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