os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcisbcencoder.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcisbcencoder.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,939 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include "teststepcisbcencoder.h"
1.20 +
1.21 +/*****************************************************************************/
1.22 +CTestStepCISbcEncoder::CTestStepCISbcEncoder()
1.23 + {
1.24 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0020-HP");
1.25 + }
1.26 +
1.27 +/*****************************************************************************/
1.28 +TVerdict CTestStepCISbcEncoder::DoTestStepL()
1.29 + {
1.30 + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device"));
1.31 +
1.32 + //Initialize - with the UID of our test HwDevice and try to get the interface
1.33 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.34 + TUid testUID = {KUidSbcEncoderTestDevice};
1.35 + #else
1.36 + TFourCC testUID('T','0','0','3');
1.37 + #endif
1.38 +
1.39 + MSbcEncoderIntfc* interface = NULL;
1.40 + interface = static_cast<MSbcEncoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc));
1.41 +
1.42 + if (interface)
1.43 + {
1.44 + iTestStepResult = EPass;
1.45 + INFO_PRINTF1(_L("Successfully retrieved the interface."));
1.46 + }
1.47 + else
1.48 + {
1.49 + iTestStepResult = EFail;
1.50 + ERR_PRINTF1(_L("Failed to retrieve the interface"));
1.51 + }
1.52 +
1.53 + return iTestStepResult;
1.54 + }
1.55 +
1.56 +/****************************************************************************/
1.57 +CTestStepCISbcEncoderGetSupportedFrequencies::CTestStepCISbcEncoderGetSupportedFrequencies()
1.58 + {
1.59 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0021-HP");
1.60 + }
1.61 +
1.62 +TVerdict CTestStepCISbcEncoderGetSupportedFrequencies::DoTestStepL()
1.63 + {
1.64 + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device"));
1.65 +
1.66 + //Initialize - with the UID of our test HwDevice and try to get the interface
1.67 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.68 + TUid testUID = {KUidSbcEncoderTestDevice};
1.69 + #else
1.70 + TFourCC testUID('T','0','0','3');
1.71 + #endif
1.72 +
1.73 + MSbcEncoderIntfc* interface = NULL;
1.74 + interface = static_cast<MSbcEncoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc));
1.75 + if (interface)
1.76 + {
1.77 + INFO_PRINTF1(_L("Getting the SBC Encoder's Supported Sampling Frequencies"));
1.78 +
1.79 + RArray<TUint> frequencies;
1.80 + CleanupClosePushL(frequencies);
1.81 + TInt err = interface->GetSupportedSamplingFrequencies(frequencies);
1.82 +
1.83 + // Data is hard coded in the test HwDevice implementation
1.84 + // to add 10 values from 0 to 9000 in intervals of 1000.
1.85 + TBool validValues = ValidateArray(frequencies);
1.86 + if (err == KErrNone && validValues)
1.87 + {
1.88 + iTestStepResult = EPass;
1.89 + INFO_PRINTF1(_L("Successfully got the frequencies."));
1.90 + }
1.91 + else
1.92 + {
1.93 + iTestStepResult = EFail;
1.94 + ERR_PRINTF1(_L("Failed to get the frequencies"));
1.95 + }
1.96 + CleanupStack::PopAndDestroy(); // frequencies
1.97 + }
1.98 + else
1.99 + {
1.100 + iTestStepResult = EInconclusive;
1.101 + INFO_PRINTF1(_L("Failed to retrieve the interface."));
1.102 + }
1.103 +
1.104 + return iTestStepResult;
1.105 + }
1.106 +
1.107 +
1.108 +TBool CTestStepCISbcEncoderGetSupportedFrequencies::ValidateArray(const RArray<TUint>& aArray) const
1.109 + {
1.110 + TBool iTestStepResult = ETrue;
1.111 +
1.112 + TInt count = aArray.Count();
1.113 + if (count != 10)
1.114 + {
1.115 + iTestStepResult = EFalse;
1.116 + }
1.117 + else
1.118 + {
1.119 + TUint val = 0;
1.120 + for (TInt i = 0; i < count; i++)
1.121 + {
1.122 + if (aArray[i] != val)
1.123 + {
1.124 + iTestStepResult = EFalse;
1.125 + break;
1.126 + }
1.127 + val += 1000;
1.128 + }
1.129 + }
1.130 +
1.131 + return iTestStepResult;
1.132 + }
1.133 +
1.134 +/****************************************************************************/
1.135 +CTestStepCISbcEncoderGetSupportedSubbands::CTestStepCISbcEncoderGetSupportedSubbands()
1.136 + {
1.137 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0023-HP");
1.138 + }
1.139 +
1.140 +TVerdict CTestStepCISbcEncoderGetSupportedSubbands::DoTestStepL()
1.141 + {
1.142 + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device"));
1.143 +
1.144 + //Initialize - with the UID of our test HwDevice and try to get the interface
1.145 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.146 + TUid testUID = {KUidSbcEncoderTestDevice};
1.147 + #else
1.148 + TFourCC testUID('T','0','0','3');
1.149 + #endif
1.150 +
1.151 + MSbcEncoderIntfc* interface = NULL;
1.152 + interface = static_cast<MSbcEncoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc));
1.153 + if (interface)
1.154 + {
1.155 + INFO_PRINTF1(_L("Getting the SBC Encoder's Number Of Subbands"));
1.156 +
1.157 + RArray<TUint> subbands;
1.158 + CleanupClosePushL(subbands);
1.159 + TInt err = interface->GetSupportedNumOfSubbands(subbands);
1.160 +
1.161 + // Data is hard coded in the test HwDevice implementation
1.162 + // to add 5 values from 100 to 500 in intervals of 100.
1.163 + TBool validValues = ValidateArray(subbands);
1.164 + if (err == KErrNone && validValues)
1.165 + {
1.166 + iTestStepResult = EPass;
1.167 + INFO_PRINTF1(_L("Successfully got the subbands."));
1.168 + }
1.169 + else
1.170 + {
1.171 + iTestStepResult = EFail;
1.172 + ERR_PRINTF1(_L("Failed to get the subbands"));
1.173 + }
1.174 + CleanupStack::PopAndDestroy(); // subbands
1.175 + }
1.176 + else
1.177 + {
1.178 + iTestStepResult = EInconclusive;
1.179 + INFO_PRINTF1(_L("Failed to retrieve the interface."));
1.180 + }
1.181 +
1.182 + return iTestStepResult;
1.183 + }
1.184 +
1.185 +
1.186 +TBool CTestStepCISbcEncoderGetSupportedSubbands::ValidateArray(const RArray<TUint>& aArray) const
1.187 + {
1.188 + TBool iTestStepResult = ETrue;
1.189 +
1.190 + TInt count = aArray.Count();
1.191 + if (count != 5)
1.192 + {
1.193 + iTestStepResult = EFalse;
1.194 + }
1.195 + else
1.196 + {
1.197 + TUint val = 100;
1.198 + for (TInt i = 0; i < count; i++)
1.199 + {
1.200 + if (aArray[i] != val)
1.201 + {
1.202 + iTestStepResult = EFalse;
1.203 + break;
1.204 + }
1.205 + val += 100;
1.206 + }
1.207 + }
1.208 +
1.209 + return iTestStepResult;
1.210 + }
1.211 +
1.212 +/****************************************************************************/
1.213 +CTestStepCISbcEncoderGetSupportedNumOfBlocks::CTestStepCISbcEncoderGetSupportedNumOfBlocks()
1.214 + {
1.215 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0025-HP");
1.216 + }
1.217 +
1.218 +TVerdict CTestStepCISbcEncoderGetSupportedNumOfBlocks::DoTestStepL()
1.219 + {
1.220 + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device"));
1.221 +
1.222 + //Initialize - with the UID of our test HwDevice and try to get the interface
1.223 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.224 + TUid testUID = {KUidSbcEncoderTestDevice};
1.225 + #else
1.226 + TFourCC testUID('T','0','0','3');
1.227 + #endif
1.228 +
1.229 + MSbcEncoderIntfc* interface = NULL;
1.230 + interface = static_cast<MSbcEncoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc));
1.231 + if (interface)
1.232 + {
1.233 + INFO_PRINTF1(_L("Getting the SBC Encoder's Number Of Supported Blocks"));
1.234 +
1.235 + RArray<TUint> blocks;
1.236 + CleanupClosePushL(blocks);
1.237 + TInt err = interface->GetSupportedNumOfBlocks(blocks);
1.238 +
1.239 + // Data is hard coded in the test HwDevice implementation
1.240 + // to add 10 values from 1 to 10
1.241 + TBool validValues = ValidateArray(blocks);
1.242 + if (err == KErrNone && validValues)
1.243 + {
1.244 + iTestStepResult = EPass;
1.245 + INFO_PRINTF1(_L("Successfully got the blocks."));
1.246 + }
1.247 + else
1.248 + {
1.249 + iTestStepResult = EFail;
1.250 + ERR_PRINTF1(_L("Failed to get the blocks"));
1.251 + }
1.252 + CleanupStack::PopAndDestroy(); // blocks
1.253 + }
1.254 + else
1.255 + {
1.256 + iTestStepResult = EInconclusive;
1.257 + INFO_PRINTF1(_L("Failed to retrieve the interface."));
1.258 + }
1.259 +
1.260 + return iTestStepResult;
1.261 + }
1.262 +
1.263 +
1.264 +TBool CTestStepCISbcEncoderGetSupportedNumOfBlocks::ValidateArray(const RArray<TUint>& aArray) const
1.265 + {
1.266 + TBool iTestStepResult = ETrue;
1.267 +
1.268 + TInt count = aArray.Count();
1.269 + if (count != 10)
1.270 + {
1.271 + iTestStepResult = EFalse;
1.272 + }
1.273 + else
1.274 + {
1.275 + TUint val = 1;
1.276 + for (TInt i = 0; i < count; i++)
1.277 + {
1.278 + if (aArray[i] != val)
1.279 + {
1.280 + iTestStepResult = EFalse;
1.281 + break;
1.282 + }
1.283 + val++;
1.284 + }
1.285 + }
1.286 +
1.287 + return iTestStepResult;
1.288 + }
1.289 +
1.290 +/****************************************************************************/
1.291 +CTestStepCISbcEncoderGetSupportedChannelModes::CTestStepCISbcEncoderGetSupportedChannelModes()
1.292 + {
1.293 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0022-HP");
1.294 + }
1.295 +
1.296 +TVerdict CTestStepCISbcEncoderGetSupportedChannelModes::DoTestStepL()
1.297 + {
1.298 + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device"));
1.299 +
1.300 + //Initialize - with the UID of our test HwDevice and try to get the interface
1.301 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.302 + TUid testUID = {KUidSbcEncoderTestDevice};
1.303 + #else
1.304 + TFourCC testUID('T','0','0','3');
1.305 + #endif
1.306 +
1.307 + MSbcEncoderIntfc* interface = NULL;
1.308 + interface = static_cast<MSbcEncoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc));
1.309 + if (interface)
1.310 + {
1.311 + INFO_PRINTF1(_L("Getting the SBC Encoder's Supported Channel Modes"));
1.312 +
1.313 + RArray<MSbcEncoderIntfc::TSbcChannelMode> modes;
1.314 + CleanupClosePushL(modes);
1.315 + TInt err = interface->GetSupportedChannelModes(modes);
1.316 +
1.317 + // Data is hard coded in the test HwDevice implementation
1.318 + // to add the 4 available values
1.319 + TBool validValues = ValidateArray(modes);
1.320 + if (err == KErrNone && validValues)
1.321 + {
1.322 + iTestStepResult = EPass;
1.323 + INFO_PRINTF1(_L("Successfully got the supported modes."));
1.324 + }
1.325 + else
1.326 + {
1.327 + iTestStepResult = EFail;
1.328 + ERR_PRINTF1(_L("Failed to get the supported modes"));
1.329 + }
1.330 + CleanupStack::PopAndDestroy(); // modes
1.331 + }
1.332 + else
1.333 + {
1.334 + iTestStepResult = EInconclusive;
1.335 + INFO_PRINTF1(_L("Failed to retrieve the interface."));
1.336 + }
1.337 +
1.338 + return iTestStepResult;
1.339 + }
1.340 +
1.341 +
1.342 +TBool CTestStepCISbcEncoderGetSupportedChannelModes::ValidateArray(const RArray<MSbcEncoderIntfc::TSbcChannelMode>& aArray) const
1.343 + {
1.344 + TBool iTestStepResult = ETrue;
1.345 +
1.346 + TInt count = aArray.Count();
1.347 + if (count != 4)
1.348 + {
1.349 + iTestStepResult = EFalse;
1.350 + }
1.351 + else
1.352 + {
1.353 + if ((aArray[0] != MSbcEncoderIntfc::ESbcChannelMono) ||
1.354 + (aArray[1] != MSbcEncoderIntfc::ESbcChannelDual) ||
1.355 + (aArray[2] != MSbcEncoderIntfc::ESbcChannelStereo) ||
1.356 + (aArray[3] != MSbcEncoderIntfc::ESbcChannelJointStereo))
1.357 + {
1.358 + iTestStepResult = EFalse;
1.359 + }
1.360 + }
1.361 +
1.362 + return iTestStepResult;
1.363 + }
1.364 +
1.365 +/****************************************************************************/
1.366 +CTestStepCISbcEncoderGetSupportedAllocationMethods::CTestStepCISbcEncoderGetSupportedAllocationMethods()
1.367 + {
1.368 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0024-HP");
1.369 + }
1.370 +
1.371 +TVerdict CTestStepCISbcEncoderGetSupportedAllocationMethods::DoTestStepL()
1.372 + {
1.373 + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device"));
1.374 +
1.375 + //Initialize - with the UID of our test HwDevice and try to get the interface
1.376 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.377 + TUid testUID = {KUidSbcEncoderTestDevice};
1.378 + #else
1.379 + TFourCC testUID('T','0','0','3');
1.380 + #endif
1.381 +
1.382 + MSbcEncoderIntfc* interface = NULL;
1.383 + interface = static_cast<MSbcEncoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc));
1.384 + if (interface)
1.385 + {
1.386 + INFO_PRINTF1(_L("Getting the SBC Encoder's Supported Allocation Methods"));
1.387 +
1.388 + RArray<MSbcEncoderIntfc::TSbcAllocationMethod> allocMethods;
1.389 + CleanupClosePushL(allocMethods);
1.390 + TInt err = interface->GetSupportedAllocationMethods(allocMethods);
1.391 +
1.392 + // Data is hard coded in the test HwDevice implementation
1.393 + // to add the 2 available allocation methods
1.394 + TBool validValues = ValidateArray(allocMethods);
1.395 + if (err == KErrNone && validValues)
1.396 + {
1.397 + iTestStepResult = EPass;
1.398 + INFO_PRINTF1(_L("Successfully got the allocation methods."));
1.399 + }
1.400 + else
1.401 + {
1.402 + iTestStepResult = EFail;
1.403 + ERR_PRINTF1(_L("Failed to get the allocation methods"));
1.404 + }
1.405 + CleanupStack::PopAndDestroy(); // allocMethods
1.406 + }
1.407 + else
1.408 + {
1.409 + iTestStepResult = EInconclusive;
1.410 + ERR_PRINTF1(_L("Failed to retrieve the interface."));
1.411 + }
1.412 +
1.413 + return iTestStepResult;
1.414 + }
1.415 +
1.416 +
1.417 +TBool CTestStepCISbcEncoderGetSupportedAllocationMethods::ValidateArray(const RArray<
1.418 + MSbcEncoderIntfc::TSbcAllocationMethod>&
1.419 + aArray) const
1.420 + {
1.421 + TBool iTestStepResult = ETrue;
1.422 +
1.423 + TInt count = aArray.Count();
1.424 + if (count != 2)
1.425 + {
1.426 + iTestStepResult = EFalse;
1.427 + }
1.428 + else
1.429 + {
1.430 + if ((aArray[0] != MSbcEncoderIntfc::ESbcAllocationSNR) ||
1.431 + (aArray[1] != MSbcEncoderIntfc::ESbcAllocationLoudness))
1.432 + {
1.433 + iTestStepResult = EFalse;
1.434 + }
1.435 + }
1.436 +
1.437 + return iTestStepResult;
1.438 + }
1.439 +
1.440 +/*****************************************************************************/
1.441 +CTestStepCISbcEncoderGetSupportedBitpoolRange::CTestStepCISbcEncoderGetSupportedBitpoolRange()
1.442 + {
1.443 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0026-HP");
1.444 + }
1.445 +
1.446 +TVerdict CTestStepCISbcEncoderGetSupportedBitpoolRange::DoTestStepL()
1.447 + {
1.448 + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device"));
1.449 +
1.450 + //Initialize - with the UID of our test HwDevice and try to get the interface
1.451 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.452 + TUid testUID = {KUidSbcEncoderTestDevice};
1.453 + #else
1.454 + TFourCC testUID('T','0','0','3');
1.455 + #endif
1.456 +
1.457 + MSbcEncoderIntfc* interface = NULL;
1.458 + interface = static_cast<MSbcEncoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc));
1.459 + if (interface)
1.460 + {
1.461 + INFO_PRINTF1(_L("Getting the SBC Encoder's Supported Bitpool Range"));
1.462 + TUint minSize = 0;
1.463 + TUint maxSize = 0;
1.464 + TInt err = interface->GetSupportedBitpoolRange(minSize, maxSize);
1.465 +
1.466 + // Hard coded min and max values in the test device
1.467 + if ((err == KErrNone) &&
1.468 + (minSize == 1) &&
1.469 + (maxSize == 2))
1.470 + {
1.471 + iTestStepResult = EPass;
1.472 + INFO_PRINTF1(_L("Successfully got the bitpool range."));
1.473 + }
1.474 + else
1.475 + {
1.476 + iTestStepResult = EFail;
1.477 + ERR_PRINTF1(_L("Failed to get the bitpool range"));
1.478 + }
1.479 + }
1.480 + else
1.481 + {
1.482 + iTestStepResult = EInconclusive;
1.483 + ERR_PRINTF1(_L("Failed to retrieve the interface."));
1.484 + }
1.485 +
1.486 + return iTestStepResult;
1.487 + }
1.488 +
1.489 +/*****************************************************************************/
1.490 +CTestStepCISbcEncoderGetSetFrequency::CTestStepCISbcEncoderGetSetFrequency(TBool aIsGetTest)
1.491 + : iIsGetTest(aIsGetTest)
1.492 + {
1.493 + if (iIsGetTest)
1.494 + {
1.495 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0034-HP");
1.496 + }
1.497 + else
1.498 + {
1.499 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0027-HP");
1.500 + }
1.501 + }
1.502 +
1.503 +TVerdict CTestStepCISbcEncoderGetSetFrequency::DoTestStepL()
1.504 + {
1.505 + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device"));
1.506 +
1.507 + //Initialize - with the UID of our test HwDevice and try to get the interface
1.508 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.509 + TUid testUID = {KUidSbcEncoderTestDevice};
1.510 + #else
1.511 + TFourCC testUID('T','0','0','3');
1.512 + #endif
1.513 +
1.514 + MSbcEncoderIntfc* interface = NULL;
1.515 + interface = static_cast<MSbcEncoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc));
1.516 + if (interface)
1.517 + {
1.518 + INFO_PRINTF1(_L("Setting the SBC Encoder's Sampling Frequency"));
1.519 +
1.520 + TUint frequency = 666;
1.521 + interface->SetSamplingFrequency(frequency);
1.522 +
1.523 + TUint testFreq = 0;
1.524 + TInt err = interface->GetSamplingFrequency(testFreq);
1.525 + if (err == KErrNone && (frequency == testFreq))
1.526 + {
1.527 + iTestStepResult = EPass;
1.528 + if (iIsGetTest)
1.529 + {
1.530 + INFO_PRINTF1(_L("Successfully got the frequency."));
1.531 + }
1.532 + else
1.533 + {
1.534 + INFO_PRINTF1(_L("Successfully set the frequency."));
1.535 + }
1.536 + }
1.537 + else
1.538 + {
1.539 + iTestStepResult = EFail;
1.540 + if (iIsGetTest)
1.541 + {
1.542 + ERR_PRINTF1(_L("Failed to get the frequency"));
1.543 + }
1.544 + else
1.545 + {
1.546 + ERR_PRINTF1(_L("Failed to set the frequency"));
1.547 + }
1.548 + }
1.549 + }
1.550 + else
1.551 + {
1.552 + iTestStepResult = EInconclusive;
1.553 + ERR_PRINTF1(_L("Failed to retrieve the interface."));
1.554 + }
1.555 +
1.556 + return iTestStepResult;
1.557 + }
1.558 +
1.559 +/*****************************************************************************/
1.560 +CTestStepCISbcEncoderGetSetChannelMode::CTestStepCISbcEncoderGetSetChannelMode(TBool aIsGetTest)
1.561 + : iIsGetTest(aIsGetTest)
1.562 + {
1.563 + if (iIsGetTest)
1.564 + {
1.565 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0035-HP");
1.566 + }
1.567 + else
1.568 + {
1.569 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0028-HP");
1.570 + }
1.571 + }
1.572 +
1.573 +TVerdict CTestStepCISbcEncoderGetSetChannelMode::DoTestStepL()
1.574 + {
1.575 + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device"));
1.576 +
1.577 + //Initialize - with the UID of our test HwDevice and try to get the interface
1.578 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.579 + TUid testUID = {KUidSbcEncoderTestDevice};
1.580 + #else
1.581 + TFourCC testUID('T','0','0','3');
1.582 + #endif
1.583 +
1.584 + MSbcEncoderIntfc* interface = NULL;
1.585 + interface = static_cast<MSbcEncoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc));
1.586 + if (interface)
1.587 + {
1.588 + INFO_PRINTF1(_L("Setting the SBC Encoder's Channel Mode"));
1.589 + MSbcEncoderIntfc::TSbcChannelMode channelMode = MSbcEncoderIntfc::ESbcChannelStereo;
1.590 + interface->SetChannelMode(channelMode);
1.591 +
1.592 + MSbcEncoderIntfc::TSbcChannelMode testChannelMode = MSbcEncoderIntfc::ESbcChannelMono;
1.593 + TInt err = interface->GetChannelMode(testChannelMode);
1.594 + if ((err == KErrNone) && (channelMode == testChannelMode))
1.595 + {
1.596 + iTestStepResult = EPass;
1.597 + if (iIsGetTest)
1.598 + {
1.599 + INFO_PRINTF1(_L("Successfully got the channel mode."));
1.600 + }
1.601 + else
1.602 + {
1.603 + INFO_PRINTF1(_L("Successfully set the channel mode."));
1.604 + }
1.605 + }
1.606 + else
1.607 + {
1.608 + iTestStepResult = EFail;
1.609 + if (iIsGetTest)
1.610 + {
1.611 + ERR_PRINTF1(_L("Failed to get channel mode"));
1.612 + }
1.613 + else
1.614 + {
1.615 + ERR_PRINTF1(_L("Failed to set channel mode"));
1.616 + }
1.617 + }
1.618 + }
1.619 + else
1.620 + {
1.621 + iTestStepResult = EInconclusive;
1.622 + ERR_PRINTF1(_L("Failed to retrieve the interface."));
1.623 + }
1.624 +
1.625 + return iTestStepResult;
1.626 + }
1.627 +
1.628 +/*****************************************************************************/
1.629 +CTestStepCISbcEncoderGetSetNumOfSubbands::CTestStepCISbcEncoderGetSetNumOfSubbands(TBool aIsGetTest)
1.630 + : iIsGetTest(aIsGetTest)
1.631 + {
1.632 + if (iIsGetTest)
1.633 + {
1.634 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0036-HP");
1.635 + }
1.636 + else
1.637 + {
1.638 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0029-HP");
1.639 + }
1.640 + }
1.641 +
1.642 +TVerdict CTestStepCISbcEncoderGetSetNumOfSubbands::DoTestStepL()
1.643 + {
1.644 + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device"));
1.645 +
1.646 + //Initialize - with the UID of our test HwDevice and try to get the interface
1.647 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.648 + TUid testUID = {KUidSbcEncoderTestDevice};
1.649 + #else
1.650 + TFourCC testUID('T','0','0','3');
1.651 + #endif
1.652 +
1.653 + MSbcEncoderIntfc* interface = NULL;
1.654 + interface = static_cast<MSbcEncoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc));
1.655 + if (interface)
1.656 + {
1.657 + INFO_PRINTF1(_L("Setting the SBC Encoder's Number of Subbands"));
1.658 + TUint numOfSubbands = 6;
1.659 + interface->SetNumOfSubbands(numOfSubbands);
1.660 +
1.661 + TUint testSubbands = 0;
1.662 + TInt err = interface->GetNumOfSubbands(testSubbands);
1.663 + if (err == KErrNone && (testSubbands == numOfSubbands))
1.664 + {
1.665 + iTestStepResult = EPass;
1.666 + if (iIsGetTest)
1.667 + {
1.668 + INFO_PRINTF1(_L("Successfully got subbands."));
1.669 + }
1.670 + else
1.671 + {
1.672 + INFO_PRINTF1(_L("Successfully set subbands."));
1.673 + }
1.674 + }
1.675 + else
1.676 + {
1.677 + iTestStepResult = EFail;
1.678 + if (iIsGetTest)
1.679 + {
1.680 + ERR_PRINTF1(_L("Failed to get subbands."));
1.681 + }
1.682 + else
1.683 + {
1.684 + ERR_PRINTF1(_L("Failed to set subbands."));
1.685 + }
1.686 + }
1.687 + }
1.688 + else
1.689 + {
1.690 + iTestStepResult = EInconclusive;
1.691 + ERR_PRINTF1(_L("Failed to retrieve the interface."));
1.692 + }
1.693 +
1.694 + return iTestStepResult;
1.695 + }
1.696 +
1.697 +/*****************************************************************************/
1.698 +CTestStepCISbcEncoderGetSetNumOfBlocks::CTestStepCISbcEncoderGetSetNumOfBlocks(TBool aIsGetTest)
1.699 + : iIsGetTest(aIsGetTest)
1.700 + {
1.701 + if (iIsGetTest)
1.702 + {
1.703 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0037-HP");
1.704 + }
1.705 + else
1.706 + {
1.707 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0030-HP");
1.708 + }
1.709 + }
1.710 +
1.711 +TVerdict CTestStepCISbcEncoderGetSetNumOfBlocks::DoTestStepL()
1.712 + {
1.713 + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device"));
1.714 +
1.715 + //Initialize - with the UID of our test HwDevice and try to get the interface
1.716 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.717 + TUid testUID = {KUidSbcEncoderTestDevice};
1.718 + #else
1.719 + TFourCC testUID('T','0','0','3');
1.720 + #endif
1.721 +
1.722 + MSbcEncoderIntfc* interface = NULL;
1.723 + interface = static_cast<MSbcEncoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc));
1.724 + if (interface)
1.725 + {
1.726 + INFO_PRINTF1(_L("Setting the SBC Encoder's Number of Blocks"));
1.727 + TUint numOfBlocks = 6;
1.728 + interface->SetNumOfBlocks(numOfBlocks);
1.729 + TUint testBlocks = 0;
1.730 + TInt err = interface->GetNumOfBlocks(testBlocks);
1.731 + if ((err == KErrNone) && (numOfBlocks == testBlocks))
1.732 + {
1.733 + iTestStepResult = EPass;
1.734 + if (iIsGetTest)
1.735 + {
1.736 + INFO_PRINTF1(_L("Successfully got the number of blocks."));
1.737 + }
1.738 + else
1.739 + {
1.740 + INFO_PRINTF1(_L("Successfully set the number of blocks."));
1.741 + }
1.742 + }
1.743 + else
1.744 + {
1.745 + iTestStepResult = EFail;
1.746 + if (iIsGetTest)
1.747 + {
1.748 + ERR_PRINTF1(_L("Failed to get the number of blocks."));
1.749 + }
1.750 + else
1.751 + {
1.752 + ERR_PRINTF1(_L("Failed to set the number of blocks."));
1.753 + }
1.754 + }
1.755 + }
1.756 + else
1.757 + {
1.758 + iTestStepResult = EInconclusive;
1.759 + ERR_PRINTF1(_L("Failed to retrieve the interface."));
1.760 + }
1.761 +
1.762 + return iTestStepResult;
1.763 + }
1.764 +
1.765 +/*****************************************************************************/
1.766 +CTestStepCISbcEncoderGetSetAllocationMethod::CTestStepCISbcEncoderGetSetAllocationMethod(TBool aIsGetTest)
1.767 + : iIsGetTest(aIsGetTest)
1.768 + {
1.769 + if (iIsGetTest)
1.770 + {
1.771 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0038-HP");
1.772 + }
1.773 + else
1.774 + {
1.775 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0031-HP");
1.776 + }
1.777 + }
1.778 +
1.779 +TVerdict CTestStepCISbcEncoderGetSetAllocationMethod::DoTestStepL()
1.780 + {
1.781 + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device"));
1.782 +
1.783 + //Initialize - with the UID of our test HwDevice and try to get the interface
1.784 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.785 + TUid testUID = {KUidSbcEncoderTestDevice};
1.786 + #else
1.787 + TFourCC testUID('T','0','0','3');
1.788 + #endif
1.789 +
1.790 + MSbcEncoderIntfc* interface = NULL;
1.791 + interface = static_cast<MSbcEncoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc));
1.792 + if (interface)
1.793 + {
1.794 + INFO_PRINTF1(_L("Setting the SBC Encoder's Allocation Method"));
1.795 + MSbcEncoderIntfc::TSbcAllocationMethod allocationMethod = MSbcEncoderIntfc::ESbcAllocationLoudness;
1.796 + interface->SetAllocationMethod(allocationMethod);
1.797 +
1.798 + MSbcEncoderIntfc::TSbcAllocationMethod testAllocationMethod;
1.799 + TInt err = interface->GetAllocationMethod(testAllocationMethod);
1.800 + if ((err == KErrNone) && (allocationMethod == testAllocationMethod))
1.801 + {
1.802 + iTestStepResult = EPass;
1.803 + if (iIsGetTest)
1.804 + {
1.805 + INFO_PRINTF1(_L("Successfully got the allocation method."));
1.806 + }
1.807 + else
1.808 + {
1.809 + INFO_PRINTF1(_L("Successfully set the allocation method."));
1.810 + } }
1.811 + else
1.812 + {
1.813 + iTestStepResult = EFail;
1.814 + if (iIsGetTest)
1.815 + {
1.816 + ERR_PRINTF1(_L("Failed to get the allocation method."));
1.817 + }
1.818 + else
1.819 + {
1.820 + ERR_PRINTF1(_L("Failed to set the allocation method."));
1.821 + }
1.822 + }
1.823 + }
1.824 + else
1.825 + {
1.826 + iTestStepResult = EInconclusive;
1.827 + ERR_PRINTF1(_L("Failed to retrieve the interface."));
1.828 + }
1.829 +
1.830 + return iTestStepResult;
1.831 + }
1.832 +
1.833 +/*****************************************************************************/
1.834 +CTestStepCISbcEncoderGetSetBitpoolSize::CTestStepCISbcEncoderGetSetBitpoolSize(TBool aIsGetTest)
1.835 + : iIsGetTest(aIsGetTest)
1.836 + {
1.837 + if (iIsGetTest)
1.838 + {
1.839 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0039-HP");
1.840 + }
1.841 + else
1.842 + {
1.843 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0032-HP");
1.844 + }
1.845 + }
1.846 +
1.847 +TVerdict CTestStepCISbcEncoderGetSetBitpoolSize::DoTestStepL()
1.848 + {
1.849 + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device"));
1.850 +
1.851 + //Initialize - with the UID of our test HwDevice and try to get the interface
1.852 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.853 + TUid testUID = {KUidSbcEncoderTestDevice};
1.854 + #else
1.855 + TFourCC testUID('T','0','0','3');
1.856 + #endif
1.857 +
1.858 + MSbcEncoderIntfc* interface = NULL;
1.859 + interface = static_cast<MSbcEncoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc));
1.860 + if (interface)
1.861 + {
1.862 + INFO_PRINTF1(_L("Setting the SBC Encoder's Bitpool Size"));
1.863 + TUint bitpoolSize = 6;
1.864 + interface->SetBitpoolSize(bitpoolSize);
1.865 +
1.866 + TUint testBitpoolSize = 0;
1.867 + TInt err = interface->GetBitpoolSize(testBitpoolSize);
1.868 + if ((err == KErrNone) && (bitpoolSize == testBitpoolSize))
1.869 + {
1.870 + iTestStepResult = EPass;
1.871 + if (iIsGetTest)
1.872 + {
1.873 + INFO_PRINTF1(_L("Successfully got the bitpool size."));
1.874 + }
1.875 + else
1.876 + {
1.877 + INFO_PRINTF1(_L("Successfully set the bitpool size."));
1.878 + }
1.879 + }
1.880 + else
1.881 + {
1.882 + iTestStepResult = EFail;
1.883 + if (iIsGetTest)
1.884 + {
1.885 + ERR_PRINTF1(_L("Failed to get the bitpool size."));
1.886 + }
1.887 + else
1.888 + {
1.889 + ERR_PRINTF1(_L("Failed to set the bitpool size."));
1.890 + }
1.891 + }
1.892 + }
1.893 + else
1.894 + {
1.895 + iTestStepResult = EInconclusive;
1.896 + ERR_PRINTF1(_L("Failed to retrieve the interface."));
1.897 + }
1.898 +
1.899 + return iTestStepResult;
1.900 + }
1.901 +
1.902 +/*****************************************************************************/
1.903 +CTestStepCISbcEncoderApplyConfig::CTestStepCISbcEncoderApplyConfig()
1.904 + {
1.905 + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0033-HP");
1.906 + }
1.907 +
1.908 +TVerdict CTestStepCISbcEncoderApplyConfig::DoTestStepL()
1.909 + {
1.910 + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device"));
1.911 +
1.912 + //Initialize - with the UID of our test HwDevice and try to get the interface
1.913 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.914 + TUid testUID = {KUidSbcEncoderTestDevice};
1.915 + #else
1.916 + TFourCC testUID('T','0','0','3');
1.917 + #endif
1.918 +
1.919 + MSbcEncoderIntfc* interface = NULL;
1.920 + interface = static_cast<MSbcEncoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc));
1.921 + if (interface)
1.922 + {
1.923 + INFO_PRINTF1(_L("Applying the config to the SBC Encoder"));
1.924 + TInt err = interface->ApplyConfig();
1.925 + if (err == KErrNone)
1.926 + {
1.927 + iTestStepResult = EPass;
1.928 + INFO_PRINTF1(_L("Successfully applied the config."));
1.929 + }
1.930 + else
1.931 + {
1.932 + iTestStepResult = EFail;
1.933 + ERR_PRINTF2(_L("Failed to apply the config, error: %d"), err);
1.934 + }
1.935 + }
1.936 + else
1.937 + {
1.938 + iTestStepResult = EInconclusive;
1.939 + ERR_PRINTF1(_L("Failed to retrieve the interface."));
1.940 + }
1.941 + return iTestStepResult;
1.942 + }