From f90f2254f55086589d1d378d35a54085e2620cb6 Mon Sep 17 00:00:00 2001 From: JF Date: Wed, 28 Oct 2020 18:23:09 +0100 Subject: Reset BLE services on disconnect, do not start advertising if a connection is already established. --- src/components/ble/CurrentTimeClient.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/components/ble/CurrentTimeClient.h') diff --git a/src/components/ble/CurrentTimeClient.h b/src/components/ble/CurrentTimeClient.h index 639ec831..fcc124c2 100644 --- a/src/components/ble/CurrentTimeClient.h +++ b/src/components/ble/CurrentTimeClient.h @@ -12,11 +12,13 @@ namespace Pinetime { public: explicit CurrentTimeClient(DateTime& dateTimeController); void Init(); + void Reset(); 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); bool IsDiscovered() const; + bool IsCharacteristicDiscovered() const; uint16_t StartHandle() const; uint16_t EndHandle() const; uint16_t CurrentTimeHandle() const; @@ -46,11 +48,14 @@ namespace Pinetime { .value = currentTimeCharacteristicId }; - uint16_t currentTimeHandle; DateTime& dateTimeController; bool isDiscovered = false; uint16_t ctsStartHandle; uint16_t ctsEndHandle; + + bool isCharacteristicDiscovered = false; + uint16_t currentTimeHandle; + }; } } \ No newline at end of file -- cgit v1.2.3-70-g09d2