kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0497.cpp
changeset 259 57b9594f5772
parent 0 a41df078684a
child 257 3e88ff8f41d5
child 271 dc268b18d709
equal deleted inserted replaced
247:d8d70de2bd36 259:57b9594f5772
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    18 
    18 
    19 #include "PBASE-T_USBDI-0497.h"
    19 #include "PBASE-T_USBDI-0497.h"
    20 #include "testpolicy.h"
    20 #include "testpolicy.h"
    21 #include "modelleddevices.h"
    21 #include "modelleddevices.h"
    22 #include "testliterals.h"
    22 #include "testliterals.h"
       
    23 #include "OstTraceDefinitions.h"
       
    24 #ifdef OST_TRACE_COMPILER_IN_USE
       
    25 #include "PBASE-T_USBDI-0497Traces.h"
       
    26 #endif
    23 
    27 
    24 
    28 
    25  
    29  
    26 
    30 
    27 namespace NUnitTesting_USBDI
    31 namespace NUnitTesting_USBDI
    61 _LIT(KTestCaseId,"PBASE-T_USBDI-0497");
    65 _LIT(KTestCaseId,"PBASE-T_USBDI-0497");
    62 const TFunctorTestCase<CUT_PBASE_T_USBDI_0497,TBool> CUT_PBASE_T_USBDI_0497::iFunctor(KTestCaseId);	
    66 const TFunctorTestCase<CUT_PBASE_T_USBDI_0497,TBool> CUT_PBASE_T_USBDI_0497::iFunctor(KTestCaseId);	
    63 
    67 
    64 CUT_PBASE_T_USBDI_0497* CUT_PBASE_T_USBDI_0497::NewL(TBool aHostRole)
    68 CUT_PBASE_T_USBDI_0497* CUT_PBASE_T_USBDI_0497::NewL(TBool aHostRole)
    65 	{
    69 	{
       
    70 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0497_NEWL_ENTRY, aHostRole );
    66 	CUT_PBASE_T_USBDI_0497* self = new (ELeave) CUT_PBASE_T_USBDI_0497(aHostRole);
    71 	CUT_PBASE_T_USBDI_0497* self = new (ELeave) CUT_PBASE_T_USBDI_0497(aHostRole);
    67 	CleanupStack::PushL(self);
    72 	CleanupStack::PushL(self);
    68 	self->ConstructL();
    73 	self->ConstructL();
    69 	CleanupStack::Pop(self);
    74 	CleanupStack::Pop(self);
       
    75 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0497_NEWL_EXIT, ( TUint )( self ) );
    70 	return self;
    76 	return self;
    71 	}
    77 	}
    72 	
    78 	
    73 
    79 
    74 CUT_PBASE_T_USBDI_0497::CUT_PBASE_T_USBDI_0497(TBool aHostRole)
    80 CUT_PBASE_T_USBDI_0497::CUT_PBASE_T_USBDI_0497(TBool aHostRole)
    75 :	CBaseBulkTestCase(KTestCaseId,aHostRole),
    81 :	CBaseBulkTestCase(KTestCaseId,aHostRole),
    76 	iCaseStep(EInProgress)
    82 	iCaseStep(EInProgress)
    77 	{
    83 	{
       
    84 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0497_CUT_PBASE_T_USBDI_0497_ENTRY, this );
       
    85 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0497_CUT_PBASE_T_USBDI_0497_EXIT, this );
    78 	} 
    86 	} 
    79 
    87 
    80 
    88 
    81 void CUT_PBASE_T_USBDI_0497::ConstructL()
    89 void CUT_PBASE_T_USBDI_0497::ConstructL()
    82 	{
    90 	{
       
    91 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0497_CONSTRUCTL_ENTRY, this );
    83 	BaseBulkConstructL();
    92 	BaseBulkConstructL();
       
    93 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0497_CONSTRUCTL_EXIT, this );
    84 	}
    94 	}
    85 
    95 
    86 
    96 
    87 CUT_PBASE_T_USBDI_0497::~CUT_PBASE_T_USBDI_0497()
    97 CUT_PBASE_T_USBDI_0497::~CUT_PBASE_T_USBDI_0497()
    88 	/**
    98 	/**
    89 	The transfer objects have test specific names - so perform transfer specific clean up here.
    99 	The transfer objects have test specific names - so perform transfer specific clean up here.
    90 	*/
   100 	*/
    91 	{
   101 	{
    92 	LOG_FUNC
   102 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0497_CUT_PBASE_T_USBDI_0497_ENTRY_DUP01, this );
    93 	
   103 	
    94 	Cancel();
   104 	Cancel();
    95 
   105 
    96 	//Do this before deleting the transfer objects
   106 	//Do this before deleting the transfer objects
    97 	CloseInterfaceAndPipes();
   107 	CloseInterfaceAndPipes();
   109 		delete iIfc1InTransfer[count];
   119 		delete iIfc1InTransfer[count];
   110 		iIfc1InTransfer[count] = NULL;
   120 		iIfc1InTransfer[count] = NULL;
   111 		delete iIfc2InTransfer[count];
   121 		delete iIfc2InTransfer[count];
   112 		iIfc2InTransfer[count] = NULL;
   122 		iIfc2InTransfer[count] = NULL;
   113 		}
   123 		}
       
   124 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0497_CUT_PBASE_T_USBDI_0497_EXIT_DUP01, this );
   114 	}
   125 	}
   115 	
   126 	
   116 	
   127 	
   117 void CUT_PBASE_T_USBDI_0497::Ep0TransferCompleteL(TInt aCompletionCode)
   128 void CUT_PBASE_T_USBDI_0497::Ep0TransferCompleteL(TInt aCompletionCode)
   118 	{
   129 	{
   119 	LOG_FUNC
   130 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0497_EP0TRANSFERCOMPLETEL_ENTRY, this );
   120 	
   131 	
   121 	RDebug::Printf("Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
   132 	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
   122 	
   133 	
   123 	if(aCompletionCode != KErrNone)
   134 	if(aCompletionCode != KErrNone)
   124 		{
   135 		{
   125 		if(iCaseStep == EFailed)
   136 		if(iCaseStep == EFailed)
   126 			{// ignore error, nad catch the TestFailed method called further down.
   137 			{// ignore error, nad catch the TestFailed method called further down.
   127 			RDebug::Printf("***Failure sending FAIL message to client on endpoint 0***");
   138 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_EP0TRANSFERCOMPLETEL_DUP01, "***Failure sending FAIL message to client on endpoint 0***");
   128 			}
   139 			}
   129 		else
   140 		else
   130 			{
   141 			{
   131 			TBuf<256> msg;
   142 			TBuf<256> msg;
   132 			msg.Format(_L("<Error %d> Transfer to control endpoint 0 was not successful"),aCompletionCode);
   143 			msg.Format(_L("<Error %d> Transfer to control endpoint 0 was not successful"),aCompletionCode);
   133 			RDebug::Print(msg);
   144 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_EP0TRANSFERCOMPLETEL_DUP02, msg);
   134 			iCaseStep = EFailed;
   145 			iCaseStep = EFailed;
   135 			TTestCaseFailed request(aCompletionCode,msg);
   146 			TTestCaseFailed request(aCompletionCode,msg);
   136 			iControlEp0->SendRequest(request,this);
   147 			iControlEp0->SendRequest(request,this);
       
   148 			OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0497_EP0TRANSFERCOMPLETEL_EXIT, this );
   137 			return;
   149 			return;
   138 			}
   150 			}
   139 		}
   151 		}
   140 	
   152 	
   141 	switch(iCaseStep)
   153 	switch(iCaseStep)
   150 			TestFailed(KErrCompletion);
   162 			TestFailed(KErrCompletion);
   151 			break;
   163 			break;
   152 		
   164 		
   153 		case ERequestDeviceRead:
   165 		case ERequestDeviceRead:
   154 			{
   166 			{
   155 			RDebug::Printf("Asking client for 'Read' on interface 2");
   167 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_EP0TRANSFERCOMPLETEL_DUP03, "Asking client for 'Read' on interface 2");
   156 			iCaseStep = ETransferOut;	
   168 			iCaseStep = ETransferOut;	
   157 			TEndpointReadRequest request(2,1,KDeviceNumReadBytes);// EP1 means endpoint index 1 not the actual endpoint number
   169 			TEndpointReadRequest request(2,1,KDeviceNumReadBytes);// EP1 means endpoint index 1 not the actual endpoint number
   158 			iControlEp0->SendRequest(request,this);
   170 			iControlEp0->SendRequest(request,this);
   159 			}
   171 			}
   160 			break;
   172 			break;
   161 			
   173 			
   162 		case ETransferOut:
   174 		case ETransferOut:
   163 			RDebug::Printf("Try to write data on BOTH interfaces");
   175 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_EP0TRANSFERCOMPLETEL_DUP04, "Try to write data on BOTH interfaces");
   164 	
   176 	
   165 			iStartTime[0].HomeTime();
   177 			iStartTime[0].HomeTime();
   166 			iStartTime[1].HomeTime();
   178 			iStartTime[1].HomeTime();
   167 	
   179 	
   168 			iIfc1OutTransfer[0]->TransferOut(KLiteralFrench4(), KHostNumWriteBytes1, EFalse);
   180 			iIfc1OutTransfer[0]->TransferOut(KLiteralFrench4(), KHostNumWriteBytes1, EFalse);
   171 			iIfc2OutTransfer[1]->TransferOut(KLiteralEnglish8(), KHostNumWriteBytes1, KHostNumWriteBytes2, EFalse);
   183 			iIfc2OutTransfer[1]->TransferOut(KLiteralEnglish8(), KHostNumWriteBytes1, KHostNumWriteBytes2, EFalse);
   172 			break;
   184 			break;
   173 		
   185 		
   174 		case ERequestDeviceWriteBack:
   186 		case ERequestDeviceWriteBack:
   175 			{
   187 			{
   176 			RDebug::Printf("Asking client for 'Write' back on interface 2");
   188 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_EP0TRANSFERCOMPLETEL_DUP05, "Asking client for 'Write' back on interface 2");
   177 			iCaseStep = ETransferIn;	
   189 			iCaseStep = ETransferIn;	
   178 			TWriteCachedReadDataRequest request(2,1,1);// EP1 means endpoint index 1 not the actual endpoint number
   190 			TWriteCachedReadDataRequest request(2,1,1);// EP1 means endpoint index 1 not the actual endpoint number
   179 			iControlEp0->SendRequest(request,this);
   191 			iControlEp0->SendRequest(request,this);
   180 			}
   192 			}
   181 			break;
   193 			break;
   182 			
   194 			
   183 		case ETransferIn:
   195 		case ETransferIn:
   184 			RDebug::Printf("Try to receive data on BOTH interfaces");
   196 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_EP0TRANSFERCOMPLETEL_DUP06, "Try to receive data on BOTH interfaces");
   185 	
   197 	
   186 			iStartTime[0].HomeTime();
   198 			iStartTime[0].HomeTime();
   187 			iStartTime[1].HomeTime();
   199 			iStartTime[1].HomeTime();
   188 			
   200 			
   189 			iIfc1InTransfer[0]->TransferIn(KHostNumReadBytes1);
   201 			iIfc1InTransfer[0]->TransferIn(KHostNumReadBytes1);
   191 			iIfc2InTransfer[0]->TransferIn(KHostNumReadBytes1);
   203 			iIfc2InTransfer[0]->TransferIn(KHostNumReadBytes1);
   192 			iIfc2InTransfer[1]->TransferIn(KHostNumReadBytes2);
   204 			iIfc2InTransfer[1]->TransferIn(KHostNumReadBytes2);
   193 			break;
   205 			break;
   194 	
   206 	
   195 		default:
   207 		default:
   196 			RDebug::Printf("<Error> Unknown test step");
   208 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_EP0TRANSFERCOMPLETEL_DUP07, "<Error> Unknown test step");
   197 			TestFailed(KErrUnknown);
   209 			TestFailed(KErrUnknown);
   198 			break;
   210 			break;
   199 		}
   211 		}
       
   212 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0497_EP0TRANSFERCOMPLETEL_EXIT_DUP01, this );
   200 	}
   213 	}
   201 	
   214 	
   202 void CUT_PBASE_T_USBDI_0497::TransferCompleteL(TInt aTransferId,TInt aCompletionCode)
   215 void CUT_PBASE_T_USBDI_0497::TransferCompleteL(TInt aTransferId,TInt aCompletionCode)
   203 	{
   216 	{
   204 	LOG_FUNC
   217 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0497_TRANSFERCOMPLETEL_ENTRY, this );
   205 	Cancel();
   218 	Cancel();
   206 	
   219 	
   207 	TInt err(KErrNone);
   220 	TInt err(KErrNone);
   208 	TBuf<256> msg;
   221 	TBuf<256> msg;
   209 	RDebug::Printf("Transfer completed (id=%d), aCompletionCode = %d, test step = %d",aTransferId, aCompletionCode, iCaseStep);
   222 	OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_TRANSFERCOMPLETEL, "Transfer completed (id=%d), aCompletionCode = %d, test step = %d",aTransferId, aCompletionCode, iCaseStep);
   210 
   223 
   211 	switch(iCaseStep)
   224 	switch(iCaseStep)
   212 		{
   225 		{
   213 		case ETransferOut:
   226 		case ETransferOut:
   214 			if(aCompletionCode != KErrNone)
   227 			if(aCompletionCode != KErrNone)
   227 				case KIfc1BulkTransferOutId1:
   240 				case KIfc1BulkTransferOutId1:
   228 				case KIfc1BulkTransferOutId2:
   241 				case KIfc1BulkTransferOutId2:
   229 				case KIfc2BulkTransferOutId1:
   242 				case KIfc2BulkTransferOutId1:
   230 				case KIfc2BulkTransferOutId2:
   243 				case KIfc2BulkTransferOutId2:
   231 					iTransferComplete |= aTransferId;
   244 					iTransferComplete |= aTransferId;
   232 					RDebug::Printf("Transfer OUT %d completed (Transfer Completion Aggregation Mask 0x%x)", aTransferId, iTransferComplete);
   245 					OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_TRANSFERCOMPLETEL_DUP01, "Transfer OUT %d completed (Transfer Completion Aggregation Mask 0x%x)", aTransferId, iTransferComplete);
   233 					break; //switch(aTransferId)
   246 					break; //switch(aTransferId)
   234 				default:
   247 				default:
   235 					iTransferComplete = 0; //reset
   248 					iTransferComplete = 0; //reset
   236 					err = KUnexpectedTransferID;
   249 					err = KUnexpectedTransferID;
   237 					msg.Format(_L("<Error %d> Unexpected transfer ID, wanted %d or %d, got %d"),
   250 					msg.Format(_L("<Error %d> Unexpected transfer ID, wanted %d or %d, got %d"),
   251 				RecordTime(1);
   264 				RecordTime(1);
   252 				}
   265 				}
   253 
   266 
   254 			if(err==KErrNone && (iTransferComplete & KBulkTransferOutIdMask) == KBulkTransferOutIdMask)
   267 			if(err==KErrNone && (iTransferComplete & KBulkTransferOutIdMask) == KBulkTransferOutIdMask)
   255 				{
   268 				{
   256 				RDebug::Printf("All OUT Transfers Completed Successfully: Transfer Completion Aggregation Mask 0x%x", iTransferComplete);
   269 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_TRANSFERCOMPLETEL_DUP02, "All OUT Transfers Completed Successfully: Transfer Completion Aggregation Mask 0x%x", iTransferComplete);
   257 				iTransferComplete = 0; //reset
   270 				iTransferComplete = 0; //reset
   258 				err = CheckAndResetTimes(0, 1, KMaxTimeDiffPercentage);
   271 				err = CheckAndResetTimes(0, 1, KMaxTimeDiffPercentage);
   259 				if(err!=KErrNone)
   272 				if(err!=KErrNone)
   260 					{
   273 					{
   261 					break; //switch(iCaseStep)
   274 					break; //switch(iCaseStep)
   262 					}
   275 					}
   263 	
   276 	
   264 				RDebug::Printf("Asking client for 'Write' back on interface 1");
   277 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_TRANSFERCOMPLETEL_DUP03, "Asking client for 'Write' back on interface 1");
   265 				iCaseStep = ERequestDeviceWriteBack;
   278 				iCaseStep = ERequestDeviceWriteBack;
   266 				TWriteCachedReadDataRequest request(1,1,1);// EP1 means endpoint index 1 not the actual endpoint number
   279 				TWriteCachedReadDataRequest request(1,1,1);// EP1 means endpoint index 1 not the actual endpoint number
   267 				iControlEp0->SendRequest(request,this);
   280 				iControlEp0->SendRequest(request,this);
   268 				}
   281 				}
   269 			break; //switch(iCaseStep)
   282 			break; //switch(iCaseStep)
   286 				case KIfc1BulkTransferInId1:
   299 				case KIfc1BulkTransferInId1:
   287 				case KIfc1BulkTransferInId2:
   300 				case KIfc1BulkTransferInId2:
   288 				case KIfc2BulkTransferInId1:
   301 				case KIfc2BulkTransferInId1:
   289 				case KIfc2BulkTransferInId2:
   302 				case KIfc2BulkTransferInId2:
   290 					iTransferComplete |= aTransferId;
   303 					iTransferComplete |= aTransferId;
   291 					RDebug::Printf("Transfer OUT %d completed (Transfer Completion Aggregation Mask 0x%x)", aTransferId, iTransferComplete);
   304 					OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_TRANSFERCOMPLETEL_DUP04, "Transfer OUT %d completed (Transfer Completion Aggregation Mask 0x%x)", aTransferId, iTransferComplete);
   292 					break; //switch(aTransferId)
   305 					break; //switch(aTransferId)
   293 	
   306 	
   294 				default:
   307 				default:
   295 					iTransferComplete = 0; //reset
   308 					iTransferComplete = 0; //reset
   296 					err = KUnexpectedTransferID;
   309 					err = KUnexpectedTransferID;
   312 				}
   325 				}
   313 
   326 
   314 			if(err==KErrNone && (iTransferComplete & KBulkTransferInIdMask) == KBulkTransferInIdMask)
   327 			if(err==KErrNone && (iTransferComplete & KBulkTransferInIdMask) == KBulkTransferInIdMask)
   315 				{
   328 				{
   316 				// ok, compare data rcvd now
   329 				// ok, compare data rcvd now
   317 				RDebug::Printf("All IN Transfers Completed Successfully: Transfer Completion Aggregation Mask 0x%x", iTransferComplete);
   330 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_TRANSFERCOMPLETEL_DUP05, "All IN Transfers Completed Successfully: Transfer Completion Aggregation Mask 0x%x", iTransferComplete);
   318 				iTransferComplete = 0; //reset
   331 				iTransferComplete = 0; //reset
   319 				err = CheckAndResetTimes(0, 1, KMaxTimeDiffPercentage);
   332 				err = CheckAndResetTimes(0, 1, KMaxTimeDiffPercentage);
   320 				if(err!=KErrNone)
   333 				if(err!=KErrNone)
   321 					{
   334 					{
   322 					break; //switch(iCaseStep)
   335 					break; //switch(iCaseStep)
   327 				TPtrC8 data3(iIfc2InTransfer[0]->DataPolled());		
   340 				TPtrC8 data3(iIfc2InTransfer[0]->DataPolled());		
   328 				TPtrC8 data4(iIfc2InTransfer[1]->DataPolled());		
   341 				TPtrC8 data4(iIfc2InTransfer[1]->DataPolled());		
   329 				//Validate first transfer on Interface 1 for number of bytes originally written.
   342 				//Validate first transfer on Interface 1 for number of bytes originally written.
   330 				if(ValidateData(data1, KLiteralFrench4(), KHostNumWriteBytes1) == EFalse)
   343 				if(ValidateData(data1, KLiteralFrench4(), KHostNumWriteBytes1) == EFalse)
   331 					{
   344 					{
   332 					RDebug::Printf("Validation failure 1st transfer, Interface 1");
   345 					OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_TRANSFERCOMPLETEL_DUP06, "Validation failure 1st transfer, Interface 1");
   333 					err = KErrCompletion; //indicates data validation failure
   346 					err = KErrCompletion; //indicates data validation failure
   334 					break; //switch(iCaseStep)
   347 					break; //switch(iCaseStep)
   335 					}
   348 					}
   336 
   349 
   337 				//Validate second transfer on Interface 1 for number of bytes originally written.
   350 				//Validate second transfer on Interface 1 for number of bytes originally written.
   338 				if(ValidateData(data2, KLiteralFrench4(), KHostNumWriteBytes1, KHostNumWriteBytes2) == EFalse)
   351 				if(ValidateData(data2, KLiteralFrench4(), KHostNumWriteBytes1, KHostNumWriteBytes2) == EFalse)
   339 					{
   352 					{
   340 					RDebug::Printf("Validation failure 2nd transfer, Interface 1");
   353 					OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_TRANSFERCOMPLETEL_DUP07, "Validation failure 2nd transfer, Interface 1");
   341 					err = KErrCompletion; //indicates data validation failure
   354 					err = KErrCompletion; //indicates data validation failure
   342 					break; //switch(iCaseStep)
   355 					break; //switch(iCaseStep)
   343 					}
   356 					}
   344 
   357 
   345 				//Validate first transfer on Interface 2 for number of bytes originally written.
   358 				//Validate first transfer on Interface 2 for number of bytes originally written.
   346 				if(ValidateData(data3, KLiteralEnglish8(), KHostNumWriteBytes1) == EFalse)
   359 				if(ValidateData(data3, KLiteralEnglish8(), KHostNumWriteBytes1) == EFalse)
   347 					{
   360 					{
   348 					RDebug::Printf("Validation failure 1st transfer, Interface 2");
   361 					OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_TRANSFERCOMPLETEL_DUP08, "Validation failure 1st transfer, Interface 2");
   349 					err = KErrCompletion; //indicates data validation failure
   362 					err = KErrCompletion; //indicates data validation failure
   350 					break; //switch(iCaseStep)
   363 					break; //switch(iCaseStep)
   351 					}
   364 					}
   352 
   365 
   353 				//Validate second transfer on Interface 2 for number of bytes originally written.
   366 				//Validate second transfer on Interface 2 for number of bytes originally written.
   354 				if(ValidateData(data4, KLiteralEnglish8(), KHostNumWriteBytes1, KHostNumWriteBytes2) == EFalse)
   367 				if(ValidateData(data4, KLiteralEnglish8(), KHostNumWriteBytes1, KHostNumWriteBytes2) == EFalse)
   355 					{
   368 					{
   356 					RDebug::Printf("Validation failure 2nd transfer, Interface 2");
   369 					OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_TRANSFERCOMPLETEL_DUP09, "Validation failure 2nd transfer, Interface 2");
   357 					err = KErrCompletion; //indicates data validation failure
   370 					err = KErrCompletion; //indicates data validation failure
   358 					break; //switch(iCaseStep)
   371 					break; //switch(iCaseStep)
   359 					}
   372 					}
   360 
   373 
   361 				// Comparison is a match
   374 				// Comparison is a match
   362 				RDebug::Printf("Comparison for IN transfer is a match");
   375 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_TRANSFERCOMPLETEL_DUP10, "Comparison for IN transfer is a match");
   363 				iCaseStep = EPassed;
   376 				iCaseStep = EPassed;
   364 				TTestCasePassed request;
   377 				TTestCasePassed request;
   365 				iControlEp0->SendRequest(request,this);
   378 				iControlEp0->SendRequest(request,this);
   366 				}
   379 				}
   367 			break; //switch(iCaseStep)
   380 			break; //switch(iCaseStep)
   384 		msg.Format(_L("<Error %d> Timer comparison showed too great a difference in transfer times between the two interfaces"), err);
   397 		msg.Format(_L("<Error %d> Timer comparison showed too great a difference in transfer times between the two interfaces"), err);
   385 		}
   398 		}
   386 	
   399 	
   387 	if(err!=KErrNone)
   400 	if(err!=KErrNone)
   388 		{	
   401 		{	
   389 		RDebug::Print(msg);
   402 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_TRANSFERCOMPLETEL_DUP11, msg);
   390 		iCaseStep = EFailed;
   403 		iCaseStep = EFailed;
   391 		TTestCaseFailed request(err,msg);
   404 		TTestCaseFailed request(err,msg);
   392 		return iControlEp0->SendRequest(request,this);
   405 		return iControlEp0->SendRequest(request,this);
   393 		}	
   406 		}	
       
   407 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0497_TRANSFERCOMPLETEL_EXIT, this );
   394 	}
   408 	}
   395 	
   409 	
   396 void CUT_PBASE_T_USBDI_0497::DeviceInsertedL(TUint aDeviceHandle)
   410 void CUT_PBASE_T_USBDI_0497::DeviceInsertedL(TUint aDeviceHandle)
   397 	{
   411 	{
   398 	LOG_FUNC
   412 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0497_DEVICEINSERTEDL_ENTRY, this );
   399 	
   413 	
   400 	Cancel();
   414 	Cancel();
   401 	RDebug::Printf("this - %08x", this);
   415 	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_DEVICEINSERTEDL, "this - %08x", this);
   402 	
   416 	
   403 	TBuf<256> msg;
   417 	TBuf<256> msg;
   404 	TInt err = KErrNone;
   418 	TInt err = KErrNone;
   405 	if(BaseBulkDeviceInsertedL(aDeviceHandle, EFalse) == EDeviceConfigurationError)
   419 	if(BaseBulkDeviceInsertedL(aDeviceHandle, EFalse) == EDeviceConfigurationError)
   406 		// Prepare for response from control transfer to client
   420 		// Prepare for response from control transfer to client
   428 			iIfc2InTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface2BulkIn,iUsbInterface2,KBulkMaxTransferSize,*this,KIfc2BulkTransferInId2);
   442 			iIfc2InTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface2BulkIn,iUsbInterface2,KBulkMaxTransferSize,*this,KIfc2BulkTransferInId2);
   429 			iIfc2OutTransfer[0] = new (ELeave) CBulkTransfer(iTestPipeInterface2BulkOut1,iUsbInterface2,KBulkMaxTransferSize,*this,KIfc2BulkTransferOutId1);
   443 			iIfc2OutTransfer[0] = new (ELeave) CBulkTransfer(iTestPipeInterface2BulkOut1,iUsbInterface2,KBulkMaxTransferSize,*this,KIfc2BulkTransferOutId1);
   430 			iIfc2OutTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface2BulkOut1,iUsbInterface2,KBulkMaxTransferSize,*this,KIfc2BulkTransferOutId2);
   444 			iIfc2OutTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface2BulkOut1,iUsbInterface2,KBulkMaxTransferSize,*this,KIfc2BulkTransferOutId2);
   431 			
   445 			
   432 			// Initialise the descriptors for transfer		
   446 			// Initialise the descriptors for transfer		
   433 			RDebug::Printf("Initialising the transfer descriptors - interface 1");
   447 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_DEVICEINSERTEDL_DUP01, "Initialising the transfer descriptors - interface 1");
   434 			err = iUsbInterface1.InitialiseTransferDescriptors();
   448 			err = iUsbInterface1.InitialiseTransferDescriptors();
   435 			if(err != KErrNone)
   449 			if(err != KErrNone)
   436 				{
   450 				{
   437 				msg.Format(_L("<Error %d> Unable to initialise transfer descriptors (Interface 1)"),err);
   451 				msg.Format(_L("<Error %d> Unable to initialise transfer descriptors (Interface 1)"),err);
   438 				}
   452 				}
   439 			else
   453 			else
   440 				{
   454 				{
   441 				// Initialise the descriptors for transfer		
   455 				// Initialise the descriptors for transfer		
   442 				RDebug::Printf("Initialising the transfer descriptors (Interface 2)");
   456 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_DEVICEINSERTEDL_DUP02, "Initialising the transfer descriptors (Interface 2)");
   443 				err = iUsbInterface2.InitialiseTransferDescriptors();
   457 				err = iUsbInterface2.InitialiseTransferDescriptors();
   444 				if(err != KErrNone)
   458 				if(err != KErrNone)
   445 					{
   459 					{
   446 					msg.Format(_L("<Error %d> Unable to initialise transfer descriptors"),err);
   460 					msg.Format(_L("<Error %d> Unable to initialise transfer descriptors"),err);
   447 					}
   461 					}
   448 				}
   462 				}
   449 			}
   463 			}
   450 		}
   464 		}
   451 	if(err != KErrNone)
   465 	if(err != KErrNone)
   452 		{
   466 		{
   453 		RDebug::Print(msg);
   467 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_DEVICEINSERTEDL_DUP03, msg);
   454 		iCaseStep = EFailed;
   468 		iCaseStep = EFailed;
   455 		TTestCaseFailed request(err,msg);
   469 		TTestCaseFailed request(err,msg);
   456 		iControlEp0->SendRequest(request,this);
   470 		iControlEp0->SendRequest(request,this);
   457 		}
   471 		}
   458 	else
   472 	else
   459 		{
   473 		{
   460 		RDebug::Printf("Asking client for 'Read' on interface 1");
   474 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0497_DEVICEINSERTEDL_DUP04, "Asking client for 'Read' on interface 1");
   461 		iCaseStep = ERequestDeviceRead;	
   475 		iCaseStep = ERequestDeviceRead;	
   462 		TEndpointReadRequest request(1,1,KDeviceNumReadBytes);// EP1 means endpoint index 1 not the actual endpoint number
   476 		TEndpointReadRequest request(1,1,KDeviceNumReadBytes);// EP1 means endpoint index 1 not the actual endpoint number
   463 		iControlEp0->SendRequest(request,this);
   477 		iControlEp0->SendRequest(request,this);
   464 		}
   478 		}
       
   479 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0497_DEVICEINSERTEDL_EXIT, this );
   465 	}
   480 	}
   466 	
   481 	
   467 	} //end namespace
   482 	} //end namespace