telephonyserverplugins/multimodetsy/test/Te_LoopBack/Te_LoopBackATIO.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 defines classes to handle serial port input/output and implement 
       
    15 // the "expect string" handling.  These "expect strings" are strings 
       
    16 // that are expected to be received on the serial line with the 
       
    17 // relevant callbacks.  This is a portion of code that has been reused
       
    18 // from the GSM TSY.  In this component, it is a bit like taking a 
       
    19 // sledgehammer to crack a nut, but it does do the job. 
       
    20 // 
       
    21 //
       
    22 
       
    23 /**
       
    24  @file
       
    25  @note  There are mulitple classes implemented in this file.
       
    26  @note  These classes are CCompletionEntry and CATIO
       
    27 */
       
    28 
       
    29 #include "Te_LoopBackATIO.H"
       
    30 #include "Te_LoopBackATBASE.H"
       
    31 #include "Te_LoopBackSLOGGER.H"
       
    32 
       
    33 CCompletionEntry* CCompletionEntry::NewL(CCommChatString* aCs,	CATBase* aAtCommand)
       
    34 /**
       
    35  * This method creates an instance of CCompletionEntry.
       
    36  *
       
    37  * @param aCS: pointer to expected string response from the GSM TSY.
       
    38  * @param aAtCommand: pointer to the script engine processing the line of script.
       
    39  * @leave Leaves if out-of-memory.
       
    40  * @return pointer to the instance of "CCompletionEntry".
       
    41  */
       
    42 	{
       
    43 	return new(ELeave) CCompletionEntry(aCs,aAtCommand);
       
    44 	}
       
    45 
       
    46 CCompletionEntry::CCompletionEntry(CCommChatString* aCs, CATBase* aAtCommand) : iCs(aCs), iAtCommand(aAtCommand)
       
    47 /**
       
    48  * This method is the constructor for CCompletionEntry.
       
    49  *
       
    50  * @param aCS: pointer to expected string response from the GSM TSY.
       
    51  * @param aAtCommand: pointer to the script engine processing the line of script.
       
    52  * @note Initializes private data "iCs" and "iAtCommand" to received parameters.
       
    53  */
       
    54 	{}
       
    55 
       
    56 CCompletionEntry::~CCompletionEntry()
       
    57 /**
       
    58  * This method is the Destructor for CCompletionEntry.
       
    59  */
       
    60 	{}
       
    61 
       
    62 //
       
    63 // CATIo
       
    64 //
       
    65 CATIO* CATIO::NewL(const TDesC& aCsy, const TDesC& aPort)
       
    66 /**
       
    67  * 2 Phase Constructor
       
    68  *
       
    69  * This method creates an instance of CATIO.
       
    70  *
       
    71  * @param aCsy: reference to a DLL name of the CSY.
       
    72  * @param aPort: reference to the port name.
       
    73  * @leave Leaves if out-of-memory.
       
    74  * @return pointer to the instance of "CATIO".
       
    75  */
       
    76 	{
       
    77 	CATIO* atIo=new(ELeave) CATIO();
       
    78 	CleanupStack::PushL(atIo);
       
    79 	atIo->ConstructL(aCsy,aPort);
       
    80 	CleanupStack::Pop();
       
    81 	return atIo;
       
    82 	}
       
    83 
       
    84 CATIO::CATIO()
       
    85 /**
       
    86  * This method is the constructor for CATIO.  Private data is initialized and 
       
    87  * a new value for the byte offset into the class for member data iLink is retrieved.
       
    88  */
       
    89 	{
       
    90 	__DECLARE_NAME(_S("CATIO"));
       
    91 	iExpectList.SetOffset(_FOFF(CCompletionEntry,iLink));
       
    92 	iReadPending=EFalse;
       
    93 	iWritePending=EFalse;
       
    94 	iWaitTimerPending=EFalse;
       
    95 	}
       
    96 
       
    97 void CATIO::ConstructL(const TDesC& aCsy, const TDesC& aPort)
       
    98 /**
       
    99  * This method is used to implement the 2 Phase Constructor for CATIO.
       
   100  * This method sets up new iCommReader and iCommWriter data for CATIO.
       
   101  * It also sets up a new iChat for and creates the buffer for iChat.
       
   102  * The Comm port indicated by the DLL and port name is then opened with 
       
   103  * as a shared resource.
       
   104  *
       
   105  * @param   aCsy:  reference to a DLL name of the CSY.
       
   106  * @param   aPort: reference to the port name.
       
   107  * @leave  Leaves if comm port can not be opened or if out-of-memory when creating other objects.
       
   108  * @return	pointer to the instance of "CATIO".
       
   109  */
       
   110 	{
       
   111 	CommConstructL(KCommReadPriority,KCommWritePriority);
       
   112 	iChat = new (ELeave) CCommChatter(this, KChatterPriority);
       
   113 	iChat->CreateL(KChatBufferSize);
       
   114  	User::LeaveIfError(CommOpen(aCsy, aPort, ECommShared));
       
   115 	iChatStringFound= new(ELeave) CArrayFixFlat<CCommChatString*>(5);
       
   116 	}
       
   117 
       
   118 CATIO::~CATIO()
       
   119 /**
       
   120  * This method is used to delete the instantion of CATIO.  This method 
       
   121  * initiates the removal of the intantiations of iChatStringFound and iChat 
       
   122  * that were created for this CATIO. 
       
   123  *
       
   124  * @param   None.
       
   125  * @return	None.
       
   126  * @note	None.
       
   127  */
       
   128 	{
       
   129 	delete iChatStringFound;
       
   130 	delete iChat;
       
   131 	}
       
   132 
       
   133 TInt CATIO::ConfigurePort(TCommConfig aConfiguration)
       
   134 /**
       
   135  * This method is used to update the comm port configuration with data received 
       
   136  * from the input parameter.
       
   137  *
       
   138  * @param   aConfiguration: reference to port configuration data.
       
   139  * @return	error value for attempt to configure port.
       
   140  */
       
   141 	{
       
   142 	TInt ret;
       
   143 	TCommConfig cbuf;
       
   144 	TCommConfigV01 &cfg=cbuf();
       
   145 	iCommPort.Config(cbuf);				// Get the Configuration
       
   146 
       
   147 	// overwrite port configuration with input configuration
       
   148 	TCommConfigV01 &newCfg=aConfiguration();
       
   149 	cfg.iRate=newCfg.iRate;
       
   150 	cfg.iDataBits=newCfg.iDataBits;
       
   151 	cfg.iStopBits=newCfg.iStopBits;
       
   152 	cfg.iParity=newCfg.iParity;
       
   153 	cfg.iHandshake=newCfg.iHandshake;
       
   154 	ret = iCommPort.SetConfig(cbuf);		// Set the Configuration
       
   155 	if(ret!=KErrNone)
       
   156 		{
       
   157 		LOGTEXT2(_L8("CATIO:\tError %d configuring port"),ret);
       
   158 		return ret;
       
   159 		}
       
   160 	return KErrNone;
       
   161 	}
       
   162 
       
   163 TInt CATIO::Start(CATBase* aCompletionClass)
       
   164 /**
       
   165  * This method is used to make sure the comm port is ready and a read is outstanding on 
       
   166  * the comm port.  This is done by making sure the comm port is initialized for both read 
       
   167  * and write capabilities.  After the comm port is initialized for read and write, a read
       
   168  * is posted to the comm port to have a read outstanding for CATIO.
       
   169  *
       
   170  * @param   aCompletionClass: pointer to a CATBase class indicating port and data.
       
   171  * @return	error value for attempt to read port.
       
   172  */
       
   173 	{
       
   174 	iControllingClass=aCompletionClass;
       
   175 	CommReadReady();
       
   176 	LOGTEXT(_S8("CATIO::Start() - ReadReady Completed"));
       
   177 	CommWriteReady();
       
   178 	LOGTEXT(_S8("CATIO::Start() - WriteReady Completed"));
       
   179 	return Read();
       
   180 	}
       
   181 
       
   182 void CATIO::GetExcessData(TDes8& aBuffer)
       
   183 /**
       
   184  * This function is currently not used by the Etel regression test harness.
       
   185  */
       
   186 	{
       
   187 	TPtrC8 des(iRxBuf.Ptr()+iRxBufOffset, iRxBuf.Length()-iRxBufOffset);
       
   188 	aBuffer.Copy(des);
       
   189 	}
       
   190 
       
   191 void CATIO::MarkRxBuffer(TInputBufferMark& aBufferMarker)
       
   192 /**
       
   193  * Set markers for last character received from the GSM TSY.
       
   194  *
       
   195  * @param   aBufferMark: reference to markers in buffer for last character received from comm port.
       
   196  * @return	None.
       
   197  */
       
   198 	{
       
   199 	iChat->GetChatBufferMarker(aBufferMarker);
       
   200 	}
       
   201 
       
   202 TPtrC8 CATIO::GetRxBufferLC(TInputBufferMark& aBufferMarker)
       
   203 /**
       
   204  * This function is currently not used by the Etel regression test harness.
       
   205  *
       
   206  * @note: This function is designed to return a descriptor for the buffer between the
       
   207  *        marker passed as a parameter and the current append marker.
       
   208  */
       
   209 	{
       
   210 	return iChat->GetChatBufferLC(aBufferMarker);
       
   211 	}
       
   212 
       
   213 void CATIO::CommReadComplete(TInt aStatus)
       
   214 /**
       
   215  * This method is invoked by the RunL of the active object to complete a read.
       
   216  * When read complete is for KErrCommsLineFail, then a check will be made to make sure 
       
   217  * there have been 2 KErrCommsLineFail's in succession before signaling the line error.
       
   218  * When no errors or 1st KErrCommsLineFail, call ProcessReadCharsL to process the 
       
   219  * characters read from the comm port.  If an error occurs processing the comm port
       
   220  * read buffer characters, the ProcessReadCharsL method will leave and will be trapped
       
   221  * in this function and the call is canceled.
       
   222  *
       
   223  * @param   aStatus: status from server indicating why read completed.
       
   224  * @return	None.
       
   225  */
       
   226 	{
       
   227 	LOGTEXT(_S8("CATIO Read Completion"));
       
   228 	__ASSERT_ALWAYS(iReadPending,HayesPanic(EATCommand_IllegalCompletionReadNotExpected));
       
   229 //	if(!iReadPending)
       
   230   //
       
   231 	//	{
       
   232 	//	SignalCommandsWithError(KErrIllegalReadComplete);
       
   233 	//	return;
       
   234 	//	}
       
   235 	if (aStatus==KErrCommsLineFail)
       
   236 		{
       
   237 		if (iSecondChanceForCommsError++!=1)	
       
   238 			aStatus=KErrNone;		// only signal error if get 2 KErrCommsLineFail's in succession
       
   239 		else
       
   240 			iSecondChanceForCommsError=0;
       
   241 		}
       
   242 	if (aStatus!=KErrNone)
       
   243 		{
       
   244 		SignalCommandsWithError(aStatus);
       
   245 		return;
       
   246 		}
       
   247 	iReadPending = EFalse;
       
   248 	TRAPD(ret,ProcessReadCharsL());
       
   249 	if(ret!=KErrNone)
       
   250 		{
       
   251 		Cancel();	// This error cannot be related to a command - so they'll all be cleaned up.
       
   252 		iChat->DeleteAllAndStop();
       
   253 		}
       
   254 	}
       
   255 
       
   256 void CATIO::SignalCommandsWithError(TInt aStatus)
       
   257 //
       
   258 //	Complete all current AT commands with the error and call the error handler
       
   259 //
       
   260 /**
       
   261  * This method is invoked when an error is detected.  All current strings with the
       
   262  * error are removed and iControllingClass->GenericEventSignal method is called to
       
   263  * signal EReadCompletion.
       
   264  *
       
   265  * @param   aStatus: status indicating error of the read.
       
   266  * @return	None.
       
   267  */
       
   268 	{	
       
   269 	LOGTEXT2(_L8("Received an error of %d"),aStatus);
       
   270 	Cancel();
       
   271 	CCompletionEntry* ce;
       
   272 	TDblQueIter<CCompletionEntry> iter(iExpectList);
       
   273 	while (ce = iter, ce!=NULL)
       
   274 		{
       
   275 		ce->iAtCommand->GenericEventSignal(EReadCompletion,aStatus);
       
   276 		iter.SetToLast();
       
   277 		CCompletionEntry* removeSimilar;
       
   278 		while (removeSimilar=iter--, removeSimilar!=ce)
       
   279 			{
       
   280 			if(removeSimilar->iAtCommand==ce->iAtCommand)
       
   281 				{
       
   282 				iChat->RemoveString(removeSimilar->iCs);
       
   283 				delete removeSimilar->iCs;
       
   284 				removeSimilar->iLink.Deque();
       
   285 				delete removeSimilar;
       
   286 				}
       
   287 			}
       
   288 		iChat->RemoveString(ce->iCs);
       
   289 		delete ce->iCs;
       
   290 		ce->iLink.Deque();
       
   291 		delete ce;
       
   292 		iter.SetToFirst();
       
   293 		}
       
   294 	if(iControllingClass!=NULL)
       
   295 		iControllingClass->GenericEventSignal(EReadCompletion,aStatus);
       
   296 	}
       
   297 
       
   298 void CATIO::ProcessReadCharsL()
       
   299 /**
       
   300  * This method processes the characters read from the comm port. It uses 
       
   301  * these characters to lookup any string from the script to complete.
       
   302  * If the string to complete is not found, this method will leave.
       
   303  * If the string to complete is found, a read complete is signaled and 
       
   304  * another read is queued.  
       
   305  * 
       
   306  * @leave Leaves if string to complete is not found in the expected list.
       
   307  */
       
   308 	{
       
   309 	LOGTEXT3(_L8("Rx:\t(%d) %S"),iRxBuf.Length(),&iRxBuf);
       
   310 	LOGTEXTREL2(_L8("Rx:\t%S"),&iRxBuf);
       
   311 
       
   312 	TBool hitFlag=EFalse;
       
   313 	TInt len;
       
   314 
       
   315 	for (iRxBufOffset=0; iRxBufOffset<iRxBuf.Length(); iRxBufOffset++)
       
   316 		{
       
   317 		iChat->AddCharL(iRxBuf[iRxBufOffset]);
       
   318 // Check for hits and one up-call per hit NOW
       
   319 		if((len=iChatStringFound->Count())>0)
       
   320 			{
       
   321 			for(TInt i=0;i<len;i++)
       
   322 				{
       
   323 				hitFlag=ETrue;
       
   324 // Find the string to complete
       
   325 				CCompletionEntry* ce;
       
   326 				TDblQueIter<CCompletionEntry> iter(iExpectList);
       
   327 				TBool aFoundFlag=EFalse;
       
   328 				while (ce = iter++, ce!=NULL)
       
   329 					{
       
   330 					if(ce->iCs==iChatStringFound->At(i))
       
   331 						{
       
   332 						iCurrentFoundChatString=ce->iCs;
       
   333 						ce->iAtCommand->GenericEventSignal(EReadCompletion,KErrNone);
       
   334 						aFoundFlag=ETrue;
       
   335 						break;
       
   336 						}
       
   337 					}
       
   338 				if(!aFoundFlag)
       
   339 					{
       
   340 					LOGTEXT(_S8("CATIO Internal Error - Chat String signalled, but not found"));
       
   341 					User::Leave(KErrGeneral);
       
   342 					}
       
   343 				}
       
   344 			iChatStringFound->Delete(0,iChatStringFound->Count());
       
   345 			}
       
   346 		}
       
   347 	if(hitFlag)
       
   348 		{
       
   349 		//iReadPending=EFalse;		  
       
   350 		Read();							// Queue Another...
       
   351 		}
       
   352 	else
       
   353 		{
       
   354 		iReadPending = ETrue;
       
   355 		CommReadOneOrMore(iRxBuf);
       
   356 		}
       
   357 	}
       
   358 
       
   359 CCommChatString* CATIO::FoundChatString()
       
   360 /**
       
   361  * This returns a pointer to the string from the script to complete.
       
   362  * 
       
   363  * @param   None.
       
   364  * @return	pointer to CComChatString containing string to complete..
       
   365  */
       
   366 	{
       
   367 	return iCurrentFoundChatString;
       
   368 	}
       
   369 
       
   370 CCommChatString* CATIO::AddExpectString(CATBase* aATBase, const TDesC8& aString)
       
   371 /**
       
   372  * This method is used to instantiate a CCompletionEntry object with a
       
   373  * CCommChatString object containing the expected string to complete the
       
   374  * string from the GSM TSY.  This CCompletionEntry is then added to 
       
   375  * the end of the expected list of strings from the GSM TSY.
       
   376  *
       
   377  * @param aATBase: pointer to the script engine processing the line of script.
       
   378  * @param aString: reference to the expected string for aATBase to be returned from the GSM TSY.
       
   379  * @return pointer to the chat string used in the instatiated CCompletionEntry.
       
   380  */
       
   381 	{
       
   382 	CCommChatString* cs=iChat->AddString(aString);
       
   383 	CCompletionEntry* completionEntry=NULL;
       
   384 	TRAP_IGNORE(completionEntry=CCompletionEntry::NewL(cs,aATBase));		// TRAP but ignore error
       
   385 	if(completionEntry)
       
   386 		iExpectList.AddLast(*completionEntry);
       
   387 	return cs;
       
   388 	}
       
   389 
       
   390 void CATIO::RemoveExpectString(CCommChatString* aExpectString)
       
   391 /**
       
   392  * This method uses the CCommChatString input parameter to remove a single 
       
   393  * CCompletionEntry from the list of expected completion strings.
       
   394  *
       
   395  * @param aExpectString: reference to the string in the list of expected string returned from the GSM TSY.
       
   396  */
       
   397 	{
       
   398 // Find the AT Command to complete
       
   399 	CCompletionEntry* ce;
       
   400 	TDblQueIter<CCompletionEntry> iter(iExpectList);
       
   401 	while (ce = iter++, ce!=NULL)
       
   402 		{
       
   403 		if(ce->iCs==aExpectString)
       
   404 			{
       
   405 			iChat->RemoveString(ce->iCs);
       
   406 			delete ce->iCs;
       
   407 			ce->iLink.Deque();
       
   408 			delete ce;
       
   409 			break;
       
   410 			}
       
   411 		}
       
   412 	}
       
   413 
       
   414 void CATIO::RemoveExpectStrings(CATBase* aATBase)
       
   415 /**
       
   416  * This method uses the CATBase input parameter to remove all of the 
       
   417  * CCompletionEntry(s) that have the same CATBase-derived callback class
       
   418  * from the list of expected completion strings.
       
   419  *
       
   420  * @param aTBase: reference to the string in the list of expected string returned from the GSM TSY.
       
   421  */
       
   422 	{
       
   423 // Find the AT Command to complete
       
   424 	CCompletionEntry* ce;
       
   425 	TDblQueIter<CCompletionEntry> iter(iExpectList);
       
   426 	while (ce = iter++, ce!=NULL)
       
   427 		{
       
   428 		if(ce->iAtCommand==aATBase)
       
   429 			{
       
   430 			iChat->RemoveString(ce->iCs);
       
   431 			delete ce->iCs;
       
   432 			ce->iLink.Deque();
       
   433 			delete ce;
       
   434 			}
       
   435 		}
       
   436 	}
       
   437 
       
   438 void CATIO::CommWriteComplete(TInt aStatus)
       
   439 /**
       
   440  * This method is used to indicate a write to the comm port has completed.
       
   441  * The timer is stopped and if a write is NOT pending, then PANIC.
       
   442  * Set the write pending flag to EFalse and signal the write completion event 
       
   443  * with the status from the input parameter.
       
   444  * 
       
   445  * @param aStatus: status indicating reason for write complete.
       
   446  */
       
   447 	{
       
   448 	LOGTEXT(_S8("CATIO Comm Write Completion"));
       
   449 	iChat->StopTimer();
       
   450 	__ASSERT_ALWAYS(iWritePending,HayesPanic(EATCommand_IllegalCompletionWriteNotExpected));
       
   451 	iWritePending=EFalse;
       
   452 	iWriteCommand->GenericEventSignal(EWriteCompletion,aStatus);
       
   453 	}
       
   454 
       
   455 void CATIO::ChatStringMatchL(CCommChatString* aCs)
       
   456 /**
       
   457  * This method is used to append the input string onto a list of found strings.
       
   458  * 
       
   459  * @param aCs: pointer to the chat string matched.
       
   460  * @leave Leaves if can not place string on end of found string list.
       
   461  */
       
   462 	{
       
   463 	LOGTEXT(_S8("CATIO Found Match."));
       
   464 	iStringFound=ETrue;
       
   465 	iChatStringFound->AppendL(aCs);
       
   466 	}
       
   467 
       
   468 void CATIO::ChatTimeout()
       
   469 /**
       
   470  * This method is used to indicate a chat time-out has completed.
       
   471  * If a timer is NOT pending, then PANIC.  When the timer is pending, 
       
   472  * set the timer pending flag to EFalse and signal the timeout completion event.
       
   473  */
       
   474 	{
       
   475 	LOGTEXT(_S8("CATIO Chat Time-out Completion"));
       
   476 	if(iWaitTimerPending)
       
   477 		{
       
   478 		iWaitTimerPending=EFalse;
       
   479 		iTimeOutCommand->GenericEventSignal(ETimeOutCompletion,KErrNone);
       
   480 		}
       
   481 	else
       
   482 		HayesPanic(EATCommand_IllegalWaitCompletion);
       
   483 	}
       
   484 
       
   485 void CATIO::SetTimeOut(CATBase* aCompletionClass, TUint aTimePeriodMillisec)
       
   486 /*
       
   487  * This method starts the timer with the command in the input aCompletionClass
       
   488  * for the input specified period.  The indicater for timer pending is set to ETrue.
       
   489  *
       
   490  * @param aCompletionClass: pointer to object containing the time-out command.
       
   491  * @param aTimePeriodMillisec: time-out period in milliseconds.
       
   492  */
       
   493 	{
       
   494 	iTimeOutCommand=aCompletionClass;
       
   495 	iChat->StartTimer(aTimePeriodMillisec*1000);
       
   496 	iWaitTimerPending=ETrue;
       
   497 	}
       
   498 
       
   499 TInt CATIO::Read()
       
   500 /*
       
   501  * This method attempts to read from the comm port only if there is currently 
       
   502  * not a read pending.  If a read is pending, this method simply returns without
       
   503  * attempting a read.  If no read is pending, this routing attempts to read as 
       
   504  * much data as is ready up to the maximum length specified in the descriptor, iRxBuf.
       
   505  * The data is read into the iRxBuf.
       
   506  */
       
   507  	{
       
   508 	if(iReadPending==EFalse)
       
   509 		{
       
   510  		iReadPending=ETrue;
       
   511 		iStringFound=EFalse;
       
   512 		CommReadOneOrMore(iRxBuf);
       
   513 		iRxBufOffset = 0;
       
   514 		LOGTEXT(_S8("CATIO Queued a Read"));
       
   515 		}
       
   516 	return KErrNone;
       
   517 	}
       
   518 
       
   519 TInt CATIO::Write(CATBase* aCompletionClass, const TDesC8& aString)
       
   520 /*
       
   521  * This method attempts to write the input data into comm port using the 
       
   522  * write command in the input aCompletionClass.
       
   523  *
       
   524  * @param aCompletionClass: pointer to object containing function to call when the write completes.
       
   525  * @param aString, a descriptor reference containing the data to be written to the port.
       
   526  */
       
   527 	{
       
   528 	iWriteCommand=aCompletionClass;
       
   529 	iWritePending=ETrue;
       
   530 	CommWrite(aString);
       
   531 	LOGTEXT2(_L8("Tx:\t%S"),&aString);
       
   532 	LOGTEXTREL2(_L8("Tx:\t%S"),&aString);
       
   533 	LOGTEXT(_S8("CATIO Queued a Transmission"));
       
   534 	return KErrNone;
       
   535 	}
       
   536 
       
   537 TBool CATIO::RWPending()
       
   538 /*
       
   539  * This method returns to the caller a boolean indicating True when 
       
   540  * either a Write is Pending  OR  a ReadPending is pending.
       
   541  *
       
   542  * @return Boolean indicating either a Write is Pending OR a Read is Pending.
       
   543  */
       
   544 	{
       
   545 	return (iWritePending)||(iReadPending);
       
   546 	}
       
   547 
       
   548 TBool CATIO::ReadPending()
       
   549 /*
       
   550  * This method returns to the caller a boolean indicating True when 
       
   551  * a ReadPending is pending.
       
   552  *
       
   553  * @return Boolean indicating if a Read is Pending.
       
   554  */
       
   555 	{
       
   556 	return iReadPending;
       
   557 	}
       
   558 
       
   559 void CATIO::Disconnect()
       
   560 /**
       
   561  * This function is currently not used by the Etel regression test harness.
       
   562  */
       
   563 	{
       
   564 	TCommConfig cbuf;
       
   565 	TCommConfigV01 &cfg=cbuf();
       
   566 	iCommPort.Config(cbuf);
       
   567 	cfg.iHandshake = KConfigFreeRTS	| KConfigFreeDTR;
       
   568 	iCommPort.SetConfig(cbuf);
       
   569 	iCommPort.SetSignalsToSpace(KSignalRTS | KSignalDTR);
       
   570 	CommClose();
       
   571 	}
       
   572 
       
   573 void CATIO::Cancel()
       
   574 /**
       
   575  * This function is currently not used by the Etel regression test harness.
       
   576  */
       
   577 	{
       
   578 	LOGTEXT(_S8("CATIO CATIO:\tCancel called"));
       
   579 	CommCancel();
       
   580 	iReadPending = EFalse;
       
   581 	iWritePending = EFalse;
       
   582 	iChat->StopTimer();
       
   583 	}
       
   584 
       
   585 void CATIO::WriteAndTimerCancel(CATBase* aATBase)
       
   586 /**
       
   587  * This method is used by the caller to either cancel a write command or stop a timer.
       
   588  * The action to be taken is determined by the command type received as a parameter.
       
   589  *
       
   590  * @param aATBase: pointer to the command type to be processed.
       
   591  */
       
   592 	{
       
   593 	if (aATBase==iWriteCommand)
       
   594 		{
       
   595 		CommWriteCancel();
       
   596 		}
       
   597 	if (aATBase==iTimeOutCommand)
       
   598 		{
       
   599 		iChat->StopTimer();
       
   600 		}
       
   601 	}
       
   602 
       
   603 void CATIO::WriteAndTimerCancelAll()
       
   604 /**
       
   605  * This function is currently not used by the Etel regression test harness.
       
   606  */
       
   607 	{
       
   608 	CommWriteCancel();
       
   609 	iChat->StopTimer();
       
   610 	}
       
   611 
       
   612 void CATIO::DropDtr()
       
   613 /**
       
   614  * This function is currently not used by the Etel regression test harness.
       
   615  */
       
   616 	{
       
   617 	LOGTEXT(_S8("CATIO Dropping DTR"));
       
   618 	iCommPort.SetSignals(0,KSignalDTR);
       
   619 	}
       
   620 
       
   621 void CATIO::RaiseDTR()
       
   622 /**
       
   623  * This function is currently not used by the Etel regression test harness.
       
   624  */
       
   625 	{
       
   626 	LOGTEXT(_S8("CATIO Raising DTR"));
       
   627 	iCommPort.SetSignals(KSignalDTR,0);
       
   628 	}
       
   629 
       
   630 void CATIO::ResetReadAndWriteBuffers()
       
   631 /**
       
   632  * This function is currently not used by the Etel regression test harness.
       
   633  */
       
   634 	{
       
   635 	iCommPort.ResetBuffers();
       
   636 	}
       
   637 
       
   638 TInt CATIO::GetSizeOfRxBuffer()
       
   639 /**
       
   640  * This function is currently not used by the Etel regression test harness.
       
   641  */
       
   642 	{
       
   643 	return iCommPort.QueryReceiveBuffer();
       
   644 	}
       
   645 
       
   646 TUint CATIO::Signals()
       
   647 /**
       
   648  * This function is currently not used by the Etel regression test harness.
       
   649  */
       
   650 	{
       
   651 	return iCommPort.Signals();
       
   652 	}
       
   653 
       
   654 void CATIO::DropRTS()
       
   655 /**
       
   656  * This function is currently not used by the Etel regression test harness.
       
   657  */
       
   658 	{
       
   659 	LOGTEXT(_S8("CATIO Dropping RTS"));
       
   660 	iCommPort.SetSignals(0,KSignalRTS);
       
   661 	}
       
   662 
       
   663 void CATIO::RaiseRTS()
       
   664 /**
       
   665  * This function is currently not used by the Etel regression test harness.
       
   666  */
       
   667 	{
       
   668 	LOGTEXT(_S8("CATIO Raising RTS"));
       
   669 	iCommPort.SetSignals(KSignalRTS,0);
       
   670 	}
       
   671 
       
   672 void CATIO::SignalMark (TUint aSignal)
       
   673 /**
       
   674  * This method is used by the caller on the emulator side to assert signals.
       
   675  *
       
   676  * @param aSignal: integer indicating the signal to assert.
       
   677  */
       
   678 	{
       
   679 	LOGTEXT2(_L8("CATIO CATIO::SignalSet(%x)"),aSignal); 
       
   680 	iCommPort.SetSignalsToMark(aSignal);
       
   681 	}
       
   682 
       
   683 void CATIO::SignalSpace (TUint aSignal)
       
   684 /**
       
   685  * This method is used by the caller on the emulator side to deassert signals.
       
   686  *
       
   687  * @param aSignal: integer indicating the signal to deassert.
       
   688  */
       
   689 	{
       
   690 	LOGTEXT2(_L8("CATIO CATIO::SignalClear(%x)"),aSignal);
       
   691 	iCommPort.SetSignalsToSpace (aSignal);
       
   692 	}