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_IDB0XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
bricks/set.h
- Committer:
- hux
- Date:
- 2018-05-19
- Revision:
- 29:8eb46b976f0f
- Parent:
- 28:114eaad388c1
File content as of revision 29:8eb46b976f0f:
// 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/o.h"
#include "bricks/types.h"
#include "bricks/characteristic.h"
inline void set(O&o, Characteristic<Bool> &chr, const Bool &data)
{
uint16_t size = sizeof(Bool)/sizeof(uint8_t);
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);
}
#endif // _SET_H_
