kerneltest/e32test/usbho/t_usbdi/src/BaseBulkTestCase.cpp
changeset 259 57b9594f5772
parent 0 a41df078684a
child 257 3e88ff8f41d5
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".
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 // @file BaseBulkTestCase.cpp
    14 // @file BaseBulkTestCase.cpp
    15 // @internalComponent
    15 // @internalComponent
    16 // 
    16 //
    17 //
    17 //
    18 
    18 
    19 #include "BaseBulkTestCase.h"
    19 #include "BaseBulkTestCase.h"
    20 #include "testpolicy.h"
    20 #include "testpolicy.h"
    21 #include "modelleddevices.h"
    21 #include "modelleddevices.h"
    22 
    22 #include "OstTraceDefinitions.h"
    23 
    23 #ifdef OST_TRACE_COMPILER_IN_USE
    24  
    24 #include "BaseBulkTestCaseTraces.h"
       
    25 #endif
       
    26 
       
    27 
       
    28 
    25 namespace NUnitTesting_USBDI
    29 namespace NUnitTesting_USBDI
    26 	{
    30 	{
    27 
    31 
    28 //*****************************************************************************************************
    32 //*****************************************************************************************************
    29 
    33 
    30 //Bulk Timer Class 
    34 //Bulk Timer Class
    31 CBulkTestTimer* CBulkTestTimer::NewL(MBulkTestTimerObserver& aParent)
    35 CBulkTestTimer* CBulkTestTimer::NewL(MBulkTestTimerObserver& aParent)
    32 	{
    36 	{
       
    37 	OstTraceFunctionEntry1( CBULKTESTTIMER_NEWL_ENTRY, ( TUint )&( aParent ) );
    33 	CBulkTestTimer* self = new (ELeave) CBulkTestTimer(aParent);
    38 	CBulkTestTimer* self = new (ELeave) CBulkTestTimer(aParent);
    34 	CleanupStack::PushL(self);
    39 	CleanupStack::PushL(self);
    35 	self->ConstructL();
    40 	self->ConstructL();
    36 	CleanupStack::Pop(self);
    41 	CleanupStack::Pop(self);
       
    42 	OstTraceFunctionExit1( CBULKTESTTIMER_NEWL_EXIT, ( TUint )( self ) );
    37 	return self;
    43 	return self;
    38 	}
    44 	}
    39 
    45 
    40 
    46 
    41 CBulkTestTimer::CBulkTestTimer(MBulkTestTimerObserver& aParent)
    47 CBulkTestTimer::CBulkTestTimer(MBulkTestTimerObserver& aParent)
    42 :	CTimer(EPriorityStandard),
    48 :	CTimer(EPriorityStandard),
    43 	iParent(aParent)
    49 	iParent(aParent)
    44 	{
    50 	{
       
    51 	OstTraceFunctionEntryExt( CBULKTESTTIMER_CBULKTESTTIMER_ENTRY, this );
    45 	CActiveScheduler::Add(this);
    52 	CActiveScheduler::Add(this);
       
    53 	OstTraceFunctionExit1( CBULKTESTTIMER_CBULKTESTTIMER_EXIT, this );
    46 	}
    54 	}
    47 
    55 
    48 
    56 
    49 CBulkTestTimer::~CBulkTestTimer()
    57 CBulkTestTimer::~CBulkTestTimer()
    50 	{
    58 	{
       
    59 	OstTraceFunctionEntry1( CBULKTESTTIMER_CBULKTESTTIMER_ENTRY_DUP01, this );
       
    60 	OstTraceFunctionExit1( CBULKTESTTIMER_CBULKTESTTIMER_EXIT_DUP01, this );
    51 	}
    61 	}
    52 
    62 
    53 
    63 
    54 void CBulkTestTimer::ConstructL()
    64 void CBulkTestTimer::ConstructL()
    55 	{
    65 	{
    56 	LOG_FUNC
    66 	OstTraceFunctionEntry1( CBULKTESTTIMER_CONSTRUCTL_ENTRY, this );
    57 	CTimer::ConstructL();
    67 	CTimer::ConstructL();
       
    68 	OstTraceFunctionExit1( CBULKTESTTIMER_CONSTRUCTL_EXIT, this );
    58 	}
    69 	}
    59 
    70 
    60 
    71 
    61 void CBulkTestTimer::RunL()
    72 void CBulkTestTimer::RunL()
    62 	{
    73 	{
    63 	LOG_FUNC
    74     OstTraceFunctionEntry1( CBULKTESTTIMER_RUNL_ENTRY, this );
    64 
    75 
    65 	iParent.HandleBulkTestTimerFired();
    76 	iParent.HandleBulkTestTimerFired();
       
    77 	OstTraceFunctionExit1( CBULKTESTTIMER_RUNL_EXIT, this );
    66 	}
    78 	}
    67 
    79 
    68 
    80 
    69 
    81 
    70 //*****************************************************************************************************
    82 //*****************************************************************************************************
    73 //Bulk Test Case Base Class
    85 //Bulk Test Case Base Class
    74 CBaseBulkTestCase::CBaseBulkTestCase(const TDesC& aTestCaseId,TBool aHostFlag, TBool aHostOnly)
    86 CBaseBulkTestCase::CBaseBulkTestCase(const TDesC& aTestCaseId,TBool aHostFlag, TBool aHostOnly)
    75 	: CBaseTestCase(aTestCaseId, aHostFlag, aHostOnly),
    87 	: CBaseTestCase(aTestCaseId, aHostFlag, aHostOnly),
    76 	iInBufferPtr(NULL,0),
    88 	iInBufferPtr(NULL,0),
    77 	iOutBufferPtr(NULL,0),
    89 	iOutBufferPtr(NULL,0),
    78 	iValidateBufferPtr(NULL,0)	
    90 	iValidateBufferPtr(NULL,0)
    79 	{
    91 	{
    80 	
    92 	OstTraceFunctionEntryExt( CBASEBULKTESTCASE_CBASEBULKTESTCASE_ENTRY, this );
       
    93 
       
    94 	OstTraceFunctionExit1( CBASEBULKTESTCASE_CBASEBULKTESTCASE_EXIT, this );
    81 	}
    95 	}
    82 
    96 
    83 
    97 
    84 void CBaseBulkTestCase::BaseBulkConstructL()
    98 void CBaseBulkTestCase::BaseBulkConstructL()
    85 	{
    99 	{
       
   100 	OstTraceFunctionEntry1( CBASEBULKTESTCASE_BASEBULKCONSTRUCTL_ENTRY, this );
    86 	iTestDevice = new RUsbDeviceD(this);
   101 	iTestDevice = new RUsbDeviceD(this);
    87 	BaseConstructL();
   102 	BaseConstructL();
       
   103 	OstTraceFunctionExit1( CBASEBULKTESTCASE_BASEBULKCONSTRUCTL_EXIT, this );
    88 	}
   104 	}
    89 
   105 
    90 
   106 
    91 CBaseBulkTestCase::~CBaseBulkTestCase()
   107 CBaseBulkTestCase::~CBaseBulkTestCase()
    92 	{
   108 	{
    93 	LOG_FUNC
   109 	OstTraceFunctionEntry1( CBASEBULKTESTCASE_CBASEBULKTESTCASE_ENTRY_DUP01, this );
    94 	
   110 
    95 	Cancel();
   111 	Cancel();
    96 
   112 
    97 	//Do this before deleting the transfer objects
   113 	//Do this before deleting the transfer objects
    98 	//NB this should do nothing if already called from a derived test class
   114 	//NB this should do nothing if already called from a derived test class
    99 	CloseInterfaceAndPipes();
   115 	CloseInterfaceAndPipes();
   100 	
   116 
   101 	delete iValidateBuffer;
   117 	delete iValidateBuffer;
   102 	delete iInBuffer;
   118 	delete iInBuffer;
   103 	delete iOutBuffer;
   119 	delete iOutBuffer;
   104 
   120 
   105 	delete iBulkTestTimer;
   121 	delete iBulkTestTimer;
   111 		}
   127 		}
   112 	for(count=0;count<KMaxNumInTransfers;count++)
   128 	for(count=0;count<KMaxNumInTransfers;count++)
   113 		{
   129 		{
   114 		delete iInTransfer[count];
   130 		delete iInTransfer[count];
   115 		}
   131 		}
   116 	
   132 
   117 	delete iControlEp0;
   133 	delete iControlEp0;
   118 	delete iActorFDF;
   134 	delete iActorFDF;
   119 	if(!IsHost() && iTestDevice)
   135 	if(!IsHost() && iTestDevice)
   120 		{
   136 		{
   121 		iTestDevice->Close();
   137 		iTestDevice->Close();
   122 		}
   138 		}
   123 	delete iTestDevice;
   139 	delete iTestDevice;
   124 	}
   140 	OstTraceFunctionExit1( CBASEBULKTESTCASE_CBASEBULKTESTCASE_EXIT_DUP01, this );
   125 	
   141 	}
   126 void CBaseBulkTestCase::ExecuteHostTestCaseL()	
   142 
   127 	{
   143 void CBaseBulkTestCase::ExecuteHostTestCaseL()
   128 	LOG_FUNC
   144 	{
   129 	
   145 	OstTraceFunctionEntry1( CBASEBULKTESTCASE_EXECUTEHOSTTESTCASEL_ENTRY, this );
       
   146 
   130 	iActorFDF = CActorFDF::NewL(*this);
   147 	iActorFDF = CActorFDF::NewL(*this);
   131 	iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0);
   148 	iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0);
   132 	iActorFDF->Monitor();
   149 	iActorFDF->Monitor();
   133 	TimeoutIn(30);
   150 	TimeoutIn(30);
   134 	}
   151 	OstTraceFunctionExit1( CBASEBULKTESTCASE_EXECUTEHOSTTESTCASEL_EXIT, this );
   135 	
   152 	}
       
   153 
   136 void CBaseBulkTestCase::HostDoCancel()
   154 void CBaseBulkTestCase::HostDoCancel()
   137 	{
   155 	{
   138 	LOG_FUNC
   156 	OstTraceFunctionEntry1( CBASEBULKTESTCASE_HOSTDOCANCEL_ENTRY, this );
   139 	
   157 
   140 	// Cancel the test step timeout timer
   158 	// Cancel the test step timeout timer
   141 	
   159 
   142 	CancelTimeout();
   160 	CancelTimeout();
   143 	}
   161 	OstTraceFunctionExit1( CBASEBULKTESTCASE_HOSTDOCANCEL_EXIT, this );
   144 	
   162 	}
   145 	
   163 
       
   164 
   146 void CBaseBulkTestCase::ExecuteDeviceTestCaseL()
   165 void CBaseBulkTestCase::ExecuteDeviceTestCaseL()
   147 	{
   166 	{
   148 	LOG_FUNC
   167 	OstTraceFunctionEntry1( CBASEBULKTESTCASE_EXECUTEDEVICETESTCASEL_ENTRY, this );
   149 	
   168 
   150 	iTestDevice->OpenL(TestCaseId());
   169 	iTestDevice->OpenL(TestCaseId());
   151 	iTestDevice->SubscribeToReports(iStatus);
   170 	iTestDevice->SubscribeToReports(iStatus);
   152 	SetActive();
   171 	SetActive();
   153 	
   172 
   154 	// Connect the device to the host
   173 	// Connect the device to the host
   155 	
   174 
   156 	iTestDevice->SoftwareConnect();
   175 	iTestDevice->SoftwareConnect();
   157 	}
   176 	OstTraceFunctionExit1( CBASEBULKTESTCASE_EXECUTEDEVICETESTCASEL_EXIT, this );
   158 	
   177 	}
       
   178 
   159 void CBaseBulkTestCase::DeviceDoCancel()
   179 void CBaseBulkTestCase::DeviceDoCancel()
   160 	{
   180 	{
   161 	LOG_FUNC
   181 	OstTraceFunctionEntry1( CBASEBULKTESTCASE_DEVICEDOCANCEL_ENTRY, this );
   162 	
   182 
   163 	// Cancel the test device error reports
   183 	// Cancel the test device error reports
   164 	
   184 
   165 	iTestDevice->CancelSubscriptionToReports();
   185 	iTestDevice->CancelSubscriptionToReports();
   166 	}
   186 	OstTraceFunctionExit1( CBASEBULKTESTCASE_DEVICEDOCANCEL_EXIT, this );
   167 	
   187 	}
   168 	
   188 
       
   189 
   169 void CBaseBulkTestCase::DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,
   190 void CBaseBulkTestCase::DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,
   170 				RUsbDevice::TDeviceState aNewState,TInt aCompletionCode)
   191 				RUsbDevice::TDeviceState aNewState,TInt aCompletionCode)
   171 	{
   192 	{
   172 	LOG_FUNC
   193 	OstTraceFunctionEntryExt( CBASEBULKTESTCASE_DEVICESTATECHANGEL_ENTRY, this );
   173 	Cancel();
   194 	Cancel();
   174 	}
   195 	OstTraceFunctionExit1( CBASEBULKTESTCASE_DEVICESTATECHANGEL_EXIT, this );
   175 	
   196 	}
   176 	
   197 
       
   198 
   177 TInt CBaseBulkTestCase::BaseBulkDeviceInsertedL(TUint aDeviceHandle)
   199 TInt CBaseBulkTestCase::BaseBulkDeviceInsertedL(TUint aDeviceHandle)
   178 	{
   200 	{
   179 	LOG_FUNC
   201 	OstTraceFunctionEntryExt( CBASEBULKTESTCASE_BASEBULKDEVICEINSERTEDL_ENTRY, this );
   180 	RDebug::Printf("this - %08x", this);
   202 	OstTrace1(TRACE_NORMAL, CBASEBULKTESTCASE_BASEBULKDEVICEINSERTEDL, "this - %08x", this);
   181 	return BaseBulkDeviceInsertedL(aDeviceHandle, EFalse);
   203 	return BaseBulkDeviceInsertedL(aDeviceHandle, EFalse);
   182 	}
   204 	}
   183 
   205 
   184 void CBaseBulkTestCase::DeviceInsertedL(TUint aDeviceHandle)
   206 void CBaseBulkTestCase::DeviceInsertedL(TUint aDeviceHandle)
   185 	{
   207 	{
       
   208 	OstTraceFunctionEntryExt( CBASEBULKTESTCASE_DEVICEINSERTEDL_ENTRY, this );
   186 	//to be implemnted in individual test cases, possibly with the help of BaseBulkDeviceInsertedL
   209 	//to be implemnted in individual test cases, possibly with the help of BaseBulkDeviceInsertedL
   187 	BaseBulkDeviceInsertedL(aDeviceHandle);
   210 	BaseBulkDeviceInsertedL(aDeviceHandle);
       
   211 	OstTraceFunctionExit1( CBASEBULKTESTCASE_DEVICEINSERTEDL_EXIT, this );
   188 	};
   212 	};
   189 
   213 
   190 TInt CBaseBulkTestCase::BaseBulkDeviceInsertedL(TUint aDeviceHandle, TBool aUseTwoInterfaces)
   214 TInt CBaseBulkTestCase::BaseBulkDeviceInsertedL(TUint aDeviceHandle, TBool aUseTwoInterfaces)
   191 	{
   215 	{
   192 	LOG_FUNC
   216 	OstTraceFunctionEntryExt( CBASEBULKTESTCASE_BASEBULKDEVICEINSERTEDL_ENTRY_DUP01, this );
   193 	TInt err(KErrNone);
   217 	TInt err(KErrNone);
   194 	
   218 
   195 	// Validate connected device	
   219 	// Validate connected device
   196 	CUsbTestDevice& testDevice = iActorFDF->DeviceL(aDeviceHandle);
   220 	CUsbTestDevice& testDevice = iActorFDF->DeviceL(aDeviceHandle);
   197 	
   221 
   198 	RDebug::Printf("device serial number (%S)",&testDevice.SerialNumber());
   222 	OstTraceExt1(TRACE_NORMAL, CBASEBULKTESTCASE_BASEBULKDEVICEINSERTEDL_DUP08, "device serial number (%S)",testDevice.SerialNumber());
   199 	RDebug::Printf("Manufacturer (%S)",&testDevice.Manufacturer());
   223 	OstTraceExt1(TRACE_NORMAL, CBASEBULKTESTCASE_BASEBULKDEVICEINSERTEDL_DUP01, "Manufacturer (%S)",testDevice.Manufacturer());
   200 	RDebug::Printf("Product (%S)",&testDevice.Product());
   224 	OstTraceExt1(TRACE_NORMAL, CBASEBULKTESTCASE_BASEBULKDEVICEINSERTEDL_DUP02, "Product (%S)",testDevice.Product());
   201 	RDebug::Printf("ProductId (%d)",testDevice.ProductId());
   225 	OstTrace1(TRACE_NORMAL, CBASEBULKTESTCASE_BASEBULKDEVICEINSERTEDL_DUP03, "ProductId (%d)",testDevice.ProductId());
   202 	RDebug::Printf("VendorId (%d)",testDevice.VendorId());
   226 	OstTrace1(TRACE_NORMAL, CBASEBULKTESTCASE_BASEBULKDEVICEINSERTEDL_DUP04, "VendorId (%d)",testDevice.VendorId());
   203 	
   227 
   204 	if(testDevice.SerialNumber().Compare(TestCaseId()) != 0)
   228 	if(testDevice.SerialNumber().Compare(TestCaseId()) != 0)
   205 		{
   229 		{
   206 		// Incorrect device for this test case	
   230 		// Incorrect device for this test case
   207 
   231 
   208 		RDebug::Printf("<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
   232 		OstTraceExt3(TRACE_NORMAL, CBASEBULKTESTCASE_BASEBULKDEVICEINSERTEDL_DUP05, "<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
   209 			KErrNotFound,&testDevice.SerialNumber(),&TestCaseId());
   233 			KErrNotFound,testDevice.SerialNumber(),TestCaseId());
   210 
   234 
   211 		// Start the connection timeout again
   235 		// Start the connection timeout again
   212 		TimeoutIn(30);
   236 		TimeoutIn(30);
       
   237 		OstTraceFunctionExitExt( CBASEBULKTESTCASE_BASEBULKDEVICEINSERTEDL_EXIT, this, EDeviceConfigurationError );
   213 		return EDeviceConfigurationError;
   238 		return EDeviceConfigurationError;
   214 		}	
   239 		}
   215 
   240 
   216 
   241 
   217 	TUint32 token0;
   242 	TUint32 token0;
   218 	err = testDevice.Device().GetTokenForInterface(0,token0);
   243 	err = testDevice.Device().GetTokenForInterface(0,token0);
   219 	if(err != KErrNone)
   244 	if(err != KErrNone)
   220 		{
   245 		{
   221 		RDebug::Printf("<Error %d> Token for interface 0 could not be retrieved",err);
   246 		OstTrace1(TRACE_NORMAL, CBASEBULKTESTCASE_BASEBULKDEVICEINSERTEDL_DUP06, "<Error %d> Token for interface 0 could not be retrieved",err);
   222 
   247 
   223 		// Start the connection timeout again
   248 		// Start the connection timeout again
   224 		TimeoutIn(30);
   249 		TimeoutIn(30);
       
   250 		OstTraceFunctionExitExt( CBASEBULKTESTCASE_BASEBULKDEVICEINSERTEDL_EXIT_DUP01, this, EDeviceConfigurationError );
   225 		return EDeviceConfigurationError;
   251 		return EDeviceConfigurationError;
   226 		}
   252 		}
   227 	err = iUsbInterface0.Open(token0); // Default interface setting 0
   253 	err = iUsbInterface0.Open(token0); // Default interface setting 0
   228 	if(err != KErrNone)
   254 	if(err != KErrNone)
   229 		{
   255 		{
   230 		RDebug::Printf("<Error %d> Unable to open interface 0 using token %d",err,token0);
   256 		OstTraceExt2(TRACE_NORMAL, CBASEBULKTESTCASE_BASEBULKDEVICEINSERTEDL_DUP07, "<Error %d> Unable to open interface 0 using token %d",err,token0);
   231 		// Start the connection timeout again
   257 		// Start the connection timeout again
   232 		TimeoutIn(30);
   258 		TimeoutIn(30);
       
   259 		OstTraceFunctionExitExt( CBASEBULKTESTCASE_BASEBULKDEVICEINSERTEDL_EXIT_DUP02, this, EDeviceConfigurationError );
   233 		return EDeviceConfigurationError;
   260 		return EDeviceConfigurationError;
   234 		}
   261 		}
   235 
   262 
   236 	err = SetUpInterfaceAndPipesL(aDeviceHandle, 1);
   263 	err = SetUpInterfaceAndPipesL(aDeviceHandle, 1);
   237 	if(err != ENone)
   264 	if(err != ENone)
   238 		//msg already setup, and failure message sent
   265 		//msg already setup, and failure message sent
   239 		{
   266 		{
   240 		return EDeviceConfigurationError;	
   267 		OstTraceFunctionExitExt( CBASEBULKTESTCASE_BASEBULKDEVICEINSERTEDL_EXIT_DUP03, this, EDeviceConfigurationError );
   241 		}
   268 		return EDeviceConfigurationError;
       
   269 		}
       
   270 	OstTraceFunctionExitExt( CBASEBULKTESTCASE_BASEBULKDEVICEINSERTEDL_EXIT_DUP04, this, ENone );
   242 	return ENone;
   271 	return ENone;
   243 	}
   272 	}
   244 
   273 
   245 
   274 
   246 TInt CBaseBulkTestCase::SetUpInterfaceAndPipesL(TUint aDeviceHandle, TUint8 aInterfaceNum)
   275 TInt CBaseBulkTestCase::SetUpInterfaceAndPipesL(TUint aDeviceHandle, TUint8 aInterfaceNum)
   247 	{
   276 	{
   248 	LOG_FUNC
   277 	OstTraceFunctionEntryExt( CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_ENTRY, this );
   249 	TInt err(KErrNone);
   278 	TInt err(KErrNone);
   250 	TInt endpointAddress;
   279 	TInt endpointAddress;
   251 	RUsbInterface* pTestInterface = NULL;
   280 	RUsbInterface* pTestInterface = NULL;
   252 	RUsbPipe* pTestPipeBulkIn = NULL;
   281 	RUsbPipe* pTestPipeBulkIn = NULL;
   253 	RUsbPipe* pTestPipeBulkOut1 = NULL;
   282 	RUsbPipe* pTestPipeBulkOut1 = NULL;
   254 	RUsbPipe* pTestPipeBulkOut2 = NULL;
   283 	RUsbPipe* pTestPipeBulkOut2 = NULL;
   255 	CUsbTestDevice& testDevice = iActorFDF->DeviceL(aDeviceHandle);
   284 	CUsbTestDevice& testDevice = iActorFDF->DeviceL(aDeviceHandle);
   256 	
   285 
   257 	switch(aInterfaceNum)
   286 	switch(aInterfaceNum)
   258 		{
   287 		{
   259 		case 1:
   288 		case 1:
   260 			pTestInterface = &iUsbInterface1;
   289 			pTestInterface = &iUsbInterface1;
   261 			pTestPipeBulkIn = &iTestPipeInterface1BulkIn;
   290 			pTestPipeBulkIn = &iTestPipeInterface1BulkIn;
   271 		default:
   300 		default:
   272 			User::Panic(_L("Bulk Interface Number Out Of Range"), KErrArgument);
   301 			User::Panic(_L("Bulk Interface Number Out Of Range"), KErrArgument);
   273 			break;
   302 			break;
   274 		}
   303 		}
   275 
   304 
   276 	RDebug::Printf("this - %08x", this);
   305 	OstTrace1(TRACE_NORMAL, CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL, "this - %08x", this);
   277 	
   306 
   278 	TUint32 token;
   307 	TUint32 token;
   279 	err = testDevice.Device().GetTokenForInterface(aInterfaceNum,token);
   308 	err = testDevice.Device().GetTokenForInterface(aInterfaceNum,token);
   280 	if(err != KErrNone)
   309 	if(err != KErrNone)
   281 		{
   310 		{
   282 		TBuf<256> msg;
   311 		TBuf<256> msg;
   283 		msg.Format(_L("<Error %d> Token for interface 1 could not be retrieved"),err);
   312 		msg.Format(_L("<Error %d> Token for interface 1 could not be retrieved"),err);
   284 		RDebug::Print(msg);
   313 		OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_DUP01, msg);
   285 		TTestCaseFailed request(err,msg);
   314 		TTestCaseFailed request(err,msg);
       
   315 		OstTraceFunctionExitExt( CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_EXIT, this, EDeviceConfigurationError );
   286 		return EDeviceConfigurationError;
   316 		return EDeviceConfigurationError;
   287 		}
   317 		}
   288 	if(pTestInterface != NULL)
   318 	if(pTestInterface != NULL)
   289 		{
   319 		{
   290 		err = pTestInterface->Open(token); // Default interface setting 1
   320 		err = pTestInterface->Open(token); // Default interface setting 1
   291 		if(err != KErrNone)
   321 		if(err != KErrNone)
   292 			{
   322 			{
   293 			TBuf<256> msg;
   323 			TBuf<256> msg;
   294 			msg.Format(_L("<Error %d> Unable to open interface 1 using token %d"),err,token);
   324 			msg.Format(_L("<Error %d> Unable to open interface 1 using token %d"),err,token);
   295 			RDebug::Print(msg);
   325 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_DUP02, msg);
   296 			TTestCaseFailed request(err,msg);
   326 			TTestCaseFailed request(err,msg);
       
   327 			OstTraceFunctionExitExt( CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_EXIT_DUP01, this, EDeviceConfigurationError );
   297 			return EDeviceConfigurationError;
   328 			return EDeviceConfigurationError;
   298 			}
   329 			}
   299 		}
   330 		}
   300 	
   331 
   301 	if(pTestPipeBulkIn != NULL)
   332 	if(pTestPipeBulkIn != NULL)
   302 		{
   333 		{
   303 		err = GetEndpointAddress(*pTestInterface,0,KTransferTypeBulk,KEpDirectionIn,endpointAddress);
   334 		err = GetEndpointAddress(*pTestInterface,0,KTransferTypeBulk,KEpDirectionIn,endpointAddress);
   304 		if(err != KErrNone)
   335 		if(err != KErrNone)
   305 			{
   336 			{
   306 			TBuf<256> msg;
   337 			TBuf<256> msg;
   307 			msg.Format(_L("<Error %d> Address for bulk in endpoint could not be obtained"),err);
   338 			msg.Format(_L("<Error %d> Address for bulk in endpoint could not be obtained"),err);
   308 			RDebug::Print(msg);
   339 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_DUP03, msg);
   309 			TTestCaseFailed request(err,msg);
   340 			TTestCaseFailed request(err,msg);
       
   341 			OstTraceFunctionExitExt( CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_EXIT_DUP02, this, EDeviceConfigurationError );
   310 			return EDeviceConfigurationError;
   342 			return EDeviceConfigurationError;
   311 			}
   343 			}
   312 		
   344 
   313 		RDebug::Printf("IN Endpoint address %08x",endpointAddress);
   345 		OstTrace1(TRACE_NORMAL, CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_DUP04, "IN Endpoint address %08x",endpointAddress);
   314 		
   346 
   315 		err = pTestInterface->OpenPipeForEndpoint(*pTestPipeBulkIn,endpointAddress,ETrue);
   347 		err = pTestInterface->OpenPipeForEndpoint(*pTestPipeBulkIn,endpointAddress,ETrue);
   316 		if(err != KErrNone)
   348 		if(err != KErrNone)
   317 			{
   349 			{
   318 			TBuf<256> msg;
   350 			TBuf<256> msg;
   319 			msg.Format(_L("<Error %d> Unable to open pipe for endpoint %08x"),err,endpointAddress);
   351 			msg.Format(_L("<Error %d> Unable to open pipe for endpoint %08x"),err,endpointAddress);
   320 			RDebug::Print(msg);
   352 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_DUP05, msg);
   321 			TTestCaseFailed request(err,msg);
   353 			TTestCaseFailed request(err,msg);
       
   354 			OstTraceFunctionExitExt( CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_EXIT_DUP03, this, EDeviceConfigurationError );
   322 			return EDeviceConfigurationError;
   355 			return EDeviceConfigurationError;
   323 			}
   356 			}
   324 		}
   357 		}
   325 		
   358 
   326 	if(pTestPipeBulkOut1 != NULL)
   359 	if(pTestPipeBulkOut1 != NULL)
   327 		{
   360 		{
   328 		err = GetEndpointAddress(*pTestInterface,0,KTransferTypeBulk,KEpDirectionOut,endpointAddress);
   361 		err = GetEndpointAddress(*pTestInterface,0,KTransferTypeBulk,KEpDirectionOut,endpointAddress);
   329 		if(err != KErrNone)
   362 		if(err != KErrNone)
   330 			{
   363 			{
   331 			TBuf<256> msg;
   364 			TBuf<256> msg;
   332 			msg.Format(_L("<Error %d> Address for(first) bulk out endpoint could not be obtained"),err);
   365 			msg.Format(_L("<Error %d> Address for(first) bulk out endpoint could not be obtained"),err);
   333 			RDebug::Print(msg);
   366 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_DUP06, msg);
   334 			TTestCaseFailed request(err,msg);
   367 			TTestCaseFailed request(err,msg);
       
   368 			OstTraceFunctionExitExt( CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_EXIT_DUP04, this, EDeviceConfigurationError );
   335 			return EDeviceConfigurationError;
   369 			return EDeviceConfigurationError;
   336 			}
   370 			}
   337 		
   371 
   338 		RDebug::Printf("OUT Endpoint address %08x",endpointAddress);
   372 		OstTrace1(TRACE_NORMAL, CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_DUP07, "OUT Endpoint address %08x",endpointAddress);
   339 		
   373 
   340 		err = pTestInterface->OpenPipeForEndpoint(*pTestPipeBulkOut1,endpointAddress,ETrue);
   374 		err = pTestInterface->OpenPipeForEndpoint(*pTestPipeBulkOut1,endpointAddress,ETrue);
   341 		if(err != KErrNone)
   375 		if(err != KErrNone)
   342 			{
   376 			{
   343 			TBuf<256> msg;
   377 			TBuf<256> msg;
   344 			msg.Format(_L("<Error %d> Unable to open pipe for endpoint %08x"),err,endpointAddress);
   378 			msg.Format(_L("<Error %d> Unable to open pipe for endpoint %08x"),err,endpointAddress);
   345 			RDebug::Print(msg);
   379 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_DUP08, msg);
   346 			TTestCaseFailed request(err,msg);
   380 			TTestCaseFailed request(err,msg);
       
   381 			OstTraceFunctionExitExt( CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_EXIT_DUP05, this, EDeviceConfigurationError );
   347 			return EDeviceConfigurationError;
   382 			return EDeviceConfigurationError;
   348 			}
   383 			}
   349 		}
   384 		}
   350 	
   385 
   351 	if(pTestPipeBulkOut2 != NULL)
   386 	if(pTestPipeBulkOut2 != NULL)
   352 		{
   387 		{
   353 		err = GetEndpointAddress(*pTestInterface,0,KTransferTypeBulk,KEpDirectionOut,1,endpointAddress);
   388 		err = GetEndpointAddress(*pTestInterface,0,KTransferTypeBulk,KEpDirectionOut,1,endpointAddress);
   354 		if(err != KErrNone)
   389 		if(err != KErrNone)
   355 			{
   390 			{
   356 			TBuf<256> msg;
   391 			TBuf<256> msg;
   357 			msg.Format(_L("<Error %d> Address for(second) bulk out endpoint could not be obtained"),err);
   392 			msg.Format(_L("<Error %d> Address for(second) bulk out endpoint could not be obtained"),err);
   358 			RDebug::Print(msg);
   393 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_DUP09, msg);
   359 			TTestCaseFailed request(err,msg);
   394 			TTestCaseFailed request(err,msg);
       
   395 			OstTraceFunctionExitExt( CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_EXIT_DUP06, this, EDeviceConfigurationError );
   360 			return EDeviceConfigurationError;
   396 			return EDeviceConfigurationError;
   361 			}
   397 			}
   362 		
   398 
   363 		RDebug::Printf("OUT Endpoint address %08x",endpointAddress);
   399 		OstTrace1(TRACE_NORMAL, CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_DUP10, "OUT Endpoint address %08x",endpointAddress);
   364 		
   400 
   365 		err = pTestInterface->OpenPipeForEndpoint(*pTestPipeBulkOut2,endpointAddress,ETrue);
   401 		err = pTestInterface->OpenPipeForEndpoint(*pTestPipeBulkOut2,endpointAddress,ETrue);
   366 		if(err != KErrNone)
   402 		if(err != KErrNone)
   367 			{
   403 			{
   368 			TBuf<256> msg;
   404 			TBuf<256> msg;
   369 			msg.Format(_L("<Error %d> Unable to open pipe for endpoint %08x"),err,endpointAddress);
   405 			msg.Format(_L("<Error %d> Unable to open pipe for endpoint %08x"),err,endpointAddress);
   370 			RDebug::Print(msg);
   406 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_DUP11, msg);
   371 			TTestCaseFailed request(err,msg);
   407 			TTestCaseFailed request(err,msg);
       
   408 			OstTraceFunctionExitExt( CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_EXIT_DUP07, this, EDeviceConfigurationError );
   372 			return EDeviceConfigurationError;
   409 			return EDeviceConfigurationError;
   373 			}
   410 			}
   374 		}
   411 		}
   375 
   412 
       
   413 	OstTraceFunctionExitExt( CBASEBULKTESTCASE_SETUPINTERFACEANDPIPESL_EXIT_DUP08, this, ENone );
   376 	return ENone;
   414 	return ENone;
   377 	}
   415 	}
   378 	
   416 
   379 void CBaseBulkTestCase::CloseInterfaceAndPipes()
   417 void CBaseBulkTestCase::CloseInterfaceAndPipes()
   380 	{
   418 	{
   381 	LOG_FUNC
   419 	OstTraceFunctionEntry1( CBASEBULKTESTCASE_CLOSEINTERFACEANDPIPES_ENTRY, this );
   382 	
   420 
   383 	// Close the pipe(s) before interface(s)
   421 	// Close the pipe(s) before interface(s)
   384 	iTestPipeInterface2BulkIn.Close();
   422 	iTestPipeInterface2BulkIn.Close();
   385 	iTestPipeInterface2BulkOut1.Close();
   423 	iTestPipeInterface2BulkOut1.Close();
   386 	iTestPipeInterface2BulkOut2.Close();
   424 	iTestPipeInterface2BulkOut2.Close();
   387 	iTestPipeInterface1BulkIn.Close();
   425 	iTestPipeInterface1BulkIn.Close();
   388 	iTestPipeInterface1BulkOut.Close();
   426 	iTestPipeInterface1BulkOut.Close();
   389 	
   427 
   390 	iUsbInterface2.Close();
   428 	iUsbInterface2.Close();
   391 	iUsbInterface1.Close();
   429 	iUsbInterface1.Close();
   392 	iUsbInterface0.Close();
   430 	iUsbInterface0.Close();
       
   431 	OstTraceFunctionExit1( CBASEBULKTESTCASE_CLOSEINTERFACEANDPIPES_EXIT, this );
   393 	}
   432 	}
   394 
   433 
   395 void CBaseBulkTestCase::DeviceRemovedL(TUint aDeviceHandle)
   434 void CBaseBulkTestCase::DeviceRemovedL(TUint aDeviceHandle)
   396 	{
   435 	{
   397 	LOG_FUNC
   436 	OstTraceFunctionEntryExt( CBASEBULKTESTCASE_DEVICEREMOVEDL_ENTRY, this );
   398 	
   437 
   399 	// The test device should not be removed until the test case has passed
   438 	// The test device should not be removed until the test case has passed
   400 	// so this test case has not completed, and state this event as an error
   439 	// so this test case has not completed, and state this event as an error
   401 	
   440 
   402 	TestFailed(KErrDisconnected);
   441 	TestFailed(KErrDisconnected);
   403 	}
   442 	OstTraceFunctionExit1( CBASEBULKTESTCASE_DEVICEREMOVEDL_EXIT, this );
   404 	
   443 	}
   405 	
   444 
       
   445 
   406 void CBaseBulkTestCase::BusErrorL(TInt aError)
   446 void CBaseBulkTestCase::BusErrorL(TInt aError)
   407 	{
   447 	{
   408 	LOG_FUNC
   448 	OstTraceFunctionEntryExt( CBASEBULKTESTCASE_BUSERRORL_ENTRY, this );
   409 	
   449 
   410 	// This test case handles no failiures on the bus
   450 	// This test case handles no failiures on the bus
   411 	
   451 
   412 	TestFailed(KErrCompletion);
   452 	TestFailed(KErrCompletion);
       
   453 	OstTraceFunctionExit1( CBASEBULKTESTCASE_BUSERRORL_EXIT, this );
   413 	}
   454 	}
   414 
   455 
   415 void CBaseBulkTestCase::HostRunL()
   456 void CBaseBulkTestCase::HostRunL()
   416 	{
   457 	{
       
   458 	OstTraceFunctionEntry1( CBASEBULKTESTCASE_HOSTRUNL_ENTRY, this );
   417 	// Obtain the completion code
   459 	// Obtain the completion code
   418 	TInt completionCode(iStatus.Int());
   460 	TInt completionCode(iStatus.Int());
   419 	
   461 
   420 	if(completionCode == KErrNone)
   462 	if(completionCode == KErrNone)
   421 		{
   463 		{
   422 		// Action timeout
   464 		// Action timeout
   423 		RDebug::Printf("<Error> Action timeout");
   465 		OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_HOSTRUNL, "<Error> Action timeout");
   424 		TestFailed(KErrTimedOut);
   466 		TestFailed(KErrTimedOut);
   425 		}
   467 		}
   426 	else
   468 	else
   427 		{
   469 		{
   428 		RDebug::Printf("<Error %d> Timeout timer could not complete",completionCode);
   470 		OstTrace1(TRACE_NORMAL, CBASEBULKTESTCASE_HOSTRUNL_DUP01, "<Error %d> Timeout timer could not complete",completionCode);
   429 		TestFailed(completionCode);
   471 		TestFailed(completionCode);
   430 		}
   472 		}
       
   473 	OstTraceFunctionExit1( CBASEBULKTESTCASE_HOSTRUNL_EXIT, this );
   431 	}
   474 	}
   432 
   475 
   433 void CBaseBulkTestCase::DeviceRunL()
   476 void CBaseBulkTestCase::DeviceRunL()
   434 	{
   477 	{
   435 	LOG_FUNC
   478 	OstTraceFunctionEntry1( CBASEBULKTESTCASE_DEVICERUNL_ENTRY, this );
   436 	
   479 
   437 	// Disconnect the device
   480 	// Disconnect the device
   438 	iTestDevice->SoftwareDisconnect();
   481 	iTestDevice->SoftwareDisconnect();
   439 	
   482 
   440 	// Complete the test case request
   483 	// Complete the test case request
   441 	TestPolicy().SignalTestComplete(iStatus.Int());
   484 	TestPolicy().SignalTestComplete(iStatus.Int());
       
   485 	OstTraceFunctionExit1( CBASEBULKTESTCASE_DEVICERUNL_EXIT, this );
   442 	}
   486 	}
   443 
   487 
   444 TBool CBaseBulkTestCase::ValidateData (const TDesC8& aDataToValidate, const TDesC8& aDataPattern)
   488 TBool CBaseBulkTestCase::ValidateData (const TDesC8& aDataToValidate, const TDesC8& aDataPattern)
   445 	{
   489 	{
       
   490 	OstTraceFunctionEntryExt( CBASEBULKTESTCASE_VALIDATEDATA_ENTRY, this );
   446 	return ValidateData(aDataToValidate, aDataPattern, aDataPattern.Length());
   491 	return ValidateData(aDataToValidate, aDataPattern, aDataPattern.Length());
   447 	}
   492 	}
   448 
   493 
   449 TBool CBaseBulkTestCase::ValidateData (const TDesC8& aDataToValidate, const TDesC8& aDataPattern, const TUint aNumBytes)
   494 TBool CBaseBulkTestCase::ValidateData (const TDesC8& aDataToValidate, const TDesC8& aDataPattern, const TUint aNumBytes)
   450 	{
   495 	{
       
   496 	OstTraceFunctionEntryExt( CBASEBULKTESTCASE_VALIDATEDATA_ENTRY_DUP01, this );
   451 	return ValidateData(aDataToValidate, aDataPattern, 0, aNumBytes);
   497 	return ValidateData(aDataToValidate, aDataPattern, 0, aNumBytes);
   452 	}
   498 	}
   453 
   499 
   454 TBool CBaseBulkTestCase::ValidateData (const TDesC8& aDataToValidate, const TDesC8& aDataPattern, const TUint aStartPoint, const TUint aNumBytes)
   500 TBool CBaseBulkTestCase::ValidateData (const TDesC8& aDataToValidate, const TDesC8& aDataPattern, const TUint aStartPoint, const TUint aNumBytes)
   455 	{
   501 	{
   456 	LOG_FUNC
   502 	OstTraceFunctionEntryExt( CBASEBULKTESTCASE_VALIDATEDATA_ENTRY_DUP02, this );
   457 		
   503 
   458 	__ASSERT_DEBUG(aDataPattern.Length()!=0, User::Panic(_L("Trying to validate with ZERO LENGTH STRING"), KErrArgument));
   504 	__ASSERT_DEBUG(aDataPattern.Length()!=0, User::Panic(_L("Trying to validate with ZERO LENGTH STRING"), KErrArgument));
   459 
   505 
   460 	if(aDataToValidate.Length()!=aNumBytes)
   506 	if(aDataToValidate.Length()!=aNumBytes)
   461 		{
   507 		{
   462 		RDebug::Printf("ROUND TRIP VALIDATION: Length Match Failure, Sent = %d, Returned = %d", aNumBytes, aDataToValidate.Length());
   508 		OstTraceExt2(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA, "ROUND TRIP VALIDATION: Length Match Failure, Sent = %d, Returned = %d", aNumBytes, aDataToValidate.Length());
       
   509 		OstTraceFunctionExitExt( CBASEBULKTESTCASE_VALIDATEDATA_EXIT, this, EFalse );
   463 		return EFalse;
   510 		return EFalse;
   464 		}
   511 		}
   465 	TUint startPoint = aStartPoint%aDataPattern.Length();
   512 	TUint startPoint = aStartPoint%aDataPattern.Length();
   466 	TUint numStartBytes = (aDataPattern.Length() - startPoint)%aDataPattern.Length();
   513 	TUint numStartBytes = (aDataPattern.Length() - startPoint)%aDataPattern.Length();
   467 	numStartBytes = aNumBytes<numStartBytes?aNumBytes:numStartBytes; //never test for more than aNumBytes
   514 	numStartBytes = aNumBytes<numStartBytes?aNumBytes:numStartBytes; //never test for more than aNumBytes
   470 	TUint numEndBytes = aNumBytes - startEndPoint;//fullRepeats*aDataPattern.Length() - numStartBytes;
   517 	TUint numEndBytes = aNumBytes - startEndPoint;//fullRepeats*aDataPattern.Length() - numStartBytes;
   471 	if(numStartBytes)
   518 	if(numStartBytes)
   472 		{
   519 		{
   473 		if(aDataToValidate.Left(numStartBytes).Compare(aDataPattern.Mid(startPoint, numStartBytes)) != 0)
   520 		if(aDataToValidate.Left(numStartBytes).Compare(aDataPattern.Mid(startPoint, numStartBytes)) != 0)
   474 			{
   521 			{
   475 			RDebug::Printf("ROUND TRIP VALIDATION: Start Bytes Match Failure");
   522 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP01, "ROUND TRIP VALIDATION: Start Bytes Match Failure");
   476 			RDebug::Printf("ROUND TRIP VALIDATION: numStartBytes = %d", numStartBytes);
   523 			OstTrace1(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP02, "ROUND TRIP VALIDATION: numStartBytes = %d", numStartBytes);
   477 			RDebug::Printf("Start of EXPECTED data ...");
   524 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP03, "Start of EXPECTED data ...");
   478 			RDebug::RawPrint(aDataPattern.Mid(startPoint, numStartBytes));
   525 			const TPtrC8& midDataPattern = aDataPattern.Mid(startPoint, numStartBytes);
   479 			RDebug::Printf("\n");
   526 			OstTraceData(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP50, "", midDataPattern.Ptr(), midDataPattern.Length());
   480 			RDebug::Printf("Start of RETURNED data ...");				
   527 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP04, "\n");
   481 			RDebug::RawPrint(aDataToValidate.Left(numStartBytes));
   528 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP05, "Start of RETURNED data ...");
   482 			RDebug::Printf("\n");
   529 			const TPtrC8& leftDataToValidate = aDataToValidate.Left(numStartBytes);
       
   530 			OstTraceData(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP51, "", leftDataToValidate.Ptr(), leftDataToValidate.Length());
       
   531 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP06, "\n");
       
   532 			OstTraceFunctionExitExt( CBASEBULKTESTCASE_VALIDATEDATA_EXIT_DUP01, this, EFalse );
   483 			return EFalse;
   533 			return EFalse;
   484 			}
   534 			}
   485 		}
   535 		}
   486 	if(numEndBytes)
   536 	if(numEndBytes)
   487 		{
   537 		{
   488 		if(aDataToValidate.Mid(startEndPoint,numEndBytes).Compare(aDataPattern.Left(numEndBytes)) != 0)
   538 		if(aDataToValidate.Mid(startEndPoint,numEndBytes).Compare(aDataPattern.Left(numEndBytes)) != 0)
   489 			{
   539 			{
   490 			RDebug::Printf("ROUND TRIP VALIDATION: End Bytes Match Failure");
   540 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP07, "ROUND TRIP VALIDATION: End Bytes Match Failure");
   491 			RDebug::Printf("ROUND TRIP VALIDATION: startEndPoint = %d, numEndBytes = %d", startEndPoint, numEndBytes);
   541 			OstTraceExt2(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP08, "ROUND TRIP VALIDATION: startEndPoint = %d, numEndBytes = %d", startEndPoint, numEndBytes);
   492 			RDebug::Printf("End of EXPECTED data ...");
   542 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP09, "End of EXPECTED data ...");
   493 			RDebug::RawPrint(aDataPattern.Left(numEndBytes));
   543 			const TPtrC8& leftDataPattern = aDataPattern.Left(numEndBytes);
   494 			RDebug::Printf("\n");
   544 			OstTraceData(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP52, "", leftDataPattern.Ptr(), leftDataPattern.Length());
   495 			RDebug::Printf("End of RETURNED data ...");				
   545 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP10, "\n");
   496 			RDebug::RawPrint(aDataToValidate.Mid(startEndPoint,numEndBytes));
   546 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP11, "End of RETURNED data ...");
   497 			RDebug::Printf("\n");
   547 			const TPtrC8& midDataToValidate = aDataToValidate.Mid(startEndPoint,numEndBytes);
       
   548 			OstTraceData(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP53, "", midDataToValidate.Ptr(), midDataToValidate.Length());
       
   549 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP12, "\n");
       
   550 			OstTraceFunctionExitExt( CBASEBULKTESTCASE_VALIDATEDATA_EXIT_DUP02, this, EFalse );
   498 			return EFalse;
   551 			return EFalse;
   499 			}
   552 			}
   500 		}
   553 		}
   501 	for(TInt i=0; i<fullRepeats; i++)
   554 	for(TInt i=0; i<fullRepeats; i++)
   502 		{
   555 		{
   503 		if(aDataToValidate.Mid(numStartBytes + i*aDataPattern.Length(),aDataPattern.Length()).Compare(aDataPattern) != 0)
   556 		if(aDataToValidate.Mid(numStartBytes + i*aDataPattern.Length(),aDataPattern.Length()).Compare(aDataPattern) != 0)
   504 			{
   557 			{
   505 			RDebug::Printf("ROUND TRIP VALIDATION: Repeated Bytes Match Failure, Repeat %d",i);
   558 			OstTrace1(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP13, "ROUND TRIP VALIDATION: Repeated Bytes Match Failure, Repeat %d",i);
   506 			RDebug::Printf("Middle block of EXPECTED data ...");
   559 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP14, "Middle block of EXPECTED data ...");
   507 			RDebug::RawPrint(aDataPattern);
   560 			OstTraceData(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP54, "", aDataPattern.Ptr(), aDataPattern.Length());
   508 			RDebug::Printf("\n");
   561 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP15, "\n");
   509 			RDebug::Printf("Middle block of RETURNED data ...");
   562 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP16, "Middle block of RETURNED data ...");
   510 			RDebug::RawPrint(aDataToValidate.Mid(numStartBytes + i*aDataPattern.Length(),aDataPattern.Length()));
   563 			const TPtrC8& midDataToValidate = aDataToValidate.Mid(numStartBytes + i*aDataPattern.Length(),aDataPattern.Length());
   511 			RDebug::Printf("\n");
   564 			OstTraceData(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP55, "", midDataToValidate.Ptr(), midDataToValidate.Length());
       
   565 			OstTrace0(TRACE_NORMAL, CBASEBULKTESTCASE_VALIDATEDATA_DUP17, "\n");
       
   566 			OstTraceFunctionExitExt( CBASEBULKTESTCASE_VALIDATEDATA_EXIT_DUP03, this, EFalse );
   512 			return EFalse; //from 'for' loop
   567 			return EFalse; //from 'for' loop
   513 			}
   568 			}
   514 		}
   569 		}
       
   570 	OstTraceFunctionExitExt( CBASEBULKTESTCASE_VALIDATEDATA_EXIT_DUP04, this, ETrue );
   515 	return ETrue;
   571 	return ETrue;
   516 	}
   572 	}
   517 
   573 
   518 void CBaseBulkTestCase::RecordTime(const TUint8 aTimerIndex)
   574 void CBaseBulkTestCase::RecordTime(const TUint8 aTimerIndex)
   519 	{
   575 	{
   520 	LOG_FUNC
   576 	OstTraceFunctionEntryExt( CBASEBULKTESTCASE_RECORDTIME_ENTRY, this );
   521 	if(aTimerIndex >= KMaxNumTimers)
   577 	if(aTimerIndex >= KMaxNumTimers)
   522 		{
   578 		{
   523 		RDebug::Printf("Record Timer with index %d called - index OUT OF RANGE", aTimerIndex);
   579 		OstTrace1(TRACE_NORMAL, CBASEBULKTESTCASE_RECORDTIME, "Record Timer with index %d called - index OUT OF RANGE", aTimerIndex);
   524 		User::Panic(_L("BAD TIMER INDEX"), KErrArgument);
   580 		User::Panic(_L("BAD TIMER INDEX"), KErrArgument);
   525 		}
   581 		}
   526 	iEndTime[aTimerIndex].HomeTime();
   582 	iEndTime[aTimerIndex].HomeTime();
   527 	iTimeElapsed[aTimerIndex] = iEndTime[aTimerIndex].MicroSecondsFrom(iStartTime[aTimerIndex]);
   583 	iTimeElapsed[aTimerIndex] = iEndTime[aTimerIndex].MicroSecondsFrom(iStartTime[aTimerIndex]);
   528 	RDebug::Printf("Timer with index %d completed in %d uSec", aTimerIndex, (TInt)(iTimeElapsed[aTimerIndex].Int64()));
   584 	OstTraceExt2(TRACE_NORMAL, CBASEBULKTESTCASE_RECORDTIME_DUP01, "Timer with index %d completed in %d uSec", aTimerIndex, (TInt)(iTimeElapsed[aTimerIndex].Int64()));
       
   585 	OstTraceFunctionExit1( CBASEBULKTESTCASE_RECORDTIME_EXIT, this );
   529 	}
   586 	}
   530 
   587 
   531 TInt CBaseBulkTestCase::CheckTimes(const TUint8 aFirstTimerIndex, const TUint8 aSecondTimerIndex, const TUint aPercentage)
   588 TInt CBaseBulkTestCase::CheckTimes(const TUint8 aFirstTimerIndex, const TUint8 aSecondTimerIndex, const TUint aPercentage)
   532 	{
   589 	{
   533 	LOG_FUNC
   590 	OstTraceFunctionEntryExt( CBASEBULKTESTCASE_CHECKTIMES_ENTRY, this );
   534 	if(aFirstTimerIndex >= KMaxNumTimers)
   591 	if(aFirstTimerIndex >= KMaxNumTimers)
   535 		{
   592 		{
   536 		RDebug::Printf("First timer with index %d called - index OUT OF RANGE", aFirstTimerIndex);
   593 		OstTrace1(TRACE_NORMAL, CBASEBULKTESTCASE_CHECKTIMES, "First timer with index %d called - index OUT OF RANGE", aFirstTimerIndex);
   537 		User::Panic(_L("BAD TIMER INDEX"), KErrArgument);
   594 		User::Panic(_L("BAD TIMER INDEX"), KErrArgument);
   538 		}
   595 		}
   539 	if(aSecondTimerIndex >= KMaxNumTimers)
   596 	if(aSecondTimerIndex >= KMaxNumTimers)
   540 		{
   597 		{
   541 		RDebug::Printf("Second timer with index %d called - index OUT OF RANGE", aSecondTimerIndex);
   598 		OstTrace1(TRACE_NORMAL, CBASEBULKTESTCASE_CHECKTIMES_DUP01, "Second timer with index %d called - index OUT OF RANGE", aSecondTimerIndex);
   542 		User::Panic(_L("BAD TIMER INDEX"), KErrArgument);
   599 		User::Panic(_L("BAD TIMER INDEX"), KErrArgument);
   543 		}
   600 		}
   544 
   601 
   545 	TInt ret = KErrNone;
   602 	TInt ret = KErrNone;
   546 	RDebug::Printf("Transfer %d completed in %d uSec\nTransfer %d completed in %d uSec", aFirstTimerIndex, (TInt)(iTimeElapsed[aFirstTimerIndex].Int64()), aSecondTimerIndex, (TInt)(iTimeElapsed[aSecondTimerIndex].Int64()));
   603 	OstTraceExt4(TRACE_NORMAL, CBASEBULKTESTCASE_CHECKTIMES_DUP02, "Transfer %d completed in %d uSec\nTransfer %d completed in %d uSec", aFirstTimerIndex, (TInt)(iTimeElapsed[aFirstTimerIndex].Int64()), aSecondTimerIndex, (TInt)(iTimeElapsed[aSecondTimerIndex].Int64()));
   547 	if(aPercentage*iTimeElapsed[aFirstTimerIndex].Int64() > KPercent*iTimeElapsed[aSecondTimerIndex].Int64())
   604 	if(aPercentage*iTimeElapsed[aFirstTimerIndex].Int64() > KPercent*iTimeElapsed[aSecondTimerIndex].Int64())
   548 		{
   605 		{
   549 		ret = KErrTooBig;
   606 		ret = KErrTooBig;
   550 		RDebug::Printf("Time %d too big", aFirstTimerIndex);
   607 		OstTrace1(TRACE_NORMAL, CBASEBULKTESTCASE_CHECKTIMES_DUP03, "Time %d too big", aFirstTimerIndex);
   551 		}
   608 		}
   552 	if(aPercentage*iTimeElapsed[aSecondTimerIndex].Int64() > KPercent*iTimeElapsed[aFirstTimerIndex].Int64())
   609 	if(aPercentage*iTimeElapsed[aSecondTimerIndex].Int64() > KPercent*iTimeElapsed[aFirstTimerIndex].Int64())
   553 		{
   610 		{
   554 		ret = KErrTooBig;
   611 		ret = KErrTooBig;
   555 		RDebug::Printf("Time %d too big", aSecondTimerIndex);
   612 		OstTrace1(TRACE_NORMAL, CBASEBULKTESTCASE_CHECKTIMES_DUP04, "Time %d too big", aSecondTimerIndex);
   556 		}
   613 		}
   557 	
   614 
       
   615 	OstTraceFunctionExitExt( CBASEBULKTESTCASE_CHECKTIMES_EXIT, this, ret );
   558 	return ret;
   616 	return ret;
   559 	}
   617 	}
   560 
   618 
   561 void CBaseBulkTestCase::ResetTimes(const TUint8 aTimerIndex)
   619 void CBaseBulkTestCase::ResetTimes(const TUint8 aTimerIndex)
   562 	{
   620 	{
       
   621 	OstTraceFunctionEntryExt( CBASEBULKTESTCASE_RESETTIMES_ENTRY, this );
   563 	iStartTime[aTimerIndex] = 0;
   622 	iStartTime[aTimerIndex] = 0;
   564 	iEndTime[aTimerIndex] = 0;
   623 	iEndTime[aTimerIndex] = 0;
   565 	iTimeElapsed[aTimerIndex] = 0;
   624 	iTimeElapsed[aTimerIndex] = 0;
       
   625 	OstTraceFunctionExit1( CBASEBULKTESTCASE_RESETTIMES_EXIT, this );
   566 	}
   626 	}
   567 
   627 
   568 TInt CBaseBulkTestCase::CheckAndResetTimes(const TUint8 aFirstTimerIndex, const TUint8 aSecondTimerIndex, const TUint aPercentage)
   628 TInt CBaseBulkTestCase::CheckAndResetTimes(const TUint8 aFirstTimerIndex, const TUint8 aSecondTimerIndex, const TUint aPercentage)
   569 	{
   629 	{
   570 	LOG_FUNC
   630 	OstTraceFunctionEntryExt( CBASEBULKTESTCASE_CHECKANDRESETTIMES_ENTRY, this );
   571 	
   631 
   572 	TInt ret = CheckTimes(aFirstTimerIndex, aSecondTimerIndex, aPercentage);
   632 	TInt ret = CheckTimes(aFirstTimerIndex, aSecondTimerIndex, aPercentage);
   573 	ResetTimes(aFirstTimerIndex);
   633 	ResetTimes(aFirstTimerIndex);
   574 	ResetTimes(aSecondTimerIndex);
   634 	ResetTimes(aSecondTimerIndex);
   575 	
   635 
       
   636 	OstTraceFunctionExitExt( CBASEBULKTESTCASE_CHECKANDRESETTIMES_EXIT, this, ret );
   576 	return ret;
   637 	return ret;
   577 	}
   638 	}
   578 
   639 
   579 void CBaseBulkTestCase::HandleBulkTestTimerFired()
   640 void CBaseBulkTestCase::HandleBulkTestTimerFired()
   580 	{
   641 	{
       
   642 	OstTraceFunctionEntry1( CBASEBULKTESTCASE_HANDLEBULKTESTTIMERFIRED_ENTRY, this );
   581 	//do nothing here - leave to derived class if required
   643 	//do nothing here - leave to derived class if required
       
   644 	OstTraceFunctionExit1( CBASEBULKTESTCASE_HANDLEBULKTESTTIMERFIRED_EXIT, this );
   582 	}
   645 	}
   583 
   646 
   584 	}//end namespace
   647 	}//end namespace
   585 
   648