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