终端与协调器均不指定PANID,信道相同,之前遇到过一个终端只会对一个协调器发送beacon,第二个协调器似乎不会收到,请问终端的入网beacon不是广播的吗?如何让终端做到对某个协调器请求次数过多时放弃对其入网请求
Alvin Chen:
如何让终端做到对某个协调器请求次数过多时放弃对其入网请求:
ZED /ZR 发送的是beacon request ZC/ZR回复的是beacon
你可以在beacon 的处理函数上相想办法:
/***************************************************************************** @fnZDApp_beaconIndProcessing** @briefThis function processes the incoming beacon indication.**When another task (MT or App) is registered to process*beacon indication themselves, this function will parse the*beacon payload and pass the beacon descriptor to that task*If no other tasks registered, this function will process*the beacon payload and generate the network descriptor link*list.** @param** @returnnone**/ void ZDO_beaconNotifyIndCB( NLME_beaconInd_t *pBeacon ) {// Pass the beacon Indication to another task if it registers the callback// Otherwise, process the beacon notification here.if (zdoCBFunc[ZDO_BEACON_NOTIFY_IND_CBID] != NULL ){zdoCBFunc[ZDO_BEACON_NOTIFY_IND_CBID]( (void*)pBeacon );}else{networkDesc_t *pNwkDesc;networkDesc_t *pLastNwkDesc;uint8 found = false;// Add the network to the Network Descriptor ListpNwkDesc = NwkDescList;pLastNwkDesc = NwkDescList;while (pNwkDesc){if ((pNwkDesc->panId == pBeacon->panID) &&(pNwkDesc->logicalChannel == pBeacon->logicalChannel)){found = true;break;}pLastNwkDesc = pNwkDesc;pNwkDesc = pNwkDesc->nextDesc;}// If no existing descriptor found, make a new one and add to the listif (found == false){pNwkDesc = MAP_osal_mem_alloc( sizeof(networkDesc_t));if ( !pNwkDesc ){// Memory alloc failed, discard this beaconreturn;}// Clear the network descriptorMAP_osal_memset( pNwkDesc, 0, sizeof(networkDesc_t));// Initialize the descriptorpNwkDesc->chosenRouter = INVALID_NODE_ADDR;pNwkDesc->chosenRouterDepth = 0xFF;// Save new entry into the descriptor listif ( !NwkDescList ){NwkDescList = pNwkDesc;}else{pLastNwkDesc->nextDesc = pNwkDesc;}}// Update the descriptor with the incoming beaconpNwkDesc->stackProfile= pBeacon->stackProfile;pNwkDesc->version= pBeacon->protocolVersion;pNwkDesc->logicalChannel = pBeacon->logicalChannel;pNwkDesc->panId= pBeacon->panID;pNwkDesc->updateId= pBeacon->updateID;// Save the extended PAN ID from the beacon payload only if 1.1 version networkif ( pBeacon->protocolVersion != ZB_PROT_V1_0 ){osal_cpyExtAddr( pNwkDesc->extendedPANID, pBeacon->extendedPanID );}else{MAP_osal_memset( pNwkDesc->extendedPANID, 0xFF, Z_EXTADDR_LEN );}// check if this device is a better choice to join...// ...dont bother checking assocPermit flag is doing a rejoinif ( ( pBeacon->LQI > gMIN_TREE_LQI ) &&( ( pBeacon->permitJoining == TRUE ) || ( bdb_isDeviceNonFactoryNew() ) ) ){uint8 selected = FALSE;uint8 capacity = FALSE;if ( ((pBeacon->LQI> pNwkDesc->chosenRouterLinkQuality) &&(pBeacon->depth < MAX_NODE_DEPTH)) ||((pBeacon->LQI== pNwkDesc->chosenRouterLinkQuality) &&(pBeacon->depth < pNwkDesc->chosenRouterDepth)) ){selected = TRUE;}if ( ZSTACK_ROUTER_BUILD ){capacity = pBeacon->routerCapacity;}else if ( ZSTACK_END_DEVICE_BUILD ){capacity = pBeacon->deviceCapacity;}if ( ( (capacity) || ( pBeacon->sourceAddr == _NIB.nwkCoordAddress ) ) && (selected) ){// this is the new chosen router for joining...pNwkDesc->chosenRouter= pBeacon->sourceAddr;pNwkDesc->chosenRouterLinkQuality = pBeacon->LQI;pNwkDesc->chosenRouterDepth= pBeacon->depth;}if ( pBeacon->deviceCapacity )pNwkDesc->deviceCapacity = 1;if ( pBeacon->routerCapacity )pNwkDesc->routerCapacity = 1;}} }
user4587069:
回复 Alvin Chen:
你好 在协调器端能控制beacon的回应吗,具体是哪个api,如果每个终端发送特定的beacon request,协调器对数据进行校验后来回应beacon,这样的想法是否可行。。现在的项目需求是不允许自组网。想根据mac地址进行过滤组网
YiKai Chen:
回复 user4587069:
协调器端不能控制beacon的回应
user4587069:
回复 YiKai Chen:
需求有些违背zigbee组网方式,但是这种需求还是有的,之前有实现的案例吗
user4587069:
回复 user4587069:
或者我升级到3.0协议栈能否实现
YiKai Chen:
回复 user4587069:
聽過很多人想要這樣作,但是沒聽過有实现的案例