fork BLE_API to add update adv payload API

Fork of BLE_API by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
rgrover1
Date:
Thu Jul 02 09:06:12 2015 +0100
Parent:
721:8f92a1a943d6
Child:
723:71507679c9b2
Commit message:
Synchronized with git rev b633e90c
Author: Rohit Grover
replace use of updateCharacteristicValue() with ble.gattServer().write()

Changed in this revision

ble/services/BatteryService.h Show annotated file Show diff for this revision Revisions of this file
ble/services/HealthThermometerService.h Show annotated file Show diff for this revision Revisions of this file
ble/services/HeartRateService.h Show annotated file Show diff for this revision Revisions of this file
ble/services/UARTService.h Show annotated file Show diff for this revision Revisions of this file
ble/services/URIBeaconConfigService.h Show annotated file Show diff for this revision Revisions of this file
--- a/ble/services/BatteryService.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/services/BatteryService.h	Thu Jul 02 09:06:12 2015 +0100
@@ -53,7 +53,7 @@
      */
     void updateBatteryLevel(uint8_t newLevel) {
         batteryLevel = newLevel;
-        ble.updateCharacteristicValue(batteryLevelCharacteristic.getValueAttribute().getHandle(), &batteryLevel, 1);
+        ble.gattServer().write(batteryLevelCharacteristic.getValueHandle(), &batteryLevel, 1);
     }
 
 protected:
--- a/ble/services/HealthThermometerService.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/services/HealthThermometerService.h	Thu Jul 02 09:06:12 2015 +0100
@@ -73,7 +73,7 @@
     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 @@
      *        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:
--- a/ble/services/HeartRateService.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/services/HeartRateService.h	Thu Jul 02 09:06:12 2015 +0100
@@ -93,7 +93,7 @@
      */
     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 @@
      */
     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());
     }
 
     /**
--- a/ble/services/UARTService.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/services/UARTService.h	Thu Jul 02 09:06:12 2015 +0100
@@ -117,7 +117,7 @@
                 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;
                 }
             }
--- a/ble/services/URIBeaconConfigService.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/services/URIBeaconConfigService.h	Thu Jul 02 09:06:12 2015 +0100
@@ -267,7 +267,7 @@
                     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 @@
      * 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));
     }