![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Bluetooth Connected TOF Sensor
Dependencies: BLE_API X_NUCLEO_6180XA1 X_NUCLEO_IDB0XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
main.cpp
- Committer:
- hux
- Date:
- 2017-01-07
- Revision:
- 26:fd06c8b57d16
- Parent:
- 25:231d3f382583
- Child:
- 27:32267cee7cb8
File content as of revision 26:fd06c8b57d16:
// T07N_Easy_GATT - Easy GATT setup using bricks #include "bricks/bricks.h" #include "easy.h" //============================================================================== // Callbacks //============================================================================== void onError(Blob &o) // Error Reporting Callback { (void) o; // Avoid compiler warnings blink(FAULT); // indicate advertising } void onConnect(Blob &blue) // Connection Callback { blink("x x x ",CONNECTED); // indicate advertising } void onDisconnect(Blob &blue) // Disconnection Callback { blue.start(); // start advertising on client disconnect blink(ADVERTISE); // indicate advertising } void onSetup(Blob &o) // Immediately After Initializing BLE { easy(o); // enroll EASY services & setup callbacks o.onConnect(onConnect); // setup connection callback o.onDisconnect(onDisconnect); // setup disconnection callback device(o,"Easy"); // setup device name data(o,"ABCDEF"); // setup advertising data name(o,"T07N#2.4 Easy GATT"); // setup advertising name peripheral(o,"C:ng",100); // start advertising @ 100 msec interval blink(ADVERTISE); // show that board is advertising } //============================================================================== // Main Program //============================================================================== int main(void) { verbose(); // print all verbose messages blink(IDLE); // idle blinking - just started! Blob blue; // declare a blob (BLE OBject) blue.init(onSetup,onError); // init BLE base layer, always do first while (true) // Infinite loop waiting for BLE events blue.sleep(); // low power waiting for BLE events }