55
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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:
|
|
15 |
* Implementation of utilities functions.
|
|
16 |
*
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
|
|
23 |
//User includes
|
|
24 |
#include "wlanpluginwlanstate.h"
|
|
25 |
#include "wlanplugindbobserver.h"
|
|
26 |
#include "wlanpluginlogger.h"
|
|
27 |
#include "wlanplugintimeshifter.h"
|
|
28 |
|
|
29 |
//System includes
|
|
30 |
#include <wsfmodel.h>
|
|
31 |
#include <wsfwlaninfoarray.h>
|
|
32 |
#include <wlanpluginrsc.rsg>
|
|
33 |
#include <StringLoader.h>
|
|
34 |
#include <gsparentplugin.h>
|
|
35 |
#include <wlanplugin.mbg>
|
|
36 |
#include <wsfwlaninfoarrayvisitor.h>
|
|
37 |
|
|
38 |
|
|
39 |
// ================= MEMBER FUNCTIONS =======================
|
|
40 |
|
|
41 |
// ---------------------------------------------------------
|
|
42 |
// CWlanPluginWlanState::CWlanPluginWlanState
|
|
43 |
// Constructor
|
|
44 |
// ---------------------------------------------------------
|
|
45 |
CWlanPluginWlanState::CWlanPluginWlanState( CGSParentPlugin *aParent )
|
|
46 |
: iScanning( EFalse ),
|
|
47 |
iConnected( EFalse ),
|
|
48 |
iExplicitScanning( 0 ),
|
|
49 |
iCoeEnv( CCoeEnv::Static() ),
|
|
50 |
iParent( aParent ),
|
|
51 |
iSignalStrength(ENoSignal),
|
|
52 |
iSupressParentUpdate( EFalse ),
|
|
53 |
iSupressUpdateWlan( EFalse ),
|
|
54 |
iValidSecondLine( ETrue ),
|
|
55 |
iSupressTimeShifter( EFalse )
|
|
56 |
{
|
|
57 |
}
|
|
58 |
|
|
59 |
// ---------------------------------------------------------
|
|
60 |
// CWlanPluginWlanState::~CWlanPluginWlanState
|
|
61 |
// Descructor
|
|
62 |
// ---------------------------------------------------------
|
|
63 |
CWlanPluginWlanState::~CWlanPluginWlanState()
|
|
64 |
{
|
|
65 |
|
|
66 |
CLOG_ENTERFN( "CWlanPluginWlanState::~CWlanPluginWlanState()" );
|
|
67 |
|
|
68 |
if ( iEngine )
|
|
69 |
{
|
|
70 |
iEngine->CancelNotifyEvents();
|
|
71 |
}
|
|
72 |
|
|
73 |
if( iExplicitScanning )
|
|
74 |
{
|
|
75 |
TRAP_IGNORE( SetScanningL( EFalse ) );
|
|
76 |
}
|
|
77 |
if( iTimeShifter )
|
|
78 |
{
|
|
79 |
delete iTimeShifter;
|
|
80 |
}
|
|
81 |
|
|
82 |
delete iDbObserver;
|
|
83 |
|
|
84 |
delete iWlanInfoBranding;
|
|
85 |
|
|
86 |
//remove self from further notifications from the
|
|
87 |
//sniffer server
|
|
88 |
delete iEngine;
|
|
89 |
delete iPresentString;
|
|
90 |
|
|
91 |
CLOG_LEAVEFN( "CWlanPluginWlanState::~CWlanPluginWlanState()" );
|
|
92 |
}
|
|
93 |
|
|
94 |
// ---------------------------------------------------------
|
|
95 |
// CWlanPluginWlanState::NewLC
|
|
96 |
// ---------------------------------------------------------
|
|
97 |
CWlanPluginWlanState* CWlanPluginWlanState::NewLC( CGSParentPlugin *aParent )
|
|
98 |
{
|
|
99 |
CWlanPluginWlanState* self= new ( ELeave )
|
|
100 |
CWlanPluginWlanState( aParent );
|
|
101 |
CleanupStack::PushL( self );
|
|
102 |
self->ConstructL();
|
|
103 |
return self;
|
|
104 |
}
|
|
105 |
|
|
106 |
// ---------------------------------------------------------
|
|
107 |
// CWlanPluginWlanState::NewL
|
|
108 |
// ---------------------------------------------------------
|
|
109 |
CWlanPluginWlanState* CWlanPluginWlanState::NewL( CGSParentPlugin *aParent )
|
|
110 |
{
|
|
111 |
CWlanPluginWlanState* self = CWlanPluginWlanState::NewLC( aParent );
|
|
112 |
CleanupStack::Pop( self );
|
|
113 |
return self;
|
|
114 |
}
|
|
115 |
|
|
116 |
// ---------------------------------------------------------
|
|
117 |
// CWlanPluginWlanState::ConstructL
|
|
118 |
// ---------------------------------------------------------
|
|
119 |
void CWlanPluginWlanState::ConstructL()
|
|
120 |
{
|
|
121 |
CLOG_ENTERFN( "CWlanPluginWlanState::ConstructL()" );
|
|
122 |
|
|
123 |
iSupressParentUpdate = ETrue;
|
|
124 |
|
|
125 |
iEngine = CWsfModel::NewL( *this, EFalse );
|
|
126 |
|
|
127 |
iWlanInfoBranding = CWsfWlanInfoArrayVisitor::NewL( ETrue );
|
|
128 |
iWlanInfoBranding->LoadFilterDefinitionsL();
|
|
129 |
|
|
130 |
if( iEngine->IsScanEnabledL() )
|
|
131 |
{
|
|
132 |
iScanning = ETrue;
|
|
133 |
UpdateWlanListL();
|
|
134 |
}
|
|
135 |
|
|
136 |
if( iEngine->IsConnectedL() )
|
|
137 |
{
|
|
138 |
iEngine->GetConnectedWlanDetailsL( iConnectedWlanInfo );
|
|
139 |
iConnected = iConnectedWlanInfo.Connected();
|
|
140 |
}
|
|
141 |
|
|
142 |
iDbObserver = CWlanPluginDbObserver::NewL( this );
|
|
143 |
iDbObserver->ActivateItL();
|
|
144 |
|
|
145 |
if( !iConnected && !iScanning && iExplicitScanning )
|
|
146 |
{
|
|
147 |
iValidSecondLine = EFalse;
|
|
148 |
}
|
|
149 |
|
|
150 |
iSupressParentUpdate = EFalse;
|
|
151 |
|
|
152 |
CLOG_LEAVEFN( "CWlanPluginWlanState::ConstructL()" );
|
|
153 |
}
|
|
154 |
|
|
155 |
// ---------------------------------------------------------
|
|
156 |
// CWlanPluginWlanState::WlanListChangedL
|
|
157 |
// ---------------------------------------------------------
|
|
158 |
void CWlanPluginWlanState::WlanListChangedL()
|
|
159 |
{
|
|
160 |
CLOG_ENTERFN( "CWlanPluginWlanState::WlanListChangedL()" );
|
|
161 |
|
|
162 |
iValidSecondLine = ETrue;
|
|
163 |
//if there is modification
|
|
164 |
UpdateWlanListL();
|
|
165 |
|
|
166 |
UpdateParentViewL();
|
|
167 |
|
|
168 |
CLOG_LEAVEFN( "CWlanPluginWlanState::WlanListChangedL()" );
|
|
169 |
}
|
|
170 |
|
|
171 |
// ---------------------------------------------------------
|
|
172 |
// CWlanPluginWlanState::NotifyEngineError
|
|
173 |
// ---------------------------------------------------------
|
|
174 |
void CWlanPluginWlanState::NotifyEngineError( TInt /*aError*/ )
|
|
175 |
{
|
|
176 |
CLOG_ENTERFN( "CWlanPluginWlanState::NotifyEngineError()" );
|
|
177 |
CLOG_LEAVEFN( "CWlanPluginWlanState::NotifyEngineError()" );
|
|
178 |
}
|
|
179 |
|
|
180 |
// ---------------------------------------------------------
|
|
181 |
// CWlanPluginWlanState::ScanDisabledL
|
|
182 |
// ---------------------------------------------------------
|
|
183 |
void CWlanPluginWlanState::ScanDisabledL()
|
|
184 |
{
|
|
185 |
CLOG_ENTERFN( "CWlanPluginWlanState::ScanDisabledL()" );
|
|
186 |
|
|
187 |
iScanning = EFalse;
|
|
188 |
UpdateParentViewL();
|
|
189 |
|
|
190 |
CLOG_LEAVEFN( "CWlanPluginWlanState::ScanDisabledL()" );
|
|
191 |
}
|
|
192 |
|
|
193 |
// ---------------------------------------------------------
|
|
194 |
// CWlanPluginWlanState::ScanEnabledL
|
|
195 |
// ---------------------------------------------------------
|
|
196 |
void CWlanPluginWlanState::ScanEnabledL()
|
|
197 |
{
|
|
198 |
CLOG_ENTERFN( "CWlanPluginWlanState::ScanEnabledL()" );
|
|
199 |
|
|
200 |
// plugin has enabled scanning - background scan is on
|
|
201 |
if ( iExplicitScanning )
|
|
202 |
{
|
|
203 |
CLOG_WRITE( "Refresh scan results" );
|
|
204 |
iEngine->RefreshScanL();
|
|
205 |
}
|
|
206 |
|
|
207 |
iScanning = ETrue;
|
|
208 |
UpdateWlanListL();
|
|
209 |
UpdateParentViewL();
|
|
210 |
|
|
211 |
CLOG_LEAVEFN( "CWlanPluginWlanState::ScanEnabledL()" );
|
|
212 |
}
|
|
213 |
|
|
214 |
// ---------------------------------------------------------
|
|
215 |
// CWlanPluginWlanState::WlanConnectionActivatedL
|
|
216 |
// ---------------------------------------------------------
|
|
217 |
void CWlanPluginWlanState::WlanConnectionActivatedL()
|
|
218 |
{
|
|
219 |
CLOG_ENTERFN( "CWlanPluginWlanState::WlanConnectionActivatedL()" );
|
|
220 |
|
|
221 |
iEngine->GetConnectedWlanDetailsL( iConnectedWlanInfo );
|
|
222 |
iConnected = iConnectedWlanInfo.Connected();
|
|
223 |
UpdateParentViewL();
|
|
224 |
|
|
225 |
CLOG_LEAVEFN( "CWlanPluginWlanState::WlanConnectionActivatedL()" );
|
|
226 |
}
|
|
227 |
|
|
228 |
// ---------------------------------------------------------
|
|
229 |
// CWlanPluginWlanState::WlanConnectionClosedL
|
|
230 |
// ---------------------------------------------------------
|
|
231 |
void CWlanPluginWlanState::WlanConnectionClosedL()
|
|
232 |
{
|
|
233 |
CLOG_ENTERFN( "CWlanPluginWlanState::WlanConnectionClosedL()" );
|
|
234 |
|
|
235 |
iConnected = EFalse;
|
|
236 |
if( iScanning )
|
|
237 |
{
|
|
238 |
UpdateWlanListL();
|
|
239 |
}
|
|
240 |
|
|
241 |
UpdateParentViewL();
|
|
242 |
|
|
243 |
CLOG_LEAVEFN( "CWlanPluginWlanState::WlanConnectionClosedL()" );
|
|
244 |
}
|
|
245 |
|
|
246 |
// ---------------------------------------------------------------------------
|
|
247 |
// CWlanPluginWlanState::ConnectionCreationProcessFinishedL
|
|
248 |
// ---------------------------------------------------------------------------
|
|
249 |
//
|
|
250 |
void CWlanPluginWlanState::ConnectionCreationProcessFinishedL( TInt /*aResult*/ )
|
|
251 |
{
|
|
252 |
// no implementation required
|
|
253 |
}
|
|
254 |
|
|
255 |
// ---------------------------------------------------------
|
|
256 |
// CWlanPluginWlanState::GetStateStringL
|
|
257 |
// ---------------------------------------------------------
|
|
258 |
void CWlanPluginWlanState::GetStateStringL( TDes& aDes )
|
|
259 |
{
|
|
260 |
CLOG_ENTERFN( "CWlanPluginWlanState::GetStateStringL()" );
|
|
261 |
|
|
262 |
if( !iValidSecondLine )
|
|
263 |
{
|
|
264 |
return;
|
|
265 |
}
|
|
266 |
|
|
267 |
//make the string according to it
|
|
268 |
HBufC* statestring = NULL;
|
|
269 |
MakeStateStringL( iInfoArray, statestring );
|
|
270 |
aDes.Copy( statestring->Des() );
|
|
271 |
|
|
272 |
//keep it to decide later if it changed
|
|
273 |
delete iPresentString;
|
|
274 |
iPresentString = statestring;
|
|
275 |
|
|
276 |
CLOG_LEAVEFN( "CWlanPluginWlanState::GetStateStringL()" );
|
|
277 |
}
|
|
278 |
|
|
279 |
// ---------------------------------------------------------
|
|
280 |
// CWlanPluginWlanState::MakeStateStringL
|
|
281 |
// ---------------------------------------------------------
|
|
282 |
void CWlanPluginWlanState::MakeStateStringL(
|
|
283 |
CWsfWlanInfoArray* aArray, HBufC*& aBuf )
|
|
284 |
{
|
|
285 |
CLOG_ENTERFN( "CWlanPluginWlanState::MakeStateStringL()" );
|
|
286 |
|
|
287 |
if( iConnected )
|
|
288 |
{
|
|
289 |
CLOG_ENTERFN( "Connected format needed" );
|
|
290 |
FormatConnectedL( aBuf );
|
|
291 |
}
|
|
292 |
else if ( !iScanning )
|
|
293 |
{
|
|
294 |
CLOG_ENTERFN( "Offline format needed" );
|
|
295 |
FormatStatusOffL( aBuf );
|
|
296 |
}
|
|
297 |
// if there's wlans avail
|
|
298 |
else if ( aArray && aArray->Count() )
|
|
299 |
{
|
|
300 |
CLOG_ENTERFN( "wlans/wlan format needed" );
|
|
301 |
CheckWlansL( aArray, aBuf );
|
|
302 |
}
|
|
303 |
else
|
|
304 |
{
|
|
305 |
// no wlans available
|
|
306 |
CLOG_ENTERFN( "No wlan format needed" );
|
|
307 |
FormatNoWlansAvailableL( aBuf );
|
|
308 |
}
|
|
309 |
|
|
310 |
CLOG_LEAVEFN( "CWlanPluginWlanState::MakeStateStringL()" );
|
|
311 |
}
|
|
312 |
|
|
313 |
// ---------------------------------------------------------
|
|
314 |
// CWlanPluginWlanState::FormatConnectedL
|
|
315 |
// ---------------------------------------------------------
|
|
316 |
void CWlanPluginWlanState::FormatConnectedL( HBufC*& aBuf )
|
|
317 |
{
|
|
318 |
CLOG_ENTERFN( "CWlanPluginWlanState::FormatConnectedL()" );
|
|
319 |
|
|
320 |
//Ssid as primary text
|
|
321 |
HBufC* ssid( NULL );
|
|
322 |
|
|
323 |
if ( iConnectedWlanInfo.iNetworkName.Length() ) // If there is IAP
|
|
324 |
{
|
|
325 |
ssid = iConnectedWlanInfo.GetIapNameAsUnicodeLC();
|
|
326 |
}
|
|
327 |
else // If there no IAP
|
|
328 |
{
|
|
329 |
ssid = iConnectedWlanInfo.GetSsidAsUnicodeLC();
|
|
330 |
}
|
|
331 |
|
|
332 |
aBuf = StringLoader::LoadL( R_QTN_CP_DETAIL_WLAN_CONNECTED,
|
|
333 |
*ssid );
|
|
334 |
|
|
335 |
CleanupStack::PopAndDestroy( ssid );
|
|
336 |
|
|
337 |
CLOG_LEAVEFN( "CWlanPluginWlanState::FormatConnectedL()" );
|
|
338 |
}
|
|
339 |
|
|
340 |
|
|
341 |
// ---------------------------------------------------------
|
|
342 |
// CWlanPluginWlanState::FormatStatusOffL
|
|
343 |
// ---------------------------------------------------------
|
|
344 |
void CWlanPluginWlanState::FormatStatusOffL( HBufC*& aBuf )
|
|
345 |
{
|
|
346 |
CLOG_ENTERFN( "CWlanPluginWlanState::FormatStatusOffL()" );
|
|
347 |
|
|
348 |
aBuf = StringLoader::LoadL( R_QTN_CP_DETAIL_WLAN_SCAN_OFF );
|
|
349 |
|
|
350 |
CLOG_LEAVEFN( "CWlanPluginWlanState::FormatStatusOffL()" );
|
|
351 |
}
|
|
352 |
|
|
353 |
// ---------------------------------------------------------
|
|
354 |
// CWlanPluginWlanState::FormatNoWlansAvailableL
|
|
355 |
// ---------------------------------------------------------
|
|
356 |
void CWlanPluginWlanState::FormatNoWlansAvailableL( HBufC*& aBuf )
|
|
357 |
{
|
|
358 |
CLOG_ENTERFN( "CWlanPluginWlanState::FormatNoWlansAvailableL()" );
|
|
359 |
|
|
360 |
aBuf = StringLoader::LoadL( R_QTN_CP_DETAIL_WLAN_NO_NW_AVAILABLE );
|
|
361 |
|
|
362 |
CLOG_LEAVEFN( "CWlanPluginWlanState::FormatNoWlansAvailableL()" );
|
|
363 |
}
|
|
364 |
|
|
365 |
// ---------------------------------------------------------
|
|
366 |
// CWlanPluginWlanState::CheckWlansL
|
|
367 |
// ---------------------------------------------------------
|
|
368 |
void CWlanPluginWlanState::CheckWlansL( CWsfWlanInfoArray* aArray,
|
|
369 |
HBufC*& aBuf )
|
|
370 |
{
|
|
371 |
CLOG_ENTERFN( "CWlanPluginWlanState::CheckWlansL()" );
|
|
372 |
|
|
373 |
if ( aArray->At( 0 )->Known() )
|
|
374 |
{
|
|
375 |
FormatWlanSingleLineL( *aArray->At( 0 ), aBuf );
|
|
376 |
return;
|
|
377 |
}
|
|
378 |
TBool multipleUnknownWlans = ( aArray->Count() > 1 );
|
|
379 |
FormatUnknownWlansSingleLineL( multipleUnknownWlans, aBuf );
|
|
380 |
|
|
381 |
CLOG_LEAVEFN( "CWlanPluginWlanState::CheckWlansL()" );
|
|
382 |
}
|
|
383 |
|
|
384 |
// ---------------------------------------------------------
|
|
385 |
// CWlanPluginWlanState::FormatWlanSingleLineL
|
|
386 |
// ---------------------------------------------------------
|
|
387 |
void CWlanPluginWlanState::FormatWlanSingleLineL(
|
|
388 |
TWsfWlanInfo& aWlan, HBufC*& aBuf )
|
|
389 |
{
|
|
390 |
CLOG_ENTERFN( "CWlanPluginWlanState::FormatWlanSingleLineL()" );
|
|
391 |
|
|
392 |
//Ssid as primary text
|
|
393 |
HBufC* ssid( NULL );
|
|
394 |
|
|
395 |
if ( aWlan.iNetworkName.Length() ) // If there is IAP
|
|
396 |
{
|
|
397 |
ssid = aWlan.GetIapNameAsUnicodeLC();
|
|
398 |
}
|
|
399 |
else // If there no IAP
|
|
400 |
{
|
|
401 |
ssid = aWlan.GetSsidAsUnicodeLC();
|
|
402 |
}
|
|
403 |
|
|
404 |
TInt formatResource = R_QTN_CP_DETAIL_WLAN_KNOWN_NW_AVAILABLE;
|
|
405 |
|
|
406 |
aBuf = StringLoader::LoadL ( formatResource, *ssid );
|
|
407 |
|
|
408 |
CleanupStack::PopAndDestroy( ssid );
|
|
409 |
|
|
410 |
CLOG_LEAVEFN( "CWlanPluginWlanState::FormatWlanSingleLineL()" );
|
|
411 |
}
|
|
412 |
|
|
413 |
// ---------------------------------------------------------
|
|
414 |
// CWlanPluginWlanState::FormatUnknownWlansSingleLineL
|
|
415 |
// ---------------------------------------------------------
|
|
416 |
void CWlanPluginWlanState::FormatUnknownWlansSingleLineL(
|
|
417 |
const TBool aMultipleUnknownWlans, HBufC*& aBuf )
|
|
418 |
{
|
|
419 |
CLOG_ENTERFN( "CWlanPluginWlanState::FormatUnknownWlansSingleLineL()" );
|
|
420 |
|
|
421 |
TInt unknownItemResource = aMultipleUnknownWlans ?
|
|
422 |
R_QTN_CP_DETAIL_WLAN_NETWORKS_AVAILABLE :
|
|
423 |
R_QTN_CP_DETAIL_WLAN_NETWORK_AVAILABLE;
|
|
424 |
|
|
425 |
aBuf = StringLoader::LoadL( unknownItemResource );
|
|
426 |
|
|
427 |
CLOG_LEAVEFN( "CWlanPluginWlanState::FormatUnknownWlansSingleLineL()" );
|
|
428 |
}
|
|
429 |
|
|
430 |
// ---------------------------------------------------------
|
|
431 |
// CWlanPluginWlanState::GetMainIconL
|
|
432 |
// ---------------------------------------------------------
|
|
433 |
TBool CWlanPluginWlanState::GetMainIconL( TInt& aPic,
|
|
434 |
TInt& aPicMask,
|
|
435 |
TAknsItemID& aItemId )
|
|
436 |
{
|
|
437 |
CLOG_ENTERFN( "CWlanPluginWlanState::GetMainIconL()" );
|
|
438 |
|
|
439 |
if( !iValidSecondLine )
|
|
440 |
{
|
|
441 |
aPic = EMbmWlanpluginQgn_prop_set_conn_wlan;
|
|
442 |
aPicMask = EMbmWlanpluginQgn_prop_set_conn_wlan_mask;
|
|
443 |
aItemId = KAknsIIDQgnPropSetConnWlanConn;
|
|
444 |
CLOG_LEAVEFN( "CWlanPluginWlanState::GetMainIconL()" );
|
|
445 |
return ETrue;
|
|
446 |
}
|
|
447 |
|
|
448 |
if( !iSupressTimeShifter)
|
|
449 |
{
|
|
450 |
iSupressTimeShifter = EFalse;
|
|
451 |
CLOG_WRITE(" Time shifter start not supressed ");
|
|
452 |
if( !iTimeShifter )
|
|
453 |
{
|
|
454 |
CLOG_WRITE(" Time shifter started ");
|
|
455 |
iSupressTimeShifter = ETrue;
|
|
456 |
iTimeShifter = CWlanPluginTimeShifter::NewL( this );
|
|
457 |
iTimeShifter->ActivateIt();
|
|
458 |
}
|
|
459 |
}
|
|
460 |
else
|
|
461 |
{
|
|
462 |
CLOG_WRITE(" Time shifter start supressed ");
|
|
463 |
iSupressTimeShifter = EFalse;
|
|
464 |
}
|
|
465 |
if( iConnected )
|
|
466 |
{
|
|
467 |
//CONNECTED
|
|
468 |
aPic = EMbmWlanpluginQgn_prop_set_conn_wlan_conn;
|
|
469 |
aPicMask = EMbmWlanpluginQgn_prop_set_conn_wlan_conn_mask;
|
|
470 |
aItemId = KAknsIIDQgnPropSetConnWlanConn;
|
|
471 |
}
|
|
472 |
else if( iScanning )
|
|
473 |
{
|
|
474 |
//SCANNING BUT NOT CONNECTED
|
|
475 |
aPic = EMbmWlanpluginQgn_prop_set_conn_wlan;
|
|
476 |
aPicMask = EMbmWlanpluginQgn_prop_set_conn_wlan_mask;
|
|
477 |
aItemId = KAknsIIDQgnPropSetConnWlanConn;
|
|
478 |
}
|
|
479 |
else
|
|
480 |
{
|
|
481 |
//SCANNING DISABLED
|
|
482 |
aPic = EMbmWlanpluginQgn_prop_set_conn_wlan_off;
|
|
483 |
aPicMask = EMbmWlanpluginQgn_prop_set_conn_wlan_off_mask;
|
|
484 |
aItemId = KAknsIIDQgnPropSetConnWlanOff;
|
|
485 |
}
|
|
486 |
|
|
487 |
CLOG_LEAVEFN( "CWlanPluginWlanState::GetMainIconL()" );
|
|
488 |
return ETrue;
|
|
489 |
}
|
|
490 |
|
|
491 |
// ---------------------------------------------------------
|
|
492 |
// CWlanPluginWlanState::GetStrengthIconL
|
|
493 |
// ---------------------------------------------------------
|
|
494 |
TBool CWlanPluginWlanState::GetStrengthIconL( TInt& aPic,
|
|
495 |
TInt& aPicMask,
|
|
496 |
TAknsItemID& aItemId)
|
|
497 |
{
|
|
498 |
CLOG_ENTERFN( "CWlanPluginWlanState::GetStrengthIconL()" );
|
|
499 |
|
|
500 |
if( !iValidSecondLine )
|
|
501 |
{
|
|
502 |
return EFalse;
|
|
503 |
}
|
|
504 |
if ( iConnected )
|
|
505 |
{
|
|
506 |
switch( iConnectedWlanInfo.SignalStrength() )
|
|
507 |
{
|
|
508 |
case EPoor:
|
|
509 |
aPic = EMbmWlanpluginQgn_indi_wlan_signal_low_add;
|
|
510 |
aPicMask = EMbmWlanpluginQgn_indi_wlan_signal_low_add_mask;
|
|
511 |
aItemId = KAknsIIDQgnIndiWlanSignalLowAdd;
|
|
512 |
break;
|
|
513 |
case EAverage:
|
|
514 |
aPic = EMbmWlanpluginQgn_indi_wlan_signal_med_add;
|
|
515 |
aPicMask = EMbmWlanpluginQgn_indi_wlan_signal_med_add_mask;
|
|
516 |
aItemId = KAknsIIDQgnIndiWlanSignalMedAdd;
|
|
517 |
break;
|
|
518 |
case EExcelent:
|
|
519 |
aPic = EMbmWlanpluginQgn_indi_wlan_signal_good_add;
|
|
520 |
aPicMask = EMbmWlanpluginQgn_indi_wlan_signal_good_add_mask;
|
|
521 |
aItemId = KAknsIIDQgnIndiWlanSignalGoodAdd;
|
|
522 |
break;
|
|
523 |
default:
|
|
524 |
aPic = EMbmWlanpluginQgn_indi_wlan_signal_low_add;
|
|
525 |
aPicMask = EMbmWlanpluginQgn_indi_wlan_signal_low_add_mask;
|
|
526 |
aItemId = KAknsIIDQgnIndiWlanSignalLowAdd;
|
|
527 |
}
|
|
528 |
iSignalStrength = iConnectedWlanInfo.SignalStrength();
|
|
529 |
CLOG_LEAVEFN( "CWlanPluginWlanState::GetStrengthIconL()" );
|
|
530 |
return ETrue;
|
|
531 |
}
|
|
532 |
iSignalStrength = ENoSignal;
|
|
533 |
|
|
534 |
CLOG_LEAVEFN( "CWlanPluginWlanState::GetStrengthIconL()" );
|
|
535 |
|
|
536 |
return EFalse;
|
|
537 |
}
|
|
538 |
|
|
539 |
// ---------------------------------------------------------
|
|
540 |
// CWlanPluginWlanState::IsStateChangedL
|
|
541 |
// ---------------------------------------------------------
|
|
542 |
TBool CWlanPluginWlanState::IsStateChangedL()
|
|
543 |
{
|
|
544 |
CLOG_ENTERFN( "CWlanPluginWlanState::IsStateChangedL()" );
|
|
545 |
|
|
546 |
if ( !iPresentString )
|
|
547 |
{
|
|
548 |
CLOG_LEAVEFN( "CWlanPluginWlanState::IsStateChangedL()" );
|
|
549 |
return ETrue;
|
|
550 |
}
|
|
551 |
//alloc a buf
|
|
552 |
CLOG_WRITE( "CWlanPluginWlanState::IsStateChangedL - there is presentstring" );
|
|
553 |
HBufC* buf = NULL;
|
|
554 |
|
|
555 |
CLOG_WRITE( "CWlanPluginWlanState::IsStateChangedL - wlan list get" );
|
|
556 |
//make the string that would be written out
|
|
557 |
MakeStateStringL( iInfoArray, buf );
|
|
558 |
|
|
559 |
CleanupStack::PushL( buf );
|
|
560 |
|
|
561 |
CLOG_WRITE( "CWlanPluginWlanState::IsStateChangedL - state string made" );
|
|
562 |
|
|
563 |
//decide if the string is the same as it was written before
|
|
564 |
//and the connection state is the same
|
|
565 |
TBool ret =
|
|
566 |
( buf->Des().Compare( iPresentString->Des() ) ||
|
|
567 |
iSignalStrength != GetSignalStrength() )
|
|
568 |
? ETrue : EFalse;
|
|
569 |
|
|
570 |
CLOG_WRITE( "CWlanPluginWlanState::IsStateChangedL - ret get" );
|
|
571 |
|
|
572 |
CleanupStack::PopAndDestroy( buf );
|
|
573 |
|
|
574 |
if( ret )
|
|
575 |
{
|
|
576 |
CLOG_WRITE( "State Changed" );
|
|
577 |
}
|
|
578 |
else
|
|
579 |
{
|
|
580 |
CLOG_WRITE( "State NOT Changed" );
|
|
581 |
}
|
|
582 |
|
|
583 |
CLOG_LEAVEFN( "CWlanPluginWlanState::IsStateChangedL()" );
|
|
584 |
|
|
585 |
//just to have ETrue in all true cases
|
|
586 |
return ret;
|
|
587 |
}
|
|
588 |
|
|
589 |
// ---------------------------------------------------------
|
|
590 |
// CWlanPluginWlanState::GetSignalStrength
|
|
591 |
// ---------------------------------------------------------
|
|
592 |
TWsfWlanSignalStrengthLevel CWlanPluginWlanState::GetSignalStrength()
|
|
593 |
{
|
|
594 |
CLOG_ENTERFN( "CWlanPluginWlanState::GetSignalStrength()" );
|
|
595 |
|
|
596 |
if ( iConnected )
|
|
597 |
{
|
|
598 |
CLOG_LEAVEFN( "CWlanPluginWlanState::GetSignalStrength()" );
|
|
599 |
return iConnectedWlanInfo.SignalStrength();
|
|
600 |
}
|
|
601 |
else
|
|
602 |
{
|
|
603 |
CLOG_LEAVEFN( "CWlanPluginWlanState::GetSignalStrength()" );
|
|
604 |
return ENoSignal;
|
|
605 |
}
|
|
606 |
}
|
|
607 |
|
|
608 |
// ---------------------------------------------------------
|
|
609 |
// CWlanPluginWlanState::IsScanning
|
|
610 |
// ---------------------------------------------------------
|
|
611 |
TBool CWlanPluginWlanState::IsScanning()
|
|
612 |
{
|
|
613 |
CLOG_ENTERFN( "CWlanPluginWlanState::IsScanning()" );
|
|
614 |
CLOG_LEAVEFN( "CWlanPluginWlanState::IsScanning()" );
|
|
615 |
return iScanning;
|
|
616 |
}
|
|
617 |
|
|
618 |
// ---------------------------------------------------------
|
|
619 |
// CWlanPluginWlanState::SetScanning
|
|
620 |
// ---------------------------------------------------------
|
|
621 |
void CWlanPluginWlanState::SetScanningL( TBool aScanning )
|
|
622 |
{
|
|
623 |
CLOG_ENTERFN( "CWlanPluginWlanState::SetScanningL()" );
|
|
624 |
|
|
625 |
if( aScanning )
|
|
626 |
{
|
|
627 |
iExplicitScanning++;
|
|
628 |
if( iExplicitScanning == 1 && iEngine )
|
|
629 |
{
|
|
630 |
iEngine->EnableScanL();
|
|
631 |
}
|
|
632 |
}
|
|
633 |
else
|
|
634 |
{
|
|
635 |
iExplicitScanning--;
|
|
636 |
if( iExplicitScanning == 0 && iEngine )
|
|
637 |
{
|
|
638 |
iEngine->DisableScanL();
|
|
639 |
}
|
|
640 |
}
|
|
641 |
|
|
642 |
CLOG_LEAVEFN( "CWlanPluginWlanState::SetScanningL()" );
|
|
643 |
}
|
|
644 |
|
|
645 |
// ---------------------------------------------------------
|
|
646 |
// CWlanPluginWlanState::UpdateParentViewL
|
|
647 |
// ---------------------------------------------------------
|
|
648 |
void CWlanPluginWlanState::UpdateParentViewL()
|
|
649 |
{
|
|
650 |
CLOG_ENTERFN( "CWlanPluginWlanState::UpdateParentViewL()" );
|
|
651 |
|
|
652 |
|
|
653 |
if( iSupressParentUpdate )
|
|
654 |
{
|
|
655 |
CLOG_WRITE( "Parent update suppressed" );
|
|
656 |
CLOG_LEAVEFN( "CWlanPluginWlanState::UpdateParentViewL()" );
|
|
657 |
return;
|
|
658 |
}
|
|
659 |
|
|
660 |
iSupressParentUpdate = ETrue;
|
|
661 |
|
|
662 |
if ( IsStateChangedL() )
|
|
663 |
{
|
|
664 |
iSupressTimeShifter = ETrue;
|
|
665 |
iParent->UpdateView();
|
|
666 |
}
|
|
667 |
else
|
|
668 |
{
|
|
669 |
iSupressTimeShifter = EFalse;
|
|
670 |
}
|
|
671 |
|
|
672 |
iSupressParentUpdate = EFalse;
|
|
673 |
|
|
674 |
CLOG_LEAVEFN( "CWlanPluginWlanState::UpdateParentViewL()" );
|
|
675 |
}
|
|
676 |
|
|
677 |
// ---------------------------------------------------------
|
|
678 |
// CWlanPluginWlanState::UpdateWlanListL
|
|
679 |
// ---------------------------------------------------------
|
|
680 |
void CWlanPluginWlanState::UpdateWlanListL()
|
|
681 |
{
|
|
682 |
CLOG_ENTERFN( "CWlanPluginWlanState::UpdateWlanListL()" );
|
|
683 |
if( iSupressUpdateWlan )
|
|
684 |
{
|
|
685 |
CLOG_WRITE( "Update WLAN List supressed" );
|
|
686 |
CLOG_LEAVEFN( "CWlanPluginWlanState::UpdateWlanListL()" );
|
|
687 |
return;
|
|
688 |
}
|
|
689 |
|
|
690 |
iSupressUpdateWlan = ETrue;
|
|
691 |
|
|
692 |
TRAPD( error,
|
|
693 |
iInfoArray = iEngine->GetWlanListL();
|
|
694 |
|
|
695 |
if( iConnected )
|
|
696 |
{
|
|
697 |
iEngine->GetConnectedWlanDetailsL( iConnectedWlanInfo );
|
|
698 |
iConnected = iConnectedWlanInfo.Connected();
|
|
699 |
}
|
|
700 |
|
|
701 |
iWlanInfoBranding->LoadFilterDefinitionsL();
|
|
702 |
|
|
703 |
iInfoArray->SortArrayL( *iWlanInfoBranding );
|
|
704 |
);
|
|
705 |
|
|
706 |
if ( error != KErrNone )
|
|
707 |
{
|
|
708 |
CLOG_WRITE( "Fetching wlan data leaved" );
|
|
709 |
// Reset the temporary flag so that wlan list
|
|
710 |
// updates are not completely suppressed
|
|
711 |
iSupressUpdateWlan = EFalse;
|
|
712 |
User::Leave( error );
|
|
713 |
}
|
|
714 |
|
|
715 |
#ifdef _DEBUG
|
|
716 |
if( iInfoArray )
|
|
717 |
{
|
|
718 |
if( iInfoArray->Count() <=0 )
|
|
719 |
{
|
|
720 |
CLOG_WRITE( "EMPTY ARRAY" );
|
|
721 |
}
|
|
722 |
for(TInt i = 0; i< iInfoArray->Count(); i++)
|
|
723 |
{
|
|
724 |
|
|
725 |
CLOG_WRITE( "----AP----" );
|
|
726 |
HBufC* buf = iInfoArray->At( i )->GetSsidAsUnicodeLC();
|
|
727 |
CLOG_WRITEF(_L("AP: %S"), ( buf ) );
|
|
728 |
CleanupStack::PopAndDestroy( buf );
|
|
729 |
if( iInfoArray->At( i )->Connected() )
|
|
730 |
{
|
|
731 |
CLOG_WRITE( "--Connected--" );
|
|
732 |
}
|
|
733 |
else
|
|
734 |
{
|
|
735 |
CLOG_WRITE( "--NOT Connected--" );
|
|
736 |
}
|
|
737 |
if( iInfoArray->At( i )->Known() )
|
|
738 |
{
|
|
739 |
CLOG_WRITE( "--Known--" );
|
|
740 |
}
|
|
741 |
else
|
|
742 |
{
|
|
743 |
CLOG_WRITE( "--NOT Known--" );
|
|
744 |
}
|
|
745 |
}
|
|
746 |
}
|
|
747 |
else
|
|
748 |
{
|
|
749 |
CLOG_ENTERFN( "NO ARRAY" );
|
|
750 |
}
|
|
751 |
#endif
|
|
752 |
|
|
753 |
iSupressUpdateWlan = EFalse;
|
|
754 |
CLOG_LEAVEFN( "CWlanPluginWlanState::UpdateWlanListL()" );
|
|
755 |
}
|
|
756 |
|
|
757 |
// ---------------------------------------------------------
|
|
758 |
// CWlanPluginWlanState::DirectlyScan
|
|
759 |
// ---------------------------------------------------------
|
|
760 |
void CWlanPluginWlanState::DirectlyScanL()
|
|
761 |
{
|
|
762 |
CLOG_ENTERFN( "CWlanPluginWlanState::DirectlyScan()" );
|
|
763 |
if ( iExplicitScanning && iParent->IsForeground())
|
|
764 |
{
|
|
765 |
iEngine->RefreshScanL();
|
|
766 |
}
|
|
767 |
CLOG_LEAVEFN( "CWlanPluginWlanState::DirectlyScan()" );
|
|
768 |
}
|
|
769 |
|
|
770 |
// ---------------------------------------------------------
|
|
771 |
// CWlanPluginWlanState::DeleteTimeShifter
|
|
772 |
// ---------------------------------------------------------
|
|
773 |
void CWlanPluginWlanState::DeleteTimeShifter()
|
|
774 |
{
|
|
775 |
CLOG_ENTERFN( "CWlanPluginWlanState::DeleteTimeShifter()" );
|
|
776 |
delete iTimeShifter;
|
|
777 |
iTimeShifter = NULL;
|
|
778 |
CLOG_LEAVEFN( "CWlanPluginWlanState::DeleteTimeShifter()" );
|
|
779 |
}
|