diff options
author | kolban <kolban1@kolban.com> | 2017-10-13 10:52:17 -0500 |
---|---|---|
committer | kolban <kolban1@kolban.com> | 2017-10-13 10:52:17 -0500 |
commit | 34902f4e7fc6926a005a5ccfd4e530d6a6321613 (patch) | |
tree | 512593068ed656012ee31fced9526bff80ecad55 /src/BLERemoteService.h | |
parent | Merge pull request #5 from sebastiankliem/master (diff) | |
download | thermostat-34902f4e7fc6926a005a5ccfd4e530d6a6321613.tar.gz thermostat-34902f4e7fc6926a005a5ccfd4e530d6a6321613.tar.bz2 thermostat-34902f4e7fc6926a005a5ccfd4e530d6a6321613.zip |
Sync update for 0.4.3 take 2
Diffstat (limited to 'src/BLERemoteService.h')
-rw-r--r-- | src/BLERemoteService.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/BLERemoteService.h b/src/BLERemoteService.h index 4393fbc..2007fa2 100644 --- a/src/BLERemoteService.h +++ b/src/BLERemoteService.h @@ -26,24 +26,32 @@ class BLERemoteCharacteristic; */ class BLERemoteService { public: - BLERemoteService(esp_gatt_srvc_id_t srvcId, BLEClient* pClient); + virtual ~BLERemoteService(); // Public methods BLERemoteCharacteristic* getCharacteristic(const char* uuid); BLERemoteCharacteristic* getCharacteristic(BLEUUID uuid); - void getCharacteristics(void); + std::map<std::string, BLERemoteCharacteristic*>* getCharacteristics(); + BLEClient* getClient(void); + uint16_t getHandle(); BLEUUID getUUID(void); std::string toString(void); private: + // Private constructor ... never meant to be created by a user application. + BLERemoteService(esp_gatt_id_t srvcId, BLEClient* pClient, uint16_t startHandle, uint16_t endHandle); + // Friends friend class BLEClient; friend class BLERemoteCharacteristic; // Private methods - esp_gatt_srvc_id_t* getSrvcId(void); + void retrieveCharacteristics(void); + esp_gatt_id_t* getSrvcId(void); + uint16_t getStartHandle(); + uint16_t getEndHandle(); void gattClientEventHandler( esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, @@ -51,12 +59,17 @@ private: void removeCharacteristics(); // Properties + + // We maintain a map of characteristics owned by this service keyed by a string representation of the UUID. std::map<std::string, BLERemoteCharacteristic *> m_characteristicMap; + bool m_haveCharacteristics; // Have we previously obtained the characteristics. BLEClient* m_pClient; FreeRTOS::Semaphore m_semaphoreGetCharEvt = FreeRTOS::Semaphore("GetCharEvt"); - esp_gatt_srvc_id_t m_srvcId; + esp_gatt_id_t m_srvcId; BLEUUID m_uuid; + uint16_t m_startHandle; + uint16_t m_endHandle; }; // BLERemoteService #endif /* CONFIG_BT_ENABLED */ |