GAP based TOF Demo

Dependencies:   BLE_API X_NUCLEO_6180XA1 mbed

Fork of BLE_HeartRate_IDB0XA1 by ST

Revision:
23:677689000369
Child:
26:fd06c8b57d16
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bricks/set.h	Fri Jan 06 15:28:18 2017 +0000
@@ -0,0 +1,36 @@
+// set.h - set data from a characteristics
+//
+// Synopsis:
+//
+//    Set data from a 'characteristic' based on 'data' variable
+//
+//       set(characteristic,data)
+//
+//    The 'set' function (overloaded function family) is implemented for all
+//    types defined in "bricks/types.h".
+//
+//    See also: CHARACTERISTIC, GET
+//
+#ifndef _SET_H_
+#define _SET_H_
+
+#include "ble/BLE.h"
+#include "ble/Gap.h"
+#include "ble/GattServer.h"
+#include "bricks/blob.h"
+#include "bricks/types.h"
+#include "bricks/characteristic.h"
+
+   inline void set(Blob &blue, Characteristic<Digital> &chr, const Digital &data)
+   {
+      uint16_t size = sizeof(Digital)/sizeof(uint8_t);
+      blue.gatt().write(chr.getValueHandle(), (uint8_t*)&data,size);
+   }
+
+   inline void set(Blob &blue, Characteristic<ObjectId> &chr, const ObjectId &data)
+   {
+      uint16_t size = sizeof(ObjectId)/sizeof(uint8_t);
+      blue.gatt().write(chr.getValueHandle(), (uint8_t*)&data,size);
+   }
+
+#endif // _SET_H_
\ No newline at end of file