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:
- 25:f3b44a34cf5d
- Parent:
- 24:7bd093ad7d63
- Child:
- 26:ab05e85743a9
diff -r 7bd093ad7d63 -r f3b44a34cf5d main.cpp
--- a/main.cpp Sat Dec 10 23:13:00 2016 +0000
+++ b/main.cpp Sat Dec 10 23:32:08 2016 +0000
@@ -40,10 +40,11 @@
void onDisconnect(Blob &blob) // Disconnection Callback
{
- BLE::Instance().gap().startAdvertising();
+ blob.start(); // start advertising
blinking("advertise");
}
+
void onError(Blob &blob) // Error Reporting Callback
{
(void) blob; // Avoid compiler warnings
@@ -62,9 +63,6 @@
blob.device(DEVICE_NAME); // setup device name
blob.disconnect(onDisconnect); // setup disconnect callback
- /* Optional: add callback for disconnection */
- //blob.pble->gap().onDisconnection(onDisconnect);
-
/* 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);
@@ -76,11 +74,12 @@
blob.pble->gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME));
/* Set advertising interval. Longer interval == longer battery life */
- blob.pble->gap().setAdvertisingInterval(100); /* 100ms */
+ //blob.pble->gap().setAdvertisingInterval(100); /* 100ms */
/* Start advertising */
- blob.pble->gap().startAdvertising();
+ //blob.pble->gap().startAdvertising();
+ blob.start(100); // start advertising with 100 msec interval
blinking("advertise");
}
