Nordic nRF51 basic device information, battery

Dependencies:   BLE_API mbed nRF51822

Fork of BLE_Basic by Mika Karaila

Files at this revision

API Documentation at this revision

Comitter:
MetaMika
Date:
Mon Jun 08 07:49:27 2015 +0000
Parent:
0:aa97837202d2
Child:
2:8f2c349db7dd
Commit message:
Updated to latest libraries, compiles now.

Changed in this revision

BLE_API.lib 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.bld Show annotated file 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	Wed Jul 02 10:15:02 2014 +0000
+++ b/BLE_API.lib	Mon Jun 08 07:49:27 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#6f4c8e545d38
+http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#ca6b956b33d1
--- a/main.cpp	Wed Jul 02 10:15:02 2014 +0000
+++ b/main.cpp	Mon Jun 08 07:49:27 2015 +0000
@@ -98,10 +98,10 @@
 GattCharacteristic *batteryChars[] = {&batteryPercentage };
 GattService         batteryService(GattService::UUID_BATTERY_SERVICE, batteryChars, sizeof(batteryChars) / sizeof(GattCharacteristic *));
 
-void disconnectionCallback(void)
+void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason)
 {
-    DEBUG("Disconnected!\n\r");
-    DEBUG("Restarting the advertising process\n\r");
+    printf("Disconnected handle %u!\n\r", handle);
+    printf("Restarting the advertising process\n\r");
     ble.startAdvertising();
 }
 
@@ -118,14 +118,14 @@
         if (batteryLevel == 1) {
             batteryLevel = 100;
         }
-        ble.updateCharacteristicValue(batteryPercentage.getHandle(), &batteryLevel, sizeof(batteryLevel));
+        ble.updateCharacteristicValue(batteryPercentage.getValueAttribute().getHandle(), &batteryLevel, sizeof(batteryLevel));
         
         /* Update the temperature measurement */
         temperature++;
         if (temperature == 50) {
             temperature = 10;
         }
-        ble.updateCharacteristicValue(tempMeas.getHandle(), &temperature, sizeof(temperature));
+        ble.updateCharacteristicValue(tempMeas.getValueAttribute().getHandle(), &temperature, sizeof(temperature));
     }
 }
 
--- a/mbed.bld	Wed Jul 02 10:15:02 2014 +0000
+++ b/mbed.bld	Mon Jun 08 07:49:27 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/024bf7f99721
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/cbbeb26dbd92
\ No newline at end of file
--- a/nRF51822.lib	Wed Jul 02 10:15:02 2014 +0000
+++ b/nRF51822.lib	Mon Jun 08 07:49:27 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/Nordic-Semiconductor/code/nRF51822/#7174913c9d67
+http://mbed.org/teams/Nordic-Semiconductor/code/nRF51822/#3b34428e80ea