微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI无线射频设计 > SimpleGATTProfile 里的第五个characteristic 怎么理解?

SimpleGATTProfile 里的第五个characteristic 怎么理解?

时间:12-22 整理:3721RD 点击:

4.6.1 Encrypting the Connection
The SimpleGATTProfile contains a fifth characteristic with a UUID of 0xFFF5. Like the second
characteristic, this characteristic has read-only permissions; however this characteristic can only be read if
the link is encrypted.

有下划线的句子的意思是:这个characteristic只能在连接被加密的情况下才能被读取。

但是我在SimpleGATTProfile.c里没有看到对SIMPLEPROFILE_CHAR5的限制,代码里读取时候也没有要求加密。

/*********************************************************************
* @fn SimpleProfile_GetParameter
*
* @brief Get a Simple Profile parameter.
*
* @param param - Profile parameter ID
* @param value - pointer to data to put. This is dependent on
* the parameter ID and WILL be cast to the appropriate
* data type (example: data type of uint16 will be cast to
* uint16 pointer).
*
* @return bStatus_t
*/
bStatus_t SimpleProfile_GetParameter( uint8 param, void *value )
{
bStatus_t ret = SUCCESS;
switch ( param )
{
case SIMPLEPROFILE_CHAR1:
*((uint8*)value) = simpleProfileChar1;
break;

case SIMPLEPROFILE_CHAR2:
*((uint8*)value) = simpleProfileChar2;
break;

case SIMPLEPROFILE_CHAR3:
*((uint8*)value) = simpleProfileChar3;
break;

case SIMPLEPROFILE_CHAR4:
*((uint8*)value) = simpleProfileChar4;
break;

case SIMPLEPROFILE_CHAR5:
VOID osal_memcpy( value, simpleProfileChar5, SIMPLEPROFILE_CHAR5_LEN );
break;

default:
ret = INVALIDPARAMETER;
break;
}

return ( ret );
}

另外,SIMPLEPROFILE_CHAR5为什么是5bytes呢?其他都是1byte.

下划线这句话的意思应该是:

如果连接是加密的, 那么这个characteristic只能是只读, 另外意思是不能被写了.

换句话说, 如果连接没有加密, 那么这个characteristic不但能被读, 还能被写. 所以你这里可以被读.

这个5 bytes只是说这个characteristic的value有5个字节长而已, 没什么特别.

最后的5个bytes是不是可以存放任意我想要放的数据?

看上去是的

请问char5能用lightblue往里面写这个数组吗?如果可以?应该怎么写?

hongliang,

应该可以。
我记得,只要Lightblue能找到服务,就能通过write命令写数据进去吧? 

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

网站地图

Top