summaryrefslogtreecommitdiff
path: root/src/Components/Ble/CurrentTimeClient.h
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-04-25 15:52:00 +0200
committerJF <jf@codingfield.com>2020-04-25 15:52:00 +0200
commit032fad094c6411ad3ff4321ad61ceed95d7dc4ff (patch)
tree53a9341ba2e93491e025ab54299ccd7241c504c6 /src/Components/Ble/CurrentTimeClient.h
parent5fcb90a14951ec70a8ec41a656f6f58358b9986b (diff)
NimbleController : CTS & ANS are now working together (even if the code is not as good as I would like).
Diffstat (limited to 'src/Components/Ble/CurrentTimeClient.h')
-rw-r--r--src/Components/Ble/CurrentTimeClient.h19
1 files changed, 10 insertions, 9 deletions
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