ST17H26之att数据库设置

#pragma once


#include "gatt.h"


#if 0
typedef enum
{
ONLY_UUID16,
SUPPORT_UUID128,
};
#else
#define ONLY_UUID16 0
#define SUPPORT_UUID128 1
#endif


#define UUID_SUPPORT_TYPE 1


/** @addtogroup  GATT_Server_Module GATT server
 *  @{
 */


/** @addtogroup  GATT_Server_Types GATT server types
 *  @{
 */


/**
 *  @brief  Definition for client characteristic configuration change callback function
 */


typedef u8* (*att_handler_t)(u8 * p);
typedef int (*att_readwrite_callback_t)(void* p);


typedef struct attribute
{
#if(UUID_SUPPORT_TYPE==ONLY_UUID16)
 u8  attNum;
//  u8  uuidLen;
 u8  attrLen;
//  u8  attrMaxLen;
 u16 uuid;
 u8* pAttrValue;
#else
 u8  attNum;
 u8  uuidLen;
 u8  attrLen;
//  u8  attrMaxLen;
 u8* uuid;
 u8* pAttrValue;
#endif
} attribute_t;








/** @addtogroup GATT_Attr_Num_Calc GATT attribute number calculation
 * @{
 */
#define GATT_CALC_ATTR_NUM( attrArray )       (sizeof(attrArray) / sizeof(attribute_t))

/** @} end of group GATT_Attr_Num_Calc */




#include "../../proj/tl_common.h"
#include "../../proj_lib/blt_ll/blt_ll.h"
#include "ui.h"






static const u8 privateSeviceUUID_Trsp[16] =
{
0x55, 0xE4, 0x05, 0xD2, 0xAF, 0x9F, 0xA9, 0x8F, 0xE5, 0x4A, 0x7D, 0xFE, 0x43, 0x53, 0x53, 0x49
};


//static const u16 privateKeyNoti_charUUID_Trsp_Write = 0xffd1;
static const u8 privateKeyNoti_charUUID_Trsp_Write[16] = 
{
0xB3, 0x9B, 0x72, 0x34, 0xBE, 0xEC, 0xD4, 0xA8, 0xF4, 0x43, 0x41, 0x88, 0x43, 0x53, 0x53, 0x49
};
static const u8  privatekeyNoti_prop_Trsp_Write = CHAR_PROP_WRITE | CHAR_PROP_WRITE_WITHOUT_RSP;
u8 privateKeyNoti_value_Trsp_Write[20] = {0};






//static const u16 privateKeyNoti_charUUID_Trsp_Read = 0xffd2;
static const u8 privateKeyNoti_charUUID_Trsp_Read[16] = 
{
0x16, 0x96, 0x24, 0x47, 0xC6, 0x23, 0x61, 0xBA, 0xD9, 0x4B, 0x4D, 0x1E, 0x43, 0x53, 0x53, 0x49
};
static const u8  privatekeyNoti_prop_Trsp_Read = CHAR_PROP_READ | CHAR_PROP_NOTIFY;
u8 privateKeyNoti_value_Trsp_Read[20] = {0};


  








// HID External Report Reference Descriptor for report map
static u16 extServiceUUID;


static const u16 GattServerUuid = GATT_UUID_PRIMARY_SERVICE;
static const u16 GattCharUuid = GATT_UUID_CHARACTER;
static const u16 ClientCharCfgUUID = GATT_UUID_CLIENT_CHAR_CFG;
static u8 ServiceChangeCCC[2]={0x01, 0x00};


/*
const attribute_t my_Attributes[] = 
{
{5,0,0,0,0}, //


// 12. Private Service /
{5, 2, 16, (u8*)(&GattServerUuid), (u8*)(privateSeviceUUID_Trsp)},
{0, 2, 1, (u8*)(&GattCharUuid), (u8*)(&privatekeyNoti_prop_Trsp_Write)},
{0, 16, 20, (u8*)(privateKeyNoti_charUUID_Trsp_Write), (u8*)(privateKeyNoti_value_Trsp_Write)},
{0, 2, 1, (u8*)(&GattCharUuid), (u8*)(&privatekeyNoti_prop_Trsp_Read)},
{0, 16, 20, (u8*)(privateKeyNoti_charUUID_Trsp_Read), (u8*)(privateKeyNoti_value_Trsp_Read)},
};
*/






const attribute_t my_Attributes[] = 
{
{6,0,0,0,0}, //


// 12. Private Service /
{6, 2, 16, (u8*)(&GattServerUuid), (u8*)(privateSeviceUUID_Trsp)},


{0, 2, 1, (u8*)(&GattCharUuid), (u8*)(&privatekeyNoti_prop_Trsp_Read)},
{0, 16, 20, (u8*)(privateKeyNoti_charUUID_Trsp_Read), (u8*)(privateKeyNoti_value_Trsp_Read)},
{0, 2, 2, (u8*)(&ClientCharCfgUUID), (u8*)(ServiceChangeCCC)},


{0, 2, 1, (u8*)(&GattCharUuid), (u8*)(&privatekeyNoti_prop_Trsp_Write)},
{0, 16, 20, (u8*)(privateKeyNoti_charUUID_Trsp_Write), (u8*)(privateKeyNoti_value_Trsp_Write)},
};










u8* att_get_reportMap()
{
return 0;
}








int att_get_reportMapSize()
{
return 0;
}








void shutter_att_init()
{
    extern attribute_t* gAttributes;
    gAttributes = (attribute_t *)my_Attributes;


}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值