aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ble/CurrentTimeClient.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/ble/CurrentTimeClient.h')
-rw-r--r--src/components/ble/CurrentTimeClient.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/components/ble/CurrentTimeClient.h b/src/components/ble/CurrentTimeClient.h
index 9e48be79..0a3a8735 100644
--- a/src/components/ble/CurrentTimeClient.h
+++ b/src/components/ble/CurrentTimeClient.h
@@ -19,24 +19,29 @@ namespace Pinetime {
bool OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_svc* service);
int OnCharacteristicDiscoveryEvent(uint16_t conn_handle, const ble_gatt_error* error, const ble_gatt_chr* characteristic);
int OnCurrentTimeReadResult(uint16_t conn_handle, const ble_gatt_error* error, const ble_gatt_attr* attribute);
+
static constexpr const ble_uuid16_t* Uuid() {
return &CurrentTimeClient::ctsServiceUuid;
}
+
static constexpr const ble_uuid16_t* CurrentTimeCharacteristicUuid() {
return &CurrentTimeClient::currentTimeCharacteristicUuid;
}
+
void Discover(uint16_t connectionHandle, std::function<void(uint16_t)> lambda) override;
private:
typedef struct __attribute__((packed)) {
- uint16_t year;
+ uint8_t year_LSO; // explicit byte ordering to be independent of machine order
+ uint8_t year_MSO; // BLE GATT is little endian
uint8_t month;
uint8_t dayofmonth;
uint8_t hour;
uint8_t minute;
uint8_t second;
- uint8_t millis;
- uint8_t reason;
+ uint8_t dayofweek;
+ uint8_t fractions256; // currently ignored
+ uint8_t reason; // currently ignored, not that any host would set it anyway
} CtsData;
static constexpr uint16_t ctsServiceId {0x1805};
@@ -55,4 +60,4 @@ namespace Pinetime {
std::function<void(uint16_t)> onServiceDiscovered;
};
}
-} \ No newline at end of file
+}