//删除设备
NLME_LeaveReq_t req;
req.removeChildren = FALSE;
req.rejoin = FALSE;
req.silent = FALSE;
AddrMgrEntry_t addrEntry;
addrEntry.user = ADDRMGR_USER_DEFAULT;
addrEntry.index = 0;
if (AddrMgrEntryGet(&addrEntry))
{
req.extAddr = addrEntry.extAddr;
NLME_LeaveReq(&req);
/*
addrIndex = addrEntry.extAddr[0];
//将扩展地址最后一位无线发射做验证
//AssocRemove( addrEntry.extAddr);
*/
}
修改这个,终端可以实时接收数据,不设置协调器发送的数据终端设备无法接收
/*-DRFD_RCVC_ALWAYS_ON=FALSE*/
-DRFD_RCVC_ALWAYS_ON=TRUE
添加这个,协调器可以存储设备地址,如果不添加协调器重启后,路由无法接入网络
NV_RESTORE=1
NV存储数据
// NV Items Reserved for applications (user applications)
// 0x0201 ? 0x0FFF
#define ZCD_NV_USER_START 0x0201
if (SUCCESS == osal_nv_read(ZCD_NV_USER_START, 0, sizeof(struct Flash_Message_Param), &Flash_Message_Param_t))
{
if (Flash_Message_Param_t.head != 0xAABB)
{
Flash_Message_Param_t.head = 0xAABB;
Flash_Message_Param_t.device_type = DEVICE_TYPE_L;
osal_memcpy(&Flash_Message_Param_t.address[0], &aExtendedAddress[0], sizeof(aExtendedAddress));
osal_nv_write(ZCD_NV_USER_START, 0, sizeof(struct Flash_Message_Param), &Flash_Message_Param_t);
HalUARTWrite(0, "flash ok", sizeof("flash ok"));
}
}
zigbee ztack一些函数操作说明
于 2025-04-18 19:05:12 首次发布