1/*
2 * ScanMngrDbg.c
3 *
4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 *  * Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 *  * Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in
15 *    the documentation and/or other materials provided with the
16 *    distribution.
17 *  * Neither the name Texas Instruments nor the names of its
18 *    contributors may be used to endorse or promote products derived
19 *    from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34/** \file ScanMngrDbg.c
35 *  \brief This file include the scan manager debug module implementation
36 *  \
37 *  \date 29-March-2005
38 */
39
40#include "tidef.h"
41#include "report.h"
42#include "paramOut.h"
43#include "scanMngr.h"
44#include "ScanMngrDbg.h"
45#include "siteMgrApi.h"
46#include "DataCtrl_Api.h"
47
48
49/**
50 * \\n
51 * \date 29-March-2005\n
52 * \brief Main scan manager debug function
53 *
54 * Function Scope \e Public.\n
55 * \param hScanMngr - handle to the scan manager object.\n
56 * \param funcType - the specific debug function.\n
57 * \param pParam - parameters for the debug function.\n
58 * \param hSiteMgr - handle to th esite manager object.\n
59 * \param hCtrlData - handle to the data ctrl object.\n
60 */
61void scanMngrDebugFunction( TI_HANDLE hScanMngr, TI_UINT32 funcType, void *pParam, TI_HANDLE hSiteMgr, TI_HANDLE hCtrlData )
62{
63  	switch (funcType)
64	{
65	case DBG_SCAN_MNGR_PRINT_HELP:
66		printScanMngrDbgFunctions();
67		break;
68
69	case DBG_SCAN_MNGR_START_CONT_SCAN:
70		startContScan( hScanMngr, hSiteMgr, hCtrlData );
71		break;
72
73	case DBG_SCAN_MNGR_STOP_CONT_SCAN:
74		scanMngr_stopContScan( hScanMngr );
75		break;
76
77    case DBG_SCAN_MNGR_START_IMMED_SCAN:
78        scanMngr_startImmediateScan( hScanMngr, (1 == *((TI_INT32*)pParam) ? TI_TRUE : TI_FALSE) );
79        break;
80
81    case DBG_SCAN_MNGR_STOP_IMMED_SCAN:
82        scanMngr_stopImmediateScan( hScanMngr );
83        break;
84
85    case DBG_SCAN_MNGR_PRINT_TRACK_LIST:
86        scanMngrDebugPrintBSSList( hScanMngr );
87        break;
88
89    case DBG_SCAN_MNGR_PRINT_STATS:
90        scanMngr_statsPrint( hScanMngr );
91        break;
92
93    case DBG_SCAN_MNGR_RESET_STATS:
94        scanMngr_statsReset( hScanMngr );
95        break;
96
97    case DBG_SCAN_MNGR_PIRNT_NEIGHBOR_APS:
98        scanMngrDebugPrintNeighborAPList( hScanMngr );
99        break;
100
101    case DBG_SCAN_MNGR_PRINT_POLICY:
102        scanMngrTracePrintScanPolicy( &(((scanMngr_t*)hScanMngr)->scanPolicy) );
103        break;
104
105    case DBG_SCAN_MNGR_PRINT_OBJECT:
106        scanMngrDebugPrintObject( hScanMngr );
107        break;
108
109    default:
110		WLAN_OS_REPORT(("Invalid function type in scan manager debug function: %d\n", funcType));
111		break;
112	}
113}
114
115/**
116 * \\n
117 * \date 29-March-2005\n
118 * \brief Prints scan manager debug menu
119 *
120 * Function Scope \e Public.\n
121 */
122void printScanMngrDbgFunctions(void)
123{
124    WLAN_OS_REPORT(("   Scan Manager Debug Functions   \n"));
125	WLAN_OS_REPORT(("---------------------------------------\n"));
126	WLAN_OS_REPORT(("1500 - Print the scan manager Debug Help\n"));
127	WLAN_OS_REPORT(("1501 - Start continuous scan\n"));
128	WLAN_OS_REPORT(("1502 - Stop continuous scan\n"));
129    WLAN_OS_REPORT(("1503 - Start immediate scan\n"));
130    WLAN_OS_REPORT(("1504 - Stop immediate scan\n"));
131    WLAN_OS_REPORT(("1505 - Print tracking list\n"));
132    WLAN_OS_REPORT(("1506 - Print statistics\n"));
133    WLAN_OS_REPORT(("1507 - Reset statistics\n"));
134    WLAN_OS_REPORT(("1508 - Print neighbor APs list\n"));
135    WLAN_OS_REPORT(("1509 - Print Scan Policy\n"));
136    WLAN_OS_REPORT(("1510 - Print scan manager object\n"));
137}
138
139/**
140 * \\n
141 * \date 29-March-2005\n
142 * \brief Starts continuous scan process.\n
143 *
144 * Function Scope \e Public.\n
145 * \param hScanMngr - handle to the scan manager object.\n
146 * \param hSiteMgr - handle to the site manager object.\n\
147 * \param hCtrlData - handle to the data ctrl object.\n
148 */
149void startContScan( TI_HANDLE hScanMngr, TI_HANDLE hSiteMgr, TI_HANDLE hCtrlData )
150{
151    paramInfo_t param;
152    ERadioBand  radioBand;
153
154    /* get current band */
155    param.paramType = SITE_MGR_RADIO_BAND_PARAM;
156    siteMgr_getParam( hSiteMgr, &param );
157    radioBand = param.content.siteMgrRadioBand;
158
159    /* get current BSSID */
160	param.paramType = CTRL_DATA_CURRENT_BSSID_PARAM;
161	ctrlData_getParam( hCtrlData, &param );
162
163    /* start continuous scan */
164    scanMngr_startContScan( hScanMngr, &(param.content.ctrlDataCurrentBSSID), radioBand );
165}
166
167