os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcig711encoderconfig.cpp
Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "teststepcig711encoderconfig.h"
19 TVerdict CTestStepCIG711EncoderConfig::DoTestStepL()
21 iTestStepResult = ETestSuiteError;
23 INFO_PRINTF1(_L("Initializing test CI device"));
25 if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0045-HP")) == 0)
27 iTestStepResult = DoTestStep0045L();
29 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0046-HP")) == 0)
31 iTestStepResult = DoTestStep0046L();
33 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0047-HP")) == 0)
35 iTestStepResult = DoTestStep0047L();
37 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0048-HP")) == 0)
39 iTestStepResult = DoTestStep0048L();
42 return iTestStepResult;
46 TVerdict CTestStepCIG711EncoderConfig::DoTestStep0045L()
48 iTestStepResult = EFail;
50 INFO_PRINTF1(_L("G711EncoderIntfc - Instantiating"));
52 //Initialize - with the UID of our test HwDevice
53 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
54 TUid testUID = {KUidG711EncoderConfigTestDevice};
56 TFourCC testUID('T','0','1','6');
59 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
61 if (iTestStepResult != EPass)
63 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
67 // reset the value as previous test is pass
68 iTestStepResult = EFail;
70 // KUidG711EncoderIntfc
71 MG711EncoderIntfc* ptr = static_cast <MG711EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc));
75 INFO_PRINTF1(_L("MG711EncoderIntfc instantiated successfully"));
77 iTestStepResult = EPass;
81 ERR_PRINTF1(_L("MG711EncoderIntfc failed to retrieve the interface"));
84 return iTestStepResult;
88 TVerdict CTestStepCIG711EncoderConfig::DoTestStep0046L()
90 iTestStepResult = EFail;
91 TInt result = KErrGeneral;
93 INFO_PRINTF1(_L("G711EncoderIntfc - SetEncoderMode"));
95 //Initialize - with the UID of our test HwDevice
96 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
97 TUid testUID = {KUidG711EncoderConfigTestDevice};
99 TFourCC testUID('T','0','1','6');
102 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
104 if (iTestStepResult != EPass)
106 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
107 return EInconclusive;
110 // reset the value as previous test is pass
111 iTestStepResult = EFail;
113 // KUidG711EncoderIntfc
114 MG711EncoderIntfc* ptr = static_cast <MG711EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc));
118 MG711EncoderIntfc::TEncodeMode encodeMode = MG711EncoderIntfc::EEncULaw;
119 TInt setEncodeMode = MG711EncoderIntfc::EEncALaw;
121 result = ptr->SetEncoderMode(encodeMode) ; // call method
123 if (result == KErrNone)
125 // This file is created by the test stub, the plugin device
126 _LIT(KFileName, "c:\\temp\\g711EncoderConfig.txt");
128 ReadFileL(KFileName, setEncodeMode);
130 if (static_cast<MG711EncoderIntfc::TEncodeMode>(setEncodeMode) == encodeMode)
132 INFO_PRINTF1(_L("MG711EncoderIntfc::SetEncoderMode finished successfully"));
134 iTestStepResult = EPass;
138 ERR_PRINTF2(_L("MIlbcEncoderIntfc::SetEncoderMode failed with encodeMode %d"), encodeMode);
143 ERR_PRINTF2(_L("MG711DecoderIntfc::SetEncoderMode failed with error %d"), result);
148 INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface"));
149 iTestStepResult = EInconclusive;
152 return iTestStepResult;
156 TVerdict CTestStepCIG711EncoderConfig::DoTestStep0047L()
158 iTestStepResult = EFail;
159 TInt result = KErrGeneral;
161 INFO_PRINTF1(_L("G711EncoderIntfc - SetVadMode"));
163 //Initialize - with the UID of our test HwDevice
164 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
165 TUid testUID = {KUidG711EncoderConfigTestDevice};
167 TFourCC testUID('T','0','1','6');
170 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
172 if (iTestStepResult != EPass)
174 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
175 return EInconclusive;
178 // reset the value as previous test is pass
179 iTestStepResult = EFail;
181 // KUidG711EncoderIntfc
182 MG711EncoderIntfc* ptr = static_cast <MG711EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc));
186 TBool vadModeOn = EFalse;
188 result = ptr->SetVadMode(ETrue); // call method
190 if (result == KErrNone)
192 INFO_PRINTF1(_L("MG711EncoderIntfc::SetVadMode finished successfully"));
194 result = ptr->GetVadMode(vadModeOn);
196 if ( (result == KErrNone) && vadModeOn)
198 INFO_PRINTF1(_L("MG711EncoderIntfc::GetVadMode finished successfully"));
200 iTestStepResult = EPass;
204 ERR_PRINTF3(_L("MG711EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn);
209 ERR_PRINTF2(_L("MG711DecoderIntfc::SetVadMode failed with error %d"), result);
214 INFO_PRINTF1(_L("MG711EncoderIntfc failed to retrieve the interface"));
215 iTestStepResult = EInconclusive;
218 return iTestStepResult;
222 TVerdict CTestStepCIG711EncoderConfig::DoTestStep0048L()
224 iTestStepResult = EFail;
225 TInt result = KErrGeneral;
227 INFO_PRINTF1(_L("G711EncoderIntfc - GetVadMode"));
229 //Initialize - with the UID of our test HwDevice
230 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
231 TUid testUID = {KUidG711EncoderConfigTestDevice};
233 TFourCC testUID('T','0','1','6');
236 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
238 if (iTestStepResult != EPass)
240 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
241 return EInconclusive;
244 // reset the value as previous test is pass
245 iTestStepResult = EFail;
247 // KUidG711EncoderIntfc
248 MG711EncoderIntfc* ptr = static_cast <MG711EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc));
252 TBool vadModeOn = EFalse;
254 result = ptr->SetVadMode(ETrue); // call method
256 if (result == KErrNone)
258 INFO_PRINTF1(_L("MG711EncoderIntfc::SetVadMode finished successfully"));
260 result = ptr->GetVadMode(vadModeOn);
262 if ( (result == KErrNone) && vadModeOn)
264 INFO_PRINTF1(_L("MG711EncoderIntfc::GetVadMode finished successfully"));
266 result = ptr->SetVadMode(EFalse);
268 if (result == KErrNone)
270 INFO_PRINTF1(_L("MG711EncoderIntfc::SetVadMode finished successfully"));
272 result = ptr->GetVadMode(vadModeOn);
274 if ( (result == KErrNone) && !vadModeOn)
276 INFO_PRINTF1(_L("MG711EncoderIntfc::GetVadMode finished successfully"));
278 iTestStepResult = EPass;
282 ERR_PRINTF3(_L("MG711EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn);
287 ERR_PRINTF2(_L("MG711EncoderIntfc::SetVadMode failed with result %d"), result);
292 ERR_PRINTF3(_L("MG711EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn);
297 ERR_PRINTF2(_L("MG711EncoderIntfc::SetVadMode failed with result %d"), result);
302 INFO_PRINTF1(_L("MG711EncoderIntfc failed to retrieve the interface"));
303 iTestStepResult = EInconclusive;
306 return iTestStepResult;