telephonyserverplugins/simtsy/test/Te_Sim/Te_SimIncomingDataTest.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "Te_SimIncomingDataTest.h"
       
    17 
       
    18 CSimIncomingDataTest::CSimIncomingDataTest() 
       
    19 	{ 
       
    20 	SetTestStepName(_L("IncomingDataTest"));
       
    21 	}
       
    22 
       
    23 TVerdict CSimIncomingDataTest::doTestStepL()
       
    24 	{
       
    25 	INFO_PRINTF1(_L("BeginIncomingDataTest"));
       
    26 
       
    27  	CreateConfigFileL(_L("c:\\config3.txt"));
       
    28  	SetTestNumberL(0);
       
    29 
       
    30 	StartNTRasSimulation();
       
    31 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
    32 	INFO_PRINTF2(_L("Result: %d"),ret); 
       
    33 	TESTL(ret == KErrNone); 
       
    34 	INFO_PRINTF1(_L("Opened phone object"));
       
    35 
       
    36 	TESTL(iPhone.Initialise()==KErrNone);
       
    37 	INFO_PRINTF1(_L("Opened phone object"));
       
    38 
       
    39 	TESTL(iLine.Open(iPhone,KDataLineName)==KErrNone);
       
    40 	INFO_PRINTF1(_L("Opened Line object"));
       
    41 
       
    42 	TName callName;
       
    43 	TESTL(iCall.OpenNewCall(iLine,callName)==KErrNone);
       
    44 	INFO_PRINTF1(_L("Opened Call object"));
       
    45 
       
    46 	INFO_PRINTF1(_L("Get DataCall Capabilities"));
       
    47 	RMobileCall::TMobileCallDataCapsV1 callCaps;
       
    48 	RMobileCall::TMobileCallDataCapsV1Pckg callCapsPckg(callCaps);
       
    49 	TESTL(iCall.GetMobileDataCallCaps(callCapsPckg)==KErrNone);
       
    50 	 
       
    51 	INFO_PRINTF1(_L("Get DataCall RLP Range"));
       
    52 	TRequestStatus stat0;
       
    53 	RMobileCall::TMobileDataRLPRangesV1 rlp;
       
    54 	RMobileCall::TMobileDataRLPRangesV1Pckg rlpPckg(rlp);
       
    55 	iCall.GetMobileDataCallRLPRange(stat0,1,rlpPckg);
       
    56 	User::WaitForRequest(stat0);
       
    57 	TESTL(stat0==KErrNone);
       
    58 	
       
    59 	INFO_PRINTF1(_L("Get DataCall Hscsd information"));
       
    60 	RMobileCall::TMobileCallHscsdInfoV1 info;
       
    61 	RMobileCall::TMobileCallHscsdInfoV1Pckg infoPckg(info);
       
    62 	TESTL(iCall.GetCurrentHscsdInfo(infoPckg)==KErrNone);
       
    63 
       
    64 	TRequestStatus reqStatus0, reqStatus1;
       
    65 	RMobileCall::TMobileCallStatus lineStatus;
       
    66 	iLine.NotifyMobileLineStatusChange(reqStatus0,lineStatus);
       
    67 
       
    68 	TName incomingCallName;
       
    69 	iLine.NotifyIncomingCall(reqStatus1,incomingCallName);
       
    70 
       
    71 	TInt state = 999;
       
    72 	INFO_PRINTF1(_L("Testing the Publish & Subscribe..."));
       
    73 	RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyIncomingDataCall, state);
       
    74 	
       
    75 	User::WaitForRequest(reqStatus1);
       
    76 	if(reqStatus1!=KErrNone)
       
    77 		{
       
    78 		INFO_PRINTF1(_L("Incoming data call test failed..."));
       
    79 		TESTL(reqStatus1==KErrNone);		// Force a failure...
       
    80 		}
       
    81 	CHECKPOINTL(reqStatus1,KErrNone,CHP_DATA_CASE("B.4"));
       
    82 
       
    83 	User::WaitForRequest(reqStatus0);
       
    84 	TESTL(reqStatus0==KErrNone);
       
    85 	TESTL(lineStatus==RMobileCall::EStatusRinging);
       
    86 
       
    87 	TESTL(iCallAnswer.OpenExistingCall(iLine,incomingCallName)==KErrNone);
       
    88 
       
    89 	INFO_PRINTF1(_L("Answering incoming call..."));
       
    90 	RMobileCall::TMobileHscsdCallParamsV1 mobileCallParams;
       
    91 	RMobileCall::TMobileHscsdCallParamsV1Pckg mobileCallParamsPckg(mobileCallParams);
       
    92 
       
    93 	mobileCallParams.iSpeakerControl=RCall::EMonitorSpeakerControlOnExceptDuringDialling;
       
    94 	mobileCallParams.iSpeakerVolume=RCall::EMonitorSpeakerVolumeUnknown;
       
    95 	mobileCallParams.iWaitForDialTone=RCall::EDialToneNoWait;
       
    96 	mobileCallParams.iInterval=5678;
       
    97 	mobileCallParams.iAutoRedial=ETrue;
       
    98 	mobileCallParams.iCug.iCugIndex=99;
       
    99 	mobileCallParams.iIdRestrict=RMobileCall::ESendMyId;
       
   100 	mobileCallParams.iWantedAiur=RMobileCall::EAiurBps9600;
       
   101 	mobileCallParams.iWantedRxTimeSlots=5;
       
   102 	mobileCallParams.iMaxTimeSlots=30;
       
   103 	mobileCallParams.iCodings=RMobileCall::ETchCoding48;
       
   104 
       
   105 	TESTL(iCallAnswer.AnswerIncomingCall(mobileCallParamsPckg)==KErrNone);
       
   106 	INFO_PRINTF1(_L("Connected"));
       
   107 
       
   108 	RCall::TStatus callStatus;
       
   109 	TESTL(iCallAnswer.GetStatus(callStatus)==KErrNone);
       
   110 	TESTL(callStatus==RCall::EStatusConnected);
       
   111 
       
   112 	INFO_PRINTF1(_L("Checking Call Params"));	
       
   113 	RMobileCall::TMobileHscsdCallParamsV1 mobileCallParams2;
       
   114 	RMobileCall::TMobileHscsdCallParamsV1Pckg mobileCallParams2Pckg(mobileCallParams2);
       
   115 	TESTL(iCallAnswer.GetCallParams(mobileCallParams2Pckg)==KErrNone);
       
   116 	TESTL(mobileCallParams2.iSpeakerControl==RCall::EMonitorSpeakerControlOnExceptDuringDialling);
       
   117 	TESTL(mobileCallParams2.iSpeakerVolume==RCall::EMonitorSpeakerVolumeUnknown);
       
   118 	TESTL(mobileCallParams2.iWaitForDialTone==RCall::EDialToneNoWait);
       
   119 	TESTL(mobileCallParams2.iInterval==5678);
       
   120 
       
   121 	INFO_PRINTF1(_L("Notification for Hscsd info changes"));
       
   122 	iCall.NotifyHscsdInfoChange(reqStatus1,infoPckg);
       
   123 	 
       
   124 	INFO_PRINTF1(_L("Set DataCall Hscsd Dynamic Parameters"));
       
   125 	iCall.SetDynamicHscsdParams(reqStatus0,RMobileCall::EAiurBps57600, 15);
       
   126 	User::WaitForRequest(reqStatus0);	
       
   127 	TESTL(reqStatus0==KErrNone);
       
   128 	User::WaitForRequest(reqStatus1);	
       
   129 	TESTL(reqStatus1==KErrNone);
       
   130 	INFO_PRINTF1(_L("Completed notification..."));
       
   131 
       
   132 	INFO_PRINTF1(_L("Hanging up..."));
       
   133 	TESTL(iCallAnswer.HangUp()==KErrNone);
       
   134 	INFO_PRINTF1(_L("Disconnected"));
       
   135 
       
   136 	TESTL(iCallAnswer.GetStatus(callStatus)==KErrNone);
       
   137 	TESTL(callStatus==RCall::EStatusIdle);
       
   138 
       
   139 	INFO_PRINTF1(_L("Closing objects..."));
       
   140 
       
   141 	iCallAnswer.Close();
       
   142 	iCall.Close();
       
   143 	iLine.Close();
       
   144    	iPhone.Close();
       
   145 	ASSERT(RThread().RequestCount()==0);
       
   146 
       
   147 	return TestStepResult();
       
   148 	}
       
   149