|
1 /* |
|
2 * Copyright (c) 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: Session command implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "mvtprotocolhandler.h" |
|
19 #include "cdatasinkproxy.h" |
|
20 #include "cdatasourceproxy.h" |
|
21 #include "csessionhandler.h" |
|
22 #include "ccommserver.h" |
|
23 #include "ch324confighandler.h" |
|
24 #include "cvideoconfighandler.h" |
|
25 #include "caudioconfighandler.h" |
|
26 |
|
27 #ifdef _DEBUG |
|
28 # define __IF_DEBUG(t) {RDebug::t;} |
|
29 #else |
|
30 # define __IF_DEBUG(t) |
|
31 #endif |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // TSessionHandler::TSessionHandler |
|
35 // Constructor. |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 TSessionHandler::TSessionHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler) |
|
39 { |
|
40 __IF_DEBUG(Print(_L("VTProto: TSessionHandler::TSessionHandler<"))); |
|
41 __IF_DEBUG(Print(_L("VTProto: TSessionHandler::TSessionHandler>"))); |
|
42 } |
|
43 |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CSessionCommand::CSessionCommand |
|
47 // Constructor. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 CSessionCommand::CSessionCommand(TSessionHandler* aSessionHandler) |
|
51 : iSessionHandler(aSessionHandler) |
|
52 { |
|
53 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::CSessionCommand<"))); |
|
54 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::CSessionCommand>"))); |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CSessionCommand::~CSessionComman |
|
59 // Destructor. |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 CSessionCommand::~CSessionCommand() |
|
63 { |
|
64 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::~CSessionCommand<"))); |
|
65 delete iVideoSource; |
|
66 delete iDisplaySink; |
|
67 delete iSessionHandler; |
|
68 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::~CSessionCommand>"))); |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // CSessionCommand::ConnectToProtocolL |
|
73 // This function can be invoked only in the ESetup state. |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 TInt CSessionCommand::ConnectToProtocolL(MCommServer* aComm) |
|
77 { |
|
78 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ConnectToProtocolL"))); |
|
79 CCommServer* commServer = static_cast<CCommServer*>(aComm); |
|
80 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ConnectToProtocolL commServer %d"), commServer)); |
|
81 return KErrNone; |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CSessionCommand::DisconnectFromProtocolL |
|
86 // The Disconnect call is valid only when invoked in the EConnecting, and |
|
87 // EConnected states. |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 TInt CSessionCommand::DisconnectFromProtocolL() |
|
91 { |
|
92 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::DisconnectFromProtocolL"))); |
|
93 return KErrNone; |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CSessionCommand::ResetProtocolL |
|
98 // This function is valid only in the ESetup and EInitializing state. |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 TInt CSessionCommand::ResetProtocolL() |
|
102 { |
|
103 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResetProtocolL"))); |
|
104 return KErrNone; |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // CSessionCommand::InitProtocolL |
|
109 // This function is valid only in the EIdle state. |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 TInt CSessionCommand::InitProtocolL(TVtInitInfo& aInitInfo) |
|
113 { |
|
114 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::InitProtocolL"))); |
|
115 return KErrNone; |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CSessionCommand::AddVideoSinkL |
|
120 // Allows an application to provide a media sink for rendering an incoming media bitstream in a |
|
121 // logical channel of communication with the peer. |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 TInt CSessionCommand::AddVideoSinkL(const TUint aChannelId, MVTVideoSink& aDataSink) |
|
125 { |
|
126 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSinkL"))); |
|
127 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSinkL aChannelId %d"), aChannelId)); |
|
128 iDisplaySink =CDisplaySinkProxy::NewL(&aDataSink); |
|
129 return KErrNone; |
|
130 } |
|
131 |
|
132 // ----------------------------------------------------------------------------- |
|
133 // CSessionCommand::AddVideoSourceL |
|
134 // Allows an application to provide a media source to be associated with a logical channel |
|
135 // of communication with the peer. |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 TInt CSessionCommand::AddVideoSourceL(const TUint aChannelId, MVTVideoSource& aDataSource) |
|
139 { |
|
140 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSourceL"))); |
|
141 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSourceL aChannelId %d"), aChannelId)); |
|
142 iVideoSource = CVideoSourceProxy::NewL(&aDataSource); |
|
143 return KErrNone; |
|
144 } |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // CSessionCommand::AddAudioSourceL |
|
148 // Allows an application to provide a media source to be associated with a logical channel |
|
149 // of communication with the peer. |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 TInt CSessionCommand::AddAudioSourceL(const TUint aChannelId, MVTAudioSource &aDataSource) |
|
153 { |
|
154 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSourceL"))); |
|
155 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSourceL aChannelId %d"), aChannelId)); |
|
156 CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(&aDataSource); |
|
157 return KErrNone; |
|
158 } |
|
159 |
|
160 // ----------------------------------------------------------------------------- |
|
161 // CSessionCommand::AddAudioSinkL |
|
162 // Allows an application to provide a media sink for rendering an incoming media bitstream in a |
|
163 // logical channel of communication with the peer. |
|
164 // ----------------------------------------------------------------------------- |
|
165 // |
|
166 TInt CSessionCommand::AddAudioSinkL(const TUint aChannelId, MVTAudioSink &aDataSink) |
|
167 { |
|
168 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSinkL"))); |
|
169 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSinkL aChannelId %d"), aChannelId)); |
|
170 CAudioSinkProxy* audioSinkProxy = static_cast<CAudioSinkProxy*>(&aDataSink); |
|
171 return KErrNone; |
|
172 } |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // CSessionCommand::PauseVideoL |
|
176 // For an incoming track (MVTVideoSink) this function pauses sending |
|
177 // media to the sink (output device) and stops the sink. |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 TInt CSessionCommand::PauseVideoL(MVTVideoSource& aTrack) |
|
181 { |
|
182 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::PauseVideoL"))); |
|
183 return KErrNone; |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // CSessionCommand::PauseVideoL |
|
188 // For an incoming track (MVtVideoSink) this function pauses sending |
|
189 // media to the sink (output device) and stops the sink. |
|
190 // ----------------------------------------------------------------------------- |
|
191 // |
|
192 TInt CSessionCommand::PauseVideoL(MVTVideoSink& aTrack) |
|
193 { |
|
194 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::PauseVideoL"))); |
|
195 return KErrNone; |
|
196 } |
|
197 |
|
198 // ----------------------------------------------------------------------------- |
|
199 // CSessionCommand::PauseAudioL |
|
200 // For an incoming track (MVTAudioSource) this function pauses sending |
|
201 // media to the sink (output device) and stops the sink. |
|
202 // ----------------------------------------------------------------------------- |
|
203 // |
|
204 TInt CSessionCommand::PauseAudioL(MVTAudioSource& aTrack) |
|
205 { |
|
206 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::PauseAudioL"))); |
|
207 CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(&aTrack); |
|
208 return KErrNone; |
|
209 } |
|
210 |
|
211 // ----------------------------------------------------------------------------- |
|
212 // CSessionCommand::ResumeVideoL |
|
213 // Resume a previously paused incoming or outgoing track. |
|
214 // ----------------------------------------------------------------------------- |
|
215 // |
|
216 TInt CSessionCommand::ResumeVideoL(MVTVideoSource& aTrack) |
|
217 { |
|
218 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResumeVideoL"))); |
|
219 return KErrNone; |
|
220 } |
|
221 |
|
222 // ----------------------------------------------------------------------------- |
|
223 // CSessionCommand::ResumeVideoL |
|
224 // Resume a previously paused incoming or outgoing track. |
|
225 // ----------------------------------------------------------------------------- |
|
226 // |
|
227 TInt CSessionCommand::ResumeVideoL(MVTVideoSink& aTrack) |
|
228 { |
|
229 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResumeVideoL"))); |
|
230 return KErrNone; |
|
231 } |
|
232 |
|
233 // ----------------------------------------------------------------------------- |
|
234 // CSessionCommand::ResumeAudioL |
|
235 // Resume a previously paused incoming or outgoing track. |
|
236 // ----------------------------------------------------------------------------- |
|
237 // |
|
238 TInt CSessionCommand::ResumeAudioL(MVTAudioSource& aTrack) |
|
239 { |
|
240 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResumeAudioL"))); |
|
241 CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(&aTrack); |
|
242 return KErrNone; |
|
243 } |
|
244 |
|
245 // ----------------------------------------------------------------------------- |
|
246 // CSessionCommand::CancelAllCommandsL |
|
247 // This API is to allow the user to cancel all pending requests. |
|
248 // ----------------------------------------------------------------------------- |
|
249 // |
|
250 TInt CSessionCommand::CancelAllCommandsL( ) |
|
251 { |
|
252 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::CancelAllCommandsL"))); |
|
253 return KErrNone; |
|
254 } |
|
255 |
|
256 // ----------------------------------------------------------------------------- |
|
257 // CSessionCommand::GetProtocolInterfaceL |
|
258 // This API is to allow for extensibility of the protocol interface. |
|
259 // ----------------------------------------------------------------------------- |
|
260 // |
|
261 TInt CSessionCommand::GetProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*& aProtocolCommand) |
|
262 { |
|
263 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::GetProtocolInterfaceL<"))); |
|
264 TInt commandId = 0; |
|
265 if (aType == EVtH324Config) |
|
266 { |
|
267 CH324ConfigCommand* H324ConfigCommand = new (ELeave)CH324ConfigCommand(); |
|
268 |
|
269 aProtocolCommand = H324ConfigCommand; |
|
270 } |
|
271 else if (aType == EVtVideoEncoderConfig) |
|
272 { |
|
273 CVideoConfigCommand* videoConfigCommand = new (ELeave)CVideoConfigCommand(); |
|
274 |
|
275 aProtocolCommand = videoConfigCommand; |
|
276 } |
|
277 else |
|
278 { |
|
279 ; |
|
280 } |
|
281 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::GetProtocolInterfaceL aType %d, aProtocolCommand %d>"), aType, aProtocolCommand)); |
|
282 return commandId; |
|
283 } |
|
284 |
|
285 // ----------------------------------------------------------------------------- |
|
286 // CSessionCommand::DeleteProtocolInterfaceL |
|
287 // This APIis to be used to release an interface that was previously obtained using |
|
288 // ----------------------------------------------------------------------------- |
|
289 // |
|
290 TInt CSessionCommand::DeleteProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand* aProtocolCommand) |
|
291 { |
|
292 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::DeleteProtocolInterfaceL<"))); |
|
293 TInt commandId = 0; |
|
294 if (aType == EVtH324Config) |
|
295 { |
|
296 CH324ConfigCommand* H324ConfigCommand = static_cast<CH324ConfigCommand*>(aProtocolCommand); |
|
297 |
|
298 delete H324ConfigCommand; |
|
299 } |
|
300 else if (aType == EVtVideoEncoderConfig) |
|
301 { |
|
302 CVideoConfigCommand* videoConfigCommand = static_cast<CVideoConfigCommand*>(aProtocolCommand); |
|
303 |
|
304 delete videoConfigCommand; |
|
305 } |
|
306 else |
|
307 { |
|
308 ; |
|
309 } |
|
310 __IF_DEBUG(Print(_L("VTProto: CSessionCommand::DeleteProtocolInterfaceL aType, aProtocolCommand %d>"), aType, aProtocolCommand)); |
|
311 return commandId; |
|
312 } |
|
313 |
|
314 // end of file |