Microbug / BLE_API

Fork of BLE_API by Bluetooth Low Energy

bleservice.h

Committer:
ktownsend
Date:
2013-12-04
Revision:
1:fd3ec64b2345
Parent:
0:ace2e8d3ce79

File content as of revision 1:fd3ec64b2345:

#ifndef __BLE_SERVICE_H__
#define __BLE_SERVICE_H__

#include "blecommon.h"
#include "uuid.h"
#include "blecharacteristic.h"

#define BLE_SERVICE_MAX_CHARACTERISTICS (5)

class BLEService
{
private:

public:
    typedef struct
    {
        uint16_t    id;
        uint16_t    lenMin;
        uint16_t    lenMax;
        uint8_t     properties;
        uint8_t     reserved;
    } serialisedChar_t;
    
    BLEService(uint8_t[16]);  /* 128-bit Base UUID */
    BLEService(uint16_t);     /* 16-bit BLE UUID */
    virtual ~BLEService(void);

    UUID                primaryServiceID;
    uint8_t             characteristicCount;
    serialisedChar_t    characteristics[BLE_SERVICE_MAX_CHARACTERISTICS];
    uint8_t             index;

    ble_error_t         addCharacteristic(BLECharacteristic &);
};

#endif