mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-12-18 09:10:47 +01:00
Refresh advertising data dynamically
This commit is contained in:
parent
2de3c31421
commit
47c3cd5b84
2 changed files with 17 additions and 0 deletions
|
@ -385,6 +385,22 @@ void NimBLEAdvertising::clearData() {
|
||||||
m_advDataSet = false;
|
m_advDataSet = false;
|
||||||
} // clearData
|
} // clearData
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Refresh advertsing data dynamically without stop/start cycle.
|
||||||
|
* For instance allows refreshing manufacturer data dynamically.
|
||||||
|
*
|
||||||
|
* @return True if the data was set successfully.
|
||||||
|
* @details If scan response is enabled it will be refreshed as well.
|
||||||
|
*/
|
||||||
|
bool NimBLEAdvertising::refreshAdvertisingData() {
|
||||||
|
bool success = setAdvertisementData(m_advData);
|
||||||
|
if (m_scanResp) {
|
||||||
|
success = setScanResponseData(m_scanData);
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
|
} // refreshAdvertisingData
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add a service uuid to exposed list of services.
|
* @brief Add a service uuid to exposed list of services.
|
||||||
* @param [in] serviceUUID The UUID of the service to expose.
|
* @param [in] serviceUUID The UUID of the service to expose.
|
||||||
|
|
|
@ -67,6 +67,7 @@ class NimBLEAdvertising {
|
||||||
const NimBLEAdvertisementData& getAdvertisementData();
|
const NimBLEAdvertisementData& getAdvertisementData();
|
||||||
const NimBLEAdvertisementData& getScanData();
|
const NimBLEAdvertisementData& getScanData();
|
||||||
void clearData();
|
void clearData();
|
||||||
|
bool refreshAdvertisingData();
|
||||||
|
|
||||||
bool addServiceUUID(const NimBLEUUID& serviceUUID);
|
bool addServiceUUID(const NimBLEUUID& serviceUUID);
|
||||||
bool addServiceUUID(const char* serviceUUID);
|
bool addServiceUUID(const char* serviceUUID);
|
||||||
|
|
Loading…
Reference in a new issue