ble example

Dependencies:   BLE_API mbed nRF51822

Fork of BLE_LEDBlinker by Bluetooth Low Energy

Revision:
5:3bbad34d1a85
Parent:
4:460ce53dc854
Child:
6:1730f66fb14d
--- a/main.cpp	Fri Jun 19 23:34:34 2015 +0000
+++ b/main.cpp	Sat Jun 20 23:36:10 2015 +0000
@@ -19,7 +19,7 @@
 #include "DiscoveredCharacteristic.h"
 #include "DiscoveredService.h"
 
-BLEDevice  ble;
+BLE        ble;
 DigitalOut alivenessLED(LED1, 1);
 
 bool triggerLedCharacteristic = false;
@@ -37,7 +37,7 @@
            params->peerAddr[5], params->peerAddr[4], params->peerAddr[3], params->peerAddr[2], params->peerAddr[1], params->peerAddr[0],
            params->rssi, params->isScanResponse, params->type);
 
-    ble.connect(params->peerAddr);
+    ble.gap().connect(params->peerAddr, Gap::ADDR_TYPE_RANDOM_STATIC, NULL, NULL);
 }
 
 void serviceDiscoveryCallback(const DiscoveredService *service) {
@@ -102,16 +102,16 @@
     ticker.attach(periodicCallback, 1);
 
     ble.init();
-    ble.onConnection(connectionCallback);
-    ble.onDisconnection(disconnectionCallback);
+    ble.gap().onConnection(connectionCallback);
+    ble.gap().onDisconnection(disconnectionCallback);
 
     /* Request for comments: should setupOnDataRead() be a static for DiscoveredCharacteristic?
      * Or should it be passed in as a parameter to read()? */
     DiscoveredCharacteristic::setupOnDataRead(triggerToggledWrite);
     DiscoveredCharacteristic::setupOnDataWrite(triggerRead);
 
-    ble.setScanParams(500, 400);
-    ble.startScan(advertisementCallback);
+    ble.gap().setScanParams(500, 400);
+    ble.gap().startScan(advertisementCallback);
 
     while (true) {
         if (triggerLedCharacteristic && !ble.gattClient().isServiceDiscoveryActive()) {