Minor temporary patch to allow DFU packet callback
Fork of BLE_API by
Diff: services/URIBeacon2Service.h
- Revision:
- 182:d16f8c11816b
- Parent:
- 181:bbb6ce1082c3
- Child:
- 183:41d6ffadba96
--- a/services/URIBeacon2Service.h Fri Nov 28 14:11:23 2014 +0000 +++ b/services/URIBeacon2Service.h Fri Nov 28 14:11:23 2014 +0000 @@ -64,7 +64,11 @@ } static URIBeacon2Service service(ble_, urldata, flagsIn, effectiveTxPowerIn, beaconPeriodIn); - return &service; + if (!service.failedToAccomodate) { + return &service; + } + + return NULL; /* Oops. Failed to accommodate uridata within the advertising payload. */ } /** @@ -113,6 +117,7 @@ ble(ble_), payloadIndex(0), serviceDataPayload(), + failedToAccomodate(false), lockedState(false), uriDataLength(strlen(urldata)), uriDataValue(), @@ -300,6 +305,9 @@ --sizeofURLData; } } + if ((payloadIndex == MAX_SIZEOF_SERVICE_DATA_PAYLOAD) && (sizeofURLData != 0)) { + failedToAccomodate = true; + } return encodedBytes; } @@ -313,6 +321,8 @@ size_t payloadIndex; uint8_t serviceDataPayload[MAX_SIZEOF_SERVICE_DATA_PAYLOAD]; + bool failedToAccomodate; + bool lockedState; uint16_t uriDataLength; uint8_t uriDataValue[MAX_SIZE_URI_DATA_CHAR_VALUE];