sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include "teststepcig711encoderconfig.h" sl@0: sl@0: sl@0: TVerdict CTestStepCIG711EncoderConfig::DoTestStepL() sl@0: { sl@0: iTestStepResult = ETestSuiteError; sl@0: sl@0: INFO_PRINTF1(_L("Initializing test CI device")); sl@0: sl@0: if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0045-HP")) == 0) sl@0: { sl@0: iTestStepResult = DoTestStep0045L(); sl@0: } sl@0: else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0046-HP")) == 0) sl@0: { sl@0: iTestStepResult = DoTestStep0046L(); sl@0: } sl@0: else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0047-HP")) == 0) sl@0: { sl@0: iTestStepResult = DoTestStep0047L(); sl@0: } sl@0: else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0048-HP")) == 0) sl@0: { sl@0: iTestStepResult = DoTestStep0048L(); sl@0: } sl@0: sl@0: return iTestStepResult; sl@0: } sl@0: sl@0: sl@0: TVerdict CTestStepCIG711EncoderConfig::DoTestStep0045L() sl@0: { sl@0: iTestStepResult = EFail; sl@0: sl@0: INFO_PRINTF1(_L("G711EncoderIntfc - Instantiating")); sl@0: sl@0: //Initialize - with the UID of our test HwDevice sl@0: #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND sl@0: TUid testUID = {KUidG711EncoderConfigTestDevice}; sl@0: #else sl@0: TFourCC testUID('T','0','1','6'); sl@0: #endif sl@0: sl@0: iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); sl@0: sl@0: if (iTestStepResult != EPass) sl@0: { sl@0: INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // reset the value as previous test is pass sl@0: iTestStepResult = EFail; sl@0: sl@0: // KUidG711EncoderIntfc sl@0: MG711EncoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc)); sl@0: sl@0: if (ptr) sl@0: { sl@0: INFO_PRINTF1(_L("MG711EncoderIntfc instantiated successfully")); sl@0: sl@0: iTestStepResult = EPass; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF1(_L("MG711EncoderIntfc failed to retrieve the interface")); sl@0: } sl@0: sl@0: return iTestStepResult; sl@0: } sl@0: sl@0: sl@0: TVerdict CTestStepCIG711EncoderConfig::DoTestStep0046L() sl@0: { sl@0: iTestStepResult = EFail; sl@0: TInt result = KErrGeneral; sl@0: sl@0: INFO_PRINTF1(_L("G711EncoderIntfc - SetEncoderMode")); sl@0: sl@0: //Initialize - with the UID of our test HwDevice sl@0: #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND sl@0: TUid testUID = {KUidG711EncoderConfigTestDevice}; sl@0: #else sl@0: TFourCC testUID('T','0','1','6'); sl@0: #endif sl@0: sl@0: iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); sl@0: sl@0: if (iTestStepResult != EPass) sl@0: { sl@0: INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // reset the value as previous test is pass sl@0: iTestStepResult = EFail; sl@0: sl@0: // KUidG711EncoderIntfc sl@0: MG711EncoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc)); sl@0: sl@0: if (ptr) sl@0: { sl@0: MG711EncoderIntfc::TEncodeMode encodeMode = MG711EncoderIntfc::EEncULaw; sl@0: TInt setEncodeMode = MG711EncoderIntfc::EEncALaw; sl@0: sl@0: result = ptr->SetEncoderMode(encodeMode) ; // call method sl@0: sl@0: if (result == KErrNone) sl@0: { sl@0: // This file is created by the test stub, the plugin device sl@0: _LIT(KFileName, "c:\\temp\\g711EncoderConfig.txt"); sl@0: sl@0: ReadFileL(KFileName, setEncodeMode); sl@0: sl@0: if (static_cast(setEncodeMode) == encodeMode) sl@0: { sl@0: INFO_PRINTF1(_L("MG711EncoderIntfc::SetEncoderMode finished successfully")); sl@0: sl@0: iTestStepResult = EPass; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MIlbcEncoderIntfc::SetEncoderMode failed with encodeMode %d"), encodeMode); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MG711DecoderIntfc::SetEncoderMode failed with error %d"), result); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface")); sl@0: iTestStepResult = EInconclusive; sl@0: } sl@0: sl@0: return iTestStepResult; sl@0: } sl@0: sl@0: sl@0: TVerdict CTestStepCIG711EncoderConfig::DoTestStep0047L() sl@0: { sl@0: iTestStepResult = EFail; sl@0: TInt result = KErrGeneral; sl@0: sl@0: INFO_PRINTF1(_L("G711EncoderIntfc - SetVadMode")); sl@0: sl@0: //Initialize - with the UID of our test HwDevice sl@0: #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND sl@0: TUid testUID = {KUidG711EncoderConfigTestDevice}; sl@0: #else sl@0: TFourCC testUID('T','0','1','6'); sl@0: #endif sl@0: sl@0: iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); sl@0: sl@0: if (iTestStepResult != EPass) sl@0: { sl@0: INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // reset the value as previous test is pass sl@0: iTestStepResult = EFail; sl@0: sl@0: // KUidG711EncoderIntfc sl@0: MG711EncoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc)); sl@0: sl@0: if (ptr) sl@0: { sl@0: TBool vadModeOn = EFalse; sl@0: sl@0: result = ptr->SetVadMode(ETrue); // call method sl@0: sl@0: if (result == KErrNone) sl@0: { sl@0: INFO_PRINTF1(_L("MG711EncoderIntfc::SetVadMode finished successfully")); sl@0: sl@0: result = ptr->GetVadMode(vadModeOn); sl@0: sl@0: if ( (result == KErrNone) && vadModeOn) sl@0: { sl@0: INFO_PRINTF1(_L("MG711EncoderIntfc::GetVadMode finished successfully")); sl@0: sl@0: iTestStepResult = EPass; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF3(_L("MG711EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MG711DecoderIntfc::SetVadMode failed with error %d"), result); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("MG711EncoderIntfc failed to retrieve the interface")); sl@0: iTestStepResult = EInconclusive; sl@0: } sl@0: sl@0: return iTestStepResult; sl@0: } sl@0: sl@0: sl@0: TVerdict CTestStepCIG711EncoderConfig::DoTestStep0048L() sl@0: { sl@0: iTestStepResult = EFail; sl@0: TInt result = KErrGeneral; sl@0: sl@0: INFO_PRINTF1(_L("G711EncoderIntfc - GetVadMode")); sl@0: sl@0: //Initialize - with the UID of our test HwDevice sl@0: #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND sl@0: TUid testUID = {KUidG711EncoderConfigTestDevice}; sl@0: #else sl@0: TFourCC testUID('T','0','1','6'); sl@0: #endif sl@0: sl@0: iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); sl@0: sl@0: if (iTestStepResult != EPass) sl@0: { sl@0: INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); sl@0: return EInconclusive; sl@0: } sl@0: sl@0: // reset the value as previous test is pass sl@0: iTestStepResult = EFail; sl@0: sl@0: // KUidG711EncoderIntfc sl@0: MG711EncoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc)); sl@0: sl@0: if (ptr) sl@0: { sl@0: TBool vadModeOn = EFalse; sl@0: sl@0: result = ptr->SetVadMode(ETrue); // call method sl@0: sl@0: if (result == KErrNone) sl@0: { sl@0: INFO_PRINTF1(_L("MG711EncoderIntfc::SetVadMode finished successfully")); sl@0: sl@0: result = ptr->GetVadMode(vadModeOn); sl@0: sl@0: if ( (result == KErrNone) && vadModeOn) sl@0: { sl@0: INFO_PRINTF1(_L("MG711EncoderIntfc::GetVadMode finished successfully")); sl@0: sl@0: result = ptr->SetVadMode(EFalse); sl@0: sl@0: if (result == KErrNone) sl@0: { sl@0: INFO_PRINTF1(_L("MG711EncoderIntfc::SetVadMode finished successfully")); sl@0: sl@0: result = ptr->GetVadMode(vadModeOn); sl@0: sl@0: if ( (result == KErrNone) && !vadModeOn) sl@0: { sl@0: INFO_PRINTF1(_L("MG711EncoderIntfc::GetVadMode finished successfully")); sl@0: sl@0: iTestStepResult = EPass; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF3(_L("MG711EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MG711EncoderIntfc::SetVadMode failed with result %d"), result); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF3(_L("MG711EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("MG711EncoderIntfc::SetVadMode failed with result %d"), result); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("MG711EncoderIntfc failed to retrieve the interface")); sl@0: iTestStepResult = EInconclusive; sl@0: } sl@0: sl@0: return iTestStepResult; sl@0: }