Thread 中讨论的其他器件:Z-stack
工具与软件:
我已经尝试修正了这样的 SDK 代码。 它有时起作用、有时不起作用。
uint16_t afRtgDstAddress = INVALID_NODE_ADDR;
afStatus_t AF_DataRequest(...)
{
....
if((req.dstAddr.addrMode == Addr16Bit) && (!(req.txOptions & APS_TX_OPTIONS_SKIP_ROUTING)))
{
afRtgDstAddress = req.dstAddr.addr.shortAddr;
}
if (len > afDataReqMTU( &mtu ) )
{
if (apsfSendFragmented)
{
stat = (*apsfSendFragmented)( &req );
}
else
{
stat = afStatus_INVALID_PARAMETER;
}
}
else
{
stat = APSDE_DataReq( &req );
}
afRtgDstAddress = INVALID_NODE_ADDR;
...
}
uint8_t afDataReqMTU( afDataReqMTU_t* fields )
{
uint8_t len;
uint8_t hdr;
if ( fields->kvp == TRUE )
{
hdr = AF_HDR_KVP_MAX_LEN;
}
else
{
hdr = AF_HDR_V1_1_MAX_LEN;
}
len = (uint8_t)(APSDE_DataReqMTU(&fields->aps) - hdr);
//match rtg table to recalculate MTU, fixed by luoyiming 2025-01-04
if( zgConcentratorEnable && (afRtgDstAddress != INVALID_NODE_ADDR) )
{
uint8_t relayCnt = 0;
uint16_t *relayList = NULL;
if ( (RTG_GetRtgSrcEntry(afRtgDstAddress, &relayCnt, &relayList) == RTG_SUCCESS) && (relayCnt > 0) )
{
len -= 2 + relayCnt * sizeof(uint16_t);
}
}
return len;
}