ble之gatt server

来源:互联网 发布:天意网络魔域一条龙 编辑:程序博客网 时间:2024/05/22 06:23

结构图:



对应代码:

typedef struct

{
    uint16_t handle;
    uint8_t uuid_len;
    uint8_t uuid[16];
}desprip_t;








typedef struct
{
    uint16_t handle;
    uint8_t uuid_len;
    uint8_t uuid[16];
}include_t;










typedef struct
{
    uint16_t dhandle;
    uint16_t vhandle;
    uint8_t property;
    uint8_t uuid_len;
    uint8_t uuid[16];


    uint8_t nod;
    desprip_t * d;
}charact_t;








typedef struct
{
    uint16_t start;//服务定义中第一个Attribute的Handle
    uint16_t end;//服务定义中最后一个Attribute的Handle
    uint8_t uuid_len;
    uint8_t uuid[16];


    uint8_t noi;
    include_t * i;


    uint8_t noc;
    charact_t * c;
}service_t;










typedef struct
{
    uint8_t nos;//服务的数量
    service_t * s;
}server_t;



server_t server;