58
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 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: Application UI class
|
|
15 |
*
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <StringLoader.h>
|
|
22 |
#include <aknnotedialog.h>
|
|
23 |
#include <AknUtils.h>
|
|
24 |
#include <cmmanagerext.h>
|
|
25 |
#include <nifvar.h>
|
|
26 |
#include <ConnectionMonitorUi.rsg>
|
|
27 |
#include "ConnectionMonitorUi.hrh"
|
|
28 |
#include "ConnectionMonitorUiAppUi.h"
|
|
29 |
#include "ConnectionMonitorUiView.h"
|
|
30 |
#include "ConnectionMonitorUiDetailsView.h"
|
|
31 |
#include "ConnectionArray.h"
|
|
32 |
#include "CsdConnectionInfo.h"
|
|
33 |
#include "GprsConnectionInfo.h"
|
|
34 |
#include "WlanConnectionInfo.h"
|
|
35 |
#include "EasyWLANConnectionInfo.h"
|
|
36 |
#include "FeatureManagerWrapper.h"
|
|
37 |
#include "ActiveWrapper.h"
|
|
38 |
|
|
39 |
|
|
40 |
// CONSTANTS
|
|
41 |
|
|
42 |
// ================= MEMBER FUNCTIONS =======================
|
|
43 |
|
|
44 |
// ----------------------------------------------------------
|
|
45 |
// CConnectionMonitorUiAppUi::ConstructL()
|
|
46 |
// ----------------------------------------------------------
|
|
47 |
//
|
|
48 |
void CConnectionMonitorUiAppUi::ConstructL()
|
|
49 |
{
|
|
50 |
CMUILOGGER_CREATE;
|
|
51 |
|
|
52 |
CMUILOGGER_WRITE( "Constructing CConnectionMonitorUiAppUi" );
|
|
53 |
|
|
54 |
BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible);
|
|
55 |
|
|
56 |
#ifdef RD_CONTROL_PANEL
|
|
57 |
|
|
58 |
TBool isEmbeddedApp = IsEmbedded();
|
|
59 |
CMUILOGGER_WRITE_F( "IsEmbedded(): %d", isEmbeddedApp );
|
|
60 |
|
|
61 |
#endif // RD_CONTROL_PANEL
|
|
62 |
|
|
63 |
iFeatureManagerWrapper = CFeatureManagerWrapper::NewL();
|
|
64 |
TBool isWlanSupported = FeatureManager::FeatureSupported(
|
|
65 |
KFeatureIdProtocolWlan );
|
|
66 |
|
|
67 |
CMUILOGGER_WRITE_F( "isWlanSupported: %b", isWlanSupported );
|
|
68 |
|
|
69 |
// connect to connection monitor engine
|
|
70 |
CMUILOGGER_WRITE( "Connection monitor engine" );
|
|
71 |
iMonitor.ConnectL();
|
|
72 |
CMUILOGGER_WRITE( "Connected" );
|
|
73 |
|
|
74 |
CMUILOGGER_WRITE( "Creating connection array" );
|
|
75 |
iConnectionArray = new ( ELeave ) CConnectionArray();
|
|
76 |
iConnectionArray->ConstructL();
|
|
77 |
|
|
78 |
iActiveWrapper = CActiveWrapper::NewL(); // start ActiveWrapper
|
|
79 |
|
|
80 |
if ( isWlanSupported )
|
|
81 |
{
|
|
82 |
GetEasyWlanIAPNameL();
|
|
83 |
}
|
|
84 |
|
|
85 |
InitializeConnectionArrayL();
|
|
86 |
|
|
87 |
CMUILOGGER_WRITE( "Created" );
|
|
88 |
|
|
89 |
CMUILOGGER_WRITE( "Creating main view" );
|
|
90 |
|
|
91 |
#ifdef RD_CONTROL_PANEL
|
|
92 |
CConnectionMonitorUiView* mainView =
|
|
93 |
new ( ELeave ) CConnectionMonitorUiView( iConnectionArray,
|
|
94 |
&iMonitor,
|
|
95 |
isEmbeddedApp,
|
|
96 |
iActiveWrapper );
|
|
97 |
#else
|
|
98 |
CConnectionMonitorUiView* mainView =
|
|
99 |
new ( ELeave ) CConnectionMonitorUiView( iConnectionArray,
|
|
100 |
&iMonitor,
|
|
101 |
iActiveWrapper );
|
|
102 |
#endif // RD_CONTROL_PANEL
|
|
103 |
|
|
104 |
CleanupStack::PushL( mainView );
|
|
105 |
CMUILOGGER_WRITE( "Constructing main view" );
|
|
106 |
mainView->ConstructL();
|
|
107 |
CMUILOGGER_WRITE( "Adding main view" );
|
|
108 |
AddViewL( mainView ); // transfer ownership to CAknViewAppUi
|
|
109 |
|
|
110 |
SetDefaultViewL( *mainView );
|
|
111 |
iTimerObserver = this;
|
|
112 |
|
|
113 |
CleanupStack::Pop( mainView );
|
|
114 |
CMUILOGGER_WRITE( "Done" );
|
|
115 |
|
|
116 |
CMUILOGGER_WRITE( "Creating details view" );
|
|
117 |
CConnectionMonitorUiDetailsView* detailsView =
|
|
118 |
new ( ELeave ) CConnectionMonitorUiDetailsView( iConnectionArray );
|
|
119 |
CleanupStack::PushL( detailsView );
|
|
120 |
CMUILOGGER_WRITE( "Constructing details view" );
|
|
121 |
detailsView->ConstructL();
|
|
122 |
CMUILOGGER_WRITE( "Adding details view" );
|
|
123 |
AddViewL( detailsView ); // transfer ownership to CAknViewAppUi
|
|
124 |
CleanupStack::Pop( detailsView );
|
|
125 |
CMUILOGGER_WRITE( "Done" );
|
|
126 |
|
|
127 |
// from this point we can listen to events of RConnectionMonitor server
|
|
128 |
iMonitor.NotifyEventL( *this );
|
|
129 |
|
|
130 |
activateMainView = EFalse;
|
|
131 |
}
|
|
132 |
|
|
133 |
// ----------------------------------------------------
|
|
134 |
// CConnectionMonitorUiAppUi::~CConnectionMonitorUiAppUi()
|
|
135 |
// Destructor
|
|
136 |
// Frees reserved resources
|
|
137 |
// ----------------------------------------------------
|
|
138 |
//
|
|
139 |
CConnectionMonitorUiAppUi::~CConnectionMonitorUiAppUi()
|
|
140 |
{
|
|
141 |
CMUILOGGER_ENTERFN( "~CConnectionMonitorUiAppUi" );
|
|
142 |
|
|
143 |
StopTimer();
|
|
144 |
delete iConnectionArray;
|
|
145 |
delete iEasyWlanIAPName;
|
|
146 |
delete iActiveWrapper;
|
|
147 |
delete iFeatureManagerWrapper;
|
|
148 |
|
|
149 |
// it's needed because views are still active here
|
|
150 |
// and a call from handleforegroundevent from them
|
|
151 |
// can cause exception in StopConnEventNotificationL
|
|
152 |
iMonitor.CancelNotifications();
|
|
153 |
iMonitor.Close();
|
|
154 |
iNewConnectionIdArray.Close();
|
|
155 |
iConnectionsWaitingFirstEvent.Close();
|
|
156 |
CMUILOGGER_LEAVEFN( "~CConnectionMonitorUiAppUi" );
|
|
157 |
|
|
158 |
CMUILOGGER_DELETE;
|
|
159 |
}
|
|
160 |
|
|
161 |
// ---------------------------------------------------------------------------
|
|
162 |
// CConnectionMonitorUiAppUi::InitializeConnectionArrayL
|
|
163 |
// ---------------------------------------------------------------------------
|
|
164 |
//
|
|
165 |
void CConnectionMonitorUiAppUi::InitializeConnectionArrayL()
|
|
166 |
{
|
|
167 |
CMUILOGGER_ENTERFN( "InitializeConnectionArrayL" );
|
|
168 |
|
|
169 |
CConnectionInfoBase* connectionInfo = NULL;
|
|
170 |
TUint connectionNumber( 0 );
|
|
171 |
TUint connectionId( 0 );
|
|
172 |
TUint subConnectionCount;
|
|
173 |
|
|
174 |
TUint wlanConnectionCounter( 0 );
|
|
175 |
TUint wlanConnectionId( 0 );
|
|
176 |
TConnMonBearerType bearerType( EBearerUnknown );
|
|
177 |
RArray<TUint> connIds;
|
|
178 |
RArray<TInt> bearers;
|
|
179 |
CleanupClosePushL( connIds );
|
|
180 |
CleanupClosePushL( bearers );
|
|
181 |
|
|
182 |
iActiveWrapper->StartGetConnectionCount( connectionNumber, iMonitor );
|
|
183 |
|
|
184 |
if ( !iActiveWrapper->iStatus.Int() )
|
|
185 |
{
|
|
186 |
CMUILOGGER_WRITE_F( "Number of connections: %d",
|
|
187 |
connectionNumber );
|
|
188 |
|
|
189 |
for ( TUint i = 1; i <= connectionNumber; ++i )
|
|
190 |
{
|
|
191 |
iMonitor.GetConnectionInfo( i, connectionId, subConnectionCount );
|
|
192 |
connIds.AppendL( connectionId );
|
|
193 |
|
|
194 |
iActiveWrapper->StartGetBearerType( connectionId,
|
|
195 |
iMonitor,
|
|
196 |
KBearer,
|
|
197 |
( TInt& )bearerType );
|
|
198 |
CMUILOGGER_WRITE_F( "status.Int(): %d",
|
|
199 |
iActiveWrapper->iStatus.Int() );
|
|
200 |
CMUILOGGER_WRITE_F( "bearerType: %d", ( TInt )bearerType );
|
|
201 |
bearers.AppendL( (TInt)bearerType );
|
|
202 |
|
|
203 |
if ( bearerType == EBearerWLAN )
|
|
204 |
{
|
|
205 |
wlanConnectionCounter++;
|
|
206 |
wlanConnectionId = connectionId;
|
|
207 |
}
|
|
208 |
}
|
|
209 |
|
|
210 |
for ( TInt i = 0; i < connectionNumber; i++ )
|
|
211 |
{
|
|
212 |
if ( bearers[i] != EBearerWLAN || wlanConnectionCounter < 2 || connIds[i] == wlanConnectionId )
|
|
213 |
{
|
|
214 |
TInt err;
|
|
215 |
TRAP(err, connectionInfo = CreateConnectionInfoL( connIds[i], (TConnMonBearerType)bearers[i] ));
|
|
216 |
|
|
217 |
if ( !err && connectionInfo )
|
|
218 |
{
|
|
219 |
CleanupStack::PushL( connectionInfo );
|
|
220 |
iConnectionArray->AppendL( connectionInfo );
|
|
221 |
CleanupStack::Pop( connectionInfo );
|
|
222 |
}
|
|
223 |
else
|
|
224 |
{
|
|
225 |
iNewConnectionIdArray.Append( connIds[i] );
|
|
226 |
}
|
|
227 |
}
|
|
228 |
else
|
|
229 |
{
|
|
230 |
CMUILOGGER_WRITE( "Fake WLAN connection, skipping" );
|
|
231 |
}
|
|
232 |
}
|
|
233 |
}
|
|
234 |
else
|
|
235 |
{
|
|
236 |
CMUILOGGER_WRITE_F( "GetConnectionCount status: %d",
|
|
237 |
iActiveWrapper->iStatus.Int() );
|
|
238 |
}
|
|
239 |
|
|
240 |
CleanupStack::Pop( &bearers );
|
|
241 |
bearers.Close();
|
|
242 |
CleanupStack::Pop( &connIds );
|
|
243 |
connIds.Close();
|
|
244 |
|
|
245 |
CMUILOGGER_LEAVEFN( "InitializeConnectionArrayL Done" );
|
|
246 |
}
|
|
247 |
|
|
248 |
// ---------------------------------------------------------------------------
|
|
249 |
// CConnectionMonitorUiAppUi::EventL
|
|
250 |
// ---------------------------------------------------------------------------
|
|
251 |
//
|
|
252 |
void CConnectionMonitorUiAppUi::EventL(
|
|
253 |
const CConnMonEventBase &aConnMonEvent )
|
|
254 |
{
|
|
255 |
CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::EventL" );
|
|
256 |
|
|
257 |
CMUILOGGER_WRITE_F( "EventL type: %d", aConnMonEvent.EventType() );
|
|
258 |
|
|
259 |
CConnectionInfoBase* connectionInfo = NULL;
|
|
260 |
TInt index( 0 );
|
|
261 |
TConnMonEvent event = ( TConnMonEvent ) aConnMonEvent.EventType();
|
|
262 |
TInt connectionId = aConnMonEvent.ConnectionId();
|
|
263 |
|
|
264 |
CMUILOGGER_WRITE_F( "Connection Id: %d", connectionId );
|
|
265 |
|
|
266 |
switch ( event )
|
|
267 |
{
|
|
268 |
case EConnMonCreateConnection:
|
|
269 |
{
|
|
270 |
CMUILOGGER_WRITE( "EConnMonCreateConnection" );
|
|
271 |
|
|
272 |
if ( connectionId > 0 )
|
|
273 |
{
|
|
274 |
iConnectionsWaitingFirstEvent.AppendL( connectionId );
|
|
275 |
}
|
|
276 |
break;
|
|
277 |
}
|
|
278 |
case EConnMonDeleteConnection:
|
|
279 |
{
|
|
280 |
CMUILOGGER_WRITE( "EConnMonDeleteConnection" );
|
|
281 |
TInt count = iNewConnectionIdArray.Count();
|
|
282 |
TInt i = 0;
|
|
283 |
TBool newConn = EFalse;
|
|
284 |
|
|
285 |
for ( TInt cindex = 0; cindex < iConnectionsWaitingFirstEvent.Count(); cindex++ )
|
|
286 |
{
|
|
287 |
if ( iConnectionsWaitingFirstEvent[cindex] == connectionId )
|
|
288 |
{
|
|
289 |
newConn = ETrue;
|
|
290 |
iConnectionsWaitingFirstEvent.Remove(cindex);
|
|
291 |
break;
|
|
292 |
}
|
|
293 |
}
|
|
294 |
|
|
295 |
if ( newConn )
|
|
296 |
{
|
|
297 |
// Job done
|
|
298 |
break;
|
|
299 |
}
|
|
300 |
|
|
301 |
while ( i < count )
|
|
302 |
{
|
|
303 |
if ( iNewConnectionIdArray[i] == connectionId )
|
|
304 |
{
|
|
305 |
iNewConnectionIdArray.Remove( i );
|
|
306 |
CMUILOGGER_WRITE_F( "Removed id %d from array", ( TUint )connectionId );
|
|
307 |
count--;
|
|
308 |
}
|
|
309 |
else
|
|
310 |
{
|
|
311 |
i++;
|
|
312 |
}
|
|
313 |
}
|
|
314 |
|
|
315 |
index = iConnectionArray->GetArrayIndex( connectionId );
|
|
316 |
if ( index >= 0 )
|
|
317 |
{
|
|
318 |
connectionInfo = ( *iConnectionArray )[index];
|
|
319 |
|
|
320 |
if ( iView->Id() == KDetailsViewId )
|
|
321 |
{
|
|
322 |
// Mark the connection as closed and refresh details view.
|
|
323 |
// It will change the status there.
|
|
324 |
connectionInfo->RefreshConnectionStatus( KConnectionClosed );
|
|
325 |
connectionInfo->RefreshDetailsArrayL();
|
|
326 |
}
|
|
327 |
else // MainView
|
|
328 |
{
|
|
329 |
TBool deleting = connectionInfo->GetDeletedFromCMUI();
|
|
330 |
if ( deleting )
|
|
331 |
{
|
|
332 |
ShowConnectionSummaryInformationNoteL( connectionInfo );
|
|
333 |
}
|
|
334 |
// Mark the connection as closed and update the status text.
|
|
335 |
// When the timer ticks the next time the marked connection
|
|
336 |
// is deleted and removed from the main view.
|
|
337 |
connectionInfo->RefreshConnectionStatus( KConnectionClosed );
|
|
338 |
connectionInfo->RefreshConnectionListBoxItemTextL();
|
|
339 |
}
|
|
340 |
CMUILOGGER_WRITE_F( "Deleted: %d", connectionId );
|
|
341 |
}
|
|
342 |
break;
|
|
343 |
}
|
|
344 |
case EConnMonConnectionStatusChange:
|
|
345 |
{
|
|
346 |
CMUILOGGER_WRITE( "EConnMonConnectionStatusChange" );
|
|
347 |
|
|
348 |
TBool newConn = EFalse;
|
|
349 |
|
|
350 |
for ( TInt cindex = 0; cindex < iConnectionsWaitingFirstEvent.Count(); cindex++ )
|
|
351 |
{
|
|
352 |
if ( iConnectionsWaitingFirstEvent[cindex] == connectionId )
|
|
353 |
{
|
|
354 |
newConn = ETrue;
|
|
355 |
iConnectionsWaitingFirstEvent.Remove(cindex);
|
|
356 |
break;
|
|
357 |
}
|
|
358 |
}
|
|
359 |
|
|
360 |
index = iConnectionArray->GetArrayIndex( connectionId );
|
|
361 |
|
|
362 |
if ( newConn || ( index < 0 ) )
|
|
363 |
{
|
|
364 |
if ( connectionId > 0)
|
|
365 |
{
|
|
366 |
TConnMonBearerType bearerType( EBearerUnknown );
|
|
367 |
iActiveWrapper->StartGetBearerType( connectionId,
|
|
368 |
iMonitor,
|
|
369 |
KBearer,
|
|
370 |
( TInt& )bearerType );
|
|
371 |
CMUILOGGER_WRITE_F( "status.Int(): %d",
|
|
372 |
iActiveWrapper->iStatus.Int() );
|
|
373 |
CMUILOGGER_WRITE_F( "bearerType: %d", ( TInt )bearerType );
|
|
374 |
if ( bearerType == 0 )
|
|
375 |
{
|
|
376 |
if ( connectionId )
|
|
377 |
{
|
|
378 |
iNewConnectionIdArray.AppendL( connectionId );
|
|
379 |
CMUILOGGER_WRITE_F( "id %d added to array", ( TUint )connectionId );
|
|
380 |
break;
|
|
381 |
}
|
|
382 |
}
|
|
383 |
|
|
384 |
connectionInfo = CreateConnectionInfoL( connectionId, bearerType );
|
|
385 |
}
|
|
386 |
|
|
387 |
if ( connectionInfo )
|
|
388 |
{
|
|
389 |
CleanupStack::PushL( connectionInfo );
|
|
390 |
iConnectionArray->AppendL( connectionInfo );
|
|
391 |
CleanupStack::Pop( connectionInfo );
|
|
392 |
}
|
|
393 |
}
|
|
394 |
|
|
395 |
index = iConnectionArray->GetArrayIndex( connectionId );
|
|
396 |
CMUILOGGER_WRITE_F( "Found index : %d", index );
|
|
397 |
|
|
398 |
if ( index >= 0 )
|
|
399 |
{
|
|
400 |
( *iConnectionArray )[index]->StatusChangedL();
|
|
401 |
}
|
|
402 |
break;
|
|
403 |
}
|
|
404 |
case EConnMonCreateSubConnection:
|
|
405 |
case EConnMonDeleteSubConnection:
|
|
406 |
{
|
|
407 |
CMUILOGGER_WRITE( "SubConnection" );
|
|
408 |
index = iConnectionArray->GetArrayIndex( connectionId );
|
|
409 |
if ( index >= 0)
|
|
410 |
{
|
|
411 |
( *iConnectionArray )[index]->RefreshDetailsL();
|
|
412 |
}
|
|
413 |
break;
|
|
414 |
}
|
|
415 |
default:
|
|
416 |
{
|
|
417 |
CMUILOGGER_WRITE( "On event default" );
|
|
418 |
break;
|
|
419 |
}
|
|
420 |
}
|
|
421 |
|
|
422 |
if ( iObserver && ( index >= 0 ) )
|
|
423 |
{
|
|
424 |
CMUILOGGER_WRITE( "EventL calls observer" );
|
|
425 |
iObserver->OnEventL( aConnMonEvent, index );
|
|
426 |
}
|
|
427 |
|
|
428 |
CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::EventL" );
|
|
429 |
}
|
|
430 |
|
|
431 |
// ---------------------------------------------------------------------------
|
|
432 |
// CConnectionMonitorUiAppUi::Static
|
|
433 |
// ---------------------------------------------------------------------------
|
|
434 |
//
|
|
435 |
CConnectionMonitorUiAppUi* CConnectionMonitorUiAppUi::Static()
|
|
436 |
{
|
|
437 |
return REINTERPRET_CAST( CConnectionMonitorUiAppUi*,
|
|
438 |
CEikonEnv::Static()->EikAppUi() );
|
|
439 |
}
|
|
440 |
|
|
441 |
// ---------------------------------------------------------------------------
|
|
442 |
// CConnectionMonitorUiAppUi::::DynInitMenuPaneL( TInt aResourceId,
|
|
443 |
// CEikMenuPane* aMenuPane )
|
|
444 |
// This function is called by the EIKON framework just before it displays
|
|
445 |
// a menu pane. Its default implementation is empty, and by overriding it,
|
|
446 |
// the application can set the state of menu items dynamically according
|
|
447 |
// to the state of application data.
|
|
448 |
// ---------------------------------------------------------------------------
|
|
449 |
//
|
|
450 |
void CConnectionMonitorUiAppUi::DynInitMenuPaneL(
|
|
451 |
TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ )
|
|
452 |
{
|
|
453 |
}
|
|
454 |
|
|
455 |
// ----------------------------------------------------
|
|
456 |
// CConnectionMonitorUiAppUi::HandleKeyEventL(
|
|
457 |
// const TKeyEvent& aKeyEvent, TEventCode /*aType*/ )
|
|
458 |
// ----------------------------------------------------
|
|
459 |
//
|
|
460 |
TKeyResponse CConnectionMonitorUiAppUi::HandleKeyEventL(
|
|
461 |
const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/ )
|
|
462 |
{
|
|
463 |
return EKeyWasNotConsumed;
|
|
464 |
}
|
|
465 |
|
|
466 |
// ----------------------------------------------------
|
|
467 |
// CConnectionMonitorUiAppUi::HandleCommandL( TInt aCommand )
|
|
468 |
// ----------------------------------------------------
|
|
469 |
//
|
|
470 |
void CConnectionMonitorUiAppUi::HandleCommandL( TInt aCommand )
|
|
471 |
{
|
|
472 |
switch ( aCommand )
|
|
473 |
{
|
|
474 |
case EEikCmdExit:
|
|
475 |
case EAknCmdExit:
|
|
476 |
case EAknSoftkeyExit:
|
|
477 |
{
|
|
478 |
Exit();
|
|
479 |
break;
|
|
480 |
}
|
|
481 |
default:
|
|
482 |
break;
|
|
483 |
}
|
|
484 |
}
|
|
485 |
|
|
486 |
// ---------------------------------------------------------
|
|
487 |
// CConnectionMonitorUiAppUi::StartConnEventNotification
|
|
488 |
// ---------------------------------------------------------
|
|
489 |
//
|
|
490 |
void CConnectionMonitorUiAppUi::StartConnEventNotification(
|
|
491 |
MActiveEventObserverInterface* aObserver )
|
|
492 |
{
|
|
493 |
CMUILOGGER_ENTERFN
|
|
494 |
( "CConnectionMonitorUiAppUi::StartConnEventNotification" );
|
|
495 |
|
|
496 |
iObserver = aObserver;
|
|
497 |
|
|
498 |
CMUILOGGER_LEAVEFN
|
|
499 |
( "CConnectionMonitorUiAppUi::StartConnEventNotification" );
|
|
500 |
}
|
|
501 |
|
|
502 |
// ---------------------------------------------------------
|
|
503 |
// CConnectionMonitorUiAppUi::StopConnEventNotification
|
|
504 |
// ---------------------------------------------------------
|
|
505 |
//
|
|
506 |
void CConnectionMonitorUiAppUi::StopConnEventNotification(
|
|
507 |
MActiveEventObserverInterface* aObserver )
|
|
508 |
{
|
|
509 |
CMUILOGGER_ENTERFN
|
|
510 |
( "CConnectionMonitorUiAppUi::StopConnEventNotification" );
|
|
511 |
|
|
512 |
if ( iObserver == aObserver )
|
|
513 |
{
|
|
514 |
iObserver = NULL;
|
|
515 |
}
|
|
516 |
|
|
517 |
CMUILOGGER_LEAVEFN
|
|
518 |
( "CConnectionMonitorUiAppUi::StopConnEventNotification" );
|
|
519 |
}
|
|
520 |
|
|
521 |
// ---------------------------------------------------------
|
|
522 |
// CConnectionMonitorUiAppUi::StartTimerL
|
|
523 |
// ---------------------------------------------------------
|
|
524 |
//
|
|
525 |
void CConnectionMonitorUiAppUi::StartTimerL( const TInt aInterval )
|
|
526 |
{
|
|
527 |
CMUILOGGER_WRITE( "Starting timer" );
|
|
528 |
|
|
529 |
if ( !iPeriodic )
|
|
530 |
{
|
|
531 |
iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
|
|
532 |
CMUILOGGER_WRITE_F( "aInterval : %d", aInterval );
|
|
533 |
|
|
534 |
iPeriodic->Start( aInterval, aInterval,
|
|
535 |
TCallBack( Tick, this ) );
|
|
536 |
}
|
|
537 |
|
|
538 |
CMUILOGGER_WRITE( "Timer started" );
|
|
539 |
}
|
|
540 |
|
|
541 |
// ---------------------------------------------------------
|
|
542 |
// CConnectionMonitorUiAppUi::StopTimer
|
|
543 |
// ---------------------------------------------------------
|
|
544 |
//
|
|
545 |
void CConnectionMonitorUiAppUi::StopTimer()
|
|
546 |
{
|
|
547 |
CMUILOGGER_WRITE( "Stopping timer" );
|
|
548 |
if ( iPeriodic )
|
|
549 |
{
|
|
550 |
CMUILOGGER_WRITE( "Timer existing" );
|
|
551 |
iPeriodic->Cancel();
|
|
552 |
delete iPeriodic;
|
|
553 |
iPeriodic = NULL;
|
|
554 |
}
|
|
555 |
|
|
556 |
CMUILOGGER_WRITE( "Timer stopped" );
|
|
557 |
}
|
|
558 |
|
|
559 |
// ---------------------------------------------------------
|
|
560 |
// CConnectionMonitorUiAppUi::Tick
|
|
561 |
// ---------------------------------------------------------
|
|
562 |
//
|
|
563 |
TInt CConnectionMonitorUiAppUi::Tick( TAny* aObject )
|
|
564 |
{
|
|
565 |
CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::Tick(TAny* aObject)" );
|
|
566 |
|
|
567 |
CConnectionMonitorUiAppUi* myself =
|
|
568 |
static_cast<CConnectionMonitorUiAppUi*>( aObject );
|
|
569 |
myself->Tick();
|
|
570 |
|
|
571 |
CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::Tick(TAny* aObject)" );
|
|
572 |
return 1;
|
|
573 |
}
|
|
574 |
|
|
575 |
// ---------------------------------------------------------
|
|
576 |
// CConnectionMonitorUiAppUi::Tick
|
|
577 |
// ---------------------------------------------------------
|
|
578 |
//
|
|
579 |
TInt CConnectionMonitorUiAppUi::Tick()
|
|
580 |
{
|
|
581 |
CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::Tick()" );
|
|
582 |
|
|
583 |
if ( iTimerObserver )
|
|
584 |
{
|
|
585 |
TInt error( KErrNone );
|
|
586 |
|
|
587 |
TRAP( error, iTimerObserver->OnTimerExpiredL() );
|
|
588 |
CMUILOGGER_WRITE_F( "OnTimerExpiredL error id : %d", error );
|
|
589 |
|
|
590 |
// refresh listboxes
|
|
591 |
if ( !error && ( iObserver ) )
|
|
592 |
{
|
|
593 |
CMUILOGGER_WRITE( "Tick !error && ( iObserver )" );
|
|
594 |
TRAP( error, iObserver->OnTimerEventL() );
|
|
595 |
}
|
|
596 |
CMUILOGGER_WRITE( "after Tick !error && ( iObserver )" );
|
|
597 |
}
|
|
598 |
|
|
599 |
CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::Tick()" );
|
|
600 |
return 1;
|
|
601 |
}
|
|
602 |
|
|
603 |
// ---------------------------------------------------------
|
|
604 |
// CConnectionMonitorUiAppUi::OnTimerExpiredL
|
|
605 |
// ---------------------------------------------------------
|
|
606 |
//
|
|
607 |
void CConnectionMonitorUiAppUi::OnTimerExpiredL()
|
|
608 |
{
|
|
609 |
CMUILOGGER_WRITE_F( "MdcaCount: %d", iConnectionArray->MdcaCount());
|
|
610 |
// First check if there are connections that need to be deleted.
|
|
611 |
// The conditions for deletion are:
|
|
612 |
// 1. Connection status must be closed
|
|
613 |
// 2. Main view must be active (details view should be shown also for closed connections)
|
|
614 |
// 3. There must not be active request ongoing (otherwise deletion might cause crash)
|
|
615 |
for(TUint i = 0; i < iConnectionArray->MdcaCount(); i++)
|
|
616 |
{
|
|
617 |
CMUILOGGER_WRITE_F( "i: %d", i );
|
|
618 |
CMUILOGGER_WRITE_F( "Status: %d", (*iConnectionArray)[i]->GetStatus() );
|
|
619 |
CMUILOGGER_WRITE_F( "active: %d", iActiveWrapper->IsActive() );
|
|
620 |
if( (*iConnectionArray)[i]->GetStatus() == EConnectionClosed
|
|
621 |
&& !iActiveWrapper->IsActive()
|
|
622 |
&& iView->Id() != KDetailsViewId)
|
|
623 |
{
|
|
624 |
CMUILOGGER_WRITE_F( "Delete conn id: %d", (*iConnectionArray)[i]->GetConnectionId() );
|
|
625 |
iConnectionArray->Delete( (*iConnectionArray)[i]->GetConnectionId() );
|
|
626 |
i--;
|
|
627 |
}
|
|
628 |
}
|
|
629 |
|
|
630 |
|
|
631 |
TInt count = iNewConnectionIdArray.Count();
|
|
632 |
if ( count > 0 )
|
|
633 |
{
|
|
634 |
for ( TInt i = 0; i < count; i++ )
|
|
635 |
{
|
|
636 |
TConnMonBearerType bearerType( EBearerUnknown );
|
|
637 |
iActiveWrapper->StartGetBearerType( iNewConnectionIdArray[i],
|
|
638 |
iMonitor,
|
|
639 |
KBearer,
|
|
640 |
( TInt& )bearerType );
|
|
641 |
CMUILOGGER_WRITE_F( "status.Int(): %d",
|
|
642 |
iActiveWrapper->iStatus.Int() );
|
|
643 |
CMUILOGGER_WRITE_F( "bearerType: %d", ( TInt )bearerType );
|
|
644 |
if ( bearerType == 0 )
|
|
645 |
{
|
|
646 |
continue;
|
|
647 |
}
|
|
648 |
CConnectionInfoBase* connectionInfo = NULL;
|
|
649 |
TInt err;
|
|
650 |
TRAP(err, connectionInfo = CreateConnectionInfoL( iNewConnectionIdArray[i], bearerType ));
|
|
651 |
if ( err )
|
|
652 |
{
|
|
653 |
continue;
|
|
654 |
}
|
|
655 |
|
|
656 |
|
|
657 |
if ( connectionInfo )
|
|
658 |
{
|
|
659 |
CleanupStack::PushL( connectionInfo );
|
|
660 |
iConnectionArray->AppendL( connectionInfo );
|
|
661 |
CleanupStack::Pop( connectionInfo );
|
|
662 |
|
|
663 |
iNewConnectionIdArray.Remove( i );
|
|
664 |
count--;
|
|
665 |
i--;
|
|
666 |
CMUILOGGER_WRITE_F( "Removed index %d from array", ( TInt )i );
|
|
667 |
}
|
|
668 |
|
|
669 |
}
|
|
670 |
}
|
|
671 |
RefreshAllConnectionsL();
|
|
672 |
if ( iView )
|
|
673 |
{
|
|
674 |
CMUILOGGER_WRITE_F( "iView->Id() %d", iView->Id() );
|
|
675 |
if ( iView->Id() == KConnectionsViewId )
|
|
676 |
{
|
|
677 |
CConnectionMonitorUiView* view =
|
|
678 |
( CConnectionMonitorUiView* )iView;
|
|
679 |
view->ConnectionKeyObserver();
|
|
680 |
}
|
|
681 |
}
|
|
682 |
}
|
|
683 |
|
|
684 |
// ---------------------------------------------------------
|
|
685 |
// CConnectionMonitorUiAppUi::GetTickInerval
|
|
686 |
// ---------------------------------------------------------
|
|
687 |
//
|
|
688 |
TInt CConnectionMonitorUiAppUi::GetTickInerval() const
|
|
689 |
{
|
|
690 |
return KTickInterval;
|
|
691 |
}
|
|
692 |
|
|
693 |
// ---------------------------------------------------------
|
|
694 |
// CConnectionMonitorUiAppUi::RefreshAllConnectionsL
|
|
695 |
// ---------------------------------------------------------
|
|
696 |
//
|
|
697 |
void CConnectionMonitorUiAppUi::RefreshAllConnectionsL()
|
|
698 |
{
|
|
699 |
CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::RefreshAllConnectionsL" );
|
|
700 |
TUint index( 0 );
|
|
701 |
CConnectionInfoBase* connection = NULL;
|
|
702 |
if ( iConnectionArray )
|
|
703 |
{
|
|
704 |
TUint count = iConnectionArray->MdcaCount();
|
|
705 |
while ( index < count )
|
|
706 |
{
|
|
707 |
connection = ( *iConnectionArray )[index];
|
|
708 |
// MainView Refresh
|
|
709 |
if ( ( connection->IsAlive() ) &&
|
|
710 |
( !connection->IsSuspended() ) )
|
|
711 |
{
|
|
712 |
CMUILOGGER_WRITE( "MainView Refresh" );
|
|
713 |
CMUILOGGER_WRITE_F( "RefreshAllConnectionsL index: %d",
|
|
714 |
index );
|
|
715 |
CMUILOGGER_WRITE_F( "RefreshAllConnectionsL connId: %d",
|
|
716 |
connection->GetConnectionId() );
|
|
717 |
connection->RefreshDetailsL();
|
|
718 |
}
|
|
719 |
// DetailsView Refresh
|
|
720 |
if ( ( connection->IsAlive() &&
|
|
721 |
( iView->Id() == KDetailsViewId ) ) )
|
|
722 |
{
|
|
723 |
CMUILOGGER_WRITE( "DetailsView Refresh" );
|
|
724 |
connection->RefreshDetailsArrayL();
|
|
725 |
}
|
|
726 |
connection->RefreshConnectionListBoxItemTextL();
|
|
727 |
count = iConnectionArray->MdcaCount();
|
|
728 |
++index;
|
|
729 |
}
|
|
730 |
}
|
|
731 |
CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::RefreshAllConnectionsL" );
|
|
732 |
}
|
|
733 |
|
|
734 |
// ---------------------------------------------------------
|
|
735 |
// CConnectionMonitorUiAppUi::HandleForegroundEventL
|
|
736 |
// ---------------------------------------------------------
|
|
737 |
//
|
|
738 |
void CConnectionMonitorUiAppUi::HandleForegroundEventL( TBool aForeground )
|
|
739 |
{
|
|
740 |
CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::HandleForegroundEventL" );
|
|
741 |
|
|
742 |
CAknViewAppUi::HandleForegroundEventL( aForeground );
|
|
743 |
if ( aForeground )
|
|
744 |
{
|
|
745 |
CMUILOGGER_WRITE( "Foreground" );
|
|
746 |
if ( activateMainView && iView != NULL && iView->Id() == KDetailsViewId )
|
|
747 |
{
|
|
748 |
((CConnectionMonitorUiDetailsView*) iView)->ActivateMainViewL();
|
|
749 |
activateMainView = EFalse;
|
|
750 |
}
|
|
751 |
|
|
752 |
TInt interval( KTickInterval );
|
|
753 |
if ( iTimerObserver )
|
|
754 |
{
|
|
755 |
interval = iTimerObserver->GetTickInerval();
|
|
756 |
}
|
|
757 |
StartTimerL( interval );
|
|
758 |
}
|
|
759 |
else
|
|
760 |
{
|
|
761 |
CMUILOGGER_WRITE( "Background" );
|
|
762 |
StopTimer();
|
|
763 |
activateMainView = EFalse;
|
|
764 |
}
|
|
765 |
|
|
766 |
CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::HandleForegroundEventL" );
|
|
767 |
}
|
|
768 |
|
|
769 |
// ---------------------------------------------------------
|
|
770 |
// CConnectionMonitorUiAppUi::CreateConnectionInfoL
|
|
771 |
// ---------------------------------------------------------
|
|
772 |
//
|
|
773 |
CConnectionInfoBase* CConnectionMonitorUiAppUi::CreateConnectionInfoL(
|
|
774 |
TUint aConnectionId,
|
|
775 |
TConnMonBearerType aBearerType )
|
|
776 |
{
|
|
777 |
CMUILOGGER_ENTERFN( "CreateConnectionInfoL - start " );
|
|
778 |
|
|
779 |
CConnectionInfoBase* connection = NULL;
|
|
780 |
|
|
781 |
if ( aConnectionId > 0 )
|
|
782 |
{
|
|
783 |
|
|
784 |
#ifdef __WINS__
|
|
785 |
if ( aBearerType == EBearerLAN )
|
|
786 |
{
|
|
787 |
aBearerType = EBearerGPRS;
|
|
788 |
}
|
|
789 |
#endif
|
|
790 |
switch ( aBearerType )
|
|
791 |
{
|
|
792 |
case EBearerGPRS:
|
|
793 |
case EBearerWCDMA:
|
|
794 |
case EBearerEdgeGPRS:
|
|
795 |
case EBearerExternalGPRS:
|
|
796 |
case EBearerExternalWCDMA:
|
|
797 |
case EBearerExternalEdgeGPRS:
|
|
798 |
{
|
|
799 |
CMUILOGGER_WRITE( "CGprsConnectionInfo" );
|
|
800 |
|
|
801 |
connection = CGprsConnectionInfo::NewL(
|
|
802 |
aConnectionId,
|
|
803 |
&iMonitor,
|
|
804 |
aBearerType,
|
|
805 |
iActiveWrapper );
|
|
806 |
break;
|
|
807 |
}
|
|
808 |
case EBearerCSD:
|
|
809 |
case EBearerHSCSD:
|
|
810 |
case EBearerWcdmaCSD:
|
|
811 |
case EBearerExternalCSD:
|
|
812 |
case EBearerExternalHSCSD:
|
|
813 |
case EBearerExternalWcdmaCSD:
|
|
814 |
{
|
|
815 |
CMUILOGGER_WRITE( "CCsdConnectionInfo" );
|
|
816 |
|
|
817 |
connection = CCsdConnectionInfo::NewL(
|
|
818 |
aConnectionId,
|
|
819 |
&iMonitor,
|
|
820 |
aBearerType,
|
|
821 |
iActiveWrapper );
|
|
822 |
break;
|
|
823 |
}
|
|
824 |
case EBearerWLAN:
|
|
825 |
//case EBearerExternalWLAN:
|
|
826 |
{
|
|
827 |
CMUILOGGER_WRITE( "CWlanConnectionInfo" );
|
|
828 |
|
|
829 |
connection = CWlanConnectionInfo::NewL(
|
|
830 |
aConnectionId,
|
|
831 |
&iMonitor,
|
|
832 |
aBearerType,
|
|
833 |
iEasyWlanIAPName,
|
|
834 |
iActiveWrapper );
|
|
835 |
break;
|
|
836 |
}
|
|
837 |
default :
|
|
838 |
{
|
|
839 |
CMUILOGGER_WRITE( "CreateConnectionInfoL, default" );
|
|
840 |
break;
|
|
841 |
}
|
|
842 |
}
|
|
843 |
CMUILOGGER_WRITE_F( "Connection created: %d", aConnectionId );
|
|
844 |
|
|
845 |
if ( connection && connection->CheckMrouterIap() )
|
|
846 |
{
|
|
847 |
CMUILOGGER_WRITE_F( "Connection deleted: %d", aConnectionId );
|
|
848 |
delete connection;
|
|
849 |
connection = NULL;
|
|
850 |
}
|
|
851 |
}
|
|
852 |
else
|
|
853 |
{
|
|
854 |
CMUILOGGER_WRITE( "Connection id is invalid" );
|
|
855 |
}
|
|
856 |
|
|
857 |
CMUILOGGER_LEAVEFN( "CreateConnectionInfoL - end " );
|
|
858 |
|
|
859 |
return connection;
|
|
860 |
}
|
|
861 |
|
|
862 |
// ---------------------------------------------------------
|
|
863 |
// CConnectionMonitorUiAppUi::GetEasyWlanIAPNameL
|
|
864 |
// ---------------------------------------------------------
|
|
865 |
//
|
|
866 |
void CConnectionMonitorUiAppUi::GetEasyWlanIAPNameL()
|
|
867 |
{
|
|
868 |
CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::GetEasyWlanIAPNameL" );
|
|
869 |
|
|
870 |
delete iEasyWlanIAPName;
|
|
871 |
iEasyWlanIAPName = NULL;
|
|
872 |
|
|
873 |
RCmManagerExt cmManagerExt;
|
|
874 |
cmManagerExt.OpenL();
|
|
875 |
CleanupClosePushL( cmManagerExt );
|
|
876 |
|
|
877 |
TUint32 easyWlanId = cmManagerExt.EasyWlanIdL();
|
|
878 |
if ( easyWlanId )
|
|
879 |
{
|
|
880 |
CMUILOGGER_WRITE_F( "easyWlanId %d", easyWlanId );
|
|
881 |
iEasyWlanIAPName = cmManagerExt
|
|
882 |
.GetConnectionMethodInfoStringL(
|
|
883 |
easyWlanId,
|
|
884 |
CMManager::ECmName );
|
|
885 |
CMUILOGGER_WRITE_F( "iEasyWlanIAPName: %S", iEasyWlanIAPName );
|
|
886 |
}
|
|
887 |
|
|
888 |
CleanupStack::PopAndDestroy( &cmManagerExt );
|
|
889 |
|
|
890 |
CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::GetEasyWlanIAPNameL" );
|
|
891 |
}
|
|
892 |
|
|
893 |
// ---------------------------------------------------------
|
|
894 |
// CConnectionMonitorUiAppUi::ShowConnectionSummaryInformationNoteL
|
|
895 |
// ---------------------------------------------------------
|
|
896 |
//
|
|
897 |
void CConnectionMonitorUiAppUi::ShowConnectionSummaryInformationNoteL(
|
|
898 |
const CConnectionInfoBase* aConnection )
|
|
899 |
{
|
|
900 |
CMUILOGGER_ENTERFN(
|
|
901 |
"CConnectionMonitorUiContainer::ShowConnectionSummaryInformationNoteL" );
|
|
902 |
|
|
903 |
HBufC* total = aConnection->ToStringTotalTransmittedDataLC();
|
|
904 |
HBufC* duration = aConnection->ToStringDurationLC();
|
|
905 |
|
|
906 |
CMUILOGGER_WRITE_F( "total: %S", total );
|
|
907 |
CMUILOGGER_WRITE_F( "duration: %S", duration );
|
|
908 |
|
|
909 |
CDesCArrayFlat* strings = new( ELeave ) CDesCArrayFlat( 2 );
|
|
910 |
CleanupStack::PushL( strings );
|
|
911 |
|
|
912 |
strings->AppendL( *total );
|
|
913 |
strings->AppendL( *duration );
|
|
914 |
|
|
915 |
HBufC* informationText;
|
|
916 |
informationText = StringLoader::LoadLC( R_QTN_CMON_CONNECTION_SUMMARY_NOTE_TEXT,
|
|
917 |
*strings );
|
|
918 |
|
|
919 |
CAknNoteDialog* dlg = new ( ELeave ) CAknNoteDialog(
|
|
920 |
CAknNoteDialog::ENoTone,
|
|
921 |
CAknNoteDialog::TTimeout( 5000000 ) );
|
|
922 |
dlg->PrepareLC( R_QTN_CMON_CONNECTION_SUMMARY_NOTE );
|
|
923 |
dlg->SetTextWrapping( EFalse );
|
|
924 |
|
|
925 |
TPtr temp( informationText->Des() );
|
|
926 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp );
|
|
927 |
|
|
928 |
dlg->SetCurrentLabelL( EGeneralNote, temp ); //SetTextL
|
|
929 |
|
|
930 |
dlg->RunDlgLD();
|
|
931 |
|
|
932 |
CleanupStack::PopAndDestroy( informationText );
|
|
933 |
CleanupStack::PopAndDestroy( strings );
|
|
934 |
CleanupStack::PopAndDestroy( duration );
|
|
935 |
CleanupStack::PopAndDestroy( total );
|
|
936 |
|
|
937 |
CMUILOGGER_LEAVEFN(
|
|
938 |
"CConnectionMonitorUiContainer::ShowConnectionSummaryInformationNoteL" );
|
|
939 |
}
|
|
940 |
|
|
941 |
// ---------------------------------------------------------
|
|
942 |
// CConnectionMonitorUiAppUi::DeleteDetailsView
|
|
943 |
// ---------------------------------------------------------
|
|
944 |
//
|
|
945 |
void CConnectionMonitorUiAppUi::DeleteDetailsView(
|
|
946 |
TInt aConnId,
|
|
947 |
CConnectionInfoBase* aConnInfo )
|
|
948 |
{
|
|
949 |
CMUILOGGER_WRITE( "CConnectionMonitorUiAppUi::DeleteDetailsView Start" );
|
|
950 |
CMUILOGGER_WRITE_F( "aConnInfo: %d", aConnInfo );
|
|
951 |
CMUILOGGER_WRITE_F( "aConnId: %d", aConnId );
|
|
952 |
|
|
953 |
TBool deleting = aConnInfo->GetDeletedFromCMUI();
|
|
954 |
iConnectionArray->Delete( aConnId );
|
|
955 |
|
|
956 |
CMUILOGGER_WRITE_F( "Deleted: %d", aConnId );
|
|
957 |
CMUILOGGER_WRITE( "CConnectionMonitorUiAppUi::DeleteDetailsView End" );
|
|
958 |
}
|
|
959 |
|
|
960 |
#ifdef RD_CONTROL_PANEL
|
|
961 |
|
|
962 |
// -----------------------------------------------------------------------------
|
|
963 |
// CConnectionMonitorUiAppUi::IsEmbedded
|
|
964 |
// -----------------------------------------------------------------------------
|
|
965 |
//
|
|
966 |
TBool CConnectionMonitorUiAppUi::IsEmbedded() const
|
|
967 |
{
|
|
968 |
return iEikonEnv->StartedAsServerApp();
|
|
969 |
}
|
|
970 |
|
|
971 |
#endif // RD_CONTROL_PANEL
|
|
972 |
|
|
973 |
|
|
974 |
// End of File
|