void CCTsyPrivacyFU::DoSetPrivacyL(const TDesC& aLineName,RMobilePhone::TMobilePhonePrivacy aPrivacySetting) { OpenEtelServerL(EUseExtendedError); CleanupStack::PushL(TCleanupItem(Cleanup,this)); OpenPhoneL(); RLine line; TInt err = line.Open(iPhone, aLineName); ASSERT_EQUALS(KErrNone, err) CleanupClosePushL(line); RMobileCall mobileCall; err = mobileCall.OpenNewCall(line); ASSERT_EQUALS(KErrNone, err) CleanupClosePushL(mobileCall); // EMobileCallSetPrivacy is not passed to LTSY // CTSY returns KErrNotSupported immediately err = mobileCall.SetPrivacy(aPrivacySetting); ASSERT_EQUALS(KErrNotSupported, err); AssertMockLtsyStatusL(); CleanupStack::PopAndDestroy(3, this); // mobileCall, line, this }
enum TVerdict CTestOpenCallFrLine::doTestStepL() { INFO_PRINTF1(_L("Open Call from RLine!")); RTelServer server; TInt ret = server.Connect(); TESTCHECK(ret, KErrNone); ret=server.LoadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); RPhone phone; ret = phone.Open(server,DSTD_PHONE_NAME); TESTCHECK(ret, KErrNone); RLine line; ret = line.Open(phone,DSTD_LINE_NAME); TESTCHECK(ret, KErrNone); RCall call; ret = call.OpenNewCall(line); TESTCHECK(ret, KErrNone); call.Close(); line.Close(); phone.Close(); ret=server.UnloadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); ServerClose(server); return TestStepResult(); }
void CCTsyPrivacyFU::DoCancelNotifyPrivacyConfirmationL(const TDesC& aLineName) { OpenEtelServerL(EUseExtendedError); CleanupStack::PushL(TCleanupItem(Cleanup,this)); OpenPhoneL(); RLine line; RMobileCall mobileCall; TInt err = line.Open(iPhone, aLineName); ASSERT_EQUALS(KErrNone, err) CleanupClosePushL(line); err = mobileCall.OpenNewCall(line); ASSERT_EQUALS(KErrNone, err) CleanupClosePushL(mobileCall); //------------------------------------------------------------------------- // Test cancelling of RMobileCall::NotifyPrivacyConfirmation //------------------------------------------------------------------------- TRequestStatus notifyStatus; RMobilePhone::TMobilePhonePrivacy privacy; mobileCall.NotifyPrivacyConfirmation(notifyStatus,privacy); mobileCall.CancelAsyncRequest(EMobileCallNotifyPrivacyConfirmation); User::WaitForRequest(notifyStatus); ASSERT_EQUALS(KErrCancel, notifyStatus.Int()); AssertMockLtsyStatusL(); // just in case CleanupStack::PopAndDestroy(3); // mobileCall, line, this }
/** @SYMTestCaseID BA-CTSY-ALTC-CNACS-0003 @SYMComponent telephony_ctsy @SYMTestCaseDesc Test support in CTSY for RMobileCall::NotifyAlternatingCallSwitch for fax calls @SYMTestPriority High @SYMTestActions Invokes RMobileCall::NotifyAlternatingCallSwitch for fax calls @SYMTestExpectedResults Pass @SYMTestType CT */ void CCTsyAlternatingCallFU::TestNotifyAlternatingCallSwitch0003L() { OpenEtelServerL(EUseExtendedError); CleanupStack::PushL(TCleanupItem(Cleanup,this)); OpenPhoneL(); RMobileCall mobileCall; RLine line; TInt err = line.Open(iPhone, KMmTsyFaxLineName); ASSERT_EQUALS(KErrNone, err) CleanupClosePushL(line); err = OpenNewCall(line, mobileCall, KMmTsyFaxLineName); ASSERT_EQUALS(KErrNone, err) CleanupClosePushL(mobileCall); TRequestStatus reqStatus; mobileCall.NotifyAlternatingCallSwitch(reqStatus); User::WaitForRequest(reqStatus); ASSERT_EQUALS(KErrNotSupported, reqStatus.Int()) AssertMockLtsyStatusL(); CleanupStack::PopAndDestroy(3, this); // mobileCall, line, this }
enum TVerdict CTestErrNewTelObjectIllegalBuffer::doTestStepL() /** Check that CTelSession::NewTelObject fails when an illegal buffer is passed to it for the name of the call. (Uses similar code to that in RTelServer::OpenNewCall().) @return EPass or EFail */ { RTelServer1 server; TInt ret = server.Connect(); TESTCHECK(ret, KErrNone); ret=server.LoadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); RTelServer::TPhoneInfo phoneInfo; ret = server.GetPhoneInfo( 0, phoneInfo ); TESTCHECK(ret, KErrNone); RPhone phone; ret = phone.Open( server, phoneInfo.iName ); TESTCHECK(ret, KErrNone); RPhone::TLineInfo lineInfo; ret = phone.GetLineInfo( 0, lineInfo ); TESTCHECK(ret, KErrNone); RLine line; ret = line.Open( phone, lineInfo.iName ); char retName; // Illegal buffer. RCall1 call; // Taken from OpenNewCall(line , retName); RSessionBase* session=&line.SessionHandle(); call.ConstructL(); TInt subSessionHandle=line.SubSessionHandle(); TPtrC name(_L("::")); // necessary so that server knows to ask TSY for new name TIpcArgs args(&name,REINTERPRET_CAST(TDes*,&retName),subSessionHandle); call.SetSessionHandle(*session); ret = call.CreateSubSession(*session,EEtelOpenFromSubSession,args); call.Destruct(); TESTCHECK(ret, KErrBadDescriptor); line.Close(); phone.Close(); ret=server.UnloadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); ServerClose(server); return TestStepResult(); }
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 CTestMemZeroLength::doTestStepL() { INFO_PRINTF1(_L("Test Zero Length Dials")); RTelServer server; TInt ret = server.Connect(); TESTCHECK(ret, KErrNone); ret=server.LoadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); RPhone phone; ret = phone.Open(server,DSTD_PHONE_NAME); TESTCHECK(ret, KErrNone); RLine line; ret = line.Open(phone,DSTD_LINE_NAME); TESTCHECK(ret, KErrNone); RCall call; TName name; ret = call.OpenNewCall(line,name); TESTCHECK(ret, KErrNone); RCall::TTelNumberC number(_L("")); TPtrC8 callParams(_L8("")); ret=call.Dial(number); TESTCHECK(ret, KErrArgument); ret=call.Dial(callParams,number); TESTCHECK(ret, KErrArgument); TRequestStatus status; call.Dial(status,number); User::WaitForRequest(status); TESTCHECK(status.Int(), KErrArgument); call.Dial(status,callParams,number); User::WaitForRequest(status); TESTCHECK(status.Int(), KErrArgument); call.Close(); line.Close(); INFO_PRINTF1(_L("Passed illegal Cancel Test")); INFO_PRINTF1(_L("Test an illegal Cancel")); // This shouldn't panic phone.NotifyModemDetectedCancel(); phone.Close(); ServerClose(server); INFO_PRINTF1(_L("Passed illegal Cancel Test")); return TestStepResult(); }
void CCTsySessionManagementFU::AuxReferenceCountL(const TDesC &aName) { OpenEtelServerL(EUseExtendedError); CleanupStack::PushL(TCleanupItem(Cleanup,this)); OpenPhoneL(); TName lineName(aName); RLine line; TInt ret = line.Open(iPhone, lineName); ASSERT_EQUALS(KErrNone, ret); CleanupClosePushL(line); TName name; RCall call; ret = OpenNewCall(line, call, lineName, name); ASSERT_EQUALS(KErrNone, ret); CleanupClosePushL(call); // test on successful completion TInt count = call.ReferenceCount(); ASSERT_EQUALS(1, count); AssertMockLtsyStatusL(); // test on successful completion, increasing count RCall call2; ret = call2.OpenExistingCall(line, name); ASSERT_EQUALS(KErrNone, ret); CleanupClosePushL(call2); count = call.ReferenceCount(); ASSERT_EQUALS(2, count); AssertMockLtsyStatusL(); // test on successful completion, decreasing count CleanupStack::PopAndDestroy(1); count = call.ReferenceCount(); ASSERT_EQUALS(1, count); AssertMockLtsyStatusL(); CleanupStack::PopAndDestroy(3, this); }
enum TVerdict CTestErrNewTelObjectOk::doTestStepL() /** Check that RTelServer::OpenNewCall returns no errors when it has a large enough valid buffer to put the call name in. @return EPass or EFail */ { RTelServer1 server; TInt ret = server.Connect(); TESTCHECK(ret, KErrNone); ret=server.LoadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); RTelServer::TPhoneInfo phoneInfo; ret = server.GetPhoneInfo( 0, phoneInfo ); TESTCHECK(ret, KErrNone); RPhone phone; ret = phone.Open( server, phoneInfo.iName ); TESTCHECK(ret, KErrNone); RPhone::TLineInfo lineInfo; ret = phone.GetLineInfo( 0, lineInfo ); TESTCHECK(ret, KErrNone); RLine line; ret = line.Open( phone, lineInfo.iName ); TName retName; // Check that we can get a name for the newly opened call. RCall call; ret = call.OpenNewCall(line , retName); TESTCHECK(ret, KErrNone); call.Close(); line.Close(); phone.Close(); ret=server.UnloadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); ServerClose(server); return TestStepResult(); }
enum TVerdict CTestErrNewTelObjectSmallBuffer::doTestStepL() /** Check that CTelSession::NewTelObject fails when a small buffer is passed to it for the name of the call. (Uses similar code to that in RTelServer::OpenNewCall().) @return EPass or EFail */ { RTelServer1 server; TInt ret = server.Connect(); TESTCHECK(ret, KErrNone); ret=server.LoadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); RTelServer::TPhoneInfo phoneInfo; ret = server.GetPhoneInfo( 0, phoneInfo ); TESTCHECK(ret, KErrNone); RPhone phone; ret = phone.Open( server, phoneInfo.iName ); TESTCHECK(ret, KErrNone); RPhone::TLineInfo lineInfo; ret = phone.GetLineInfo( 0, lineInfo ); TESTCHECK(ret, KErrNone); RLine line; ret = line.Open( phone, lineInfo.iName ); TBuf<1> retName; //Buffer too small to recieve name. RCall call; ret = call.OpenNewCall(line , retName); TESTCHECK(ret, KErrOverflow); line.Close(); phone.Close(); ret=server.UnloadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); ServerClose(server); return TestStepResult(); }
/** * "Outgoing Call" function. This function will wait until the * Watchers have started and then will make and terminate a call. */ void CTelWatchersIntTestOutgoingCallStatusWithPublishSubscribe::OutgoingCallL() { const TInt KStartupPollPeriod = 1*1000000; const TInt KCallActivePeriod = 5*1000000; TInt val(KErrNotFound); while (val < KErrNone) { User::After(KStartupPollPeriod); User::LeaveIfError(RProperty::Get(KUidSystemCategory, KUidCurrentCall.iUid, val)); } RTelServer telServer; User::LeaveIfError(telServer.Connect()); CleanupClosePushL(telServer); RPhone phone; User::LeaveIfError(phone.Open(telServer, KPhoneName)); CleanupClosePushL(phone); RLine line; User::LeaveIfError(line.Open(phone, KVoiceLineName)); CleanupClosePushL(line); RCall call; TName callName; User::LeaveIfError(call.OpenNewCall(line, callName)); CleanupClosePushL(call); _LIT(KTelNumber,"1234"); User::LeaveIfError(call.Dial(KTelNumber)); User::After(KCallActivePeriod); call.HangUp(); CleanupStack::PopAndDestroy(&call); CleanupStack::PopAndDestroy(&line); CleanupStack::PopAndDestroy(&phone); CleanupStack::PopAndDestroy(&telServer); } // CTelWatchersIntTestOutgoingCallStatusWithPublishSubscribe::OutgoingCallL
void CTelServerProcessor::GetLineInfoL(RPhone::TLineInfo& aInfo,const TDesC& aPhoneName, TUint aLineType) { RPhone phone; User::LeaveIfError(phone.Open(iTelServer,aPhoneName)); CleanupClosePushL(phone); TInt count = 0; User::LeaveIfError(phone.EnumerateLines(count)); if (count <= 0) { OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_GETLINEINFOL_1,"NetDial:\tGetLineInfoL(): no line info available - leaving with -1"); User::Leave(KErrNotFound); } TBool found = EFalse; for (TInt i=0; i<count && !found; ++i) { User::LeaveIfError(phone.GetLineInfo(i,aInfo)); /* if (aInfo.iLineCapsFlags & aLineType) // Required line found { found=ETrue; } */ RLine line; User::LeaveIfError(line.Open(phone,aInfo.iName)); CleanupClosePushL(line); RLine::TCaps caps; User::LeaveIfError(line.GetCaps(caps)); if (caps.iFlags & aLineType) // Required line found { found=ETrue; } CleanupStack::PopAndDestroy(&line); } CleanupStack::PopAndDestroy(&phone); if (!found) { OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_GETLINEINFOL_2, "NetDial:\tGetLineInfoL(): required line not found - leaving with -1"); User::Leave(KErrNotFound); } }
enum TVerdict CTestOpenLineFrServ::doTestStepL() { INFO_PRINTF1(_L("Test Open Line From Server")); RTelServer server; TInt ret = server.Connect(); TESTCHECK(ret, KErrNone); ret=server.LoadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); RLine line; ret = line.Open(server,DSTD_LINE_FULLNAME); TESTCHECK(ret, KErrNone); line.Close(); ret=server.UnloadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); ServerClose(server); return TestStepResult(); }
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 }
void CCTsySessionManagementFU::AuxOpenExisting1L(const TDesC &aName) { OpenEtelServerL(EUseExtendedError); CleanupStack::PushL(TCleanupItem(Cleanup,this)); OpenPhoneL(); TName lineName(aName); RLine line; TInt ret = line.Open(iPhone, lineName); ASSERT_EQUALS(KErrNone, ret); CleanupClosePushL(line); TName callname; RCall call; ret = OpenNewCall(line, call, lineName, callname); ASSERT_EQUALS(KErrNone, ret); CleanupClosePushL(call); // test on successful completion RCall call2; ret = call2.OpenExistingCall(line, callname); ASSERT_EQUALS(KErrNone, ret); CleanupClosePushL(call2); AssertMockLtsyStatusL(); // test on successful completion (another params set) TName name; name = lineName; name.Append(KDoubleColon); name.Append(callname); RCall call3; ret = call3.OpenExistingCall(iPhone, name); ASSERT_EQUALS(KErrNone, ret); CleanupClosePushL(call3); AssertMockLtsyStatusL(); // test on successful completion (another params set) RCall call4; name = KMmTsyPhoneName; name.Append(KDoubleColon); name.Append(lineName); name.Append(KDoubleColon); name.Append(callname); ret = call4.OpenExistingCall(iTelServer, name); ASSERT_EQUALS(KErrNone, ret); CleanupClosePushL(call4); AssertMockLtsyStatusL(); CleanupStack::PopAndDestroy(6, this); }
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; }
static void DialNumberL(PktBuf &in, PktBuf &out) { /// @todo maybe use a CActive object to allow the call to be cancelled from gammu TBuf<100> aPhoneNumber; in >> aPhoneNumber; cons->Printf( _L("dialing... number:\n") ); cons->Printf( aPhoneNumber ); cons->Printf( _L("\n") ); TName newCallName = _L("call"); //Create a connection to the tel server RTelServer server; CleanupClosePushL(server); User::LeaveIfError(server.Connect()); //Load in the phone device driver User::LeaveIfError(server.LoadPhoneModule(KTsyName)); //Find the number of phones available from the tel server TInt numberPhones; User::LeaveIfError(server.EnumeratePhones(numberPhones)); //Check there are available phones if (numberPhones < 1) { User::Leave(KErrNotFound); } //Get info about the first available phone RTelServer::TPhoneInfo info; User::LeaveIfError(server.GetPhoneInfo(0, info)); //Use this info to open a connection to the phone, the phone is identified by its name RPhone phone; CleanupClosePushL(phone); User::LeaveIfError(phone.Open(server, info.iName)); //Get info about the first line from the phone RPhone::TLineInfo lineInfo; User::LeaveIfError(phone.GetLineInfo(0, lineInfo)); //Use this to open a line RLine line; CleanupClosePushL(line); User::LeaveIfError(line.Open(phone, lineInfo.iName)); //Open a new call on this line RCall call; CleanupClosePushL(call); User::LeaveIfError(call.OpenNewCall(line, newCallName)); if ((call.Dial(aPhoneNumber) == KErrNone)) { TRequestStatus iStatus; RCall::TStatus iLineStatus; line.NotifyStatusChange(iStatus, iLineStatus); User::WaitForRequest(iStatus); } CleanupStack::PopAndDestroy(4);//phone, line, call //Unload the phone device driver User::LeaveIfError(server.UnloadPhoneModule(KTsyName)); out << (TUint16)GNAPPLET_MSG_PHONEBOOK_DIAL_RESP; out << (TUint16)GN_ERR_NONE; }
void CCTsyPrivacyFU::DoNotifyPrivacyConfirmationL(const TDesC& aLineName) { OpenEtelServerL(EUseExtendedError); CleanupStack::PushL(TCleanupItem(Cleanup,this)); OpenPhoneL(); RLine line; RMobileCall mobileCall; TInt err = line.Open(iPhone, aLineName); ASSERT_EQUALS(KErrNone, err) CleanupClosePushL(line); err = mobileCall.OpenNewCall(line); ASSERT_EQUALS(KErrNone, err) CleanupClosePushL(mobileCall); //------------------------------------------------------------------------- // TEST C: Successful completion request of // RMobileCall::NotifyPrivacyConfirmation when result is not cached. //------------------------------------------------------------------------- // invoke RMobilePhone::NotifyPrivacyConfirmation TRequestStatus notifyStatus; // initialize the variable to be set by CTSY with the value other than passed to MockLTSY RMobilePhone::TMobilePhonePrivacy privacy = RMobilePhone::EPrivacyOn; mobileCall.NotifyPrivacyConfirmation(notifyStatus,privacy); // prepare the data to be returned from MockLTSY RMobilePhone::TMobilePhonePrivacy privacySetting = RMobilePhone::EPrivacyUnspecified; TMockLtsyCallData1<RMobilePhone::TMobilePhonePrivacy> privacySettingData(privacySetting); RBuf8 data; CleanupClosePushL(data); privacySettingData.SerialiseL(data); // trigger EMobileCallNotifyPrivacyConfirmation completion via MockLTSY TRequestStatus mockLtsyStatus; iMockLTSY.NotifyTerminated(mockLtsyStatus); iMockLTSY.CompleteL(EMobileCallNotifyPrivacyConfirmation, KErrNone,data); User::WaitForRequest(mockLtsyStatus); ASSERT_EQUALS(KErrNone,mockLtsyStatus.Int()); // wait for RMobilePhone::NotifyPrivacyConfirmation completion User::WaitForRequest(notifyStatus); ASSERT_EQUALS(KErrNone,notifyStatus.Int()); ASSERT_EQUALS(RMobilePhone::EPrivacyUnspecified, privacy); AssertMockLtsyStatusL(); //------------------------------------------------------------------------- // TEST E: Unsolicited completion of RMobileCall::NotifyPrivacyConfirmation // from LTSY. //------------------------------------------------------------------------- iMockLTSY.NotifyTerminated(mockLtsyStatus); iMockLTSY.CompleteL(EMobileCallNotifyPrivacyConfirmation, KErrNone,data); User::WaitForRequest(mockLtsyStatus); ASSERT_EQUALS(KErrNone,mockLtsyStatus.Int()); AssertMockLtsyStatusL(); CleanupStack::PopAndDestroy(4, this); // data, mobileCall, line, this }
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; }
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; }
void CCTsySessionManagementFU::AuxOpenExisting3L(const TDesC &aName) { OpenEtelServerL(EUseExtendedError); CleanupStack::PushL(TCleanupItem(Cleanup,this)); OpenPhoneL(); TName lineName(aName); RLine line; TInt ret = line.Open(iPhone, lineName); ASSERT_EQUALS(KErrNone, ret); CleanupClosePushL(line); TName callname; RCall call; ret = OpenNewCall(line, call, lineName, callname); ASSERT_EQUALS(KErrNone, ret); CleanupClosePushL(call); // test on bad call name _LIT(KBadCallName, "BadCallName"); RCall call2; ret = call2.OpenExistingCall(line, KBadCallName); ASSERT_EQUALS(KErrNotFound, ret); AssertMockLtsyStatusL(); // test on bad line name _LIT(KBadLineName, "BadLineName"); TName name; name = KBadLineName; name.Append(KDoubleColon); name.Append(callname); ret = call2.OpenExistingCall(iPhone, name); ASSERT_EQUALS(KErrNotSupported, ret); AssertMockLtsyStatusL(); // test on bad call name and correct line name = lineName; name.Append(KDoubleColon); name.Append(KBadCallName); ret = call2.OpenExistingCall(iPhone, name); ASSERT_EQUALS(KErrNotFound, ret); AssertMockLtsyStatusL(); // test on bad phone name _LIT(KBadPhoneName, "BadPhoneName"); name = KBadPhoneName; name.Append(KDoubleColon); name.Append(lineName); name.Append(KDoubleColon); name.Append(callname); ret = call2.OpenExistingCall(iTelServer, name); ASSERT_EQUALS(KErrNotFound, ret); AssertMockLtsyStatusL(); // test on bad line name and correct phone name = KMmTsyPhoneName; name.Append(KDoubleColon); name.Append(KBadLineName); name.Append(KDoubleColon); name.Append(callname); ret = call2.OpenExistingCall(iTelServer, name); ASSERT_EQUALS(KErrNotSupported, ret); AssertMockLtsyStatusL(); // test on bad call name with correct phone and line name = KMmTsyPhoneName; name.Append(KDoubleColon); name.Append(lineName); name.Append(KDoubleColon); name.Append(KBadCallName); ret = call2.OpenExistingCall(iTelServer, name); ASSERT_EQUALS(KErrNotFound, ret); // test on string analyze _LIT(KBad, "::::::::"); name = KBad; ret = call2.OpenExistingCall(iTelServer, name); ASSERT_EQUALS(KErrNotFound, ret); AssertMockLtsyStatusL(); CleanupStack::PopAndDestroy(3, this); }
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; }
TInt CTestDriveDataCallCallBack::DriveETelApiL() /** * This method contains the real meat of the Client-side "Data Call dial-up networking * call-back" test code. This method sets up an outgoing data-call write test that is * terminated from the remote end. The test then quickly responds to an incoming call. * Data is received and the call is terminated again from the remote end. */ { _LIT(KDataLineName,"Data"); INFO_PRINTF1(_L("Opening Mobile Phone\n")); 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,KWriteTestCallBackData); 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,KWriteTestCallBackData); 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 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")); TESTL(call.LoanDataPort(commPort)==KErrNone); TESTL(cs.Connect()==KErrNone); TESTL(port.Open(cs,commPort.iPort,ECommShared)==KErrNone); port.Write(stat,KWriteTestCallBackData2); 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,KWriteTestCallBackData2); 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; iPhone.GetSignalStrength(stat,ss,bar); // mmPhone.GetSignalStrength(stat,ss,bar); User::WaitForRequest(stat); TESTL(stat==KErrNone); // close iPhone, line and call line.Close(); call.Close(); return KErrNone; }
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; }