A cute tiny piece of code implementing an IoT NAND device, demonstrating how to setup and advertise a cute GATT (NAND) service. The code has been tested on a Nordic nRF51822-DK.
Dependencies: BLE_API mbed nRF51822
Fork of BLE_HeartRate_IDB0XA1 by
Diff: bricks/updated.h
- Revision:
- 23:2e73c391bb12
diff -r d467526abc4a -r 2e73c391bb12 bricks/updated.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bricks/updated.h Sun Jan 08 23:15:53 2017 +0000 @@ -0,0 +1,25 @@ +// updated.h - check whether a characteristic has been updated +// note: can only used within 'onWritten' callback +// +// Synopsis: +// +// See also: CHARACTERISTIC, GET, SET, ONWRITTEN +// +#ifndef _UPDATED_H_ +#define _UPDATED_H_ + +#include "ble/Gap.h" +#include "bricks/blob.h" + + inline int updated(Blob &o,GattCharacteristic &chr) // has char. been updated? + { + const GattWriteCallbackParams *p = o.pWritten; + if (!p) + return 0; // no update! + else if(p->handle == chr.getValueHandle()) + return 1; + else + return 0; + } + +#endif // _SET_H_ \ No newline at end of file