0
|
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: AudioroutingControl test module
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <e32svr.h>
|
|
22 |
#include <StifParser.h>
|
|
23 |
#include <Stiftestinterface.h>
|
|
24 |
#include "AudioRoutingTestClass.h"
|
|
25 |
#include "debug.h"
|
|
26 |
|
|
27 |
// EXTERNAL DATA STRUCTURES
|
|
28 |
//extern ?external_data;
|
|
29 |
|
|
30 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
31 |
//extern ?external_function( ?arg_type,?arg_type );
|
|
32 |
|
|
33 |
// CONSTANTS
|
|
34 |
//const ?type ?constant_var = ?constant;
|
|
35 |
|
|
36 |
// MACROS
|
|
37 |
//#define ?macro ?macro_def
|
|
38 |
|
|
39 |
// LOCAL CONSTANTS AND MACROS
|
|
40 |
//const ?type ?constant_var = ?constant;
|
|
41 |
//#define ?macro_name ?macro_def
|
|
42 |
|
|
43 |
// MODULE DATA STRUCTURES
|
|
44 |
//enum ?declaration
|
|
45 |
//typedef ?declaration
|
|
46 |
|
|
47 |
// LOCAL FUNCTION PROTOTYPES
|
|
48 |
//?type ?function_name( ?arg_type, ?arg_type );
|
|
49 |
|
|
50 |
// FORWARD DECLARATIONS
|
|
51 |
//class ?FORWARD_CLASSNAME;
|
|
52 |
|
|
53 |
// ============================= LOCAL FUNCTIONS ===============================
|
|
54 |
|
|
55 |
// -----------------------------------------------------------------------------
|
|
56 |
// ?function_name ?description.
|
|
57 |
// ?description
|
|
58 |
// Returns: ?value_1: ?description
|
|
59 |
// ?value_n: ?description_line1
|
|
60 |
// ?description_line2
|
|
61 |
// -----------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
/*
|
|
64 |
?type ?function_name(
|
|
65 |
?arg_type arg, // ?description
|
|
66 |
?arg_type arg) // ?description
|
|
67 |
{
|
|
68 |
|
|
69 |
?code // ?comment
|
|
70 |
|
|
71 |
// ?comment
|
|
72 |
?code
|
|
73 |
}
|
|
74 |
*/
|
|
75 |
|
|
76 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
77 |
|
|
78 |
// -----------------------------------------------------------------------------
|
|
79 |
// CAudioAudioRoutingTest::Delete
|
|
80 |
// Delete here all resources allocated and opened from test methods.
|
|
81 |
// Called from destructor.
|
|
82 |
// -----------------------------------------------------------------------------
|
|
83 |
//
|
|
84 |
TInt CAudioRoutingTestClass::Delete()
|
|
85 |
{
|
|
86 |
TInt error= KErrNone;
|
|
87 |
FTRACE(FPrint(_L("CAudioRoutingTestClass::Delete")));
|
|
88 |
|
|
89 |
iExpectedEvents.Close();
|
|
90 |
iOcurredEvents.Close();
|
|
91 |
|
|
92 |
iLog->Log(_L("Deleting test class..."));
|
|
93 |
iLog->Log(_L(""));
|
|
94 |
iLog->Log(_L(""));
|
|
95 |
|
|
96 |
|
|
97 |
if (iAudioInput)
|
|
98 |
{
|
|
99 |
delete iAudioInput;
|
|
100 |
}
|
|
101 |
|
|
102 |
if (iAudioOutput)
|
|
103 |
{
|
|
104 |
delete iAudioOutput;
|
|
105 |
}
|
|
106 |
|
|
107 |
if (iAudioTone)
|
|
108 |
{
|
|
109 |
delete iAudioTone;
|
|
110 |
}
|
|
111 |
|
|
112 |
if (iAudioInputStream)
|
|
113 |
{
|
|
114 |
delete iAudioInputStream;
|
|
115 |
}
|
|
116 |
|
|
117 |
if (iAudioOutputStream)
|
|
118 |
{
|
|
119 |
delete iAudioOutputStream;
|
|
120 |
}
|
|
121 |
|
|
122 |
if (iCustomCommandUtility)
|
|
123 |
{
|
|
124 |
delete iCustomCommandUtility;
|
|
125 |
}
|
|
126 |
|
|
127 |
if (iMidiClientUtility)
|
|
128 |
{
|
|
129 |
iMidiClientUtility->Close();
|
|
130 |
delete iMidiClientUtility;
|
|
131 |
}
|
|
132 |
|
|
133 |
if (iRecorder)
|
|
134 |
{
|
|
135 |
delete iRecorder;
|
|
136 |
}
|
|
137 |
|
|
138 |
if (iUtil)
|
|
139 |
{
|
|
140 |
delete iUtil;
|
|
141 |
}
|
|
142 |
|
|
143 |
if (iDrmPlayerUtility)
|
|
144 |
{
|
|
145 |
delete iDrmPlayerUtility;
|
|
146 |
}
|
|
147 |
|
|
148 |
|
|
149 |
if (iVideoPlayerUtility)
|
|
150 |
{
|
|
151 |
delete iVideoPlayerUtility;
|
|
152 |
DeleteVideoWindow();
|
|
153 |
}
|
|
154 |
if (iDevSound)
|
|
155 |
{
|
|
156 |
delete iDevSound;
|
|
157 |
}
|
|
158 |
REComSession::FinalClose();
|
|
159 |
return error;
|
|
160 |
}
|
|
161 |
|
|
162 |
// -----------------------------------------------------------------------------
|
|
163 |
// CAudioAudioRoutingTest::RunMethodL
|
|
164 |
// Run specified method. Contains also table of test mothods and their names.
|
|
165 |
// -----------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
TInt CAudioRoutingTestClass::RunMethodL( CStifItemParser& aItem )
|
|
168 |
{
|
|
169 |
|
|
170 |
static TStifFunctionInfo const KFunctions[] =
|
|
171 |
{
|
|
172 |
// Copy this line for every implemented function.
|
|
173 |
// First string is the function name used in TestScripter script file.
|
|
174 |
// Second is the actual implementation member function.
|
|
175 |
ENTRY( "AudioInput", CAudioRoutingTestClass::CreateAudioInput),
|
|
176 |
ENTRY( "CreateObject", CAudioRoutingTestClass::CreateObject),
|
|
177 |
ENTRY( "AudioInputs", CAudioRoutingTestClass::AudioInput),
|
|
178 |
ENTRY( "SetAudioInput", CAudioRoutingTestClass::SetAudioInputL),
|
|
179 |
ENTRY( "AudioOutput", CAudioRoutingTestClass::AudioOutput),
|
|
180 |
ENTRY( "DefaultAudioOutput", CAudioRoutingTestClass::DefaultAudioOutput),
|
|
181 |
ENTRY( "RegisterObserver", CAudioRoutingTestClass::RegisterObserverL),
|
|
182 |
ENTRY( "SecureOutput", CAudioRoutingTestClass::SecureOutput),
|
|
183 |
ENTRY( "SetAudioOutput", CAudioRoutingTestClass::SetAudioOutputL),
|
|
184 |
ENTRY( "SetSecureOutput", CAudioRoutingTestClass::SetSecureOutputL),
|
|
185 |
ENTRY( "UnregisterObserver", CAudioRoutingTestClass::UnregisterObserver),
|
5
|
186 |
ENTRY( "CustomCommandPlay",CAudioRoutingTestClass::CustomCommandSyncAsync),
|
|
187 |
ENTRY("CustomCommandRec",CAudioRoutingTestClass::CustomCommandRecord),
|
|
188 |
ENTRY("CustomCommandRoute",CAudioRoutingTestClass::CustomCommandRouting),
|
|
189 |
ENTRY("CustomCommandVRecord",CAudioRoutingTestClass::CustomCommandVRecord)
|
|
190 |
};
|
0
|
191 |
|
|
192 |
const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo );
|
|
193 |
|
|
194 |
return RunInternalL( KFunctions, count, aItem );
|
|
195 |
|
|
196 |
}
|
|
197 |
|
|
198 |
|
|
199 |
// -----------------------------------------------------------------------------
|
|
200 |
// CAudioAudioRoutingTest::EventName
|
|
201 |
// Return descriptor with the notification description
|
|
202 |
// -----------------------------------------------------------------------------
|
|
203 |
TPtrC CAudioRoutingTestClass::EventName( TInt aKey )
|
|
204 |
{
|
|
205 |
static TText* const badKeyword = (TText*)L"BadKeyword";
|
|
206 |
static TText* const keywords[] =
|
|
207 |
{
|
|
208 |
|
|
209 |
(TText*)L"EInitializeComplete",
|
|
210 |
|
|
211 |
};
|
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
if( (TUint)aKey >= (sizeof( keywords )/sizeof(TText*)) )
|
|
216 |
{
|
|
217 |
iLog->Log(_L("Keyword out of bounds"));
|
|
218 |
TPtrC keyword( badKeyword );
|
|
219 |
return keyword;
|
|
220 |
}
|
|
221 |
else
|
|
222 |
{
|
|
223 |
TPtrC keyword( keywords[aKey] );
|
|
224 |
return keyword;
|
|
225 |
}
|
|
226 |
}
|
|
227 |
|
|
228 |
// -----------------------------------------------------------------------------
|
|
229 |
// CAudioAudioRoutingTest::AddExpectedEvent
|
|
230 |
// Add an event to the expected events' list
|
|
231 |
// -----------------------------------------------------------------------------
|
|
232 |
void CAudioRoutingTestClass::AddExpectedEvent(TG711ExpectedEvent event, TInt ms)
|
|
233 |
{
|
|
234 |
FTRACE(FPrint(_L("CAudioRoutingTestClass::AddExpectedEvent")));
|
|
235 |
iExpectedEvents.Append(event);
|
|
236 |
TPtrC eventName = EventName(event);
|
|
237 |
iLog->Log(_L("Adding expected event:(0x%02x)%S Total=%d"), event, &eventName, iExpectedEvents.Count() );
|
|
238 |
|
|
239 |
if ( iTimeoutController && !iTimeoutController->IsActive() )
|
|
240 |
{
|
|
241 |
if (ms > 0)
|
|
242 |
{
|
|
243 |
iTimeoutController->Start( TTimeIntervalMicroSeconds(ms * 1000) );
|
|
244 |
}
|
|
245 |
else
|
|
246 |
{
|
|
247 |
iLog->Log(_L("Timeout with default value (1s)"));
|
|
248 |
iTimeoutController->Start( TTimeIntervalMicroSeconds(1000000) );
|
|
249 |
}
|
|
250 |
}
|
|
251 |
}
|
|
252 |
|
|
253 |
// -----------------------------------------------------------------------------
|
|
254 |
// CAudioAudioRoutingTest::RemoveExpectedEvent
|
|
255 |
// Remove the indicated event from the expected events' list
|
|
256 |
// -----------------------------------------------------------------------------
|
|
257 |
TBool CAudioRoutingTestClass::RemoveExpectedEvent(TG711ExpectedEvent aEvent)
|
|
258 |
{
|
|
259 |
FTRACE(FPrint(_L("CAudioRoutingTestClass::RemoveExpectedEvent")));
|
|
260 |
TBool match = EFalse;
|
|
261 |
for (TUint i=0; i < iExpectedEvents.Count() ; i++)
|
|
262 |
{
|
|
263 |
if (iExpectedEvents[i] == aEvent)
|
|
264 |
{
|
|
265 |
iExpectedEvents.Remove(i);
|
|
266 |
match = ETrue;
|
|
267 |
break;
|
|
268 |
}
|
|
269 |
}
|
|
270 |
|
|
271 |
return match;
|
|
272 |
}
|
|
273 |
|
|
274 |
|
|
275 |
// -----------------------------------------------------------------------------
|
|
276 |
// CAudioAudioRoutingTest::RemoveAllExpectedEvents
|
|
277 |
// Remove the indicated event from the expected events' list
|
|
278 |
// -----------------------------------------------------------------------------
|
|
279 |
void CAudioRoutingTestClass::RemoveAllExpectedEvents()
|
|
280 |
{
|
|
281 |
FTRACE(FPrint(_L("CAudioRoutingTestClass::RemoveAllExpectedEvents")));
|
|
282 |
iLog->Log(_L("Removing all expected events"));
|
|
283 |
|
|
284 |
iExpectedEvents.Reset();
|
|
285 |
iOcurredEvents.Reset();
|
|
286 |
}
|
|
287 |
|
|
288 |
|
|
289 |
// -----------------------------------------------------------------------------
|
|
290 |
// CAudioAudioRoutingTest::ProcessEvent
|
|
291 |
// -----------------------------------------------------------------------------
|
|
292 |
void CAudioRoutingTestClass::ProcessEvent(TG711ExpectedEvent aEvent, TInt aError)
|
|
293 |
{
|
|
294 |
FTRACE(FPrint(_L("CAudioRoutingTestClass::ProcessEvent")));
|
|
295 |
TPtrC nameEvent = EventName(aEvent);
|
|
296 |
|
|
297 |
// Check for error
|
|
298 |
if (aError == KErrNone)
|
|
299 |
{
|
|
300 |
// Remove the event
|
|
301 |
if (RemoveExpectedEvent(aEvent))
|
|
302 |
{
|
|
303 |
iLog->Log(_L("Expected Event: (0x%02x)%S has ocurred Total=%d"), aEvent, &nameEvent,iExpectedEvents.Count());
|
|
304 |
}
|
|
305 |
else
|
|
306 |
{
|
|
307 |
iLog->Log(_L("Event: (0x%02x)%S has ocurred"), aEvent, &nameEvent);
|
|
308 |
return;
|
|
309 |
}
|
|
310 |
|
|
311 |
// All expected events have ocurred
|
|
312 |
if (iExpectedEvents.Count() == 0 )
|
|
313 |
{
|
|
314 |
Signal();
|
|
315 |
iTimeoutController->Cancel();
|
|
316 |
}
|
|
317 |
}
|
|
318 |
else
|
|
319 |
{
|
|
320 |
iLog->Log(_L("[Error] Event: (0x%02x)%S return with error code=%d"), aEvent, &nameEvent, aError);
|
|
321 |
if (iExpectedEvents.Count() != 0 )
|
|
322 |
{
|
|
323 |
RemoveExpectedEvent(aEvent);
|
|
324 |
}
|
|
325 |
iTimeoutController->Cancel();
|
|
326 |
Signal(KErrCallbackErrorCode);
|
|
327 |
}
|
|
328 |
}
|
|
329 |
|
|
330 |
// -----------------------------------------------------------------------------
|
|
331 |
// CAudioAudioRoutingTest::HandleTimeout
|
|
332 |
// Review if all the expected events have ocurred once the time is over
|
|
333 |
// -----------------------------------------------------------------------------
|
|
334 |
|
|
335 |
void CAudioRoutingTestClass::HandleTimeout(TInt aError)
|
|
336 |
{
|
|
337 |
FTRACE(FPrint(_L("CAudioRoutingTestClass::HandleTimeout")));
|
|
338 |
// All expected events have ocurred
|
|
339 |
if (aError != KErrNone)
|
|
340 |
{
|
|
341 |
if (iExpectedEvents.Count() == 0 )
|
|
342 |
{
|
|
343 |
iLog->Log(_L("Timing out but events have ocurred"));
|
|
344 |
Signal();
|
|
345 |
}
|
|
346 |
else
|
|
347 |
{
|
|
348 |
RemoveAllExpectedEvents();
|
|
349 |
iLog->Log(_L("Timing out and events still pending"));
|
|
350 |
Signal(KErrEventPending);
|
|
351 |
}
|
|
352 |
}
|
|
353 |
else
|
|
354 |
{
|
|
355 |
iLog->Log(_L("Timing out return a error %d"), aError);
|
|
356 |
Signal(aError);
|
|
357 |
}
|
|
358 |
}
|
|
359 |
|
|
360 |
// -----------------------------------------------------------------------------
|
|
361 |
// CAudioAudioRoutingTest::SetTimeout
|
|
362 |
// Create a timer and set a timeout
|
|
363 |
// When the timeout is reached the test case is marked as failed
|
|
364 |
// It's used rather than the "timeout" keyword in the configuration file
|
|
365 |
// because in this way the log continues
|
|
366 |
// -----------------------------------------------------------------------------
|
|
367 |
TInt CAudioRoutingTestClass::SetTimeout( CStifItemParser& aItem )
|
|
368 |
{
|
|
369 |
FTRACE(FPrint(_L("CAudioRoutingTestClass::SetTimeout")));
|
|
370 |
TInt timeout=0;
|
|
371 |
TInt error = aItem.GetNextInt(timeout) ;
|
|
372 |
if ( iTimeoutController )
|
|
373 |
{
|
|
374 |
if ( timeout > 0 )
|
|
375 |
{
|
|
376 |
iTimeoutController->Start( TTimeIntervalMicroSeconds(timeout*1000) );
|
|
377 |
}
|
|
378 |
else
|
|
379 |
{
|
|
380 |
iTimeoutController->Start( TTimeIntervalMicroSeconds(1000000) );
|
|
381 |
}
|
|
382 |
}
|
|
383 |
else
|
|
384 |
{
|
|
385 |
iLog->Log(_L("Timeout Controller doesn't exist"));
|
|
386 |
error = KErrTimeoutController;
|
|
387 |
}
|
|
388 |
return error;
|
|
389 |
}
|
|
390 |
|
|
391 |
|
|
392 |
// -----------------------------------------------------------------------------
|
|
393 |
// Uses the TestModuleBase API to allow a panic as exit reason for a test case
|
|
394 |
// -----------------------------------------------------------------------------
|
|
395 |
TInt CAudioRoutingTestClass::SetAllowedPanic( CStifItemParser& aItem )
|
|
396 |
{
|
|
397 |
FTRACE(FPrint(_L("CAudioRoutingTestClass::SetAllowedPanic")));
|
|
398 |
TInt error = KErrNone;
|
|
399 |
TInt panicCode;
|
|
400 |
TPtrC panicType;
|
|
401 |
if ( ( KErrNone == aItem.GetNextString(panicType) ) &&
|
|
402 |
( KErrNone == aItem.GetNextInt(panicCode) ) )
|
|
403 |
{
|
|
404 |
iLog->Log(_L("Allowing panic: %S %d"), &panicType, panicCode);
|
|
405 |
iTestModuleIf.SetExitReason( CTestModuleIf::EPanic, panicCode );
|
|
406 |
iNormalExitReason = EFalse;
|
|
407 |
}
|
|
408 |
else
|
|
409 |
{
|
|
410 |
iLog->Log(KMsgBadTestParameters);
|
|
411 |
error = KErrBadTestParameter;
|
|
412 |
}
|
|
413 |
return error;
|
|
414 |
}
|
|
415 |
|
|
416 |
// -----------------------------------------------------------------------------
|
|
417 |
// CAudioAudioRoutingTest::SetExpectedEvents()
|
|
418 |
// -----------------------------------------------------------------------------
|
|
419 |
TInt CAudioRoutingTestClass::SetExpectedEvents( CStifItemParser& aItem )
|
|
420 |
{
|
|
421 |
FTRACE(FPrint(_L("CAudioRoutingTestClass::SetExpectedEvents")));
|
|
422 |
TInt error = KErrNone;
|
|
423 |
TInt event=0;
|
|
424 |
while ( KErrNone == aItem.GetNextInt(event))
|
|
425 |
{
|
|
426 |
AddExpectedEvent(static_cast<TG711ExpectedEvent>(event), 0); // Default timeout value
|
|
427 |
}
|
|
428 |
return error;
|
|
429 |
}
|
|
430 |
|
|
431 |
|
|
432 |
// -----------------------------------------------------------------------------
|
|
433 |
// CAudioAudioRoutingTest::ExampleL
|
|
434 |
// Example test method function.
|
|
435 |
// (other items were commented in a header).
|
|
436 |
// -----------------------------------------------------------------------------
|
|
437 |
//
|
|
438 |
TInt CAudioRoutingTestClass::ExampleL( CStifItemParser& aItem )
|
|
439 |
{
|
|
440 |
_LIT( KAudioRoutingTestClass, "AudioRoutingTestClass" );
|
|
441 |
_LIT( KExample, "In Example" );
|
|
442 |
TestModuleIf().Printf( 0, KAudioRoutingTestClass, KExample );
|
|
443 |
|
|
444 |
iLog->Log( KExample );
|
|
445 |
|
|
446 |
TInt i = 0;
|
|
447 |
TPtrC string;
|
|
448 |
_LIT( KParam, "Param[%i]: %S" );
|
|
449 |
while ( aItem.GetNextString ( string ) == KErrNone )
|
|
450 |
{
|
|
451 |
TestModuleIf().Printf( i, KAudioRoutingTestClass, KParam, i, &string );
|
|
452 |
i++;
|
|
453 |
}
|
|
454 |
|
|
455 |
return KErrNone;
|
|
456 |
}
|
|
457 |
|
|
458 |
// -----------------------------------------------------------------------------
|
|
459 |
// CG711DecoderIntfcTestClass::CreateObject
|
|
460 |
// Create Factory
|
|
461 |
// -----------------------------------------------------------------------------
|
|
462 |
//
|
|
463 |
|
|
464 |
|
|
465 |
TInt CAudioRoutingTestClass::CreateObject( CStifItemParser& aItem )
|
|
466 |
{
|
|
467 |
FTRACE(FPrint(_L("CAudioAudioRoutingTest::CreateObject")));
|
|
468 |
iLog->Log(_L("CAudioAudioRoutingTest::CreateObject"));
|
|
469 |
TInt error = KErrNone;
|
|
470 |
|
|
471 |
TPtrC object;
|
|
472 |
aItem.GetNextString ( object );
|
|
473 |
|
|
474 |
iObject.Set(object);
|
|
475 |
iLog->Log(_L("the object to create is [%S]"),&object);
|
|
476 |
|
|
477 |
if (object == KTagDevSound)
|
|
478 |
{
|
|
479 |
TRAP(error, iDevSound = CMMFDevSound::NewL());
|
|
480 |
if (error == KErrNone)
|
|
481 |
{
|
|
482 |
TRAP(error,iDevSound->InitializeL(*this,KMMFFourCCCodeAMR,EMMFStatePlaying));
|
|
483 |
}
|
|
484 |
}
|
|
485 |
else if (object == KTagRecorder)
|
|
486 |
{
|
|
487 |
iInputOutput = ETrue;
|
|
488 |
CreateInput();
|
|
489 |
}
|
|
490 |
else if (object== KTagCustomCommand)
|
|
491 |
{
|
|
492 |
TPtrC type;
|
|
493 |
aItem.GetNextString ( type );
|
|
494 |
if (type == KTagAudioPlayer)
|
|
495 |
{
|
|
496 |
TRAP(error,iCustomCommandUtility = CCustomCommandUtility::NewL(*iUtil));
|
|
497 |
}
|
5
|
498 |
if (type == KTagAudioConvert)
|
|
499 |
{
|
|
500 |
TRAP(error,iCustomCommandUtility = CCustomCommandUtility::NewL(*iUtilConvert));
|
|
501 |
}
|
|
502 |
if(type ==KTagCustomCommand)
|
|
503 |
{
|
|
504 |
TRAP(error,iCustomCommandUtility = CCustomCommandUtility::NewL(*iUtil));
|
|
505 |
}
|
0
|
506 |
else
|
|
507 |
{
|
|
508 |
TRAP(error,iCustomCommandUtility = CCustomCommandUtility::NewL(*iRecorder,ETrue));
|
|
509 |
}
|
|
510 |
}
|
|
511 |
else if (object == KTagCustomInterface)
|
|
512 |
{
|
|
513 |
TPtrC type;
|
|
514 |
aItem.GetNextString ( type );
|
|
515 |
if (type == KTagAudioPlayer)
|
|
516 |
{
|
|
517 |
TRAP(error,iCustomInterfaceUtility = CCustomInterfaceUtility::NewL(*iUtil));
|
|
518 |
}
|
|
519 |
else if (type == KTagCustomCommand)
|
|
520 |
{
|
|
521 |
TRAP(error,iCustomInterfaceUtility = CCustomInterfaceUtility::NewL(*iCustomCommandUtility));
|
|
522 |
}
|
|
523 |
else if (type == KTagRecorder)
|
|
524 |
{
|
|
525 |
TRAP(error,iCustomInterfaceUtility = CCustomInterfaceUtility::NewL(*iRecorder,ETrue));
|
|
526 |
}
|
5
|
527 |
else if(type == KTagAudioConvert)
|
|
528 |
{
|
|
529 |
TRAP(error,iCustomInterfaceUtility = CCustomInterfaceUtility::NewL(*iUtilConvert));
|
|
530 |
}
|
|
531 |
else if(type == KTagDevSound)
|
|
532 |
{
|
|
533 |
TRAP(error,iCustomInterfaceUtility = CCustomInterfaceUtility::NewL(*iDevSound));
|
|
534 |
}
|
0
|
535 |
}
|
|
536 |
else if (object == KTagInputStream)
|
|
537 |
{
|
|
538 |
TRAP(error,iAudioInputStream = CMdaAudioInputStream::NewL(*this));
|
|
539 |
}
|
|
540 |
else if (object == KTagAudioPlayer)
|
|
541 |
{
|
|
542 |
CreateOutput();
|
|
543 |
}
|
|
544 |
else if (object == KTagOuputRecord)
|
|
545 |
{
|
|
546 |
iInputOutput = EFalse;
|
|
547 |
CreateInput();
|
|
548 |
}
|
|
549 |
else if (object == KTagOutputStream)
|
|
550 |
{
|
|
551 |
iStreamSettings.iChannels = TMdaAudioDataSettings::EChannelsMono;
|
|
552 |
iStreamSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate16000Hz;
|
|
553 |
iStreamSettings.iVolume = 1;
|
|
554 |
TRAPD(error, iAudioOutputStream = CMdaAudioOutputStream::NewL(*this));
|
|
555 |
if (error == KErrNone)
|
|
556 |
{
|
|
557 |
iAudioOutputStream->Open(&iStreamSettings);
|
|
558 |
}
|
|
559 |
}
|
|
560 |
else if (object == KTagToneUtility)
|
|
561 |
{
|
|
562 |
TRAP(error,iAudioTone = CMdaAudioToneUtility::NewL(*this));
|
|
563 |
}
|
|
564 |
else if (object == KTagDevSound1)
|
|
565 |
{
|
|
566 |
TRAP(error, iDevSound = CMMFDevSound::NewL());
|
|
567 |
}
|
|
568 |
else if (object == KTagMidiClient)
|
|
569 |
{
|
|
570 |
TRAP(error, iMidiClientUtility = CMidiClientUtility::NewL(*this,80,TMdaPriorityPreference(0x00000000),EFalse));
|
|
571 |
//TRAP(error, iMidiClientUtility = CMidiClientUtility::NewL(*this));
|
|
572 |
if(error == KErrNone)
|
|
573 |
{
|
|
574 |
isInput = EFalse;
|
|
575 |
//iMidiClientUtility->OpenFile(KAudioMidiFile);
|
|
576 |
}
|
|
577 |
}
|
|
578 |
else if (object == KTagDrmPlayer)
|
|
579 |
{
|
|
580 |
TRAP(error, iDrmPlayerUtility = CDrmPlayerUtility::NewL(*this,EMdaPriorityNormal,TMdaPriorityPreference(0x00000000)));
|
|
581 |
if (error == KErrNone)
|
|
582 |
{
|
|
583 |
iDrmPlayerUtility->OpenFileL(KAudioDrmFile);
|
|
584 |
}
|
|
585 |
}
|
|
586 |
else if (object == KTagVideoPlayer)
|
|
587 |
{
|
|
588 |
aItem.GetNextString ( object );
|
|
589 |
error = KErrNone;
|
|
590 |
TRAP(error, CreateSessionAndScreen());
|
|
591 |
TRAP(error, CreateWindowGroup());
|
|
592 |
TRAP(error, CreateVideoWindow());
|
5
|
593 |
TRAP(error, CreateVideoObject());
|
|
594 |
}
|
0
|
595 |
else if(object == KTagVideoRecord)
|
|
596 |
{
|
|
597 |
TRAP(error, CreateVideoRecorderObject());
|
|
598 |
}
|
|
599 |
if (error == KErrNone)
|
|
600 |
{
|
|
601 |
AddExpectedEvent(EInitializeComplete, KMediumTimeout);
|
|
602 |
}
|
|
603 |
else
|
|
604 |
{
|
|
605 |
iLog->Log(_L("CAudioRoutingTestClass::CreateObject Error [%d] - [%S]"),error,&object);
|
|
606 |
FTRACE(FPrint(_L("CAudioRoutingTestClass::CreateObject Error [%d] - [%S]"),error,&object));
|
|
607 |
}
|
|
608 |
return error;
|
|
609 |
}
|
|
610 |
|
|
611 |
TInt CAudioRoutingTestClass::CreateAudioInput( CStifItemParser& aItem )
|
|
612 |
{
|
|
613 |
TInt error = KErrNone;
|
|
614 |
|
|
615 |
TPtrC object;
|
|
616 |
RArray<CAudioInput::TAudioInputPreference> inputArray;
|
|
617 |
|
|
618 |
aItem.GetNextString ( object );
|
|
619 |
iLog->Log(_L("The AudioInput to create is with [%S]"),&object);
|
|
620 |
|
|
621 |
if ( object == KTagVideoRecord )
|
|
622 |
{
|
|
623 |
FTRACE(FPrint(_L("CAudioRoutingTest::CAudioInput")));
|
|
624 |
iLog->Log(_L("CAudioRoutingTest::CAudioInput"));
|
|
625 |
TRAP(error, iAudioInput = CAudioInput::NewL(*iVideoRecord));
|
5
|
626 |
if (error == KErrNotFound)
|
0
|
627 |
{
|
5
|
628 |
error = KErrNone;
|
|
629 |
iLog->Log(_L("CAudioInput::NewL(*iVideoRecord) OK with expected error"));
|
0
|
630 |
}
|
|
631 |
}
|
|
632 |
|
|
633 |
else if ( object == KTagDevSound )
|
|
634 |
{
|
|
635 |
FTRACE(FPrint(_L("CAudioRoutingTest::CAudioInput")));
|
|
636 |
iLog->Log(_L("CAudioRoutingTest::CAudioInput"));
|
|
637 |
TRAP(error, iAudioInput = CAudioInput::NewL(*iDevSound));
|
|
638 |
if (error == KErrNone)
|
|
639 |
{
|
|
640 |
iLog->Log(_L("CAudioInput::NewL(*iDevSound) OK"));
|
|
641 |
}
|
|
642 |
}
|
|
643 |
else if (object == KTagRecorder)
|
|
644 |
{
|
|
645 |
FTRACE(FPrint(_L("CAudioRoutingTest::CAudioInput")));
|
|
646 |
iLog->Log(_L("CAudioRoutingTest::CAudioInput"));
|
|
647 |
TRAP(error, iAudioInput = CAudioInput::NewL(*iRecorder));
|
|
648 |
if (error == KErrNone)
|
|
649 |
{
|
|
650 |
iLog->Log(_L("CAudioInput::NewL(*iRecorder) OK"));
|
|
651 |
}
|
|
652 |
}
|
|
653 |
else if (object == KTagCustomCommand)
|
|
654 |
{
|
|
655 |
FTRACE(FPrint(_L("CAudioRoutingTest::CAudioInput - iCustomCommandUtility")));
|
|
656 |
iLog->Log(_L("CAudioRoutingTest::CAudioInput - iCustomCommandUtility"));
|
|
657 |
TRAP(error, iAudioInput = CAudioInput::NewL(*iCustomCommandUtility));
|
|
658 |
if (error == KErrNone)
|
|
659 |
{
|
|
660 |
iLog->Log(_L("CAudioInput::NewL(*iCustomCommandUtility) OK"));
|
|
661 |
}
|
|
662 |
}
|
|
663 |
else if (object == KTagCustomInterface)
|
|
664 |
{
|
|
665 |
FTRACE(FPrint(_L("CAudioRoutingTest::CAudioInput - CustomInterfaceUtility")));
|
|
666 |
iLog->Log(_L("CAudioRoutingTest::CAudioInput - CustomInterfaceUtility"));
|
|
667 |
TRAP(error, iAudioInput = CAudioInput::NewL(*iCustomInterfaceUtility));
|
|
668 |
if (error == KErrNone)
|
|
669 |
{
|
|
670 |
iLog->Log(_L("CAudioInput::NewL(*iCustomInterfaceUtility) OK"));
|
|
671 |
}
|
|
672 |
}
|
|
673 |
else if (object == KTagInputStream)
|
|
674 |
{
|
|
675 |
FTRACE(FPrint(_L("CAudioRoutingTest::CAudioInput - InputStream")));
|
|
676 |
iLog->Log(_L("CAudioRoutingTest::CAudioInput - InputStream"));
|
|
677 |
TRAP(error, iAudioInput = CAudioInput::NewL(*iAudioInputStream));
|
|
678 |
if (error == KErrNone)
|
|
679 |
{
|
|
680 |
iLog->Log(_L(" CAudioInput::NewL(*iAudioInputStream) OK"));
|
|
681 |
}
|
|
682 |
}
|
|
683 |
else if (object == KTagOuputRecord)
|
|
684 |
{
|
|
685 |
FTRACE(FPrint(_L("CAudioRoutingTest::CAudioInput - InputStream")));
|
|
686 |
iLog->Log(_L("CAudioRoutingTest::CAudioInput - InputStream"));
|
|
687 |
TRAP(error, iAudioOutput = CAudioOutput::NewL(*iRecorder,ETrue));
|
|
688 |
if (error == KErrNone)
|
|
689 |
{
|
|
690 |
iLog->Log(_L("CAudioOutput::NewL(*iRecorder,ETrue OK"));
|
|
691 |
}
|
|
692 |
}
|
|
693 |
else if (object == KTagOutputStream)
|
|
694 |
{
|
|
695 |
FTRACE(FPrint(_L("CAudioRoutingTest::CAudioOutput - OutputStream")));
|
|
696 |
iLog->Log(_L("CAudioRoutingTest::CAudioOutput - OutputStream"));
|
|
697 |
TRAP(error, iAudioOutput = CAudioOutput::NewL(*iAudioOutputStream));
|
|
698 |
if (error == KErrNone)
|
|
699 |
{
|
|
700 |
iLog->Log(_L("CAudioOutput::NewL(*iAudioOutputStream) OK"));
|
|
701 |
}
|
|
702 |
}
|
|
703 |
else if (object == KTagToneUtility)
|
|
704 |
{
|
|
705 |
FTRACE(FPrint(_L("CAudioRoutingTest::CAudioOutput - AudioTone")));
|
|
706 |
iLog->Log(_L("CAudioRoutingTest::CAudioOutput - AudioTone"));
|
|
707 |
TRAP(error, iAudioOutput = CAudioOutput::NewL(*iAudioTone));
|
|
708 |
if (error == KErrNone)
|
|
709 |
{
|
|
710 |
iLog->Log(_L("CAudioOutput::NewL(*iAudioTone) OK"));
|
|
711 |
}
|
|
712 |
}
|
|
713 |
else if (object == KTagDevSound1)
|
|
714 |
{
|
|
715 |
FTRACE(FPrint(_L("CAudioRoutingTest::CAudioOutput - DevSound")));
|
|
716 |
iLog->Log(_L("CAudioRoutingTest::CAudioOutput - DevSound"));
|
|
717 |
TRAP(error, iAudioOutput = CAudioOutput::NewL(*iDevSound));
|
|
718 |
if (error == KErrNone)
|
|
719 |
{
|
|
720 |
iLog->Log(_L("CAudioOutput::NewL(*iDevSound) OK"));
|
|
721 |
}
|
|
722 |
}
|
|
723 |
else if (object == KTagCustomInterfaceOutput)
|
|
724 |
{
|
|
725 |
FTRACE(FPrint(_L("CAudioRoutingTest::CAudioOutput - CustomInterfaceOutput")));
|
|
726 |
iLog->Log(_L("CAudioRoutingTest::CAudioOutput - CustomInterfaceOutput"));
|
|
727 |
TRAP(error, iAudioOutput = CAudioOutput::NewL(*iCustomInterfaceUtility));
|
|
728 |
}
|
|
729 |
else if (object == KTagAudioPlayer)
|
|
730 |
{
|
|
731 |
FTRACE(FPrint(_L("CAudioRoutingTest::CAudioOutput - AudioPlayer")));
|
|
732 |
iLog->Log(_L("CAudioRoutingTest::CAudioOutput - AudioPlayer"));
|
|
733 |
TRAPD(error,iAudioOutput = CAudioOutput::NewL(*iUtil));
|
|
734 |
if (error == KErrNone)
|
|
735 |
{
|
|
736 |
iLog->Log(_L("CAudioOutput::NewL(*iUtil) OK"));
|
|
737 |
}
|
|
738 |
}
|
|
739 |
else if (object == KTagCustomCommandOutput)
|
|
740 |
{
|
|
741 |
FTRACE(FPrint(_L("CAudioRoutingTest::CAudioOutput - iCustomCommandOutput")));
|
|
742 |
iLog->Log(_L("CAudioRoutingTest::CAudioOutput - iCustomCommandOutput"));
|
|
743 |
TRAP(error, iAudioOutput = CAudioOutput::NewL(*iCustomCommandUtility));
|
|
744 |
if (error == KErrNone)
|
|
745 |
{
|
|
746 |
iLog->Log(_L("CAudioOutput::NewL(*iCustomCommandUtility) OK"));
|
|
747 |
}
|
|
748 |
}
|
|
749 |
|
|
750 |
else if (object == KTagMidiClient)
|
|
751 |
{
|
|
752 |
FTRACE(FPrint(_L("CAudioRoutingTest::CAudioOutput - CMidiClientUtility")));
|
|
753 |
iLog->Log(_L("CAudioRoutingTest::CAudioOutput - CMidiClientUtility"));
|
|
754 |
TRAP(error, iAudioOutput = CAudioOutput::NewL(*iMidiClientUtility));
|
|
755 |
if (error == KErrNone)
|
|
756 |
{
|
|
757 |
iLog->Log(_L("CAudioOutput::NewL(*iMidiClientUtility) OK"));
|
|
758 |
}
|
|
759 |
}
|
|
760 |
else if (object == KTagDrmPlayer)
|
|
761 |
{
|
|
762 |
FTRACE(FPrint(_L("CAudioRoutingTest::CAudioOutput - CDrmPlayerUtility")));
|
|
763 |
iLog->Log(_L("CAudioRoutingTest::CAudioOutput - CDrmPlayerUtility"));
|
|
764 |
TRAP(error, iAudioOutput = CAudioOutput::NewL(*iDrmPlayerUtility));
|
|
765 |
if (error == KErrNone)
|
|
766 |
{
|
|
767 |
iLog->Log(_L("CAudioOutput::NewL(*iDrmPlayerUtility) OK"));
|
|
768 |
}
|
|
769 |
}
|
|
770 |
else if (object == KTagVideoPlayer)
|
|
771 |
{
|
|
772 |
FTRACE(FPrint(_L("CAudioRoutingTest::CAudioOutput - VideoPlayer")));
|
|
773 |
iLog->Log(_L("CAudioRoutingTest::CAudioOutput - VideoPlayer"));
|
|
774 |
TRAP(error, iAudioOutput = CAudioOutput::NewL(*iVideoPlayerUtility));
|
|
775 |
if (error == KErrNone)
|
|
776 |
{
|
|
777 |
iLog->Log(_L("CAudioOutput::NewL(*iVideoPlayerUtility) OK"));
|
|
778 |
}
|
|
779 |
}
|
|
780 |
else
|
|
781 |
{
|
|
782 |
iLog->Log(_L(" No Intut Data"));
|
|
783 |
}
|
|
784 |
if (error != KErrNone)
|
|
785 |
{
|
|
786 |
iLog->Log(_L("CAudioRoutingTestClass::CreateAudioInput ERROR [%d] for [%s]"),error,&object);
|
|
787 |
}
|
|
788 |
return error;
|
|
789 |
}
|
|
790 |
|
|
791 |
void CAudioRoutingTestClass::CreateInput()
|
|
792 |
{
|
|
793 |
//TInt error = KErrNone;
|
|
794 |
isInput = ETrue;
|
|
795 |
iUtil = CMdaAudioPlayerUtility::NewFilePlayerL(KMp3TestFile, *this);
|
|
796 |
TRAPD(error, iRecorder = CMdaAudioRecorderUtility::NewL(*this));
|
|
797 |
if (error == KErrNone)
|
|
798 |
{
|
|
799 |
iLog->Log(_L("CMdaAudioRecorderUtility::NewL(*this) OK"));
|
|
800 |
}
|
|
801 |
}
|
|
802 |
|
|
803 |
void CAudioRoutingTestClass::CreateOutput()
|
|
804 |
{
|
|
805 |
isInput = EFalse;
|
|
806 |
iUtil = CMdaAudioPlayerUtility::NewFilePlayerL(KMp3TestFile, *this);
|
|
807 |
}
|
|
808 |
|
5
|
809 |
void CAudioRoutingTestClass::CreateOutput_AudioConvert()
|
|
810 |
{
|
|
811 |
isInput = EFalse;
|
|
812 |
iUtilConvert = CMdaAudioConvertUtility::NewL(*this,NULL);
|
|
813 |
}
|
0
|
814 |
TInt CAudioRoutingTestClass::CreateVideoInput()
|
|
815 |
{
|
|
816 |
// TInt error1 = KErrNone;
|
|
817 |
TInt error = KErrNone;
|
|
818 |
isInput = ETrue;
|
|
819 |
iUtil = CMdaAudioPlayerUtility::NewFilePlayerL(KMp3TestFile,*this);
|
|
820 |
if (iUtil)
|
|
821 |
{
|
|
822 |
iRecorder = CMdaAudioRecorderUtility::NewL(*this);
|
|
823 |
if (iRecorder)
|
|
824 |
{
|
|
825 |
iLog->Log(_L("CMdaAudioRecorderUtility::NewL(*this) OK"));
|
|
826 |
}
|
|
827 |
}
|
|
828 |
return error;
|
|
829 |
}
|
|
830 |
|
|
831 |
TInt CAudioRoutingTestClass::CreateVideoWindow()
|
|
832 |
{
|
|
833 |
TInt error = KErrNone;
|
|
834 |
TRAP(error,iWindow = RWindow( iWindowSession ));
|
|
835 |
if (error == KErrNone)
|
|
836 |
{
|
|
837 |
TRAP(error,User::LeaveIfError(iWindow.Construct(iWindowGroup, reinterpret_cast<TUint32>(&iWindowGroup) + 1)));
|
|
838 |
if (error == KErrNone)
|
|
839 |
{
|
|
840 |
iWindow.SetBackgroundColor(TRgb(0x90, 0x90, 0x90));
|
|
841 |
iWindow.Activate();
|
|
842 |
iWindow.SetExtent(TPoint(0, 0), TSize(screenWidth, screenHeight));
|
|
843 |
iWindow.SetVisible(ETrue);
|
|
844 |
iWindowGc->Activate(iWindow);
|
|
845 |
iRect = TRect(iWindow.Size());
|
|
846 |
iWindow.Invalidate(iRect);
|
|
847 |
iWindow.BeginRedraw(iRect);
|
|
848 |
}
|
|
849 |
}
|
|
850 |
return error;
|
|
851 |
}
|
|
852 |
|
|
853 |
TInt CAudioRoutingTestClass::DeleteVideoWindow()
|
|
854 |
{
|
|
855 |
TInt error = KErrNone;
|
|
856 |
|
|
857 |
TRAP(error,iWindowSession.Close());
|
|
858 |
|
|
859 |
if (iScreenDevice)
|
|
860 |
{
|
|
861 |
|
|
862 |
}
|
|
863 |
if (iWindowGc)
|
|
864 |
{
|
|
865 |
|
|
866 |
}
|
|
867 |
|
|
868 |
return error;
|
|
869 |
}
|
|
870 |
|
|
871 |
TInt CAudioRoutingTestClass::CreateSessionAndScreen()
|
|
872 |
{
|
|
873 |
TInt error = KErrNone;
|
|
874 |
error = User::LeaveIfError(iWindowSession.Connect());
|
|
875 |
|
|
876 |
if (error == KErrNone)
|
|
877 |
{
|
|
878 |
TRAP(error,iScreenDevice = new(ELeave) CWsScreenDevice(iWindowSession));
|
|
879 |
}
|
|
880 |
|
|
881 |
if (error == KErrNone)
|
|
882 |
{
|
|
883 |
TRAP(error, iScreenDevice->Construct());
|
|
884 |
}
|
|
885 |
|
|
886 |
return error;
|
|
887 |
}
|
|
888 |
|
|
889 |
TInt CAudioRoutingTestClass::CreateVideoObject( )
|
|
890 |
{
|
|
891 |
TInt error = KErrNone;
|
|
892 |
|
|
893 |
|
|
894 |
TRAP(error, iVideoPlayerUtility = CVideoPlayerUtility::NewL ( *this,
|
|
895 |
EMdaPriorityNormal,
|
|
896 |
EMdaPriorityPreferenceNone,
|
|
897 |
iWindowSession,
|
|
898 |
*iScreenDevice,
|
|
899 |
iWindow,
|
|
900 |
iRect,
|
|
901 |
iRect));
|
|
902 |
if (error == KErrNone)
|
|
903 |
{
|
|
904 |
TRAP(error, iVideoPlayerUtility->OpenFileL(K3gpTestFile));
|
|
905 |
// AddExpectedEvent(EInitializeComplete, 6000);
|
|
906 |
CActiveScheduler::Start();
|
|
907 |
}
|
|
908 |
if (error == KErrNone)
|
|
909 |
{
|
|
910 |
EndDrawing();
|
|
911 |
iWindow.Close();
|
|
912 |
iWindowGroup.Close();
|
|
913 |
}
|
|
914 |
return error;
|
|
915 |
|
|
916 |
}
|
|
917 |
TInt CAudioRoutingTestClass::CreateVideoRecorderObject()
|
|
918 |
{
|
|
919 |
TInt error = KErrNone;
|
|
920 |
TRAP(error, iVideoRecord = CVideoRecorderUtility::NewL(*this));
|
|
921 |
|
|
922 |
if (error == KErrNone)
|
|
923 |
{
|
|
924 |
// const TUid KVidTstControllerUid = {0x101F8503};
|
|
925 |
TUid NULLUid ={0};
|
|
926 |
|
|
927 |
TRAP(error,iVideoRecord->OpenFileL(K3gpTestFile, NULL, NULLUid, NULLUid));
|
|
928 |
}
|
|
929 |
|
|
930 |
return error;
|
|
931 |
}
|
|
932 |
|
|
933 |
TInt CAudioRoutingTestClass::CreateWindowGroup()
|
|
934 |
{
|
|
935 |
TInt error = KErrNone;
|
|
936 |
TRAP(error, iWindowGroup = RWindowGroup(iWindowSession));
|
|
937 |
if (error == KErrNone)
|
|
938 |
{
|
|
939 |
error = User::LeaveIfError(iWindowGroup.Construct(reinterpret_cast<TUint32>(&iWindowGroup), EFalse));
|
|
940 |
if (error == KErrNone)
|
|
941 |
{
|
|
942 |
TRAP(error, iWindowGroup.SetOrdinalPosition(10, ECoeWinPriorityAlwaysAtFront));
|
|
943 |
}
|
|
944 |
}
|
|
945 |
else
|
|
946 |
{
|
|
947 |
iLog->Log(_L("iWindowGroup = RWindowGroup(iWindowSession) Failed [%d]"),error);
|
|
948 |
}
|
|
949 |
|
|
950 |
User::LeaveIfError(iScreenDevice->CreateContext(iWindowGc));
|
|
951 |
|
|
952 |
return error;
|
|
953 |
}
|
|
954 |
|
|
955 |
TInt CAudioRoutingTestClass::EndDrawing()
|
|
956 |
{
|
|
957 |
TInt error = KErrNone;
|
|
958 |
TRAP(error,{iWindow.EndRedraw();iWindowGc->Deactivate();iWindowSession.Flush();});
|
|
959 |
if (error!=KErrNone)
|
|
960 |
{
|
|
961 |
iLog->Log(_L("CAudioRoutingTestClass::EndDrawing Failed [%d]"),error);
|
|
962 |
}
|
|
963 |
return error;
|
|
964 |
}
|
|
965 |
|
|
966 |
TInt CAudioRoutingTestClass::AudioInput()
|
|
967 |
{
|
|
968 |
if (iAudioInput)
|
|
969 |
{
|
|
970 |
CAudioInput::TAudioInputArray currentInputs = iAudioInput->AudioInput();
|
|
971 |
CAudioInput::TAudioInputPreference currentInput = currentInputs[0];
|
|
972 |
iLog->Log(_L("AudioInput - currentInput = %d"),currentInput);
|
|
973 |
}
|
|
974 |
return KErrNone;
|
|
975 |
}
|
|
976 |
|
|
977 |
TInt CAudioRoutingTestClass::SetAudioInputL()
|
|
978 |
{
|
|
979 |
if (iAudioInput)
|
|
980 |
{
|
|
981 |
RArray<CAudioInput::TAudioInputPreference> inputArray;
|
|
982 |
inputArray.Append(CAudioInput::EDefaultMic);
|
|
983 |
iAudioInput->SetAudioInputL(inputArray.Array());
|
|
984 |
inputArray.Reset();
|
|
985 |
}
|
|
986 |
iLog->Log(_L("AudioInput - SetAudioInputL "));
|
|
987 |
return KErrNone;
|
|
988 |
}
|
|
989 |
|
|
990 |
TInt CAudioRoutingTestClass::AudioOutput()
|
|
991 |
{
|
|
992 |
if (iAudioOutput)
|
|
993 |
{
|
|
994 |
iAudioOutput->AudioOutput();
|
|
995 |
}
|
|
996 |
iLog->Log(_L("AudioOutput - AudioOutput "));
|
|
997 |
return KErrNone;
|
|
998 |
}
|
|
999 |
TInt CAudioRoutingTestClass::DefaultAudioOutput()
|
|
1000 |
{
|
|
1001 |
if (iAudioOutput)
|
|
1002 |
{
|
|
1003 |
iAudioOutput->DefaultAudioOutput();
|
|
1004 |
}
|
|
1005 |
iLog->Log(_L("iAudioOutput - DefaultAudioOutput "));
|
|
1006 |
return KErrNone;
|
|
1007 |
}
|
|
1008 |
|
|
1009 |
TInt CAudioRoutingTestClass::RegisterObserverL()
|
|
1010 |
{
|
|
1011 |
if(iAudioOutput)
|
|
1012 |
{
|
|
1013 |
iAudioOutput->RegisterObserverL(*this);
|
|
1014 |
}
|
|
1015 |
iLog->Log(_L("iAudioOutput - RegisterObserverL "));
|
|
1016 |
return KErrNone;
|
|
1017 |
}
|
|
1018 |
|
|
1019 |
TInt CAudioRoutingTestClass::SecureOutput()
|
|
1020 |
{
|
|
1021 |
if (iAudioOutput)
|
|
1022 |
{
|
|
1023 |
TBool secureOutput = iAudioOutput->SecureOutput();
|
|
1024 |
iLog->Log(_L("CAudioRoutingTestClass::SecureOutput - SecureOutput = %d"),secureOutput);
|
|
1025 |
}
|
|
1026 |
iLog->Log(_L("iAudioOutput - SecureOutput "));
|
|
1027 |
return KErrNone;
|
|
1028 |
}
|
|
1029 |
|
|
1030 |
|
|
1031 |
TInt CAudioRoutingTestClass::SetAudioOutputL()
|
|
1032 |
{
|
|
1033 |
if(iAudioOutput)
|
|
1034 |
{
|
|
1035 |
iAudioOutput->SetAudioOutputL(CAudioOutput::EPublic);
|
|
1036 |
}
|
|
1037 |
iLog->Log(_L("iAudioOutput - SetAudioOutputL "));
|
|
1038 |
return KErrNone;
|
|
1039 |
}
|
|
1040 |
|
|
1041 |
TInt CAudioRoutingTestClass::SetSecureOutputL()
|
|
1042 |
{
|
|
1043 |
TInt err;
|
|
1044 |
if(iAudioOutput)
|
|
1045 |
{
|
|
1046 |
TRAP(err,iAudioOutput->SetSecureOutputL(EFalse));
|
|
1047 |
}
|
|
1048 |
if(err == KErrNotSupported)
|
|
1049 |
{
|
|
1050 |
iLog->Log(_L("SetsecureoutputL is deprecated,so not supported"));
|
|
1051 |
return KErrNone;
|
|
1052 |
}
|
|
1053 |
else
|
|
1054 |
{
|
|
1055 |
return KErrGeneral;
|
|
1056 |
}
|
|
1057 |
|
|
1058 |
}
|
|
1059 |
|
|
1060 |
TInt CAudioRoutingTestClass::UnregisterObserver()
|
|
1061 |
{
|
|
1062 |
iLog->Log(_L("iAudioOutput - UnregisterObserver INIT"));
|
|
1063 |
if(iAudioOutput)
|
|
1064 |
{
|
|
1065 |
iAudioOutput->UnregisterObserver(*this);
|
|
1066 |
}
|
|
1067 |
iLog->Log(_L("iAudioOutput - UnregisterObserver "));
|
|
1068 |
return KErrNone;
|
|
1069 |
}
|
5
|
1070 |
TInt CAudioRoutingTestClass::CustomCommandSyncAsync()
|
|
1071 |
{
|
|
1072 |
iLog->Log(_L("CustomCommandPlay-CustomCommandSyncAsync"));
|
|
1073 |
TMMFMessageDestination temp(TUid::Uid(0),NULL);
|
|
1074 |
const TMMFMessageDestinationPckg destination(temp) ;
|
|
1075 |
TInt function = 1;
|
|
1076 |
_LIT8(KData1, "NULL");
|
|
1077 |
|
|
1078 |
const TDesC8& dataTo1 = KData1;
|
|
1079 |
const TDesC8& dataTo2 = KData1;
|
|
1080 |
TRequestStatus status = NULL;
|
|
1081 |
TBuf8 <50> test;
|
|
1082 |
iCustomCommandUtility = CCustomCommandUtility::NewL(*iUtil);
|
|
1083 |
iCustomCommandUtility->CustomCommandAsync(destination,function,dataTo1,dataTo2,status);
|
|
1084 |
iCustomCommandUtility->CustomCommandSync(destination,function,dataTo1,dataTo2);
|
|
1085 |
iCustomCommandUtility->CustomCommandAsync(destination,function,dataTo1,dataTo2,test,status);
|
|
1086 |
|
|
1087 |
return KErrNone;
|
|
1088 |
}
|
|
1089 |
|
|
1090 |
TInt CAudioRoutingTestClass::CustomCommandRecord()
|
|
1091 |
{
|
|
1092 |
iLog->Log(_L("CustomCommandRecord"));
|
|
1093 |
TMMFMessageDestination temp(TUid::Uid(0),NULL);
|
|
1094 |
const TMMFMessageDestinationPckg destination(temp) ;
|
|
1095 |
TInt function = 1;
|
|
1096 |
_LIT8(KData1, "NULL");
|
|
1097 |
|
|
1098 |
const TDesC8& dataTo1 = KData1;
|
|
1099 |
const TDesC8& dataTo2 = KData1;
|
|
1100 |
TBuf8 <50> test;
|
|
1101 |
TBool recstream = 0;
|
|
1102 |
TBool recstream1 = 1;
|
|
1103 |
TRequestStatus status = NULL;
|
|
1104 |
|
|
1105 |
iCustomCommandUtility = CCustomCommandUtility::NewL(*iRecorder,recstream);
|
|
1106 |
iCustomCommandUtility->CustomCommandSync(destination,function,dataTo1,dataTo2,test);
|
|
1107 |
iCustomCommandUtility->CustomCommandSync(destination,function,dataTo1,dataTo2);
|
|
1108 |
iCustomCommandUtility = CCustomCommandUtility::NewL(*iRecorder,recstream1);
|
|
1109 |
iCustomCommandUtility->CustomCommandAsync(destination,function,dataTo1,dataTo2,status);
|
|
1110 |
iCustomCommandUtility->CustomCommandAsync(destination,function,dataTo1,dataTo2,test,status);
|
|
1111 |
|
|
1112 |
return KErrNone;
|
|
1113 |
}
|
|
1114 |
|
|
1115 |
|
|
1116 |
TInt CAudioRoutingTestClass::CustomCommandRouting()
|
|
1117 |
{
|
|
1118 |
iLog->Log(_L("CustomCommandRouting"));
|
|
1119 |
|
|
1120 |
TMMFMessageDestination temp(TUid::Uid(0),NULL);
|
|
1121 |
const TMMFMessageDestinationPckg destination(temp) ;
|
|
1122 |
TInt function = 1;
|
|
1123 |
_LIT8(KData1, "NULL");
|
|
1124 |
|
|
1125 |
const TDesC8& dataTo1 = KData1;
|
|
1126 |
const TDesC8& dataTo2 = KData1;
|
|
1127 |
TRequestStatus status = NULL;
|
|
1128 |
TBuf8 <50> test;
|
|
1129 |
|
|
1130 |
iCustomCommandUtility = CCustomCommandUtility::NewL(*iUtilConvert);
|
|
1131 |
iCustomCommandUtility->CustomCommandAsync(destination,function,dataTo1,dataTo2,status);
|
|
1132 |
iCustomCommandUtility->CustomCommandSync(destination,function,dataTo1,dataTo2);
|
|
1133 |
iCustomCommandUtility->CustomCommandAsync(destination,function,dataTo1,dataTo2,test,status);
|
|
1134 |
|
|
1135 |
return KErrNone;
|
|
1136 |
}
|
|
1137 |
|
|
1138 |
TInt CAudioRoutingTestClass::CustomCommandVRecord()
|
|
1139 |
{
|
|
1140 |
iLog->Log(_L("CustomCommandVideoRecord"));
|
|
1141 |
TMMFMessageDestination temp(TUid::Uid(0),NULL);
|
|
1142 |
const TMMFMessageDestinationPckg destination(temp) ;
|
|
1143 |
TInt function = 1;
|
|
1144 |
_LIT8(KData1, "NULL");
|
|
1145 |
|
|
1146 |
const TDesC8& dataTo1 = KData1;
|
|
1147 |
const TDesC8& dataTo2 = KData1;
|
|
1148 |
TRequestStatus status = NULL;
|
|
1149 |
TBuf8 <50> test;
|
|
1150 |
|
|
1151 |
iCustomCommandUtility = CCustomCommandUtility::NewL(*iVideoRecord);
|
|
1152 |
iCustomCommandUtility->CustomCommandAsync(destination,function,dataTo1,dataTo2,status);
|
|
1153 |
iCustomCommandUtility->CustomCommandSync(destination,function,dataTo1,dataTo2);
|
|
1154 |
iCustomCommandUtility->CustomCommandAsync(destination,function,dataTo1,dataTo2,test,status);
|
|
1155 |
|
|
1156 |
return KErrNone;
|
|
1157 |
}
|
0
|
1158 |
// End of File
|