A blue button is always a nice toy ...
Dependencies: BLE_API X_NUCLEO_IDB0XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
Diff: bricks/blob.h
- Revision:
- 24:0f08f68579bd
- Parent:
- 23:677689000369
- Child:
- 26:fd06c8b57d16
--- a/bricks/blob.h Fri Jan 06 15:28:18 2017 +0000 +++ b/bricks/blob.h Fri Jan 06 20:49:58 2017 +0000 @@ -4,7 +4,6 @@ #include "ble/BLE.h" #include "ble/Gap.h" -#include "bricks/service.h" #define ICCC BLE::InitializationCompleteCallbackContext // pure short hand #define GDCP Gap::DisconnectionCallbackParams_t // pure short hand @@ -40,7 +39,6 @@ // adding custom service - void config(Service &svc); // configure custom service void config(GattService &svc); // configure custom service // advertising flags @@ -51,7 +49,7 @@ void name(const char *str); // add name to device void start(void); // start advertising void start(int msec); // start advertising (msec: periode) - void advertise(cptr pmod,int ms=100);// advertise + void peripheral(cptr pmod,int ms=100);// advertise as a peripheral void copy(GattCharacteristic &dst); void get(GattCharacteristic &chr, Buffer &data); @@ -61,6 +59,32 @@ void onWritten(void (*fptr)(Blob&)); // setup data written callback }; +// Setup Advertising Name (syntactic sugar) + inline void name(Blob &o, const char *text) + { + o.name(text); // setup advertising name + } + +// Setup Device Name (syntactic sugar) + + inline void device(Blob &o, const char *text) + { + o.device(text); // setup device name + } +// Setup Advertising Data (syntactic sugar) + + inline void data(Blob &o, const char *text) + { + o.data(text); // setup advertising data + } + +// Start Advertising in Peripheral Mode + + inline void peripheral(Blob &o, const char *mode, int msec) + { + o.peripheral(mode,msec); // start advertising as a peripheral + } + #endif // _BLOB_H_ \ No newline at end of file