replace use of updateCharacteristicValue() with ble.gattServer().write()

master
Rohit Grover 2015-07-01 12:57:17 +01:00
parent 7fb8b66ebb
commit b633e90c9c
5 changed files with 13 additions and 13 deletions

View File

@ -53,7 +53,7 @@ public:
*/
void updateBatteryLevel(uint8_t newLevel) {
batteryLevel = newLevel;
ble.updateCharacteristicValue(batteryLevelCharacteristic.getValueAttribute().getHandle(), &batteryLevel, 1);
ble.gattServer().write(batteryLevelCharacteristic.getValueHandle(), &batteryLevel, 1);
}
protected:

View File

@ -73,7 +73,7 @@ public:
void updateTemperature(float temperature) {
if (ble.getGapState().connected) {
valueBytes.updateTemperature(temperature);
ble.updateCharacteristicValue(tempMeasurement.getValueAttribute().getHandle(), valueBytes.getPointer(), sizeof(TemperatureValueBytes));
ble.gattServer().write(tempMeasurement.getValueHandle(), valueBytes.getPointer(), sizeof(TemperatureValueBytes));
}
}
@ -83,7 +83,7 @@ public:
* new location value.
*/
void updateLocation(SensorLocation_t loc) {
ble.updateCharacteristicValue(tempLocation.getValueHandle(), reinterpret_cast<uint8_t *>(&loc), sizeof(uint8_t));
ble.gattServer().write(tempLocation.getValueHandle(), reinterpret_cast<uint8_t *>(&loc), sizeof(uint8_t));
}
private:

View File

@ -93,7 +93,7 @@ public:
*/
void updateHeartRate(uint8_t hrmCounter) {
valueBytes.updateHeartRate(hrmCounter);
ble.updateCharacteristicValue(hrmRate.getValueAttribute().getHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes());
ble.gattServer().write(hrmRate.getValueHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes());
}
/**
@ -104,7 +104,7 @@ public:
*/
void updateHeartRate(uint16_t hrmCounter) {
valueBytes.updateHeartRate(hrmCounter);
ble.updateCharacteristicValue(hrmRate.getValueAttribute().getHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes());
ble.gattServer().write(hrmRate.getValueHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes());
}
/**

View File

@ -117,7 +117,7 @@ public:
if ((sendBufferIndex == BLE_UART_SERVICE_MAX_DATA_LEN) ||
// (sendBuffer[sendBufferIndex - 1] == '\r') ||
(sendBuffer[sendBufferIndex - 1] == '\n')) {
ble.updateCharacteristicValue(getRXCharacteristicHandle(), static_cast<const uint8_t *>(sendBuffer), sendBufferIndex);
ble.gattServer().write(getRXCharacteristicHandle(), static_cast<const uint8_t *>(sendBuffer), sendBufferIndex);
sendBufferIndex = 0;
}
}

View File

@ -267,7 +267,7 @@ class URIBeaconConfigService {
paramsUpdated = true;
}
if (paramsUpdated) {
ble.updateCharacteristicValue(beaconPeriodChar.getValueHandle(), reinterpret_cast<uint8_t *>(&params.beaconPeriod), sizeof(uint16_t));
ble.gattServer().write(beaconPeriodChar.getValueHandle(), reinterpret_cast<uint8_t *>(&params.beaconPeriod), sizeof(uint16_t));
}
}
} else if (handle == resetChar.getValueHandle()) {
@ -295,13 +295,13 @@ class URIBeaconConfigService {
* change to the internal state of the service object.
*/
void updateCharacteristicValues(void) {
ble.updateCharacteristicValue(lockedStateChar.getValueHandle(), &lockedState, 1);
ble.updateCharacteristicValue(uriDataChar.getValueHandle(), params.uriData, params.uriDataLength);
ble.updateCharacteristicValue(flagsChar.getValueHandle(), &params.flags, 1);
ble.updateCharacteristicValue(beaconPeriodChar.getValueHandle(),
ble.gattServer().write(lockedStateChar.getValueHandle(), &lockedState, 1);
ble.gattServer().write(uriDataChar.getValueHandle(), params.uriData, params.uriDataLength);
ble.gattServer().write(flagsChar.getValueHandle(), &params.flags, 1);
ble.gattServer().write(beaconPeriodChar.getValueHandle(),
reinterpret_cast<uint8_t *>(&params.beaconPeriod), sizeof(uint16_t));
ble.updateCharacteristicValue(txPowerModeChar.getValueHandle(), &params.txPowerMode, 1);
ble.updateCharacteristicValue(advPowerLevelsChar.getValueHandle(),
ble.gattServer().write(txPowerModeChar.getValueHandle(), &params.txPowerMode, 1);
ble.gattServer().write(advPowerLevelsChar.getValueHandle(),
reinterpret_cast<uint8_t *>(params.advPowerLevels), sizeof(PowerLevels_t));
}