Example #1
0
void CPubSubMode::TestCallInitiationL(const TDesC& aLineName, TUid aPSCallInitCategory, const TInt aPSCallInitKey)
	{		
	RLine line;
	CleanupClosePushL(line); 
	
	TName callName;
	
	INFO_PRINTF2(_L("Opening %S Line"), &aLineName);

	TInt ret = line.Open(iPhone,aLineName);
	TEST(ret==KErrNone);

	TInt callID = 0;
	RCall call;

	//Test  Initiate call using P&S
	
	line.NotifyIncomingCall(iStatus, callName);	// wait for a call
	
	ret = RProperty::Set(aPSCallInitCategory, aPSCallInitKey, callID);
	TEST(ret == KErrNone);
	callID++;
	
	User::WaitForRequest(iStatus);
	TEST(iStatus == KErrNone);	
	
	//answer the call then hangup.
	ret = call.OpenExistingCall(line, callName);
	TEST(ret == KErrNone);
	call.AnswerIncomingCall(iStatus);
	User::WaitForRequest(iStatus);	
	call.HangUp();
	call.Close();
	
	CleanupStack::PopAndDestroy(); //call	
	}
TInt CTestDriveTwoFaxRx::DriveETelApiL()
//
// This function contains the real meat of the Client-side test code
//
	{
	_LIT(KFaxLineName,"Fax");

	RLine faxLine;
	INFO_PRINTF1(_L("Opening Fax Line\n"));
	TESTL(faxLine.Open(iPhone,KFaxLineName)==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("Waiting for an incoming fax call\n"));
	TName callName;
	faxLine.NotifyIncomingCall(stat1,callName);
	User::WaitForRequest(stat1);
	TESTL(stat1==KErrNone);

	RCall faxCall;
	INFO_PRINTF1(_L("Opening Fax Call to answer\n"));
	TESTL(faxCall.OpenNewCall(faxLine)==KErrNone);

	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::WaitForRequest(stat2);
	User::After(300000L);
	TESTL(faxCall.HangUp()==KErrNone);
	faxCall.Close();

// Now wait for a second incoming fax call...
	INFO_PRINTF1(_L("Waiting for a second incoming fax call\n"));
	TName callName2;
	faxLine.NotifyIncomingCall(stat1,callName2);
	User::WaitForRequest(stat1);
	TESTL(stat1==KErrNone);

	RCall faxCall2;
	INFO_PRINTF1(_L("Opening Fax Call to answer\n"));
	TESTL(faxCall2.OpenNewCall(faxLine)==KErrNone);

	INFO_PRINTF1(_L("Answering a Fax Call\n"));
	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;
	faxCall2.SetFaxSettings(faxSessionSettings);
	faxCall2.AnswerIncomingCall(stat2);
	User::WaitForRequest(stat2);
	User::After(300000L);
	TESTL(faxCall2.HangUp()==KErrNone);
	faxCall2.Close();

	faxLine.Close();
	return KErrNone;
	}