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: Class header for CWsfAiModel |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_WSFAIMODEL_H |
|
20 #define C_WSFAIMODEL_H |
|
21 |
|
22 // EXTERNAL INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <badesca.h> |
|
25 #include "wsfwlaninfo.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CWsfWlanInfoArray; |
|
29 class CWsfWlanInfoArrayVisitor; |
|
30 class CCoeEnv; |
|
31 class CAknIconArray; |
|
32 class CGulIcon; |
|
33 |
|
34 //class TWsfWlanInfo; |
|
35 |
|
36 /** |
|
37 * The model part. It holds the list of available WLANs and creates the |
|
38 * suitable texts and icons to display. |
|
39 * |
|
40 * @lib wsfaiplugin.lib |
|
41 * @since S60 v5.0 |
|
42 */ |
|
43 class CWsfAiModel : public CBase |
|
44 { |
|
45 public: // Constructors and destructor |
|
46 |
|
47 /** |
|
48 * Two-phased constructor |
|
49 * @since S60 5.0 |
|
50 * @return instance of CWsfAiModel class |
|
51 */ |
|
52 static CWsfAiModel* NewL(); |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. Leaves the object on CleanupStack |
|
56 * @since S60 5.0 |
|
57 * @return instance of CWsfAiModel class |
|
58 */ |
|
59 static CWsfAiModel* NewLC(); |
|
60 |
|
61 /** |
|
62 * Destructor of CWsfAiModel class |
|
63 * @since S60 5.0 |
|
64 */ |
|
65 ~CWsfAiModel(); |
|
66 |
|
67 private: // Constructors |
|
68 |
|
69 /** |
|
70 * Default C++ constructor |
|
71 * @since S60 5.0 |
|
72 */ |
|
73 CWsfAiModel(); |
|
74 |
|
75 /** |
|
76 * 2nd phase constructor |
|
77 * @since S60 5.0 |
|
78 */ |
|
79 void ConstructL(); |
|
80 |
|
81 public: // New methods |
|
82 |
|
83 /** |
|
84 * Creates array for the listbox, it contains a formatted array of WLANs. |
|
85 * @param aWlanList - Array of WLAN that will be formatted. |
|
86 * @return Formatted WLAN list (Ownership not passed) |
|
87 */ |
|
88 CDesCArrayFlat* FormatWlanListL( CWsfWlanInfoArray* aWlanList, const TBool aUIPrioritySort ); |
|
89 |
|
90 /* |
|
91 * Returns WLAN list that has already formatted |
|
92 * @return Formatted WLAN list (Ownership not passed) |
|
93 */ |
|
94 CDesCArrayFlat* GetWlanList(); |
|
95 |
|
96 /** |
|
97 * Returns a pointerarray for TWsfWlanInfo items. |
|
98 * @return non-formatted WLAN list (Ownership not passed) |
|
99 */ |
|
100 CWsfWlanInfoArray* GetInfoArray(); |
|
101 |
|
102 /** |
|
103 * Format the WlanList for one-line |
|
104 * @param aWlanList - Array of WLAN that will be formatted. |
|
105 * @return Formatted WLAN list (Ownership not passed) |
|
106 */ |
|
107 CDesCArrayFlat* FormatSingleLineWlanListL( |
|
108 CWsfWlanInfoArray* aWlanList ); |
|
109 |
|
110 /** |
|
111 * Load and format the refreshing information for the WLAN list |
|
112 * @return Formatted WLAN list (Ownership not passed) |
|
113 */ |
|
114 CDesCArrayFlat* FormatRefreshingL(); |
|
115 |
|
116 /** |
|
117 * Load and format the connecting information for the WLAN list |
|
118 * @return Formatted WLAN list (Ownership not passed) |
|
119 */ |
|
120 CDesCArrayFlat* FormatConnectingL(); |
|
121 |
|
122 /** |
|
123 * Appends icons of customer favourite networks to the given array |
|
124 * @param aIconArray The icon array to which brand icons |
|
125 * should be appended |
|
126 */ |
|
127 void AppendBrandIconsL( CAknIconArray& aIconArray ); |
|
128 |
|
129 /** |
|
130 * Set the scanning status flag on |
|
131 */ |
|
132 inline void SetScanningOn(); |
|
133 |
|
134 /** |
|
135 * Set the scanning status flag off |
|
136 */ |
|
137 inline void SetScanningOff(); |
|
138 |
|
139 /** |
|
140 * Returns with the scanning status flag |
|
141 * @since S60 5.0 |
|
142 * @return ETrue if the scanning on, if it is off EFalse |
|
143 */ |
|
144 inline TBool ScanningOn(); |
|
145 |
|
146 /** |
|
147 * Returns that the WLAN item connected or not. |
|
148 * @return ETrue if it is connected otherwise EFalse |
|
149 */ |
|
150 inline TBool Connected(); |
|
151 |
|
152 /** |
|
153 * Sets the connected flag |
|
154 * @param - aConnected True if connected |
|
155 */ |
|
156 inline void SetConnected( TBool aConnected ); |
|
157 |
|
158 /** |
|
159 * Sets the connected flag |
|
160 * @param - aConnected True if connected |
|
161 */ |
|
162 inline void SetConnecting( TBool aConnecting ); |
|
163 |
|
164 /** |
|
165 * Sets the connected wlan info |
|
166 * @param aConnected - connected wlan info |
|
167 */ |
|
168 inline void SetConnectedWlanInfo( TWsfWlanInfo& aWlanInfo ); |
|
169 |
|
170 /** |
|
171 * Initialize the refresh animation |
|
172 */ |
|
173 void InitializeRefreshAnimation(); |
|
174 |
|
175 /* |
|
176 * Step the animation |
|
177 */ |
|
178 void AnimateRefresh(); |
|
179 |
|
180 /** |
|
181 * Initialize the refresh animation |
|
182 */ |
|
183 void InitializeConnectingAnimation(); |
|
184 |
|
185 /* |
|
186 * Step the animation |
|
187 */ |
|
188 void AnimateConnecting(); |
|
189 |
|
190 private: // New methods |
|
191 |
|
192 /** |
|
193 * Format the Hidden WLANs for the listbox.(text and icon) |
|
194 * @since S60 v5.0 |
|
195 * @param aWlan - Reference to wlaninfo |
|
196 * @param aItem - Listbox item |
|
197 */ |
|
198 void FormatHiddenWlanItemL( TWsfWlanInfo& aWlan, TPtr& aItem ); |
|
199 |
|
200 /** |
|
201 * Format the listbox filed with the scanning status off information |
|
202 * @since S60 v5.0 |
|
203 * @param aItem - Listbox item |
|
204 */ |
|
205 void FormatStatusOffL( TPtr& aItem ); |
|
206 |
|
207 /** |
|
208 * Format the listbox filed with the No Wlan found information |
|
209 * @since S60 v5.0 |
|
210 * @param aItem - Listbox item |
|
211 */ |
|
212 void FormatNoWlansAvailableL( TPtr& aItem ); |
|
213 |
|
214 /** |
|
215 * Format the WlanList item for one-line or (visible networks) items for |
|
216 * the listbox.(text and icon) |
|
217 * @param aWlan - reference to wlaninfo |
|
218 * @param aItem - Listbox item |
|
219 * @param aSingleLine - ETrue if Single Line Item wanted to be shown |
|
220 * EFalse if Visible Wlan Item wanted to be shown |
|
221 */ |
|
222 void FormatWlanSingleLineL( TWsfWlanInfo& aWlan, |
|
223 TPtr& aItem, |
|
224 TBool aSingleLine ); |
|
225 |
|
226 /** |
|
227 * Format the WlanList items in one-line for Unknown networks |
|
228 * @param aMultipleUnknownWlans - ETreue if more unknown network found |
|
229 * @param aItem - Listbox item |
|
230 */ |
|
231 void FormatUnknownWlansSingleLineL( const TBool aMultipleUnknownWlans, |
|
232 TPtr& aItem ); |
|
233 |
|
234 /** |
|
235 * Go through the WLANs list and find Max signal strength amont know wlans |
|
236 * @param aWlanList - array of WLANs |
|
237 * @return the ID of the Wlan with the Max signal strength |
|
238 */ |
|
239 TInt FindPreferredKnownWlan( CWsfWlanInfoArray* aWlanList ); |
|
240 |
|
241 /** |
|
242 * Check if there's connection and it is the first item in array |
|
243 * @param aWlanList - array of WLANs |
|
244 * @param aItem - Listbox item |
|
245 */ |
|
246 void CheckWlansL( CWsfWlanInfoArray* aWlanList, TPtr& aItem ); |
|
247 |
|
248 /** |
|
249 * Formats the connected string. |
|
250 * @param aItem - The name of the connected network to be put |
|
251 */ |
|
252 void FormatConnectedL( TPtr& aItem ); |
|
253 |
|
254 private: // Data |
|
255 |
|
256 /** |
|
257 * Array of WLANs |
|
258 * Not Own. |
|
259 */ |
|
260 CWsfWlanInfoArray* iWlanInfoArray; |
|
261 |
|
262 /** |
|
263 * Coe env for loading string from resource |
|
264 * Not Own. |
|
265 */ |
|
266 CCoeEnv* iCoeEnv; |
|
267 |
|
268 /** |
|
269 * List that contains the WLAN items |
|
270 * Own. |
|
271 */ |
|
272 CDesCArrayFlat* iFormattedWlanList; |
|
273 |
|
274 /** |
|
275 * WlanInfoArrayVisitor |
|
276 * Own. |
|
277 */ |
|
278 CWsfWlanInfoArrayVisitor *iWlanInfoBranding; |
|
279 |
|
280 /** |
|
281 * The scanning status flag |
|
282 */ |
|
283 TBool iScanning; |
|
284 |
|
285 /** |
|
286 * Connected status flag |
|
287 */ |
|
288 TBool iConnected; |
|
289 |
|
290 /** |
|
291 * Connected status flag |
|
292 */ |
|
293 TBool iConnecting; |
|
294 |
|
295 /** |
|
296 * Info of the connected WLAN |
|
297 */ |
|
298 TWsfWlanInfo iConnectedWlanInfo; |
|
299 |
|
300 /** |
|
301 * List of animation states of refreshing icon |
|
302 */ |
|
303 TFixedArray<TInt, 4> iRefreshIcons; |
|
304 |
|
305 /** |
|
306 * List of animation states of connecting icon |
|
307 */ |
|
308 TFixedArray<TInt, 4> iConnectingIcons; |
|
309 |
|
310 /** |
|
311 * The refreshing animation frame index |
|
312 */ |
|
313 TInt iRefreshIndex; |
|
314 |
|
315 /** |
|
316 * The connecting animation frame index |
|
317 */ |
|
318 TInt iConnectingIndex; |
|
319 |
|
320 /** |
|
321 * Constants for 'WLAN scanning off' text |
|
322 * Own. |
|
323 */ |
|
324 HBufC* iStatusScanningOff; |
|
325 |
|
326 /** |
|
327 * Constants for 'Refreshing' text |
|
328 * Own. |
|
329 */ |
|
330 HBufC* iStatusRefreshing; |
|
331 |
|
332 /** |
|
333 * Constants for 'Connecting' text |
|
334 * Own. |
|
335 */ |
|
336 HBufC* iStatusConnecting; |
|
337 |
|
338 /** |
|
339 * Constants for 'Other (hidden netw.)' text |
|
340 * Own. |
|
341 */ |
|
342 HBufC* iManualSSIDInputting; |
|
343 |
|
344 /** |
|
345 * Constants for 'No WLAN network found' text |
|
346 * Own. |
|
347 */ |
|
348 HBufC* iNoWLANsAvailable; |
|
349 |
|
350 }; |
|
351 |
|
352 |
|
353 #include "wsfaimodel.inl" |
|
354 |
|
355 |
|
356 #endif // C_WSFAIMODEL_H |
|
357 |
|
358 // End of file |
|