variable renames.

This commit is contained in:
Rohit Grover 2014-11-28 10:28:13 +00:00
parent fdfc899372
commit f79f6b8ba7
1 changed files with 13 additions and 13 deletions

View File

@ -58,12 +58,12 @@ public:
* @return * @return
* Pointer to the singleton uribeacon service if the initialization goes well; else NULL. * Pointer to the singleton uribeacon service if the initialization goes well; else NULL.
*/ */
static URIBeacon2Service *setup(BLEDevice &ble_, const char *urldata, uint8_t flagsIn = 0, int8_t effectiveTxPowerIn = 0, uint16_t beaconPeriodIn = 1000) { static URIBeacon2Service *setup(BLEDevice &bleIn, const char *urlDataIn, uint8_t flagsIn = 0, int8_t effectiveTxPowerIn = 0, uint16_t beaconPeriodIn = 1000) {
if ((urldata == NULL) || (strlen(urldata) == 0)) { if ((urlDataIn == NULL) || (strlen(urlDataIn) == 0)) {
return NULL; return NULL;
} }
static URIBeacon2Service service(ble_, urldata, flagsIn, effectiveTxPowerIn, beaconPeriodIn); static URIBeacon2Service service(bleIn, urlDataIn, flagsIn, effectiveTxPowerIn, beaconPeriodIn);
if (!service.failedToAccomodate) { if (!service.failedToAccomodate) {
return &service; return &service;
} }
@ -127,21 +127,21 @@ private:
/** /**
* Private constructor. We want a singleton. * Private constructor. We want a singleton.
*/ */
URIBeacon2Service(BLEDevice &ble_, const char *urldata, uint8_t flagsIn = 0, int8_t effectiveTxPowerIn = 0, uint16_t beaconPeriodIn = 1000) : URIBeacon2Service(BLEDevice &bleIn, const char *urldataIn, uint8_t flagsIn = 0, int8_t effectiveTxPowerIn = 0, uint16_t beaconPeriodIn = 1000) :
ble(ble_), ble(bleIn),
payloadIndex(0), payloadIndex(0),
serviceDataPayload(), serviceDataPayload(),
failedToAccomodate(false), failedToAccomodate(false),
lockedState(false), lockedState(false),
uriDataLength(strlen(urldata)), uriDataLength(strlen(urldataIn)),
uriDataValue(), uriData(),
flags(flagsIn), flags(flagsIn),
effectivePower(effectiveTxPowerIn), effectivePower(effectiveTxPowerIn),
powerLevels(), powerLevels(),
beaconPeriod(Gap::MSEC_TO_ADVERTISEMENT_DURATION_UNITS(beaconPeriodIn)), beaconPeriod(Gap::MSEC_TO_ADVERTISEMENT_DURATION_UNITS(beaconPeriodIn)),
lockedStateChar(lockedStateCharUUID, reinterpret_cast<uint8_t *>(&lockedState), 1, 1, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ), lockedStateChar(lockedStateCharUUID, reinterpret_cast<uint8_t *>(&lockedState), 1, 1, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ),
uriDataChar(uriDataCharUUID, uriDataChar(uriDataCharUUID,
uriDataValue, uriData,
MAX_SIZE_URI_DATA_CHAR_VALUE, MAX_SIZE_URI_DATA_CHAR_VALUE,
MAX_SIZE_URI_DATA_CHAR_VALUE, MAX_SIZE_URI_DATA_CHAR_VALUE,
GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE), GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE),
@ -154,7 +154,7 @@ private:
beaconPeriodChar(beaconPeriodCharUUID, reinterpret_cast<uint8_t *>(&beaconPeriod), 2, 2, beaconPeriodChar(beaconPeriodCharUUID, reinterpret_cast<uint8_t *>(&beaconPeriod), 2, 2,
GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE) GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE)
{ {
strncpy(reinterpret_cast<char *>(uriDataValue), urldata, MAX_SIZE_URI_DATA_CHAR_VALUE); strncpy(reinterpret_cast<char *>(uriData), urldataIn, MAX_SIZE_URI_DATA_CHAR_VALUE);
configure(); configure();
@ -177,7 +177,7 @@ private:
serviceDataPayload[payloadIndex++] = flags; serviceDataPayload[payloadIndex++] = flags;
serviceDataPayload[payloadIndex++] = effectivePower; serviceDataPayload[payloadIndex++] = effectivePower;
const char *urlData = reinterpret_cast<char *>(uriDataValue); const char *urlData = reinterpret_cast<char *>(uriData);
size_t sizeofURLData = uriDataLength; size_t sizeofURLData = uriDataLength;
size_t encodedBytes = encodeURISchemePrefix(urlData, sizeofURLData) + encodeURI(urlData, sizeofURLData); size_t encodedBytes = encodeURISchemePrefix(urlData, sizeofURLData) + encodeURI(urlData, sizeofURLData);
@ -276,7 +276,7 @@ private:
if (params->charHandle == uriDataChar.getValueAttribute().getHandle()) { if (params->charHandle == uriDataChar.getValueAttribute().getHandle()) {
if (lockedState) { /* When locked, the device isn't allowed to update the uriData characteristic. */ if (lockedState) { /* When locked, the device isn't allowed to update the uriData characteristic. */
/* Restore GATT database with previous value. */ /* Restore GATT database with previous value. */
ble.updateCharacteristicValue(uriDataChar.getValueAttribute().getHandle(), uriDataValue, uriDataLength); ble.updateCharacteristicValue(uriDataChar.getValueAttribute().getHandle(), uriData, uriDataLength);
return; return;
} }
@ -286,7 +286,7 @@ private:
} }
uriDataLength = params->len; uriDataLength = params->len;
memcpy(uriDataValue, params->data, uriDataLength); memcpy(uriData, params->data, uriDataLength);
} else if (params->charHandle == flagsChar.getValueAttribute().getHandle()) { } else if (params->charHandle == flagsChar.getValueAttribute().getHandle()) {
if (lockedState) { /* When locked, the device isn't allowed to update the characteristic. */ if (lockedState) { /* When locked, the device isn't allowed to update the characteristic. */
/* Restore GATT database with previous value. */ /* Restore GATT database with previous value. */
@ -341,7 +341,7 @@ private:
bool lockedState; bool lockedState;
uint16_t uriDataLength; uint16_t uriDataLength;
uint8_t uriDataValue[MAX_SIZE_URI_DATA_CHAR_VALUE]; uint8_t uriData[MAX_SIZE_URI_DATA_CHAR_VALUE];
uint8_t flags; uint8_t flags;
int8_t effectivePower; int8_t effectivePower;
int8_t powerLevels[NUM_POWER_MODES]; int8_t powerLevels[NUM_POWER_MODES];