Zigbee coordinator network management
We have a Zigbee network, working as a coordinator, and we want to know which devices are connected. In order to know which devices are connected, we use this code:
while (ZbNwkGetIndex(zigbee_app_info.zb, ZB_NWK_NIB_ID_NeighborTable, &neighbor, sizeof(neighbor), i++) == ZB_NWK_STATUS_SUCCESS)
{
if (neighbor.relationship == ZB_NWK_NEIGHBOR_REL_CHILD)
{
neigbors.device[neigbors.length].mac = neighbor.extAddr;
neigbors.device[neigbors.length].address = neighbor.nwkAddr;
neigbors.length++;
if (neigbors.length >= MAX_DEVICES)
break;
}
}
And in order to remove a device from the network, we use this code:
req.destAddr = device->address;
req.deviceAddr = device->mac;
req.flags = ZB_ZDO_MGMT_NWK_LEAVE_FLAG_REMOVE_CHILDREN;
status = ZbZdoLeaveReq(zigbee_app_info.zb, &req, NULL, NULL);
But several times, after remove a device, the device is still in the neighbor table.
What's wrong? We should handle the network in other ways? Which is the best way to know which devices are connected? And to remove a device?
Thank you!!
