|
1 /* |
|
2 * Copyright (c) 2002 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: Audio Output Control Utility |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CAudioOutputControlTestClass_H |
|
21 #define CAudioOutputControlTestClass_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <StifLogger.h> |
|
25 #include <TestScripterInternal.h> |
|
26 #include <StifTestModule.h> |
|
27 |
|
28 #include <e32svr.h> |
|
29 #include <e32base.h> |
|
30 #include <e32cons.h> |
|
31 //#include <DataSourceAdapter.h> |
|
32 |
|
33 |
|
34 |
|
35 #include <customInterfaceUtility.h> |
|
36 #include <SoundDevice.h> |
|
37 #include <ConfigurationComponentsFactory.h> |
|
38 #include <AudioOutputControlUtility.h> |
|
39 #include <DRMConfigIntfc.h> |
|
40 #include <DataBufferSource.h> |
|
41 |
|
42 #include <StreamControl.h> |
|
43 #include <ControlObserver.h> |
|
44 #include <Events.h> |
|
45 #include <ProgDLSource.h> |
|
46 #include <DataBufferSource.h> |
|
47 #include <FileSource.h> |
|
48 #include <DataBuffer.h> |
|
49 #include <MMControlFactory.h> |
|
50 #include <SinkControl.h> |
|
51 #include <badesca.h> |
|
52 #include <MimeTypes.h> |
|
53 #include <DescriptorSource.h> |
|
54 #include <VolumeControl.h> |
|
55 |
|
56 #include <StreamControlObserver.h> |
|
57 #include <SourceControlObserver.h> |
|
58 #include "TimeoutController.h" |
|
59 using namespace multimedia; |
|
60 |
|
61 |
|
62 // CONSTANTS |
|
63 const TInt KErrBadTestParameter= -1000; // Error on configuration file |
|
64 |
|
65 const TInt KErrEventPending =-2000; // Timeout and not callback |
|
66 const TInt KErrCallbackErrorCode = -2001; // Callback return error code |
|
67 const TInt KErrUnexpectedValue =-2002; // Unexpected value at setting |
|
68 const TInt KErrTimeoutController = -2007; // Unexpected notification |
|
69 |
|
70 const TInt KShortTimeout = 1000; |
|
71 const TInt KMediumTimeout = 4000; |
|
72 const TInt KLongTimeout = 100000; |
|
73 |
|
74 // Uid identifying Stream Control |
|
75 /*const TUid KStreamControl = {0x10207B44}; |
|
76 const TUid KMMFAudioOutputSinkControl = {0x101F53B9}; |
|
77 // Uid identifying Volume Control |
|
78 const TUid KVolumeEffectControl = {0x10207B75};*/ |
|
79 |
|
80 _LIT( KMsgBadTestParameters, "[Error] No valid test case parameters"); |
|
81 |
|
82 // General |
|
83 _LIT( KTagG711, "G711"); |
|
84 _LIT( KTagOutput32Bit, "Output32Bit"); |
|
85 _LIT( KTagDownMixToStereo, "DownMixToStereo"); |
|
86 _LIT( KTagLostDataConcealment, "LostDataConcealment"); |
|
87 _LIT( KTagTrue, "True"); |
|
88 _LIT( KTagFalse, "False"); |
|
89 |
|
90 // MACROS |
|
91 //#define ?macro ?macro_def |
|
92 // Logging path |
|
93 #ifdef __WINSCW__ |
|
94 _LIT( KAudioOutputControlTestClassLogPath, "\\logs\\testframework\\" ); |
|
95 #else |
|
96 _LIT( KAudioOutputControlTestClassLogPath, "e:\\testing\\Log\\" ); |
|
97 #endif |
|
98 |
|
99 // Log file |
|
100 _LIT( KAudioOutputControlTestClassLogFile, "AudioOutputControlTestClass.txt" ); |
|
101 |
|
102 |
|
103 // FORWARD DECLARATIONS |
|
104 class CAudioOutputControlTestClass; |
|
105 |
|
106 class CConfigurationComponentsFactory; |
|
107 class CMMFDevSound; |
|
108 class CAudioOutputControlUtility; |
|
109 |
|
110 using multimedia::MStreamControl; |
|
111 using multimedia::MControlObserver; |
|
112 using multimedia::MProgDLSource; |
|
113 using multimedia::MDataBufferSource; |
|
114 using multimedia::MDescriptorSource; |
|
115 using multimedia::MDataBuffer; |
|
116 using multimedia::MControl; |
|
117 using multimedia::CMultimediaFactory; |
|
118 using multimedia::MSinkControl; |
|
119 using multimedia::MFileSource; |
|
120 using multimedia::MVolumeControl; |
|
121 |
|
122 //_LIT(KRm1TestFile,"C:\\10sec_16Kbps_Voice_Wideband.rm"); |
|
123 _LIT(KRm1TestFile,"C:\\Sounds\\RM128k_RA10_stereo.rm"); |
|
124 _LIT(KPcmTestFile,"C:\\Sounds\\T48000mo.pcm"); |
|
125 _LIT(KWAVTestFile,"C:\\Sounds\\opera.wav"); |
|
126 _LIT(KMp3TestFile,"C:\\Sounds\\test.mp3"); |
|
127 |
|
128 // CLASS DECLARATION |
|
129 |
|
130 /** |
|
131 * CRadioUtilityTestClass test class for STIF Test Framework TestScripter. |
|
132 * ?other_description_lines |
|
133 * |
|
134 * @lib ?library |
|
135 * @since Series60_3_2 |
|
136 */ |
|
137 NONSHARABLE_CLASS(CAudioOutputControlTestClass) : public CScriptBase, |
|
138 public MTimeoutObserver, |
|
139 public MDevSoundObserver, |
|
140 MControlObserver//, |
|
141 //public MMdaAudioOutputStreamCallback |
|
142 // public MRadioFmTunerObserver, |
|
143 // public MRadioPlayerObserver, |
|
144 // public MRadioRdsObserver |
|
145 /*public MRadioPresetObserver*/ |
|
146 { |
|
147 public: // Constructors and destructor |
|
148 |
|
149 /** |
|
150 * Two-phased constructor. |
|
151 */ |
|
152 static CAudioOutputControlTestClass* NewL( CTestModuleIf& aTestModuleIf ); |
|
153 |
|
154 /** |
|
155 * Destructor. |
|
156 */ |
|
157 virtual ~CAudioOutputControlTestClass(); |
|
158 |
|
159 enum TG711ExpectedEvent |
|
160 { |
|
161 EInitializeComplete, |
|
162 |
|
163 }; |
|
164 |
|
165 public: // New functions |
|
166 |
|
167 /** |
|
168 * ?member_description. |
|
169 * @since ?Series60_version |
|
170 * @param ?arg1 |
|
171 * @return |
|
172 */ |
|
173 //?type ?member_function( ?type ?arg1 ); |
|
174 |
|
175 public: // Functions from base classes |
|
176 |
|
177 /** |
|
178 * From CScriptBase Runs a script line. |
|
179 * @since ?Series60_version |
|
180 * @param aItem Script line containing method name and parameters |
|
181 * @return Symbian OS error code |
|
182 */ |
|
183 virtual TInt RunMethodL( CStifItemParser& aItem ); |
|
184 |
|
185 |
|
186 // Required for MDevSoundObserver: |
|
187 void InitializeComplete(TInt /*aError*/); |
|
188 void ToneFinished(TInt /*aError*/); |
|
189 void BufferToBeFilled(CMMFBuffer* /*aBuffer*/); |
|
190 void PlayError(TInt /*aError*/); |
|
191 void BufferToBeEmptied(CMMFBuffer* /*aBuffer*/); |
|
192 void RecordError(TInt /*aError*/); |
|
193 void ConvertError(TInt /*aError*/); |
|
194 void DeviceMessage(TUid /*aMessageType*/, const TDesC8& /*aMsg*/); |
|
195 |
|
196 // Audio Output Stream |
|
197 //virtual void MaoscOpenComplete(TInt aError); |
|
198 //virtual void MaoscBufferCopied(TInt aError, const TDesC8& aBuffer); |
|
199 //virtual void MaoscPlayComplete(TInt aError); |
|
200 |
|
201 // From MTimeoutObserver |
|
202 |
|
203 //MCONTROL OBSERVER |
|
204 virtual void Event( MControl* aObject,TUint aEvent, TAny* aData ); |
|
205 |
|
206 |
|
207 /** |
|
208 * @since ?Series60_version |
|
209 * @param none |
|
210 * Review if all the expected events have ocurred once the time is over |
|
211 */ |
|
212 void HandleTimeout(TInt error); |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 protected: // New functions |
|
218 |
|
219 /** |
|
220 * ?member_description. |
|
221 * @since ?Series60_version |
|
222 * @param ?arg1 |
|
223 * @return |
|
224 */ |
|
225 //?type ?member_function( ?type ?arg1 ); |
|
226 |
|
227 protected: // Functions from base classes |
|
228 |
|
229 /** |
|
230 * From ?base_class ?member_description |
|
231 */ |
|
232 //?type ?member_function(); |
|
233 |
|
234 private: |
|
235 |
|
236 /** |
|
237 * C++ default constructor. |
|
238 */ |
|
239 CAudioOutputControlTestClass( CTestModuleIf& aTestModuleIf ); |
|
240 |
|
241 /** |
|
242 * By default Symbian 2nd phase constructor is private. |
|
243 */ |
|
244 void ConstructL(); |
|
245 |
|
246 // Prohibit copy constructor if not deriving from CBase. |
|
247 // ?classname( const ?classname& ); |
|
248 // Prohibit assigment operator if not deriving from CBase. |
|
249 // ?classname& operator=( const ?classname& ); |
|
250 |
|
251 /** |
|
252 * Frees all resources allocated from test methods. |
|
253 * @since ?Series60_version |
|
254 */ |
|
255 void Delete(); |
|
256 |
|
257 /** |
|
258 * Test methods are listed below. |
|
259 */ |
|
260 |
|
261 /** |
|
262 * Example test method. |
|
263 * @since ?Series60_version |
|
264 * @param aItem Script line containing parameters. |
|
265 * @return Symbian OS error code. |
|
266 */ |
|
267 |
|
268 /** |
|
269 * Set an event as expected and set default timeout |
|
270 * @since ?Series60_version |
|
271 */ |
|
272 void AddExpectedEvent(TG711ExpectedEvent event, TInt ms); |
|
273 |
|
274 |
|
275 /** |
|
276 * Unset an event as expected |
|
277 * @since ?Series60_version |
|
278 */ |
|
279 TBool RemoveExpectedEvent(TG711ExpectedEvent event); |
|
280 |
|
281 |
|
282 /** |
|
283 * @since ?Series60_version |
|
284 * @param none |
|
285 * Removes all expected events |
|
286 */ |
|
287 void RemoveAllExpectedEvents(); |
|
288 |
|
289 /** |
|
290 * Verify that the event was expected, removes it from the list |
|
291 * Signal the TestScripter with the returned error code |
|
292 * @since ?Series60_version |
|
293 */ |
|
294 void ProcessEvent(TG711ExpectedEvent aEvent, TInt aError); |
|
295 |
|
296 /** |
|
297 * Maps a event with a descriptor with its name |
|
298 * @since ?Series60_version |
|
299 */ |
|
300 TPtrC EventName( TInt aKey ); |
|
301 |
|
302 /* |
|
303 * Test methods are listed below. |
|
304 */ |
|
305 |
|
306 /** |
|
307 * Sets a timeout different since the default |
|
308 * @since Series60_3_2 |
|
309 * @param aItem Script line containing parameters. |
|
310 * @return Symbian OS error code. |
|
311 */ |
|
312 TInt SetTimeout( CStifItemParser& aItem ); |
|
313 |
|
314 /** |
|
315 * |
|
316 * @since Series60_3_2 |
|
317 * @param aItem Script line containing parameters. |
|
318 * @return Symbian OS error code. |
|
319 */ |
|
320 TInt SetExpectedEvents( CStifItemParser& aItem ); |
|
321 |
|
322 /** |
|
323 * |
|
324 * @since Series60_3_2 |
|
325 * @param aItem Script line containing parameters. |
|
326 * @return Symbian OS error code. |
|
327 */ |
|
328 TInt SetAllowedPanic( CStifItemParser& aItem ); |
|
329 |
|
330 /** |
|
331 * Connect to the default client to the server |
|
332 * @since ?Series60_version |
|
333 * @param aItem Script line containing parameters. |
|
334 * @return Symbian OS error code. |
|
335 */ |
|
336 |
|
337 TInt ExampleL( CStifItemParser& aItem ); |
|
338 // TInt CreateAudioOutputControl( CStifItemParser& aItem ); |
|
339 TInt CreateObject( CStifItemParser& aItem ); |
|
340 TInt ConfigureAudioOutput( CStifItemParser& aItem ); |
|
341 TInt SetDRMConfigIntfc( CStifItemParser& aItem ); |
|
342 TInt CreateRestrictedAudioOutput(CStifItemParser& aItem ); |
|
343 |
|
344 void SourceMenuResetEOFFlag(); |
|
345 |
|
346 |
|
347 TInt SetDRMConfig( CStifItemParser& aItem ); |
|
348 TInt CalcPref( CStifItemParser& aItem ); |
|
349 |
|
350 |
|
351 public: // Data |
|
352 // ?one_line_short_description_of_data |
|
353 //?data_declaration; |
|
354 |
|
355 protected: // Data |
|
356 // ?one_line_short_description_of_data |
|
357 //?data_declaration; |
|
358 |
|
359 private: // Data |
|
360 |
|
361 // reference to TestModuleIf |
|
362 CTestModuleIf& iTestModuleIf; |
|
363 |
|
364 MDataSource* aSource; |
|
365 |
|
366 |
|
367 CMMFDevSound* iDevSound; |
|
368 // CRestrictedAudioOutput* iRestrictedAudioOutput; |
|
369 CAudioOutputControlUtility* iAudioOutputControlUtility; |
|
370 MSourceControl* iSourceControl; |
|
371 |
|
372 CConfigurationComponentsFactory* iFactory; |
|
373 CMultimediaFactory* iFactorys; |
|
374 //CAudioOutputControl* iAudioOutputControl; |
|
375 |
|
376 // Active object with a timer to timeout the test case |
|
377 CSimpleTimeout * iTimeoutController; |
|
378 |
|
379 // Indicates if the test case use a normal exit reason |
|
380 TBool iNormalExitReason; |
|
381 |
|
382 // List of expected events |
|
383 RArray<TG711ExpectedEvent> iExpectedEvents; |
|
384 |
|
385 // List of notification event (by the callback) |
|
386 RArray<TG711ExpectedEvent> iOcurredEvents; |
|
387 |
|
388 CDRMConfigIntfc* iDRMConfigIntfc; |
|
389 |
|
390 MDataBufferSource* iMDataBufferSource; |
|
391 MStreamControl* iMStreamControl; |
|
392 MVolumeControl* iMVolumeControl; |
|
393 MSinkControl* iMAudioSink; |
|
394 |
|
395 TBool iIsEOFReached; |
|
396 TInt iBytesReadFromFile; |
|
397 TInt iMaxVolume; |
|
398 RFs iFs; |
|
399 RFile iFile; |
|
400 |
|
401 |
|
402 |
|
403 CRestrictedAudioOutput* iRestrictedAudioOutput; |
|
404 |
|
405 |
|
406 // ?one_line_short_description_of_data |
|
407 //?data_declaration; |
|
408 |
|
409 // Reserved pointer for future extension |
|
410 //TAny* iReserved; |
|
411 |
|
412 public: // Friend classes |
|
413 //?friend_class_declaration; |
|
414 protected: // Friend classes |
|
415 //?friend_class_declaration; |
|
416 private: // Friend classes |
|
417 //?friend_class_declaration; |
|
418 |
|
419 }; |
|
420 |
|
421 #endif // CAudioOutputControlTestClass_H |
|
422 |
|
423 // End of File |