telephonyserverplugins/multimodetsy/test/Te_LoopBack/Te_LoopBackcvoicecall.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // This file implements voice call scenarios.
       
    15 // See CDataCall.cpp for fully documented test scenario.
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21 */
       
    22 
       
    23 
       
    24 #include <e32test.h>
       
    25 #include <mmretrieve.h>
       
    26 #include <etelmm.h>
       
    27 #include "Te_LoopBackcvoicecall.h"
       
    28 #include "../../hayes/TSYCONFG.H" // for KInternetAccessPoint
       
    29 
       
    30 
       
    31 //
       
    32 // Test-side class
       
    33 // With the assistance of the base class, this class must start the emulator
       
    34 // and drive the ETel API.
       
    35 //
       
    36 CTestDriveVoiceCall* CTestDriveVoiceCall::NewL(const TScriptList aScriptListEntry)
       
    37 	{
       
    38 	CTestDriveVoiceCall* aA = new(ELeave) CTestDriveVoiceCall(aScriptListEntry);
       
    39 	CleanupStack::PushL(aA);
       
    40 	aA->ConstructL();
       
    41 	CleanupStack::Pop();
       
    42 	return aA;
       
    43 	}
       
    44 
       
    45 CTestDriveVoiceCall::CTestDriveVoiceCall(const TScriptList aScriptListEntry) : 
       
    46 	iScriptListEntry(aScriptListEntry)	
       
    47 	{}
       
    48 
       
    49 TInt CTestDriveVoiceCall::RunTestL()
       
    50 	{
       
    51 	iCurrentScript = iScriptListEntry;
       
    52 	return StartEmulatorL();
       
    53 	}
       
    54 
       
    55 TInt CTestDriveVoiceCall::DriveETelApiL()
       
    56 //
       
    57 // This function contains the real meat of the Client-side test code
       
    58 //
       
    59 	{
       
    60 	_LIT(KPhoneName, "GsmPhone1");
       
    61 	_LIT(KLineName,  "Voice");
       
    62 
       
    63 	RMobilePhone mobilePhone;
       
    64 	TESTL(mobilePhone.Open(iServer, KPhoneName) == KErrNone);
       
    65 
       
    66 	RLine line;
       
    67 	INFO_PRINTF1(_L("Opening Voice Line\n"));
       
    68 	TESTL(line.Open(iPhone,KLineName) == KErrNone);
       
    69 
       
    70 	INFO_PRINTF1(_L("Opening New Voice Call\n"));
       
    71 	RCall call;
       
    72 	TESTL(call.OpenNewCall(line) == KErrNone);
       
    73 
       
    74 	INFO_PRINTF1(_L("Initialise the Phone...\n"));
       
    75 
       
    76 	TRequestStatus reqStatus;
       
    77 	RMobilePhone::TMMTableSettings tableSettings;
       
    78 	tableSettings.iLocId=KInternetAccessPoint;
       
    79 	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
       
    80 	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
       
    81 	User::WaitForRequest(reqStatus);
       
    82 	TESTL(reqStatus == KErrNone);
       
    83 
       
    84 	INFO_PRINTF1(_L("Dial a number...\n"));
       
    85 	_LIT(KDialString, "+1234");
       
    86 	TESTL(call.Dial(KDialString) == KErrNone);
       
    87 
       
    88 	INFO_PRINTF1(_L("Hangup a call...\n"));
       
    89 	TESTL(call.HangUp() == KErrNone);
       
    90 
       
    91 	// wait for an incoming call...
       
    92 	INFO_PRINTF1(_L("Answer an Incoming call...\n"));
       
    93 	TESTL(call.AnswerIncomingCall() == KErrNone);
       
    94 
       
    95 	INFO_PRINTF1(_L("Hangup a call...\n"));
       
    96 	TESTL(call.HangUp() == KErrNone);
       
    97 
       
    98 	// repeat the test asking for the signal strength during each request
       
    99 	INFO_PRINTF1(_L("Dial a number...\n"));
       
   100 	TESTL(call.Dial(KDialString) == KErrNone);
       
   101 
       
   102 	TRequestStatus requestStatus;
       
   103 	TInt32         signalStrength;
       
   104 	TInt8          bar;
       
   105 
       
   106 	INFO_PRINTF1(_L("Retrieve Signal Strength...\n"));
       
   107 	mobilePhone.GetSignalStrength(requestStatus, signalStrength, bar);
       
   108 	User::WaitForRequest(requestStatus);
       
   109 	TESTL(requestStatus == KErrNone);
       
   110 
       
   111 	INFO_PRINTF1(_L("Hangup a call...\n"));
       
   112 	TESTL(call.HangUp() == KErrNone);
       
   113 
       
   114 	INFO_PRINTF1(_L("Retrieve Signal Strength...\n"));
       
   115 	mobilePhone.GetSignalStrength(requestStatus, signalStrength, bar);
       
   116 	User::WaitForRequest(requestStatus);
       
   117 	TESTL(requestStatus == KErrNone);
       
   118 
       
   119     // wait for an incoming call...
       
   120 	INFO_PRINTF1(_L("Answer an Incoming call...\n"));
       
   121 	TESTL(call.AnswerIncomingCall() == KErrNone);
       
   122 
       
   123 	INFO_PRINTF1(_L("Retrieve Signal Strength...\n"));
       
   124 	mobilePhone.GetSignalStrength(requestStatus, signalStrength, bar);
       
   125 	User::WaitForRequest(requestStatus);
       
   126 	TESTL(requestStatus == KErrNone);
       
   127 
       
   128 	INFO_PRINTF1(_L("Hangup a call...\n"));
       
   129 	TESTL(call.HangUp() == KErrNone);
       
   130 
       
   131 	INFO_PRINTF1(_L("Retrieve Signal Strength...\n"));
       
   132 	mobilePhone.GetSignalStrength(requestStatus, signalStrength, bar);
       
   133 	User::WaitForRequest(requestStatus);
       
   134 	TESTL(requestStatus == KErrNone);
       
   135 
       
   136 	INFO_PRINTF1(_L("Close the call, line & iPhone...\n"));
       
   137 	call.Close();
       
   138 	line.Close();
       
   139 	mobilePhone.Close();
       
   140 
       
   141 	return (KErrNone);
       
   142 	}
       
   143 
       
   144 //
       
   145 // Emulator-side class
       
   146 // With the assistance of the base class, this class must run the designated script
       
   147 //
       
   148 CTestVoiceCall* CTestVoiceCall::NewL(const TScript* aScript)
       
   149 	{
       
   150 	CTestVoiceCall* aA = new(ELeave) CTestVoiceCall(aScript);
       
   151 	CleanupStack::PushL(aA);
       
   152 	aA->ConstructL();
       
   153 	CleanupStack::Pop();
       
   154 	return aA;
       
   155 	}
       
   156 
       
   157 CTestVoiceCall::CTestVoiceCall(const TScript* aScript) : iScript(aScript)
       
   158 	{}
       
   159 
       
   160 void CTestVoiceCall::ConstructL()
       
   161 	{
       
   162 	CATScriptEng::ConstructL();
       
   163 	}
       
   164 
       
   165 TInt CTestVoiceCall::Start()
       
   166 	{
       
   167 	StartScript(iScript);
       
   168 	return KErrNone;
       
   169 	}
       
   170 
       
   171 void CTestVoiceCall::SpecificAlgorithmL(TInt /* aParam */)
       
   172 	{
       
   173 	}
       
   174 
       
   175 void CTestVoiceCall::Complete(TInt aError)
       
   176 	{
       
   177 	iReturnValue = aError;
       
   178 	CActiveScheduler::Stop();
       
   179 	}