• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** \file ScanCncnOidSM.c
2  *  \brief This file include the scan concentrator OID request SM module implementation
3  *  \author Ronen Kalish
4  *  \date 11-May-2006
5  */
6 /****************************************************************************
7 **+-----------------------------------------------------------------------+**
8 **|                                                                       |**
9 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved.      |**
10 **| All rights reserved.                                                  |**
11 **|                                                                       |**
12 **| Redistribution and use in source and binary forms, with or without    |**
13 **| modification, are permitted provided that the following conditions    |**
14 **| are met:                                                              |**
15 **|                                                                       |**
16 **|  * Redistributions of source code must retain the above copyright     |**
17 **|    notice, this list of conditions and the following disclaimer.      |**
18 **|  * Redistributions in binary form must reproduce the above copyright  |**
19 **|    notice, this list of conditions and the following disclaimer in    |**
20 **|    the documentation and/or other materials provided with the         |**
21 **|    distribution.                                                      |**
22 **|  * Neither the name Texas Instruments nor the names of its            |**
23 **|    contributors may be used to endorse or promote products derived    |**
24 **|    from this software without specific prior written permission.      |**
25 **|                                                                       |**
26 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |**
27 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |**
28 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
29 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |**
30 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
31 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |**
32 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
33 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
34 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |**
35 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
36 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |**
37 **|                                                                       |**
38 **+-----------------------------------------------------------------------+**
39 ****************************************************************************/
40 
41 #include "ScanCncnOidSM.h"
42 #include "ScanCncn.h"
43 #include "report.h"
44 #include "osApi.h"
45 #include "fsm.h"
46 #include "siteMgrApi.h"
47 #include "regulatoryDomainApi.h"
48 
49 static TI_STATUS actionUnexpected( TI_HANDLE hScanCncn );
50 
51 /**
52  * \author Ronen Kalish\n
53  * \date 14-May-2006\n
54  * \brief Initialize the scan concentrator OID scan SM.
55  *
56  * Function Scope \e Public.\n
57  * \param hScanCncn - handle to the scan concentrator object.\n
58  * \return OK if successful, NOK otherwise.\n
59  */
scanConcentratorOidSM_init(TI_HANDLE hScanCncn)60 TI_STATUS scanConcentratorOidSM_init( TI_HANDLE hScanCncn )
61 {
62     scanConcentrator_t* pScanConcentrator = (scanConcentrator_t*)hScanCncn;
63 
64     fsm_actionCell_t    smMatrix[ OID_SCAN_NUM_OF_STATES ][ OID_SCAN_NUM_OF_EVENTS ] =
65 	{
66 		/* next state and actions for IDLE state */
67 		{
68             {OID_SCAN_STATE_SCAN_ON_G, scanConcentratorOidSM_actionStartGScan},         //"START_SCAN",
69 			{OID_SCAN_STATE_IDLE, actionUnexpected},                                    //"SCAN_COMPLETE",
70 			{OID_SCAN_STATE_IDLE, actionUnexpected},                                    //"SCAN_FAILED",
71   		},
72 
73 		/* next state and actions for SCAN_ON_G state */
74 		{
75             {OID_SCAN_STATE_SCAN_ON_G, actionUnexpected},                               //"START_SCAN",
76 			{OID_SCAN_STATE_SCAN_ON_A, scanConcentratorOidSM_actionStartAScan},         //"SCAN_COMPLETE",
77 			{OID_SCAN_STATE_SCAN_ON_A, scanConcentratorOidSM_actionStartAScan},         //"SCAN_FAILED",
78 		},
79 
80 		/* next state and actions for SCAN_ON_A state */
81 		{
82             {OID_SCAN_STATE_SCAN_ON_A, actionUnexpected},                               //"START_SCAN",
83 			{OID_SCAN_STATE_IDLE, scanConcentratorOidSM_actionCleanup},                 //"SCAN_COMPLETE",
84 			{OID_SCAN_STATE_IDLE, scanConcentratorOidSM_actionCleanup},					//"SCAN_FAILED",
85 		}
86     };
87 
88     /* initialize current state */
89     pScanConcentrator->oidSMState = OID_SCAN_STATE_IDLE;
90 	pScanConcentrator->bOidScanRunning = FALSE;
91 	pScanConcentrator->oidScanLastTimeStamp = 0;
92 
93     /* configure the state machine */
94 	return fsm_Config( pScanConcentrator->hOidSM, (fsm_Matrix_t)smMatrix,
95                        OID_SCAN_NUM_OF_STATES, OID_SCAN_NUM_OF_EVENTS,
96                        (fsm_eventActivation_t)scanConcentratorOidSM_SMEvent, pScanConcentrator->hOS );
97 }
98 
99 #ifdef REPORT_LOG
100 /* state descriptions, for state machine logging */
101 static char stateDesc[ OID_SCAN_NUM_OF_STATES ][ MAX_DESC_STRING_LEN ] =
102 {
103     "STATE_IDLE",
104     "STATE_SCAN_ON_G",
105     "STATE_SCAN_ON_A"
106 };
107 
108 /* event descriptions, for state machine logging */
109 static char eventDesc[ OID_SCAN_NUM_OF_EVENTS ][ MAX_DESC_STRING_LEN ] =
110 {
111     "EVENT_START_SCAN",
112     "EVENT_SCAN_COMPLETE",
113     "EVENT_SCAN_FAILED"
114 };
115 #endif
116 
117 /**
118  * \author Ronen Kalish\n
119  * \date 11-May-2006\n
120  * \brief Processes an event.
121  *
122  * Function Scope \e Public.\n
123  * \param hScanCncn - handle to the scan concentrator object.\n
124  * \param currentState - the current OID request SM state.\n
125  * \param event - the event to handle.\n
126  * \return OK if successful, NOK otherwise.\n
127  */
scanConcentratorOidSM_SMEvent(TI_HANDLE hScanCncn,scan_oidSMStates_e * currentState,scan_oidSMEvents_e event)128 TI_STATUS scanConcentratorOidSM_SMEvent( TI_HANDLE hScanCncn, scan_oidSMStates_e* currentState,
129                                          scan_oidSMEvents_e event )
130 {
131     scanConcentrator_t *pScanConcentrator = (scanConcentrator_t *)hScanCncn;
132 	TI_STATUS status = OK;
133 	UINT8 nextState;
134 
135     /* obtain the next state */
136 	status = fsm_GetNextState( pScanConcentrator->hOidSM, (UINT8)*currentState,
137                                (UINT8)event, &nextState );
138 	if ( status != OK )
139 	{
140 		WLAN_REPORT_SM( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG, ("Failed getting OID scan next state.\n") );
141 		return NOK;
142 	}
143 
144     /* report the move */
145     WLAN_REPORT_SM( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG,
146                     ("OID SCAN: <%s, %s> --> %s\n\n",
147                     stateDesc[(UINT8)*currentState],
148                     eventDesc[(UINT8)event],
149                     stateDesc[nextState]) );
150 
151     /* move */
152     return fsm_Event( pScanConcentrator->hOidSM, (UINT8*)currentState, (UINT8)event, hScanCncn );
153 }
154 
155 /**
156  * \author Ronen Kalish\n
157  * \date 11-May-2006\n
158  * \brief SM action - starts a scan on G band
159  *
160  * Function Scope \e Public.\n
161  * \param hScanCncn - handle to the scan concentrator object.\n
162  * \return OK if successful, NOK otherwise.\n
163  */
scanConcentratorOidSM_actionStartGScan(TI_HANDLE hScanCncn)164 TI_STATUS scanConcentratorOidSM_actionStartGScan( TI_HANDLE hScanCncn )
165 {
166     scanConcentrator_t* pScanConcentrator = (scanConcentrator_t*)hScanCncn;
167 	paramInfo_t         param;
168 	int					validChannelsCount;
169 	BOOL				regulatoryDomainEnabled;
170 
171 	/* if the STA is not configured for G band or dual band, send a scan complete event to the SM */
172 	param.paramType = SITE_MGR_DESIRED_DOT11_MODE_PARAM;
173 	siteMgr_getParam( pScanConcentrator->hSiteManager, &param );
174 	if ( (DOT11_G_MODE != param.content.siteMgrDot11Mode) && (DOT11_DUAL_MODE != param.content.siteMgrDot11Mode) )
175 	{
176 		WLAN_REPORT_INFORMATION( pScanConcentrator->hOS, SCAN_CNCN_MODULE_LOG,
177 								 ("Scan OID SM: STA does not work on 2.4 GHz, continuing to 5.0 GHz scan\n") );
178 		scanConcentratorOidSM_SMEvent( hScanCncn, (scan_oidSMStates_e*)&(pScanConcentrator->oidSMState), OID_SCAN_EVENT_SCAN_FAILED );
179 		return OK;
180 	}
181 
182 	/* build scan command header */
183 	pScanConcentrator->oidScanParams.band = RADIO_BAND_2_4_GHZ;
184 	pScanConcentrator->oidScanParams.desiredSsid.len = 0;
185 	pScanConcentrator->oidScanParams.desiredSsid.ssidString[ 0 ] = '\0'; /* broadcast scan */
186 	pScanConcentrator->oidScanParams.Tid = 0;
187 
188 	/* query the regulatory domain if 802.11d is in use */
189 	param.paramType = REGULATORY_DOMAIN_ENABLED_PARAM;
190 	regulatoryDomain_getParam( pScanConcentrator->hRegulatoryDomain,&param );
191 	regulatoryDomainEnabled = param.content.regulatoryDomainEnabled;
192 
193 	/* Get country code status */
194 	param.paramType			 = REGULATORY_DOMAIN_IS_COUNTRY_FOUND;
195 	param.content.eRadioBand = RADIO_BAND_2_4_GHZ;
196 	regulatoryDomain_getParam(pScanConcentrator->hRegulatoryDomain,&param);
197 
198 	/* scan type is passive if 802.11d is enabled and country IE was not yet found, active otherwise */
199 	if ( (TRUE == regulatoryDomainEnabled) &&
200 		 (FALSE == param.content.bIsCountryFound) )
201 	{
202 		pScanConcentrator->oidScanParams.scanType = SCAN_TYPE_NORMAL_PASSIVE;
203 	}
204 	else
205 	{
206 		pScanConcentrator->oidScanParams.scanType = SCAN_TYPE_NORMAL_ACTIVE;
207 		/* also set number and rate of probe requests */
208 		pScanConcentrator->oidScanParams.probeReqNumber = SCAN_OID_DEFAULT_PROBE_REQUEST_NUMBER_G;
209 		pScanConcentrator->oidScanParams.probeRequestRate = SCAN_OID_DEFAULT_PROBE_REQUEST_RATE_G;
210 	}
211 
212 	/* add supported channels on G */
213 	if ( SCAN_TYPE_NORMAL_PASSIVE == pScanConcentrator->oidScanParams.scanType )
214 	{
215 		validChannelsCount = scanConcentratorOidSM_FillAllAvailableChannels( hScanCncn, RADIO_BAND_2_4_GHZ, SCAN_TYPE_NORMAL_PASSIVE,
216                                        &(pScanConcentrator->oidScanParams.channelEntry[0]),
217 																			 SCAN_OID_DEFAULT_MAX_DWELL_TIME_PASSIVE_G,
218 																			 SCAN_OID_DEFAULT_MIN_DWELL_TIME_PASSIVE_G,
219 																			 SCAN_OID_DEFAULT_EARLY_TERMINATION_EVENT_PASSIVE_G,
220 																			 SCAN_OID_DEFAULT_EARLY_TERMINATION_COUNT_PASSIVE_G );
221 	}
222 	else
223 	{
224 		validChannelsCount = scanConcentratorOidSM_FillAllAvailableChannels( hScanCncn, RADIO_BAND_2_4_GHZ, SCAN_TYPE_NORMAL_ACTIVE,
225                                        &(pScanConcentrator->oidScanParams.channelEntry[0]),
226  																			 SCAN_OID_DEFAULT_MAX_DWELL_TIME_ACTIVE_G,
227 																			 SCAN_OID_DEFAULT_MIN_DWELL_TIME_ACTIVE_G,
228 																			 SCAN_OID_DEFAULT_EARLY_TERMINATION_EVENT_ACTIVE_G,
229 																			 SCAN_OID_DEFAULT_EARLY_TERMINATION_COUNT_ACTIVE_G );
230 	}
231 	pScanConcentrator->oidScanParams.numOfChannels = validChannelsCount;
232 
233 	/* check that some channels are available */
234 	if ( validChannelsCount > 0 )
235 	{
236 		scan_cncnResultStatus_e res;
237 
238 		/*
239 		 * Prepare scan complete's aging, by increasing the scanned sites
240 		 * scan attemps counter. The counter will be checked upon scan complete,
241 		 * and the sites with no update scan results will be dropped.
242 		 */
243 		siteMgr_setNotReceivedParameter( pScanConcentrator->hSiteManager, &(pScanConcentrator->oidScanParams.desiredSsid),
244 		                                 RADIO_BAND_2_4_GHZ );
245 
246 		/* send command to scan concentrator APP SM */
247 		res = scanConcentrator_scan(hScanCncn, SCAN_SCC_APP, &(pScanConcentrator->oidScanParams) );
248 
249 		/* if scan failed, send scan failed event to the SM */
250 		if ( SCAN_CRS_SCAN_RUNNING != res )
251 		{
252 			scanConcentratorOidSM_SMEvent( hScanCncn, (scan_oidSMStates_e*)&(pScanConcentrator->oidSMState), OID_SCAN_EVENT_SCAN_FAILED );
253 		}
254 	}
255 	else
256 	{
257 		/* no channels to scan, send a scan failed event */
258 		scanConcentratorOidSM_SMEvent( hScanCncn, (scan_oidSMStates_e*)&(pScanConcentrator->oidSMState), OID_SCAN_EVENT_SCAN_FAILED );
259 	}
260 
261 	return OK;
262 }
263 
264 /**
265  * \author Ronen Kalish\n
266  * \date 11-May-2006\n
267  * \brief SM action - starts a scan on A band
268  *
269  * Function Scope \e Public.\n
270  * \param hScanCncn - handle to the scan concentrator object.\n
271  * \return OK if successful, NOK otherwise.\n
272  */
scanConcentratorOidSM_actionStartAScan(TI_HANDLE hScanCncn)273 TI_STATUS scanConcentratorOidSM_actionStartAScan( TI_HANDLE hScanCncn )
274 {
275     scanConcentrator_t* pScanConcentrator = (scanConcentrator_t*)hScanCncn;
276 	paramInfo_t         param;
277 	int					validChannelsCount;
278 	BOOL				regulatoryDomainEnabled;
279 
280 	/* if the STA is not configured for G band or dual band, send a scan complete event to the SM */
281 	param.paramType = SITE_MGR_DESIRED_DOT11_MODE_PARAM;
282 	siteMgr_getParam( pScanConcentrator->hSiteManager, &param );
283 	if ( (DOT11_A_MODE != param.content.siteMgrDot11Mode) && (DOT11_DUAL_MODE != param.content.siteMgrDot11Mode) )
284 	{
285 		WLAN_REPORT_INFORMATION( pScanConcentrator->hOS, SCAN_CNCN_MODULE_LOG,
286 								 ("Scan OID SM: STA does not work on 5.0 GHz, quitting\n") );
287 		scanConcentratorOidSM_SMEvent( hScanCncn, (scan_oidSMStates_e*)&(pScanConcentrator->oidSMState), OID_SCAN_EVENT_SCAN_FAILED );
288 		return OK;
289 	}
290 
291 	/* build scan command header */
292 	pScanConcentrator->oidScanParams.band = RADIO_BAND_5_0_GHZ;
293 	pScanConcentrator->oidScanParams.desiredSsid.len = 0;
294 	pScanConcentrator->oidScanParams.desiredSsid.ssidString[ 0 ] = '\0'; /* broadcast scan */
295 	pScanConcentrator->oidScanParams.Tid = 0;
296 
297 	/* query the regulatory domain if 802.11d is in use */
298 	param.paramType = REGULATORY_DOMAIN_ENABLED_PARAM;
299 	regulatoryDomain_getParam( pScanConcentrator->hRegulatoryDomain,&param );
300 	regulatoryDomainEnabled = param.content.regulatoryDomainEnabled;
301 
302 	/* Get country code status */
303 	param.paramType			 = REGULATORY_DOMAIN_IS_COUNTRY_FOUND;
304 	param.content.eRadioBand = RADIO_BAND_5_0_GHZ;
305 	regulatoryDomain_getParam(pScanConcentrator->hRegulatoryDomain,&param);
306 
307 	/* scan type is passive if 802.11d is enabled and country IE was not yet found, active otherwise */
308 	if ( (TRUE == regulatoryDomainEnabled) &&
309 		 (FALSE == param.content.bIsCountryFound) )
310 	{
311 		pScanConcentrator->oidScanParams.scanType = SCAN_TYPE_NORMAL_PASSIVE;
312 	}
313 	else
314 	{
315 		pScanConcentrator->oidScanParams.scanType = SCAN_TYPE_NORMAL_ACTIVE;
316 		/* also set number and rate of probe requests */
317 		pScanConcentrator->oidScanParams.probeReqNumber = SCAN_OID_DEFAULT_PROBE_REQUEST_NUMBER_A;
318 		pScanConcentrator->oidScanParams.probeRequestRate = SCAN_OID_DEFAULT_PROBE_REQUEST_RATE_A;
319 	}
320 
321 	/* add supported channels on G */
322 	if ( SCAN_TYPE_NORMAL_PASSIVE == pScanConcentrator->oidScanParams.scanType )
323 	{
324 		validChannelsCount = scanConcentratorOidSM_FillAllAvailableChannels( hScanCncn, RADIO_BAND_5_0_GHZ, SCAN_TYPE_NORMAL_PASSIVE,
325                                        &(pScanConcentrator->oidScanParams.channelEntry[0]),
326  																			 SCAN_OID_DEFAULT_MAX_DWELL_TIME_PASSIVE_A,
327 																			 SCAN_OID_DEFAULT_MIN_DWELL_TIME_PASSIVE_A,
328 																			 SCAN_OID_DEFAULT_EARLY_TERMINATION_EVENT_PASSIVE_A,
329 																			 SCAN_OID_DEFAULT_EARLY_TERMINATION_COUNT_PASSIVE_A );
330 	}
331 	else
332 	{
333 		validChannelsCount = scanConcentratorOidSM_FillAllAvailableChannels( hScanCncn, RADIO_BAND_5_0_GHZ, SCAN_TYPE_NORMAL_ACTIVE,
334                                        &(pScanConcentrator->oidScanParams.channelEntry[0]),
335                                        SCAN_OID_DEFAULT_MAX_DWELL_TIME_ACTIVE_A,
336 																			 SCAN_OID_DEFAULT_MIN_DWELL_TIME_ACTIVE_A,
337 																			 SCAN_OID_DEFAULT_EARLY_TERMINATION_EVENT_ACTIVE_A,
338 																			 SCAN_OID_DEFAULT_EARLY_TERMINATION_COUNT_ACTIVE_A );
339 	}
340 	pScanConcentrator->oidScanParams.numOfChannels = validChannelsCount;
341 
342 	/* check that some channels are available */
343 	if ( validChannelsCount > 0 )
344 	{
345 		scan_cncnResultStatus_e res;
346 
347 		/*
348 		 * Prepare scan complete's aging, by increasing the scanned sites
349 		 * scan attemps counter. The counter will be checked upon scan complete,
350 		 * and the sites with no update scan results will be dropped.
351 		 */
352 		siteMgr_setNotReceivedParameter( pScanConcentrator->hSiteManager, &(pScanConcentrator->oidScanParams.desiredSsid),
353 		                                 RADIO_BAND_5_0_GHZ );
354 
355       /* send command to scan concentrator APP SM */
356 		res = scanConcentrator_scan(hScanCncn, SCAN_SCC_APP, &(pScanConcentrator->oidScanParams) );
357 
358 		/* if scan failed, send scan failed event to the SM */
359 		if ( SCAN_CRS_SCAN_RUNNING != res )
360 		{
361 			scanConcentratorOidSM_SMEvent( hScanCncn, (scan_oidSMStates_e*)&(pScanConcentrator->oidSMState), OID_SCAN_EVENT_SCAN_FAILED );
362 		}
363 	}
364 	else
365 	{
366 		/* no channels to scan, send a scan failed event */
367 		scanConcentratorOidSM_SMEvent( hScanCncn, (scan_oidSMStates_e*)&(pScanConcentrator->oidSMState), OID_SCAN_EVENT_SCAN_FAILED );
368 	}
369 
370 	return OK;
371 }
372 
373 /**
374  * \author Ronen Kalish\n
375  * \date 14-May-2006\n
376  * \brief SM action - Cleans up an OID scan operation
377  *
378  * Function Scope \e Public.\n
379  * \param hScanCncn - handle to the scan concentrator object.\n
380  * \return OK if successful, NOK otherwise.\n
381  */
scanConcentratorOidSM_actionCleanup(TI_HANDLE hScanCncn)382 TI_STATUS scanConcentratorOidSM_actionCleanup( TI_HANDLE hScanCncn )
383 {
384     scanConcentrator_t* 	pScanConcentrator = (scanConcentrator_t*)hScanCncn;
385 
386 	/* mark that OID scan process is no longer running */
387 	pScanConcentrator->bOidScanRunning = FALSE;
388 
389 
390 	return OK;
391 }
392 
393 /**
394  * \author Ronen Kalish\n
395  * \date 14-May-2006\n
396  * \brief Fills a chhanel array with valid channels (and their params) according to band and scan type\n
397  *
398  * Function Scope \e Public.\n
399  * \param hScanCncn - handle to the scan concentrator object.\n
400  * \param band - band to extract channels for.\n
401  * \param scanType - scan type tp ectract channels for.\n
402  * \param channelArray - where to store allowed channels information.\n
403  * \param maxDwellTime - maximum dwell time value to be used for each channel.\n
404  * \param minDwellTime - minimum dwell time value to be used for each channel.\n
405  * \param ETCondition - early termination condition value to be used for each channel.\n
406  * \param ETFrameNumber - early termination frame number value to be used for each channel.\n
407  * \return Number of allowed channels (that were placed in the given channels array).\n
408  */
scanConcentratorOidSM_FillAllAvailableChannels(TI_HANDLE hScanCncn,radioBand_e band,scan_Type_e scanType,scan_channelEntry_u * channelArray,UINT32 maxDwellTime,UINT32 minChannelTime,scan_ETCondition_e ETCondition,UINT8 ETFrameNumber)409 UINT32 scanConcentratorOidSM_FillAllAvailableChannels( TI_HANDLE hScanCncn, radioBand_e band, scan_Type_e scanType,
410 													   scan_channelEntry_u* channelArray, UINT32 maxDwellTime,
411 													   UINT32 minChannelTime, scan_ETCondition_e ETCondition,
412 													   UINT8 ETFrameNumber )
413 {
414     scanConcentrator_t* 	pScanConcentrator = (scanConcentrator_t*)hScanCncn;
415 	int 					i, j, allowedChannelsCount, validChannelsCnt = 0;
416 	paramInfo_t 			param;
417 	UINT8      				tempChannelList[ SCAN_MAX_NUM_OF_NORMAL_CHANNELS_PER_COMMAND ];
418 
419 	/* get the numnber of supported channels for this band */
420 	param.paramType = REGULATORY_DOMAIN_ALL_SUPPORTED_CHANNELS;
421 	param.content.siteMgrRadioBand = band;
422 	regulatoryDomain_getParam( pScanConcentrator->hRegulatoryDomain, &param );
423 	allowedChannelsCount = param.content.supportedChannels.sizeOfList;
424 
425 	/* for the time being don't scan more channels than fit in one command */
426 	if ( allowedChannelsCount > SCAN_MAX_NUM_OF_NORMAL_CHANNELS_PER_COMMAND )
427 	{
428 		allowedChannelsCount = SCAN_MAX_NUM_OF_NORMAL_CHANNELS_PER_COMMAND;
429 	}
430 
431  	/* Copy allowed channels to reuse param var */
432 	os_memoryCopy( pScanConcentrator->hOS, tempChannelList,
433 			param.content.supportedChannels.listOfChannels, allowedChannelsCount );
434 
435 	/* preapre the param var to request channel allowance for the requested scan type */
436 	param.paramType = REGULATORY_DOMAIN_GET_SCAN_CAPABILITIES;
437 	param.content.channelCapabilityReq.band = band;
438 
439 	/* add default values to channels allowed for the requested scan type and band */
440 	for ( i = 0; i < allowedChannelsCount; i++ )
441 	{
442 		/* get specific channel allowance for scan type */
443 		if ( (scanType == SCAN_TYPE_NORMAL_PASSIVE) ||
444 			 (scanType == SCAN_TYPE_TRIGGERED_PASSIVE) ||
445 			 (scanType == SCAN_TYPE_SPS) )
446 		{
447 			param.content.channelCapabilityReq.scanOption = PASSIVE_SCANNING;
448 		}
449 		else
450 		{
451 			param.content.channelCapabilityReq.scanOption = ACTIVE_SCANNING;
452 		}
453 		param.content.channelCapabilityReq.channelNum = tempChannelList[ i ];
454 
455 		regulatoryDomain_getParam( pScanConcentrator->hRegulatoryDomain, &param );
456 		if ( TRUE == param.content.channelCapabilityRet.channelValidity )
457 		{
458 			/* add the channel ID */
459 			channelArray[ validChannelsCnt ].normalChannelEntry.channel = tempChannelList[ i ];
460 
461 			/* add other default parameters */
462 			channelArray[ validChannelsCnt ].normalChannelEntry.minChannelDwellTime = minChannelTime;
463 			channelArray[ validChannelsCnt ].normalChannelEntry.maxChannelDwellTime = maxDwellTime;
464 			channelArray[ validChannelsCnt ].normalChannelEntry.earlyTerminationEvent = ETCondition;
465 		    channelArray[ validChannelsCnt ].normalChannelEntry.ETMaxNumOfAPframes = ETFrameNumber;
466 			channelArray[ validChannelsCnt ].normalChannelEntry.txPowerDbm  =
467 				param.content.channelCapabilityRet.maxTxPowerDbm;
468 			/* Fill broadcast BSSID */
469 			for ( j = 0; j < 6; j++ )
470 			{
471 				channelArray[ validChannelsCnt ].normalChannelEntry.bssId.addr[ j ] = 0xff;
472 			}
473 			validChannelsCnt++;
474 		}
475 	}
476 
477 	/* return the number of channels that are actually allowed for the requested scan type on the requested band */
478 	return validChannelsCnt;
479 }
480 
481 /**
482  * \author Ronen Kalish\n
483  * \date 11-Jan-2005\n
484  * \brief Handles an unexpected event.\n
485 
486  *
487  * Function Scope \e Private.\n
488  * \param hScanCncn - handle to the scan concentrator object.\n
489  * \return always OK.\n
490  */
actionUnexpected(TI_HANDLE hScanCncn)491 TI_STATUS actionUnexpected( TI_HANDLE hScanCncn )
492 {
493     scanConcentrator_t* pScanConcentrator = (scanConcentrator_t*)hScanCncn;
494 
495     WLAN_REPORT_SM( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG, ("OID scan state machine error, unexpected Event\n\n") );
496 
497     return OK;
498 }
499 
500 
501 
502