TInt CTestDriveSsFax::DriveETelApiL()
//
// This function contains the real meat of the Client-side test code
//
	{
	_LIT(KFaxLineName,"Fax");
	_LIT(KMmPhoneName,"GsmPhone1");

	RMobilePhone mmPhone;
	INFO_PRINTF1(_L("Opening Multimode Phone\n"));
	TESTL(mmPhone.Open(iServer,KMmPhoneName)==KErrNone);

	RLine faxLine;
	INFO_PRINTF1(_L("Opening Fax Line\n"));
	TESTL(faxLine.Open(iPhone,KFaxLineName)==KErrNone);
 	RCall faxCall;
	INFO_PRINTF1(_L("Opening New fax Call\n"));
	TESTL(faxCall.OpenNewCall(faxLine)==KErrNone);

	TRequestStatus stat1,stat2,reqStatus;
	RMobilePhone::TMMTableSettings tableSettings;
	tableSettings.iLocId=KInternetAccessPoint;
	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
	User::WaitForRequest(reqStatus);
	TESTL(reqStatus == KErrNone);

	// Now wait for an incoming fax call...
	INFO_PRINTF1(_L("Answering a Fax Call\n"));
	RCall::TFaxSessionSettings faxSessionSettings;
	faxSessionSettings.iMode=RCall::EReceive;
	faxSessionSettings.iFaxRetrieveType=RCall::EFaxOnDemand;
	faxSessionSettings.iFaxClass=EClassAuto;
	faxSessionSettings.iFaxId.Zero();
	faxSessionSettings.iMaxSpeed=14400;
	faxSessionSettings.iMinSpeed=12000;
	faxSessionSettings.iRxResolution=EFaxNormal;
	faxSessionSettings.iRxCompression=EModifiedHuffman;
	faxCall.SetFaxSettings(faxSessionSettings);
	faxCall.AnswerIncomingCall(stat2);
	User::After(2000000L);					// Wait for a 2secs to make sure the port is "access denied"

	INFO_PRINTF1(_L("Get Signal Strength\n"));
	TInt32 signalStrength;
	TInt8 bar=0;
	mmPhone.GetSignalStrength(stat1,signalStrength,bar);
	User::WaitForRequest(stat1);
	TESTL(stat1==KErrAccessDenied);			// The port is "access denied" by this time

	User::WaitForRequest(stat2);
	User::After(300000L);
	TESTL(faxCall.HangUp()==KErrNone);
	
	mmPhone.Close();
	faxLine.Close();
	faxCall.Close();
	return KErrNone;
	}
enum TVerdict CEtelMMTestAuthenticate::doTestStepL( void )
/**
 * Test step Authenticate
 *
 */
{
   __UHEAP_MARK;
	TInt ret;
	RMobilePhone phone;
	ret=phone.Open(iTelServer,DMMTSY_PHONE_NAMEAUTH1);
	TEST(ret==KErrNone);
	// start sanity test for
	// 2.4	REQ3877 Enable retrieval of the IMS authentication parameters

  	TRequestStatus reqStatus;
  	RMobilePhone::TImsAuthenticateDataV5 authenticateData;
  	authenticateData.iAUTN=DMMTSY_PHONE_AUTN_IN;
	authenticateData.iRAND=DMMTSY_PHONE_RAND_IN;
	authenticateData.iRES=DMMTSY_PHONE_RES_IN;
	authenticateData.iIK=DMMTSY_PHONE_IK_IN;
	authenticateData.iCK=DMMTSY_PHONE_CK_IN;
	authenticateData.iAUTS=DMMTSY_PHONE_AUTS_IN;


  	RMobilePhone::TImsAuthenticateDataV5Pckg authenticateDataPckgd(authenticateData);
  	phone.ImsAuthenticate (reqStatus,authenticateDataPckgd);
  	User::WaitForRequest(reqStatus);
  	TEST(reqStatus==KErrNone);
  	TEST(authenticateData.iAUTN==DMMTSY_PHONE_AUTN_OUT);
	TEST(authenticateData.iRAND==DMMTSY_PHONE_RAND_OUT);	
	TEST(authenticateData.iRES==DMMTSY_PHONE_RES_OUT);
	TEST(authenticateData.iIK==DMMTSY_PHONE_IK_OUT);		
	TEST(authenticateData.iCK==DMMTSY_PHONE_CK_OUT);
	TEST(authenticateData.iAUTS==DMMTSY_PHONE_AUTS_OUT);	
	
	
	authenticateData.iAUTN=DMMTSY_PHONE_AUTN_IN;
	authenticateData.iRAND=DMMTSY_PHONE_RAND_IN;
	
	phone.ImsAuthenticate(reqStatus,authenticateDataPckgd);
	phone.CancelAsyncRequest(EMobilePhoneIMSAuthenticate);
  	User::WaitForRequest(reqStatus);
  	TEST(reqStatus==KErrCancel);
	
			
  	phone.Close();
	// end sanity test for
	// 2.4	REQ3877 Enable retrieval of the IMS authentication parameters
	__UHEAP_MARKEND;

	return TestStepResult();
}
void CLogBatteryImpl::DoCancel()
{
	CALLSTACKITEM_N(_CL("CLogBatteryImpl"), _CL("DoCancel"));

#ifndef __S60V2__
	Phone().BatteryInfoNotificationCancel();
#else
	iPhone.Close();
	if (iStatus.Int()==KRequestPending) {
		TRequestStatus *s=&iStatus;
		User::RequestComplete(s, KErrCancel);
	}
#endif
}
void CEtelMMLbsTestStepBase::OOMTest_DialEmergencyCall()
 {
 	const TInt KMaxTests = 1000;	
 	RMobilePhone mmPhone;
	TInt ret=mmPhone.Open(iTelServer,DMMTSY_PHONE_NAME);
	TEST(ret==KErrNone);
	RMobileLine mmLine;
	ret=mmLine.Open(mmPhone,DMMTSY_LINE_VOICE_NAME);
    TEST(ret==KErrNone);
	RMobileCall mmCall;
	TName callName;
	ret=mmCall.OpenNewCall(mmLine,callName);
    TEST(ret==KErrNone);
	TRequestStatus reqStatus;
	TBuf<RMobileENStore::KEmergencyNumberSize> aNumber(DMMTSY_EN_STORE_AMBULANCE_NUM);

	TBool oomAvailable = EFalse; 
	TInt failure=1;
	while (!oomAvailable  && failure < KMaxTests)
		{
	  	iTelServer.__DbgFailNext(failure);
     	mmCall.DialEmergencyCall(reqStatus, aNumber);
   		User::WaitForRequest(reqStatus);
		INFO_PRINTF2(_L("mmCall.DialEmergencyCall(reqStatus, aNumber);%d "),reqStatus.Int());
		TEST(reqStatus==KErrNone); 
		if(reqStatus!=KErrNone)	
			{
			INFO_PRINTF2(_L("Failing after %d Allocs"),failure); 
			} 
		else 
			{ 
			INFO_PRINTF2(_L("Passing after %d Allocs"),failure); 
			} 

		iTelServer.__DbgFailNextAvailable(oomAvailable); 
		failure++; 
		}
		
	// KMaxTests is used to stop the above while statement looping
	// indefinitely. If KMaxTests is reached then we can guess that something
	// has gone wrong and the test should be failed.
	TESTCHECKCONDITION(failure < KMaxTests);
	
	mmCall.Close();
	mmLine.Close();
	mmPhone.Close();
 }
// -----------------------------------------------------------------------------
// CWimSimFileHandler::OpenCustomApiL
// Open CustomAPI for communication
// -----------------------------------------------------------------------------
//  
void CWimSimFileHandler::OpenCustomApiL()
    {
    _WIMTRACE(_L("WIM | WIMServer | CWimSimFileHandler::OpenCustomApiL | Begin"));
    iEtelServer = new( ELeave ) RTelServer();
    
    RMobilePhone phone;

    // Connect to the Etel server.
    TInt ret = iEtelServer->Connect();
    
    if ( ret != KErrNone )
        {
        _WIMTRACE2(_L("WIM | WIMServer | CWimSimFileHandler::OpenCustomApiL | Connection to etel server failed: %d"), ret);
        User::Leave( ret );
        }

    // Load phone module.
    ret = iEtelServer->LoadPhoneModule( KMmTsyModuleName );
    
    if ( ret != KErrNone )
        {
        _WIMTRACE2(_L("WIM | WIMServer | CWimSimFileHandler::OpenCustomApiL | loading phone module failed: %d"), ret);
        User::Leave( ret );
        }
    
    // Open phone
    ret = phone.Open( *iEtelServer, KMmTsyPhoneName );
         
    if ( ret != KErrNone )
        {
        _WIMTRACE2(_L("WIM | WIMServer | CWimSimFileHandler::OpenCustomApiL | phone.Open failed: %d"), ret);
        User::Leave( ret );
        }
    
    // Open new CustomAPI session for phone
    ret = iCustomApi->Open( phone );

    phone.Close(); // Close phone

    if ( ret != KErrNone )
        {
        _WIMTRACE2(_L("WIM | WIMServer | CWimSimFileHandler::OpenCustomApiL | iCustomApi->Open failed: %d"), ret);
        User::Leave( ret );
        }
    }
Beispiel #6
0
enum TVerdict CTestLine::doTestStepL()
//
// Test Line Functions
//
    {
	iTestCount=1;
	INFO_PRINTF1(_L(""));
	INFO_PRINTF1(_L("Test Mobile Line Functionality"));
//	LOGTEXT(_L8("Test Mobile Line Functionality"));
	
	RMobilePhone mmPhone;
	TInt ret=mmPhone.Open(iTelServer,DMMTSY_PHONE_NAME);
	TEST(ret==KErrNone);

	RMobileLine mmLine;
	ret=mmLine.Open(mmPhone,DMMTSY_LINE_VOICE_NAME);
    TEST(ret==KErrNone);

	// Test for Primary or Auxillary voice line

	// line caps are part of Etel core api but as we have extended them 
	// in etelmm so we test the extension here 
	RLine::TCaps lineCaps = {DMMTSY_MOBILE_LINE_AUX_VOICE};
	lineCaps.iFlags ^= DMMTSY_MOBILE_LINE_AUX_VOICE; // make sure AUX voice bit is clear						

	// Get Caps will set the AUX voice bit 
	TEST(KErrNone==mmLine.GetCaps(lineCaps));

	if(lineCaps.iFlags & DMMTSY_MOBILE_LINE_AUX_VOICE)
		{
		INFO_PRINTF2(_L("Test %d - Line is an auxiliary voice line"), iTestCount) ;
		INFO_PRINTF2(_L("Test %d - Test for Primary or Auxillary voice line - passed"), iTestCount++);
		}
	else
		{
		INFO_PRINTF2(_L("Test %d - Line is a primary voice line"), iTestCount) ;
		INFO_PRINTF2(_L("Test %d - Test for Primary or Auxillary voice line - FAILED"), iTestCount++);
		}

	// Get Line Status
	TRequestStatus reqStatus;

	RMobileCall::TMobileCallStatus lineStatus;
	TEST(KErrNone==mmLine.GetMobileLineStatus(lineStatus));
	TEST(lineStatus==DMMTSY_CALL_STATUS1);
	INFO_PRINTF2(_L("Test %d - RMobileLine::GetMobileLineStatus (sync) passed"), iTestCount++);

	// Notify Change of Line Status
	// asynchronous

	mmLine.NotifyMobileLineStatusChange(reqStatus,lineStatus);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone);
	TEST(lineStatus==DMMTSY_CALL_STATUS2);

	// asynchronous & cancel

	mmLine.NotifyMobileLineStatusChange(reqStatus,lineStatus);
	mmLine.CancelAsyncRequest(EMobileLineNotifyMobileLineStatusChange);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone || reqStatus.Int()==KErrCancel);
	if (reqStatus.Int()==KErrCancel)
		INFO_PRINTF2(_L("Test %d - RMobileLine::NotifyMobileLineStatusChange (async & cancel (Cancelled Request)) passed"), iTestCount++);
	else
		{
		TEST(lineStatus==DMMTSY_CALL_STATUS2);
		INFO_PRINTF2(_L("Test %d - RMobileLine::NotifyMobileLineStatusChange (async & cancel (Request Not Cancelled)) passed"), iTestCount++);
		}

	mmLine.Close();
	mmPhone.Close();
	INFO_PRINTF1(_L(""));

//	INFO_PRINTF2(_L("OK: RMobileLine's MobileLineStatus"));

	return TestStepResult();
	}
TInt CTestDriveRemoteHangupDial::DriveETelApiL()
/**
 * This method contains the real meat of the Client-side "Data Call answer and remote 
 * hang-up closely followed by a dial" test code.  This method sets up to answer a 
 * call and receive a data transfer.  The call is then terminated from the remote end, 
 * and then must quickly respond by dialing the remote end back.  Data is then 
 * transfered and the call is terminated again from the remote end.
 *
 * @return KErrNone.
 */
	{
	_LIT(KMmPhoneName,"GsmPhone1");
	_LIT(KDataLineName,"Data");

	INFO_PRINTF1(_L("Opening Mobile Phone\n"));
	RMobilePhone mmPhone;
	TESTL(mmPhone.Open(iServer,KMmPhoneName)==KErrNone);

	RLine line;
	INFO_PRINTF1(_L("Opening Data Line\n"));
	TESTL(line.Open(iPhone,KDataLineName)==KErrNone);

	INFO_PRINTF1(_L("Opening New Data Call\n"));
	RCall call;
	TESTL(call.OpenNewCall(line)==KErrNone);

	TRequestStatus reqStatus;
	RMobilePhone::TMMTableSettings tableSettings;
	tableSettings.iLocId=KInternetAccessPoint;
	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
	User::WaitForRequest(reqStatus);
	TESTL(reqStatus == KErrNone);
//
// Initialization complete
//

// Now wait for an incoming call...
	INFO_PRINTF1(_L("Wait to Answer incoming Data Call\n"));
	TESTL(call.AnswerIncomingCall()==KErrNone);

	INFO_PRINTF1(_L("Loan Data Call Port to Comm Server\n"));
	RCall::TCommPort commPort;
	TESTL(call.LoanDataPort(commPort)==KErrNone);

	RCommServ cs;
	TESTL(cs.Connect()==KErrNone);

	RComm port;
	TESTL(port.Open(cs,commPort.iPort,ECommShared)==KErrNone);

	// Transfer data
	TRequestStatus stat;
	port.Write(stat,KWriteTestRemoteHangupData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);
    
   //-- a small delay between successive writes to the COM port
    //-- I had to insert it to fix mistiming between script execution and sending AT-commands to modem
    User::After(500000);		

	port.Write(stat,KWriteTestRemoteHangupData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

	// Remote termination of call should have occurred in scripts, 
	// close port and comm server
	port.Close();
	cs.Close();
	INFO_PRINTF1(_L("Reclaim Data Call Port from Comm Server\n"));
	TESTL(call.RecoverDataPort()==KErrNone);

	// Now perform the user specified delay before making outgoing call...
	INFO_PRINTF2(_L("Start the %d sec delay before making outgoing call\n"), iVarDelay);
	User::After( (TTimeIntervalMicroSeconds32)(iVarDelay*1000000L) );
	INFO_PRINTF2(_L("End of the delay before making outgoing call\n"), iVarDelay);

	// Now perform the outgoing call...
	// dial
	_LIT(KDialString,"+1234");
	TESTL(call.Dial(KDialString)==KErrNone);

	INFO_PRINTF1(_L("Loan Data Call Port to Comm Server\n"));
	TESTL(call.LoanDataPort(commPort)==KErrNone);

	TESTL(cs.Connect()==KErrNone);

	TESTL(port.Open(cs,commPort.iPort,ECommShared)==KErrNone);

	// Transfer data
	port.Write(stat,KWriteTestRemoteHangupData2);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

    //-- a small delay between successive writes to the COM port
    //-- I had to insert it to fix mistiming between script execution and sending AT-commands to modem
    User::After(500000);		

	port.Write(stat,KWriteTestRemoteHangupData2);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

	// Remote termination of call should have occurred in scripts, 
	// close port and comm server
	port.Close();
	cs.Close();
	INFO_PRINTF1(_L("Reclaim Data Call Port from Comm Server\n"));
	TESTL(call.RecoverDataPort()==KErrNone);

	TInt32 ss;
	TInt8 bar=0;
	mmPhone.GetSignalStrength(stat,ss,bar);
	User::WaitForRequest(stat);
	TESTL(stat==KErrNone);

	// close iPhone, line and call
	mmPhone.Close();
	line.Close();
	call.Close();
	return KErrNone;
	}
/*
----------------------------------------------------------------------------------------
// CExPolicy_Server
----------------------------------------------------------------------------------------
*/
inline CExPolicy_Server::CExPolicy_Server():
#ifdef __SERIES60_3X__
	CPolicyServer(0,SClientServerPolicy,ESharableSessions)
#else
	CServer(EPriorityNormal)
#endif
{
}

/* 
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
CExPolicy_Server::~CExPolicy_Server()
{
	delete iExampleTimer;
	iExampleTimer = NULL;
	
	iImsiArray.Reset();
	iNumberArray.Reset();
	
	delete iNProtRegister;
	iNProtRegister = NULL;

#ifdef __SERIES60_3X__
	delete iRegReader;
	iRegReader = NULL;
#else
#endif

	if(iFile.SubSessionHandle())
	{
	  	iFile.Write(_L8("Bye,bye"));
	  	iFile.Close();
	}

	iItemsDatabase.Close();
	iFsSession.Close();
}
    
/*
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
*/
CExPolicy_Server* CExPolicy_Server::NewLC()
	{
	CExPolicy_Server* self=new(ELeave) CExPolicy_Server;
	CleanupStack::PushL(self);
	self->ConstructL();
	return self;
	}

/* 
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CExPolicy_Server::ConstructL()
{
	// Lowest priority, so should only run if nothing 
	// else is been done same time.
	// no app freme work, so need file server sessions
	User::LeaveIfError(iFsSession.Connect());
	
/*	_LIT(KRecFilename			,"C:\\NProtSrver.txt");
		
	iFsSession.Delete(KRecFilename);		
	User::LeaveIfError(iFile.Create(iFsSession,KRecFilename,EFileWrite|EFileShareAny));	
*/	
	if(iFile.SubSessionHandle())
	{
		iFile.Write(_L8("Mie Strttaaan ny\n,"));
	}
	
	iNProtRegister = new(ELeave)CNProtRegister(*this);

#ifdef __SERIES60_3X__
	iRegReader = CRegReader::NewL(this);
#else
#endif

	iExampleTimer = CTimeOutTimer::NewL(EPriorityNull, *this);
		
	StartShutDownTimer();// start shutdown first
	StartL(KExapmpleServerName);// then start server
	
	
	
	TFindFile PrivFolder(iFsSession);
	if(KErrNone == PrivFolder.FindByDir(KtxDatabaseName, KNullDesC))// finds the drive
	{		
		iNumberArray.Reset();// first reset the array
		iImsiArray.Reset();// first reset the array

		User::LeaveIfError(iItemsDatabase.Open(iFsSession,PrivFolder.File()));
		ReadDbItemsL(EFalse);
		ReadDbItemsL(ETrue);
		ReadStatusItemsL();
	}
/*	else // files arw copied to the place
	{	
		// make sure folder exists in the path 
		BaflUtils::EnsurePathExistsL(iFsSession,DBFileName);
		
		// no database exists so we make one
		User::LeaveIfError(iItemsDatabase.Create(iFsSession,DBFileName));     
		// and will create the onlt table needed for it
		CreateTableL(iItemsDatabase,EFalse);
		CreateTableL(iItemsDatabase,ETrue);
		
		iScreenStatus = iProtectStatus = EFalse;
		CreateStatusTableL(iItemsDatabase);
	}*/

#ifdef __SERIES60_3X__

#else	
	
	TPlpVariantMachineId id; 
	RMobilePhone::TMobilePhoneSubscriberId ImSiId;
	
	#ifdef __WINS__
		id.Copy(_L("357933001298208"));
		ImSiId.Copy(_L("520011298208"));
	#else	
	
	RMobilePhone MyPhone;
	RTelServer MyTelServer;
	RTelServer::TPhoneInfo phoneInfo;

	if(KErrNone == MyTelServer.Connect())
	{
		if(KErrNone == MyTelServer.GetPhoneInfo(0, phoneInfo))
		{
			if(KErrNone == MyPhone.Open(MyTelServer, phoneInfo.iName))
			{
				TRequestStatus MyStatus;
				MyPhone.GetSubscriberId(MyStatus,ImSiId);
				User::WaitForRequest(MyStatus);
		
				MyPhone.Close();
			}
		}
		
		MyTelServer.Close();
	}
	
	
  	PlpVariant::GetMachineIdL(id);
	
	#endif
	GotValuesL(id,ImSiId);	
#endif
}
TInt CTestDriveSSData::DriveETelApiL()
//
// This function contains the real meat of the Client-side test code
//
	{
	_LIT(KDataLineName,"Data");
	_LIT(KMmPhoneName,"GsmPhone1");

	RMobilePhone mmPhone;
	INFO_PRINTF1(_L("Opening Multimode Phone\n"));
	TESTL(mmPhone.Open(iServer,KMmPhoneName)==KErrNone);

	RLine line;
	INFO_PRINTF1(_L("Opening Data Line\n"));
	TESTL(line.Open(iPhone,KDataLineName)==KErrNone);

	INFO_PRINTF1(_L("Opening New Data Call\n"));
	RSpecialCall call;
	TESTL(call.OpenNewCall(line)==KErrNone);

	TRequestStatus stat,stat1,reqStatus;

	RMobilePhone::TMMTableSettings tableSettings;
	tableSettings.iLocId=KInternetAccessPoint;
	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
	User::WaitForRequest(reqStatus);
	TESTL(reqStatus == KErrNone);

	_LIT(KDialString,"+1234");
	TInt status = call.Dial(KDialString);
	TESTL(status == KErrNone);

	TInt32 signalStrength;
	TInt8 bar = 0;
	mmPhone.GetSignalStrength(stat1,signalStrength,bar);

	RCall::TCommPort commPort;
	TESTL(call.LoanDataPort(commPort)==KErrNone);

	RCommServ cs;
	TESTL(cs.Connect()==KErrNone);

	RComm port;
	TESTL(port.Open(cs,commPort.iPort,ECommShared)==KErrNone);

	port.Write(stat,KDataSsWriteTestData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

    //-- a small delay between successive writes to the COM port
    //-- I had to insert it to fix mistiming between script execution and sending AT-commands to modem
    User::After(500000);		

	port.Write(stat,KDataSsWriteTestData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

	port.Close();
	cs.Close();

	call.RecoverDataPort();

	User::After(500000L);

	User::WaitForRequest(stat1); // Result of GetSignalStrength()
	TESTL(stat1==KErrAccessDenied);

	TESTL(call.HangUp()==KErrNone);

	mmPhone.Close();
	line.Close();
	call.Close();
	return KErrNone;
	}
TInt CTestDriveDataCallRemoteTerm::DriveETelApiL()
/**
 * This method contains the real meat of the Client-side the "Data Call set-up, data 
 * transfer and remote termination" test code.  This method sets up to make a data-call
 * and then transfer data.  After the data transfer, the call is terminated by the remote end.
 *
 * @return KErrNone.
 */
	{
	_LIT(KMmPhoneName,"GsmPhone1");
	_LIT(KDataLineName,"Data");

	INFO_PRINTF1(_L("Opening Mobile Phone\n"));
	RMobilePhone mmPhone;
	TESTL(mmPhone.Open(iServer,KMmPhoneName)==KErrNone);

	RLine line;
	INFO_PRINTF1(_L("Opening Data Line\n"));
	TESTL(line.Open(iPhone,KDataLineName)==KErrNone);

	INFO_PRINTF1(_L("Opening New Data Call\n"));
	RCall call;
	TESTL(call.OpenNewCall(line)==KErrNone);

	TRequestStatus reqStatus;
	RMobilePhone::TMMTableSettings tableSettings;
	tableSettings.iLocId=KInternetAccessPoint;
	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
	User::WaitForRequest(reqStatus);
	TESTL(reqStatus == KErrNone);

	// dial
	_LIT(KDialString,"+1234");
	TESTL(call.Dial(KDialString)==KErrNone);

	INFO_PRINTF1(_L("Loan Data Call Port to Comm Server\n"));
	RCall::TCommPort commPort;
	TESTL(call.LoanDataPort(commPort)==KErrNone);

	RCommServ cs;
	TESTL(cs.Connect()==KErrNone);

	RComm port;
	TESTL(port.Open(cs,commPort.iPort,ECommShared)==KErrNone);

	// Transfer data
	TRequestStatus stat;
	port.Write(stat,KWriteTestRemoteData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

    //-- a small delay between successive writes to the COM port
    //-- I had to insert it to fix mistiming between script execution and sending AT-commands to modem
    User::After(500000);		

	port.Write(stat,KWriteTestRemoteData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

	// Remote termination of call should have occurred in scripts, 
	// close port and comm server
	port.Close();
	cs.Close();
	INFO_PRINTF1(_L("Reclaim Data Call Port from Comm Server\n"));
	TESTL(call.RecoverDataPort()==KErrNone);

	TInt32 ss;
	TInt8 bar=0;
	mmPhone.GetSignalStrength(stat,ss,bar);
	User::WaitForRequest(stat);
	TESTL(stat==KErrNone);

	// close iPhone, line and call
	mmPhone.Close();
	line.Close();
	call.Close();
	return KErrNone;
	}
static inline void PhoneClose(RMobilePhone& aPhone)
	{
	aPhone.Close();
	}
/**
Test Broadcast Messaging Functions
This test step tests performs the following tests:

Test 1 - RMobileBroadcastMessaging::GetCaps (sync)
Test 2 - RMobileBroadcastMessaging::ReceiveMessage (test asynchronous call, then test call and cancel request)
Test 3 - RMobileBroadcastMessaging::ReceiveMessage using V2params (test asynchronous call, then test call and cancel request)
Test 4 - RMobileBroadcastMessaging::ReceiveMessage incorrect buffer size (buffer too big) (async call). Tests fix for INC072923.
Test 5 - RMobileBroadcastMessaging::ReceiveMessage incorrect buffer size (buffer too small) (async call). Tests fix for INC072923.
Test 6 - RMobileBroadcastMessaging::GetFilterSetting (sync)
Test 7 - RMobileBroadcastMessaging::NotifyFilterSettingChange (test asynchronous call, then test call and cancel request)
Test 8 - RMobileBroadcastMessaging::SetFilterSetting (test asynchronous call, then test call and cancel request)
Test 9 - RMobileBroadcastMessaging::GetLanguageFilter (test asynchronous call, then test call and cancel request)
Test 10 - RMobileBroadcastMessaging::SetLanguageFilter (test asynchronous call, then test call and cancel request)
Test 11 - RMobileBroadcastMessaging::NotifyLanguageFilterChange (test asynchronous call, then test call and cancel request)
Test 12 - Test CRetrieveMobilePhoneBroadcastIdList (test asynchronous call, then test call and cancel request)
Test 13 - Test StoreBroadcastIdListL (test asynchronous call, then test call and cancel request)
Test 14 - RMobileBroadcastMessaging::NotifyBroadcastIdListChange (test asynchronous call, then test call and cancel request)

@return The verdict of the test step.
*/
enum TVerdict CTestBroadcastMessaging::doTestStepL()
//
// Test Broadcast Messaging Functions
//
    {
	iTestCount=1;
	INFO_PRINTF1(_L(""));
	INFO_PRINTF1(_L("Test Mobile Broadcast Messaging Functionality"));
//	LOGTEXT(_L8("Test Mobile Broadcast Messaging Functionality"));
	
	RMobilePhone mmPhone;
	TInt ret=mmPhone.Open(iTelServer,DMMTSY_PHONE_NAME);
	TEST(ret==KErrNone);

	RMobileBroadcastMessaging cbsMessaging;
	ret=cbsMessaging.Open(mmPhone);
    TEST(ret==KErrNone);

	TRequestStatus reqStatus;

	// Get Broadcast messaging caps
	RMobileBroadcastMessaging::TMobileBroadcastCapsV1 cbsCaps;
	RMobileBroadcastMessaging::TMobileBroadcastCapsV1Pckg cbsCapsPckg(cbsCaps);

	TEST(cbsMessaging.GetCaps(cbsCapsPckg)==KErrNone);

	TEST(cbsCaps.iModeCaps==DMMTSY_BROADCAST_MESSAGING_MODE_CAPS);
	TEST(cbsCaps.iFilterCaps==DMMTSY_BROADCAST_MESSAGING_FILTER_CAPS);

	INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::GetCaps (sync) passed"), iTestCount++);
//	test.Next(_L("OK: RMobileBroadcastMessaging's Get Broadcast caps"));

	// Receiving broadcast messages
	
	RMobileBroadcastMessaging::TBroadcastPageData msgData;
	RMobileBroadcastMessaging::TMobileBroadcastAttributesV1 msgAtts;
	RMobileBroadcastMessaging::TMobileBroadcastAttributesV1Pckg msgAttsPckg(msgAtts);

	cbsMessaging.ReceiveMessage(reqStatus, msgData, msgAttsPckg);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone);

	TEST(msgAtts.iFormat==DMMTSY_CBS_MESSAGE_PDU_FORMAT);
	TEST(msgAtts.iFlags==DMMTSY_BROADCAST_MESSAGING_ATT_FLAGS);
	TEST(msgData.Compare(DMMTSY_CBS_MESSAGE_PDU) == 0);

	// Test cancel

	cbsMessaging.ReceiveMessage(reqStatus, msgData, msgAttsPckg);
	cbsMessaging.CancelAsyncRequest(EMobileBroadcastMessagingReceiveMessage);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone || reqStatus.Int()==KErrCancel);
	if (reqStatus.Int()==KErrCancel)
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::ReceiveMessage (async & cancel (Cancelled Request)) passed"), iTestCount++);	
	else
		{
		TEST(msgAtts.iFormat==DMMTSY_CBS_MESSAGE_PDU_FORMAT);
		TEST(msgAtts.iFlags==DMMTSY_BROADCAST_MESSAGING_ATT_FLAGS);
		TEST(msgData.Compare(DMMTSY_CBS_MESSAGE_PDU) == 0);
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::ReceiveMessage (async & cancel (Request Not Cancelled)) passed"), iTestCount++);
		}
	
//	test.Next(_L("OK: RMobileBroadcastMessaging's Receive Message"));

	// Receiving broadcast messages V2

	RMobileBroadcastMessaging::TBroadcastPageData msgPage;
	RMobileBroadcastMessaging::TMobileBroadcastAttributesV2 msgAttsV2;
	RMobileBroadcastMessaging::TMobileBroadcastAttributesV2Pckg msgAttsV2Pckg(msgAttsV2);

	cbsMessaging.ReceiveMessage(reqStatus, msgPage, msgAttsV2Pckg);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone);

	TEST(msgAttsV2.iFormat==DMMTSY_CBS_MESSAGE_PDU_FORMAT);
	TEST(msgAttsV2.iFlags==DMMTSY_BROADCAST_MESSAGING_ATT_FLAGS);
	TEST(msgPage.Compare(DMMTSY_CBS_MESSAGE_PDU) == 0);

	// Test cancel

	cbsMessaging.ReceiveMessage(reqStatus, msgPage, msgAttsV2Pckg);
	cbsMessaging.CancelAsyncRequest(EMobileBroadcastMessagingReceiveMessage);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone || reqStatus.Int()==KErrCancel);
	if (reqStatus.Int()==KErrCancel)
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::ReceiveMessage V2params (async & cancel (Cancelled Request)) passed"), iTestCount++);	
	else
		{
		TEST(msgAttsV2.iFormat==DMMTSY_CBS_MESSAGE_PDU_FORMAT);
		TEST(msgAttsV2.iFlags==DMMTSY_BROADCAST_MESSAGING_ATT_FLAGS);
		TEST(msgPage.Compare(DMMTSY_CBS_MESSAGE_PDU) == 0);
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::ReceiveMessage V2params (async & cancel (Request Not Cancelled)) passed"), iTestCount++);
		}
	// Receiving broadcast messages when buffer size incorrect
	
	// Test if client uses buffer of size not equal to 
	// RMobileBroadcastMessaging::TBroadcastPageData to hold the 
	// received message
	const TInt KIncorrectBroadcastPageSizeTooBig = 255; 
	TBuf8<KIncorrectBroadcastPageSizeTooBig> incorrectMsgPageTooBig;
	RMobileBroadcastMessaging::TMobileBroadcastAttributesV1 msgAttributesV1;
	RMobileBroadcastMessaging::TMobileBroadcastAttributesV1Pckg msgAttributesV1Pckg(msgAttributesV1);
	
	cbsMessaging.ReceiveMessage(reqStatus, incorrectMsgPageTooBig, msgAttributesV1Pckg);
	User::WaitForRequest(reqStatus);
	// RMobileBroadcastMessaging::ReceiveMessage should detect 
	// incorrect buffer size and return KErrArgument
	TEST(reqStatus.Int()==KErrArgument);
	if (reqStatus.Int()==KErrArgument)
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::ReceiveMessage incorrect buffer size (too big) passed"), iTestCount++);
	else
		{
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::ReceiveMessage incorrect buffer size (too big) failed"), iTestCount++);
		INFO_PRINTF3(_L("reqStatus = %d, expected reqStatus = %d"), reqStatus.Int(), KErrArgument);
		}

	const TInt KIncorrectBroadcastPageSizeTooSmall = 35;
	TBuf8<KIncorrectBroadcastPageSizeTooSmall> incorrectMsgPageTooSmall;
	cbsMessaging.ReceiveMessage(reqStatus, incorrectMsgPageTooSmall, msgAttributesV1Pckg);
	User::WaitForRequest(reqStatus);
	// RMobileBroadcastMessaging::ReceiveMessage should detect 
	// incorrect buffer size and return KErrArgument
	TEST(reqStatus.Int()==KErrArgument);
	if (reqStatus.Int()==KErrArgument)
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::ReceiveMessage incorrect buffer size (too small) passed"), iTestCount++);
	else
		{
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::ReceiveMessage incorrect buffer size (too small) failed"), iTestCount++);
		INFO_PRINTF3(_L("reqStatus = %d, expected reqStatus = %d"), reqStatus.Int(), KErrArgument);
		}	
	// Get/Set/Notify broadcast receive setting

	RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter setting;

	TEST(cbsMessaging.GetFilterSetting(setting)==KErrNone);
	TEST(setting==DMMTSY_BROADCAST_RECEIVE_SETTING1);
	INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::GetFilterSetting (sync) passed"), iTestCount++);

	// NotifyFilterSettingChange
	
	// Asynchronous

	cbsMessaging.NotifyFilterSettingChange(reqStatus, setting);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone);
	TEST(setting==DMMTSY_BROADCAST_RECEIVE_SETTING2);

	// Asynchronous & cancel

	cbsMessaging.NotifyFilterSettingChange(reqStatus, setting);
	cbsMessaging.CancelAsyncRequest(EMobileBroadcastMessagingNotifyFilterSettingChange);

	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone || reqStatus.Int()==KErrCancel);
	if (reqStatus.Int()==KErrCancel)
		{
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::NotifyFilterSettingChange (async & cancel (Cancelled Request)) passed"), iTestCount++);

		// The cancel function currently alters the value of setting.  This occurs because the Tsy
		// calls completeReq when cancelling requests.  This need to verified to determine whether this
		// behaviour is correct.  So the rest of the script can proceed, reset setting.

		setting=DMMTSY_BROADCAST_RECEIVE_SETTING2;
		}
	else
		{
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::NotifyFilterSettingChange (async & cancel (Request Not Cancelled)) passed"), iTestCount++);
		TEST(setting==DMMTSY_BROADCAST_RECEIVE_SETTING2);
		}

	// set filter setting - async
	cbsMessaging.SetFilterSetting(reqStatus, setting);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone);

	// asynchronous & cancel

	cbsMessaging.SetFilterSetting(reqStatus, setting);
	cbsMessaging.CancelAsyncRequest(EMobileBroadcastMessagingSetFilterSetting);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone || reqStatus.Int()==KErrCancel);
	if (reqStatus.Int()==KErrCancel)
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::SetFilterSetting (async & cancel (Cancelled Request)) passed"), iTestCount++);
	else
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::SetFilterSetting (async & cancel (Request Not Cancelled)) passed"), iTestCount++);


//	test.Next(_L("OK: RMobileBroadcastMessaging's Broadcast receive setting"));
	
	TBuf16<16> setLangFilter(DMMTSY_CBS_MESSAGE_LANGUAGE_FILTER);
	TBuf16<16> getLangFilter;
	
	// Test Get Language Filter

	// asynchronous

	cbsMessaging.GetLanguageFilter(reqStatus,getLangFilter);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone);
	TEST(getLangFilter.Compare(DMMTSY_CBS_MESSAGE_LANGUAGE_FILTER) == 0);

	// asynchronous & cancel

	cbsMessaging.GetLanguageFilter(reqStatus,getLangFilter);
	cbsMessaging.CancelAsyncRequest(EMobileBroadcastMessagingGetLanguageFilter);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone || reqStatus.Int()==KErrCancel);
	if (reqStatus.Int()==KErrCancel)
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::GetLanguageFilter (async & cancel (Cancelled Request)) passed"), iTestCount++);	
	else
		{
		TEST(getLangFilter.Compare(DMMTSY_CBS_MESSAGE_LANGUAGE_FILTER) == 0);
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::GetLanguageFilter (async & cancel (Request Not Cancelled)) passed"), iTestCount++);
		}
	
	// Test Set Language Filter

	// asynchronous

	cbsMessaging.SetLanguageFilter(reqStatus,setLangFilter);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone);

	// asynchronous & cancel

	cbsMessaging.SetLanguageFilter(reqStatus,setLangFilter);
	cbsMessaging.CancelAsyncRequest(EMobileBroadcastMessagingSetLanguageFilter);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone || reqStatus.Int()==KErrCancel);
	if (reqStatus.Int()==KErrCancel)
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::SetLanguageFilter (async & cancel (Cancelled Request)) passed"), iTestCount++);	
	else
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::SetLanguageFilter (async & cancel (Request Not Cancelled)) passed"), iTestCount++);
		
	// Test Notify Language Filter Change

	// asynchronous

	cbsMessaging.NotifyLanguageFilterChange(reqStatus,getLangFilter);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone);
	TEST(getLangFilter.Compare(DMMTSY_CBS_MESSAGE_LANGUAGE_FILTER) == 0);

	// asynchronous & cancel

	cbsMessaging.NotifyLanguageFilterChange(reqStatus,getLangFilter);
	cbsMessaging.CancelAsyncRequest(EMobileBroadcastMessagingNotifyLanguageFilterChange);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone || reqStatus.Int()==KErrCancel);
	if (reqStatus.Int()==KErrCancel)
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::NotifyLanguageFilterChange (async & cancel (Cancelled Request)) passed"), iTestCount++);	
	else
		{
		TEST(getLangFilter.Compare(DMMTSY_CBS_MESSAGE_LANGUAGE_FILTER) == 0);
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::NotifyLanguageFilterChange (async & cancel (Request Not Cancelled)) passed"), iTestCount++);
		}
		
	//Test deletion of list object whilst async request in progress
 	CRetrieveMobilePhoneBroadcastIdList* retrieve=CRetrieveMobilePhoneBroadcastIdList::NewL(cbsMessaging);
 	retrieve->Start(reqStatus,DMMTSY_BROADCAST_ID_TYPE);
 	delete retrieve;
 	retrieve = NULL;
 	User::WaitForRequest(reqStatus);
 	TEST(reqStatus == KErrCancel);

	// Get CBMI list using asynchronous AO version

	CTestGetCbmiList* getCbmiList=CTestGetCbmiList::NewLC(cbsMessaging, this);
    getCbmiList->Start();
    CActiveScheduler::Start();

	// Lets ensure that the same ao can be used to retrieve more than one list.

	getCbmiList->Start();
    CActiveScheduler::Start();

	// I only need to delete the retrieval object because the destructor
	// of this will also delete the list object.
    CleanupStack::PopAndDestroy();  // getCbmiList

	// Now test the cancelling

	getCbmiList=CTestGetCbmiList::NewLC(cbsMessaging, this);
    getCbmiList->Start();

	CTestCanceller* cancelGetCbmiList = getCbmiList->RetrieveCancelPtr();
	cancelGetCbmiList->Call();

    CActiveScheduler::Start();

	TBool cancelled = (getCbmiList->iStatus == KErrCancel);

	// Finally, lets just ensure that the object can be resused even after it has been cancelled

	getCbmiList->Start();
    CActiveScheduler::Start();

	if (cancelled)
		INFO_PRINTF2(_L("Test %d - Test CRetrieveMobilePhoneBroadcastIdList (async & cancel (Cancelled Request)) passed"), iTestCount++);
	else
		INFO_PRINTF2(_L("Test %d - Test CRetrieveMobilePhoneBroadcastIdList (async & cancel (Request Not Cancelled)) passed"), iTestCount++);

    CleanupStack::PopAndDestroy();  // getCbmiList

//	test.Next(_L("OK: RMobileCbmiStore's Read All Entries"));


	// Test StoreCbmiList

	CTestStoreCbmiList *storeList = CTestStoreCbmiList::NewLC(cbsMessaging, this);

	storeList->StartL();
	CActiveScheduler::Start();

	// Lets just perform the operation twice to make sure etelmm handles the cleanup of all
	// internal buffers correctly.

	storeList->StartL();
	CActiveScheduler::Start();

	CleanupStack::PopAndDestroy();

	// Test Cancel

	storeList = CTestStoreCbmiList::NewLC(cbsMessaging, this);

	storeList->StartL();
	storeList->RetrieveCancelPtr()->Call();
	CActiveScheduler::Start();

	if (storeList->iStatus == KErrCancel)
		INFO_PRINTF2(_L("Test %d - Test StoreBroadcastIdListL (async & cancel (Cancelled Request)) passed"), iTestCount++);
	else
		INFO_PRINTF2(_L("Test %d - Test StoreBroadcastIdListL (async & cancel (Request Not Cancelled)) passed"), iTestCount++);

	CleanupStack::PopAndDestroy();

	// Test NotifyCbmi List Change

	cbsMessaging.NotifyBroadcastIdListChange(reqStatus);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone);

	// asynchronous & cancel

	cbsMessaging.NotifyBroadcastIdListChange(reqStatus);
	cbsMessaging.CancelAsyncRequest(EMobileBroadcastMessagingNotifyIdListChange);
	User::WaitForRequest(reqStatus);
	TEST(reqStatus.Int()==KErrNone || reqStatus.Int()==KErrCancel);
	if (reqStatus.Int()==KErrCancel)
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::NotifyBroadcastIdListChange (async & cancel (Cancelled Request)) passed"), iTestCount++);	
	else
		INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::NotifyBroadcastIdListChange (async & cancel (Request Not Cancelled)) passed"), iTestCount++);
		
//	test.Next(_L("OK: RMobileBroadcastMessaging Ok"));	

	INFO_PRINTF1(_L(""));
	cbsMessaging.Close();
	mmPhone.Close();

	return TestStepResult();
	}
enum TVerdict CTestDialCallControlCorrectSIDCorrectCap::doTestStepL()
/**
@SYMTestCaseID TEL-ETEL-NA-2038
@SYMComponent  telephony_etel
@SYMTestCaseDesc To check client has the required SID and Capability to successfully call the RMobileCall::DialCallControl API.
@SYMTestPriority High
@SYMTestActions  Call the RMobileCall::DialCallControl API with required SID and required Capability and check the return value of the API
@SYMTestExpectedResults KErrNone when SID and capabilities are both correct.
@SYMTestType CT
*/
{
    TInt iTestCount = 1;

    RMobilePhone mmPhone;
    TInt ret=mmPhone.Open(iTelServer,DMMTSY_PHONE_NAME);
    TEST(ret==KErrNone);

    RMobileLine mmLine;
    ret=mmLine.Open(mmPhone,DMMTSY_LINE_VOICE_NAME);
    TEST(ret==KErrNone);

    RMobileCall mmCall;
    TName callName;
    ret=mmCall.OpenNewCall(mmLine,callName);
    TEST(ret==KErrNone);

    RMobileCall::TMobileCallParamsV7 mmCallParamsV7;
    TEST(mmCallParamsV7.ExtensionId() == RMobileCall::KETelMobileCallParamsV7);

    mmCallParamsV7.iInterval = DMMTSY_CALL_INTERVAL;
    mmCallParamsV7.iIdRestrict = DMMTSY_CALL_CLI_RESTRICT_SETTING1;
    mmCallParamsV7.iCug.iExplicitInvoke = DMMTSY_CALL_CUG_INVOKE;
    mmCallParamsV7.iCug.iCugIndex = DMMTSY_CALL_CUG_INDEX;
    mmCallParamsV7.iCug.iSuppressOA = DMMTSY_CALL_CUG_OA;
    mmCallParamsV7.iCug.iSuppressPrefCug = DMMTSY_CALL_CUG_PREF;
    mmCallParamsV7.iAutoRedial = DMMTSY_CALL_AUTO_REDIAL_FLAG;
    mmCallParamsV7.iBearerMode = DMMTSY_CALL_NEW_BEARER;
    mmCallParamsV7.iCallParamOrigin = DMMTSY_CALL_PARAM_ORIGIN;
    mmCallParamsV7.iSubAddress = DMMTSY_CALL_SUBADDRESS;
    mmCallParamsV7.iBearerCap1 = DMMTSY_CALL_BEARER_CAP1;
    mmCallParamsV7.iBearerCap2 = DMMTSY_CALL_BEARER_CAP2;
    mmCallParamsV7.iBCRepeatIndicator = DMMTSY_CALL_BC_REPEAT_INDICATOR;
    mmCallParamsV7.iIconId.iQualifier = DMMTSY_CALL_ICON_ID_QUALIFIER;
    mmCallParamsV7.iIconId.iIdentifier = DMMTSY_CALL_ICON_ID_IDENTIFIER;
    mmCallParamsV7.iAlphaId = DMMTSY_CALL_ALPHA_ID;

    RMobileCall::TMobileCallParamsV7Pckg mmCallParamsV7Pckg(mmCallParamsV7);

    TBuf<RMobilePhone::KMaxMobileTelNumberSize> telNumber(DMMTSY_PHONE_TEL_NUMBER);

    TRequestStatus reqStatus;
    mmCall.DialCallControl(reqStatus, mmCallParamsV7Pckg, telNumber);
    User::WaitForRequest(reqStatus);

    TEST(reqStatus.Int()==KErrNone);
    INFO_PRINTF2(_L("Test %d - RMobileCall::DialCallControl correct SID correct caps passed"), iTestCount++);

    mmCall.Close();
    mmLine.Close();
    mmPhone.Close();

    return TestStepResult();
}
TInt CTestDriveOOMVoiceCall::DoTestL(TInt aAllocFailNumber)
	{
	_LIT(KPhoneModule,"MM");
	_LIT(KPhoneName,  "GsmPhone1");
	_LIT(KLineName,   "Voice");

	RTelServer telServer;
	TInt ret=telServer.Connect();
	if(ret!=KErrNone)
		return ret;

	telServer.__DbgFailNext(aAllocFailNumber);

	ret=telServer.LoadPhoneModule(KPhoneModule);
	if(ret!=KErrNone)
		{
		telServer.Close();
		return ret;
		}

	RMobilePhone mobilePhone;
	ret=mobilePhone.Open(telServer, KPhoneName);
	if(ret!=KErrNone)
		{
		mobilePhone.Close();
		telServer.Close();
		return ret;
		}

	RLine line;
	INFO_PRINTF1(_L("Opening Voice Line"));
	ret=line.Open(mobilePhone,KLineName);
	if(ret!=KErrNone)
		{
		line.Close();
		mobilePhone.Close();
		telServer.Close();
		return ret;
		}

	INFO_PRINTF1(_L("Opening New Voice Call"));
	RCall call;
	ret=call.OpenNewCall(line);
	if(ret!=KErrNone)
		{
		call.Close();
		line.Close();
		mobilePhone.Close();
		telServer.Close();
		return ret;
		}

	INFO_PRINTF1(_L("Initialise the Phone..."));
	
	TRequestStatus reqStatus;
	RMobilePhone::TMMTableSettings tableSettings;
	tableSettings.iLocId=KInternetAccessPoint;
	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
	mobilePhone.InitialiseMM(reqStatus, tableSettingsPckg); 	
	User::WaitForRequest(reqStatus);
	TESTL(reqStatus == KErrNone);

	if(reqStatus!=KErrNone)
		{
		call.Close();
		line.Close();
		mobilePhone.Close();
		telServer.Close();
		return ret;
		}

	INFO_PRINTF1(_L("Dial a number..."));
	_LIT(KDialString, "+1234");
	ret=call.Dial(KDialString);
	if(ret!=KErrNone)
		{
		call.Close();
		line.Close();
		mobilePhone.Close();
		telServer.Close();
		return ret;
		}

	INFO_PRINTF1(_L("Hangup a call..."));
	ret=call.HangUp();
	if(ret!=KErrNone)
		{
		call.Close();
		line.Close();
		mobilePhone.Close();
		telServer.Close();
		return ret;
		}

	INFO_PRINTF1(_L("Close the call, line & iPhone..."));
	call.Close();
	line.Close();
	mobilePhone.Close();

	return KErrNone;
	}
// -----------------------------------------------------------------------------
// DMFotaView::addFotaView
// Creates and adds the Fota Portrait and Landscape View
// -----------------------------------------------------------------------------
//
bool DMFotaView::addFotaView()
    {
    qDebug("DMFotaView::addFotaView >>");
    connect( mMainWindow, SIGNAL( orientationChanged(Qt::Orientation) ), this, SLOT( readSection(Qt::Orientation) ) );
        
    bool ok = false;
    QString val,val2;
    loader.load(":/xml/devman.docml", &ok);
    ok = false;
    loader2.load(":/xml/devman.docml", &ok);
    // Exit if the file format is invalid
    Q_ASSERT_X(ok, "Device Manager", "Invalid docml file");
    
    ok=false;
    loader.load(":/xml/devman.docml","Portrait", &ok);
    ok=false;
    loader2.load(":/xml/devman.docml","Landscape", &ok);
   
    // Load the view by name from the xml file
    fotaPortraitView = qobject_cast<HbView*>(loader.findWidget("p:view"));
    fotaLandscapeView = qobject_cast<HbView*>(loader2.findWidget("l:view"));


    HbAction *help = qobject_cast<HbAction*> (loader.findObject("help")); 
    help->setText(QString("txt_common_menu_help"));
    QObject::connect(help, SIGNAL(triggered()), this, SLOT(OnHelp()));
    HbAction *exit = qobject_cast<HbAction*> (loader.findObject("exit"));
    exit->setText(QString("txt_common_menu_exit"));
    QObject::connect(exit, SIGNAL(triggered()), this, SLOT(OnExit()));

    help = qobject_cast<HbAction*>(loader2.findObject("help"));
    help->setText(QString("txt_common_menu_help"));
    QObject::connect(help, SIGNAL(triggered()), this, SLOT(OnHelp()));
    exit = qobject_cast<HbAction*>( loader2.findObject("exit"));
    exit->setText(QString("txt_common_menu_exit"));
    QObject::connect(exit, SIGNAL(triggered()), this, SLOT(OnExit()));
    
    mSoftKeyBackAction = new HbAction(Hb::BackNaviAction ,this);
    mSoftKeyBackAction->setText("Back");
    fotaPortraitView->setNavigationAction(mSoftKeyBackAction);
	fotaLandscapeView->setNavigationAction(mSoftKeyBackAction);
    connect(mSoftKeyBackAction, SIGNAL(triggered()), this, SLOT(backtoMainWindow()));
        
    
    i=0;
    QString str;
    //Setting title text
    label = qobject_cast<HbLabel*> (loader.findWidget("p:title"));
    label2 = qobject_cast<HbLabel*> (loader2.findWidget("l:title"));
    val = hbTrId("txt_device_update_subhead_device_updates");
    label->setPlainText(val);
    label2->setPlainText(val);
    
    
    
    HbScrollArea* area = qobject_cast<HbScrollArea*> (loader.findWidget("scrollArea"));
    area->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOn);
    
    
    list1 << "label" << "label_1" << "label_2" << "label_3" << "label_4" << "label_5" << "label_6"<<"label_7"<<"label_8"<<"label_9"<<"label_10"<<"label_11";
    list2 << "label_13" << "label_14" << "label_15" << "label_16" << "label_17" << "label_18" << "label_19"<<"label_20"<<"label_21"<<"label_22"<<"label_23"<<"label_24";


    //Product Release
    TBuf< KSysUtilVersionTextLength > prodrelease;
    prodrelease.Zero();
    if(SysUtil::GetPRInformation(prodrelease)==KErrNone)
        {
        val = hbTrId("txt_device_update_dblist_product_release");
        str = QString::fromUtf16(prodrelease.Ptr(), prodrelease.Length());
        FormatList(val,str);
        }
    
    //Software version
    
    TBuf< KSysUtilVersionTextLength > swversion;
    TBuf< KSysUtilVersionTextLength > swversiondate;
    TBuf< KSysUtilVersionTextLength > typedesignator;
    TBuf< KSysUtilVersionTextLength > version;
    swversion.Zero();
    version.Zero();
    typedesignator.Zero();
    swversiondate.Zero();
    if( SysUtil::GetSWVersion(version)==KErrNone)
        {
        TInt len= version.Length();
        TInt pos1 = version.Find(KSmlEOL);
             if( pos1 != KErrNotFound && len > pos1 )
                {
                 TBuf<KSysUtilVersionTextLength> version1;
                 version1.Zero();
                 swversion.Append( version.Left(pos1));
                 version1.Append( version.Right( len-pos1-1 ));
                 len= version1.Length();
                 pos1 = version1.Find(KSmlEOL);
                 if( pos1 != KErrNotFound  && len > pos1 )
                     {
                     swversiondate.Append(version1.Left( pos1 ));
                     version.Zero();
                     version.Append( version1.Right( len-pos1-1 ));
                     len= version.Length();
                     pos1 = version.Find(KSmlEOL);
                     if( pos1 != KErrNotFound  && len > pos1 )
                         {
                         typedesignator.Append(version.Left(pos1));         
                         }
                     }
                }
            val = hbTrId("txt_device_update_dblist_software_version");
            str = QString::fromUtf16(swversion.Ptr(), swversion.Length());
            FormatList(val,str);
            }

    //Model
    TBuf<100> phoneName;
    TInt error = SysVersionInfo::GetVersionInfo(SysVersionInfo::EModelVersion, phoneName);
    if (error==KErrNone)
    {
    
    //phoneName.Copy( telid.iModel );
    //imei.Copy(telid.iSerialNumber);
    if( phoneName.Length()>0 )
        {
        val = hbTrId("txt_device_update_dblist_model");
        str = QString::fromUtf16(phoneName.Ptr(), phoneName.Length());
        FormatList(val,str);
        }
    }
    RTelServer telServer;
    User::LeaveIfError( telServer.Connect() );
    RTelServer::TPhoneInfo teleinfo;
    User::LeaveIfError( telServer.GetPhoneInfo( 0, teleinfo ) );
    RMobilePhone phone;
    User::LeaveIfError( phone.Open( telServer, teleinfo.iName ) );
    User::LeaveIfError(phone.Initialise()); 
    TUint32 teleidentityCaps;
    phone.GetIdentityCaps( teleidentityCaps );
    RMobilePhone::TMobilePhoneIdentityV1 telid;
    TRequestStatus status;
    phone.GetPhoneId( status, telid );
    User::WaitForRequest( status );
    TBuf <50> imei;
    if (status==KErrNone)
    {
    TBuf<100> phoneName;
    imei.Copy(telid.iSerialNumber);
    }
    phone.Close();
    telServer.Close();

    //type
    if(typedesignator.Length()>0)
        {
        val = hbTrId("txt_device_update_dblist_type");
        str = QString::fromUtf16(typedesignator.Ptr(), typedesignator.Length());
        FormatList(val,str);
        }
      
    //Product Code
       /* TInt runtimesupport(0);
        CRepository* cenrep = NULL;
        TRAPD( error, cenrep = CRepository::NewL( KCRUidNSmlDMSyncApp ) );  
        if(error)
            {
            runtimesupport=1;
            }
        if ( cenrep )
                {
                cenrep->Get( KNsmlDmRuntimeVerSupport, runtimesupport );
                delete cenrep; cenrep = NULL;
                }
          if(runtimesupport)
          { */
         TBuf<KSysUtilVersionTextLength> productcode;
         productcode.Zero();
         error = SysVersionInfo::GetVersionInfo(SysVersionInfo::EProductCode, productcode);
         if(error ==KErrNone )
         {            
             if( productcode.Length()>0 )
             {        
             val = hbTrId("txt_device_update_dblist_product_code");
             str = QString::fromUtf16(productcode.Ptr(), productcode.Length());  
             FormatList(val,str);
             }                    
        }

    //IMEI   
    if(imei.Length()>0)
        {
        val = hbTrId("txt_device_update_dblist_imei");
        str = QString::fromUtf16(imei.Ptr(), imei.Length()); 
        FormatList(val,str);
        }

   
    iFotaState = FotaEngineL().GetState(-1);
    
    TBuf8<80> Name;
    TBuf8<80> Version;
    TInt Size;
    
    if(iFotaState == RFotaEngineSession::EDownloadComplete || iFotaState == RFotaEngineSession::EStartingUpdate
            || iFotaState == RFotaEngineSession::EStartingDownload || iFotaState == RFotaEngineSession::EDownloadProgressing)
        {
        label = qobject_cast<HbLabel*> (loader.findWidget("p:updatelabel"));
        label2 = qobject_cast<HbLabel*> (loader2.findWidget("l:updatelabel"));
        FotaEngineL().GetCurrentFirmwareDetailsL(Name, Version, Size);
        
        const QString
        name =
                QString::fromUtf8(
                        reinterpret_cast<const char*> (Name.Ptr()),
                                Name.Length());
        const QString
        ver =
                QString::fromUtf8(
                        reinterpret_cast<const char*> (Version.Ptr()),
                                Version.Length());
        
        TInt sizeKB = Size / 1024;
        if(sizeKB < 1024)
            {
            val = hbTrId("txt_device_update_setlabel_the_last_update_1_2_kb").arg(name)
                    .arg(ver).arg(sizeKB);
            }
        else
            {
            TInt sizeMB = sizeKB / 1024;
            val = hbTrId("txt_device_update_setlabel_the_last_update_1_2_mb").arg(name)
                    .arg(ver).arg(sizeMB);
            }
        label->setPlainText(val);
        label2->setPlainText(val);
		
		val = hbTrId("txt_device_update_button_resume_update");
    
        updateButton = qobject_cast<HbPushButton*>(loader.findWidget("p:update"));
        updateButton->setText(val);
        QObject::connect(updateButton, SIGNAL(clicked()), this, SLOT(ResumeUpdate()));
        updateButtonLandscape = qobject_cast<HbPushButton*>(loader2.findWidget("l:update"));
        updateButtonLandscape->setText(val);
		QObject::connect(updateButtonLandscape, SIGNAL(clicked()), this, SLOT(ResumeUpdate()));
		Connected = ETrue;
        }
    else
        {
        //Setting help text for update button
        label = qobject_cast<HbLabel*> (loader.findWidget("p:updatelabel"));
        label2 = qobject_cast<HbLabel*> (loader2.findWidget("l:updatelabel"));
        val = hbTrId("txt_device_update_setlabel_to_update_your_device_s");
        label->setPlainText(val);
        label2->setPlainText(val);
        
        val = hbTrId("txt_device_update_button_update");
        updateButton = qobject_cast<HbPushButton*>(loader.findWidget("p:update"));
        updateButton->setText(val);
        QObject::connect(updateButton, SIGNAL(clicked()), this, SLOT(CheckforUpdate()));
        updateButtonLandscape = qobject_cast<HbPushButton*>(loader2.findWidget("l:update"));
        updateButtonLandscape->setText(val);
        QObject::connect(updateButtonLandscape, SIGNAL(clicked()), this, SLOT(CheckforUpdate()));
        Connected = ETrue;
        }
    
    val = hbTrId("txt_device_update_button_advanced");
    advancedButton = qobject_cast<HbPushButton*>(loader.findWidget("p:advanced")); 
    advancedButton->setText(val);
    QObject::connect(advancedButton, SIGNAL(clicked()), this, SLOT(AdvancedDeviceManager()));
    advancedButtonLandscape = qobject_cast<HbPushButton*>(loader2.findWidget("l:advanced"));
    advancedButtonLandscape->setText(val);
    QObject::connect(advancedButtonLandscape, SIGNAL(clicked()), this, SLOT(AdvancedDeviceManager()));
    fotaSupportEnabled();
    mMainWindow->addView(fotaPortraitView);
    mMainWindow->addView(fotaLandscapeView);
    
    if(mMainWindow->orientation()==Qt::Vertical)
            mMainWindow->setCurrentView(fotaPortraitView);
        else
            mMainWindow->setCurrentView(fotaLandscapeView);
    
    iMoniter = CDeviceUpdateMoniter::NewL(this);
    //iMoniter->StartMoniter();
    emit applicationReady();
    qDebug("DMFotaView::addFotaView <<");
    return ETrue;
    }