This is an extremely simple consumer of the BLEDevice API. The aim is to demonstrate the smallest program that is sensibly detected on a device. Be careful with the name! iOS caches device names, and so you can't necessarily guarantee how long you'll be stuck with the first one you choose first time iOS sees your board.
Dependencies: BLE_API mbed nRF51822
Diff: main.cpp
- Revision:
- 1:db5fcf988f53
- Parent:
- 0:e2b2b6bdb2dc
--- a/main.cpp Wed Jan 28 00:50:59 2015 +0000 +++ b/main.cpp Wed Jan 28 01:01:47 2015 +0000 @@ -25,9 +25,13 @@ { ble.init(); - /* Setup advertising. */ + /* Setup the data to go into the advertising packets. */ ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME)); + + /* The default advertising period is a little low - increase it */ + ble.setAdvertisingInterval(Gap::MSEC_TO_ADVERTISEMENT_DURATION_UNITS(1000)); + ble.startAdvertising(); while (true) {