TI_MAC 1.51 void MAC_CbackEvent(macCbackEvent_t *pData)
来源:互联网 发布:詹姆斯全明星mvp数据 编辑:程序博客网 时间:2024/06/05 12:41
/************************************************************************************************** * * @fn MAC_CbackEvent * * @brief This callback function sends MAC events to the application. * The application must implement this function. A typical * implementation of this function would allocate an OSAL message, * copy the event parameters to the message, and send the message * to the application's OSAL event handler. This function may be * executed from task or interrupt context and therefore must * be reentrant. * * @param pData - Pointer to parameters structure. * * @return None. * **************************************************************************************************/void MAC_CbackEvent(macCbackEvent_t *pData){ macCbackEvent_t *pMsg = NULL; uint8 len = msa_cbackSizeTable[pData->hdr.event]; switch (pData->hdr.event) { case MAC_MLME_BEACON_NOTIFY_IND: len += sizeof(macPanDesc_t) + pData->beaconNotifyInd.sduLength + MAC_PEND_FIELDS_LEN(pData->beaconNotifyInd.pendAddrSpec); if ((pMsg = (macCbackEvent_t *) osal_msg_allocate(len)) != NULL) { /* Copy data over and pass them up */ osal_memcpy(pMsg, pData, sizeof(macMlmeBeaconNotifyInd_t)); pMsg->beaconNotifyInd.pPanDesc = (macPanDesc_t *) ((uint8 *) pMsg + sizeof(macMlmeBeaconNotifyInd_t)); osal_memcpy(pMsg->beaconNotifyInd.pPanDesc, pData->beaconNotifyInd.pPanDesc, sizeof(macPanDesc_t)); pMsg->beaconNotifyInd.pSdu = (uint8 *) (pMsg->beaconNotifyInd.pPanDesc + 1); osal_memcpy(pMsg->beaconNotifyInd.pSdu, pData->beaconNotifyInd.pSdu, pData->beaconNotifyInd.sduLength); } break; case MAC_MCPS_DATA_IND: pMsg = pData; break; default: if ((pMsg = (macCbackEvent_t *) osal_msg_allocate(len)) != NULL) { osal_memcpy(pMsg, pData, len); } break; } if (pMsg != NULL) { osal_msg_send(MSA_TaskId, (uint8 *) pMsg); }}
描述:这个回调函数发送MAC事件到应用程序。应用程序必须执行这个函数。这个函数的典型执行是分配一个OSAL信息,复制事件参数到该信息中,并发送该信息到应用程序的OSAL事件处理器。这个函数可以在任务或者中断的环境下执行,因此必须是可重新进入的。
详细参数:
/* Union of callback structures */typedef union{ macEventHdr_t hdr; macMlmeAssociateInd_t associateInd; /* MAC_MLME_ASSOCIATE_IND */ macMlmeAssociateCnf_t associateCnf; /* MAC_MLME_ASSOCIATE_CNF */ macMlmeDisassociateInd_t disassociateInd; /* MAC_MLME_DISASSOCIATE_IND */ macMlmeDisassociateCnf_t disassociateCnf; /* MAC_MLME_DISASSOCIATE_CNF */ macMlmeBeaconNotifyInd_t beaconNotifyInd; /* MAC_MLME_BEACON_NOTIFY_IND */ macMlmeOrphanInd_t orphanInd; /* MAC_MLME_ORPHAN_IND */ macMlmeScanCnf_t scanCnf; /* MAC_MLME_SCAN_CNF */ macMlmeStartCnf_t startCnf; /* MAC_MLME_START_CNF */ macMlmeSyncLossInd_t syncLossInd; /* MAC_MLME_SYNC_LOSS_IND */ macMlmePollCnf_t pollCnf; /* MAC_MLME_POLL_CNF */ macMlmeCommStatusInd_t commStatusInd; /* MAC_MLME_COMM_STATUS_IND */ macMlmePollInd_t pollInd; /* MAC_MLME_POLL_IND */ macMcpsDataCnf_t dataCnf; /* MAC_MCPS_DATA_CNF */ macMcpsDataInd_t dataInd; /* MAC_MCPS_DATA_IND */ macMcpsPurgeCnf_t purgeCnf; /* MAC_MCPS_PURGE_CNF */} macCbackEvent_t;/* MAC event header type */typedef struct{ uint8 event; /* MAC event */ uint8 status; /* MAC status */} macEventHdr_t;
/* Size table for MAC structures */const CODE uint8 msa_cbackSizeTable [] ={ 0, /* unused */ sizeof(macMlmeAssociateInd_t), /* MAC_MLME_ASSOCIATE_IND */ sizeof(macMlmeAssociateCnf_t), /* MAC_MLME_ASSOCIATE_CNF */ sizeof(macMlmeDisassociateInd_t), /* MAC_MLME_DISASSOCIATE_IND */ sizeof(macMlmeDisassociateCnf_t), /* MAC_MLME_DISASSOCIATE_CNF */ sizeof(macMlmeBeaconNotifyInd_t), /* MAC_MLME_BEACON_NOTIFY_IND */ sizeof(macMlmeOrphanInd_t), /* MAC_MLME_ORPHAN_IND */ sizeof(macMlmeScanCnf_t), /* MAC_MLME_SCAN_CNF */ sizeof(macMlmeStartCnf_t), /* MAC_MLME_START_CNF */ sizeof(macMlmeSyncLossInd_t), /* MAC_MLME_SYNC_LOSS_IND */ sizeof(macMlmePollCnf_t), /* MAC_MLME_POLL_CNF */ sizeof(macMlmeCommStatusInd_t), /* MAC_MLME_COMM_STATUS_IND */ sizeof(macMcpsDataCnf_t), /* MAC_MCPS_DATA_CNF */ sizeof(macMcpsDataInd_t), /* MAC_MCPS_DATA_IND */ sizeof(macMcpsPurgeCnf_t), /* MAC_MCPS_PURGE_CNF */ sizeof(macEventHdr_t), /* MAC_PWR_ON_CNF */ sizeof(macMlmePollInd_t) /* MAC_MLME_POLL_IND */};
0 0
- TI_MAC 1.51 void MAC_CbackEvent(macCbackEvent_t *pData)
- void *pdata的理解分析
- MSA_AssociateRsp((macCbackEvent_t*)pMsg);
- jsoncpp用法(判断void* pData是否为json格式的字符串)
- pdata= pdata 防止编译警告
- void *
- void
- void
- void
- void
- void
- void*
- void
- void
- void
- void
- void
- void
- 二叉树的遍历
- 提搞网站访问速度可做的优化-------转载自熊哥的博客
- linux进程间通信之信号量
- 六款值得推荐的android(安卓)开源框架简介
- 【毕业设计day03】疑难攻克
- TI_MAC 1.51 void MAC_CbackEvent(macCbackEvent_t *pData)
- leetcode Add Binary
- linux进程间通信之共享内存
- 面试必备的9大成功秘诀
- AS3 移动设备上的触控事件和手势
- 【Oracle 64bit】win7x64 VS2012调试 提示ORA-12154
- ps
- 我的Appium学习之路
- Android_ProgressBar(第一季重制版)