diff options
author | Neil Kolban <kolban1@kolban.com> | 2018-01-17 18:16:31 -0600 |
---|---|---|
committer | Neil Kolban <kolban1@kolban.com> | 2018-01-17 18:16:31 -0600 |
commit | 3f5005c383540d07dd16ac044c78d7be28d4aa8e (patch) | |
tree | c5236ddbe5c8dd99ad7083dd498110152ad0e9be /src/BLERemoteService.h | |
parent | Removal of unneeded file (diff) | |
download | thermostat-3f5005c383540d07dd16ac044c78d7be28d4aa8e.tar.gz thermostat-3f5005c383540d07dd16ac044c78d7be28d4aa8e.tar.bz2 thermostat-3f5005c383540d07dd16ac044c78d7be28d4aa8e.zip |
0.4.8
Diffstat (limited to 'src/BLERemoteService.h')
-rw-r--r-- | src/BLERemoteService.h | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/BLERemoteService.h b/src/BLERemoteService.h index 521effc..222c6e4 100644 --- a/src/BLERemoteService.h +++ b/src/BLERemoteService.h @@ -30,15 +30,17 @@ public: virtual ~BLERemoteService(); // Public methods - BLERemoteCharacteristic* getCharacteristic(const char* uuid); - BLERemoteCharacteristic* getCharacteristic(BLEUUID uuid); - BLERemoteCharacteristic* getCharacteristic(uint16_t uuid); - std::map<BLERemoteCharacteristic*, std::string>* getCharacteristics(); - void getCharacteristics(std::map<uint16_t, BLERemoteCharacteristic*>* ptr); - - BLEClient* getClient(void); - uint16_t getHandle(); - BLEUUID getUUID(void); + BLERemoteCharacteristic* getCharacteristic(const char* uuid); // Get the specified characteristic reference. + BLERemoteCharacteristic* getCharacteristic(BLEUUID uuid); // Get the specified characteristic reference. + BLERemoteCharacteristic* getCharacteristic(uint16_t uuid); // Get the specified characteristic reference. + std::map<std::string, BLERemoteCharacteristic*>* getCharacteristics(); + void getCharacteristics(std::map<uint16_t, BLERemoteCharacteristic*>* pCharacteristicMap); // Get the characteristics map. + + BLEClient* getClient(void); // Get a reference to the client associated with this service. + uint16_t getHandle(); // Get the handle of this service. + BLEUUID getUUID(void); // Get the UUID of this service. + std::string getValue(BLEUUID characteristicUuid); // Get the value of a characteristic. + void setValue(BLEUUID characteristicUuid, std::string value); // Set the value of a characteristic. std::string toString(void); private: @@ -50,20 +52,23 @@ private: friend class BLERemoteCharacteristic; // Private methods - void retrieveCharacteristics(void); + void retrieveCharacteristics(void); // Retrieve the characteristics from the BLE Server. esp_gatt_id_t* getSrvcId(void); - uint16_t getStartHandle(); - uint16_t getEndHandle(); + uint16_t getStartHandle(); // Get the start handle for this service. + uint16_t getEndHandle(); // Get the end handle for this service. + void gattClientEventHandler( esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t* evtParam); + void removeCharacteristics(); // Properties // We maintain a map of characteristics owned by this service keyed by a string representation of the UUID. - std::map<BLERemoteCharacteristic *, std::string> m_characteristicMap; + std::map<std::string, BLERemoteCharacteristic *> m_characteristicMap; + // We maintain a map of characteristics owned by this service keyed by a handle. std::map<uint16_t, BLERemoteCharacteristic *> m_characteristicMapByHandle; @@ -71,9 +76,9 @@ private: BLEClient* m_pClient; FreeRTOS::Semaphore m_semaphoreGetCharEvt = FreeRTOS::Semaphore("GetCharEvt"); esp_gatt_id_t m_srvcId; - BLEUUID m_uuid; - uint16_t m_startHandle; - uint16_t m_endHandle; + BLEUUID m_uuid; // The UUID of this service. + uint16_t m_startHandle; // The starting handle of this service. + uint16_t m_endHandle; // The ending handle of this service. }; // BLERemoteService #endif /* CONFIG_BT_ENABLED */ |