Implementation of Heart Rate Service on nRF52-DK with security (bonding/pairing procedure). Correct key for smartphone to enter is printed on serial. Baud rate 9600, 8 bits + 1 stop bit + no parity bit.

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

Revision:
71:ef25b79853ee
Parent:
70:cae5b05ed2b9
--- a/source/main.cpp	Tue Oct 09 23:06:03 2018 +0000
+++ b/source/main.cpp	Wed Oct 10 01:15:42 2018 +0000
@@ -26,7 +26,7 @@
 static const uint16_t uuid16_list[] = {GattService::UUID_HEART_RATE_SERVICE};
 static uint16_t rriValues[100] = {880,860,860,860,870,880,890,910,920,930,940,940,950,940,950,940,950,950,950,950,530,1350,950,930,910,920,940,940,950,940,950,940,930,940,950,950,950,960,960,960,950,960,950,960,950,960,960,950,960,960,950,950,940,950,950,940,930,930,920,920,910,920,910,900,670,1130,910,880,880,870,660,1100,890,880,880,880,660,1110,910,890,900,900,690,1110,910,900,910,900,900,910,930,920,940,940,940,950,960,950,950,960};
 static uint16_t counter = 0;
-static uint8_t hrmCounter = 800; // init
+static uint16_t hrmCounter = 800; // init
 
 static HeartRateService *hrServicePtr;
 
@@ -119,7 +119,7 @@
     ble.gap().onConnection(connectionCallback);
 
     /* Setup primary service. */
-    hrServicePtr = new HeartRateService(ble, hrmCounter, HeartRateService::LOCATION_FINGER);
+    hrServicePtr = new HeartRateService(ble, hrmCounter, HeartRateService::LOCATION_CHEST);
 
     /* Initialize BLE security */
     bool enableBonding = true;