Skip to content

Commit 03a8f5a

Browse files
committed
Add better support for channelEventResponse
1 parent 13b69e2 commit 03a8f5a

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/ANTPLUS_PrivateDefines.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@
1212

1313
#define ANTPLUS_PAIRING_BIT_MASK 0x80
1414

15+
#define ANTPLUS_CHANNELEVENT_MESSAGECODE 1
16+
1517
#endif // ANTPLUS_PRIVATEDEFINES_h

src/BaseClasses/ANTPLUS_BaseProfile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class BaseProfile {
2121
*/
2222
void onOtherDataPage(void (*func)(AntRxDataResponse&, uintptr_t), uintptr_t data = 0) { _onOtherDataPage.set(func, data); }
2323
/**
24-
* Callback when an even on the radio occurs
24+
* Callback when an event on this channel occurs
2525
*/
2626
void onChannelEvent(void (*func)(ChannelEventResponse&, uintptr_t), uintptr_t data = 0) { _onChannelEvent.set(func, data); }
2727
// TODO on channel config change callback (used for when wildcarding to identify when actual information has been found)

src/MainClasses/ANTPLUS_AntPlusRouter.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <MainClasses/ANTPLUS_AntPlusRouter.h>
22
#include <MainClasses/ANTPLUS_CallbackWorkAround.h>
3+
#include <ANTPLUS_PrivateDefines.h>
34

45
AntPlusRouter::AntPlusRouter() {
56
// TODO
@@ -139,7 +140,14 @@ void AntPlusRouter::onCapabilities(Capabilities& msg) {
139140
}
140141

141142
void AntPlusRouter::onChannelEventResponse(ChannelEventResponse& msg) {
142-
// TODO
143+
if (msg.getMsgId() == ANTPLUS_CHANNELEVENT_MESSAGECODE) {
144+
uint8_t channel = msg.getChannelNumber();
145+
if (_profiles[channel]) {
146+
_profiles[channel]->onChannelEventResponse(msg);
147+
}
148+
} else {
149+
// TODO
150+
}
143151
}
144152

145153
void AntPlusRouter::onChannelIdResponse(ChannelIdResponse& msg) {

0 commit comments

Comments
 (0)