Bluetooth Connected TOF Sensor

Dependencies:   BLE_API X_NUCLEO_6180XA1 X_NUCLEO_IDB0XA1 mbed

Fork of BLE_HeartRate_IDB0XA1 by ST

Committer:
hux
Date:
Fri Jan 06 20:49:58 2017 +0000
Revision:
24:0f08f68579bd
Version 1.0 - now satisfying behavior. No known bugs!

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hux 24:0f08f68579bd 1 // descriptor.h - a description list, containing a single descriptor
hux 24:0f08f68579bd 2 //
hux 24:0f08f68579bd 3 // Synopsis:
hux 24:0f08f68579bd 4 //
hux 24:0f08f68579bd 5 // Descriptor user(0x2901,"User");
hux 24:0f08f68579bd 6 // Descriptor client(0x2902,"Client");
hux 24:0f08f68579bd 7 //
hux 24:0f08f68579bd 8 // UserDescriptor status("Status"); // user descriptor 0x2901
hux 24:0f08f68579bd 9 // ClientDescriptor client("Client"); // client descriptor 0x2902
hux 24:0f08f68579bd 10 //
hux 24:0f08f68579bd 11 #ifndef _DESCRIPTOR_H_
hux 24:0f08f68579bd 12 #define _DESCRIPTOR_H_
hux 24:0f08f68579bd 13
hux 24:0f08f68579bd 14 #include "ble/BLE.h"
hux 24:0f08f68579bd 15 #include "ble/Gap.h"
hux 24:0f08f68579bd 16
hux 24:0f08f68579bd 17 class Descriptor : public GattAttribute
hux 24:0f08f68579bd 18 {
hux 24:0f08f68579bd 19 private:
hux 24:0f08f68579bd 20 typedef GattAttribute *GattAttributePtr;
hux 24:0f08f68579bd 21
hux 24:0f08f68579bd 22 public:
hux 24:0f08f68579bd 23 GattAttributePtr plist[1];
hux 24:0f08f68579bd 24
hux 24:0f08f68579bd 25 Descriptor(UUID uuid, const char *name) :
hux 24:0f08f68579bd 26 GattAttribute(uuid,(uint8_t*)name,strlen(name),strlen(name))
hux 24:0f08f68579bd 27 {
hux 24:0f08f68579bd 28 plist[0] = this;
hux 24:0f08f68579bd 29 }
hux 24:0f08f68579bd 30 };
hux 24:0f08f68579bd 31
hux 24:0f08f68579bd 32 class UserDescriptor : public Descriptor
hux 24:0f08f68579bd 33 {
hux 24:0f08f68579bd 34 public:
hux 24:0f08f68579bd 35 UserDescriptor(const char *name) : Descriptor(0x2901,name)
hux 24:0f08f68579bd 36 {
hux 24:0f08f68579bd 37 // empty
hux 24:0f08f68579bd 38 }
hux 24:0f08f68579bd 39 };
hux 24:0f08f68579bd 40
hux 24:0f08f68579bd 41 class ClientDescriptor : public Descriptor
hux 24:0f08f68579bd 42 {
hux 24:0f08f68579bd 43 public:
hux 24:0f08f68579bd 44 ClientDescriptor(const char *name) : Descriptor(0x2902,name)
hux 24:0f08f68579bd 45 {
hux 24:0f08f68579bd 46 // empty
hux 24:0f08f68579bd 47 }
hux 24:0f08f68579bd 48 };
hux 24:0f08f68579bd 49
hux 24:0f08f68579bd 50 #endif // _DESCRIPTOR_H_