diff --git a/ble/services/BatteryService.h b/ble/services/BatteryService.h index 6bc0723..b8ef8ec 100644 --- a/ble/services/BatteryService.h +++ b/ble/services/BatteryService.h @@ -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: diff --git a/ble/services/HealthThermometerService.h b/ble/services/HealthThermometerService.h index 2afa1e5..53858e9 100644 --- a/ble/services/HealthThermometerService.h +++ b/ble/services/HealthThermometerService.h @@ -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(&loc), sizeof(uint8_t)); + ble.gattServer().write(tempLocation.getValueHandle(), reinterpret_cast(&loc), sizeof(uint8_t)); } private: diff --git a/ble/services/HeartRateService.h b/ble/services/HeartRateService.h index 606dc9f..14479c1 100644 --- a/ble/services/HeartRateService.h +++ b/ble/services/HeartRateService.h @@ -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()); } /** diff --git a/ble/services/UARTService.h b/ble/services/UARTService.h index 3ba367b..08b1e92 100644 --- a/ble/services/UARTService.h +++ b/ble/services/UARTService.h @@ -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(sendBuffer), sendBufferIndex); + ble.gattServer().write(getRXCharacteristicHandle(), static_cast(sendBuffer), sendBufferIndex); sendBufferIndex = 0; } } diff --git a/ble/services/URIBeaconConfigService.h b/ble/services/URIBeaconConfigService.h index 4ceaa05..81ef844 100644 --- a/ble/services/URIBeaconConfigService.h +++ b/ble/services/URIBeaconConfigService.h @@ -267,7 +267,7 @@ class URIBeaconConfigService { paramsUpdated = true; } if (paramsUpdated) { - ble.updateCharacteristicValue(beaconPeriodChar.getValueHandle(), reinterpret_cast(¶ms.beaconPeriod), sizeof(uint16_t)); + ble.gattServer().write(beaconPeriodChar.getValueHandle(), reinterpret_cast(¶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(¶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(params.advPowerLevels), sizeof(PowerLevels_t)); }