|
1 /* |
|
2 * Copyright (c) 2004 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 #include "CMccController_stub.h" |
|
22 |
|
23 |
|
24 void CMccControllerStub::OpenL () |
|
25 { |
|
26 if ( !Stub() ) |
|
27 { |
|
28 CMccControllerStub* self = new (ELeave) CMccControllerStub(); |
|
29 CleanupStack::PushL( self ); |
|
30 User::LeaveIfError( Dll::SetTls( self ) ); |
|
31 CleanupStack::Pop( self ); |
|
32 } |
|
33 } |
|
34 |
|
35 void CMccControllerStub::Close () |
|
36 { |
|
37 CMccControllerStub* self = Stub(); |
|
38 delete self; |
|
39 Dll::SetTls( NULL ); |
|
40 } |
|
41 |
|
42 |
|
43 CMccControllerStub* CMccControllerStub::Stub() |
|
44 { |
|
45 return static_cast<CMccControllerStub*>(Dll::Tls()); |
|
46 } |
|
47 |
|
48 CMccControllerStub::CMccControllerStub() |
|
49 { |
|
50 Reset( ETrue ); |
|
51 } |
|
52 |
|
53 CMccControllerStub::~CMccControllerStub() |
|
54 { |
|
55 } |
|
56 |
|
57 |
|
58 void CMccControllerStub::Reset( TBool aAll ) |
|
59 { |
|
60 iActionPtr = 0; |
|
61 |
|
62 for( TInt i = 0; i < KMce_MM_MaxArray;i++) |
|
63 { |
|
64 iActions[ i ] = TAction(); |
|
65 } |
|
66 |
|
67 if ( aAll ) |
|
68 { |
|
69 iSessionID = 0; |
|
70 iLinkID = KMce_MM_LinkIdBase; |
|
71 iStreamID = KMce_MM_StreamIdBase; |
|
72 iEndpointID = KMce_MM_EndpointIdBase; |
|
73 iRequireSignalling = ETrue; |
|
74 iRefCount = 0; |
|
75 iStreamExists = -1; |
|
76 |
|
77 for( TInt i = 0; i < KMce_MM_MaxArray;i++) |
|
78 { |
|
79 iCodecs[ i ] = TCodecInfo(); |
|
80 } |
|
81 for( TInt j = 0; j < KMce_MM_MaxArray;j++) |
|
82 { |
|
83 iLinks[ j ] = TLink(); |
|
84 } |
|
85 } |
|
86 |
|
87 iSetFmtpFailure = EFalse; |
|
88 } |
|
89 |
|
90 void CMccControllerStub::SetCodec( TCodecInfo aCodecInfo ) |
|
91 { |
|
92 TInt i = 0; |
|
93 |
|
94 while( iCodecs[ i ].iStreamID != KMceNotAssigned && |
|
95 iCodecs[ i ].iStreamID != aCodecInfo.iStreamID ) |
|
96 { |
|
97 if ( i == KMce_MM_MaxArray - 1 ) |
|
98 { |
|
99 User::Panic( _L(""), KErrNotFound ); |
|
100 } |
|
101 else |
|
102 { |
|
103 i++; |
|
104 } |
|
105 } |
|
106 |
|
107 iCodecs[ i ] = aCodecInfo; |
|
108 } |
|
109 |
|
110 void CMccControllerStub::GetCodec( TCodecInfo& aCodecInfo ) |
|
111 { |
|
112 TInt i = 0; |
|
113 |
|
114 while( iCodecs[ i ].iStreamID != aCodecInfo.iStreamID ) |
|
115 { |
|
116 if ( i == KMce_MM_MaxArray - 1 ) |
|
117 { |
|
118 User::Panic( _L(""), KErrNotFound ); |
|
119 } |
|
120 else |
|
121 { |
|
122 i++; |
|
123 } |
|
124 } |
|
125 |
|
126 aCodecInfo = iCodecs[ i ]; |
|
127 |
|
128 } |
|
129 |
|
130 void CMccControllerStub::CreateStream( TLink aLink ) |
|
131 { |
|
132 TInt i = 0; |
|
133 |
|
134 |
|
135 while( iLinks[ i ].iSessionID != KMceNotAssigned && |
|
136 iLinks[ i ].iSessionID != aLink.iSessionID && |
|
137 iLinks[ i ].iLinkID != aLink.iLinkID ) |
|
138 { |
|
139 if ( i == KMce_MM_MaxArray - 1 ) |
|
140 { |
|
141 User::Panic( _L(""), KErrNotFound ); |
|
142 } |
|
143 else |
|
144 { |
|
145 i++; |
|
146 } |
|
147 } |
|
148 |
|
149 iLinks[ i ].iSessionID = aLink.iSessionID; |
|
150 iLinks[ i ].iLinkID = aLink.iLinkID; |
|
151 iLinks[ i ].iStreams++; |
|
152 |
|
153 } |
|
154 |
|
155 CMccControllerStub::TLink& CMccControllerStub::GetLink( const TLink& aLink ) |
|
156 { |
|
157 TInt i = 0; |
|
158 |
|
159 while( iLinks[ i ].iSessionID != aLink.iSessionID && |
|
160 iLinks[ i ].iLinkID != aLink.iLinkID ) |
|
161 { |
|
162 if ( i == KMce_MM_MaxArray - 1 ) |
|
163 { |
|
164 User::Panic( _L(""), KErrNotFound ); |
|
165 } |
|
166 else |
|
167 { |
|
168 i++; |
|
169 } |
|
170 } |
|
171 |
|
172 return iLinks[ i ]; |
|
173 |
|
174 } |
|
175 |
|
176 |
|
177 TUint32 CMccControllerStub::NextSessionId() |
|
178 { |
|
179 return iSessionID++; |
|
180 } |
|
181 |
|
182 TUint32 CMccControllerStub::NextLinkId() |
|
183 { |
|
184 return iLinkID++; |
|
185 } |
|
186 |
|
187 TUint32 CMccControllerStub::NextStreamId() |
|
188 { |
|
189 return iStreamID++; |
|
190 } |
|
191 |
|
192 TUint32 CMccControllerStub::NextEndpointId() |
|
193 { |
|
194 if ( !iEndpointID ) |
|
195 { |
|
196 iEndpointID++; |
|
197 } |
|
198 return iEndpointID++; |
|
199 } |
|
200 |
|
201 TBool CMccControllerStub::StreamsExists( TUint32 aSessionId, |
|
202 TUint32 aLinkId ) |
|
203 { |
|
204 TLink link; |
|
205 link.iSessionID = aSessionId; |
|
206 link.iLinkID = aLinkId; |
|
207 |
|
208 return iStreamExists == -1 ? GetLink( link ).iStreams > 0 : iStreamExists == 1; |
|
209 } |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 TInt CMccControllerStub::ControllerCalled( TMMCActionType aAction, |
|
215 TUint32 aSessionID, |
|
216 TUint32 aLinkID, |
|
217 TUint32 aStreamID, |
|
218 TUint32 aEndpointID, |
|
219 TUint32 aLinkType, |
|
220 TUint32 aStreamType ) |
|
221 |
|
222 { |
|
223 TAction action; |
|
224 action.iAction = aAction; |
|
225 action.iSessionID = aSessionID; |
|
226 action.iLinkID = aLinkID; |
|
227 action.iStreamID = aStreamID; |
|
228 action.iEndpointID = aEndpointID; |
|
229 action.iLinkType = aLinkType; |
|
230 action.iStreamType = aStreamType; |
|
231 action.iPaused = KMceNotAssigned; |
|
232 action.iEnableRTCP = KMceNotAssigned; |
|
233 |
|
234 iActions[ iActionPtr++ ] = action; |
|
235 iActionPtr = iActionPtr < KMce_MM_MaxArray-1 ? iActionPtr : 0; |
|
236 |
|
237 if ( aAction == EMccCreateStream ) |
|
238 { |
|
239 TLink link; |
|
240 link.iSessionID = aSessionID; |
|
241 link.iLinkID = aLinkID; |
|
242 CreateStream( link ); |
|
243 |
|
244 } |
|
245 else if ( aAction == EMccDeleteStream ) |
|
246 { |
|
247 TLink link; |
|
248 link.iSessionID = aSessionID; |
|
249 link.iLinkID = aLinkID; |
|
250 TLink& l = GetLink( link ); |
|
251 l.iStreams--; |
|
252 } |
|
253 |
|
254 return iLeaveError; |
|
255 |
|
256 } |
|
257 |
|
258 TInt CMccControllerStub::ControllerStreamCtrCalled( TMMCActionType aAction, |
|
259 TUint32 aSessionID, |
|
260 TUint32 aLinkID, |
|
261 TUint32 aStreamID, |
|
262 TUint32 aEndpointID, |
|
263 TUint32 aPaused, |
|
264 TUint32 aEnableRTCP ) |
|
265 |
|
266 { |
|
267 TAction action; |
|
268 action.iAction = aAction; |
|
269 action.iSessionID = aSessionID; |
|
270 action.iLinkID = aLinkID; |
|
271 action.iStreamID = aStreamID; |
|
272 action.iEndpointID = aEndpointID; |
|
273 action.iLinkType = KMceNotAssigned; |
|
274 action.iStreamType = KMceNotAssigned; |
|
275 action.iPaused = aPaused; |
|
276 action.iEnableRTCP = aEnableRTCP; |
|
277 action.iKey = KMceNotAssigned; |
|
278 action.iParamSet = KMceNotAssigned; |
|
279 |
|
280 iActions[ iActionPtr++ ] = action; |
|
281 |
|
282 iActionPtr = iActionPtr < KMce_MM_MaxArray-1 ? iActionPtr : 0; |
|
283 |
|
284 if ( aAction == EMccCreateStream ) |
|
285 { |
|
286 TLink link; |
|
287 link.iSessionID = aSessionID; |
|
288 link.iLinkID = aLinkID; |
|
289 CreateStream( link ); |
|
290 |
|
291 } |
|
292 else if ( aAction == EMccDeleteStream ) |
|
293 { |
|
294 TLink link; |
|
295 link.iSessionID = aSessionID; |
|
296 link.iLinkID = aLinkID; |
|
297 TLink& l = GetLink( link ); |
|
298 l.iStreams--; |
|
299 } |
|
300 |
|
301 |
|
302 return iLeaveError; |
|
303 |
|
304 } |
|
305 |
|
306 |
|
307 TInt CMccControllerStub::ControllerStreamSettings( TUint32 aSessionID, |
|
308 TUint32 aLinkID, |
|
309 TUint32 aStreamID, |
|
310 TUint32 aEndpointID, |
|
311 TUint32 aKey, |
|
312 TUint32 aSet ) |
|
313 { |
|
314 TAction action; |
|
315 action.iAction = EMccStreamSettings; |
|
316 action.iSessionID = aSessionID; |
|
317 action.iLinkID = aLinkID; |
|
318 action.iStreamID = aStreamID; |
|
319 action.iEndpointID = aEndpointID; |
|
320 action.iLinkType = KMceNotAssigned; |
|
321 action.iStreamType = KMceNotAssigned; |
|
322 action.iPaused = KMceNotAssigned; |
|
323 action.iEnableRTCP = KMceNotAssigned; |
|
324 action.iKey = aKey; |
|
325 action.iParamSet = aSet; |
|
326 |
|
327 iActions[ iActionPtr++ ] = action; |
|
328 |
|
329 iActionPtr = iActionPtr < KMce_MM_MaxArray-1 ? iActionPtr : 0; |
|
330 |
|
331 return iLeaveError; |
|
332 |
|
333 |
|
334 } |
|
335 |
|
336 TInt CMccControllerStub::ControllerSignal( TUint32 aSessionID, |
|
337 TUint32 aLinkID, |
|
338 TUint32 aStreamID, |
|
339 TUint32 aEndpointID, |
|
340 TUint32 aEventType ) |
|
341 { |
|
342 TAction action; |
|
343 action.iAction = EMccSendMediaSignal; |
|
344 action.iSessionID = aSessionID; |
|
345 action.iLinkID = aLinkID; |
|
346 action.iStreamID = aStreamID; |
|
347 action.iEndpointID = aEndpointID; |
|
348 action.iLinkType = KMceNotAssigned; |
|
349 action.iStreamType = KMceNotAssigned; |
|
350 action.iPaused = KMceNotAssigned; |
|
351 action.iEnableRTCP = KMceNotAssigned; |
|
352 action.iKey = KMceNotAssigned; |
|
353 action.iParamSet = KMceNotAssigned; |
|
354 action.iEventType = aEventType; |
|
355 |
|
356 iActions[ iActionPtr++ ] = action; |
|
357 |
|
358 iActionPtr = iActionPtr < KMce_MM_MaxArray-1 ? iActionPtr : 0; |
|
359 |
|
360 return iLeaveError; |
|
361 |
|
362 |
|
363 } |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 //end of file |