os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcigsmconfig.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
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 "teststepcigsmconfig.h"
sl@0
    17
sl@0
    18
sl@0
    19
TVerdict CTestStepCIGsmConfig::DoTestStepL()
sl@0
    20
	{
sl@0
    21
	iTestStepResult = ETestSuiteError;
sl@0
    22
sl@0
    23
	INFO_PRINTF1(_L("Initializing test CI device"));
sl@0
    24
sl@0
    25
	if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0088-HP")) == 0)
sl@0
    26
		{
sl@0
    27
		iTestStepResult = DoTestStep0088L();
sl@0
    28
		}
sl@0
    29
	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0089-HP")) == 0)
sl@0
    30
		{
sl@0
    31
		iTestStepResult = DoTestStep0089L();
sl@0
    32
		}
sl@0
    33
	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0090-HP")) == 0)
sl@0
    34
		{
sl@0
    35
		iTestStepResult = DoTestStep0090L();
sl@0
    36
		}
sl@0
    37
sl@0
    38
	return iTestStepResult;
sl@0
    39
	}
sl@0
    40
sl@0
    41
sl@0
    42
TVerdict CTestStepCIGsmConfig::DoTestStep0088L()
sl@0
    43
	{
sl@0
    44
	iTestStepResult = EFail;
sl@0
    45
sl@0
    46
	INFO_PRINTF1(_L("GsmConfig - Instantiating"));
sl@0
    47
sl@0
    48
	//Initialize - with the UID of our test HwDevice
sl@0
    49
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
    50
	TUid testUID = {KUidGsmConfigTestDevice};
sl@0
    51
	#else
sl@0
    52
	TFourCC testUID('T','0','2','0');
sl@0
    53
	#endif
sl@0
    54
		
sl@0
    55
	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
sl@0
    56
sl@0
    57
	if (iTestStepResult != EPass)
sl@0
    58
		{
sl@0
    59
		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
sl@0
    60
		return EInconclusive;
sl@0
    61
		}
sl@0
    62
sl@0
    63
	// reset the value as previous test is pass
sl@0
    64
	iTestStepResult = EFail;  
sl@0
    65
sl@0
    66
	// KUidGsmConfig
sl@0
    67
	MMMFGsmConfig* ptr = static_cast <MMMFGsmConfig*> (iMMFDevSound->CustomInterface(KUidGsmConfig));
sl@0
    68
sl@0
    69
	if (ptr)
sl@0
    70
		{
sl@0
    71
		INFO_PRINTF1(_L("MMMFGsmConfig instantiated successfully"));
sl@0
    72
sl@0
    73
		iTestStepResult = EPass;
sl@0
    74
		}
sl@0
    75
	else
sl@0
    76
		{
sl@0
    77
		ERR_PRINTF1(_L("MMMFGsmConfig failed to retrieve the interface"));
sl@0
    78
		}
sl@0
    79
sl@0
    80
	return iTestStepResult;
sl@0
    81
	}
sl@0
    82
sl@0
    83
sl@0
    84
TVerdict CTestStepCIGsmConfig::DoTestStep0089L()
sl@0
    85
	{
sl@0
    86
	iTestStepResult = EFail;
sl@0
    87
	TInt result = KErrGeneral;
sl@0
    88
sl@0
    89
	INFO_PRINTF1(_L("GsmConfig - SetConversionFormat"));
sl@0
    90
sl@0
    91
	//Initialize - with the UID of our test HwDevice
sl@0
    92
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
    93
	TUid testUID = {KUidGsmConfigTestDevice};
sl@0
    94
	#else
sl@0
    95
	TFourCC testUID('T','0','2','0');
sl@0
    96
	#endif
sl@0
    97
	
sl@0
    98
	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
sl@0
    99
sl@0
   100
	if (iTestStepResult != EPass)
sl@0
   101
		{
sl@0
   102
		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
sl@0
   103
		return EInconclusive;
sl@0
   104
		}
sl@0
   105
sl@0
   106
	// reset the value as previous test is pass
sl@0
   107
	iTestStepResult = EFail;
sl@0
   108
sl@0
   109
	// KUidGsmConfig
sl@0
   110
	MMMFGsmConfig* ptr = static_cast <MMMFGsmConfig*> (iMMFDevSound->CustomInterface(KUidGsmConfig));
sl@0
   111
sl@0
   112
	if (ptr)
sl@0
   113
		{
sl@0
   114
		result = ptr->SetConversionFormat(MMMFGsmConfig::ENone); // call method
sl@0
   115
		
sl@0
   116
		if (result == KErrNone)
sl@0
   117
			{
sl@0
   118
			INFO_PRINTF1(_L("MMMFGsmConfig::SetConversionFormat finished successfully"));
sl@0
   119
sl@0
   120
			iTestStepResult = EPass;
sl@0
   121
			}
sl@0
   122
		else
sl@0
   123
			{
sl@0
   124
			ERR_PRINTF2(_L("MMMFGsmConfig::SetConversionFormat failed with error %d"), result);
sl@0
   125
			}
sl@0
   126
		}
sl@0
   127
	else
sl@0
   128
		{
sl@0
   129
		INFO_PRINTF1(_L("MMMFGsmConfig failed to retrieve the interface"));
sl@0
   130
		iTestStepResult = EInconclusive;
sl@0
   131
		}
sl@0
   132
sl@0
   133
	return iTestStepResult;
sl@0
   134
	}
sl@0
   135
sl@0
   136
sl@0
   137
TVerdict CTestStepCIGsmConfig::DoTestStep0090L()
sl@0
   138
	{
sl@0
   139
	iTestStepResult = EFail;
sl@0
   140
	TInt result = KErrGeneral;
sl@0
   141
sl@0
   142
	INFO_PRINTF1(_L("GsmConfig - ConversionFormat"));
sl@0
   143
sl@0
   144
	//Initialize - with the UID of our test HwDevice
sl@0
   145
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
   146
	TUid testUID = {KUidGsmConfigTestDevice};
sl@0
   147
	#else
sl@0
   148
	TFourCC testUID('T','0','2','0');
sl@0
   149
	#endif
sl@0
   150
	
sl@0
   151
	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
sl@0
   152
sl@0
   153
	if (iTestStepResult != EPass)
sl@0
   154
		{
sl@0
   155
		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
sl@0
   156
		return EInconclusive;
sl@0
   157
		}
sl@0
   158
sl@0
   159
	// reset the value as previous test is pass
sl@0
   160
	iTestStepResult = EFail;
sl@0
   161
sl@0
   162
	// KUidGsmConfig
sl@0
   163
	MMMFGsmConfig* ptr = static_cast <MMMFGsmConfig*> (iMMFDevSound->CustomInterface(KUidGsmConfig));
sl@0
   164
		
sl@0
   165
	if (ptr)
sl@0
   166
		{
sl@0
   167
		MMMFGsmConfig::TMMFGsmConversionFormat convFormat = MMMFGsmConfig::ENone;
sl@0
   168
sl@0
   169
		result = ptr->SetConversionFormat(MMMFGsmConfig::EAlawPCM); // call method
sl@0
   170
		
sl@0
   171
		if (result == KErrNone)
sl@0
   172
			{
sl@0
   173
			INFO_PRINTF1(_L("MMMFGsmConfig::SetConversionFormat finished successfully"));
sl@0
   174
sl@0
   175
			result = ptr->ConversionFormat(convFormat);
sl@0
   176
			
sl@0
   177
			if ( (result == KErrNone) && (MMMFGsmConfig::EAlawPCM == convFormat) )
sl@0
   178
				{
sl@0
   179
				INFO_PRINTF1(_L("MMMFGsmConfig::ConversionFormat finished successfully"));
sl@0
   180
sl@0
   181
				iTestStepResult = EPass;
sl@0
   182
				}
sl@0
   183
			else
sl@0
   184
				{
sl@0
   185
				ERR_PRINTF3(_L("MMMFGsmConfig::SetConversionFormat failed with result %d  convFormat"), result, convFormat);
sl@0
   186
				}
sl@0
   187
			}
sl@0
   188
		else
sl@0
   189
			{
sl@0
   190
			ERR_PRINTF2(_L("MMMFGsmConfig::SetConversionFormat failed with error %d"), result);
sl@0
   191
			}
sl@0
   192
		}
sl@0
   193
	else
sl@0
   194
		{
sl@0
   195
		INFO_PRINTF1(_L("MMMFGsmConfig failed to retrieve the interface"));
sl@0
   196
		iTestStepResult = EInconclusive;
sl@0
   197
		}
sl@0
   198
sl@0
   199
	return iTestStepResult;
sl@0
   200
	}