changed name

Fork of mbed-os-example-ble-BatteryLevel by mbed-os-examples

Revision:
74:923be844d0fe
Parent:
73:4bce85f91e5a
Child:
75:fc7f3b141378
--- a/source/main.cpp	Wed Oct 24 09:44:30 2018 +0000
+++ b/source/main.cpp	Wed Oct 24 13:28:56 2018 +0000
@@ -19,14 +19,16 @@
 #include "ble/BLE.h"
 #include "ble/Gap.h"
 #include "ble/services/BatteryService.h"
+#include "ble/services/HeartRateService.h"
 
 DigitalOut led1(LED1, 1);
 
 const static char     DEVICE_NAME[] = "ProVaida";
-static const uint16_t uuid16_list[] = {GattService::UUID_BATTERY_SERVICE};
+static const uint16_t uuid16_list[] = {GattService::UUID_HEART_RATE_SERVICE};
+//static const uint16_t uuid16_list[] = {GattService::UUID_BATTERY_SERVICE};
 
-static uint8_t batteryLevel = 50;
-static BatteryService* batteryServicePtr;
+uint8_t hrmCounter = 100;
+static HeartRateService* hrService;
 
 static EventQueue eventQueue(/* event count */ 16 * EVENTS_EVENT_SIZE);
 
@@ -36,12 +38,12 @@
 }
 
 void updateSensorValue() {
-    batteryLevel++;
-    if (batteryLevel > 100) {
-        batteryLevel = 20;
+    hrmCounter++;
+    if (hrmCounter > 175) {
+        hrmCounter = 100;
     }
-
-    batteryServicePtr->updateBatteryLevel(batteryLevel);
+    hrService->updateHeartRate(hrmCounter);
+    //batteryServicePtr->updateBatteryLevel(batteryLevel);
 }
 
 void blinkCallback(void)
@@ -55,7 +57,7 @@
 }
 
 /**
- * This function is called when the ble initialization process has failled
+ * This function is called when the ble initialization process has failed
  */
 void onBleInitError(BLE &ble, ble_error_t error)
 {
@@ -97,7 +99,7 @@
     ble.gap().onDisconnection(disconnectionCallback);
 
     /* Setup primary service */
-    batteryServicePtr = new BatteryService(ble, batteryLevel);
+    hrService = new HeartBeatService(ble, hrmCounter);
 
     /* Setup advertising */
     ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);