heart rate monitor

Dependencies:   BLE_API GroveEarbudSensor mbed nRF51822

Fork of BLE_HeartRate by Bluetooth Low Energy

Revision:
42:06ebef2e0e44
Parent:
41:9cef0129da5f
Child:
43:dbb025ed4a55
--- a/main.cpp	Tue Sep 02 16:17:18 2014 +0000
+++ b/main.cpp	Mon Sep 22 10:38:25 2014 +0000
@@ -17,6 +17,9 @@
 #include "mbed.h"
 #include "BLEDevice.h"
 #include "HeartRateService.h"
+#include "BatteryService.h"
+#include "DeviceInformationService.h"
+// #include "DFUService.h"
 
 BLEDevice  ble;
 DigitalOut led1(LED1);
@@ -32,7 +35,9 @@
 #endif /* #if NEED_CONSOLE_OUTPUT */
 
 const static char     DEVICE_NAME[]        = "Nordic_HRM";
-static const uint16_t uuid16_list[]        = {GattService::UUID_HEART_RATE_SERVICE};
+static const uint16_t uuid16_list[]        = {GattService::UUID_HEART_RATE_SERVICE,
+                                              GattService::UUID_BATTERY_SERVICE,
+                                              GattService::UUID_DEVICE_INFORMATION_SERVICE};
 static volatile bool  triggerSensorPolling = false;
 
 void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason)
@@ -64,7 +69,7 @@
     /* setup advertising */
     ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);
     ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list));
-    ble.accumulateAdvertisingPayload(GapAdvertisingData::HEART_RATE_SENSOR_HEART_RATE_BELT);
+    ble.accumulateAdvertisingPayload(GapAdvertisingData::GENERIC_HEART_RATE_SENSOR);
     ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME));
     ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
     ble.setAdvertisingInterval(1600); /* 1000ms; in multiples of 0.625ms. */
@@ -73,6 +78,10 @@
     uint8_t hrmCounter = 100;
     HeartRateService hrService(ble, hrmCounter, HeartRateService::LOCATION_FINGER);
 
+    BatteryService battery(ble);
+    DeviceInformationService deviceInfo(ble, "ARM");
+    // DFUService dfu(ble);
+
     while (true) {
         if (triggerSensorPolling) {
             triggerSensorPolling = false;