Skip to content

Commit

Permalink
Add clearData method to NimBLEAdvertisementData.
Browse files Browse the repository at this point in the history
  • Loading branch information
h2zero committed Jun 13, 2024
1 parent 5b2d72a commit a0abf93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/NimBLEAdvertising.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1067,4 +1067,12 @@ std::string NimBLEAdvertisementData::getPayload() {
return m_payload;
} // 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 */
1 change: 1 addition & 0 deletions src/NimBLEAdvertising.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class NimBLEAdvertisementData {
void addTxPower();
void setPreferredParams(uint16_t min, uint16_t max);
std::string getPayload(); // Retrieve the current advert payload.
void clearData(); // Clear the advertisement data.

private:
friend class NimBLEAdvertising;
Expand Down

0 comments on commit a0abf93

Please sign in to comment.