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/BLERemoteDescriptor.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/BLERemoteDescriptor.h')
-rw-r--r-- | src/BLERemoteDescriptor.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/BLERemoteDescriptor.h b/src/BLERemoteDescriptor.h index a8d944d..c2cf383 100644 --- a/src/BLERemoteDescriptor.h +++ b/src/BLERemoteDescriptor.h @@ -9,12 +9,47 @@ #define COMPONENTS_CPP_UTILS_BLEREMOTEDESCRIPTOR_H_ #include "sdkconfig.h" #if defined(CONFIG_BT_ENABLED) +#include <string> +#include <esp_gattc_api.h> + +#include "BLERemoteCharacteristic.h" +#include "BLEUUID.h" +#include "FreeRTOS.h" + +class BLERemoteCharacteristic; /** * @brief A model of remote %BLE descriptor. */ class BLERemoteDescriptor { public: + uint16_t getHandle(); + BLEUUID getUUID(); + std::string readValue(void); + uint8_t readUInt8(void); + uint16_t readUInt16(void); + uint32_t readUInt32(void); + std::string toString(void); + //void registerForNotify(void (*notifyCallback)(BLERemoteCharacteristic *pBLERemoteCharacteristic, uint8_t *pData, size_t length, bool isNotify)); + void writeValue(uint8_t* data, size_t length, bool response = false); + void writeValue(std::string newValue, bool response = false); + void writeValue(uint8_t newValue, bool response = false); + + +private: + friend class BLERemoteCharacteristic; + BLERemoteDescriptor( + uint16_t handle, + BLEUUID uuid, + BLERemoteCharacteristic* pRemoteCharacteristic + ); + uint16_t m_handle; // Server handle of this descriptor. + BLEUUID m_uuid; // UUID of this descriptor. + std::string m_value; // Last received value of the descriptor. + BLERemoteCharacteristic* m_pRemoteCharacteristic; // Reference to the Remote characteristic of which this descriptor is associated. + FreeRTOS::Semaphore m_semaphoreReadDescrEvt = FreeRTOS::Semaphore("ReadDescrEvt"); + + }; #endif /* CONFIG_BT_ENABLED */ #endif /* COMPONENTS_CPP_UTILS_BLEREMOTEDESCRIPTOR_H_ */ |