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
Revision 23:8315afc7bc95, committed 2017-02-19
- Comitter:
- fdalforno
- Date:
- Sun Feb 19 15:54:06 2017 +0000
- Parent:
- 22:3f0b2c0bf9f3
- Commit message:
- prova
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 3f0b2c0bf9f3 -r 8315afc7bc95 main.cpp --- a/main.cpp Tue Dec 27 09:48:25 2016 +0000 +++ b/main.cpp Sun Feb 19 15:54:06 2017 +0000 @@ -35,6 +35,12 @@ pc.printf("Periferica disconnessa \r\n"); } +void connectionCallback(const Gap::ConnectionCallbackParams_t *params){ + if(params->role == Gap::CENTRAL){ + pc.printf("Connesso dispositivo %u \r\n"); + } +} + void periodicCallback(void){ led1 = !led1; @@ -95,6 +101,7 @@ } ble.gap().onDisconnection(disconnectionCallback); + ble.gap().onConnection(connectionCallback); /*Quando mi arriva qualcosa dal client viene invocata questa funzione*/ ble.onDataWritten(onDataWritten); @@ -116,7 +123,7 @@ ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); /*Ogni quanto inviare un pacchetto di avviso*/ - ble.gap().setAdvertisingInterval(1000); /* 1000ms. */ + ble.gap().setAdvertisingInterval(100); /* 1000ms. */ /*Inizio a spedire i pacchetti*/ ble.gap().startAdvertising();