Bluetooth Connected TOF Sensor

Dependencies:   BLE_API X_NUCLEO_6180XA1 X_NUCLEO_IDB0XA1 mbed

Fork of BLE_HeartRate_IDB0XA1 by ST

Committer:
hux
Date:
Sat Jan 07 15:38:15 2017 +0000
Revision:
26:fd06c8b57d16
Parent:
23:677689000369
Child:
27:32267cee7cb8
change of advertising service UUID in enrollment

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hux 23:677689000369 1 // set.h - set data from a characteristics
hux 23:677689000369 2 //
hux 23:677689000369 3 // Synopsis:
hux 23:677689000369 4 //
hux 23:677689000369 5 // Set data from a 'characteristic' based on 'data' variable
hux 23:677689000369 6 //
hux 23:677689000369 7 // set(characteristic,data)
hux 23:677689000369 8 //
hux 23:677689000369 9 // The 'set' function (overloaded function family) is implemented for all
hux 23:677689000369 10 // types defined in "bricks/types.h".
hux 23:677689000369 11 //
hux 23:677689000369 12 // See also: CHARACTERISTIC, GET
hux 23:677689000369 13 //
hux 23:677689000369 14 #ifndef _SET_H_
hux 23:677689000369 15 #define _SET_H_
hux 23:677689000369 16
hux 23:677689000369 17 #include "ble/BLE.h"
hux 23:677689000369 18 #include "ble/Gap.h"
hux 23:677689000369 19 #include "ble/GattServer.h"
hux 23:677689000369 20 #include "bricks/blob.h"
hux 23:677689000369 21 #include "bricks/types.h"
hux 23:677689000369 22 #include "bricks/characteristic.h"
hux 23:677689000369 23
hux 26:fd06c8b57d16 24 inline void set(Blob &blue, Characteristic<Bool> &chr, const Bool &data)
hux 23:677689000369 25 {
hux 26:fd06c8b57d16 26 uint16_t size = sizeof(Bool)/sizeof(uint8_t);
hux 23:677689000369 27 blue.gatt().write(chr.getValueHandle(), (uint8_t*)&data,size);
hux 23:677689000369 28 }
hux 23:677689000369 29
hux 23:677689000369 30 inline void set(Blob &blue, Characteristic<ObjectId> &chr, const ObjectId &data)
hux 23:677689000369 31 {
hux 23:677689000369 32 uint16_t size = sizeof(ObjectId)/sizeof(uint8_t);
hux 23:677689000369 33 blue.gatt().write(chr.getValueHandle(), (uint8_t*)&data,size);
hux 23:677689000369 34 }
hux 23:677689000369 35
hux 23:677689000369 36 #endif // _SET_H_