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