From a116f0d0c01c911e9783b077cc0a44f3ff06d6dc Mon Sep 17 00:00:00 2001 From: h2zero Date: Sun, 31 Jul 2022 11:38:16 -0600 Subject: [PATCH] Release v1.4.0 --- _h_i_d_keyboard_types_8h_source.html | 4 +- _h_i_d_types_8h_source.html | 4 +- _nim_b_l_e2904_8h_source.html | 8 +- _nim_b_l_e_address_8h_source.html | 8 +- _nim_b_l_e_advertised_device_8h_source.html | 173 ++- _nim_b_l_e_advertising_8h_source.html | 314 ++--- _nim_b_l_e_att_value_8h_source.html | 465 +++++++ _nim_b_l_e_beacon_8h_source.html | 4 +- _nim_b_l_e_characteristic_8h_source.html | 324 +++-- _nim_b_l_e_client_8h_source.html | 289 ++-- _nim_b_l_e_conn_info_8h_source.html | 8 +- _nim_b_l_e_descriptor_8h_source.html | 187 +-- _nim_b_l_e_device_8h_source.html | 467 ++++--- _nim_b_l_e_eddystone_t_l_m_8h_source.html | 14 +- _nim_b_l_e_eddystone_u_r_l_8h_source.html | 6 +- _nim_b_l_e_ext_advertising_8h_source.html | 282 ++++ _nim_b_l_e_h_i_d_device_8h_source.html | 10 +- _nim_b_l_e_log_8h_source.html | 4 +- ...b_l_e_remote_characteristic_8h_source.html | 314 +++-- _nim_b_l_e_remote_descriptor_8h_source.html | 114 +- _nim_b_l_e_remote_service_8h_source.html | 24 +- _nim_b_l_e_scan_8h_source.html | 48 +- _nim_b_l_e_security_8h_source.html | 6 +- _nim_b_l_e_server_8h_source.html | 273 ++-- _nim_b_l_e_service_8h_source.html | 94 +- _nim_b_l_e_u_u_i_d_8h_source.html | 38 +- _nim_b_l_e_utils_8h_source.html | 6 +- annotated.html | 54 +- annotated_dup.js | 4 + class_nim_b_l_e2904-members.html | 31 +- class_nim_b_l_e2904.html | 37 +- class_nim_b_l_e_address-members.html | 2 +- class_nim_b_l_e_address.html | 8 +- ...s_nim_b_l_e_advertised_device-members.html | 26 +- class_nim_b_l_e_advertised_device.html | 201 ++- class_nim_b_l_e_advertised_device.js | 12 +- ...e_advertised_device_callbacks-members.html | 2 +- ...nim_b_l_e_advertised_device_callbacks.html | 2 +- ..._nim_b_l_e_advertisement_data-members.html | 2 +- class_nim_b_l_e_advertisement_data.html | 2 +- class_nim_b_l_e_advertising-members.html | 4 +- class_nim_b_l_e_advertising.html | 29 +- class_nim_b_l_e_advertising.js | 2 +- class_nim_b_l_e_att_value-members.html | 135 ++ class_nim_b_l_e_att_value.html | 811 +++++++++++ class_nim_b_l_e_att_value.js | 37 + class_nim_b_l_e_beacon-members.html | 2 +- class_nim_b_l_e_beacon.html | 2 +- class_nim_b_l_e_characteristic-members.html | 35 +- class_nim_b_l_e_characteristic.html | 413 ++++-- class_nim_b_l_e_characteristic.js | 19 +- ..._l_e_characteristic_callbacks-members.html | 2 +- class_nim_b_l_e_characteristic_callbacks.html | 2 +- class_nim_b_l_e_characteristic_callbacks.js | 4 +- class_nim_b_l_e_client-members.html | 25 +- class_nim_b_l_e_client.html | 134 +- class_nim_b_l_e_client.js | 13 +- class_nim_b_l_e_client_callbacks-members.html | 2 +- class_nim_b_l_e_client_callbacks.html | 4 +- class_nim_b_l_e_conn_info-members.html | 2 +- class_nim_b_l_e_conn_info.html | 2 +- class_nim_b_l_e_descriptor-members.html | 21 +- class_nim_b_l_e_descriptor.html | 223 ++- class_nim_b_l_e_descriptor.js | 5 +- ...im_b_l_e_descriptor_callbacks-members.html | 2 +- class_nim_b_l_e_descriptor_callbacks.html | 2 +- class_nim_b_l_e_device-members.html | 13 +- class_nim_b_l_e_device.html | 141 +- class_nim_b_l_e_eddystone_t_l_m-members.html | 2 +- class_nim_b_l_e_eddystone_t_l_m.html | 30 +- class_nim_b_l_e_eddystone_u_r_l-members.html | 2 +- class_nim_b_l_e_eddystone_u_r_l.html | 6 +- ...s_nim_b_l_e_ext_advertisement-members.html | 137 ++ class_nim_b_l_e_ext_advertisement.html | 1226 +++++++++++++++++ class_nim_b_l_e_ext_advertisement.js | 39 + class_nim_b_l_e_ext_advertising-members.html | 113 ++ class_nim_b_l_e_ext_advertising.html | 448 ++++++ class_nim_b_l_e_ext_advertising.js | 15 + ...l_e_ext_advertising_callbacks-members.html | 103 ++ ...s_nim_b_l_e_ext_advertising_callbacks.html | 223 +++ class_nim_b_l_e_ext_advertising_callbacks.js | 5 + class_nim_b_l_e_h_i_d_device-members.html | 2 +- class_nim_b_l_e_h_i_d_device.html | 6 +- ...m_b_l_e_remote_characteristic-members.html | 14 +- class_nim_b_l_e_remote_characteristic.html | 250 ++-- class_nim_b_l_e_remote_characteristic.js | 12 +- ...s_nim_b_l_e_remote_descriptor-members.html | 8 +- class_nim_b_l_e_remote_descriptor.html | 168 ++- class_nim_b_l_e_remote_descriptor.js | 6 +- class_nim_b_l_e_remote_service-members.html | 2 +- class_nim_b_l_e_remote_service.html | 2 +- class_nim_b_l_e_scan-members.html | 2 +- class_nim_b_l_e_scan.html | 6 +- class_nim_b_l_e_scan_results-members.html | 2 +- class_nim_b_l_e_scan_results.html | 2 +- class_nim_b_l_e_security-members.html | 2 +- class_nim_b_l_e_security.html | 8 +- ..._nim_b_l_e_security_callbacks-members.html | 2 +- class_nim_b_l_e_security_callbacks.html | 2 +- class_nim_b_l_e_server-members.html | 9 +- class_nim_b_l_e_server.html | 111 +- class_nim_b_l_e_server.js | 5 +- class_nim_b_l_e_server_callbacks-members.html | 2 +- class_nim_b_l_e_server_callbacks.html | 6 +- class_nim_b_l_e_service-members.html | 6 +- class_nim_b_l_e_service.html | 40 +- class_nim_b_l_e_service.js | 4 +- class_nim_b_l_e_u_u_i_d-members.html | 5 +- class_nim_b_l_e_u_u_i_d.html | 35 +- class_nim_b_l_e_u_u_i_d.js | 1 + class_nim_b_l_e_utils-members.html | 2 +- class_nim_b_l_e_utils.html | 2 +- classes.html | 4 +- deprecated.html | 16 +- dir_68267d1309a1af8e8297ef4c3efbcdba.html | 4 +- dir_68267d1309a1af8e8297ef4c3efbcdba.js | 2 + files.html | 44 +- functions.html | 7 +- functions_b.html | 5 +- functions_c.html | 17 +- functions_d.html | 7 +- functions_dup.js | 1 + functions_e.html | 8 +- functions_enum.html | 2 +- functions_f.html | 2 +- functions_func.html | 7 +- functions_func.js | 1 + functions_func_b.html | 5 +- functions_func_c.html | 17 +- functions_func_d.html | 7 +- functions_func_e.html | 8 +- functions_func_f.html | 2 +- functions_func_g.html | 32 +- functions_func_h.html | 2 +- functions_func_i.html | 12 +- functions_func_l.html | 101 ++ functions_func_m.html | 5 +- functions_func_n.html | 13 +- functions_func_o.html | 26 +- functions_func_p.html | 2 +- functions_func_r.html | 12 +- functions_func_s.html | 83 +- functions_func_t.html | 5 +- functions_func_u.html | 4 +- functions_func_w.html | 2 +- functions_func_~.html | 8 +- functions_g.html | 32 +- functions_h.html | 2 +- functions_i.html | 12 +- functions_l.html | 101 ++ functions_m.html | 5 +- functions_n.html | 13 +- functions_o.html | 26 +- functions_p.html | 2 +- functions_r.html | 12 +- functions_s.html | 83 +- functions_t.html | 5 +- functions_u.html | 4 +- functions_w.html | 2 +- functions_~.html | 8 +- globals.html | 8 +- globals_defs.html | 8 +- hierarchy.html | 56 +- hierarchy.js | 4 + index.html | 47 +- md__bluetooth_5_features.html | 119 ++ md__command_line_config.html | 258 ---- md__improvements_and_updates.html | 119 +- ...nts_esp_nimble_cpp__c_h_a_n_g_e_l_o_g.html | 104 +- md__migration_guide.html | 351 ++--- md__new_user_guide.html | 28 +- md__usage_tips.html | 20 +- menudata.js | 2 + navtreedata.js | 151 +- navtreeindex0.js | 326 ++--- navtreeindex1.js | 500 +++---- navtreeindex2.js | 327 +++-- nimconfig_8h.html | 20 +- nimconfig_8h.js | 2 + nimconfig_8h_source.html | 87 +- pages.html | 6 +- search/all_0.js | 6 +- search/all_1.js | 9 +- search/all_10.js | 7 +- search/all_11.js | 6 +- search/all_12.js | 7 +- search/all_13.html | 37 + search/all_13.js | 9 + search/all_2.js | 77 +- search/all_3.js | 33 +- search/all_4.js | 7 +- search/all_5.js | 4 +- search/all_6.js | 199 +-- search/all_7.js | 28 +- search/all_8.js | 31 +- search/all_9.js | 3 +- search/all_a.js | 36 +- search/all_b.js | 59 +- search/all_c.js | 31 +- search/all_d.js | 16 +- search/all_e.js | 97 +- search/all_f.js | 98 +- search/classes_0.js | 64 +- search/defines_0.js | 42 +- search/enums_0.js | 2 +- search/files_0.js | 2 +- search/functions_0.js | 21 +- search/functions_1.js | 12 +- search/functions_10.js | 5 +- search/functions_11.js | 5 +- search/functions_12.js | 7 +- search/functions_13.html | 37 + search/functions_13.js | 9 + search/functions_2.js | 33 +- search/functions_3.js | 31 +- search/functions_4.js | 7 +- search/functions_5.js | 4 +- search/functions_6.js | 199 +-- search/functions_7.js | 28 +- search/functions_8.js | 29 +- search/functions_9.js | 2 +- search/functions_a.js | 14 +- search/functions_b.js | 36 +- search/functions_c.js | 30 +- search/functions_d.js | 16 +- search/functions_e.js | 96 +- search/functions_f.js | 96 +- search/pages_0.js | 2 +- search/pages_1.js | 2 +- search/pages_2.js | 2 +- search/pages_3.js | 2 +- search/pages_4.js | 2 +- search/pages_5.js | 2 +- search/pages_6.js | 2 +- search/pages_7.js | 2 +- search/pages_8.js | 2 +- search/searchdata.js | 6 +- todo.html | 2 +- 238 files changed, 9929 insertions(+), 4077 deletions(-) create mode 100644 _nim_b_l_e_att_value_8h_source.html create mode 100644 _nim_b_l_e_ext_advertising_8h_source.html create mode 100644 class_nim_b_l_e_att_value-members.html create mode 100644 class_nim_b_l_e_att_value.html create mode 100644 class_nim_b_l_e_att_value.js create mode 100644 class_nim_b_l_e_ext_advertisement-members.html create mode 100644 class_nim_b_l_e_ext_advertisement.html create mode 100644 class_nim_b_l_e_ext_advertisement.js create mode 100644 class_nim_b_l_e_ext_advertising-members.html create mode 100644 class_nim_b_l_e_ext_advertising.html create mode 100644 class_nim_b_l_e_ext_advertising.js create mode 100644 class_nim_b_l_e_ext_advertising_callbacks-members.html create mode 100644 class_nim_b_l_e_ext_advertising_callbacks.html create mode 100644 class_nim_b_l_e_ext_advertising_callbacks.js create mode 100644 functions_func_l.html create mode 100644 functions_l.html create mode 100644 md__bluetooth_5_features.html delete mode 100644 md__command_line_config.html rename md__k___users__ryan__desktop_thermo_git_components_esp_nimble_cpp__c_h_a_n_g_e_l_o_g.html => md__k___users__ryan__desktop_test_idf_components_esp_nimble_cpp__c_h_a_n_g_e_l_o_g.html (87%) create mode 100644 search/all_13.html create mode 100644 search/all_13.js create mode 100644 search/functions_13.html create mode 100644 search/functions_13.js diff --git a/_h_i_d_keyboard_types_8h_source.html b/_h_i_d_keyboard_types_8h_source.html index 60361c3..cd5fb39 100644 --- a/_h_i_d_keyboard_types_8h_source.html +++ b/_h_i_d_keyboard_types_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/HIDKeyboardTypes.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/HIDKeyboardTypes.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
diff --git a/_h_i_d_types_8h_source.html b/_h_i_d_types_8h_source.html index 2954560..dfe4099 100644 --- a/_h_i_d_types_8h_source.html +++ b/_h_i_d_types_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/HIDTypes.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/HIDTypes.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
diff --git a/_nim_b_l_e2904_8h_source.html b/_nim_b_l_e2904_8h_source.html index c00b2bd..592a073 100644 --- a/_nim_b_l_e2904_8h_source.html +++ b/_nim_b_l_e2904_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLE2904.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLE2904.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -167,8 +167,8 @@ $(document).ready(function(){initNavTree('_nim_b_l_e2904_8h_source.html',''); in
void setExponent(int8_t exponent)
Set the exponent.
Definition: NimBLE2904.cpp:52
void setFormat(uint8_t format)
Set the format.
Definition: NimBLE2904.cpp:61
void setUnit(uint16_t unit)
Set the units for this value. It should be one of the encoded values defined here: https://www....
Definition: NimBLE2904.cpp:81
-
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:62
-
A model of a BLE descriptor.
Definition: NimBLEDescriptor.h:42
+
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:63
+
A model of a BLE descriptor.
Definition: NimBLEDescriptor.h:35
diff --git a/_nim_b_l_e_address_8h_source.html b/_nim_b_l_e_address_8h_source.html index fcdba0a..e2839e8 100644 --- a/_nim_b_l_e_address_8h_source.html +++ b/_nim_b_l_e_address_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLEAddress.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEAddress.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -147,10 +147,10 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_address_8h_source.html','')
uint8_t getType() const
Get the address type.
Definition: NimBLEAddress.cpp:136
NimBLEAddress()
Create a blank address, i.e. 00:00:00:00:00:00, type 0.
Definition: NimBLEAddress.cpp:43
bool equals(const NimBLEAddress &otherAddress) const
Determine if this address equals another.
Definition: NimBLEAddress.cpp:118
-
bool operator==(const NimBLEAddress &rhs) const
Convienience operator to check if this address is equal to another.
Definition: NimBLEAddress.cpp:161
+
bool operator==(const NimBLEAddress &rhs) const
Convenience operator to check if this address is equal to another.
Definition: NimBLEAddress.cpp:161
std::string toString() const
Convert a BLE address to a string.
Definition: NimBLEAddress.cpp:153
const uint8_t * getNative() const
Get the native representation of the address.
Definition: NimBLEAddress.cpp:127
-
bool operator!=(const NimBLEAddress &rhs) const
Convienience operator to check if this address is not equal to another.
Definition: NimBLEAddress.cpp:169
+
bool operator!=(const NimBLEAddress &rhs) const
Convenience operator to check if this address is not equal to another.
Definition: NimBLEAddress.cpp:169
diff --git a/_nim_b_l_e_advertised_device_8h_source.html b/_nim_b_l_e_advertised_device_8h_source.html index 3e9885b..528d009 100644 --- a/_nim_b_l_e_advertised_device_8h_source.html +++ b/_nim_b_l_e_advertised_device_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLEAdvertisedDevice.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEAdvertisedDevice.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -145,7 +145,7 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_advertised_device_8h_source
71  std::string getName();
72  int getRSSI();
73  NimBLEScan* getScan();
-
74  size_t getServiceDataCount();
+
74  uint8_t getServiceDataCount();
75  std::string getServiceData(uint8_t index = 0);
76  std::string getServiceData(const NimBLEUUID &uuid);
77 
@@ -167,9 +167,9 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_advertised_device_8h_source
111 
112  NimBLEUUID getServiceDataUUID(uint8_t index = 0);
113  NimBLEUUID getServiceUUID(uint8_t index = 0);
-
114  size_t getServiceUUIDCount();
+
114  uint8_t getServiceUUIDCount();
115  NimBLEAddress getTargetAddress(uint8_t index = 0);
-
116  size_t getTargetAddressCount();
+
116  uint8_t getTargetAddressCount();
117  int8_t getTXPower();
118  uint8_t* getPayload();
119  uint8_t getAdvLength();
@@ -189,80 +189,107 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_advertised_device_8h_source
133  bool haveTargetAddress();
134  bool haveURI();
135  std::string toString();
-
136 
-
137 private:
-
138  friend class NimBLEScan;
-
139 
-
140  void setAddress(NimBLEAddress address);
-
141  void setAdvType(uint8_t advType);
-
142  void setPayload(const uint8_t *payload, uint8_t length, bool append);
-
143  void setRSSI(int rssi);
-
144  uint8_t findAdvField(uint8_t type, uint8_t index = 0, uint8_t *data_loc = nullptr);
-
145  uint8_t findServiceData(uint8_t index, uint8_t* bytes);
-
146 
-
147  NimBLEAddress m_address = NimBLEAddress("");
-
148  uint8_t m_advType;
-
149  int m_rssi;
-
150  time_t m_timestamp;
-
151  bool m_callbackSent;
-
152  uint8_t m_advLength;
-
153 
-
154  std::vector<uint8_t> m_payload;
-
155 };
-
156 
-
164 class NimBLEAdvertisedDeviceCallbacks {
-
165 public:
-
166  virtual ~NimBLEAdvertisedDeviceCallbacks() {}
-
173  virtual void onResult(NimBLEAdvertisedDevice* advertisedDevice) = 0;
-
174 };
-
175 
-
176 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER */
-
177 #endif /* COMPONENTS_NIMBLEADVERTISEDDEVICE_H_ */
+
136  bool isConnectable();
+
137  bool isLegacyAdvertisement();
+
138 #if CONFIG_BT_NIMBLE_EXT_ADV
+
139  uint8_t getSetId();
+
140  uint8_t getPrimaryPhy();
+
141  uint8_t getSecondaryPhy();
+
142  uint16_t getPeriodicInterval();
+
143 #endif
+
144 
+
145 private:
+
146  friend class NimBLEScan;
+
147 
+
148  void setAddress(NimBLEAddress address);
+
149  void setAdvType(uint8_t advType, bool isLegacyAdv);
+
150  void setPayload(const uint8_t *payload, uint8_t length, bool append);
+
151  void setRSSI(int rssi);
+
152 #if CONFIG_BT_NIMBLE_EXT_ADV
+
153  void setSetId(uint8_t sid) { m_sid = sid; }
+
154  void setPrimaryPhy(uint8_t phy) { m_primPhy = phy; }
+
155  void setSecondaryPhy(uint8_t phy) { m_secPhy = phy; }
+
156  void setPeriodicInterval(uint16_t itvl) { m_periodicItvl = itvl; }
+
157 #endif
+
158  uint8_t findAdvField(uint8_t type, uint8_t index = 0, size_t * data_loc = nullptr);
+
159  size_t findServiceData(uint8_t index, uint8_t* bytes);
+
160 
+
161  NimBLEAddress m_address = NimBLEAddress("");
+
162  uint8_t m_advType;
+
163  int m_rssi;
+
164  time_t m_timestamp;
+
165  bool m_callbackSent;
+
166  uint8_t m_advLength;
+
167 #if CONFIG_BT_NIMBLE_EXT_ADV
+
168  bool m_isLegacyAdv;
+
169  uint8_t m_sid;
+
170  uint8_t m_primPhy;
+
171  uint8_t m_secPhy;
+
172  uint16_t m_periodicItvl;
+
173 #endif
+
174 
+
175  std::vector<uint8_t> m_payload;
+
176 };
+
177 
+
185 class NimBLEAdvertisedDeviceCallbacks {
+
186 public:
+
187  virtual ~NimBLEAdvertisedDeviceCallbacks() {}
+
194  virtual void onResult(NimBLEAdvertisedDevice* advertisedDevice) = 0;
+
195 };
+
196 
+
197 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER */
+
198 #endif /* COMPONENTS_NIMBLEADVERTISEDDEVICE_H_ */
A BLE device address.
Definition: NimBLEAddress.h:39
-
A callback handler for callbacks associated device scanning.
Definition: NimBLEAdvertisedDevice.h:164
+
A callback handler for callbacks associated device scanning.
Definition: NimBLEAdvertisedDevice.h:185
virtual void onResult(NimBLEAdvertisedDevice *advertisedDevice)=0
Called when a new scan result is detected.
A representation of a BLE advertised device found by a scan.
Definition: NimBLEAdvertisedDevice.h:42
-
bool haveTargetAddress()
Does the advertisement contain a target address?
Definition: NimBLEAdvertisedDevice.cpp:532
-
time_t getTimestamp()
Get the timeStamp of when the device last advertised.
Definition: NimBLEAdvertisedDevice.cpp:771
-
uint16_t getAppearance()
Get the appearance.
Definition: NimBLEAdvertisedDevice.cpp:71
-
bool haveConnParams()
Does this advertisement have preferred connection parameters?
Definition: NimBLEAdvertisedDevice.cpp:487
-
uint16_t getMinInterval()
Get the preferred min connection interval.
Definition: NimBLEAdvertisedDevice.cpp:107
-
bool isAdvertisingService(const NimBLEUUID &uuid)
Check advertised services for existance of the required UUID.
Definition: NimBLEAdvertisedDevice.cpp:453
-
uint16_t getMaxInterval()
Get the preferred max connection interval.
Definition: NimBLEAdvertisedDevice.cpp:125
-
NimBLEUUID getServiceDataUUID(uint8_t index=0)
Get the UUID of the serice data at the index.
Definition: NimBLEAdvertisedDevice.cpp:313
-
NimBLEAddress getTargetAddress(uint8_t index=0)
Get the target address at the index.
Definition: NimBLEAdvertisedDevice.cpp:232
-
bool haveServiceUUID()
Does this advertisement have a service UUID value?
Definition: NimBLEAdvertisedDevice.cpp:570
-
size_t getServiceDataCount()
Get the count of advertised service data UUIDS.
Definition: NimBLEAdvertisedDevice.cpp:369
-
bool haveRSSI()
Does this advertisement have a signal strength value?
Definition: NimBLEAdvertisedDevice.cpp:552
-
size_t getServiceUUIDCount()
Get the number of services advertised.
Definition: NimBLEAdvertisedDevice.cpp:434
-
bool haveURI()
Does this advertisement have a URI?
Definition: NimBLEAdvertisedDevice.cpp:523
-
bool haveName()
Does this advertisement have a name value?
Definition: NimBLEAdvertisedDevice.cpp:542
+
bool haveTargetAddress()
Does the advertisement contain a target address?
Definition: NimBLEAdvertisedDevice.cpp:534
+
uint8_t getServiceDataCount()
Get the count of advertised service data UUIDS.
Definition: NimBLEAdvertisedDevice.cpp:371
+
time_t getTimestamp()
Get the timeStamp of when the device last advertised.
Definition: NimBLEAdvertisedDevice.cpp:821
+
uint8_t getSecondaryPhy()
Get the primary PHY used by this advertisement.
Definition: NimBLEAdvertisedDevice.cpp:614
+
uint16_t getAppearance()
Get the appearance.
Definition: NimBLEAdvertisedDevice.cpp:73
+
bool haveConnParams()
Does this advertisement have preferred connection parameters?
Definition: NimBLEAdvertisedDevice.cpp:489
+
uint16_t getMinInterval()
Get the preferred min connection interval.
Definition: NimBLEAdvertisedDevice.cpp:109
+
bool isLegacyAdvertisement()
Check if this advertisement is a legacy or extended type.
Definition: NimBLEAdvertisedDevice.cpp:855
+
bool isAdvertisingService(const NimBLEUUID &uuid)
Check advertised services for existence of the required UUID.
Definition: NimBLEAdvertisedDevice.cpp:455
+
uint16_t getMaxInterval()
Get the preferred max connection interval.
Definition: NimBLEAdvertisedDevice.cpp:127
+
NimBLEUUID getServiceDataUUID(uint8_t index=0)
Get the UUID of the service data at the index.
Definition: NimBLEAdvertisedDevice.cpp:315
+
bool isConnectable()
Check if this device is advertising as connectable.
Definition: NimBLEAdvertisedDevice.cpp:839
+
NimBLEAddress getTargetAddress(uint8_t index=0)
Get the target address at the index.
Definition: NimBLEAdvertisedDevice.cpp:234
+
bool haveServiceUUID()
Does this advertisement have a service UUID value?
Definition: NimBLEAdvertisedDevice.cpp:572
+
uint8_t getServiceUUIDCount()
Get the number of services advertised.
Definition: NimBLEAdvertisedDevice.cpp:436
+
bool haveRSSI()
Does this advertisement have a signal strength value?
Definition: NimBLEAdvertisedDevice.cpp:554
+
uint8_t getSetId()
Get the set ID of the extended advertisement.
Definition: NimBLEAdvertisedDevice.cpp:591
+
bool haveURI()
Does this advertisement have a URI?
Definition: NimBLEAdvertisedDevice.cpp:525
+
bool haveName()
Does this advertisement have a name value?
Definition: NimBLEAdvertisedDevice.cpp:544
T getServiceData(uint8_t index=0, bool skipSizeCheck=false)
A template to convert the service data to <type>.
Definition: NimBLEAdvertisedDevice.h:88
-
size_t getTargetAddressCount()
Get the number of target addresses.
Definition: NimBLEAdvertisedDevice.cpp:217
-
uint16_t getAdvInterval()
Get the advertisement interval.
Definition: NimBLEAdvertisedDevice.cpp:89
+
uint16_t getAdvInterval()
Get the advertisement interval.
Definition: NimBLEAdvertisedDevice.cpp:91
+
uint8_t getPrimaryPhy()
Get the primary PHY used by this advertisement.
Definition: NimBLEAdvertisedDevice.cpp:602
T getServiceData(const NimBLEUUID &uuid, bool skipSizeCheck=false)
A template to convert the service data to <type>.
Definition: NimBLEAdvertisedDevice.h:105
-
uint8_t getAdvType()
Get the advertisement type.
Definition: NimBLEAdvertisedDevice.cpp:58
-
NimBLEAddress getAddress()
Get the address of the advertising device.
Definition: NimBLEAdvertisedDevice.cpp:44
-
bool haveAdvInterval()
Does this advertisement have have the advertising interval?
Definition: NimBLEAdvertisedDevice.cpp:496
-
NimBLEUUID getServiceUUID(uint8_t index=0)
Get the Service UUID.
Definition: NimBLEAdvertisedDevice.cpp:385
-
NimBLEAdvertisedDevice()
Constructor.
Definition: NimBLEAdvertisedDevice.cpp:29
-
bool haveManufacturerData()
Does this advertisement have manufacturer data?
Definition: NimBLEAdvertisedDevice.cpp:514
-
std::string toString()
Create a string representation of this device.
Definition: NimBLEAdvertisedDevice.cpp:678
-
size_t getPayloadLength()
Get the length of the payload advertised by the device.
Definition: NimBLEAdvertisedDevice.cpp:780
-
bool haveAppearance()
Does this advertisement have an appearance value?
Definition: NimBLEAdvertisedDevice.cpp:505
-
int getRSSI()
Get the RSSI.
Definition: NimBLEAdvertisedDevice.cpp:199
-
NimBLEScan * getScan()
Get the scan object that created this advertised device.
Definition: NimBLEAdvertisedDevice.cpp:208
-
std::string getURI()
Get the URI from the advertisement.
Definition: NimBLEAdvertisedDevice.cpp:161
-
std::string getName()
Get the advertised name.
Definition: NimBLEAdvertisedDevice.cpp:179
-
uint8_t getAdvLength()
Get the length of the advertisement data in the payload.
Definition: NimBLEAdvertisedDevice.cpp:749
+
uint8_t getAdvType()
Get the advertisement type.
Definition: NimBLEAdvertisedDevice.cpp:60
+
NimBLEAddress getAddress()
Get the address of the advertising device.
Definition: NimBLEAdvertisedDevice.cpp:46
+
bool haveAdvInterval()
Does this advertisement have have the advertising interval?
Definition: NimBLEAdvertisedDevice.cpp:498
+
NimBLEUUID getServiceUUID(uint8_t index=0)
Get the Service UUID.
Definition: NimBLEAdvertisedDevice.cpp:387
+
NimBLEAdvertisedDevice()
Constructor.
Definition: NimBLEAdvertisedDevice.cpp:31
+
bool haveManufacturerData()
Does this advertisement have manufacturer data?
Definition: NimBLEAdvertisedDevice.cpp:516
+
std::string toString()
Create a string representation of this device.
Definition: NimBLEAdvertisedDevice.cpp:728
+
size_t getPayloadLength()
Get the length of the payload advertised by the device.
Definition: NimBLEAdvertisedDevice.cpp:830
+
bool haveAppearance()
Does this advertisement have an appearance value?
Definition: NimBLEAdvertisedDevice.cpp:507
+
int getRSSI()
Get the RSSI.
Definition: NimBLEAdvertisedDevice.cpp:201
+
NimBLEScan * getScan()
Get the scan object that created this advertised device.
Definition: NimBLEAdvertisedDevice.cpp:210
+
std::string getURI()
Get the URI from the advertisement.
Definition: NimBLEAdvertisedDevice.cpp:163
+
uint16_t getPeriodicInterval()
Get the periodic interval of the advertisement.
Definition: NimBLEAdvertisedDevice.cpp:623
+
uint8_t getTargetAddressCount()
Get the number of target addresses.
Definition: NimBLEAdvertisedDevice.cpp:219
+
std::string getName()
Get the advertised name.
Definition: NimBLEAdvertisedDevice.cpp:181
+
uint8_t getAdvLength()
Get the length of the advertisement data in the payload.
Definition: NimBLEAdvertisedDevice.cpp:799
T getManufacturerData(bool skipSizeCheck=false)
A template to convert the service data to <type>.
Definition: NimBLEAdvertisedDevice.h:64
-
std::string getServiceData(uint8_t index=0)
Get the service data.
Definition: NimBLEAdvertisedDevice.cpp:264
-
bool haveTXPower()
Does this advertisement have a transmission power value?
Definition: NimBLEAdvertisedDevice.cpp:579
-
std::string getManufacturerData()
Get the manufacturer data.
Definition: NimBLEAdvertisedDevice.cpp:143
-
uint8_t * getPayload()
Get the payload advertised by the device.
Definition: NimBLEAdvertisedDevice.cpp:724
-
bool haveServiceData()
Does this advertisement have a service data value?
Definition: NimBLEAdvertisedDevice.cpp:561
-
uint8_t getAddressType()
Get the advertised device address type.
Definition: NimBLEAdvertisedDevice.cpp:762
-
int8_t getTXPower()
Get the TX Power.
Definition: NimBLEAdvertisedDevice.cpp:469
+
std::string getServiceData(uint8_t index=0)
Get the service data.
Definition: NimBLEAdvertisedDevice.cpp:266
+
bool haveTXPower()
Does this advertisement have a transmission power value?
Definition: NimBLEAdvertisedDevice.cpp:581
+
std::string getManufacturerData()
Get the manufacturer data.
Definition: NimBLEAdvertisedDevice.cpp:145
+
uint8_t * getPayload()
Get the payload advertised by the device.
Definition: NimBLEAdvertisedDevice.cpp:774
+
bool haveServiceData()
Does this advertisement have a service data value?
Definition: NimBLEAdvertisedDevice.cpp:563
+
uint8_t getAddressType()
Get the advertised device address type.
Definition: NimBLEAdvertisedDevice.cpp:812
+
int8_t getTXPower()
Get the TX Power.
Definition: NimBLEAdvertisedDevice.cpp:471
Perform and manage BLE scans.
Definition: NimBLEScan.h:63
A model of a BLE UUID.
Definition: NimBLEUUID.h:37
diff --git a/_nim_b_l_e_advertising_8h_source.html b/_nim_b_l_e_advertising_8h_source.html index f9dbde3..756f519 100644 --- a/_nim_b_l_e_advertising_8h_source.html +++ b/_nim_b_l_e_advertising_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLEAdvertising.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEAdvertising.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -103,162 +103,166 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_advertising_8h_source.html'
15 #ifndef MAIN_BLEADVERTISING_H_
16 #define MAIN_BLEADVERTISING_H_
17 #include "nimconfig.h"
-
18 #if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
-
19 
-
20 #if defined(CONFIG_NIMBLE_CPP_IDF)
-
21 #include "host/ble_gap.h"
-
22 #else
-
23 #include "nimble/nimble/host/include/host/ble_gap.h"
-
24 #endif
-
25 
-
26 /**** FIX COMPILATION ****/
-
27 #undef min
-
28 #undef max
-
29 /**************************/
-
30 
-
31 #include "NimBLEUUID.h"
+
18 #if (defined(CONFIG_BT_ENABLED) && \
+
19  defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && \
+
20  !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
+
21 
+
22 #if defined(CONFIG_NIMBLE_CPP_IDF)
+
23 #include "host/ble_gap.h"
+
24 #else
+
25 #include "nimble/nimble/host/include/host/ble_gap.h"
+
26 #endif
+
27 
+
28 /**** FIX COMPILATION ****/
+
29 #undef min
+
30 #undef max
+
31 /**************************/
32 
-
33 #include <vector>
+
33 #include "NimBLEUUID.h"
34 
-
35 /* COMPATIBILITY - DO NOT USE */
-
36 #define ESP_BLE_ADV_FLAG_LIMIT_DISC (0x01 << 0)
-
37 #define ESP_BLE_ADV_FLAG_GEN_DISC (0x01 << 1)
-
38 #define ESP_BLE_ADV_FLAG_BREDR_NOT_SPT (0x01 << 2)
-
39 #define ESP_BLE_ADV_FLAG_DMT_CONTROLLER_SPT (0x01 << 3)
-
40 #define ESP_BLE_ADV_FLAG_DMT_HOST_SPT (0x01 << 4)
-
41 #define ESP_BLE_ADV_FLAG_NON_LIMIT_DISC (0x00 )
-
42  /* ************************* */
-
43 
-
44 
-
48 class NimBLEAdvertisementData {
-
49  // Only a subset of the possible BLE architected advertisement fields are currently exposed. Others will
-
50  // be exposed on demand/request or as time permits.
-
51  //
-
52 public:
-
53  void setAppearance(uint16_t appearance);
-
54  void setCompleteServices(const NimBLEUUID &uuid);
-
55  void setCompleteServices16(const std::vector<NimBLEUUID> &v_uuid);
-
56  void setCompleteServices32(const std::vector<NimBLEUUID> &v_uuid);
-
57  void setFlags(uint8_t);
-
58  void setManufacturerData(const std::string &data);
-
59  void setURI(const std::string &uri);
-
60  void setName(const std::string &name);
-
61  void setPartialServices(const NimBLEUUID &uuid);
-
62  void setPartialServices16(const std::vector<NimBLEUUID> &v_uuid);
-
63  void setPartialServices32(const std::vector<NimBLEUUID> &v_uuid);
-
64  void setServiceData(const NimBLEUUID &uuid, const std::string &data);
-
65  void setShortName(const std::string &name);
-
66  void addData(const std::string &data); // Add data to the payload.
-
67  void addData(char * data, size_t length);
-
68  void addTxPower();
-
69  void setPreferredParams(uint16_t min, uint16_t max);
-
70  std::string getPayload(); // Retrieve the current advert payload.
-
71 
-
72 private:
-
73  friend class NimBLEAdvertising;
-
74  void setServices(const bool complete, const uint8_t size,
-
75  const std::vector<NimBLEUUID> &v_uuid);
-
76  std::string m_payload; // The payload of the advertisement.
-
77 }; // NimBLEAdvertisementData
-
78 
-
79 
-
85 class NimBLEAdvertising {
-
86 public:
-
87  NimBLEAdvertising();
-
88  void addServiceUUID(const NimBLEUUID &serviceUUID);
-
89  void addServiceUUID(const char* serviceUUID);
-
90  void removeServiceUUID(const NimBLEUUID &serviceUUID);
-
91  bool start(uint32_t duration = 0, void (*advCompleteCB)(NimBLEAdvertising *pAdv) = nullptr);
-
92  void stop();
-
93  void setAppearance(uint16_t appearance);
-
94  void setName(const std::string &name);
-
95  void setManufacturerData(const std::string &data);
-
96  void setURI(const std::string &uri);
-
97  void setServiceData(const NimBLEUUID &uuid, const std::string &data);
-
98  void setAdvertisementType(uint8_t adv_type);
-
99  void setMaxInterval(uint16_t maxinterval);
-
100  void setMinInterval(uint16_t mininterval);
-
101  void setAdvertisementData(NimBLEAdvertisementData& advertisementData);
-
102  void setScanFilter(bool scanRequestWhitelistOnly, bool connectWhitelistOnly);
-
103  void setScanResponseData(NimBLEAdvertisementData& advertisementData);
-
104  void setScanResponse(bool);
-
105  void setMinPreferred(uint16_t);
-
106  void setMaxPreferred(uint16_t);
-
107  void addTxPower();
-
108  void reset();
-
109  void advCompleteCB();
-
110  bool isAdvertising();
-
111 
-
112 private:
-
113  friend class NimBLEDevice;
-
114 
-
115  void onHostSync();
-
116  static int handleGapEvent(struct ble_gap_event *event, void *arg);
+
35 #include <vector>
+
36 
+
37 /* COMPATIBILITY - DO NOT USE */
+
38 #define ESP_BLE_ADV_FLAG_LIMIT_DISC (0x01 << 0)
+
39 #define ESP_BLE_ADV_FLAG_GEN_DISC (0x01 << 1)
+
40 #define ESP_BLE_ADV_FLAG_BREDR_NOT_SPT (0x01 << 2)
+
41 #define ESP_BLE_ADV_FLAG_DMT_CONTROLLER_SPT (0x01 << 3)
+
42 #define ESP_BLE_ADV_FLAG_DMT_HOST_SPT (0x01 << 4)
+
43 #define ESP_BLE_ADV_FLAG_NON_LIMIT_DISC (0x00 )
+
44  /* ************************* */
+
45 
+
46 
+
50 class NimBLEAdvertisementData {
+
51  // Only a subset of the possible BLE architected advertisement fields are currently exposed. Others will
+
52  // be exposed on demand/request or as time permits.
+
53  //
+
54 public:
+
55  void setAppearance(uint16_t appearance);
+
56  void setCompleteServices(const NimBLEUUID &uuid);
+
57  void setCompleteServices16(const std::vector<NimBLEUUID> &v_uuid);
+
58  void setCompleteServices32(const std::vector<NimBLEUUID> &v_uuid);
+
59  void setFlags(uint8_t);
+
60  void setManufacturerData(const std::string &data);
+
61  void setURI(const std::string &uri);
+
62  void setName(const std::string &name);
+
63  void setPartialServices(const NimBLEUUID &uuid);
+
64  void setPartialServices16(const std::vector<NimBLEUUID> &v_uuid);
+
65  void setPartialServices32(const std::vector<NimBLEUUID> &v_uuid);
+
66  void setServiceData(const NimBLEUUID &uuid, const std::string &data);
+
67  void setShortName(const std::string &name);
+
68  void addData(const std::string &data); // Add data to the payload.
+
69  void addData(char * data, size_t length);
+
70  void addTxPower();
+
71  void setPreferredParams(uint16_t min, uint16_t max);
+
72  std::string getPayload(); // Retrieve the current advert payload.
+
73 
+
74 private:
+
75  friend class NimBLEAdvertising;
+
76  void setServices(const bool complete, const uint8_t size,
+
77  const std::vector<NimBLEUUID> &v_uuid);
+
78  std::string m_payload; // The payload of the advertisement.
+
79 }; // NimBLEAdvertisementData
+
80 
+
81 
+
87 class NimBLEAdvertising {
+
88 public:
+
89  NimBLEAdvertising();
+
90  void addServiceUUID(const NimBLEUUID &serviceUUID);
+
91  void addServiceUUID(const char* serviceUUID);
+
92  void removeServiceUUID(const NimBLEUUID &serviceUUID);
+
93  bool start(uint32_t duration = 0, void (*advCompleteCB)(NimBLEAdvertising *pAdv) = nullptr);
+
94  bool stop();
+
95  void setAppearance(uint16_t appearance);
+
96  void setName(const std::string &name);
+
97  void setManufacturerData(const std::string &data);
+
98  void setURI(const std::string &uri);
+
99  void setServiceData(const NimBLEUUID &uuid, const std::string &data);
+
100  void setAdvertisementType(uint8_t adv_type);
+
101  void setMaxInterval(uint16_t maxinterval);
+
102  void setMinInterval(uint16_t mininterval);
+
103  void setAdvertisementData(NimBLEAdvertisementData& advertisementData);
+
104  void setScanFilter(bool scanRequestWhitelistOnly, bool connectWhitelistOnly);
+
105  void setScanResponseData(NimBLEAdvertisementData& advertisementData);
+
106  void setScanResponse(bool);
+
107  void setMinPreferred(uint16_t);
+
108  void setMaxPreferred(uint16_t);
+
109  void addTxPower();
+
110  void reset();
+
111  void advCompleteCB();
+
112  bool isAdvertising();
+
113 
+
114 private:
+
115  friend class NimBLEDevice;
+
116  friend class NimBLEServer;
117 
-
118  ble_hs_adv_fields m_advData;
-
119  ble_hs_adv_fields m_scanData;
-
120  ble_gap_adv_params m_advParams;
-
121  std::vector<NimBLEUUID> m_serviceUUIDs;
-
122  bool m_customAdvData;
-
123  bool m_customScanResponseData;
-
124  bool m_scanResp;
-
125  bool m_advDataSet;
-
126  void (*m_advCompCB)(NimBLEAdvertising *pAdv);
-
127  uint8_t m_slaveItvl[4];
-
128  uint32_t m_duration;
-
129  std::vector<uint8_t> m_svcData16;
-
130  std::vector<uint8_t> m_svcData32;
-
131  std::vector<uint8_t> m_svcData128;
-
132  std::vector<uint8_t> m_name;
-
133  std::vector<uint8_t> m_mfgData;
-
134  std::vector<uint8_t> m_uri;
-
135 };
-
136 
-
137 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER */
-
138 #endif /* MAIN_BLEADVERTISING_H_ */
-
Advertisement data set by the programmer to be published by the BLE server.
Definition: NimBLEAdvertising.h:48
-
void setAppearance(uint16_t appearance)
Set the appearance.
Definition: NimBLEAdvertising.cpp:776
-
void setPartialServices32(const std::vector< NimBLEUUID > &v_uuid)
Set the partial list of services to advertise.
Definition: NimBLEAdvertising.cpp:885
-
void addTxPower()
Adds Tx power level to the advertisement data.
Definition: NimBLEAdvertising.cpp:995
-
void setPartialServices16(const std::vector< NimBLEUUID > &v_uuid)
Set the partial list of services to advertise.
Definition: NimBLEAdvertising.cpp:876
-
void setCompleteServices16(const std::vector< NimBLEUUID > &v_uuid)
Set the complete list of 16 bit services to advertise.
Definition: NimBLEAdvertising.cpp:849
-
void setPreferredParams(uint16_t min, uint16_t max)
Set the preferred connection interval parameters.
Definition: NimBLEAdvertising.cpp:1009
-
void setCompleteServices(const NimBLEUUID &uuid)
Set a single service to advertise as a complete list of services.
Definition: NimBLEAdvertising.cpp:840
-
void setCompleteServices32(const std::vector< NimBLEUUID > &v_uuid)
Set the complete list of 32 bit services to advertise.
Definition: NimBLEAdvertising.cpp:858
-
void setFlags(uint8_t)
Set the advertisement flags.
Definition: NimBLEAdvertising.cpp:791
-
void setName(const std::string &name)
Set the complete name of this device.
Definition: NimBLEAdvertising.cpp:828
-
void setURI(const std::string &uri)
Set the URI to advertise.
Definition: NimBLEAdvertising.cpp:816
-
void setManufacturerData(const std::string &data)
Set manufacturer specific data.
Definition: NimBLEAdvertising.cpp:804
-
std::string getPayload()
Retrieve the payload that is to be advertised.
Definition: NimBLEAdvertising.cpp:1025
-
void setShortName(const std::string &name)
Set the short name.
Definition: NimBLEAdvertising.cpp:984
-
void addData(const std::string &data)
Add data to the payload to be advertised.
Definition: NimBLEAdvertising.cpp:750
-
void setServiceData(const NimBLEUUID &uuid, const std::string &data)
Set the service data (UUID + data)
Definition: NimBLEAdvertising.cpp:947
-
void setPartialServices(const NimBLEUUID &uuid)
Set a single service to advertise as a partial list of services.
Definition: NimBLEAdvertising.cpp:867
-
Perform and manage BLE advertising.
Definition: NimBLEAdvertising.h:85
-
void setScanResponseData(NimBLEAdvertisementData &advertisementData)
Set the advertisement data that is to be published in a scan response.
Definition: NimBLEAdvertising.cpp:370
-
void setMinInterval(uint16_t mininterval)
Set the minimum advertising interval.
Definition: NimBLEAdvertising.cpp:225
-
void setManufacturerData(const std::string &data)
Set the advertised manufacturer data.
Definition: NimBLEAdvertising.cpp:149
-
void setMaxPreferred(uint16_t)
Set the advertised max connection interval preferred by this device.
Definition: NimBLEAdvertising.cpp:277
-
void setMinPreferred(uint16_t)
Set the advertised min connection interval preferred by this device.
Definition: NimBLEAdvertising.cpp:245
-
void advCompleteCB()
Handles the callback when advertising stops.
Definition: NimBLEAdvertising.cpp:683
-
void addServiceUUID(const NimBLEUUID &serviceUUID)
Add a service uuid to exposed list of services.
Definition: NimBLEAdvertising.cpp:80
-
void reset()
Stops the current advertising and resets the advertising data to the default values.
Definition: NimBLEAdvertising.cpp:44
-
void setURI(const std::string &uri)
Set the advertised URI.
Definition: NimBLEAdvertising.cpp:161
-
void setAdvertisementType(uint8_t adv_type)
Set the type of advertisment to use.
Definition: NimBLEAdvertising.cpp:216
-
void setScanResponse(bool)
Set if scan response is available.
Definition: NimBLEAdvertising.cpp:305
-
void removeServiceUUID(const NimBLEUUID &serviceUUID)
Add a service uuid to exposed list of services.
Definition: NimBLEAdvertising.cpp:100
-
void setServiceData(const NimBLEUUID &uuid, const std::string &data)
Set the service data advertised for the UUID.
Definition: NimBLEAdvertising.cpp:175
-
void setAppearance(uint16_t appearance)
Set the device appearance in the advertising data. The codes for distinct appearances can be found he...
Definition: NimBLEAdvertising.cpp:117
-
void setScanFilter(bool scanRequestWhitelistOnly, bool connectWhitelistOnly)
Set the filtering for the scan filter.
Definition: NimBLEAdvertising.cpp:316
-
void setMaxInterval(uint16_t maxinterval)
Set the maximum advertising interval.
Definition: NimBLEAdvertising.cpp:234
-
void stop()
Stop advertising.
Definition: NimBLEAdvertising.cpp:666
-
NimBLEAdvertising()
Construct a default advertising object.
Definition: NimBLEAdvertising.cpp:36
-
bool isAdvertising()
Check if currently advertising.
Definition: NimBLEAdvertising.cpp:694
-
void addTxPower()
Add the transmission power level to the advertisement packet.
Definition: NimBLEAdvertising.cpp:127
-
void setName(const std::string &name)
Set the advertised name of the device.
Definition: NimBLEAdvertising.cpp:137
-
bool start(uint32_t duration=0, void(*advCompleteCB)(NimBLEAdvertising *pAdv)=nullptr)
Start advertising.
Definition: NimBLEAdvertising.cpp:390
-
void setAdvertisementData(NimBLEAdvertisementData &advertisementData)
Set the advertisement data that is to be published in a regular advertisement.
Definition: NimBLEAdvertising.cpp:350
-
A model of a BLE Device from which all the BLE roles are created.
Definition: NimBLEDevice.h:92
+
118  void onHostSync();
+
119  static int handleGapEvent(struct ble_gap_event *event, void *arg);
+
120 
+
121  ble_hs_adv_fields m_advData;
+
122  ble_hs_adv_fields m_scanData;
+
123  ble_gap_adv_params m_advParams;
+
124  std::vector<NimBLEUUID> m_serviceUUIDs;
+
125  bool m_customAdvData;
+
126  bool m_customScanResponseData;
+
127  bool m_scanResp;
+
128  bool m_advDataSet;
+
129  void (*m_advCompCB)(NimBLEAdvertising *pAdv);
+
130  uint8_t m_slaveItvl[4];
+
131  uint32_t m_duration;
+
132  std::vector<uint8_t> m_svcData16;
+
133  std::vector<uint8_t> m_svcData32;
+
134  std::vector<uint8_t> m_svcData128;
+
135  std::vector<uint8_t> m_name;
+
136  std::vector<uint8_t> m_mfgData;
+
137  std::vector<uint8_t> m_uri;
+
138 };
+
139 
+
140 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV */
+
141 #endif /* MAIN_BLEADVERTISING_H_ */
+
Advertisement data set by the programmer to be published by the BLE server.
Definition: NimBLEAdvertising.h:50
+
void setAppearance(uint16_t appearance)
Set the appearance.
Definition: NimBLEAdvertising.cpp:785
+
void setPartialServices32(const std::vector< NimBLEUUID > &v_uuid)
Set the partial list of services to advertise.
Definition: NimBLEAdvertising.cpp:894
+
void addTxPower()
Adds Tx power level to the advertisement data.
Definition: NimBLEAdvertising.cpp:1004
+
void setPartialServices16(const std::vector< NimBLEUUID > &v_uuid)
Set the partial list of services to advertise.
Definition: NimBLEAdvertising.cpp:885
+
void setCompleteServices16(const std::vector< NimBLEUUID > &v_uuid)
Set the complete list of 16 bit services to advertise.
Definition: NimBLEAdvertising.cpp:858
+
void setPreferredParams(uint16_t min, uint16_t max)
Set the preferred connection interval parameters.
Definition: NimBLEAdvertising.cpp:1018
+
void setCompleteServices(const NimBLEUUID &uuid)
Set a single service to advertise as a complete list of services.
Definition: NimBLEAdvertising.cpp:849
+
void setCompleteServices32(const std::vector< NimBLEUUID > &v_uuid)
Set the complete list of 32 bit services to advertise.
Definition: NimBLEAdvertising.cpp:867
+
void setFlags(uint8_t)
Set the advertisement flags.
Definition: NimBLEAdvertising.cpp:800
+
void setName(const std::string &name)
Set the complete name of this device.
Definition: NimBLEAdvertising.cpp:837
+
void setURI(const std::string &uri)
Set the URI to advertise.
Definition: NimBLEAdvertising.cpp:825
+
void setManufacturerData(const std::string &data)
Set manufacturer specific data.
Definition: NimBLEAdvertising.cpp:813
+
std::string getPayload()
Retrieve the payload that is to be advertised.
Definition: NimBLEAdvertising.cpp:1034
+
void setShortName(const std::string &name)
Set the short name.
Definition: NimBLEAdvertising.cpp:993
+
void addData(const std::string &data)
Add data to the payload to be advertised.
Definition: NimBLEAdvertising.cpp:759
+
void setServiceData(const NimBLEUUID &uuid, const std::string &data)
Set the service data (UUID + data)
Definition: NimBLEAdvertising.cpp:956
+
void setPartialServices(const NimBLEUUID &uuid)
Set a single service to advertise as a partial list of services.
Definition: NimBLEAdvertising.cpp:876
+
Perform and manage BLE advertising.
Definition: NimBLEAdvertising.h:87
+
void setScanResponseData(NimBLEAdvertisementData &advertisementData)
Set the advertisement data that is to be published in a scan response.
Definition: NimBLEAdvertising.cpp:372
+
void setMinInterval(uint16_t mininterval)
Set the minimum advertising interval.
Definition: NimBLEAdvertising.cpp:227
+
void setManufacturerData(const std::string &data)
Set the advertised manufacturer data.
Definition: NimBLEAdvertising.cpp:151
+
void setMaxPreferred(uint16_t)
Set the advertised max connection interval preferred by this device.
Definition: NimBLEAdvertising.cpp:279
+
bool stop()
Stop advertising.
Definition: NimBLEAdvertising.cpp:674
+
void setMinPreferred(uint16_t)
Set the advertised min connection interval preferred by this device.
Definition: NimBLEAdvertising.cpp:247
+
void advCompleteCB()
Handles the callback when advertising stops.
Definition: NimBLEAdvertising.cpp:692
+
void addServiceUUID(const NimBLEUUID &serviceUUID)
Add a service uuid to exposed list of services.
Definition: NimBLEAdvertising.cpp:82
+
void reset()
Stops the current advertising and resets the advertising data to the default values.
Definition: NimBLEAdvertising.cpp:46
+
void setURI(const std::string &uri)
Set the advertised URI.
Definition: NimBLEAdvertising.cpp:163
+
void setAdvertisementType(uint8_t adv_type)
Set the type of advertisment to use.
Definition: NimBLEAdvertising.cpp:218
+
void setScanResponse(bool)
Set if scan response is available.
Definition: NimBLEAdvertising.cpp:307
+
void removeServiceUUID(const NimBLEUUID &serviceUUID)
Add a service uuid to exposed list of services.
Definition: NimBLEAdvertising.cpp:102
+
void setServiceData(const NimBLEUUID &uuid, const std::string &data)
Set the service data advertised for the UUID.
Definition: NimBLEAdvertising.cpp:177
+
void setAppearance(uint16_t appearance)
Set the device appearance in the advertising data. The codes for distinct appearances can be found he...
Definition: NimBLEAdvertising.cpp:119
+
void setScanFilter(bool scanRequestWhitelistOnly, bool connectWhitelistOnly)
Set the filtering for the scan filter.
Definition: NimBLEAdvertising.cpp:318
+
void setMaxInterval(uint16_t maxinterval)
Set the maximum advertising interval.
Definition: NimBLEAdvertising.cpp:236
+
NimBLEAdvertising()
Construct a default advertising object.
Definition: NimBLEAdvertising.cpp:38
+
bool isAdvertising()
Check if currently advertising.
Definition: NimBLEAdvertising.cpp:703
+
void addTxPower()
Add the transmission power level to the advertisement packet.
Definition: NimBLEAdvertising.cpp:129
+
void setName(const std::string &name)
Set the advertised name of the device.
Definition: NimBLEAdvertising.cpp:139
+
bool start(uint32_t duration=0, void(*advCompleteCB)(NimBLEAdvertising *pAdv)=nullptr)
Start advertising.
Definition: NimBLEAdvertising.cpp:392
+
void setAdvertisementData(NimBLEAdvertisementData &advertisementData)
Set the advertisement data that is to be published in a regular advertisement.
Definition: NimBLEAdvertising.cpp:352
+
A model of a BLE Device from which all the BLE roles are created.
Definition: NimBLEDevice.h:96
+
The model of a BLE server.
Definition: NimBLEServer.h:46
A model of a BLE UUID.
Definition: NimBLEUUID.h:37
diff --git a/_nim_b_l_e_att_value_8h_source.html b/_nim_b_l_e_att_value_8h_source.html new file mode 100644 index 0000000..fa9f72e --- /dev/null +++ b/_nim_b_l_e_att_value_8h_source.html @@ -0,0 +1,465 @@ + + + + + + + +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEAttValue.h Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
esp-nimble-cpp +  1.4.0 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
NimBLEAttValue.h
+
+
+
1 /*
+
2  * NimBLEAttValue.h
+
3  *
+
4  * Created: on March 18, 2021
+
5  * Author H2zero
+
6  *
+
7  */
+
8 
+
9 #ifndef MAIN_NIMBLEATTVALUE_H_
+
10 #define MAIN_NIMBLEATTVALUE_H_
+
11 #include "nimconfig.h"
+
12 #if defined(CONFIG_BT_ENABLED)
+
13 
+
14 #ifdef NIMBLE_CPP_ARDUINO_STRING_AVAILABLE
+
15 #include <Arduino.h>
+
16 #endif
+
17 
+
18 #include "NimBLELog.h"
+
19 
+
20 /**** FIX COMPILATION ****/
+
21 #undef min
+
22 #undef max
+
23 /**************************/
+
24 
+
25 #include <string>
+
26 #include <vector>
+
27 
+
28 #ifndef CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED
+
29 # define CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED 0
+
30 #endif
+
31 
+
32 #if CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED
+
33 # include <time.h>
+
34 #endif
+
35 
+
36 #if !defined(CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH)
+
37 # define CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH 20
+
38 #elif CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH > BLE_ATT_ATTR_MAX_LEN
+
39 # error CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH cannot be larger than 512 (BLE_ATT_ATTR_MAX_LEN)
+
40 #elif CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH < 1
+
41 # error CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH cannot be less than 1; Range = 1 : 512
+
42 #endif
+
43 
+
44 
+
45 /* Used to determine if the type passed to a template has a c_str() and length() method. */
+
46 template <typename T, typename = void, typename = void>
+
47 struct Has_c_str_len : std::false_type {};
+
48 
+
49 template <typename T>
+
50 struct Has_c_str_len<T, decltype(void(std::declval<T &>().c_str())),
+
51  decltype(void(std::declval<T &>().length()))> : std::true_type {};
+
52 
+
53 
+ +
61 {
+
62  uint8_t* m_attr_value = nullptr;
+
63  uint16_t m_attr_max_len = 0;
+
64  uint16_t m_attr_len = 0;
+
65  uint16_t m_capacity = 0;
+
66 #if CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED
+
67  time_t m_timestamp = 0;
+
68 #endif
+
69  void deepCopy(const NimBLEAttValue & source);
+
70 
+
71 public:
+ +
78  uint16_t max_len = BLE_ATT_ATTR_MAX_LEN);
+
79 
+
86  NimBLEAttValue(const uint8_t *value, uint16_t len,
+
87  uint16_t max_len = BLE_ATT_ATTR_MAX_LEN);
+
88 
+
94  NimBLEAttValue(std::initializer_list<uint8_t> list,
+
95  uint16_t max_len = BLE_ATT_ATTR_MAX_LEN)
+
96  :NimBLEAttValue(list.begin(), (uint16_t)list.size(), max_len){}
+
97 
+
103  NimBLEAttValue(const char *value, uint16_t max_len = BLE_ATT_ATTR_MAX_LEN)
+
104  :NimBLEAttValue((uint8_t*)value, (uint16_t)strlen(value), max_len){}
+
105 
+
111  NimBLEAttValue(const std::string str, uint16_t max_len = BLE_ATT_ATTR_MAX_LEN)
+
112  :NimBLEAttValue((uint8_t*)str.data(), (uint16_t)str.length(), max_len){}
+
113 
+
119  NimBLEAttValue(const std::vector<uint8_t> vec, uint16_t max_len = BLE_ATT_ATTR_MAX_LEN)
+
120  :NimBLEAttValue(&vec[0], (uint16_t)vec.size(), max_len){}
+
121 
+
122 #ifdef NIMBLE_CPP_ARDUINO_STRING_AVAILABLE
+
128  NimBLEAttValue(const String str, uint16_t max_len = BLE_ATT_ATTR_MAX_LEN)
+
129  :NimBLEAttValue((uint8_t*)str.c_str(), str.length(), max_len){}
+
130 #endif
+
131 
+
133  NimBLEAttValue(const NimBLEAttValue & source) { deepCopy(source); }
+
134 
+
136  NimBLEAttValue(NimBLEAttValue && source) { *this = std::move(source); }
+
137 
+
139  ~NimBLEAttValue();
+
140 
+
142  uint16_t max_size() const { return m_attr_max_len; }
+
143 
+
145  uint16_t capacity() const { return m_capacity; }
+
146 
+
148  uint16_t length() const { return m_attr_len; }
+
149 
+
151  uint16_t size() const { return m_attr_len; }
+
152 
+
154  const uint8_t* data() const { return m_attr_value; }
+
155 
+
157  const char* c_str() const { return (const char*)m_attr_value; }
+
158 
+
160  const uint8_t* begin() const { return m_attr_value; }
+
161 
+
163  const uint8_t* end() const { return m_attr_value + m_attr_len; }
+
164 
+
165 #if CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED
+
167  time_t getTimeStamp() const { return m_timestamp; }
+
168 
+
170  void setTimeStamp() { m_timestamp = time(nullptr); }
+
171 
+
176  void setTimeStamp(time_t t) { m_timestamp = t; }
+
177 #else
+
178  time_t getTimeStamp() const { return 0; }
+
179  void setTimeStamp() { }
+
180  void setTimeStamp(time_t t) { }
+
181 #endif
+
182 
+
189  bool setValue(const uint8_t *value, uint16_t len);
+
190 
+
195  bool setValue(const char* s) {
+
196  return setValue((uint8_t*)s, (uint16_t)strlen(s)); }
+
197 
+
203  const uint8_t* getValue(time_t *timestamp);
+
204 
+
211  NimBLEAttValue& append(const uint8_t *value, uint16_t len);
+
212 
+
213 
+
214  /*********************** Template Functions ************************/
+
215 
+
221  template<typename T>
+
222 #ifdef _DOXYGEN_
+
223  bool
+
224 #else
+
225  typename std::enable_if<!Has_c_str_len<T>::value, bool>::type
+
226 #endif
+
227  setValue(const T &s) {
+
228  return setValue((uint8_t*)&s, sizeof(T));
+
229  }
+
230 
+
236  template<typename T>
+
237 #ifdef _DOXYGEN_
+
238  bool
+
239 #else
+
240  typename std::enable_if<Has_c_str_len<T>::value, bool>::type
+
241 #endif
+
242  setValue(const T & s) {
+
243  return setValue((uint8_t*)s.c_str(), (uint16_t)s.length());
+
244  }
+
245 
+
256  template<typename T>
+
257  T getValue(time_t *timestamp = nullptr, bool skipSizeCheck = false) {
+
258  if(!skipSizeCheck && size() < sizeof(T)) {
+
259  return T();
+
260  }
+
261  return *((T *)getValue(timestamp));
+
262  }
+
263 
+
264 
+
265  /*********************** Operators ************************/
+
266 
+
268  uint8_t operator [](int pos) const {
+
269  assert(pos < m_attr_len && "out of range"); return m_attr_value[pos]; }
+
270 
+
272  operator std::vector<uint8_t>() const {
+
273  return std::vector<uint8_t>(m_attr_value, m_attr_value + m_attr_len); }
+
274 
+
276  operator std::string() const {
+
277  return std::string((char*)m_attr_value, m_attr_len); }
+
278 
+
280  operator const uint8_t*() const { return m_attr_value; }
+
281 
+ +
284  return append(source.data(), source.size()); }
+
285 
+
287  NimBLEAttValue& operator =(const std::string & source) {
+
288  setValue((uint8_t*)source.data(), (uint16_t)source.size()); return *this; }
+
289 
+ +
292 
+
294  NimBLEAttValue& operator =(const NimBLEAttValue & source);
+
295 
+
297  bool operator ==(const NimBLEAttValue & source) {
+
298  return (m_attr_len == source.size()) ?
+
299  memcmp(m_attr_value, source.data(), m_attr_len) == 0 : false; }
+
300 
+
302  bool operator !=(const NimBLEAttValue & source){ return !(*this == source); }
+
303 
+
304 #ifdef NIMBLE_CPP_ARDUINO_STRING_AVAILABLE
+
306  operator String() const { return String((char*)m_attr_value); }
+
307 #endif
+
308 
+
309 };
+
310 
+
311 
+
312 inline NimBLEAttValue::NimBLEAttValue(uint16_t init_len, uint16_t max_len) {
+
313  m_attr_value = (uint8_t*)calloc(init_len + 1, 1);
+
314  assert(m_attr_value && "No Mem");
+
315  m_attr_max_len = std::min(BLE_ATT_ATTR_MAX_LEN, (int)max_len);
+
316  m_attr_len = 0;
+
317  m_capacity = init_len;
+
318  setTimeStamp(0);
+
319 }
+
320 
+
321 inline NimBLEAttValue::NimBLEAttValue(const uint8_t *value, uint16_t len, uint16_t max_len)
+
322 : NimBLEAttValue(len, max_len) {
+
323  memcpy(m_attr_value, value, len);
+
324  m_attr_value[len] = '\0';
+
325  m_attr_len = len;
+
326 }
+
327 
+ +
329  if(m_attr_value != nullptr) {
+
330  free(m_attr_value);
+
331  }
+
332 }
+
333 
+ +
335  if (this != &source){
+
336  free(m_attr_value);
+
337 
+
338  m_attr_value = source.m_attr_value;
+
339  m_attr_max_len = source.m_attr_max_len;
+
340  m_attr_len = source.m_attr_len;
+
341  m_capacity = source.m_capacity;
+
342  setTimeStamp(source.getTimeStamp());
+
343  source.m_attr_value = nullptr;
+
344  }
+
345  return *this;
+
346 }
+
347 
+ +
349  if (this != &source) {
+
350  deepCopy(source);
+
351  }
+
352  return *this;
+
353 }
+
354 
+
355 inline void NimBLEAttValue::deepCopy(const NimBLEAttValue & source) {
+
356  uint8_t* res = (uint8_t*)realloc( m_attr_value, source.m_capacity + 1);
+
357  assert(res && "deepCopy: realloc failed");
+
358 
+
359  ble_npl_hw_enter_critical();
+
360  m_attr_value = res;
+
361  m_attr_max_len = source.m_attr_max_len;
+
362  m_attr_len = source.m_attr_len;
+
363  m_capacity = source.m_capacity;
+
364  setTimeStamp(source.getTimeStamp());
+
365  memcpy(m_attr_value, source.m_attr_value, m_attr_len + 1);
+
366  ble_npl_hw_exit_critical(0);
+
367 }
+
368 
+
369 inline const uint8_t* NimBLEAttValue::getValue(time_t *timestamp) {
+
370  if(timestamp != nullptr) {
+
371 #if CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED
+
372  *timestamp = m_timestamp;
+
373 #else
+
374  *timestamp = 0;
+
375 #endif
+
376  }
+
377  return m_attr_value;
+
378 }
+
379 
+
380 inline bool NimBLEAttValue::setValue(const uint8_t *value, uint16_t len) {
+
381  if (len > m_attr_max_len) {
+
382  NIMBLE_LOGE("NimBLEAttValue", "value exceeds max, len=%u, max=%u",
+
383  len, m_attr_max_len);
+
384  return false;
+
385  }
+
386 
+
387  uint8_t *res = m_attr_value;
+
388  if (len > m_capacity) {
+
389  res = (uint8_t*)realloc(m_attr_value, (len + 1));
+
390  m_capacity = len;
+
391  }
+
392  assert(res && "setValue: realloc failed");
+
393 
+
394 #if CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED
+
395  time_t t = time(nullptr);
+
396 #else
+
397  time_t t = 0;
+
398 #endif
+
399 
+
400  ble_npl_hw_enter_critical();
+
401  m_attr_value = res;
+
402  memcpy(m_attr_value, value, len);
+
403  m_attr_value[len] = '\0';
+
404  m_attr_len = len;
+
405  setTimeStamp(t);
+
406  ble_npl_hw_exit_critical(0);
+
407  return true;
+
408 }
+
409 
+
410 inline NimBLEAttValue& NimBLEAttValue::append(const uint8_t *value, uint16_t len) {
+
411  if (len < 1) {
+
412  return *this;
+
413  }
+
414 
+
415  if ((m_attr_len + len) > m_attr_max_len) {
+
416  NIMBLE_LOGE("NimBLEAttValue", "val > max, len=%u, max=%u",
+
417  len, m_attr_max_len);
+
418  return *this;
+
419  }
+
420 
+
421  uint8_t* res = m_attr_value;
+
422  uint16_t new_len = m_attr_len + len;
+
423  if (new_len > m_capacity) {
+
424  res = (uint8_t*)realloc(m_attr_value, (new_len + 1));
+
425  m_capacity = new_len;
+
426  }
+
427  assert(res && "append: realloc failed");
+
428 
+
429 #if CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED
+
430  time_t t = time(nullptr);
+
431 #else
+
432  time_t t = 0;
+
433 #endif
+
434 
+
435  ble_npl_hw_enter_critical();
+
436  m_attr_value = res;
+
437  memcpy(m_attr_value + m_attr_len, value, len);
+
438  m_attr_len = new_len;
+
439  m_attr_value[m_attr_len] = '\0';
+
440  setTimeStamp(t);
+
441  ble_npl_hw_exit_critical(0);
+
442 
+
443  return *this;
+
444 }
+
445 
+
446 #endif /*(CONFIG_BT_ENABLED) */
+
447 #endif /* MAIN_NIMBLEATTVALUE_H_ */
+
A specialized container class to hold BLE attribute values.
Definition: NimBLEAttValue.h:61
+
NimBLEAttValue(const std::vector< uint8_t > vec, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)
Construct with an initial value from a std::vector<uint8_t>.
Definition: NimBLEAttValue.h:119
+
~NimBLEAttValue()
Destructor.
Definition: NimBLEAttValue.h:328
+
NimBLEAttValue & operator+=(const NimBLEAttValue &source)
Operator; Append another NimBLEAttValue.
Definition: NimBLEAttValue.h:283
+
T getValue(time_t *timestamp=nullptr, bool skipSizeCheck=false)
Template to return the value as a <type>.
Definition: NimBLEAttValue.h:257
+
uint16_t length() const
Returns the current length of the value in bytes.
Definition: NimBLEAttValue.h:148
+
NimBLEAttValue(const char *value, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)
Construct with an initial value from a const char string.
Definition: NimBLEAttValue.h:103
+
uint16_t capacity() const
Returns the currently allocated capacity in bytes.
Definition: NimBLEAttValue.h:145
+
const uint8_t * end() const
Iterator end.
Definition: NimBLEAttValue.h:163
+
NimBLEAttValue(const std::string str, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)
Construct with an initial value from a std::string.
Definition: NimBLEAttValue.h:111
+
bool setValue(const uint8_t *value, uint16_t len)
Set the value from a buffer.
Definition: NimBLEAttValue.h:380
+
const uint8_t * getValue(time_t *timestamp)
Get a pointer to the value buffer with timestamp.
Definition: NimBLEAttValue.h:369
+
const uint8_t * begin() const
Iterator begin.
Definition: NimBLEAttValue.h:160
+
NimBLEAttValue(std::initializer_list< uint8_t > list, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)
Construct with an initializer list.
Definition: NimBLEAttValue.h:94
+
NimBLEAttValue(const NimBLEAttValue &source)
Copy constructor.
Definition: NimBLEAttValue.h:133
+
NimBLEAttValue(NimBLEAttValue &&source)
Move constructor.
Definition: NimBLEAttValue.h:136
+
uint8_t operator[](int pos) const
Subscript operator.
Definition: NimBLEAttValue.h:268
+
bool operator==(const NimBLEAttValue &source)
Equality operator.
Definition: NimBLEAttValue.h:297
+
bool setValue(const char *s)
Set value to the value of const char*.
Definition: NimBLEAttValue.h:195
+
bool operator!=(const NimBLEAttValue &source)
Inequality operator.
Definition: NimBLEAttValue.h:302
+
const uint8_t * data() const
Returns a pointer to the internal buffer of the value.
Definition: NimBLEAttValue.h:154
+
NimBLEAttValue & operator=(const std::string &source)
Operator; Set the value from a std::string source.
Definition: NimBLEAttValue.h:287
+
NimBLEAttValue & append(const uint8_t *value, uint16_t len)
Append data to the value.
Definition: NimBLEAttValue.h:410
+
const char * c_str() const
Returns a pointer to the internal buffer of the value as a const char*.
Definition: NimBLEAttValue.h:157
+
NimBLEAttValue(uint16_t init_len=CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)
Default constructor.
Definition: NimBLEAttValue.h:312
+
uint16_t size() const
Returns the current size of the value in bytes.
Definition: NimBLEAttValue.h:151
+
uint16_t max_size() const
Returns the max size in bytes.
Definition: NimBLEAttValue.h:142
+
bool setValue(const T &s)
Template to set value to the value of <type>val.
Definition: NimBLEAttValue.h:227
+ +
#define CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH
Uncomment to set the default allocation size (bytes) for each attribute if not specified when the con...
Definition: nimconfig.h:56
+
+
+ + + + diff --git a/_nim_b_l_e_beacon_8h_source.html b/_nim_b_l_e_beacon_8h_source.html index 2528aa5..f1bf3e8 100644 --- a/_nim_b_l_e_beacon_8h_source.html +++ b/_nim_b_l_e_beacon_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLEBeacon.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEBeacon.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
diff --git a/_nim_b_l_e_characteristic_8h_source.html b/_nim_b_l_e_characteristic_8h_source.html index 54f269f..c46c2a5 100644 --- a/_nim_b_l_e_characteristic_8h_source.html +++ b/_nim_b_l_e_characteristic_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLECharacteristic.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLECharacteristic.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -132,163 +132,185 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_characteristic_8h_source.ht
44 
45 #include "NimBLEService.h"
46 #include "NimBLEDescriptor.h"
-
47 
-
48 #include <string>
-
49 #include <vector>
-
50 
-
51 class NimBLEService;
-
52 class NimBLEDescriptor;
-
53 class NimBLECharacteristicCallbacks;
-
54 
+
47 #include "NimBLEAttValue.h"
+
48 
+
49 #include <string>
+
50 #include <vector>
+
51 
+
52 class NimBLEService;
+
53 class NimBLEDescriptor;
+
54 class NimBLECharacteristicCallbacks;
55 
-
62 class NimBLECharacteristic {
-
63 public:
-
64  NimBLECharacteristic(const char* uuid,
-
65  uint16_t properties =
-
66  NIMBLE_PROPERTY::READ |
-
67  NIMBLE_PROPERTY::WRITE,
-
68  NimBLEService* pService = nullptr);
-
69  NimBLECharacteristic(const NimBLEUUID &uuid,
-
70  uint16_t properties =
-
71  NIMBLE_PROPERTY::READ |
-
72  NIMBLE_PROPERTY::WRITE,
-
73  NimBLEService* pService = nullptr);
-
74 
-
75  ~NimBLECharacteristic();
-
76 
-
77  uint16_t getHandle();
-
78  NimBLEUUID getUUID();
-
79  std::string toString();
-
80 
-
81  void setCallbacks(NimBLECharacteristicCallbacks* pCallbacks);
-
82  NimBLECharacteristicCallbacks*
-
83  getCallbacks();
-
84 
-
85  void indicate();
+
56 
+
63 class NimBLECharacteristic {
+
64 public:
+
65  NimBLECharacteristic(const char* uuid,
+
66  uint16_t properties =
+
67  NIMBLE_PROPERTY::READ |
+
68  NIMBLE_PROPERTY::WRITE,
+
69  uint16_t max_len = BLE_ATT_ATTR_MAX_LEN,
+
70  NimBLEService* pService = nullptr);
+
71  NimBLECharacteristic(const NimBLEUUID &uuid,
+
72  uint16_t properties =
+
73  NIMBLE_PROPERTY::READ |
+
74  NIMBLE_PROPERTY::WRITE,
+
75  uint16_t max_len = BLE_ATT_ATTR_MAX_LEN,
+
76  NimBLEService* pService = nullptr);
+
77 
+
78  ~NimBLECharacteristic();
+
79 
+
80  uint16_t getHandle();
+
81  NimBLEUUID getUUID();
+
82  std::string toString();
+
83  void indicate();
+
84  void indicate(const uint8_t* value, size_t length);
+
85  void indicate(const std::vector<uint8_t>& value);
86  void notify(bool is_notification = true);
-
87  void notify(std::string value, bool is_notification = true);
-
88 
+
87  void notify(const uint8_t* value, size_t length, bool is_notification = true);
+
88  void notify(const std::vector<uint8_t>& value, bool is_notification = true);
89  size_t getSubscribedCount();
-
90 
-
91  NimBLEDescriptor* createDescriptor(const char* uuid,
-
92  uint32_t properties =
-
93  NIMBLE_PROPERTY::READ |
-
94  NIMBLE_PROPERTY::WRITE,
-
95  uint16_t max_len = 100);
-
96  NimBLEDescriptor* createDescriptor(const NimBLEUUID &uuid,
-
97  uint32_t properties =
-
98  NIMBLE_PROPERTY::READ |
-
99  NIMBLE_PROPERTY::WRITE,
-
100  uint16_t max_len = 100);
-
101 
-
102  void addDescriptor(NimBLEDescriptor *pDescriptor);
-
103  NimBLEDescriptor* getDescriptorByUUID(const char* uuid);
-
104  NimBLEDescriptor* getDescriptorByUUID(const NimBLEUUID &uuid);
-
105  NimBLEDescriptor* getDescriptorByHandle(uint16_t handle);
-
106  void removeDescriptor(NimBLEDescriptor *pDescriptor, bool deleteDsc = false);
-
107 
-
108  std::string getValue(time_t *timestamp = nullptr);
-
109  size_t getDataLength();
-
119  template<typename T>
-
120  T getValue(time_t *timestamp = nullptr, bool skipSizeCheck = false) {
-
121  std::string value = getValue();
-
122  if(!skipSizeCheck && value.size() < sizeof(T)) return T();
-
123  const char *pData = value.data();
-
124  return *((T *)pData);
-
125  }
-
126 
-
127  void setValue(const uint8_t* data, size_t size);
-
128  void setValue(const std::string &value);
+
90  void addDescriptor(NimBLEDescriptor *pDescriptor);
+
91  NimBLEDescriptor* getDescriptorByUUID(const char* uuid);
+
92  NimBLEDescriptor* getDescriptorByUUID(const NimBLEUUID &uuid);
+
93  NimBLEDescriptor* getDescriptorByHandle(uint16_t handle);
+
94  void removeDescriptor(NimBLEDescriptor *pDescriptor, bool deleteDsc = false);
+
95  NimBLEService* getService();
+
96  uint16_t getProperties();
+
97  NimBLEAttValue getValue(time_t *timestamp = nullptr);
+
98  size_t getDataLength();
+
99  void setValue(const uint8_t* data, size_t size);
+
100  void setValue(const std::vector<uint8_t>& vec);
+
101  void setCallbacks(NimBLECharacteristicCallbacks* pCallbacks);
+
102  NimBLEDescriptor* createDescriptor(const char* uuid,
+
103  uint32_t properties =
+
104  NIMBLE_PROPERTY::READ |
+
105  NIMBLE_PROPERTY::WRITE,
+
106  uint16_t max_len = BLE_ATT_ATTR_MAX_LEN);;
+
107  NimBLEDescriptor* createDescriptor(const NimBLEUUID &uuid,
+
108  uint32_t properties =
+
109  NIMBLE_PROPERTY::READ |
+
110  NIMBLE_PROPERTY::WRITE,
+
111  uint16_t max_len = BLE_ATT_ATTR_MAX_LEN);
+
112 
+
113  NimBLECharacteristicCallbacks* getCallbacks();
+
114 
+
115 
+
116  /*********************** Template Functions ************************/
+
117 
+
122  template<typename T>
+
123  void setValue(const T &s) { m_value.setValue<T>(s); }
+
124 
133  template<typename T>
-
134  void setValue(const T &s) {
-
135  setValue((uint8_t*)&s, sizeof(T));
+
134  T getValue(time_t *timestamp = nullptr, bool skipSizeCheck = false) {
+
135  return m_value.getValue<T>(timestamp, skipSizeCheck);
136  }
137 
-
138  NimBLEService* getService();
-
139  uint16_t getProperties();
-
140 
-
141 private:
-
142 
-
143  friend class NimBLEServer;
-
144  friend class NimBLEService;
-
145 
-
146  void setService(NimBLEService *pService);
-
147  void setSubscribe(struct ble_gap_event *event);
-
148  static int handleGapEvent(uint16_t conn_handle, uint16_t attr_handle,
-
149  struct ble_gatt_access_ctxt *ctxt, void *arg);
-
150 
-
151  NimBLEUUID m_uuid;
-
152  uint16_t m_handle;
-
153  uint16_t m_properties;
-
154  NimBLECharacteristicCallbacks* m_pCallbacks;
-
155  NimBLEService* m_pService;
-
156  std::string m_value;
-
157  std::vector<NimBLEDescriptor*> m_dscVec;
-
158  time_t m_timestamp;
-
159  uint8_t m_removed;
-
160 
-
161  std::vector<std::pair<uint16_t, uint16_t>> m_subscribedVec;
-
162 }; // NimBLECharacteristic
-
163 
-
164 
-
172 class NimBLECharacteristicCallbacks {
-
173 public:
-
174 
-
180  typedef enum {
-
181  SUCCESS_INDICATE,
-
182  SUCCESS_NOTIFY,
-
183  ERROR_INDICATE_DISABLED,
-
184  ERROR_NOTIFY_DISABLED,
-
185  ERROR_GATT,
-
186  ERROR_NO_CLIENT,
-
187  ERROR_INDICATE_TIMEOUT,
-
188  ERROR_INDICATE_FAILURE
-
189  }Status;
-
190 
-
191  virtual ~NimBLECharacteristicCallbacks();
-
192  virtual void onRead(NimBLECharacteristic* pCharacteristic);
-
193  virtual void onRead(NimBLECharacteristic* pCharacteristic, ble_gap_conn_desc* desc);
-
194  virtual void onWrite(NimBLECharacteristic* pCharacteristic);
-
195  virtual void onWrite(NimBLECharacteristic* pCharacteristic, ble_gap_conn_desc* desc);
-
196  virtual void onNotify(NimBLECharacteristic* pCharacteristic);
-
197  virtual void onStatus(NimBLECharacteristic* pCharacteristic, Status s, int code);
-
198  virtual void onSubscribe(NimBLECharacteristic* pCharacteristic, ble_gap_conn_desc* desc, uint16_t subValue);
-
199 };
-
200 
-
201 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
-
202 #endif /*MAIN_NIMBLECHARACTERISTIC_H_*/
-
Callbacks that can be associated with a BLE characteristic to inform of events.
Definition: NimBLECharacteristic.h:172
-
Status
An enum to provide the callback the status of the notification/indication, implemented for backward c...
Definition: NimBLECharacteristic.h:180
-
virtual void onNotify(NimBLECharacteristic *pCharacteristic)
Callback function to support a Notify request.
Definition: NimBLECharacteristic.cpp:616
-
virtual void onSubscribe(NimBLECharacteristic *pCharacteristic, ble_gap_conn_desc *desc, uint16_t subValue)
Callback function called when a client changes subscription status.
Definition: NimBLECharacteristic.cpp:642
-
virtual void onRead(NimBLECharacteristic *pCharacteristic)
Callback function to support a read request.
Definition: NimBLECharacteristic.cpp:582
-
virtual void onWrite(NimBLECharacteristic *pCharacteristic)
Callback function to support a write request.
Definition: NimBLECharacteristic.cpp:599
-
virtual void onStatus(NimBLECharacteristic *pCharacteristic, Status s, int code)
Callback function to support a Notify/Indicate Status report.
Definition: NimBLECharacteristic.cpp:627
-
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:62
-
NimBLEDescriptor * getDescriptorByHandle(uint16_t handle)
Return the BLE Descriptor for the given handle.
Definition: NimBLECharacteristic.cpp:182
-
NimBLECharacteristicCallbacks * getCallbacks()
Get the callback handlers for this characteristic.
Definition: NimBLECharacteristic.cpp:513
-
NimBLEUUID getUUID()
Get the UUID of the characteristic.
Definition: NimBLECharacteristic.cpp:227
-
void setCallbacks(NimBLECharacteristicCallbacks *pCallbacks)
Set the callback handlers for this characteristic.
Definition: NimBLECharacteristic.cpp:502
-
void removeDescriptor(NimBLEDescriptor *pDescriptor, bool deleteDsc=false)
Remove a descriptor from the characterisitc.
Definition: NimBLECharacteristic.cpp:130
-
void indicate()
Send an indication. An indication is a transmission of up to the first 20 bytes of the characteristic...
Definition: NimBLECharacteristic.cpp:391
-
std::string getValue(time_t *timestamp=nullptr)
Retrieve the current value of the characteristic.
Definition: NimBLECharacteristic.cpp:236
-
std::string toString()
Return a string representation of the characteristic.
Definition: NimBLECharacteristic.cpp:559
+
145  template<typename T>
+
146 #ifdef _DOXYGEN_
+
147  void
+
148 #else
+
149  typename std::enable_if<Has_c_str_len<T>::value, void>::type
+
150 #endif
+
151  notify(const T& value, bool is_notification = true) {
+
152  notify((uint8_t*)value.c_str(), value.length(), is_notification);
+
153  }
+
154 
+
161  template<typename T>
+
162 #ifdef _DOXYGEN_
+
163  void
+
164 #else
+
165  typename std::enable_if<Has_c_str_len<T>::value, void>::type
+
166 #endif
+
167  indicate(const T& value) {
+
168  indicate((uint8_t*)value.c_str(), value.length());
+
169  }
+
170 
+
171 private:
+
172 
+
173  friend class NimBLEServer;
+
174  friend class NimBLEService;
+
175 
+
176  void setService(NimBLEService *pService);
+
177  void setSubscribe(struct ble_gap_event *event);
+
178  static int handleGapEvent(uint16_t conn_handle, uint16_t attr_handle,
+
179  struct ble_gatt_access_ctxt *ctxt, void *arg);
+
180 
+
181  NimBLEUUID m_uuid;
+
182  uint16_t m_handle;
+
183  uint16_t m_properties;
+
184  NimBLECharacteristicCallbacks* m_pCallbacks;
+
185  NimBLEService* m_pService;
+
186  NimBLEAttValue m_value;
+
187  std::vector<NimBLEDescriptor*> m_dscVec;
+
188  uint8_t m_removed;
+
189 
+
190  std::vector<std::pair<uint16_t, uint16_t>> m_subscribedVec;
+
191 }; // NimBLECharacteristic
+
192 
+
193 
+
201 class NimBLECharacteristicCallbacks {
+
202 public:
+
203 
+
209  typedef enum {
+
210  SUCCESS_INDICATE,
+
211  SUCCESS_NOTIFY,
+
212  ERROR_INDICATE_DISABLED,
+
213  ERROR_NOTIFY_DISABLED,
+
214  ERROR_GATT,
+
215  ERROR_NO_CLIENT,
+
216  ERROR_INDICATE_TIMEOUT,
+
217  ERROR_INDICATE_FAILURE
+
218  }Status;
+
219 
+
220  virtual ~NimBLECharacteristicCallbacks();
+
221  virtual void onRead(NimBLECharacteristic* pCharacteristic);
+
222  virtual void onRead(NimBLECharacteristic* pCharacteristic, ble_gap_conn_desc* desc);
+
223  virtual void onWrite(NimBLECharacteristic* pCharacteristic);
+
224  virtual void onWrite(NimBLECharacteristic* pCharacteristic, ble_gap_conn_desc* desc);
+
225  virtual void onNotify(NimBLECharacteristic* pCharacteristic);
+
226  virtual void onStatus(NimBLECharacteristic* pCharacteristic, Status s, int code);
+
227  virtual void onSubscribe(NimBLECharacteristic* pCharacteristic, ble_gap_conn_desc* desc, uint16_t subValue);
+
228 };
+
229 
+
230 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
+
231 #endif /*MAIN_NIMBLECHARACTERISTIC_H_*/
+
A specialized container class to hold BLE attribute values.
Definition: NimBLEAttValue.h:61
+
bool setValue(const uint8_t *value, uint16_t len)
Set the value from a buffer.
Definition: NimBLEAttValue.h:380
+
const uint8_t * getValue(time_t *timestamp)
Get a pointer to the value buffer with timestamp.
Definition: NimBLEAttValue.h:369
+
Callbacks that can be associated with a BLE characteristic to inform of events.
Definition: NimBLECharacteristic.h:201
+
Status
An enum to provide the callback the status of the notification/indication, implemented for backward c...
Definition: NimBLECharacteristic.h:209
+
virtual void onNotify(NimBLECharacteristic *pCharacteristic)
Callback function to support a Notify request.
Definition: NimBLECharacteristic.cpp:628
+
virtual void onSubscribe(NimBLECharacteristic *pCharacteristic, ble_gap_conn_desc *desc, uint16_t subValue)
Callback function called when a client changes subscription status.
Definition: NimBLECharacteristic.cpp:654
+
virtual void onRead(NimBLECharacteristic *pCharacteristic)
Callback function to support a read request.
Definition: NimBLECharacteristic.cpp:594
+
virtual void onWrite(NimBLECharacteristic *pCharacteristic)
Callback function to support a write request.
Definition: NimBLECharacteristic.cpp:611
+
virtual void onStatus(NimBLECharacteristic *pCharacteristic, Status s, int code)
Callback function to support a Notify/Indicate Status report.
Definition: NimBLECharacteristic.cpp:639
+
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:63
+
NimBLEDescriptor * getDescriptorByHandle(uint16_t handle)
Return the BLE Descriptor for the given handle.
Definition: NimBLECharacteristic.cpp:185
+
NimBLECharacteristicCallbacks * getCallbacks()
Get the callback handlers for this characteristic.
Definition: NimBLECharacteristic.cpp:535
+
NimBLEDescriptor * createDescriptor(const char *uuid, uint32_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)
Create a new BLE Descriptor associated with this characteristic.
Definition: NimBLECharacteristic.cpp:76
+
NimBLEUUID getUUID()
Get the UUID of the characteristic.
Definition: NimBLECharacteristic.cpp:230
+
void setCallbacks(NimBLECharacteristicCallbacks *pCallbacks)
Set the callback handlers for this characteristic.
Definition: NimBLECharacteristic.cpp:524
+
void removeDescriptor(NimBLEDescriptor *pDescriptor, bool deleteDsc=false)
Remove a descriptor from the characteristic.
Definition: NimBLECharacteristic.cpp:133
+
void indicate()
Send an indication.
Definition: NimBLECharacteristic.cpp:389
+
std::string toString()
Return a string representation of the characteristic.
Definition: NimBLECharacteristic.cpp:571
size_t getDataLength()
Retrieve the the current data length of the characteristic.
Definition: NimBLECharacteristic.cpp:252
-
uint16_t getProperties()
Get the properties of the characteristic.
Definition: NimBLECharacteristic.cpp:205
-
void setValue(const uint8_t *data, size_t size)
Set the value of the characteristic.
Definition: NimBLECharacteristic.cpp:523
-
T getValue(time_t *timestamp=nullptr, bool skipSizeCheck=false)
A template to convert the characteristic data to <type>.
Definition: NimBLECharacteristic.h:120
-
~NimBLECharacteristic()
Destructor.
Definition: NimBLECharacteristic.cpp:59
-
NimBLEService * getService()
Get the service associated with this characteristic.
Definition: NimBLECharacteristic.cpp:213
-
NimBLECharacteristic(const char *uuid, uint16_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, NimBLEService *pService=nullptr)
Construct a characteristic.
Definition: NimBLECharacteristic.cpp:35
-
void notify(bool is_notification=true)
Send a notification. A notification is a transmission of up to the first 20 bytes of the characterist...
Definition: NimBLECharacteristic.cpp:404
-
NimBLEDescriptor * createDescriptor(const char *uuid, uint32_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=100)
Create a new BLE Descriptor associated with this characteristic.
Definition: NimBLECharacteristic.cpp:73
-
void setValue(const T &s)
Convenience template to set the characteristic value to <type>val.
Definition: NimBLECharacteristic.h:134
-
NimBLEDescriptor * getDescriptorByUUID(const char *uuid)
Return the BLE Descriptor for the given UUID.
Definition: NimBLECharacteristic.cpp:158
-
uint16_t getHandle()
Get the handle of the characteristic.
Definition: NimBLECharacteristic.cpp:196
+
NimBLEAttValue getValue(time_t *timestamp=nullptr)
Retrieve the current value of the characteristic.
Definition: NimBLECharacteristic.cpp:239
+
uint16_t getProperties()
Get the properties of the characteristic.
Definition: NimBLECharacteristic.cpp:208
+
void setValue(const uint8_t *data, size_t size)
Set the value of the characteristic from a data buffer .
Definition: NimBLECharacteristic.cpp:545
+
T getValue(time_t *timestamp=nullptr, bool skipSizeCheck=false)
Template to convert the characteristic data to <type>.
Definition: NimBLECharacteristic.h:134
+
~NimBLECharacteristic()
Destructor.
Definition: NimBLECharacteristic.cpp:62
+
NimBLEService * getService()
Get the service associated with this characteristic.
Definition: NimBLECharacteristic.cpp:216
+
NimBLECharacteristic(const char *uuid, uint16_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN, NimBLEService *pService=nullptr)
Construct a characteristic.
Definition: NimBLECharacteristic.cpp:36
+
void notify(bool is_notification=true)
Send a notification or indication.
Definition: NimBLECharacteristic.cpp:417
+
void setValue(const T &s)
Template to set the characteristic value to <type>val.
Definition: NimBLECharacteristic.h:123
+
NimBLEDescriptor * getDescriptorByUUID(const char *uuid)
Return the BLE Descriptor for the given UUID.
Definition: NimBLECharacteristic.cpp:161
+
uint16_t getHandle()
Get the handle of the characteristic.
Definition: NimBLECharacteristic.cpp:199
size_t getSubscribedCount()
Get the number of clients subscribed to the characteristic.
Definition: NimBLECharacteristic.cpp:334
-
void addDescriptor(NimBLEDescriptor *pDescriptor)
Add a descriptor to the characteristic.
Definition: NimBLECharacteristic.cpp:104
-
A model of a BLE descriptor.
Definition: NimBLEDescriptor.h:42
-
The model of a BLE server.
Definition: NimBLEServer.h:42
+
void notify(const T &value, bool is_notification=true)
Template to send a notification from a class type that has a c_str() and length() method.
Definition: NimBLECharacteristic.h:151
+
void addDescriptor(NimBLEDescriptor *pDescriptor)
Add a descriptor to the characteristic.
Definition: NimBLECharacteristic.cpp:107
+
void indicate(const T &value)
Template to send an indication from a class type that has a c_str() and length() method.
Definition: NimBLECharacteristic.h:167
+
A model of a BLE descriptor.
Definition: NimBLEDescriptor.h:35
+
The model of a BLE server.
Definition: NimBLEServer.h:46
The model of a BLE service.
Definition: NimBLEService.h:34
A model of a BLE UUID.
Definition: NimBLEUUID.h:37
diff --git a/_nim_b_l_e_client_8h_source.html b/_nim_b_l_e_client_8h_source.html index 1b75f42..d359d06 100644 --- a/_nim_b_l_e_client_8h_source.html +++ b/_nim_b_l_e_client_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLEClient.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEClient.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -109,151 +109,160 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_client_8h_source.html','');
21 #include "NimBLEUUID.h"
22 #include "NimBLEUtils.h"
23 #include "NimBLEConnInfo.h"
-
24 #include "NimBLEAdvertisedDevice.h"
-
25 #include "NimBLERemoteService.h"
-
26 
-
27 #include <vector>
-
28 #include <string>
-
29 
-
30 class NimBLERemoteService;
-
31 class NimBLERemoteCharacteristic;
-
32 class NimBLEClientCallbacks;
-
33 class NimBLEAdvertisedDevice;
-
34 
-
38 class NimBLEClient {
-
39 public:
-
40  bool connect(NimBLEAdvertisedDevice* device, bool deleteAttibutes = true);
-
41  bool connect(const NimBLEAddress &address, bool deleteAttibutes = true);
-
42  bool connect(bool deleteAttibutes = true);
-
43  int disconnect(uint8_t reason = BLE_ERR_REM_USER_CONN_TERM);
-
44  NimBLEAddress getPeerAddress();
-
45  void setPeerAddress(const NimBLEAddress &address);
-
46  int getRssi();
-
47  std::vector<NimBLERemoteService*>* getServices(bool refresh = false);
-
48  std::vector<NimBLERemoteService*>::iterator begin();
-
49  std::vector<NimBLERemoteService*>::iterator end();
-
50  NimBLERemoteService* getService(const char* uuid);
-
51  NimBLERemoteService* getService(const NimBLEUUID &uuid);
-
52  void deleteServices();
-
53  size_t deleteService(const NimBLEUUID &uuid);
-
54  std::string getValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID);
-
55  bool setValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID,
-
56  const std::string &value, bool response = false);
-
57  NimBLERemoteCharacteristic* getCharacteristic(const uint16_t handle);
-
58  bool isConnected();
-
59  void setClientCallbacks(NimBLEClientCallbacks *pClientCallbacks,
-
60  bool deleteCallbacks = true);
-
61  std::string toString();
-
62  uint16_t getConnId();
-
63  uint16_t getMTU();
-
64  bool secureConnection();
-
65  void setConnectTimeout(uint8_t timeout);
-
66  void setConnectionParams(uint16_t minInterval, uint16_t maxInterval,
-
67  uint16_t latency, uint16_t timeout,
-
68  uint16_t scanInterval=16, uint16_t scanWindow=16);
-
69  void updateConnParams(uint16_t minInterval, uint16_t maxInterval,
-
70  uint16_t latency, uint16_t timeout);
-
71  void setDataLen(uint16_t tx_octets);
-
72  void discoverAttributes();
-
73  NimBLEConnInfo getConnInfo();
-
74  int getLastError();
-
75 
-
76 private:
-
77  NimBLEClient(const NimBLEAddress &peerAddress);
-
78  ~NimBLEClient();
+
24 #include "NimBLEAttValue.h"
+
25 #include "NimBLEAdvertisedDevice.h"
+
26 #include "NimBLERemoteService.h"
+
27 
+
28 #include <vector>
+
29 #include <string>
+
30 
+
31 class NimBLERemoteService;
+
32 class NimBLERemoteCharacteristic;
+
33 class NimBLEClientCallbacks;
+
34 class NimBLEAdvertisedDevice;
+
35 
+
39 class NimBLEClient {
+
40 public:
+
41  bool connect(NimBLEAdvertisedDevice* device, bool deleteAttributes = true);
+
42  bool connect(const NimBLEAddress &address, bool deleteAttributes = true);
+
43  bool connect(bool deleteAttributes = true);
+
44  int disconnect(uint8_t reason = BLE_ERR_REM_USER_CONN_TERM);
+
45  NimBLEAddress getPeerAddress();
+
46  void setPeerAddress(const NimBLEAddress &address);
+
47  int getRssi();
+
48  std::vector<NimBLERemoteService*>* getServices(bool refresh = false);
+
49  std::vector<NimBLERemoteService*>::iterator begin();
+
50  std::vector<NimBLERemoteService*>::iterator end();
+
51  NimBLERemoteService* getService(const char* uuid);
+
52  NimBLERemoteService* getService(const NimBLEUUID &uuid);
+
53  void deleteServices();
+
54  size_t deleteService(const NimBLEUUID &uuid);
+
55  NimBLEAttValue getValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID);
+
56  bool setValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID,
+
57  const NimBLEAttValue &value, bool response = false);
+
58  NimBLERemoteCharacteristic* getCharacteristic(const uint16_t handle);
+
59  bool isConnected();
+
60  void setClientCallbacks(NimBLEClientCallbacks *pClientCallbacks,
+
61  bool deleteCallbacks = true);
+
62  std::string toString();
+
63  uint16_t getConnId();
+
64  uint16_t getMTU();
+
65  bool secureConnection();
+
66  void setConnectTimeout(uint8_t timeout);
+
67  void setConnectionParams(uint16_t minInterval, uint16_t maxInterval,
+
68  uint16_t latency, uint16_t timeout,
+
69  uint16_t scanInterval=16, uint16_t scanWindow=16);
+
70  void updateConnParams(uint16_t minInterval, uint16_t maxInterval,
+
71  uint16_t latency, uint16_t timeout);
+
72  void setDataLen(uint16_t tx_octets);
+
73  bool discoverAttributes();
+
74  NimBLEConnInfo getConnInfo();
+
75  int getLastError();
+
76 #if CONFIG_BT_NIMBLE_EXT_ADV
+
77  void setConnectPhy(uint8_t mask);
+
78 #endif
79 
-
80  friend class NimBLEDevice;
-
81  friend class NimBLERemoteService;
-
82 
-
83  static int handleGapEvent(struct ble_gap_event *event, void *arg);
-
84  static int serviceDiscoveredCB(uint16_t conn_handle,
-
85  const struct ble_gatt_error *error,
-
86  const struct ble_gatt_svc *service,
-
87  void *arg);
-
88  static void dcTimerCb(ble_npl_event *event);
-
89  bool retrieveServices(const NimBLEUUID *uuid_filter = nullptr);
-
90 
-
91  NimBLEAddress m_peerAddress;
-
92  int m_lastErr;
-
93  uint16_t m_conn_id;
-
94  bool m_connEstablished;
-
95  bool m_deleteCallbacks;
-
96  int32_t m_connectTimeout;
-
97  NimBLEClientCallbacks* m_pClientCallbacks;
-
98  ble_task_data_t* m_pTaskData;
-
99  ble_npl_callout m_dcTimer;
-
100 
-
101  std::vector<NimBLERemoteService*> m_servicesVector;
-
102 
-
103 private:
-
104  friend class NimBLEClientCallbacks;
-
105  ble_gap_conn_params m_pConnParams;
-
106 
-
107 }; // class NimBLEClient
-
108 
+
80 private:
+
81  NimBLEClient(const NimBLEAddress &peerAddress);
+
82  ~NimBLEClient();
+
83 
+
84  friend class NimBLEDevice;
+
85  friend class NimBLERemoteService;
+
86 
+
87  static int handleGapEvent(struct ble_gap_event *event, void *arg);
+
88  static int serviceDiscoveredCB(uint16_t conn_handle,
+
89  const struct ble_gatt_error *error,
+
90  const struct ble_gatt_svc *service,
+
91  void *arg);
+
92  static void dcTimerCb(ble_npl_event *event);
+
93  bool retrieveServices(const NimBLEUUID *uuid_filter = nullptr);
+
94 
+
95  NimBLEAddress m_peerAddress;
+
96  int m_lastErr;
+
97  uint16_t m_conn_id;
+
98  bool m_connEstablished;
+
99  bool m_deleteCallbacks;
+
100  int32_t m_connectTimeout;
+
101  NimBLEClientCallbacks* m_pClientCallbacks;
+
102  ble_task_data_t* m_pTaskData;
+
103  ble_npl_callout m_dcTimer;
+
104 #if CONFIG_BT_NIMBLE_EXT_ADV
+
105  uint8_t m_phyMask;
+
106 #endif
+
107 
+
108  std::vector<NimBLERemoteService*> m_servicesVector;
109 
-
113 class NimBLEClientCallbacks {
-
114 public:
-
115  virtual ~NimBLEClientCallbacks() {};
+
110 private:
+
111  friend class NimBLEClientCallbacks;
+
112  ble_gap_conn_params m_pConnParams;
+
113 
+
114 }; // class NimBLEClient
+
115 
116 
-
121  virtual void onConnect(NimBLEClient* pClient);
-
122 
-
127  virtual void onDisconnect(NimBLEClient* pClient);
-
128 
-
135  virtual bool onConnParamsUpdateRequest(NimBLEClient* pClient, const ble_gap_upd_params* params);
-
136 
-
141  virtual uint32_t onPassKeyRequest();
-
142 
-
143  /*virtual void onPassKeyNotify(uint32_t pass_key);
-
144  virtual bool onSecurityRequest();*/
-
145 
-
151  virtual void onAuthenticationComplete(ble_gap_conn_desc* desc);
+
120 class NimBLEClientCallbacks {
+
121 public:
+
122  virtual ~NimBLEClientCallbacks() {};
+
123 
+
128  virtual void onConnect(NimBLEClient* pClient);
+
129 
+
134  virtual void onDisconnect(NimBLEClient* pClient);
+
135 
+
142  virtual bool onConnParamsUpdateRequest(NimBLEClient* pClient, const ble_gap_upd_params* params);
+
143 
+
148  virtual uint32_t onPassKeyRequest();
+
149 
+
150  /*virtual void onPassKeyNotify(uint32_t pass_key);
+
151  virtual bool onSecurityRequest();*/
152 
-
158  virtual bool onConfirmPIN(uint32_t pin);
-
159 };
-
160 
-
161 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
-
162 #endif /* MAIN_NIMBLECLIENT_H_ */
+
158  virtual void onAuthenticationComplete(ble_gap_conn_desc* desc);
+
159 
+
165  virtual bool onConfirmPIN(uint32_t pin);
+
166 };
+
167 
+
168 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
+
169 #endif /* MAIN_NIMBLECLIENT_H_ */
A BLE device address.
Definition: NimBLEAddress.h:39
A representation of a BLE advertised device found by a scan.
Definition: NimBLEAdvertisedDevice.h:42
-
Callbacks associated with a BLE client.
Definition: NimBLEClient.h:113
-
virtual void onDisconnect(NimBLEClient *pClient)
Called when disconnected from the server.
Definition: NimBLEClient.cpp:1202
-
virtual void onAuthenticationComplete(ble_gap_conn_desc *desc)
Called when the pairing procedure is complete.
Definition: NimBLEClient.cpp:1224
-
virtual bool onConnParamsUpdateRequest(NimBLEClient *pClient, const ble_gap_upd_params *params)
Called when server requests to update the connection parameters.
Definition: NimBLEClient.cpp:1206
-
virtual void onConnect(NimBLEClient *pClient)
Called after client connects.
Definition: NimBLEClient.cpp:1198
-
virtual uint32_t onPassKeyRequest()
Called when server requests a passkey for pairing.
Definition: NimBLEClient.cpp:1211
-
virtual bool onConfirmPIN(uint32_t pin)
Called when using numeric comparision for pairing.
Definition: NimBLEClient.cpp:1227
-
A model of a BLE client.
Definition: NimBLEClient.h:38
-
NimBLEAddress getPeerAddress()
Retrieve the address of the peer.
Definition: NimBLEClient.cpp:520
-
bool setValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID, const std::string &value, bool response=false)
Set the value of a specific characteristic associated with a specific service.
Definition: NimBLEClient.cpp:798
-
std::vector< NimBLERemoteService * >::iterator end()
Get iterator to the end of the vector of remote service pointers.
Definition: NimBLEClient.cpp:578
-
size_t deleteService(const NimBLEUUID &uuid)
Delete service by UUID.
Definition: NimBLEClient.cpp:134
-
void setConnectionParams(uint16_t minInterval, uint16_t maxInterval, uint16_t latency, uint16_t timeout, uint16_t scanInterval=16, uint16_t scanWindow=16)
Set the connection paramaters to use when connecting to a server.
Definition: NimBLEClient.cpp:407
-
int getLastError()
Get the last error code reported by the NimBLE host.
Definition: NimBLEClient.cpp:1193
-
NimBLERemoteCharacteristic * getCharacteristic(const uint16_t handle)
Get the remote characteristic with the specified handle.
Definition: NimBLEClient.cpp:824
-
void setDataLen(uint16_t tx_octets)
Request an update of the data packet length.
Definition: NimBLEClient.cpp:466
-
void discoverAttributes()
Retrieves the full database of attributes that the peripheral has available.
Definition: NimBLEClient.cpp:655
-
void setConnectTimeout(uint8_t timeout)
Set the timeout to wait for connection attempt to complete.
Definition: NimBLEClient.cpp:503
-
NimBLEConnInfo getConnInfo()
Get detailed information about the current peer connection.
Definition: NimBLEClient.cpp:484
-
int disconnect(uint8_t reason=BLE_ERR_REM_USER_CONN_TERM)
Disconnect from the peer.
Definition: NimBLEClient.cpp:354
-
void deleteServices()
Delete all service objects created by this client and clear the vector.
Definition: NimBLEClient.cpp:117
-
bool secureConnection()
Initiate a secure connection (pair/bond) with the server. Called automatically when a characteristic ...
Definition: NimBLEClient.cpp:318
-
void setPeerAddress(const NimBLEAddress &address)
Set the peer address.
Definition: NimBLEClient.cpp:530
-
uint16_t getConnId()
Get the connection id for this client.
Definition: NimBLEClient.cpp:512
-
bool connect(NimBLEAdvertisedDevice *device, bool deleteAttibutes=true)
Connect to an advertising device.
Definition: NimBLEClient.cpp:168
-
std::vector< NimBLERemoteService * >::iterator begin()
Get iterator to the beginning of the vector of remote service pointers.
Definition: NimBLEClient.cpp:569
-
uint16_t getMTU()
Get the current mtu of this connection.
Definition: NimBLEClient.cpp:849
-
std::string toString()
Return a string representation of this client.
Definition: NimBLEClient.cpp:1177
-
std::vector< NimBLERemoteService * > * getServices(bool refresh=false)
Get a pointer to the vector of found services.
Definition: NimBLEClient.cpp:637
-
int getRssi()
Ask the BLE server for the RSSI value.
Definition: NimBLEClient.cpp:545
-
NimBLERemoteService * getService(const char *uuid)
Get the service BLE Remote Service instance corresponding to the uuid.
Definition: NimBLEClient.cpp:588
-
void setClientCallbacks(NimBLEClientCallbacks *pClientCallbacks, bool deleteCallbacks=true)
Set the callbacks that will be invoked when events are received.
Definition: NimBLEClient.cpp:1163
-
bool isConnected()
Are we connected to a server?
Definition: NimBLEClient.cpp:1153
-
std::string getValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID)
Get the value of a specific characteristic associated with a specific service.
Definition: NimBLEClient.cpp:771
-
void updateConnParams(uint16_t minInterval, uint16_t maxInterval, uint16_t latency, uint16_t timeout)
Update the connection parameters:
Definition: NimBLEClient.cpp:437
+
A specialized container class to hold BLE attribute values.
Definition: NimBLEAttValue.h:61
+
Callbacks associated with a BLE client.
Definition: NimBLEClient.h:120
+
virtual void onDisconnect(NimBLEClient *pClient)
Called when disconnected from the server.
Definition: NimBLEClient.cpp:1266
+
virtual void onAuthenticationComplete(ble_gap_conn_desc *desc)
Called when the pairing procedure is complete.
Definition: NimBLEClient.cpp:1288
+
virtual bool onConnParamsUpdateRequest(NimBLEClient *pClient, const ble_gap_upd_params *params)
Called when server requests to update the connection parameters.
Definition: NimBLEClient.cpp:1270
+
virtual void onConnect(NimBLEClient *pClient)
Called after client connects.
Definition: NimBLEClient.cpp:1262
+
virtual uint32_t onPassKeyRequest()
Called when server requests a passkey for pairing.
Definition: NimBLEClient.cpp:1275
+
virtual bool onConfirmPIN(uint32_t pin)
Called when using numeric comparision for pairing.
Definition: NimBLEClient.cpp:1291
+
A model of a BLE client.
Definition: NimBLEClient.h:39
+
NimBLEAddress getPeerAddress()
Retrieve the address of the peer.
Definition: NimBLEClient.cpp:555
+
std::vector< NimBLERemoteService * >::iterator end()
Get iterator to the end of the vector of remote service pointers.
Definition: NimBLEClient.cpp:613
+
size_t deleteService(const NimBLEUUID &uuid)
Delete service by UUID.
Definition: NimBLEClient.cpp:141
+
bool discoverAttributes()
Retrieves the full database of attributes that the peripheral has available.
Definition: NimBLEClient.cpp:708
+
void setConnectionParams(uint16_t minInterval, uint16_t maxInterval, uint16_t latency, uint16_t timeout, uint16_t scanInterval=16, uint16_t scanWindow=16)
Set the connection parameters to use when connecting to a server.
Definition: NimBLEClient.cpp:442
+
int getLastError()
Get the last error code reported by the NimBLE host.
Definition: NimBLEClient.cpp:1257
+
NimBLERemoteCharacteristic * getCharacteristic(const uint16_t handle)
Get the remote characteristic with the specified handle.
Definition: NimBLEClient.cpp:892
+
void setDataLen(uint16_t tx_octets)
Request an update of the data packet length.
Definition: NimBLEClient.cpp:501
+
NimBLEAttValue getValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID)
Get the value of a specific characteristic associated with a specific service.
Definition: NimBLEClient.cpp:839
+
void setConnectPhy(uint8_t mask)
Set the PHY types to use when connecting to a server.
Definition: NimBLEClient.cpp:427
+
void setConnectTimeout(uint8_t timeout)
Set the timeout to wait for connection attempt to complete.
Definition: NimBLEClient.cpp:538
+
NimBLEConnInfo getConnInfo()
Get detailed information about the current peer connection.
Definition: NimBLEClient.cpp:519
+
int disconnect(uint8_t reason=BLE_ERR_REM_USER_CONN_TERM)
Disconnect from the peer.
Definition: NimBLEClient.cpp:374
+
void deleteServices()
Delete all service objects created by this client and clear the vector.
Definition: NimBLEClient.cpp:124
+
bool secureConnection()
Initiate a secure connection (pair/bond) with the server. Called automatically when a characteristic ...
Definition: NimBLEClient.cpp:338
+
void setPeerAddress(const NimBLEAddress &address)
Set the peer address.
Definition: NimBLEClient.cpp:565
+
bool setValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID, const NimBLEAttValue &value, bool response=false)
Set the value of a specific characteristic associated with a specific service.
Definition: NimBLEClient.cpp:866
+
uint16_t getConnId()
Get the connection id for this client.
Definition: NimBLEClient.cpp:547
+
std::vector< NimBLERemoteService * >::iterator begin()
Get iterator to the beginning of the vector of remote service pointers.
Definition: NimBLEClient.cpp:604
+
uint16_t getMTU()
Get the current mtu of this connection.
Definition: NimBLEClient.cpp:917
+
std::string toString()
Return a string representation of this client.
Definition: NimBLEClient.cpp:1241
+
std::vector< NimBLERemoteService * > * getServices(bool refresh=false)
Get a pointer to the vector of found services.
Definition: NimBLEClient.cpp:689
+
int getRssi()
Ask the BLE server for the RSSI value.
Definition: NimBLEClient.cpp:580
+
NimBLERemoteService * getService(const char *uuid)
Get the service BLE Remote Service instance corresponding to the uuid.
Definition: NimBLEClient.cpp:623
+
bool connect(NimBLEAdvertisedDevice *device, bool deleteAttributes=true)
Connect to an advertising device.
Definition: NimBLEClient.cpp:175
+
void setClientCallbacks(NimBLEClientCallbacks *pClientCallbacks, bool deleteCallbacks=true)
Set the callbacks that will be invoked when events are received.
Definition: NimBLEClient.cpp:1227
+
bool isConnected()
Are we connected to a server?
Definition: NimBLEClient.cpp:1217
+
void updateConnParams(uint16_t minInterval, uint16_t maxInterval, uint16_t latency, uint16_t timeout)
Update the connection parameters:
Definition: NimBLEClient.cpp:472
Connection information.
Definition: NimBLEConnInfo.h:9
-
A model of a BLE Device from which all the BLE roles are created.
Definition: NimBLEDevice.h:92
-
A model of a remote BLE characteristic.
Definition: NimBLERemoteCharacteristic.h:43
+
A model of a BLE Device from which all the BLE roles are created.
Definition: NimBLEDevice.h:96
+
A model of a remote BLE characteristic.
Definition: NimBLERemoteCharacteristic.h:44
A model of a remote BLE service.
Definition: NimBLERemoteService.h:34
A model of a BLE UUID.
Definition: NimBLEUUID.h:37
diff --git a/_nim_b_l_e_conn_info_8h_source.html b/_nim_b_l_e_conn_info_8h_source.html index 364e9cb..ba88e8f 100644 --- a/_nim_b_l_e_conn_info_8h_source.html +++ b/_nim_b_l_e_conn_info_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLEConnInfo.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEConnInfo.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -126,7 +126,7 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_conn_info_8h_source.html','
54 };
55 #endif
A BLE device address.
Definition: NimBLEAddress.h:39
-
A model of a BLE client.
Definition: NimBLEClient.h:38
+
A model of a BLE client.
Definition: NimBLEClient.h:39
Connection information.
Definition: NimBLEConnInfo.h:9
uint16_t getConnLatency()
Gets the allowable latency for this connection (unit = number of intervals)
Definition: NimBLEConnInfo.h:32
uint8_t getSecKeySize()
Gets the key size used to encrypt the connection.
Definition: NimBLEConnInfo.h:53
@@ -141,7 +141,7 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_conn_info_8h_source.html','
bool isSlave()
Check if we are in the slave role in this connection.
Definition: NimBLEConnInfo.h:41
NimBLEAddress getAddress()
Gets the over-the-air address of the connected peer.
Definition: NimBLEConnInfo.h:17
bool isBonded()
Check if we are connected to a bonded peer.
Definition: NimBLEConnInfo.h:44
-
The model of a BLE server.
Definition: NimBLEServer.h:42
+
The model of a BLE server.
Definition: NimBLEServer.h:46
diff --git a/_nim_b_l_e_descriptor_8h_source.html b/_nim_b_l_e_descriptor_8h_source.html index 745a2b5..6b644c4 100644 --- a/_nim_b_l_e_descriptor_8h_source.html +++ b/_nim_b_l_e_descriptor_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLEDescriptor.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEDescriptor.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -108,102 +108,103 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_descriptor_8h_source.html',
20 
21 #include "NimBLECharacteristic.h"
22 #include "NimBLEUUID.h"
-
23 
-
24 #include <string>
-
25 
+
23 #include "NimBLEAttValue.h"
+
24 
+
25 #include <string>
26 
-
27 typedef struct
-
28 {
-
29  uint16_t attr_max_len;
-
30  uint16_t attr_len;
-
31  uint8_t *attr_value;
-
32 } attr_value_t;
-
33 
-
34 class NimBLEService;
-
35 class NimBLECharacteristic;
-
36 class NimBLEDescriptorCallbacks;
-
37 
-
38 
-
42 class NimBLEDescriptor {
-
43 public:
-
44  NimBLEDescriptor(const char* uuid, uint16_t properties,
-
45  uint16_t max_len,
-
46  NimBLECharacteristic* pCharacteristic = nullptr);
-
47 
-
48  NimBLEDescriptor(NimBLEUUID uuid, uint16_t properties,
-
49  uint16_t max_len,
-
50  NimBLECharacteristic* pCharacteristic = nullptr);
-
51 
-
52  ~NimBLEDescriptor();
-
53 
-
54  uint16_t getHandle();
-
55  NimBLEUUID getUUID();
-
56  std::string toString();
-
57 
-
58  void setCallbacks(NimBLEDescriptorCallbacks* pCallbacks);
+
27 class NimBLEService;
+
28 class NimBLECharacteristic;
+
29 class NimBLEDescriptorCallbacks;
+
30 
+
31 
+
35 class NimBLEDescriptor {
+
36 public:
+
37  NimBLEDescriptor(const char* uuid, uint16_t properties,
+
38  uint16_t max_len,
+
39  NimBLECharacteristic* pCharacteristic = nullptr);
+
40 
+
41  NimBLEDescriptor(NimBLEUUID uuid, uint16_t properties,
+
42  uint16_t max_len,
+
43  NimBLECharacteristic* pCharacteristic = nullptr);
+
44 
+
45  ~NimBLEDescriptor();
+
46 
+
47  uint16_t getHandle();
+
48  NimBLEUUID getUUID();
+
49  std::string toString();
+
50  void setCallbacks(NimBLEDescriptorCallbacks* pCallbacks);
+
51  NimBLECharacteristic* getCharacteristic();
+
52 
+
53  size_t getLength();
+
54  NimBLEAttValue getValue(time_t *timestamp = nullptr);
+
55  std::string getStringValue();
+
56 
+
57  void setValue(const uint8_t* data, size_t size);
+
58  void setValue(const std::vector<uint8_t>& vec);
59 
-
60  size_t getLength();
-
61  uint8_t* getValue();
-
62  std::string getStringValue();
-
63 
-
64  void setValue(const uint8_t* data, size_t size);
-
65  void setValue(const std::string &value);
-
66  NimBLECharacteristic* getCharacteristic();
-
67 
-
72  template<typename T>
-
73  void setValue(const T &s) {
-
74  setValue((uint8_t*)&s, sizeof(T));
-
75  }
-
76 
-
77 private:
-
78  friend class NimBLECharacteristic;
-
79  friend class NimBLEService;
-
80  friend class NimBLE2904;
+
60  /*********************** Template Functions ************************/
+
61 
+
66  template<typename T>
+
67  void setValue(const T &s) { m_value.setValue<T>(s); }
+
68 
+
77  template<typename T>
+
78  T getValue(time_t *timestamp = nullptr, bool skipSizeCheck = false) {
+
79  return m_value.getValue<T>(timestamp, skipSizeCheck);
+
80  }
81 
-
82  static int handleGapEvent(uint16_t conn_handle, uint16_t attr_handle,
-
83  struct ble_gatt_access_ctxt *ctxt, void *arg);
-
84  void setHandle(uint16_t handle);
-
85  void setCharacteristic(NimBLECharacteristic* pChar);
+
82 private:
+
83  friend class NimBLECharacteristic;
+
84  friend class NimBLEService;
+
85  friend class NimBLE2904;
86 
-
87  NimBLEUUID m_uuid;
-
88  uint16_t m_handle;
-
89  NimBLEDescriptorCallbacks* m_pCallbacks;
-
90  NimBLECharacteristic* m_pCharacteristic;
-
91  uint8_t m_properties;
-
92  attr_value_t m_value;
-
93  uint8_t m_removed;
-
94 }; // NimBLEDescriptor
-
95 
-
96 
-
104 class NimBLEDescriptorCallbacks {
-
105 public:
-
106  virtual ~NimBLEDescriptorCallbacks();
-
107  virtual void onRead(NimBLEDescriptor* pDescriptor);
-
108  virtual void onWrite(NimBLEDescriptor* pDescriptor);
-
109 };
-
110 
-
111 #include "NimBLE2904.h"
-
112 
-
113 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
-
114 #endif /* MAIN_NIMBLEDESCRIPTOR_H_ */
+
87  static int handleGapEvent(uint16_t conn_handle, uint16_t attr_handle,
+
88  struct ble_gatt_access_ctxt *ctxt, void *arg);
+
89  void setHandle(uint16_t handle);
+
90  void setCharacteristic(NimBLECharacteristic* pChar);
+
91 
+
92  NimBLEUUID m_uuid;
+
93  uint16_t m_handle;
+
94  NimBLEDescriptorCallbacks* m_pCallbacks;
+
95  NimBLECharacteristic* m_pCharacteristic;
+
96  uint8_t m_properties;
+
97  NimBLEAttValue m_value;
+
98  uint8_t m_removed;
+
99 }; // NimBLEDescriptor
+
100 
+
101 
+
109 class NimBLEDescriptorCallbacks {
+
110 public:
+
111  virtual ~NimBLEDescriptorCallbacks();
+
112  virtual void onRead(NimBLEDescriptor* pDescriptor);
+
113  virtual void onWrite(NimBLEDescriptor* pDescriptor);
+
114 };
+
115 
+
116 #include "NimBLE2904.h"
+
117 
+
118 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
+
119 #endif /* MAIN_NIMBLEDESCRIPTOR_H_ */
Descriptor for Characteristic Presentation Format.
Definition: NimBLE2904.h:40
-
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:62
-
Callbacks that can be associated with a BLE descriptors to inform of events.
Definition: NimBLEDescriptor.h:104
-
virtual void onRead(NimBLEDescriptor *pDescriptor)
Callback function to support a read request.
Definition: NimBLEDescriptor.cpp:282
-
virtual void onWrite(NimBLEDescriptor *pDescriptor)
Callback function to support a write request.
Definition: NimBLEDescriptor.cpp:292
-
A model of a BLE descriptor.
Definition: NimBLEDescriptor.h:42
-
size_t getLength()
Get the length of the value of this descriptor.
Definition: NimBLEDescriptor.cpp:103
-
NimBLEDescriptor(const char *uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)
NimBLEDescriptor constructor.
Definition: NimBLEDescriptor.cpp:33
-
NimBLECharacteristic * getCharacteristic()
Get the characteristic this descriptor belongs to.
Definition: NimBLEDescriptor.cpp:138
-
uint16_t getHandle()
Get the BLE handle for this descriptor.
Definition: NimBLEDescriptor.cpp:94
-
std::string getStringValue()
Get the value of this descriptor as a string.
Definition: NimBLEDescriptor.cpp:129
-
void setValue(const T &s)
Convenience template to set the descriptor value to <type>val.
Definition: NimBLEDescriptor.h:73
-
void setValue(const uint8_t *data, size_t size)
Set the value of the descriptor.
Definition: NimBLEDescriptor.cpp:233
-
void setCallbacks(NimBLEDescriptorCallbacks *pCallbacks)
Set the callback handlers for this descriptor.
Definition: NimBLEDescriptor.cpp:206
-
NimBLEUUID getUUID()
Get the UUID of the descriptor.
Definition: NimBLEDescriptor.cpp:111
-
std::string toString()
Return a string representation of the descriptor.
Definition: NimBLEDescriptor.cpp:268
-
uint8_t * getValue()
Get the value of this descriptor.
Definition: NimBLEDescriptor.cpp:120
-
~NimBLEDescriptor()
NimBLEDescriptor destructor.
Definition: NimBLEDescriptor.cpp:86
+
A specialized container class to hold BLE attribute values.
Definition: NimBLEAttValue.h:61
+
bool setValue(const uint8_t *value, uint16_t len)
Set the value from a buffer.
Definition: NimBLEAttValue.h:380
+
const uint8_t * getValue(time_t *timestamp)
Get a pointer to the value buffer with timestamp.
Definition: NimBLEAttValue.h:369
+
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:63
+
Callbacks that can be associated with a BLE descriptors to inform of events.
Definition: NimBLEDescriptor.h:109
+
virtual void onRead(NimBLEDescriptor *pDescriptor)
Callback function to support a read request.
Definition: NimBLEDescriptor.cpp:289
+
virtual void onWrite(NimBLEDescriptor *pDescriptor)
Callback function to support a write request.
Definition: NimBLEDescriptor.cpp:299
+
A model of a BLE descriptor.
Definition: NimBLEDescriptor.h:35
+
size_t getLength()
Get the length of the value of this descriptor.
Definition: NimBLEDescriptor.cpp:107
+
NimBLEDescriptor(const char *uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)
Construct a descriptor.
Definition: NimBLEDescriptor.cpp:37
+
NimBLECharacteristic * getCharacteristic()
Get the characteristic this descriptor belongs to.
Definition: NimBLEDescriptor.cpp:146
+
uint16_t getHandle()
Get the BLE handle for this descriptor.
Definition: NimBLEDescriptor.cpp:98
+
T getValue(time_t *timestamp=nullptr, bool skipSizeCheck=false)
Template to convert the descriptor data to <type>.
Definition: NimBLEDescriptor.h:78
+
std::string getStringValue()
Get the value of this descriptor as a string.
Definition: NimBLEDescriptor.cpp:137
+
NimBLEAttValue getValue(time_t *timestamp=nullptr)
Get the value of this descriptor.
Definition: NimBLEDescriptor.cpp:124
+
void setValue(const T &s)
Template to set the characteristic value to <type>val.
Definition: NimBLEDescriptor.h:67
+
void setValue(const uint8_t *data, size_t size)
Set the value of the descriptor.
Definition: NimBLEDescriptor.cpp:248
+
void setCallbacks(NimBLEDescriptorCallbacks *pCallbacks)
Set the callback handlers for this descriptor.
Definition: NimBLEDescriptor.cpp:221
+
NimBLEUUID getUUID()
Get the UUID of the descriptor.
Definition: NimBLEDescriptor.cpp:115
+
std::string toString()
Return a string representation of the descriptor.
Definition: NimBLEDescriptor.cpp:275
+
~NimBLEDescriptor()
NimBLEDescriptor destructor.
Definition: NimBLEDescriptor.cpp:91
The model of a BLE service.
Definition: NimBLEService.h:34
A model of a BLE UUID.
Definition: NimBLEUUID.h:37
diff --git a/_nim_b_l_e_device_8h_source.html b/_nim_b_l_e_device_8h_source.html index c3499f9..da4c684 100644 --- a/_nim_b_l_e_device_8h_source.html +++ b/_nim_b_l_e_device_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLEDevice.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEDevice.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -111,246 +111,269 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_device_8h_source.html','');
23 #endif
24 
25 #if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
-
26 #include "NimBLEAdvertising.h"
-
27 #endif
-
28 
-
29 #if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
-
30 #include "NimBLEClient.h"
+
26 # if CONFIG_BT_NIMBLE_EXT_ADV
+
27 # include "NimBLEExtAdvertising.h"
+
28 # else
+
29 # include "NimBLEAdvertising.h"
+
30 # endif
31 #endif
32 
-
33 #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
-
34 #include "NimBLEServer.h"
+
33 #if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+
34 #include "NimBLEClient.h"
35 #endif
36 
-
37 #include "NimBLEUtils.h"
-
38 #include "NimBLESecurity.h"
-
39 #include "NimBLEAddress.h"
+
37 #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+
38 #include "NimBLEServer.h"
+
39 #endif
40 
-
41 #ifdef ESP_PLATFORM
-
42 # include "esp_bt.h"
-
43 #endif
+
41 #include "NimBLEUtils.h"
+
42 #include "NimBLESecurity.h"
+
43 #include "NimBLEAddress.h"
44 
-
45 #include <map>
-
46 #include <string>
-
47 #include <list>
+
45 #ifdef ESP_PLATFORM
+
46 # include "esp_bt.h"
+
47 #endif
48 
-
49 #define BLEDevice NimBLEDevice
-
50 #define BLEClient NimBLEClient
-
51 #define BLERemoteService NimBLERemoteService
-
52 #define BLERemoteCharacteristic NimBLERemoteCharacteristic
-
53 #define BLERemoteDescriptor NimBLERemoteDescriptor
-
54 #define BLEAdvertisedDevice NimBLEAdvertisedDevice
-
55 #define BLEScan NimBLEScan
-
56 #define BLEUUID NimBLEUUID
-
57 #define BLESecurity NimBLESecurity
-
58 #define BLESecurityCallbacks NimBLESecurityCallbacks
-
59 #define BLEAddress NimBLEAddress
-
60 #define BLEUtils NimBLEUtils
-
61 #define BLEClientCallbacks NimBLEClientCallbacks
-
62 #define BLEAdvertisedDeviceCallbacks NimBLEAdvertisedDeviceCallbacks
-
63 #define BLEScanResults NimBLEScanResults
-
64 #define BLEServer NimBLEServer
-
65 #define BLEService NimBLEService
-
66 #define BLECharacteristic NimBLECharacteristic
-
67 #define BLEAdvertising NimBLEAdvertising
-
68 #define BLEServerCallbacks NimBLEServerCallbacks
-
69 #define BLECharacteristicCallbacks NimBLECharacteristicCallbacks
-
70 #define BLEAdvertisementData NimBLEAdvertisementData
-
71 #define BLEDescriptor NimBLEDescriptor
-
72 #define BLE2902 NimBLE2902
-
73 #define BLE2904 NimBLE2904
-
74 #define BLEDescriptorCallbacks NimBLEDescriptorCallbacks
-
75 #define BLEBeacon NimBLEBeacon
-
76 #define BLEEddystoneTLM NimBLEEddystoneTLM
-
77 #define BLEEddystoneURL NimBLEEddystoneURL
-
78 
-
79 #ifdef CONFIG_BT_NIMBLE_MAX_CONNECTIONS
-
80 #define NIMBLE_MAX_CONNECTIONS CONFIG_BT_NIMBLE_MAX_CONNECTIONS
-
81 #else
-
82 #define NIMBLE_MAX_CONNECTIONS CONFIG_NIMBLE_MAX_CONNECTIONS
-
83 #endif
-
84 
-
85 typedef int (*gap_event_handler)(ble_gap_event *event, void *arg);
-
86 
-
87 extern "C" void ble_store_config_init(void);
+
49 #include <map>
+
50 #include <string>
+
51 #include <list>
+
52 
+
53 #define BLEDevice NimBLEDevice
+
54 #define BLEClient NimBLEClient
+
55 #define BLERemoteService NimBLERemoteService
+
56 #define BLERemoteCharacteristic NimBLERemoteCharacteristic
+
57 #define BLERemoteDescriptor NimBLERemoteDescriptor
+
58 #define BLEAdvertisedDevice NimBLEAdvertisedDevice
+
59 #define BLEScan NimBLEScan
+
60 #define BLEUUID NimBLEUUID
+
61 #define BLESecurity NimBLESecurity
+
62 #define BLESecurityCallbacks NimBLESecurityCallbacks
+
63 #define BLEAddress NimBLEAddress
+
64 #define BLEUtils NimBLEUtils
+
65 #define BLEClientCallbacks NimBLEClientCallbacks
+
66 #define BLEAdvertisedDeviceCallbacks NimBLEAdvertisedDeviceCallbacks
+
67 #define BLEScanResults NimBLEScanResults
+
68 #define BLEServer NimBLEServer
+
69 #define BLEService NimBLEService
+
70 #define BLECharacteristic NimBLECharacteristic
+
71 #define BLEAdvertising NimBLEAdvertising
+
72 #define BLEServerCallbacks NimBLEServerCallbacks
+
73 #define BLECharacteristicCallbacks NimBLECharacteristicCallbacks
+
74 #define BLEAdvertisementData NimBLEAdvertisementData
+
75 #define BLEDescriptor NimBLEDescriptor
+
76 #define BLE2902 NimBLE2902
+
77 #define BLE2904 NimBLE2904
+
78 #define BLEDescriptorCallbacks NimBLEDescriptorCallbacks
+
79 #define BLEBeacon NimBLEBeacon
+
80 #define BLEEddystoneTLM NimBLEEddystoneTLM
+
81 #define BLEEddystoneURL NimBLEEddystoneURL
+
82 
+
83 #ifdef CONFIG_BT_NIMBLE_MAX_CONNECTIONS
+
84 #define NIMBLE_MAX_CONNECTIONS CONFIG_BT_NIMBLE_MAX_CONNECTIONS
+
85 #else
+
86 #define NIMBLE_MAX_CONNECTIONS CONFIG_NIMBLE_MAX_CONNECTIONS
+
87 #endif
88 
-
92 class NimBLEDevice {
-
93 public:
-
94  static void init(const std::string &deviceName);
-
95  static void deinit(bool clearAll = false);
-
96  static bool getInitialized();
-
97  static NimBLEAddress getAddress();
-
98  static std::string toString();
-
99  static bool whiteListAdd(const NimBLEAddress & address);
-
100  static bool whiteListRemove(const NimBLEAddress & address);
-
101  static bool onWhiteList(const NimBLEAddress & address);
-
102  static size_t getWhiteListCount();
-
103  static NimBLEAddress getWhiteListAddress(size_t index);
-
104 
-
105 #if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
-
106  static NimBLEScan* getScan();
-
107 #endif
+
89 typedef int (*gap_event_handler)(ble_gap_event *event, void *arg);
+
90 
+
91 extern "C" void ble_store_config_init(void);
+
92 
+
96 class NimBLEDevice {
+
97 public:
+
98  static void init(const std::string &deviceName);
+
99  static void deinit(bool clearAll = false);
+
100  static bool getInitialized();
+
101  static NimBLEAddress getAddress();
+
102  static std::string toString();
+
103  static bool whiteListAdd(const NimBLEAddress & address);
+
104  static bool whiteListRemove(const NimBLEAddress & address);
+
105  static bool onWhiteList(const NimBLEAddress & address);
+
106  static size_t getWhiteListCount();
+
107  static NimBLEAddress getWhiteListAddress(size_t index);
108 
-
109 #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
-
110  static NimBLEServer* createServer();
-
111  static NimBLEServer* getServer();
-
112 #endif
-
113 
-
114 #ifdef ESP_PLATFORM
-
115  static void setPower(esp_power_level_t powerLevel, esp_ble_power_type_t powerType=ESP_BLE_PWR_TYPE_DEFAULT);
-
116  static int getPower(esp_ble_power_type_t powerType=ESP_BLE_PWR_TYPE_DEFAULT);
-
117  static void setOwnAddrType(uint8_t own_addr_type, bool useNRPA=false);
-
118  static void setScanDuplicateCacheSize(uint16_t cacheSize);
-
119  static void setScanFilterMode(uint8_t type);
-
120 #else
-
121  static void setPower(int dbm);
-
122  static int getPower();
-
123 #endif
-
124 
-
125  static void setCustomGapHandler(gap_event_handler handler);
-
126  static void setSecurityAuth(bool bonding, bool mitm, bool sc);
-
127  static void setSecurityAuth(uint8_t auth_req);
-
128  static void setSecurityIOCap(uint8_t iocap);
-
129  static void setSecurityInitKey(uint8_t init_key);
-
130  static void setSecurityRespKey(uint8_t init_key);
-
131  static void setSecurityPasskey(uint32_t pin);
-
132  static uint32_t getSecurityPasskey();
-
133  static void setSecurityCallbacks(NimBLESecurityCallbacks* pCallbacks);
-
134  static int startSecurity(uint16_t conn_id);
-
135  static int setMTU(uint16_t mtu);
-
136  static uint16_t getMTU();
-
137  static bool isIgnored(const NimBLEAddress &address);
-
138  static void addIgnored(const NimBLEAddress &address);
-
139  static void removeIgnored(const NimBLEAddress &address);
-
140 
-
141 #if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
-
142  static NimBLEAdvertising* getAdvertising();
-
143  static void startAdvertising();
-
144  static void stopAdvertising();
-
145 #endif
-
146 
-
147 #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
-
148  static NimBLEClient* createClient(NimBLEAddress peerAddress = NimBLEAddress(""));
-
149  static bool deleteClient(NimBLEClient* pClient);
-
150  static NimBLEClient* getClientByID(uint16_t conn_id);
-
151  static NimBLEClient* getClientByPeerAddress(const NimBLEAddress &peer_addr);
-
152  static NimBLEClient* getDisconnectedClient();
-
153  static size_t getClientListSize();
-
154  static std::list<NimBLEClient*>* getClientList();
-
155 #endif
-
156 
-
157 #if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) || defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
-
158  static bool deleteBond(const NimBLEAddress &address);
-
159  static int getNumBonds();
-
160  static bool isBonded(const NimBLEAddress &address);
-
161  static void deleteAllBonds();
-
162  static NimBLEAddress getBondedAddress(int index);
-
163 #endif
-
164 
-
165 private:
-
166 #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
-
167  friend class NimBLEClient;
+
109 #if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
+
110  static NimBLEScan* getScan();
+
111 #endif
+
112 
+
113 #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+
114  static NimBLEServer* createServer();
+
115  static NimBLEServer* getServer();
+
116 #endif
+
117 
+
118 #ifdef ESP_PLATFORM
+
119  static void setPower(esp_power_level_t powerLevel, esp_ble_power_type_t powerType=ESP_BLE_PWR_TYPE_DEFAULT);
+
120  static int getPower(esp_ble_power_type_t powerType=ESP_BLE_PWR_TYPE_DEFAULT);
+
121  static void setOwnAddrType(uint8_t own_addr_type, bool useNRPA=false);
+
122  static void setScanDuplicateCacheSize(uint16_t cacheSize);
+
123  static void setScanFilterMode(uint8_t type);
+
124 #else
+
125  static void setPower(int dbm);
+
126  static int getPower();
+
127 #endif
+
128 
+
129  static void setCustomGapHandler(gap_event_handler handler);
+
130  static void setSecurityAuth(bool bonding, bool mitm, bool sc);
+
131  static void setSecurityAuth(uint8_t auth_req);
+
132  static void setSecurityIOCap(uint8_t iocap);
+
133  static void setSecurityInitKey(uint8_t init_key);
+
134  static void setSecurityRespKey(uint8_t init_key);
+
135  static void setSecurityPasskey(uint32_t pin);
+
136  static uint32_t getSecurityPasskey();
+
137  static void setSecurityCallbacks(NimBLESecurityCallbacks* pCallbacks);
+
138  static int startSecurity(uint16_t conn_id);
+
139  static int setMTU(uint16_t mtu);
+
140  static uint16_t getMTU();
+
141  static bool isIgnored(const NimBLEAddress &address);
+
142  static void addIgnored(const NimBLEAddress &address);
+
143  static void removeIgnored(const NimBLEAddress &address);
+
144 
+
145 #if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
+
146 # if CONFIG_BT_NIMBLE_EXT_ADV
+
147  static NimBLEExtAdvertising* getAdvertising();
+
148  static bool startAdvertising(uint8_t inst_id,
+
149  int duration = 0,
+
150  int max_events = 0);
+
151  static bool stopAdvertising(uint8_t inst_id);
+
152  static bool stopAdvertising();
+
153 # else
+
154  static NimBLEAdvertising* getAdvertising();
+
155  static bool startAdvertising();
+
156  static bool stopAdvertising();
+
157 # endif
+
158 #endif
+
159 
+
160 #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+
161  static NimBLEClient* createClient(NimBLEAddress peerAddress = NimBLEAddress(""));
+
162  static bool deleteClient(NimBLEClient* pClient);
+
163  static NimBLEClient* getClientByID(uint16_t conn_id);
+
164  static NimBLEClient* getClientByPeerAddress(const NimBLEAddress &peer_addr);
+
165  static NimBLEClient* getDisconnectedClient();
+
166  static size_t getClientListSize();
+
167  static std::list<NimBLEClient*>* getClientList();
168 #endif
169 
-
170 #if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
-
171  friend class NimBLEScan;
-
172 #endif
-
173 
-
174 #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
-
175  friend class NimBLEServer;
-
176  friend class NimBLECharacteristic;
-
177 #endif
-
178 
-
179 #if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
-
180  friend class NimBLEAdvertising;
+
170 #if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) || defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+
171  static bool deleteBond(const NimBLEAddress &address);
+
172  static int getNumBonds();
+
173  static bool isBonded(const NimBLEAddress &address);
+
174  static void deleteAllBonds();
+
175  static NimBLEAddress getBondedAddress(int index);
+
176 #endif
+
177 
+
178 private:
+
179 #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+
180  friend class NimBLEClient;
181 #endif
182 
-
183  static void onReset(int reason);
-
184  static void onSync(void);
-
185  static void host_task(void *param);
-
186  static bool m_synced;
-
187 
-
188 #if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
-
189  static NimBLEScan* m_pScan;
+
183 #if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
+
184  friend class NimBLEScan;
+
185 #endif
+
186 
+
187 #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+
188  friend class NimBLEServer;
+
189  friend class NimBLECharacteristic;
190 #endif
191 
-
192 #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
-
193  static NimBLEServer* m_pServer;
-
194 #endif
-
195 
-
196 #if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
-
197  static NimBLEAdvertising* m_bleAdvertising;
+
192 #if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
+
193  friend class NimBLEAdvertising;
+
194 # if CONFIG_BT_NIMBLE_EXT_ADV
+
195  friend class NimBLEExtAdvertising;
+
196  friend class NimBLEExtAdvertisement;
+
197 # endif
198 #endif
199 
-
200 #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
-
201  static std::list <NimBLEClient*> m_cList;
-
202 #endif
-
203  static std::list <NimBLEAddress> m_ignoreList;
-
204  static NimBLESecurityCallbacks* m_securityCallbacks;
-
205  static uint32_t m_passkey;
-
206  static ble_gap_event_listener m_listener;
-
207  static gap_event_handler m_customGapHandler;
-
208  static uint8_t m_own_addr_type;
-
209 #ifdef ESP_PLATFORM
-
210  static uint16_t m_scanDuplicateSize;
-
211  static uint8_t m_scanFilterMode;
-
212 #endif
-
213  static std::vector<NimBLEAddress> m_whiteList;
-
214 };
-
215 
-
216 
-
217 #endif // CONFIG_BT_ENABLED
-
218 #endif // MAIN_NIMBLEDEVICE_H_
+
200  static void onReset(int reason);
+
201  static void onSync(void);
+
202  static void host_task(void *param);
+
203  static bool m_synced;
+
204 
+
205 #if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
+
206  static NimBLEScan* m_pScan;
+
207 #endif
+
208 
+
209 #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+
210  static NimBLEServer* m_pServer;
+
211 #endif
+
212 
+
213 #if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
+
214 # if CONFIG_BT_NIMBLE_EXT_ADV
+
215  static NimBLEExtAdvertising* m_bleAdvertising;
+
216 # else
+
217  static NimBLEAdvertising* m_bleAdvertising;
+
218 # endif
+
219 #endif
+
220 
+
221 #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+
222  static std::list <NimBLEClient*> m_cList;
+
223 #endif
+
224  static std::list <NimBLEAddress> m_ignoreList;
+
225  static NimBLESecurityCallbacks* m_securityCallbacks;
+
226  static uint32_t m_passkey;
+
227  static ble_gap_event_listener m_listener;
+
228  static gap_event_handler m_customGapHandler;
+
229  static uint8_t m_own_addr_type;
+
230 #ifdef ESP_PLATFORM
+
231  static uint16_t m_scanDuplicateSize;
+
232  static uint8_t m_scanFilterMode;
+
233 #endif
+
234  static std::vector<NimBLEAddress> m_whiteList;
+
235 };
+
236 
+
237 
+
238 #endif // CONFIG_BT_ENABLED
+
239 #endif // MAIN_NIMBLEDEVICE_H_
A BLE device address.
Definition: NimBLEAddress.h:39
-
Perform and manage BLE advertising.
Definition: NimBLEAdvertising.h:85
-
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:62
-
A model of a BLE client.
Definition: NimBLEClient.h:38
-
A model of a BLE Device from which all the BLE roles are created.
Definition: NimBLEDevice.h:92
-
static void removeIgnored(const NimBLEAddress &address)
Remove a device from the ignore list.
Definition: NimBLEDevice.cpp:1133
-
static NimBLEClient * getDisconnectedClient()
Finds the first disconnected client in the list.
Definition: NimBLEDevice.cpp:288
-
static bool isIgnored(const NimBLEAddress &address)
Check if the device address is on our ignore list.
Definition: NimBLEDevice.cpp:1107
-
static bool isBonded(const NimBLEAddress &address)
Checks if a peer device is bonded.
Definition: NimBLEDevice.cpp:551
-
static std::list< NimBLEClient * > * getClientList()
Get the list of created client objects.
Definition: NimBLEDevice.cpp:235
-
static bool deleteBond(const NimBLEAddress &address)
Deletes a peer bond.
Definition: NimBLEDevice.cpp:531
-
static int startSecurity(uint16_t conn_id)
Start the connection securing and authorization for this connection.
Definition: NimBLEDevice.cpp:1091
-
static NimBLEServer * getServer()
Get the instance of the server.
Definition: NimBLEDevice.cpp:110
-
static NimBLEAddress getWhiteListAddress(size_t index)
Gets the address at the vector index.
Definition: NimBLEDevice.cpp:700
-
static NimBLEServer * createServer()
Create a new instance of a server.
Definition: NimBLEDevice.cpp:94
-
static uint16_t getMTU()
Get local MTU value set.
Definition: NimBLEDevice.cpp:445
-
static void setSecurityRespKey(uint8_t init_key)
Set the keys we are willing to accept during pairing.
Definition: NimBLEDevice.cpp:1012
-
static void init(const std::string &deviceName)
Initialize the BLE environment.
Definition: NimBLEDevice.cpp:802
-
static void addIgnored(const NimBLEAddress &address)
Add a device to the ignore list.
Definition: NimBLEDevice.cpp:1123
-
static NimBLEAddress getAddress()
Get our device address.
Definition: NimBLEDevice.cpp:397
-
static void setSecurityCallbacks(NimBLESecurityCallbacks *pCallbacks)
Set callbacks that will be used to handle encryption negotiation events and authentication events.
Definition: NimBLEDevice.cpp:1043
-
static int setMTU(uint16_t mtu)
Setup local mtu that will be used to negotiate mtu during request from client peer.
Definition: NimBLEDevice.cpp:426
-
static int getNumBonds()
Gets the number of bonded peers stored.
Definition: NimBLEDevice.cpp:503
-
static bool whiteListRemove(const NimBLEAddress &address)
Remove a peer address from the whitelist.
Definition: NimBLEDevice.cpp:649
-
static bool deleteClient(NimBLEClient *pClient)
Delete the client object and remove it from the list. Checks if it is connected or trying to connect ...
Definition: NimBLEDevice.cpp:190
-
static void setSecurityPasskey(uint32_t pin)
Set the passkey the server will ask for when pairing.
Definition: NimBLEDevice.cpp:1022
-
static void stopAdvertising()
Convenience function to stop advertising.
Definition: NimBLEDevice.cpp:140
-
static void setCustomGapHandler(gap_event_handler handler)
Set a custom callback for gap events.
Definition: NimBLEDevice.cpp:1148
-
static void setSecurityInitKey(uint8_t init_key)
If we are the initiator of the security procedure this sets the keys we will distribute.
Definition: NimBLEDevice.cpp:997
-
static uint32_t getSecurityPasskey()
Get the current passkey used for pairing.
Definition: NimBLEDevice.cpp:1032
-
static void setSecurityAuth(bool bonding, bool mitm, bool sc)
Set the authorization mode for this device.
Definition: NimBLEDevice.cpp:947
-
static NimBLEAdvertising * getAdvertising()
Get the instance of the advertising object.
Definition: NimBLEDevice.cpp:121
-
static bool whiteListAdd(const NimBLEAddress &address)
Add a peer address to the whitelist.
Definition: NimBLEDevice.cpp:617
-
static size_t getWhiteListCount()
Gets the count of addresses in the whitelist.
Definition: NimBLEDevice.cpp:689
-
static void deleteAllBonds()
Deletes all bonding information.
Definition: NimBLEDevice.cpp:520
-
static void setSecurityIOCap(uint8_t iocap)
Set the Input/Output capabilities of this device.
Definition: NimBLEDevice.cpp:982
-
static size_t getClientListSize()
Get the number of created client objects.
Definition: NimBLEDevice.cpp:245
-
static std::string toString()
Return a string representation of the address of this device.
Definition: NimBLEDevice.cpp:415
-
static NimBLEClient * getClientByPeerAddress(const NimBLEAddress &peer_addr)
Get a reference to a client by peer address.
Definition: NimBLEDevice.cpp:273
-
static NimBLEClient * getClientByID(uint16_t conn_id)
Get a reference to a client by connection ID.
Definition: NimBLEDevice.cpp:256
-
static NimBLEAddress getBondedAddress(int index)
Get the address of a bonded peer device by index.
Definition: NimBLEDevice.cpp:577
-
static void startAdvertising()
Convenience function to begin advertising.
Definition: NimBLEDevice.cpp:132
-
static bool getInitialized()
Check if the initialization is complete.
Definition: NimBLEDevice.cpp:935
-
static bool onWhiteList(const NimBLEAddress &address)
Checks if a peer device is whitelisted.
Definition: NimBLEDevice.cpp:600
-
static void deinit(bool clearAll=false)
Shutdown the NimBLE stack/controller.
Definition: NimBLEDevice.cpp:878
-
static NimBLEClient * createClient(NimBLEAddress peerAddress=NimBLEAddress(""))
Creates a new client object and maintains a list of all client objects each client can connect to 1 p...
Definition: NimBLEDevice.cpp:171
-
static NimBLEScan * getScan()
Retrieve the Scan object that we use for scanning.
Definition: NimBLEDevice.cpp:153
+
Perform and manage BLE advertising.
Definition: NimBLEAdvertising.h:87
+
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:63
+
A model of a BLE client.
Definition: NimBLEClient.h:39
+
A model of a BLE Device from which all the BLE roles are created.
Definition: NimBLEDevice.h:96
+
static void removeIgnored(const NimBLEAddress &address)
Remove a device from the ignore list.
Definition: NimBLEDevice.cpp:1178
+
static NimBLEClient * getDisconnectedClient()
Finds the first disconnected client in the list.
Definition: NimBLEDevice.cpp:333
+
static bool isIgnored(const NimBLEAddress &address)
Check if the device address is on our ignore list.
Definition: NimBLEDevice.cpp:1152
+
static bool isBonded(const NimBLEAddress &address)
Checks if a peer device is bonded.
Definition: NimBLEDevice.cpp:596
+
static std::list< NimBLEClient * > * getClientList()
Get the list of created client objects.
Definition: NimBLEDevice.cpp:280
+
static bool deleteBond(const NimBLEAddress &address)
Deletes a peer bond.
Definition: NimBLEDevice.cpp:576
+
static int startSecurity(uint16_t conn_id)
Start the connection securing and authorization for this connection.
Definition: NimBLEDevice.cpp:1136
+
static bool stopAdvertising()
Convenience function to stop all advertising.
Definition: NimBLEDevice.cpp:185
+
static NimBLEServer * getServer()
Get the instance of the server.
Definition: NimBLEDevice.cpp:114
+
static NimBLEAddress getWhiteListAddress(size_t index)
Gets the address at the vector index.
Definition: NimBLEDevice.cpp:745
+
static NimBLEServer * createServer()
Create a new instance of a server.
Definition: NimBLEDevice.cpp:98
+
static uint16_t getMTU()
Get local MTU value set.
Definition: NimBLEDevice.cpp:490
+
static void setSecurityRespKey(uint8_t init_key)
Set the keys we are willing to accept during pairing.
Definition: NimBLEDevice.cpp:1057
+
static void init(const std::string &deviceName)
Initialize the BLE environment.
Definition: NimBLEDevice.cpp:847
+
static void addIgnored(const NimBLEAddress &address)
Add a device to the ignore list.
Definition: NimBLEDevice.cpp:1168
+
static NimBLEAddress getAddress()
Get our device address.
Definition: NimBLEDevice.cpp:442
+
static void setSecurityCallbacks(NimBLESecurityCallbacks *pCallbacks)
Set callbacks that will be used to handle encryption negotiation events and authentication events.
Definition: NimBLEDevice.cpp:1088
+
static int setMTU(uint16_t mtu)
Setup local mtu that will be used to negotiate mtu during request from client peer.
Definition: NimBLEDevice.cpp:471
+
static int getNumBonds()
Gets the number of bonded peers stored.
Definition: NimBLEDevice.cpp:548
+
static bool whiteListRemove(const NimBLEAddress &address)
Remove a peer address from the whitelist.
Definition: NimBLEDevice.cpp:694
+
static bool deleteClient(NimBLEClient *pClient)
Delete the client object and remove it from the list. Checks if it is connected or trying to connect ...
Definition: NimBLEDevice.cpp:235
+
static void setSecurityPasskey(uint32_t pin)
Set the passkey the server will ask for when pairing.
Definition: NimBLEDevice.cpp:1067
+
static void setCustomGapHandler(gap_event_handler handler)
Set a custom callback for gap events.
Definition: NimBLEDevice.cpp:1193
+
static void setSecurityInitKey(uint8_t init_key)
If we are the initiator of the security procedure this sets the keys we will distribute.
Definition: NimBLEDevice.cpp:1042
+
static uint32_t getSecurityPasskey()
Get the current passkey used for pairing.
Definition: NimBLEDevice.cpp:1077
+
static void setSecurityAuth(bool bonding, bool mitm, bool sc)
Set the authorization mode for this device.
Definition: NimBLEDevice.cpp:992
+
static NimBLEExtAdvertising * getAdvertising()
Get the instance of the advertising object.
Definition: NimBLEDevice.cpp:126
+
static bool whiteListAdd(const NimBLEAddress &address)
Add a peer address to the whitelist.
Definition: NimBLEDevice.cpp:662
+
static size_t getWhiteListCount()
Gets the count of addresses in the whitelist.
Definition: NimBLEDevice.cpp:734
+
static void deleteAllBonds()
Deletes all bonding information.
Definition: NimBLEDevice.cpp:565
+
static void setSecurityIOCap(uint8_t iocap)
Set the Input/Output capabilities of this device.
Definition: NimBLEDevice.cpp:1027
+
static size_t getClientListSize()
Get the number of created client objects.
Definition: NimBLEDevice.cpp:290
+
static std::string toString()
Return a string representation of the address of this device.
Definition: NimBLEDevice.cpp:460
+
static NimBLEClient * getClientByPeerAddress(const NimBLEAddress &peer_addr)
Get a reference to a client by peer address.
Definition: NimBLEDevice.cpp:318
+
static NimBLEClient * getClientByID(uint16_t conn_id)
Get a reference to a client by connection ID.
Definition: NimBLEDevice.cpp:301
+
static NimBLEAddress getBondedAddress(int index)
Get the address of a bonded peer device by index.
Definition: NimBLEDevice.cpp:622
+
static bool getInitialized()
Check if the initialization is complete.
Definition: NimBLEDevice.cpp:980
+
static bool onWhiteList(const NimBLEAddress &address)
Checks if a peer device is whitelisted.
Definition: NimBLEDevice.cpp:645
+
static void deinit(bool clearAll=false)
Shutdown the NimBLE stack/controller.
Definition: NimBLEDevice.cpp:923
+
static bool startAdvertising(uint8_t inst_id, int duration=0, int max_events=0)
Convenience function to begin advertising.
Definition: NimBLEDevice.cpp:141
+
static NimBLEClient * createClient(NimBLEAddress peerAddress=NimBLEAddress(""))
Creates a new client object and maintains a list of all client objects each client can connect to 1 p...
Definition: NimBLEDevice.cpp:216
+
static NimBLEScan * getScan()
Retrieve the Scan object that we use for scanning.
Definition: NimBLEDevice.cpp:198
+
Extended advertisement data.
Definition: NimBLEExtAdvertising.h:37
+
Extended advertising class.
Definition: NimBLEExtAdvertising.h:92
Perform and manage BLE scans.
Definition: NimBLEScan.h:63
Callbacks to handle GAP events related to authorization. Deprecated - provided for backward compatibi...
Definition: NimBLESecurity.h:94
-
The model of a BLE server.
Definition: NimBLEServer.h:42
+
The model of a BLE server.
Definition: NimBLEServer.h:46
diff --git a/_nim_b_l_e_eddystone_t_l_m_8h_source.html b/_nim_b_l_e_eddystone_t_l_m_8h_source.html index 08f3b00..904d7f4 100644 --- a/_nim_b_l_e_eddystone_t_l_m_8h_source.html +++ b/_nim_b_l_e_eddystone_t_l_m_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLEEddystoneTLM.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEEddystoneTLM.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -143,17 +143,17 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_eddystone_t_l_m_8h_source.h
60 
61 #endif /* _NimBLEEddystoneTLM_H_ */
Representation of a beacon. See:
Definition: NimBLEEddystoneTLM.h:29
-
void setData(const std::string &data)
Set the raw data for the beacon advertisment.
Definition: NimBLEEddystoneTLM.cpp:164
+
void setData(const std::string &data)
Set the raw data for the beacon advertisement.
Definition: NimBLEEddystoneTLM.cpp:164
void setVersion(uint8_t version)
Set the version to advertise.
Definition: NimBLEEddystoneTLM.cpp:187
void setUUID(const NimBLEUUID &l_uuid)
Set the UUID to advertise.
Definition: NimBLEEddystoneTLM.cpp:178
NimBLEEddystoneTLM()
Construct a default EddystoneTLM beacon object.
Definition: NimBLEEddystoneTLM.cpp:32
-
uint32_t getCount()
Get the count of advertisments sent.
Definition: NimBLEEddystoneTLM.cpp:91
-
void setCount(uint32_t advCount)
Set the advertisment count.
Definition: NimBLEEddystoneTLM.cpp:214
+
uint32_t getCount()
Get the count of advertisements sent.
Definition: NimBLEEddystoneTLM.cpp:91
+
void setCount(uint32_t advCount)
Set the advertisement count.
Definition: NimBLEEddystoneTLM.cpp:214
void setTemp(float temp)
Set the temperature to advertise.
Definition: NimBLEEddystoneTLM.cpp:205
std::string toString()
Get a string representation of the beacon.
Definition: NimBLEEddystoneTLM.cpp:109
-
void setTime(uint32_t tmil)
Set the advertisment time.
Definition: NimBLEEddystoneTLM.cpp:223
+
void setTime(uint32_t tmil)
Set the advertisement time.
Definition: NimBLEEddystoneTLM.cpp:223
NimBLEUUID getUUID()
Get the UUID being advertised.
Definition: NimBLEEddystoneTLM.cpp:56
-
uint32_t getTime()
Get the advertisment time.
Definition: NimBLEEddystoneTLM.cpp:100
+
uint32_t getTime()
Get the advertisement time.
Definition: NimBLEEddystoneTLM.cpp:100
float getTemp()
Get the temperature being advertised.
Definition: NimBLEEddystoneTLM.cpp:83
void setVolt(uint16_t volt)
Set the battery voltage to advertise.
Definition: NimBLEEddystoneTLM.cpp:196
std::string getData()
Retrieve the data that is being advertised.
Definition: NimBLEEddystoneTLM.cpp:47
diff --git a/_nim_b_l_e_eddystone_u_r_l_8h_source.html b/_nim_b_l_e_eddystone_u_r_l_8h_source.html index 6fd5e4c..c8c0bac 100644 --- a/_nim_b_l_e_eddystone_u_r_l_8h_source.html +++ b/_nim_b_l_e_eddystone_u_r_l_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLEEddystoneURL.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEEddystoneURL.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -141,7 +141,7 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_eddystone_u_r_l_8h_source.h
void setURL(const std::string &url)
Set the URL to advertise.
Definition: NimBLEEddystoneURL.cpp:192
std::string getDecodedURL()
Get the full URL being advertised.
Definition: NimBLEEddystoneURL.cpp:77
std::string getData()
Retrieve the data that is being advertised.
Definition: NimBLEEddystoneURL.cpp:41
-
void setData(const std::string &data)
Set the raw data for the beacon advertisment.
Definition: NimBLEEddystoneURL.cpp:158
+
void setData(const std::string &data)
Set the raw data for the beacon advertisement.
Definition: NimBLEEddystoneURL.cpp:158
NimBLEEddystoneURL()
Construct a default EddystoneURL beacon object.
Definition: NimBLEEddystoneURL.cpp:28
void setUUID(const NimBLEUUID &l_uuid)
Set the UUID to advertise.
Definition: NimBLEEddystoneURL.cpp:174
A model of a BLE UUID.
Definition: NimBLEUUID.h:37
diff --git a/_nim_b_l_e_ext_advertising_8h_source.html b/_nim_b_l_e_ext_advertising_8h_source.html new file mode 100644 index 0000000..b6f48fb --- /dev/null +++ b/_nim_b_l_e_ext_advertising_8h_source.html @@ -0,0 +1,282 @@ + + + + + + + +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEExtAdvertising.h Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
esp-nimble-cpp +  1.4.0 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
NimBLEExtAdvertising.h
+
+
+
1 /*
+
2  * NimBLEExtAdvertising.h
+
3  *
+
4  * Created: on February 6, 2022
+
5  * Author H2zero
+
6  */
+
7 
+
8 #ifndef MAIN_BLEEXTADVERTISING_H_
+
9 #define MAIN_BLEEXTADVERTISING_H_
+
10 #include "nimconfig.h"
+
11 #if defined(CONFIG_BT_ENABLED) && \
+
12  defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && \
+
13  CONFIG_BT_NIMBLE_EXT_ADV
+
14 
+
15 # if defined(CONFIG_NIMBLE_CPP_IDF)
+
16 # include "host/ble_gap.h"
+
17 # else
+
18 # include "nimble/nimble/host/include/host/ble_gap.h"
+
19 # endif
+
20 
+
21 /**** FIX COMPILATION ****/
+
22 #undef min
+
23 #undef max
+
24 /**************************/
+
25 
+
26 #include "NimBLEAddress.h"
+
27 #include "NimBLEUUID.h"
+
28 
+
29 #include <vector>
+
30 
+ +
32 
+
33 
+ +
38 public:
+
39  NimBLEExtAdvertisement(uint8_t priPhy = BLE_HCI_LE_PHY_1M,
+
40  uint8_t secPhy = BLE_HCI_LE_PHY_1M);
+
41  void setAppearance(uint16_t appearance);
+
42  void setCompleteServices(const NimBLEUUID &uuid);
+
43  void setCompleteServices16(const std::vector<NimBLEUUID> &v_uuid);
+
44  void setCompleteServices32(const std::vector<NimBLEUUID> &v_uuid);
+
45  void setFlags(uint8_t flag);
+
46  void setManufacturerData(const std::string &data);
+
47  void setURI(const std::string &uri);
+
48  void setName(const std::string &name);
+
49  void setPartialServices(const NimBLEUUID &uuid);
+
50  void setPartialServices16(const std::vector<NimBLEUUID> &v_uuid);
+
51  void setPartialServices32(const std::vector<NimBLEUUID> &v_uuid);
+
52  void setServiceData(const NimBLEUUID &uuid, const std::string &data);
+
53  void setShortName(const std::string &name);
+
54  void setData(const uint8_t * data, size_t length);
+
55  void addData(const std::string &data);
+
56  void addData(const uint8_t * data, size_t length);
+
57  void addTxPower();
+
58  void setPreferredParams(uint16_t min, uint16_t max);
+
59  void setLegacyAdvertising(bool val);
+
60  void setConnectable(bool val);
+
61  void setScannable(bool val);
+
62  void setMinInterval(uint32_t mininterval);
+
63  void setMaxInterval(uint32_t maxinterval);
+
64  void setPrimaryPhy(uint8_t phy);
+
65  void setSecondaryPhy(uint8_t phy);
+
66  void setScanFilter(bool scanRequestWhitelistOnly, bool connectWhitelistOnly);
+
67  void setDirectedPeer(const NimBLEAddress & addr);
+
68  void setDirected(bool val, bool high_duty = true);
+
69  void setAnonymous(bool val);
+
70  void setPrimaryChannels(bool ch37, bool ch38, bool ch39);
+
71  void setTxPower(int8_t dbm);
+
72  void setAddress(const NimBLEAddress & addr);
+
73  void enableScanRequestCallback(bool enable);
+
74  void clearData();
+
75  size_t getDataSize();
+
76 
+
77 private:
+
78  friend class NimBLEExtAdvertising;
+
79 
+
80  void setServices(const bool complete, const uint8_t size,
+
81  const std::vector<NimBLEUUID> &v_uuid);
+
82 
+
83  std::vector<uint8_t> m_payload;
+
84  ble_gap_ext_adv_params m_params;
+
85  NimBLEAddress m_advAddress;
+
86 }; // NimBLEExtAdvertisement
+
87 
+
88 
+ +
93 public:
+
97  NimBLEExtAdvertising() :m_advStatus(CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES + 1, false) {}
+ +
99  bool start(uint8_t inst_id, int duration = 0, int max_events = 0);
+
100  bool setInstanceData(uint8_t inst_id, NimBLEExtAdvertisement& adv);
+
101  bool setScanResponseData(uint8_t inst_id, NimBLEExtAdvertisement & data);
+
102  bool removeInstance(uint8_t inst_id);
+
103  bool removeAll();
+
104  bool stop(uint8_t inst_id);
+
105  bool stop();
+
106  bool isActive(uint8_t inst_id);
+
107  bool isAdvertising();
+ +
109  bool deleteCallbacks = true);
+
110 
+
111 private:
+
112  friend class NimBLEDevice;
+
113  friend class NimBLEServer;
+
114 
+
115  void onHostSync();
+
116  static int handleGapEvent(struct ble_gap_event *event, void *arg);
+
117 
+
118  bool m_scanResp;
+
119  bool m_deleteCallbacks;
+
120  NimBLEExtAdvertisingCallbacks* m_pCallbacks;
+
121  ble_gap_ext_adv_params m_advParams;
+
122  std::vector<bool> m_advStatus;
+
123 };
+
124 
+
125 
+ +
130 public:
+
131  virtual ~NimBLEExtAdvertisingCallbacks() {};
+
132 
+
139  virtual void onStopped(NimBLEExtAdvertising *pAdv, int reason, uint8_t inst_id);
+
140 
+
148  virtual void onScanRequest(NimBLEExtAdvertising *pAdv, uint8_t inst_id, NimBLEAddress addr);
+
149 }; // NimBLEExtAdvertisingCallbacks
+
150 
+
151 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && CONFIG_BT_NIMBLE_EXT_ADV */
+
152 #endif /* MAIN_BLEADVERTISING_H_ */
+
A BLE device address.
Definition: NimBLEAddress.h:39
+
A model of a BLE Device from which all the BLE roles are created.
Definition: NimBLEDevice.h:96
+
Extended advertisement data.
Definition: NimBLEExtAdvertising.h:37
+
void setCompleteServices(const NimBLEUUID &uuid)
Set a single service to advertise as a complete list of services.
Definition: NimBLEExtAdvertising.cpp:694
+
void setAddress(const NimBLEAddress &addr)
Set the address to use for this advertisement.
Definition: NimBLEExtAdvertising.cpp:446
+
void setScannable(bool val)
Sets wether the advertisement has scan response data available.
Definition: NimBLEExtAdvertising.cpp:414
+
void setData(const uint8_t *data, size_t length)
Set the advertisement data.
Definition: NimBLEExtAdvertising.cpp:599
+
void setCompleteServices16(const std::vector< NimBLEUUID > &v_uuid)
Set the complete list of 16 bit services to advertise.
Definition: NimBLEExtAdvertising.cpp:703
+
void clearData()
Clears the data stored in this instance, does not change settings.
Definition: NimBLEExtAdvertising.cpp:579
+
void setServiceData(const NimBLEUUID &uuid, const std::string &data)
Set the service data (UUID + data)
Definition: NimBLEExtAdvertising.cpp:801
+
void setScanFilter(bool scanRequestWhitelistOnly, bool connectWhitelistOnly)
Set the filtering for the scan filter.
Definition: NimBLEExtAdvertising.cpp:471
+
void setDirected(bool val, bool high_duty=true)
Enable or disable direct advertisements to the peer set with NimBLEExtAdvertisement::setDirectedPeer
Definition: NimBLEExtAdvertising.cpp:508
+
void setCompleteServices32(const std::vector< NimBLEUUID > &v_uuid)
Set the complete list of 32 bit services to advertise.
Definition: NimBLEExtAdvertising.cpp:712
+
void setAnonymous(bool val)
Sets whether the advertisement should be anonymous.
Definition: NimBLEExtAdvertising.cpp:561
+
void setMaxInterval(uint32_t maxinterval)
Set the maximum advertising interval.
Definition: NimBLEExtAdvertising.cpp:527
+
void setDirectedPeer(const NimBLEAddress &addr)
Sets the peer to directly advertise to.
Definition: NimBLEExtAdvertising.cpp:495
+
void setFlags(uint8_t flag)
Set the advertisement flags.
Definition: NimBLEExtAdvertising.cpp:645
+
void setManufacturerData(const std::string &data)
Set manufacturer specific data.
Definition: NimBLEExtAdvertising.cpp:658
+
void setConnectable(bool val)
Sets wether this advertisement should advertise as a connectable device.
Definition: NimBLEExtAdvertising.cpp:435
+
void setShortName(const std::string &name)
Set the short name.
Definition: NimBLEExtAdvertising.cpp:838
+
void setTxPower(int8_t dbm)
Sets the transmission power level for this advertisement.
Definition: NimBLEExtAdvertising.cpp:426
+
void setLegacyAdvertising(bool val)
Sets wether the advertisement should use legacy (BLE 4.0, 31 bytes max) advertising.
Definition: NimBLEExtAdvertising.cpp:405
+
void setPartialServices16(const std::vector< NimBLEUUID > &v_uuid)
Set the partial list of services to advertise.
Definition: NimBLEExtAdvertising.cpp:730
+
void addData(const std::string &data)
Add data to the payload to be advertised.
Definition: NimBLEExtAdvertising.cpp:608
+
void setName(const std::string &name)
Set the complete name of this device.
Definition: NimBLEExtAdvertising.cpp:682
+
void setAppearance(uint16_t appearance)
Set the appearance.
Definition: NimBLEExtAdvertising.cpp:630
+
NimBLEExtAdvertisement(uint8_t priPhy=BLE_HCI_LE_PHY_1M, uint8_t secPhy=BLE_HCI_LE_PHY_1M)
Construct a BLE extended advertisement.
Definition: NimBLEExtAdvertising.cpp:390
+
void setSecondaryPhy(uint8_t phy)
Set the secondary advertising PHY to use.
Definition: NimBLEExtAdvertising.cpp:550
+
void enableScanRequestCallback(bool enable)
Sets whether the scan response request callback should be called.
Definition: NimBLEExtAdvertising.cpp:570
+
void setPrimaryChannels(bool ch37, bool ch38, bool ch39)
Sets The primary channels to advertise on.
Definition: NimBLEExtAdvertising.cpp:461
+
void setPartialServices(const NimBLEUUID &uuid)
Set a single service to advertise as a partial list of services.
Definition: NimBLEExtAdvertising.cpp:721
+
void setPreferredParams(uint16_t min, uint16_t max)
Set the preferred connection interval parameters.
Definition: NimBLEExtAdvertising.cpp:859
+
void addTxPower()
Adds Tx power level to the advertisement data.
Definition: NimBLEExtAdvertising.cpp:849
+
void setPartialServices32(const std::vector< NimBLEUUID > &v_uuid)
Set the partial list of services to advertise.
Definition: NimBLEExtAdvertising.cpp:739
+
void setPrimaryPhy(uint8_t phy)
Set the primary advertising PHY to use.
Definition: NimBLEExtAdvertising.cpp:538
+
void setMinInterval(uint32_t mininterval)
Set the minimum advertising interval.
Definition: NimBLEExtAdvertising.cpp:518
+
size_t getDataSize()
Get the size of the current data.
Definition: NimBLEExtAdvertising.cpp:588
+
void setURI(const std::string &uri)
Set the URI to advertise.
Definition: NimBLEExtAdvertising.cpp:670
+
Callbacks associated with NimBLEExtAdvertising class.
Definition: NimBLEExtAdvertising.h:129
+
virtual void onStopped(NimBLEExtAdvertising *pAdv, int reason, uint8_t inst_id)
Handle an advertising stop event.
Definition: NimBLEExtAdvertising.cpp:368
+
virtual void onScanRequest(NimBLEExtAdvertising *pAdv, uint8_t inst_id, NimBLEAddress addr)
Handle a scan response request. This is called when a scanning device requests a scan response.
Definition: NimBLEExtAdvertising.cpp:374
+
Extended advertising class.
Definition: NimBLEExtAdvertising.h:92
+
bool setInstanceData(uint8_t inst_id, NimBLEExtAdvertisement &adv)
Register the extended advertisement data.
Definition: NimBLEExtAdvertising.cpp:44
+
bool stop()
Stop all advertisements.
Definition: NimBLEExtAdvertising.cpp:257
+
~NimBLEExtAdvertising()
Destructor: deletes callback instances if requested.
Definition: NimBLEExtAdvertising.cpp:31
+
bool start(uint8_t inst_id, int duration=0, int max_events=0)
Start extended advertising.
Definition: NimBLEExtAdvertising.cpp:154
+
bool isActive(uint8_t inst_id)
Check if currently advertising.
Definition: NimBLEExtAdvertising.cpp:294
+
bool removeAll()
Stop and remove all advertising instance data.
Definition: NimBLEExtAdvertising.cpp:220
+
bool setScanResponseData(uint8_t inst_id, NimBLEExtAdvertisement &data)
Set the scan response data for a legacy advertisement.
Definition: NimBLEExtAdvertising.cpp:128
+
bool isAdvertising()
Check if any instances are currently advertising.
Definition: NimBLEExtAdvertising.cpp:303
+
void setCallbacks(NimBLEExtAdvertisingCallbacks *callbacks, bool deleteCallbacks=true)
Set a callback to call when the advertisement stops.
Definition: NimBLEExtAdvertising.cpp:278
+
bool removeInstance(uint8_t inst_id)
Stop and remove this instance data from the advertisement set.
Definition: NimBLEExtAdvertising.cpp:201
+
NimBLEExtAdvertising()
Construct an extended advertising object.
Definition: NimBLEExtAdvertising.h:97
+
The model of a BLE server.
Definition: NimBLEServer.h:46
+
A model of a BLE UUID.
Definition: NimBLEUUID.h:37
+ +
+
+ + + + diff --git a/_nim_b_l_e_h_i_d_device_8h_source.html b/_nim_b_l_e_h_i_d_device_8h_source.html index 96e804d..2eda75a 100644 --- a/_nim_b_l_e_h_i_d_device_8h_source.html +++ b/_nim_b_l_e_h_i_d_device_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLEHIDDevice.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEHIDDevice.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -169,7 +169,7 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_h_i_d_device_8h_source.html
84 
85 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER */
86 #endif /* _BLEHIDDEVICE_H_ */
-
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:62
+
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:63
A model of a BLE Human Interface Device.
Definition: NimBLEHIDDevice.h:40
NimBLEService * deviceInfo()
Returns a pointer to the device information service.
Definition: NimBLEHIDDevice.cpp:230
NimBLECharacteristic * protocolMode()
Returns a pointer to the protocol mode characteristic.
Definition: NimBLEHIDDevice.cpp:192
@@ -178,7 +178,7 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_h_i_d_device_8h_source.html
NimBLECharacteristic * manufacturer()
Create a manufacturer characteristic (this characteristic is optional).
Definition: NimBLEHIDDevice.cpp:88
NimBLECharacteristic * bootInput()
Creates a keyboard boot input report characteristic.
Definition: NimBLEHIDDevice.cpp:171
NimBLECharacteristic * featureReport(uint8_t reportID)
Create feature report characteristic.
Definition: NimBLEHIDDevice.cpp:158
-
void pnp(uint8_t sig, uint16_t vid, uint16_t pid, uint16_t version)
Sets the Plug n Play characterisc value.
Definition: NimBLEHIDDevice.cpp:108
+
void pnp(uint8_t sig, uint16_t vid, uint16_t pid, uint16_t version)
Sets the Plug n Play characteristic value.
Definition: NimBLEHIDDevice.cpp:108
void startServices()
Start the HID device services. This function called when all the services have been created.
Definition: NimBLEHIDDevice.cpp:79
NimBLECharacteristic * hidControl()
Returns a pointer to the HID control point characteristic.
Definition: NimBLEHIDDevice.cpp:185
void reportMap(uint8_t *map, uint16_t)
Set the report map data formatting information.
Definition: NimBLEHIDDevice.cpp:71
@@ -188,7 +188,7 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_h_i_d_device_8h_source.html
NimBLECharacteristic * outputReport(uint8_t reportID)
Create output report characteristic.
Definition: NimBLEHIDDevice.cpp:143
NimBLECharacteristic * bootOutput()
Create a keyboard boot output report characteristic.
Definition: NimBLEHIDDevice.cpp:178
NimBLEService * hidService()
Returns a pointer to the HID service.
Definition: NimBLEHIDDevice.cpp:237
-
The model of a BLE server.
Definition: NimBLEServer.h:42
+
The model of a BLE server.
Definition: NimBLEServer.h:46
The model of a BLE service.
Definition: NimBLEService.h:34
diff --git a/_nim_b_l_e_log_8h_source.html b/_nim_b_l_e_log_8h_source.html index 86b20b8..a31dce4 100644 --- a/_nim_b_l_e_log_8h_source.html +++ b/_nim_b_l_e_log_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLELog.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLELog.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
diff --git a/_nim_b_l_e_remote_characteristic_8h_source.html b/_nim_b_l_e_remote_characteristic_8h_source.html index 393a7b1..ff79d7d 100644 --- a/_nim_b_l_e_remote_characteristic_8h_source.html +++ b/_nim_b_l_e_remote_characteristic_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLERemoteCharacteristic.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLERemoteCharacteristic.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -111,154 +111,174 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_remote_characteristic_8h_so
23 
24 #include <vector>
25 #include <functional>
-
26 
-
27 class NimBLERemoteService;
-
28 class NimBLERemoteDescriptor;
-
29 
+
26 #include "NimBLELog.h"
+
27 
+
28 class NimBLERemoteService;
+
29 class NimBLERemoteDescriptor;
30 
-
31 typedef std::function<void (NimBLERemoteCharacteristic* pBLERemoteCharacteristic,
-
32  uint8_t* pData, size_t length, bool isNotify)> notify_callback;
-
33 
-
34 typedef struct {
-
35  const NimBLEUUID *uuid;
-
36  void *task_data;
-
37 } desc_filter_t;
-
38 
+
31 
+
32 typedef std::function<void (NimBLERemoteCharacteristic* pBLERemoteCharacteristic,
+
33  uint8_t* pData, size_t length, bool isNotify)> notify_callback;
+
34 
+
35 typedef struct {
+
36  const NimBLEUUID *uuid;
+
37  void *task_data;
+
38 } desc_filter_t;
39 
-
43 class NimBLERemoteCharacteristic {
-
44 public:
-
45  ~NimBLERemoteCharacteristic();
-
46 
-
47  // Public member functions
-
48  bool canBroadcast();
-
49  bool canIndicate();
-
50  bool canNotify();
-
51  bool canRead();
-
52  bool canWrite();
-
53  bool canWriteNoResponse();
-
54  std::vector<NimBLERemoteDescriptor*>::iterator begin();
-
55  std::vector<NimBLERemoteDescriptor*>::iterator end();
-
56  NimBLERemoteDescriptor* getDescriptor(const NimBLEUUID &uuid);
-
57  std::vector<NimBLERemoteDescriptor*>* getDescriptors(bool refresh = false);
-
58  void deleteDescriptors();
-
59  size_t deleteDescriptor(const NimBLEUUID &uuid);
-
60  uint16_t getHandle();
-
61  uint16_t getDefHandle();
-
62  NimBLEUUID getUUID();
-
63  std::string readValue(time_t *timestamp = nullptr);
-
64 
-
74  template<typename T>
-
75  T readValue(time_t *timestamp = nullptr, bool skipSizeCheck = false) {
-
76  std::string value = readValue(timestamp);
-
77  if(!skipSizeCheck && value.size() < sizeof(T)) return T();
-
78  const char *pData = value.data();
-
79  return *((T *)pData);
-
80  }
-
81 
-
82  uint8_t readUInt8() __attribute__ ((deprecated("Use template readValue<uint8_t>()")));
-
83  uint16_t readUInt16() __attribute__ ((deprecated("Use template readValue<uint16_t>()")));
-
84  uint32_t readUInt32() __attribute__ ((deprecated("Use template readValue<uint32_t>()")));
-
85  float readFloat() __attribute__ ((deprecated("Use template readValue<float>()")));
-
86  std::string getValue(time_t *timestamp = nullptr);
+
40 
+
44 class NimBLERemoteCharacteristic {
+
45 public:
+
46  ~NimBLERemoteCharacteristic();
+
47 
+
48  // Public member functions
+
49  bool canBroadcast();
+
50  bool canIndicate();
+
51  bool canNotify();
+
52  bool canRead();
+
53  bool canWrite();
+
54  bool canWriteNoResponse();
+
55  std::vector<NimBLERemoteDescriptor*>::iterator begin();
+
56  std::vector<NimBLERemoteDescriptor*>::iterator end();
+
57  NimBLERemoteDescriptor* getDescriptor(const NimBLEUUID &uuid);
+
58  std::vector<NimBLERemoteDescriptor*>* getDescriptors(bool refresh = false);
+
59  void deleteDescriptors();
+
60  size_t deleteDescriptor(const NimBLEUUID &uuid);
+
61  uint16_t getHandle();
+
62  uint16_t getDefHandle();
+
63  NimBLEUUID getUUID();
+
64  NimBLEAttValue readValue(time_t *timestamp = nullptr);
+
65  std::string toString();
+
66  NimBLERemoteService* getRemoteService();
+
67 
+
68  uint8_t readUInt8() __attribute__ ((deprecated("Use template readValue<uint8_t>()")));
+
69  uint16_t readUInt16() __attribute__ ((deprecated("Use template readValue<uint16_t>()")));
+
70  uint32_t readUInt32() __attribute__ ((deprecated("Use template readValue<uint32_t>()")));
+
71  float readFloat() __attribute__ ((deprecated("Use template readValue<float>()")));
+
72  NimBLEAttValue getValue(time_t *timestamp = nullptr);
+
73 
+
74  bool subscribe(bool notifications = true,
+
75  notify_callback notifyCallback = nullptr,
+
76  bool response = true);
+
77  bool unsubscribe(bool response = true);
+
78  bool registerForNotify(notify_callback notifyCallback,
+
79  bool notifications = true,
+
80  bool response = true)
+
81  __attribute__ ((deprecated("Use subscribe()/unsubscribe()")));
+
82  bool writeValue(const uint8_t* data,
+
83  size_t length,
+
84  bool response = false);
+
85  bool writeValue(const std::vector<uint8_t>& v, bool response = false);
+
86  bool writeValue(const char* s, bool response = false);
87 
-
97  template<typename T>
-
98  T getValue(time_t *timestamp = nullptr, bool skipSizeCheck = false) {
-
99  std::string value = getValue(timestamp);
-
100  if(!skipSizeCheck && value.size() < sizeof(T)) return T();
-
101  const char *pData = value.data();
-
102  return *((T *)pData);
-
103  }
-
104 
-
105  bool subscribe(bool notifications = true,
-
106  notify_callback notifyCallback = nullptr,
-
107  bool response = false);
-
108  bool unsubscribe(bool response = false);
-
109  bool registerForNotify(notify_callback notifyCallback,
-
110  bool notifications = true,
-
111  bool response = true)
-
112  __attribute__ ((deprecated("Use subscribe()/unsubscribe()")));
-
113  bool writeValue(const uint8_t* data,
-
114  size_t length,
-
115  bool response = false);
-
116  bool writeValue(const std::string &newValue,
-
117  bool response = false);
-
123  template<typename T>
-
124  bool writeValue(const T &s, bool response = false) {
-
125  return writeValue((uint8_t*)&s, sizeof(T), response);
-
126  }
-
127 
-
128  std::string toString();
-
129  NimBLERemoteService* getRemoteService();
-
130 
-
131 private:
-
132 
-
133  NimBLERemoteCharacteristic(NimBLERemoteService *pRemoteservice, const struct ble_gatt_chr *chr);
-
134 
-
135  friend class NimBLEClient;
-
136  friend class NimBLERemoteService;
-
137  friend class NimBLERemoteDescriptor;
-
138 
-
139  // Private member functions
-
140  bool setNotify(uint16_t val, notify_callback notifyCallback = nullptr, bool response = true);
-
141  bool retrieveDescriptors(const NimBLEUUID *uuid_filter = nullptr);
-
142  static int onReadCB(uint16_t conn_handle, const struct ble_gatt_error *error,
-
143  struct ble_gatt_attr *attr, void *arg);
-
144  static int onWriteCB(uint16_t conn_handle, const struct ble_gatt_error *error,
-
145  struct ble_gatt_attr *attr, void *arg);
-
146  static int descriptorDiscCB(uint16_t conn_handle, const struct ble_gatt_error *error,
-
147  uint16_t chr_val_handle, const struct ble_gatt_dsc *dsc,
-
148  void *arg);
-
149  static int nextCharCB(uint16_t conn_handle, const struct ble_gatt_error *error,
-
150  const struct ble_gatt_chr *chr, void *arg);
-
151 
-
152  // Private properties
-
153  NimBLEUUID m_uuid;
-
154  uint8_t m_charProp;
-
155  uint16_t m_handle;
-
156  uint16_t m_defHandle;
-
157  uint16_t m_endHandle;
-
158  NimBLERemoteService* m_pRemoteService;
-
159  std::string m_value;
-
160  notify_callback m_notifyCallback;
-
161  time_t m_timestamp;
-
162 
-
163  // We maintain a vector of descriptors owned by this characteristic.
-
164  std::vector<NimBLERemoteDescriptor*> m_descriptorVector;
-
165 }; // NimBLERemoteCharacteristic
-
166 
-
167 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
-
168 #endif /* COMPONENTS_NIMBLEREMOTECHARACTERISTIC_H_ */
-
A model of a BLE client.
Definition: NimBLEClient.h:38
-
A model of a remote BLE characteristic.
Definition: NimBLERemoteCharacteristic.h:43
-
bool canRead()
Does the characteristic support reading?
Definition: NimBLERemoteCharacteristic.cpp:116
-
uint16_t readUInt16() __attribute__((deprecated("Use template readValue<uint16_t>()")))
Read an unsigned 16 bit value.
Definition: NimBLERemoteCharacteristic.cpp:434
-
bool canWriteNoResponse()
Does the characteristic support writing with no response?
Definition: NimBLERemoteCharacteristic.cpp:134
-
std::vector< NimBLERemoteDescriptor * >::iterator end()
Get iterator to the end of the vector of remote descriptor pointers.
Definition: NimBLERemoteCharacteristic.cpp:372
-
bool writeValue(const uint8_t *data, size_t length, bool response=false)
Write the new value for the characteristic from a data buffer.
Definition: NimBLERemoteCharacteristic.cpp:739
-
T readValue(time_t *timestamp=nullptr, bool skipSizeCheck=false)
A template to convert the remote characteristic data to <type>.
Definition: NimBLERemoteCharacteristic.h:75
-
std::string toString()
Convert a NimBLERemoteCharacteristic to a string representation;.
Definition: NimBLERemoteCharacteristic.cpp:699
-
bool canIndicate()
Does the characteristic support indications?
Definition: NimBLERemoteCharacteristic.cpp:98
-
void deleteDescriptors()
Delete the descriptors in the descriptor vector.
Definition: NimBLERemoteCharacteristic.cpp:662
-
NimBLERemoteDescriptor * getDescriptor(const NimBLEUUID &uuid)
Get the descriptor instance with the given UUID that belongs to this characteristic.
Definition: NimBLERemoteCharacteristic.cpp:304
-
bool unsubscribe(bool response=false)
Unsubscribe for notifications or indications.
Definition: NimBLERemoteCharacteristic.cpp:631
-
bool canBroadcast()
Does the characteristic support broadcasting?
Definition: NimBLERemoteCharacteristic.cpp:89
-
uint32_t readUInt32() __attribute__((deprecated("Use template readValue<uint32_t>()")))
Read an unsigned 32 bit value.
Definition: NimBLERemoteCharacteristic.cpp:444
-
std::vector< NimBLERemoteDescriptor * >::iterator begin()
Get iterator to the beginning of the vector of remote descriptor pointers.
Definition: NimBLERemoteCharacteristic.cpp:363
-
std::string readValue(time_t *timestamp=nullptr)
Read the value of the remote characteristic.
Definition: NimBLERemoteCharacteristic.cpp:473
-
float readFloat() __attribute__((deprecated("Use template readValue<float>()")))
Read a float value.
Definition: NimBLERemoteCharacteristic.cpp:463
-
~NimBLERemoteCharacteristic()
Destructor.
Definition: NimBLERemoteCharacteristic.cpp:70
-
NimBLERemoteService * getRemoteService()
Get the remote service associated with this characteristic.
Definition: NimBLERemoteCharacteristic.cpp:398
-
bool canNotify()
Does the characteristic support notifications?
Definition: NimBLERemoteCharacteristic.cpp:107
-
bool subscribe(bool notifications=true, notify_callback notifyCallback=nullptr, bool response=false)
Subscribe for notifications or indications.
Definition: NimBLERemoteCharacteristic.cpp:617
-
size_t deleteDescriptor(const NimBLEUUID &uuid)
Delete descriptor by UUID.
Definition: NimBLERemoteCharacteristic.cpp:678
-
bool canWrite()
Does the characteristic support writing?
Definition: NimBLERemoteCharacteristic.cpp:125
-
uint16_t getHandle()
Get the handle for this characteristic.
Definition: NimBLERemoteCharacteristic.cpp:381
-
bool registerForNotify(notify_callback notifyCallback, bool notifications=true, bool response=true) __attribute__((deprecated("Use subscribe()/unsubscribe()")))
backward-compatibility method for subscribe/unsubscribe notifications/indications
Definition: NimBLERemoteCharacteristic.cpp:645
-
std::vector< NimBLERemoteDescriptor * > * getDescriptors(bool refresh=false)
Get a pointer to the vector of found descriptors.
Definition: NimBLERemoteCharacteristic.cpp:344
-
NimBLEUUID getUUID()
Get the UUID for this characteristic.
Definition: NimBLERemoteCharacteristic.cpp:407
-
std::string getValue(time_t *timestamp=nullptr)
Get the value of the remote characteristic.
Definition: NimBLERemoteCharacteristic.cpp:417
-
uint8_t readUInt8() __attribute__((deprecated("Use template readValue<uint8_t>()")))
Read a byte value.
Definition: NimBLERemoteCharacteristic.cpp:454
-
uint16_t getDefHandle()
Get the handle for this characteristics definition.
Definition: NimBLERemoteCharacteristic.cpp:389
+
88 
+
89  /*********************** Template Functions ************************/
+
90 
+
97  template<typename T>
+
98 #ifdef _DOXYGEN_
+
99  bool
+
100 #else
+
101  typename std::enable_if<!std::is_array<T>::value && !Has_c_str_len<T>::value, bool>::type
+
102 #endif
+
103  writeValue(const T& s, bool response = false) {
+
104  return writeValue((uint8_t*)&s, sizeof(T), response);
+
105  }
+
106 
+
113  template<typename T>
+
114 #ifdef _DOXYGEN_
+
115  bool
+
116 #else
+
117  typename std::enable_if<Has_c_str_len<T>::value, bool>::type
+
118 #endif
+
119  writeValue(const T& s, bool response = false) {
+
120  return writeValue((uint8_t*)s.c_str(), s.length(), response);
+
121  }
+
122 
+
132  template<typename T>
+
133  T getValue(time_t *timestamp = nullptr, bool skipSizeCheck = false) {
+
134  if(!skipSizeCheck && m_value.size() < sizeof(T)) return T();
+
135  return *((T *)m_value.getValue(timestamp));
+
136  }
+
137 
+
147  template<typename T>
+
148  T readValue(time_t *timestamp = nullptr, bool skipSizeCheck = false) {
+
149  NimBLEAttValue value = readValue();
+
150  if(!skipSizeCheck && value.size() < sizeof(T)) return T();
+
151  return *((T *)value.getValue(timestamp));
+
152  }
+
153 
+
154 private:
+
155 
+
156  NimBLERemoteCharacteristic(NimBLERemoteService *pRemoteservice, const struct ble_gatt_chr *chr);
+
157 
+
158  friend class NimBLEClient;
+
159  friend class NimBLERemoteService;
+
160  friend class NimBLERemoteDescriptor;
+
161 
+
162  // Private member functions
+
163  bool setNotify(uint16_t val, notify_callback notifyCallback = nullptr, bool response = true);
+
164  bool retrieveDescriptors(const NimBLEUUID *uuid_filter = nullptr);
+
165  static int onReadCB(uint16_t conn_handle, const struct ble_gatt_error *error,
+
166  struct ble_gatt_attr *attr, void *arg);
+
167  static int onWriteCB(uint16_t conn_handle, const struct ble_gatt_error *error,
+
168  struct ble_gatt_attr *attr, void *arg);
+
169  static int descriptorDiscCB(uint16_t conn_handle, const struct ble_gatt_error *error,
+
170  uint16_t chr_val_handle, const struct ble_gatt_dsc *dsc,
+
171  void *arg);
+
172  static int nextCharCB(uint16_t conn_handle, const struct ble_gatt_error *error,
+
173  const struct ble_gatt_chr *chr, void *arg);
+
174 
+
175  // Private properties
+
176  NimBLEUUID m_uuid;
+
177  uint8_t m_charProp;
+
178  uint16_t m_handle;
+
179  uint16_t m_defHandle;
+
180  uint16_t m_endHandle;
+
181  NimBLERemoteService* m_pRemoteService;
+
182  NimBLEAttValue m_value;
+
183  notify_callback m_notifyCallback;
+
184 
+
185  // We maintain a vector of descriptors owned by this characteristic.
+
186  std::vector<NimBLERemoteDescriptor*> m_descriptorVector;
+
187 }; // NimBLERemoteCharacteristic
+
188 
+
189 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
+
190 #endif /* COMPONENTS_NIMBLEREMOTECHARACTERISTIC_H_ */
+
A specialized container class to hold BLE attribute values.
Definition: NimBLEAttValue.h:61
+
const uint8_t * getValue(time_t *timestamp)
Get a pointer to the value buffer with timestamp.
Definition: NimBLEAttValue.h:369
+
uint16_t size() const
Returns the current size of the value in bytes.
Definition: NimBLEAttValue.h:151
+
A model of a BLE client.
Definition: NimBLEClient.h:39
+
A model of a remote BLE characteristic.
Definition: NimBLERemoteCharacteristic.h:44
+
bool canRead()
Does the characteristic support reading?
Definition: NimBLERemoteCharacteristic.cpp:115
+
uint16_t readUInt16() __attribute__((deprecated("Use template readValue<uint16_t>()")))
Read an unsigned 16 bit value.
Definition: NimBLERemoteCharacteristic.cpp:451
+
bool canWriteNoResponse()
Does the characteristic support writing with no response?
Definition: NimBLERemoteCharacteristic.cpp:133
+
std::vector< NimBLERemoteDescriptor * >::iterator end()
Get iterator to the end of the vector of remote descriptor pointers.
Definition: NimBLERemoteCharacteristic.cpp:392
+
bool writeValue(const uint8_t *data, size_t length, bool response=false)
Write a new value to the remote characteristic from a data buffer.
Definition: NimBLERemoteCharacteristic.cpp:765
+
NimBLEAttValue readValue(time_t *timestamp=nullptr)
Read the value of the remote characteristic.
Definition: NimBLERemoteCharacteristic.cpp:490
+
T readValue(time_t *timestamp=nullptr, bool skipSizeCheck=false)
Template to convert the remote characteristic data to <type>.
Definition: NimBLERemoteCharacteristic.h:148
+
std::string toString()
Convert a NimBLERemoteCharacteristic to a string representation;.
Definition: NimBLERemoteCharacteristic.cpp:714
+
bool canIndicate()
Does the characteristic support indications?
Definition: NimBLERemoteCharacteristic.cpp:97
+
void deleteDescriptors()
Delete the descriptors in the descriptor vector.
Definition: NimBLERemoteCharacteristic.cpp:677
+
NimBLERemoteDescriptor * getDescriptor(const NimBLEUUID &uuid)
Get the descriptor instance with the given UUID that belongs to this characteristic.
Definition: NimBLERemoteCharacteristic.cpp:307
+
NimBLEAttValue getValue(time_t *timestamp=nullptr)
Get the value of the remote characteristic.
Definition: NimBLERemoteCharacteristic.cpp:437
+
bool canBroadcast()
Does the characteristic support broadcasting?
Definition: NimBLERemoteCharacteristic.cpp:88
+
uint32_t readUInt32() __attribute__((deprecated("Use template readValue<uint32_t>()")))
Read an unsigned 32 bit value.
Definition: NimBLERemoteCharacteristic.cpp:461
+
T getValue(time_t *timestamp=nullptr, bool skipSizeCheck=false)
Template to convert the remote characteristic data to <type>.
Definition: NimBLERemoteCharacteristic.h:133
+
std::vector< NimBLERemoteDescriptor * >::iterator begin()
Get iterator to the beginning of the vector of remote descriptor pointers.
Definition: NimBLERemoteCharacteristic.cpp:383
+
float readFloat() __attribute__((deprecated("Use template readValue<float>()")))
Read a float value.
Definition: NimBLERemoteCharacteristic.cpp:480
+
~NimBLERemoteCharacteristic()
Destructor.
Definition: NimBLERemoteCharacteristic.cpp:69
+
NimBLERemoteService * getRemoteService()
Get the remote service associated with this characteristic.
Definition: NimBLERemoteCharacteristic.cpp:418
+
bool canNotify()
Does the characteristic support notifications?
Definition: NimBLERemoteCharacteristic.cpp:106
+
size_t deleteDescriptor(const NimBLEUUID &uuid)
Delete descriptor by UUID.
Definition: NimBLERemoteCharacteristic.cpp:693
+
bool canWrite()
Does the characteristic support writing?
Definition: NimBLERemoteCharacteristic.cpp:124
+
uint16_t getHandle()
Get the handle for this characteristic.
Definition: NimBLERemoteCharacteristic.cpp:401
+
bool registerForNotify(notify_callback notifyCallback, bool notifications=true, bool response=true) __attribute__((deprecated("Use subscribe()/unsubscribe()")))
backward-compatibility method for subscribe/unsubscribe notifications/indications
Definition: NimBLERemoteCharacteristic.cpp:660
+
std::vector< NimBLERemoteDescriptor * > * getDescriptors(bool refresh=false)
Get a pointer to the vector of found descriptors.
Definition: NimBLERemoteCharacteristic.cpp:364
+
bool writeValue(const T &s, bool response=false)
Template to set the remote characteristic value to <type>val.
Definition: NimBLERemoteCharacteristic.h:103
+
bool subscribe(bool notifications=true, notify_callback notifyCallback=nullptr, bool response=true)
Subscribe for notifications or indications.
Definition: NimBLERemoteCharacteristic.cpp:632
+
NimBLEUUID getUUID()
Get the UUID for this characteristic.
Definition: NimBLERemoteCharacteristic.cpp:427
+
uint8_t readUInt8() __attribute__((deprecated("Use template readValue<uint8_t>()")))
Read a byte value.
Definition: NimBLERemoteCharacteristic.cpp:471
+
bool unsubscribe(bool response=true)
Unsubscribe for notifications or indications.
Definition: NimBLERemoteCharacteristic.cpp:646
+
uint16_t getDefHandle()
Get the handle for this characteristics definition.
Definition: NimBLERemoteCharacteristic.cpp:409
A model of remote BLE descriptor.
Definition: NimBLERemoteDescriptor.h:27
A model of a remote BLE service.
Definition: NimBLERemoteService.h:34
A model of a BLE UUID.
Definition: NimBLEUUID.h:37
diff --git a/_nim_b_l_e_remote_descriptor_8h_source.html b/_nim_b_l_e_remote_descriptor_8h_source.html index 5c8182f..c141136 100644 --- a/_nim_b_l_e_remote_descriptor_8h_source.html +++ b/_nim_b_l_e_remote_descriptor_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLERemoteDescriptor.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLERemoteDescriptor.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -114,56 +114,78 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_remote_descriptor_8h_source
29  uint16_t getHandle();
30  NimBLERemoteCharacteristic* getRemoteCharacteristic();
31  NimBLEUUID getUUID();
-
32  std::string readValue();
+
32  NimBLEAttValue readValue();
33 
-
42  template<typename T>
-
43  T readValue(bool skipSizeCheck = false) {
-
44  std::string value = readValue();
-
45  if(!skipSizeCheck && value.size() < sizeof(T)) return T();
-
46  const char *pData = value.data();
-
47  return *((T *)pData);
-
48  }
-
49 
-
50  uint8_t readUInt8() __attribute__ ((deprecated("Use template readValue<uint8_t>()")));
-
51  uint16_t readUInt16() __attribute__ ((deprecated("Use template readValue<uint16_t>()")));
-
52  uint32_t readUInt32() __attribute__ ((deprecated("Use template readValue<uint32_t>()")));
-
53  std::string toString(void);
-
54  bool writeValue(const uint8_t* data, size_t length, bool response = false);
-
55  bool writeValue(const std::string &newValue, bool response = false);
-
56 
-
62  template<typename T>
-
63  bool writeValue(const T &s, bool response = false) {
-
64  return writeValue((uint8_t*)&s, sizeof(T), response);
-
65  }
-
66 
-
67 private:
-
68  friend class NimBLERemoteCharacteristic;
-
69 
-
70  NimBLERemoteDescriptor (NimBLERemoteCharacteristic* pRemoteCharacteristic,
-
71  const struct ble_gatt_dsc *dsc);
-
72  static int onWriteCB(uint16_t conn_handle, const struct ble_gatt_error *error,
-
73  struct ble_gatt_attr *attr, void *arg);
-
74  static int onReadCB(uint16_t conn_handle, const struct ble_gatt_error *error,
-
75  struct ble_gatt_attr *attr, void *arg);
+
34  uint8_t readUInt8() __attribute__ ((deprecated("Use template readValue<uint8_t>()")));
+
35  uint16_t readUInt16() __attribute__ ((deprecated("Use template readValue<uint16_t>()")));
+
36  uint32_t readUInt32() __attribute__ ((deprecated("Use template readValue<uint32_t>()")));
+
37  std::string toString(void);
+
38  bool writeValue(const uint8_t* data, size_t length, bool response = false);
+
39  bool writeValue(const std::vector<uint8_t>& v, bool response = false);
+
40  bool writeValue(const char* s, bool response = false);
+
41 
+
42 
+
43  /*********************** Template Functions ************************/
+
44 
+
51  template<typename T>
+
52 #ifdef _DOXYGEN_
+
53  bool
+
54 #else
+
55  typename std::enable_if<!std::is_array<T>::value && !Has_c_str_len<T>::value, bool>::type
+
56 #endif
+
57  writeValue(const T& s, bool response = false) {
+
58  return writeValue((uint8_t*)&s, sizeof(T), response);
+
59  }
+
60 
+
67  template<typename T>
+
68 #ifdef _DOXYGEN_
+
69  bool
+
70 #else
+
71  typename std::enable_if<Has_c_str_len<T>::value, bool>::type
+
72 #endif
+
73  writeValue(const T& s, bool response = false) {
+
74  return writeValue((uint8_t*)s.c_str(), s.length(), response);
+
75  }
76 
-
77  uint16_t m_handle;
-
78  NimBLEUUID m_uuid;
-
79  NimBLERemoteCharacteristic* m_pRemoteCharacteristic;
-
80 };
-
81 
-
82 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
-
83 #endif /* COMPONENTS_NIMBLEREMOTEDESCRIPTOR_H_ */
-
A model of a remote BLE characteristic.
Definition: NimBLERemoteCharacteristic.h:43
+
85  template<typename T>
+
86  T readValue(bool skipSizeCheck = false) {
+
87  NimBLEAttValue value = readValue();
+
88  if(!skipSizeCheck && value.size() < sizeof(T)) return T();
+
89  return *((T *)value.data());
+
90  }
+
91 
+
92 private:
+
93  friend class NimBLERemoteCharacteristic;
+
94 
+
95  NimBLERemoteDescriptor (NimBLERemoteCharacteristic* pRemoteCharacteristic,
+
96  const struct ble_gatt_dsc *dsc);
+
97  static int onWriteCB(uint16_t conn_handle, const struct ble_gatt_error *error,
+
98  struct ble_gatt_attr *attr, void *arg);
+
99  static int onReadCB(uint16_t conn_handle, const struct ble_gatt_error *error,
+
100  struct ble_gatt_attr *attr, void *arg);
+
101 
+
102  uint16_t m_handle;
+
103  NimBLEUUID m_uuid;
+
104  NimBLERemoteCharacteristic* m_pRemoteCharacteristic;
+
105 };
+
106 
+
107 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
+
108 #endif /* COMPONENTS_NIMBLEREMOTEDESCRIPTOR_H_ */
+
A specialized container class to hold BLE attribute values.
Definition: NimBLEAttValue.h:61
+
const uint8_t * data() const
Returns a pointer to the internal buffer of the value.
Definition: NimBLEAttValue.h:154
+
uint16_t size() const
Returns the current size of the value in bytes.
Definition: NimBLEAttValue.h:151
+
A model of a remote BLE characteristic.
Definition: NimBLERemoteCharacteristic.h:44
A model of remote BLE descriptor.
Definition: NimBLERemoteDescriptor.h:27
-
std::string toString(void)
Return a string representation of this Remote Descriptor.
Definition: NimBLERemoteDescriptor.cpp:234
-
bool writeValue(const uint8_t *data, size_t length, bool response=false)
Write data to the BLE Remote Descriptor.
Definition: NimBLERemoteDescriptor.cpp:276
-
uint16_t readUInt16() __attribute__((deprecated("Use template readValue<uint16_t>()")))
Read an unsigned 16 bit value.
Definition: NimBLERemoteDescriptor.cpp:102
-
uint32_t readUInt32() __attribute__((deprecated("Use template readValue<uint32_t>()")))
Read an unsigned 32 bit value.
Definition: NimBLERemoteDescriptor.cpp:116
-
std::string readValue()
Read the value of the remote descriptor.
Definition: NimBLERemoteDescriptor.cpp:129
+
std::string toString(void)
Return a string representation of this Remote Descriptor.
Definition: NimBLERemoteDescriptor.cpp:222
+
bool writeValue(const uint8_t *data, size_t length, bool response=false)
Write a new value to a remote descriptor.
Definition: NimBLERemoteDescriptor.cpp:286
+
uint16_t readUInt16() __attribute__((deprecated("Use template readValue<uint16_t>()")))
Read an unsigned 16 bit value.
Definition: NimBLERemoteDescriptor.cpp:98
+
bool writeValue(const T &s, bool response=false)
Template to set the remote descriptor value to <type>val.
Definition: NimBLERemoteDescriptor.h:57
+
uint32_t readUInt32() __attribute__((deprecated("Use template readValue<uint32_t>()")))
Read an unsigned 32 bit value.
Definition: NimBLERemoteDescriptor.cpp:108
NimBLERemoteCharacteristic * getRemoteCharacteristic()
Get the characteristic that owns this descriptor.
Definition: NimBLERemoteDescriptor.cpp:69
+
NimBLEAttValue readValue()
Read the value of the remote descriptor.
Definition: NimBLERemoteDescriptor.cpp:117
uint8_t readUInt8() __attribute__((deprecated("Use template readValue<uint8_t>()")))
Read a byte value.
Definition: NimBLERemoteDescriptor.cpp:88
uint16_t getHandle()
Retrieve the handle associated with this remote descriptor.
Definition: NimBLERemoteDescriptor.cpp:60
-
T readValue(bool skipSizeCheck=false)
A template to convert the remote descriptor data to <type>.
Definition: NimBLERemoteDescriptor.h:43
+
T readValue(bool skipSizeCheck=false)
Template to convert the remote descriptor data to <type>.
Definition: NimBLERemoteDescriptor.h:86
NimBLEUUID getUUID()
Retrieve the UUID associated this remote descriptor.
Definition: NimBLERemoteDescriptor.cpp:78
A model of a BLE UUID.
Definition: NimBLEUUID.h:37
diff --git a/_nim_b_l_e_remote_service_8h_source.html b/_nim_b_l_e_remote_service_8h_source.html index 744df6a..d0cf05e 100644 --- a/_nim_b_l_e_remote_service_8h_source.html +++ b/_nim_b_l_e_remote_service_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLERemoteService.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLERemoteService.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -168,20 +168,20 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_remote_service_8h_source.ht
83 
84 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
85 #endif /* COMPONENTS_NIMBLEREMOTESERVICE_H_ */
-
A model of a BLE client.
Definition: NimBLEClient.h:38
-
A model of a remote BLE characteristic.
Definition: NimBLERemoteCharacteristic.h:43
+
A model of a BLE client.
Definition: NimBLEClient.h:39
+
A model of a remote BLE characteristic.
Definition: NimBLERemoteCharacteristic.h:44
A model of a remote BLE service.
Definition: NimBLERemoteService.h:34
std::vector< NimBLERemoteCharacteristic * >::iterator end()
Get iterator to the end of the vector of remote characteristic pointers.
Definition: NimBLERemoteService.cpp:76
-
size_t deleteCharacteristic(const NimBLEUUID &uuid)
Delete characteristic by UUID.
Definition: NimBLERemoteService.cpp:350
-
void deleteCharacteristics()
Delete the characteristics in the characteristics vector.
Definition: NimBLERemoteService.cpp:335
+
size_t deleteCharacteristic(const NimBLEUUID &uuid)
Delete characteristic by UUID.
Definition: NimBLERemoteService.cpp:369
+
void deleteCharacteristics()
Delete the characteristics in the characteristics vector.
Definition: NimBLERemoteService.cpp:354
virtual ~NimBLERemoteService()
When deleting the service make sure we delete all characteristics and descriptors.
Definition: NimBLERemoteService.cpp:58
-
std::vector< NimBLERemoteCharacteristic * > * getCharacteristics(bool refresh=false)
Get a pointer to the vector of found characteristics.
Definition: NimBLERemoteService.cpp:135
-
NimBLEClient * getClient(void)
Get the client associated with this service.
Definition: NimBLERemoteService.cpp:259
+
std::vector< NimBLERemoteCharacteristic * > * getCharacteristics(bool refresh=false)
Get a pointer to the vector of found characteristics.
Definition: NimBLERemoteService.cpp:152
+
NimBLEClient * getClient(void)
Get the client associated with this service.
Definition: NimBLERemoteService.cpp:278
std::vector< NimBLERemoteCharacteristic * >::iterator begin()
Get iterator to the beginning of the vector of remote characteristic pointers.
Definition: NimBLERemoteService.cpp:67
-
std::string getValue(const NimBLEUUID &characteristicUuid)
Read the value of a characteristic associated with this service.
Definition: NimBLERemoteService.cpp:293
-
bool setValue(const NimBLEUUID &characteristicUuid, const std::string &value)
Set the value of a characteristic.
Definition: NimBLERemoteService.cpp:314
-
NimBLEUUID getUUID(void)
Get the service UUID.
Definition: NimBLERemoteService.cpp:283
-
std::string toString(void)
Create a string representation of this remote service.
Definition: NimBLERemoteService.cpp:371
+
std::string getValue(const NimBLEUUID &characteristicUuid)
Read the value of a characteristic associated with this service.
Definition: NimBLERemoteService.cpp:312
+
bool setValue(const NimBLEUUID &characteristicUuid, const std::string &value)
Set the value of a characteristic.
Definition: NimBLERemoteService.cpp:333
+
NimBLEUUID getUUID(void)
Get the service UUID.
Definition: NimBLERemoteService.cpp:302
+
std::string toString(void)
Create a string representation of this remote service.
Definition: NimBLERemoteService.cpp:390
NimBLERemoteCharacteristic * getCharacteristic(const char *uuid)
Get the remote characteristic object for the characteristic UUID.
Definition: NimBLERemoteService.cpp:86
A model of a BLE UUID.
Definition: NimBLEUUID.h:37
diff --git a/_nim_b_l_e_scan_8h_source.html b/_nim_b_l_e_scan_8h_source.html index 2faa970..920b5de 100644 --- a/_nim_b_l_e_scan_8h_source.html +++ b/_nim_b_l_e_scan_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLEScan.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEScan.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -178,31 +178,31 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_scan_8h_source.html',''); i
102 #endif /* CONFIG_BT_ENABLED CONFIG_BT_NIMBLE_ROLE_OBSERVER */
103 #endif /* COMPONENTS_NIMBLE_SCAN_H_ */
A BLE device address.
Definition: NimBLEAddress.h:39
-
A callback handler for callbacks associated device scanning.
Definition: NimBLEAdvertisedDevice.h:164
+
A callback handler for callbacks associated device scanning.
Definition: NimBLEAdvertisedDevice.h:185
A representation of a BLE advertised device found by a scan.
Definition: NimBLEAdvertisedDevice.h:42
-
A model of a BLE Device from which all the BLE roles are created.
Definition: NimBLEDevice.h:92
+
A model of a BLE Device from which all the BLE roles are created.
Definition: NimBLEDevice.h:96
Perform and manage BLE scans.
Definition: NimBLEScan.h:63
-
bool start(uint32_t duration, void(*scanCompleteCB)(NimBLEScanResults), bool is_continue=false)
Start scanning.
Definition: NimBLEScan.cpp:285
-
NimBLEScanResults getResults()
Get the results of the scan.
Definition: NimBLEScan.cpp:459
-
void setInterval(uint16_t intervalMSecs)
Set the interval to scan.
Definition: NimBLEScan.cpp:255
-
void setFilterPolicy(uint8_t filter)
Sets the scan filter policy.
Definition: NimBLEScan.cpp:224
-
void erase(const NimBLEAddress &address)
Delete peer device from the scan results vector.
Definition: NimBLEScan.cpp:422
-
bool stop()
Stop an in progress scan.
Definition: NimBLEScan.cpp:381
-
void clearDuplicateCache()
Clears the duplicate scan filter cache.
Definition: NimBLEScan.cpp:410
-
void setLimitedOnly(bool enabled)
Set whether or not the BLE controller only report scan results from devices advertising in limited di...
Definition: NimBLEScan.cpp:201
-
void setActiveScan(bool active)
Should we perform an active or passive scan? The default is a passive scan. An active scan means that...
Definition: NimBLEScan.cpp:179
-
void setMaxResults(uint8_t maxResults)
Sets the max number of results to store.
Definition: NimBLEScan.cpp:234
-
void setAdvertisedDeviceCallbacks(NimBLEAdvertisedDeviceCallbacks *pAdvertisedDeviceCallbacks, bool wantDuplicates=false)
Set the call backs to be invoked.
Definition: NimBLEScan.cpp:244
-
bool isScanning()
Get the status of the scanner.
Definition: NimBLEScan.cpp:273
-
void setWindow(uint16_t windowMSecs)
Set the window to actively scan.
Definition: NimBLEScan.cpp:264
-
void setDuplicateFilter(bool enabled)
Set whether or not the BLE controller should only report results from devices it has not already seen...
Definition: NimBLEScan.cpp:191
-
void clearResults()
Clear the results of the scan.
Definition: NimBLEScan.cpp:467
+
bool start(uint32_t duration, void(*scanCompleteCB)(NimBLEScanResults), bool is_continue=false)
Start scanning.
Definition: NimBLEScan.cpp:310
+
NimBLEScanResults getResults()
Get the results of the scan.
Definition: NimBLEScan.cpp:503
+
void setInterval(uint16_t intervalMSecs)
Set the interval to scan.
Definition: NimBLEScan.cpp:280
+
void setFilterPolicy(uint8_t filter)
Sets the scan filter policy.
Definition: NimBLEScan.cpp:249
+
void erase(const NimBLEAddress &address)
Delete peer device from the scan results vector.
Definition: NimBLEScan.cpp:466
+
bool stop()
Stop an in progress scan.
Definition: NimBLEScan.cpp:425
+
void clearDuplicateCache()
Clears the duplicate scan filter cache.
Definition: NimBLEScan.cpp:454
+
void setLimitedOnly(bool enabled)
Set whether or not the BLE controller only report scan results from devices advertising in limited di...
Definition: NimBLEScan.cpp:226
+
void setActiveScan(bool active)
Should we perform an active or passive scan? The default is a passive scan. An active scan means that...
Definition: NimBLEScan.cpp:204
+
void setMaxResults(uint8_t maxResults)
Sets the max number of results to store.
Definition: NimBLEScan.cpp:259
+
void setAdvertisedDeviceCallbacks(NimBLEAdvertisedDeviceCallbacks *pAdvertisedDeviceCallbacks, bool wantDuplicates=false)
Set the call backs to be invoked.
Definition: NimBLEScan.cpp:269
+
bool isScanning()
Get the status of the scanner.
Definition: NimBLEScan.cpp:298
+
void setWindow(uint16_t windowMSecs)
Set the window to actively scan.
Definition: NimBLEScan.cpp:289
+
void setDuplicateFilter(bool enabled)
Set whether or not the BLE controller should only report results from devices it has not already seen...
Definition: NimBLEScan.cpp:216
+
void clearResults()
Clear the results of the scan.
Definition: NimBLEScan.cpp:511
A class that contains and operates on the results of a BLE scan.
Definition: NimBLEScan.h:44
-
void dump()
Dump the scan results to the log.
Definition: NimBLEScan.cpp:479
-
std::vector< NimBLEAdvertisedDevice * >::iterator end()
Get iterator to the end of the vector of advertised device pointers.
Definition: NimBLEScan.cpp:520
-
NimBLEAdvertisedDevice getDevice(uint32_t i)
Return the specified device at the given index. The index should be between 0 and getCount()-1.
Definition: NimBLEScan.cpp:502
-
std::vector< NimBLEAdvertisedDevice * >::iterator begin()
Get iterator to the beginning of the vector of advertised device pointers.
Definition: NimBLEScan.cpp:511
-
int getCount()
Get the count of devices found in the last scan.
Definition: NimBLEScan.cpp:491
+
void dump()
Dump the scan results to the log.
Definition: NimBLEScan.cpp:523
+
std::vector< NimBLEAdvertisedDevice * >::iterator end()
Get iterator to the end of the vector of advertised device pointers.
Definition: NimBLEScan.cpp:564
+
NimBLEAdvertisedDevice getDevice(uint32_t i)
Return the specified device at the given index. The index should be between 0 and getCount()-1.
Definition: NimBLEScan.cpp:546
+
std::vector< NimBLEAdvertisedDevice * >::iterator begin()
Get iterator to the beginning of the vector of advertised device pointers.
Definition: NimBLEScan.cpp:555
+
int getCount()
Get the count of devices found in the last scan.
Definition: NimBLEScan.cpp:535
diff --git a/_nim_b_l_e_security_8h_source.html b/_nim_b_l_e_security_8h_source.html index 24830ed..f29e144 100644 --- a/_nim_b_l_e_security_8h_source.html +++ b/_nim_b_l_e_security_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLESecurity.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLESecurity.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -191,7 +191,7 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_security_8h_source.html',''
void setAuthenticationMode(esp_ble_auth_req_t auth_req)
Set requested authentication mode.
Definition: NimBLESecurity.cpp:40
void setRespEncryptionKey(uint8_t resp_key)
Sets the keys we will accept during encryption.
Definition: NimBLESecurity.cpp:86
void setKeySize(uint8_t key_size=16)
Definition: NimBLESecurity.cpp:94
-
void setInitEncryptionKey(uint8_t init_key)
Sets the keys we will distibute during encryption.
Definition: NimBLESecurity.cpp:72
+
void setInitEncryptionKey(uint8_t init_key)
Sets the keys we will distribute during encryption.
Definition: NimBLESecurity.cpp:72
diff --git a/_nim_b_l_e_server_8h_source.html b/_nim_b_l_e_server_8h_source.html index ed6b3f6..16cef2b 100644 --- a/_nim_b_l_e_server_8h_source.html +++ b/_nim_b_l_e_server_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLEServer.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEServer.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -113,137 +113,158 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_server_8h_source.html','');
25 
26 #include "NimBLEUtils.h"
27 #include "NimBLEAddress.h"
-
28 #include "NimBLEAdvertising.h"
-
29 #include "NimBLEService.h"
-
30 #include "NimBLESecurity.h"
-
31 #include "NimBLEConnInfo.h"
-
32 
-
33 
-
34 class NimBLEService;
-
35 class NimBLECharacteristic;
-
36 class NimBLEServerCallbacks;
+
28 #if CONFIG_BT_NIMBLE_EXT_ADV
+
29 #include "NimBLEExtAdvertising.h"
+
30 #else
+
31 #include "NimBLEAdvertising.h"
+
32 #endif
+
33 #include "NimBLEService.h"
+
34 #include "NimBLESecurity.h"
+
35 #include "NimBLEConnInfo.h"
+
36 
37 
-
38 
-
42 class NimBLEServer {
-
43 public:
-
44  size_t getConnectedCount();
-
45  NimBLEService* createService(const char* uuid);
-
46  NimBLEService* createService(const NimBLEUUID &uuid);
-
47  void removeService(NimBLEService* service, bool deleteSvc = false);
-
48  void addService(NimBLEService* service);
-
49  NimBLEAdvertising* getAdvertising();
-
50  void setCallbacks(NimBLEServerCallbacks* pCallbacks,
-
51  bool deleteCallbacks = true);
-
52  void startAdvertising();
-
53  void stopAdvertising();
-
54  void start();
-
55  NimBLEService* getServiceByUUID(const char* uuid, uint16_t instanceId = 0);
-
56  NimBLEService* getServiceByUUID(const NimBLEUUID &uuid, uint16_t instanceId = 0);
-
57  NimBLEService* getServiceByHandle(uint16_t handle);
-
58  int disconnect(uint16_t connID,
-
59  uint8_t reason = BLE_ERR_REM_USER_CONN_TERM);
-
60  void updateConnParams(uint16_t conn_handle,
-
61  uint16_t minInterval, uint16_t maxInterval,
-
62  uint16_t latency, uint16_t timeout);
-
63  void setDataLen(uint16_t conn_handle, uint16_t tx_octets);
-
64  uint16_t getPeerMTU(uint16_t conn_id);
-
65  std::vector<uint16_t> getPeerDevices();
-
66  NimBLEConnInfo getPeerInfo(size_t index);
-
67  NimBLEConnInfo getPeerInfo(const NimBLEAddress& address);
-
68  NimBLEConnInfo getPeerIDInfo(uint16_t id);
-
69  void advertiseOnDisconnect(bool);
-
70 
-
71 private:
-
72  NimBLEServer();
-
73  ~NimBLEServer();
-
74  friend class NimBLECharacteristic;
-
75  friend class NimBLEService;
-
76  friend class NimBLEDevice;
-
77  friend class NimBLEAdvertising;
-
78 
-
79  bool m_gattsStarted;
-
80  bool m_advertiseOnDisconnect;
-
81  bool m_svcChanged;
-
82  NimBLEServerCallbacks* m_pServerCallbacks;
-
83  bool m_deleteCallbacks;
-
84  uint16_t m_indWait[CONFIG_BT_NIMBLE_MAX_CONNECTIONS];
-
85  std::vector<uint16_t> m_connectedPeersVec;
-
86 
-
87 // uint16_t m_svcChgChrHdl; // Future use
-
88 
-
89  std::vector<NimBLEService*> m_svcVec;
-
90  std::vector<NimBLECharacteristic*> m_notifyChrVec;
-
91 
-
92  static int handleGapEvent(struct ble_gap_event *event, void *arg);
-
93  void serviceChanged();
-
94  void resetGATT();
-
95  bool setIndicateWait(uint16_t conn_handle);
-
96  void clearIndicateWait(uint16_t conn_handle);
-
97 }; // NimBLEServer
-
98 
-
99 
-
103 class NimBLEServerCallbacks {
-
104 public:
-
105  virtual ~NimBLEServerCallbacks() {};
+
38 class NimBLEService;
+
39 class NimBLECharacteristic;
+
40 class NimBLEServerCallbacks;
+
41 
+
42 
+
46 class NimBLEServer {
+
47 public:
+
48  size_t getConnectedCount();
+
49  NimBLEService* createService(const char* uuid);
+
50  NimBLEService* createService(const NimBLEUUID &uuid);
+
51  void removeService(NimBLEService* service, bool deleteSvc = false);
+
52  void addService(NimBLEService* service);
+
53  void setCallbacks(NimBLEServerCallbacks* pCallbacks,
+
54  bool deleteCallbacks = true);
+
55 #if CONFIG_BT_NIMBLE_EXT_ADV
+
56  NimBLEExtAdvertising* getAdvertising();
+
57  bool startAdvertising(uint8_t inst_id,
+
58  int duration = 0,
+
59  int max_events = 0);
+
60  bool stopAdvertising(uint8_t inst_id);
+
61 #else
+
62  NimBLEAdvertising* getAdvertising();
+
63  bool startAdvertising();
+
64 #endif
+
65  bool stopAdvertising();
+
66  void start();
+
67  NimBLEService* getServiceByUUID(const char* uuid, uint16_t instanceId = 0);
+
68  NimBLEService* getServiceByUUID(const NimBLEUUID &uuid, uint16_t instanceId = 0);
+
69  NimBLEService* getServiceByHandle(uint16_t handle);
+
70  int disconnect(uint16_t connID,
+
71  uint8_t reason = BLE_ERR_REM_USER_CONN_TERM);
+
72  void updateConnParams(uint16_t conn_handle,
+
73  uint16_t minInterval, uint16_t maxInterval,
+
74  uint16_t latency, uint16_t timeout);
+
75  void setDataLen(uint16_t conn_handle, uint16_t tx_octets);
+
76  uint16_t getPeerMTU(uint16_t conn_id);
+
77  std::vector<uint16_t> getPeerDevices();
+
78  NimBLEConnInfo getPeerInfo(size_t index);
+
79  NimBLEConnInfo getPeerInfo(const NimBLEAddress& address);
+
80  NimBLEConnInfo getPeerIDInfo(uint16_t id);
+
81 #if !CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)
+
82  void advertiseOnDisconnect(bool);
+
83 #endif
+
84 
+
85 private:
+
86  NimBLEServer();
+
87  ~NimBLEServer();
+
88  friend class NimBLECharacteristic;
+
89  friend class NimBLEService;
+
90  friend class NimBLEDevice;
+
91  friend class NimBLEAdvertising;
+
92 #if CONFIG_BT_NIMBLE_EXT_ADV
+
93  friend class NimBLEExtAdvertising;
+
94  friend class NimBLEExtAdvertisementData;
+
95 #endif
+
96 
+
97  bool m_gattsStarted;
+
98 #if !CONFIG_BT_NIMBLE_EXT_ADV
+
99  bool m_advertiseOnDisconnect;
+
100 #endif
+
101  bool m_svcChanged;
+
102  NimBLEServerCallbacks* m_pServerCallbacks;
+
103  bool m_deleteCallbacks;
+
104  uint16_t m_indWait[CONFIG_BT_NIMBLE_MAX_CONNECTIONS];
+
105  std::vector<uint16_t> m_connectedPeersVec;
106 
-
112  virtual void onConnect(NimBLEServer* pServer);
-
113 
-
121  virtual void onConnect(NimBLEServer* pServer, ble_gap_conn_desc* desc);
-
122 
-
128  virtual void onDisconnect(NimBLEServer* pServer);
-
129 
-
137  virtual void onDisconnect(NimBLEServer* pServer, ble_gap_conn_desc* desc);
-
138 
-
145  virtual void onMTUChange(uint16_t MTU, ble_gap_conn_desc* desc);
-
146 
-
151  virtual uint32_t onPassKeyRequest();
-
152 
-
153  //virtual void onPassKeyNotify(uint32_t pass_key);
-
154  //virtual bool onSecurityRequest();
-
155 
-
161  virtual void onAuthenticationComplete(ble_gap_conn_desc* desc);
-
162 
-
168  virtual bool onConfirmPIN(uint32_t pin);
-
169 }; // NimBLEServerCallbacks
-
170 
-
171 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
-
172 #endif /* MAIN_NIMBLESERVER_H_ */
+
107 // uint16_t m_svcChgChrHdl; // Future use
+
108 
+
109  std::vector<NimBLEService*> m_svcVec;
+
110  std::vector<NimBLECharacteristic*> m_notifyChrVec;
+
111 
+
112  static int handleGapEvent(struct ble_gap_event *event, void *arg);
+
113  void serviceChanged();
+
114  void resetGATT();
+
115  bool setIndicateWait(uint16_t conn_handle);
+
116  void clearIndicateWait(uint16_t conn_handle);
+
117 }; // NimBLEServer
+
118 
+
119 
+
123 class NimBLEServerCallbacks {
+
124 public:
+
125  virtual ~NimBLEServerCallbacks() {};
+
126 
+
132  virtual void onConnect(NimBLEServer* pServer);
+
133 
+
141  virtual void onConnect(NimBLEServer* pServer, ble_gap_conn_desc* desc);
+
142 
+
148  virtual void onDisconnect(NimBLEServer* pServer);
+
149 
+
157  virtual void onDisconnect(NimBLEServer* pServer, ble_gap_conn_desc* desc);
+
158 
+
165  virtual void onMTUChange(uint16_t MTU, ble_gap_conn_desc* desc);
+
166 
+
171  virtual uint32_t onPassKeyRequest();
+
172 
+
173  //virtual void onPassKeyNotify(uint32_t pass_key);
+
174  //virtual bool onSecurityRequest();
+
175 
+
181  virtual void onAuthenticationComplete(ble_gap_conn_desc* desc);
+
182 
+
188  virtual bool onConfirmPIN(uint32_t pin);
+
189 }; // NimBLEServerCallbacks
+
190 
+
191 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
+
192 #endif /* MAIN_NIMBLESERVER_H_ */
A BLE device address.
Definition: NimBLEAddress.h:39
-
Perform and manage BLE advertising.
Definition: NimBLEAdvertising.h:85
-
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:62
+
Perform and manage BLE advertising.
Definition: NimBLEAdvertising.h:87
+
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:63
Connection information.
Definition: NimBLEConnInfo.h:9
-
A model of a BLE Device from which all the BLE roles are created.
Definition: NimBLEDevice.h:92
-
Callbacks associated with the operation of a BLE server.
Definition: NimBLEServer.h:103
-
virtual void onDisconnect(NimBLEServer *pServer)
Handle a client disconnection. This is called when a client disconnects.
Definition: NimBLEServer.cpp:832
-
virtual bool onConfirmPIN(uint32_t pin)
Called when using numeric comparision for pairing.
Definition: NimBLEServer.cpp:861
-
virtual void onAuthenticationComplete(ble_gap_conn_desc *desc)
Called when the pairing procedure is complete.
Definition: NimBLEServer.cpp:858
-
virtual void onConnect(NimBLEServer *pServer)
Handle a client connection. This is called when a client connects.
Definition: NimBLEServer.cpp:822
-
virtual void onMTUChange(uint16_t MTU, ble_gap_conn_desc *desc)
Called when the connection MTU changes.
Definition: NimBLEServer.cpp:840
-
virtual uint32_t onPassKeyRequest()
Called when a client requests a passkey for pairing.
Definition: NimBLEServer.cpp:844
-
The model of a BLE server.
Definition: NimBLEServer.h:42
-
void removeService(NimBLEService *service, bool deleteSvc=false)
Remove a service from the server.
Definition: NimBLEServer.cpp:630
-
void setDataLen(uint16_t conn_handle, uint16_t tx_octets)
Request an update of the data packet length.
Definition: NimBLEServer.cpp:784
-
NimBLEService * getServiceByHandle(uint16_t handle)
Get a BLE Service by its handle.
Definition: NimBLEServer.cpp:133
-
void startAdvertising()
Start advertising.
Definition: NimBLEServer.cpp:724
-
NimBLEConnInfo getPeerInfo(size_t index)
Get the connection information of a connected peer by vector index.
Definition: NimBLEServer.cpp:273
-
void setCallbacks(NimBLEServerCallbacks *pCallbacks, bool deleteCallbacks=true)
Set the server callbacks.
Definition: NimBLEServer.cpp:602
-
int disconnect(uint16_t connID, uint8_t reason=BLE_ERR_REM_USER_CONN_TERM)
Disconnect the specified client with optional reason.
Definition: NimBLEServer.cpp:229
-
void advertiseOnDisconnect(bool)
Set the server to automatically start advertising when a client disconnects.
Definition: NimBLEServer.cpp:247
-
void addService(NimBLEService *service)
Adds a service which was either already created but removed from availability, or created and later a...
Definition: NimBLEServer.cpp:666
-
NimBLEService * getServiceByUUID(const char *uuid, uint16_t instanceId=0)
Get a BLE Service by its UUID.
Definition: NimBLEServer.cpp:104
-
size_t getConnectedCount()
Return the number of connected clients.
Definition: NimBLEServer.cpp:256
-
void updateConnParams(uint16_t conn_handle, uint16_t minInterval, uint16_t maxInterval, uint16_t latency, uint16_t timeout)
Request an Update the connection parameters:
Definition: NimBLEServer.cpp:755
-
uint16_t getPeerMTU(uint16_t conn_id)
Get the MTU of the client.
Definition: NimBLEServer.cpp:741
-
NimBLEService * createService(const char *uuid)
Create a BLE Service.
Definition: NimBLEServer.cpp:70
-
NimBLEAdvertising * getAdvertising()
Retrieve the advertising object that can be used to advertise the existence of the server.
Definition: NimBLEServer.cpp:147
-
void stopAdvertising()
Stop advertising.
Definition: NimBLEServer.cpp:732
-
std::vector< uint16_t > getPeerDevices()
Get the vector of the connected client ID's.
Definition: NimBLEServer.cpp:264
-
NimBLEConnInfo getPeerIDInfo(uint16_t id)
Get the connection information of a connected peer by connection ID.
Definition: NimBLEServer.cpp:306
-
void start()
Start the GATT server. Required to be called after setup of all services and characteristics / descri...
Definition: NimBLEServer.cpp:168
+
A model of a BLE Device from which all the BLE roles are created.
Definition: NimBLEDevice.h:96
+
Extended advertising class.
Definition: NimBLEExtAdvertising.h:92
+
Callbacks associated with the operation of a BLE server.
Definition: NimBLEServer.h:123
+
virtual void onDisconnect(NimBLEServer *pServer)
Handle a client disconnection. This is called when a client disconnects.
Definition: NimBLEServer.cpp:887
+
virtual bool onConfirmPIN(uint32_t pin)
Called when using numeric comparision for pairing.
Definition: NimBLEServer.cpp:916
+
virtual void onAuthenticationComplete(ble_gap_conn_desc *desc)
Called when the pairing procedure is complete.
Definition: NimBLEServer.cpp:913
+
virtual void onConnect(NimBLEServer *pServer)
Handle a client connection. This is called when a client connects.
Definition: NimBLEServer.cpp:877
+
virtual void onMTUChange(uint16_t MTU, ble_gap_conn_desc *desc)
Called when the connection MTU changes.
Definition: NimBLEServer.cpp:895
+
virtual uint32_t onPassKeyRequest()
Called when a client requests a passkey for pairing.
Definition: NimBLEServer.cpp:899
+
The model of a BLE server.
Definition: NimBLEServer.h:46
+
void removeService(NimBLEService *service, bool deleteSvc=false)
Remove a service from the server.
Definition: NimBLEServer.cpp:653
+
void setDataLen(uint16_t conn_handle, uint16_t tx_octets)
Request an update of the data packet length.
Definition: NimBLEServer.cpp:839
+
NimBLEService * getServiceByHandle(uint16_t handle)
Get a BLE Service by its handle.
Definition: NimBLEServer.cpp:135
+
NimBLEConnInfo getPeerInfo(size_t index)
Get the connection information of a connected peer by vector index.
Definition: NimBLEServer.cpp:287
+
void setCallbacks(NimBLEServerCallbacks *pCallbacks, bool deleteCallbacks=true)
Set the server callbacks.
Definition: NimBLEServer.cpp:625
+
int disconnect(uint16_t connID, uint8_t reason=BLE_ERR_REM_USER_CONN_TERM)
Disconnect the specified client with optional reason.
Definition: NimBLEServer.cpp:242
+
void advertiseOnDisconnect(bool)
Set the server to automatically start advertising when a client disconnects.
Definition: NimBLEServer.cpp:261
+
void addService(NimBLEService *service)
Adds a service which was either already created but removed from availability, or created and later a...
Definition: NimBLEServer.cpp:691
+
bool stopAdvertising()
Stop advertising.
Definition: NimBLEServer.cpp:787
+
NimBLEService * getServiceByUUID(const char *uuid, uint16_t instanceId=0)
Get a BLE Service by its UUID.
Definition: NimBLEServer.cpp:106
+
bool startAdvertising(uint8_t inst_id, int duration=0, int max_events=0)
Start advertising.
Definition: NimBLEServer.cpp:753
+
size_t getConnectedCount()
Return the number of connected clients.
Definition: NimBLEServer.cpp:270
+
void updateConnParams(uint16_t conn_handle, uint16_t minInterval, uint16_t maxInterval, uint16_t latency, uint16_t timeout)
Request an Update the connection parameters:
Definition: NimBLEServer.cpp:810
+
uint16_t getPeerMTU(uint16_t conn_id)
Get the MTU of the client.
Definition: NimBLEServer.cpp:796
+
NimBLEService * createService(const char *uuid)
Create a BLE Service.
Definition: NimBLEServer.cpp:72
+
NimBLEExtAdvertising * getAdvertising()
Retrieve the advertising object that can be used to advertise the existence of the server.
Definition: NimBLEServer.cpp:150
+
std::vector< uint16_t > getPeerDevices()
Get the vector of the connected client ID's.
Definition: NimBLEServer.cpp:278
+
NimBLEConnInfo getPeerIDInfo(uint16_t id)
Get the connection information of a connected peer by connection ID.
Definition: NimBLEServer.cpp:320
+
void start()
Start the GATT server. Required to be called after setup of all services and characteristics / descri...
Definition: NimBLEServer.cpp:181
The model of a BLE service.
Definition: NimBLEService.h:34
A model of a BLE UUID.
Definition: NimBLEUUID.h:37
-
#define CONFIG_BT_NIMBLE_MAX_CONNECTIONS
Un-comment to change the number of simultaneous connections (esp controller max is 9)
Definition: nimconfig.h:33
+
#define CONFIG_BT_NIMBLE_MAX_CONNECTIONS
Un-comment to change the number of simultaneous connections (esp controller max is 9)
Definition: nimconfig.h:40
diff --git a/_nim_b_l_e_service_8h_source.html b/_nim_b_l_e_service_8h_source.html index 5e35d95..984e823 100644 --- a/_nim_b_l_e_service_8h_source.html +++ b/_nim_b_l_e_service_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLEService.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEService.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -131,59 +131,61 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_service_8h_source.html','')
47 
48  bool start();
49 
-
50  NimBLECharacteristic* createCharacteristic(const char* uuid,
+
50  NimBLECharacteristic* createCharacteristic(const char* uuid,
51  uint32_t properties =
52  NIMBLE_PROPERTY::READ |
-
53  NIMBLE_PROPERTY::WRITE);
-
54 
-
55  NimBLECharacteristic* createCharacteristic(const NimBLEUUID &uuid,
-
56  uint32_t properties =
-
57  NIMBLE_PROPERTY::READ |
-
58  NIMBLE_PROPERTY::WRITE);
-
59 
-
60  void addCharacteristic(NimBLECharacteristic* pCharacteristic);
-
61  void removeCharacteristic(NimBLECharacteristic* pCharacteristic, bool deleteChr = false);
-
62  NimBLECharacteristic* getCharacteristic(const char* uuid, uint16_t instanceId = 0);
-
63  NimBLECharacteristic* getCharacteristic(const NimBLEUUID &uuid, uint16_t instanceId = 0);
-
64  NimBLECharacteristic* getCharacteristicByHandle(uint16_t handle);
-
65 
-
66  std::vector<NimBLECharacteristic*> getCharacteristics();
-
67  std::vector<NimBLECharacteristic*> getCharacteristics(const char* uuid);
-
68  std::vector<NimBLECharacteristic*> getCharacteristics(const NimBLEUUID &uuid);
-
69 
-
70 
-
71 private:
+
53  NIMBLE_PROPERTY::WRITE,
+
54  uint16_t max_len = BLE_ATT_ATTR_MAX_LEN);
+
55 
+
56  NimBLECharacteristic* createCharacteristic(const NimBLEUUID &uuid,
+
57  uint32_t properties =
+
58  NIMBLE_PROPERTY::READ |
+
59  NIMBLE_PROPERTY::WRITE,
+
60  uint16_t max_len = BLE_ATT_ATTR_MAX_LEN);
+
61 
+
62  void addCharacteristic(NimBLECharacteristic* pCharacteristic);
+
63  void removeCharacteristic(NimBLECharacteristic* pCharacteristic, bool deleteChr = false);
+
64  NimBLECharacteristic* getCharacteristic(const char* uuid, uint16_t instanceId = 0);
+
65  NimBLECharacteristic* getCharacteristic(const NimBLEUUID &uuid, uint16_t instanceId = 0);
+
66  NimBLECharacteristic* getCharacteristicByHandle(uint16_t handle);
+
67 
+
68  std::vector<NimBLECharacteristic*> getCharacteristics();
+
69  std::vector<NimBLECharacteristic*> getCharacteristics(const char* uuid);
+
70  std::vector<NimBLECharacteristic*> getCharacteristics(const NimBLEUUID &uuid);
+
71 
72 
-
73  friend class NimBLEServer;
-
74  friend class NimBLEDevice;
-
75 
-
76  uint16_t m_handle;
-
77  NimBLEUUID m_uuid;
-
78  ble_gatt_svc_def* m_pSvcDef;
-
79  uint8_t m_removed;
-
80  std::vector<NimBLECharacteristic*> m_chrVec;
-
81 
-
82 }; // NimBLEService
+
73 private:
+
74 
+
75  friend class NimBLEServer;
+
76  friend class NimBLEDevice;
+
77 
+
78  uint16_t m_handle;
+
79  NimBLEUUID m_uuid;
+
80  ble_gatt_svc_def* m_pSvcDef;
+
81  uint8_t m_removed;
+
82  std::vector<NimBLECharacteristic*> m_chrVec;
83 
-
84 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
-
85 #endif /* MAIN_NIMBLESERVICE_H_ */
-
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:62
-
A model of a BLE Device from which all the BLE roles are created.
Definition: NimBLEDevice.h:92
-
The model of a BLE server.
Definition: NimBLEServer.h:42
+
84 }; // NimBLEService
+
85 
+
86 #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
+
87 #endif /* MAIN_NIMBLESERVICE_H_ */
+
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:63
+
A model of a BLE Device from which all the BLE roles are created.
Definition: NimBLEDevice.h:96
+
The model of a BLE server.
Definition: NimBLEServer.h:46
The model of a BLE service.
Definition: NimBLEService.h:34
-
std::string toString()
Return a string representation of this service. A service is defined by:
Definition: NimBLEService.cpp:409
-
NimBLECharacteristic * getCharacteristic(const char *uuid, uint16_t instanceId=0)
Get a pointer to the characteristic object with the specified UUID.
Definition: NimBLEService.cpp:338
-
NimBLECharacteristic * getCharacteristicByHandle(uint16_t handle)
Get a pointer to the characteristic object with the specified handle.
Definition: NimBLEService.cpp:366
+
std::string toString()
Return a string representation of this service. A service is defined by:
Definition: NimBLEService.cpp:417
+
NimBLECharacteristic * getCharacteristic(const char *uuid, uint16_t instanceId=0)
Get a pointer to the characteristic object with the specified UUID.
Definition: NimBLEService.cpp:346
+
NimBLECharacteristic * getCharacteristicByHandle(uint16_t handle)
Get a pointer to the characteristic object with the specified handle.
Definition: NimBLEService.cpp:374
+
NimBLECharacteristic * createCharacteristic(const char *uuid, uint32_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)
Create a new BLE Characteristic associated with this service.
Definition: NimBLEService.cpp:262
NimBLEService(const char *uuid)
Construct an instance of the NimBLEService.
Definition: NimBLEService.cpp:36
void dump()
Dump details of this BLE GATT service.
Definition: NimBLEService.cpp:77
-
uint16_t getHandle()
Get the handle associated with this service.
Definition: NimBLEService.cpp:244
-
std::vector< NimBLECharacteristic * > getCharacteristics()
Definition: NimBLEService.cpp:378
+
uint16_t getHandle()
Get the handle associated with this service.
Definition: NimBLEService.cpp:250
+
std::vector< NimBLECharacteristic * > getCharacteristics()
Definition: NimBLEService.cpp:386
NimBLEUUID getUUID()
Get the UUID of the service.
Definition: NimBLEService.cpp:101
bool start()
Builds the database of characteristics/descriptors for the service and registers it with the NimBLE s...
Definition: NimBLEService.cpp:111
-
NimBLECharacteristic * createCharacteristic(const char *uuid, uint32_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE)
Create a new BLE Characteristic associated with this service.
Definition: NimBLEService.cpp:255
-
NimBLEServer * getServer()
Get the BLE server associated with this service.
Definition: NimBLEService.cpp:423
-
void addCharacteristic(NimBLECharacteristic *pCharacteristic)
Add a characteristic to the service.
Definition: NimBLEService.cpp:283
-
void removeCharacteristic(NimBLECharacteristic *pCharacteristic, bool deleteChr=false)
Remove a characteristic from the service.
Definition: NimBLEService.cpp:309
+
NimBLEServer * getServer()
Get the BLE server associated with this service.
Definition: NimBLEService.cpp:431
+
void addCharacteristic(NimBLECharacteristic *pCharacteristic)
Add a characteristic to the service.
Definition: NimBLEService.cpp:291
+
void removeCharacteristic(NimBLECharacteristic *pCharacteristic, bool deleteChr=false)
Remove a characteristic from the service.
Definition: NimBLEService.cpp:317
A model of a BLE UUID.
Definition: NimBLEUUID.h:37
diff --git a/_nim_b_l_e_u_u_i_d_8h_source.html b/_nim_b_l_e_u_u_i_d_8h_source.html index 8c7d08f..763b61f 100644 --- a/_nim_b_l_e_u_u_i_d_8h_source.html +++ b/_nim_b_l_e_u_u_i_d_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLEUUID.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEUUID.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -133,27 +133,29 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_u_u_i_d_8h_source.html','')
48  bool equals(const NimBLEUUID &uuid) const;
49  const ble_uuid_any_t* getNative() const;
50  const NimBLEUUID & to128();
-
51  std::string toString() const;
-
52  static NimBLEUUID fromString(const std::string &uuid);
-
53 
-
54  bool operator ==(const NimBLEUUID & rhs) const;
-
55  bool operator !=(const NimBLEUUID & rhs) const;
-
56  operator std::string() const;
-
57 
-
58 private:
-
59  ble_uuid_any_t m_uuid;
-
60  bool m_valueSet = false;
-
61 }; // NimBLEUUID
-
62 #endif /* CONFIG_BT_ENABLED */
-
63 #endif /* COMPONENTS_NIMBLEUUID_H_ */
+
51  const NimBLEUUID& to16();
+
52  std::string toString() const;
+
53  static NimBLEUUID fromString(const std::string &uuid);
+
54 
+
55  bool operator ==(const NimBLEUUID & rhs) const;
+
56  bool operator !=(const NimBLEUUID & rhs) const;
+
57  operator std::string() const;
+
58 
+
59 private:
+
60  ble_uuid_any_t m_uuid;
+
61  bool m_valueSet = false;
+
62 }; // NimBLEUUID
+
63 #endif /* CONFIG_BT_ENABLED */
+
64 #endif /* COMPONENTS_NIMBLEUUID_H_ */
A model of a BLE UUID.
Definition: NimBLEUUID.h:37
bool equals(const NimBLEUUID &uuid) const
Compare a UUID against this UUID.
Definition: NimBLEUUID.cpp:187
-
bool operator==(const NimBLEUUID &rhs) const
Convienience operator to check if this UUID is equal to another.
Definition: NimBLEUUID.cpp:279
+
bool operator==(const NimBLEUUID &rhs) const
Convenience operator to check if this UUID is equal to another.
Definition: NimBLEUUID.cpp:302
+
const NimBLEUUID & to16()
Convert 128 bit UUID to its 16 bit representation.
Definition: NimBLEUUID.cpp:266
const ble_uuid_any_t * getNative() const
Get the native UUID value.
Definition: NimBLEUUID.cpp:227
const NimBLEUUID & to128()
Convert a UUID to its 128 bit representation.
Definition: NimBLEUUID.cpp:242
-
std::string toString() const
Get a string representation of the UUID.
Definition: NimBLEUUID.cpp:271
+
std::string toString() const
Get a string representation of the UUID.
Definition: NimBLEUUID.cpp:294
NimBLEUUID()
Creates an empty UUID.
Definition: NimBLEUUID.cpp:166
-
bool operator!=(const NimBLEUUID &rhs) const
Convienience operator to check if this UUID is not equal to another.
Definition: NimBLEUUID.cpp:318
+
bool operator!=(const NimBLEUUID &rhs) const
Convenience operator to check if this UUID is not equal to another.
Definition: NimBLEUUID.cpp:341
static NimBLEUUID fromString(const std::string &uuid)
Definition: NimBLEUUID.cpp:203
uint8_t bitSize() const
Get the number of bits in this uuid.
Definition: NimBLEUUID.cpp:175
diff --git a/_nim_b_l_e_utils_8h_source.html b/_nim_b_l_e_utils_8h_source.html index 9e877a7..3e320e7 100644 --- a/_nim_b_l_e_utils_8h_source.html +++ b/_nim_b_l_e_utils_8h_source.html @@ -5,7 +5,7 @@ -esp-nimble-cpp: K:/Users/Ryan/Desktop/thermo-git/components/esp-nimble-cpp/src/NimBLEUtils.h Source File +esp-nimble-cpp: K:/Users/Ryan/Desktop/test_idf/components/esp-nimble-cpp/src/NimBLEUtils.h Source File @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -117,7 +117,7 @@ $(document).ready(function(){initNavTree('_nim_b_l_e_utils_8h_source.html','');
29  void *pATT;
30  TaskHandle_t task;
31  int rc;
-
32  std::string *buf;
+
32  void *buf;
33 } ble_task_data_t;
34 
35 
diff --git a/annotated.html b/annotated.html index abda9c5..29317f0 100644 --- a/annotated.html +++ b/annotated.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -94,30 +94,34 @@ $(document).ready(function(){initNavTree('annotated.html',''); initResizable();  CNimBLEAdvertisedDeviceCallbacksA callback handler for callbacks associated device scanning  CNimBLEAdvertisementDataAdvertisement data set by the programmer to be published by the BLE server  CNimBLEAdvertisingPerform and manage BLE advertising - CNimBLEBeaconRepresentation of a beacon. See: - CNimBLECharacteristicThe model of a BLE Characteristic - CNimBLECharacteristicCallbacksCallbacks that can be associated with a BLE characteristic to inform of events - CNimBLEClientA model of a BLE client - CNimBLEClientCallbacksCallbacks associated with a BLE client - CNimBLEConnInfoConnection information - CNimBLEDescriptorA model of a BLE descriptor - CNimBLEDescriptorCallbacksCallbacks that can be associated with a BLE descriptors to inform of events - CNimBLEDeviceA model of a BLE Device from which all the BLE roles are created - CNimBLEEddystoneTLMRepresentation of a beacon. See: - CNimBLEEddystoneURLRepresentation of a beacon. See: - CNimBLEHIDDeviceA model of a BLE Human Interface Device - CNimBLERemoteCharacteristicA model of a remote BLE characteristic - CNimBLERemoteDescriptorA model of remote BLE descriptor - CNimBLERemoteServiceA model of a remote BLE service - CNimBLEScanPerform and manage BLE scans - CNimBLEScanResultsA class that contains and operates on the results of a BLE scan - CNimBLESecurityA class to handle BLE security operations. Deprecated - provided for backward compatibility only. - CNimBLESecurityCallbacksCallbacks to handle GAP events related to authorization. Deprecated - provided for backward compatibility only. - CNimBLEServerThe model of a BLE server - CNimBLEServerCallbacksCallbacks associated with the operation of a BLE server - CNimBLEServiceThe model of a BLE service - CNimBLEUtilsA BLE Utility class with methods for debugging and general purpose use - CNimBLEUUIDA model of a BLE UUID + CNimBLEAttValueA specialized container class to hold BLE attribute values + CNimBLEBeaconRepresentation of a beacon. See: + CNimBLECharacteristicThe model of a BLE Characteristic + CNimBLECharacteristicCallbacksCallbacks that can be associated with a BLE characteristic to inform of events + CNimBLEClientA model of a BLE client + CNimBLEClientCallbacksCallbacks associated with a BLE client + CNimBLEConnInfoConnection information + CNimBLEDescriptorA model of a BLE descriptor + CNimBLEDescriptorCallbacksCallbacks that can be associated with a BLE descriptors to inform of events + CNimBLEDeviceA model of a BLE Device from which all the BLE roles are created + CNimBLEEddystoneTLMRepresentation of a beacon. See: + CNimBLEEddystoneURLRepresentation of a beacon. See: + CNimBLEExtAdvertisementExtended advertisement data + CNimBLEExtAdvertisingExtended advertising class + CNimBLEExtAdvertisingCallbacksCallbacks associated with NimBLEExtAdvertising class + CNimBLEHIDDeviceA model of a BLE Human Interface Device + CNimBLERemoteCharacteristicA model of a remote BLE characteristic + CNimBLERemoteDescriptorA model of remote BLE descriptor + CNimBLERemoteServiceA model of a remote BLE service + CNimBLEScanPerform and manage BLE scans + CNimBLEScanResultsA class that contains and operates on the results of a BLE scan + CNimBLESecurityA class to handle BLE security operations. Deprecated - provided for backward compatibility only. + CNimBLESecurityCallbacksCallbacks to handle GAP events related to authorization. Deprecated - provided for backward compatibility only. + CNimBLEServerThe model of a BLE server + CNimBLEServerCallbacksCallbacks associated with the operation of a BLE server + CNimBLEServiceThe model of a BLE service + CNimBLEUtilsA BLE Utility class with methods for debugging and general purpose use + CNimBLEUUIDA model of a BLE UUID diff --git a/annotated_dup.js b/annotated_dup.js index fa1a6ed..55222ee 100644 --- a/annotated_dup.js +++ b/annotated_dup.js @@ -6,6 +6,7 @@ var annotated_dup = [ "NimBLEAdvertisedDeviceCallbacks", "class_nim_b_l_e_advertised_device_callbacks.html", "class_nim_b_l_e_advertised_device_callbacks" ], [ "NimBLEAdvertisementData", "class_nim_b_l_e_advertisement_data.html", "class_nim_b_l_e_advertisement_data" ], [ "NimBLEAdvertising", "class_nim_b_l_e_advertising.html", "class_nim_b_l_e_advertising" ], + [ "NimBLEAttValue", "class_nim_b_l_e_att_value.html", "class_nim_b_l_e_att_value" ], [ "NimBLEBeacon", "class_nim_b_l_e_beacon.html", "class_nim_b_l_e_beacon" ], [ "NimBLECharacteristic", "class_nim_b_l_e_characteristic.html", "class_nim_b_l_e_characteristic" ], [ "NimBLECharacteristicCallbacks", "class_nim_b_l_e_characteristic_callbacks.html", "class_nim_b_l_e_characteristic_callbacks" ], @@ -17,6 +18,9 @@ var annotated_dup = [ "NimBLEDevice", "class_nim_b_l_e_device.html", null ], [ "NimBLEEddystoneTLM", "class_nim_b_l_e_eddystone_t_l_m.html", "class_nim_b_l_e_eddystone_t_l_m" ], [ "NimBLEEddystoneURL", "class_nim_b_l_e_eddystone_u_r_l.html", "class_nim_b_l_e_eddystone_u_r_l" ], + [ "NimBLEExtAdvertisement", "class_nim_b_l_e_ext_advertisement.html", "class_nim_b_l_e_ext_advertisement" ], + [ "NimBLEExtAdvertising", "class_nim_b_l_e_ext_advertising.html", "class_nim_b_l_e_ext_advertising" ], + [ "NimBLEExtAdvertisingCallbacks", "class_nim_b_l_e_ext_advertising_callbacks.html", "class_nim_b_l_e_ext_advertising_callbacks" ], [ "NimBLEHIDDevice", "class_nim_b_l_e_h_i_d_device.html", "class_nim_b_l_e_h_i_d_device" ], [ "NimBLERemoteCharacteristic", "class_nim_b_l_e_remote_characteristic.html", "class_nim_b_l_e_remote_characteristic" ], [ "NimBLERemoteDescriptor", "class_nim_b_l_e_remote_descriptor.html", "class_nim_b_l_e_remote_descriptor" ], diff --git a/class_nim_b_l_e2904-members.html b/class_nim_b_l_e2904-members.html index ec12f29..bb12b92 100644 --- a/class_nim_b_l_e2904-members.html +++ b/class_nim_b_l_e2904-members.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -94,20 +94,21 @@ $(document).ready(function(){initNavTree('class_nim_b_l_e2904.html',''); initRes getLength()NimBLEDescriptor getStringValue()NimBLEDescriptor getUUID()NimBLEDescriptor - getValue()NimBLEDescriptor - NimBLEDescriptor(const char *uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)NimBLEDescriptor - NimBLEDescriptor(NimBLEUUID uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)NimBLEDescriptor - setCallbacks(NimBLEDescriptorCallbacks *pCallbacks)NimBLEDescriptor - setDescription(uint16_t)NimBLE2904 - setExponent(int8_t exponent)NimBLE2904 - setFormat(uint8_t format)NimBLE2904 - setNamespace(uint8_t namespace_value)NimBLE2904 - setUnit(uint16_t unit)NimBLE2904 - setValue(const uint8_t *data, size_t size)NimBLEDescriptor - setValue(const std::string &value)NimBLEDescriptor - setValue(const T &s)NimBLEDescriptorinline - toString()NimBLEDescriptor - ~NimBLEDescriptor()NimBLEDescriptor + getValue(time_t *timestamp=nullptr)NimBLEDescriptor + getValue(time_t *timestamp=nullptr, bool skipSizeCheck=false)NimBLEDescriptorinline + NimBLEDescriptor(const char *uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)NimBLEDescriptor + NimBLEDescriptor(NimBLEUUID uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)NimBLEDescriptor + setCallbacks(NimBLEDescriptorCallbacks *pCallbacks)NimBLEDescriptor + setDescription(uint16_t)NimBLE2904 + setExponent(int8_t exponent)NimBLE2904 + setFormat(uint8_t format)NimBLE2904 + setNamespace(uint8_t namespace_value)NimBLE2904 + setUnit(uint16_t unit)NimBLE2904 + setValue(const uint8_t *data, size_t size)NimBLEDescriptor + setValue(const std::vector< uint8_t > &vec)NimBLEDescriptor + setValue(const T &s)NimBLEDescriptorinline + toString()NimBLEDescriptor + ~NimBLEDescriptor()NimBLEDescriptor diff --git a/class_nim_b_l_e2904.html b/class_nim_b_l_e2904.html index 7c92591..b3f3645 100644 --- a/class_nim_b_l_e2904.html +++ b/class_nim_b_l_e2904.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -117,13 +117,11 @@ void  Set the units for this value. It should be one of the encoded values defined here: https://www.bluetooth.com/specifications/assigned-numbers/units. More...
  - Public Member Functions inherited from NimBLEDescriptor -NimBLEDescriptor (const char *uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr) - NimBLEDescriptor constructor.
NimBLEDescriptor (const char *uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr) + Construct a descriptor. More...
  -NimBLEDescriptor (NimBLEUUID uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr) - NimBLEDescriptor constructor.
NimBLEDescriptor (NimBLEUUID uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr) + Construct a descriptor. More...
   ~NimBLEDescriptor () @@ -142,28 +140,33 @@ void void setCallbacks (NimBLEDescriptorCallbacks *pCallbacks)  Set the callback handlers for this descriptor. More...
  +NimBLECharacteristicgetCharacteristic () + Get the characteristic this descriptor belongs to. More...
+  size_t getLength ()  Get the length of the value of this descriptor. More...
  -uint8_t * getValue () - Get the value of this descriptor. More...
-  +NimBLEAttValue getValue (time_t *timestamp=nullptr) + Get the value of this descriptor. More...
+  std::string getStringValue ()  Get the value of this descriptor as a string. More...
  void setValue (const uint8_t *data, size_t size)  Set the value of the descriptor. More...
  -void setValue (const std::string &value) - Set the value of the descriptor. More...
-  -NimBLECharacteristicgetCharacteristic () - Get the characteristic this descriptor belongs to. More...
-  +void setValue (const std::vector< uint8_t > &vec) + Set the value of the descriptor from a std::vector<uint8_t>.
+. More...
+  template<typename T > void setValue (const T &s) - Convenience template to set the descriptor value to <type>val. More...
+ Template to set the characteristic value to <type>val. More...
  +template<typename T > +T getValue (time_t *timestamp=nullptr, bool skipSizeCheck=false) + Template to convert the descriptor data to <type>. More...

Detailed Description

Descriptor for Characteristic Presentation Format.

diff --git a/class_nim_b_l_e_address-members.html b/class_nim_b_l_e_address-members.html index 5e6e834..514127d 100644 --- a/class_nim_b_l_e_address-members.html +++ b/class_nim_b_l_e_address-members.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
diff --git a/class_nim_b_l_e_address.html b/class_nim_b_l_e_address.html index 616fa82..27c61ae 100644 --- a/class_nim_b_l_e_address.html +++ b/class_nim_b_l_e_address.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -126,18 +126,18 @@ Use the same byte order, so use 0xa4c1385def16 for "a4:c1:38:5d:ef:16".   bool operator== (const NimBLEAddress &rhs) const - Convienience operator to check if this address is equal to another.
+ Convenience operator to check if this address is equal to another.
  bool operator!= (const NimBLEAddress &rhs) const - Convienience operator to check if this address is not equal to another.
+ Convenience operator to check if this address is not equal to another.
   operator std::string () const  Convienience operator to convert this address to string representation. More...
   operator uint64_t () const - Convienience operator to convert the native address representation to uint_64.
+ Convenience operator to convert the native address representation to uint_64.
 

Detailed Description

diff --git a/class_nim_b_l_e_advertised_device-members.html b/class_nim_b_l_e_advertised_device-members.html index 4993cfd..d787364 100644 --- a/class_nim_b_l_e_advertised_device-members.html +++ b/class_nim_b_l_e_advertised_device-members.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -102,18 +102,22 @@ $(document).ready(function(){initNavTree('class_nim_b_l_e_advertised_device.html getName()NimBLEAdvertisedDevice getPayload()NimBLEAdvertisedDevice getPayloadLength()NimBLEAdvertisedDevice + getPeriodicInterval()NimBLEAdvertisedDevice + getPrimaryPhy()NimBLEAdvertisedDevice getRSSI()NimBLEAdvertisedDevice getScan()NimBLEAdvertisedDevice - getServiceData(uint8_t index=0)NimBLEAdvertisedDevice - getServiceData(const NimBLEUUID &uuid)NimBLEAdvertisedDevice - getServiceData(uint8_t index=0, bool skipSizeCheck=false)NimBLEAdvertisedDeviceinline - getServiceData(const NimBLEUUID &uuid, bool skipSizeCheck=false)NimBLEAdvertisedDeviceinline - getServiceDataCount()NimBLEAdvertisedDevice - getServiceDataUUID(uint8_t index=0)NimBLEAdvertisedDevice - getServiceUUID(uint8_t index=0)NimBLEAdvertisedDevice - getServiceUUIDCount()NimBLEAdvertisedDevice + getSecondaryPhy()NimBLEAdvertisedDevice + getServiceData(uint8_t index=0)NimBLEAdvertisedDevice + getServiceData(const NimBLEUUID &uuid)NimBLEAdvertisedDevice + getServiceData(uint8_t index=0, bool skipSizeCheck=false)NimBLEAdvertisedDeviceinline + getServiceData(const NimBLEUUID &uuid, bool skipSizeCheck=false)NimBLEAdvertisedDeviceinline + getServiceDataCount()NimBLEAdvertisedDevice + getServiceDataUUID(uint8_t index=0)NimBLEAdvertisedDevice + getServiceUUID(uint8_t index=0)NimBLEAdvertisedDevice + getServiceUUIDCount()NimBLEAdvertisedDevice + getSetId()NimBLEAdvertisedDevice getTargetAddress(uint8_t index=0)NimBLEAdvertisedDevice - getTargetAddressCount()NimBLEAdvertisedDevice + getTargetAddressCount()NimBLEAdvertisedDevice getTimestamp()NimBLEAdvertisedDevice getTXPower()NimBLEAdvertisedDevice getURI()NimBLEAdvertisedDevice @@ -129,6 +133,8 @@ $(document).ready(function(){initNavTree('class_nim_b_l_e_advertised_device.html haveTXPower()NimBLEAdvertisedDevice haveURI()NimBLEAdvertisedDevice isAdvertisingService(const NimBLEUUID &uuid)NimBLEAdvertisedDevice + isConnectable()NimBLEAdvertisedDevice + isLegacyAdvertisement()NimBLEAdvertisedDevice NimBLEAdvertisedDevice()NimBLEAdvertisedDevice toString()NimBLEAdvertisedDevice
diff --git a/class_nim_b_l_e_advertised_device.html b/class_nim_b_l_e_advertised_device.html index 17b95d4..a35a0d0 100644 --- a/class_nim_b_l_e_advertised_device.html +++ b/class_nim_b_l_e_advertised_device.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -136,9 +136,9 @@ Public Member Functions NimBLEScangetScan ()  Get the scan object that created this advertised device. More...
  -size_t getServiceDataCount () - Get the count of advertised service data UUIDS. More...
-  +uint8_t getServiceDataCount () + Get the count of advertised service data UUIDS. More...
+  std::string getServiceData (uint8_t index=0)  Get the service data. More...
  @@ -154,20 +154,20 @@ Public Member Functions  A template to convert the service data to <type>. More...
  NimBLEUUID getServiceDataUUID (uint8_t index=0) - Get the UUID of the serice data at the index. More...
+ Get the UUID of the service data at the index. More...
  NimBLEUUID getServiceUUID (uint8_t index=0)  Get the Service UUID. More...
  -size_t getServiceUUIDCount () - Get the number of services advertised. More...
-  +uint8_t getServiceUUIDCount () + Get the number of services advertised. More...
NimBLEAddress getTargetAddress (uint8_t index=0)  Get the target address at the index. More...
  -size_t getTargetAddressCount () - Get the number of target addresses. More...
-  +uint8_t getTargetAddressCount () + Get the number of target addresses. More...
+  int8_t getTXPower ()  Get the TX Power. More...
  @@ -187,7 +187,7 @@ Public Member Functions  Get the timeStamp of when the device last advertised. More...
  bool isAdvertisingService (const NimBLEUUID &uuid) - Check advertised services for existance of the required UUID. More...
+ Check advertised services for existence of the required UUID. More...
  bool haveAppearance ()  Does this advertisement have an appearance value? More...
@@ -225,6 +225,24 @@ Public Member Functions std::string toString ()  Create a string representation of this device. More...
  +bool isConnectable () + Check if this device is advertising as connectable. More...
+  +bool isLegacyAdvertisement () + Check if this advertisement is a legacy or extended type. More...
+  +uint8_t getSetId () + Get the set ID of the extended advertisement. More...
+  +uint8_t getPrimaryPhy () + Get the primary PHY used by this advertisement. More...
+  +uint8_t getSecondaryPhy () + Get the primary PHY used by this advertisement. More...
+  +uint16_t getPeriodicInterval () + Get the periodic interval of the advertisement. More...

Detailed Description

A representation of a BLE advertised device found by a scan.

@@ -312,7 +330,7 @@ Public Member Functions

Get the length of the advertisement data in the payload.

-
Returns
The number of bytes in the payload that is from the advertisment.
+
Returns
The number of bytes in the payload that is from the advertisement.
@@ -334,9 +352,9 @@ Public Member Functions

Get the advertisement type.

Returns
The advertising type the device is reporting:
  • BLE_HCI_ADV_TYPE_ADV_IND (0) - indirect advertising
  • -
  • BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD (1) - direct advertisng - high duty cycle
  • +
  • BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD (1) - direct advertising - high duty cycle
  • BLE_HCI_ADV_TYPE_ADV_SCAN_IND (2) - indirect scan response
  • -
  • BLE_HCI_ADV_TYPE_ADV_NONCONN_IND (3) - indirect advertisng - not connectable
  • +
  • BLE_HCI_ADV_TYPE_ADV_NONCONN_IND (3) - indirect advertising - not connectable
  • BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_LD (4) - direct advertising - low duty cycle
@@ -359,7 +377,7 @@ Public Member Functions

Get the appearance.

-

A BLE device can declare its own appearance. The appearance is how it would like to be shown to an end user typcially in the form of an icon.

+

A BLE device can declare its own appearance. The appearance is how it would like to be shown to an end user typically in the form of an icon.

Returns
The appearance of the advertised device.
@@ -526,6 +544,50 @@ template<typename T >

Get the length of the payload advertised by the device.

Returns
The size of the payload in bytes.
+ + + +

◆ getPeriodicInterval()

+ +
+
+ + + + + + + +
uint16_t NimBLEAdvertisedDevice::getPeriodicInterval ()
+
+ +

Get the periodic interval of the advertisement.

+
Returns
The periodic advertising interval, 0 if not periodic advertising.
+ +
+
+ +

◆ getPrimaryPhy()

+ +
+
+ + + + + + + +
uint8_t NimBLEAdvertisedDevice::getPrimaryPhy ()
+
+ +

Get the primary PHY used by this advertisement.

+
Returns
The PHY type, one of:
    +
  • BLE_HCI_LE_PHY_1M
  • +
  • BLE_HCI_LE_PHY_CODED
  • +
+
+
@@ -566,6 +628,31 @@ template<typename T >

Get the scan object that created this advertised device.

Returns
The scan object.
+ + + +

◆ getSecondaryPhy()

+ +
+
+ + + + + + + +
uint8_t NimBLEAdvertisedDevice::getSecondaryPhy ()
+
+ +

Get the primary PHY used by this advertisement.

+
Returns
The PHY type, one of:
    +
  • BLE_HCI_LE_PHY_1M
  • +
  • BLE_HCI_LE_PHY_2M
  • +
  • BLE_HCI_LE_PHY_CODED
  • +
+
+
@@ -732,14 +819,14 @@ template<typename T > - -

◆ getServiceDataCount()

+ +

◆ getServiceDataCount()

- + @@ -768,7 +855,7 @@ template<typename T >
size_t NimBLEAdvertisedDevice::getServiceDataCount uint8_t NimBLEAdvertisedDevice::getServiceDataCount ( )
-

Get the UUID of the serice data at the index.

+

Get the UUID of the service data at the index.

Parameters
@@ -806,14 +893,14 @@ template<typename T > - -

◆ getServiceUUIDCount()

+ +

◆ getServiceUUIDCount()

[in]indexThe index of the service data UUID requested.
- + @@ -824,6 +911,26 @@ template<typename T >

Get the number of services advertised.

Returns
The count of services in the advertising packet.
+ + + +

◆ getSetId()

+ +
+
+
size_t NimBLEAdvertisedDevice::getServiceUUIDCount uint8_t NimBLEAdvertisedDevice::getServiceUUIDCount ( )
+ + + + + + +
uint8_t NimBLEAdvertisedDevice::getSetId ()
+
+ +

Get the set ID of the extended advertisement.

+
Returns
The set ID.
+
@@ -853,14 +960,14 @@ template<typename T > - -

◆ getTargetAddressCount()

+ +

◆ getTargetAddressCount()

- + @@ -1169,7 +1276,7 @@ template<typename T >
size_t NimBLEAdvertisedDevice::getTargetAddressCount uint8_t NimBLEAdvertisedDevice::getTargetAddressCount ( )
-

Check advertised services for existance of the required UUID.

+

Check advertised services for existence of the required UUID.

Parameters
@@ -1178,6 +1285,46 @@ template<typename T >
Returns
Return true if service is advertised
+ + + +

◆ isConnectable()

+ +
+
+
[in]uuidThe service uuid to look for in the advertisement.
+ + + + + + +
bool NimBLEAdvertisedDevice::isConnectable ()
+
+ +

Check if this device is advertising as connectable.

+
Returns
True if the device is connectable.
+ +
+
+ +

◆ isLegacyAdvertisement()

+ +
+
+ + + + + + + +
bool NimBLEAdvertisedDevice::isLegacyAdvertisement ()
+
+ +

Check if this advertisement is a legacy or extended type.

+
Returns
True if legacy (Bluetooth 4.x), false if extended (bluetooth 5.x).
+
diff --git a/class_nim_b_l_e_advertised_device.js b/class_nim_b_l_e_advertised_device.js index 8d3c56a..116ebae 100644 --- a/class_nim_b_l_e_advertised_device.js +++ b/class_nim_b_l_e_advertised_device.js @@ -14,18 +14,22 @@ var class_nim_b_l_e_advertised_device = [ "getName", "class_nim_b_l_e_advertised_device.html#ae6c6b48369d71a5998c1393c0d6a0179", null ], [ "getPayload", "class_nim_b_l_e_advertised_device.html#afacf7717a15b36af184cd957d397e384", null ], [ "getPayloadLength", "class_nim_b_l_e_advertised_device.html#ac7879f4aa0f2b069b1d3aff4809ae62c", null ], + [ "getPeriodicInterval", "class_nim_b_l_e_advertised_device.html#ad9c5b9ffda267ddbcaef6b0f236846f9", null ], + [ "getPrimaryPhy", "class_nim_b_l_e_advertised_device.html#a9b4ad695a4f035512d4d17313d8c5d3b", null ], [ "getRSSI", "class_nim_b_l_e_advertised_device.html#acd42dfbc92a43fc90e933df975c029f3", null ], [ "getScan", "class_nim_b_l_e_advertised_device.html#ad3931c72aaded3b594896c29b3691562", null ], + [ "getSecondaryPhy", "class_nim_b_l_e_advertised_device.html#a1efd77b20e3198ef148282bf75ff3e22", null ], [ "getServiceData", "class_nim_b_l_e_advertised_device.html#acf4398ca81f800445092ccc77deaf00b", null ], [ "getServiceData", "class_nim_b_l_e_advertised_device.html#a9ca1c022e10764ec72850ff3a011b009", null ], [ "getServiceData", "class_nim_b_l_e_advertised_device.html#aecb3e30a94abd59401cafb70a5903abb", null ], [ "getServiceData", "class_nim_b_l_e_advertised_device.html#a9017ce5b59bdae3cebf33c54f28cee70", null ], - [ "getServiceDataCount", "class_nim_b_l_e_advertised_device.html#a5fc9be9de9209622259f8d28b01825df", null ], + [ "getServiceDataCount", "class_nim_b_l_e_advertised_device.html#a1602b70c37fb9a5f2f7ca4eacbf01091", null ], [ "getServiceDataUUID", "class_nim_b_l_e_advertised_device.html#a4f89e99dffdfde45c1cafff74a20a95f", null ], [ "getServiceUUID", "class_nim_b_l_e_advertised_device.html#ab53f862df15953d19ba7a45d4cf51b46", null ], - [ "getServiceUUIDCount", "class_nim_b_l_e_advertised_device.html#a6dc4484bc89ea5560a51c349b5300049", null ], + [ "getServiceUUIDCount", "class_nim_b_l_e_advertised_device.html#a5ca6792d1ee559470ae8edccc1aea20d", null ], + [ "getSetId", "class_nim_b_l_e_advertised_device.html#a6361e2b275cc45578f1000b5fd1b3c29", null ], [ "getTargetAddress", "class_nim_b_l_e_advertised_device.html#a599cad9a3f3d535049c87a911bc1b14d", null ], - [ "getTargetAddressCount", "class_nim_b_l_e_advertised_device.html#a9352a7760d9e4af0561d7923fcbe2535", null ], + [ "getTargetAddressCount", "class_nim_b_l_e_advertised_device.html#ae2256f6b4da4c11cf75cb773a6b7f223", null ], [ "getTimestamp", "class_nim_b_l_e_advertised_device.html#a1855415f3c60bc88d62e9206fe6ed75a", null ], [ "getTXPower", "class_nim_b_l_e_advertised_device.html#afee346437447173eed1b9edf1de70f34", null ], [ "getURI", "class_nim_b_l_e_advertised_device.html#ad65f8040a142f8d6d0763d4876f0d22e", null ], @@ -41,5 +45,7 @@ var class_nim_b_l_e_advertised_device = [ "haveTXPower", "class_nim_b_l_e_advertised_device.html#af5293030ef439856c195caa3aba86543", null ], [ "haveURI", "class_nim_b_l_e_advertised_device.html#a83ebd08b512dc936b1059db7a69b9ead", null ], [ "isAdvertisingService", "class_nim_b_l_e_advertised_device.html#a37ad095c066aa231a52a7259734c9bce", null ], + [ "isConnectable", "class_nim_b_l_e_advertised_device.html#a54917b2644c433977e24a10a63d7431a", null ], + [ "isLegacyAdvertisement", "class_nim_b_l_e_advertised_device.html#a3684969e3e10cd0af9ecaf342847ea71", null ], [ "toString", "class_nim_b_l_e_advertised_device.html#ac1b8ff0f2897abda335743d55668fcd9", null ] ]; \ No newline at end of file diff --git a/class_nim_b_l_e_advertised_device_callbacks-members.html b/class_nim_b_l_e_advertised_device_callbacks-members.html index dd8574a..65caf8e 100644 --- a/class_nim_b_l_e_advertised_device_callbacks-members.html +++ b/class_nim_b_l_e_advertised_device_callbacks-members.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
diff --git a/class_nim_b_l_e_advertised_device_callbacks.html b/class_nim_b_l_e_advertised_device_callbacks.html index b1c7b2e..193a3dc 100644 --- a/class_nim_b_l_e_advertised_device_callbacks.html +++ b/class_nim_b_l_e_advertised_device_callbacks.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
diff --git a/class_nim_b_l_e_advertisement_data-members.html b/class_nim_b_l_e_advertisement_data-members.html index aab8be9..883babf 100644 --- a/class_nim_b_l_e_advertisement_data-members.html +++ b/class_nim_b_l_e_advertisement_data-members.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
diff --git a/class_nim_b_l_e_advertisement_data.html b/class_nim_b_l_e_advertisement_data.html index 94e778b..951424e 100644 --- a/class_nim_b_l_e_advertisement_data.html +++ b/class_nim_b_l_e_advertisement_data.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
diff --git a/class_nim_b_l_e_advertising-members.html b/class_nim_b_l_e_advertising-members.html index 8c85992..0674c3a 100644 --- a/class_nim_b_l_e_advertising-members.html +++ b/class_nim_b_l_e_advertising-members.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -112,7 +112,7 @@ $(document).ready(function(){initNavTree('class_nim_b_l_e_advertising.html',''); setServiceData(const NimBLEUUID &uuid, const std::string &data)NimBLEAdvertising setURI(const std::string &uri)NimBLEAdvertising start(uint32_t duration=0, void(*advCompleteCB)(NimBLEAdvertising *pAdv)=nullptr)NimBLEAdvertising - stop()NimBLEAdvertising + stop()NimBLEAdvertising diff --git a/class_nim_b_l_e_advertising.html b/class_nim_b_l_e_advertising.html index 4cd8003..6ae14be 100644 --- a/class_nim_b_l_e_advertising.html +++ b/class_nim_b_l_e_advertising.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -111,10 +111,9 @@ Public Member Functions bool start (uint32_t duration=0, void(*advCompleteCB)(NimBLEAdvertising *pAdv)=nullptr)  Start advertising. More...
  - -void stop () - Stop advertising.
-  +bool stop () + Stop advertising. More...
+  void setAppearance (uint16_t appearance)  Set the device appearance in the advertising data. The codes for distinct appearances can be found here:
https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.gap.appearance.xml. More...
@@ -714,6 +713,26 @@ When using custom scan response data you must also use custom advertisement data
Returns
True if advertising started successfully.
+ + + +

◆ stop()

+ +
+
+ + + + + + + +
bool NimBLEAdvertising::stop ()
+
+ +

Stop advertising.

+
Returns
True if advertising stopped successfully.
+
diff --git a/class_nim_b_l_e_advertising.js b/class_nim_b_l_e_advertising.js index 90b0d21..48f9434 100644 --- a/class_nim_b_l_e_advertising.js +++ b/class_nim_b_l_e_advertising.js @@ -23,5 +23,5 @@ var class_nim_b_l_e_advertising = [ "setServiceData", "class_nim_b_l_e_advertising.html#a994e43e9e4ace6ce64c57e57d0575781", null ], [ "setURI", "class_nim_b_l_e_advertising.html#a6495d7c9ad80a8c2a5edf974705f8103", null ], [ "start", "class_nim_b_l_e_advertising.html#aeeee5a131b42a4f76010751f4c182e4f", null ], - [ "stop", "class_nim_b_l_e_advertising.html#ab19c9e9015e812055e3cad29d52ed2ff", null ] + [ "stop", "class_nim_b_l_e_advertising.html#a3ab772936ace18c9a7e509740aa59800", null ] ]; \ No newline at end of file diff --git a/class_nim_b_l_e_att_value-members.html b/class_nim_b_l_e_att_value-members.html new file mode 100644 index 0000000..8f3a479 --- /dev/null +++ b/class_nim_b_l_e_att_value-members.html @@ -0,0 +1,135 @@ + + + + + + + +esp-nimble-cpp: Member List + + + + + + + + + + + + + +
+
+ + + + + + +
+
esp-nimble-cpp +  1.4.0 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
NimBLEAttValue Member List
+
+
+ +

This is the complete list of members for NimBLEAttValue, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
append(const uint8_t *value, uint16_t len)NimBLEAttValueinline
begin() constNimBLEAttValueinline
c_str() constNimBLEAttValueinline
capacity() constNimBLEAttValueinline
data() constNimBLEAttValueinline
end() constNimBLEAttValueinline
getValue(time_t *timestamp)NimBLEAttValueinline
getValue(time_t *timestamp=nullptr, bool skipSizeCheck=false)NimBLEAttValueinline
length() constNimBLEAttValueinline
max_size() constNimBLEAttValueinline
NimBLEAttValue(uint16_t init_len=CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)NimBLEAttValueinline
NimBLEAttValue(const uint8_t *value, uint16_t len, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)NimBLEAttValueinline
NimBLEAttValue(std::initializer_list< uint8_t > list, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)NimBLEAttValueinline
NimBLEAttValue(const char *value, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)NimBLEAttValueinline
NimBLEAttValue(const std::string str, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)NimBLEAttValueinline
NimBLEAttValue(const std::vector< uint8_t > vec, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)NimBLEAttValueinline
NimBLEAttValue(const NimBLEAttValue &source)NimBLEAttValueinline
NimBLEAttValue(NimBLEAttValue &&source)NimBLEAttValueinline
operator const uint8_t *() constNimBLEAttValueinline
operator std::string() constNimBLEAttValueinline
operator std::vector< uint8_t >() constNimBLEAttValueinline
operator!=(const NimBLEAttValue &source)NimBLEAttValueinline
operator+=(const NimBLEAttValue &source)NimBLEAttValueinline
operator=(const std::string &source)NimBLEAttValueinline
operator=(NimBLEAttValue &&source)NimBLEAttValueinline
operator=(const NimBLEAttValue &source)NimBLEAttValueinline
operator==(const NimBLEAttValue &source)NimBLEAttValueinline
operator[](int pos) constNimBLEAttValueinline
setValue(const uint8_t *value, uint16_t len)NimBLEAttValueinline
setValue(const char *s)NimBLEAttValueinline
setValue(const T &s)NimBLEAttValueinline
setValue(const T &s)NimBLEAttValueinline
size() constNimBLEAttValueinline
~NimBLEAttValue()NimBLEAttValueinline
+
+ + + + diff --git a/class_nim_b_l_e_att_value.html b/class_nim_b_l_e_att_value.html new file mode 100644 index 0000000..c9d734e --- /dev/null +++ b/class_nim_b_l_e_att_value.html @@ -0,0 +1,811 @@ + + + + + + + +esp-nimble-cpp: NimBLEAttValue Class Reference + + + + + + + + + + + + + +
+
+ + + + + + +
+
esp-nimble-cpp +  1.4.0 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
NimBLEAttValue Class Reference
+
+
+ +

A specialized container class to hold BLE attribute values. + More...

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 NimBLEAttValue (uint16_t init_len=CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)
 Default constructor. More...
 
 NimBLEAttValue (const uint8_t *value, uint16_t len, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)
 Construct with an initial value from a buffer. More...
 
 NimBLEAttValue (std::initializer_list< uint8_t > list, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)
 Construct with an initializer list. More...
 
 NimBLEAttValue (const char *value, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)
 Construct with an initial value from a const char string. More...
 
 NimBLEAttValue (const std::string str, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)
 Construct with an initial value from a std::string. More...
 
 NimBLEAttValue (const std::vector< uint8_t > vec, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)
 Construct with an initial value from a std::vector<uint8_t>. More...
 
NimBLEAttValue (const NimBLEAttValue &source)
 Copy constructor.
 
NimBLEAttValue (NimBLEAttValue &&source)
 Move constructor.
 
~NimBLEAttValue ()
 Destructor.
 
+uint16_t max_size () const
 Returns the max size in bytes.
 
+uint16_t capacity () const
 Returns the currently allocated capacity in bytes.
 
+uint16_t length () const
 Returns the current length of the value in bytes.
 
+uint16_t size () const
 Returns the current size of the value in bytes.
 
+const uint8_t * data () const
 Returns a pointer to the internal buffer of the value.
 
+const char * c_str () const
 Returns a pointer to the internal buffer of the value as a const char*.
 
+const uint8_t * begin () const
 Iterator begin.
 
+const uint8_t * end () const
 Iterator end.
 
bool setValue (const uint8_t *value, uint16_t len)
 Set the value from a buffer. More...
 
bool setValue (const char *s)
 Set value to the value of const char*. More...
 
const uint8_t * getValue (time_t *timestamp)
 Get a pointer to the value buffer with timestamp. More...
 
NimBLEAttValueappend (const uint8_t *value, uint16_t len)
 Append data to the value. More...
 
template<typename T >
bool setValue (const T &s)
 Template to set value to the value of <type>val. More...
 
template<typename T >
bool setValue (const T &s)
 Template to set value to the value of <type>val. More...
 
template<typename T >
getValue (time_t *timestamp=nullptr, bool skipSizeCheck=false)
 Template to return the value as a <type>. More...
 
+uint8_t operator[] (int pos) const
 Subscript operator.
 
operator std::vector< uint8_t > () const
 Operator; Get the value as a std::vector<uint8_t>.
 
operator std::string () const
 Operator; Get the value as a std::string.
 
operator const uint8_t * () const
 Operator; Get the value as a const uint8_t*.
 
+NimBLEAttValueoperator+= (const NimBLEAttValue &source)
 Operator; Append another NimBLEAttValue.
 
+NimBLEAttValueoperator= (const std::string &source)
 Operator; Set the value from a std::string source.
 
+NimBLEAttValueoperator= (NimBLEAttValue &&source)
 Move assignment operator.
 
+NimBLEAttValueoperator= (const NimBLEAttValue &source)
 Copy assignment operator.
 
+bool operator== (const NimBLEAttValue &source)
 Equality operator.
 
+bool operator!= (const NimBLEAttValue &source)
 Inequality operator.
 
+

Detailed Description

+

A specialized container class to hold BLE attribute values.

+

This class is designed to be more memory efficient than using
+standard container types for value storage, while being convertible to
+many different container classes.

+

Constructor & Destructor Documentation

+ +

◆ NimBLEAttValue() [1/6]

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
NimBLEAttValue::NimBLEAttValue (uint16_t init_len = CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH,
uint16_t max_len = BLE_ATT_ATTR_MAX_LEN 
)
+
+inline
+
+ +

Default constructor.

+
Parameters
+ + + +
[in]init_lenThe initial size in bytes.
[in]max_lenThe max size in bytes that the value can be.
+
+
+ +
+
+ +

◆ NimBLEAttValue() [2/6]

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
NimBLEAttValue::NimBLEAttValue (const uint8_t * value,
uint16_t len,
uint16_t max_len = BLE_ATT_ATTR_MAX_LEN 
)
+
+inline
+
+ +

Construct with an initial value from a buffer.

+
Parameters
+ + + + +
valueA pointer to the initial value to set.
[in]lenThe size in bytes of the value to set.
[in]max_lenThe max size in bytes that the value can be.
+
+
+ +
+
+ +

◆ NimBLEAttValue() [3/6]

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
NimBLEAttValue::NimBLEAttValue (std::initializer_list< uint8_t > list,
uint16_t max_len = BLE_ATT_ATTR_MAX_LEN 
)
+
+inline
+
+ +

Construct with an initializer list.

+
Parameters
+ + + +
listAn initializer list containing the initial value to set.
[in]max_lenThe max size in bytes that the value can be.
+
+
+ +
+
+ +

◆ NimBLEAttValue() [4/6]

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
NimBLEAttValue::NimBLEAttValue (const char * value,
uint16_t max_len = BLE_ATT_ATTR_MAX_LEN 
)
+
+inline
+
+ +

Construct with an initial value from a const char string.

+
Parameters
+ + + +
valueA pointer to the initial value to set.
[in]max_lenThe max size in bytes that the value can be.
+
+
+ +
+
+ +

◆ NimBLEAttValue() [5/6]

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
NimBLEAttValue::NimBLEAttValue (const std::string str,
uint16_t max_len = BLE_ATT_ATTR_MAX_LEN 
)
+
+inline
+
+ +

Construct with an initial value from a std::string.

+
Parameters
+ + + +
strA std::string containing to the initial value to set.
[in]max_lenThe max size in bytes that the value can be.
+
+
+ +
+
+ +

◆ NimBLEAttValue() [6/6]

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
NimBLEAttValue::NimBLEAttValue (const std::vector< uint8_t > vec,
uint16_t max_len = BLE_ATT_ATTR_MAX_LEN 
)
+
+inline
+
+ +

Construct with an initial value from a std::vector<uint8_t>.

+
Parameters
+ + + +
vecA std::vector<uint8_t> containing to the initial value to set.
[in]max_lenThe max size in bytes that the value can be.
+
+
+ +
+
+

Member Function Documentation

+ +

◆ append()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
NimBLEAttValue & NimBLEAttValue::append (const uint8_t * value,
uint16_t len 
)
+
+inline
+
+ +

Append data to the value.

+
Parameters
+ + + +
[in]valueA ponter to a data buffer with the value to append.
[in]lenThe length of the value to append in bytes.
+
+
+
Returns
A reference to the appended NimBLEAttValue.
+ +
+
+ +

◆ getValue() [1/2]

+ +
+
+ + + + + +
+ + + + + + + + +
const uint8_t * NimBLEAttValue::getValue (time_t * timestamp)
+
+inline
+
+ +

Get a pointer to the value buffer with timestamp.

+
Parameters
+ + +
[in]timestampA ponter to a time_t variable to store the timestamp.
+
+
+
Returns
A pointer to the internal value buffer.
+ +
+
+ +

◆ getValue() [2/2]

+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
T NimBLEAttValue::getValue (time_t * timestamp = nullptr,
bool skipSizeCheck = false 
)
+
+inline
+
+ +

Template to return the value as a <type>.

+
Template Parameters
+ + +
TThe type to convert the data to.
+
+
+
Parameters
+ + + +
[in]timestampA pointer to a time_t struct to store the time the value was read.
[in]skipSizeCheckIf true it will skip checking if the data size is less than
+sizeof(<type>).
+
+
+
Returns
The data converted to <type> or NULL if skipSizeCheck is false and the data is
+less than sizeof(<type>).
+

Use: getValue<type>(&timestamp, skipSizeCheck);

+ +
+
+ +

◆ setValue() [1/4]

+ +
+
+ + + + + +
+ + + + + + + + +
bool NimBLEAttValue::setValue (const char * s)
+
+inline
+
+ +

Set value to the value of const char*.

+
Parameters
+ + +
[in]sA ponter to a const char value to set.
+
+
+ +
+
+ +

◆ setValue() [2/4]

+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + +
bool NimBLEAttValue::setValue (const T & s)
+
+inline
+
+ +

Template to set value to the value of <type>val.

+
Parameters
+ + +
[in]sThe <type>value to set.
+
+
+

Only used for types without a c_str() method.

+ +
+
+ +

◆ setValue() [3/4]

+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + +
bool NimBLEAttValue::setValue (const T & s)
+
+inline
+
+ +

Template to set value to the value of <type>val.

+
Parameters
+ + +
[in]sThe <type>value to set.
+
+
+

Only used if the <type> has a c_str() method.

+ +
+
+ +

◆ setValue() [4/4]

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool NimBLEAttValue::setValue (const uint8_t * value,
uint16_t len 
)
+
+inline
+
+ +

Set the value from a buffer.

+
Parameters
+ + + +
[in]valueA ponter to a buffer containing the value.
[in]lenThe length of the value in bytes.
+
+
+
Returns
True if successful.
+ +
+
+
+
+ + + + diff --git a/class_nim_b_l_e_att_value.js b/class_nim_b_l_e_att_value.js new file mode 100644 index 0000000..0bbe023 --- /dev/null +++ b/class_nim_b_l_e_att_value.js @@ -0,0 +1,37 @@ +var class_nim_b_l_e_att_value = +[ + [ "NimBLEAttValue", "class_nim_b_l_e_att_value.html#aa801ed93f65e8cbc507c6ea6f4f49294", null ], + [ "NimBLEAttValue", "class_nim_b_l_e_att_value.html#ad0bbdf17e7861cbb4bb2cadae9cbe32c", null ], + [ "NimBLEAttValue", "class_nim_b_l_e_att_value.html#a61813a898f1bfb1b00e670a7fbb413df", null ], + [ "NimBLEAttValue", "class_nim_b_l_e_att_value.html#a4322572d778438318f5750f6df5fdb35", null ], + [ "NimBLEAttValue", "class_nim_b_l_e_att_value.html#a584cac329cd5d3c0a14aa855e6e6143e", null ], + [ "NimBLEAttValue", "class_nim_b_l_e_att_value.html#a03347eab1f3df449762902a4256d2b1c", null ], + [ "NimBLEAttValue", "class_nim_b_l_e_att_value.html#a7473ad95c2240e0d1ce5c2d57f8914c2", null ], + [ "NimBLEAttValue", "class_nim_b_l_e_att_value.html#a778d1da5334049292fdfba221bcd5772", null ], + [ "~NimBLEAttValue", "class_nim_b_l_e_att_value.html#a08f3b04d05cf0c2b76a24cc37cd1f8ab", null ], + [ "append", "class_nim_b_l_e_att_value.html#aa217dfc649daed50eb75c7168442f86e", null ], + [ "begin", "class_nim_b_l_e_att_value.html#a6167f1cbc50a81a4ca0708e273bbb63e", null ], + [ "c_str", "class_nim_b_l_e_att_value.html#aa2c18949ffc2e7d2d2f288c1b2b2f0ed", null ], + [ "capacity", "class_nim_b_l_e_att_value.html#a49a8a126d0b534c999c4a341cdcf7ba2", null ], + [ "data", "class_nim_b_l_e_att_value.html#a9e595630f7959b4002f6fb64c69ae123", null ], + [ "end", "class_nim_b_l_e_att_value.html#a4f797f89e9c2d55dc7bee7ec8993952e", null ], + [ "getValue", "class_nim_b_l_e_att_value.html#a60fb3dc7057d4ec800c3ef6fd2480a69", null ], + [ "getValue", "class_nim_b_l_e_att_value.html#a1aca76279ea3f0d8cb06ff5540a326e3", null ], + [ "length", "class_nim_b_l_e_att_value.html#a35df29c514613b1d00841abd6fffa320", null ], + [ "max_size", "class_nim_b_l_e_att_value.html#ac7abc6cd08adb0b654e051d62af725d5", null ], + [ "operator const uint8_t *", "class_nim_b_l_e_att_value.html#a3aa926c56cd58146a5b1c6e02c97894b", null ], + [ "operator std::string", "class_nim_b_l_e_att_value.html#a5edd484c83c5efa62916add8927a6371", null ], + [ "operator std::vector< uint8_t >", "class_nim_b_l_e_att_value.html#a3af3b6efb528b1063df2de409c64a0d6", null ], + [ "operator!=", "class_nim_b_l_e_att_value.html#a9dc3bc75c3a0cedf76bed59ef2d0d289", null ], + [ "operator+=", "class_nim_b_l_e_att_value.html#a0e6691f9660a2b78e038e87e99914696", null ], + [ "operator=", "class_nim_b_l_e_att_value.html#aa53ee00be956c25596cf7cce71b502ba", null ], + [ "operator=", "class_nim_b_l_e_att_value.html#aa0545edd766dc4ca6e3ebfac5efa384e", null ], + [ "operator=", "class_nim_b_l_e_att_value.html#a47d30a61ba65f5d9a21fa593cf15d4b9", null ], + [ "operator==", "class_nim_b_l_e_att_value.html#a9634dd47ea705ec8d10f29482e572bbf", null ], + [ "operator[]", "class_nim_b_l_e_att_value.html#a8ca8d07c06a79e30bf6279e6817e4881", null ], + [ "setValue", "class_nim_b_l_e_att_value.html#a9c0f67d150d198c5bcad6eafafee21b6", null ], + [ "setValue", "class_nim_b_l_e_att_value.html#ac94a41f0c0d42d48b29d5b18d7ad7bd8", null ], + [ "setValue", "class_nim_b_l_e_att_value.html#ac94a41f0c0d42d48b29d5b18d7ad7bd8", null ], + [ "setValue", "class_nim_b_l_e_att_value.html#a5c8c5ecfa3864d45ea5b155385e3f9fa", null ], + [ "size", "class_nim_b_l_e_att_value.html#aa8c75101d9898c3ff4646d84521ed61c", null ] +]; \ No newline at end of file diff --git a/class_nim_b_l_e_beacon-members.html b/class_nim_b_l_e_beacon-members.html index 31a1790..60343cb 100644 --- a/class_nim_b_l_e_beacon-members.html +++ b/class_nim_b_l_e_beacon-members.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
diff --git a/class_nim_b_l_e_beacon.html b/class_nim_b_l_e_beacon.html index d2a3335..e8a349c 100644 --- a/class_nim_b_l_e_beacon.html +++ b/class_nim_b_l_e_beacon.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
diff --git a/class_nim_b_l_e_characteristic-members.html b/class_nim_b_l_e_characteristic-members.html index a1f62d9..4d85ad2 100644 --- a/class_nim_b_l_e_characteristic-members.html +++ b/class_nim_b_l_e_characteristic-members.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -90,8 +90,8 @@ $(document).ready(function(){initNavTree('class_nim_b_l_e_characteristic.html','

This is the complete list of members for NimBLECharacteristic, including all inherited members.

- - + + @@ -102,20 +102,25 @@ $(document).ready(function(){initNavTree('class_nim_b_l_e_characteristic.html',' - + - - - - - - - - - - - + + + + + + + + + + + + + + + +
addDescriptor(NimBLEDescriptor *pDescriptor)NimBLECharacteristic
createDescriptor(const char *uuid, uint32_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=100)NimBLECharacteristic
createDescriptor(const NimBLEUUID &uuid, uint32_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=100)NimBLECharacteristic
createDescriptor(const char *uuid, uint32_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)NimBLECharacteristic
createDescriptor(const NimBLEUUID &uuid, uint32_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)NimBLECharacteristic
getCallbacks()NimBLECharacteristic
getDataLength()NimBLECharacteristic
getDescriptorByHandle(uint16_t handle)NimBLECharacteristic
getService()NimBLECharacteristic
getSubscribedCount()NimBLECharacteristic
getUUID()NimBLECharacteristic
getValue(time_t *timestamp=nullptr)NimBLECharacteristic
getValue(time_t *timestamp=nullptr)NimBLECharacteristic
getValue(time_t *timestamp=nullptr, bool skipSizeCheck=false)NimBLECharacteristicinline
indicate()NimBLECharacteristic
NimBLECharacteristic(const char *uuid, uint16_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, NimBLEService *pService=nullptr)NimBLECharacteristic
NimBLECharacteristic(const NimBLEUUID &uuid, uint16_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, NimBLEService *pService=nullptr)NimBLECharacteristic
notify(bool is_notification=true)NimBLECharacteristic
notify(std::string value, bool is_notification=true)NimBLECharacteristic
removeDescriptor(NimBLEDescriptor *pDescriptor, bool deleteDsc=false)NimBLECharacteristic
setCallbacks(NimBLECharacteristicCallbacks *pCallbacks)NimBLECharacteristic
setValue(const uint8_t *data, size_t size)NimBLECharacteristic
setValue(const std::string &value)NimBLECharacteristic
setValue(const T &s)NimBLECharacteristicinline
toString()NimBLECharacteristic
~NimBLECharacteristic()NimBLECharacteristic
indicate(const uint8_t *value, size_t length)NimBLECharacteristic
indicate(const std::vector< uint8_t > &value)NimBLECharacteristic
indicate(const T &value)NimBLECharacteristicinline
NimBLECharacteristic(const char *uuid, uint16_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN, NimBLEService *pService=nullptr)NimBLECharacteristic
NimBLECharacteristic(const NimBLEUUID &uuid, uint16_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN, NimBLEService *pService=nullptr)NimBLECharacteristic
notify(bool is_notification=true)NimBLECharacteristic
notify(const uint8_t *value, size_t length, bool is_notification=true)NimBLECharacteristic
notify(const std::vector< uint8_t > &value, bool is_notification=true)NimBLECharacteristic
notify(const T &value, bool is_notification=true)NimBLECharacteristicinline
removeDescriptor(NimBLEDescriptor *pDescriptor, bool deleteDsc=false)NimBLECharacteristic
setCallbacks(NimBLECharacteristicCallbacks *pCallbacks)NimBLECharacteristic
setValue(const uint8_t *data, size_t size)NimBLECharacteristic
setValue(const std::vector< uint8_t > &vec)NimBLECharacteristic
setValue(const T &s)NimBLECharacteristicinline
toString()NimBLECharacteristic
~NimBLECharacteristic()NimBLECharacteristic
diff --git a/class_nim_b_l_e_characteristic.html b/class_nim_b_l_e_characteristic.html index 11ddbfa..84c4864 100644 --- a/class_nim_b_l_e_characteristic.html +++ b/class_nim_b_l_e_characteristic.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -95,12 +95,12 @@ $(document).ready(function(){initNavTree('class_nim_b_l_e_characteristic.html',' - - - - - - + + + + + + @@ -114,38 +114,28 @@ Public Member Functions - - - - - - - + + + + + + + - + - - - + + + + + + - - - - - - @@ -159,29 +149,8 @@ A notification will not block; it is a fire and forget. - + - - - - - - - - - - - - - - - - - - - - @@ -189,13 +158,55 @@ We set the value of the characteristic from the bytes contained in the string. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 NimBLECharacteristic (const char *uuid, uint16_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, NimBLEService *pService=nullptr)
 Construct a characteristic. More...
 
 NimBLECharacteristic (const NimBLEUUID &uuid, uint16_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, NimBLEService *pService=nullptr)
 Construct a characteristic. More...
 
 NimBLECharacteristic (const char *uuid, uint16_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN, NimBLEService *pService=nullptr)
 Construct a characteristic. More...
 
 NimBLECharacteristic (const NimBLEUUID &uuid, uint16_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN, NimBLEService *pService=nullptr)
 Construct a characteristic. More...
 
 ~NimBLECharacteristic ()
 Destructor.
std::string toString ()
 Return a string representation of the characteristic. More...
 
void setCallbacks (NimBLECharacteristicCallbacks *pCallbacks)
 Set the callback handlers for this characteristic. More...
 
-NimBLECharacteristicCallbacksgetCallbacks ()
 Get the callback handlers for this characteristic.
 
void indicate ()
 Send an indication.
-An indication is a transmission of up to the first 20 bytes of the characteristic value.
-An indication will block waiting for a positive confirmation from the client.
 Send an indication.
 
void indicate (const uint8_t *value, size_t length)
 Send an indication. More...
 
void indicate (const std::vector< uint8_t > &value)
 Send an indication. More...
 
void notify (bool is_notification=true)
 Send a notification.
-A notification is a transmission of up to the first 20 bytes of the characteristic value.
-A notification will not block; it is a fire and forget. More...
 Send a notification or indication. More...
 
void notify (std::string value, bool is_notification=true)
 Send a notification.
-A notification is a transmission of up to the first 20 bytes of the characteristic value.
-A notification will not block; it is a fire and forget. More...
 
void notify (const uint8_t *value, size_t length, bool is_notification=true)
 Send a notification or indication. More...
 
void notify (const std::vector< uint8_t > &value, bool is_notification=true)
 Send a notification or indication. More...
 
size_t getSubscribedCount ()
 Get the number of clients subscribed to the characteristic. More...
 
NimBLEDescriptorcreateDescriptor (const char *uuid, uint32_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=100)
 Create a new BLE Descriptor associated with this characteristic. More...
 
NimBLEDescriptorcreateDescriptor (const NimBLEUUID &uuid, uint32_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=100)
 Create a new BLE Descriptor associated with this characteristic. More...
 
void addDescriptor (NimBLEDescriptor *pDescriptor)
 Add a descriptor to the characteristic. More...
 
 Return the BLE Descriptor for the given handle. More...
 
void removeDescriptor (NimBLEDescriptor *pDescriptor, bool deleteDsc=false)
 Remove a descriptor from the characterisitc. More...
 Remove a descriptor from the characteristic. More...
 
std::string getValue (time_t *timestamp=nullptr)
 Retrieve the current value of the characteristic. More...
 
size_t getDataLength ()
 Retrieve the the current data length of the characteristic. More...
 
template<typename T >
getValue (time_t *timestamp=nullptr, bool skipSizeCheck=false)
 A template to convert the characteristic data to <type>. More...
 
void setValue (const uint8_t *data, size_t size)
 Set the value of the characteristic. More...
 
void setValue (const std::string &value)
 Set the value of the characteristic from string data.
-We set the value of the characteristic from the bytes contained in the string. More...
 
template<typename T >
void setValue (const T &s)
 Convenience template to set the characteristic value to <type>val. More...
 
NimBLEServicegetService ()
 Get the service associated with this characteristic.
uint16_t getProperties ()
 Get the properties of the characteristic. More...
 
NimBLEAttValue getValue (time_t *timestamp=nullptr)
 Retrieve the current value of the characteristic. More...
 
size_t getDataLength ()
 Retrieve the the current data length of the characteristic. More...
 
void setValue (const uint8_t *data, size_t size)
 Set the value of the characteristic from a data buffer . More...
 
void setValue (const std::vector< uint8_t > &vec)
 Set the value of the characteristic from a std::vector<uint8_t>.
+. More...
 
void setCallbacks (NimBLECharacteristicCallbacks *pCallbacks)
 Set the callback handlers for this characteristic. More...
 
NimBLEDescriptorcreateDescriptor (const char *uuid, uint32_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)
 Create a new BLE Descriptor associated with this characteristic. More...
 
NimBLEDescriptorcreateDescriptor (const NimBLEUUID &uuid, uint32_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)
 Create a new BLE Descriptor associated with this characteristic. More...
 
+NimBLECharacteristicCallbacksgetCallbacks ()
 Get the callback handlers for this characteristic.
 
template<typename T >
void setValue (const T &s)
 Template to set the characteristic value to <type>val. More...
 
template<typename T >
getValue (time_t *timestamp=nullptr, bool skipSizeCheck=false)
 Template to convert the characteristic data to <type>. More...
 
template<typename T >
void notify (const T &value, bool is_notification=true)
 Template to send a notification from a class type that has a c_str() and length() method. More...
 
template<typename T >
void indicate (const T &value)
 Template to send an indication from a class type that has a c_str() and length() method. More...
 

Detailed Description

The model of a BLE Characteristic.

A BLE Characteristic is an identified value container that manages a value. It is exposed by a BLE server and can be read and written to by a BLE client.

Constructor & Destructor Documentation

- -

◆ NimBLECharacteristic() [1/2]

+ +

◆ NimBLECharacteristic() [1/2]

@@ -212,6 +223,12 @@ We set the value of the characteristic from the bytes contained in the string. uint16_t  properties = NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::WRITE, + + + + uint16_t  + max_len = BLE_ATT_ATTR_MAX_LEN, + @@ -231,6 +248,7 @@ We set the value of the characteristic from the bytes contained in the string. +
[in]uuid- UUID (const char*) for the characteristic.
[in]properties- Properties for the characteristic.
[in]max_len- The maximum length in bytes that the characteristic value can hold. (Default: 512 bytes for esp32, 20 for all others).
[in]pService- pointer to the service instance this characteristic belongs to.
@@ -238,8 +256,8 @@ We set the value of the characteristic from the bytes contained in the string.
- -

◆ NimBLECharacteristic() [2/2]

+ +

◆ NimBLECharacteristic() [2/2]

@@ -256,6 +274,12 @@ We set the value of the characteristic from the bytes contained in the string. uint16_t  properties = NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::WRITE, + + + + uint16_t  + max_len = BLE_ATT_ATTR_MAX_LEN, + @@ -275,6 +299,7 @@ We set the value of the characteristic from the bytes contained in the string. +
[in]uuid- UUID for the characteristic.
[in]properties- Properties for the characteristic.
[in]max_len- The maximum length in bytes that the characteristic value can hold. (Default: 512 bytes for esp32, 20 for all others).
[in]pService- pointer to the service instance this characteristic belongs to.
@@ -309,8 +334,8 @@ We set the value of the characteristic from the bytes contained in the string.
- -

◆ createDescriptor() [1/2]

+ +

◆ createDescriptor() [1/2]

@@ -331,7 +356,7 @@ We set the value of the characteristic from the bytes contained in the string. uint16_t  - max_len = 100  + max_len = BLE_ATT_ATTR_MAX_LEN  @@ -354,8 +379,8 @@ We set the value of the characteristic from the bytes contained in the string.
- -

◆ createDescriptor() [2/2]

+ +

◆ createDescriptor() [2/2]

@@ -376,7 +401,7 @@ We set the value of the characteristic from the bytes contained in the string. uint16_t  - max_len = 100  + max_len = BLE_ATT_ATTR_MAX_LEN  @@ -580,14 +605,14 @@ We set the value of the characteristic from the bytes contained in the string.
- -

◆ getValue() [1/2]

+ +

◆ getValue() [1/2]

- + @@ -597,7 +622,7 @@ We set the value of the characteristic from the bytes contained in the string.

Retrieve the current value of the characteristic.

-
Returns
A std::string containing the current characteristic value.
+
Returns
The NimBLEAttValue containing the current characteristic value.
@@ -637,7 +662,7 @@ template<typename T >
std::string NimBLECharacteristic::getValue NimBLEAttValue NimBLECharacteristic::getValue ( time_t *  timestamp = nullptr)
-

A template to convert the characteristic data to <type>.

+

Template to convert the characteristic data to <type>.

Template Parameters
@@ -646,18 +671,124 @@ template<typename T >
Parameters
TThe type to convert the data to.
- - + +
[in]timestampA pointer to a time_t struct to store the time the value was read.
[in]skipSizeCheckIf true it will skip checking if the data size is less than sizeof(<type>).
[in]timestamp(Optional) A pointer to a time_t struct to store the time the value was read.
[in]skipSizeCheck(Optional) If true it will skip checking if the data size is less than sizeof(<type>).
Returns
The data converted to <type> or NULL if skipSizeCheck is false and the data is less than sizeof(<type>).

Use: getValue<type>(&timestamp, skipSizeCheck);

+
+
+ +

◆ indicate() [1/3]

+ +
+
+ + + + + + + + +
void NimBLECharacteristic::indicate (const std::vector< uint8_t > & value)
+
+ +

Send an indication.

+
Parameters
+ + +
[in]valueA std::vector<uint8_t> containing the value to send as the notification value.
+
+
+ +
+
+ +

◆ indicate() [2/3]

+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + +
void NimBLECharacteristic::indicate (const T & value)
+
+inline
+
+ +

Template to send an indication from a class type that has a c_str() and length() method.

+
Template Parameters
+ + +
TThe a reference to a class containing the data to send.
+
+
+
Parameters
+ + +
[in]valueThe <type>value to set.
+
+
+

Only used if the <type> has a c_str() method.

+ +
+
+ +

◆ indicate() [3/3]

+ +
+
+ + + + + + + + + + + + + + + + + + +
void NimBLECharacteristic::indicate (const uint8_t * value,
size_t length 
)
+
+ +

Send an indication.

+
Parameters
+ + + +
[in]valueA pointer to the data to send.
[in]lengthThe length of the data to send.
+
+
+
-

◆ notify() [1/2]

+

◆ notify() [1/4]

@@ -672,9 +803,7 @@ template<typename T >
-

Send a notification.
-A notification is a transmission of up to the first 20 bytes of the characteristic value.
-A notification will not block; it is a fire and forget.

+

Send a notification or indication.

Parameters
@@ -684,8 +813,8 @@ A notification will not block; it is a fire and forget.

- -

◆ notify() [2/2]

+ +

◆ notify() [2/4]

@@ -693,7 +822,7 @@ A notification will not block; it is a fire and forget.

- + @@ -710,12 +839,108 @@ A notification will not block; it is a fire and forget.

[in]is_notificationif true sends a notification, false sends an indication.
void NimBLECharacteristic::notify (std::string const std::vector< uint8_t > &  value,
-

Send a notification.
-A notification is a transmission of up to the first 20 bytes of the characteristic value.
-A notification will not block; it is a fire and forget.

+

Send a notification or indication.

Parameters
- + + +
[in]valueAn optional value to send as the notification, else the current characteristic value is used.
[in]valueA std::vector<uint8_t> containing the value to send as the notification value.
[in]is_notificationif true sends a notification, false sends an indication.
+
+
+ +
+ + +

◆ notify() [3/4]

+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void NimBLECharacteristic::notify (const T & value,
bool is_notification = true 
)
+
+inline
+
+ +

Template to send a notification from a class type that has a c_str() and length() method.

+
Template Parameters
+ + +
TThe a reference to a class containing the data to send.
+
+
+
Parameters
+ + + +
[in]valueThe <type>value to set.
[in]is_notificationif true sends a notification, false sends an indication.
+
+
+

Only used if the <type> has a c_str() method.

+ +
+
+ +

◆ notify() [4/4]

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void NimBLECharacteristic::notify (const uint8_t * value,
size_t length,
bool is_notification = true 
)
+
+ +

Send a notification or indication.

+
Parameters
+ + +
[in]valueA pointer to the data to send.
[in]lengthThe length of the data to send.
[in]is_notificationif true sends a notification, false sends an indication.
@@ -749,10 +974,10 @@ A notification will not block; it is a fire and forget.

-

Remove a descriptor from the characterisitc.

+

Remove a descriptor from the characteristic.

Parameters
- +
[in]pDescriptorA pointer to the descriptor instance to remove from the characterisitc.
[in]pDescriptorA pointer to the descriptor instance to remove from the characteristic.
[in]deleteDscIf true it will delete the descriptor instance and free it's resources.
@@ -787,8 +1012,8 @@ used to define any callbacks for the characteristic.
- -

◆ setValue() [1/3]

+ +

◆ setValue() [1/3]

@@ -796,18 +1021,18 @@ used to define any callbacks for the characteristic. void NimBLECharacteristic::setValue ( - const std::string &  - value) + const std::vector< uint8_t > &  + vec)
-

Set the value of the characteristic from string data.
-We set the value of the characteristic from the bytes contained in the string.

+

Set the value of the characteristic from a std::vector<uint8_t>.
+.

Parameters
- +
[in]valuethe std::string value of the characteristic.
[in]vecThe std::vector<uint8_t> reference to set the characteristic value from.
@@ -840,7 +1065,7 @@ template<typename T >
-

Convenience template to set the characteristic value to <type>val.

+

Template to set the characteristic value to <type>val.

Parameters
@@ -876,11 +1101,11 @@ template<typename T >
[in]sThe value to set.
-

Set the value of the characteristic.

+

Set the value of the characteristic from a data buffer .

Parameters
- - + +
[in]dataThe data to set for the characteristic.
[in]lengthThe length of the data in bytes.
[in]dataThe data buffer to set for the characteristic.
[in]lengthThe number of bytes in the data buffer.
diff --git a/class_nim_b_l_e_characteristic.js b/class_nim_b_l_e_characteristic.js index f218e28..37a5ca4 100644 --- a/class_nim_b_l_e_characteristic.js +++ b/class_nim_b_l_e_characteristic.js @@ -1,11 +1,11 @@ var class_nim_b_l_e_characteristic = [ - [ "NimBLECharacteristic", "class_nim_b_l_e_characteristic.html#a942b2d29d77fcef233549d0c4fd798da", null ], - [ "NimBLECharacteristic", "class_nim_b_l_e_characteristic.html#acdbd57f7e97646403e520edc35c34c8b", null ], + [ "NimBLECharacteristic", "class_nim_b_l_e_characteristic.html#aa32224e69115e9ba60ac614e8f37a871", null ], + [ "NimBLECharacteristic", "class_nim_b_l_e_characteristic.html#ae2053d941cf8574acbdceb8b549b8264", null ], [ "~NimBLECharacteristic", "class_nim_b_l_e_characteristic.html#a7fe29c5ec571d0513c51b8cbac942f4a", null ], [ "addDescriptor", "class_nim_b_l_e_characteristic.html#aed4b2241c89ad2a8f49117e2b9433e5b", null ], - [ "createDescriptor", "class_nim_b_l_e_characteristic.html#aae014669e9ce1ad01520d68fe0cc0fda", null ], - [ "createDescriptor", "class_nim_b_l_e_characteristic.html#a6523266a751a778a2c04fea19fed4de5", null ], + [ "createDescriptor", "class_nim_b_l_e_characteristic.html#a1fc55adb9d62d8b5fe1be2b172686353", null ], + [ "createDescriptor", "class_nim_b_l_e_characteristic.html#a67a1fb8bddfbd47007ccb8b6f5e5611a", null ], [ "getCallbacks", "class_nim_b_l_e_characteristic.html#a1747ac4889c7adbb93a2d88a10327a47", null ], [ "getDataLength", "class_nim_b_l_e_characteristic.html#a580ad0133fd82a673027c91cbb1c74fa", null ], [ "getDescriptorByHandle", "class_nim_b_l_e_characteristic.html#a062f52918f13c49a37ce8e58b9e7382a", null ], @@ -16,14 +16,19 @@ var class_nim_b_l_e_characteristic = [ "getService", "class_nim_b_l_e_characteristic.html#a84aa251a612810ec8d07e77ab03cb483", null ], [ "getSubscribedCount", "class_nim_b_l_e_characteristic.html#aced225d46153b6969f6ded30c0190e39", null ], [ "getUUID", "class_nim_b_l_e_characteristic.html#a28b03617fe753133582ba4e58c60e52e", null ], - [ "getValue", "class_nim_b_l_e_characteristic.html#a37e908d114f6ad2b4bf19c7cc4db9c54", null ], + [ "getValue", "class_nim_b_l_e_characteristic.html#a78484a01350300176033a09180f7207f", null ], [ "getValue", "class_nim_b_l_e_characteristic.html#a7d09c29b26362f6ddcaf51a9c9dc8be4", null ], [ "indicate", "class_nim_b_l_e_characteristic.html#a2ce9f62ecc3d1644ef4d58efe7a3c434", null ], + [ "indicate", "class_nim_b_l_e_characteristic.html#a2e827aba484add48e52c8eebf80b4a78", null ], + [ "indicate", "class_nim_b_l_e_characteristic.html#af2940e8c314a1ecee1750d20a60c459d", null ], + [ "indicate", "class_nim_b_l_e_characteristic.html#a8c1875611a1beb192e6c24dff35d0655", null ], [ "notify", "class_nim_b_l_e_characteristic.html#aa45461059e1992c816e32c371d17e813", null ], - [ "notify", "class_nim_b_l_e_characteristic.html#ad44ce481c0341abe32b1e0f823c520d4", null ], + [ "notify", "class_nim_b_l_e_characteristic.html#a15a9f056e5a3e85d5cb0bdc7adbdd970", null ], + [ "notify", "class_nim_b_l_e_characteristic.html#aed1432c11fadec203104b13aaaf7060d", null ], + [ "notify", "class_nim_b_l_e_characteristic.html#a9ce09408a307a6b62a91418ea7723ebf", null ], [ "removeDescriptor", "class_nim_b_l_e_characteristic.html#a2c0ed8932ee257a8632e3d72e353489b", null ], [ "setCallbacks", "class_nim_b_l_e_characteristic.html#a29dc2505e1d3b4a7d6800d1547965d17", null ], - [ "setValue", "class_nim_b_l_e_characteristic.html#a3e77647e4c9bd02c96b761639c4d206f", null ], + [ "setValue", "class_nim_b_l_e_characteristic.html#a9daeb13599265cb0f8ea94b7ac4ef053", null ], [ "setValue", "class_nim_b_l_e_characteristic.html#aba05898f446e31222fbe509fa357c730", null ], [ "setValue", "class_nim_b_l_e_characteristic.html#a7cd211a8bb9a0c2ffaed57f2af273677", null ], [ "toString", "class_nim_b_l_e_characteristic.html#a4fa6b8ed011d12e2b1f16e92a02b9a89", null ] diff --git a/class_nim_b_l_e_characteristic_callbacks-members.html b/class_nim_b_l_e_characteristic_callbacks-members.html index 3184c53..6a6caa9 100644 --- a/class_nim_b_l_e_characteristic_callbacks-members.html +++ b/class_nim_b_l_e_characteristic_callbacks-members.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
diff --git a/class_nim_b_l_e_characteristic_callbacks.html b/class_nim_b_l_e_characteristic_callbacks.html index 11913e3..be6e502 100644 --- a/class_nim_b_l_e_characteristic_callbacks.html +++ b/class_nim_b_l_e_characteristic_callbacks.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
diff --git a/class_nim_b_l_e_characteristic_callbacks.js b/class_nim_b_l_e_characteristic_callbacks.js index 8aeffc7..f614674 100644 --- a/class_nim_b_l_e_characteristic_callbacks.js +++ b/class_nim_b_l_e_characteristic_callbacks.js @@ -1,8 +1,8 @@ var class_nim_b_l_e_characteristic_callbacks = [ [ "Status", "class_nim_b_l_e_characteristic_callbacks.html#a104baba3c4bbdee7aa28273d265e4c6f", [ - [ "Example", "md__migration_guide.html#autotoc_md55", null ], - [ "Example", "md__migration_guide.html#autotoc_md56", null ] + [ "Example", "md__migration_guide.html#autotoc_md61", null ], + [ "Example", "md__migration_guide.html#autotoc_md62", null ] ] ], [ "onNotify", "class_nim_b_l_e_characteristic_callbacks.html#a185eb5298cc042f1aceeba21caf0dcc9", null ], [ "onRead", "class_nim_b_l_e_characteristic_callbacks.html#a523904b8d39e364db094f623403bad93", null ], diff --git a/class_nim_b_l_e_client-members.html b/class_nim_b_l_e_client-members.html index 899b9fc..f8259ca 100644 --- a/class_nim_b_l_e_client-members.html +++ b/class_nim_b_l_e_client-members.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -90,13 +90,13 @@ $(document).ready(function(){initNavTree('class_nim_b_l_e_client.html',''); init

This is the complete list of members for NimBLEClient, including all inherited members.

- - - + + + - + @@ -108,17 +108,18 @@ $(document).ready(function(){initNavTree('class_nim_b_l_e_client.html',''); init - + - - - - - - + + + + + + +
begin()NimBLEClient
connect(NimBLEAdvertisedDevice *device, bool deleteAttibutes=true)NimBLEClient
connect(const NimBLEAddress &address, bool deleteAttibutes=true)NimBLEClient
connect(bool deleteAttibutes=true)NimBLEClient
connect(NimBLEAdvertisedDevice *device, bool deleteAttributes=true)NimBLEClient
connect(const NimBLEAddress &address, bool deleteAttributes=true)NimBLEClient
connect(bool deleteAttributes=true)NimBLEClient
deleteService(const NimBLEUUID &uuid)NimBLEClient
deleteServices()NimBLEClient
disconnect(uint8_t reason=BLE_ERR_REM_USER_CONN_TERM)NimBLEClient
discoverAttributes()NimBLEClient
discoverAttributes()NimBLEClient
end()NimBLEClient
getCharacteristic(const uint16_t handle)NimBLEClient
getConnId()NimBLEClient
getService(const char *uuid)NimBLEClient
getService(const NimBLEUUID &uuid)NimBLEClient
getServices(bool refresh=false)NimBLEClient
getValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID)NimBLEClient
getValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID)NimBLEClient
isConnected()NimBLEClient
secureConnection()NimBLEClient
setClientCallbacks(NimBLEClientCallbacks *pClientCallbacks, bool deleteCallbacks=true)NimBLEClient
setConnectionParams(uint16_t minInterval, uint16_t maxInterval, uint16_t latency, uint16_t timeout, uint16_t scanInterval=16, uint16_t scanWindow=16)NimBLEClient
setConnectTimeout(uint8_t timeout)NimBLEClient
setDataLen(uint16_t tx_octets)NimBLEClient
setPeerAddress(const NimBLEAddress &address)NimBLEClient
setValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID, const std::string &value, bool response=false)NimBLEClient
toString()NimBLEClient
updateConnParams(uint16_t minInterval, uint16_t maxInterval, uint16_t latency, uint16_t timeout)NimBLEClient
setConnectPhy(uint8_t mask)NimBLEClient
setConnectTimeout(uint8_t timeout)NimBLEClient
setDataLen(uint16_t tx_octets)NimBLEClient
setPeerAddress(const NimBLEAddress &address)NimBLEClient
setValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID, const NimBLEAttValue &value, bool response=false)NimBLEClient
toString()NimBLEClient
updateConnParams(uint16_t minInterval, uint16_t maxInterval, uint16_t latency, uint16_t timeout)NimBLEClient
diff --git a/class_nim_b_l_e_client.html b/class_nim_b_l_e_client.html index 0dae98a..1f91ab2 100644 --- a/class_nim_b_l_e_client.html +++ b/class_nim_b_l_e_client.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -95,15 +95,15 @@ $(document).ready(function(){initNavTree('class_nim_b_l_e_client.html',''); init - - - - - - - - - + + + + + + + + + @@ -139,12 +139,12 @@ void  - - - - - - + + + + + + @@ -171,7 +171,7 @@ Called automatically when a characteristic or descriptor requires encryption or - + @@ -179,10 +179,9 @@ Called automatically when a characteristic or descriptor requires encryption or - - - + + + @@ -190,6 +189,9 @@ void  + + +

Public Member Functions

bool connect (NimBLEAdvertisedDevice *device, bool deleteAttibutes=true)
 Connect to an advertising device. More...
 
bool connect (const NimBLEAddress &address, bool deleteAttibutes=true)
 Connect to the BLE Server. More...
 
bool connect (bool deleteAttibutes=true)
 Connect to the BLE Server. More...
 
bool connect (NimBLEAdvertisedDevice *device, bool deleteAttributes=true)
 Connect to an advertising device. More...
 
bool connect (const NimBLEAddress &address, bool deleteAttributes=true)
 Connect to the BLE Server. More...
 
bool connect (bool deleteAttributes=true)
 Connect to the BLE Server. More...
 
int disconnect (uint8_t reason=BLE_ERR_REM_USER_CONN_TERM)
 Disconnect from the peer. More...
 
size_t deleteService (const NimBLEUUID &uuid)
 Delete service by UUID. More...
 
std::string getValue (const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID)
 Get the value of a specific characteristic associated with a specific service. More...
 
bool setValue (const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID, const std::string &value, bool response=false)
 Set the value of a specific characteristic associated with a specific service. More...
 
NimBLEAttValue getValue (const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID)
 Get the value of a specific characteristic associated with a specific service. More...
 
bool setValue (const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID, const NimBLEAttValue &value, bool response=false)
 Set the value of a specific characteristic associated with a specific service. More...
 
NimBLERemoteCharacteristicgetCharacteristic (const uint16_t handle)
 Get the remote characteristic with the specified handle. More...
 
 Set the timeout to wait for connection attempt to complete. More...
 
void setConnectionParams (uint16_t minInterval, uint16_t maxInterval, uint16_t latency, uint16_t timeout, uint16_t scanInterval=16, uint16_t scanWindow=16)
 Set the connection paramaters to use when connecting to a server. More...
 Set the connection parameters to use when connecting to a server. More...
 
void updateConnParams (uint16_t minInterval, uint16_t maxInterval, uint16_t latency, uint16_t timeout)
 Update the connection parameters: More...
void setDataLen (uint16_t tx_octets)
 Request an update of the data packet length. More...
 
-void discoverAttributes ()
 Retrieves the full database of attributes that the peripheral has available.
 
bool discoverAttributes ()
 Retrieves the full database of attributes that the peripheral has available. More...
 
NimBLEConnInfo getConnInfo ()
 Get detailed information about the current peer connection.
int getLastError ()
 Get the last error code reported by the NimBLE host. More...
 
void setConnectPhy (uint8_t mask)
 Set the PHY types to use when connecting to a server. More...
 

Detailed Description

A model of a BLE client.

@@ -214,8 +216,8 @@ void  -

◆ connect() [1/3]

+ +

◆ connect() [1/3]

- -

◆ connect() [2/3]

+ +

◆ connect() [2/3]

@@ -258,7 +260,7 @@ have created and clears the vectors after successful connection. bool  - deleteAttibutes = true  + deleteAttributes = true  @@ -272,7 +274,7 @@ have created and clears the vectors after successful connection.
Parameters
-
[in]addressThe address of the server.
[in]deleteAttibutesIf true this will delete any attribute objects this client may already
+
[in]deleteAttributesIf true this will delete any attribute objects this client may already
have created and clears the vectors after successful connection.
@@ -281,8 +283,8 @@ have created and clears the vectors after successful connection.
- -

◆ connect() [3/3]

+ +

◆ connect() [3/3]

@@ -297,7 +299,7 @@ have created and clears the vectors after successful connection. bool  - deleteAttibutes = true  + deleteAttributes = true  @@ -311,7 +313,7 @@ have created and clears the vectors after successful connection.
Parameters
-
[in]deviceThe device to connect to.
[in]deleteAttibutesIf true this will delete any attribute objects this client may already
+
[in]deleteAttributesIf true this will delete any attribute objects this client may already
have created and clears the vectors after successful connection.
@@ -366,6 +368,26 @@ have created and clears the vectors after successful connection.

Disconnect from the peer.

Returns
Error code from NimBLE stack, 0 = success.
+
+
+ +

◆ discoverAttributes()

+ +
+
+ + + + + + + +
bool NimBLEClient::discoverAttributes ()
+
+ +

Retrieves the full database of attributes that the peripheral has available.

+
Returns
True if successful.
+
@@ -578,14 +600,14 @@ If false the vector will be returned with the currently stored services.
- -

◆ getValue()

+ +

◆ getValue()

- + @@ -744,7 +766,7 @@ Called automatically when a characteristic or descriptor requires encryption or
std::string NimBLEClient::getValue NimBLEAttValue NimBLEClient::getValue ( const NimBLEUUID serviceUUID,
-

Set the connection paramaters to use when connecting to a server.

+

Set the connection parameters to use when connecting to a server.

Parameters
@@ -757,6 +779,38 @@ Called automatically when a characteristic or descriptor requires encryption or + + + +

◆ setConnectPhy()

+ +
+
+
[in]minIntervalThe minimum connection interval in 1.25ms units.
+ + + + + + + +
void NimBLEClient::setConnectPhy (uint8_t mask)
+
+ +

Set the PHY types to use when connecting to a server.

+
Parameters
+ + +
[in]maskA bitmask indicating what PHYS to connect with.
+The available bits are:
    +
  • 0x01 BLE_GAP_LE_PHY_1M_MASK
  • +
  • 0x02 BLE_GAP_LE_PHY_2M_MASK
  • +
  • 0x04 BLE_GAP_LE_PHY_CODED_MASK
  • +
+
+
+
+
@@ -841,8 +895,8 @@ Called automatically when a characteristic or descriptor requires encryption or - -

◆ setValue()

+ +

◆ setValue()

@@ -862,7 +916,7 @@ Called automatically when a characteristic or descriptor requires encryption or - const std::string &  + const NimBLEAttValuevalue, diff --git a/class_nim_b_l_e_client.js b/class_nim_b_l_e_client.js index b63a8e3..22c41f1 100644 --- a/class_nim_b_l_e_client.js +++ b/class_nim_b_l_e_client.js @@ -1,13 +1,13 @@ var class_nim_b_l_e_client = [ [ "begin", "class_nim_b_l_e_client.html#ab09639b499fdcd0021a2432b2b8203f5", null ], - [ "connect", "class_nim_b_l_e_client.html#a836438fc9d5c2001207249661ad10e01", null ], - [ "connect", "class_nim_b_l_e_client.html#a9188741bf29d58d5ff1352383c959b7b", null ], - [ "connect", "class_nim_b_l_e_client.html#aab311f0a8af21fb63f78e7fbac29951a", null ], + [ "connect", "class_nim_b_l_e_client.html#a1f9d4ad6d3d03b819bfad82d1f39b684", null ], + [ "connect", "class_nim_b_l_e_client.html#a026d7e04557b4821a7da2c1a1caa46eb", null ], + [ "connect", "class_nim_b_l_e_client.html#ae9b3e8a9b47c7eaad040b485bda958a1", null ], [ "deleteService", "class_nim_b_l_e_client.html#a0f940c51807469db1f1802b742180beb", null ], [ "deleteServices", "class_nim_b_l_e_client.html#a668d476de250055a106a9f46bb7719f3", null ], [ "disconnect", "class_nim_b_l_e_client.html#a5f77999664cc8a83f3cdb603ba4a5c8c", null ], - [ "discoverAttributes", "class_nim_b_l_e_client.html#a3d8cbf51caf8b3b8a0ec6ce2074ba71d", null ], + [ "discoverAttributes", "class_nim_b_l_e_client.html#a1019178a12799ca2c3a84f523b3a7db9", null ], [ "end", "class_nim_b_l_e_client.html#a0accd665926ea77d85ecb483b2b853fe", null ], [ "getCharacteristic", "class_nim_b_l_e_client.html#a2fc46f43a71dd0df63a377961baf8009", null ], [ "getConnId", "class_nim_b_l_e_client.html#aa09466a7050bf08bab2390da66007896", null ], @@ -19,15 +19,16 @@ var class_nim_b_l_e_client = [ "getService", "class_nim_b_l_e_client.html#ae22379ab10bd82932d2303fb3753c366", null ], [ "getService", "class_nim_b_l_e_client.html#ad8ba10522d79af1136019606802f0978", null ], [ "getServices", "class_nim_b_l_e_client.html#acb9007569b3bb13b3b49f3c4cb47b21a", null ], - [ "getValue", "class_nim_b_l_e_client.html#afd7b5c40f3c190a542f25b0b9e4afaf3", null ], + [ "getValue", "class_nim_b_l_e_client.html#a3903fb7589e2b8b781f8f81f9e0f2a83", null ], [ "isConnected", "class_nim_b_l_e_client.html#af1603da59b829f75b162ac4a65ce181c", null ], [ "secureConnection", "class_nim_b_l_e_client.html#a79935ecbe94f2a41e0106d011edafac4", null ], [ "setClientCallbacks", "class_nim_b_l_e_client.html#aeede4deef7421b9121387a786c07820c", null ], [ "setConnectionParams", "class_nim_b_l_e_client.html#a17718339f76eb621db0d7919c73b9267", null ], + [ "setConnectPhy", "class_nim_b_l_e_client.html#a3ab0a864d8fc7f91ea27f459e2c76b9e", null ], [ "setConnectTimeout", "class_nim_b_l_e_client.html#a4068b29a9bd12e3110465908864dd20e", null ], [ "setDataLen", "class_nim_b_l_e_client.html#a33a0114a126e0e58f7b4359c74f4ed41", null ], [ "setPeerAddress", "class_nim_b_l_e_client.html#a93b5b7c01e58a95dcea335f837d81d07", null ], - [ "setValue", "class_nim_b_l_e_client.html#a0910bbe298a68e9122a169ab229bf767", null ], + [ "setValue", "class_nim_b_l_e_client.html#a967d0c75083706f336f2283eac6d0de2", null ], [ "toString", "class_nim_b_l_e_client.html#aba9ae035357776514b61c2b6286ce1ab", null ], [ "updateConnParams", "class_nim_b_l_e_client.html#aff7d389ec48567286ea732c54d320526", null ] ]; \ No newline at end of file diff --git a/class_nim_b_l_e_client_callbacks-members.html b/class_nim_b_l_e_client_callbacks-members.html index 91d8c63..9386deb 100644 --- a/class_nim_b_l_e_client_callbacks-members.html +++ b/class_nim_b_l_e_client_callbacks-members.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
diff --git a/class_nim_b_l_e_client_callbacks.html b/class_nim_b_l_e_client_callbacks.html index 97966f2..39d5f3b 100644 --- a/class_nim_b_l_e_client_callbacks.html +++ b/class_nim_b_l_e_client_callbacks.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -263,7 +263,7 @@ This can be used to check the status of the connection encryption/pairing. -
Returns
True to accept the parmeters.
+
Returns
True to accept the parameters.
diff --git a/class_nim_b_l_e_conn_info-members.html b/class_nim_b_l_e_conn_info-members.html index 56ee9a6..5ab8955 100644 --- a/class_nim_b_l_e_conn_info-members.html +++ b/class_nim_b_l_e_conn_info-members.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
diff --git a/class_nim_b_l_e_conn_info.html b/class_nim_b_l_e_conn_info.html index b537f5f..cab6304 100644 --- a/class_nim_b_l_e_conn_info.html +++ b/class_nim_b_l_e_conn_info.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
diff --git a/class_nim_b_l_e_descriptor-members.html b/class_nim_b_l_e_descriptor-members.html index 2b6ed0c..9dd505d 100644 --- a/class_nim_b_l_e_descriptor-members.html +++ b/class_nim_b_l_e_descriptor-members.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -94,15 +94,16 @@ $(document).ready(function(){initNavTree('class_nim_b_l_e_descriptor.html',''); getLength()NimBLEDescriptor getStringValue()NimBLEDescriptor getUUID()NimBLEDescriptor - getValue()NimBLEDescriptor - NimBLEDescriptor(const char *uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)NimBLEDescriptor - NimBLEDescriptor(NimBLEUUID uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)NimBLEDescriptor - setCallbacks(NimBLEDescriptorCallbacks *pCallbacks)NimBLEDescriptor - setValue(const uint8_t *data, size_t size)NimBLEDescriptor - setValue(const std::string &value)NimBLEDescriptor - setValue(const T &s)NimBLEDescriptorinline - toString()NimBLEDescriptor - ~NimBLEDescriptor()NimBLEDescriptor + getValue(time_t *timestamp=nullptr)NimBLEDescriptor + getValue(time_t *timestamp=nullptr, bool skipSizeCheck=false)NimBLEDescriptorinline + NimBLEDescriptor(const char *uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)NimBLEDescriptor + NimBLEDescriptor(NimBLEUUID uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)NimBLEDescriptor + setCallbacks(NimBLEDescriptorCallbacks *pCallbacks)NimBLEDescriptor + setValue(const uint8_t *data, size_t size)NimBLEDescriptor + setValue(const std::vector< uint8_t > &vec)NimBLEDescriptor + setValue(const T &s)NimBLEDescriptorinline + toString()NimBLEDescriptor + ~NimBLEDescriptor()NimBLEDescriptor diff --git a/class_nim_b_l_e_descriptor.html b/class_nim_b_l_e_descriptor.html index 25c29e2..dd31c08 100644 --- a/class_nim_b_l_e_descriptor.html +++ b/class_nim_b_l_e_descriptor.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -97,13 +97,11 @@ $(document).ready(function(){initNavTree('class_nim_b_l_e_descriptor.html',''); - - + + - - + + @@ -122,32 +120,140 @@ Public Member Functions + + + - - - + + + - - - - - - + + + - + + + + +

Public Member Functions

NimBLEDescriptor (const char *uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)
 NimBLEDescriptor constructor.
 NimBLEDescriptor (const char *uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)
 Construct a descriptor. More...
 
NimBLEDescriptor (NimBLEUUID uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)
 NimBLEDescriptor constructor.
 NimBLEDescriptor (NimBLEUUID uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)
 Construct a descriptor. More...
 
 ~NimBLEDescriptor ()
void setCallbacks (NimBLEDescriptorCallbacks *pCallbacks)
 Set the callback handlers for this descriptor. More...
 
NimBLECharacteristicgetCharacteristic ()
 Get the characteristic this descriptor belongs to. More...
 
size_t getLength ()
 Get the length of the value of this descriptor. More...
 
uint8_t * getValue ()
 Get the value of this descriptor. More...
 
NimBLEAttValue getValue (time_t *timestamp=nullptr)
 Get the value of this descriptor. More...
 
std::string getStringValue ()
 Get the value of this descriptor as a string. More...
 
void setValue (const uint8_t *data, size_t size)
 Set the value of the descriptor. More...
 
void setValue (const std::string &value)
 Set the value of the descriptor. More...
 
NimBLECharacteristicgetCharacteristic ()
 Get the characteristic this descriptor belongs to. More...
 
void setValue (const std::vector< uint8_t > &vec)
 Set the value of the descriptor from a std::vector<uint8_t>.
+. More...
 
template<typename T >
void setValue (const T &s)
 Convenience template to set the descriptor value to <type>val. More...
 Template to set the characteristic value to <type>val. More...
 
template<typename T >
getValue (time_t *timestamp=nullptr, bool skipSizeCheck=false)
 Template to convert the descriptor data to <type>. More...
 

Detailed Description

A model of a BLE descriptor.

-

Member Function Documentation

+

Constructor & Destructor Documentation

+ +

◆ NimBLEDescriptor() [1/2]

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NimBLEDescriptor::NimBLEDescriptor (const char * uuid,
uint16_t properties,
uint16_t max_len,
NimBLECharacteristicpCharacteristic = nullptr 
)
+
+ +

Construct a descriptor.

+
Parameters
+ + + + + +
[in]uuid- UUID (const char*) for the descriptor.
[in]properties- Properties for the descriptor.
[in]max_len- The maximum length in bytes that the descriptor value can hold. (Default: 512 bytes for esp32, 20 for all others).
[in]pCharacteristic- pointer to the characteristic instance this descriptor belongs to.
+
+
+ +
+
+ +

◆ NimBLEDescriptor() [2/2]

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NimBLEDescriptor::NimBLEDescriptor (NimBLEUUID uuid,
uint16_t properties,
uint16_t max_len,
NimBLECharacteristicpCharacteristic = nullptr 
)
+
+ +

Construct a descriptor.

+
Parameters
+ + + + + +
[in]uuid- UUID (const char*) for the descriptor.
[in]properties- Properties for the descriptor.
[in]max_len- The maximum length in bytes that the descriptor value can hold. (Default: 512 bytes for esp32, 20 for all others).
[in]pCharacteristic- pointer to the characteristic instance this descriptor belongs to.
+
+
+ +
+
+

Member Function Documentation

◆ getCharacteristic()

@@ -228,23 +334,79 @@ Public Member Functions - -

◆ getValue()

+ +

◆ getValue() [1/2]

- + - + +
uint8_t * NimBLEDescriptor::getValue NimBLEAttValue NimBLEDescriptor::getValue ()time_t * timestamp = nullptr)

Get the value of this descriptor.

-
Returns
A pointer to the value of this descriptor.
+
Returns
The NimBLEAttValue of this descriptor.
+ +
+
+ +

◆ getValue() [2/2]

+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
T NimBLEDescriptor::getValue (time_t * timestamp = nullptr,
bool skipSizeCheck = false 
)
+
+inline
+
+ +

Template to convert the descriptor data to <type>.

+
Template Parameters
+ + +
TThe type to convert the data to.
+
+
+
Parameters
+ + + +
[in]timestamp(Optional) A pointer to a time_t struct to store the time the value was read.
[in]skipSizeCheck(Optional) If true it will skip checking if the data size is less than sizeof(<type>).
+
+
+
Returns
The data converted to <type> or NULL if skipSizeCheck is false and the data is less than sizeof(<type>).
+

Use: getValue<type>(&timestamp, skipSizeCheck);

@@ -274,8 +436,8 @@ Public Member Functions - -

◆ setValue() [1/3]

+ +

◆ setValue() [1/3]

@@ -283,17 +445,18 @@ Public Member Functions void NimBLEDescriptor::setValue ( - const std::string &  - value) + const std::vector< uint8_t > &  + vec)
-

Set the value of the descriptor.

+

Set the value of the descriptor from a std::vector<uint8_t>.
+.

Parameters
- +
[in]valueThe value of the descriptor in string form.
[in]vecThe std::vector<uint8_t> reference to set the descriptor value from.
@@ -326,7 +489,7 @@ template<typename T >
-

Convenience template to set the descriptor value to <type>val.

+

Template to set the characteristic value to <type>val.

Parameters
diff --git a/class_nim_b_l_e_descriptor.js b/class_nim_b_l_e_descriptor.js index c4ee90e..4bc416a 100644 --- a/class_nim_b_l_e_descriptor.js +++ b/class_nim_b_l_e_descriptor.js @@ -8,9 +8,10 @@ var class_nim_b_l_e_descriptor = [ "getLength", "class_nim_b_l_e_descriptor.html#a378346f59afb706d4c1d961227b98c5d", null ], [ "getStringValue", "class_nim_b_l_e_descriptor.html#a7153e051e5808469c23e2207fa6711db", null ], [ "getUUID", "class_nim_b_l_e_descriptor.html#abc5398a570edc197fbadad3f5b45e186", null ], - [ "getValue", "class_nim_b_l_e_descriptor.html#ac54fd0830ceb64b91037b623dbc427b5", null ], + [ "getValue", "class_nim_b_l_e_descriptor.html#a8f64c733c8848948fe9123bd7cd3fd53", null ], + [ "getValue", "class_nim_b_l_e_descriptor.html#a61062547f21ca8e102ec5d8e0843c9f9", null ], [ "setCallbacks", "class_nim_b_l_e_descriptor.html#aa9cb8727f9e17cf8050cf619e5fe3096", null ], - [ "setValue", "class_nim_b_l_e_descriptor.html#ad14bda7d046b5f814ed599c8157c7e51", null ], + [ "setValue", "class_nim_b_l_e_descriptor.html#a644f739b6621702856be8db93035e9a0", null ], [ "setValue", "class_nim_b_l_e_descriptor.html#a9136cc9e4b41110b3dd99d1c9553a477", null ], [ "setValue", "class_nim_b_l_e_descriptor.html#a9447cee9092dc516266f7764131ba923", null ], [ "toString", "class_nim_b_l_e_descriptor.html#ac15dc6c9c24d280c4b0eb766080497e5", null ] diff --git a/class_nim_b_l_e_descriptor_callbacks-members.html b/class_nim_b_l_e_descriptor_callbacks-members.html index 2828a9e..f3c174b 100644 --- a/class_nim_b_l_e_descriptor_callbacks-members.html +++ b/class_nim_b_l_e_descriptor_callbacks-members.html @@ -26,7 +26,7 @@ diff --git a/class_nim_b_l_e_descriptor_callbacks.html b/class_nim_b_l_e_descriptor_callbacks.html index 593707c..ac87b47 100644 --- a/class_nim_b_l_e_descriptor_callbacks.html +++ b/class_nim_b_l_e_descriptor_callbacks.html @@ -26,7 +26,7 @@ diff --git a/class_nim_b_l_e_device-members.html b/class_nim_b_l_e_device-members.html index 2ce765d..152949d 100644 --- a/class_nim_b_l_e_device-members.html +++ b/class_nim_b_l_e_device-members.html @@ -26,7 +26,7 @@ @@ -126,12 +126,13 @@ $(document).ready(function(){initNavTree('class_nim_b_l_e_device.html',''); init - + - - - - + + + + +
[in]sThe value to set.
esp-nimble-cpp -  1.3.2 +  1.4.0
esp-nimble-cpp -  1.3.2 +  1.4.0
esp-nimble-cpp -  1.3.2 +  1.4.0
setSecurityIOCap(uint8_t iocap)NimBLEDevicestatic
setSecurityPasskey(uint32_t pin)NimBLEDevicestatic
setSecurityRespKey(uint8_t init_key)NimBLEDevicestatic
startAdvertising()NimBLEDevicestatic
startAdvertising(uint8_t inst_id, int duration=0, int max_events=0)NimBLEDevicestatic
startSecurity(uint16_t conn_id)NimBLEDevicestatic
stopAdvertising()NimBLEDevicestatic
toString()NimBLEDevicestatic
whiteListAdd(const NimBLEAddress &address)NimBLEDevicestatic
whiteListRemove(const NimBLEAddress &address)NimBLEDevicestatic
stopAdvertising(uint8_t inst_id)NimBLEDevicestatic
stopAdvertising()NimBLEDevicestatic
toString()NimBLEDevicestatic
whiteListAdd(const NimBLEAddress &address)NimBLEDevicestatic
whiteListRemove(const NimBLEAddress &address)NimBLEDevicestatic
diff --git a/class_nim_b_l_e_device.html b/class_nim_b_l_e_device.html index 67683f0..98885b6 100644 --- a/class_nim_b_l_e_device.html +++ b/class_nim_b_l_e_device.html @@ -26,7 +26,7 @@
esp-nimble-cpp -  1.3.2 +  1.4.0
@@ -179,17 +179,18 @@ Static Public Member Functions static void removeIgnored (const NimBLEAddress &address)  Remove a device from the ignore list. More...
  -static NimBLEAdvertisinggetAdvertising () +static NimBLEExtAdvertisinggetAdvertising ()  Get the instance of the advertising object. More...
  - -static void startAdvertising () - Convenience function to begin advertising.
-  - -static void stopAdvertising () - Convenience function to stop advertising.
-  +static bool startAdvertising (uint8_t inst_id, int duration=0, int max_events=0) + Convenience function to begin advertising. More...
+  +static bool stopAdvertising (uint8_t inst_id) + Convenience function to stop advertising a data set. More...
+  +static bool stopAdvertising () + Convenience function to stop all advertising. More...
+  static NimBLEClientcreateClient (NimBLEAddress peerAddress=NimBLEAddress(""))  Creates a new client object and maintains a list of all client objects each client can connect to 1 peripheral device. More...
  @@ -294,7 +295,7 @@ static void Creates a new client object and maintains a list of all client objects each client can connect to 1 peripheral device.

Parameters
- +
[in]peerAddressAn optional peer address that is copied to the new client object, allows for calling NimBLEClient::connect(bool) without a device or address parameter.
[in]peerAddressAn optional peer address that is copied to the new client object, allows for calling NimBLEClient::connect(bool) without a device or address parameter.
@@ -1409,6 +1410,61 @@ The available bits are defined as: