设置一个已知PANID网络,让sensor,主动加入
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
动态?是可以的,不过你需要HOLD_START,禁止上电自动入网扫网。
试着动态修改如下应该可以实现
Public function defined in cllc.h */ void Cllc_init(ApiMac_callbacks_t *pMacCbs, Cllc_callbacks_t *pCllcCbs) { uint16_t panId = CONFIG_PAN_ID; /* Initialize coordinator PAN ID if a valid value is defined in config */ if((panId != 0x0000) && (panId != CLLC_INVALID_PAN)) { coordInfoBlock.panID = panId; }
。。。。。。。
如果sensor 是被collector 踢出会进到
static void jdllcDisassocIndCb(ApiMac_sAddrExt_t *pExtAddress, ApiMac_disassocateReason_t reason) { /* Stop the reporting timer */ Ssf_setReadingClock(0); Ssf_clearNetworkInfo(); #ifdef FEATURE_NATIVE_OAD /* OAD abort with no auto resume */ OADClient_abort(false); #endif //FEATURE_NATIVE_OAD }
也就是会clear networkinfo。
如果是主动退出调用如下;
Send disassociation request. Public function defined in jdllc.h */ void Jdllc_sendDisassociationRequest(void) { ApiMac_mlmeDisassociateReq_t disassocReq; /* Zero-init the data strcture * set up the sec field: no security * */ memset(&disassocReq,0x00, sizeof(disassocReq)); if(CONFIG_FH_ENABLE && CONFIG_RX_ON_IDLE) { disassocReq.deviceAddress.addrMode = ApiMac_addrType_extended; Util_copyExtAddr(&disassocReq.deviceAddress.addr.extAddr, &devInfoBlock.coordExtAddr); } else { disassocReq.deviceAddress.addrMode = ApiMac_addrType_short; disassocReq.deviceAddress.addr.shortAddr = devInfoBlock.coordShortAddr; } disassocReq.devicePanId = devInfoBlock.panID; disassocReq.disassociateReason = ApiMac_disassocateReason_device; disassocReq.txIndirect = false; ApiMac_mlmeDisassociateReq(&disassocReq); }
也会清掉network info。
collector的信道CONFIG_CHANNEL_MASK{03}是可以在信道0或1組網,你先確認collector是在信道0還是1,不然就是把collector的信道設置為CONFIG_CHANNEL_MASK{0x02},這樣collector就一定是在信道1組網,你在測試看看