Skip to content

Commit 6b95fd8

Browse files
Set navigation service id is base UUID macro
Avoids the need to copy the same ID into every characteristic UUID genereated from it.
1 parent 54ccd2c commit 6b95fd8

2 files changed

Lines changed: 1 addition & 13 deletions

File tree

src/components/ble/NavigationService.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,17 @@ int NAVCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_acce
2626
}
2727

2828
Pinetime::Controllers::NavigationService::NavigationService(Pinetime::System::SystemTask& system) : m_system(system) {
29-
navUuid.value[14] = navId[0];
30-
navUuid.value[15] = navId[1];
31-
3229
navFlagCharUuid.value[12] = navFlagCharId[0];
3330
navFlagCharUuid.value[13] = navFlagCharId[1];
34-
navFlagCharUuid.value[14] = navId[0];
35-
navFlagCharUuid.value[15] = navId[1];
3631

3732
navNarrativeCharUuid.value[12] = navNarrativeCharId[0];
3833
navNarrativeCharUuid.value[13] = navNarrativeCharId[1];
39-
navNarrativeCharUuid.value[14] = navId[0];
40-
navNarrativeCharUuid.value[15] = navId[1];
4134

4235
navManDistCharUuid.value[12] = navManDistCharId[0];
4336
navManDistCharUuid.value[13] = navManDistCharId[1];
44-
navManDistCharUuid.value[14] = navId[0];
45-
navManDistCharUuid.value[15] = navId[1];
4637

4738
navProgressCharUuid.value[12] = navProgressCharId[0];
4839
navProgressCharUuid.value[13] = navProgressCharId[1];
49-
navProgressCharUuid.value[14] = navId[0];
50-
navProgressCharUuid.value[15] = navId[1];
5140

5241
characteristicDefinition[0] = {
5342
.uuid = (ble_uuid_t*) (&navFlagCharUuid), .access_cb = NAVCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ};

src/components/ble/NavigationService.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
// 00010000-78fc-48fe-8e23-433b3a1942d0
3030
#define NAVIGATION_SERVICE_UUID_BASE \
31-
{ 0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x00, 0x00, 0x00, 0x00 }
31+
{ 0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x00, 0x00, 0x01, 0x00 }
3232

3333
namespace Pinetime {
3434
namespace System {
@@ -53,7 +53,6 @@ namespace Pinetime {
5353
int getProgress();
5454

5555
private:
56-
static constexpr uint8_t navId[2] = {0x01, 0x00};
5756
static constexpr uint8_t navFlagCharId[2] = {0x01, 0x00};
5857
static constexpr uint8_t navNarrativeCharId[2] = {0x02, 0x00};
5958
static constexpr uint8_t navManDistCharId[2] = {0x03, 0x00};

0 commit comments

Comments
 (0)