BOOL radioSend(BYTE* transmitData, WORD dataLength, BYTE remoteAddress, BYTE doAck)
{
WORD sent = 0;//发送字节数
BOOL status = TRUE;//状态标志位
WORD remaining;//剩余字节
BYTE retries;
BYTE res;
//数据目的地址赋值
txData.destAddress = remoteAddress;
//标志位赋值
txData.flags = doAck;
while((sent < dataLength) && (status == TRUE))
{
retries = ACK_RETRIES;// #define ACK_RETRIES 3
//添加数据量
txData.payload = transmitData + sent;
remaining = dataLength-sent;
if(remaining > SPP_MAX_PAYLOAD_LENGTH)
// #defineSPP_MAX_PAYLOAD_LENGTH 122
{
txData.payloadLength = SPP_MAX_PAYLOAD_LENGTH;
sent += SPP_MAX_PAYLOAD_LENGTH;
}
else
{
txData.payloadLength = dataLength;
sent += dataLength;
}
文章评论(0条评论)
登录后参与讨论