|
1 /* |
|
2 * Copyright (c) 2009 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 // Method : |
|
21 // Purpose : Working as a stub for NAT Connectivity FW tests |
|
22 // Parameters : |
|
23 // Return Value: |
|
24 //******************************************************************************* |
|
25 #include <e32base.h> |
|
26 #include <e32debug.h> |
|
27 #include <mmccinterface.h> |
|
28 #include <mmccevents.h> |
|
29 |
|
30 #include "mediateststubs.h" |
|
31 #include "natfwcandidate.h" |
|
32 #include "testconsolestubsobserver.h" |
|
33 |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // CMediaTestStubs::CMediaTestStubs |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 CMediaTestStubs* CMediaTestStubs::NewL( CConsoleBase& aConsole ) |
|
40 { |
|
41 CMediaTestStubs* self = new (ELeave) CMediaTestStubs( aConsole ); |
|
42 CleanupStack::PushL( self ); |
|
43 self->ConstructL(); |
|
44 CleanupStack::Pop( self ); |
|
45 return self; |
|
46 } |
|
47 |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // CMediaTestStubs::CMediaTestStubs |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 CMediaTestStubs::CMediaTestStubs( CConsoleBase& aConsole ): |
|
54 CNATConnFWTestConsoleStubs( aConsole ) |
|
55 { |
|
56 } |
|
57 |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // CMediaTestStubs::~CMediaTestStubs |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 CMediaTestStubs::~CMediaTestStubs() |
|
64 { |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // CMediaTestStubs::SetObserver |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 void CMediaTestStubs::SetObserver( MTestConsoleStubsObserver* aObserver ) |
|
72 { |
|
73 iObserver = aObserver; |
|
74 } |
|
75 |
|
76 void CMediaTestStubs::MccEventReceived( const TMccEvent& aEvent ) |
|
77 { |
|
78 RDebug::Print( _L("TEST PRINT: CMediaTestStubs::MccEventReceived Event:%d"), |
|
79 aEvent.iEventType ); |
|
80 |
|
81 TMccNetSettingsPackage package; |
|
82 package.Copy( aEvent.iEventData ); |
|
83 TBuf<50> localAddr; |
|
84 TBuf<50> localPublicAddr; |
|
85 |
|
86 iNetsettings = package(); |
|
87 |
|
88 if ( KMccLinkCreated == aEvent.iEventType ) |
|
89 { |
|
90 CActiveScheduler::Stop(); |
|
91 iActive = EFalse; |
|
92 } |
|
93 } |
|
94 |
|
95 void CMediaTestStubs::MccMediaStarted( TUint32 aSessionId, |
|
96 TUint32 aLinkId, |
|
97 TUint32 aStreamId, |
|
98 TUint32 aSinkSourceId ) |
|
99 { |
|
100 RDebug::Print( _L("TEST PRINT: CMediaTestStubs::MccMediaStarted") ); |
|
101 RDebug::Print( _L("TEST PRINT: SESSID: %u, LINKID: %u, STREAMID: %u, SINKSOURCEID: %u"), |
|
102 aSessionId, aLinkId, aStreamId, aSinkSourceId ); |
|
103 |
|
104 CActiveScheduler::Stop(); |
|
105 iActive = EFalse; |
|
106 } |
|
107 |
|
108 void CMediaTestStubs::MccMediaStopped( TUint32 aSessionId, |
|
109 TUint32 aLinkId, |
|
110 TUint32 aStreamId, |
|
111 TUint32 aSinkSourceId ) |
|
112 { |
|
113 RDebug::Print( _L("TEST PRINT: CMediaTestStubs::MccMediaStopped") ); |
|
114 RDebug::Print( _L("TEST PRINT: SESSID: %u, LINKID: %u, STREAMID: %u, SINKSOURCEID: %u"), |
|
115 aSessionId, aLinkId, aStreamId, aSinkSourceId ); |
|
116 /* |
|
117 TMccEvent event = TMccEvent( aSessionId, aLinkId, aStreamId, aSinkSourceId, |
|
118 KMccEventCategoryStream, KMccStreamStopped, KErrNone, KNullDesC8 ); |
|
119 */ |
|
120 } |
|
121 |
|
122 |
|
123 // --------------------------------------------------------------------------- |
|
124 // CMuxTestConsoleStubs:: |
|
125 // |
|
126 // --------------------------------------------------------------------------- |
|
127 // |
|
128 void CMediaTestStubs::MccMediaPaused( TUint32 aSessionId, |
|
129 TUint32 aLinkId, |
|
130 TUint32 aStreamId, |
|
131 TUint32 aSinkSourceId ) |
|
132 { |
|
133 RDebug::Print( _L("TEST PRINT: CMediaTestStubs::MccMediaPaused") ); |
|
134 RDebug::Print( _L("TEST PRINT: SESSID: %u, LINKID: %u, STREAMID: %u, SINKSOURCEID: %u"), |
|
135 aSessionId, aLinkId, aStreamId, aSinkSourceId ); |
|
136 /* |
|
137 TMccEvent event = TMccEvent( aSessionId, aLinkId, aStreamId, aSinkSourceId, |
|
138 KMccEventCategoryStream, KMccStreamPaused, KErrNone, KNullDesC8 ); |
|
139 */ |
|
140 } |
|
141 |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // CMuxTestConsoleStubs:: |
|
145 // |
|
146 // --------------------------------------------------------------------------- |
|
147 // |
|
148 void CMediaTestStubs::MccMediaResumed( TUint32 aSessionId, |
|
149 TUint32 aLinkId, |
|
150 TUint32 aStreamId, |
|
151 TUint32 aSinkSourceId ) |
|
152 { |
|
153 RDebug::Print( _L("TEST PRINT: CMediaTestStubs::MccMediaResumed") ); |
|
154 RDebug::Print( _L("TEST PRINT: SESSID: %u, LINKID: %u, STREAMID: %u, SINKSOURCEID: %u"), |
|
155 aSessionId, aLinkId, aStreamId, aSinkSourceId ); |
|
156 /* |
|
157 TMccEvent event = TMccEvent( aSessionId, aLinkId, aStreamId, aSinkSourceId, |
|
158 KMccEventCategoryStream, KMccStreamResumed, KErrNone, KNullDesC8 ); |
|
159 */ |
|
160 } |
|
161 |
|
162 |
|
163 // --------------------------------------------------------------------------- |
|
164 // CMuxTestConsoleStubs:: |
|
165 // |
|
166 // --------------------------------------------------------------------------- |
|
167 // |
|
168 void CMediaTestStubs::MccMediaPrepared( TUint32 aSessionId, |
|
169 TUint32 aLinkId, |
|
170 TUint32 aStreamId, |
|
171 TUint32 aSinkSourceId ) |
|
172 { |
|
173 RDebug::Print( _L("TEST PRINT: CMediaTestStubs::MccMediaPrepared") ); |
|
174 RDebug::Print( _L("TEST PRINT: SESSID: %u, LINKID: %u, STREAMID: %u, SINKSOURCEID: %u"), |
|
175 aSessionId, aLinkId, aStreamId, aSinkSourceId ); |
|
176 /* |
|
177 TMccEvent event = TMccEvent( aSessionId, aLinkId, aStreamId, aSinkSourceId, |
|
178 KMccEventCategoryStream, KMccStreamPrepared, KErrNone, KNullDesC8 ); |
|
179 */ |
|
180 CActiveScheduler::Stop(); |
|
181 iActive = EFalse; |
|
182 } |
|
183 |
|
184 // --------------------------------------------------------------------------- |
|
185 // CMuxTestConsoleStubs:: |
|
186 // |
|
187 // --------------------------------------------------------------------------- |
|
188 // |
|
189 void CMediaTestStubs::MccMediaInactive( TUint32 aSessionId, |
|
190 TUint32 aLinkId, |
|
191 TUint32 aStreamId, |
|
192 TUint32 aSinkSourceId ) |
|
193 { |
|
194 RDebug::Print( _L("TEST PRINT: CMediaTestStubs::MccMediaInactive" ) ); |
|
195 RDebug::Print( _L("TEST PRINT: SESSID: %u, LINKID: %u, STREAMID: %u, SINKSOURCEID: %u"), |
|
196 aSessionId, aLinkId, aStreamId, aSinkSourceId ); |
|
197 /* |
|
198 TMccEvent event = TMccEvent( aSessionId, aLinkId, aStreamId, aSinkSourceId, |
|
199 KMccEventCategoryRtp, KMccInactivityEvent, KErrNone, KNullDesC8 ); |
|
200 */ |
|
201 } |
|
202 |
|
203 |
|
204 // --------------------------------------------------------------------------- |
|
205 // CMuxTestConsoleStubs:: |
|
206 // |
|
207 // --------------------------------------------------------------------------- |
|
208 // |
|
209 void CMediaTestStubs::MccMediaActive( TUint32 aSessionId, |
|
210 TUint32 aLinkId, |
|
211 TUint32 aStreamId, |
|
212 TUint32 aSinkSourceId ) |
|
213 { |
|
214 RDebug::Print( _L("TEST PRINT: CMediaTestStubs::MccMediaActive") ); |
|
215 RDebug::Print( _L("TEST PRINT: SESSID: %u, LINKID: %u, STREAMID: %u, SINKSOURCEID: %u"), |
|
216 aSessionId, aLinkId, aStreamId, aSinkSourceId ); |
|
217 /* |
|
218 TMccEvent event = TMccEvent( aSessionId, aLinkId, aStreamId, aSinkSourceId, |
|
219 KMccEventCategoryRtp, KMccActivityEvent, KErrNone, KNullDesC8 ); |
|
220 */ |
|
221 } |
|
222 |
|
223 |
|
224 // --------------------------------------------------------------------------- |
|
225 // CMuxTestConsoleStubs:: |
|
226 // |
|
227 // --------------------------------------------------------------------------- |
|
228 // |
|
229 void CMediaTestStubs::MccCtrlError( TInt aError, |
|
230 TUint32 aSessionId, |
|
231 TUint32 aLinkId, |
|
232 TUint32 aStreamId, |
|
233 TUint32 aSinkSourceId ) |
|
234 { |
|
235 RDebug::Print( _L("TEST PRINT: CMediaTestStubs::MccCtrlError, ERR: %d"), aError ); |
|
236 RDebug::Print( _L("TEST PRINT: SESSID: %u, LINKID: %u, STREAMID: %u, SINKSOURCEID: %u"), |
|
237 aSessionId, aLinkId, aStreamId, aSinkSourceId ); |
|
238 /* |
|
239 TMccEvent event = TMccEvent( aSessionId, aLinkId, aStreamId, aSinkSourceId, |
|
240 KMccEventCategoryStream, KMccStreamError, aError, KNullDesC8 ); |
|
241 */ |
|
242 } |
|
243 |
|
244 |
|
245 // --------------------------------------------------------------------------- |
|
246 // CMuxTestConsoleStubs:: |
|
247 // |
|
248 // --------------------------------------------------------------------------- |
|
249 // |
|
250 void CMediaTestStubs::UnknownMediaReceived( TUint32 aSessionId, |
|
251 TUint32 /*aLinkId*/, |
|
252 TUint32 aStreamId, |
|
253 TUint32 /*aSinkSourceId*/, |
|
254 TUint8 aPayloadType ) |
|
255 { |
|
256 RDebug::Print( _L("TEST PRINT: CMediaTestStubs::UnknownMediaReceived") ); |
|
257 RDebug::Print( _L("TEST PRINT: SESSID: %u, STREAMID: %u, PT: %u"), |
|
258 aSessionId, aStreamId, aPayloadType ); |
|
259 } |
|
260 |
|
261 |
|
262 // --------------------------------------------------------------------------- |
|
263 // CMuxTestConsoleStubs:: |
|
264 // |
|
265 // --------------------------------------------------------------------------- |
|
266 // |
|
267 TMccNetSettings& CMediaTestStubs::NetSettings() |
|
268 { |
|
269 return iNetsettings; |
|
270 } |