z-stack 2.5
问题:使用ZDP_MgmtLeaveReq该函数后路由节点无法退出网络
描述如下:
网络由协调器、路由1、路由2组成
路由1连接协调器、路由2连接路由1
使用该函数后,路由2无法断开路由1
路由节点未使用NV_RESTORE
退网代码如下:
zAddrType_t leaveid;
uint8 *extaddr;
extaddr=pNwkAddrRsp->extAddr;
leaveid.addrMode=(afAddrMode_t) Addr16Bit;
leaveid.addr.shortAddr=pNwkAddrRsp->nwkAddr;
ZDP_MgmtLeaveReq(&leaveid,extaddr,1,0,0);
AssocRemove(pNwkAddrRsp->extAddr);
ZDApp_NVUpdate();
user4456207:
抓包文件
Alvin Chen:
回复 user4456207:
Try to enable the following two defines:#define ZDO_MGMT_LEAVE_REQUEST#define ZDO_MGMT_LEAVE_RESPONSE
user4456207:
回复 Alvin Chen:
您好,这两个功能在,协调器与路由节点中都有定义了。为什么还会出现这种情况呢?
Susan Yang:
回复 user4456207:
ZDP_MgmtLeaveReq(&leaveid,extaddr,1,0,0);第三个参数是1才会移除子设备
@fn ZDP_MgmtLeaveReq** @brief This builds and send a Mgmt_Leave_req message.** @param dstAddr – destination address of the message* IEEEAddr – IEEE adddress of device that is removed* RemoveChildren – set to 1 to remove the children of the* device as well. 0 otherwise.* Rejoin – set to 1 if the removed device should rejoinafterwards. 0 otherwise.** @return afStatus_t