|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // MCE API |
|
22 |
|
23 |
|
24 //#include <MCEManager.h> |
|
25 #include <MCESession.h> |
|
26 #include <MCEMediaStream.h> |
|
27 //#include <MCEOneWayStream.h> |
|
28 #include <MCEAudioStream.h> |
|
29 #include <MCEMediaSource.h> |
|
30 #include <MCEMicSource.h> |
|
31 #include <MCEMediaSink.h> |
|
32 #include <MCERtpSink.h> |
|
33 #include <MCERtpSource.h> |
|
34 #include <MCEFileSource.h> |
|
35 #include <MCESpeakerSink.h> |
|
36 |
|
37 #include "CMCETestUIEngine.h" |
|
38 #include "MCETestUIEngineConstants.h" |
|
39 #include "CMCETestUIEngineSource.h" |
|
40 |
|
41 #include "TMCETestUIEngineCmdBase.h" |
|
42 #include "TMCETestUIEngineCmdEnableAudioSource.h" |
|
43 #include "TMCETestUIEngineCmdDisableAudioSource.h" |
|
44 |
|
45 // ============================ MEMBER FUNCTIONS =============================== |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CMCETestUIEngineSource::NewL() |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 CMCETestUIEngineSource* CMCETestUIEngineSource::NewL( |
|
52 CMCETestUIEngine& aEngine, |
|
53 CMceMediaSource& aSource ) |
|
54 { |
|
55 |
|
56 CMCETestUIEngineSource* self = |
|
57 new (ELeave) CMCETestUIEngineSource( aEngine, |
|
58 aSource ); |
|
59 CleanupStack::PushL( self ); |
|
60 self->ConstructL(); |
|
61 CleanupStack::Pop( self ); |
|
62 return self; |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CMCETestUIEngineSource::CMCETestUIEngineSource |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 CMCETestUIEngineSource::CMCETestUIEngineSource( |
|
70 CMCETestUIEngine& aEngine, |
|
71 CMceMediaSource& aSource ) |
|
72 : iEngine( aEngine ), |
|
73 iSource( aSource ) |
|
74 { |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CMCETestUIEngineSource::ConstructL() |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 void CMCETestUIEngineSource::ConstructL() |
|
82 { |
|
83 return; |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CMCETestUIEngineAudioStream::~CMCETestUIEngineAudioStream |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 EXPORT_C CMCETestUIEngineSource::~CMCETestUIEngineSource() |
|
91 { |
|
92 iCommands.ResetAndDestroy(); |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CMCETestUIEngineSource::GetCommands |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 const RPointerArray<TMCETestUIEngineCmdBase>& |
|
100 CMCETestUIEngineSource::GetCommandsL() |
|
101 { |
|
102 iCommands.ResetAndDestroy(); |
|
103 |
|
104 if ( iSource.IsEnabled() ) |
|
105 { |
|
106 iCommands.Append( new (ELeave) TMCETestUIEngineCmdDisableSource( |
|
107 iEngine, *this ) ); |
|
108 } |
|
109 else |
|
110 { |
|
111 iCommands.Append( new (ELeave) TMCETestUIEngineCmdEnableSource( |
|
112 iEngine, *this ) ); |
|
113 } |
|
114 if(iSource.Type() == KMceRTPSource) |
|
115 { |
|
116 iCommands.Append( new (ELeave) TMCETestUIEngineCmdEnableRtpSourceInActivityTimer( |
|
117 iEngine, *this ) ); |
|
118 iCommands.Append( new (ELeave) TMCETestUIEngineCmdSendRR( |
|
119 iEngine, *this ) ); |
|
120 } |
|
121 else if(iSource.Type() == KMceFileSource) |
|
122 { |
|
123 iCommands.Append( new (ELeave) TMCETestUIEngineCmdAudioTranscode( |
|
124 iEngine, *this ) ); |
|
125 iCommands.Append( new (ELeave) TMCETestUIEngineCmdAudioCancelTranscode( |
|
126 iEngine, *this ) ); |
|
127 } |
|
128 |
|
129 if( iSource.DtmfAvailable() && !iSource.DtmfActive() ) |
|
130 { |
|
131 iCommands.Append( new (ELeave) TMCETestUIEngineCmdStartDtmfToneL( |
|
132 iEngine, *this ) ); |
|
133 |
|
134 iCommands.Append( new (ELeave) TMCETestUIEngineCmdSendDtmfToneL( |
|
135 iEngine, *this ) ); |
|
136 |
|
137 iCommands.Append( new (ELeave) TMCETestUIEngineCmdSendDtmfToneSequenceL( |
|
138 iEngine, *this ) ); |
|
139 } |
|
140 else if( iSource.DtmfAvailable() && iSource.DtmfActive() ) |
|
141 { |
|
142 iCommands.Append( new (ELeave) TMCETestUIEngineCmdStopDtmfToneL( |
|
143 iEngine, *this ) ); |
|
144 } |
|
145 |
|
146 return iCommands; |
|
147 } |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CMCEMediaSource::Type |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 EXPORT_C TMceSourceType CMCETestUIEngineSource::Type() const |
|
154 { |
|
155 return iSource.Type();; |
|
156 } |
|
157 |
|
158 |
|
159 |
|
160 // ----------------------------------------------------------------------------- |
|
161 // CMCETestUIEngineAudioStream::State |
|
162 // ----------------------------------------------------------------------------- |
|
163 // |
|
164 EXPORT_C const TDesC16& CMCETestUIEngineSource::State() const |
|
165 { |
|
166 if ( iSource.IsEnabled() ) |
|
167 { |
|
168 return KSourceStateEnabled; |
|
169 } |
|
170 return KSourceStateDisabled; |
|
171 } |
|
172 |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // CMCETestUIEngineSource::Source |
|
176 // ----------------------------------------------------------------------------- |
|
177 // |
|
178 EXPORT_C CMceMediaSource& CMCETestUIEngineSource::Source() |
|
179 { |
|
180 return iSource; |
|
181 } |
|
182 |