你好我使用notfy快速传输数据:
{
VOID memcpy( simpleProfileChar4, value, SIMPLEPROFILE_CHAR4_LEN );
GATTServApp_ProcessCharCfg( simpleProfileChar4Config, simpleProfileChar4, FALSE,
simpleProfileAttrTbl, GATT_NUM_ATTRS( simpleProfileAttrTbl ),
INVALID_TASK_ID, simpleProfile_ReadAttrCB );
}
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> ICALL TIMEOUT!");
HAL_ASSERT_SPINLOCK;
break
Viki Shi:
发送频繁了,内存分配不过来就有可能卡死,已在 下面帖子回复,请勿重复发帖e2echina.ti.com/…/596898
yekun kun:
回复 Viki Shi:
有没有notfly 的相关程序,我觉得按下面这样操作notlfy不太好,为什么不判断是否连接等VOID memcpy( simpleProfileChar4, value, SIMPLEPROFILE_CHAR4_LEN );// See if Notification has been enabledGATTServApp_ProcessCharCfg( simpleProfileChar4Config, simpleProfileChar4, FALSE,simpleProfileAttrTbl, GATT_NUM_ATTRS( simpleProfileAttrTbl ),INVALID_TASK_ID, simpleProfile_ReadAttrCB );
Viki Shi:
回复 yekun kun:
如果要确保对方收到,建议不要用notify,换用indication,有确认机制
yekun kun:
回复 Viki Shi:
你好,我notfly 为什么在距离过长的时候断开,一般都直接报TIME_out ;
bStatus_t ServApp_SendNotiInd( uint8_t *nvalue,uint16_t nlen){ attHandleValueNoti_t noti; uint16_t slen; bStatus_t status; slen = nlen; gattCharCfg_t *pItem = simpleProfileChar4Config;
if ( pItem->connHandle != CONNHANDLE_INVALID) { noti.pValue = (uint8 *)GATT_bm_alloc( pItem->connHandle, ATT_HANDLE_VALUE_NOTI,slen,&slen);// GATT_MAX_MTU, &slen ); if ( noti.pValue != NULL ) //申请到了地址。=NULL说明没申请到地址 { noti.handle = simpleProfileAttrTbl[11].handle; noti.len = slen; memcpy(noti.pValue, nvalue, slen);
status = GATT_Notification( pItem->connHandle, ¬i, FALSE );
if ( status != SUCCESS ) { GATT_bm_free( (gattMsg_t *)¬i, ATT_HANDLE_VALUE_NOTI ); } } else { GATT_bm_free( (gattMsg_t *)¬i, ATT_HANDLE_VALUE_NOTI ); status = bleNoResources; } }
return ( status );}
报申请内存不成功indication速度快吗,有没有相关的例程
Viki Shi:
回复 yekun kun:
速度是notify比较快,但是发的快了对方每来得及收,数据可能会被后面的冲掉,而indication可确认对方是否收到,看你自己取舍了。下面这个例程用到了indication:http://dev.ti.com/tirex/explore/node?node=ABLh-budrPNNeEoULdAnRg__KbOGwol__LATEST
yekun kun:
回复 Viki Shi:
谢谢,目前还想尝试一下notfly ,我使用的oad offchip 例程,包越小越稳定,我由原来的184,换成64 数据 mtu ,数据比比原来稳定一些,长距离断线试了十几次没有死机,很烦恼啊