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/URIBeaconConfigService.h
- Revision:
- 320:c39b901dca81
- Parent:
- 319:3782a0d47b00
- Child:
- 321:6330d9b08295
--- a/services/URIBeaconConfigService.h Fri Mar 13 09:57:57 2015 +0000 +++ b/services/URIBeaconConfigService.h Fri Mar 13 09:57:57 2015 +0000 @@ -191,16 +191,16 @@ void setupURIBeaconAdvertisements() { uint8_t serviceData[SERVICE_DATA_MAX]; - int serviceDataLen = 0; + unsigned serviceDataLen = 0; /* Reinitialize the BLE stack. This will clear away the existing services and advertising state. */ ble.shutdown(); ble.init(); // Fields from the Service - int beaconPeriod = params.beaconPeriod; - int txPowerMode = params.txPowerMode; - int uriDataLength = params.uriDataLength; + unsigned beaconPeriod = params.beaconPeriod; + unsigned txPowerMode = params.txPowerMode; + unsigned uriDataLength = params.uriDataLength; URIBeaconConfigService::UriData_t &uriData = params.uriData; URIBeaconConfigService::PowerLevels_t &advPowerLevels = params.advPowerLevels; uint8_t flags = params.flags; @@ -219,7 +219,7 @@ serviceData[serviceDataLen++] = BEACON_UUID[1]; serviceData[serviceDataLen++] = flags; serviceData[serviceDataLen++] = advPowerLevels[txPowerMode]; - for (int j=0; j < uriDataLength; j++) { + for (unsigned j = 0; j < uriDataLength; j++) { serviceData[serviceDataLen++] = uriData[j]; } ble.accumulateAdvertisingPayload(GapAdvertisingData::SERVICE_DATA, serviceData, serviceDataLen); @@ -270,7 +270,7 @@ * Reset the default values. */ void resetToDefaults(void) { - lockedState = false; + lockedState = false; memset(params.lock, 0, sizeof(Lock_t)); memcpy(params.uriData, defaultUriData, URI_DATA_MAX); params.uriDataLength = defaultUriDataLength; @@ -317,7 +317,7 @@ } void flagsAuthorizationCallback(GattCharacteristicWriteAuthCBParams *authParams) { - if (lockedState || authParams->len != 1) { + if (lockedState || (authParams->len != 1)) { authParams->authorizationReply = false; } }