A simple demo around security APIs. Submitted by Xiao Sun.

Dependencies:   BLE_API mbed nRF51822

Fork of BLE_HeartRate_AddSec by xiao sun

Revision:
5:ed2cb43f3589
Parent:
3:b852bf8d6fad
Child:
6:715150f7f293
--- a/HeartRateSecService.h	Mon Jun 08 10:08:09 2015 +0000
+++ b/HeartRateSecService.h	Fri Jun 19 23:57:59 2015 +0000
@@ -17,7 +17,7 @@
 #ifndef __BLE_HEART_RATE_SEC_SAMPLE_SERVICE_H__
 #define __BLE_HEART_RATE_SEC_SAMPLE_SERVICE_H__
 
-#include "BLEDevice.h"
+#include "BLE.h"
 
 /**
 * @class HeartRateSecService
@@ -114,8 +114,8 @@
      * @param[in] params
      *     Information about the characterisitc being updated.
      */
-    virtual void onDataWritten(const GattCharacteristicWriteCBParams *params) {
-        if (params->charHandle == controlPoint.getValueAttribute().getHandle()) {
+    virtual void onDataWritten(const GattWriteCallbackParams *params) {
+        if (params->handle == controlPoint.getValueAttribute().getHandle()) {
             /* Do something here if the new value is 1; else you can override this method by
              * extending this class.
              * @NOTE: if you are extending this class, be sure to also call
@@ -132,7 +132,7 @@
             return;
         }
         
-        hrmRate.requireSecurity(Gap::SECURITY_MODE_ENCRYPTION_WITH_MITM);
+        hrmRate.requireSecurity(SecurityManager::SECURITY_MODE_ENCRYPTION_WITH_MITM);
 
         GattCharacteristic *charTable[] = {&hrmRate, &hrmLocation, &controlPoint};
         GattService         hrmService(GattService::UUID_HEART_RATE_SERVICE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));