• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** \file ScanCncnRoamingImmedSM.c
2  *  \brief This file include the scan concentrator immediate scan for roaming module implementation
3  *  \author Ronen Kalish
4  *  \date 03-Jan-2005
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 "ScanCncnRoamingImmedSM.h"
42 #include "MacServices_api.h"
43 #include "report.h"
44 #include "siteMgrApi.h"
45 #include "healthMonitor.h"
46 
47 static TI_STATUS actionUnexpected( TI_HANDLE hScanCncn );
48 static TI_STATUS actionNop( TI_HANDLE hScanCncn );
49 
50 extern BOOLEAN apConn_isPsRequiredBeforeScan(TI_HANDLE hAPConnection);
51 
52 /**
53  * \author Ronen Kalish\n
54  * \date 02-Jan-2005\n
55  * \brief Initialize the scan concentrator immediate scan for roaming SM.
56  *
57  * Function Scope \e Public.\n
58  * \param hScanCncn - handle to the scan concentrator object.\n
59  * \return OK if successful, NOK otherwise.\n
60  */
scanConcentratorRoamingImmedSM_init(TI_HANDLE hScanCncn)61 TI_STATUS scanConcentratorRoamingImmedSM_init( TI_HANDLE hScanCncn )
62 {
63     scanConcentrator_t* pScanConcentrator = (scanConcentrator_t*)hScanCncn;
64 
65     fsm_actionCell_t    smMatrix[ IMMED_SCAN_NUM_OF_STATES ][ IMMED_SCAN_NUM_OF_EVENTS ] =
66 	{
67 		/* next state and actions for IDLE state */
68 		{
69             {IMMED_SCAN_STATE_SCR_REQUEST, scanConcentratorRoamingImmedSM_requestSCR},     /*"START_SCAN",*/
70 			{IMMED_SCAN_STATE_IDLE, actionUnexpected},                                     /*"SCR_RUN",*/
71 			{IMMED_SCAN_STATE_IDLE, actionUnexpected},                                     /*"SCR_PEND",  */
72 			{IMMED_SCAN_STATE_IDLE, actionUnexpected},                                     /*"SCR_REJECT",*/
73             {IMMED_SCAN_STATE_IDLE, actionUnexpected},                                     /*"ABORT_SCAN"*/
74             {IMMED_SCAN_STATE_IDLE, actionUnexpected},                                     /*"FW_RESET"*/
75             {IMMED_SCAN_STATE_IDLE, actionNop},                                            /*"STOP_SCAN"*/
76             {IMMED_SCAN_STATE_IDLE, actionUnexpected}                                      /*"SCAN_COMPLETE"*/
77 
78 		},
79 
80 		/* next state and actions for SCR_REQUEST state */
81 		{
82             {IMMED_SCAN_STATE_SCR_REQUEST, actionUnexpected},                                     /*"START_SCAN",*/
83             {IMMED_SCAN_STATE_SCANNING, scanConcentratorRoamingImmedSM_startScan},         /*"SCR_RUN",*/
84 			{IMMED_SCAN_STATE_SCR_WAIT, actionNop},                                        /*"SCR_PEND",  */
85 			{IMMED_SCAN_STATE_IDLE, scanConcentratorRoamingImmedSM_scanRejected},          /*"SCR_REJECT",*/
86             {IMMED_SCAN_STATE_SCR_REQUEST, actionUnexpected},                                     /*"ABORT_SCAN"*/
87             {IMMED_SCAN_STATE_SCR_REQUEST, actionUnexpected},                                     /*"FW_RESET"*/
88             {IMMED_SCAN_STATE_SCR_REQUEST, actionUnexpected},                                     /*"STOP_SCAN"*/
89             {IMMED_SCAN_STATE_SCR_REQUEST, actionUnexpected}                                      /*"SCAN_COMPLETE"*/
90 		},
91 
92 		/* next state and actions for SCR_WAIT state */
93 		{
94             {IMMED_SCAN_STATE_SCR_WAIT, actionUnexpected},                                      /*"START_SCAN",*/
95 			{IMMED_SCAN_STATE_SCANNING, scanConcentratorRoamingImmedSM_startScan},         /*"SCR_RUN",*/
96 			{IMMED_SCAN_STATE_SCR_WAIT, actionNop},                                        /*"SCR_PEND",  */
97 			{IMMED_SCAN_STATE_IDLE, scanConcentratorRoamingImmedSM_scanRejected},          /*"SCR_REJECT",*/
98             {IMMED_SCAN_STATE_SCR_WAIT, actionUnexpected},                                      /*"ABORT_SCAN"*/
99             {IMMED_SCAN_STATE_SCR_WAIT, actionUnexpected},                                      /*"FW_RESET"*/
100             {IMMED_SCAN_STATE_IDLE, scanConcentratorRoamingImmedSM_scanRejected},          /*"STOP_SCAN"*/
101             {IMMED_SCAN_STATE_SCR_WAIT, actionUnexpected}                                       /*"SCAN_COMPLETE"*/
102 		},
103 
104         /* next state and actions for SCANNING state */
105         {
106             {IMMED_SCAN_STATE_SCANNING, actionUnexpected},                                     /*"START_SCAN",*/
107 			{IMMED_SCAN_STATE_SCANNING, actionUnexpected},                                     /*"SCR_RUN",*/
108 			{IMMED_SCAN_STATE_SCANNING, actionUnexpected},                                     /*"SCR_PEND",  */
109 			{IMMED_SCAN_STATE_SCANNING, actionUnexpected},                                     /*"SCR_REJECT",*/
110             {IMMED_SCAN_STATE_STOPPING, scanConcentratorRoamingImmedSM_abortScan},         /*"ABORT_SCAN"*/
111             {IMMED_SCAN_STATE_SCANNING, scanConcentratorRoamingImmedSM_recoveryDuringScan},/*"FW_RESET"*/
112             {IMMED_SCAN_STATE_STOPPING, scanConcentratorRoamingImmedSM_abortScan},         /*"STOP_SCAN"*/
113             {IMMED_SCAN_STATE_IDLE, scanConcentratorRoamingImmedSM_scanComplete}           /*"SCAN_COMPLETE"*/
114 		},
115 
116         /* next state and actions for STOPPING state */
117 		{
118             {IMMED_SCAN_STATE_STOPPING, actionUnexpected},                                     /*"START_SCAN",*/
119 			{IMMED_SCAN_STATE_STOPPING, actionUnexpected},                                     /*"SCR_RUN",*/
120 			{IMMED_SCAN_STATE_STOPPING, actionUnexpected},                                     /*"SCR_PEND",  */
121 			{IMMED_SCAN_STATE_STOPPING, actionUnexpected},                                     /*"SCR_REJECT",*/
122             {IMMED_SCAN_STATE_STOPPING, actionNop},                                        /*"ABORT_SCAN"*/
123             {IMMED_SCAN_STATE_STOPPING, scanConcentratorRoamingImmedSM_recoveryDuringScan},/*"FW_RESET"*/
124             {IMMED_SCAN_STATE_STOPPING, actionNop},                                        /*"STOP_SCAN"*/
125             {IMMED_SCAN_STATE_IDLE, scanConcentratorRoamingImmedSM_scanComplete}           /*"SCAN_COMPLETE"*/
126 		}
127     };
128 
129     /* initialize current state */
130     pScanConcentrator->clientSMState[ SCAN_SCC_ROAMING_IMMED ] = IMMED_SCAN_STATE_IDLE;
131 
132     /* configure the state machine */
133 	return fsm_Config( pScanConcentrator->clientSM[ SCAN_SCC_ROAMING_IMMED ], (fsm_Matrix_t)smMatrix,
134                        IMMED_SCAN_NUM_OF_STATES, IMMED_SCAN_NUM_OF_EVENTS,
135                        (fsm_eventActivation_t)scanConcentratorRoamingImmedSM_SMEvent, pScanConcentrator->hOS );
136 }
137 
138 
139 #ifdef REPORT_LOG
140 
141 /* state descriptions, for state machine logging */
142 static char stateDesc[ IMMED_SCAN_NUM_OF_STATES ][ MAX_DESC_STRING_LEN ] =
143 {
144     "STATE_IDLE",
145     "STATE_SCR_REQUEST",
146     "STATE_SCR_WAIT",
147     "STATE_SCANNING",
148     "STATE_STOPPING"
149 };
150 
151 /* event descriptions, for state machine logging */
152 static char eventDesc[ IMMED_SCAN_NUM_OF_EVENTS ][ MAX_DESC_STRING_LEN ] =
153 {
154     "EVENT_START_SCAN",
155     "EVENT_SCR_RUN",
156     "EVENT_SCR_PEND",
157     "EVENT_SCR_REJECT",
158     "EVENT_ABORT_SCAN",
159     "EVENT_FW_RESET",
160     "EVENT_STOP_SCAN",
161     "EVENT_SCAN_COMPLETE"
162 };
163 
164 #endif
165 
166 /**
167  * \author Ronen Kalish\n
168  * \date 02-Jan-2005\n
169  * \brief Processes an event.
170  *
171  * Function Scope \e Public.\n
172  * \param hScanCncn - handle to the scan concentrator object.\n
173  * \param currentState - the current immediate scan for roaming SM state.\n
174  * \param event - the event to handle.\n
175  * \return OK if successful, NOK otherwise.\n
176  */
scanConcentratorRoamingImmedSM_SMEvent(TI_HANDLE hScanCncn,scan_immedSMStates_e * currentState,scan_immedSMEvents_e event)177 TI_STATUS scanConcentratorRoamingImmedSM_SMEvent( TI_HANDLE hScanCncn, scan_immedSMStates_e* currentState,
178                                                   scan_immedSMEvents_e event )
179 {
180     scanConcentrator_t *pScanConcentrator = (scanConcentrator_t *)hScanCncn;
181 	TI_STATUS status = OK;
182 	UINT8 nextState;
183 
184     /* obtain the next state */
185 	status = fsm_GetNextState( pScanConcentrator->clientSM[ SCAN_SCC_ROAMING_IMMED ],
186                  *(UINT8*)currentState, (UINT8)event, &nextState );
187 	if ( status != OK )
188 	{
189 		WLAN_REPORT_SM( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG,
190                         ("Failed getting immediate scan for roaming next state.\n") );
191 		return NOK;
192 	}
193 
194     /* report the move */
195     WLAN_REPORT_SM( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG,
196                     ("IMMED ROAMING SCAN: <%s, %s> --> %s\n\n",
197                     stateDesc[(UINT8)*currentState],
198                     eventDesc[(UINT8)event],
199                     stateDesc[nextState]) );
200 
201     /* move */
202     return fsm_Event( pScanConcentrator->clientSM[ SCAN_SCC_ROAMING_IMMED ], (UINT8*)currentState,
203                       (UINT8)event, hScanCncn );
204 }
205 
206 /**
207  * \author Ronen Kalish\n
208  * \date 02-Jan-2005\n
209  * \brief SM action - handles a start scan event (by requesting the SCR)
210  *
211  * Function Scope \e Public.\n
212  * \param hScanCncn - handle to the scan concentrator object.\n
213  * \return OK if successful, NOK otherwise.\n
214  */
scanConcentratorRoamingImmedSM_requestSCR(TI_HANDLE hScanCncn)215 TI_STATUS scanConcentratorRoamingImmedSM_requestSCR( TI_HANDLE hScanCncn )
216 {
217     scr_clientRequestStatus_e scrReplyStatus;
218 	scr_pendReason_e scrPendReason;
219     scanConcentrator_t* pScanConcentrator = (scanConcentrator_t*)hScanCncn;
220 
221     WLAN_REPORT_INFORMATION( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG,
222                              ("IMMED SM: Requesting SCR.\n") );
223 
224     /* request the SCR as immediate roaming client, and act according to return status */
225     switch ( scrReplyStatus = scr_clientRequest( pScanConcentrator->hSCR, SCR_CID_IMMED_SCAN, &scrPendReason ) )
226     {
227     case SCR_CRS_PEND:
228         WLAN_REPORT_INFORMATION( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG,
229                                  ("IMMED SM: SCR pending, pend Reason: %d.\n", scrPendReason) );
230 
231         if ( SCR_PR_DIFFERENT_GROUP_RUNNING == scrPendReason )
232         {
233             /* send a reject event to the SM - will not scan if not in connected group */
234 			pScanConcentrator->scanResult[ SCAN_SCC_ROAMING_IMMED ] = SCAN_CRS_SCAN_FAILED;
235 			return scanConcentratorRoamingImmedSM_SMEvent( hScanCncn,
236                                                            (scan_immedSMStates_e*)&(pScanConcentrator->clientSMState[ SCAN_SCC_ROAMING_IMMED ]),
237                                                            IMMED_SCAN_EVENT_SCR_REJECT );
238         }
239         else
240         {
241             /* send a pend event to the SM */
242             return scanConcentratorRoamingImmedSM_SMEvent( hScanCncn,
243                                                            (scan_immedSMStates_e*)&(pScanConcentrator->clientSMState[ SCAN_SCC_ROAMING_IMMED ]),
244                                                            IMMED_SCAN_EVENT_SCR_PEND );
245         }
246 /*        break; - unreachable */
247 
248     case SCR_CRS_RUN:
249         /* send a run event to the SM */
250         WLAN_REPORT_INFORMATION( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG,
251                                  ("IMMED SM: SCR acquired.\n") );
252         return scanConcentratorRoamingImmedSM_SMEvent( hScanCncn,
253                                                        (scan_immedSMStates_e*)&(pScanConcentrator->clientSMState[ SCAN_SCC_ROAMING_IMMED ]),
254                                                        IMMED_SCAN_EVENT_SCR_RUN );
255 /*        break; - unreachable */
256 
257     default:
258         WLAN_REPORT_WARNING( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG,
259                              ("IMMED SM: SCR returned unrecognized status: %d.\n", scrReplyStatus) );
260 		pScanConcentrator->scanResult[ SCAN_SCC_ROAMING_IMMED ] = SCAN_CRS_SCAN_FAILED;
261         /* Notify scan complete to recover from this error */
262         scanConcentratorRoamingImmedSM_SMEvent( hScanCncn,
263                                                 (scan_immedSMStates_e*)&(pScanConcentrator->clientSMState[ SCAN_SCC_ROAMING_IMMED ]),
264                                                 IMMED_SCAN_EVENT_SCAN_COMPLETE );
265         return NOK;
266 /*        break;  - unreachable */
267     }
268 
269 /*    return OK; - unreachable */
270 }
271 
272 /**
273  * \author Ronen Kalish\n
274  * \date 02-Jan-2005\n
275  * \brief SM action - handles a SCR run event (by starting the actual scan)
276  *
277  * Function Scope \e Public.\n
278  * \param hScanCncn - handle to the scan concentrator object.\n
279  * \return OK if successful, NOK otherwise.\n
280  */
scanConcentratorRoamingImmedSM_startScan(TI_HANDLE hScanCncn)281 TI_STATUS scanConcentratorRoamingImmedSM_startScan( TI_HANDLE hScanCncn )
282 {
283     scanConcentrator_t* pScanConcentrator = (scanConcentrator_t*)hScanCncn;
284     TI_STATUS status;
285     BOOLEAN psRequest;
286 
287     WLAN_REPORT_INFORMATION( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG,
288                              ("IMMED SM: Sending scan command to scan SRV.\n") );
289 
290     /* mark that this scan is currently running */
291     pScanConcentrator->currentRunningScanClient = SCAN_SCC_ROAMING_IMMED;
292 
293     /* register for scan results with the MLME parser */
294     if ( OK != mlmeParser_registerForBeaconAndProbeResp( pScanConcentrator->hMlme,
295                                                          scanConcentrator_mlmeResultCB,
296                                                          hScanCncn ) )
297     {
298         WLAN_REPORT_WARNING( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG,
299                              ("IMMED SM: MLME result registration failed.\n") );
300 
301         /* mark the return status */
302         pScanConcentrator->scanResult[ SCAN_SCC_ROAMING_IMMED ] = SCAN_CRS_SCAN_FAILED;
303 
304         /* could not start scan, send a scan complete event */
305         scanConcentratorRoamingImmedSM_SMEvent( hScanCncn,
306                                                 (scan_immedSMStates_e*)&(pScanConcentrator->clientSMState[ SCAN_SCC_ROAMING_IMMED ]),
307                                                 IMMED_SCAN_EVENT_SCAN_COMPLETE );
308 
309         return NOK;
310     }
311 
312 	 /* stop built-in test timer, to avoid TX stuck due to heavy traffic and unknown scan result time originally at scanSrv*/
313 	healthMonitor_suspendPeriodicTest( pScanConcentrator->hHealthMonitor );
314 
315 	psRequest = apConn_isPsRequiredBeforeScan(pScanConcentrator->hAPConn);
316 
317     /* call the scan SRV start scan */
318     if ( OK != (status = MacServices_scanSRV_scan( pScanConcentrator->hMacServices,
319                                        &(pScanConcentrator->clientScanParams[ SCAN_SCC_ROAMING_IMMED ]),
320                                        ( (SCAN_TYPE_TRIGGERED_ACTIVE == pScanConcentrator->clientScanParams[ SCAN_SCC_ROAMING_IMMED ].scanType) ||
321                                          (SCAN_TYPE_TRIGGERED_PASSIVE == pScanConcentrator->clientScanParams[ SCAN_SCC_ROAMING_IMMED ].scanType)
322                                          ? FALSE : TRUE ), /* Triggered scan cannot be high priority */
323                                        TRUE,
324                                        TRUE,
325 									   ( psRequest ? POWER_SAVE_ON : POWER_SAVE_KEEP_CURRENT ),
326                                        psRequest,
327 									   NULL,NULL)) )
328     {
329         WLAN_REPORT_WARNING( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG,
330                              ("IMMED SM: scan SRV returned status %d, quitting immediate scan.\n", status) );
331 
332         /* mark the return status */
333         pScanConcentrator->scanResult[ SCAN_SCC_ROAMING_IMMED ] = SCAN_CRS_SCAN_FAILED;
334 
335 	    /* unregister at the MLME for scan result frames */
336         mlmeParser_unregisterForBeaconAndProbeResp( pScanConcentrator->hMlme );
337 
338         /* could not start scan, send a scan complete event */
339         scanConcentratorRoamingImmedSM_SMEvent( hScanCncn,
340                                                 (scan_immedSMStates_e*)&(pScanConcentrator->clientSMState[ SCAN_SCC_ROAMING_IMMED ]),
341                                                 IMMED_SCAN_EVENT_SCAN_COMPLETE );
342 
343         return NOK;
344     }
345 
346     return OK;
347 }
348 
349 /**
350  * \author Ronen Kalish\n
351  * \date 02-Jan-2005\n
352  * \brief SM action - handles a stop scan or abort scan event (by stopping the actual scan)
353  *
354  * Function Scope \e Public.\n
355  * \param hScanCncn - handle to the scan concentrator object.\n
356  * \return OK if successful, NOK otherwise.\n
357  */
scanConcentratorRoamingImmedSM_abortScan(TI_HANDLE hScanCncn)358 TI_STATUS scanConcentratorRoamingImmedSM_abortScan( TI_HANDLE hScanCncn )
359 {
360     scanConcentrator_t* pScanConcentrator = (scanConcentrator_t*)hScanCncn;
361     BOOLEAN     bSendNullData;
362 
363     WLAN_REPORT_INFORMATION( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG,
364                              ("IMMED SM: aborting scan.\n") );
365 
366     bSendNullData = (pScanConcentrator->bAbortOrStop == SCAN_CNCN_STOP) ? TRUE : FALSE;
367 
368     /* call the scan SRV stop scan */
369     MacServices_scanSRV_stopScan( pScanConcentrator->hMacServices, bSendNullData , NULL , NULL );
370 
371     return OK;
372 }
373 
374 /**
375  * \author Ronen Kalish\n
376  * \date 10-July-2005\n
377  * \brief SM action - handles a recovery event (calls the scan SRV abort on FW reset and than finishes scan)
378  *
379  * Function Scope \e Public.\n
380  * \param hScanCncn - handle to the scan concentrator object.\n
381  * \return OK if successful, NOK otherwise.\n
382  */
scanConcentratorRoamingImmedSM_recoveryDuringScan(TI_HANDLE hScanCncn)383 TI_STATUS scanConcentratorRoamingImmedSM_recoveryDuringScan( TI_HANDLE hScanCncn )
384 {
385     scanConcentrator_t* pScanConcentrator = (scanConcentrator_t*)hScanCncn;
386 
387     WLAN_REPORT_INFORMATION( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG,
388                              ("IMMED SM: Recovery occured!.\n") );
389 
390     /* reset the scan SRV */
391     MacServices_scanSRV_stopOnFWReset( pScanConcentrator->hMacServices );
392 
393     /* send a scan complete event to the SM */
394     return scanConcentratorRoamingImmedSM_SMEvent( hScanCncn,
395                                                    (scan_immedSMStates_e*)&(pScanConcentrator->clientSMState[ SCAN_SCC_ROAMING_IMMED ]),
396                                                    IMMED_SCAN_EVENT_SCAN_COMPLETE );
397 }
398 
399 /**
400  * \author Ronen Kalish\n
401  * \date 02-Jan-2005\n
402  * \brief SM action - handles a scan complete event (by releasing the SCR and calling the scan complete CB).
403  *
404  * Function Scope \e Public.\n
405  * \param hScanCncn - handle to the scan concentrator object.\n
406  * \return OK if successful, NOK otherwise.\n
407  */
scanConcentratorRoamingImmedSM_scanComplete(TI_HANDLE hScanCncn)408 TI_STATUS scanConcentratorRoamingImmedSM_scanComplete( TI_HANDLE hScanCncn )
409 {
410     scanConcentrator_t* pScanConcentrator = (scanConcentrator_t*)hScanCncn;
411 
412     WLAN_REPORT_INFORMATION( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG,
413                              ("IMMED SM: Scan is complete.\n") );
414 
415 	/* unregister at the MLME for scan result frames */
416     mlmeParser_unregisterForBeaconAndProbeResp( pScanConcentrator->hMlme );
417 
418     /* mark that this scan is no longer running */
419     pScanConcentrator->currentRunningScanClient = SCAN_SCC_NO_CLIENT;
420 
421     /* release the SCR */
422     scr_clientComplete( pScanConcentrator->hSCR, SCR_CID_IMMED_SCAN );
423 
424     /* notify the scan complete to the scan mngr */
425     if ( FALSE == pScanConcentrator->bInRequest )
426     {
427         pScanConcentrator->scanResultCB[ SCAN_SCC_ROAMING_IMMED ]( pScanConcentrator->scanResultCBObj[ SCAN_SCC_ROAMING_IMMED ],
428                                                                    pScanConcentrator->scanResult[ SCAN_SCC_ROAMING_IMMED ],
429                                                                    NULL, 0xffff );
430     }
431 
432     return OK;
433 }
434 
435 /**
436  * \author Ronen Kalish\n
437  * \date 02-Jan-2005\n
438  * \brief SM action - handles a scan reject event (abort scan before scan actually started)\n
439  *
440  * Function Scope \e Public.\n
441  * \param hScanCncn - handle to the scan concentrator object.\n
442  * \return OK if successful, NOK otherwise.\n
443  */
scanConcentratorRoamingImmedSM_scanRejected(TI_HANDLE hScanCncn)444 TI_STATUS scanConcentratorRoamingImmedSM_scanRejected( TI_HANDLE hScanCncn )
445 {
446     scanConcentrator_t* pScanConcentrator = (scanConcentrator_t*)hScanCncn;
447 
448     WLAN_REPORT_INFORMATION( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG,
449                              ("IMMED SM: Scan is rejected.\n") );
450 
451     /* release the SCR */
452     scr_clientComplete( pScanConcentrator->hSCR, SCR_CID_IMMED_SCAN );
453 
454     /* notify the scan complete to the scan mngr */
455     if ( FALSE == pScanConcentrator->bInRequest )
456     {
457         pScanConcentrator->scanResultCB[ SCAN_SCC_ROAMING_IMMED ]( pScanConcentrator->scanResultCBObj[ SCAN_SCC_ROAMING_IMMED ],
458                                                                    pScanConcentrator->scanResult[ SCAN_SCC_ROAMING_IMMED ],
459                                                                    NULL, 0xffff );
460     }
461 
462     return OK;
463 }
464 
465 /**
466  * \author Ronen Kalish\n
467  * \date 11-Jan-2005\n
468  * \brief Handles an unexpected event.\n
469  *
470  * Function Scope \e Private.\n
471  * \param hScanCncn - handle to the scan concentrator object.\n
472  * \return always OK.\n
473  */
actionUnexpected(TI_HANDLE hScanCncn)474 TI_STATUS actionUnexpected( TI_HANDLE hScanCncn )
475 {
476     scanConcentrator_t* pScanConcentrator = (scanConcentrator_t*)hScanCncn;
477 
478     WLAN_REPORT_ERROR( pScanConcentrator->hReport, SCAN_CNCN_MODULE_LOG,
479                     ("Immediate scan for roaming state machine error, unexpected Event, state=%d\n\n",
480 					 pScanConcentrator->clientSMState[SCAN_SCC_ROAMING_IMMED]) );
481 
482     return OK;
483 }
484 
485 /**
486  * \author Ronen Kalish\n
487  * \date 10-Jan-2005\n
488  * \brief Handles an event that doesn't require any action.\n
489  *
490  * Function Scope \e Private.\n
491  * \param hScanCncn - handle to the scan concentrator object.\n
492  * \return always OK.\n
493  */
actionNop(TI_HANDLE hScanCncn)494 TI_STATUS actionNop( TI_HANDLE hScanCncn )
495 {
496     return OK;
497 }
498 
499