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) {
8888 setDeviceNumber (msg.getDeviceNumber ());
8989 setTransmissionType (msg.getTransmissionType ());
9090 _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;
91130}
Original file line number Diff line number Diff line change @@ -60,14 +60,18 @@ class BaseProfile {
6060 * Close radio channel and stop transmitting
6161 */
6262 virtual void stop () = 0;
63+ /* *
64+ * Sends a message through the connected router
65+ */
66+ void send (AntRequest& msg);
6367
6468 /* *****************************************
6569 *LIBRARY INTERNAL ONLY FUNCTIONS BELOW
6670 ******************************************/
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);
7175 virtual void onChannelEventResponse (ChannelEventResponse& msg);
7276 virtual void onChannelIdResponse (ChannelIdResponse& msg);
7377 void setRouter (AntPlusRouter* router);
@@ -87,6 +91,7 @@ class BaseProfile {
8791 void openChannel ();
8892 void closeChannel ();
8993private:
94+ void checkProfileStatus ();
9095 AntPlusRouter* _router;
9196 Callback<AntRxDataResponse&> _onDataPage;
9297 Callback<AntRxDataResponse&> _onOtherDataPage;
You can’t perform that action at this time.
0 commit comments