Ejemplo n.º 1
0
/**
 * \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;
}
Ejemplo n.º 2
0
/** 
 * \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;
}
/** 
 * \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);
    }
}
Ejemplo n.º 4
0
/** 
 * \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:

        /* App scan can start only if there is a periodic scan running or no scan at all */
        if (pScanCncn->pScanClients[SCAN_SCC_APP_ONE_SHOT]->bCurrentlyRunning) 
        {
            TRACE0(pScanCncn->hReport, REPORT_SEVERITY_WARNING, "scanCncnApp_SetParam: trying to start app one-shot scan when SCAN_SCC_APP_ONE_SHOT is currently running!\n");
            /* Scan was not started successfully because driver is busy. 
            Send a scan complete event to the user */
            return TI_BUSY;
        }

        /* set one-shot scan as running app scan client */
        pScanCncn->pScanClients[SCAN_SCC_APP_ONE_SHOT]->bCurrentlyRunning = TI_TRUE;

        /* 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->pScanClients[SCAN_SCC_APP_ONE_SHOT]->bCurrentlyRunning = TI_FALSE;
            return TI_ERROR;
        }
        break;

    case SCAN_CNCN_STOP_APP_SCAN:

        /* verify that scan is currently running */
        if (pScanCncn->pScanClients[SCAN_SCC_APP_ONE_SHOT]->bCurrentlyRunning) 
        {
            scanCncn_StopScan (hScanCncn, SCAN_SCC_APP_ONE_SHOT);
        }
        break;

    case SCAN_CNCN_START_PERIODIC_SCAN:

        /* Check if there is periodic scan running  */
        if (pScanCncn->pScanClients[SCAN_SCC_APP_PERIODIC]->bCurrentlyRunning) 
        {
            
            /* Check if the running scan was requested by the same slient as the new scan
               If yes - stop the running scan and start a new one with the new params.
               If not - return BUSY. */
            int currRunningScanClientId = 
                pScanCncn->pScanClients[SCAN_SCC_APP_PERIODIC]->uScanParams.tPeriodicScanParams.eScanClient;
            int newSanClientId = 
                pParam->content.pPeriodicScanParams->eScanClient;

            if (currRunningScanClientId == newSanClientId) 
            {
                TRACE0(pScanCncn->hReport, REPORT_SEVERITY_INFORMATION, "Stopping running periodical scan"
                                                                        "in order to start a new one from the same client.\n");
                os_memoryCopy(pScanCncn->hOS, &pScanCncn->tPendingPeriodicScanParams, &pParam, 
                              sizeof(paramInfo_t));
                pScanCncn->bPendingPeriodicScan = TI_TRUE;
                scanCncn_StopPeriodicScan (hScanCncn, SCAN_SCC_APP_PERIODIC);
            }
            else
            {
                TRACE0(pScanCncn->hReport, REPORT_SEVERITY_WARNING, "scanCncnApp_SetParam: trying to start app periodic scan when there is one currently running!\n");
                /* Scan was not started successfully because driver is busy. 
                Send a scan complete event to the user */
                return TI_BUSY;
            }
        } 

        /* set periodic scan as running app scan client */
        pScanCncn->pScanClients[SCAN_SCC_APP_PERIODIC]->bCurrentlyRunning = TI_TRUE;

        /* Perform aging process before the scan */
        scanResultTable_PerformAging(pScanCncn->hScanResultTable);

        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->pScanClients[SCAN_SCC_APP_PERIODIC]->bCurrentlyRunning = TI_FALSE;
            return TI_ERROR;

        }

        break;

    case SCAN_CNCN_STOP_PERIODIC_SCAN:
        /* verify that scan is currently running */
        if (pScanCncn->pScanClients[SCAN_SCC_APP_PERIODIC]->bCurrentlyRunning)
        {
            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;
        }

        /* App (os OS) scan can start only if there is a periodic scan running or no scan at all */
        if (pScanCncn->pScanClients[SCAN_SCC_APP_ONE_SHOT]->bCurrentlyRunning) 
        {
            TRACE0(pScanCncn->hReport, REPORT_SEVERITY_WARNING, "scanCncnApp_SetParam: trying to start app one-shot scan when SCAN_SCC_APP_ONE_SHOT is currently running!\n");
            /* Scan was not started successfully because driver is busy. 
            Send a scan complete event to the user */
            return TI_BUSY;
        }

        /* set one-shot scan as running app scan client */
        pScanCncn->pScanClients[SCAN_SCC_APP_ONE_SHOT]->bCurrentlyRunning = TI_TRUE;

        /* 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.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;
        pScanCncn->tOsScanParams.eScanClient = pParam->content.pScanParams->eScanClient;
		pScanCncn->tOsScanParams.numOfChannels = pParam->content.pScanParams->numOfChannels;

		TRACE2(pScanCncn->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnApp_SetParam: scanType is %d and numOfChannels is %d\n", pParam->content.pScanParams->scanType, pParam->content.pScanParams->numOfChannels);


        /* 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:
        TRACE1(pScanCncn->hReport, REPORT_SEVERITY_ERROR , "scanCncnApp_SetParam: unrecognized param type :0x%x\n", pParam->paramType);
        return PARAM_NOT_SUPPORTED;
    }

    return TI_OK;
}