Skip to content

Commit c64b754

Browse files
committed
Make Acknowledge messages handled the same as for Broadcast
This is testing for Heart rate implementation
1 parent 24d805b commit c64b754

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/Profiles/Environment/Display/ANTPLUS_ProfileEnvironmentDisplay.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@ ProfileEnvironmentDisplay::ProfileEnvironmentDisplay(uint16_t deviceNumber, uint
1616

1717
void ProfileEnvironmentDisplay::onBroadcastData(BroadcastData& msg) {
1818
EnvironmentBaseDataPage dp = EnvironmentBaseDataPage(msg);
19+
BaseProfile::onBroadcastData(msg);
20+
if(!handleDataPage(dp)) {
21+
callOnOtherDataPage(msg);
22+
}
23+
}
24+
25+
bool ProfileEnvironmentDisplay::handleDataPage(EnvironmentBaseDataPage& dp) {
1926
uint8_t dataPage = dp.getDataPageNumber();
2027
bool called = false;
2128

22-
BaseProfile::onBroadcastData(msg);
23-
2429
switch (dataPage) {
2530
case ANTPLUS_ENVIRONMENT_DATAPAGE_GENERALINFORMATION_NUMBER:
2631
called = handleGeneralInformation(dp);
@@ -36,14 +41,15 @@ void ProfileEnvironmentDisplay::onBroadcastData(BroadcastData& msg) {
3641
called = handleProductInformation(dp);
3742
break;
3843
}
39-
40-
if (!called) {
41-
callOnOtherDataPage(msg);
42-
}
44+
return called;
4345
}
4446

4547
void ProfileEnvironmentDisplay::onAcknowledgedData(AcknowledgedData& msg) {
46-
// TODO
48+
EnvironmentBaseDataPage dp = EnvironmentBaseDataPage(msg);
49+
BaseProfile::onAcknowledgedData(msg);
50+
if(!handleDataPage(dp)) {
51+
callOnOtherDataPage(msg);
52+
}
4753
}
4854

4955
void ProfileEnvironmentDisplay::setChannelConfig() {

src/Profiles/Environment/Display/ANTPLUS_ProfileEnvironmentDisplay.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class ProfileEnvironmentDisplay : public BaseSlaveProfile {
2222
void onBroadcastData(BroadcastData& msg);
2323
void onAcknowledgedData(AcknowledgedData& msg);
2424

25+
bool handleDataPage(EnvironmentBaseDataPage& dp);
26+
2527
bool handleGeneralInformation(EnvironmentBaseDataPage& dataPage);
2628
bool handleTemperature(EnvironmentBaseDataPage& dataPage);
2729
bool handleManufacturersInformation(EnvironmentBaseDataPage& dataPage);

0 commit comments

Comments
 (0)