微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI蓝牙设计交流 > SimpleBLEPeripheral中的Characteristic 1 2 3 4 5的模式都是定死的吗?

SimpleBLEPeripheral中的Characteristic 1 2 3 4 5的模式都是定死的吗?

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

SimpleBLEPeripheral中的Characteristic 1 2 3 4 5的模式都是定死的吗?

不能修改其中的参数吗?为什么我把程序修改成这样还不能读出CHAR3的UUID

static uint8 simpleProfileChar1Props = GATT_PROP_READ | GATT_PROP_WRITE;

static uint8 simpleProfileChar2Props = GATT_PROP_READ| GATT_PROP_WRITE;

static uint8 simpleProfileChar3Props = GATT_PROP_READ | GATT_PROP_WRITE;

static uint8 simpleProfileChar4Props = GATT_PROP_READ | GATT_PROP_NOTIFY;

{
{ 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 Descriptin
{
{ 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 | GATT_PERMIT_WRITE,
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_READ|GATT_PERMIT_WRITE,
0,
&simpleProfileChar3
},

// Characteristic 3 User Description
{
{ ATT_BT_UUID_SIZE, charUserDescUUID },
GATT_PERMIT_READ,
0,
simpleProfileChar3UserDesp
},

定不定死我不太确定,我有尝试改动过,不过出来运行都不行。不过我有看到别人改动char1成功的案例。我自己这的问题我是添加了一个char6来满足我自己应用的需要的

还有个地方要改吧:

static uint8 simpleProfile_ReadAttrCB( uint16 connHandle, gattAttribute_t *pAttr,
uint8 *pValue, uint8 *pLen, uint16 offset, uint8 maxLen )
{

......

switch ( uuid )
{
// No need for "GATT_SERVICE_UUID" or "GATT_CLIENT_CHAR_CFG_UUID" cases;
// gattserverapp handles those reads

// characteristics 1 and 2 have read permissions
// characteritisc 3 does not have read permissions; therefore it is not
// included here
// characteristic 4 does not have read permissions, but because it
// can be sent as a notification, it is included here
case SIMPLEPROFILE_CHAR1_UUID:
case SIMPLEPROFILE_CHAR2_UUID:
case SIMPLEPROFILE_CHAR4_UUID:
*pLen = 1;
pValue[0] = *pAttr->pValue;
break;

case SIMPLEPROFILE_CHAR5_UUID:
*pLen = SIMPLEPROFILE_CHAR5_LEN;
VOID osal_memcpy( pValue, switch ( uuid )
{
// No need for "GATT_SERVICE_UUID" or "GATT_CLIENT_CHAR_CFG_UUID" cases;
// gattserverapp handles those reads

// characteristics 1 and 2 have read permissions
// characteritisc 3 does not have read permissions; therefore it is not
// included here
// characteristic 4 does not have read permissions, but because it
// can be sent as a notification, it is included here
case SIMPLEPROFILE_CHAR1_UUID:
case SIMPLEPROFILE_CHAR2_UUID:
case SIMPLEPROFILE_CHAR4_UUID:
*pLen = 1;
pValue[0] = *pAttr->pValue;
break;

case SIMPLEPROFILE_CHAR5_UUID:
*pLen = SIMPLEPROFILE_CHAR5_LEN;
VOID osal_memcpy( pValue, pAttr->pValue, SIMPLEPROFILE_CHAR5_LEN );
break;

 

我当时是profile从头改到尾的。。你给我个邮箱,我发给你看个pdf文件你就明白了

simpleProfile_ReadAttrCB 函数中缺了CHAR3_UUID:项读,需要加上去,而你的上面修改明显没有加这项。

TI有点奇怪,本来特性都是差不多的,读写为什么都要各个分别编程,最起码应有个公共的方法才对,他的缺省是不处理。 

您好,我的邮箱是:majtsdd@163.com

先谢谢你了

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

网站地图

Top