This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
协议栈:Z-Stack 3.0.2
协调器:CC2538
终端:CC2530
问题描述:
1、我调用 AF_DataRequestSrcRtg() 函数,“RelayCnt”参数为 1,“RelayCnt”参数 “pRelayList” 参数为 “0xd5eb”,然后抓包看见发出去的包并没有使用“source route” 功能。
请问这是为什么?
2、请问 “AF_DataRequestSrcRtg()” 函数的 “RTG_AddSrcRtgEntry_Guaranteed()” 有什么作用?
afStatus_t AF_DataRequestSrcRtg( afAddrType_t *dstAddr, endPointDesc_t *srcEP,
uint16 cID, uint16 len, uint8 *buf, uint8 *transID,
uint8 options, uint8 radius, uint8 relayCnt, uint16* pRelayList )
{
uint8 status;
/* Add the source route to the source routing table */
status = RTG_AddSrcRtgEntry_Guaranteed( dstAddr->addr.shortAddr, relayCnt,
pRelayList );
if( status == RTG_SUCCESS)
{
/* Call AF_DataRequest to send the data */
status = AF_DataRequest( dstAddr, srcEP, cID, len, buf, transID, options, radius );
}
else if( status == RTG_INVALID_PATH )
{
/* The source route relay count is exceeding the network limit */
status = afStatus_INVALID_PARAMETER;
}
else
{
/* The guaranteed adding entry fails due to memory failure */
status = afStatus_MEM_FAIL;
}
return status;
}
调用 RTG_AddSrcRtgEntry_Guaranteed 保存的源路由表是保存到这里对吧:
#if defined ( ZIGBEEPRO ) || defined ( ZBIT )
rtgSrcEntry_t rtgSrcTable[MAX_RTG_SRC_ENTRIES];
uint16 rtgSrcRelayList[MAX_SOURCE_ROUTE];
#endif
那什么时候会删除?还会一直保存在这的吗?
如果调用 “RTG_AddSrcRtgEntry_Guaranteed()” 函数就只是更新源路由列表的话,那么我直接调用 “AF_DataRequest()” 也是会使用到源路由路径的咯?那上面那个建议不就不成立了?那返回状态为 “Source Route Failure” 的 “network status” 命令时,还是无法更新路径啊?
原贴:https://e2echina.ti.com/question_answer/wireless_connectivity/zigbee/f/104/t/176019
Alvin Chen 说:source route failure是你的链路不对,但是不会导致发送不到设备。如果已经证明你的加入的这个source record是无效的或者错误的,就没必要非要用这个错误路径去发。
对啊,那我该怎么发?这时候我直接调用 “AF_DataRequest()” 函数是不是也会经过这个路径发?
用了 “NLME_RouteDiscoveryRequest(dstAddr, MTO_ROUTE, 0x1E);” 重新寻找关于这个节点的 route request,它也不会返回 “route record” 吧?
Alvin Chen 说:举个简单的应用实例,你收到了很多个设备的route record通常是做一个数据库,然后进行查表比对而不是直接就去RTG_AddSrcRtgEntry_Guaranteed更新。当然你想是否上传到host还是收一个就去RTG_AddSrcRtgEntry_Guaranteed更新,这是你的自己应用决定的。
那每次调用 “AF_DataRequestSrcRtg()” 函数的时候也是要调用 “RTG_AddSrcRtgEntry_Guaranteed()” 进行更新的,如果会造成负荷的话,这样负荷会不会也是很重?
这个是抓包文件,抓包软件是 wireshark;网络密钥是:fd:e2:82:29:e3:be:48:b0:36:14:54:0f:3f:c4:51:53no enable soure route.rar
具体可以查看 501 行的读属性命令,是没有使能“source route”功能的,但是我查看了"rtgSrcTable []",“0xec7d”设备的条目为"relayCnt" 为1, "pRelayList" 为 "0x99e9"。而且我也是调用"relayCnt" 为1, "pRelayList" 为 "0x99e9"的“ Af_Data Request SrcRtg()”函数来进行发送的。但是还是没有使能“source route”功能。