1 /* |
|
2 * Copyright (c) 2002-2010 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: Contains SAT commands. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <f32file.h> |
|
21 #include <barsc.h> |
|
22 #include <bautils.h> |
|
23 #include <SatServer.rsg> |
|
24 #include <ecom.h> |
|
25 #include <e32property.h> |
|
26 #include <data_caging_path_literals.hrh> |
|
27 #include <startupdomainpskeys.h> |
|
28 #include <satdomainpskeys.h> |
|
29 |
|
30 #include "MSatSystemState.h" |
|
31 #include "TSatSystemStateFactory.h" |
|
32 #include "MSatSystemStateChangeNotifier.h" |
|
33 #include "CSatCommandContainer.h" |
|
34 //lint -e766 Used inside TRAP macro, lint misfunction. |
|
35 #include "EnginePanic.h" |
|
36 #include "TUSatAPI.h" |
|
37 #include "MSatSSessions.h" |
|
38 #include "MSatShellController.h" |
|
39 #include "SatServer.hrh" |
|
40 #include "SatLog.h" |
|
41 #include "MSatSUiClientHandler.h" |
|
42 #include "CSatClientServiceReq.h" |
|
43 #include "CSatEventMonitorContainer.h" |
|
44 #include "CSatSAPChangeObserver.h" |
|
45 #include "CSatSSimSubscriberId.h" |
|
46 #include "CSatBIPUtils.h" |
|
47 #include "TSatExtErrorUtils.h" |
|
48 #include "MSatUiSession.h" |
|
49 #include "csatmediatoreventprovider.h" |
|
50 #include "csatprofilechangeobserver.h" |
|
51 #include "SATInternalPSKeys.h" |
|
52 #include "csatmultimodeapi.h" |
|
53 #include "csatsactivewrapper.h" |
|
54 |
|
55 // Drive letter for resource file |
|
56 _LIT( KResourceDrive, "Z:" ); |
|
57 // SatServer's resource file |
|
58 _LIT( KSatServerRsc, "SatServer.rsc" ); |
|
59 |
|
60 |
|
61 const TUid KSatInterfaceDefinitionUid = { 0x1000f001 }; |
|
62 const TInt KSizeOfBuf = 50; |
|
63 |
|
64 const TInt8 KCreateSatAppNamePop( 2 ); |
|
65 |
|
66 // Important plugins UIDs. These are started on startup |
|
67 // Implementation UID is from the <plugin>.rss |
|
68 const TUid KSetUpEventListUid = { 0x10202993 }; |
|
69 |
|
70 // ======== LOCAL FUNCTIONS ======== |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CleanupPointerArray |
|
74 // Cleanup RPointerArray objects by using the cleanup stack. Function will be |
|
75 // called when application leaves while a RPointerArray object still alive, |
|
76 // or when CleanupStack::PopAndDestroy is explicitly called to release a |
|
77 // RPointerArray. See CleanupStack::PushL( TCleanupItem ) for more details. |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 static void CleanupPointerArray( TAny* aArray ) |
|
81 { |
|
82 LOG2( NORMAL, "SATENGINE: CSatCommandContainer::CleanupPointerArray \ |
|
83 calling array = 0x%08x", aArray ) |
|
84 |
|
85 RImplInfoPtrArray* array = reinterpret_cast<RImplInfoPtrArray*>( aArray ); |
|
86 if ( array ) |
|
87 { |
|
88 array->ResetAndDestroy(); |
|
89 } |
|
90 |
|
91 LOG( NORMAL, "SATENGINE: CSatCommandContainer::CleanupPointerArray \ |
|
92 exiting" ) |
|
93 } |
|
94 |
|
95 // ======== MEMBER FUNCTIONS ======== |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CSatCommandContainer::NewL |
|
99 // Two-phased constructor. |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 CSatCommandContainer* CSatCommandContainer::NewL( |
|
103 MSatSSessions& aSessions, |
|
104 TSatEventMediator& aEventMediator, |
|
105 MSatSUiClientHandler& aSatUiHandler ) |
|
106 { |
|
107 LOG( NORMAL, "SATENGINE: CSatCommandContainer::NewL calling" ) |
|
108 |
|
109 CSatCommandContainer* self = |
|
110 new ( ELeave ) CSatCommandContainer( |
|
111 aSessions, |
|
112 aEventMediator, |
|
113 aSatUiHandler ); |
|
114 |
|
115 CleanupStack::PushL( self ); |
|
116 self->ConstructL(); |
|
117 CleanupStack::Pop( self ); |
|
118 |
|
119 LOG( NORMAL, "SATENGINE: CSatCommandContainer::NewL exiting" ) |
|
120 return self; |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // CSatCommandContainer::~CSatCommandContainer |
|
125 // Destructor |
|
126 // ----------------------------------------------------------------------------- |
|
127 // |
|
128 CSatCommandContainer::~CSatCommandContainer() |
|
129 { |
|
130 LOG( NORMAL, |
|
131 "SATENGINE: CSatCommandContainer::~CSatCommandContainer calling" ) |
|
132 |
|
133 // Stop and Delete all command handlers |
|
134 StopCommandHandlers(); |
|
135 |
|
136 if ( iUSatAPI ) |
|
137 { |
|
138 iUSatAPI->Close(); |
|
139 delete iUSatAPI; |
|
140 iUSatAPI = NULL; |
|
141 } |
|
142 |
|
143 if ( iServiceReqs ) |
|
144 { |
|
145 iServiceReqs->Reset(); |
|
146 delete iServiceReqs; |
|
147 iServiceReqs = NULL; |
|
148 } |
|
149 |
|
150 delete iSatAppName; |
|
151 delete iSystemState; |
|
152 delete iBipUtils; |
|
153 delete iSatMediatorEvent; |
|
154 delete iMultiModeApi; |
|
155 |
|
156 delete iSapObserver; |
|
157 delete iProfileObserver; |
|
158 |
|
159 delete iSimSubscriberId; |
|
160 delete iEventMonitors; |
|
161 |
|
162 delete iCmdHandlers; |
|
163 delete iStartupChangeObserver; |
|
164 |
|
165 LOG( NORMAL, |
|
166 "SATENGINE: CSatCommandContainer::~CSatCommandContainer exiting" ) |
|
167 } |
|
168 |
|
169 // ----------------------------------------------------------------------------- |
|
170 // CSatCommandContainer::StartCommandHandlersL |
|
171 // (other items were commented in a header). |
|
172 // ----------------------------------------------------------------------------- |
|
173 // |
|
174 void CSatCommandContainer::StartCommandHandlersL() |
|
175 { |
|
176 LOG( NORMAL, |
|
177 "SATENGINE: CSatCommandContainer::StartCommandHandlersL calling" ) |
|
178 |
|
179 // If in startup phase, start the rest of the commands |
|
180 if ( iStartupPhase ) |
|
181 { |
|
182 LOG( NORMAL, "SATENGINE: CSatCommandContainer::StartCommandHandlersL \ |
|
183 in startup phase" ) |
|
184 // Create command handlers. |
|
185 RImplInfoPtrArray satCommandImplementations; |
|
186 CleanupStack::PushL( |
|
187 TCleanupItem( CleanupPointerArray, &satCommandImplementations ) ); |
|
188 REComSession::ListImplementationsL( KSatInterfaceDefinitionUid, |
|
189 satCommandImplementations ); |
|
190 |
|
191 // Container for commands |
|
192 const TInt cmdCount( satCommandImplementations.Count() ); |
|
193 LOG2( NORMAL, "SATENGINE: CSatCommandContainer::StartCommandHandlersL \ |
|
194 Command handler count: %d", cmdCount ) |
|
195 |
|
196 // Check are there any command implementations |
|
197 if ( cmdCount > 0 ) |
|
198 { |
|
199 // Check array. Should not be NULL as it is started earlier |
|
200 if ( !iCmdHandlers ) |
|
201 { |
|
202 LOG( NORMAL, "SATENGINE: CSatCommandContainer::\ |
|
203 StartCommandHandlersL iCmdHandlers false" ) |
|
204 iCmdHandlers = new ( ELeave ) |
|
205 CArrayPtrFlat<CSatCommandHandler>( cmdCount ); |
|
206 } |
|
207 |
|
208 // Add all found command handlers to list |
|
209 for ( TInt i = 0; i < cmdCount; i++ ) |
|
210 { |
|
211 const TUid KImplementationUid( |
|
212 satCommandImplementations[i]->ImplementationUid() ); |
|
213 |
|
214 // Check important command handlers. They are already started |
|
215 if ( KImplementationUid != KSetUpEventListUid ) |
|
216 { |
|
217 CSatCommandHandler* cmd = |
|
218 CSatCommandHandler::NewL( KImplementationUid, this ); |
|
219 cmd->Start(); |
|
220 CleanupStack::PushL( cmd ); |
|
221 iCmdHandlers->AppendL( cmd ); |
|
222 CleanupStack::Pop( cmd ); |
|
223 } |
|
224 } |
|
225 } |
|
226 CleanupStack::PopAndDestroy( &satCommandImplementations ); |
|
227 |
|
228 // Notify TSY about readiness i.e. all nofies are sent |
|
229 // Done only once in startup phase |
|
230 TInt ret = iUSatAPI->UsatClientReadyIndication(); |
|
231 LOG2( NORMAL, "SATENGINE: UsatClientReadyIndication() gives %d", ret ) |
|
232 } |
|
233 |
|
234 // Else check that there are no command handlers created and |
|
235 // BT SAP is not active |
|
236 else if ( !iCmdHandlers && !( SystemState().IsBtSapActive() ) ) |
|
237 { |
|
238 LOG( NORMAL, "SATENGINE: CSatCommandContainer::StartCommandHandlersL \ |
|
239 no command handlers created and BT SAP is not active" ) |
|
240 // This is the case when |
|
241 // SAP is first enabled and then disabled |
|
242 if ( !iUSatAPI->IsRSatConnected() ) |
|
243 { |
|
244 User::LeaveIfError( iUSatAPI->Connect( *iMultiModeApi ) ); |
|
245 } |
|
246 |
|
247 // Create command handlers. |
|
248 RImplInfoPtrArray satCommandImplementations; |
|
249 CleanupStack::PushL( |
|
250 TCleanupItem( CleanupPointerArray, &satCommandImplementations ) ); |
|
251 REComSession::ListImplementationsL( KSatInterfaceDefinitionUid, |
|
252 satCommandImplementations ); |
|
253 |
|
254 // Container for commands |
|
255 const TInt cmdCount( satCommandImplementations.Count() ); |
|
256 LOG2( NORMAL, "SATENGINE: CSatCommandContainer::StartCommandHandlersL \ |
|
257 Command handler count: %d", cmdCount ) |
|
258 |
|
259 // Check are there any command implementations |
|
260 if ( cmdCount > 0 ) |
|
261 { |
|
262 iCmdHandlers = |
|
263 new ( ELeave ) CArrayPtrFlat<CSatCommandHandler>( cmdCount ); |
|
264 |
|
265 // Add all found command handlers to list |
|
266 for ( TInt i = 0; i < cmdCount; i++ ) |
|
267 { |
|
268 const TUid KImplementationUid( |
|
269 satCommandImplementations[i]->ImplementationUid() ); |
|
270 CSatCommandHandler* cmd = |
|
271 CSatCommandHandler::NewL( KImplementationUid, this ); |
|
272 cmd->Start(); |
|
273 CleanupStack::PushL( cmd ); |
|
274 iCmdHandlers->AppendL( cmd ); |
|
275 CleanupStack::Pop( cmd ); |
|
276 } |
|
277 } |
|
278 else |
|
279 { |
|
280 LOG( NORMAL, "SATENGINE: CSatCommandContainer::\ |
|
281 StartCommandHandlersL No commands found" ) |
|
282 // No commands, remove SAT Icon from shell |
|
283 iSatUiHandler.ShellController().RemoveSatUiL(); |
|
284 } |
|
285 CleanupStack::PopAndDestroy( &satCommandImplementations ); |
|
286 } |
|
287 else |
|
288 { |
|
289 LOG( NORMAL, " Not starting any command handlers" ) |
|
290 } |
|
291 |
|
292 // Create SAP State observer. |
|
293 if ( !iSapObserver ) |
|
294 { |
|
295 LOG( NORMAL, "SATENGINE: CSatCommandContainer::StartCommandHandlersL \ |
|
296 iSapObserver false" ) |
|
297 // Create SAP change observer only if there are command handlers. |
|
298 iSapObserver = CSatSAPChangeObserver::NewL( *this ); |
|
299 } |
|
300 |
|
301 // Create Profile change observer. |
|
302 if ( !iProfileObserver ) |
|
303 { |
|
304 LOG( NORMAL, "SATENGINE: CSatCommandContainer::StartCommandHandlersL \ |
|
305 iProfileObserver false" ) |
|
306 iProfileObserver = CSatProfileChangeObserver::NewL( *this ); |
|
307 } |
|
308 |
|
309 LOG( NORMAL, |
|
310 "SATENGINE: CSatCommandContainer::StartCommandHandlersL exiting" ) |
|
311 } |
|
312 |
|
313 // ----------------------------------------------------------------------------- |
|
314 // CSatCommandContainer::StopCommandHandlersL |
|
315 // (other items were commented in a header). |
|
316 // ----------------------------------------------------------------------------- |
|
317 // |
|
318 void CSatCommandContainer::StopCommandHandlers() |
|
319 { |
|
320 LOG( NORMAL, |
|
321 "SATENGINE: CSatCommandContainer::StopCommandHandlers calling" ) |
|
322 |
|
323 if ( iCmdHandlers ) |
|
324 { |
|
325 // Remove every command handler from event observers |
|
326 const TInt count( iCmdHandlers->Count() ); |
|
327 LOG2( NORMAL, "SATENGINE: CSatCommandContainer::StopCommandHandlers \ |
|
328 Command handler count: %d", count ) |
|
329 for ( TInt j = 0; j < count; j++ ) |
|
330 { |
|
331 CSatCommandHandler* cmd = iCmdHandlers->At( j ); |
|
332 UnregisterEventObserver( cmd ); |
|
333 } |
|
334 |
|
335 // Delete command handlers |
|
336 iCmdHandlers->ResetAndDestroy(); |
|
337 |
|
338 delete iCmdHandlers; |
|
339 iCmdHandlers = NULL; |
|
340 } |
|
341 |
|
342 // This must be called when all ECom Plug-Ins has been deleted. Otherwise |
|
343 // there might be memory leaks. |
|
344 REComSession::FinalClose(); |
|
345 |
|
346 // Reset ClientService request handlers since there are no command handlers |
|
347 // to handle client responses. If SAT UI / Proactive command is executing |
|
348 // while Bluetooth SAP is enabled, SAT UI sends ClientResponse and that must |
|
349 // be preveted |
|
350 if ( iServiceReqs ) |
|
351 { |
|
352 iServiceReqs->Reset(); |
|
353 } |
|
354 |
|
355 // Close all reserved BIP Data channels |
|
356 if ( iBipUtils ) |
|
357 { |
|
358 LOG( NORMAL, "SATENGINE: CSatCommandContainer::StopCommandHandlers \ |
|
359 iBipUtils true" ) |
|
360 iBipUtils->CloseAllChannels(); |
|
361 } |
|
362 |
|
363 // Cancel all event monitors |
|
364 if ( iEventMonitors ) |
|
365 { |
|
366 LOG( NORMAL, "SATENGINE: CSatCommandContainer::StopCommandHandlers \ |
|
367 iEventMonitors true" ) |
|
368 iEventMonitors->CancelAllMonitors(); |
|
369 } |
|
370 |
|
371 #ifdef SAT_USE_DUMMY_TSY |
|
372 // Close ATSY. This is needed when testin BT SAP in emulator |
|
373 if ( iUSatAPI ) |
|
374 { |
|
375 iUSatAPI->Close(); |
|
376 } |
|
377 #endif |
|
378 |
|
379 LOG( NORMAL, |
|
380 "SATENGINE: CSatCommandContainer::StopCommandHandlers exiting" ) |
|
381 } |
|
382 |
|
383 // ----------------------------------------------------------------------------- |
|
384 // CSatCommandContainer::Event |
|
385 // (other items were commented in a header). |
|
386 // ----------------------------------------------------------------------------- |
|
387 // |
|
388 void CSatCommandContainer::Event( TInt aEvent ) |
|
389 { |
|
390 LOG( NORMAL, "SATENGINE: CSatCommandContainer::Event calling" ) |
|
391 |
|
392 if ( MSatUtils::ECmccSimDetected == aEvent ) |
|
393 { |
|
394 LOG( NORMAL, "SATENGINE: Event: ECmccSimDetected" ) |
|
395 iIsCmccSim = ETrue; |
|
396 |
|
397 // Update default name read in ConstructL. |
|
398 TRAPD( err, CreateSatAppNameL( R_QTN_SAT_CMCC_TITLE ) ); |
|
399 LOG2( NORMAL, "SATENGINE: Error: %i", err ) |
|
400 if ( KErrNone == err ) |
|
401 { |
|
402 // Notify application name update. |
|
403 NotifyEvent( EApplNameUpdated ); |
|
404 } |
|
405 } |
|
406 else if ( MSatUtils::ESatUiClosed == aEvent ) |
|
407 { |
|
408 LOG( NORMAL, "SATENGINE: Event: ESatUiClosed" ) |
|
409 // Reset service requests. If this is not done, |
|
410 // Some command may try to send data to UiClient, |
|
411 // even if there is no request. |
|
412 const TInt reqs( iServiceReqs->Count() ); |
|
413 LOG2( NORMAL, "SATENGINE: CSatCommandContainer::Event reqs: %i", |
|
414 reqs ) |
|
415 for ( TInt i = 0; i < reqs; i++ ) |
|
416 { |
|
417 iServiceReqs->At( i )->Reset(); |
|
418 } |
|
419 } |
|
420 else |
|
421 { |
|
422 LOG( NORMAL, "SATENGINE: Unexpected event" ) |
|
423 } |
|
424 |
|
425 LOG( NORMAL, "SATENGINE: CSatCommandContainer::Event exiting" ) |
|
426 } |
|
427 |
|
428 // ----------------------------------------------------------------------------- |
|
429 // CSatCommandContainer::NotifyUiEvent |
|
430 // (other items were commented in a header). |
|
431 // ----------------------------------------------------------------------------- |
|
432 // |
|
433 void CSatCommandContainer::NotifyUiEvent( |
|
434 TInt aEventId, TInt aEventStatus, TInt aEventError ) |
|
435 { |
|
436 LOG( NORMAL, "SATENGINE: CSatCommandContainer::NotifyUiEvent calling" ) |
|
437 |
|
438 MSatUiSession* session = iSatUiHandler.UiSession(); |
|
439 if ( session ) |
|
440 { |
|
441 LOG( NORMAL, "SATENGINE: CSatCommandContainer::NotifyUiEvent \ |
|
442 session" ) |
|
443 session->UiEventNotification( aEventId, aEventStatus, aEventError ); |
|
444 session = NULL; |
|
445 } |
|
446 |
|
447 LOG( NORMAL, "SATENGINE: CSatCommandContainer::NotifyUiEvent exiting" ) |
|
448 } |
|
449 |
|
450 // ----------------------------------------------------------------------------- |
|
451 // CSatCommandContainer::USatAPI |
|
452 // (other items were commented in a header). |
|
453 // ----------------------------------------------------------------------------- |
|
454 // |
|
455 MSatApi& CSatCommandContainer::USatAPI() |
|
456 { |
|
457 LOG( DETAILED, "SATENGINE: CSatCommandContainer::USatAPI calling" ) |
|
458 |
|
459 __ASSERT_ALWAYS( iUSatAPI, PanicSatEngine( ESatEngineNullPointer ) ); |
|
460 |
|
461 LOG( DETAILED, "SATENGINE: CSatCommandContainer::USatAPI exiting" ) |
|
462 return *iUSatAPI; |
|
463 } |
|
464 |
|
465 // ----------------------------------------------------------------------------- |
|
466 // CSatCommandContainer::SystemState |
|
467 // (other items were commented in a header). |
|
468 // ----------------------------------------------------------------------------- |
|
469 // |
|
470 MSatSystemState& CSatCommandContainer::SystemState() |
|
471 { |
|
472 LOG( NORMAL, |
|
473 "SATENGINE: CSatCommandContainer::SystemState calling-exiting" ) |
|
474 return *iSystemState; |
|
475 } |
|
476 |
|
477 // ----------------------------------------------------------------------------- |
|
478 // CSatCommandContainer::SatUiHandler |
|
479 // (other items were commented in a header). |
|
480 // ----------------------------------------------------------------------------- |
|
481 // |
|
482 MSatSUiClientHandler& CSatCommandContainer::SatUiHandler() |
|
483 { |
|
484 LOG( NORMAL, |
|
485 "SATENGINE: CSatCommandContainer::SatUiHandler calling-exiting" ) |
|
486 return iSatUiHandler; |
|
487 } |
|
488 |
|
489 // ----------------------------------------------------------------------------- |
|
490 // CSatCommandContainer::RegisterL |
|
491 // Forwards the registeration to TSatEventMediator |
|
492 // (other items were commented in a header). |
|
493 // ----------------------------------------------------------------------------- |
|
494 // |
|
495 void CSatCommandContainer::RegisterL( |
|
496 MSatEventObserver* aObserver, // Event observer |
|
497 TSatEvent aEvent ) // Event which is observerd |
|
498 { |
|
499 LOG( NORMAL, "SATENGINE: CSatCommandContainer::RegisterL calling" ) |
|
500 |
|
501 iEventMediator.RegisterL( aObserver, aEvent ); |
|
502 |
|
503 LOG( NORMAL, "SATENGINE: CSatCommandContainer::RegisterL exiting" ) |
|
504 } |
|
505 |
|
506 // ----------------------------------------------------------------------------- |
|
507 // CSatCommandContainer::NotifyEvent |
|
508 // (other items were commented in a header). |
|
509 // ----------------------------------------------------------------------------- |
|
510 // |
|
511 void CSatCommandContainer::NotifyEvent( TSatEvent aEvent ) |
|
512 { |
|
513 LOG( NORMAL, "SATENGINE: CSatCommandContainer::NotifyEvent calling" ) |
|
514 |
|
515 iEventMediator.Notify( aEvent ); |
|
516 |
|
517 LOG( NORMAL, "SATENGINE: CSatCommandContainer::NotifyEvent exiting" ) |
|
518 } |
|
519 |
|
520 // ----------------------------------------------------------------------------- |
|
521 // CSatCommandContainer::UnregisterEvent |
|
522 // (other items were commented in a header). |
|
523 // ----------------------------------------------------------------------------- |
|
524 // |
|
525 void CSatCommandContainer::UnregisterEvent( |
|
526 MSatEventObserver* aObserver, // Observer of the event |
|
527 TSatEvent aEvent ) // Event |
|
528 { |
|
529 LOG( NORMAL, "SATENGINE: CSatCommandContainer::UnregisterEvent calling" ) |
|
530 |
|
531 iEventMediator.Unregister( aObserver, aEvent ); |
|
532 |
|
533 LOG( NORMAL, "SATENGINE: CSatCommandContainer::UnregisterEvent exiting" ) |
|
534 } |
|
535 |
|
536 // ----------------------------------------------------------------------------- |
|
537 // CSatCommandContainer::UnregisterEvent |
|
538 // (other items were commented in a header). |
|
539 // ----------------------------------------------------------------------------- |
|
540 // |
|
541 void CSatCommandContainer::UnregisterEventObserver( |
|
542 MSatEventObserver* aObserver ) |
|
543 { |
|
544 LOG( NORMAL, |
|
545 "SATENGINE: CSatCommandContainer::UnregisterEventObserver calling" ) |
|
546 |
|
547 iEventMediator.Unregister( aObserver ); |
|
548 |
|
549 LOG( NORMAL, |
|
550 "SATENGINE: CSatCommandContainer::UnregisterEventObserver exiting" ) |
|
551 } |
|
552 |
|
553 // ----------------------------------------------------------------------------- |
|
554 // CSatCommandContainer::NumberOfExecutingCommandHandlers |
|
555 // (other items were commented in a header). |
|
556 // ----------------------------------------------------------------------------- |
|
557 // |
|
558 TInt CSatCommandContainer::NumberOfExecutingCommandHandlers() |
|
559 { |
|
560 LOG( NORMAL, |
|
561 "SATENGINE: CSatCommandContainer::NumberOfExecutingCommandHandlers \ |
|
562 calling" ) |
|
563 |
|
564 TInt result( 0 ); |
|
565 TInt count( 0 ); |
|
566 if ( iCmdHandlers ) |
|
567 { |
|
568 LOG( NORMAL, |
|
569 "SATENGINE: CSatCommandContainer::NumberOfExecutingCommandHandlers \ |
|
570 iCmdHandlers true" ) |
|
571 // Gets the count of command handlers |
|
572 // if the list is already available. |
|
573 count = iCmdHandlers->Count(); |
|
574 } |
|
575 LOG2( NORMAL, "CSatCommandContainer::NumberOfExecutingCommandHandlers \ |
|
576 count: %i", count ) |
|
577 for ( TInt i = 0; i < count; i++ ) |
|
578 { |
|
579 CSatCommandHandler* handler = iCmdHandlers->At( i ); |
|
580 __ASSERT_ALWAYS( handler, PanicSatEngine( ESatEngineNullPointer ) ); |
|
581 |
|
582 // If command handler is not active then it has received command |
|
583 // from sim. |
|
584 if ( handler->IsCommandExecuting() ) |
|
585 { |
|
586 result++; |
|
587 } |
|
588 } |
|
589 |
|
590 LOG2( NORMAL, |
|
591 "SATENGINE: CSatCommandContainer::NumberOfExecutingCommandHandlers \ |
|
592 exiting: %i", result ) |
|
593 return result; |
|
594 } |
|
595 |
|
596 // ----------------------------------------------------------------------------- |
|
597 // CSatCommandContainer::SatAppName |
|
598 // (other items were commented in a header). |
|
599 // ----------------------------------------------------------------------------- |
|
600 // |
|
601 const TDesC& CSatCommandContainer::SatAppName() const |
|
602 { |
|
603 LOG( NORMAL, "SATENGINE: CSatCommandContainer::SatAppName calling-exiting" ) |
|
604 return *iSatAppName; |
|
605 } |
|
606 |
|
607 // ----------------------------------------------------------------------------- |
|
608 // CSatCommandContainer::BipApnName |
|
609 // (other items were commented in a header). |
|
610 // ----------------------------------------------------------------------------- |
|
611 // |
|
612 const TDesC& CSatCommandContainer::BipApnName() const |
|
613 { |
|
614 LOG( NORMAL, "SATENGINE: CSatCommandContainer::BipApnName calling-exiting" ) |
|
615 return iSatBipName; |
|
616 } |
|
617 |
|
618 // ----------------------------------------------------------------------------- |
|
619 // CSatCommandContainer::RestoreSatAppNameL |
|
620 // (other items were commented in a header). |
|
621 // ----------------------------------------------------------------------------- |
|
622 // |
|
623 void CSatCommandContainer::RestoreSatAppNameL() |
|
624 { |
|
625 LOG( NORMAL, "SATENGINE: CSatCommandContainer::RestoreSatAppNameL calling" ) |
|
626 if ( !iIsCmccSim ) |
|
627 { |
|
628 LOG( NORMAL, |
|
629 "SATENGINE: CSatCommandContainer::RestoreSatAppNameL name reset" ) |
|
630 CreateSatAppNameL( R_QTN_SAT_LOG_TITLE ); |
|
631 } |
|
632 LOG( NORMAL, "SATENGINE: CSatCommandContainer::RestoreSatAppNameL exiting" ) |
|
633 } |
|
634 |
|
635 // ----------------------------------------------------------------------------- |
|
636 // CSatCommandContainer::SetSatAppNameL |
|
637 // (other items were commented in a header). |
|
638 // ----------------------------------------------------------------------------- |
|
639 // |
|
640 void CSatCommandContainer::SetSatAppNameL( |
|
641 const TDesC& aName ) // New sat app name |
|
642 { |
|
643 LOG( NORMAL, "SATENGINE: CSatCommandContainer::SetSatAppNameL calling" ) |
|
644 |
|
645 if ( !iIsCmccSim ) |
|
646 { |
|
647 LOG( NORMAL, "SATENGINE: CSatCommandContainer::SetSatAppNameL \ |
|
648 iIsCmccSim false" ) |
|
649 HBufC* temp = aName.AllocL(); |
|
650 delete iSatAppName; |
|
651 iSatAppName = temp; |
|
652 } |
|
653 |
|
654 LOG( NORMAL, "SATENGINE: CSatCommandContainer::SetSatAppNameL exiting" ) |
|
655 } |
|
656 |
|
657 // ----------------------------------------------------------------------------- |
|
658 // CSatCommandContainer::RefreshSubSessions |
|
659 // (other items were commented in a header). |
|
660 // ----------------------------------------------------------------------------- |
|
661 // |
|
662 const RPointerArray<MSatRefreshSubSession>& |
|
663 CSatCommandContainer::RefreshSubSessions() |
|
664 { |
|
665 LOG( NORMAL, |
|
666 "SATENGINE: CSatCommandContainer::RefreshSubSessions calling-exiting" ) |
|
667 return iSessions.RefreshSubSessions(); |
|
668 } |
|
669 |
|
670 // ----------------------------------------------------------------------------- |
|
671 // CSatCommandContainer::RegisterServiceRequestL |
|
672 // (other items were commented in a header). |
|
673 // ----------------------------------------------------------------------------- |
|
674 // |
|
675 void CSatCommandContainer::RegisterServiceRequestL( |
|
676 TSatServerRequest aRequest, |
|
677 TSatServerRequest aResponse, |
|
678 MSatCommand* aCommand ) |
|
679 { |
|
680 LOG( NORMAL, |
|
681 "SATENGINE: CSatCommandContainer::RegisterServiceRequestL calling" ) |
|
682 |
|
683 // First, check is there service request handler already with the same |
|
684 // request.If it exists, change command handler |
|
685 const TInt reqs( iServiceReqs->Count() ); |
|
686 TBool requestHandled( EFalse ); |
|
687 LOG2( NORMAL, "CSatCommandContainer::RegisterServiceRequestL \ |
|
688 reqs: %i", reqs ) |
|
689 for ( TInt i = 0; i < reqs; i++ ) |
|
690 { |
|
691 CSatClientServiceReq* req = iServiceReqs->At( i ); |
|
692 __ASSERT_ALWAYS( req, PanicSatEngine( ESatEngineNullPointer ) ); |
|
693 |
|
694 if ( req->IsMyRequest( aRequest ) ) |
|
695 { |
|
696 req->SetCommandHandler( aCommand ); |
|
697 requestHandled = ETrue; |
|
698 i = reqs; // to end for-loop |
|
699 } |
|
700 } |
|
701 |
|
702 // Check was service request found |
|
703 if ( !requestHandled ) |
|
704 { |
|
705 LOG( NORMAL, "SATENGINE: CSatCommandContainer::\ |
|
706 RegisterServiceRequestL requestHandled false" ) |
|
707 // Not found, add new |
|
708 CSatClientServiceReq* servReq = CSatClientServiceReq::NewL( |
|
709 aRequest, aResponse, aCommand, *this ); |
|
710 CleanupStack::PushL( servReq ); |
|
711 iServiceReqs->AppendL( servReq ); |
|
712 CleanupStack::Pop( servReq ); |
|
713 } |
|
714 |
|
715 LOG( NORMAL, |
|
716 "SATENGINE: CSatCommandContainer::RegisterServiceRequestL exiting" ) |
|
717 } |
|
718 |
|
719 // ----------------------------------------------------------------------------- |
|
720 // CSatCommandContainer::ServiceRequests |
|
721 // (other items were commented in a header). |
|
722 // ----------------------------------------------------------------------------- |
|
723 // |
|
724 CArrayPtrFlat<CSatClientServiceReq>* |
|
725 CSatCommandContainer::ServiceRequests() |
|
726 { |
|
727 LOG( NORMAL, |
|
728 "SATENGINE: CSatCommandContainer::ServiceRequests calling-exiting" ) |
|
729 return iServiceReqs; |
|
730 } |
|
731 |
|
732 // ----------------------------------------------------------------------------- |
|
733 // CSatCommandContainer::EventMonitors |
|
734 // (other items were commented in a header). |
|
735 // ----------------------------------------------------------------------------- |
|
736 // |
|
737 MSatEventMonitorContainer* CSatCommandContainer::EventMonitors() |
|
738 { |
|
739 LOG( NORMAL, |
|
740 "SATENGINE: CSatCommandContainer::EventMonitors calling-exiting" ) |
|
741 return iEventMonitors; |
|
742 } |
|
743 |
|
744 // ----------------------------------------------------------------------------- |
|
745 // CSatCommandContainer::SimSubscriberId |
|
746 // (other items were commented in a header). |
|
747 // ----------------------------------------------------------------------------- |
|
748 // |
|
749 MSatSSimSubscriberId& CSatCommandContainer::SimSubscriberId() |
|
750 { |
|
751 LOG( NORMAL, |
|
752 "SATENGINE: CSatCommandContainer::SimSubscriberId calling-exiting" ) |
|
753 return *iSimSubscriberId; |
|
754 } |
|
755 |
|
756 // ----------------------------------------------------------------------------- |
|
757 // CSatCommandContainer::BipUtils |
|
758 // (other items were commented in a header). |
|
759 // ----------------------------------------------------------------------------- |
|
760 // |
|
761 MSatBIPUtils& CSatCommandContainer::BipUtils() |
|
762 { |
|
763 LOG( NORMAL, |
|
764 "SATENGINE: CSatCommandContainer::BipUtils calling-exiting" ) |
|
765 return *CreateAndGetBIPUtils(); |
|
766 } |
|
767 |
|
768 // ----------------------------------------------------------------------------- |
|
769 // CSatCommandContainer::BipEventNotifier |
|
770 // (other items were commented in a header). |
|
771 // ----------------------------------------------------------------------------- |
|
772 // |
|
773 MSatBIPEventNotifier& CSatCommandContainer::BipEventNotifier() |
|
774 { |
|
775 LOG( NORMAL, |
|
776 "SATENGINE: CSatCommandContainer::BipEventNotifier calling-exiting" ) |
|
777 return *CreateAndGetBIPUtils(); |
|
778 } |
|
779 |
|
780 // ----------------------------------------------------------------------------- |
|
781 // CSatCommandContainer::MultiModeApi |
|
782 // (other items were commented in a header). |
|
783 // ----------------------------------------------------------------------------- |
|
784 // |
|
785 MSatMultiModeApi& CSatCommandContainer::MultiModeApi() |
|
786 { |
|
787 LOG( NORMAL, |
|
788 "SATENGINE: CSatCommandContainer::MultiModeApi calling-exiting" ) |
|
789 return *iMultiModeApi; |
|
790 } |
|
791 |
|
792 // ----------------------------------------------------------------------------- |
|
793 // CSatCommandContainer::CustomApi |
|
794 // (other items were commented in a header). |
|
795 // ----------------------------------------------------------------------------- |
|
796 // |
|
797 RMmCustomAPI* CSatCommandContainer::CustomApi() |
|
798 { |
|
799 LOG( NORMAL, |
|
800 "SATENGINE: CSatCommandContainer::CustomApi calling-exiting" ) |
|
801 return iMultiModeApi->CustomApi(); |
|
802 } |
|
803 |
|
804 // ----------------------------------------------------------------------------- |
|
805 // CSatCommandContainer::RaiseSatEvent |
|
806 // (other items were commented in a header). |
|
807 // ----------------------------------------------------------------------------- |
|
808 // |
|
809 TInt CSatCommandContainer::RaiseSatEvent( const TDesC8& aData ) |
|
810 { |
|
811 LOG( NORMAL, "SATENGINE: CSatCommandContainer::RaiseSatEvent calling" ) |
|
812 |
|
813 CSatMediatorEventProvider* medEvent = |
|
814 CreateAndGetSatMediatorEventProvider(); |
|
815 TInt retVal( KErrNone ); |
|
816 if ( medEvent ) |
|
817 { |
|
818 LOG( NORMAL, "SATENGINE: CSatCommandContainer::RaiseSatEvent \ |
|
819 medEvent true" ) |
|
820 retVal = medEvent->RaiseSatEvent( aData ); |
|
821 } |
|
822 |
|
823 LOG2( NORMAL,"SATENGINE: CSatCommandContainer::RaiseSatEvent exiting, \ |
|
824 retVal: %d", retVal ) |
|
825 return retVal; |
|
826 } |
|
827 |
|
828 // ----------------------------------------------------------------------------- |
|
829 // CSatCommandContainer::CoverUiSupported() |
|
830 // (other items were commented in a header). |
|
831 // ----------------------------------------------------------------------------- |
|
832 // |
|
833 TBool CSatCommandContainer::CoverUiSupported() |
|
834 { |
|
835 LOG( NORMAL, "SATENGINE: CSatCommandContainer::CoverUiSupported calling" ) |
|
836 |
|
837 CSatMediatorEventProvider* medEvent = CreateAndGetSatMediatorEventProvider(); |
|
838 TBool supported( EFalse ); |
|
839 if ( medEvent ) |
|
840 { |
|
841 LOG( NORMAL, "SATENGINE: CSatCommandContainer::CoverUiSupported \ |
|
842 medEvent true" ) |
|
843 supported = medEvent->CoverUiSupported(); |
|
844 } |
|
845 |
|
846 LOG2( NORMAL, "SATENGINE: CSatCommandContainer::CoverUiSupported exiting,\ |
|
847 supported: %d", supported ) |
|
848 return supported; |
|
849 } |
|
850 |
|
851 // ----------------------------------------------------------------------------- |
|
852 // CSatCommandContainer::CreateAsyncToSyncHelperL |
|
853 // (other items were commented in a header). |
|
854 // ----------------------------------------------------------------------------- |
|
855 // |
|
856 MSatAsyncToSync* CSatCommandContainer::CreateAsyncToSyncHelper() |
|
857 { |
|
858 MSatAsyncToSync* wrapper = new CSatSActiveWrapper(); |
|
859 LOG( NORMAL, "SATENGINE: CSatCommandContainer::\ |
|
860 CreateAsyncToSyncHelperL calling - exiting" ) |
|
861 return wrapper; |
|
862 } |
|
863 |
|
864 // ----------------------------------------------------------------------------- |
|
865 // CSatCommandContainer::StateChanged |
|
866 // (other items were commented in a header). |
|
867 // ----------------------------------------------------------------------------- |
|
868 // |
|
869 void CSatCommandContainer::StateChanged( const TInt aValue ) |
|
870 { |
|
871 LOG( NORMAL, "SATENGINE: CSatCommandContainer::StateChanged calling" ) |
|
872 CheckStartupState( aValue ); |
|
873 LOG( NORMAL, "SATENGINE: CSatCommandContainer::StateChanged exiting" ) |
|
874 } |
|
875 |
|
876 // ----------------------------------------------------------------------------- |
|
877 // CSatCommandContainer::CSatCommandContainer |
|
878 // C++ default constructor can NOT contain any code, that |
|
879 // might leave. |
|
880 // ----------------------------------------------------------------------------- |
|
881 // |
|
882 CSatCommandContainer::CSatCommandContainer( |
|
883 MSatSSessions& aSessions, |
|
884 TSatEventMediator& aEventMediator, |
|
885 MSatSUiClientHandler& aSatUiHandler ) : |
|
886 iSessions( aSessions ), |
|
887 iEventMediator( aEventMediator ), |
|
888 iSatUiHandler( aSatUiHandler ), |
|
889 iSatMediatorEvent( NULL ) |
|
890 { |
|
891 LOG( NORMAL, |
|
892 "SATENGINE: CSatCommandContainer::CSatCommandContainer calling-exiting" ) |
|
893 } |
|
894 |
|
895 // ----------------------------------------------------------------------------- |
|
896 // CSatCommandContainer::ConstructL |
|
897 // Symbian 2nd phase constructor can leave. |
|
898 // ----------------------------------------------------------------------------- |
|
899 // |
|
900 void CSatCommandContainer::ConstructL() |
|
901 { |
|
902 LOG( NORMAL, "SATENGINE: CSatCommandContainer::ConstructL calling" ) |
|
903 |
|
904 iIsCmccSim = EFalse; |
|
905 CreateSatAppNameL( R_QTN_SAT_LOG_TITLE ); |
|
906 |
|
907 // Register for ui events in order to keep track if user or command |
|
908 // has launched the ui. |
|
909 iEventMediator.RegisterL( this, MSatUtils::ESatUiClosed ); |
|
910 iEventMediator.RegisterL( this, MSatUtils::ECmccSimDetected ); |
|
911 |
|
912 // Set these pointers to NULL because their value is checked |
|
913 // before initialization... |
|
914 iSapObserver = NULL; |
|
915 iCmdHandlers = NULL; |
|
916 iProfileObserver = NULL; |
|
917 |
|
918 // Create pointer array for service request handlers |
|
919 iServiceReqs = new( ELeave )CArrayPtrFlat<CSatClientServiceReq>( 1 ); |
|
920 |
|
921 iMultiModeApi = CSatMultiModeApi::NewL(); |
|
922 |
|
923 // By default, we use extended errors |
|
924 iMultiModeApi->RaiseErrorGranularity(); |
|
925 |
|
926 iUSatAPI = new( ELeave )TUSatAPI(); |
|
927 TInt error = iUSatAPI->Connect( *iMultiModeApi ); |
|
928 |
|
929 // Create SystemState. |
|
930 iSystemState = |
|
931 TSatSystemStateFactory::CreateSystemStateL( *iMultiModeApi ); |
|
932 |
|
933 // Create event monitor container. |
|
934 iEventMonitors = CSatEventMonitorContainer::NewL( *iUSatAPI, *this ); |
|
935 |
|
936 // Check did the conneciton to phone passed. |
|
937 if ( KErrNone == error ) |
|
938 { |
|
939 LOG( NORMAL, "SATENGINE: CSatCommandContainer::ConstructL connection \ |
|
940 to phone" ) |
|
941 iStartupPhase = ETrue; |
|
942 // Start important plugins |
|
943 StartImportantCommandHandlersL(); |
|
944 |
|
945 // Start listening system's state |
|
946 iStartupChangeObserver = |
|
947 TSatSystemStateFactory::CreateStartupChangeNotifierL( *this ); |
|
948 CheckStartupState( iStartupChangeObserver->GetValueInt() ); |
|
949 |
|
950 if ( iStartupPhase ) |
|
951 { |
|
952 LOG( NORMAL, "SATENGINE: CSatCommandContainer::ConstructL \ |
|
953 iStartupPhase true" ) |
|
954 iStartupChangeObserver->NotifyChangeL(); |
|
955 } |
|
956 |
|
957 } |
|
958 |
|
959 // Create Subscriber id handler. |
|
960 iSimSubscriberId = |
|
961 CSatSSimSubscriberId::NewL( *iMultiModeApi, iEventMediator ); |
|
962 iSimSubscriberId->Start(); |
|
963 |
|
964 // Create SatMediatorEventProvider. Will register SAT Cover UI events |
|
965 // if cover UI is supported. |
|
966 CreateAndGetSatMediatorEventProvider(); |
|
967 |
|
968 TSecurityPolicy readPolicy( ECapabilityReadUserData ); |
|
969 TSecurityPolicy writePolicy( ECapabilityWriteUserData ); |
|
970 |
|
971 // Define properties in P&S key for icon support |
|
972 error = RProperty::Define( KPSUidSatServerInternal, |
|
973 KSatAppClosedUsingEndKey, RProperty::EInt, readPolicy, writePolicy ); |
|
974 |
|
975 LOG2( NORMAL, "CSatUiActionPerformer::ConstructL \ |
|
976 define KSatAppClosedUsingEndKey and return: %d", error ) |
|
977 |
|
978 // Publish P&S key for icon support |
|
979 error = RProperty::Set( KPSUidSatServerInternal, KSatAppClosedUsingEndKey, |
|
980 KSatAppTerminatedNormal ); |
|
981 |
|
982 LOG2( SIMPLE, "SATENGINE: CSatCommandContainer::ConstructL \ |
|
983 P&S key: %i", KSatAppTerminatedNormal ) |
|
984 |
|
985 LOG2( NORMAL, "CSatUiActionPerformer::ConstructL \ |
|
986 publish KSatAppClosedUsingEndKey and return: %d", error ) |
|
987 LOG( NORMAL, "SATENGINE: CSatCommandContainer::ConstructL exiting" ) |
|
988 } |
|
989 // ----------------------------------------------------------------------------- |
|
990 // CSatCommandContainer::CreateSatAppNameL |
|
991 // (other items were commented in a header). |
|
992 // ----------------------------------------------------------------------------- |
|
993 // |
|
994 void CSatCommandContainer::CreateSatAppNameL( const TInt aResourceId ) |
|
995 { |
|
996 LOG( NORMAL, "SATENGINE: CSatCommandContainer::CreateSatAppNameL calling" ) |
|
997 |
|
998 // Open the RFs session. |
|
999 RFs fs; |
|
1000 |
|
1001 User::LeaveIfError( fs.Connect() ); |
|
1002 |
|
1003 // Push close operation in tbe cleanup stack |
|
1004 CleanupClosePushL( fs ); |
|
1005 |
|
1006 RResourceFile resFile; |
|
1007 // Backslashes are already defined in resource file, not needed here. |
|
1008 TBuf<KSizeOfBuf> buf( KResourceDrive ); |
|
1009 buf.Append( KDC_RESOURCE_FILES_DIR ); |
|
1010 buf.Append( KSatServerRsc ); |
|
1011 |
|
1012 TFileName fileName( buf ); |
|
1013 |
|
1014 BaflUtils::NearestLanguageFile( fs, fileName ); |
|
1015 |
|
1016 // Open the resource file |
|
1017 resFile.OpenL( fs, fileName ); |
|
1018 |
|
1019 // Push close operation in the cleanup stack |
|
1020 CleanupClosePushL( resFile ); |
|
1021 |
|
1022 resFile.ConfirmSignatureL( ESatSResourceSignature ); |
|
1023 |
|
1024 // Reads a resource structure with memory allocation. |
|
1025 HBufC8* dataBuffer = resFile.AllocReadLC( aResourceId ); |
|
1026 |
|
1027 TResourceReader resReader; |
|
1028 resReader.SetBuffer( dataBuffer ); |
|
1029 |
|
1030 // Reads a string with memory allocation |
|
1031 iSatAppName = resReader.ReadHBufCL(); |
|
1032 iSatBipName.Copy( SatAppName() ); |
|
1033 |
|
1034 // dataBuffer |
|
1035 CleanupStack::PopAndDestroy( dataBuffer ); |
|
1036 // resFile, Calls resFile.Close() |
|
1037 // fs, Calls fs.Close |
|
1038 CleanupStack::PopAndDestroy( KCreateSatAppNamePop ); |
|
1039 |
|
1040 LOG( NORMAL, "SATENGINE: CSatCommandContainer::CreateSatAppNameL exiting" ) |
|
1041 } |
|
1042 |
|
1043 // ----------------------------------------------------------------------------- |
|
1044 // CSatCommandContainer::CreateAndGetBIPUtilsL |
|
1045 // (other items were commented in a header). |
|
1046 // ----------------------------------------------------------------------------- |
|
1047 // |
|
1048 CSatBIPUtils* CSatCommandContainer::CreateAndGetBIPUtils() |
|
1049 { |
|
1050 LOG( NORMAL, |
|
1051 "SATENGINE: CSatCommandContainer::CreateAndGetBIPUtils calling" ) |
|
1052 // If pointer is null, create new |
|
1053 if ( !iBipUtils ) |
|
1054 { |
|
1055 LOG( NORMAL, "SATENGINE: CSatCommandContainer::CreateAndGetBIPUtilsL \ |
|
1056 Creating BIP Utils" ) |
|
1057 // TRAP this, We will panic, if this is NULL |
|
1058 TInt err( KErrNone ); |
|
1059 TRAP( err, iBipUtils = CSatBIPUtils::NewL( *this ) ); |
|
1060 LOG2( NORMAL, "SATENGINE: CSatCommandContainer::\ |
|
1061 CreateAndGetBIPUtilsL BIP Utils creation status: %i", err ) |
|
1062 } |
|
1063 |
|
1064 __ASSERT_ALWAYS( iBipUtils, PanicSatEngine( ESatEngineNullPointer ) ); |
|
1065 |
|
1066 LOG( NORMAL, |
|
1067 "SATENGINE: CSatCommandContainer::CreateAndGetBIPUtils exiting" ) |
|
1068 return iBipUtils; |
|
1069 } |
|
1070 |
|
1071 // ----------------------------------------------------------------------------- |
|
1072 // CSatCommandContainer::CreateAndGetMediatorEventProvider |
|
1073 // (other items were commented in a header). |
|
1074 // ----------------------------------------------------------------------------- |
|
1075 // |
|
1076 CSatMediatorEventProvider* CSatCommandContainer:: |
|
1077 CreateAndGetSatMediatorEventProvider() |
|
1078 { |
|
1079 LOG( NORMAL, |
|
1080 "SATENGINE: CSatCommandContainer::CreateAndGetSatMediatorEventProvider \ |
|
1081 calling" ) |
|
1082 |
|
1083 // If pointer is null, create new |
|
1084 if ( !iSatMediatorEvent ) |
|
1085 { |
|
1086 LOG( NORMAL, "SATENGINE: CSatCommandContainer::\ |
|
1087 CreateAndGetSatMediatorEventProvider \ |
|
1088 Creating CreateAndGetSatMediatorEventProvider" ) |
|
1089 // TRAP this, We will panic, if this is NULL |
|
1090 TInt err( KErrNone ); |
|
1091 TRAP( err, iSatMediatorEvent = CSatMediatorEventProvider::NewL() ); |
|
1092 LOG2( NORMAL, "SATENGINE: CSatCommandContainer::\ |
|
1093 CreateAndGetCSatMediatorEventProvider status: %i", err ) |
|
1094 } |
|
1095 |
|
1096 __ASSERT_ALWAYS( |
|
1097 iSatMediatorEvent, PanicSatEngine( ESatEngineNullPointer ) ); |
|
1098 |
|
1099 LOG( NORMAL, |
|
1100 "SATENGINE: CSatCommandContainer::CreateAndGetSatMediatorEventProvider \ |
|
1101 exiting" ) |
|
1102 return iSatMediatorEvent; |
|
1103 } |
|
1104 |
|
1105 // ----------------------------------------------------------------------------- |
|
1106 // CSatCommandContainer::StartImportantCommandHandlersL |
|
1107 // (other items were commented in a header). |
|
1108 // ----------------------------------------------------------------------------- |
|
1109 // |
|
1110 void CSatCommandContainer::StartImportantCommandHandlersL() |
|
1111 { |
|
1112 LOG( NORMAL, "SATENGINE: CSatCommandContainer::\ |
|
1113 StartImportantCommandHandlersL calling" ) |
|
1114 |
|
1115 // Create command handlers. |
|
1116 RImplInfoPtrArray satCommandImplementations; |
|
1117 CleanupStack::PushL( |
|
1118 TCleanupItem( CleanupPointerArray, &satCommandImplementations ) ); |
|
1119 REComSession::ListImplementationsL( KSatInterfaceDefinitionUid, |
|
1120 satCommandImplementations ); |
|
1121 |
|
1122 // Container for commands |
|
1123 const TInt cmdCount( satCommandImplementations.Count() ); |
|
1124 LOG2( NORMAL, "SATENGINE: CSatCommandContainer::\ |
|
1125 StartImportantCommandHandlersL Command handler count: %d", cmdCount ) |
|
1126 |
|
1127 // Check are there any command implementations |
|
1128 if ( cmdCount > 0 ) |
|
1129 { |
|
1130 iCmdHandlers |
|
1131 = new ( ELeave ) CArrayPtrFlat<CSatCommandHandler>( cmdCount ); |
|
1132 |
|
1133 CSatCommandHandler* setUpEventListCmd = NULL; |
|
1134 // Add all important command handlers to list. |
|
1135 |
|
1136 // This will return KErrNotFound if the implementation is not included |
|
1137 // in configurations |
|
1138 TRAPD( err, setUpEventListCmd = |
|
1139 CSatCommandHandler::NewL( KSetUpEventListUid, this ) ); |
|
1140 |
|
1141 // Check does the command exist. |
|
1142 if ( setUpEventListCmd && KErrNone == err ) |
|
1143 { |
|
1144 LOG( NORMAL, "SATENGINE: CSatCommandContainer::\ |
|
1145 StartImportantCommandHandlersL KErrNone == err" ) |
|
1146 setUpEventListCmd->Start(); |
|
1147 CleanupStack::PushL( setUpEventListCmd ); |
|
1148 iCmdHandlers->AppendL( setUpEventListCmd ); |
|
1149 CleanupStack::Pop( setUpEventListCmd ); |
|
1150 } |
|
1151 } |
|
1152 |
|
1153 CleanupStack::PopAndDestroy( &satCommandImplementations ); |
|
1154 LOG( NORMAL, "SATENGINE: CSatCommandContainer::\ |
|
1155 StartImportantCommandHandlersL exiting" ) |
|
1156 } |
|
1157 |
|
1158 // ----------------------------------------------------------------------------- |
|
1159 // CSatCommandContainer::CheckStartupState |
|
1160 // (other items were commented in a header). |
|
1161 // ----------------------------------------------------------------------------- |
|
1162 // |
|
1163 void CSatCommandContainer::CheckStartupState( const TInt aValue ) |
|
1164 { |
|
1165 LOG2( NORMAL, "SATENGINE: CSatCommandContainer::CheckStartupState calling\ |
|
1166 with value %d", aValue ) |
|
1167 if ( ESwStateNormalRfOn == aValue ) |
|
1168 { |
|
1169 TRAP_IGNORE( StartCommandHandlersL() ) |
|
1170 iStartupChangeObserver->CancelNotify(); |
|
1171 // Startup phase is over |
|
1172 iStartupPhase = EFalse; |
|
1173 } |
|
1174 LOG( NORMAL, "SATENGINE: CSatCommandContainer::CheckStartupState exiting" ) |
|
1175 } |
|
1176 |
|
1177 // End Of File |
|