|
1 /* |
|
2 * Copyright (c) 2005-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 #ifndef C_CSATCOMMANDCONTAINER_H |
|
21 #define C_CSATCOMMANDCONTAINER_H |
|
22 |
|
23 |
|
24 #include <e32base.h> |
|
25 #include "MSatUtils.h" |
|
26 #include "TSatEventMediator.h" |
|
27 #include "MSatEventObserver.h" |
|
28 #include "MSatSystemStateObserver.h" |
|
29 #include "CSatCommandHandler.h" |
|
30 |
|
31 |
|
32 class TUSatAPI; |
|
33 class MSatSSessions; |
|
34 class MSatShellController; |
|
35 class MSatSystemState; |
|
36 class MSatSUiClientHandler; |
|
37 class CSatEventMonitorContainer; |
|
38 class MSatSSimSubscriberId; |
|
39 class CSatSAPChangeObserver; |
|
40 class CSatBIPUtils; |
|
41 class CSatMediatorEventProvider; |
|
42 class CSatProfileChangeObserver; |
|
43 class CSatMultiModeApi; |
|
44 class MSatSystemStateChangeNotifier; |
|
45 |
|
46 const TInt KSatMaxBipApnName = 50; |
|
47 |
|
48 |
|
49 /** |
|
50 * Contains SAT commands and offers accessor API for |
|
51 * command handlers. |
|
52 * |
|
53 * @lib SatEngine.lib |
|
54 * @since Series 60 3.0 |
|
55 */ |
|
56 class CSatCommandContainer : public CBase, |
|
57 public MSatUtils, |
|
58 public MSatEventObserver, |
|
59 public MSatSystemStateObserver |
|
60 { |
|
61 public: // Constructors and destructor |
|
62 |
|
63 /** |
|
64 * Two-phased constructor. |
|
65 * @param aSessions Accessor for sessions |
|
66 * @param aEventMediator Event handler class |
|
67 * @param aSatUiHandler UI Client handler class |
|
68 */ |
|
69 static CSatCommandContainer* NewL( |
|
70 MSatSSessions& aSessions, |
|
71 TSatEventMediator& aEventMediator, |
|
72 MSatSUiClientHandler& aSatUiHandler ); |
|
73 |
|
74 virtual ~CSatCommandContainer(); |
|
75 |
|
76 /** |
|
77 * Starts command handlers. |
|
78 * |
|
79 * @since S60 v3.0 |
|
80 */ |
|
81 void StartCommandHandlersL(); |
|
82 |
|
83 /** |
|
84 * Stops command handlers. |
|
85 * |
|
86 * @since S60 v3.0 |
|
87 */ |
|
88 void StopCommandHandlers(); |
|
89 |
|
90 // from MSatEventObserver |
|
91 |
|
92 /** |
|
93 * From MSatEventObserver. |
|
94 * Event notification. |
|
95 * |
|
96 * @since S60 v3.0 |
|
97 * @param aEvent An event that has been notified by TSatEventMediator |
|
98 */ |
|
99 void Event( TInt aEvent ); |
|
100 |
|
101 /** |
|
102 * From MSatEventObserver. |
|
103 * Sends UI Event Notification if UI session has found |
|
104 * |
|
105 * @since S60 v3.1 |
|
106 * @param aEvenId, identifies the event |
|
107 * @param aEventStatus, status of the event |
|
108 * @param aEventError, possible error value |
|
109 */ |
|
110 void NotifyUiEvent( |
|
111 TInt aEventId, |
|
112 TInt aEventStatus, |
|
113 TInt aEventError ); |
|
114 |
|
115 // from MSatUtils |
|
116 /** |
|
117 * From MSatUtils. |
|
118 * Gives USAT API wrapper. |
|
119 * |
|
120 * @since S60 v3.0 |
|
121 * @return USAT API wrapper reference |
|
122 */ |
|
123 MSatApi& USatAPI(); |
|
124 |
|
125 /** |
|
126 * From MSatUtils. |
|
127 * Gives reference to system state. |
|
128 * |
|
129 * @since S60 v3.0 |
|
130 * @return SAT System state API reference |
|
131 */ |
|
132 MSatSystemState& SystemState(); |
|
133 |
|
134 /** |
|
135 * From MSatUtils. |
|
136 * Gives pointer to MSatSUiClientHandler |
|
137 * |
|
138 * @since S60 v3.0 |
|
139 * @return SAT UI handler API reference |
|
140 */ |
|
141 MSatSUiClientHandler& SatUiHandler(); |
|
142 |
|
143 /** |
|
144 * From MSatUtils. |
|
145 * Registers observer for event. Same observer will not |
|
146 * be added more than once for one event. |
|
147 * |
|
148 * @since S60 v3.0 |
|
149 * @param aObserver Pointer of observer instance. Panic will occur if |
|
150 * aObserver is NULL. |
|
151 * @param aEvent Event, which will cause the notification of observer. |
|
152 */ |
|
153 void RegisterL( |
|
154 MSatEventObserver* aObserver, |
|
155 TSatEvent aEvent ); |
|
156 |
|
157 /** |
|
158 * From MSatUtils. |
|
159 * Notifies all the listeners who are listening for aEvent. |
|
160 * |
|
161 * @since S60 v3.0 |
|
162 * @param aEvent Event to be notified. |
|
163 */ |
|
164 void NotifyEvent( TSatEvent aEvent ); |
|
165 |
|
166 /** |
|
167 * From MSatUtils. |
|
168 * Unregisteres the event notification. |
|
169 * |
|
170 * @since S60 v3.0 |
|
171 * @param aObserver An event observer that is unregistering event |
|
172 * @param aEvent An event that is unregistered from aObserver parameter |
|
173 */ |
|
174 void UnregisterEvent( |
|
175 MSatEventObserver* aObserver, |
|
176 TSatEvent aEvent ); |
|
177 |
|
178 /** |
|
179 * From MSatUtils. |
|
180 * Removes observer from event observers |
|
181 * |
|
182 * @since S60 v3.0 |
|
183 * @param aObserver Observer to removed |
|
184 */ |
|
185 void UnregisterEventObserver( MSatEventObserver* aObserver ); |
|
186 |
|
187 /** |
|
188 * From MSatUtils. |
|
189 * Number of executing commands. |
|
190 * |
|
191 * @since S60 v3.0 |
|
192 * @return Number of currently executing command handlers |
|
193 */ |
|
194 TInt NumberOfExecutingCommandHandlers(); |
|
195 |
|
196 /** |
|
197 * From MSatUtils. |
|
198 * Gets the sim application name. |
|
199 * |
|
200 * @since S60 v3.0 |
|
201 * @return SAT Application name |
|
202 */ |
|
203 const TDesC& SatAppName() const; |
|
204 |
|
205 /** |
|
206 * From MSatUtils. |
|
207 * Gets the name for the APN. |
|
208 * |
|
209 * @since S60 v3.0 |
|
210 * @return BIP Apn name |
|
211 */ |
|
212 const TDesC& BipApnName() const; |
|
213 |
|
214 /** |
|
215 * From MSatUtils. |
|
216 * Restores default SIM Application name. |
|
217 * |
|
218 * @since S60 v3.1 |
|
219 */ |
|
220 void RestoreSatAppNameL(); |
|
221 |
|
222 /** |
|
223 * From MSatUtils. |
|
224 * Sets the sim application name. |
|
225 * |
|
226 * @since S60 v3.0 |
|
227 * @param aName New name of Sat application |
|
228 */ |
|
229 void SetSatAppNameL( const TDesC& aName ); |
|
230 |
|
231 /** |
|
232 * From MSatUtils |
|
233 * Gets an array of refresh subsessions |
|
234 * |
|
235 * @since S60 v3.0 |
|
236 * @return Pointer array containing refresh subsessions |
|
237 */ |
|
238 const RPointerArray<MSatRefreshSubSession>& RefreshSubSessions(); |
|
239 |
|
240 /** |
|
241 * From MSatUtils. |
|
242 * Registers new service request handler |
|
243 * |
|
244 * @since S60 v3.0 |
|
245 * @param aRequest A Request this service request listens |
|
246 * @param aResponse A Response for this service request |
|
247 * @param aCommand A Command handler for request |
|
248 */ |
|
249 void RegisterServiceRequestL( |
|
250 TSatServerRequest aRequest, |
|
251 TSatServerRequest aResponse, |
|
252 MSatCommand* aCommand ); |
|
253 |
|
254 /** |
|
255 * From MSatUtils Gets all registered service requests |
|
256 * |
|
257 * @since S60 v3.0 |
|
258 * @return Pointer array of registered Client Service requests |
|
259 */ |
|
260 CArrayPtrFlat<CSatClientServiceReq>* ServiceRequests(); |
|
261 |
|
262 /** |
|
263 * From MSatUtils. |
|
264 * Gives pointer to event monitor container |
|
265 * |
|
266 * @since S60 v3.0 |
|
267 * @return Pointer to MSatEventMonitorContainer API |
|
268 */ |
|
269 MSatEventMonitorContainer* EventMonitors(); |
|
270 |
|
271 /** |
|
272 * From MSatUtils. |
|
273 * Gives reference to subscriber id. |
|
274 * |
|
275 * @since S60 v3.0 |
|
276 * @return SIM subscriber id API reference. |
|
277 */ |
|
278 MSatSSimSubscriberId& SimSubscriberId(); |
|
279 |
|
280 /** |
|
281 * From MSatUtils. |
|
282 * Gives reference to BIP Utils interface. |
|
283 * |
|
284 * @since S60 v3.0 |
|
285 * @return Reference to BIP Utils interface. |
|
286 */ |
|
287 MSatBIPUtils& BipUtils(); |
|
288 |
|
289 /** |
|
290 * From MSatUtils. |
|
291 * Gives reference to BIP Event notifier interface. |
|
292 * |
|
293 * @since S60 v3.0 |
|
294 * @return Reference to BIP Event notifier interface. |
|
295 */ |
|
296 MSatBIPEventNotifier& BipEventNotifier(); |
|
297 |
|
298 /** |
|
299 * Gives reference to MSatMultiModeApi |
|
300 * |
|
301 * @since S60 v5.0 |
|
302 * @return Reference to MSatMultiModeApi |
|
303 */ |
|
304 MSatMultiModeApi& MultiModeApi() ; |
|
305 |
|
306 /** |
|
307 * From MSatUtils. |
|
308 * Gives reference to active RMmCustomApi session |
|
309 * |
|
310 * @since S60 v3.1 |
|
311 * @return Reference to active RMmCustomApi server session |
|
312 */ |
|
313 RMmCustomAPI* CustomApi(); |
|
314 |
|
315 /** |
|
316 * From MSatUtils. |
|
317 * Raises SAT Mediator event |
|
318 * |
|
319 * @since S60 v3.1 |
|
320 * @param aData event data to Mediator Event consumer. |
|
321 * @return KErrNone or error code. |
|
322 */ |
|
323 TInt RaiseSatEvent( const TDesC8& aData ); |
|
324 |
|
325 /** |
|
326 * From MSatUtils. |
|
327 * Checks if Cover UI is supported by SAT |
|
328 * |
|
329 * @since S60 v3.1 |
|
330 * @return ETrue if Cover UI is supported. |
|
331 */ |
|
332 TBool CoverUiSupported(); |
|
333 |
|
334 /** |
|
335 * From MSatUtils. |
|
336 * Gives pointer to MSatAsyncToSync interface. |
|
337 * |
|
338 * @since S60 v5.0.1 |
|
339 * @return a MSatAsyncToSync Pointer to CreateAsyncToSyncHelper object. |
|
340 */ |
|
341 MSatAsyncToSync* CreateAsyncToSyncHelper(); |
|
342 |
|
343 // from MSatSystemStateObserver |
|
344 |
|
345 /** |
|
346 * Notifies that system state changed. |
|
347 * @param aValue The new value that has changed. |
|
348 * |
|
349 * @since S60 v3.1 |
|
350 */ |
|
351 void StateChanged( const TInt aValue ); |
|
352 |
|
353 private: |
|
354 |
|
355 /** |
|
356 * Private Constructor |
|
357 * |
|
358 * @since S60 v3.0 |
|
359 * @param aSessions Accessor for sessions |
|
360 * @param aEventMediator Event handler class |
|
361 * @param aSatUiHandler UI Client handler class |
|
362 */ |
|
363 CSatCommandContainer( MSatSSessions& aSessions, |
|
364 TSatEventMediator& aEventMediator, |
|
365 MSatSUiClientHandler& aSatUiHandler ); |
|
366 |
|
367 void ConstructL(); |
|
368 |
|
369 /** |
|
370 * Reads sat application name from the resource. |
|
371 * |
|
372 * @since S60 v3.0 |
|
373 * @param aResourceId Selects name of the item to be read. |
|
374 */ |
|
375 void CreateSatAppNameL( const TInt aResourceId ); |
|
376 |
|
377 /** |
|
378 * Gives pointer to BIP Utils class. |
|
379 * |
|
380 * @since S60 v3.0 |
|
381 * @return Pointer to BIP Utils class. |
|
382 */ |
|
383 CSatBIPUtils* CreateAndGetBIPUtils(); |
|
384 |
|
385 /** |
|
386 * Gives pointer to SatMediatorEventProvider class. |
|
387 * |
|
388 * @since S60 v3.1 |
|
389 * @return Pointer to SatMediatorEventProvider class. |
|
390 */ |
|
391 CSatMediatorEventProvider* CreateAndGetSatMediatorEventProvider(); |
|
392 |
|
393 /** |
|
394 * Starts command handlers. |
|
395 * |
|
396 * @since S60 v3.1 |
|
397 */ |
|
398 void StartImportantCommandHandlersL(); |
|
399 |
|
400 /** |
|
401 * Checks current startup state and starts rest of command handlers. |
|
402 * @param aValue Current startup state to check. |
|
403 * |
|
404 * @since S60 v3.1 |
|
405 */ |
|
406 void CheckStartupState( const TInt aValue ); |
|
407 |
|
408 private: // Data |
|
409 |
|
410 /** |
|
411 * Default name of the SAT Application, used when creating new APN |
|
412 */ |
|
413 TBuf<KSatMaxBipApnName> iSatBipName; |
|
414 |
|
415 /** |
|
416 * Indicates special SIM to be currently used, |
|
417 */ |
|
418 TBool iIsCmccSim; |
|
419 |
|
420 |
|
421 /** |
|
422 * Access the encapsuled ETel MM api by CSatMultiModeApi |
|
423 * Own |
|
424 */ |
|
425 CSatMultiModeApi* iMultiModeApi; |
|
426 |
|
427 /** |
|
428 * Accessor for sessions. |
|
429 */ |
|
430 MSatSSessions& iSessions; |
|
431 |
|
432 /** |
|
433 * Event mediator. |
|
434 */ |
|
435 TSatEventMediator& iEventMediator; |
|
436 |
|
437 /** |
|
438 * UI Client handler API reference. |
|
439 */ |
|
440 MSatSUiClientHandler& iSatUiHandler; |
|
441 |
|
442 /** |
|
443 * USat api. |
|
444 * Own. |
|
445 */ |
|
446 TUSatAPI* iUSatAPI; |
|
447 |
|
448 /** |
|
449 * Command handlers. |
|
450 * Own. |
|
451 */ |
|
452 CArrayPtrFlat<CSatCommandHandler>* iCmdHandlers; |
|
453 |
|
454 /** |
|
455 * Registered Client request handlers. |
|
456 * Own. |
|
457 */ |
|
458 CArrayPtrFlat<CSatClientServiceReq>* iServiceReqs; |
|
459 |
|
460 /** |
|
461 * Name of the Sat application. |
|
462 * Own. |
|
463 */ |
|
464 HBufC* iSatAppName; |
|
465 |
|
466 /** |
|
467 * System state interface. |
|
468 * Own. |
|
469 */ |
|
470 MSatSystemState* iSystemState; |
|
471 |
|
472 /** |
|
473 * Event monitor container interface |
|
474 * Own. |
|
475 */ |
|
476 CSatEventMonitorContainer* iEventMonitors; |
|
477 |
|
478 /** |
|
479 * SAP change observer / notifier |
|
480 * Own. |
|
481 */ |
|
482 CSatSAPChangeObserver* iSapObserver; |
|
483 |
|
484 /** |
|
485 * Subscriber id interface. |
|
486 * Own. |
|
487 */ |
|
488 MSatSSimSubscriberId* iSimSubscriberId; |
|
489 |
|
490 /** |
|
491 * BIP Utils class |
|
492 * Own. |
|
493 */ |
|
494 CSatBIPUtils* iBipUtils; |
|
495 |
|
496 /** |
|
497 * pointer to SAT Mediator event provider |
|
498 * Own. |
|
499 */ |
|
500 CSatMediatorEventProvider* iSatMediatorEvent; |
|
501 |
|
502 /** |
|
503 * Pointer to Profile state observer |
|
504 * Own. |
|
505 */ |
|
506 CSatProfileChangeObserver* iProfileObserver; |
|
507 |
|
508 /** |
|
509 * Boolean indicating is Startup ongoing |
|
510 */ |
|
511 TBool iStartupPhase; |
|
512 |
|
513 /** |
|
514 * Pointer to startup change observer |
|
515 */ |
|
516 MSatSystemStateChangeNotifier* iStartupChangeObserver; |
|
517 |
|
518 }; |
|
519 |
|
520 #endif // C_CSATCOMMANDCONTAINER_H |