Lightly modified version of the BLE stack, that doesn't bring up a DFUService by default... as we have our own.
Fork of BLE_API by
Diff: services/URIBeacon2Service.h
- Revision:
- 183:41d6ffadba96
- Parent:
- 182:d16f8c11816b
- Child:
- 184:ec211f2288ef
diff -r d16f8c11816b -r 41d6ffadba96 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 @@ -93,6 +93,12 @@ } /** + * Please note that the following public APIs are offered to allow modifying + * the service programmatically. It is also possible to do so over BLE GATT + * transactions. + */ +public: + /** * Update the txPower for a particular mode in the powerLevels table. */ void setTxPowerLevel(TXPowerModes_t mode, int8_t txPowerIn) { @@ -107,12 +113,20 @@ setup(); } + /** + * The period in milliseconds that a UriBeacon packet is transmitted. + * + * @Note: A value of zero disables UriBeacon transmissions. + */ void setBeaconPeriod(uint16_t beaconPeriodIn) { beaconPeriod = beaconPeriodIn; setup(); } private: + /** + * Private constructor. We want a singleton. + */ URIBeacon2Service(BLEDevice &ble_, const char *urldata, uint8_t flagsIn = 0, int8_t effectiveTxPowerIn = 0, uint16_t beaconPeriodIn = 1000) : ble(ble_), payloadIndex(0), @@ -222,9 +236,9 @@ serviceDataPayload[payloadIndex++] = flags; serviceDataPayload[payloadIndex++] = effectivePower; - const char *urlData = reinterpret_cast<char *>(uriDataValue); + const char *urlData = reinterpret_cast<char *>(uriDataValue); size_t sizeofURLData = uriDataLength; - size_t encodedBytes = encodeURISchemePrefix(urlData, sizeofURLData) + encodeURI(urlData, sizeofURLData); + size_t encodedBytes = encodeURISchemePrefix(urlData, sizeofURLData) + encodeURI(urlData, sizeofURLData); ble.clearAdvertisingPayload(); ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, BEACON_UUID, sizeof(BEACON_UUID));