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 N06_NAND by
bricks/updated.h@23:2e73c391bb12, 2017-01-08 (annotated)
- Committer:
- hux
- Date:
- Sun Jan 08 23:15:53 2017 +0000
- Revision:
- 23:2e73c391bb12
A cute tiny piece of code implementing an Iot NAND device, demonstrating how to setup and advertise a cute GATT (NAND) service.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| hux | 23:2e73c391bb12 | 1 | // updated.h - check whether a characteristic has been updated |
| hux | 23:2e73c391bb12 | 2 | // note: can only used within 'onWritten' callback |
| hux | 23:2e73c391bb12 | 3 | // |
| hux | 23:2e73c391bb12 | 4 | // Synopsis: |
| hux | 23:2e73c391bb12 | 5 | // |
| hux | 23:2e73c391bb12 | 6 | // See also: CHARACTERISTIC, GET, SET, ONWRITTEN |
| hux | 23:2e73c391bb12 | 7 | // |
| hux | 23:2e73c391bb12 | 8 | #ifndef _UPDATED_H_ |
| hux | 23:2e73c391bb12 | 9 | #define _UPDATED_H_ |
| hux | 23:2e73c391bb12 | 10 | |
| hux | 23:2e73c391bb12 | 11 | #include "ble/Gap.h" |
| hux | 23:2e73c391bb12 | 12 | #include "bricks/blob.h" |
| hux | 23:2e73c391bb12 | 13 | |
| hux | 23:2e73c391bb12 | 14 | inline int updated(Blob &o,GattCharacteristic &chr) // has char. been updated? |
| hux | 23:2e73c391bb12 | 15 | { |
| hux | 23:2e73c391bb12 | 16 | const GattWriteCallbackParams *p = o.pWritten; |
| hux | 23:2e73c391bb12 | 17 | if (!p) |
| hux | 23:2e73c391bb12 | 18 | return 0; // no update! |
| hux | 23:2e73c391bb12 | 19 | else if(p->handle == chr.getValueHandle()) |
| hux | 23:2e73c391bb12 | 20 | return 1; |
| hux | 23:2e73c391bb12 | 21 | else |
| hux | 23:2e73c391bb12 | 22 | return 0; |
| hux | 23:2e73c391bb12 | 23 | } |
| hux | 23:2e73c391bb12 | 24 | |
| hux | 23:2e73c391bb12 | 25 | #endif // _SET_H_ |
