仕倫 林 / Mbed OS 12_1

Dependencies:   X_NUCLEO_IKS01A2

Revision:
1:b12ac7b02a21
Parent:
0:9c0e0ac79e75
Child:
2:5da515ba10ff
--- a/source/ESS.h	Wed Apr 29 10:42:44 2020 +0000
+++ b/source/ESS.h	Wed Apr 29 16:18:37 2020 +0000
@@ -9,7 +9,7 @@
 #ifndef __BLE_ENVIRONMENTAL_SENSING_SERVICE_H__
 #define __BLE_ENVIRONMENTAL_SENSING_SERVICE_H__
 
-#include "mbed.h"
+#include <mbed.h>
 #include "blecommon.h"
 #include "Gap.h"
 #include "GattServer.h"
@@ -53,18 +53,18 @@
 
                 GattService      EnvironmentalService(0x181A, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
 
-        ble.addService(EnvironmentalService);
+        ble.gattServer().addService(EnvironmentalService);
     }
 
 
     /* Set a new 16-bit value for the humidity measurement.  */
     void updateHumidity(uint16_t humidity) {
-        ble.updateCharacteristicValue(humiditychar.getValueAttribute().getHandle(), (uint8_t *)&humidity, sizeof(uint16_t));
+        ble.gattServer().write(humiditychar.getValueAttribute().getHandle(), (uint8_t *)&humidity, sizeof(uint16_t));
     }
 
                  /* Set a new 16-bit value for the temperature measurement.  */
     void updateTemperature(int16_t temperature) {
-        ble.updateCharacteristicValue(temperaturechar.getValueAttribute().getHandle(), (uint8_t *)&temperature, sizeof(int16_t));
+        ble.gattServer().write(temperaturechar.getValueAttribute().getHandle(), (uint8_t *)&temperature, sizeof(int16_t));
     }