kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0473.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".
    19 #include "PBASE-T_USBDI-0473.h"
    19 #include "PBASE-T_USBDI-0473.h"
    20 #include <d32usbc.h>
    20 #include <d32usbc.h>
    21 #include "testdebug.h"
    21 #include "testdebug.h"
    22 #include "modelleddevices.h"
    22 #include "modelleddevices.h"
    23 #include "TestPolicy.h"
    23 #include "TestPolicy.h"
       
    24 #include "OstTraceDefinitions.h"
       
    25 #ifdef OST_TRACE_COMPILER_IN_USE
       
    26 #include "PBASE-T_USBDI-0473Traces.h"
       
    27 #endif
    24 
    28 
    25 namespace NUnitTesting_USBDI
    29 namespace NUnitTesting_USBDI
    26 	{
    30 	{
    27 	
    31 	
    28 _LIT(KTestCaseId,"PBASE-T_USBDI-0473");
    32 _LIT(KTestCaseId,"PBASE-T_USBDI-0473");
    29 const TFunctorTestCase<CUT_PBASE_T_USBDI_0473,TBool> CUT_PBASE_T_USBDI_0473::iFunctor(KTestCaseId);	
    33 const TFunctorTestCase<CUT_PBASE_T_USBDI_0473,TBool> CUT_PBASE_T_USBDI_0473::iFunctor(KTestCaseId);	
    30 
    34 
    31 CUT_PBASE_T_USBDI_0473* CUT_PBASE_T_USBDI_0473::NewL(TBool aHostRole)
    35 CUT_PBASE_T_USBDI_0473* CUT_PBASE_T_USBDI_0473::NewL(TBool aHostRole)
    32 	{
    36 	{
       
    37 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_NEWL_ENTRY, aHostRole );
    33 	CUT_PBASE_T_USBDI_0473* self = new (ELeave) CUT_PBASE_T_USBDI_0473(aHostRole);
    38 	CUT_PBASE_T_USBDI_0473* self = new (ELeave) CUT_PBASE_T_USBDI_0473(aHostRole);
    34 	CleanupStack::PushL(self);
    39 	CleanupStack::PushL(self);
    35 	self->ConstructL();
    40 	self->ConstructL();
    36 	CleanupStack::Pop(self);
    41 	CleanupStack::Pop(self);
       
    42 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_NEWL_EXIT, ( TUint )( self ) );
    37 	return self; 
    43 	return self; 
    38 	}
    44 	}
    39 	   
    45 	   
    40 
    46 
    41 CUT_PBASE_T_USBDI_0473::CUT_PBASE_T_USBDI_0473(TBool aHostRole)
    47 CUT_PBASE_T_USBDI_0473::CUT_PBASE_T_USBDI_0473(TBool aHostRole)
    42 :	CBaseTestCase(KTestCaseId,aHostRole),
    48 :	CBaseTestCase(KTestCaseId,aHostRole),
    43 	iSuspendedI0(EFalse),
    49 	iSuspendedI0(EFalse),
    44 	iSuspendedI1(EFalse),
    50 	iSuspendedI1(EFalse),
    45 	iDeviceNotificationPending(ETrue)
    51 	iDeviceNotificationPending(ETrue)
    46 	{
    52 	{
       
    53 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_CUT_PBASE_T_USBDI_0473_ENTRY, this );
       
    54 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_CUT_PBASE_T_USBDI_0473_EXIT, this );
    47 	} 
    55 	} 
    48 
    56 
    49 
    57 
    50 void CUT_PBASE_T_USBDI_0473::ConstructL()
    58 void CUT_PBASE_T_USBDI_0473::ConstructL()
    51 	{
    59 	{
       
    60 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_CONSTRUCTL_ENTRY, this );
    52 	iTestDevice = new RUsbDeviceA(this);
    61 	iTestDevice = new RUsbDeviceA(this);
    53 	BaseConstructL();
    62 	BaseConstructL();
       
    63 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_CONSTRUCTL_EXIT, this );
    54 	}
    64 	}
    55 
    65 
    56 
    66 
    57 CUT_PBASE_T_USBDI_0473::~CUT_PBASE_T_USBDI_0473()
    67 CUT_PBASE_T_USBDI_0473::~CUT_PBASE_T_USBDI_0473()
    58 	{
    68 	{
    59 	LOG_FUNC
    69 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_CUT_PBASE_T_USBDI_0473_ENTRY_DUP01, this );
    60 	
    70 	
    61 	// Cancel any async operations
    71 	// Cancel any async operations
    62 	
    72 	
    63 	Cancel(); // Cancel host timer
    73 	Cancel(); // Cancel host timer
    64 	
    74 	
    76 	if(!IsHost() && iTestDevice)
    86 	if(!IsHost() && iTestDevice)
    77 		{
    87 		{
    78 		iTestDevice->Close();
    88 		iTestDevice->Close();
    79 		}		
    89 		}		
    80 	delete iTestDevice;
    90 	delete iTestDevice;
       
    91 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_CUT_PBASE_T_USBDI_0473_EXIT_DUP01, this );
    81 	}
    92 	}
    82 
    93 
    83 
    94 
    84 void CUT_PBASE_T_USBDI_0473::ExecuteHostTestCaseL()
    95 void CUT_PBASE_T_USBDI_0473::ExecuteHostTestCaseL()
    85 	{
    96 	{
    86 	LOG_FUNC
    97 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_EXECUTEHOSTTESTCASEL_ENTRY, this );
    87 	iCaseStep = EStepSuspend;
    98 	iCaseStep = EStepSuspend;
    88 	iActorFDF = CActorFDF::NewL(*this);
    99 	iActorFDF = CActorFDF::NewL(*this);
    89 	iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0);
   100 	iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0);
    90 	iInterface0Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface0,TCallBack(CUT_PBASE_T_USBDI_0473::Interface0ResumedL,this));
   101 	iInterface0Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface0,TCallBack(CUT_PBASE_T_USBDI_0473::Interface0ResumedL,this));
    91 	iInterface1Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface1,TCallBack(CUT_PBASE_T_USBDI_0473::Interface1ResumedL,this));
   102 	iInterface1Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface1,TCallBack(CUT_PBASE_T_USBDI_0473::Interface1ResumedL,this));
    93 	// Monitor for device connections
   104 	// Monitor for device connections
    94 	iActorFDF->Monitor();
   105 	iActorFDF->Monitor();
    95 
   106 
    96 	// Start the connection timeout	
   107 	// Start the connection timeout	
    97 	TimeoutIn(30);
   108 	TimeoutIn(30);
       
   109 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_EXECUTEHOSTTESTCASEL_EXIT, this );
    98 	}
   110 	}
    99 
   111 
   100 void CUT_PBASE_T_USBDI_0473::ExecuteDeviceTestCaseL()
   112 void CUT_PBASE_T_USBDI_0473::ExecuteDeviceTestCaseL()
   101 	{
   113 	{
   102 	LOG_FUNC
   114     OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_EXECUTEDEVICETESTCASEL_ENTRY, this );
   103 
   115 
   104 	// Construct the device for the test case
   116 	// Construct the device for the test case
   105 	iTestDevice->OpenL(TestCaseId());
   117 	iTestDevice->OpenL(TestCaseId());
   106 	iTestDevice->SubscribeToReports(iStatus);
   118 	iTestDevice->SubscribeToReports(iStatus);
   107 	SetActive();
   119 	SetActive();
   108 
   120 
   109 	// Connect the test device	
   121 	// Connect the test device	
   110 	iTestDevice->SoftwareConnect();
   122 	iTestDevice->SoftwareConnect();
       
   123 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_EXECUTEDEVICETESTCASEL_EXIT, this );
   111 	}
   124 	}
   112 	
   125 	
   113 	
   126 	
   114 void CUT_PBASE_T_USBDI_0473::HostDoCancel()
   127 void CUT_PBASE_T_USBDI_0473::HostDoCancel()
   115 	{
   128 	{
   116 	LOG_FUNC
   129     OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_HOSTDOCANCEL_ENTRY, this );
   117 
   130 
   118 	// Cancel the timeout timer
   131 	// Cancel the timeout timer
   119 	CancelTimeout();
   132 	CancelTimeout();
       
   133 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_HOSTDOCANCEL_EXIT, this );
   120 	}
   134 	}
   121 
   135 
   122 
   136 
   123 void CUT_PBASE_T_USBDI_0473::DeviceDoCancel()
   137 void CUT_PBASE_T_USBDI_0473::DeviceDoCancel()
   124 	{
   138 	{
   125 	LOG_FUNC
   139 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_DEVICEDOCANCEL_ENTRY, this );
   126 	
   140 	
   127 	// Cancel the device	
   141 	// Cancel the device	
   128 	iTestDevice->CancelSubscriptionToReports();
   142 	iTestDevice->CancelSubscriptionToReports();
       
   143 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICEDOCANCEL_EXIT, this );
   129 	}
   144 	}
   130 	
   145 	
   131 void CUT_PBASE_T_USBDI_0473::DeviceInsertedL(TUint aDeviceHandle)
   146 void CUT_PBASE_T_USBDI_0473::DeviceInsertedL(TUint aDeviceHandle)
   132 	{
   147 	{
   133 	LOG_FUNC
   148     OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_ENTRY, this );
   134 
   149 
   135 	Cancel(); // Cancel the timer
   150 	Cancel(); // Cancel the timer
   136 	TInt err(KErrNone);
   151 	TInt err(KErrNone);
   137 	iDeviceHandle = aDeviceHandle;
   152 	iDeviceHandle = aDeviceHandle;
   138 	iActorFDF->Monitor();
   153 	iActorFDF->Monitor();
   141 	CUsbTestDevice& testDevice = iActorFDF->DeviceL(aDeviceHandle);
   156 	CUsbTestDevice& testDevice = iActorFDF->DeviceL(aDeviceHandle);
   142 	if(testDevice.SerialNumber().Compare(TestCaseId()) != 0)
   157 	if(testDevice.SerialNumber().Compare(TestCaseId()) != 0)
   143 		{
   158 		{
   144 		// Incorrect device for this test case
   159 		// Incorrect device for this test case
   145 
   160 
   146 		RDebug::Printf("<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
   161 		OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL, "<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
   147 			KErrNotFound,&testDevice.SerialNumber(),&TestCaseId());
   162 			KErrNotFound,testDevice.SerialNumber(),TestCaseId());
   148 
   163 
   149 		// Start the connection timeout again
   164 		// Start the connection timeout again
   150 		TimeoutIn(30);
   165 		TimeoutIn(30);
       
   166 		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_EXIT, this );
   151 		return;
   167 		return;
   152 		}	
   168 		}	
   153 	// Check tree now	
   169 	// Check tree now	
   154 	CHECK(CheckTreeAfterDeviceInsertion(testDevice, _L("RDeviceA")) == KErrNone);
   170 	CHECK(CheckTreeAfterDeviceInsertion(testDevice, _L("RDeviceA")) == KErrNone);
   155 		
   171 		
   159 		case EStepSuspend:
   175 		case EStepSuspend:
   160 			{
   176 			{
   161 			TUint32 token1(0);
   177 			TUint32 token1(0);
   162 			TUint32 token2(0);
   178 			TUint32 token2(0);
   163 	
   179 	
   164 			RDebug::Printf("Obtaining token for interface 0");
   180 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP01, "Obtaining token for interface 0");
   165 			err = testDevice.Device().GetTokenForInterface(0,token1);
   181 			err = testDevice.Device().GetTokenForInterface(0,token1);
   166 			if(err != KErrNone)
   182 			if(err != KErrNone)
   167 				{
   183 				{
   168 				RDebug::Printf("<Error %d> Token for interface 0 could not be retrieved",err);
   184 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP02, "<Error %d> Token for interface 0 could not be retrieved",err);
   169 				return TestFailed(err);
   185 				return TestFailed(err);
   170 				}
   186 				}
   171 			RDebug::Printf("Token 1 (%d) retrieved",token1);
   187 			OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP03, "Token 1 (%d) retrieved",token1);
   172 			RDebug::Printf("Opening interface 0");
   188 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP04, "Opening interface 0");
   173 			err = iUsbInterface0.Open(token1); // Alternate interface setting 0
   189 			err = iUsbInterface0.Open(token1); // Alternate interface setting 0
   174 			if(err != KErrNone)
   190 			if(err != KErrNone)
   175 				{
   191 				{
   176 				RDebug::Printf("<Error %d> Interface 0 could not be opened",err);
   192 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP05, "<Error %d> Interface 0 could not be opened",err);
   177 				return TestFailed(err);
   193 				return TestFailed(err);
   178 				}
   194 				}
   179 			RDebug::Printf("Interface 0 opened");
   195 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP06, "Interface 0 opened");
   180 		
   196 		
   181 																
   197 																
   182 			RDebug::Printf("Obtaining token for interface 1");
   198 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP07, "Obtaining token for interface 1");
   183 			err = testDevice.Device().GetTokenForInterface(1,token2);
   199 			err = testDevice.Device().GetTokenForInterface(1,token2);
   184 			if(err != KErrNone)
   200 			if(err != KErrNone)
   185 				{
   201 				{
   186 				RDebug::Printf("<Error %d> Token for interface 1 could not be retrieved",err);
   202 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP08, "<Error %d> Token for interface 1 could not be retrieved",err);
   187 				return TestFailed(err);			
   203 				return TestFailed(err);			
   188 				}	
   204 				}	
   189 			RDebug::Printf("Opening interface 1");
   205 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP09, "Opening interface 1");
   190 			err = iUsbInterface1.Open(token2); // Alternate interface setting 0
   206 			err = iUsbInterface1.Open(token2); // Alternate interface setting 0
   191 			if(err != KErrNone)
   207 			if(err != KErrNone)
   192 				{
   208 				{
   193 				RDebug::Printf("<Error %d> Interface 1 could not be opened",err);
   209 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP10, "<Error %d> Interface 1 could not be opened",err);
   194 				return TestFailed(err);
   210 				return TestFailed(err);
   195 				}
   211 				}
   196 			RDebug::Printf("Interface 1 opened");
   212 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP11, "Interface 1 opened");
   197 	
   213 	
   198 			// close it
   214 			// close it
   199 			iUsbInterface1.Close();		
   215 			iUsbInterface1.Close();		
   200 			RDebug::Printf("Interface 1 closed");
   216 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP12, "Interface 1 closed");
   201 	
   217 	
   202 			//re-open now
   218 			//re-open now
   203 			err = iUsbInterface1.Open(token2); // Alternate interface setting 0
   219 			err = iUsbInterface1.Open(token2); // Alternate interface setting 0
   204 			if(err != KErrNone)
   220 			if(err != KErrNone)
   205 				{
   221 				{
   206 				RDebug::Printf("<Error %d> Interface 1 could not be re-opened",err);
   222 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP13, "<Error %d> Interface 1 could not be re-opened",err);
   207 				return TestFailed(err);
   223 				return TestFailed(err);
   208 				}
   224 				}
   209 			RDebug::Printf("Interface 1 re-opened");
   225 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP14, "Interface 1 re-opened");
   210 			
   226 			
   211 			
   227 			
   212 			// Suspend interface 0
   228 			// Suspend interface 0
   213 			RDebug::Printf("Suspending interface 0");
   229 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP15, "Suspending interface 0");
   214 			iInterface0Watcher->SuspendAndWatch();
   230 			iInterface0Watcher->SuspendAndWatch();
   215 			iSuspendedI0 = ETrue;
   231 			iSuspendedI0 = ETrue;
   216 			
   232 			
   217 			// Suspend interface 1
   233 			// Suspend interface 1
   218 			RDebug::Printf("Suspending interface 1");
   234 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP16, "Suspending interface 1");
   219 			iInterface1Watcher->SuspendAndWatch();
   235 			iInterface1Watcher->SuspendAndWatch();
   220 			iSuspendedI1 = ETrue;
   236 			iSuspendedI1 = ETrue;
   221 			
   237 			
   222 			iCaseStep = EValidateSuspendingInterfaces;
   238 			iCaseStep = EValidateSuspendingInterfaces;
   223 			TimeoutIn(10); // Give 10 seconds for device to suspend
   239 			TimeoutIn(10); // Give 10 seconds for device to suspend
   226 			
   242 			
   227 		default:
   243 		default:
   228 			TestFailed(KErrCorrupt);
   244 			TestFailed(KErrCorrupt);
   229 			break;
   245 			break;
   230 		}	
   246 		}	
       
   247 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_EXIT_DUP01, this );
   231 	}
   248 	}
   232 
   249 
   233 
   250 
   234 TInt CUT_PBASE_T_USBDI_0473::Interface0ResumedL(TAny* aPtr)
   251 TInt CUT_PBASE_T_USBDI_0473::Interface0ResumedL(TAny* aPtr)
   235 	{
   252 	{
   236 	LOG_CFUNC
   253 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_INTERFACE0RESUMEDL_ENTRY, 0 );
   237 	RDebug::Printf("Interface 0 resumed");
   254 	OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_INTERFACE0RESUMEDL, "Interface 0 resumed");
   238 	CUT_PBASE_T_USBDI_0473* self = reinterpret_cast<CUT_PBASE_T_USBDI_0473*>(aPtr);
   255 	CUT_PBASE_T_USBDI_0473* self = reinterpret_cast<CUT_PBASE_T_USBDI_0473*>(aPtr);
   239 	RDebug::Printf("watcher 0 iStatus=%d",self->iInterface0Watcher->CompletionCode());
   256 	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_INTERFACE0RESUMEDL_DUP01, "watcher 0 iStatus=%d",self->iInterface0Watcher->CompletionCode());
   240 	self->iSuspendedI0 = EFalse;
   257 	self->iSuspendedI0 = EFalse;
   241 	return self->CheckForAllResumedNotificationsAndContinueFSM();
   258 	return self->CheckForAllResumedNotificationsAndContinueFSM();
   242 	}
   259 	}
   243 	
   260 	
   244 	
   261 	
   245 TInt CUT_PBASE_T_USBDI_0473::Interface1ResumedL(TAny* aPtr)
   262 TInt CUT_PBASE_T_USBDI_0473::Interface1ResumedL(TAny* aPtr)
   246 	{
   263 	{
   247 	LOG_CFUNC
   264 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_INTERFACE1RESUMEDL_ENTRY, 0 );
   248 	RDebug::Printf("Interface 1 resumed");
   265 	OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_INTERFACE1RESUMEDL, "Interface 1 resumed");
   249 	CUT_PBASE_T_USBDI_0473* self = reinterpret_cast<CUT_PBASE_T_USBDI_0473*>(aPtr);
   266 	CUT_PBASE_T_USBDI_0473* self = reinterpret_cast<CUT_PBASE_T_USBDI_0473*>(aPtr);
   250 	RDebug::Printf("watcher 1 iStatus=%d",self->iInterface1Watcher->CompletionCode());
   267 	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_INTERFACE1RESUMEDL_DUP01, "watcher 1 iStatus=%d",self->iInterface1Watcher->CompletionCode());
   251 	self->iSuspendedI1 = EFalse;
   268 	self->iSuspendedI1 = EFalse;
   252 	return self->CheckForAllResumedNotificationsAndContinueFSM();
   269 	return self->CheckForAllResumedNotificationsAndContinueFSM();
   253 	}
   270 	}
   254 	
   271 	
   255 	
   272 	
   256 void CUT_PBASE_T_USBDI_0473::DeviceRemovedL(TUint aDeviceHandle)
   273 void CUT_PBASE_T_USBDI_0473::DeviceRemovedL(TUint aDeviceHandle)
   257 	{
   274 	{
   258 	LOG_FUNC
   275     OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_DEVICEREMOVEDL_ENTRY, this );
   259 
   276 
   260 	// The test device should not be removed until the test case has passed
   277 	// The test device should not be removed until the test case has passed
   261 	// so this test case has not completed, and state this event as an error
   278 	// so this test case has not completed, and state this event as an error
   262 
   279 
   263 	TestFailed(KErrDisconnected);
   280 	TestFailed(KErrDisconnected);
       
   281 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICEREMOVEDL_EXIT, this );
   264 	}
   282 	}
   265 	
   283 	
   266 	
   284 	
   267 void CUT_PBASE_T_USBDI_0473::BusErrorL(TInt aError)
   285 void CUT_PBASE_T_USBDI_0473::BusErrorL(TInt aError)
   268 	{
   286 	{
   269 	LOG_FUNC
   287     OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_BUSERRORL_ENTRY, this );
   270 
   288 
   271 	// This test case handles no failiures on the bus
   289 	// This test case handles no failiures on the bus
   272 
   290 
   273 	TestFailed(aError);
   291 	TestFailed(aError);
       
   292 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_BUSERRORL_EXIT, this );
   274 	}
   293 	}
   275 
   294 
   276 TInt CUT_PBASE_T_USBDI_0473::CheckForAllResumedNotificationsAndContinueFSM()
   295 TInt CUT_PBASE_T_USBDI_0473::CheckForAllResumedNotificationsAndContinueFSM()
   277 	{
   296 	{
   278 	LOG_FUNC
   297 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_CHECKFORALLRESUMEDNOTIFICATIONSANDCONTINUEFSM_ENTRY, this );
   279 	TBool readyToContinueFSM= ETrue;
   298 	TBool readyToContinueFSM= ETrue;
   280 	if( iInterface0Watcher->IsActive()
   299 	if( iInterface0Watcher->IsActive()
   281 	||  iInterface0Watcher->iStatus == KRequestPending)
   300 	||  iInterface0Watcher->iStatus == KRequestPending)
   282 		{
   301 		{
   283 		RDebug::Printf("Interface 0 watcher still pending");
   302 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CHECKFORALLRESUMEDNOTIFICATIONSANDCONTINUEFSM, "Interface 0 watcher still pending");
   284 		readyToContinueFSM= EFalse;
   303 		readyToContinueFSM= EFalse;
   285 		}
   304 		}
   286 
   305 
   287 	if( iInterface1Watcher->IsActive()
   306 	if( iInterface1Watcher->IsActive()
   288 	||  iInterface1Watcher->iStatus == KRequestPending)
   307 	||  iInterface1Watcher->iStatus == KRequestPending)
   289 		{
   308 		{
   290 		RDebug::Printf("Interface 1 watcher still pending");
   309 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CHECKFORALLRESUMEDNOTIFICATIONSANDCONTINUEFSM_DUP01, "Interface 1 watcher still pending");
   291 		readyToContinueFSM= EFalse;
   310 		readyToContinueFSM= EFalse;
   292 		}
   311 		}
   293 
   312 
   294 	if( iDeviceNotificationPending)
   313 	if( iDeviceNotificationPending)
   295 		{
   314 		{
   300 		{
   319 		{
   301 		return ContinueFSMAfterAllResumedNotifications();
   320 		return ContinueFSMAfterAllResumedNotifications();
   302 		}
   321 		}
   303 	else
   322 	else
   304 		{
   323 		{
       
   324 		OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CHECKFORALLRESUMEDNOTIFICATIONSANDCONTINUEFSM_EXIT, this, KErrNone );
   305 		return KErrNone;
   325 		return KErrNone;
   306 		}
   326 		}
   307 	}
   327 	}
   308 
   328 
   309 TInt CUT_PBASE_T_USBDI_0473::ContinueFSMAfterAllResumedNotifications()
   329 TInt CUT_PBASE_T_USBDI_0473::ContinueFSMAfterAllResumedNotifications()
   310 	{
   330 	{
   311 	LOG_FUNC
   331 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_ENTRY, this );
   312 	iDeviceNotificationPending= ETrue;
   332 	iDeviceNotificationPending= ETrue;
   313 	if(iSuspendedI0)
   333 	if(iSuspendedI0)
   314 		{
   334 		{
   315 		RDebug::Printf("<Error %d> Interface 0 still suspended",KErrCompletion);
   335 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS, "<Error %d> Interface 0 still suspended",KErrCompletion);
   316 		TestFailed(KErrCompletion);
   336 		TestFailed(KErrCompletion);
       
   337 		OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_EXIT, this, KErrCompletion );
   317 		return KErrCompletion;
   338 		return KErrCompletion;
   318 		}
   339 		}
   319 
   340 
   320 	if(iSuspendedI1)
   341 	if(iSuspendedI1)
   321 		{
   342 		{
   322 		RDebug::Printf("<Error %d> Interface 1 still suspended",KErrCompletion);
   343 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP01, "<Error %d> Interface 1 still suspended",KErrCompletion);
   323 		TestFailed(KErrCompletion);
   344 		TestFailed(KErrCompletion);
       
   345 		OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_EXIT_DUP01, this, KErrCompletion );
   324 		return KErrCompletion;
   346 		return KErrCompletion;
   325 		}
   347 		}
   326 
   348 
   327 	switch(iCaseStep)
   349 	switch(iCaseStep)
   328 		{
   350 		{
   331 			// Device is resumed, send request to client: Remote wake up in 6 secs
   353 			// Device is resumed, send request to client: Remote wake up in 6 secs
   332 			TInt err= iUsbInterface1.PermitRemoteWakeup(ETrue);
   354 			TInt err= iUsbInterface1.PermitRemoteWakeup(ETrue);
   333 			
   355 			
   334 			if(err != KErrNone)
   356 			if(err != KErrNone)
   335 				{
   357 				{
   336 				RDebug::Printf("<Error %d> Unable to permit remote device wakeup",err);
   358 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP02, "<Error %d> Unable to permit remote device wakeup",err);
   337 				iCaseStep = EFailed;
   359 				iCaseStep = EFailed;
   338 				TTestCaseFailed request(err,_L8("Unable to permit remote device wakeup"));
   360 				TTestCaseFailed request(err,_L8("Unable to permit remote device wakeup"));
   339 				iControlEp0->SendRequest(request,this);
   361 				iControlEp0->SendRequest(request,this);
   340 				}
   362 				}
   341 			else
   363 			else
   342 				{
   364 				{
   343 				RDebug::Printf("Device is resumed, send request to client: Remote wake up in 6 secs");
   365 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP03, "Device is resumed, send request to client: Remote wake up in 6 secs");
   344 				
   366 				
   345 				TRemoteWakeupRequest request(6);
   367 				TRemoteWakeupRequest request(6);
   346 				iControlEp0->SendRequest(request,this);			
   368 				iControlEp0->SendRequest(request,this);			
   347 				iCaseStep = ESuspendForRemoteWakeup;		
   369 				iCaseStep = ESuspendForRemoteWakeup;		
   348 				}
   370 				}
   353 			{
   375 			{
   354 			if(iStoredNewState == RUsbDevice::EDeviceActive)
   376 			if(iStoredNewState == RUsbDevice::EDeviceActive)
   355 				{
   377 				{
   356 				// Now suspend the device again after resumption from remote wakeup
   378 				// Now suspend the device again after resumption from remote wakeup
   357 			
   379 			
   358 				RDebug::Printf("Suspending interface 0");
   380 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP04, "Suspending interface 0");
   359 				iInterface0Watcher->SuspendAndWatch();
   381 				iInterface0Watcher->SuspendAndWatch();
   360 				iSuspendedI0 = ETrue;
   382 				iSuspendedI0 = ETrue;
   361 				
   383 				
   362 				RDebug::Printf("Suspending interface 1");
   384 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP05, "Suspending interface 1");
   363 				iInterface1Watcher->SuspendAndWatch();
   385 				iInterface1Watcher->SuspendAndWatch();
   364 				iSuspendedI1 = ETrue;
   386 				iSuspendedI1 = ETrue;
   365 				
   387 				
   366 				iCaseStep = EValidateSuspendAfterWakeup;
   388 				iCaseStep = EValidateSuspendAfterWakeup;
   367 				}
   389 				}
   368 			else
   390 			else
   369 				{
   391 				{
   370 				RDebug::Printf("<Error %d> Device is still suspended",KErrCompletion);
   392 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP06, "<Error %d> Device is still suspended",KErrCompletion);
   371 				TestFailed(KErrCompletion);
   393 				TestFailed(KErrCompletion);
       
   394 				OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_EXIT_DUP02, this, KErrCompletion );
   372 				return KErrCompletion;
   395 				return KErrCompletion;
   373 				}
   396 				}
   374 			}
   397 			}
   375 			break;
   398 			break;
   376 
   399 
   377 		default:
   400 		default:
   378 			RDebug::Printf("CUT_PBASE_T_USBDI_0473::ContinueFSMAfterAllResumedNotifications: Invalid state %d", iCaseStep);
   401 			OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP07, "CUT_PBASE_T_USBDI_0473::ContinueFSMAfterAllResumedNotifications: Invalid state %d", iCaseStep);
   379 			TestFailed(KErrCompletion);
   402 			TestFailed(KErrCompletion);
       
   403 			OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_EXIT_DUP03, this, KErrCompletion );
   380 			return KErrCompletion;
   404 			return KErrCompletion;
   381 		}
   405 		}
   382 
   406 
       
   407 	OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_EXIT_DUP04, this, KErrNone );
   383 	return KErrNone;
   408 	return KErrNone;
   384 	}
   409 	}
   385 
   410 
   386 void CUT_PBASE_T_USBDI_0473::DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,RUsbDevice::TDeviceState aNewState,TInt aCompletionCode)
   411 void CUT_PBASE_T_USBDI_0473::DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,RUsbDevice::TDeviceState aNewState,TInt aCompletionCode)
   387 	{
   412 	{
   388 	LOG_FUNC
   413 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_ENTRY, this );
   389 	Cancel();
   414 	Cancel();
   390 	
   415 	
   391 	RDebug::Printf("Device State change from %d to %d err=%d",aPreviousState,aNewState,aCompletionCode);
   416 	OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL, "Device State change from %d to %d err=%d",aPreviousState,aNewState,aCompletionCode);
   392 
   417 
   393 	switch(iCaseStep)
   418 	switch(iCaseStep)
   394 		{
   419 		{
   395 	
   420 	
   396 		// Validate that the device was suspended by individual interface suspension
   421 		// Validate that the device was suspended by individual interface suspension
   399 			{
   424 			{
   400 			if(aNewState == RUsbDevice::EDeviceSuspended)
   425 			if(aNewState == RUsbDevice::EDeviceSuspended)
   401 				{
   426 				{
   402 				// Device state is suspended now resume it by resuming one of the interfaces
   427 				// Device state is suspended now resume it by resuming one of the interfaces
   403 				
   428 				
   404 				RDebug::Printf("Device is suspended now resume device by resuming one of the interfaces");
   429 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP01, "Device is suspended now resume device by resuming one of the interfaces");
   405 				iUsbInterface0.CancelPermitSuspend();
   430 				iUsbInterface0.CancelPermitSuspend();
   406 				iCaseStep = EValidateResumptionAfterInterfaceSuspension;
   431 				iCaseStep = EValidateResumptionAfterInterfaceSuspension;
   407 				}
   432 				}
   408 			else
   433 			else
   409 				{
   434 				{
   410 				RDebug::Printf("<Error %d> State was not suspended",KErrCompletion);
   435 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP02, "<Error %d> State was not suspended",KErrCompletion);
   411 				
   436 				
   412 				// Since the device is not suspended, send test case failed to the device
   437 				// Since the device is not suspended, send test case failed to the device
   413 	
   438 	
   414 				iCaseStep = EFailed;
   439 				iCaseStep = EFailed;
   415 				TTestCaseFailed request(KErrCompletion,_L8("The device was not in the expected suspend state"));
   440 				TTestCaseFailed request(KErrCompletion,_L8("The device was not in the expected suspend state"));
   428 				{
   453 				{
   429 				CheckForAllResumedNotificationsAndContinueFSM();
   454 				CheckForAllResumedNotificationsAndContinueFSM();
   430 				}
   455 				}
   431 			else
   456 			else
   432 				{
   457 				{
   433 				RDebug::Printf("<Error %d> Device is still suspended",KErrCompletion);
   458 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP03, "<Error %d> Device is still suspended",KErrCompletion);
   434 				return TestFailed(KErrCompletion);
   459 				return TestFailed(KErrCompletion);
   435 				}
   460 				}
   436 			}
   461 			}
   437 			break;
   462 			break;
   438 			
   463 			
   441 			{
   466 			{
   442 			if(aNewState == RUsbDevice::EDeviceSuspended)
   467 			if(aNewState == RUsbDevice::EDeviceSuspended)
   443 				{
   468 				{
   444 				// Now awaiting a remote wake up state change notification
   469 				// Now awaiting a remote wake up state change notification
   445 				
   470 				
   446 				RDebug::Printf("Now awaiting a remote wake up state change notification");
   471 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP04, "Now awaiting a remote wake up state change notification");
   447 				
   472 				
   448 				CancelTimeout();
   473 				CancelTimeout();
   449 				iTimer.After(iStatus,10000000); // Give 10 seconds for device to signal remote wake-up
   474 				iTimer.After(iStatus,10000000); // Give 10 seconds for device to signal remote wake-up
   450 				iCaseStep = EValidateResumptionAfterWakeup;
   475 				iCaseStep = EValidateResumptionAfterWakeup;
   451 				SetActive();
   476 				SetActive();
   452 				}
   477 				}
   453 			else
   478 			else
   454 				{
   479 				{
   455 				RDebug::Printf("<Error %d> State was not suspended",KErrCompletion);
   480 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP05, "<Error %d> State was not suspended",KErrCompletion);
   456 				
   481 				
   457 				// Since the device is not suspended, send test case failed to the device
   482 				// Since the device is not suspended, send test case failed to the device
   458 	
   483 	
   459 				iCaseStep = EFailed;
   484 				iCaseStep = EFailed;
   460 				TTestCaseFailed request(KErrCompletion,_L8("State was not suspended"));
   485 				TTestCaseFailed request(KErrCompletion,_L8("State was not suspended"));
   464 			break;
   489 			break;
   465 			
   490 			
   466 		// This step should never be reached as ep0 complete traps this step, but if it does test fails.
   491 		// This step should never be reached as ep0 complete traps this step, but if it does test fails.
   467 		case ESuspendForRemoteWakeup:
   492 		case ESuspendForRemoteWakeup:
   468 			{
   493 			{
   469 			RDebug::Printf("Resumed before suspended");	    
   494 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP06, "Resumed before suspended");
   470 		    iCaseStep = EFailed;
   495 		    iCaseStep = EFailed;
   471 		    TTestCaseFailed request(KErrCompletion,_L8("State was not suspended"));
   496 		    TTestCaseFailed request(KErrCompletion,_L8("State was not suspended"));
   472 		    iControlEp0->SendRequest(request,this);
   497 		    iControlEp0->SendRequest(request,this);
   473 		    break;	
   498 		    break;	
   474 			}	    
   499 			}	    
   490 			if(aNewState == RUsbDevice::EDeviceSuspended)
   515 			if(aNewState == RUsbDevice::EDeviceSuspended)
   491 				{
   516 				{
   492 				// Device is now suspended, now activate the device again to send test case
   517 				// Device is now suspended, now activate the device again to send test case
   493 				// completed request to device
   518 				// completed request to device
   494 	
   519 	
   495 				RDebug::Printf("Device is now suspended, now activate the device again to send test case completed request to device");
   520 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP07, "Device is now suspended, now activate the device again to send test case completed request to device");
   496 	
   521 	
   497 				CUsbTestDevice& testDevice = iActorFDF->DeviceL(iDeviceHandle);
   522 				CUsbTestDevice& testDevice = iActorFDF->DeviceL(iDeviceHandle);
   498 	
   523 	
   499 				RDebug::Printf("Resuming at device level");
   524 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP08, "Resuming at device level");
   500 				TInt err(testDevice.Device().Resume());
   525 				TInt err(testDevice.Device().Resume());
   501 				if(err != KErrNone)
   526 				if(err != KErrNone)
   502 					{
   527 					{
   503 					RDebug::Printf("<Error %d> Unable to suspend the device",err);
   528 					OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP09, "<Error %d> Unable to suspend the device",err);
   504 					iCaseStep = EFailed;
   529 					iCaseStep = EFailed;
   505 					TTestCaseFailed request(err,_L8("Unable to suspend the device"));
   530 					TTestCaseFailed request(err,_L8("Unable to suspend the device"));
   506 					iControlEp0->SendRequest(request,this);
   531 					iControlEp0->SendRequest(request,this);
   507 					}
   532 					}
   508 				
   533 				
   509 				iCaseStep = EPassed;
   534 				iCaseStep = EPassed;
   510 				}
   535 				}
   511 			else
   536 			else
   512 				{
   537 				{
   513 				RDebug::Printf("<Error %d> State was not suspended",KErrCompletion);
   538 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP10, "<Error %d> State was not suspended",KErrCompletion);
   514 				
   539 				
   515 				// Since the device is not suspended, send test case failed to the device
   540 				// Since the device is not suspended, send test case failed to the device
   516 	
   541 	
   517 				iCaseStep = EFailed;
   542 				iCaseStep = EFailed;
   518 				TTestCaseFailed request(KErrCompletion,_L8("State was not suspended"));
   543 				TTestCaseFailed request(KErrCompletion,_L8("State was not suspended"));
   525 	
   550 	
   526 		case EPassed:
   551 		case EPassed:
   527 			{
   552 			{
   528 			if(aNewState == RUsbDevice::EDeviceActive)
   553 			if(aNewState == RUsbDevice::EDeviceActive)
   529 				{
   554 				{
   530 				RDebug::Printf("Device is active again, test case passed");
   555 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP11, "Device is active again, test case passed");
   531 				TTestCasePassed request;
   556 				TTestCasePassed request;
   532 				iControlEp0->SendRequest(request,this);
   557 				iControlEp0->SendRequest(request,this);
   533 				}
   558 				}
   534 			else
   559 			else
   535 				{
   560 				{
   536 				RDebug::Printf("<Error %d> Device is still suspended",KErrCompletion);
   561 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP12, "<Error %d> Device is still suspended",KErrCompletion);
   537 				return TestFailed(KErrCompletion);
   562 				return TestFailed(KErrCompletion);
   538 				}
   563 				}
   539 			}
   564 			}
   540 			break;
   565 			break;
   541 			
   566 			
   542 		default:
   567 		default:
   543 			break;
   568 			break;
   544 		}
   569 		}
       
   570 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_EXIT, this );
   545 	}
   571 	}
   546 
   572 
   547 
   573 
   548 void CUT_PBASE_T_USBDI_0473::Ep0TransferCompleteL(TInt aCompletionCode)
   574 void CUT_PBASE_T_USBDI_0473::Ep0TransferCompleteL(TInt aCompletionCode)
   549 	{
   575 	{
   550 	LOG_FUNC
   576 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL_ENTRY, this );
   551 	RDebug::Printf("Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
   577 	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
   552 	switch(iCaseStep)
   578 	switch(iCaseStep)
   553 		{
   579 		{
   554 		case ESuspendForRemoteWakeup:
   580 		case ESuspendForRemoteWakeup:
   555 			{
   581 			{
   556 			// Suspend device again so a remote wakeup can be achieved
   582 			// Suspend device again so a remote wakeup can be achieved
   557 			RDebug::Printf("Suspend device again so a remote wakeup can be achieved");
   583 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL_DUP01, "Suspend device again so a remote wakeup can be achieved");
   558 	
   584 	
   559 			// Suspend interface 0
   585 			// Suspend interface 0
   560 			RDebug::Printf("Suspending interface 0");
   586 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL_DUP02, "Suspending interface 0");
   561 			iInterface0Watcher->SuspendAndWatch();
   587 			iInterface0Watcher->SuspendAndWatch();
   562 			iSuspendedI0 = ETrue;
   588 			iSuspendedI0 = ETrue;
   563 			
   589 			
   564 			// Suspend interface 1
   590 			// Suspend interface 1
   565 			RDebug::Printf("Suspending interface 1");
   591 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL_DUP03, "Suspending interface 1");
   566 			iInterface1Watcher->SuspendAndWatch();
   592 			iInterface1Watcher->SuspendAndWatch();
   567 			iSuspendedI1 = ETrue;
   593 			iSuspendedI1 = ETrue;
   568 			
   594 			
   569 			iCaseStep = EValidateSuspendForRemoteWakeup;
   595 			iCaseStep = EValidateSuspendForRemoteWakeup;
   570 			TimeoutIn(10); // Give 10 seconds for device to suspend	
   596 			TimeoutIn(10); // Give 10 seconds for device to suspend	
   582 	
   608 	
   583 		case EPassed:
   609 		case EPassed:
   584 			TestPassed();
   610 			TestPassed();
   585 			break;
   611 			break;
   586 			}
   612 			}
       
   613 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL_EXIT, this );
   587 	}
   614 	}
   588 
   615 
   589 
   616 
   590 void CUT_PBASE_T_USBDI_0473::HostRunL()
   617 void CUT_PBASE_T_USBDI_0473::HostRunL()
   591 	{
   618 	{
   592 	LOG_FUNC
   619 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_HOSTRUNL_ENTRY, this );
   593 	
   620 	
   594 	// Obtain the completion code
   621 	// Obtain the completion code
   595 	TInt completionCode(iStatus.Int());
   622 	TInt completionCode(iStatus.Int());
   596 	
   623 	
   597 	if(completionCode == KErrNone)
   624 	if(completionCode == KErrNone)
   598 		{
   625 		{
   599 		// Action timeout
   626 		// Action timeout
   600 		RDebug::Printf("<Error> Action timeout");
   627 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_HOSTRUNL, "<Error> Action timeout");
   601 		TestFailed(KErrTimedOut);
   628 		TestFailed(KErrTimedOut);
   602 		}
   629 		}
   603 	else
   630 	else
   604 		{
   631 		{
   605 		RDebug::Printf("<Error %d> Timeout timer could not complete",completionCode);
   632 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_HOSTRUNL_DUP01, "<Error %d> Timeout timer could not complete",completionCode);
   606 		TestFailed(completionCode);
   633 		TestFailed(completionCode);
   607 		}
   634 		}
       
   635 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_HOSTRUNL_EXIT, this );
   608 	}
   636 	}
   609 	
   637 	
   610 
   638 
   611 void CUT_PBASE_T_USBDI_0473::DeviceRunL()
   639 void CUT_PBASE_T_USBDI_0473::DeviceRunL()
   612 	{
   640 	{
   613 	LOG_FUNC
   641 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_DEVICERUNL_ENTRY, this );
   614 	
   642 	
   615 	// Disconnect the device
   643 	// Disconnect the device
   616 	
   644 	
   617 	iTestDevice->SoftwareDisconnect();
   645 	iTestDevice->SoftwareDisconnect();
   618 	
   646 	
   619 	// Complete the test case request
   647 	// Complete the test case request
   620 	
   648 	
   621 	TestPolicy().SignalTestComplete(iStatus.Int());
   649 	TestPolicy().SignalTestComplete(iStatus.Int());
   622 	}
   650 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICERUNL_EXIT, this );
   623 	
   651 	}
   624 	
   652 	
   625 	}
   653 	
       
   654 	}