22
|
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:
|
|
15 |
* Alwaysonline manager implementation file
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
#include <ecom/ecom.h>
|
|
21 |
#include <ecom/resolver.h>
|
|
22 |
#include <AlwaysOnlineManagerCommon.h>
|
|
23 |
#include <CoreApplicationUIsSDKCRKeys.h> // Offline key
|
|
24 |
|
|
25 |
#include "AlwaysOnlineManager.h"
|
|
26 |
#include "AlwaysOnlineManagerServer.h"
|
|
27 |
#include "HandleServerCommandOperation.h"
|
|
28 |
#include "AlwaysOnlineManagerLogging.h"
|
|
29 |
#include "AOCenRepControl.h"
|
|
30 |
#include "AOCommandParser.h"
|
|
31 |
|
|
32 |
const TInt KPluginArrayGranularity = 3;
|
|
33 |
const TInt KNWOperationsAllowed = 1;
|
|
34 |
const TInt KManagerOperationsGranularity = 6;
|
|
35 |
|
|
36 |
const TInt KDisabledPluginsGranulatiry = 3;
|
|
37 |
|
|
38 |
const TUid KAOEmailPluginUid = {0x101F85ED};
|
|
39 |
|
|
40 |
_LIT8( KStopPlugin, "1" );
|
|
41 |
#ifdef _DEBUG
|
|
42 |
_LIT( KAOManagerParsePanic, "AO parse" );
|
|
43 |
#endif
|
|
44 |
|
|
45 |
// ----------------------------------------------------------------------------
|
|
46 |
// CAlwaysOnlineManager()
|
|
47 |
// ----------------------------------------------------------------------------
|
|
48 |
//
|
|
49 |
CAlwaysOnlineManager::CAlwaysOnlineManager()
|
|
50 |
{
|
|
51 |
}
|
|
52 |
|
|
53 |
// ----------------------------------------------------------------------------
|
|
54 |
// NewL()
|
|
55 |
// ----------------------------------------------------------------------------
|
|
56 |
//
|
|
57 |
CAlwaysOnlineManager* CAlwaysOnlineManager::NewL(
|
|
58 |
CAlwaysOnlineManagerServer* aServer )
|
|
59 |
{
|
|
60 |
CAlwaysOnlineManager* self = new(ELeave) CAlwaysOnlineManager;
|
|
61 |
CleanupStack::PushL( self );
|
|
62 |
self->ConstructL( aServer );
|
|
63 |
CleanupStack::Pop( self );
|
|
64 |
return self;
|
|
65 |
}
|
|
66 |
|
|
67 |
// ----------------------------------------------------------------------------
|
|
68 |
// ~CAlwaysOnlineManager()
|
|
69 |
// ----------------------------------------------------------------------------
|
|
70 |
//
|
|
71 |
CAlwaysOnlineManager::~CAlwaysOnlineManager()
|
|
72 |
{
|
|
73 |
if ( iOperations )
|
|
74 |
{
|
|
75 |
iOperations->ResetAndDestroy();
|
|
76 |
}
|
|
77 |
|
|
78 |
delete iOperations;
|
|
79 |
iRfs.Close();
|
|
80 |
iConMon.Close();
|
|
81 |
|
|
82 |
//we shouldn't never come here while phone is switched on
|
|
83 |
if ( iPluginArray )
|
|
84 |
{
|
|
85 |
TInt idx = KErrNotFound;
|
|
86 |
while( iPluginArray->Count() )
|
|
87 |
{
|
|
88 |
idx = iPluginArray->Count() - 1;
|
|
89 |
// Delete object
|
|
90 |
delete iPluginArray->At( idx );
|
|
91 |
// Delete element
|
|
92 |
iPluginArray->Delete( idx );
|
|
93 |
}
|
|
94 |
}
|
|
95 |
|
|
96 |
delete iCenRepControl;
|
|
97 |
delete iPluginArray;
|
|
98 |
delete iDisabledPluginUidsArray;
|
|
99 |
delete iDiskSpaceObserver;
|
|
100 |
delete iSession;
|
|
101 |
}
|
|
102 |
|
|
103 |
// ----------------------------------------------------------------------------
|
|
104 |
// ConstructL()
|
|
105 |
// ----------------------------------------------------------------------------
|
|
106 |
//
|
|
107 |
void CAlwaysOnlineManager::ConstructL( CAlwaysOnlineManagerServer* aServer )
|
|
108 |
{
|
|
109 |
// Create operation array to heap
|
|
110 |
iOperations = new ( ELeave )
|
|
111 |
CMsvSingleOpWatcherArray( KManagerOperationsGranularity );
|
|
112 |
|
|
113 |
iCenRepControl = CAOCenRepControl::NewL( *this );
|
|
114 |
|
|
115 |
iSession = CMsvSession::OpenSyncL(*this);
|
|
116 |
iServer = aServer;
|
|
117 |
iNetworkStatus = KErrNotFound;
|
|
118 |
iOffline = ETrue;
|
|
119 |
iLastDiskEvent = EAOManagerEmailCommandBase;
|
|
120 |
iPluginsLoaded = EFalse;
|
|
121 |
iPluginArray = new(ELeave)
|
|
122 |
CArrayFixFlat<CAlwaysOnlineEComInterface*>(KPluginArrayGranularity);
|
|
123 |
iDisabledPluginUidsArray = new ( ELeave )
|
|
124 |
CArrayFixFlat<TUid>( KDisabledPluginsGranulatiry );
|
|
125 |
|
|
126 |
User::LeaveIfError( iRfs.Connect() );
|
|
127 |
iConMon.ConnectL();
|
|
128 |
}
|
|
129 |
|
|
130 |
// ----------------------------------------------------------------------------
|
|
131 |
// DoStartL()
|
|
132 |
// ----------------------------------------------------------------------------
|
|
133 |
//
|
|
134 |
void CAlwaysOnlineManager::DoStartL()
|
|
135 |
{
|
|
136 |
if( !iPluginsLoaded )
|
|
137 |
{
|
|
138 |
TRAPD( err, LoadPluginsL() );
|
|
139 |
if ( err != KErrNone )
|
|
140 |
{
|
|
141 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::DoStartL() Errors in LoadPluginsL. Err = %d", err );
|
|
142 |
}
|
|
143 |
else
|
|
144 |
{
|
|
145 |
// Nowadays, we don't care about the plugin count, we will start all
|
|
146 |
// which are not disabled. At this point iPluginArray contains those
|
|
147 |
// plugins which are enabled.
|
|
148 |
TRAPD( err, StartPluginsL() );
|
|
149 |
if ( err != KErrNone )
|
|
150 |
{
|
|
151 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::DoStartL() Errors in StartPluginsL. Err = %d", err );
|
|
152 |
}
|
|
153 |
else
|
|
154 |
{
|
|
155 |
//don't start observer unless plugins have been started
|
|
156 |
iDiskSpaceObserver =
|
|
157 |
CAlwaysOnlineDiskSpaceObserver::NewL( this, *iSession );
|
|
158 |
iDiskSpaceObserver->SetLimitAndActivateL();
|
|
159 |
//check network status and start observing it
|
|
160 |
CheckNetworkStatusAndSetObserverL();
|
|
161 |
|
|
162 |
//get state of KCoreAppUIsNetworkConnectionAllowed key from
|
|
163 |
//CenRep and relay it to plugins
|
|
164 |
TInt state = KErrNotFound;
|
|
165 |
TInt result = iCenRepControl->GetCenRepKey(
|
|
166 |
KCRUidCoreApplicationUIs,
|
|
167 |
KCoreAppUIsNetworkConnectionAllowed,
|
|
168 |
state );
|
|
169 |
|
|
170 |
if ( result == KErrNone )
|
|
171 |
{
|
|
172 |
HandleOfflineEventL( state );
|
|
173 |
}
|
|
174 |
else
|
|
175 |
{
|
|
176 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::DoStartL() Could not get KCoreAppUIsNetworkConnectionAllowed from CenRep! Result = %d", result );
|
|
177 |
}
|
|
178 |
}
|
|
179 |
|
|
180 |
// Send suicide query to all started plugins.
|
|
181 |
KAOMANAGER_LOGGER_WRITE("CAlwaysOnlineManager::DoStartL() Sending suicide queries.");
|
|
182 |
QuerySuicideL();
|
|
183 |
}
|
|
184 |
}
|
|
185 |
}
|
|
186 |
|
|
187 |
// ----------------------------------------------------------------------------
|
|
188 |
// PointerArrayCleanup()
|
|
189 |
//
|
|
190 |
// An utility function to handle cleanup of RImplInfoPtrArray instances
|
|
191 |
// @param aArray Pointer to RImpInfoPtrArray to be deleted.
|
|
192 |
// Guaranteed not to be NULL.
|
|
193 |
// ----------------------------------------------------------------------------
|
|
194 |
//
|
|
195 |
static void PointerArrayCleanup( TAny* aArray )
|
|
196 |
{
|
|
197 |
static_cast< RImplInfoPtrArray* >( aArray )->ResetAndDestroy();
|
|
198 |
}
|
|
199 |
|
|
200 |
// ----------------------------------------------------------------------------
|
|
201 |
// LoadPluginsL()
|
|
202 |
// ----------------------------------------------------------------------------
|
|
203 |
//
|
|
204 |
void CAlwaysOnlineManager::LoadPluginsL()
|
|
205 |
{
|
|
206 |
RImplInfoPtrArray pluginArray;
|
|
207 |
TCleanupItem arrayCleanup( PointerArrayCleanup, &pluginArray );
|
|
208 |
CleanupStack::PushL( arrayCleanup );
|
|
209 |
|
|
210 |
//List all plugins which implement AlwaysOnlineManagerInterface
|
|
211 |
REComSession::ListImplementationsL( KCEComInterfaceUid, pluginArray );
|
|
212 |
|
|
213 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::LoadPluginsL() Count of plugins found: %d", pluginArray.Count() );
|
|
214 |
|
|
215 |
// Update list of disabled plugins from cenrep
|
|
216 |
iCenRepControl->UpdateDisabledPluginsUids( *iDisabledPluginUidsArray );
|
|
217 |
|
|
218 |
if ( pluginArray.Count() )
|
|
219 |
{
|
|
220 |
TInt index = -1;
|
|
221 |
TKeyArrayFix key( 0, ECmpTInt32 );
|
|
222 |
|
|
223 |
for( TInt i = 0; i < pluginArray.Count(); i++ )
|
|
224 |
{
|
|
225 |
CImplementationInformation* info = pluginArray[ i ];
|
|
226 |
|
|
227 |
TUid id = info->ImplementationUid();
|
|
228 |
|
|
229 |
TInt result( iDisabledPluginUidsArray->Find( id, key, index ) );
|
|
230 |
// if id is found from disabled plugins list, then we don't
|
|
231 |
// load it.
|
|
232 |
if ( result == 0 )
|
|
233 |
{
|
|
234 |
KAOMANAGER_LOGGER_WRITE_FORMAT( "CAlwaysOnlineManager::LoadPluginsL() disabled plugin: 0x%x", id );
|
|
235 |
}
|
|
236 |
else
|
|
237 |
{
|
|
238 |
CAlwaysOnlineEComInterface* implementation( NULL );
|
|
239 |
|
|
240 |
//be sure that if plugin leaves, manager doesn't.
|
|
241 |
//This applies in every place!
|
|
242 |
TRAP_IGNORE( implementation = CAlwaysOnlineEComInterface::NewL( id ) );
|
|
243 |
CleanupStack::PushL( implementation );
|
|
244 |
if ( implementation )
|
|
245 |
{
|
|
246 |
implementation->SetStatusQueryObject( this );
|
|
247 |
iPluginArray->AppendL( implementation );
|
|
248 |
|
|
249 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::LoadPluginsL() plugin loaded succesfully: 0x%x", id);
|
|
250 |
}
|
|
251 |
else
|
|
252 |
{
|
|
253 |
// Just write to debug log, that all the plugins could not be loaded.
|
|
254 |
// Perhaps there should be some nice way to acknoledge the user or the system!
|
|
255 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::LoadPluginsL() plugin load failed: 0x%x", id);
|
|
256 |
}
|
|
257 |
CleanupStack::Pop( implementation );
|
|
258 |
}
|
|
259 |
}//for
|
|
260 |
|
|
261 |
//plugins should be loaded
|
|
262 |
iPluginsLoaded = ETrue;
|
|
263 |
|
|
264 |
}//if
|
|
265 |
else
|
|
266 |
{
|
|
267 |
KAOMANAGER_LOGGER_WRITE("CAlwaysOnlineManager::LoadPluginsL() NO PLUGINS FOUND!");
|
|
268 |
//no plugins. This shouldn't be, there's something wrong with build.
|
|
269 |
//if plugins are not in build, server shouldn't be either!
|
|
270 |
}
|
|
271 |
CleanupStack::PopAndDestroy(); // arrayCleanup
|
|
272 |
}
|
|
273 |
|
|
274 |
// ----------------------------------------------------------------------------
|
|
275 |
// StartPluginsL()
|
|
276 |
// ----------------------------------------------------------------------------
|
|
277 |
//
|
|
278 |
void CAlwaysOnlineManager::StartPluginsL()
|
|
279 |
{
|
|
280 |
TInt count = iPluginArray->Count();
|
|
281 |
|
|
282 |
TBuf8<1> dummyParam;
|
|
283 |
for ( TInt i = 0; i < count; i++ )
|
|
284 |
{
|
|
285 |
InvokeCommandHandlerL( EAOManagerPluginStart, dummyParam, i );
|
|
286 |
}
|
|
287 |
KAOMANAGER_LOGGER_WRITE("CAlwaysOnlineManager::StartPluginsL() All plugins ordered to start");
|
|
288 |
}
|
|
289 |
|
|
290 |
// ----------------------------------------------------------------------------
|
|
291 |
// QuerySuicideL()
|
|
292 |
// ----------------------------------------------------------------------------
|
|
293 |
//
|
|
294 |
void CAlwaysOnlineManager::QuerySuicideL()
|
|
295 |
{
|
|
296 |
TInt count = iPluginArray->Count();
|
|
297 |
|
|
298 |
TBuf8<1> dummyParam;
|
|
299 |
for ( TInt i = 0; i < count; i++ )
|
|
300 |
{
|
|
301 |
InvokeCommandHandlerL( EAOManagerSuicideQuery, dummyParam, i );
|
|
302 |
}
|
|
303 |
KAOMANAGER_LOGGER_WRITE("CAlwaysOnlineManager::QuerySuicideL() Suicide query made for all plugins");
|
|
304 |
}
|
|
305 |
|
|
306 |
// ----------------------------------------------------------------------------
|
|
307 |
// QueryStatusL()
|
|
308 |
// ----------------------------------------------------------------------------
|
|
309 |
//
|
|
310 |
TAny* CAlwaysOnlineManager::QueryStatusL( TInt aQuery )
|
|
311 |
{
|
|
312 |
KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::QueryStatusL()");
|
|
313 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::QueryStatusL() Query received: %d", aQuery);
|
|
314 |
|
|
315 |
switch( aQuery )
|
|
316 |
{
|
|
317 |
case EAOManagerStatusQueryRoaming:
|
|
318 |
return reinterpret_cast<TAny*>(
|
|
319 |
iNetworkStatus == ENetworkRegistrationRoaming );
|
|
320 |
|
|
321 |
case EAOManagerStatusQueryOffline:
|
|
322 |
return reinterpret_cast<TAny*>( iOffline );
|
|
323 |
|
|
324 |
case EAOManagerStatusQueryNetwork:
|
|
325 |
return reinterpret_cast<TAny*>( iNetworkStatus );
|
|
326 |
|
|
327 |
default:
|
|
328 |
return reinterpret_cast<TAny*>( KErrNotSupported );//unknown query
|
|
329 |
|
|
330 |
}
|
|
331 |
}
|
|
332 |
|
|
333 |
// ----------------------------------------------------------------------------
|
|
334 |
// HandleOfflineEventL()
|
|
335 |
// ----------------------------------------------------------------------------
|
|
336 |
//
|
|
337 |
void CAlwaysOnlineManager::HandleOfflineEventL( TInt aEvent)
|
|
338 |
{
|
|
339 |
KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::HandleOfflineEventL()");
|
|
340 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandeOfflineEventL() aEvent: %d", aEvent);
|
|
341 |
TInt count = iPluginArray->Count();
|
|
342 |
|
|
343 |
TInt command = KErrNotFound;
|
|
344 |
|
|
345 |
if( aEvent == KNWOperationsAllowed )
|
|
346 |
{
|
|
347 |
command = EAOManagerNWOpsAllowed;
|
|
348 |
iOffline = EFalse;
|
|
349 |
}
|
|
350 |
else
|
|
351 |
{
|
|
352 |
command = EAOManagerNWOpsNotAllowed;
|
|
353 |
iOffline = ETrue;
|
|
354 |
}
|
|
355 |
|
|
356 |
TBuf8<1> dummyParam;
|
|
357 |
for( TInt i = 0; i<count; i++ )
|
|
358 |
{
|
|
359 |
InvokeCommandHandlerL(
|
|
360 |
static_cast<TManagerServerCommands>(command), dummyParam, i );
|
|
361 |
}
|
|
362 |
KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::HandleOfflineEventL()");
|
|
363 |
}
|
|
364 |
|
|
365 |
// ----------------------------------------------------------------------------
|
|
366 |
// CheckNetworkStatusAndSetObserverL()
|
|
367 |
// ----------------------------------------------------------------------------
|
|
368 |
//
|
|
369 |
void CAlwaysOnlineManager::CheckNetworkStatusAndSetObserverL()
|
|
370 |
{
|
|
371 |
KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::CheckNetworkStatusAndSetObserverL()");
|
|
372 |
TRequestStatus status;
|
|
373 |
TInt registrationStatus( 0 );
|
|
374 |
|
|
375 |
//check network status
|
|
376 |
iConMon.GetIntAttribute(
|
|
377 |
EBearerIdGSM, 0, KNetworkRegistration,
|
|
378 |
registrationStatus, status );
|
|
379 |
|
|
380 |
User::WaitForRequest( status ); // CSI: 94 # This is server side context
|
|
381 |
|
|
382 |
if ( status.Int() == KErrNone )
|
|
383 |
{
|
|
384 |
HandleRegistrationStatusL( registrationStatus );
|
|
385 |
}
|
|
386 |
|
|
387 |
//sets this as an observer for networkstatus
|
|
388 |
iConMon.NotifyEventL(*this);
|
|
389 |
|
|
390 |
KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::CheckNetworkStatusAndSetObserverL()");
|
|
391 |
}
|
|
392 |
|
|
393 |
// ----------------------------------------------------------------------------
|
|
394 |
// EventL()
|
|
395 |
// ----------------------------------------------------------------------------
|
|
396 |
//
|
|
397 |
void CAlwaysOnlineManager::EventL( const CConnMonEventBase &aConnMonEvent )
|
|
398 |
{
|
|
399 |
switch ( aConnMonEvent.EventType() )
|
|
400 |
{
|
|
401 |
case EConnMonNetworkRegistrationChange:
|
|
402 |
{
|
|
403 |
CConnMonNetworkRegistrationChange* eventNetworkRegChange;
|
|
404 |
eventNetworkRegChange = ( CConnMonNetworkRegistrationChange* ) &aConnMonEvent;
|
|
405 |
|
|
406 |
TInt regStatus = eventNetworkRegChange->RegistrationStatus();
|
|
407 |
|
|
408 |
HandleRegistrationStatusL( regStatus );
|
|
409 |
|
|
410 |
}
|
|
411 |
break;
|
|
412 |
default:
|
|
413 |
break;
|
|
414 |
};
|
|
415 |
|
|
416 |
}
|
|
417 |
|
|
418 |
// ----------------------------------------------------------------------------
|
|
419 |
// HandleRegistrationStatusL()
|
|
420 |
// ----------------------------------------------------------------------------
|
|
421 |
//
|
|
422 |
void CAlwaysOnlineManager::HandleRegistrationStatusL( TInt aStatus )
|
|
423 |
{
|
|
424 |
KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::HandleRegistrationStatusL()");
|
|
425 |
TInt command;
|
|
426 |
|
|
427 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleRegistrationStatusL Reporting Network Status to plugins. aStatus: %d", aStatus );
|
|
428 |
iNetworkStatus = aStatus;
|
|
429 |
|
|
430 |
if ( aStatus == ENetworkRegistrationHomeNetwork )
|
|
431 |
{
|
|
432 |
command = EAOManagerStoppedRoaming;
|
|
433 |
}
|
|
434 |
else if ( aStatus == ENetworkRegistrationRoaming )
|
|
435 |
{
|
|
436 |
command = EAOManagerStartedRoaming;
|
|
437 |
}
|
|
438 |
else
|
|
439 |
{
|
|
440 |
// lets tell plugins we are offline while we don't know network status so that they
|
|
441 |
// won't try any connections...
|
|
442 |
KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::HandleRegistrationStatusL() 2");
|
|
443 |
return; //we don't care about other network states than these two
|
|
444 |
}
|
|
445 |
|
|
446 |
TInt count = iPluginArray->Count();
|
|
447 |
|
|
448 |
//send changed status to all plugins
|
|
449 |
TBuf8<1> dummyParam;
|
|
450 |
for ( TInt i = 0; i<count; i++ )
|
|
451 |
{
|
|
452 |
InvokeCommandHandlerL(
|
|
453 |
static_cast<TManagerServerCommands>(command), dummyParam, i );
|
|
454 |
}
|
|
455 |
KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::HandleRegistrationStatusL()");
|
|
456 |
}
|
|
457 |
|
|
458 |
// ----------------------------------------------------------------------------
|
|
459 |
// InvokeCommandHandlerL
|
|
460 |
// ----------------------------------------------------------------------------
|
|
461 |
//
|
|
462 |
void CAlwaysOnlineManager::InvokeCommandHandlerL(
|
|
463 |
const TManagerServerCommands aCommand,
|
|
464 |
TDes8& aParameter,
|
|
465 |
TInt aIndex )
|
|
466 |
{
|
|
467 |
KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::InvokeCommandHandlerL()");
|
|
468 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::InvokeCommandHandlerL() CommandHandler invoked for TManagerServerCommand: %d", aCommand);
|
|
469 |
CMsvSingleOpWatcher* watcher = CMsvSingleOpWatcher::NewL(*this);
|
|
470 |
CleanupStack::PushL( watcher );
|
|
471 |
|
|
472 |
if ( !iSession )
|
|
473 |
{
|
|
474 |
KAOMANAGER_LOGGER_WRITE("CAlwaysOnlineManager::InvokeCommandHandlerL() iSession is NULL");
|
|
475 |
iSession = CMsvSession::OpenSyncL(*this);
|
|
476 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::InvokeCommandHandlerL() iSession created to 0x%x", iSession );
|
|
477 |
}
|
|
478 |
|
|
479 |
CAOServerCommandHandler* op = CAOServerCommandHandler::NewL(
|
|
480 |
*iSession,
|
|
481 |
watcher->iStatus,
|
|
482 |
aCommand,
|
|
483 |
aParameter,
|
|
484 |
*iPluginArray->At(aIndex) );
|
|
485 |
CleanupStack::PushL( op );
|
|
486 |
iOperations->AppendL( watcher );
|
|
487 |
watcher->SetOperation( op ); // takes immediately ownership
|
|
488 |
|
|
489 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::InvokeCommandHandlerL() Async command invoked. Operation ID: %d ",op->Id() );
|
|
490 |
|
|
491 |
CleanupStack::Pop( 2, watcher ); // CSI: 47,12 # op, watcher
|
|
492 |
KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::InvokeCommandHandlerL()");
|
|
493 |
}
|
|
494 |
|
|
495 |
// ----------------------------------------------------------------------------
|
|
496 |
// HandleDiskSpaceEventL()
|
|
497 |
// ----------------------------------------------------------------------------
|
|
498 |
//
|
|
499 |
void CAlwaysOnlineManager::HandleDiskSpaceEventL( TInt aEvent )
|
|
500 |
{
|
|
501 |
KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::HandleDiskSpaceEventL()");
|
|
502 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleDiskSpaceEventL() Got DiskSpace event: %d, Forwarding to plugins", aEvent );
|
|
503 |
|
|
504 |
// Make sure there actually is a reason to send the event
|
|
505 |
if ( aEvent == iLastDiskEvent )
|
|
506 |
{
|
|
507 |
return;
|
|
508 |
}
|
|
509 |
|
|
510 |
iLastDiskEvent = aEvent;
|
|
511 |
|
|
512 |
TInt count = iPluginArray->Count();
|
|
513 |
|
|
514 |
//send event to all plugins
|
|
515 |
TBuf8<1> dummyParam;
|
|
516 |
for( TInt i = 0; i<count; i++ )
|
|
517 |
{
|
|
518 |
InvokeCommandHandlerL(
|
|
519 |
static_cast<TManagerServerCommands>(aEvent), dummyParam, i );
|
|
520 |
}
|
|
521 |
KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::HandleDiskSpaceEventL()");
|
|
522 |
}
|
|
523 |
|
|
524 |
|
|
525 |
// ----------------------------------------------------------------------------
|
|
526 |
// CAlwaysOnlineManager::HandleSessionEventL
|
|
527 |
// ----------------------------------------------------------------------------
|
|
528 |
//
|
|
529 |
void CAlwaysOnlineManager::HandleSessionEventL(
|
|
530 |
TMsvSessionEvent aEvent,
|
|
531 |
TAny* /*aArg1*/,
|
|
532 |
TAny* /*aArg2*/,
|
|
533 |
TAny* /*aArg3*/)
|
|
534 |
{
|
|
535 |
KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::HandleSessionEventL");
|
|
536 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleSessionEventL() aEvent %d", aEvent);
|
|
537 |
switch( aEvent )
|
|
538 |
{
|
|
539 |
case EMsvMediaUnavailable:
|
|
540 |
//delete diskspace observer
|
|
541 |
if( iDiskSpaceObserver )
|
|
542 |
{
|
|
543 |
iDiskSpaceObserver->Cancel();
|
|
544 |
delete iDiskSpaceObserver;
|
|
545 |
iDiskSpaceObserver = NULL;
|
|
546 |
}
|
|
547 |
break;
|
|
548 |
case EMsvMediaAvailable:
|
|
549 |
//restart diskspace observer
|
|
550 |
if( !iDiskSpaceObserver )
|
|
551 |
{
|
|
552 |
iDiskSpaceObserver =
|
|
553 |
CAlwaysOnlineDiskSpaceObserver::NewL( this, *iSession );
|
|
554 |
iDiskSpaceObserver->SetLimitAndActivateL();
|
|
555 |
}
|
|
556 |
break;
|
|
557 |
case EMsvMediaChanged:
|
|
558 |
//if media changed, old observer is obsolete, delete and restart.
|
|
559 |
if( iDiskSpaceObserver )
|
|
560 |
{
|
|
561 |
iDiskSpaceObserver->Cancel();
|
|
562 |
delete iDiskSpaceObserver;
|
|
563 |
iDiskSpaceObserver = NULL;
|
|
564 |
|
|
565 |
iDiskSpaceObserver =
|
|
566 |
CAlwaysOnlineDiskSpaceObserver::NewL( this, *iSession );
|
|
567 |
iDiskSpaceObserver->SetLimitAndActivateL();
|
|
568 |
}
|
|
569 |
break;
|
|
570 |
|
|
571 |
case EMsvCloseSession:
|
|
572 |
case EMsvServerTerminated:
|
|
573 |
iOperations->ResetAndDestroy();
|
|
574 |
delete iSession;
|
|
575 |
iSession = NULL;
|
|
576 |
break;
|
|
577 |
|
|
578 |
|
|
579 |
default:
|
|
580 |
break;
|
|
581 |
}
|
|
582 |
|
|
583 |
KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::HandleSessionEventL");
|
|
584 |
}
|
|
585 |
|
|
586 |
// ----------------------------------------------------------------------------
|
|
587 |
// CAlwaysOnlineManager::BroadcastClientCommandL
|
|
588 |
// ----------------------------------------------------------------------------
|
|
589 |
//
|
|
590 |
void CAlwaysOnlineManager::BroadcastClientCommandL(
|
|
591 |
TAlwaysOnlineServerAPICommands aCommand,
|
|
592 |
TDes8& aParameter )
|
|
593 |
{
|
|
594 |
KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::BroadcastClientCommandL()");
|
|
595 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::BroadcastClientCommandL() aCommand: %d", aCommand);
|
|
596 |
// Translate TAlwaysOnlineServerAPICommands to TManagerServerCommands
|
|
597 |
TManagerServerCommands command = (TManagerServerCommands)KErrNotFound;
|
|
598 |
TBool invoke = ETrue;
|
|
599 |
|
|
600 |
switch( aCommand )
|
|
601 |
{
|
|
602 |
|
|
603 |
// Start a plugin
|
|
604 |
case EServerAPIBaseCommandStart:
|
|
605 |
HandleStartPluginL( aParameter );
|
|
606 |
command = EAOManagerPluginStart;
|
|
607 |
invoke = EFalse;
|
|
608 |
break;
|
|
609 |
|
|
610 |
// Stop a plugin
|
|
611 |
case EServerAPIBaseCommandStop:
|
|
612 |
HandleStopPluginL( aParameter );
|
|
613 |
command = EAOManagerPluginStop;
|
|
614 |
invoke = EFalse;
|
|
615 |
break;
|
|
616 |
|
|
617 |
case EServerAPIBaseCommandAoSchedulerError:
|
|
618 |
KAOMANAGER_LOGGER_WRITE("CAlwaysOnlineManager::BroadcastClientCommandL() AOScheduler ERROR!" );
|
|
619 |
command = EAOManagerAOSchdulerError;
|
|
620 |
break;
|
|
621 |
|
|
622 |
// Suspend email agent
|
|
623 |
case EServerAPIEmailTurnOff:
|
|
624 |
command = EAOManagerMailboxAgentSuspend;
|
|
625 |
break;
|
|
626 |
|
|
627 |
// Turn the email agent back on
|
|
628 |
case EServerAPIEmailTurnOn:
|
|
629 |
command = EAOManagerMailboxAgentResume;
|
|
630 |
break;
|
|
631 |
|
|
632 |
case EServerAPIBaseAllowNWOperations:
|
|
633 |
invoke = EFalse;
|
|
634 |
break;
|
|
635 |
case EServerAPIBaseSuspendNWOperations:
|
|
636 |
invoke = EFalse;
|
|
637 |
break;
|
|
638 |
// Remove the agent completely
|
|
639 |
case EServerAPIEmailAgentRemove:
|
|
640 |
command = EAOManagerMailboxAgentRemove;
|
|
641 |
break;
|
|
642 |
|
|
643 |
// Handle the OMA Email Notification
|
|
644 |
case EServerAPIEmailEMNReceived:
|
|
645 |
command = EAOManagerEMNReceived;
|
|
646 |
break;
|
|
647 |
|
|
648 |
// Start temporary agent for manual IMAP4 connection
|
|
649 |
case EServerAPIEmailUpdateMailWhileConnected:
|
|
650 |
command = EAOManagerMailboxAgentUpdateMailWhileConnected;
|
|
651 |
break;
|
|
652 |
case EServerAPIEmailQueryState:
|
|
653 |
command = EAOManagerQueryState;
|
|
654 |
invoke = EFalse;
|
|
655 |
BroadcastCommandDirectL( command, aParameter );
|
|
656 |
break;
|
|
657 |
case EServerAPIEmailCancelAllAndDisconnect:
|
|
658 |
command = EAOManagerCancelAllAndDisconnect;
|
|
659 |
break;
|
|
660 |
case EServerAPIEmailCancelAllAndDoNotDisconnect:
|
|
661 |
command = EAOManagerCancelAllAndDoNotDisconnect;
|
|
662 |
break;
|
|
663 |
case EServerAPIEmailSuspend:
|
|
664 |
command = EAOManagerSuspend;
|
|
665 |
break;
|
|
666 |
case EServerAPIEmailContinue:
|
|
667 |
command = EAOManagerContinue;
|
|
668 |
break;
|
|
669 |
case EServerAPIEmailDoNotDisconnect:
|
|
670 |
command = EAOManagerDoNotDisconnect;
|
|
671 |
break;
|
|
672 |
case EServerAPIEmailSessionClosed:
|
|
673 |
command = EAOManagerSessionClosed;
|
|
674 |
invoke = EFalse;
|
|
675 |
BroadcastCommandDirectL( command, aParameter );
|
|
676 |
break;
|
|
677 |
case EServerAPIEmailDisableAOEmailPlugin:
|
|
678 |
// Remove UID from plugin array and delete the instance
|
|
679 |
// of the email plugin
|
|
680 |
iCenRepControl->SetPluginStatus( KAOEmailPluginUid, ETrue );
|
|
681 |
for( TInt i = 0; i < iPluginArray->Count(); i++ )
|
|
682 |
{
|
|
683 |
if( KAOEmailPluginUid == iPluginArray->At(i)->InstanceUid() )
|
|
684 |
{
|
|
685 |
delete iPluginArray->At( i );
|
|
686 |
// Delete element
|
|
687 |
iPluginArray->Delete( i );
|
|
688 |
}
|
|
689 |
}
|
|
690 |
break;
|
|
691 |
case EServerAPIEmailEnableAOEmailPlugin:
|
|
692 |
iCenRepControl->SetPluginStatus( KAOEmailPluginUid, EFalse );
|
|
693 |
break;
|
|
694 |
|
|
695 |
// Ignore unrecognized command
|
|
696 |
default:
|
|
697 |
invoke = EFalse;
|
|
698 |
};
|
|
699 |
|
|
700 |
// EServerAPIBaseCommandStart and EServerAPIBaseCommandStop is only
|
|
701 |
// sent to one plugin and at this point, it is already handled in
|
|
702 |
// their own cases.
|
|
703 |
if ( invoke )
|
|
704 |
{
|
|
705 |
TInt count = iPluginArray->Count();
|
|
706 |
|
|
707 |
// Send event to all plugins
|
|
708 |
for( TInt i = 0; i<count; i++ )
|
|
709 |
{
|
|
710 |
InvokeCommandHandlerL(
|
|
711 |
static_cast<TManagerServerCommands>(command), aParameter, i );
|
|
712 |
}
|
|
713 |
}
|
|
714 |
KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::BroadcastClientCommandL()");
|
|
715 |
}
|
|
716 |
|
|
717 |
// ----------------------------------------------------------------------------
|
|
718 |
// ----------------------------------------------------------------------------
|
|
719 |
//
|
|
720 |
void CAlwaysOnlineManager::BroadcastCommandDirectL(
|
|
721 |
TManagerServerCommands aCommand,
|
|
722 |
TDes8& aParameter )
|
|
723 |
{
|
|
724 |
TInt count = iPluginArray->Count();
|
|
725 |
TInt ret = KErrNone;
|
|
726 |
// Send event to all plugins
|
|
727 |
for( TInt i = 0; i<count; i++ )
|
|
728 |
{
|
|
729 |
CAlwaysOnlineEComInterface* plugin = iPluginArray->At(i);
|
|
730 |
TAny* result = plugin->HandleServerCommandL( aCommand, &aParameter );
|
|
731 |
ret = reinterpret_cast<TInt>(result);
|
|
732 |
}
|
|
733 |
|
|
734 |
if ( ret != KErrNone )
|
|
735 |
{
|
|
736 |
User::Leave( ret );
|
|
737 |
}
|
|
738 |
|
|
739 |
}
|
|
740 |
|
|
741 |
// ----------------------------------------------------------------------------
|
|
742 |
// CAlwaysOnlineManager::OpCompleted
|
|
743 |
// ----------------------------------------------------------------------------
|
|
744 |
//
|
|
745 |
void CAlwaysOnlineManager::OpCompleted(
|
|
746 |
CMsvSingleOpWatcher& aOpWatcher,
|
|
747 |
TInt /*aCompletionCode*/ )
|
|
748 |
{
|
|
749 |
TMsvOp opId = aOpWatcher.Operation().Id();
|
|
750 |
const TInt count = iOperations->Count();
|
|
751 |
|
|
752 |
for ( TInt i=0; i < count; i++ )
|
|
753 |
{
|
|
754 |
CMsvOperation& op = (*iOperations)[i]->Operation();
|
|
755 |
|
|
756 |
if ( op.Id() == opId )
|
|
757 |
{
|
|
758 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::OpCompleted() Async operation %d completed ", opId );
|
|
759 |
CMsvSingleOpWatcher* operation = (*iOperations)[i];
|
|
760 |
|
|
761 |
// Attempt to handle operation
|
|
762 |
TRAPD( err, HandleOpCompletionL( op.FinalProgress() ) );
|
|
763 |
if ( err != KErrNone )
|
|
764 |
{
|
|
765 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::OpCompleted() failed err:%d", err );
|
|
766 |
}
|
|
767 |
|
|
768 |
delete operation;
|
|
769 |
iOperations->Delete(i);
|
|
770 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::OpCompleted() Operations remaining: %d ", iOperations->Count() );
|
|
771 |
break;
|
|
772 |
}
|
|
773 |
}
|
|
774 |
}
|
|
775 |
|
|
776 |
// ----------------------------------------------------------------------------
|
|
777 |
// CAlwaysOnlineManager::HandleOpCompletionL
|
|
778 |
// ----------------------------------------------------------------------------
|
|
779 |
//
|
|
780 |
void CAlwaysOnlineManager::HandleOpCompletionL( const TDesC8& aProgress )
|
|
781 |
{
|
|
782 |
KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::HandleOpCompletionL");
|
|
783 |
|
|
784 |
TUid id;
|
|
785 |
TInt command;
|
|
786 |
TBuf8<KAOFinalProgressLength> result;
|
|
787 |
|
|
788 |
if ( ParseProgressL( aProgress, id, command, result ) )
|
|
789 |
{
|
|
790 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleOpCompletionL() : plugin: 0x%x", id);
|
|
791 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleOpCompletionL() : command: %d", command);
|
|
792 |
KAOMANAGER_LOGGER_WRITE_FORMAT8("CAlwaysOnlineManager::HandleOpCompletionL() : result: %S", &result);
|
|
793 |
|
|
794 |
switch ( static_cast<TManagerServerCommands>( command ) )
|
|
795 |
{
|
|
796 |
case EAOManagerSuicideQuery:
|
|
797 |
if ( result.Match( KStopPlugin ) > KErrNotFound )
|
|
798 |
{
|
|
799 |
StopPluginL( id );
|
|
800 |
}
|
|
801 |
break;
|
|
802 |
case EAOManagerPluginStop:
|
|
803 |
DisablePlugin( id );
|
|
804 |
break;
|
|
805 |
default:
|
|
806 |
// Currently, there is no other commands for plugins, which
|
|
807 |
// returns something useful to server.
|
|
808 |
break;
|
|
809 |
}
|
|
810 |
}
|
|
811 |
KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::HandleOpCompletionL");
|
|
812 |
}
|
|
813 |
|
|
814 |
// ----------------------------------------------------------------------------
|
|
815 |
// CAlwaysOnlineManager::ParseProgressL
|
|
816 |
// ----------------------------------------------------------------------------
|
|
817 |
//
|
|
818 |
TBool CAlwaysOnlineManager::ParseProgressL(
|
|
819 |
const TDesC8& aProgress,
|
|
820 |
TUid& aUid,
|
|
821 |
TInt& aCommand,
|
|
822 |
TDes8& aResult )
|
|
823 |
{
|
|
824 |
KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::ParseProgressL");
|
|
825 |
TBool parseOk = EFalse;
|
|
826 |
|
|
827 |
// Parse final progress, received from CAOServerCommandHandler::FinalProgress()
|
|
828 |
CAOCommandParser* parser = NULL;
|
|
829 |
TRAPD( err, parser = CAOCommandParser::NewL( aProgress ) );
|
|
830 |
|
|
831 |
if ( err == KErrNone )
|
|
832 |
{
|
|
833 |
CleanupStack::PushL( parser );
|
|
834 |
|
|
835 |
TInt error = parser->Parse();
|
|
836 |
|
|
837 |
__ASSERT_DEBUG( error != KErrNotFound, User::Panic( KAOManagerParsePanic, error ) );
|
|
838 |
|
|
839 |
if ( error != KErrNotFound )
|
|
840 |
{
|
|
841 |
aUid = parser->Uid();
|
|
842 |
aCommand = parser->Command();
|
|
843 |
aResult = parser->Result().Left( aResult.MaxLength() );
|
|
844 |
parseOk = ETrue;
|
|
845 |
}
|
|
846 |
|
|
847 |
CleanupStack::PopAndDestroy( parser );
|
|
848 |
}
|
|
849 |
|
|
850 |
KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::ParseProgressL");
|
|
851 |
|
|
852 |
return parseOk;
|
|
853 |
}
|
|
854 |
|
|
855 |
// ----------------------------------------------------------------------------
|
|
856 |
// CAlwaysOnlineManager::HandleStartPluginL
|
|
857 |
// ----------------------------------------------------------------------------
|
|
858 |
//
|
|
859 |
void CAlwaysOnlineManager::HandleStartPluginL( const TDes8& aParameter )
|
|
860 |
{
|
|
861 |
KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::HandleStartPluginL");
|
|
862 |
|
|
863 |
TPckgBuf<TUid> paramPack;
|
|
864 |
TUid pluginId;
|
|
865 |
TInt error = KErrNone;
|
|
866 |
|
|
867 |
// Make sure that the parameter length matches Id length
|
|
868 |
if ( aParameter.Length() == sizeof( TUid ) )
|
|
869 |
{
|
|
870 |
paramPack.Copy( aParameter );
|
|
871 |
|
|
872 |
// Get the mailbox id from the packet
|
|
873 |
pluginId = paramPack();
|
|
874 |
error = KErrNone;
|
|
875 |
}
|
|
876 |
else
|
|
877 |
{
|
|
878 |
error = KErrNotFound;
|
|
879 |
}
|
|
880 |
|
|
881 |
// Check if plugin already loaded.
|
|
882 |
for ( TInt i = 0; i < iPluginArray->Count(); i++ )
|
|
883 |
{
|
|
884 |
if ( pluginId == iPluginArray->At( i )->InstanceUid() )
|
|
885 |
{
|
|
886 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleStartPluginL() plugin already loaded: 0x%x", pluginId);
|
|
887 |
// No need to load a plugin again.
|
|
888 |
error = KErrAlreadyExists;
|
|
889 |
break;
|
|
890 |
}
|
|
891 |
}
|
|
892 |
|
|
893 |
// Load the plugin and call start for it.
|
|
894 |
CAlwaysOnlineEComInterface* implementation = NULL;
|
|
895 |
|
|
896 |
if ( error == KErrNone )
|
|
897 |
{
|
|
898 |
TRAPD( err, implementation =
|
|
899 |
CAlwaysOnlineEComInterface::NewL( pluginId ) );
|
|
900 |
|
|
901 |
if ( err == KErrNone )
|
|
902 |
{
|
|
903 |
implementation->SetStatusQueryObject( this );
|
|
904 |
iPluginArray->AppendL( implementation );
|
|
905 |
|
|
906 |
// Set the loaded plugin to be enabled (== delete UID from cenrep).
|
|
907 |
iCenRepControl->SetPluginStatus( pluginId, EFalse );
|
|
908 |
|
|
909 |
// Refresh the list of disabled plugins UIDs.
|
|
910 |
iCenRepControl->UpdateDisabledPluginsUids(
|
|
911 |
*iDisabledPluginUidsArray );
|
|
912 |
|
|
913 |
TBuf8<1> dummyParam;
|
|
914 |
// AppendL puts object to the end of the array,
|
|
915 |
// so we can start the last plugin
|
|
916 |
TInt idx = iPluginArray->Count() - 1;
|
|
917 |
InvokeCommandHandlerL( EAOManagerPluginStart, dummyParam, idx );
|
|
918 |
|
|
919 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleStartPluginL() plugin loaded succesfully: 0x%x", pluginId);
|
|
920 |
}
|
|
921 |
else
|
|
922 |
{
|
|
923 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleStartPluginL() plugin load failed: 0x%x", pluginId);
|
|
924 |
}
|
|
925 |
}
|
|
926 |
KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::HandleStartPluginL");
|
|
927 |
}
|
|
928 |
|
|
929 |
// ----------------------------------------------------------------------------
|
|
930 |
// CAlwaysOnlineManager::HandleStopPluginL
|
|
931 |
// ----------------------------------------------------------------------------
|
|
932 |
//
|
|
933 |
void CAlwaysOnlineManager::HandleStopPluginL( const TDes8& aParameter )
|
|
934 |
{
|
|
935 |
KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::HandleStopPluginL");
|
|
936 |
|
|
937 |
TPckgBuf<TUid> paramPack;
|
|
938 |
TUid pluginId;
|
|
939 |
|
|
940 |
// Make sure that the parameter length matches Id length
|
|
941 |
if ( aParameter.Length() == sizeof( TUid ) )
|
|
942 |
{
|
|
943 |
paramPack.Copy( aParameter );
|
|
944 |
|
|
945 |
// Get the mailbox id from the packet
|
|
946 |
pluginId = paramPack();
|
|
947 |
StopPluginL( pluginId );
|
|
948 |
}
|
|
949 |
|
|
950 |
KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::HandleStopPluginL");
|
|
951 |
}
|
|
952 |
|
|
953 |
// ----------------------------------------------------------------------------
|
|
954 |
// CAlwaysOnlineManager::StopPluginL
|
|
955 |
// ----------------------------------------------------------------------------
|
|
956 |
//
|
|
957 |
void CAlwaysOnlineManager::StopPluginL(
|
|
958 |
const TUid& aPlugin )
|
|
959 |
{
|
|
960 |
KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::StopPluginL");
|
|
961 |
|
|
962 |
// Find the plugin and send stop command.
|
|
963 |
if ( iPluginArray->Count() )
|
|
964 |
{
|
|
965 |
// Get correct plugin from
|
|
966 |
for ( TInt i = 0; i < iPluginArray->Count(); i++ )
|
|
967 |
{
|
|
968 |
TUid id = ( iPluginArray->At( i ) )->InstanceUid();
|
|
969 |
|
|
970 |
// Is it this plugin?
|
|
971 |
if ( id == aPlugin )
|
|
972 |
{
|
|
973 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::StopPluginL() Calling stop to plugin: 0x%x", aPlugin);
|
|
974 |
TBuf8<1> dummyParam;
|
|
975 |
InvokeCommandHandlerL(
|
|
976 |
static_cast<TManagerServerCommands>( EAOManagerPluginStop ),
|
|
977 |
dummyParam,
|
|
978 |
i );
|
|
979 |
}
|
|
980 |
}
|
|
981 |
}
|
|
982 |
|
|
983 |
KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::StopPluginL");
|
|
984 |
}
|
|
985 |
|
|
986 |
// ----------------------------------------------------------------------------
|
|
987 |
// CAlwaysOnlineManager::DisablePlugin
|
|
988 |
// ----------------------------------------------------------------------------
|
|
989 |
//
|
|
990 |
void CAlwaysOnlineManager::DisablePlugin( const TUid& aPlugin )
|
|
991 |
{
|
|
992 |
KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::DisablePlugin");
|
|
993 |
|
|
994 |
// Delete the plugin and mark it disabled.
|
|
995 |
if ( iPluginArray->Count() )
|
|
996 |
{
|
|
997 |
// Get correct plugin from
|
|
998 |
for ( TInt i = 0; i < iPluginArray->Count(); i++ )
|
|
999 |
{
|
|
1000 |
TUid id = ( iPluginArray->At( i ) )->InstanceUid();
|
|
1001 |
|
|
1002 |
// Is it this plugin?
|
|
1003 |
if ( id == aPlugin )
|
|
1004 |
{
|
|
1005 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::DisablePlugin() Deleting plugin from array: 0x%x", aPlugin);
|
|
1006 |
// Delete object
|
|
1007 |
delete iPluginArray->At( i );
|
|
1008 |
// Delete element
|
|
1009 |
iPluginArray->Delete( i );
|
|
1010 |
}
|
|
1011 |
}
|
|
1012 |
// Set this plugin as disabled.
|
|
1013 |
iCenRepControl->SetPluginStatus( aPlugin, ETrue );
|
|
1014 |
|
|
1015 |
// Refresh the list of disabled plugins UIDs.
|
|
1016 |
iCenRepControl->UpdateDisabledPluginsUids(
|
|
1017 |
*iDisabledPluginUidsArray );
|
|
1018 |
}
|
|
1019 |
|
|
1020 |
KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::DisablePlugin");
|
|
1021 |
}
|
|
1022 |
|
|
1023 |
// ----------------------------------------------------------------------------
|
|
1024 |
// CAlwaysOnlineManager::HandleNotifyInt
|
|
1025 |
// ----------------------------------------------------------------------------
|
|
1026 |
//
|
|
1027 |
void CAlwaysOnlineManager::HandleNotifyInt(
|
|
1028 |
TUint32 /* aId */,
|
|
1029 |
TInt aNewValue )
|
|
1030 |
{
|
|
1031 |
TRAPD( err, HandleOfflineEventL( aNewValue ) );
|
|
1032 |
if( err != KErrNone )
|
|
1033 |
{
|
|
1034 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleNotifyInt() failed err:%d", err );
|
|
1035 |
}
|
|
1036 |
}
|
|
1037 |
|
|
1038 |
// ----------------------------------------------------------------------------
|
|
1039 |
// CAlwaysOnlineManager::HandleNotifyError
|
|
1040 |
// ----------------------------------------------------------------------------
|
|
1041 |
//
|
|
1042 |
void CAlwaysOnlineManager::HandleNotifyError(
|
|
1043 |
TUint32 /* aId */,
|
|
1044 |
TInt /* aError */,
|
|
1045 |
CCenRepNotifyHandler* /* aHandler */ )
|
|
1046 |
{
|
|
1047 |
TRAPD( err, iCenRepControl->ReCreateCoreAppUiCenRepSessionL() );
|
|
1048 |
if( err != KErrNone )
|
|
1049 |
{
|
|
1050 |
KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleNotifyError() failed err:%d", err );
|
|
1051 |
}
|
|
1052 |
}
|
|
1053 |
|
|
1054 |
//EOF
|