Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API X_NUCLEO_IDB0XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
Diff: main.cpp
- Revision:
- 26:ab05e85743a9
- Parent:
- 25:f3b44a34cf5d
- Child:
- 27:09ec26511db8
diff -r f3b44a34cf5d -r ab05e85743a9 main.cpp
--- a/main.cpp Sat Dec 10 23:32:08 2016 +0000
+++ b/main.cpp Sun Dec 11 00:16:31 2016 +0000
@@ -26,7 +26,7 @@
// Add a device name for human readability
- const static char DEVICE_NAME[] = "T05N_Advertising";
+ const static char DEVICE_NAME[] = "T05P_Advertising";
// You have up to 26 bytes of advertising data to use.
// Hex data example: {0x01,0x02,0x03,0x04,0x05}
@@ -60,26 +60,16 @@
return;
}
- blob.device(DEVICE_NAME); // setup device name
- blob.disconnect(onDisconnect); // setup disconnect callback
+ blob.device(DEVICE_NAME); // setup device name
+ blob.disconnect(onDisconnect); // setup disconnect callback
- /* Sacrifice 3B of 31B to Advertising Flags */
- blob.pble->gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE );
- blob.pble->gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
-
- /* Sacrifice 2B of 31B to AdvType overhead, rest goes to AdvData array you define */
- blob.pble->gap().accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, AdvData, sizeof(AdvData));
+ blob.discoverable();
+ blob.type("cu"); // connectable unidirected
- /* Optional: Add name to device */
- blob.pble->gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME));
+ blob.data(AdvData,sizeof(AdvData));
+ blob.name("Humbo"); // add name to device
- /* Set advertising interval. Longer interval == longer battery life */
- //blob.pble->gap().setAdvertisingInterval(100); /* 100ms */
-
- /* Start advertising */
- //blob.pble->gap().startAdvertising();
-
- blob.start(100); // start advertising with 100 msec interval
+ blob.start(100); // start advertising @ 100 msec interval
blinking("advertise");
}
@@ -88,7 +78,6 @@
{
Blob blob;
blinking(idle); // idle blinking - everything is OK!
- wait(5.0);
blob.init(onSetup); // init BLE base layer, always do first
blinking(advertise); // idle blinking - everything is OK!
