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
Diff: bricks/set.h
- Revision:
- 27:32267cee7cb8
- Parent:
- 26:fd06c8b57d16
diff -r fd06c8b57d16 -r 32267cee7cb8 bricks/set.h
--- a/bricks/set.h Sat Jan 07 15:38:15 2017 +0000
+++ b/bricks/set.h Sat Jan 14 08:43:14 2017 +0000
@@ -17,20 +17,30 @@
#include "ble/BLE.h"
#include "ble/Gap.h"
#include "ble/GattServer.h"
-#include "bricks/blob.h"
+#include "bricks/o.h"
#include "bricks/types.h"
#include "bricks/characteristic.h"
- inline void set(Blob &blue, Characteristic<Bool> &chr, const Bool &data)
+ inline void set(O&o, Characteristic<Bool> &chr, const Bool &data)
{
uint16_t size = sizeof(Bool)/sizeof(uint8_t);
- blue.gatt().write(chr.getValueHandle(), (uint8_t*)&data,size);
+ o.gattServer().write(chr.getValueHandle(), (uint8_t*)&data,size);
+ }
+
+ inline void set(O&o, Characteristic<ObjectId> &chr, const ObjectId &data)
+ {
+ uint16_t size = sizeof(ObjectId)/sizeof(uint8_t);
+ o.gattServer().write(chr.getValueHandle(), (uint8_t*)&data,size);
}
- inline void set(Blob &blue, Characteristic<ObjectId> &chr, const ObjectId &data)
+// we provide also some SET methods for GattCharacteristics. However the use
+// of these methods are more dangerous, because a GattCharacteristics can be
+// of any type and the compiler cannot help us to check !!!
+
+ inline void set(O&o,GattCharacteristic &chr,Bool data)
{
- uint16_t size = sizeof(ObjectId)/sizeof(uint8_t);
- blue.gatt().write(chr.getValueHandle(), (uint8_t*)&data,size);
+ uint16_t size = sizeof(Bool)/sizeof(uint8_t);
+ o.gattServer().write(chr.getValueHandle(), (uint8_t*)&data,size);
}
#endif // _SET_H_
\ No newline at end of file
