Quantcast
Channel: 蓝牙论坛 - 最近的话题
Viewing all articles
Browse latest Browse all 7485

CC2541通知GATT_Notification频率可以达到多快

$
0
0

我在SimpleBLEPeripheral.c的performPeriodicTask周期性的上报数据,当设置时间为每秒上报一次,可以正常上报数据,但是当设置上报时间间隔为100ms的时候,上报一小会儿,就直接死机了,请问这个应该是什么问题啊?其实我是希望每10ms上报一次数据的。

下面是上报函数代码:

static uint8 commDataNoti(uint8 *buf,uint16 len)
{
gattAttribute_t *pAttr;
attHandleValueNoti_t noti;
uint16 sendOffset = 0;
uint8 rtnVal = FAILURE;

pAttr = ColaProfileGetAttr();
noti.handle = pAttr->handle;

//循环发送
while(sendOffset < len)
{
uint16 nlen = ((len - sendOffset) > 20) ? 20 : (len - sendOffset);
noti.pValue = (uint8 *)GATT_bm_alloc( 0, ATT_HANDLE_VALUE_NOTI,
GATT_MAX_MTU, &nlen );
noti.len = nlen;
if(noti.pValue != NULL)
{
osal_memcpy(noti.pValue,buf + sendOffset,nlen);
if(!GATT_Notification(0,&noti,FALSE))
{
sendOffset += nlen;
rtnVal = SUCCESS;
}
else
{
rtnVal = FAILURE;
GATT_bm_free((gattMsg_t *)&noti, ATT_HANDLE_VALUE_NOTI);
}
}
}

return rtnVal;
}

请各位大神帮忙分析一下,问题出在哪里?


Viewing all articles
Browse latest Browse all 7485

Trending Articles