コード例 #1
0
ファイル: ScanCncnApp.c プロジェクト: IdeosDev/vendor_ti_wlan
/**
 * \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;
}
コード例 #2
0
ファイル: smeSm.c プロジェクト: IdeosDev/vendor_ti_wlan
/**
 * \fn     sme_StartScan
 * \brief  Set scan parameters and calls scan concnetartor to start the scan operation.
 *
 * Set scan parameters and calls scan concnetartor to start the scan operation.
 *
 * Scan parameters are set according to scan target - find country IE, find desired SSID, or both
 * (one on each band). To find country IE we use passive scan forever, to find the desired SSID we
 * use active scan until the current country IE expires. In addition, we take into account the WSC PB
 * mode - scan constantly for two minutes (but under the country validity and expiry constraints)
 *
 * \param  hSme - handle to the SME object
 * \return TI_OK if scan started successfully, TI_NOK otherwise
 * \sa     smeSm_PreConnect
 */
TI_STATUS sme_StartScan (TI_HANDLE hSme)
{
	TSme            *pSme = (TSme*)hSme;
	paramInfo_t     *pParam;
	TI_BOOL         bDEnabled, bCountryValid;
	TI_BOOL         bBandChannelExist[ RADIO_BAND_NUM_OF_BANDS ];
	TI_BOOL         bBandCountryFound[ RADIO_BAND_NUM_OF_BANDS ];
	TI_STATUS       tStatus;
	TI_UINT32       uIndex;

	/* get 802.11d enable state */
	pParam = (paramInfo_t *)os_memoryAlloc(pSme->hOS, sizeof(paramInfo_t));
	if (!pParam) {
		return TI_NOK;
	}

	pParam->paramType = REGULATORY_DOMAIN_ENABLED_PARAM;
	regulatoryDomain_getParam (pSme->hRegDomain, pParam);
	bDEnabled = pParam->content.regulatoryDomainEnabled;

	pParam->paramType = REGULATORY_DOMAIN_IS_COUNTRY_FOUND;
	/* get country validity for all bands */
	for (uIndex = 0; uIndex < RADIO_BAND_NUM_OF_BANDS; uIndex++) {
		pParam->content.eRadioBand = (ERadioBand)uIndex;
		regulatoryDomain_getParam (pSme->hRegDomain, pParam);
		bBandCountryFound[ uIndex ] = pParam->content.bIsCountryFound;
		/* also nullify the channel exist indication for this band */
		bBandChannelExist[ uIndex ] = TI_FALSE;
	}
	os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t));

	/* First fill the channels */
	for (uIndex = 0; uIndex < pSme->tInitParams.uChannelNum; uIndex++) {
		/* for each channel, if country is found, set active scan */
		pSme->tScanParams.tChannels[ uIndex ].eBand = pSme->tInitParams.tChannelList[ uIndex ].eBand;
		pSme->tScanParams.tChannels[ uIndex ].uChannel = pSme->tInitParams.tChannelList[ uIndex ].uChannel;
		pSme->tScanParams.tChannels[ uIndex ].uMaxDwellTimeMs = pSme->tInitParams.uMaxScanDuration;
		pSme->tScanParams.tChannels[ uIndex ].uMinDwellTimeMs = pSme->tInitParams.uMinScanDuration;
		pSme->tScanParams.tChannels[ uIndex ].uTxPowerLevelDbm = DEF_TX_POWER;

		/* if 802.11d is disabled, or country is available for this band */
		if ((TI_FALSE == bDEnabled) ||
		        (TI_TRUE == bBandCountryFound[ pSme->tInitParams.tChannelList[ uIndex ].eBand ])) {
			/* set active scan */
			pSme->tScanParams.tChannels[ uIndex ].eScanType = SCAN_TYPE_NORMAL_ACTIVE;
		}
		/* 802.11d is enabled and no country available */
		else {
			/* set passive scan */
			pSme->tScanParams.tChannels[ uIndex ].eScanType = SCAN_TYPE_NORMAL_PASSIVE;

			/*
			 * in order to fined country set uMaxDwellTimeMs ( that at passive scan set the passiveScanDuration )
			 * to significant value
			 */
			pSme->tScanParams.tChannels[ uIndex ].uMaxDwellTimeMs = SCAN_CNCN_REGULATORY_DOMAIN_PASSIVE_DWELL_TIME_DEF;
		}
		/* mark that a channel exists for this band */
		bBandChannelExist[ pSme->tInitParams.tChannelList[ uIndex ].eBand ] = TI_TRUE;
	}
	/* set number of channels */
	pSme->tScanParams.uChannelNum = pSme->tInitParams.uChannelNum;

	/* now, fill global parameters */
	pSme->tScanParams.uProbeRequestNum = pSme->tInitParams.uProbeReqNum;
	pSme->tScanParams.iRssiThreshold = pSme->tInitParams.iRssiThreshold;
	pSme->tScanParams.iSnrThreshold = pSme->tInitParams.iSnrThreshold;
	pSme->tScanParams.bTerminateOnReport = TI_TRUE;
	pSme->tScanParams.uFrameCountReportThreshold = 1;

	/*
	 * if for at least one band country is known and scan is performed on this band - means we need to
	 * take into consideration country expiry, plus we are scanning for the desired SSID
	 */
	bCountryValid = ((TI_TRUE == bBandChannelExist[ RADIO_BAND_2_4_GHZ ]) && (TI_TRUE == bBandCountryFound[ RADIO_BAND_2_4_GHZ ])) ||
	                ((TI_TRUE == bBandChannelExist[ RADIO_BAND_5_0_GHZ ]) && (TI_TRUE == bBandCountryFound[ RADIO_BAND_5_0_GHZ ]));

	/* set SSID(s) and BSS type according to 802.11d status, and country availability */
	/* if 802.11d is disabled */
	if (TI_FALSE == bDEnabled) {
		pSme->tScanParams.eBssType = pSme->eBssType;
		/* set the deisred SSID, or any SSID if this is the desired SSID */
		if (SSID_TYPE_ANY == pSme->eSsidType) {
			pSme->tScanParams.uSsidNum = 0;
			pSme->tScanParams.uSsidListFilterEnabled = 1;
		} else {
			pSme->tScanParams.tDesiredSsid[ 0 ].eVisability = SCAN_SSID_VISABILITY_HIDDEN;
			os_memoryCopy (pSme->hOS, &(pSme->tScanParams.tDesiredSsid[ 0 ].tSsid), &(pSme->tSsid), sizeof (TSsid));
			pSme->tScanParams.uSsidNum = 1;
			pSme->tScanParams.uSsidListFilterEnabled = 1;

#ifdef XCC_MODULE_INCLUDED
			pSme->tScanParams.uSsidListFilterEnabled = (TI_UINT8)TI_FALSE;
			pSme->tScanParams.uSsidNum = 2;
			pSme->tScanParams.tDesiredSsid[ 1 ].tSsid.len = 0;
			pSme->tScanParams.tDesiredSsid[ 1 ].eVisability =  SCAN_SSID_VISABILITY_PUBLIC;
#endif

		}
	}
	/* Country code exists and scan is performed on this band - take country expiry timr into account */
	else if (TI_TRUE == bCountryValid) {

		/* we already know that at least on one band we know the country IE, so we scan for our SSID */
		pSme->tScanParams.tDesiredSsid[ 0 ].eVisability = SCAN_SSID_VISABILITY_HIDDEN;
		os_memoryCopy (pSme->hOS, &(pSme->tScanParams.tDesiredSsid[ 0 ].tSsid), &(pSme->tSsid), sizeof (TSsid));
		/*
		 * if, in addition, we scan the other band to find its country, and the desired SSDI is not any SSID,
		 * add an empty SSID
		 */
		if ((SSID_TYPE_ANY != pSme->eSsidType) &&
		        (((TI_TRUE == bBandChannelExist[ RADIO_BAND_2_4_GHZ ]) && (TI_FALSE == bBandCountryFound[ RADIO_BAND_2_4_GHZ ])) ||
		         ((TI_TRUE == bBandChannelExist[ RADIO_BAND_5_0_GHZ ]) && (TI_FALSE == bBandCountryFound[ RADIO_BAND_5_0_GHZ ])))) {
			pSme->tScanParams.tDesiredSsid[ 1 ].eVisability = SCAN_SSID_VISABILITY_PUBLIC;
			pSme->tScanParams.tDesiredSsid[ 1 ].tSsid.len = 0;
			pSme->tScanParams.uSsidNum = 2;
			pSme->tScanParams.uSsidListFilterEnabled = 1;
			/*
			 * since we are also looking for an AP with country IE (not include in IBSS), we need to make sure
			 * the desired BSS type include infrastructure BSSes.
			 */
			if (BSS_INDEPENDENT == pSme->eBssType) {
				/* the desired is only IBSS - scan for any */
				pSme->tScanParams.eBssType = BSS_ANY;
			} else {
				/* the desired is either infrastructure or any - use it */
				pSme->tScanParams.eBssType = pSme->eBssType;
			}
		} else {
			pSme->tScanParams.uSsidNum = 1;
			pSme->tScanParams.uSsidListFilterEnabled = 1;
			/* only looking for the desired SSID - set the desired BSS type */
			pSme->tScanParams.eBssType = pSme->eBssType;
		}
	}
	/* no scanned band has a counrty code - meaning all scan is passive (to find country) */
	else {
		pSme->tScanParams.eBssType = BSS_INFRASTRUCTURE; /* only an AP would transmit a country IE */
		pSme->tScanParams.uSsidNum = 0;
		pSme->tScanParams.uSsidListFilterEnabled = 1;
	}

	/* update scan cycle number and scan intervals according to 802.11d status and country availability  */
	sme_updateScanCycles (hSme, bDEnabled, bCountryValid, pSme->bConstantScan);

	/* Finally(!!!), start the scan */
	tStatus = scanCncn_StartPeriodicScan (pSme->hScanCncn, SCAN_SCC_DRIVER, &(pSme->tScanParams));
	if (SCAN_CRS_SCAN_RUNNING != tStatus) {
		return TI_NOK;
	}

	return TI_OK;
}
コード例 #3
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;
}
コード例 #4
0
ファイル: ScanCncnApp.c プロジェクト: chambejp/hardware
/** 
 * \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;
}