replace use of updateCharacteristicValue() with ble.gattServer().write()
parent
7fb8b66ebb
commit
b633e90c9c
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ class URIBeaconConfigService {
|
|||
paramsUpdated = true;
|
||||
}
|
||||
if (paramsUpdated) {
|
||||
ble.updateCharacteristicValue(beaconPeriodChar.getValueHandle(), reinterpret_cast<uint8_t *>(¶ms.beaconPeriod), sizeof(uint16_t));
|
||||
ble.gattServer().write(beaconPeriodChar.getValueHandle(), reinterpret_cast<uint8_t *>(¶ms.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(), ¶ms.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(), ¶ms.flags, 1);
|
||||
ble.gattServer().write(beaconPeriodChar.getValueHandle(),
|
||||
reinterpret_cast<uint8_t *>(¶ms.beaconPeriod), sizeof(uint16_t));
|
||||
ble.updateCharacteristicValue(txPowerModeChar.getValueHandle(), ¶ms.txPowerMode, 1);
|
||||
ble.updateCharacteristicValue(advPowerLevelsChar.getValueHandle(),
|
||||
ble.gattServer().write(txPowerModeChar.getValueHandle(), ¶ms.txPowerMode, 1);
|
||||
ble.gattServer().write(advPowerLevelsChar.getValueHandle(),
|
||||
reinterpret_cast<uint8_t *>(params.advPowerLevels), sizeof(PowerLevels_t));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue