heart rate monitor

Dependencies:   BLE_API GroveEarbudSensor mbed nRF51822

Fork of BLE_HeartRate by Bluetooth Low Energy

Revision:
26:e6ad33b227c6
Parent:
22:299658c5fa3c
Child:
27:97adf2b76b9c
diff -r b3e91851d9e2 -r e6ad33b227c6 main.cpp
--- a/main.cpp	Thu Jun 26 14:11:57 2014 +0000
+++ b/main.cpp	Thu Jul 03 11:44:59 2014 +0100
@@ -30,6 +30,14 @@
 #define DEBUG(...) /* nothing */
 #endif /* #if NEED_CONSOLE_OUTPUT */
 
+/* Device Information service */
+const char         deviceName[] = { 'm', 'b', 'e', 'd' };
+GattCharacteristic deviceManufacturer(GattCharacteristic::UUID_MANUFACTURER_NAME_STRING_CHAR, (uint8_t *)deviceName, sizeof(deviceName), sizeof(deviceName),
+                                      GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ);
+GattCharacteristic *deviceInformationChars[] = {&deviceManufacturer};
+GattService        deviceInformationService(GattService::UUID_DEVICE_INFORMATION_SERVICE, deviceInformationChars,
+                                            sizeof(deviceInformationChars) / sizeof(GattCharacteristic *));
+
 /* Heart Rate Service */
 /* Service:  https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.heart_rate.xml */
 /* HRM Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml */
@@ -89,6 +97,7 @@
     ble.setAdvertisingInterval(160); /* 100ms; in multiples of 0.625ms. */
     ble.startAdvertising();
 
+    ble.addService(deviceInformationService);
     ble.addService(hrmService);
 
     while (true) {