士鈞 林 / Mbed OS 12_1

Dependencies:   X_NUCLEO_IKS01A2

Revision:
1:b12ac7b02a21
Parent:
0:9c0e0ac79e75
--- a/source/ESS2.h	Wed Apr 29 10:42:44 2020 +0000
+++ b/source/ESS2.h	Wed Apr 29 16:18:37 2020 +0000
@@ -9,7 +9,7 @@
 #ifndef __BLE_ENVIRONMENTAL_SENSING_SERVICE2_H__
 #define __BLE_ENVIRONMENTAL_SENSING_SERVICE2_H__
 
-#include "mbed.h"
+#include <mbed.h>
 #include "blecommon.h"
 #include "Gap.h"
 #include "GattServer.h"
@@ -55,17 +55,17 @@
 
                 GattService      EnvironmentalService(0x181A, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
 
-        ble.addService(EnvironmentalService);
+        ble.gattServer().addService(EnvironmentalService);
     }
 
 
         /* Set a new 16-bit value for the wind direction measurement.  */
     void updateWinddirection(uint16_t winddirection) {
-        ble.updateCharacteristicValue(winddirectionchar.getValueAttribute().getHandle(), (uint8_t *)&winddirection, sizeof(uint16_t));
+        ble.gattServer().write(winddirectionchar.getValueAttribute().getHandle(), (uint8_t *)&winddirection, sizeof(uint16_t));
     }       
     /* Set a new 32-bit value for the pressure measurement.  */
     void updatePressure(uint32_t pressure) {
-        ble.updateCharacteristicValue(pressurechar.getValueAttribute().getHandle(), (uint8_t *)&pressure, sizeof(uint32_t));
+        ble.gattServer().write(pressurechar.getValueAttribute().getHandle(), (uint8_t *)&pressure, sizeof(uint32_t));
     }