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_6180XA1 X_NUCLEO_IDB0XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
set.h
00001 // set.h - set data from a characteristics 00002 // 00003 // Synopsis: 00004 // 00005 // Set data from a 'characteristic' based on 'data' variable 00006 // 00007 // set(characteristic,data) 00008 // 00009 // The 'set' function (overloaded function family) is implemented for all 00010 // types defined in "bricks/types.h". 00011 // 00012 // See also: CHARACTERISTIC, GET 00013 // 00014 #ifndef _SET_H_ 00015 #define _SET_H_ 00016 00017 #include "ble/BLE.h" 00018 #include "ble/Gap.h" 00019 #include "ble/GattServer.h" 00020 #include "bricks/o.h" 00021 #include "bricks/types.h" 00022 #include "bricks/characteristic.h" 00023 00024 inline void set(O&o, Characteristic<Bool> &chr, const Bool &data) 00025 { 00026 uint16_t size = sizeof(Bool)/sizeof(uint8_t); 00027 o.gattServer().write(chr.getValueHandle(), (uint8_t*)&data,size); 00028 } 00029 00030 inline void set(O&o, Characteristic<Int> &chr, const Int &data) 00031 { 00032 uint16_t size = sizeof(Int)/sizeof(uint8_t); 00033 o.gattServer().write(chr.getValueHandle(), (uint8_t*)&data,size); 00034 } 00035 00036 inline void set(O&o, Characteristic<ObjectId> &chr, const ObjectId &data) 00037 { 00038 uint16_t size = sizeof(ObjectId)/sizeof(uint8_t); 00039 o.gattServer().write(chr.getValueHandle(), (uint8_t*)&data,size); 00040 } 00041 00042 // we provide also some SET methods for GattCharacteristics. However the use 00043 // of these methods are more dangerous, because a GattCharacteristics can be 00044 // of any type and the compiler cannot help us to check !!! 00045 00046 inline void set(O&o,GattCharacteristic &chr,Bool data) 00047 { 00048 uint16_t size = sizeof(Bool)/sizeof(uint8_t); 00049 o.gattServer().write(chr.getValueHandle(), (uint8_t*)&data,size); 00050 } 00051 00052 #endif // _SET_H_
Generated on Sat Jul 16 2022 07:45:39 by
1.7.2
