telephonyserverplugins/multimodetsy/test/Te_LoopBack/Te_LoopBackCDataCallRemoteHangupDial.h
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 has the class definitions and scripts for the "Data Call answer and 
       
    15 // remote hang-up closely followed by a dial" Test in the ETel Regression test harness.
       
    16 // The call scripts are processed and handled by the emulator side of the test via the
       
    17 // scripting engine.  Each line in the script represents an action that the emulator must
       
    18 // take, either a receive action (which defines an expected string) or a transmit action with the
       
    19 // ASCII data to be sent.  See the description of the scripting language for more information.
       
    20 // 
       
    21 //
       
    22 
       
    23 /**
       
    24  @file
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #ifndef __CDATACALLREMOTEHANGUP_H__
       
    29 #define __CDATACALLREMOTEHANGUP_H__
       
    30 
       
    31 #include "Te_LoopbackTestStepBase.h"
       
    32 #include "Te_LoopBackScriptEng.h"
       
    33 
       
    34 _LIT8(KWriteTestRemoteHangupData,"ABCD\r\n");
       
    35 _LIT8(KWriteTestRemoteHangupData2,"EFGH\r\n");
       
    36 
       
    37 // KHangupDialDefVarDelay is the default Variable Delay value when the user did NOT enter a variable 
       
    38 // delay value to be used as a timeout by script processing when the iParam value is set -1 in a 
       
    39 // TScript script whose iCommand is an EWait.
       
    40 const TInt KHangupDialDefVarDelay=15;
       
    41 
       
    42 // KHangupDialMinVarDelay is Minimum Variable Delay value that can be input by the user as the timeout 
       
    43 // by script processing when iParam value is set -1 in a TScript script whose iCommand is an EWait.
       
    44 const TInt KHangupDialMinVarDelay=1;
       
    45 
       
    46 // KHangupDialMaxVarDelay is Maximum Variable Delay value that can be input by the user as the timeout 
       
    47 // by script processing when iParam value is set -1 in a TScript script whose iCommand is an EWait.
       
    48 const TInt KHangupDialMaxVarDelay=45;
       
    49 
       
    50 // KHangupDialMaxDigits is Maximum number of digits allowed to be entered by the operator when 
       
    51 // Variable Delay value that can be input by the user as the timeout by script
       
    52 // processing when the iParam value is set -1 in a TScript script whose iCommand is an EWait.
       
    53 const TInt KHangupDialMaxDigits=3;
       
    54 
       
    55 //
       
    56 // First a Script where everything is in order
       
    57 //
       
    58 const struct TScript KDataCallRemoteHangDialScript[]= {
       
    59 	{	ERxString,	(TText8*)"AT\r",		0, ERxEvent	},
       
    60 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
    61 
       
    62 	{	EIfRxStringJmp, (TText8*)"AT\r",	1, 0	},
       
    63 
       
    64 	{	ERxString, (TText8*)"AT+FCLASS=?",	0, ERxEvent	},
       
    65 	{	ETxString, (TText8*)"0,1,2\r",		0, ETxEvent|EFailIfTimeOut	},
       
    66 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
    67 
       
    68 //
       
    69 // The initialisation string - we don't care what it is
       
    70 //
       
    71 	{	ERxString, (TText8*)"AT",			0, ERxEvent	},
       
    72 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
    73 
       
    74 	{	ERxString, (TText8*)"AT+CNMI=,0",   0, ERxEvent	},
       
    75 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
    76 
       
    77 	{	ERxString, (TText8*)"ATS7?",		0, ERxEvent	},
       
    78 	{	ETxString, (TText8*)"050\r",		0, ETxEvent|EFailIfTimeOut	},
       
    79 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
    80 
       
    81 	{	ERxString, (TText8*)"ATS0=0",		0, ERxEvent	},
       
    82 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
    83 
       
    84 	{	ERxString, (TText8*)"AT+CGMI",	0, ERxEvent	},
       
    85 	{	ETxString, (TText8*)"ERICSSON\r",	0, ETxEvent|EFailIfTimeOut	},
       
    86 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
    87 
       
    88 	{	ERxString, (TText8*)"AT+CGMM",	0, ERxEvent	},
       
    89 	{	ETxString, (TText8*)"1100801\r",	0, ETxEvent|EFailIfTimeOut	},
       
    90 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
    91 
       
    92 	{	ERxString, (TText8*)"AT+CGMR",	0, ERxEvent	},
       
    93 	{	ETxString, (TText8*)"9808261341\r",	0, ETxEvent|EFailIfTimeOut	},
       
    94 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
    95 
       
    96 	{	ERxString, (TText8*)"AT+CGSN",	0, ERxEvent	},
       
    97 	{	ETxString, (TText8*)"520002512954000\r",	0, ETxEvent|EFailIfTimeOut	},
       
    98 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
    99 
       
   100 	{	ERxString, (TText8*)"AT+CIMI",	0, ERxEvent	},
       
   101 	{	ETxString, (TText8*)"ERROR\r",	0, ETxEvent|EFailIfTimeOut	},
       
   102 
       
   103 	{	ERxString, (TText8*)"AT+CMGF=?",	0, ERxEvent	},
       
   104 	{	ETxString, (TText8*)"+CMGF: (0)\r",	0, ETxEvent|EFailIfTimeOut	},
       
   105 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   106 
       
   107 	{	ERxString, (TText8*)"AT+CMGF=0",	0, ERxEvent	},
       
   108 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   109 
       
   110 	{	ERxString, (TText8*)"AT+CPMS=?",	0, ERxEvent	},
       
   111 	{	ETxString, (TText8*)"+CPMS: (\"ME\",\"SM\"),(\"ME\",\"SM\")\r",	0, ETxEvent|EFailIfTimeOut	},
       
   112 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   113 
       
   114 	{	ERxString, (TText8*)"AT+CPMS?",	0, ERxEvent	},
       
   115 	{	ETxString, (TText8*)"+CPMS: \"SM\",0,15,\"SM\",0,15\r",	0, ETxEvent|EFailIfTimeOut	},
       
   116 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   117 
       
   118 	{	ERxString, (TText8*)"AT+CPBS=?",	0, ERxEvent	},
       
   119 	{	ETxString, (TText8*)"+CPBS: (\"ME\",\"SM\")\r",	0, ETxEvent|EFailIfTimeOut	},
       
   120 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   121 
       
   122 	{	ERxString, (TText8*)"AT+CREG=0",	0, ERxEvent	},
       
   123 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   124 
       
   125 	{	ERxString, (TText8*)"AT+CREG=2",	0, ERxEvent	},
       
   126 	{	ETxString, (TText8*)"ERROR\r",		0, ETxEvent|EFailIfTimeOut	},
       
   127 
       
   128 	{	ERxString, (TText8*)"AT+CREG=1",	0, ERxEvent	},
       
   129 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   130 
       
   131 	{	ERxString, (TText8*)"AT+CREG?",	0, ERxEvent	},
       
   132 	{	ETxString, (TText8*)"ERROR\r",	0, ETxEvent|EFailIfTimeOut	},
       
   133 	
       
   134 	{	ERxString, (TText8*)"AT+CRC=1",		0, ERxEvent	},
       
   135 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   136 
       
   137 	{	ERxString, (TText8*)"AT+COPS?",	0, ERxEvent	},
       
   138 	{	ETxString, (TText8*)"+COPS: 0,0,\"UK VODAFONE\"\r",	0, ETxEvent|EFailIfTimeOut	},
       
   139 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   140 
       
   141 	{	ERxString, (TText8*)"AT+CBC",	0, ERxEvent	},
       
   142 	{	ETxString, (TText8*)"ERROR\r",		0, ETxEvent|EFailIfTimeOut	},
       
   143 
       
   144 	{	ERxString, (TText8*)"AT+CSQ",	0, ERxEvent	},
       
   145 	{	ETxString, (TText8*)"+CSQ: 31,99\r",		0, ETxEvent|EFailIfTimeOut	},
       
   146 	{	ETxStringOK, NULL,				0, ETxEvent|EFailIfTimeOut	},
       
   147 
       
   148 	{	ERxString, (TText8*)"AT+CGCLASS",	0, ERxEvent	},
       
   149 	{	ETxString, (TText8*)"ERROR\r",		0, ETxEvent|EFailIfTimeOut	},
       
   150 
       
   151 	{	ERxString, (TText8*)"AT+CGCLASS",	0, ERxEvent	},
       
   152 	{	ETxString, (TText8*)"ERROR\r",		0, ETxEvent|EFailIfTimeOut	},
       
   153 
       
   154 	{	ERxString, (TText8*)"AT+CGQREQ",	0, ERxEvent	},
       
   155 	{	ETxString, (TText8*)"ERROR\r",		0, ETxEvent|EFailIfTimeOut	},
       
   156 
       
   157 	{	ERxString, (TText8*)"AT+CGATT",	0, ERxEvent	},
       
   158 	{	ETxString, (TText8*)"ERROR\r",		0, ETxEvent|EFailIfTimeOut	},
       
   159 
       
   160 	{	ERxString, (TText8*)"AT+CNMI=?",	0, ERxEvent	},
       
   161 	{	ETxString, (TText8*)"+CNMI: (0-2),(0,1,3),(0),(0),(0,1)\r",	0, ETxEvent|EFailIfTimeOut	},
       
   162 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   163 
       
   164 	{	ERxString, (TText8*)"AT+CBST=?",	0, ERxEvent	},
       
   165 	{	ETxString, (TText8*)"+CBST: (0-7,12,14-16,34,36,38,39,43,47-51,65,66,68,70,71,75,79-81),(0,2),(1)\r",	0, ETxEvent|EFailIfTimeOut	},
       
   166 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   167 
       
   168 	{	ERxString, (TText8*)"AT+CSCA?",		0, ERxEvent	},
       
   169 	{	ETxString, (TText8*)"+CSCA: \"441632960000\",145",	0, ETxEvent|EFailIfTimeOut	},
       
   170 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   171 
       
   172 	{	ERxString, (TText8*)"AT+CGREG=1",	0, ERxEvent	},
       
   173 	{	ETxString, (TText8*)"ERROR\r",		0, ETxEvent|EFailIfTimeOut	},
       
   174 
       
   175 	{	ERxString, (TText8*)"AT*ECAM=1",	0, ERxEvent	},
       
   176 	{	ETxString, (TText8*)"ERROR\r",		0, ETxEvent|EFailIfTimeOut	},
       
   177 
       
   178 //
       
   179 // Initialisation complete.
       
   180 //
       
   181 // Now we simulate an incoming data call
       
   182 //
       
   183 	{	EWait,		NULL,					1,	ETimeOutEvent	},
       
   184 	{	ETxString, (TText8*)"\r\n+CRING: REL ASYNC\r\n",	0, ETxEvent|EFailIfTimeOut	},
       
   185 
       
   186 	{	ERxString, (TText8*)"AT+FCLASS=0",	0, ERxEvent	},
       
   187 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   188 
       
   189 	{	ERxString, (TText8*)"ATM0L0X3S8=0",	0, ERxEvent	},
       
   190 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   191 
       
   192 // This is the Data Init String
       
   193 	{	ERxString, (TText8*)"AT345678901234567890123456789012345678901234567890",	0, ERxEvent	},
       
   194 	{	ETxStringOK, NULL,						0, ETxEvent|EFailIfTimeOut	},
       
   195 	{	ERxString, (TText8*)"AT",			0, ERxEvent	},
       
   196 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   197 
       
   198 	{	ERxString, (TText8*)"ATA",			0, ERxEvent	},
       
   199 
       
   200 // Set signal for connection
       
   201 	{	ESignalMark, NULL,					KSignalDCD, 0	},
       
   202 	{	ETxString, (TText8*)"\r\nCONNECT 28800/ARQ/V34/LAPM/V42BIS\r\n", 0, ETxEvent|EFailIfTimeOut	},
       
   203 
       
   204 	{	ERxString, (TText8*)"ABCD\r\n",		0, ERxEvent	},
       
   205 	{	ERxString, (TText8*)"ABCD\r\n",		0, ERxEvent	},
       
   206 
       
   207 	{	ERxString, (TText8*)"AT",			0, ERxEvent	},
       
   208 	{	ERxString, (TText8*)"+++",			0, ERxEvent	},
       
   209 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   210 
       
   211 	{	ERxString, (TText8*)"AT",			0, ERxEvent	},
       
   212 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   213 
       
   214 // Simulate Remote hangup
       
   215 // Deassert signal for no-connection
       
   216 	{	ESignalSpace, NULL,					KSignalDCD, 0	},
       
   217 	{	ETxString, (TText8*)"NO CARRIER",	0, ETxEvent	},
       
   218 
       
   219 //
       
   220 //  A delay is performed at this point by the CTestDriveRemoteHangupDial::DriveETelApiL() method,
       
   221 //  ...and not by the scripts.
       
   222 //
       
   223 
       
   224 //
       
   225 //  Perform the Dial request
       
   226 //
       
   227 	{	ERxString, (TText8*)"AT+FCLASS=0",	0, ERxEvent	},
       
   228 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   229 
       
   230 // Note: Run another test where we ERROR this request
       
   231 	{	ERxString, (TText8*)"ATM0L0X3S8=0",	0, ERxEvent	},
       
   232 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   233 
       
   234 // This is the Data Init String
       
   235 	{	ERxString, (TText8*)"AT345678901234567890123456789012345678901234567890",	0, ERxEvent	},
       
   236 	{	ETxStringOK, NULL,						0, ETxEvent|EFailIfTimeOut	},
       
   237 
       
   238 // This is just another quick "AT", "OK" sequence to check we're still alright
       
   239 	{	ERxString, (TText8*)"AT",			0, ERxEvent	},
       
   240 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   241 
       
   242 // Issue the dial command and wait for connection
       
   243 	{	ERxString, (TText8*)"ATD+1234",		0, ERxEvent	},
       
   244 // Set signal for connection
       
   245 	{	ESignalMark, NULL,					KSignalDCD, 0	},
       
   246 	{	ETxString, (TText8*)"\r\nCONNECT 28800/ARQ/V34/LAPM/V42BIS\r\n", 0, ETxEvent|EFailIfTimeOut	},
       
   247 
       
   248 // This is the Data Xfer String
       
   249 	{	ERxString, (TText8*)"EFGH\r\n",		0, ERxEvent	},
       
   250 	{	ERxString, (TText8*)"EFGH\r\n",		0, ERxEvent	},
       
   251 
       
   252 	{	ERxString, (TText8*)"AT",			0, ERxEvent	},
       
   253 	{	ERxString, (TText8*)"+++",			0, ERxEvent	},
       
   254 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   255 
       
   256 // Simulate Remote hangup
       
   257 // Deassert signal for no-connection
       
   258 	{	ESignalSpace, NULL,					KSignalDCD, 0	},
       
   259 	{	ETxString, (TText8*)"NO CARRIER",	0, ETxEvent	},
       
   260 
       
   261 // Request for GSM Phone Signal Strength
       
   262 	{	ERxString, (TText8*)"AT+CSQ",		0, ERxEvent	},
       
   263 	{	ETxString, (TText8*)"+CSQ:31,99",	0, ETxEvent|EFailIfTimeOut	},
       
   264 	{	ETxStringOK, NULL,					0, ETxEvent|EFailIfTimeOut	},
       
   265 
       
   266 	{	EWait,		NULL,					2,	ETimeOutEvent	},
       
   267 	{	EComplete,	 NULL,					0, 0	}
       
   268 	};
       
   269 
       
   270 /**
       
   271  * This class is used by the client side of the test.  It contains the method DriveETelApi
       
   272  * which is the primary client side method.  This class inherits from the CTestBase class.
       
   273  * All client side test classes must contain these entries.
       
   274  */
       
   275 class CTestDriveRemoteHangupDial : public CTestBase
       
   276 	{
       
   277 public:
       
   278 	static CTestDriveRemoteHangupDial* NewL(const TScriptList aScriptListEntry, TInt aVarDelay);
       
   279 	// Called by the user interface from the C function PerformTestL.
       
   280 	virtual TInt RunTestL();
       
   281 
       
   282 protected:
       
   283 	// Called by the CTestBase::StartEmulator method to drive the ETel API.
       
   284 	virtual TInt DriveETelApiL();
       
   285 
       
   286 private:
       
   287 	CTestDriveRemoteHangupDial(const TScriptList aScriptListEntry, TInt aVarDelay);
       
   288 
       
   289 	TScriptList iScriptListEntry;	//< Initialized by the constructor, it records the enumerated
       
   290 									//< script entry number.
       
   291 	TInt        iVarDelay;			//< Variable delay value to be used as the timeout by the 
       
   292 									//< ...script processing when the iParam value is set -1 in 
       
   293 									//< ...a TScript script whose iCommand is an EWait.
       
   294 	};
       
   295 
       
   296 /**
       
   297  * This class is used by the emulator side of the test.  It implements several virtual functions
       
   298  * which are test specific and referenced by other classes.  This class inherits from the
       
   299  * CATScriptEng class.  All Emulator side test classes should have this structure.
       
   300  */
       
   301 class CTestRemoteHangupDial : public CATScriptEng
       
   302 	{
       
   303 public:
       
   304 	static CTestRemoteHangupDial* NewL(const TScript* aScript);
       
   305 	static CTestRemoteHangupDial* NewL(const TScript* aScript, const TInt aVarDelay);
       
   306 
       
   307 	// Called by the scripting engine to implement the EExecuteSpecial Command.
       
   308 	virtual void SpecificAlgorithmL(TInt aParam);
       
   309 
       
   310 	// Called by the scripting engine to end the execution of the script.
       
   311 	virtual void Complete(TInt aError);
       
   312 
       
   313 	// Called by the scripting engine to start the execution of the script.
       
   314 	virtual TInt Start();
       
   315 
       
   316 private:
       
   317 	CTestRemoteHangupDial(const TScript* aScript);
       
   318 	CTestRemoteHangupDial(const TScript* aScript, const TInt aVarDelay);
       
   319 	void ConstructL();
       
   320 
       
   321 	const TScript* iScript;			//< Pointer to the first line in the associated script.
       
   322 	};
       
   323 
       
   324 #endif