|
1 /* |
|
2 * Copyright (c) 2006 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 #include "MCEConstants.h" |
|
21 #include "TCmdGetRtpEvent.h" |
|
22 #include "CTcMCEContext.h" |
|
23 #include <MCEMediaStream.h> |
|
24 #include <MCERtpSource.h> |
|
25 |
|
26 /** |
|
27 * INPUT: |
|
28 * Parameters: (int:CallbackType) |
|
29 * (int:Timeout=5) |
|
30 * |
|
31 * IDs: - |
|
32 * |
|
33 * OUTPUT: |
|
34 * Parameters: int:CallbackType |
|
35 * |
|
36 * IDs: StreamId |
|
37 * SourceId |
|
38 */ |
|
39 |
|
40 void TCmdGetRtpEvent::ExecuteL() |
|
41 { |
|
42 // ---------- Setup -------------------------------------------------------- |
|
43 |
|
44 |
|
45 // ---------- Execution ---------------------------------------------------- |
|
46 |
|
47 // It is not necessary to define what event is expected |
|
48 TTcMceCallbackType type = ExtractIntegerL( KParamCallbackType, KTcMceUnknown, EFalse ); |
|
49 |
|
50 // Get an item off the receive queue (waits until timeout if none is present) |
|
51 TInt timeout = ExtractIntegerL( KParamTimeout, KDefaultReceiveTimeout, EFalse ); |
|
52 |
|
53 // Get an item off the receive queue (waits until timeout if none is present) |
|
54 TPtrC8 sourceId = ExtractIdL( KParamSourceId, EFalse ); |
|
55 //Get RTP Source object from registry |
|
56 CMceRtpSource *rtpSource = NULL; |
|
57 rtpSource =reinterpret_cast<CMceRtpSource*> (iContext.Registry().ObjectPtrL(sourceId)); |
|
58 //time as millisecs |
|
59 rtpSource->EnableInactivityTimerL(timeout*1000); |
|
60 |
|
61 //time as seconds |
|
62 CTcMCEReceived& item = iContext.ReceivedRTPItemL( timeout + 5); |
|
63 |
|
64 if (!item.MediaStream() || |
|
65 !item.RtpSource() || |
|
66 ( type != KTcMceUnknown && item.Type() != type ) ) |
|
67 { |
|
68 User::Leave( KErrNotFound ); |
|
69 } |
|
70 // ---------- Response creation -------------------------------------------- |
|
71 |
|
72 |
|
73 AddIdResponseL( KStreamId, *(item.MediaStream()) ); |
|
74 AddIdResponseL( KSourceId, *(item.RtpSource()) ); |
|
75 AddIntegerResponseL( KParamCallbackType, item.Type() ); |
|
76 } |
|
77 |
|
78 TBool TCmdGetRtpEvent::Match( const TTcIdentifier& aId ) |
|
79 { |
|
80 return TTcMceCommandBase::Match( aId, _L8("GetRtpEvent") ); |
|
81 } |
|
82 |
|
83 TTcCommandBase* TCmdGetRtpEvent::CreateL( MTcTestContext& aContext ) |
|
84 { |
|
85 return new( ELeave ) TCmdGetRtpEvent( aContext ); |
|
86 } |