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() {
253253 log_v (" << stop" );
254254} // stop
255255
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+
256277/* *
257278 * @brief Add data to the payload to be advertised.
258279 * @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 {
5858 void setScanFilter (bool scanRequertWhitelistOnly, bool connectWhitelistOnly);
5959 void setScanResponseData (BLEAdvertisementData& advertisementData);
6060 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);
6162
6263 void handleGAPEvent (esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t * param);
6364 void setMinPreferred (uint16_t );
You can’t perform that action at this time.
0 commit comments