|
1 /* |
|
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of CWsfWLANListActiveWrapper. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CWSFWLANLISTACTIVEWRAPPER_H |
|
19 #define CWSFWLANLISTACTIVEWRAPPER_H |
|
20 |
|
21 // EXTERNAL INCLUDES |
|
22 #include <e32base.h> |
|
23 |
|
24 // INTERNAL INCLUDES |
|
25 #include "wsfaicontroller.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CWsfModel; |
|
29 class CWsfWlanInfoArray; |
|
30 |
|
31 /** |
|
32 * Active object that fetches wlan list data |
|
33 * |
|
34 * @lib wsfaiplugin.lib |
|
35 * @since S60 v5.2 |
|
36 */ |
|
37 class CWsfWLANListActiveWrapper : public CActive |
|
38 { |
|
39 public: // Constructors and destructor |
|
40 |
|
41 /** |
|
42 * Destructor |
|
43 * @since S60 5.2 |
|
44 */ |
|
45 ~CWsfWLANListActiveWrapper(); |
|
46 |
|
47 /** |
|
48 * Two-phased constructor. |
|
49 * @since S60 5.2 |
|
50 */ |
|
51 static CWsfWLANListActiveWrapper* NewL( CWsfModel* aModel, |
|
52 TWsfAiController &aController ); |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 * @since S60 5.2 |
|
57 */ |
|
58 static CWsfWLANListActiveWrapper* NewLC( CWsfModel* aModel, |
|
59 TWsfAiController &aController ); |
|
60 |
|
61 public: |
|
62 /** |
|
63 * Function for making the initial request |
|
64 * @since S60 5.2 |
|
65 * @param aStarUp is start called from plugin start up |
|
66 */ |
|
67 void Start( TBool aStarUp ); |
|
68 |
|
69 /** |
|
70 * Returns the list of found WLANs. |
|
71 * Ownership not passed. |
|
72 * @since S60 5.2 |
|
73 * @return Array of WLANs |
|
74 */ |
|
75 CWsfWlanInfoArray* GetWlanList(); |
|
76 |
|
77 /** |
|
78 * Returns the connected WLAN network |
|
79 * @since S60 5.2 |
|
80 * @return TWsfWlanInfo |
|
81 */ |
|
82 TWsfWlanInfo GetConnectedWLANNetwork(); |
|
83 |
|
84 private: |
|
85 |
|
86 /** |
|
87 * constructor |
|
88 */ |
|
89 CWsfWLANListActiveWrapper(); |
|
90 |
|
91 /** |
|
92 * Factory function. |
|
93 * @since S60 5.2 |
|
94 * @param aModel Whether to react to screensaver events |
|
95 * @param aController Whether to react to screensaver events |
|
96 */ |
|
97 void ConstructL( CWsfModel* aModel, TWsfAiController &aController ); |
|
98 |
|
99 private: // From CActive |
|
100 |
|
101 /** |
|
102 * @see CActive |
|
103 */ |
|
104 void RunL(); |
|
105 |
|
106 /** |
|
107 * @see CActive |
|
108 */ |
|
109 void DoCancel(); |
|
110 |
|
111 /** |
|
112 * @see CActive |
|
113 */ |
|
114 TInt RunError( TInt aError ); |
|
115 |
|
116 private: |
|
117 |
|
118 /** |
|
119 * States of the active object |
|
120 */ |
|
121 enum TCWsfWLANListActiveWrapperState |
|
122 { |
|
123 EUninitialized, // Uninitialized |
|
124 EInitialized, // Initalized |
|
125 EProcessWLANListData, // Create wlan array from results |
|
126 EGetConnectedNetwork, // Request connected network |
|
127 EError |
|
128 // Error condition |
|
129 }; |
|
130 |
|
131 private: |
|
132 |
|
133 /** |
|
134 * State of the active object |
|
135 */ |
|
136 TInt iState; // State of the active object |
|
137 |
|
138 /** |
|
139 * Needed size to allocate result data |
|
140 */ |
|
141 TPckgBuf<TUint> iPckgNeededSize; |
|
142 |
|
143 /** |
|
144 * Data size in engine |
|
145 */ |
|
146 TPckgBuf<TUint> iPckgAllocatedSize; |
|
147 |
|
148 /** |
|
149 * Connected network request result |
|
150 */ |
|
151 TPckgBuf<TBool> iPckg; |
|
152 |
|
153 /** |
|
154 * Reference to Model |
|
155 */ |
|
156 CWsfModel* iModel; |
|
157 |
|
158 /** |
|
159 * Array to store WLAN scan results. Owned. |
|
160 */ |
|
161 CWsfWlanInfoArray* iArray; |
|
162 |
|
163 /** |
|
164 * TPtr to wlan data |
|
165 */ |
|
166 TPtr8 iPtr; |
|
167 |
|
168 /** |
|
169 * Wlan data buffer |
|
170 */ |
|
171 HBufC8* iBuffer; |
|
172 |
|
173 /** |
|
174 * Pointer to TWsfAiController |
|
175 */ |
|
176 TWsfAiController *iController; |
|
177 |
|
178 /** |
|
179 * Is this object called from plugin startup |
|
180 */ |
|
181 TBool iStartUp; |
|
182 |
|
183 /** |
|
184 * Retries to fetch data |
|
185 */ |
|
186 TInt iRetriesLeft; |
|
187 |
|
188 /** |
|
189 * Cache of the connected WLAN data |
|
190 */ |
|
191 TWsfWlanInfo iConnectedWlan; |
|
192 |
|
193 }; |
|
194 |
|
195 #endif // CWSFWLANLISTACTIVEWRAPPER_H |