A blue button is always a nice toy ...
Dependencies: BLE_API X_NUCLEO_IDB0XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
bricks/updated.h@29:a6b74dfdd5f2, 2017-10-01 (annotated)
- Committer:
- hux
- Date:
- Sun Oct 01 12:49:25 2017 +0000
- Revision:
- 29:a6b74dfdd5f2
- Parent:
- 24:0f08f68579bd
A blue button is always a nice toy ...
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hux | 24:0f08f68579bd | 1 | // updated.h - check whether a characteristic has been updated |
hux | 24:0f08f68579bd | 2 | // note: can only used within 'onWritten' callback |
hux | 24:0f08f68579bd | 3 | // |
hux | 24:0f08f68579bd | 4 | // Synopsis: |
hux | 24:0f08f68579bd | 5 | // |
hux | 24:0f08f68579bd | 6 | // See also: CHARACTERISTIC, GET, SET, ONWRITTEN |
hux | 24:0f08f68579bd | 7 | // |
hux | 24:0f08f68579bd | 8 | #ifndef _UPDATED_H_ |
hux | 24:0f08f68579bd | 9 | #define _UPDATED_H_ |
hux | 24:0f08f68579bd | 10 | |
hux | 24:0f08f68579bd | 11 | #include "ble/Gap.h" |
hux | 24:0f08f68579bd | 12 | #include "bricks/blob.h" |
hux | 24:0f08f68579bd | 13 | |
hux | 24:0f08f68579bd | 14 | inline int updated(Blob &o,GattCharacteristic &chr) // has char. been updated? |
hux | 24:0f08f68579bd | 15 | { |
hux | 24:0f08f68579bd | 16 | const GattWriteCallbackParams *p = o.pWritten; |
hux | 24:0f08f68579bd | 17 | if (!p) |
hux | 24:0f08f68579bd | 18 | return 0; // no update! |
hux | 24:0f08f68579bd | 19 | else if(p->handle == chr.getValueHandle()) |
hux | 24:0f08f68579bd | 20 | return 1; |
hux | 24:0f08f68579bd | 21 | else |
hux | 24:0f08f68579bd | 22 | return 0; |
hux | 24:0f08f68579bd | 23 | } |
hux | 24:0f08f68579bd | 24 | |
hux | 24:0f08f68579bd | 25 | #endif // _SET_H_ |