File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,27 @@ void BLEAdvertising::stop() {
253
253
log_v (" << stop" );
254
254
} // stop
255
255
256
+ /* *
257
+ * @brief Set BLE address.
258
+ * @param [in] Bluetooth address.
259
+ * @param [in] Bluetooth address type.
260
+ * Set BLE address.
261
+ */
262
+
263
+ void BLEAdvertising::setDeviceAddress (esp_bd_addr_t addr, esp_ble_addr_type_t type)
264
+ {
265
+ log_v (" >> setPrivateAddress" )
266
+
267
+ m_advParams.own_addr_type = type;
268
+ esp_err_t errRc = esp_ble_gap_set_rand_addr ((uint8_t *)addr);
269
+ if (errRc != ESP_OK)
270
+ {
271
+ log_e (" esp_ble_gap_set_rand_addr: rc=%d %s" , errRc, GeneralUtils::errorToString (errRc));
272
+ return ;
273
+ }
274
+ log_v (" << setPrivateAddress" )
275
+ } // setPrivateAddress
276
+
256
277
/* *
257
278
* @brief Add data to the payload to be advertised.
258
279
* @param [in] data The data to be added to the payload.
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ class BLEAdvertising {
58
58
void setScanFilter (bool scanRequertWhitelistOnly, bool connectWhitelistOnly);
59
59
void setScanResponseData (BLEAdvertisementData& advertisementData);
60
60
void setPrivateAddress (esp_ble_addr_type_t type = BLE_ADDR_TYPE_RANDOM);
61
+ void setDeviceAddress (esp_bd_addr_t addr, esp_ble_addr_type_t type = BLE_ADDR_TYPE_RANDOM);
61
62
62
63
void handleGAPEvent (esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t * param);
63
64
void setMinPreferred (uint16_t );
You can’t perform that action at this time.
0 commit comments