Heart Rate Monitor example for the BLE API using nRF51822 native mode drivers

Dependencies:   BLE_API mbed nRF51822 X_NUCLEO_IDB0XA1

Fork of BLE_HeartRate by Bluetooth Low Energy

Revision:
16:f3361e20642d
Parent:
15:7ba28817e31e
Child:
17:583b765af55f
diff -r 7ba28817e31e -r f3361e20642d main.cpp
--- a/main.cpp	Tue Jun 10 14:40:29 2014 +0100
+++ b/main.cpp	Wed Jun 11 09:06:14 2014 +0100
@@ -36,33 +36,22 @@
 uint8_t            batt      = 72; /* Battery level */
 uint8_t            read_batt = 0;  /* Variable to hold battery level reads */
 GattService        battService (GattService::UUID_BATTERY_SERVICE);
-GattCharacteristic battLevel   (GattCharacteristic::UUID_BATTERY_LEVEL_CHAR,
-                                1, /* initialLen */
-                                1, /* maxLen */
+GattCharacteristic battLevel   (GattCharacteristic::UUID_BATTERY_LEVEL_CHAR, 1, 1,
                                 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ);
 
 /* 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 */
 /* Location: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.body_sensor_location.xml */
-GattService        hrmService    (GattService::UUID_HEART_RATE_SERVICE);
-GattCharacteristic hrmRate       (GattCharacteristic::UUID_HEART_RATE_MEASUREMENT_CHAR,
-                                  2, /* initialLen */
-                                  3, /* maxLen */
-                                  GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY);
-GattCharacteristic hrmLocation   (GattCharacteristic::UUID_BODY_SENSOR_LOCATION_CHAR,
-                                  1, /* initialLen */
-                                  1, /* maxLen */
-                                  GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ);
+GattService        hrmService(GattService::UUID_HEART_RATE_SERVICE);
+GattCharacteristic hrmRate(GattCharacteristic::UUID_HEART_RATE_MEASUREMENT_CHAR, 2, 3, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY);
+GattCharacteristic hrmLocation(GattCharacteristic::UUID_BODY_SENSOR_LOCATION_CHAR, 1, 1, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ);
 
 /* Device Information service */
 static const uint8_t deviceName[] = {'m', 'b', 'e', 'd'};
 GattService        deviceInformationService (GattService::UUID_DEVICE_INFORMATION_SERVICE);
-GattCharacteristic deviceManufacturer (
-    GattCharacteristic::UUID_MANUFACTURER_NAME_STRING_CHAR,
-    sizeof(deviceName), /* initialLen */
-    sizeof(deviceName), /* maxLen */
-    GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ);
+GattCharacteristic deviceManufacturer (GattCharacteristic::UUID_MANUFACTURER_NAME_STRING_CHAR,
+                                       sizeof(deviceName), sizeof(deviceName), GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ);
 
 static const uint16_t uuid16_list[] = {
     GattService::UUID_BATTERY_SERVICE,