File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -385,6 +385,22 @@ void NimBLEAdvertising::clearData() {
385385 m_advDataSet = false ;
386386} // clearData
387387
388+ /* *
389+ * @brief Refresh advertsing data dynamically without stop/start cycle.
390+ * For instance allows refreshing manufacturer data dynamically.
391+ *
392+ * @return True if the data was set successfully.
393+ * @details If scan response is enabled it will be refreshed as well.
394+ */
395+ bool NimBLEAdvertising::refreshAdvertisingData () {
396+ bool success = setAdvertisementData (m_advData);
397+ if (m_scanResp) {
398+ success = setScanResponseData (m_scanData);
399+ }
400+
401+ return success;
402+ } // refreshAdvertisingData
403+
388404/* *
389405 * @brief Add a service uuid to exposed list of services.
390406 * @param [in] serviceUUID The UUID of the service to expose.
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ class NimBLEAdvertising {
6767 const NimBLEAdvertisementData& getAdvertisementData ();
6868 const NimBLEAdvertisementData& getScanData ();
6969 void clearData ();
70+ bool refreshAdvertisingData ();
7071
7172 bool addServiceUUID (const NimBLEUUID& serviceUUID);
7273 bool addServiceUUID (const char * serviceUUID);
You can’t perform that action at this time.
0 commit comments