telephonyserverplugins/simtsy/test/Te_Sim/Te_SimMiscTest.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2005-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 "Te_SimMiscTest.h"
       
    17 
       
    18 #define KSimTsyVersionTestOffset	30
       
    19 _LIT8(KConfigScAuthAUTN, "AUTN_IN");
       
    20 _LIT8(KConfigScAuthRAND, "RAND_IN");
       
    21 
       
    22 CSimMiscTest::CSimMiscTest() 
       
    23 	{ 
       
    24 	SetTestStepName(_L("MiscTest"));
       
    25 	}
       
    26 
       
    27 TVerdict CSimMiscTest::doTestStepL()
       
    28 	{
       
    29 	INFO_PRINTF1(_L("Misc Functionality"));
       
    30 
       
    31  	CreateConfigFileL(_L("c:\\config3.txt"));
       
    32  	SetTestNumberL(0);
       
    33 
       
    34 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
    35 	INFO_PRINTF2(_L("Result: %d"),ret); 
       
    36 	TESTL(ret == KErrNone); 
       
    37 	INFO_PRINTF1(_L("Opened phone object"));
       
    38 	
       
    39 	TBool result;
       
    40 	TBuf<10> tsyName;
       
    41 	tsyName = KSimtsyName;
       
    42 	INFO_PRINTF1(_L("Tesing Is Supported functionality"));
       
    43 	for (TInt mixin=KETelExtMultimodeV1; mixin<=KETelFuncMobileUserSignalling;mixin++)
       
    44 		{	
       
    45 		iTelServer.IsSupportedByModule(tsyName, mixin, result);
       
    46 		if (mixin== KETelExtMultimodeV1
       
    47 			|| mixin==KETelFuncMobileNetwork
       
    48 			|| mixin==KETelFuncMobilePower
       
    49 			|| mixin==KETelFuncMobileSignal
       
    50 			|| mixin==KETelFuncMobileIndicator
       
    51 			|| mixin==KETelFuncMobileDTMF
       
    52 			|| mixin==KETelFuncMobileDataCall
       
    53 			|| mixin==KETelFuncMobileEmergencyCall
       
    54 			|| mixin==KETelFuncMobileSmsMessaging
       
    55 			|| mixin==KETelFuncMobilePhonebook
       
    56 			|| mixin==KETelFuncMobileSmsStore
       
    57 			|| mixin==KETelFuncMobileOwnNumberStore
       
    58 			|| mixin==KETelExtPcktV1
       
    59 			|| mixin==RMobileCall::KETelMobileDataCallParamsV1
       
    60 			|| mixin==RMobileCall::KETel3rdPartyCallParamsV1			
       
    61 			)
       
    62 				TESTL(result!=EFalse);
       
    63 		else 
       
    64 				TESTL(result==EFalse);
       
    65 		
       
    66 		}
       
    67 	
       
    68 	iTelServer.IsSupportedByModule(tsyName, KEtelExtMultimodeV9, result);
       
    69 	TESTL(result!=EFalse);
       
    70 	iTelServer.IsSupportedByModule(tsyName, KEtelFuncCellInfo, result);
       
    71 	TESTL(result!=EFalse);
       
    72 
       
    73 	iPhone.Close();
       
    74 	ASSERT(RThread().RequestCount()==0);
       
    75 
       
    76 	return TestStepResult();
       
    77 	}
       
    78 
       
    79 //------------------------------------------------------------------
       
    80 
       
    81 CSetVersion::CSetVersion()
       
    82 /** Each test step initialises it's own name
       
    83 */
       
    84 	{
       
    85 	// store the name of this test case
       
    86 	// this is the name that is used by the script file
       
    87 	SetTestStepName(_L("SetVersion"));
       
    88 	}
       
    89 //------------------------------------------------------------------
       
    90 
       
    91 TVerdict CSetVersion::doTestStepL( void )
       
    92 	{
       
    93     INFO_PRINTF1(_L("Testing the simulated version."));
       
    94 
       
    95 	CreateConfigFileL(_L("c:\\config3.txt"));
       
    96 
       
    97 	for(TInt version = 1; version<=6; version++)
       
    98 		{
       
    99 		SetTestNumberL(version + KSimTsyVersionTestOffset);
       
   100 		TestVersion(version);
       
   101 		}
       
   102 	
       
   103 	return TestStepResult();
       
   104 	}
       
   105 
       
   106 void CSetVersion::TestVersion(TInt aVersion)
       
   107 	{
       
   108 	// Closing and re-opening the phone (to refresh the version setting)
       
   109  	iPhone.Close();
       
   110 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
   111 	TESTL(ret == KErrNone); 
       
   112 	INFO_PRINTF1(_L("Opened phone object"));
       
   113 
       
   114 	TRequestStatus stat0;
       
   115 
       
   116 	// Testing a V1 data structure.
       
   117 	TUint32 capabilities;
       
   118 	RMobilePhone::TMobilePhoneBatteryInfoV1 battery;
       
   119 	INFO_PRINTF1(_L("Testing a V1 data structure."));
       
   120 	ret = iPhone.GetBatteryCaps(capabilities);
       
   121 	TESTL(ret==KErrNone); // must always pass - there is no version number lower than 1;
       
   122 
       
   123 	// Testing a V2 data structure.
       
   124  	RMobilePhone::TUSimApplicationInfoV2 usimAppInfo;
       
   125 	RMobilePhone::TUSimApplicationInfoV2Pckg usimAppInfoPckg(usimAppInfo);
       
   126 	INFO_PRINTF1(_L("Testing a V2 data structure."));
       
   127 	iPhone.GetUSimApplicationInfo(stat0, 0, usimAppInfoPckg);
       
   128   	User::WaitForRequest(stat0);
       
   129 	if(aVersion >=2)
       
   130 		{
       
   131 		TESTL(stat0==KErrNone);
       
   132 		}
       
   133 	else
       
   134 		{
       
   135 		TESTL(stat0==KErrNotSupported);
       
   136 		}
       
   137   	
       
   138   	
       
   139  	// Testing a V3 data structure.
       
   140  	RMobilePhone::TMobilePhoneNetworkNameV3 networkname;
       
   141 	RMobilePhone::TMobilePhoneNetworkNameV3Pckg networknamePckg(networkname);
       
   142 	RMobilePhone::TMobilePhoneOPlmnV3 locInfo;
       
   143 	RMobilePhone::TMobilePhoneOPlmnV3Pckg locInfoPckg(locInfo);
       
   144 	INFO_PRINTF1(_L("Testing a V3 data structure."));
       
   145 	iPhone.GetCurrentNetworkName(stat0, networknamePckg, locInfoPckg);
       
   146 	User::WaitForRequest(stat0);
       
   147 	if(aVersion >=3)
       
   148 		{
       
   149 		TESTL(stat0==KErrNone);
       
   150 		}
       
   151 	else
       
   152 		{
       
   153 		TESTL(stat0==KErrNotSupported);
       
   154 		}
       
   155   	
       
   156  	// Testing a V5 data structure.
       
   157  	RMobilePhone::TSmartCardApplicationInfoV5 smartCardAppInfo;
       
   158 	RMobilePhone::TSmartCardApplicationInfoV5Pckg smartCardAppInfoPckg(smartCardAppInfo);
       
   159 	INFO_PRINTF1(_L("Testing a V5 data structure."));
       
   160 	iPhone.GetSmartCardApplicationInfo(stat0, 0, smartCardAppInfoPckg);
       
   161 	User::WaitForRequest(stat0);
       
   162 	if(aVersion >=5)
       
   163 		{
       
   164 		TESTL(stat0==KErrNone);
       
   165 		}
       
   166 	else
       
   167 		{
       
   168 		TESTL(stat0==KErrNotSupported);
       
   169 		}
       
   170 
       
   171  	// Testing a V6 data structure.
       
   172 	RMobilePhone::TSmartCardAuthenticateDataV6 authenticateData;
       
   173 	RMobilePhone::TSmartCardAuthenticateDataV6Pckg authenticateDataPckg(authenticateData);
       
   174 	authenticateData.iAUTN = KConfigScAuthAUTN();
       
   175 	authenticateData.iRAND = KConfigScAuthRAND();
       
   176 	INFO_PRINTF1(_L("Testing a V6 data structure."));
       
   177 	iPhone.SmartCardAuthenticate(stat0, authenticateDataPckg);
       
   178 	User::WaitForRequest(stat0);
       
   179 	if(aVersion >=6)
       
   180 		{
       
   181 		TESTL(stat0==KErrNone);
       
   182 		}
       
   183 	else
       
   184 		{
       
   185 		TESTL(stat0==KErrNotSupported);
       
   186 		}
       
   187 
       
   188 	
       
   189 	iPhone.Close();
       
   190 	}
       
   191 	
       
   192 //------------------------------------------------------------------
       
   193 
       
   194 CCheckVersionSupport::CCheckVersionSupport()
       
   195 /** Each test step initialises it's own name
       
   196 */
       
   197 	{
       
   198 	// store the name of this test case
       
   199 	// this is the name hat is used by the script file
       
   200 	SetTestStepName(_L("CCheckVersionSupport"));
       
   201 	}
       
   202 //------------------------------------------------------------------
       
   203 
       
   204 TVerdict CCheckVersionSupport::doTestStepL( void )
       
   205 	{
       
   206     INFO_PRINTF1(_L("Testing the support of the simulated version."));
       
   207 
       
   208 	CreateConfigFileL(_L("c:\\config3.txt"));
       
   209 
       
   210 	for(TInt version = 1; version<=6; version++)
       
   211 		{
       
   212 		SetTestNumberL(version + KSimTsyVersionTestOffset);
       
   213 		TestVersionSupport(version);
       
   214 		}
       
   215 
       
   216 	return TestStepResult();
       
   217 	}
       
   218 	
       
   219 	
       
   220 void CCheckVersionSupport::TestVersionSupport(TInt aSimTsyVersion)
       
   221 	{
       
   222 	TInt mmBaseClassVersion = KETelExtMultimodeV1;
       
   223 	TBool isVer;
       
   224 
       
   225 	const TInt mmVersion[7] = 
       
   226 		{
       
   227 		0,
       
   228 		KETelExtMultimodeV1,
       
   229 		KETelExtMultimodeV2,
       
   230 		KETelExtMultimodeV3,
       
   231 		KETelExtMultimodeV4,
       
   232 		KEtelExtMultimodeV5,
       
   233 		KEtelExtMultimodeV6
       
   234 		};
       
   235 	
       
   236 	// Closing and re-opening the phone (to refresh the version setting)
       
   237  	iPhone.Close();
       
   238 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
   239 	TESTL(ret == KErrNone); 
       
   240 	INFO_PRINTF1(_L("Opened phone object"));
       
   241 
       
   242 	for(TInt version = 1; version<=6; version++)
       
   243 		{
       
   244 		// setting the version to check
       
   245 		mmBaseClassVersion = mmVersion[version];
       
   246 		
       
   247 		// checking support
       
   248 		INFO_PRINTF2(_L("Testing KETelExtMultimodeV%d."), version);
       
   249 		iTelServer.IsSupportedByModule(KSimtsyName,mmBaseClassVersion,isVer);
       
   250 
       
   251 		if(version <= aSimTsyVersion)
       
   252 			{
       
   253 			TEST(isVer);
       
   254 			}
       
   255 		else
       
   256 			{
       
   257 			TEST(!isVer);
       
   258 			}
       
   259 		}
       
   260 		
       
   261 	// close the phone (will be opened again on the next iteration)
       
   262 	iPhone.Close();
       
   263 	}