|
1 /* |
|
2 * ========================================================================== |
|
3 * Name : lcvtsession.h |
|
4 * Description : |
|
5 * Version : |
|
6 * |
|
7 * Copyright ?2005 Nokia Corporation. |
|
8 * This material, including documentation and any related |
|
9 * computer programs, is protected by copyright controlled by |
|
10 * Nokia Corporation. All rights are reserved. Copying, |
|
11 * including reproducing, storing, adapting or translating, any |
|
12 * or all of this material requires the prior written consent of |
|
13 * Nokia Corporation. This material also contains confidential |
|
14 * information which may not be disclosed to others without the |
|
15 * prior written consent of Nokia Corporation. |
|
16 * ========================================================================== |
|
17 */ |
|
18 |
|
19 #ifndef LCVTSESSION_H |
|
20 #define LCVTSESSION_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <w32std.h> |
|
24 #include <f32file.h> |
|
25 #include <e32property.h> |
|
26 #include <UikonInternalPSKeys.h> |
|
27 #include <centralrepository.h> |
|
28 #include <settingsinternalcrkeys.h> |
|
29 #include <AknQueryDialog.h> |
|
30 #include <gdi.h> |
|
31 |
|
32 #include <lcsession.h> |
|
33 #include <lcaudiocontrol.h> |
|
34 #include <lcsessionobserver.h> |
|
35 #include <lcuiprovider.h> |
|
36 #include <lcengine.h> |
|
37 |
|
38 #include <cvtlogger.h> |
|
39 #include <mvtengeventobserver.h> |
|
40 #include <mvtengcommandobserver.h> |
|
41 #include <mvtengcommandhandler.h> |
|
42 #include <mvtengframeobserver.h> |
|
43 #include <mvtengaudio.h> |
|
44 #include <mvtengsessioninfo.h> |
|
45 #include <vtengevents.h> |
|
46 #include <mvtengmedia.h> |
|
47 |
|
48 #include <tvtengrendering.h> |
|
49 #include <tvtengrenderingdp.h> |
|
50 #include <tvtengrenderingnga.h> |
|
51 #include <tvtengrenderingdsa.h> |
|
52 |
|
53 |
|
54 #include "tlcvtcamerahandler.h" |
|
55 #include "clcvtactiveexec.h" |
|
56 #include "tlcvtstatebase.h" |
|
57 |
|
58 #define NGA_VIDEO_RENDER |
|
59 |
|
60 class CVtEngModel; |
|
61 class CLcVtLocalVideoPlayer; |
|
62 class CLcVtRemoteVideoPlayer; |
|
63 class TLcVtStates; |
|
64 class CLcVtCmdExecutor; |
|
65 |
|
66 |
|
67 class CLcVtSession : public CBase, |
|
68 public MLcSession, |
|
69 public MLcAudioControl, |
|
70 public MLcVtActiveExec, |
|
71 public MLcVtStateContext |
|
72 { |
|
73 public: |
|
74 |
|
75 static CLcVtSession* NewL(); |
|
76 |
|
77 ~CLcVtSession(); |
|
78 |
|
79 public: // From MLcSession |
|
80 |
|
81 TLcSessionState LcSessionState() const; |
|
82 |
|
83 void EstablishLcSessionL(); |
|
84 |
|
85 void TerminateLcSessionL(); |
|
86 |
|
87 void SetLcSessionObserver( MLcSessionObserver* aObserver ); |
|
88 |
|
89 void SetLcUiProvider( MLcUiProvider* aUiProvider ); |
|
90 |
|
91 TBool IsBackgroundStartup(); |
|
92 |
|
93 MLcVideoPlayer* RemoteVideoPlayer(); |
|
94 |
|
95 MLcVideoPlayer* LocalVideoPlayer(); |
|
96 |
|
97 const TDesC& LocalDisplayName(); |
|
98 |
|
99 const TDesC& RemoteDisplayName(); |
|
100 |
|
101 TInt SetParameter( TInt aId, TInt aValue ); |
|
102 |
|
103 TInt ParameterValue( TInt aId ); |
|
104 |
|
105 TInt SetForegroundStatus( TBool aIsForeground ); |
|
106 |
|
107 const TDesC& RemoteDetails(); |
|
108 |
|
109 void UpdateLcSessionL(); |
|
110 |
|
111 TBool SendDialTone( TChar aKey ); |
|
112 |
|
113 public: // from MLcAudioControl |
|
114 |
|
115 TBool IsLcAudioMutedL(); |
|
116 |
|
117 void MuteLcAudioL( TBool aMute ); |
|
118 |
|
119 TBool IsLcMicMutedL(); |
|
120 |
|
121 void MuteLcMicL( TBool aMute ); |
|
122 |
|
123 TBool IsEnablingLcLoudspeakerAllowed(); |
|
124 |
|
125 void EnableLcLoudspeakerL( TBool aEnabled ); |
|
126 |
|
127 TBool IsLcLoudspeakerEnabled(); |
|
128 |
|
129 TInt LcVolumeL(); |
|
130 |
|
131 void SetLcVolumeL( TInt aValue ); |
|
132 |
|
133 void IncreaseLcVolumeL(); |
|
134 |
|
135 void DecreaseLcVolumeL(); |
|
136 |
|
137 public: //from MLcVtActiveExec |
|
138 /** |
|
139 * @see MLcVtActiveExec::ActiveExecExecuteL. |
|
140 */ |
|
141 TBool ActiveExecExecuteL( |
|
142 CLcVtActiveExec& aActiveExec, |
|
143 const TInt aState, |
|
144 TInt& aNextState, |
|
145 TRequestStatus& aRequest ); |
|
146 |
|
147 /** |
|
148 * @see MLcVtActiveExec::ActiveExecContinue. |
|
149 */ |
|
150 TBool ActiveExecContinue( |
|
151 CLcVtActiveExec& aActiveExec, |
|
152 TInt& aState, |
|
153 const TInt aError ); |
|
154 |
|
155 /** |
|
156 * @see MLcVtActiveExec::ActiveExecCancel. |
|
157 */ |
|
158 void ActiveExecCancel( |
|
159 CLcVtActiveExec& aActiveExec, |
|
160 const TInt aState ); |
|
161 |
|
162 /** |
|
163 * @see MLcVtActiveExec::ActiveExecDone. |
|
164 */ |
|
165 virtual void ActiveExecDone( |
|
166 CLcVtActiveExec& aActiveExec, |
|
167 const TInt aInitialState ); |
|
168 |
|
169 public: //new function |
|
170 /** |
|
171 * @see MLcVtActiveExec::ActiveExecExecuteL. |
|
172 */ |
|
173 TBool ActiveExecInitExecuteL( |
|
174 const TInt aState, |
|
175 TInt& aNextState, |
|
176 TRequestStatus& aRequest ); |
|
177 |
|
178 /** |
|
179 * @see MLcVtActiveExec::ActiveExecContinue. |
|
180 */ |
|
181 TBool ActiveExecInitContinue( |
|
182 TInt& aState, |
|
183 const TInt aError ); |
|
184 |
|
185 /** |
|
186 * @see MLcVtActiveExec::ActiveExecCancel. |
|
187 */ |
|
188 void ActiveExecInitCancel( |
|
189 const TInt aState ); |
|
190 |
|
191 /** |
|
192 * @see MLcVtActiveExec::ActiveExecDone. |
|
193 */ |
|
194 void ActiveExecInitDone( |
|
195 const TInt aInitialState ); |
|
196 |
|
197 /** |
|
198 * Executes command taking no parameters. |
|
199 * @param aCommand command to be performed. |
|
200 * @param aRequest request status. |
|
201 */ |
|
202 void ActiveExecInitExecuteCommandL( |
|
203 const TVtEngCommandId aCommand, |
|
204 TRequestStatus& aRequest ); |
|
205 |
|
206 /** |
|
207 * Executes command taking no parameters. |
|
208 * @param aCommand command to be performed. |
|
209 * @param aParam command parameters. |
|
210 * @param aRequest request status. |
|
211 */ |
|
212 template < class T > |
|
213 void ActiveExecInitExecuteCommandL( |
|
214 const TVtEngCommandId aCommand, |
|
215 T& aParam, |
|
216 TRequestStatus& aRequest ); |
|
217 |
|
218 /** |
|
219 * Executes prepare viewfinder command. |
|
220 * @param aRequest request status to be completed when finished. |
|
221 */ |
|
222 void ActiveExecInitPrepareViewFinderL( |
|
223 TRequestStatus& aRequest ); |
|
224 |
|
225 /** |
|
226 * Executes prepare remote render command. |
|
227 * @param aRequest request status to be completed when finished. |
|
228 */ |
|
229 void ActiveExecInitPrepareRemoteRenderL( |
|
230 TRequestStatus& aRequest ); |
|
231 |
|
232 /** |
|
233 * Executes 'prepare camera' command. |
|
234 * @param aSource source to be prepared. |
|
235 * @param aRequest request status. |
|
236 */ |
|
237 void ActiveExecInitPrepareCameraL( |
|
238 const MVtEngMedia::TMediaSource aSource, |
|
239 TRequestStatus& aRequest ); |
|
240 |
|
241 /** |
|
242 * Executes 'set source' command. |
|
243 * @param aSource source to be selected. |
|
244 * @param aRequest request status. |
|
245 */ |
|
246 void ActiveExecInitSetSourceL( |
|
247 const MVtEngMedia::TMediaSource aSource, |
|
248 TRequestStatus& aRequest ); |
|
249 |
|
250 /** |
|
251 * Performs a command without any parameters. |
|
252 * @param aCommand command to be performed. |
|
253 */ |
|
254 void ExecuteCmdL( const TVtEngCommandId aCommand ); |
|
255 |
|
256 /** |
|
257 * Performs a command with a parameter. |
|
258 * @param aCommmand command to be performed. |
|
259 * @param aParam parameter. |
|
260 */ |
|
261 template< class T > |
|
262 void ExecuteCmdL( |
|
263 const TVtEngCommandId aCommand, |
|
264 T& aParam ); |
|
265 |
|
266 // ASYNCHRONOUS EXECUTION: |
|
267 |
|
268 /** |
|
269 * Performs a command without any parameters. |
|
270 * @param aExecutorPtr pointer to which returned value is stored. |
|
271 * @param aCommand command to be performed. |
|
272 * @param aStatus request status. |
|
273 * @return dialog. |
|
274 */ |
|
275 CLcVtCmdExecutor* ExecuteCmdAsyncL( |
|
276 CLcVtCmdExecutor** aExecutorPtr, |
|
277 const TVtEngCommandId aCommand, |
|
278 TRequestStatus& aStatus ); |
|
279 |
|
280 /** |
|
281 * Performs a command with a parameter. |
|
282 * @param aExecutorPtr pointer to which returned value is stored. |
|
283 * @param aCommmand command to be performed. |
|
284 * @param aParam parameter. |
|
285 * @param aStatus request status. |
|
286 * @return dialog. |
|
287 */ |
|
288 template< class T > |
|
289 CLcVtCmdExecutor* ExecuteCmdAsyncL( |
|
290 CLcVtCmdExecutor** aExecutorPtr, |
|
291 const TVtEngCommandId aCommand, |
|
292 T& aParam, |
|
293 TRequestStatus& aStatus ); |
|
294 |
|
295 /** |
|
296 * Performs a command. |
|
297 * @param aExecutorPtr pointer to which returned value is stored. |
|
298 * @param aCommand command. |
|
299 * @param aParams parameter, optional. |
|
300 * @param aStatus request status. |
|
301 * @return dialog. |
|
302 */ |
|
303 CLcVtCmdExecutor* DoExecuteCmdAsyncL( |
|
304 CLcVtCmdExecutor** aExecutorPtr, |
|
305 const TVtEngCommandId aCommand, |
|
306 TDesC8* aParams, |
|
307 TRequestStatus& aStatus ); |
|
308 |
|
309 /** |
|
310 * Executes command in TRAP harnness. |
|
311 * @param aCommand command identifier. |
|
312 * @param aParam optional, parameters. |
|
313 * @return error code. |
|
314 */ |
|
315 TInt Execute( const TVtEngCommandId aCommand, TDesC8* aParam ); |
|
316 |
|
317 /** |
|
318 * Handles layout changes basically calling HandleLayoutChangedL |
|
319 * in trap harness. |
|
320 * @return error code. |
|
321 */ |
|
322 //TInt HandleLayoutChanged(); |
|
323 |
|
324 /** |
|
325 * Handles layout changes. |
|
326 */ |
|
327 void HandleLayoutChangedL(); |
|
328 |
|
329 public: //from MLcVtStateContext |
|
330 |
|
331 /** @see MLcVtStateContext::StartupPhase1L */ |
|
332 void StartupPhase1L(); |
|
333 |
|
334 /** @see MLcVtStateContext::ShutdownL */ |
|
335 void ShutdownL(); |
|
336 |
|
337 /** @see MLcVtStateContext::StartupPhase2L */ |
|
338 void StartupPhase2L(); |
|
339 |
|
340 /** @see MLcVtStateContext::ChangeApplicationFocus */ |
|
341 void ChangeApplicationFocus( const TBool aForeground ); |
|
342 |
|
343 /** @see MLcVtStateContext::ChangeState */ |
|
344 void ChangeState( TLcVtStateBase* aState ); |
|
345 |
|
346 /** @see MLcVtStateContext::StartTone */ |
|
347 //void StartDtmfTone( const TChar& aTone ); |
|
348 |
|
349 /** @see MLcVtStateContext::StopTone */ |
|
350 //void StopDtmfTone(); |
|
351 |
|
352 /** @see MLcVtStateContext::Model */ |
|
353 CVtEngModel& Model(); |
|
354 |
|
355 /** @see MLcVtStateContext::NumberSource*/ |
|
356 TDesC* NumberSource() const; |
|
357 |
|
358 /** @see MLcVtStateContext::RefreshL */ |
|
359 void RefreshL( const TInt aRefreshFlags ); |
|
360 |
|
361 /** @see MLcVtStateContext::RefreshStatesL */ |
|
362 void RefreshStatesL(); |
|
363 |
|
364 /** @see MLcVtStateContext::DoExecuteCmdL */ |
|
365 void DoExecuteCmdL( |
|
366 const TVtEngCommandId aCommand, |
|
367 TDesC8* aParams ); |
|
368 |
|
369 /** @see MLcVtStateContext::DoHandleLayoutChangedL */ |
|
370 void DoHandleLayoutChangedL(); |
|
371 |
|
372 /** From MLcVtShutterObserver via MLcVtStateContext |
|
373 * Exits the application. |
|
374 */ |
|
375 void HandleShutdownReady(); |
|
376 |
|
377 /** @see MLcVtStateContext::SetCallIdL */ |
|
378 void SetCallIdL( const TInt aCallId ); |
|
379 |
|
380 /** @see MLcVtStateContext::SetCallNameL */ |
|
381 TBool SetCallNameL( const TDesC& aName ); |
|
382 |
|
383 /** @see MLcVtStateContext::SetCallNumberL */ |
|
384 void SetCallNumberL( const TDesC& aNumber ); |
|
385 |
|
386 /** @see MLcVtStateContext::StartShutdown */ |
|
387 void StartShutdown(); |
|
388 |
|
389 public: //new functions |
|
390 |
|
391 /** |
|
392 * Static async callback for handling layout change. |
|
393 */ |
|
394 //static TInt DelayedHandleLayoutChanged( TAny* aPtr ); |
|
395 |
|
396 /** |
|
397 * Callback function to exit. |
|
398 * @param aAny pointer to instance of this class. |
|
399 * @return KErrNone always. |
|
400 */ |
|
401 static TInt DoExit( TAny* aAny ); |
|
402 |
|
403 /** |
|
404 * Close UI Application. |
|
405 */ |
|
406 void CloseApp(); |
|
407 |
|
408 /** |
|
409 * Handles engine reset. |
|
410 */ |
|
411 void HandleEngineResetL(); |
|
412 |
|
413 /** |
|
414 * Handle plugin command. |
|
415 */ |
|
416 void HandleCommandL(const TInt acommand); |
|
417 |
|
418 /** |
|
419 * Sets given zoom step, if it allowed. |
|
420 * @param aZoomStep New zoom step to be set. |
|
421 */ |
|
422 void SetZoomFactorL( TInt aZoomStep ); |
|
423 |
|
424 /** |
|
425 * Updates rendering parameters. |
|
426 */ |
|
427 void UpdateRenderingParametersL(); |
|
428 |
|
429 inline TLcVtStates& LcVtStates(); |
|
430 |
|
431 #ifndef NGA_VIDEO_RENDER |
|
432 void vtHandleFrameL( CFbsBitmap* aBitmap ); |
|
433 #endif |
|
434 TBool IsFeatureSupported( CLcEngine::TLcFeature aLcFeature ); |
|
435 |
|
436 |
|
437 private: |
|
438 CLcVtSession(); |
|
439 |
|
440 void ConstructL(); |
|
441 |
|
442 #ifndef NGA_VIDEO_RENDER |
|
443 /** |
|
444 * connect to font & bitmap server. |
|
445 */ |
|
446 void ConnectFbsServerL(); |
|
447 |
|
448 /** |
|
449 * disconnect from font & bitmap server. |
|
450 */ |
|
451 void DisconnectFbsServer(); |
|
452 #endif |
|
453 |
|
454 // COMMAND HANDLING |
|
455 |
|
456 /** |
|
457 * Enables audio (unmute microphone). |
|
458 */ |
|
459 void CmdEnableAudioL(); |
|
460 |
|
461 /** |
|
462 * Disables audio (mute microphone). |
|
463 */ |
|
464 void CmdDisableAudioL(); |
|
465 |
|
466 /** |
|
467 * Switches used camera. |
|
468 * @param aPrimaryCamera ETrue if primary camera is to be selected, |
|
469 * EFalse if secondary camera is to be selected. |
|
470 */ |
|
471 void CmdUseCameraL( const TBool aPrimaryCamera ); |
|
472 |
|
473 /** |
|
474 * Activates loudspeaker. |
|
475 */ |
|
476 void CmdActivateLoudspeakerL(); |
|
477 |
|
478 /** |
|
479 * Deactivates loudspeaker. |
|
480 */ |
|
481 void CmdDeactivateLoudspeakerL(); |
|
482 |
|
483 /** |
|
484 * Enables video. |
|
485 */ |
|
486 void CmdEnableVideoL(); |
|
487 |
|
488 /** |
|
489 * Disables video. |
|
490 */ |
|
491 void CmdDisableVideoL(); |
|
492 |
|
493 #ifdef NGA_VIDEO_RENDER |
|
494 void CreateVideoWindowsL(); |
|
495 void DestroyVideoWindows(); |
|
496 #endif |
|
497 |
|
498 private: |
|
499 class CEventObserver; |
|
500 |
|
501 private: |
|
502 #ifdef NGA_VIDEO_RENDER |
|
503 RWindow* iRemoteVideoWindow; |
|
504 RWindow* iLocalVideoWindow; |
|
505 #else |
|
506 CFbsBitmap* iDummy; |
|
507 CWindowGc* iGc; |
|
508 TBool iFbsStarted; |
|
509 RWsSession* iWsSession; |
|
510 CWsScreenDevice* iWsSessionScreenDev; |
|
511 RWindowGroup *iRootWin; |
|
512 #endif |
|
513 // Owned event observer. |
|
514 CEventObserver* iEventObserver; |
|
515 // Engine model. |
|
516 CVtEngModel* iModel; |
|
517 // plugin states (media, audio, boolean variables) |
|
518 TLcVtStates* iLcVtStates; |
|
519 |
|
520 TVtCameraHandler iCameraHandler; |
|
521 CLcVtLocalVideoPlayer* iLocalVideoPlayer; |
|
522 CLcVtRemoteVideoPlayer* iRemoteVideoPlayer; |
|
523 |
|
524 MLcSessionObserver* iObserver; |
|
525 MLcUiProvider* iUiProvider; |
|
526 |
|
527 TLcSessionState iSessionState; |
|
528 |
|
529 // Owned active executor for initialisation / uninitialisation. |
|
530 CLcVtActiveExec* iActiveExec; |
|
531 |
|
532 CLcVtCmdExecutor* iCmdExecutor; |
|
533 |
|
534 // Reference to request status. |
|
535 TRequestStatus* iShutdownRequest; |
|
536 |
|
537 TLcVtStateBase* iState; |
|
538 |
|
539 // ASync callback. |
|
540 CAsyncCallBack* iAsyncCallback; |
|
541 |
|
542 // Async callback for layout change |
|
543 //CAsyncCallBack* iLayoutChangeCallback; |
|
544 |
|
545 // DTMF tone, used as parameter to KVtEngStartDtmfTone. |
|
546 TPckgBuf< TChar > iDtmfTone; |
|
547 |
|
548 TBool iLoudspeakerEnabled; |
|
549 TBool iMute; |
|
550 |
|
551 RWindow* iMainWindow; |
|
552 |
|
553 RWsSession iRwSession; |
|
554 RWindowGroup* iRwGroup; |
|
555 CWsScreenDevice* iDev; |
|
556 |
|
557 HBufC* iRemoteDisplayName; |
|
558 HBufC* iRemoteDetails; |
|
559 |
|
560 }; |
|
561 |
|
562 |
|
563 TLcVtStates& CLcVtSession::LcVtStates() |
|
564 { |
|
565 return *iLcVtStates; |
|
566 } |
|
567 #endif // LCVTSESSION_H |
|
568 |
|
569 // end of file |