Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_LEDBlinker by
Revision 5:3bbad34d1a85, committed 2015-06-20
- Comitter:
- rgrover1
- Date:
- Sat Jun 20 23:36:10 2015 +0000
- Parent:
- 4:460ce53dc854
- Child:
- 6:1730f66fb14d
- Commit message:
- switch to newer APIs; rename BLEDevice to BLE
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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()) {
