コード例 #1
0
/** 
 * \fn     sme_SetDefaults
 * \brief  Set default values to the SME (and the SM and scan result table)
 * 
 * Set default values to the SME (and the SM and scan result table)
 * 
 * \param  hSme - handle to the SME object
 * \param  pInitParams - values read from registry / ini file
 * \return None
 * \sa     sme_Create, sme_Init
 */ 
void sme_SetDefaults (TI_HANDLE hSme, TSmeModifiedInitParams *pModifiedInitParams, TSmeInitParams *pInitParams)
{
    TSme        *pSme = (TSme*)hSme;

    /* copy init params */
    os_memoryCopy (pSme->hOS, &(pSme->tInitParams), pInitParams, sizeof (TSmeInitParams));

    /* initialize SME varaibles */   
    pSme->bRadioOn = pModifiedInitParams->bRadioOn;
    pSme->eConnectMode = pModifiedInitParams->eConnectMode;
    if (CONNECT_MODE_AUTO == pSme->eConnectMode)
    {
        pSme->hScanResultTable = pSme->hSmeScanResultTable;
    }
    else if (CONNECT_MODE_MANUAL == pSme->eConnectMode) 
    {
        pSme->hScanResultTable = pSme->hScanCncnScanResulTable;
    }

    pSme->eBssType = pModifiedInitParams->eDesiredBssType;
    MAC_COPY (pSme->tBssid, pModifiedInitParams->tDesiredBssid);

    pSme->tSsid.len = pModifiedInitParams->tDesiredSsid.len;
    if ( pSme->tSsid.len > MAX_SSID_LEN )
    {
        TRACE2( pSme->hReport, REPORT_SEVERITY_ERROR, "sme_SetDefaults. pSme->tSsid.len=%d exceeds the limit %d\n", pSme->tSsid.len, MAX_SSID_LEN);
        pSme->tSsid.len = MAX_SSID_LEN;
    }
    os_memoryCopy (pSme->hOS, &(pSme->tSsid.str[ 0 ]), &(pModifiedInitParams->tDesiredSsid.str[ 0 ]), pSme->tSsid.len);
    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->eLastConnectMode = CONNECT_MODE_AUTO;
    pSme->bAuthSent = TI_FALSE;
    pSme->bReselect = TI_FALSE;
    pSme->uScanCount = 0;
    pSme->bRunning = TI_FALSE;

    /* Initialize the SME state-machine */
    genSM_SetDefaults (pSme->hSmeSm, SME_SM_NUMBER_OF_STATES, SME_SM_NUMBER_OF_EVENTS, (TGenSM_matrix)tSmMatrix,
                       SME_SM_STATE_IDLE, "SME SM", uStateDescription, uEventDescription, __FILE_ID__);

    /* register scan conecntrator CB */
    scanCncn_RegisterScanResultCB (pSme->hScanCncn, SCAN_SCC_DRIVER, sme_ScanResultCB, hSme);
}
コード例 #2
0
ファイル: smeSm.c プロジェクト: IdeosDev/vendor_ti_wlan
/**
 * \fn     smeSm_ConnectSuccess
 * \brief  Handles connection success indication
 *
 * Handles connection success indication - starts AP conn and set SCR group to connected
 *
 * \param  hSme - handle to the SME object
 * \return None
 * \sa     smeSm_PreConnect, smeSm_Connect
 */
void smeSm_ConnectSuccess (TI_HANDLE hSme)
{
	TSme        *pSme = (TSme*)hSme;

	pSme->uScanCount = 0;

	/* connection succedded to the connection candidate - start AP connection */
	if (BSS_INFRASTRUCTURE == pSme->pCandidate->bssType) {
		/* Start the AP connection */
		apConn_start (pSme->hApConn,
		              (pSme->tSsid.len != 0) && !OS_802_11_SSID_JUNK (pSme->tSsid.str, pSme->tSsid.len));
	}

	/* Set SCR group to connected */
	scr_setGroup (pSme->hScr, SCR_GID_CONNECTED);
}
コード例 #3
0
/** 
 * \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;
}