Example of BLE scan/connect/service discovery
Fork of BLE_LEDBlinker by
Revision 4:460ce53dc854, committed 2015-06-19
- Comitter:
- rgrover1
- Date:
- Fri Jun 19 23:34:34 2015 +0000
- Parent:
- 3:146eba831693
- Child:
- 5:3bbad34d1a85
- Commit message:
- updating to the latest of BLE_API and nRF51822 (which now contains support for Gatt Client).
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BLE_API.lib Fri Jun 19 23:34:34 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#b04b5db36865
--- 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jun 19 23:34:34 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7cff1c4259d7 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nRF51822.lib Fri Jun 19 23:34:34 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/teams/Nordic-Semiconductor/code/nRF51822/#7c68c8d67e1f
