kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0488.cpp
changeset 253 d37db4dcc88d
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
252:0a40b8675b23 253:d37db4dcc88d
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-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".
    17 //
    17 //
    18 
    18 
    19 #include "PBASE-T_USBDI-0488.h"
    19 #include "PBASE-T_USBDI-0488.h"
    20 #include "testpolicy.h"
    20 #include "testpolicy.h"
    21 #include "modelleddevices.h"
    21 #include "modelleddevices.h"
       
    22 #include "OstTraceDefinitions.h"
       
    23 #ifdef OST_TRACE_COMPILER_IN_USE
       
    24 #include "PBASE-T_USBDI-0488Traces.h"
       
    25 #endif
    22 #include <d32usbdi_errors.h>
    26 #include <d32usbdi_errors.h>
    23 
    27 
    24 namespace NUnitTesting_USBDI
    28 namespace NUnitTesting_USBDI
    25 	{
    29 	{
    26 
    30 
    27 _LIT(KTestCaseId,"PBASE-T_USBDI-0488");
    31 _LIT(KTestCaseId,"PBASE-T_USBDI-0488");
    28 const TFunctorTestCase<CUT_PBASE_T_USBDI_0488,TBool> CUT_PBASE_T_USBDI_0488::iFunctor(KTestCaseId);
    32 const TFunctorTestCase<CUT_PBASE_T_USBDI_0488,TBool> CUT_PBASE_T_USBDI_0488::iFunctor(KTestCaseId);
    29 
    33 
    30 CUT_PBASE_T_USBDI_0488* CUT_PBASE_T_USBDI_0488::NewL(TBool aHostRole)
    34 CUT_PBASE_T_USBDI_0488* CUT_PBASE_T_USBDI_0488::NewL(TBool aHostRole)
    31 	{
    35 	{
       
    36 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0488_NEWL_ENTRY, aHostRole );
    32 	CUT_PBASE_T_USBDI_0488* self = new (ELeave) CUT_PBASE_T_USBDI_0488(aHostRole);
    37 	CUT_PBASE_T_USBDI_0488* self = new (ELeave) CUT_PBASE_T_USBDI_0488(aHostRole);
    33 	CleanupStack::PushL(self);
    38 	CleanupStack::PushL(self);
    34 	self->ConstructL();
    39 	self->ConstructL();
    35 	CleanupStack::Pop(self);
    40 	CleanupStack::Pop(self);
       
    41 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_NEWL_EXIT, ( TUint )( self ) );
    36 	return self;
    42 	return self;
    37 	}
    43 	}
    38 	
    44 	
    39 
    45 
    40 CUT_PBASE_T_USBDI_0488::CUT_PBASE_T_USBDI_0488(TBool aHostRole)
    46 CUT_PBASE_T_USBDI_0488::CUT_PBASE_T_USBDI_0488(TBool aHostRole)
    41 :	CBaseTestCase(KTestCaseId,aHostRole),
    47 :	CBaseTestCase(KTestCaseId,aHostRole),
    42 	iCaseStep(EInProgress)
    48 	iCaseStep(EInProgress)
    43 	{
    49 	{
       
    50 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0488_CUT_PBASE_T_USBDI_0488_ENTRY, this );
       
    51 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_CUT_PBASE_T_USBDI_0488_EXIT, this );
    44 	} 
    52 	} 
    45 
    53 
    46 
    54 
    47 void CUT_PBASE_T_USBDI_0488::ConstructL()
    55 void CUT_PBASE_T_USBDI_0488::ConstructL()
    48 	{
    56 	{
       
    57 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0488_CONSTRUCTL_ENTRY, this );
    49 	iTestDevice = new RUsbDeviceA(this);
    58 	iTestDevice = new RUsbDeviceA(this);
    50 	BaseConstructL();
    59 	BaseConstructL();
       
    60 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_CONSTRUCTL_EXIT, this );
    51 	}
    61 	}
    52 
    62 
    53 
    63 
    54 CUT_PBASE_T_USBDI_0488::~CUT_PBASE_T_USBDI_0488()
    64 CUT_PBASE_T_USBDI_0488::~CUT_PBASE_T_USBDI_0488()
    55 	{
    65 	{
    56 	LOG_FUNC
    66 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0488_CUT_PBASE_T_USBDI_0488_ENTRY_DUP01, this );
    57 	
    67 	
    58 	Cancel();
    68 	Cancel();
    59 	
    69 	
    60 	// Close the interface
    70 	// Close the interface
    61 	iUsbInterface0.Close();
    71 	iUsbInterface0.Close();
    65 	if(!IsHost() && iTestDevice)
    75 	if(!IsHost() && iTestDevice)
    66 		{
    76 		{
    67 		iTestDevice->Close();
    77 		iTestDevice->Close();
    68 		}		
    78 		}		
    69 	delete iTestDevice;
    79 	delete iTestDevice;
       
    80 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_CUT_PBASE_T_USBDI_0488_EXIT_DUP01, this );
    70 	}
    81 	}
    71 	
    82 	
    72 	
    83 	
    73 void CUT_PBASE_T_USBDI_0488::ExecuteHostTestCaseL()	
    84 void CUT_PBASE_T_USBDI_0488::ExecuteHostTestCaseL()	
    74 	{
    85 	{
    75 	LOG_FUNC
    86 		OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0488_EXECUTEHOSTTESTCASEL_ENTRY, this );
    76 		
    87 		
    77 	iActorFDF = CActorFDF::NewL(*this);
    88 	iActorFDF = CActorFDF::NewL(*this);
    78 	iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0);
    89 	iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0);
    79 	iActorFDF->Monitor();
    90 	iActorFDF->Monitor();
    80 	
    91 	
    81 	TimeoutIn(30);
    92 	TimeoutIn(30);
       
    93 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_EXECUTEHOSTTESTCASEL_EXIT, this );
    82 	}
    94 	}
    83 	
    95 	
    84 /*static*/ TInt CUT_PBASE_T_USBDI_0488::TestSelectAlternateInterfaceThenPanic(TAny* aTest) 
    96 /*static*/ TInt CUT_PBASE_T_USBDI_0488::TestSelectAlternateInterfaceThenPanic(TAny* aTest) 
    85 	{
    97 	{
    86 	LOG_CFUNC
    98 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0488_TESTSELECTALTERNATEINTERFACETHENPANIC_ENTRY, 0 );
    87 	
    99 	
    88 	CTrapCleanup* trapHandler=CTrapCleanup::New();
   100 	CTrapCleanup* trapHandler=CTrapCleanup::New();
    89 	if(!trapHandler)
   101 	if(!trapHandler)
    90 		{
   102 		{
       
   103 		OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0488_TESTSELECTALTERNATEINTERFACETHENPANIC_EXIT, 0, KErrNoMemory );
    91 		return KErrNoMemory;
   104 		return KErrNoMemory;
    92 		}		
   105 		}		
    93 						
   106 						
    94 	CUT_PBASE_T_USBDI_0488* pTest = reinterpret_cast<CUT_PBASE_T_USBDI_0488*>(aTest);
   107 	CUT_PBASE_T_USBDI_0488* pTest = reinterpret_cast<CUT_PBASE_T_USBDI_0488*>(aTest);
    95 	
   108 	
    96 	// change interface setting whilst pipes are opened in another alt. setting, should panic
   109 	// change interface setting whilst pipes are opened in another alt. setting, should panic
    97 	pTest->iUsbInterface1.SelectAlternateInterface(0); // panic expected
   110 	pTest->iUsbInterface1.SelectAlternateInterface(0); // panic expected
    98 	
   111 	
    99 	// Should never get here.*/
   112 	// Should never get here.*/
       
   113 	OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0488_TESTSELECTALTERNATEINTERFACETHENPANIC_EXIT_DUP01, 0, KErrNone );
   100 	return KErrNone;
   114 	return KErrNone;
   101 	}
   115 	}
   102 	
   116 	
   103 	
   117 	
   104 	
   118 	
   105 void CUT_PBASE_T_USBDI_0488::HostDoCancel()
   119 void CUT_PBASE_T_USBDI_0488::HostDoCancel()
   106 	{
   120 	{
   107 	LOG_FUNC	
   121 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0488_HOSTDOCANCEL_ENTRY, this );
   108 	// Cancel the timeout timer	
   122 	// Cancel the timeout timer	
   109 	CancelTimeout();
   123 	CancelTimeout();
       
   124 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_HOSTDOCANCEL_EXIT, this );
   110 	}
   125 	}
   111 	
   126 	
   112 	
   127 	
   113 void CUT_PBASE_T_USBDI_0488::ExecuteDeviceTestCaseL()	
   128 void CUT_PBASE_T_USBDI_0488::ExecuteDeviceTestCaseL()	
   114 	{
   129 	{
   115 	LOG_FUNC	
   130 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0488_EXECUTEDEVICETESTCASEL_ENTRY, this );
   116 	iTestDevice->OpenL(TestCaseId());
   131 	iTestDevice->OpenL(TestCaseId());
   117 	iTestDevice->SubscribeToReports(iStatus);
   132 	iTestDevice->SubscribeToReports(iStatus);
   118 	SetActive();
   133 	SetActive();
   119 	iTestDevice->SoftwareConnect();
   134 	iTestDevice->SoftwareConnect();
       
   135 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_EXECUTEDEVICETESTCASEL_EXIT, this );
   120 	}
   136 	}
   121 	
   137 	
   122 void CUT_PBASE_T_USBDI_0488::DeviceDoCancel()
   138 void CUT_PBASE_T_USBDI_0488::DeviceDoCancel()
   123 	{
   139 	{
   124 	LOG_FUNC	
   140 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0488_DEVICEDOCANCEL_ENTRY, this );
   125 	// Cancel the device	
   141 	// Cancel the device	
   126 	iTestDevice->CancelSubscriptionToReports();
   142 	iTestDevice->CancelSubscriptionToReports();
       
   143 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_DEVICEDOCANCEL_EXIT, this );
   127 	}
   144 	}
   128 	
   145 	
   129 	
   146 	
   130 void CUT_PBASE_T_USBDI_0488::DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,RUsbDevice::TDeviceState aNewState,
   147 void CUT_PBASE_T_USBDI_0488::DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,RUsbDevice::TDeviceState aNewState,
   131 		TInt aCompletionCode)
   148 		TInt aCompletionCode)
   132 	{
   149 	{
   133 	LOG_FUNC	
   150 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0488_DEVICESTATECHANGEL_ENTRY, this );
       
   151 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_DEVICESTATECHANGEL_EXIT, this );
   134 	}
   152 	}
   135 
   153 
   136 
   154 
   137 void CUT_PBASE_T_USBDI_0488::DeviceInsertedL(TUint aDeviceHandle)
   155 void CUT_PBASE_T_USBDI_0488::DeviceInsertedL(TUint aDeviceHandle)
   138 	{
   156 	{
   139 	LOG_FUNC
   157 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0488_DEVICEINSERTEDL_ENTRY, this );
   140 	Cancel();
   158 	Cancel();
   141 	TInt err(KErrNone);
   159 	TInt err(KErrNone);
   142 	
   160 	
   143 	// Validate that device is as expected
   161 	// Validate that device is as expected
   144 	CUsbTestDevice& testDevice = iActorFDF->DeviceL(aDeviceHandle);
   162 	CUsbTestDevice& testDevice = iActorFDF->DeviceL(aDeviceHandle);
   145 	if(testDevice.SerialNumber().Compare(TestCaseId()) != 0)
   163 	if(testDevice.SerialNumber().Compare(TestCaseId()) != 0)
   146 		{
   164 		{
   147 		// Incorrect device for this test case
   165 		// Incorrect device for this test case
   148 		RDebug::Printf("<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
   166 		OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0488_DEVICEINSERTEDL, "<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
   149 			KErrNotFound,&testDevice.SerialNumber(),&TestCaseId());
   167 			KErrNotFound,testDevice.SerialNumber(),TestCaseId());
   150 		// Start the connection timeout again
   168 		// Start the connection timeout again
   151 		CancelTimeout();
   169 		CancelTimeout();
   152 		iTimer.After(iStatus,30000000);
   170 		iTimer.After(iStatus,30000000);
   153 		SetActive();
   171 		SetActive();
       
   172 		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_DEVICEINSERTEDL_EXIT, this );
   154 		return;
   173 		return;
   155 		}
   174 		}
   156 	
   175 	
   157 	
   176 	
   158 	TUint32 token0,token1;
   177 	TUint32 token0,token1;
   159 	err = testDevice.Device().GetTokenForInterface(0,token0);
   178 	err = testDevice.Device().GetTokenForInterface(0,token0);
   160 	if(err != KErrNone)
   179 	if(err != KErrNone)
   161 		{
   180 		{
   162 		RDebug::Printf("<Error %d> Token for interface 0 could not be retrieved",err);
   181 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0488_DEVICEINSERTEDL_DUP01, "<Error %d> Token for interface 0 could not be retrieved",err);
   163 		return TestFailed(err);
   182 		return TestFailed(err);
   164 		}
   183 		}
   165 	err = iUsbInterface0.Open(token0); // Default interface setting 0
   184 	err = iUsbInterface0.Open(token0); // Default interface setting 0
   166 	if(err != KErrNone)
   185 	if(err != KErrNone)
   167 		{
   186 		{
   168 		RDebug::Printf("<Error %d> Unable to open interface 0 using token %d",err,token0);
   187 		OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_0488_DEVICEINSERTEDL_DUP02, "<Error %d> Unable to open interface 0 using token %d",err,token0);
   169 		return TestFailed(err);
   188 		return TestFailed(err);
   170 		}
   189 		}
   171 		
   190 		
   172 	__UHEAP_MARK;
   191 	__UHEAP_MARK;
   173 	err = testDevice.Device().GetTokenForInterface(1,token1);
   192 	err = testDevice.Device().GetTokenForInterface(1,token1);
   174 	if(err != KErrNone)
   193 	if(err != KErrNone)
   175 		{
   194 		{
   176 		TBuf<256> msg;
   195 		TBuf<256> msg;
   177 		msg.Format(_L("<Error %d> Token for interface 1 could not be retrieved"),err);
   196 		msg.Format(_L("<Error %d> Token for interface 1 could not be retrieved"),err);
   178 		RDebug::Print(msg);
   197 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0488_DEVICEINSERTEDL_DUP03, msg);
   179 		iCaseStep = EFailed;
   198 		iCaseStep = EFailed;
   180 		TTestCaseFailed request(err,msg);
   199 		TTestCaseFailed request(err,msg);
   181 		return iControlEp0->SendRequest(request,this);
   200 		return iControlEp0->SendRequest(request,this);
   182 		}
   201 		}
   183 	err = iUsbInterface1.Open(token1); // Default interface setting 0
   202 	err = iUsbInterface1.Open(token1); // Default interface setting 0
   184 	if(err != KErrNone)
   203 	if(err != KErrNone)
   185 		{
   204 		{
   186 		TBuf<256> msg;
   205 		TBuf<256> msg;
   187 		msg.Format(_L("<Error %d> Unable to open interface 1 using token %d"),err,token1);
   206 		msg.Format(_L("<Error %d> Unable to open interface 1 using token %d"),err,token1);
   188 		RDebug::Print(msg);
   207 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0488_DEVICEINSERTEDL_DUP04, msg);
   189 		iCaseStep = EFailed;
   208 		iCaseStep = EFailed;
   190 		TTestCaseFailed request(err,msg);
   209 		TTestCaseFailed request(err,msg);
   191 		return iControlEp0->SendRequest(request,this);
   210 		return iControlEp0->SendRequest(request,this);
   192 		} 
   211 		} 
   193 	
   212 	
   195 	err = iUsbInterface1.SelectAlternateInterface(1);
   214 	err = iUsbInterface1.SelectAlternateInterface(1);
   196 	if(err != KErrNone)
   215 	if(err != KErrNone)
   197 		{
   216 		{
   198 		TBuf<256> msg;
   217 		TBuf<256> msg;
   199 		msg.Format(_L("<Error %d> Selecting alternate interface setting 1 on interface 1"),err);
   218 		msg.Format(_L("<Error %d> Selecting alternate interface setting 1 on interface 1"),err);
   200 		RDebug::Print(msg);
   219 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0488_DEVICEINSERTEDL_DUP05, msg);
   201 		iCaseStep = EFailed;
   220 		iCaseStep = EFailed;
   202 		TTestCaseFailed request(err,msg);
   221 		TTestCaseFailed request(err,msg);
   203 		iControlEp0->SendRequest(request,this);
   222 		iControlEp0->SendRequest(request,this);
       
   223 		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_DEVICEINSERTEDL_EXIT_DUP01, this );
   204 		return;
   224 		return;
   205 		}  
   225 		}  
   206 	
   226 	
   207 	// Open a pipe for endpoint (Int in)	
   227 	// Open a pipe for endpoint (Int in)	
   208 	TInt endpointAddress;
   228 	TInt endpointAddress;
   209 	err = GetEndpointAddress(iUsbInterface1,1,KTransferTypeInterrupt,KEpDirectionIn,endpointAddress);
   229 	err = GetEndpointAddress(iUsbInterface1,1,KTransferTypeInterrupt,KEpDirectionIn,endpointAddress);
   210 	if(err != KErrNone)
   230 	if(err != KErrNone)
   211 		{
   231 		{
   212 		TBuf<256> msg;
   232 		TBuf<256> msg;
   213 		msg.Format(_L("<Error %d> unable to get endpoint address for interrupt in endpoint"),err);
   233 		msg.Format(_L("<Error %d> unable to get endpoint address for interrupt in endpoint"),err);
   214 		RDebug::Print(msg);
   234 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0488_DEVICEINSERTEDL_DUP06, msg);
   215 		iCaseStep = EFailed;
   235 		iCaseStep = EFailed;
   216 		TTestCaseFailed request(err,msg);
   236 		TTestCaseFailed request(err,msg);
   217 		iControlEp0->SendRequest(request,this);
   237 		iControlEp0->SendRequest(request,this);
       
   238 		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_DEVICEINSERTEDL_EXIT_DUP02, this );
   218 		return;
   239 		return;
   219 		}	
   240 		}	
   220 	
   241 	
   221 	err = iUsbInterface1.OpenPipeForEndpoint(iInPipe,endpointAddress,EFalse);
   242 	err = iUsbInterface1.OpenPipeForEndpoint(iInPipe,endpointAddress,EFalse);
   222 	if(err != KErrNone)
   243 	if(err != KErrNone)
   223 		{
   244 		{
   224 		TBuf<256> msg;
   245 		TBuf<256> msg;
   225 		msg.Format(_L("<Error %d> Unable to open pipe for endpoint 1"),err);
   246 		msg.Format(_L("<Error %d> Unable to open pipe for endpoint 1"),err);
   226 		RDebug::Print(msg);
   247 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0488_DEVICEINSERTEDL_DUP07, msg);
   227 		iCaseStep = EFailed;
   248 		iCaseStep = EFailed;
   228 		TTestCaseFailed request(err,msg);
   249 		TTestCaseFailed request(err,msg);
   229 		return iControlEp0->SendRequest(request,this);		
   250 		return iControlEp0->SendRequest(request,this);		
   230 		}		
   251 		}		
   231 
   252 
   250 	}
   271 	}
   251 
   272 
   252 
   273 
   253 void CUT_PBASE_T_USBDI_0488::Ep0TransferCompleteL(TInt aCompletionCode)
   274 void CUT_PBASE_T_USBDI_0488::Ep0TransferCompleteL(TInt aCompletionCode)
   254 	{
   275 	{
   255 	LOG_FUNC
   276 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0488_EP0TRANSFERCOMPLETEL_ENTRY, this );
   256 	
   277 	
   257 	RDebug::Printf("Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
   278 	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0488_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
   258 	
   279 	
   259 	if(aCompletionCode != KErrNone)
   280 	if(aCompletionCode != KErrNone)
   260 		{	
   281 		{	
   261 		TBuf<256> msg;
   282 		TBuf<256> msg;
   262 		msg.Format(_L("<Error %d> Transfer to control endpoint 0 was not successful"),aCompletionCode);
   283 		msg.Format(_L("<Error %d> Transfer to control endpoint 0 was not successful"),aCompletionCode);
   263 		RDebug::Print(msg);
   284 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0488_EP0TRANSFERCOMPLETEL_DUP01, msg);
   264 		}
   285 		}
   265 
   286 
   266 	if(iCaseStep == EPassed)
   287 	if(iCaseStep == EPassed)
   267 		{	
   288 		{	
   268 		if(aCompletionCode == KErrNone)
   289 		if(aCompletionCode == KErrNone)
   275 	
   296 	
   276 	if(iCaseStep == EFailed)
   297 	if(iCaseStep == EFailed)
   277 		{
   298 		{
   278 		return TestFailed(KErrCompletion);
   299 		return TestFailed(KErrCompletion);
   279 		}	
   300 		}	
       
   301 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_EP0TRANSFERCOMPLETEL_EXIT, this );
   280 	}
   302 	}
   281 	
   303 	
   282 
   304 
   283 void CUT_PBASE_T_USBDI_0488::DeviceRemovedL(TUint aDeviceHandle)
   305 void CUT_PBASE_T_USBDI_0488::DeviceRemovedL(TUint aDeviceHandle)
   284 	{
   306 	{
   285 	LOG_FUNC
   307 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0488_DEVICEREMOVEDL_ENTRY, this );
   286 	
   308 	
   287 	// The test device should not be removed until the test case has passed
   309 	// The test device should not be removed until the test case has passed
   288 	// so this test case has not completed, and state this event as an error	
   310 	// so this test case has not completed, and state this event as an error	
   289 	TestFailed(KErrDisconnected);
   311 	TestFailed(KErrDisconnected);
       
   312 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_DEVICEREMOVEDL_EXIT, this );
   290 	}
   313 	}
   291 	
   314 	
   292 	
   315 	
   293 void CUT_PBASE_T_USBDI_0488::BusErrorL(TInt aError)
   316 void CUT_PBASE_T_USBDI_0488::BusErrorL(TInt aError)
   294 	{
   317 	{
   295 	LOG_FUNC
   318 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0488_BUSERRORL_ENTRY, this );
   296 	
   319 	
   297 	// This test case handles no failiures on the bus	
   320 	// This test case handles no failiures on the bus	
   298 	TestFailed(KErrCompletion);
   321 	TestFailed(KErrCompletion);
       
   322 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_BUSERRORL_EXIT, this );
   299 	}
   323 	}
   300 
   324 
   301 void CUT_PBASE_T_USBDI_0488::HostRunL()
   325 void CUT_PBASE_T_USBDI_0488::HostRunL()
   302 	{
   326 	{
   303 	LOG_FUNC	
   327 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0488_HOSTRUNL_ENTRY, this );
   304 	// Obtain the completion code
   328 	// Obtain the completion code
   305 	TInt completionCode(iStatus.Int());
   329 	TInt completionCode(iStatus.Int());
   306 	
   330 	
   307 	if(completionCode == KErrNone)
   331 	if(completionCode == KErrNone)
   308 		{
   332 		{
   309 		// Action timeout
   333 		// Action timeout
   310 		RDebug::Printf("<Error> Action timeout");
   334 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0488_HOSTRUNL, "<Error> Action timeout");
   311 		TestFailed(KErrTimedOut);
   335 		TestFailed(KErrTimedOut);
   312 		}
   336 		}
   313 	else
   337 	else
   314 		{
   338 		{
   315 		RDebug::Printf("<Error %d> Timeout timer could not complete",completionCode);
   339 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0488_HOSTRUNL_DUP01, "<Error %d> Timeout timer could not complete",completionCode);
   316 		TestFailed(completionCode);
   340 		TestFailed(completionCode);
   317 		}
   341 		}
       
   342 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_HOSTRUNL_EXIT, this );
   318 	}
   343 	}
   319 
   344 
   320 void CUT_PBASE_T_USBDI_0488::DeviceRunL()
   345 void CUT_PBASE_T_USBDI_0488::DeviceRunL()
   321 	{
   346 	{
   322 	LOG_FUNC
   347 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0488_DEVICERUNL_ENTRY, this );
   323 	
   348 	
   324 	// Disconnect the device	
   349 	// Disconnect the device	
   325 	iTestDevice->SoftwareDisconnect();
   350 	iTestDevice->SoftwareDisconnect();
   326 	
   351 	
   327 	// Complete the test case request	
   352 	// Complete the test case request	
   328 	TestPolicy().SignalTestComplete(iStatus.Int());
   353 	TestPolicy().SignalTestComplete(iStatus.Int());
   329 	}
   354 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0488_DEVICERUNL_EXIT, this );
   330 
   355 	}
   331 	
   356 
   332 	}
   357 	
       
   358 	}