os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcieaacplusdecoder.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include "teststepcieaacplusdecoder.h"
sl@0
    17
sl@0
    18
/*****************************************************************************/
sl@0
    19
CTestStepCIEAacPlusDecoder::CTestStepCIEAacPlusDecoder()
sl@0
    20
	{
sl@0
    21
	iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0008-HP");
sl@0
    22
	}
sl@0
    23
sl@0
    24
/*****************************************************************************/
sl@0
    25
TVerdict CTestStepCIEAacPlusDecoder::DoTestStepL()
sl@0
    26
	{
sl@0
    27
	INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device"));
sl@0
    28
	
sl@0
    29
	//Initialize - with the UID of our test HwDevice and try to get the interface
sl@0
    30
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
    31
	TUid testUID = {KUidEAacPlusDecoderTestDevice};
sl@0
    32
	#else
sl@0
    33
	TFourCC testUID('T','0','0','2');
sl@0
    34
	#endif
sl@0
    35
	
sl@0
    36
	MEAacPlusDecoderIntfc* interface = NULL;
sl@0
    37
	interface = static_cast<MEAacPlusDecoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc));
sl@0
    38
sl@0
    39
	if (interface)
sl@0
    40
		{
sl@0
    41
		iTestStepResult = EPass;
sl@0
    42
		INFO_PRINTF1(_L("Successfully retrieved the interface."));
sl@0
    43
		}
sl@0
    44
	else
sl@0
    45
		{
sl@0
    46
		iTestStepResult = EFail;
sl@0
    47
		ERR_PRINTF1(_L("Failed to retrieve the interface"));
sl@0
    48
		}
sl@0
    49
	return iTestStepResult;
sl@0
    50
	}
sl@0
    51
sl@0
    52
/*****************************************************************************/
sl@0
    53
CTestStepCIEAacPlusDecoderGetSetFrequency::CTestStepCIEAacPlusDecoderGetSetFrequency(TBool aIsGetTest) 
sl@0
    54
											: iIsGetTest(aIsGetTest)
sl@0
    55
	{
sl@0
    56
	if (iIsGetTest)
sl@0
    57
		{
sl@0
    58
		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0015-HP");		
sl@0
    59
		}
sl@0
    60
	else
sl@0
    61
		{
sl@0
    62
		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0009-HP");
sl@0
    63
		}
sl@0
    64
	}
sl@0
    65
sl@0
    66
TVerdict CTestStepCIEAacPlusDecoderGetSetFrequency::DoTestStepL()
sl@0
    67
	{
sl@0
    68
	INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device"));
sl@0
    69
	
sl@0
    70
	//Initialize - with the UID of our test HwDevice and try to get the interface
sl@0
    71
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
    72
	TUid testUID = {KUidEAacPlusDecoderTestDevice};
sl@0
    73
	#else
sl@0
    74
	TFourCC testUID('T','0','0','2');
sl@0
    75
	#endif
sl@0
    76
	
sl@0
    77
	MEAacPlusDecoderIntfc* interface = NULL;
sl@0
    78
	interface = static_cast<MEAacPlusDecoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc));
sl@0
    79
	
sl@0
    80
	if (interface)
sl@0
    81
		{
sl@0
    82
		INFO_PRINTF1(_L("Setting the EAAC+ Decoder's Sampling Frequency"));
sl@0
    83
		TUint frequency = 666;
sl@0
    84
		interface->SetInputSamplingFrequency(frequency);
sl@0
    85
		
sl@0
    86
		TUint testFrequency;
sl@0
    87
		TInt err = interface->GetInputSamplingFrequency(testFrequency);
sl@0
    88
		if (err == KErrNone && testFrequency == frequency)
sl@0
    89
			{
sl@0
    90
			iTestStepResult = EPass;
sl@0
    91
			if (iIsGetTest)
sl@0
    92
				{
sl@0
    93
				INFO_PRINTF1(_L("Successfully got the frequency."));
sl@0
    94
				}
sl@0
    95
			else
sl@0
    96
				{
sl@0
    97
				INFO_PRINTF1(_L("Successfully set the frequency."));
sl@0
    98
				}
sl@0
    99
			}
sl@0
   100
		else
sl@0
   101
			{
sl@0
   102
			iTestStepResult = EFail;
sl@0
   103
			if (iIsGetTest)
sl@0
   104
				{
sl@0
   105
				ERR_PRINTF1(_L("Failed to get the frequency"));
sl@0
   106
				}
sl@0
   107
			else
sl@0
   108
				{
sl@0
   109
				ERR_PRINTF1(_L("Failed to set the frequency"));			
sl@0
   110
				}
sl@0
   111
			}
sl@0
   112
		}
sl@0
   113
	else
sl@0
   114
		{
sl@0
   115
		iTestStepResult = EInconclusive;
sl@0
   116
		ERR_PRINTF1(_L("Failed to retrieve the interface."));
sl@0
   117
		}
sl@0
   118
sl@0
   119
	return iTestStepResult;
sl@0
   120
	}
sl@0
   121
sl@0
   122
/*****************************************************************************/
sl@0
   123
CTestStepCIEAacPlusDecoderGetSetObjType::CTestStepCIEAacPlusDecoderGetSetObjType(TBool aIsGetTest) 
sl@0
   124
										: iIsGetTest(aIsGetTest)
sl@0
   125
	{
sl@0
   126
	if (iIsGetTest)
sl@0
   127
		{
sl@0
   128
		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0016-HP");		
sl@0
   129
		}
sl@0
   130
	else
sl@0
   131
		{
sl@0
   132
		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0010-HP");
sl@0
   133
		}
sl@0
   134
	}
sl@0
   135
sl@0
   136
TVerdict CTestStepCIEAacPlusDecoderGetSetObjType::DoTestStepL()
sl@0
   137
	{
sl@0
   138
	INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device"));
sl@0
   139
	
sl@0
   140
	//Initialize - with the UID of our test HwDevice and try to get the interface
sl@0
   141
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
   142
	TUid testUID = {KUidEAacPlusDecoderTestDevice};
sl@0
   143
	#else
sl@0
   144
	TFourCC testUID('T','0','0','2');
sl@0
   145
	#endif
sl@0
   146
	
sl@0
   147
	MEAacPlusDecoderIntfc* interface = NULL;
sl@0
   148
	interface = static_cast<MEAacPlusDecoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc));
sl@0
   149
	if (interface)
sl@0
   150
		{
sl@0
   151
		INFO_PRINTF1(_L("Setting the EAAC+ Decoder's Object Type"));
sl@0
   152
		
sl@0
   153
		MEAacPlusDecoderIntfc::TAudioObjectType audioObjectType = MEAacPlusDecoderIntfc::EAacLtp;
sl@0
   154
		interface->SetAudioObjectType(audioObjectType);
sl@0
   155
		
sl@0
   156
		MEAacPlusDecoderIntfc::TAudioObjectType testAudioObjectType;
sl@0
   157
		interface->GetAudioObjectType(testAudioObjectType);
sl@0
   158
		if (audioObjectType == testAudioObjectType)
sl@0
   159
			{
sl@0
   160
			iTestStepResult = EPass;
sl@0
   161
			if (iIsGetTest)
sl@0
   162
				{
sl@0
   163
				INFO_PRINTF1(_L("Successfully got the object type."));
sl@0
   164
				}
sl@0
   165
			else
sl@0
   166
				{
sl@0
   167
				INFO_PRINTF1(_L("Successfully set the object type."));				
sl@0
   168
				}
sl@0
   169
			}
sl@0
   170
		else
sl@0
   171
			{
sl@0
   172
			iTestStepResult = EFail;
sl@0
   173
			if (iIsGetTest)
sl@0
   174
				{
sl@0
   175
				ERR_PRINTF1(_L("Failed to get the object type"));
sl@0
   176
				}
sl@0
   177
			else
sl@0
   178
				{
sl@0
   179
				ERR_PRINTF1(_L("Failed to set the object type"));
sl@0
   180
				}
sl@0
   181
			}
sl@0
   182
		}
sl@0
   183
	else
sl@0
   184
		{
sl@0
   185
		iTestStepResult = EInconclusive;
sl@0
   186
		ERR_PRINTF1(_L("Failed to retrieve the interface."));
sl@0
   187
		}
sl@0
   188
sl@0
   189
	return iTestStepResult;
sl@0
   190
	}
sl@0
   191
	
sl@0
   192
/*****************************************************************************/
sl@0
   193
CTestStepCIEAacPlusDecoderGetSetNumChannels::CTestStepCIEAacPlusDecoderGetSetNumChannels(TBool aIsGetTest) 
sl@0
   194
											: iIsGetTest(aIsGetTest)
sl@0
   195
	{
sl@0
   196
	if (iIsGetTest)
sl@0
   197
		{
sl@0
   198
		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0017-HP");
sl@0
   199
		}
sl@0
   200
	else
sl@0
   201
		{
sl@0
   202
		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0011-HP");
sl@0
   203
		}
sl@0
   204
	}
sl@0
   205
sl@0
   206
TVerdict CTestStepCIEAacPlusDecoderGetSetNumChannels::DoTestStepL()
sl@0
   207
	{
sl@0
   208
	INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device"));
sl@0
   209
	
sl@0
   210
	//Initialize - with the UID of our test HwDevice and try to get the interface
sl@0
   211
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
   212
	TUid testUID = {KUidEAacPlusDecoderTestDevice};
sl@0
   213
	#else
sl@0
   214
	TFourCC testUID('T','0','0','2');
sl@0
   215
	#endif
sl@0
   216
	
sl@0
   217
	MEAacPlusDecoderIntfc* interface = NULL;
sl@0
   218
	interface = static_cast<MEAacPlusDecoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc));
sl@0
   219
	if (interface)
sl@0
   220
		{
sl@0
   221
		INFO_PRINTF1(_L("Setting the EAAC+ Decoder's Number of Channels"));
sl@0
   222
		TUint numChannels = 2;
sl@0
   223
		interface->SetNumOfChannels(numChannels);
sl@0
   224
		
sl@0
   225
		TUint testNumChannels;
sl@0
   226
		interface->GetNumOfChannels(testNumChannels);
sl@0
   227
		if (testNumChannels == numChannels)
sl@0
   228
			{
sl@0
   229
			iTestStepResult = EPass;
sl@0
   230
			if (iIsGetTest)
sl@0
   231
				{
sl@0
   232
				INFO_PRINTF1(_L("Successfully got the number of channels."));
sl@0
   233
				}
sl@0
   234
			else
sl@0
   235
				{
sl@0
   236
				INFO_PRINTF1(_L("Successfully set the number of channels."));				
sl@0
   237
				}
sl@0
   238
			}
sl@0
   239
		else
sl@0
   240
			{
sl@0
   241
			iTestStepResult = EFail;
sl@0
   242
			if (iIsGetTest)
sl@0
   243
				{
sl@0
   244
				ERR_PRINTF1(_L("Failed to get the number of channels"));
sl@0
   245
				}
sl@0
   246
			else
sl@0
   247
				{
sl@0
   248
				ERR_PRINTF1(_L("Failed to set the number of channels"));
sl@0
   249
				}
sl@0
   250
			}
sl@0
   251
		}
sl@0
   252
	else
sl@0
   253
		{
sl@0
   254
		iTestStepResult = EInconclusive;
sl@0
   255
		ERR_PRINTF1(_L("Failed to retrieve the interface."));
sl@0
   256
		}
sl@0
   257
sl@0
   258
	return iTestStepResult;
sl@0
   259
	}
sl@0
   260
sl@0
   261
/*****************************************************************************/
sl@0
   262
CTestStepCIEAacPlusDecoderGetSetSbr::CTestStepCIEAacPlusDecoderGetSetSbr(TBool aIsGetTest) 
sl@0
   263
									: iIsGetTest(aIsGetTest)
sl@0
   264
	{
sl@0
   265
	if (iIsGetTest)
sl@0
   266
		{
sl@0
   267
		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0018-HP");		
sl@0
   268
		}
sl@0
   269
	else
sl@0
   270
		{
sl@0
   271
		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0012-HP");
sl@0
   272
		}
sl@0
   273
	}
sl@0
   274
sl@0
   275
TVerdict CTestStepCIEAacPlusDecoderGetSetSbr::DoTestStepL()
sl@0
   276
	{
sl@0
   277
	INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device"));
sl@0
   278
	
sl@0
   279
	//Initialize - with the UID of our test HwDevice and try to get the interface
sl@0
   280
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
   281
	TUid testUID = {KUidEAacPlusDecoderTestDevice};
sl@0
   282
	#else
sl@0
   283
	TFourCC testUID('T','0','0','2');
sl@0
   284
	#endif
sl@0
   285
	
sl@0
   286
	MEAacPlusDecoderIntfc* interface = NULL;
sl@0
   287
	interface = static_cast<MEAacPlusDecoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc));
sl@0
   288
	if (interface)
sl@0
   289
		{
sl@0
   290
		INFO_PRINTF1(_L("Setting the EAAC+ Decoder's SBR"));
sl@0
   291
		interface->SetSbr(ETrue);
sl@0
   292
		
sl@0
   293
		TBool testSbr = EFalse;
sl@0
   294
		interface->GetSbr(testSbr);
sl@0
   295
		if (testSbr)
sl@0
   296
			{
sl@0
   297
			iTestStepResult = EPass;
sl@0
   298
			if (iIsGetTest)
sl@0
   299
				{			
sl@0
   300
				INFO_PRINTF1(_L("Successfully got SBR."));
sl@0
   301
				}
sl@0
   302
			else
sl@0
   303
				{				
sl@0
   304
				INFO_PRINTF1(_L("Successfully set SBR."));
sl@0
   305
				}
sl@0
   306
			}
sl@0
   307
		else
sl@0
   308
			{
sl@0
   309
			iTestStepResult = EFail;
sl@0
   310
			if (iIsGetTest)
sl@0
   311
				{
sl@0
   312
				ERR_PRINTF1(_L("Failed to get SBR."));
sl@0
   313
				}
sl@0
   314
			else
sl@0
   315
				{
sl@0
   316
				ERR_PRINTF1(_L("Failed to set SBR."));	
sl@0
   317
				}
sl@0
   318
			}
sl@0
   319
		}
sl@0
   320
	else
sl@0
   321
		{
sl@0
   322
		iTestStepResult = EInconclusive;
sl@0
   323
		ERR_PRINTF1(_L("Failed to retrieve the interface."));
sl@0
   324
		}
sl@0
   325
sl@0
   326
	return iTestStepResult;
sl@0
   327
	}
sl@0
   328
	
sl@0
   329
/*****************************************************************************/
sl@0
   330
CTestStepCIEAacPlusDecoderGetSetDsm::CTestStepCIEAacPlusDecoderGetSetDsm(TBool aIsGetTest) 
sl@0
   331
									: iIsGetTest(aIsGetTest)
sl@0
   332
	{
sl@0
   333
	if (iIsGetTest)
sl@0
   334
		{
sl@0
   335
		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0019-HP");
sl@0
   336
		}
sl@0
   337
	else
sl@0
   338
		{
sl@0
   339
		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0013-HP");
sl@0
   340
		}
sl@0
   341
	}
sl@0
   342
sl@0
   343
TVerdict CTestStepCIEAacPlusDecoderGetSetDsm::DoTestStepL()
sl@0
   344
	{
sl@0
   345
	INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device"));
sl@0
   346
	
sl@0
   347
	//Initialize - with the UID of our test HwDevice and try to get the interface
sl@0
   348
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
   349
	TUid testUID = {KUidEAacPlusDecoderTestDevice};
sl@0
   350
	#else
sl@0
   351
	TFourCC testUID('T','0','0','2');
sl@0
   352
	#endif
sl@0
   353
	
sl@0
   354
	MEAacPlusDecoderIntfc* interface = NULL;
sl@0
   355
	interface = static_cast<MEAacPlusDecoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc));
sl@0
   356
	if (interface)
sl@0
   357
		{
sl@0
   358
		INFO_PRINTF1(_L("Setting the EAAC+ Decoder's Down Sampled Mode"));
sl@0
   359
		interface->SetDownSampledMode(ETrue);
sl@0
   360
		
sl@0
   361
		TBool testDSM = EFalse;
sl@0
   362
		interface->GetDownSampledMode(testDSM);
sl@0
   363
		if (testDSM)
sl@0
   364
			{
sl@0
   365
			iTestStepResult = EPass;
sl@0
   366
			if (iIsGetTest)
sl@0
   367
				{
sl@0
   368
				INFO_PRINTF1(_L("Successfully got the DSM."));
sl@0
   369
				}
sl@0
   370
			else
sl@0
   371
				{
sl@0
   372
				INFO_PRINTF1(_L("Successfully set the DSM."));
sl@0
   373
				}
sl@0
   374
			}
sl@0
   375
		else
sl@0
   376
			{
sl@0
   377
			iTestStepResult = EFail;
sl@0
   378
				ERR_PRINTF1(_L("Failed to set the DSM."));
sl@0
   379
			}
sl@0
   380
		}
sl@0
   381
	else
sl@0
   382
		{
sl@0
   383
		iTestStepResult = EInconclusive;
sl@0
   384
		ERR_PRINTF1(_L("Failed to retrieve the interface."));
sl@0
   385
		}
sl@0
   386
sl@0
   387
	return iTestStepResult;
sl@0
   388
	}
sl@0
   389
	
sl@0
   390
/*****************************************************************************/
sl@0
   391
CTestStepCIEAacPlusDecoderApplyConfig::CTestStepCIEAacPlusDecoderApplyConfig()
sl@0
   392
	{
sl@0
   393
sl@0
   394
	iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0014-HP");
sl@0
   395
	}
sl@0
   396
sl@0
   397
TVerdict CTestStepCIEAacPlusDecoderApplyConfig::DoTestStepL()
sl@0
   398
	{
sl@0
   399
	INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device"));
sl@0
   400
	
sl@0
   401
	//Initialize - with the UID of our test HwDevice and try to get the interface
sl@0
   402
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
   403
	TUid testUID = {KUidEAacPlusDecoderTestDevice};
sl@0
   404
	#else
sl@0
   405
	TFourCC testUID('T','0','0','2');
sl@0
   406
	#endif
sl@0
   407
	
sl@0
   408
	MEAacPlusDecoderIntfc* interface = NULL;
sl@0
   409
	interface = static_cast<MEAacPlusDecoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc));
sl@0
   410
	if (interface)
sl@0
   411
		{
sl@0
   412
		INFO_PRINTF1(_L("Applying the config to the EAAC+ Decoder"));
sl@0
   413
		TInt err = interface->ApplyConfig();
sl@0
   414
		if (err == KErrNone)
sl@0
   415
			{
sl@0
   416
			iTestStepResult = EPass;
sl@0
   417
			INFO_PRINTF1(_L("Successfully applied the config."));
sl@0
   418
			}
sl@0
   419
		else
sl@0
   420
			{
sl@0
   421
			iTestStepResult = EFail;
sl@0
   422
			ERR_PRINTF2(_L("Failed to apply the config, error: %d"), err);
sl@0
   423
			}
sl@0
   424
		}
sl@0
   425
	else
sl@0
   426
		{
sl@0
   427
		iTestStepResult = EInconclusive;
sl@0
   428
		ERR_PRINTF1(_L("Failed to retrieve the interface."));
sl@0
   429
		}
sl@0
   430
	return iTestStepResult;
sl@0
   431
	}