Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: microbit-dal microbit-dal microbit-ble-open microbit-dal ... more
Fork of BLE_API by
Diff: services/URIBeacon2Service.h
- Revision:
- 182:d16f8c11816b
- Parent:
- 181:bbb6ce1082c3
- Child:
- 183:41d6ffadba96
diff -r bbb6ce1082c3 -r d16f8c11816b services/URIBeacon2Service.h
--- 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];
