当协调器已经创建了一个网络后,如果我再使用“network form ……”来为它再次创建网络,这时创建是不成功的,返回值为0x70。
若要再次创建新的网络,则需要提前执行“network leave”指令。
那么,我想请教的是,协调器如何判断自己已经创建过网络呢?我想通过判断条件来确定是否给协调器再次创建网络,而不是通过再次创建发现不成功才知道协调器
已经创建了网络。
谢谢!
VV:
你可以判断设备的devState
typedef enum{ DEV_HOLD, // Initialized – not started automatically DEV_INIT, // Initialized – not connected to anything DEV_NWK_DISC, // Discovering PAN's to join DEV_NWK_JOINING, // Joining a PAN DEV_NWK_SEC_REJOIN_CURR_CHANNEL, // ReJoining a PAN in secure mode scanning in current channel, only for end devices DEV_END_DEVICE_UNAUTH, // Joined but not yet authenticated by trust center DEV_END_DEVICE, // Started as device after authentication DEV_ROUTER, // Device joined, authenticated and is a router DEV_COORD_STARTING, // Started as Zigbee Coordinator DEV_ZB_COORD, // Started as Zigbee Coordinator DEV_NWK_ORPHAN, // Device has lost information about its parent.. DEV_NWK_KA, // Device is sending KeepAlive message to its parent DEV_NWK_BACKOFF, // Device is waiting before trying to rejoin DEV_NWK_SEC_REJOIN_ALL_CHANNEL, // ReJoining a PAN in secure mode scanning in all channels, only for end devices DEV_NWK_TC_REJOIN_CURR_CHANNEL, // ReJoining a PAN in Trust center mode scanning in current channel, only for end devices DEV_NWK_TC_REJOIN_ALL_CHANNEL // ReJoining a PAN in Trust center mode scanning in all channels, only for end devices} devStates_t;