
A simple demo that directly uses BLE library to define service and characteristics
Dependencies: BLE_API mbed nRF51822
Fork of BLE_HeartRate by
Revision 27:97adf2b76b9c, committed 2014-07-03
- Comitter:
- Rohit Grover
- Date:
- Thu Jul 03 11:52:32 2014 +0100
- Parent:
- 26:e6ad33b227c6
- Child:
- 28:bdfc8cc53f0b
- Commit message:
- add 16-bit UUIDs to the advertising payload; this is cosmetic
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Jul 03 11:44:59 2014 +0100 +++ b/main.cpp Thu Jul 03 11:52:32 2014 +0100 @@ -53,6 +53,8 @@ GattCharacteristic *hrmChars[] = {&hrmRate, &hrmLocation, }; GattService hrmService(GattService::UUID_HEART_RATE_SERVICE, hrmChars, sizeof(hrmChars) / sizeof(GattCharacteristic *)); +static const uint16_t uuid16_list[] = {GattService::UUID_DEVICE_INFORMATION_SERVICE, GattService::UUID_HEART_RATE_SERVICE}; + void disconnectionCallback(void) { DEBUG("Disconnected!\n\r"); @@ -92,6 +94,7 @@ /* 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. */