8 #ifndef COMPONENTS_CPP_UTILS_BLEREMOTECHARACTERISTIC_H_
9 #define COMPONENTS_CPP_UTILS_BLEREMOTECHARACTERISTIC_H_
10 #include "sdkconfig.h"
11 #if defined(CONFIG_BT_ENABLED)
15 #include <esp_gattc_api.h>
17 #include "BLERemoteService.h"
18 #include "BLERemoteDescriptor.h"
20 #include "BLEAddress.h"
23 class BLERemoteService;
24 class BLERemoteDescriptor;
25 typedef void (*notify_callback)(BLERemoteCharacteristic* pBLERemoteCharacteristic, uint8_t* pData,
size_t length,
bool isNotify);
30 class BLERemoteCharacteristic {
32 ~BLERemoteCharacteristic();
40 bool canWriteNoResponse();
41 BLERemoteDescriptor* getDescriptor(BLEUUID uuid);
42 std::map<std::string, BLERemoteDescriptor*>* getDescriptors();
45 std::string readValue();
47 uint16_t readUInt16();
48 uint32_t readUInt32();
49 void registerForNotify(notify_callback _callback,
bool notifications =
true);
50 void writeValue(uint8_t* data,
size_t length,
bool response =
false);
51 void writeValue(std::string newValue,
bool response =
false);
52 void writeValue(uint8_t newValue,
bool response =
false);
53 std::string toString();
54 uint8_t* readRawData();
55 BLEAddress getRemoteAddress();
58 BLERemoteCharacteristic(uint16_t handle, BLEUUID uuid, esp_gatt_char_prop_t charProp, BLERemoteService* pRemoteService);
59 friend class BLEClient;
60 friend class BLERemoteService;
61 friend class BLERemoteDescriptor;
64 void gattClientEventHandler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t* evtParam);
66 BLERemoteService* getRemoteService();
67 void removeDescriptors();
68 void retrieveDescriptors();
72 esp_gatt_char_prop_t m_charProp;
74 BLERemoteService* m_pRemoteService;
80 notify_callback m_notifyCallback;
83 std::map<std::string, BLERemoteDescriptor*> m_descriptorMap;
Definition: FreeRTOS.h:31