|
1 /* |
|
2 * Copyright (c) 2005 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: Implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include <mcedefs.h> |
|
22 #include "CMCETestUIEngineMultimediaObserver.h" |
|
23 #include "TMCETestUIEngineCmdAcceptSession.h" |
|
24 #include "CMCETestUIEngineSession.h" |
|
25 #include "CMCETestUIEngineInSession.h" |
|
26 #include "CMCETestUIEngine.h" |
|
27 |
|
28 #include "CMCETestUIEngineInSession.h" |
|
29 #include "CMCETestUIEngineOutSession.h" |
|
30 #include "CMCETestUIEngineSession.h" |
|
31 #include "CMCETestUIEngineAudioStream.h" |
|
32 #include "MCETestUIEngineConstants.h" |
|
33 #include "TMCETestUIEngineCmdAnswerSession.h" |
|
34 #include "mcetransactiondatacontainer.h" |
|
35 |
|
36 #include <MCEInSession.h> |
|
37 #include <MCEAudioStream.h> |
|
38 #include <MCESpeakerSink.h> |
|
39 |
|
40 #include <MCERtpSource.h> |
|
41 #include <MCEMicSource.h> |
|
42 #include <MCEFileSource.h> |
|
43 #include <MCEMediaSource.h> |
|
44 #include <e32err.h> |
|
45 #include <e32debug.h> |
|
46 |
|
47 #include "MCETestUIDebug.h" |
|
48 |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CMCETestUIEngineMultimediaObserver::NewL |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CMCETestUIEngineMultimediaObserver* CMCETestUIEngineMultimediaObserver::NewL( |
|
55 CMCETestUIEngine& aEngine ) |
|
56 { |
|
57 CMCETestUIEngineMultimediaObserver* self = |
|
58 new (ELeave) CMCETestUIEngineMultimediaObserver( aEngine ); |
|
59 |
|
60 CleanupStack::PushL( self ); |
|
61 self->ConstructL(); |
|
62 CleanupStack::Pop( self ); |
|
63 |
|
64 return self; |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CMCETestUIEngineMultimediaObserver::CMCETestUIEngineMultimediaObserver |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 CMCETestUIEngineMultimediaObserver::CMCETestUIEngineMultimediaObserver( |
|
72 CMCETestUIEngine& aEngine): |
|
73 iEngine( aEngine ) |
|
74 { |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CMCETestUIEngineMultimediaObserver::ConstructL |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 void CMCETestUIEngineMultimediaObserver::ConstructL() |
|
82 { |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CMCETestUIEngineMultimediaObserver::~CMCETestUIEngineMultimediaObserver |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 CMCETestUIEngineMultimediaObserver::~CMCETestUIEngineMultimediaObserver() |
|
90 { |
|
91 } |
|
92 |
|
93 |
|
94 // -- From MMCEInSessionObserver-------------------------------------------------- |
|
95 |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CMCETestUIEngineMultimediaObserver::IncomingSession |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 void CMCETestUIEngineMultimediaObserver::IncomingSession( |
|
102 CMceInSession* aSession, |
|
103 TMceTransactionDataContainer* /*aContainer*/ ) |
|
104 { |
|
105 if(iEngine.iAutoResponse) |
|
106 { |
|
107 TInt state = aSession->State(); |
|
108 |
|
109 switch( state ) |
|
110 { |
|
111 case CMceSession::EIncoming: |
|
112 { |
|
113 aSession->UpdateL(); |
|
114 break; |
|
115 } |
|
116 |
|
117 default: |
|
118 { |
|
119 break; |
|
120 } |
|
121 } |
|
122 } |
|
123 else if(iEngine.iVoIPFlag) |
|
124 { |
|
125 TInt state = aSession->State(); |
|
126 |
|
127 switch( state ) |
|
128 { |
|
129 case CMceSession::EIncoming: |
|
130 { |
|
131 iEngine.NotifyUser( KMiscIncomingVoIPSession ); |
|
132 iEngine.UpdateIncomingSessionVoIPDataL(aSession); |
|
133 break; |
|
134 } |
|
135 |
|
136 default: |
|
137 { |
|
138 break; |
|
139 } |
|
140 } |
|
141 } |
|
142 else |
|
143 { |
|
144 CMCETestUIEngineInSession& engineSession = |
|
145 iEngine.CreateInSessionL( aSession ); |
|
146 } |
|
147 |
|
148 } |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // CMCETestUIEngineMultimediaObserver::IncomingUpdate |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 void CMCETestUIEngineMultimediaObserver::IncomingUpdate( |
|
155 CMceSession& aOrigSession, |
|
156 CMceInSession* aUpdatedSession, |
|
157 TMceTransactionDataContainer* /*aContainer*/ ) |
|
158 { |
|
159 // CMCETestUIEngineInSession& engineSession = |
|
160 // iEngine.CreateInSessionL( aUpdatedSession); |
|
161 iEngine.IncomingUpdateL( aOrigSession, aUpdatedSession ) ; |
|
162 } |
|
163 |
|
164 // -- From MMCESessionObserver ------------------------------------------------- |
|
165 |
|
166 // ----------------------------------------------------------------------------- |
|
167 // CMCETestUIEngineMultimediaObserver::SessionStateChanged |
|
168 // ----------------------------------------------------------------------------- |
|
169 // |
|
170 void CMCETestUIEngineMultimediaObserver::SessionStateChanged( |
|
171 CMceSession& aSession, |
|
172 TMceTransactionDataContainer* aContainer ) |
|
173 { |
|
174 if(iEngine.iAutoResponse) |
|
175 { |
|
176 TInt state = aSession.State(); |
|
177 |
|
178 |
|
179 switch( state ) |
|
180 { |
|
181 case CMceSession::EProceeding: |
|
182 { |
|
183 CMceInSession& inSession = |
|
184 static_cast<CMceInSession&>(aSession); |
|
185 inSession.AcceptL(); |
|
186 break; |
|
187 } |
|
188 |
|
189 default: |
|
190 { |
|
191 break; |
|
192 } |
|
193 } |
|
194 } |
|
195 else if(iEngine.iVoIPFlag) |
|
196 { |
|
197 TInt state = aSession.State(); |
|
198 switch( state ) |
|
199 { |
|
200 case CMceSession::EProceeding: |
|
201 { |
|
202 CMceInSession& inSession = |
|
203 static_cast<CMceInSession&>(aSession); |
|
204 inSession.RingL(); |
|
205 inSession.AcceptL(); |
|
206 iEngine.UpdateIncomingSessionVoIPDataAfterAnswerL(inSession); |
|
207 |
|
208 break; |
|
209 } |
|
210 case CMceSession::EEstablished: |
|
211 { |
|
212 CMceInSession& inSession = |
|
213 static_cast<CMceInSession&>(aSession); |
|
214 // iEngine.UpdateIncomingSessionVoIPDataAfterAnswerL(inSession); |
|
215 CMCETestUIEngineInSession* session = CMCETestUIEngineInSession::NewL( |
|
216 iEngine, &inSession ); |
|
217 CleanupStack::PushL( session ); |
|
218 iEngine.iInSessions.Append( session ); |
|
219 iEngine.EngineStateChangedL(); |
|
220 CleanupStack::Pop( session ); |
|
221 } |
|
222 default: |
|
223 { |
|
224 break; |
|
225 } |
|
226 } |
|
227 } |
|
228 if( CMceSession::EEstablished == aSession.State() ) |
|
229 { |
|
230 const RPointerArray<CMCETestUIEngineOutSession>& outsessions = |
|
231 iEngine.OutSessions(); |
|
232 const RPointerArray<CMCETestUIEngineInSession>& insessions = |
|
233 iEngine.InSessions(); |
|
234 |
|
235 for ( TInt i = 0; i < outsessions.Count(); ++i ) |
|
236 { |
|
237 if ( &outsessions[i]->Session() == &aSession && outsessions[i]->iHoldInProgress ) |
|
238 { |
|
239 outsessions[i]->EnableAudioL(); |
|
240 outsessions[i]->iHoldInProgress = EFalse; |
|
241 } |
|
242 } |
|
243 for ( TInt i = 0; i < insessions.Count(); ++i ) |
|
244 { |
|
245 if ( &insessions[i]->Session() == &aSession && insessions[i]->iHoldInProgress ) |
|
246 { |
|
247 insessions[i]->EnableAudioL(); |
|
248 insessions[i]->iHoldInProgress = EFalse; |
|
249 } |
|
250 } |
|
251 } |
|
252 |
|
253 |
|
254 |
|
255 |
|
256 HBufC8* hbuf = aContainer->GetReasonPhrase(); |
|
257 if(hbuf) |
|
258 { |
|
259 HBufC* buf = HBufC::NewL(hbuf->Length()); |
|
260 TPtr ptr = buf->Des(); |
|
261 ptr.Copy(*hbuf); |
|
262 TBuf16<100> buf16; |
|
263 buf16.Append(KUserNotificationSessionStateChanged ); |
|
264 buf16.Append(KSpace); |
|
265 TInt code = aContainer->GetStatusCode(); |
|
266 buf16.AppendNum(code); |
|
267 buf16.Append(*buf); |
|
268 iEngine.NotifyUser(buf16); |
|
269 delete buf; |
|
270 } |
|
271 else |
|
272 { |
|
273 iEngine.NotifyUser( KUserNotificationSessionStateChanged ); |
|
274 } |
|
275 |
|
276 delete hbuf; |
|
277 iEngine.EngineStateChangedL(); |
|
278 } |
|
279 |
|
280 // ----------------------------------------------------------------------------- |
|
281 // CMCETestUIEngineMultimediaObserver::SessionConnectionStateChanged |
|
282 // ----------------------------------------------------------------------------- |
|
283 // |
|
284 void CMCETestUIEngineMultimediaObserver::SessionConnectionStateChanged( |
|
285 CMceSession& /*aSession*/, |
|
286 TBool /*aActive*/) |
|
287 { |
|
288 } |
|
289 |
|
290 // ----------------------------------------------------------------------------- |
|
291 // CMCETestUIEngineMultimediaObserver::Failed |
|
292 // ----------------------------------------------------------------------------- |
|
293 // |
|
294 void CMCETestUIEngineMultimediaObserver::Failed( CMceSession& /*aSession*/, |
|
295 TInt /*aError*/ ) |
|
296 { |
|
297 iEngine.NotifyUser( KUserNotificationSessionFailed ); |
|
298 iEngine.EngineStateChangedL(); |
|
299 } |
|
300 |
|
301 // ----------------------------------------------------------------------------- |
|
302 // CMCETestUIEngineMultimediaObserver::UpdateFailed |
|
303 // ----------------------------------------------------------------------------- |
|
304 // |
|
305 void CMCETestUIEngineMultimediaObserver::UpdateFailed( |
|
306 CMceSession& /*aSession*/, |
|
307 TMceTransactionDataContainer* /*aContainer*/ ) |
|
308 { |
|
309 iEngine.NotifyUser( KUpdateFailed ); |
|
310 iEngine.EngineStateChangedL(); |
|
311 } |
|
312 |
|
313 |
|
314 |
|
315 // From MMCETransactionObserver ------------------------------------------------- |
|
316 // ----------------------------------------------------------------------------- |
|
317 // CMCETestUIEngineMultimediaObserver::TransactionResponse |
|
318 // ----------------------------------------------------------------------------- |
|
319 void CMCETestUIEngineMultimediaObserver::TransactionResponse( |
|
320 CMceSession& /*aSession*/, |
|
321 TMceTransactionId aTransactionId, |
|
322 TMceTransactionDataContainer* aContainer ) |
|
323 |
|
324 { |
|
325 MCE_TESTUI_DEBUG1("CMCETestUIEngineMultimediaObserver::TransactionResponse entry") |
|
326 |
|
327 iEngine.NotifyUser( KResponseReceived ); |
|
328 iEngine.EngineStateChangedL(); |
|
329 |
|
330 //Clean the Container |
|
331 LogContainer( aContainer, aTransactionId ); |
|
332 |
|
333 MCE_TESTUI_DEBUG1("CMCETestUIEngineMultimediaObserver::TransactionResponse exit") |
|
334 } |
|
335 |
|
336 // ----------------------------------------------------------------------------- |
|
337 // CMCETestUIEngineMultimediaObserver::TransactionFailed |
|
338 // ----------------------------------------------------------------------------- |
|
339 |
|
340 void CMCETestUIEngineMultimediaObserver::TransactionFailed( |
|
341 CMceSession& /*aSession*/, |
|
342 TMceTransactionId aTransactionId, |
|
343 TInt aError ) |
|
344 |
|
345 |
|
346 { |
|
347 MCE_TESTUI_DEBUG1("CMCETestUIEngineMultimediaObserver::TransactionFailed entry") |
|
348 |
|
349 iEngine.RemoveTransactionId( aTransactionId ); |
|
350 iEngine.NotifyUser( KTransactionFailed ); |
|
351 iEngine.EngineStateChangedL(); |
|
352 |
|
353 MCE_TESTUI_DEBUG3("CMCETestUIEngineMultimediaObserver::TransactionFailed aTransactionId", aTransactionId ) |
|
354 MCE_TESTUI_DEBUG3("CMCETestUIEngineMultimediaObserver::TransactionFailed aError", aError ) |
|
355 |
|
356 MCE_TESTUI_DEBUG1("CMCETestUIEngineMultimediaObserver::TransactionFailed exit") |
|
357 } |
|
358 |
|
359 // From MMCEInTransactionObserver ------------------------------------------------- |
|
360 // ----------------------------------------------------------------------------- |
|
361 // CMCETestUIEngineMultimediaObserver::TransactionResponse |
|
362 // ----------------------------------------------------------------------------- |
|
363 void CMCETestUIEngineMultimediaObserver::IncomingRequest( |
|
364 const TDesC8& /*aMethod*/, |
|
365 CMceSession& /*aSession*/, |
|
366 TMceTransactionId aTransactionId, |
|
367 TMceTransactionDataContainer* aContainer ) |
|
368 { |
|
369 MCE_TESTUI_DEBUG1("CMCETestUIEngineMultimediaObserver::IncomingRequest entry") |
|
370 |
|
371 TUint code = 200; |
|
372 _LIT8( KMceSipOK,"OK"); |
|
373 |
|
374 iEngine.AddTransactionIdL( aTransactionId ); |
|
375 iEngine.NotifyUser( KRequestReceived ); |
|
376 iEngine.EngineStateChangedL(); |
|
377 |
|
378 LogContainer( aContainer, aTransactionId ); |
|
379 |
|
380 } |
|
381 |
|
382 |
|
383 // -- from MMCEStreamObserver -------------------------------------------------- |
|
384 |
|
385 |
|
386 // ----------------------------------------------------------------------------- |
|
387 // CMCETestUIEngineMultimediaObserver::StreamStateChanged |
|
388 // ----------------------------------------------------------------------------- |
|
389 // |
|
390 void CMCETestUIEngineMultimediaObserver::StreamStateChanged( |
|
391 CMceMediaStream& aStream ) |
|
392 { |
|
393 iEngine.NotifyStreamStateChangeL( aStream ); |
|
394 } |
|
395 |
|
396 // ----------------------------------------------------------------------------- |
|
397 // CMCETestUIEngineMultimediaObserver::StreamStateChanged |
|
398 // ----------------------------------------------------------------------------- |
|
399 // |
|
400 void CMCETestUIEngineMultimediaObserver::StreamStateChanged( |
|
401 CMceMediaStream& aStream, |
|
402 CMceMediaSink& /*aSink*/ ) |
|
403 { |
|
404 iEngine.NotifyStreamStateChangeL( aStream ); |
|
405 } |
|
406 |
|
407 // ----------------------------------------------------------------------------- |
|
408 // CMCETestUIEngineMultimediaObserver::StreamStateChanged |
|
409 // ----------------------------------------------------------------------------- |
|
410 // |
|
411 void CMCETestUIEngineMultimediaObserver::StreamStateChanged( |
|
412 CMceMediaStream& aStream, |
|
413 CMceMediaSource& aSource) |
|
414 { |
|
415 TInt state = aStream.State(); |
|
416 |
|
417 TBuf16<100> buf16; |
|
418 // buf16.Append(KUserNotificationStreamStateChanged ); |
|
419 // buf16.Append(KLeftParenthesis); |
|
420 TInt transProgress; |
|
421 |
|
422 switch( state ) |
|
423 { |
|
424 case CMceMediaStream::ETranscodingRequired: |
|
425 buf16.Append(KStreamTranscodingRequired); |
|
426 iEngine.NotifyUser(buf16); |
|
427 break; |
|
428 case CMceMediaStream::ETranscoding: |
|
429 { |
|
430 buf16.Append(KStreamTranscoding); |
|
431 CMceFileSource& fileSource = static_cast<CMceFileSource&>(aSource); |
|
432 transProgress = fileSource.TranscodingProgressL(); |
|
433 buf16.Append(KLeftParenthesis); |
|
434 buf16.AppendNum(transProgress); |
|
435 buf16.Append(KRightParenthesis); |
|
436 } |
|
437 |
|
438 break; |
|
439 default: |
|
440 buf16.Append(KSessionStateUnknown); |
|
441 } |
|
442 if( transProgress == 10 || transProgress == 100 ) |
|
443 { |
|
444 iEngine.NotifyUser(buf16); |
|
445 } |
|
446 } |
|
447 |
|
448 |
|
449 |
|
450 // -- from MMCERtpObserver ----------------------------------------------------- |
|
451 |
|
452 |
|
453 // ----------------------------------------------------------------------------- |
|
454 // CMCETestUIEngineMultimediaObserver::SRReceived |
|
455 // ----------------------------------------------------------------------------- |
|
456 // |
|
457 void CMCETestUIEngineMultimediaObserver::SRReceived( |
|
458 CMceSession& /*aStream*/, |
|
459 CMceMediaStream& /*aSource*/ ) |
|
460 { |
|
461 RDebug::Print(_L("SR Received ")); |
|
462 if(iEngine.iRtcpFlag) |
|
463 { |
|
464 iEngine.NotifyUser( KUserNotificationSRReceived ); |
|
465 iEngine.EngineStateChangedL(); |
|
466 } |
|
467 else |
|
468 { |
|
469 iEngine.iSRCount++; |
|
470 if(iEngine.iSRCount == 20) |
|
471 { |
|
472 iEngine.NotifyUser( KUserNotificationSRReceived ); |
|
473 iEngine.EngineStateChangedL(); |
|
474 iEngine.iSRCount = 0; |
|
475 } |
|
476 } |
|
477 } |
|
478 |
|
479 // ----------------------------------------------------------------------------- |
|
480 // CMCETestUIEngineMultimediaObserver::RRReceived |
|
481 // ----------------------------------------------------------------------------- |
|
482 // |
|
483 void CMCETestUIEngineMultimediaObserver::RRReceived( |
|
484 CMceSession&/* aStream*/, |
|
485 CMceMediaStream& /*aSource*/ ) |
|
486 { |
|
487 RDebug::Print(_L("RR Received ")); |
|
488 if(iEngine.iRtcpFlag) |
|
489 { |
|
490 iEngine.NotifyUser( KUserNotificationRRReceived ); |
|
491 iEngine.EngineStateChangedL(); |
|
492 } |
|
493 else |
|
494 { |
|
495 iEngine.iRRCount++; |
|
496 if(iEngine.iRRCount == 20) |
|
497 { |
|
498 iEngine.NotifyUser( KUserNotificationRRReceived ); |
|
499 iEngine.EngineStateChangedL(); |
|
500 iEngine.iRRCount = 0; |
|
501 } |
|
502 } |
|
503 } |
|
504 |
|
505 // ----------------------------------------------------------------------------- |
|
506 // CMCETestUIEngineMultimediaObserver::InactivityTimeout |
|
507 // ----------------------------------------------------------------------------- |
|
508 // |
|
509 void CMCETestUIEngineMultimediaObserver::InactivityTimeout( |
|
510 CMceMediaStream& /*aStream*/, |
|
511 CMceRtpSource& /*aSource*/ ) |
|
512 { |
|
513 iEngine.NotifyUser( KUserInactivityTimeoutReceived ); |
|
514 iEngine.EngineStateChangedL(); |
|
515 } |
|
516 |
|
517 |
|
518 // ----------------------------------------------------------------------------- |
|
519 // CMCETestUIEngineMultimediaObserver::Activity |
|
520 // ----------------------------------------------------------------------------- |
|
521 // |
|
522 void CMCETestUIEngineMultimediaObserver::Activity( |
|
523 CMceMediaStream& /*aStream*/, |
|
524 CMceRtpSource& /*aSource*/ ) |
|
525 { |
|
526 iEngine.NotifyUser( KUserActivityTimeReceived ); |
|
527 iEngine.EngineStateChangedL(); |
|
528 } |
|
529 |
|
530 // ----------------------------------------------------------------------------- |
|
531 // CMCETestUIEngineMultimediaObserver::IncomingEvent |
|
532 // ----------------------------------------------------------------------------- |
|
533 // |
|
534 void CMCETestUIEngineMultimediaObserver::IncomingEvent( |
|
535 CMceInEvent* aEvent, |
|
536 TMceTransactionDataContainer*/* aContainer*/ ) |
|
537 { |
|
538 CMCETestUIEngineInEvent& engineEvent = |
|
539 iEngine.CreateInEventL( aEvent ); |
|
540 } |
|
541 // ----------------------------------------------------------------------------- |
|
542 // CMCETestUIEngineMultimediaObserver::EventStateChanged |
|
543 // ----------------------------------------------------------------------------- |
|
544 // |
|
545 void CMCETestUIEngineMultimediaObserver::EventStateChanged( |
|
546 CMceEvent& /*aEvent*/, |
|
547 TMceTransactionDataContainer* aContainer ) |
|
548 { |
|
549 HBufC8* hbuf = aContainer->GetReasonPhrase(); |
|
550 if(hbuf) |
|
551 { |
|
552 HBufC* buf = HBufC::NewL(hbuf->Length()); |
|
553 TPtr ptr = buf->Des(); |
|
554 ptr.Copy(*hbuf); |
|
555 TBuf16<100> buf16; |
|
556 buf16.Append(KUserNotificationEventStateChanged ); |
|
557 buf16.Append(KSpace); |
|
558 TInt code = aContainer->GetStatusCode(); |
|
559 buf16.AppendNum(code); |
|
560 buf16.Append(*buf); |
|
561 iEngine.NotifyUser(buf16); |
|
562 delete buf; |
|
563 } |
|
564 else |
|
565 { |
|
566 iEngine.NotifyUser( KUserNotificationEventStateChanged ); |
|
567 } |
|
568 |
|
569 delete hbuf; |
|
570 iEngine.EngineStateChangedL(); |
|
571 } |
|
572 |
|
573 // ----------------------------------------------------------------------------- |
|
574 // CMCETestUIEngineMultimediaObserver::NotifyReceived |
|
575 // ----------------------------------------------------------------------------- |
|
576 // |
|
577 void CMCETestUIEngineMultimediaObserver::NotifyReceived( |
|
578 CMceEvent&/* aEvent*/, |
|
579 TMceTransactionDataContainer*/* aContainer*/ ) |
|
580 { |
|
581 iEngine.NotifyUser( KUserNotificationEventNotifyReceived ); |
|
582 iEngine.EngineStateChangedL(); |
|
583 } |
|
584 |
|
585 // ----------------------------------------------------------------------------- |
|
586 // CMCETestUIEngineMultimediaObserver::EventConnectionStateChanged |
|
587 // ----------------------------------------------------------------------------- |
|
588 // |
|
589 void CMCETestUIEngineMultimediaObserver::EventConnectionStateChanged( |
|
590 CMceEvent& /*aEvent*/, |
|
591 TBool aActive ) |
|
592 { |
|
593 if(aActive) |
|
594 { |
|
595 iEngine.NotifyUser( KUserNotificationEventActiveConnectionStateChangedReceived ); |
|
596 } |
|
597 else |
|
598 { |
|
599 iEngine.NotifyUser( KUserNotificationEventNotActiveConnectionStateChangedReceived ); |
|
600 } |
|
601 |
|
602 iEngine.EngineStateChangedL(); |
|
603 } |
|
604 // ----------------------------------------------------------------------------- |
|
605 // CMCETestUIEngineMultimediaObserver::Failed |
|
606 // ----------------------------------------------------------------------------- |
|
607 // |
|
608 |
|
609 void CMCETestUIEngineMultimediaObserver::Failed |
|
610 (CMceEvent& /*aEvent*/, TInt /*aError*/ ) |
|
611 { |
|
612 iEngine.NotifyUser( KUserNotificationEventFailed ); |
|
613 iEngine.EngineStateChangedL(); |
|
614 } |
|
615 |
|
616 // ----------------------------------------------------------------------------- |
|
617 // CMCETestUIEngineMultimediaObserver::IncomingRefer |
|
618 // ----------------------------------------------------------------------------- |
|
619 // |
|
620 void CMCETestUIEngineMultimediaObserver::IncomingRefer( |
|
621 CMceInRefer* aRefer, |
|
622 const TDesC8& /*aReferTo*/, |
|
623 TMceTransactionDataContainer* /*aContainer*/ ) |
|
624 { |
|
625 CMCETestUIEngineInRefer& engineRefer = |
|
626 iEngine.CreateInReferL( aRefer ); |
|
627 } |
|
628 // ----------------------------------------------------------------------------- |
|
629 // CMCETestUIEngineMultimediaObserver::ReferStateChanged |
|
630 // ----------------------------------------------------------------------------- |
|
631 // |
|
632 void CMCETestUIEngineMultimediaObserver::ReferStateChanged( |
|
633 CMceRefer& /*aRefer*/, |
|
634 TMceTransactionDataContainer* aContainer ) |
|
635 { |
|
636 HBufC8* hbuf = aContainer->GetReasonPhrase(); |
|
637 if(hbuf) |
|
638 { |
|
639 HBufC* buf = HBufC::NewL(hbuf->Length()); |
|
640 TPtr ptr = buf->Des(); |
|
641 ptr.Copy(*hbuf); |
|
642 TBuf16<100> buf16; |
|
643 buf16.Append(KUserNotificationReferStateChanged ); |
|
644 buf16.Append(KSpace); |
|
645 TInt code = aContainer->GetStatusCode(); |
|
646 buf16.AppendNum(code); |
|
647 buf16.Append(*buf); |
|
648 iEngine.NotifyUser(buf16); |
|
649 delete buf; |
|
650 } |
|
651 else |
|
652 { |
|
653 iEngine.NotifyUser( KUserNotificationReferStateChanged ); |
|
654 } |
|
655 |
|
656 delete hbuf; |
|
657 iEngine.EngineStateChangedL(); |
|
658 } |
|
659 |
|
660 |
|
661 |
|
662 void CMCETestUIEngineMultimediaObserver::SsrcAdded( |
|
663 CMceMediaStream& /*aStream*/, |
|
664 CMceRtpSource& /*aSource*/, |
|
665 TUint /*aSsrc*/ ) |
|
666 |
|
667 { |
|
668 } |
|
669 void CMCETestUIEngineMultimediaObserver::SsrcRemoved( |
|
670 CMceMediaStream& /*aStream*/, |
|
671 CMceRtpSource& /*aSource*/, |
|
672 TUint /*aSsrc*/ ) |
|
673 { |
|
674 } |
|
675 |
|
676 // ----------------------------------------------------------------------------- |
|
677 // CMCETestUIEngineMultimediaObserver::ReferConnectionStateChanged |
|
678 // ----------------------------------------------------------------------------- |
|
679 // |
|
680 void CMCETestUIEngineMultimediaObserver::ReferConnectionStateChanged( |
|
681 CMceRefer& /*aRefer*/, |
|
682 TBool aActive ) |
|
683 { |
|
684 if(aActive) |
|
685 { |
|
686 iEngine.NotifyUser( KUserNotificationReferActiveConnectionStateChangedReceived ); |
|
687 } |
|
688 else |
|
689 { |
|
690 iEngine.NotifyUser( KUserNotificationReferNotActiveConnectionStateChangedReceived ); |
|
691 } |
|
692 |
|
693 iEngine.EngineStateChangedL(); |
|
694 } |
|
695 // ----------------------------------------------------------------------------- |
|
696 // CMCETestUIEngineMultimediaObserver::Failed |
|
697 // ----------------------------------------------------------------------------- |
|
698 // |
|
699 |
|
700 void CMCETestUIEngineMultimediaObserver::Failed |
|
701 (CMceRefer& /*aRefer*/, TInt /*aError*/ ) |
|
702 { |
|
703 iEngine.NotifyUser( KUserNotificationReferFailed ); |
|
704 iEngine.EngineStateChangedL(); |
|
705 } |
|
706 |
|
707 |
|
708 void CMCETestUIEngineMultimediaObserver::FCMsgReceived(CMceSession& /*aSession*/, |
|
709 HBufC8* aMessage) |
|
710 { |
|
711 if(aMessage) |
|
712 { |
|
713 HBufC* buf = HBufC::NewL(aMessage->Length()); |
|
714 TPtr ptr = buf->Des(); |
|
715 ptr.Copy(*aMessage); |
|
716 TBuf16<100> buf16; |
|
717 buf16.Append(KFCMessageReceived ); |
|
718 buf16.Append(KSpace); |
|
719 buf16.Append(*buf); |
|
720 iEngine.NotifyUser(buf16); |
|
721 delete buf; |
|
722 } |
|
723 delete aMessage; |
|
724 iEngine.EngineStateChangedL(); |
|
725 } |
|
726 |
|
727 void CMCETestUIEngineMultimediaObserver::FCMsgErrorOccurred(CMceSession& /*aSession*/, |
|
728 TInt /*aError*/) |
|
729 { |
|
730 TBuf16<100> buf16; |
|
731 buf16.Append(KFCMessageErrorOccured); |
|
732 iEngine.NotifyUser(buf16); |
|
733 iEngine.EngineStateChangedL(); |
|
734 } |
|
735 |
|
736 |
|
737 |
|
738 // ----------------------------------------------------------------------------- |
|
739 // CMCETestUIEngineMultimediaObserver::Failed |
|
740 // ----------------------------------------------------------------------------- |
|
741 // |
|
742 void CMCETestUIEngineMultimediaObserver::CsStatusChangedL( |
|
743 TPoCOmaCsState aStatus ) |
|
744 |
|
745 { |
|
746 iEngine.CsStatusChangedL( aStatus ); |
|
747 } |
|
748 |
|
749 /** |
|
750 * Incoming DTMF tone received. |
|
751 * @param aSession Session that tone was received. |
|
752 * @param aStream Stream that tone was received. |
|
753 * @param aTone Received tone. |
|
754 */ |
|
755 void CMCETestUIEngineMultimediaObserver::DtmfToneReceived( CMceSession& /*aSession*/, |
|
756 CMceAudioStream& /*aStream*/, |
|
757 const TChar& aTone ) |
|
758 { |
|
759 TBuf16<100> buf16; |
|
760 buf16.Append(KDtmfToneReceived); |
|
761 buf16.Append(aTone); |
|
762 iEngine.NotifyUser(buf16); |
|
763 iEngine.EngineStateChangedL(); |
|
764 } |
|
765 /** |
|
766 * DTMF event received. |
|
767 * @param aSession Session that event was received. |
|
768 * @param aStream Stream that event was received. |
|
769 * @param aSource Source that event was received. |
|
770 * @param aEvent Received event. |
|
771 */ |
|
772 void CMCETestUIEngineMultimediaObserver::DtmfEventReceived( CMceSession& /*aSession*/, |
|
773 CMceAudioStream& /*aStream*/, |
|
774 CMceMediaSource& /*aSource*/, |
|
775 TMceDtmfEvent aEvent ) |
|
776 { |
|
777 TBuf16<100> buf16; |
|
778 buf16.Append(KDtmfEventReceived); |
|
779 switch( aEvent ) |
|
780 { |
|
781 case EDtmfSendStarted: |
|
782 { |
|
783 buf16.Append(KDtmfStarted); |
|
784 break; |
|
785 } |
|
786 case EDtmfSendCompleted: |
|
787 { |
|
788 buf16.Append(KDtmfCompleted); |
|
789 break; |
|
790 } |
|
791 default: |
|
792 { |
|
793 break; |
|
794 } |
|
795 |
|
796 } |
|
797 iEngine.NotifyUser(buf16); |
|
798 iEngine.EngineStateChangedL(); |
|
799 } |
|
800 |
|
801 /** |
|
802 * DTMF error occured. If error occurs, DTMFs becomes |
|
803 * unavailable for that source. |
|
804 * @param aSession Session that event was received. |
|
805 * @param aStream Stream that event was received. |
|
806 * @param aStream Stream that event was received. |
|
807 * @param aError Error code. |
|
808 */ |
|
809 void CMCETestUIEngineMultimediaObserver::DtmfErrorOccured( |
|
810 CMceSession& /*aSession*/, |
|
811 CMceAudioStream& /*aStream*/, |
|
812 CMceMediaSource& /*aSource*/, |
|
813 TInt /*aError*/ ) |
|
814 { |
|
815 TBuf16<100> buf16; |
|
816 buf16.Append(KDtmfErrorOccured); |
|
817 iEngine.NotifyUser(buf16); |
|
818 iEngine.EngineStateChangedL(); |
|
819 } |
|
820 |
|
821 void CMCETestUIEngineMultimediaObserver::LogContainer( TMceTransactionDataContainer* aContainer, |
|
822 TMceTransactionId aTransactionId ) const |
|
823 { |
|
824 MCE_TESTUI_DEBUG1( "CMCETestUIEngineMultimediaObserver::LogContainer entry" ) |
|
825 |
|
826 MCE_TESTUI_DEBUG3( "CMCETestUIEngineMultimediaObserver::LogContainer aTransactionId", aTransactionId ) |
|
827 MCE_TESTUI_DEBUG1( "Headers:" ) |
|
828 |
|
829 CDesC8Array* arr = NULL; |
|
830 HBufC8* p = NULL; |
|
831 TInt count = 0; |
|
832 |
|
833 arr = aContainer->GetHeaders(); |
|
834 if ( arr ) |
|
835 { |
|
836 count = arr->Count(); |
|
837 for ( TInt i=0 ; i < count ; ++i ) |
|
838 { |
|
839 MCE_TESTUI_DEBUG6( "", arr->MdcaPoint( i ) ) |
|
840 } |
|
841 delete arr; |
|
842 arr = 0; |
|
843 } |
|
844 |
|
845 arr = aContainer->GetContentHeaders(); |
|
846 if ( arr ) |
|
847 { |
|
848 count = arr->Count(); |
|
849 for ( TInt i=0 ; i < count ; ++i ) |
|
850 { |
|
851 MCE_TESTUI_DEBUG6( "", arr->MdcaPoint( i ) ) |
|
852 } |
|
853 delete arr; |
|
854 arr = 0; |
|
855 } |
|
856 |
|
857 p = aContainer->GetContentType(); |
|
858 if ( p ) |
|
859 { |
|
860 MCE_TESTUI_DEBUG6( "ContentType ", *p ); |
|
861 delete p; |
|
862 arr = 0; |
|
863 } |
|
864 |
|
865 p = aContainer->GetContent(); |
|
866 if ( p ) |
|
867 { |
|
868 MCE_TESTUI_DEBUG6( "Content ", *p ); |
|
869 delete p; |
|
870 arr = 0; |
|
871 } |
|
872 |
|
873 p = aContainer->GetReasonPhrase(); |
|
874 if ( p ) |
|
875 { |
|
876 MCE_TESTUI_DEBUG6( "ReasonPhrase ", *p ); |
|
877 delete p; |
|
878 arr = 0; |
|
879 } |
|
880 |
|
881 MCE_TESTUI_DEBUG1( "CMCETestUIEngineMultimediaObserver::LogContainer exit" ) |
|
882 } |
|
883 |
|
884 |
|
885 // End of File. |