afDataReqMTU()基于 输入参数可以发送字节数的最大值
Posted 马小跳life
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了afDataReqMTU()基于 输入参数可以发送字节数的最大值相关的知识,希望对你有一定的参考价值。
在API的手册中可以看出,
根据此函数,能读取最大有效载荷的大小;
ti论坛的解释:
The maximum payload size for an application is based on several factors. The MAC layer provides a constant payload length of 116 (can be changed in f8wConfig.cfg – MAC_MAX_FRAME_SIZE). The NWK layer requires a fixed header size, one size with security and one without security. The APS layer has a required, but variable,header size based on a variety of settings, including the ZigBee Protocol Version, APS frame control settings, etc.
Ultimately, the user does not have to calculate the maximum payload size using the aforementioned factors. The AF module provides an API that allows the user to query the stack for the maximum payload size, or the maximum transport unit (MTU). The user can call the function, “afDataReqMTU” (see “af.h”) which will return the MTU, or maximum payload size
自己实测:
int a=512; char temp[3]; afDataReqMTU_t *pafData; afDataReqMTU_t afData; afData.kvp=0; afData.aps.secure=0; *pafData=afData; a=afDataReqMTU(pafData); sprintf(temp, (const char *)"%d",a); MT_UartInit (); MT_UartRegisterTaskID(task_id);//注册串口任务 HalUARTWrite(0,(unsigned char *)&temp[0],4); //发送数据
利用串口发送,数据最大载荷为99.
以上是关于afDataReqMTU()基于 输入参数可以发送字节数的最大值的主要内容,如果未能解决你的问题,请参考以下文章