1154

Dependencies:   BLE_API Peripheral_1 mbed nRF51822

Fork of Peripheral_1_serial by -deleted-

Files at this revision

API Documentation at this revision

Comitter:
ssenwkdw
Date:
Thu Oct 01 17:33:32 2015 +0000
Parent:
2:ad8f5f00e490
Commit message:
aa

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Oct 01 17:10:50 2015 +0000
+++ b/main.cpp	Thu Oct 01 17:33:32 2015 +0000
@@ -288,8 +288,8 @@
     ble.init();
     ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_SCANNABLE_UNDIRECTED);
     ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);
-    ble.accumulateAdvertisingPayload(GapAdvertisingData::RABOT_REDBEAR_BLE_NANO, (uint8_t *)secure_code, sizeof(secure_code));
-    ble.setAdvertisingType(GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED);
+    ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::RABOT_REDBEAR_BLE_NANO, (uint8_t *)secure_code, sizeof(secure_code));
+    ble.setAdvertisingType(GapAdvertisingParams::ADV_SCANNABLE_UNDIRECTED);
     ble.gap().setAdvertisingInterval(32);
     ble.gap().startAdvertising();
     
@@ -320,14 +320,14 @@
     //advertising for real experiment
     printf("communication for connection is started\r\n");
 
-    ble.onConnection(connectionCallback);
-    ble.onDisconnection(disconnectionCallback);
+    ble.gap().onConnection(connectionCallback);
+    ble.gap().onDisconnection(disconnectionCallback);
 
     ble.gattClient().onDataRead(triggerToggledWrite);
     ble.gattClient().onDataWrite(onDataWriteCallback);
     ble.gattServer().onDataWritten(onDataWrittenCallback);
     ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
-    ble.accumulateAdvertisingPayload(GapAdvertisingData::RABOT_REDBEAR_BLE_NANO, (uint8_t *)secure_code, sizeof(secure_code));
+    ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::RABOT_REDBEAR_BLE_NANO, (uint8_t *)secure_code, sizeof(secure_code));
     ble.gap().setAdvertisingInterval(29);
 
     ble.addService(customService);