MSA_AssociateRsp((macCbackEvent_t*)pMsg);
来源:互联网 发布:soda上海开放大数据 编辑:程序博客网 时间:2024/06/05 11:20
/************************************************************************************************** * * @fn MSA_AssociateRsp() * * @brief This routine is called by Associate_Ind inorder to return the response to the device * * @param pMsg - pointer to the structure recieved by MAC_MLME_ASSOCIATE_IND * * @return None msa_NumOfDevices * **************************************************************************************************/uint8 MSA_AssociateRsp(macCbackEvent_t* pMsg){ uint8 i, addrFlag = 0, rt = 0, curFlag = 0; bool isNeedNewAddr = TRUE; uint16 assocShortAddress = 0xffff; for(i = 0; i < MSA_MAX_DEVICE_NUM; i++) //限定数量 { if(msa_DeviceRecord[i].devShortAddr != 0) //存储这一层给下一层分配的地址 { /* compare the two mac address to avoid the waste of short address */ if(sAddrExtCmp(msa_DeviceRecord[i].devMacAddr, pMsg->associateInd.deviceAddress)) { /* Assign the short address for the Device, from pool */ assocShortAddress = msa_DevShortAddrList[i]; break; } curFlag++; } /* record the first free address */ else { /* save the first free space */ if(isNeedNewAddr) { addrFlag = i; isNeedNewAddr = FALSE; } /* if we reach the current number of device and still can't find duplicate device, then break the loop */ if(curFlag >= msa_NumOfDevices) { break; } } }/* end for */ /* assign a new short address to the device */ if(!isNeedNewAddr) { /* Assign the short address for the Device, from pool */ assocShortAddress = msa_DevShortAddrList[addrFlag]; /* Build the record for this device */ msa_DeviceRecord[addrFlag].devShortAddr = msa_DevShortAddrList[addrFlag]; sAddrExtCpy(msa_DeviceRecord[addrFlag].devMacAddr, pMsg->associateInd.deviceAddress); msa_DeviceRecord[addrFlag].dsn = 0; msa_DeviceRecord[addrFlag].checkCount = 0; rt = addrFlag; msa_NumOfDevices++; } /* If the number of devices are more than MAX_DEVICE_NUM, turn off the association permit */ if (msa_NumOfDevices == MSA_MAX_DEVICE_NUM) { MAC_MlmeSetReq(MAC_ASSOCIATION_PERMIT, &msa_MACFalse); } /* Fill in association respond message */ sAddrExtCpy(msa_AssociateRsp.deviceAddress, pMsg->associateInd.deviceAddress); msa_AssociateRsp.assocShortAddress = assocShortAddress; msa_AssociateRsp.status = MAC_SUCCESS; msa_AssociateRsp.sec.securityLevel = MAC_SEC_LEVEL_NONE; /* Call Associate Response */ MAC_MlmeAssociateRsp(&msa_AssociateRsp); return rt;}
0 0
- MSA_AssociateRsp((macCbackEvent_t*)pMsg);
- CTrackThread::PreTranslateMessage(MSG* pMsg)
- CTrackThread::PreTranslateMessage(MSG* pMsg)
- PMSG类型究竟是什么意思"?
- TI_MAC 1.51 void MAC_CbackEvent(macCbackEvent_t *pData)
- jsp_project_/store//store/WebRoot/Pmsg
- 使用PreTranslateMessage(MSG* pMsg)截获键盘数字键
- 函数右括号错误! PreTranslateMessage(MSG* pMsg)未返回
- PreTranslateMessage(MSG* pMsg) 中 break 与return的区别
- WM_MOUSEWHEEL 在PreTranslateMessage(MSG* pMsg)中MSG 的说明
- 对话框不响应WM_KEYDOWN消息,可以通过重载BOOL PreTranslateMessage(MSG * pMsg)来实现
- 重写PreTranslateMessage(MSG* pMsg)遇到的问题--相应右键消息。隔一次响应一次,求解。
- MFC PreTranslateMessage(MSG* pMsg)中调用DoModal()模态窗口问题
- Ubuntu上搭建samba服务器
- PHP parse_ini_file 函数
- 移动游戏防作弊攻防战
- 如何打造一个伟大的产品7 - 产品使命验证法
- Android ListView从网络获取图片及文字显示
- MSA_AssociateRsp((macCbackEvent_t*)pMsg);
- 黑名单增删改
- 为什么C++支持函数重载
- rurntime常用函数
- C++stringstream的clear()清空误区
- c#条件结构(一)----bool型
- LeetCode 160. Intersection of Two Linked Lists
- Avro RPC 对比测试
- C编译器剖析_C语言的变参函数