A blue button is always a nice toy ...

Dependencies:   BLE_API X_NUCLEO_IDB0XA1 mbed

Fork of BLE_HeartRate_IDB0XA1 by ST

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers descriptor.h Source File

descriptor.h

00001 // descriptor.h - a description list, containing a single descriptor
00002 //
00003 // Synopsis:
00004 //
00005 //    Descriptor user(0x2901,"User");
00006 //    Descriptor client(0x2902,"Client");
00007 //
00008 //    UserDescriptor    status("Status");      // user descriptor   0x2901
00009 //    ClientDescriptor  client("Client");      // client descriptor 0x2902
00010 //
00011 #ifndef _DESCRIPTOR_H_
00012 #define _DESCRIPTOR_H_
00013 
00014 #include "ble/BLE.h"
00015 #include "ble/Gap.h"
00016 
00017    class Descriptor : public GattAttribute
00018    {
00019        private:
00020           typedef GattAttribute *GattAttributePtr;
00021        
00022        public:
00023           GattAttributePtr plist[1];
00024           
00025           Descriptor(UUID uuid, const char *name) :
00026              GattAttribute(uuid,(uint8_t*)name,strlen(name),strlen(name))
00027           {
00028               plist[0] = this;
00029           }
00030    };
00031 
00032    class UserDescriptor : public Descriptor
00033    {
00034        public:
00035           UserDescriptor(const char *name) :  Descriptor(0x2901,name)
00036           {
00037               // empty
00038           }
00039    };
00040 
00041    class ClientDescriptor : public Descriptor
00042    {
00043        public:
00044           ClientDescriptor(const char *name) :  Descriptor(0x2902,name)
00045           {
00046               // empty
00047           }
00048    };
00049 
00050 #endif // _DESCRIPTOR_H_