I've got some basic filter code setup (but not yet tested).

Dependencies:   BLE_API Queue mbed nRF51822

Fork of BLE_HeartRate by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
rgrover1
Date:
Tue Sep 02 16:17:18 2014 +0000
Parent:
40:e73130c6f2bb
Child:
42:06ebef2e0e44
Commit message:
updated underlying libraries

Changed in this revision

BLE_API.lib Show annotated file Show diff for this revision Revisions of this file
HeartRateService.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-src.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show diff for this revision Revisions of this file
nRF51822.lib Show annotated file Show diff for this revision Revisions of this file
--- a/BLE_API.lib	Fri Aug 22 15:04:49 2014 +0000
+++ b/BLE_API.lib	Tue Sep 02 16:17:18 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#189ff241dae1
+http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#ca826083980e
--- a/HeartRateService.h	Fri Aug 22 15:04:49 2014 +0000
+++ b/HeartRateService.h	Tue Sep 02 16:17:18 2014 +0000
@@ -25,13 +25,15 @@
 /* Location: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.body_sensor_location.xml */
 class HeartRateService {
 public:
-    static const unsigned BLE_HRS_BODY_SENSOR_LOCATION_OTHER    = 0;
-    static const unsigned BLE_HRS_BODY_SENSOR_LOCATION_CHEST    = 1;
-    static const unsigned BLE_HRS_BODY_SENSOR_LOCATION_WRIST    = 2;
-    static const unsigned BLE_HRS_BODY_SENSOR_LOCATION_FINGER   = 3;
-    static const unsigned BLE_HRS_BODY_SENSOR_LOCATION_HAND     = 4;
-    static const unsigned BLE_HRS_BODY_SENSOR_LOCATION_EAR_LOBE = 5;
-    static const unsigned BLE_HRS_BODY_SENSOR_LOCATION_FOOT     = 6;
+    enum {
+        LOCATION_OTHER = 0,
+        LOCATION_CHEST,
+        LOCATION_WRIST,
+        LOCATION_FINGER,
+        LOCATION_HAND,
+        LOCATION_EAR_LOBE,
+        LOCATION_FOOT,
+    };
 
 public:
     HeartRateService(BLEDevice &_ble, uint8_t _hrmCounter, uint8_t _location) :
@@ -57,7 +59,7 @@
     void updateHeartRate(uint8_t hrmCounter) {
         if (ble.getGapState().connected) {
             bpm.updateHeartRate(hrmCounter);
-            ble.updateCharacteristicValue(hrmRate.getHandle(), bpm.getPointer(), HeartRateValueBytes::SIZEOF_ARRAY);
+            ble.updateCharacteristicValue(hrmRate.getValueAttribute().getHandle(), bpm.getPointer(), HeartRateValueBytes::SIZEOF_ARRAY);
         }
     }
 
@@ -82,6 +84,7 @@
             return beatsPerMinute;
         }
 
+    private:
         /* First byte = 8-bit values, no extra info, Second byte = uint8_t HRM value */
         /* See --> https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml */
         uint8_t beatsPerMinute[SIZEOF_ARRAY];
--- a/main.cpp	Fri Aug 22 15:04:49 2014 +0000
+++ b/main.cpp	Tue Sep 02 16:17:18 2014 +0000
@@ -35,7 +35,7 @@
 static const uint16_t uuid16_list[]        = {GattService::UUID_HEART_RATE_SERVICE};
 static volatile bool  triggerSensorPolling = false;
 
-void disconnectionCallback(Gap::Handle_t handle)
+void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason)
 {
     DEBUG("Disconnected handle %u!\n\r", handle);
     DEBUG("Restarting the advertising process\n\r");
@@ -71,7 +71,7 @@
     ble.startAdvertising();
 
     uint8_t hrmCounter = 100;
-    HeartRateService hrService(ble, hrmCounter, HeartRateService::BLE_HRS_BODY_SENSOR_LOCATION_FINGER);
+    HeartRateService hrService(ble, hrmCounter, HeartRateService::LOCATION_FINGER);
 
     while (true) {
         if (triggerSensorPolling) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-src.lib	Tue Sep 02 16:17:18 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-src/#1f0269907d8b
--- a/mbed.bld	Fri Aug 22 15:04:49 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013
\ No newline at end of file
--- a/nRF51822.lib	Fri Aug 22 15:04:49 2014 +0000
+++ b/nRF51822.lib	Tue Sep 02 16:17:18 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/Nordic-Semiconductor/code/nRF51822/#1e5c300cec7f
+http://mbed.org/teams/Nordic-Semiconductor/code/nRF51822/#e861f2041469