![](/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
bricks/updated.h@24:0f08f68579bd, 2017-01-06 (annotated)
- Committer:
- hux
- Date:
- Fri Jan 06 20:49:58 2017 +0000
- Revision:
- 24:0f08f68579bd
Version 1.0 - now satisfying behavior. No known bugs!
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_ |