telephonyserverplugins/multimodetsy/test/Te_LoopBack/Te_LoopBackcshutdown.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-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 // This file implements several shutdown tests for the MM TSY.
       
    15 // See CDataCall.cpp for fully documented test scenario.
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21 */
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <mmretrieve.h>
       
    25 #include "Te_LoopBackcshutdown.h"
       
    26 #include "Te_LoopbackCWrapGetDetNet.h"
       
    27 #include "../../hayes/TSYCONFG.H" // for KInternetAccessPoint
       
    28 
       
    29 //
       
    30 // Test-side class
       
    31 // With the assistance of the base class, this class must start the emulator
       
    32 // and drive the ETel API.
       
    33 //
       
    34 CTestDriveShutdown* CTestDriveShutdown::NewL(const TScriptList aScriptListEntry)
       
    35 	{
       
    36 	CTestDriveShutdown* aA=new(ELeave) CTestDriveShutdown(aScriptListEntry);
       
    37 	CleanupStack::PushL(aA);
       
    38 	aA->ConstructL();
       
    39 	CleanupStack::Pop();
       
    40 	return aA;
       
    41 	}
       
    42 
       
    43 CTestDriveShutdown::CTestDriveShutdown(const TScriptList aScriptListEntry) : iScriptListEntry(aScriptListEntry)
       
    44 	{}
       
    45 
       
    46 TInt CTestDriveShutdown::RunTestL()
       
    47 	{
       
    48 	iCurrentScript=iScriptListEntry;
       
    49 	return StartEmulatorL();
       
    50 	}
       
    51 
       
    52 TInt CTestDriveShutdown::DriveETelApiL()
       
    53 //
       
    54 // This function contains the real meat of the Client-side test code
       
    55 //
       
    56 	{
       
    57 	RMobileSmsMessaging sms;
       
    58 	TRequestStatus stat0,reqStatus;
       
    59 
       
    60 	INFO_PRINTF1(_L("Opening Sms Messaging\n"));
       
    61 	TESTL(sms.Open(iPhone)==KErrNone);
       
    62 	CleanupClosePushL(sms);
       
    63 
       
    64 	RMobilePhone::TMMTableSettings tableSettings;
       
    65 	tableSettings.iLocId=KInternetAccessPoint;
       
    66 	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
       
    67 	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
       
    68 	User::WaitForRequest(reqStatus);
       
    69 	TESTL(reqStatus == KErrNone);
       
    70 
       
    71 	sms.SetReceiveMode (stat0, RMobileSmsMessaging::EReceiveStored);
       
    72 	User::WaitForRequest(stat0);
       
    73 	TESTL(stat0 == KErrNone); 
       
    74 
       
    75 	// which mode - gsm or cdma pdu
       
    76 	RMobileSmsMessaging::TMobileSmsCapsV1 caps;
       
    77 	RMobileSmsMessaging::TMobileSmsCapsV1Pckg capsPkg(caps);
       
    78 	sms.GetCaps (capsPkg);
       
    79 	caps = capsPkg();
       
    80 	if (caps.iSmsMode & RMobileSmsMessaging::KCapsGsmSms)
       
    81 		{
       
    82 		INFO_PRINTF1(_L("Phone supports GSM/WCDMA mode.\n"));
       
    83 		}
       
    84 	/*else if (caps.iSmsMode & RMobileSmsMessaging::KCapsCdmaSms)
       
    85 		{
       
    86 		INFO_PRINTF1(_L("Phone supports CDMA mode.\n"));
       
    87 		}*/
       
    88 	RMobileSmsMessaging::TMobileSmsGsmTpdu pduGsm;
       
    89 	RMobileSmsMessaging::TMobileSmsReceiveAttributesV1 attrib;
       
    90 	RMobileSmsMessaging::TMobileSmsReceiveAttributesV1Pckg attribPkg(attrib);
       
    91 	
       
    92 	sms.ReceiveMessage(stat0, pduGsm, attribPkg);
       
    93 	User::WaitForRequest(stat0);   
       
    94 	TESTL(stat0.Int()==KErrNone);
       
    95 
       
    96 	CleanupStack::PopAndDestroy(&sms);
       
    97 
       
    98 	User::After(2000000L);
       
    99 
       
   100 	return KErrNone;
       
   101 	}
       
   102 
       
   103 //
       
   104 // Emulator-side class
       
   105 // With the assistance of the base class, this class must run the designated script
       
   106 //
       
   107 CTestShutdown* CTestShutdown::NewL(const TScript* aScript)
       
   108 	{
       
   109 	CTestShutdown* aA=new(ELeave) CTestShutdown(aScript);
       
   110 	CleanupStack::PushL(aA);
       
   111 	aA->ConstructL();
       
   112 	CleanupStack::Pop();
       
   113 	return aA;
       
   114 	}
       
   115 
       
   116 CTestShutdown::CTestShutdown(const TScript* aScript) : iScript(aScript)
       
   117 	{}
       
   118 
       
   119 void CTestShutdown::ConstructL()
       
   120 	{
       
   121 	CATScriptEng::ConstructL();
       
   122 	}
       
   123 
       
   124 TInt CTestShutdown::Start()
       
   125 	{
       
   126 	StartScript(iScript);
       
   127 	return KErrNone;
       
   128 	}
       
   129 
       
   130 void CTestShutdown::SpecificAlgorithmL(TInt /* aParam */)
       
   131 	{
       
   132 	}
       
   133 
       
   134 void CTestShutdown::Complete(TInt aError)
       
   135 	{
       
   136 	iReturnValue=aError;
       
   137 	CActiveScheduler::Stop();
       
   138 	}
       
   139 
       
   140 //
       
   141 // Test-side class
       
   142 // With the assistance of the base class, this class must start the emulator
       
   143 // and drive the ETel API.
       
   144 //
       
   145 CTestDriveShutdownA* CTestDriveShutdownA::NewL(const TScriptList aScriptListEntry)
       
   146 	{
       
   147 	CTestDriveShutdownA* aA=new(ELeave) CTestDriveShutdownA(aScriptListEntry);
       
   148 	CleanupStack::PushL(aA);
       
   149 	aA->ConstructL();
       
   150 	CleanupStack::Pop();
       
   151 	return aA;
       
   152 	}
       
   153 
       
   154 CTestDriveShutdownA::CTestDriveShutdownA(const TScriptList aScriptListEntry) : iScriptListEntry(aScriptListEntry)
       
   155 	{}
       
   156 
       
   157 TInt CTestDriveShutdownA::RunTestL()
       
   158 	{
       
   159 	iCurrentScript=iScriptListEntry;
       
   160 	return StartEmulatorL();
       
   161 	}
       
   162 
       
   163 TInt CTestDriveShutdownA::DriveETelApiL()
       
   164 //
       
   165 // This function contains the real meat of the Client-side test code
       
   166 //
       
   167 	{
       
   168 	TRequestStatus reqStatus;
       
   169 	RMobileSmsMessaging sms;
       
   170 	INFO_PRINTF1(_L("Opening Sms Messaging\n"));
       
   171 	TESTL(sms.Open(iPhone)==KErrNone);
       
   172 	CleanupClosePushL(sms);
       
   173 
       
   174 	RMobilePhone::TMMTableSettings tableSettings;
       
   175 	tableSettings.iLocId=KInternetAccessPoint;
       
   176 	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
       
   177 	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
       
   178 	User::WaitForRequest(reqStatus);
       
   179 	TESTL(reqStatus == KErrNone);
       
   180 
       
   181 	CWrapperGetDetectedNetworks* pWrapper=NULL;
       
   182 	pWrapper = CWrapperGetDetectedNetworks::NewL(iPhone);
       
   183 	CleanupStack::PushL(pWrapper);
       
   184 
       
   185 	pWrapper->Start();
       
   186 	CActiveScheduler::Start();
       
   187 
       
   188 	User::After(1000000L);
       
   189 
       
   190 	pWrapper->Cancel();
       
   191 	CleanupStack::PopAndDestroy(pWrapper);
       
   192 
       
   193 	iPhone.Close();
       
   194 
       
   195 	CleanupStack::PopAndDestroy(&sms);
       
   196 
       
   197 	User::After(2000000L);
       
   198 
       
   199 	iPhone.Open(iServer,PHONE_NAME);
       
   200 
       
   201 	return KErrNone;
       
   202 	}