Bluetooth Connected TOF Sensor
Dependencies: BLE_API X_NUCLEO_6180XA1 X_NUCLEO_IDB0XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
bricks/get.h@26:fd06c8b57d16, 2017-01-07 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
hux | 23:677689000369 | 1 | // get.h - get data from a characteristics |
hux | 23:677689000369 | 2 | // |
hux | 23:677689000369 | 3 | // Synopsis: |
hux | 23:677689000369 | 4 | // |
hux | 23:677689000369 | 5 | // Get data from a 'characteristic' into a 'data' variable |
hux | 23:677689000369 | 6 | // |
hux | 23:677689000369 | 7 | // get(characteristic,data) |
hux | 23:677689000369 | 8 | // |
hux | 23:677689000369 | 9 | // The 'get' 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, SET |
hux | 23:677689000369 | 13 | // |
hux | 23:677689000369 | 14 | #ifndef _GET_H_ |
hux | 23:677689000369 | 15 | #define _GET_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/GattClient.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 get(Blob &blue, Characteristic<Bool> &chr, Bool &data) |
hux | 23:677689000369 | 25 | { |
hux | 26:fd06c8b57d16 | 26 | uint16_t size = sizeof(Bool)/sizeof(uint8_t); |
hux | 23:677689000369 | 27 | blue.gatt().read(chr.getValueHandle(), (uint8_t*)&data,&size); |
hux | 23:677689000369 | 28 | } |
hux | 23:677689000369 | 29 | |
hux | 23:677689000369 | 30 | inline void get(Blob &blue, Characteristic<ObjectId> &chr, ObjectId &data) |
hux | 23:677689000369 | 31 | { |
hux | 23:677689000369 | 32 | uint16_t size = sizeof(ObjectId)/sizeof(uint8_t); |
hux | 23:677689000369 | 33 | blue.gatt().read(chr.getValueHandle(), (uint8_t*)&data,&size); |
hux | 23:677689000369 | 34 | } |
hux | 23:677689000369 | 35 | |
hux | 23:677689000369 | 36 | #endif // _GET_H_ |