TOF based Presence Detector

Dependencies:   BLE_API X_NUCLEO_6180XA1 X_NUCLEO_IDB0XA1 mbed

Fork of BLE_HeartRate_IDB0XA1 by ST

bricks/get.h

Committer:
hux
Date:
2017-01-07
Revision:
26:fd06c8b57d16
Parent:
23:677689000369
Child:
27:32267cee7cb8

File content as of revision 26:fd06c8b57d16:

// get.h - get data from a characteristics
//
// Synopsis:
//
//    Get data from a 'characteristic' into a 'data' variable
//
//       get(characteristic,data)
//
//    The 'get' function (overloaded function family) is implemented for all
//    types defined in "bricks/types.h".
//
//    See also: CHARACTERISTIC, SET
//
#ifndef _GET_H_
#define _GET_H_

#include "ble/BLE.h"
#include "ble/Gap.h"
#include "ble/GattClient.h"
#include "bricks/blob.h"
#include "bricks/types.h"
#include "bricks/characteristic.h"

   inline void get(Blob &blue, Characteristic<Bool> &chr, Bool &data)
   {
      uint16_t size = sizeof(Bool)/sizeof(uint8_t);
      blue.gatt().read(chr.getValueHandle(), (uint8_t*)&data,&size);
   }

   inline void get(Blob &blue, Characteristic<ObjectId> &chr, ObjectId &data)
   {
      uint16_t size = sizeof(ObjectId)/sizeof(uint8_t);
      blue.gatt().read(chr.getValueHandle(), (uint8_t*)&data,&size);
   }

#endif // _GET_H_