160801

Dependencies:   BLE_API mbed nRF51822

Fork of 151006_1st_Scenario_normal by ramo

Revision:
3:3f4aa38b0fb7
Parent:
1:c227f3064399
Child:
4:e80d411f87ae
diff -r ad8f5f00e490 -r 3f4aa38b0fb7 main.cpp
--- 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);