mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-21 20:50:55 +01:00
NimBLEAdvertisedDevice: Prevent adding dupicate service uuid's.
This commit is contained in:
parent
59823b4bf0
commit
fba7e0fd68
1 changed files with 6 additions and 0 deletions
|
@ -441,6 +441,12 @@ void NimBLEAdvertisedDevice::setServiceUUID(const char* serviceUUID) {
|
|||
* @param [in] serviceUUID The discovered serviceUUID
|
||||
*/
|
||||
void NimBLEAdvertisedDevice::setServiceUUID(NimBLEUUID serviceUUID) {
|
||||
// Don't add duplicates
|
||||
for (int i = 0; i < m_serviceUUIDs.size(); i++) {
|
||||
if (m_serviceUUIDs[i].equals(serviceUUID)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_serviceUUIDs.push_back(serviceUUID);
|
||||
m_haveServiceUUID = true;
|
||||
NIMBLE_LOGD(LOG_TAG,"- addServiceUUID(): serviceUUID: %s", serviceUUID.toString().c_str());
|
||||
|
|
Loading…
Reference in a new issue