/** * \fn scanCncnSmApp1Shot_ScrRequest * \brief Request the SCR for one-shot application scan * * Request the SCR for one-shot application scan. handle different results. * * \param hScanCncnClient - handle to the specific client object * \return None */ void scanCncnSmApp1Shot_ScrRequest (TI_HANDLE hScanCncnClient) { TScanCncnClient *pScanCncnClient = (TScanCncnClient*)hScanCncnClient; EScrClientRequestStatus eScrReplyStatus; EScePendReason eScrPendReason; /* request the SCR as application scan client, and act according to return status */ switch (eScrReplyStatus = scr_clientRequest (pScanCncnClient->hSCR, SCR_CID_APP_SCAN, SCR_RESOURCE_SERVING_CHANNEL, &eScrPendReason)) { case SCR_CRS_PEND: /* send a reject event to the SM */ TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnSmApp1Shot_ScrRequest: SCR pending, pend reason: %d.\n", eScrPendReason); pScanCncnClient->eScanResult = SCAN_CRS_SCAN_FAILED; genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_REJECT, hScanCncnClient); break; case SCR_CRS_RUN: /* send a run event to the SM */ TRACE0(pScanCncnClient->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnSmApp1Shot_ScrRequest: SCR acquired.\n"); genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_RUN, hScanCncnClient); break; default: TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_ERROR , "scanCncnSmApp1Shot_ScrRequest: SCR returned unrecognized status: %d.\n", eScrReplyStatus); /* Send a reject event to recover from this error */ pScanCncnClient->eScanResult = SCAN_CRS_SCAN_FAILED; genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_REJECT, hScanCncnClient); break; } }
/** * \fn Function declaration * \brief Function brief description goes here * * Function detailed description goes here * * \note Note is indicated here * \param Parameter name - parameter description * \param … * \return Return code is detailed here * \sa Reference to other relevant functions */ void sme_ReportConnStatus (TI_HANDLE hSme, mgmtStatus_e eStatusType, TI_UINT32 uStatusCode) { TSme *pSme = (TSme*)hSme; TRACE2(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ReportConnStatus: statusType = %d, uStatusCode = %d\n", eStatusType, uStatusCode); /* Act according to status */ switch (eStatusType) { /* connection was successful */ case STATUS_SUCCESSFUL: pSme->bAuthSent = TI_TRUE; genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_SUCCESS, hSme); break; case STATUS_ASSOC_REJECT: case STATUS_SECURITY_FAILURE: case STATUS_AP_DEAUTHENTICATE: case STATUS_AP_DISASSOCIATE: case STATUS_ROAMING_TRIGGER: case STATUS_AUTH_REJECT: /* Indicate the authentication and/or association was sent to the AP */ pSme->bAuthSent = TI_TRUE; /* keep the disassociation status and code, for sending event to user-mode */ pSme->tDisAssoc.eMgmtStatus = eStatusType; pSme->tDisAssoc.uStatusCode = uStatusCode; /* try to find the next connection candidate */ pSme->pCandidate = sme_Select (hSme); /* if the next connection candidate exists */ if (NULL != pSme->pCandidate) { genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme); } else { genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); } break; /* Note that in case of unspecified status we won't update the status. This is done since this function could be called twice */ /* for example: apConn called this function and than SME called conn_stop and this function is called again */ /* we use this status at SME, if != 0 means that assoc frame sent */ case STATUS_UNSPECIFIED: pSme->bAuthSent = TI_TRUE; genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); break; default: TRACE1(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ReportConnStatus: unknown statusType = %d\n", eStatusType); break; } }
/** * \fn scanCncnSmImmed1Shot_StartScan * \brief Request scan start from TWD for one-shot immediate scan * * Request scan start from TWD for one-shot immediate scan * * \param hScanCncnClient - handle to the specific client object * \return None */ void scanCncnSmImmed1Shot_StartScan (TI_HANDLE hScanCncnClient) { TScanCncnClient *pScanCncnClient = (TScanCncnClient*)hScanCncnClient; TI_BOOL bPsRequired, bTriggeredScan; TI_STATUS status; /* check whether enter PS is required - according to the roaming reason severity */ bPsRequired = apConn_isPsRequiredBeforeScan (pScanCncnClient->hApConn); bTriggeredScan = ((SCAN_TYPE_TRIGGERED_ACTIVE == pScanCncnClient->uScanParams.tOneShotScanParams.scanType) || (SCAN_TYPE_TRIGGERED_PASSIVE == pScanCncnClient->uScanParams.tOneShotScanParams.scanType) ? TI_TRUE : TI_FALSE); status = TWD_Scan (pScanCncnClient->hTWD, &(pScanCncnClient->uScanParams.tOneShotScanParams), SCAN_RESULT_TAG_IMMEDIATE, !bTriggeredScan, /* Triggered scan cannot be high priority */ TI_TRUE, TI_TRUE, (bPsRequired ? POWER_SAVE_ON : POWER_SAVE_KEEP_CURRENT), bPsRequired, NULL, NULL); /* call the scan SRV start scan */ if (TI_OK != status) { TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_ERROR , "scanCncnSmImmed1Shot_StartScan: TWD start scanreturned status %d, quitting immediate scan.\n", status); /* mark the return status */ pScanCncnClient->eScanResult = SCAN_CRS_SCAN_FAILED; /* could not start scan, send a scan complete event */ genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_SCAN_COMPLETE, hScanCncnClient); } }
/** * \fn scanCncnSmApp1Shot_StartScan * \brief Request scan start from TWD for one-shot application scan * * Request scan start from TWD for one-shot application scan * * \param hScanCncnClient - handle to the specific client object * \return None */ void scanCncnSmApp1Shot_StartScan (TI_HANDLE hScanCncnClient) { TScanCncnClient *pScanCncnClient = (TScanCncnClient*)hScanCncnClient; TScanCncn *pScanCncn = (TScanCncn*)pScanCncnClient->hScanCncn; TI_BOOL bPsRequired; TI_STATUS tStatus; /* if the STA is connected, it is rquired to enter PS before scan */ bPsRequired = (STA_CONNECTED == pScanCncn->eConnectionStatus ? TI_TRUE : TI_FALSE); /* call the TWD start scan - enter driver mode (PS) only if station is connected */ tStatus = TWD_Scan (pScanCncnClient->hTWD, &(pScanCncnClient->uScanParams.tOneShotScanParams), SCAN_RESULT_TAG_APPLICATION_ONE_SHOT, TI_FALSE, bPsRequired, TI_FALSE, POWER_SAVE_ON, /* this parameter is used only when driver mode requested */ bPsRequired, NULL, NULL); if (TI_OK != tStatus) { TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_ERROR , "scanCncnSmApp1Shot_StartScan: TWD returned status %d, quitting app scan.\n", tStatus); /* mark the return status */ pScanCncnClient->eScanResult = SCAN_CRS_SCAN_FAILED; /* could not start scan, send a scan complete event to reset the SM */ genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_SCAN_COMPLETE, hScanCncnClient); } }
void sme_SmEvent(TI_HANDLE hGenSm, TI_UINT32 uEvent, void* pData) { TSme *pSme = (TSme*)pData; TGenSM *pGenSM = (TGenSM*)hGenSm; TRACE2(pSme->hReport, REPORT_SEVERITY_INFORMATION, "sme_SmEvent: Current State = %d, sending event %d\n", (pGenSM->uCurrentState), (uEvent)); genSM_Event(pGenSM, uEvent, pData); }
/** * \fn sme_ReportApConnStatus * \brief Used by AP connection (and Soft-gemini) modules to report connection status * * Used by AP connection (and Soft-gemini) modules to report connection status * * \param hSme - handle to the SME object * \param eStatusType - connection status * \param uStatus code - extended status information (if available) * \return None * \sa sme_ReportConnStatus */ void sme_ReportApConnStatus (TI_HANDLE hSme, mgmtStatus_e eStatusType, TI_UINT32 uStatusCode) { TSme *pSme = (TSme*)hSme; TRACE2(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ReportApConnStatus: statusType = %d, uStatusCode = %d\n", eStatusType, uStatusCode); /* Act according to status */ switch (eStatusType) { /* SG re-select */ case STATUS_SG_RESELECT: pSme->bReselect = TI_TRUE; pSme->bConnectRequired = TI_TRUE; genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); break; /* shouldn't happen (not from AP conn) */ case STATUS_SUCCESSFUL: TRACE0(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ReportApConnStatus: received STATUS_SUCCESSFUL\n"); break; case STATUS_UNSPECIFIED: case STATUS_AUTH_REJECT: case STATUS_ASSOC_REJECT: case STATUS_SECURITY_FAILURE: case STATUS_AP_DEAUTHENTICATE: case STATUS_AP_DISASSOCIATE: case STATUS_ROAMING_TRIGGER: /* keep the disassociation status and code, for sending event to user-mode */ pSme->tDisAssoc.eMgmtStatus = eStatusType; pSme->tDisAssoc.uStatusCode = uStatusCode; genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); break; case STATUS_DISCONNECT_DURING_CONNECT: genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); break; default: TRACE1(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ReportApConnStatus: received unrecognized status: %d\n", eStatusType); } }
void smeSm_CheckStartConditions (TI_HANDLE hSme) { TSme *pSme = (TSme*)hSme; if ((TI_TRUE == pSme->bRunning) && (TI_TRUE == pSme->bRadioOn)) { /* send a start event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_START, hSme); } }
/** * \fn sme_Restart * \brief Called due to a paramter value change in site mgr. Triggers a disconnect. * * Called due to a paramter value change in site mgr. Triggers a disconnect. * * \param hSme - handle to the SME object * \param eReason - the reason for restarting the SME * \return None */ void sme_Restart (TI_HANDLE hSme) { TSme *pSme = (TSme*)hSme; TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Restart called.\n"); pSme->uScanCount = 0; genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); }
/** * \fn smeSm_Start * \brief Starts STA opeartion by moving SCR out of idle group and starting connection process * * Starts STA opeartion by moving SCR out of idle group and starting connection process * * \param hSme - handle to the SME object * \return None * \sa smeSm_Stop, sme_start */ void smeSm_Start (TI_HANDLE hSme) { TSme *pSme = (TSme*)hSme; /* set SCR group according to connection mode */ if (CONNECT_MODE_AUTO == pSme->eConnectMode) { scr_setGroup (pSme->hScr, SCR_GID_DRV_SCAN); } else { scr_setGroup (pSme->hScr, SCR_GID_APP_SCAN); } if ((TI_FALSE == pSme->bRadioOn) || (TI_FALSE == pSme->bRunning)) { /* Radio is off so send stop event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_STOP, hSme); } else if (TI_TRUE == pSme->bConnectRequired) { /* if connection was required, start the process */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme); } }
/** * \fn SME_Disconnect * \brief perform disconnect by clear the flag ConnectRequired and issue DISCONNECT event. * * \param hSme - handle to the SME object * \return None * \sa SME_ConnectRequired */ void SME_Disconnect (TI_HANDLE hSme) { TSme *pSme = (TSme*)hSme; pSme->bConnectRequired = TI_FALSE; /* turn off WSC PB mode */ pSme->bConstantScan = TI_FALSE; /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); }
/** * \fn SME_ConnectRequired * \brief start connection sequence by set the flag ConnectRequired and issue DISCONNECT event. * called by CommandDispatcher in OSE OS. * * \param hSme - handle to the SME object * \return None * \sa SME_Disconnect */ void SME_ConnectRequired (TI_HANDLE hSme) { TSme *pSme = (TSme*)hSme; pSme->bRadioOn = TI_TRUE; pSme->uScanCount = 0; pSme->bConnectRequired = TI_TRUE; /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); }
/** * \fn sme_Stop * \brief Stops the driver (shuts-down the radio) * * Stops the driver (shuts-down the radio) * * \param hSme - handle to the SME object * \param pCBFunc - callback function to be called when stop operation is doen * \param hCBHanlde - handle to supply to the callback function * \return None * \sa sme_Start */ void sme_Stop (TI_HANDLE hSme) { TSme *pSme = (TSme*)hSme; TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Stop called\n"); pSme->bRunning = TI_FALSE; /* mark that running flag is send a stop event to the SM */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_STOP, hSme); }
/** * \fn scanCncnSmDrvP_ScrRequest * \brief Request the SCR for periodic driver scan * * Request the SCR for periodic driver scan. Handle different results * * \param hScanCncnClient - handle to the specific client object * \return None */ void scanCncnSmDrvP_ScrRequest (TI_HANDLE hScanCncnClient) { TScanCncnClient *pScanCncnClient = (TScanCncnClient*)hScanCncnClient; EScrClientRequestStatus eScrReplyStatus; EScePendReason eScrPendReason; /* request the SCR as driver scan client, and act according to return status */ switch (eScrReplyStatus = scr_clientRequest( pScanCncnClient->hSCR, SCR_CID_DRIVER_FG_SCAN, SCR_RESOURCE_PERIODIC_SCAN, &eScrPendReason ) ) { case SCR_CRS_PEND: TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnSmAppP_ScrRequest: SCR pending, pend reason: %d.\n", eScrPendReason); /* check the pending reason */ if (SCR_PR_OTHER_CLIENT_ABORTING != eScrPendReason) { /* * send a reject event to the SM - would not scan if not in a different group or * another un-abortable client is running */ pScanCncnClient->eScanResult = SCAN_CRS_SCAN_FAILED; genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_REJECT, hScanCncnClient); } /* if the pending reason is another client aborting wait untill it finish abort */ break; case SCR_CRS_RUN: /* send a run event to the SM */ TRACE0(pScanCncnClient->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnSmAppP_ScrRequest: SCR acquired.\n"); genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_RUN, hScanCncnClient); break; default: TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_ERROR , "scanCncnSmAppP_ScrRequest: SCR returned unrecognized status: %d\n", eScrReplyStatus); /* Send a reject event to recover from this error */ pScanCncnClient->eScanResult = SCAN_CRS_SCAN_FAILED; genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_REJECT, hScanCncnClient); break; } }
/** * \fn scanCncnSmImmed1Shot_ScrRequest * \brief Request the SCR for one-shot immediate scan * * Request the SCR for one-shot immediate scan. Handle different results * * \param hScanCncnClient - handle to the specific client object * \return None */ void scanCncnSmImmed1Shot_ScrRequest (TI_HANDLE hScanCncnClient) { TScanCncnClient *pScanCncnClient = (TScanCncnClient*)hScanCncnClient; EScrClientRequestStatus eScrReplyStatus; EScePendReason eScrPendReason; /* request the SCR as immediate roaming client, and act according to return status */ switch (eScrReplyStatus = scr_clientRequest (pScanCncnClient->hSCR, SCR_CID_IMMED_SCAN, SCR_RESOURCE_SERVING_CHANNEL, &eScrPendReason)) { case SCR_CRS_PEND: TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnSmImmed1Shot_ScrRequest: SCR pending, pend Reason: %d.\n", eScrPendReason); /* check pend reason */ if ( SCR_PR_DIFFERENT_GROUP_RUNNING == eScrPendReason ) { /* send a reject event to the SM - will not scan if not in the correct group */ pScanCncnClient->eScanResult = SCAN_CRS_SCAN_FAILED; genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_REJECT, hScanCncnClient); } /* for other pending reasons wait untill current client finishes */ break; case SCR_CRS_RUN: /* send a run event to the SM */ TRACE0(pScanCncnClient->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnSmImmed1Shot_ScrRequest: SCR acquired.\n"); genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_RUN, hScanCncnClient); break; default: TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_ERROR , "scanCncnSmImmed1Shot_ScrRequest: SCR returned unrecognized status: %d.\n", eScrReplyStatus); pScanCncnClient->eScanResult = SCAN_CRS_SCAN_FAILED; /* Send a reject event to recover from this error */ genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_REJECT, hScanCncnClient); break; } }
/** * * roamingMngr_smEvent * * \b Description: * * Roaming Manager state machine transition function * * \b ARGS: * * I/O - currentState - current state in the state machine\n * I - event - specific event for the state machine\n * I - pData - Data for state machine action function\n * * \b RETURNS: * * TI_OK on success, TI_NOK otherwise. * * \sa */ TI_STATUS roamingMngr_smEvent(TI_UINT8 event, void* data) { roamingMngr_t *pRoamingMngr = (roamingMngr_t*)data; TRACE3(pRoamingMngr->hReport, REPORT_SEVERITY_INFORMATION, "roamingMngr_smEvent(). Mode(%d) ,currentState = %d, event=%d \n", pRoamingMngr->RoamingOperationalMode, *(pRoamingMngr->pCurrentState), event); genSM_Event (pRoamingMngr->hRoamingSm, (TI_UINT32)event, data); TRACE1(pRoamingMngr->hReport, REPORT_SEVERITY_INFORMATION, "roamingMngr_smEvent(). new State : %d \n", *(pRoamingMngr->pCurrentState)); return TI_OK; }
/** * \fn scanCncnSmImmed1Shot_StopScan * \brief Request scan stop from TWD for one-shot immediate scan * * Request scan stop from TWD for one-shot immediate scan * * \param hScanCncnClient - handle to the specific client object * \return None */ void scanCncnSmImmed1Shot_StopScan (TI_HANDLE hScanCncnClient) { TScanCncnClient *pScanCncnClient = (TScanCncnClient*)hScanCncnClient; TI_STATUS status; /* call the TWD stop scan */ status = TWD_StopScan (pScanCncnClient->hTWD, SCAN_RESULT_TAG_IMMEDIATE, pScanCncnClient->bSendNullDataOnStop, NULL, NULL); /* if stop scan operation failed, send a scan complete event to reset the SM */ if (TI_OK != status) { TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_ERROR , "scanCncnSmImmed1Shot_StopScan: status %d from TWD_StopScan, sending scan complete to SM\n", status); genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_SCAN_COMPLETE, hScanCncnClient); } }
/** * \fn scanCncnSmDrvP_StopScan * \brief Request scan stop from TWD for periodic driver scan * * Request scan stop from TWD for periodic driver scan * * \param hScanCncnClient - handle to the specific client object * \return None */ void scanCncnSmDrvP_StopScan (TI_HANDLE hScanCncnClient) { TScanCncnClient *pScanCncnClient = (TScanCncnClient*)hScanCncnClient; TI_STATUS status; /* call the TWD stop periodic scan */ status = TWD_StopPeriodicScan (pScanCncnClient->hTWD, SCAN_RESULT_TAG_DRIVER_PERIODIC, NULL, NULL); /* if stop scan operation failed, send a scan complete event to reset the SM */ if (TI_OK != status) { TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_ERROR , "scanCncnSmDrvP_StopScan: status %d from TWD_StopPeriodicScan, sending scan complete to SM\n", status); genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_SCAN_COMPLETE, hScanCncnClient); } }
/** * \fn sme_Start * \brief Starts SME operation * * Starts SME operation. Send probe request templates and send a start event to the SM. * Only the DrvMain module could & is call that function !!! * * \param hSme - handle to the SME object * \return None * \sa sme_Stop */ void sme_Start (TI_HANDLE hSme) { TSme *pSme = (TSme*)hSme; TRACE1(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Start: called, bRadioOn = %d\n", pSme->bRadioOn); pSme->bRunning = TI_TRUE; /* * call setDefaultProbeReqTemplate at sme_Start() due to the fact in order to set prob req template * all moudules need to be set already */ setDefaultProbeReqTemplate (pSme->hSiteMgr); /* if radio is on, start the SM */ if (TI_TRUE == pSme->bRadioOn) { genSM_Event (pSme->hSmeSm, SME_SM_EVENT_START, hSme); } }
/** * \fn scanCncnSmCont1Shot_StartScan * \brief Request scan start from TWD for one-shot continuous scan * * Request scan start from TWD for one-shot continuous scan * * \param hScanCncnClient - handle to the specific client object * \return None */ void scanCncnSmCont1Shot_StartScan (TI_HANDLE hScanCncnClient) { TScanCncnClient *pScanCncnClient = (TScanCncnClient*)hScanCncnClient; TI_STATUS status; /* call the TWD start scan function */ status = TWD_Scan (pScanCncnClient->hTWD, &(pScanCncnClient->uScanParams.tOneShotScanParams), SCAN_RESULT_TAG_CONTINUOUS, TI_FALSE, TI_TRUE, TI_FALSE, POWER_SAVE_ON, TI_TRUE, NULL, NULL); if (TI_OK != status) { TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_ERROR , "scanCncnSmCont1Shot_StartScan: TWD returned status %d, quitting continuous scan.\n", status); /* mark the return status */ pScanCncnClient->eScanResult = SCAN_CRS_SCAN_FAILED; /* could not start scan, send a scan complete event */ genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_SCAN_COMPLETE, hScanCncnClient); } }
/** * \fn scanCncnSmAppP_StartScan * \brief Request scan start from TWD for periodic application scan * * Request scan start from TWD for periodic application scan * * \param hScanCncnClient - handle to the specific client object * \return None */ void scanCncnSmAppP_StartScan (TI_HANDLE hScanCncnClient) { TScanCncnClient *pScanCncnClient = (TScanCncnClient*)hScanCncnClient; TScanCncn *pScanCncn = (TScanCncn*)pScanCncnClient->hScanCncn; TI_STATUS tStatus; /* call the TWD start scan */ tStatus = TWD_StartConnectionScan (pScanCncnClient->hTWD, &(pScanCncnClient->uScanParams.tPeriodicScanParams), SCAN_RESULT_TAG_APPLICATION_PEIODIC, pScanCncn->tInitParams.uDfsPassiveDwellTimeMs, NULL, NULL); if (TI_OK != tStatus) { TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_ERROR , "scanCncnSmAppP_StartScan: TWD returned status %d, quitting app scan.\n", tStatus); /* mark the return status */ pScanCncnClient->eScanResult = SCAN_CRS_SCAN_FAILED; /* could not start scan, send a scan complete event to reset the SM */ genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_SCAN_COMPLETE, hScanCncnClient); } }
/** * \fn scanCncnSmApp1Shot_StopScan * \brief Request scan stop from TWD for one-shot application scan * * Request scan stop from TWD for one-shot application scan * * \param hScanCncnClient - handle to the specific client object * \return None */ void scanCncnSmApp1Shot_StopScan (TI_HANDLE hScanCncnClient) { TScanCncnClient *pScanCncnClient = (TScanCncnClient*)hScanCncnClient; TScanCncn *pScanCncn = (TScanCncn*)pScanCncnClient->hScanCncn; TI_STATUS tStatus; /* call the TWD stop scan function */ if (pScanCncn->eConnectionStatus != STA_CONNECTED) { tStatus = TWD_StopScan (pScanCncnClient->hTWD, SCAN_RESULT_TAG_APPLICATION_ONE_SHOT, TI_FALSE, NULL, NULL); } else { tStatus = TWD_StopScan (pScanCncnClient->hTWD, SCAN_RESULT_TAG_APPLICATION_ONE_SHOT, pScanCncnClient->bSendNullDataOnStop, NULL, NULL); } /* if stop scan operation failed, send a scan complete event to reset the SM */ if (TI_OK != tStatus) { TRACE1(pScanCncnClient->hReport, REPORT_SEVERITY_ERROR , "scanCncnSmApp1Shot_StopScan: status %d from TWD_StopScan, sending scan complete to SM\n", tStatus); genSM_Event (pScanCncnClient->hGenSM, SCAN_CNCN_SM_EVENT_SCAN_COMPLETE, hScanCncnClient); } }
/** * \fn smeSm_Connect * \brief Starts a connection process with the selected network * * Starts a connection process with the selected network * * \param hSme - handle to the SME object * \return None * \sa smeSm_PreConnect, smeSm_ConnectSuccess */ void smeSm_Connect (TI_HANDLE hSme) { TSme *pSme = (TSme*)hSme; TI_STATUS tStatus; paramInfo_t *pParam; /* Sanity check - if no connection candidate was found so far */ if (NULL == pSme->pCandidate) { genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); } else { pParam = (paramInfo_t *)os_memoryAlloc(pSme->hOS, sizeof(paramInfo_t)); if (!pParam) { return; } /* set SCR group */ if (BSS_INFRASTRUCTURE == pSme->pCandidate->bssType) { scr_setGroup (pSme->hScr, SCR_GID_CONNECT); } /***************** Config Connection *************************/ pParam->paramType = CONN_TYPE_PARAM; if (BSS_INDEPENDENT == pSme->pCandidate->bssType) if (SITE_SELF == pSme->pCandidate->siteType) { pParam->content.connType = CONNECTION_SELF; } else { pParam->content.connType = CONNECTION_IBSS; } else pParam->content.connType = CONNECTION_INFRA; conn_setParam(pSme->hConn, pParam); os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t)); /* start the connection process */ tStatus = conn_start (pSme->hConn, CONN_TYPE_FIRST_CONN, sme_ReportConnStatus, hSme, TI_FALSE, TI_FALSE); } }
/** * \fn scanCncn_AppScanResultCB * \brief Scan result callback for application scan * * Scan result callback for application scan * * \param hScanCncn - handle to the scan concentrator object * \param status - the scan result status (scan complete, result received etc.) * \param frameInfo - a pointer to the structure holding all frame related info (in case a frame was received) * \param SPSStatus - a bitmap indicating on which channels scan was attempted (valid for SPS scan only!) * \return None */ void scanCncn_AppScanResultCB (TI_HANDLE hScanCncn, EScanCncnResultStatus status, TScanFrameInfo* frameInfo, TI_UINT16 SPSStatus) { TScanCncn *pScanCncn = (TScanCncn*)hScanCncn; TI_UINT32 statusData; /* forward all data to SME */ sme_AppScanResult (pScanCncn->hSme, status, frameInfo); switch (status) { case SCAN_CRS_RECEIVED_FRAME: /* Save the result in the app scan result table */ if (TI_OK != scanResultTable_UpdateEntry (pScanCncn->hScanResultTable, frameInfo->bssId, frameInfo)) { TRACE0(pScanCncn->hReport, REPORT_SEVERITY_WARNING , "scanCncn_AppScanResultCB, scanResultTable_UpdateEntry() failed\n"); } break; case SCAN_CRS_SCAN_COMPLETE_OK: TRACE1(pScanCncn->hReport, REPORT_SEVERITY_INFORMATION , "scanCncn_AppScanResultCB, received scan complete with status :%d\n", status); /* if OS scan is running */ if (TI_TRUE == pScanCncn->bOSScanRunning) { /* send a scan complete event to the OS scan SM. It will stabliza the table when needed */ genSM_Event (pScanCncn->hOSScanSm, SCAN_CNCN_OS_SM_EVENT_SCAN_COMPLETE, hScanCncn); } else { /* move the scan result table to stable state, clear it if no results were received */ scanResultTable_SetStableState (pScanCncn->hScanResultTable); /* mark that no app scan is running */ pScanCncn->eCurrentRunningAppScanClient = SCAN_SCC_NO_CLIENT; /* * The scan was finished, send a scan complete event to the user * (regardless of why the scan was completed) */ statusData = SCAN_STATUS_COMPLETE; /* Completed status */ EvHandlerSendEvent (pScanCncn->hEvHandler, IPC_EVENT_SCAN_COMPLETE, (TI_UINT8 *)&statusData, sizeof(TI_UINT32)); } break; case SCAN_CRS_SCAN_STOPPED: TRACE1(pScanCncn->hReport, REPORT_SEVERITY_INFORMATION , "scanCncn_AppScanResultCB, received scan complete with status :%d\n", status); /* if OS scan is running */ if (TI_TRUE == pScanCncn->bOSScanRunning) { /* send a scan complete event to the OS scan SM. It will stabliza the table when needed */ genSM_Event (pScanCncn->hOSScanSm, SCAN_CNCN_OS_SM_EVENT_SCAN_COMPLETE, hScanCncn); } else { /* move the scan result table to stable state, clear it if no results were received */ scanResultTable_SetStableState (pScanCncn->hScanResultTable); /* mark that no app scan is running */ pScanCncn->eCurrentRunningAppScanClient = SCAN_SCC_NO_CLIENT; /* * The scan was finished, send a scan complete event to the user * (regardless of why the scan was completed) */ statusData = SCAN_STATUS_STOPPED; /* Stopped status */ EvHandlerSendEvent (pScanCncn->hEvHandler, IPC_EVENT_SCAN_COMPLETE, (TI_UINT8 *)&statusData, sizeof(TI_UINT32)); } break; case SCAN_CRS_TSF_ERROR: case SCAN_CRS_SCAN_RUNNING: case SCAN_CRS_SCAN_FAILED: case SCAN_CRS_SCAN_ABORTED_HIGHER_PRIORITY: case SCAN_CRS_SCAN_ABORTED_FW_RESET: TRACE1(pScanCncn->hReport, REPORT_SEVERITY_INFORMATION , "scanCncn_AppScanResultCB, received scan complete with status :%d\n", status); /* if OS scan is running */ if (TI_TRUE == pScanCncn->bOSScanRunning) { /* send a scan complete event to the OS scan SM. It will stabliza the table when needed */ genSM_Event (pScanCncn->hOSScanSm, SCAN_CNCN_OS_SM_EVENT_SCAN_COMPLETE, hScanCncn); } else { /* move the scan result table to stable state, clear it if no results were received */ scanResultTable_SetStableState (pScanCncn->hScanResultTable); /* mark that no app scan is running */ pScanCncn->eCurrentRunningAppScanClient = SCAN_SCC_NO_CLIENT; /* * The scan was finished, send a scan complete event to the user * (regardless of why the scan was completed) */ statusData = SCAN_STATUS_FAILED; /* Failed status */ EvHandlerSendEvent (pScanCncn->hEvHandler, IPC_EVENT_SCAN_COMPLETE, (TI_UINT8 *)&statusData, sizeof(TI_UINT32)); } break; case SCAN_CRS_NUM_OF_RES_STATUS: default: TRACE1(pScanCncn->hReport, REPORT_SEVERITY_ERROR , "scanCncn_AppScanResultCB, received erroneuos scan result with status :%d\n", status); break; } }
/** * \fn sme_SetParam * \brief Set parameters values * * Set parameters values * * \note Note is indicated here * \param hSme - handle to the SME object * \param pParam - pointer to the param to set * \return PARAM_NOT_SUPPORTED for an unrecognized parameter, TI_OK if successfull. * \sa sme_GetParam */ TI_STATUS sme_SetParam (TI_HANDLE hSme, paramInfo_t *pParam) { TSme *pSme = (TSme*)hSme; TRACE1(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_SetParam: param type is 0x%x\n", pParam->paramType); switch (pParam->paramType) { case SME_RADIO_ON_PARAM: /* if new value is different than current one */ if (pSme->bRadioOn != pParam->content.smeRadioOn) { /* set new radio on value and send an event to the state-machine accordingly */ pSme->bRadioOn = pParam->content.smeRadioOn; if (TI_TRUE == pSme->bRadioOn) { if(TI_TRUE == pSme->bRunning) { genSM_Event (pSme->hSmeSm, SME_SM_EVENT_START, hSme); } } else { genSM_Event (pSme->hSmeSm, SME_SM_EVENT_STOP, hSme); } } break; case SME_DESIRED_SSID_PARAM: /* if new value is different than current one */ if ((pSme->tSsid.len != pParam->content.smeDesiredSSID.len) || (0 != os_memoryCompare (pSme->hOS, &(pSme->tSsid.str[ 0 ]), &(pParam->content.smeDesiredSSID.str[ 0 ]), pSme->tSsid.len))) { /* set new desired SSID */ os_memoryCopy (pSme->hOS, &(pSme->tSsid.str[ 0 ]), &(pParam->content.smeDesiredSSID.str[ 0 ]), pParam->content.smeDesiredSSID.len); pSme->tSsid.len = pParam->content.smeDesiredSSID.len; pSme->uScanCount = 0; /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); } break; case SME_DESIRED_SSID_ACT_PARAM: pSme->bRadioOn = TI_TRUE; /* if new value is different than current one */ if ((pSme->tSsid.len != pParam->content.smeDesiredSSID.len) || (0 != os_memoryCompare (pSme->hOS, &(pSme->tSsid.str[ 0 ]), &(pParam->content.smeDesiredSSID.str[ 0 ]), pSme->tSsid.len))) { /* set new desired SSID */ os_memoryCopy (pSme->hOS, &(pSme->tSsid.str[ 0 ]), &(pParam->content.smeDesiredSSID.str[ 0 ]), pParam->content.smeDesiredSSID.len); pSme->tSsid.len = pParam->content.smeDesiredSSID.len; } /* also set SSID type and connect required flag */ if (OS_802_11_SSID_JUNK (pSme->tSsid.str, pSme->tSsid.len)) { pSme->eSsidType = SSID_TYPE_INVALID; pSme->bConnectRequired = TI_FALSE; } else if (0 == pSme->tSsid.len) { pSme->eSsidType = SSID_TYPE_ANY; pSme->bConnectRequired = TI_TRUE; } else { pSme->eSsidType = SSID_TYPE_SPECIFIC; pSme->bConnectRequired = TI_TRUE; } pSme->uScanCount = 0; /* if junk SSID */ if(TI_FALSE == pSme->bConnectRequired) { pSme->bConstantScan = TI_FALSE; } /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); break; case SME_DESIRED_BSSID_PARAM: /* if new value is different than current one */ if (TI_FALSE == MAC_EQUAL (pSme->tBssid, pParam->content.smeDesiredBSSID)) { /* set new BSSID */ MAC_COPY (pSme->tBssid, pParam->content.smeDesiredBSSID); pSme->uScanCount = 0; /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); } break; case SME_CONNECTION_MODE_PARAM: /* if new value is different than current one */ if (pSme->eConnectMode != pParam->content.smeConnectionMode) { /* set new connection mode */ pSme->eConnectMode = pParam->content.smeConnectionMode; pSme->uScanCount = 0; /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); } break; case SME_DESIRED_BSS_TYPE_PARAM: /* if new value is different than current one */ if (pSme->eBssType != pParam->content.smeDesiredBSSType) { /* set new BSS type */ pSme->eBssType = pParam->content.smeDesiredBSSType; pSme->uScanCount = 0; /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); } break; case SME_WSC_PB_MODE_PARAM: if (pParam->content.siteMgrWSCMode.WSCMode != TIWLN_SIMPLE_CONFIG_OFF) { pSme->bConstantScan = TI_TRUE; pSme->uScanCount = 0; /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); } else { pSme->bConstantScan = TI_FALSE; } break; default: TRACE1(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_SetParam: unrecognized param type %d\n", pParam->paramType); return PARAM_NOT_SUPPORTED; /* break;*/ } return TI_OK; }
/** * \fn sme_ScanResultCB * \brief Callback function from scan concentrator for results and scan complete indications * * Callback function from scan concentrator for results and scan complete indications * * \param hSme - handle to the SME object * \param eStatus - the reason for calling the CB * \param pFrameInfo - frame information (if the CB is called due to received frame) * \param uSPSStatus - SPS attened channels (if the CB is called to inidcate an SPS scan complete) * \return None */ void sme_ScanResultCB (TI_HANDLE hSme, EScanCncnResultStatus eStatus, TScanFrameInfo* pFrameInfo, TI_UINT16 uSPSStatus) { TSme *pSme = (TSme*)hSme; paramInfo_t param; switch (eStatus) { /* a frame was received - update the scan result table */ case SCAN_CRS_RECEIVED_FRAME: TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: received frame from BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); /* * in auto mode in order to find country IE only !!! * filter frames according to desired SSID, in case we are also trying to find * country IE in passive scan, to avoid a table overflow (in manual mode, the SME table must be equal to the app * table, the app is responsible to decide which SSIDs to use for scan) */ if (CONNECT_MODE_AUTO == pSme->eConnectMode) { if (SSID_TYPE_SPECIFIC == pSme->eSsidType) { #ifndef XCC_MODULE_INCLUDED if ((pSme->tSsid.len == pFrameInfo->parsedIEs->content.iePacket.pSsid->hdr[ 1 ]) && (0 == os_memoryCompare (pSme->hOS, &(pSme->tSsid.str[ 0 ]), &(pFrameInfo->parsedIEs->content.iePacket.pSsid->serviceSetId[ 0 ]), pSme->tSsid.len))) #endif { if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo)) { TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update specific enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); } } } else { if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo)) { TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x because table is full\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); } } } else /* manual mode */ { if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo)) { TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update application scan enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); } } break; /* scan was completed successfully */ case SCAN_CRS_SCAN_COMPLETE_OK: /* an error occured, try selecting a site anyway */ case SCAN_CRS_SCAN_ABORTED_FW_RESET: case SCAN_CRS_SCAN_ABORTED_HIGHER_PRIORITY: case SCAN_CRS_SCAN_FAILED: case SCAN_CRS_TSF_ERROR: TRACE1(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: received scan complete indication with status %d\n", eStatus); /* stablizie the scan result table - delete its contenst if no results were recived during last scan */ scanResultTable_SetStableState (pSme->hScanResultTable); if (CONNECT_MODE_AUTO == pSme->eConnectMode) { /* try to select a site */ pSme->pCandidate = sme_Select (hSme); /* if no matching site was found */ if (NULL == pSme->pCandidate) { /* for IBSS or any, if no entries where found, add the self site */ if (pSme->eBssType == BSS_INFRASTRUCTURE) { TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: No candidate available, sending connect failure\n"); genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); break; } { TI_UINT8 uDesiredChannel; param.paramType = SITE_MGR_DESIRED_CHANNEL_PARAM; siteMgr_getParam(pSme->hSiteMgr, ¶m); uDesiredChannel = param.content.siteMgrDesiredChannel; if (uDesiredChannel >= SITE_MGR_CHANNEL_A_MIN) { param.content.channelCapabilityReq.band = RADIO_BAND_5_0_GHZ; } else { param.content.channelCapabilityReq.band = RADIO_BAND_2_4_GHZ; } /* update the regulatory domain with the selected band */ /* Check if the selected channel is valid according to regDomain */ param.paramType = REGULATORY_DOMAIN_GET_SCAN_CAPABILITIES; param.content.channelCapabilityReq.scanOption = ACTIVE_SCANNING; param.content.channelCapabilityReq.channelNum = uDesiredChannel; regulatoryDomain_getParam (pSme->hRegDomain,¶m); if (!param.content.channelCapabilityRet.channelValidity) { TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "IBSS SELECT FAILURE - No channel !!!\n\n"); genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); break; } pSme->pCandidate = (TSiteEntry *)addSelfSite(pSme->hSiteMgr); if (pSme->pCandidate == NULL) { TRACE0(pSme->hReport, REPORT_SEVERITY_ERROR , "IBSS SELECT FAILURE - could not open self site !!!\n\n"); genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); break; } #ifdef REPORT_LOG TRACE6(pSme->hReport, REPORT_SEVERITY_CONSOLE,"%%%%%%%%%%%%%% SELF SELECT SUCCESS, bssid: %X-%X-%X-%X-%X-%X %%%%%%%%%%%%%%\n\n", pSme->pCandidate->bssid[0], pSme->pCandidate->bssid[1], pSme->pCandidate->bssid[2], pSme->pCandidate->bssid[3], pSme->pCandidate->bssid[4], pSme->pCandidate->bssid[5]); WLAN_OS_REPORT (("%%%%%%%%%%%%%% SELF SELECT SUCCESS, bssid: %02x.%02x.%02x.%02x.%02x.%02x %%%%%%%%%%%%%%\n\n", pSme->pCandidate->bssid[0], pSme->pCandidate->bssid[1], pSme->pCandidate->bssid[2], pSme->pCandidate->bssid[3], pSme->pCandidate->bssid[4], pSme->pCandidate->bssid[5])); #endif } } /* a connection candidate is available, send a connect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme); } break; /* * scan was stopped according to SME request (should happen when moving to disconnecting from scanning), send a * connect failure event to move out of disconnecting */ case SCAN_CRS_SCAN_STOPPED: TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: received scan stopped indication\n"); genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); break; default: TRACE1(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: received unrecognized status %d\n", eStatus); break; } }
/** * \fn smeSm_PreConnect * \brief Initiates the connection process * * Initiates the connection process - for automatic mode, start scan, for manual mode - triggers connection * * \param hSme - handle to the SME object * \return None * \sa smeSm_Connect, smeSm_ConnectSuccess */ void smeSm_PreConnect (TI_HANDLE hSme) { TSme *pSme = (TSme *)hSme; paramInfo_t *pParam; /* set the connection mode with which this connection attempt is starting */ pSme->eLastConnectMode = pSme->eConnectMode; /* mark that no authentication/assocaition was yet sent */ pSme->bAuthSent = TI_FALSE; /* try to find a connection candidate (manual mode have already performed scann */ pSme->pCandidate = sme_Select (hSme); if (NULL != pSme->pCandidate) { /* candidate is available - attempt connection */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme); } /* no candidate */ else { if (CONNECT_MODE_AUTO == pSme->eConnectMode) { /* automatic mode - start scanning */ if (TI_OK != sme_StartScan (hSme)) { pSme->bRadioOn = TI_FALSE; genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); } /* update scan count counter */ if(pSme->uScanCount < PERIODIC_SCAN_MAX_INTERVAL_NUM) { pSme->uScanCount++; } } else { /* Manual mode */ /* for IBSS or any, if no entries where found, add the self site */ if (pSme->eBssType == BSS_INFRASTRUCTURE) { /* makr whether we need to stop the attempt connection in manual mode */ pSme->bConnectRequired = TI_FALSE; /* manual mode and no connection candidate is available - connection failed */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); } else { /* IBSS */ TI_UINT8 uDesiredChannel; TI_BOOL channelValidity; pSme->bConnectRequired = TI_FALSE; pParam = (paramInfo_t *)os_memoryAlloc(pSme->hOS, sizeof(paramInfo_t)); if (!pParam) { return; } pParam->paramType = SITE_MGR_DESIRED_CHANNEL_PARAM; siteMgr_getParam(pSme->hSiteMgr, pParam); uDesiredChannel = pParam->content.siteMgrDesiredChannel; if (uDesiredChannel >= SITE_MGR_CHANNEL_A_MIN) { pParam->content.channelCapabilityReq.band = RADIO_BAND_5_0_GHZ; } else { pParam->content.channelCapabilityReq.band = RADIO_BAND_2_4_GHZ; } /* update the regulatory domain with the selected band */ /* Check if the selected channel is valid according to regDomain */ pParam->paramType = REGULATORY_DOMAIN_GET_SCAN_CAPABILITIES; pParam->content.channelCapabilityReq.scanOption = ACTIVE_SCANNING; pParam->content.channelCapabilityReq.channelNum = uDesiredChannel; regulatoryDomain_getParam (pSme->hRegDomain,pParam); channelValidity = pParam->content.channelCapabilityRet.channelValidity; os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t)); if (!channelValidity) { genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); return; } pSme->pCandidate = (TSiteEntry *)addSelfSite(pSme->hSiteMgr); if (pSme->pCandidate == NULL) { genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); return; } /* a connection candidate is available, send a connect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme); } } } }
/** * \fn scanCncnApp_SetParam * \brief Parses and executes a set param command * * Parses and executes a set param command (start/stop one-shot/periodic/OS scan) * * \param hScanCncn - handle to the scan concentrator object * \param pParam - the param to set * \return operation status (OK / NOK / PARAM_NOT_SUPPORTED) * \sa scanCncnApp_GetParam */ TI_STATUS scanCncnApp_SetParam (TI_HANDLE hScanCncn, paramInfo_t *pParam) { TScanCncn *pScanCncn = (TScanCncn*)hScanCncn; TI_UINT32 uCurrentTimeStamp; switch (pParam->paramType) { case SCAN_CNCN_START_APP_SCAN: /* verify that scan is not currently running */ if (pScanCncn->eCurrentRunningAppScanClient != SCAN_SCC_NO_CLIENT) { /* Scan was not started successfully, send a scan complete event to the user */ return TI_NOK; } /* set one-shot scan as running app scan client */ pScanCncn->eCurrentRunningAppScanClient = SCAN_SCC_APP_ONE_SHOT; /* Perform aging process before the scan */ scanResultTable_PerformAging(pScanCncn->hScanResultTable); /* start the scan */ if (SCAN_CRS_SCAN_RUNNING != scanCncn_Start1ShotScan (hScanCncn, SCAN_SCC_APP_ONE_SHOT, pParam->content.pScanParams)) { /* Scan was not started successfully, mark that no app scan is running */ pScanCncn->eCurrentRunningAppScanClient = SCAN_SCC_NO_CLIENT; return TI_NOK; } break; case SCAN_CNCN_STOP_APP_SCAN: /* verify that scan is currently running */ if (pScanCncn->eCurrentRunningAppScanClient != SCAN_SCC_NO_CLIENT) { scanCncn_StopScan (hScanCncn, SCAN_SCC_APP_ONE_SHOT); } break; case SCAN_CNCN_START_PERIODIC_SCAN: /* verify that scan is not currently running */ if (SCAN_SCC_NO_CLIENT != pScanCncn->eCurrentRunningAppScanClient) { /* Scan was not started successfully, send a scan complete event to the user */ return TI_NOK; } /* set one-shot scan as running app scan client */ pScanCncn->eCurrentRunningAppScanClient = SCAN_SCC_APP_PERIODIC; /* Perform aging process before the scan */ scanResultTable_PerformAging(pScanCncn->hScanResultTable); /* start the scan */ if (SCAN_CRS_SCAN_RUNNING != scanCncn_StartPeriodicScan (hScanCncn, SCAN_SCC_APP_PERIODIC, pParam->content.pPeriodicScanParams)) { WLAN_OS_REPORT (("Scan was not started. Verify scan parametrs or SME mode\n")); /* Scan was not started successfully, mark that no app scan is running */ pScanCncn->eCurrentRunningAppScanClient = SCAN_SCC_NO_CLIENT; return TI_NOK; } break; case SCAN_CNCN_STOP_PERIODIC_SCAN: /* verify that scan is currently running */ if (pScanCncn->eCurrentRunningAppScanClient != SCAN_SCC_NO_CLIENT) { scanCncn_StopPeriodicScan (hScanCncn, SCAN_SCC_APP_PERIODIC); } break; case SCAN_CNCN_BSSID_LIST_SCAN_PARAM: /* check if OID scans are enabled in the registry */ if (0 == pScanCncn->tInitParams.uMinimumDurationBetweenOsScans) { return TI_NOK; } /* check if the last OID scan didn't start at a shorter duration than the configured minimum */ uCurrentTimeStamp = os_timeStampMs (pScanCncn->hOS); if ( (uCurrentTimeStamp - pScanCncn->uOSScanLastTimeStamp) < (pScanCncn->tInitParams.uMinimumDurationBetweenOsScans * 1000) ) { /*converted to ms */ return TI_NOK; } /* check that no other scan is currently running */ if (SCAN_SCC_NO_CLIENT != pScanCncn->eCurrentRunningAppScanClient) { return TI_NOK; } /* set one-shot scan as running app scan client */ pScanCncn->eCurrentRunningAppScanClient = SCAN_SCC_APP_ONE_SHOT; /* mark that an OID scan process has started */ pScanCncn->bOSScanRunning = TI_TRUE; pScanCncn->uOSScanLastTimeStamp = uCurrentTimeStamp; if (0 != pParam->content.pScanParams->desiredSsid.len) { pScanCncn->tOsScanParams.desiredSsid.len = pParam->content.pScanParams->desiredSsid.len; os_memoryCopy(pScanCncn->hOS, pScanCncn->tOsScanParams.desiredSsid.str, pParam->content.pScanParams->desiredSsid.str, pParam->content.pScanParams->desiredSsid.len); } else { pScanCncn->tOsScanParams.desiredSsid.len = 0; pScanCncn->tOsScanParams.desiredSsid.str[ 0 ] = '\0'; /* broadcast scan */ } pScanCncn->tOsScanParams.scanType = pParam->content.pScanParams->scanType; /* Perform aging process before the scan */ scanResultTable_PerformAging(pScanCncn->hScanResultTable); /* and actually start the scan */ genSM_Event (pScanCncn->hOSScanSm, SCAN_CNCN_OS_SM_EVENT_START_SCAN, hScanCncn); break; case SCAN_CNCN_SET_SRA: scanResultTable_SetSraThreshold(pScanCncn->hScanResultTable, pParam->content.uSraThreshold); break; case SCAN_CNCN_SET_RSSI: pScanCncn->tInitParams.nRssiThreshold = pParam->content.nRssiThreshold; break; default: return PARAM_NOT_SUPPORTED; } return TI_OK; }
/** * \fn scanCncn_AppScanResultCB * \brief Scan result callback for application scan * * Scan result callback for application scan * * \param hScanCncn - handle to the scan concentrator object * \param status - the scan result status (scan complete, result received etc.) * \param frameInfo - a pointer to the structure holding all frame related info (in case a frame was received) * \param SPSStatus - a bitmap indicating on which channels scan was attempted (valid for SPS scan only!) * \return None */ void scanCncn_AppScanResultCB (TI_HANDLE hScanCncn, EScanCncnResultStatus status, TScanFrameInfo* frameInfo, TI_UINT16 SPSStatus) { TScanCncn *pScanCncn = (TScanCncn*)hScanCncn; TI_UINT32 statusData; /* Since in Manual Mode the app and the SME use the same table * there is no need to forward data to SME */ switch (status) { case SCAN_CRS_RECEIVED_FRAME: /* Save the result in the app scan result table */ if (TI_OK != scanResultTable_UpdateEntry (pScanCncn->hScanResultTable, frameInfo->bssId, frameInfo)) { } break; case SCAN_CRS_SCAN_COMPLETE_OK: /* if OS scan is running */ if (TI_TRUE == pScanCncn->bOSScanRunning) { /* send a scan complete event to the OS scan SM. It will stabliza the table when needed */ genSM_Event (pScanCncn->hOSScanSm, SCAN_CNCN_OS_SM_EVENT_SCAN_COMPLETE, hScanCncn); } else { /* move the scan result table to stable state */ scanResultTable_SetStableState (pScanCncn->hScanResultTable); /* mark that no app scan is running */ pScanCncn->eCurrentRunningAppScanClient = SCAN_SCC_NO_CLIENT; /* * The scan was finished, send a scan complete event to the user * (regardless of why the scan was completed) */ statusData = SCAN_STATUS_COMPLETE; /* Completed status */ EvHandlerSendEvent (pScanCncn->hEvHandler, IPC_EVENT_SCAN_COMPLETE, (TI_UINT8 *)&statusData, sizeof(TI_UINT32)); } break; case SCAN_CRS_SCAN_STOPPED: /* if OS scan is running */ if (TI_TRUE == pScanCncn->bOSScanRunning) { /* send a scan complete event to the OS scan SM. It will stabliza the table when needed */ genSM_Event (pScanCncn->hOSScanSm, SCAN_CNCN_OS_SM_EVENT_SCAN_COMPLETE, hScanCncn); } else { /* move the scan result table to stable state */ scanResultTable_SetStableState (pScanCncn->hScanResultTable); /* mark that no app scan is running */ pScanCncn->eCurrentRunningAppScanClient = SCAN_SCC_NO_CLIENT; /* * The scan was finished, send a scan complete event to the user * (regardless of why the scan was completed) */ statusData = SCAN_STATUS_STOPPED; /* Stopped status */ EvHandlerSendEvent (pScanCncn->hEvHandler, IPC_EVENT_SCAN_COMPLETE, (TI_UINT8 *)&statusData, sizeof(TI_UINT32)); } break; case SCAN_CRS_TSF_ERROR: case SCAN_CRS_SCAN_RUNNING: case SCAN_CRS_SCAN_FAILED: case SCAN_CRS_SCAN_ABORTED_HIGHER_PRIORITY: case SCAN_CRS_SCAN_ABORTED_FW_RESET: /* if OS scan is running */ if (TI_TRUE == pScanCncn->bOSScanRunning) { /* send a scan complete event to the OS scan SM. It will stabliza the table when needed */ genSM_Event (pScanCncn->hOSScanSm, SCAN_CNCN_OS_SM_EVENT_SCAN_COMPLETE, hScanCncn); } else { /* move the scan result table to stable state */ scanResultTable_SetStableState (pScanCncn->hScanResultTable); /* mark that no app scan is running */ pScanCncn->eCurrentRunningAppScanClient = SCAN_SCC_NO_CLIENT; /* * The scan was finished, send a scan complete event to the user * (regardless of why the scan was completed) */ statusData = SCAN_STATUS_FAILED; /* Failed status */ EvHandlerSendEvent (pScanCncn->hEvHandler, IPC_EVENT_SCAN_COMPLETE, (TI_UINT8 *)&statusData, sizeof(TI_UINT32)); } break; case SCAN_CRS_NUM_OF_RES_STATUS: default: break; } }
/** * \fn scanCncnOsSm_ActionStartAScan * \brief Scan concentartor OS state machine start scan on A action function * * Scan concentartor OS state machine start scan on A action function. * Starts a sacn on A using all allowed channels * * \param hScanCncn - handle to the scan concentartor object * \return None */ void scanCncnOsSm_ActionStartAScan (TI_HANDLE hScanCncn) { TScanCncn *pScanCncn = (TScanCncn*)hScanCncn; paramInfo_t tParam; TI_UINT32 uValidChannelsCount; TI_BOOL bRegulatoryDomainEnabled; /* if the STA is not configured for G band or dual band, send a scan complete event to the SM */ tParam.paramType = SITE_MGR_DESIRED_DOT11_MODE_PARAM; siteMgr_getParam (pScanCncn->hSiteManager, &tParam); if ((DOT11_A_MODE != tParam.content.siteMgrDot11Mode) && (DOT11_DUAL_MODE != tParam.content.siteMgrDot11Mode)) { TRACE0(pScanCncn->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnOsSm_ActionStartAScan: STA does not work on 5.0 GHz, quitting\n"); genSM_Event (pScanCncn->hOSScanSm, SCAN_CNCN_OS_SM_EVENT_SCAN_COMPLETE, hScanCncn); return; } /* build scan command header */ pScanCncn->tOsScanParams.band = RADIO_BAND_5_0_GHZ; pScanCncn->tOsScanParams.Tid = 0; /* query the regulatory domain if 802.11d is in use */ tParam.paramType = REGULATORY_DOMAIN_ENABLED_PARAM; regulatoryDomain_getParam (pScanCncn->hRegulatoryDomain, &tParam ); bRegulatoryDomainEnabled = tParam.content.regulatoryDomainEnabled; /* Get country code status */ tParam.paramType = REGULATORY_DOMAIN_IS_COUNTRY_FOUND; tParam.content.eRadioBand = RADIO_BAND_5_0_GHZ; regulatoryDomain_getParam (pScanCncn->hRegulatoryDomain, &tParam); /* scan type is passive if 802.11d is enabled and country IE was not yet found, active otherwise */ if (((TI_TRUE == bRegulatoryDomainEnabled) && (TI_FALSE == tParam.content.bIsCountryFound)) || SCAN_TYPE_TRIGGERED_PASSIVE == pScanCncn->tOsScanParams.scanType) { pScanCncn->tOsScanParams.scanType = SCAN_TYPE_TRIGGERED_PASSIVE; } /* All paramters in the func are hard coded, due to that we set to active if not passive */ else { pScanCncn->tOsScanParams.scanType = SCAN_TYPE_TRIGGERED_ACTIVE; /* also set number and rate of probe requests */ pScanCncn->tOsScanParams.probeReqNumber = SCAN_OID_DEFAULT_PROBE_REQUEST_NUMBER_A; pScanCncn->tOsScanParams.probeRequestRate = (ERateMask)SCAN_OID_DEFAULT_PROBE_REQUEST_RATE_A; } /* add supported channels on G */ if (SCAN_TYPE_NORMAL_PASSIVE == pScanCncn->tOsScanParams.scanType ) { uValidChannelsCount = scanCncnOsSm_FillAllAvailableChannels (hScanCncn, RADIO_BAND_5_0_GHZ, SCAN_TYPE_NORMAL_PASSIVE, &(pScanCncn->tOsScanParams.channelEntry[0]), SCAN_OID_DEFAULT_MAX_DWELL_TIME_PASSIVE_A, SCAN_OID_DEFAULT_MIN_DWELL_TIME_PASSIVE_A, SCAN_OID_DEFAULT_EARLY_TERMINATION_EVENT_PASSIVE_A, SCAN_OID_DEFAULT_EARLY_TERMINATION_COUNT_PASSIVE_A ); } else { uValidChannelsCount = scanCncnOsSm_FillAllAvailableChannels (hScanCncn, RADIO_BAND_5_0_GHZ, SCAN_TYPE_NORMAL_ACTIVE, &(pScanCncn->tOsScanParams.channelEntry[0]), SCAN_OID_DEFAULT_MAX_DWELL_TIME_ACTIVE_A, SCAN_OID_DEFAULT_MIN_DWELL_TIME_ACTIVE_A, SCAN_OID_DEFAULT_EARLY_TERMINATION_EVENT_ACTIVE_A, SCAN_OID_DEFAULT_EARLY_TERMINATION_COUNT_ACTIVE_A ); } pScanCncn->tOsScanParams.numOfChannels = uValidChannelsCount; /* check that some channels are available */ if ( uValidChannelsCount > 0 ) { EScanCncnResultStatus eResult; /* send command to scan concentrator APP SM */ eResult = scanCncn_Start1ShotScan (hScanCncn, SCAN_SCC_APP_ONE_SHOT, &(pScanCncn->tOsScanParams)); /* if scan failed, send scan complete event to the SM */ if (SCAN_CRS_SCAN_RUNNING != eResult) { TRACE0(pScanCncn->hReport, REPORT_SEVERITY_ERROR , "scanCncnOsSm_ActionStartAScan: scan failed on 5.0 GHz, quitting\n"); genSM_Event (pScanCncn->hOSScanSm, SCAN_CNCN_OS_SM_EVENT_SCAN_COMPLETE, hScanCncn); } } else { TRACE0(pScanCncn->hReport, REPORT_SEVERITY_ERROR , "scanCncnOsSm_ActionStartGScan: no valid cahnnels on 5.0 GHz, quitting\n"); /* no channels to scan, send a scan complete event */ genSM_Event (pScanCncn->hOSScanSm, SCAN_CNCN_OS_SM_EVENT_SCAN_COMPLETE, hScanCncn); } }
/** * \fn scanCncnApp_SetParam * \brief Parses and executes a set param command * * Parses and executes a set param command (start/stop one-shot/periodic/OS scan) * * \param hScanCncn - handle to the scan concentrator object * \param pParam - the param to set * \return operation status (OK / NOK / PARAM_NOT_SUPPORTED) * \sa scanCncnApp_GetParam */ TI_STATUS scanCncnApp_SetParam (TI_HANDLE hScanCncn, paramInfo_t *pParam) { TScanCncn *pScanCncn = (TScanCncn*)hScanCncn; TI_UINT32 uCurrentTimeStamp; TRACE1(pScanCncn->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnApp_SetParam: recevived request of type 0x%x\n", pParam->paramType); switch (pParam->paramType) { case SCAN_CNCN_START_APP_SCAN: /* verify that scan is not currently running */ if (pScanCncn->eCurrentRunningAppScanClient != SCAN_SCC_NO_CLIENT) { TRACE1(pScanCncn->hReport, REPORT_SEVERITY_WARNING, "scanCncnApp_SetParam: trying to start app one-shot scan when client %d is currently running!\n", pScanCncn->eCurrentRunningAppScanClient); /* Scan was not started successfully, send a scan complete event to the user */ return TI_NOK; } /* set one-shot scan as running app scan client */ pScanCncn->eCurrentRunningAppScanClient = SCAN_SCC_APP_ONE_SHOT; /* start the scan */ if (SCAN_CRS_SCAN_RUNNING != scanCncn_Start1ShotScan (hScanCncn, SCAN_SCC_APP_ONE_SHOT, pParam->content.pScanParams)) { /* Scan was not started successfully, mark that no app scan is running */ pScanCncn->eCurrentRunningAppScanClient = SCAN_SCC_NO_CLIENT; return TI_NOK; } break; case SCAN_CNCN_STOP_APP_SCAN: /* verify that scan is currently running */ if (pScanCncn->eCurrentRunningAppScanClient != SCAN_SCC_NO_CLIENT) { scanCncn_StopScan (hScanCncn, SCAN_SCC_APP_ONE_SHOT); } break; case SCAN_CNCN_START_PERIODIC_SCAN: /* verify that scan is not currently running */ if (SCAN_SCC_NO_CLIENT != pScanCncn->eCurrentRunningAppScanClient) { TRACE1(pScanCncn->hReport, REPORT_SEVERITY_WARNING, "scanCncnApp_SetParam: trying to start app periodic scan when client %d is currently running!\n", pScanCncn->eCurrentRunningAppScanClient); /* Scan was not started successfully, send a scan complete event to the user */ return TI_NOK; } /* set one-shot scan as running app scan client */ pScanCncn->eCurrentRunningAppScanClient = SCAN_SCC_APP_PERIODIC; /* start the scan */ if (SCAN_CRS_SCAN_RUNNING != scanCncn_StartPeriodicScan (hScanCncn, SCAN_SCC_APP_PERIODIC, pParam->content.pPeriodicScanParams)) { TRACE0(pScanCncn->hReport, REPORT_SEVERITY_CONSOLE , "Scan was not started. Verify scan parametrs or SME mode\n"); WLAN_OS_REPORT (("Scan was not started. Verify scan parametrs or SME mode\n")); /* Scan was not started successfully, mark that no app scan is running */ pScanCncn->eCurrentRunningAppScanClient = SCAN_SCC_NO_CLIENT; return TI_NOK; } break; case SCAN_CNCN_STOP_PERIODIC_SCAN: /* verify that scan is currently running */ if (pScanCncn->eCurrentRunningAppScanClient != SCAN_SCC_NO_CLIENT) { scanCncn_StopPeriodicScan (hScanCncn, SCAN_SCC_APP_PERIODIC); } break; case SCAN_CNCN_BSSID_LIST_SCAN_PARAM: /* check if OID scans are enabled in the registry */ if (0 == pScanCncn->tInitParams.uMinimumDurationBetweenOsScans) { TRACE0(pScanCncn->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnApp_SetParam: received OS scan request when OS scans are disabled, quitting...\n"); return TI_NOK; } /* check if the last OID scan didn't start at a shorter duration than the configured minimum */ uCurrentTimeStamp = os_timeStampMs (pScanCncn->hOS); if ( (uCurrentTimeStamp - pScanCncn->uOSScanLastTimeStamp) < (pScanCncn->tInitParams.uMinimumDurationBetweenOsScans * 1000) ) /*converted to ms */ { TRACE3(pScanCncn->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnApp_SetParam: last OID scan performed at: %d, now is: %d, min duration is: %d, too early for another scan!\n", pScanCncn->uOSScanLastTimeStamp, uCurrentTimeStamp, pScanCncn->tInitParams.uMinimumDurationBetweenOsScans); return TI_NOK; } /* check that no other scan is currently running */ if (SCAN_SCC_NO_CLIENT != pScanCncn->eCurrentRunningAppScanClient) { TRACE1(pScanCncn->hReport, REPORT_SEVERITY_ERROR , "scanCncnApp_SetParam: received OS scan request when client %d is currently running!\n", pScanCncn->eCurrentRunningAppScanClient); return TI_NOK; } /* set one-shot scan as running app scan client */ pScanCncn->eCurrentRunningAppScanClient = SCAN_SCC_APP_ONE_SHOT; /* mark that an OID scan process has started */ pScanCncn->bOSScanRunning = TI_TRUE; pScanCncn->uOSScanLastTimeStamp = uCurrentTimeStamp; TRACE0(pScanCncn->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnApp_SetParam: starting OID scan process...\n"); if(0 != pParam->content.tScanDesiredSSID.len) { pScanCncn->tOsScanParams.desiredSsid.len = pParam->content.tScanDesiredSSID.len; os_memoryCopy(pScanCncn->hOS, pScanCncn->tOsScanParams.desiredSsid.str, pParam->content.tScanDesiredSSID.str, pParam->content.tScanDesiredSSID.len); } else { pScanCncn->tOsScanParams.desiredSsid.len = 0; pScanCncn->tOsScanParams.desiredSsid.str[ 0 ] = '\0'; /* broadcast scan */ } /* and actually start the scan */ genSM_Event (pScanCncn->hOSScanSm, SCAN_CNCN_OS_SM_EVENT_START_SCAN, hScanCncn); break; default: TRACE1(pScanCncn->hReport, REPORT_SEVERITY_ERROR , "scanCncnApp_SetParam: unrecognized param type :%d\n", pParam->paramType); return PARAM_NOT_SUPPORTED; } return TI_OK; }