Add clearData method to NimBLEAdvertisementData.

This commit is contained in:
h2zero 2024-06-13 15:02:32 -06:00
parent 20349c64a4
commit bc7bfe8278
2 changed files with 9 additions and 0 deletions

View file

@ -1064,4 +1064,12 @@ std::string NimBLEAdvertisementData::getPayload() {
return m_payload; return m_payload;
} // getPayload } // getPayload
/**
* @brief Clear the advertisement data for reuse.
*/
void NimBLEAdvertisementData::clearData() {
m_payload.clear();
}
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV */ #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV */

View file

@ -76,6 +76,7 @@ public:
void addTxPower(); void addTxPower();
void setPreferredParams(uint16_t min, uint16_t max); void setPreferredParams(uint16_t min, uint16_t max);
std::string getPayload(); // Retrieve the current advert payload. std::string getPayload(); // Retrieve the current advert payload.
void clearData(); // Clear the advertisement data.
private: private:
friend class NimBLEAdvertising; friend class NimBLEAdvertising;