From 032fad094c6411ad3ff4321ad61ceed95d7dc4ff Mon Sep 17 00:00:00 2001 From: JF Date: Sat, 25 Apr 2020 15:52:00 +0200 Subject: NimbleController : CTS & ANS are now working together (even if the code is not as good as I would like). --- src/Components/Ble/CurrentTimeClient.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/Components/Ble/CurrentTimeClient.h') diff --git a/src/Components/Ble/CurrentTimeClient.h b/src/Components/Ble/CurrentTimeClient.h index 43deadcc..2278ef15 100644 --- a/src/Components/Ble/CurrentTimeClient.h +++ b/src/Components/Ble/CurrentTimeClient.h @@ -6,12 +6,6 @@ namespace Pinetime { namespace Controllers { - int CurrentTimeDiscoveryEventCallback(uint16_t conn_handle, const struct ble_gatt_error *error, - const struct ble_gatt_svc *service, void *arg); - int CurrentTimeCharacteristicDiscoveredCallback(uint16_t conn_handle, const struct ble_gatt_error *error, - const struct ble_gatt_chr *chr, void *arg); - int CurrentTimeReadCallback(uint16_t conn_handle, const struct ble_gatt_error *error, - struct ble_gatt_attr *attr, void *arg); class CurrentTimeClient { public: @@ -21,9 +15,12 @@ namespace Pinetime { 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); - - - void StartDiscovery(uint16_t connectionHandle); + bool IsDiscovered() const; + uint16_t StartHandle() const; + uint16_t EndHandle() const; + uint16_t CurrentTimeHandle() const; + static constexpr const ble_uuid16_t* Uuid() { return &CurrentTimeClient::ctsServiceUuid; } + static constexpr const ble_uuid16_t* CurrentTimeCharacteristicUuid() { return &CurrentTimeClient::currentTimeCharacteristicUuid; } private: typedef struct __attribute__((packed)) { uint16_t year; @@ -48,7 +45,11 @@ namespace Pinetime { .value = currentTimeCharacteristicId }; + uint16_t currentTimeHandle; DateTime& dateTimeController; + bool isDiscovered = false; + uint16_t ctsStartHandle; + uint16_t ctsEndHandle; }; } } \ No newline at end of file -- cgit v1.2.3-70-g09d2