
A simple demo that directly uses BLE library to define service and characteristics
Dependencies: BLE_API mbed nRF51822
Fork of BLE_HeartRate by
Revision 15:7ba28817e31e, committed 2014-06-10
- Comitter:
- Rohit Grover
- Date:
- Tue Jun 10 14:40:29 2014 +0100
- Parent:
- 14:de84386d179a
- Child:
- 16:f3361e20642d
- Commit message:
- move ble_init() to the beginning of main()
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Jun 10 14:37:18 2014 +0100 +++ b/main.cpp Tue Jun 10 14:40:29 2014 +0100 @@ -138,6 +138,9 @@ Ticker ticker; ticker.attach(periodicCallback, 1); + DEBUG("Initialising the nRF51822\n\r"); + ble.init(); + /* Setup the local GAP/GATT event handlers */ ble.onTimeout(timeoutCallback); ble.onConnection(connectionCallback); @@ -145,13 +148,10 @@ ble.onUpdatesEnabled(updatesEnabledCallback); ble.onUpdatesDisabled(updatesDisabledCallback); - DEBUG("Initialising the nRF51822\n\r"); - ble.init(); - + /* setup advertising */ ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED); ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list)); ble.accumulateAdvertisingPayload(GapAdvertisingData::HEART_RATE_SENSOR_HEART_RATE_BELT); - ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); ble.setAdvertisingInterval(160); /* 100ms; in multiples of 0.625ms. */ ble.startAdvertising();