some more variable renames.
This commit is contained in:
parent
f79f6b8ba7
commit
149a413573
|
@ -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 &bleIn, const char *urlDataIn, uint8_t flagsIn = 0, int8_t effectiveTxPowerIn = 0, uint16_t beaconPeriodIn = 1000) {
|
static URIBeacon2Service *setup(BLEDevice &bleIn, const char *uriDataIn, uint8_t flagsIn = 0, int8_t effectiveTxPowerIn = 0, uint16_t beaconPeriodIn = 1000) {
|
||||||
if ((urlDataIn == NULL) || (strlen(urlDataIn) == 0)) {
|
if ((uriDataIn == NULL) || (strlen(uriDataIn) == 0)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static URIBeacon2Service service(bleIn, urlDataIn, flagsIn, effectiveTxPowerIn, beaconPeriodIn);
|
static URIBeacon2Service service(bleIn, uriDataIn, flagsIn, effectiveTxPowerIn, beaconPeriodIn);
|
||||||
if (!service.failedToAccomodate) {
|
if (!service.failedToAccomodate) {
|
||||||
return &service;
|
return &service;
|
||||||
}
|
}
|
||||||
|
@ -127,13 +127,13 @@ private:
|
||||||
/**
|
/**
|
||||||
* Private constructor. We want a singleton.
|
* Private constructor. We want a singleton.
|
||||||
*/
|
*/
|
||||||
URIBeacon2Service(BLEDevice &bleIn, const char *urldataIn, uint8_t flagsIn = 0, int8_t effectiveTxPowerIn = 0, uint16_t beaconPeriodIn = 1000) :
|
URIBeacon2Service(BLEDevice &bleIn, const char *uriDataIn, uint8_t flagsIn = 0, int8_t effectiveTxPowerIn = 0, uint16_t beaconPeriodIn = 1000) :
|
||||||
ble(bleIn),
|
ble(bleIn),
|
||||||
payloadIndex(0),
|
payloadIndex(0),
|
||||||
serviceDataPayload(),
|
serviceDataPayload(),
|
||||||
failedToAccomodate(false),
|
failedToAccomodate(false),
|
||||||
lockedState(false),
|
lockedState(false),
|
||||||
uriDataLength(strlen(urldataIn)),
|
uriDataLength(strlen(uriDataIn)),
|
||||||
uriData(),
|
uriData(),
|
||||||
flags(flagsIn),
|
flags(flagsIn),
|
||||||
effectivePower(effectiveTxPowerIn),
|
effectivePower(effectiveTxPowerIn),
|
||||||
|
@ -154,9 +154,16 @@ 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 *>(uriData), urldataIn, MAX_SIZE_URI_DATA_CHAR_VALUE);
|
strncpy(reinterpret_cast<char *>(uriData), uriDataIn, MAX_SIZE_URI_DATA_CHAR_VALUE);
|
||||||
|
|
||||||
configure();
|
configure();
|
||||||
|
if (!failedToAccomodate) {
|
||||||
|
/* Preserve the originals to be able to reset() upon request. */
|
||||||
|
// memcpy(service.originalURIData, urlDataIn, MAX_SIZE_URI_DATA_CHAR_VALUE);
|
||||||
|
// service.originalFlags = flagsIn;
|
||||||
|
// service.originalEffectiveTxPower = effectiveTxPowerIn;
|
||||||
|
// service.originalBeaconPeriod = beaconPeriodIn;
|
||||||
|
}
|
||||||
|
|
||||||
GattCharacteristic *charTable[] = {&lockedStateChar, &uriDataChar, &flagsChar, &txPowerLevelsChar, &beaconPeriodChar};
|
GattCharacteristic *charTable[] = {&lockedStateChar, &uriDataChar, &flagsChar, &txPowerLevelsChar, &beaconPeriodChar};
|
||||||
GattService beaconControlService(URIBeacon2ControlServiceUUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
|
GattService beaconControlService(URIBeacon2ControlServiceUUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
|
||||||
|
@ -347,6 +354,10 @@ private:
|
||||||
int8_t powerLevels[NUM_POWER_MODES];
|
int8_t powerLevels[NUM_POWER_MODES];
|
||||||
uint16_t beaconPeriod;
|
uint16_t beaconPeriod;
|
||||||
|
|
||||||
|
uint8_t originalURIData[MAX_SIZE_URI_DATA_CHAR_VALUE];
|
||||||
|
uint8_t originalFlags;
|
||||||
|
int8_t originalEffectivePower;
|
||||||
|
|
||||||
GattCharacteristic lockedStateChar;
|
GattCharacteristic lockedStateChar;
|
||||||
GattCharacteristic uriDataChar;
|
GattCharacteristic uriDataChar;
|
||||||
GattCharacteristic flagsChar;
|
GattCharacteristic flagsChar;
|
||||||
|
|
Loading…
Reference in New Issue