Example of BLE scan/connect/service discovery
Fork of BLE_LEDBlinker by
Diff: main.cpp
- Revision:
- 4:460ce53dc854
- Parent:
- 3:146eba831693
- Child:
- 5:3bbad34d1a85
--- a/main.cpp Mon Jun 08 06:37:03 2015 +0000
+++ b/main.cpp Fri Jun 19 23:34:34 2015 +0000
@@ -15,7 +15,7 @@
*/
#include "mbed.h"
-#include "BLEDevice.h"
+#include "BLE.h"
#include "DiscoveredCharacteristic.h"
#include "DiscoveredService.h"
@@ -67,8 +67,8 @@
void connectionCallback(const Gap::ConnectionCallbackParams_t *params) {
if (params->role == Gap::CENTRAL) {
- ble.onServiceDiscoveryTermination(discoveryTerminationCallback);
- ble.launchServiceDiscovery(params->handle, serviceDiscoveryCallback, characteristicDiscoveryCallback, 0xa000, 0xa001);
+ ble.gattClient().onServiceDiscoveryTermination(discoveryTerminationCallback);
+ ble.gattClient().launchServiceDiscovery(params->handle, serviceDiscoveryCallback, characteristicDiscoveryCallback, 0xa000, 0xa001);
}
}
@@ -114,7 +114,7 @@
ble.startScan(advertisementCallback);
while (true) {
- if (triggerLedCharacteristic && !ble.isServiceDiscoveryActive()) {
+ if (triggerLedCharacteristic && !ble.gattClient().isServiceDiscoveryActive()) {
triggerLedCharacteristic = false;
ledCharacteristic.read(); /* We could have issued this read just as easily from
* characteristicDiscoveryCallback(); but
