File tree Expand file tree Collapse file tree 2 files changed +48
-4
lines changed Expand file tree Collapse file tree 2 files changed +48
-4
lines changed Original file line number Diff line number Diff line change @@ -88,4 +88,43 @@ void BaseProfile::onChannelIdResponse(ChannelIdResponse& msg) {
88
88
setDeviceNumber (msg.getDeviceNumber ());
89
89
setTransmissionType (msg.getTransmissionType ());
90
90
_onChannelIdResponse.call (msg);
91
+ }
92
+
93
+ void BaseProfile::onAcknowledgedData (AcknowledgedData& msg) {
94
+ checkProfileStatus ();
95
+ _onDataPage.call (msg);
96
+ }
97
+
98
+ void BaseProfile::onAdvancedBurstData (AdvancedBurstData& msg) {
99
+ checkProfileStatus ();
100
+ _onDataPage.call (msg);
101
+ }
102
+
103
+ void BaseProfile::onBroadcastData (BroadcastData& msg) {
104
+ checkProfileStatus ();
105
+ _onDataPage.call (msg);
106
+ }
107
+
108
+ void BaseProfile::onBurstTransferData (BurstTransferData& msg) {
109
+ checkProfileStatus ();
110
+ _onDataPage.call (msg);
111
+ }
112
+
113
+ void BaseProfile::checkProfileStatus () {
114
+ if (!getDeviceNumber () || !getTransmissionType ()) {
115
+ RequestMessage rm = RequestMessage (CHANNEL_ID, _channel);
116
+ send (rm);
117
+ }
118
+ }
119
+
120
+ void BaseProfile::send (AntRequest& msg) {
121
+ _router->send (msg);
122
+ }
123
+
124
+ uint8_t BaseProfile::getTransmissionType () {
125
+ return _transmissionType;
126
+ }
127
+
128
+ uint16_t BaseProfile::getDeviceNumber () {
129
+ return _deviceNumber;
91
130
}
Original file line number Diff line number Diff line change @@ -60,14 +60,18 @@ class BaseProfile {
60
60
* Close radio channel and stop transmitting
61
61
*/
62
62
virtual void stop () = 0;
63
+ /* *
64
+ * Sends a message through the connected router
65
+ */
66
+ void send (AntRequest& msg);
63
67
64
68
/* *****************************************
65
69
*LIBRARY INTERNAL ONLY FUNCTIONS BELOW
66
70
******************************************/
67
- virtual void onAcknowledgedData (AcknowledgedData& msg) { _onDataPage. call (msg); }
68
- virtual void onAdvancedBurstData (AdvancedBurstData& msg) { _onDataPage. call (msg); }
69
- virtual void onBroadcastData (BroadcastData& msg) { _onDataPage. call (msg); }
70
- virtual void onBurstTransferData (BurstTransferData& msg) { _onDataPage. call (msg); }
71
+ virtual void onAcknowledgedData (AcknowledgedData& msg);
72
+ virtual void onAdvancedBurstData (AdvancedBurstData& msg);
73
+ virtual void onBroadcastData (BroadcastData& msg);
74
+ virtual void onBurstTransferData (BurstTransferData& msg);
71
75
virtual void onChannelEventResponse (ChannelEventResponse& msg);
72
76
virtual void onChannelIdResponse (ChannelIdResponse& msg);
73
77
void setRouter (AntPlusRouter* router);
@@ -87,6 +91,7 @@ class BaseProfile {
87
91
void openChannel ();
88
92
void closeChannel ();
89
93
private:
94
+ void checkProfileStatus ();
90
95
AntPlusRouter* _router;
91
96
Callback<AntRxDataResponse&> _onDataPage;
92
97
Callback<AntRxDataResponse&> _onOtherDataPage;
You can’t perform that action at this time.
0 commit comments