NimBLEAdvertisedDevice: Prevent adding dupicate service uuid's.

This commit is contained in:
h2zero 2020-05-07 22:30:58 -06:00
parent 59823b4bf0
commit fba7e0fd68

View file

@ -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());