微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI蓝牙设计交流 > 基于SerialBLEbridge V1.4.1实现BLE和UART透传功能,修改simpleProfileAttrTbl属性表后通知功能失效

基于SerialBLEbridge V1.4.1实现BLE和UART透传功能,修改simpleProfileAttrTbl属性表后通知功能失效

时间:10-02 整理:3721RD 点击:

基于SerialBLEbridge V1.4.1实现BLE和UART透传功能,读和写都通实现透传了,但修改simpleProfileAttrTbl属性表,去掉Characteristic 1到Characteristic 3后影响到了Characteristic 4,Characteristic 4的通知功能失效,Characteristic 4的写数据没问题,读数据是在通知是侦听的,通知失效后读数据就失效了。

static gattAttribute_t simpleProfileAttrTbl[] =
{
// Simple Profile Service
{
{ ATT_BT_UUID_SIZE, primaryServiceUUID }, /* type */
GATT_PERMIT_READ, /* permissions */
0, /* handle */
(uint8 *)&simpleProfileService /* pValue */
},

// // Characteristic 1 Declaration
// {
// { ATT_BT_UUID_SIZE, characterUUID },
// GATT_PERMIT_READ,
// 0,
// &simpleProfileChar1Props
// },
//
// // Characteristic Value 1
// {
// { ATT_BT_UUID_SIZE, simpleProfilechar1UUID },
// GATT_PERMIT_READ | GATT_PERMIT_WRITE,
// 0,
// &simpleProfileChar1
// },
//
// // Characteristic 1 User Description
// {
// { ATT_BT_UUID_SIZE, charUserDescUUID },
// GATT_PERMIT_READ,
// 0,
// simpleProfileChar1UserDesp
// },
//
// // Characteristic 2 Declaration
// {
// { ATT_BT_UUID_SIZE, characterUUID },
// GATT_PERMIT_READ,
// 0,
// &simpleProfileChar2Props
// },
//
// // Characteristic Value 2
// {
// { ATT_BT_UUID_SIZE, simpleProfilechar2UUID },
// GATT_PERMIT_READ,
// 0,
// &simpleProfileChar2
// },
//
// // Characteristic 2 User Description
// {
// { ATT_BT_UUID_SIZE, charUserDescUUID },
// GATT_PERMIT_READ,
// 0,
// simpleProfileChar2UserDesp
// },
//
// // Characteristic 3 Declaration
// {
// { ATT_BT_UUID_SIZE, characterUUID },
// GATT_PERMIT_READ,
// 0,
// &simpleProfileChar3Props
// },
//
// // Characteristic Value 3
// {
// { ATT_BT_UUID_SIZE, simpleProfilechar3UUID },
// GATT_PERMIT_WRITE,
// 0,
// simpleProfileChar3
// },
//
// // Characteristic 3 User Description
// {
// { ATT_BT_UUID_SIZE, charUserDescUUID },
// GATT_PERMIT_READ,
// 0,
// simpleProfileChar3UserDesp
// },

// Characteristic 4 Declaration
{
{ ATT_BT_UUID_SIZE, characterUUID },
GATT_PERMIT_READ,
0,
&simpleProfileChar4Props
},

// Characteristic Value 4
{
{ ATT_BT_UUID_SIZE, simpleProfilechar4UUID },
//0,
GATT_PERMIT_READ | GATT_PERMIT_WRITE, //modified by xsh 2017.05.19
0,
//&simpleProfileChar4
simpleProfileChar4 //modified by xsh 2017.05.19
},

// Characteristic 4 configuration
{
{ ATT_BT_UUID_SIZE, clientCharCfgUUID },
GATT_PERMIT_READ | GATT_PERMIT_WRITE,
0,
(uint8 *)&simpleProfileChar4Config
},

// Characteristic 4 User Description
{
{ ATT_BT_UUID_SIZE, charUserDescUUID },
GATT_PERMIT_READ,
0,
simpleProfileChar4UserDesp
},

// // Characteristic 5 Declaration
// {
// { ATT_BT_UUID_SIZE, characterUUID },
// GATT_PERMIT_READ,
// 0,
// &simpleProfileChar5Props
// },
//
// // Characteristic Value 5
// {
// { ATT_BT_UUID_SIZE, simpleProfilechar5UUID },
// GATT_PERMIT_AUTHEN_READ,
// 0,
// simpleProfileChar5
// },
//
// // Characteristic 5 User Description
// {
// { ATT_BT_UUID_SIZE, charUserDescUUID },
// GATT_PERMIT_READ,
// 0,
// simpleProfileChar5UserDesp
// },

};

请问是哪里出了问题?

去掉Characteristic 5的定义就没影响,去掉Characteristic 4前面的定义就受影响,不知道为何?

论坛有类似问题,参考这边解答: https://e2e.ti.com/support/wireless_connectivity/bluetooth_low_energy/f/538/p/349378/1223423

按以上链接的这个方法不行,我的simpleProfileChar4定义成这样:

static uint8 simpleProfileChar4[SIMPLEPROFILE_CHAR4_LEN] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

static uint8 simpleProfileChar4Props = GATT_PROP_NOTIFY|GATT_PROP_READ|GATT_PROP_WRITE|GATT_PROP_WRITE_NO_RSP;  

我要通过simpleProfileChar4这个数组实现透传数据的存放,会不会是这个有影响,但是没注解掉属性表中的Characteristic1-3是可以的。

源程序上传,simpleProfileAttrTbl表这样定义就OK,但我只想要Characteristic4,一注解掉Characteristic1-3就造成通知失效,APP写数据到UART是正常的,UART发数据到APP就没有。

static gattAttribute_t simpleProfileAttrTbl[] = 
{
// Simple Profile Service

{ ATT_BT_UUID_SIZE, primaryServiceUUID }, /* type */
GATT_PERMIT_READ, /* permissions */
0, /* handle */
(uint8 *)&simpleProfileService /* pValue */
},

// Characteristic 1 Declaration

{ ATT_BT_UUID_SIZE, characterUUID },
GATT_PERMIT_READ, 
0,
&simpleProfileChar1Props 
},

// Characteristic Value 1

{ ATT_BT_UUID_SIZE, simpleProfilechar1UUID },
GATT_PERMIT_READ | GATT_PERMIT_WRITE, 
0, 
&simpleProfileChar1 
},

// Characteristic 1 User Description

{ ATT_BT_UUID_SIZE, charUserDescUUID },
GATT_PERMIT_READ, 
0, 
simpleProfileChar1UserDesp 
},

// Characteristic 2 Declaration

{ ATT_BT_UUID_SIZE, characterUUID },
GATT_PERMIT_READ, 
0,
&simpleProfileChar2Props 
},

// Characteristic Value 2

{ ATT_BT_UUID_SIZE, simpleProfilechar2UUID },
GATT_PERMIT_READ, 
0, 
&simpleProfileChar2 
},

// Characteristic 2 User Description

{ ATT_BT_UUID_SIZE, charUserDescUUID },
GATT_PERMIT_READ, 
0, 
simpleProfileChar2UserDesp 
}, 

// Characteristic 3 Declaration

{ ATT_BT_UUID_SIZE, characterUUID },
GATT_PERMIT_READ, 
0,
&simpleProfileChar3Props 
},

// Characteristic Value 3

{ ATT_BT_UUID_SIZE, simpleProfilechar3UUID },
GATT_PERMIT_WRITE,
0, 
simpleProfileChar3 
},

// Characteristic 3 User Description

{ ATT_BT_UUID_SIZE, charUserDescUUID },
GATT_PERMIT_READ, 
0, 
simpleProfileChar3UserDesp 
},

// Characteristic 4 Declaration

{ ATT_BT_UUID_SIZE, characterUUID },
GATT_PERMIT_READ, 
0,
&simpleProfileChar4Props 
},

// Characteristic Value 4

{ ATT_BT_UUID_SIZE, simpleProfilechar4UUID },
//0, 
GATT_PERMIT_READ | GATT_PERMIT_WRITE, //modified by xsh 2017.05.19
0, 
//&simpleProfileChar4 
simpleProfileChar4 //modified by xsh 2017.05.19 
},

// Characteristic 4 configuration

{ ATT_BT_UUID_SIZE, clientCharCfgUUID },
GATT_PERMIT_READ | GATT_PERMIT_WRITE, 
0, 
(uint8 *)&simpleProfileChar4Config
},

// Characteristic 4 User Description

{ ATT_BT_UUID_SIZE, charUserDescUUID },
GATT_PERMIT_READ, 
0, 
simpleProfileChar4UserDesp 
},

// // Characteristic 5 Declaration
// { 
// { ATT_BT_UUID_SIZE, characterUUID },
// GATT_PERMIT_READ, 
// 0,
// &simpleProfileChar5Props 
// },
//
// // Characteristic Value 5
// { 
// { ATT_BT_UUID_SIZE, simpleProfilechar5UUID },
// GATT_PERMIT_AUTHEN_READ, 
// 0, 
// simpleProfileChar5 
// },
//
// // Characteristic 5 User Description
// { 
// { ATT_BT_UUID_SIZE, charUserDescUUID },
// GATT_PERMIT_READ, 
// 0, 
// simpleProfileChar5UserDesp 
// },
};

尝试直接把在simpleProfileChar1基础上改成simpleProfileChar4 的模式,把simpleProfileChar2-5去掉

是这个地方出了问题:noti.handle ,写死了

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top