CC2640R2F 主机向从机怎么发送数据

举人 1100 points

CC2640R2F 主机怎么向从机发送数据 , 有函数接口吗?

我用下面的程序发送数据, 很容易出现发送失败. 这个程序发送数据有时间间隔要求吗?

attWriteReq_t att;
att.pValue = GATT_bm_alloc(charHdl, ATT_WRITE_REQ, sendstrlen[sendcount % MAXSENDSIZE], NULL);
if(att.pValue != NULL)
{
att.handle = charHdl;
att.len = sendstrlen[sendcount % MAXSENDSIZE];
osal_memcpy(att.pValue, sendstr[sendcount % MAXSENDSIZE], sendstrlen[sendcount % MAXSENDSIZE]);
att.sig = 0;
att.cmd = 0;

if(GATT_WriteCharValue(connHandle, &att, selfEntity) == SUCCESS)
{
#ifdef USER_DEBUGUART
UART_Send(sendstr[sendcount % MAXSENDSIZE], sendstrlen[sendcount % MAXSENDSIZE]);
#endif
DeleteSendString();
}
else
{
GATT_bm_free((gattMsg_t *)&att, ATT_WRITE_REQ);
}
}

28 个回复