My Project
 All Classes Functions Variables Pages
BLERemoteDescriptor.h
1 /*
2  * BLERemoteDescriptor.h
3  *
4  * Created on: Jul 8, 2017
5  * Author: kolban
6  */
7 
8 #ifndef COMPONENTS_CPP_UTILS_BLEREMOTEDESCRIPTOR_H_
9 #define COMPONENTS_CPP_UTILS_BLEREMOTEDESCRIPTOR_H_
10 #include "sdkconfig.h"
11 #if defined(CONFIG_BT_ENABLED)
12 #include <string>
13 
14 #include <esp_gattc_api.h>
15 
16 #include "BLERemoteCharacteristic.h"
17 #include "BLEUUID.h"
18 #include "FreeRTOS.h"
19 
20 class BLERemoteCharacteristic;
24 class BLERemoteDescriptor {
25 public:
26  uint16_t getHandle();
27  BLERemoteCharacteristic* getRemoteCharacteristic();
28  BLEUUID getUUID();
29  std::string readValue(void);
30  uint8_t readUInt8(void);
31  uint16_t readUInt16(void);
32  uint32_t readUInt32(void);
33  std::string toString(void);
34  void writeValue(uint8_t* data, size_t length, bool response = false);
35  void writeValue(std::string newValue, bool response = false);
36  void writeValue(uint8_t newValue, bool response = false);
37 
38 
39 private:
40  friend class BLERemoteCharacteristic;
41  BLERemoteDescriptor(
42  uint16_t handle,
43  BLEUUID uuid,
44  BLERemoteCharacteristic* pRemoteCharacteristic
45  );
46  uint16_t m_handle; // Server handle of this descriptor.
47  BLEUUID m_uuid; // UUID of this descriptor.
48  std::string m_value; // Last received value of the descriptor.
49  BLERemoteCharacteristic* m_pRemoteCharacteristic; // Reference to the Remote characteristic of which this descriptor is associated.
50  FreeRTOS::Semaphore m_semaphoreReadDescrEvt = FreeRTOS::Semaphore("ReadDescrEvt");
51 
52 
53 };
54 #endif /* CONFIG_BT_ENABLED */
55 #endif /* COMPONENTS_CPP_UTILS_BLEREMOTEDESCRIPTOR_H_ */
Definition: FreeRTOS.h:31