prova

Fork of BLE_API by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
andreasortino
Date:
Thu Sep 28 13:22:57 2017 +0000
Parent:
1208:65474dc93927
Commit message:
ertrfgnbc

Changed in this revision

ble/GattCharacteristic.h Show annotated file Show diff for this revision Revisions of this file
ble/GattService.h Show annotated file Show diff for this revision Revisions of this file
ble/services/HeartRateService.h Show annotated file Show diff for this revision Revisions of this file
--- a/ble/GattCharacteristic.h	Wed Sep 14 14:18:00 2016 +0100
+++ b/ble/GattCharacteristic.h	Thu Sep 28 13:22:57 2017 +0000
@@ -26,6 +26,7 @@
 class GattCharacteristic {
 public:
     enum {
+                        
         UUID_BATTERY_LEVEL_STATE_CHAR                     = 0x2A1B,
         UUID_BATTERY_POWER_STATE_CHAR                     = 0x2A1A,
         UUID_REMOVABLE_CHAR                               = 0x2A3A,
@@ -54,7 +55,8 @@
         UUID_GLUCOSE_MEASUREMENT_CONTEXT_CHAR             = 0x2A34,
         UUID_HARDWARE_REVISION_STRING_CHAR                = 0x2A27,
         UUID_HEART_RATE_CONTROL_POINT_CHAR                = 0x2A39,
-        UUID_HEART_RATE_MEASUREMENT_CHAR                  = 0x2A37,
+        UUID_HEART_RATE_MEASUREMENT_CHAR                  = 0x2A37,     //Originale
+       
         UUID_HID_CONTROL_POINT_CHAR                       = 0x2A4C,
         UUID_HID_INFORMATION_CHAR                         = 0x2A4A,
         UUID_HUMIDITY_CHAR                                = 0x2A6F,
--- a/ble/GattService.h	Wed Sep 14 14:18:00 2016 +0100
+++ b/ble/GattService.h	Thu Sep 28 13:22:57 2017 +0000
@@ -23,6 +23,7 @@
 class GattService {
 public:
     enum {
+        
         UUID_ALERT_NOTIFICATION_SERVICE     = 0x1811,
         UUID_BATTERY_SERVICE                = 0x180F,
         UUID_BLOOD_PRESSURE_SERVICE         = 0x1810,
@@ -32,7 +33,8 @@
         UUID_ENVIRONMENTAL_SERVICE          = 0x181A,
         UUID_GLUCOSE_SERVICE                = 0x1808,
         UUID_HEALTH_THERMOMETER_SERVICE     = 0x1809,
-        UUID_HEART_RATE_SERVICE             = 0x180D,
+        UUID_HEART_RATE_SERVICE             = 0x180D,         //Originale
+        
         UUID_HUMAN_INTERFACE_DEVICE_SERVICE = 0x1812,
         UUID_IMMEDIATE_ALERT_SERVICE        = 0x1802,
         UUID_LINK_LOSS_SERVICE              = 0x1803,
--- a/ble/services/HeartRateService.h	Wed Sep 14 14:18:00 2016 +0100
+++ b/ble/services/HeartRateService.h	Thu Sep 28 13:22:57 2017 +0000
@@ -52,18 +52,52 @@
      *               Initial value for the HRM counter.
      * @param[in] location
      *               Sensor's location.
+    ************************************************************************************************************************************************
+    *                                                   ORIGINALE
+    ***********************************************************************************************************************************************************
+     
      */
     HeartRateService(BLE &_ble, uint8_t hrmCounter, uint8_t location) :
         ble(_ble),
         valueBytes(hrmCounter),
-        hrmRate(GattCharacteristic::UUID_HEART_RATE_MEASUREMENT_CHAR, valueBytes.getPointer(),
+        hrmRate(GattCharacteristic:: UUID_HEART_RATE_MEASUREMENT_CHAR  , valueBytes.getPointer(),
                 valueBytes.getNumValueBytes(), HeartRateValueBytes::MAX_VALUE_BYTES,
                 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
         hrmLocation(GattCharacteristic::UUID_BODY_SENSOR_LOCATION_CHAR, &location),
         controlPoint(GattCharacteristic::UUID_HEART_RATE_CONTROL_POINT_CHAR, &controlPointValue) {
         setupService();
     }
+    /*
+***************************************************************************************************************************************************************************
+                                                        mODIFICATO
 
+***************************************************************************************************************************************************************************
+                    8-bit 
+*/ /*
+HeartRateService(BLE &_ble, uint8_t hrmCounter, uint8_t location) :
+        ble(_ble),
+        valueBytes(hrmCounter),
+        hrmRate(GattCharacteristic:: UUID_TEMPERATURE_MEASUREMENT_CHAR  , valueBytes.getPointer(),
+                valueBytes.getNumValueBytes(), HeartRateValueBytes::MAX_VALUE_BYTES,
+                GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
+        hrmLocation(GattCharacteristic::UUID_BODY_SENSOR_LOCATION_CHAR, &location),
+        controlPoint(GattCharacteristic::UUID_TEMPERATURE_CHAR , &controlPointValue) {
+        setupService();
+
+}
+//                      16-bit 
+
+
+HeartRateService(BLE &_ble, uint16_t hrmCounter, uint8_t location) :
+        ble(_ble),
+        valueBytes(hrmCounter),
+        hrmRate(GattCharacteristic::UUID_TEMPERATURE_MEASUREMENT_CHAR, valueBytes.getPointer(),
+                valueBytes.getNumValueBytes(), HeartRateValueBytes::MAX_VALUE_BYTES,
+                GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
+        hrmLocation(GattCharacteristic::UUID_BODY_SENSOR_LOCATION_CHAR, &location),
+        controlPoint(GattCharacteristic::UUID_TEMPERATURE_CHAR, &controlPointValue) {
+        setupService();
+    }*/
     /**
      * @brief Constructor with a 16-bit HRM Counter value.
      *
@@ -73,8 +107,17 @@
      *               Initial value for the HRM counter.
      * @param[in] location
      *               Sensor's location.
+     ***************************************************************************************************************************************************************************
+     ***************************************************************************************************************************************************************************
+     ***************************************************************************************************************************************************************************
+     SOTTO IL 16 BIT DISABILITATO
+     
+     ***************************************************************************************************************************************************************************
+     ***************************************************************************************************************************************************************************
      */
-    HeartRateService(BLE &_ble, uint16_t hrmCounter, uint8_t location) :
+     
+     
+ HeartRateService(BLE &_ble, uint16_t hrmCounter, uint8_t location) :
         ble(_ble),
         valueBytes(hrmCounter),
         hrmRate(GattCharacteristic::UUID_HEART_RATE_MEASUREMENT_CHAR, valueBytes.getPointer(),
@@ -128,7 +171,9 @@
 protected:
     void setupService(void) {
         GattCharacteristic *charTable[] = {&hrmRate, &hrmLocation, &controlPoint};
-        GattService         hrmService(GattService::UUID_HEART_RATE_SERVICE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
+        //GattService         hrmService(GattService::UUID_HEALTH_THERMOMETER_SERVICE  , charTable, sizeof(charTable) / sizeof(GattCharacteristic *));       //Modificato
+
+        GattService         hrmService(GattService::UUID_HEART_RATE_SERVICE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));                //ORIGILAE
 
         ble.addService(hrmService);
         ble.onDataWritten(this, &HeartRateService::onDataWritten);