Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/utility/GAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ int GAPClass::advertise()

uint8_t type = (_connectable) ? 0x00 : (_localName ? 0x02 : 0x03);

_advertising = false;
stopAdvertise();

if (HCI.leSetAdvertisingParameters(_advertisingInterval, _advertisingInterval, type, 0x00, 0x00, directBdaddr, 0x07, 0) != 0) {
return 0;
Expand Down Expand Up @@ -110,7 +110,7 @@ int GAPClass::advertise()
advertisingDataLen += (2 + _manufacturerDataLength);
}

if (_serviceData && _serviceDataLength > 0 && advertisingDataLen >= (_serviceDataLength + 4)) {
if (_serviceData && _serviceDataLength > 0 && (sizeof(advertisingData) - advertisingDataLen) >= (_serviceDataLength + 4)) {
advertisingData[advertisingDataLen++] = _serviceDataLength + 3;
advertisingData[advertisingDataLen++] = 0x16;

Expand Down Expand Up @@ -153,7 +153,7 @@ int GAPClass::advertise()
return 0;
}

_advertising = false;
_advertising = true;

return 1;
}
Expand Down