os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-1234.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// @file PBASE-T_USBDI-1234.cpp
sl@0
    15
// @internalComponent
sl@0
    16
// 
sl@0
    17
//
sl@0
    18
sl@0
    19
#include "PBASE-T_USBDI-1234.h"
sl@0
    20
#include "modelleddevices.h"
sl@0
    21
#include "testpolicy.h"
sl@0
    22
#include "testliterals.h"
sl@0
    23
sl@0
    24
namespace NUnitTesting_USBDI
sl@0
    25
	{
sl@0
    26
	const TInt KBulkTransferSize = 583;
sl@0
    27
	const TUint KHostNumWriteBytes1 = 210;
sl@0
    28
	const TUint KHostNumWriteBytes2 = 350;
sl@0
    29
	const TUint KHostNumWriteBytes3 = KBulkTransferSize - KHostNumWriteBytes1
sl@0
    30
			- KHostNumWriteBytes2; // 23
sl@0
    31
	const TUint KHostNumReadBytes1 = 301;
sl@0
    32
	const TUint KHostNumReadBytes2 = 21;
sl@0
    33
	const TUint KHostNumReadBytes3 = KBulkTransferSize - KHostNumReadBytes1
sl@0
    34
			- KHostNumReadBytes2; // 261
sl@0
    35
sl@0
    36
sl@0
    37
	//Make these single bit values ... 
sl@0
    38
	// ... so that their completion can be easily recorded in a bit mask!
sl@0
    39
	const TInt KBulkTransferInId0 = 1<<0;
sl@0
    40
	const TInt KBulkTransferInId1 = 1<<1;
sl@0
    41
	const TInt KBulkTransferInId2 = 1<<2;
sl@0
    42
	const TInt KBulkTransferOutId0 = 1<<3;
sl@0
    43
	const TInt KBulkTransferOutId1 = 1<<4;
sl@0
    44
	const TInt KBulkTransferOutId2 = 1<<5;
sl@0
    45
sl@0
    46
	const TInt KUnexpectedTransferID = -101;
sl@0
    47
	const TInt KUndefinedStep = -102;
sl@0
    48
sl@0
    49
	_LIT(KTestCaseId,"PBASE-T_USBDI-1234");
sl@0
    50
	// the name is very important 
sl@0
    51
	const TFunctorTestCase<CUT_PBASE_T_USBDI_1234,TBool>
sl@0
    52
			CUT_PBASE_T_USBDI_1234::iFunctor(KTestCaseId);
sl@0
    53
sl@0
    54
	CUT_PBASE_T_USBDI_1234* CUT_PBASE_T_USBDI_1234::NewL(TBool aHostRole)
sl@0
    55
		{
sl@0
    56
		CUT_PBASE_T_USBDI_1234* self = new (ELeave) CUT_PBASE_T_USBDI_1234(aHostRole);
sl@0
    57
		CleanupStack::PushL(self);
sl@0
    58
		self->ConstructL();
sl@0
    59
		CleanupStack::Pop(self);
sl@0
    60
		return self;
sl@0
    61
		}
sl@0
    62
sl@0
    63
	CUT_PBASE_T_USBDI_1234::CUT_PBASE_T_USBDI_1234(TBool aHostRole) :
sl@0
    64
		CBaseBulkTestCase(KTestCaseId, aHostRole), iCaseStep(EInProgress)
sl@0
    65
		{
sl@0
    66
sl@0
    67
		}
sl@0
    68
sl@0
    69
	void CUT_PBASE_T_USBDI_1234::ExecuteHostTestCaseL()
sl@0
    70
		{
sl@0
    71
		CBaseBulkTestCase::ExecuteHostTestCaseL();
sl@0
    72
		iInterface0Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface0,TCallBack(CUT_PBASE_T_USBDI_1234::Interface0ResumedL,this));
sl@0
    73
		iInterface1Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface1,TCallBack(CUT_PBASE_T_USBDI_1234::Interface1ResumedL,this));
sl@0
    74
		iInterface2Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface1,TCallBack(CUT_PBASE_T_USBDI_1234::Interface2ResumedL,this));
sl@0
    75
		}
sl@0
    76
sl@0
    77
	void CUT_PBASE_T_USBDI_1234::ConstructL()
sl@0
    78
		{
sl@0
    79
		BaseBulkConstructL();
sl@0
    80
		}
sl@0
    81
sl@0
    82
	CUT_PBASE_T_USBDI_1234::~CUT_PBASE_T_USBDI_1234()
sl@0
    83
		{
sl@0
    84
		LOG_FUNC
sl@0
    85
		// Cancel any async operations
sl@0
    86
sl@0
    87
		Cancel(); // Cancel host timer
sl@0
    88
sl@0
    89
		if (iInterface1Watcher)
sl@0
    90
			{
sl@0
    91
			delete iInterface1Watcher;
sl@0
    92
			}
sl@0
    93
		if (iInterface0Watcher)
sl@0
    94
			{
sl@0
    95
			delete iInterface0Watcher;
sl@0
    96
			}
sl@0
    97
		if (iInterface2Watcher)
sl@0
    98
			{
sl@0
    99
			delete iInterface2Watcher;
sl@0
   100
			}
sl@0
   101
sl@0
   102
		}
sl@0
   103
sl@0
   104
	void CUT_PBASE_T_USBDI_1234::DeviceInsertedL(TUint aDeviceHandle)
sl@0
   105
		{
sl@0
   106
		LOG_FUNC
sl@0
   107
sl@0
   108
		Cancel();
sl@0
   109
sl@0
   110
		if (BaseBulkDeviceInsertedL(aDeviceHandle) == EDeviceConfigurationError)
sl@0
   111
		// Prepare for response from control transfer to client
sl@0
   112
			{
sl@0
   113
			iCaseStep = EFailed;
sl@0
   114
			}
sl@0
   115
sl@0
   116
		// Create the bulk transfers	
sl@0
   117
		iInTransfer[0]
sl@0
   118
				= new (ELeave) CBulkTransfer(iTestPipeInterface1BulkIn,iUsbInterface1,KBulkTransferSize,*this,KBulkTransferInId0);
sl@0
   119
		iInTransfer[1]
sl@0
   120
				= new (ELeave) CBulkTransfer(iTestPipeInterface1BulkIn,iUsbInterface1,KBulkTransferSize,*this,KBulkTransferInId1);
sl@0
   121
		iInTransfer[2]
sl@0
   122
				= new (ELeave) CBulkTransfer(iTestPipeInterface1BulkIn,iUsbInterface1,KBulkTransferSize,*this,KBulkTransferInId2);
sl@0
   123
		iOutTransfer[0]
sl@0
   124
				= new (ELeave) CBulkTransfer(iTestPipeInterface1BulkOut,iUsbInterface1,KBulkTransferSize,*this,KBulkTransferOutId0);
sl@0
   125
		iOutTransfer[1]
sl@0
   126
				= new (ELeave) CBulkTransfer(iTestPipeInterface1BulkOut,iUsbInterface1,KBulkTransferSize,*this,KBulkTransferOutId1);
sl@0
   127
		iOutTransfer[2]
sl@0
   128
				= new (ELeave) CBulkTransfer(iTestPipeInterface1BulkOut,iUsbInterface1,KBulkTransferSize,*this,KBulkTransferOutId2);
sl@0
   129
sl@0
   130
		// Initialise the descriptors for transfer		
sl@0
   131
		RDebug::Printf("Initialising the transfer descriptors");
sl@0
   132
		TInt err = iUsbInterface1.InitialiseTransferDescriptors();
sl@0
   133
		if (err != KErrNone)
sl@0
   134
			{
sl@0
   135
			TBuf<256> msg;
sl@0
   136
			msg.Format(_L("<Error %d> Unable to initialise transfer descriptors"),err);
sl@0
   137
			RDebug::Print(msg);
sl@0
   138
			iCaseStep = EFailed;
sl@0
   139
			TTestCaseFailed request(err, msg);
sl@0
   140
			iControlEp0->SendRequest(request, this);
sl@0
   141
			return;
sl@0
   142
			}
sl@0
   143
sl@0
   144
		iCaseStep = ESuspendDevice;
sl@0
   145
sl@0
   146
		TrySuspendDeviceByInterfaces();
sl@0
   147
sl@0
   148
		}
sl@0
   149
sl@0
   150
	TInt CUT_PBASE_T_USBDI_1234::Interface0ResumedL(TAny* aPtr)
sl@0
   151
		{
sl@0
   152
		
sl@0
   153
		// when device is really resumed , the whole of interfaces' previous call  PermitSuspendAndWaitForResume()'s requests of the device will be completed , random chose one .
sl@0
   154
		LOG_CFUNC
sl@0
   155
		RDebug::Printf("Interface 0 resumed");
sl@0
   156
		CUT_PBASE_T_USBDI_1234* self =
sl@0
   157
				reinterpret_cast<CUT_PBASE_T_USBDI_1234*>(aPtr);
sl@0
   158
		TInt completionCode = self->iInterface0Watcher->CompletionCode();
sl@0
   159
		RDebug::Printf("watcher 0 errCode=%d",completionCode);
sl@0
   160
		self->iSuspendedI0 = EFalse;
sl@0
   161
sl@0
   162
		switch (self->iCaseStep)
sl@0
   163
			{
sl@0
   164
sl@0
   165
			case EValidateResumebyInterface:
sl@0
   166
				{
sl@0
   167
				if (completionCode == KErrNone)
sl@0
   168
					{
sl@0
   169
					RDebug::Printf("device resumed succeed, do bulk transfer!");
sl@0
   170
					self->iCaseStep = EBulkTransferOutWhenResume;
sl@0
   171
					self->SendEpTransferRequest();
sl@0
   172
					}
sl@0
   173
				else
sl@0
   174
					{
sl@0
   175
					RDebug::Printf("device resumed failed,<err %d> ",completionCode);
sl@0
   176
					self->iCaseStep = EFailed;
sl@0
   177
					self->SendEpRequest();
sl@0
   178
					}
sl@0
   179
				}
sl@0
   180
sl@0
   181
				break;
sl@0
   182
sl@0
   183
			default:
sl@0
   184
				break;
sl@0
   185
			};
sl@0
   186
sl@0
   187
		return KErrNone;
sl@0
   188
		}
sl@0
   189
sl@0
   190
	TInt CUT_PBASE_T_USBDI_1234::Interface1ResumedL(TAny* aPtr)
sl@0
   191
		{
sl@0
   192
		LOG_CFUNC
sl@0
   193
		RDebug::Printf("Interface 1 resumed");
sl@0
   194
		CUT_PBASE_T_USBDI_1234* self =
sl@0
   195
				reinterpret_cast<CUT_PBASE_T_USBDI_1234*>(aPtr);
sl@0
   196
		RDebug::Printf("watcher 1 iStatus=%d",
sl@0
   197
				self->iInterface1Watcher->CompletionCode());
sl@0
   198
		self->iSuspendedI1 = EFalse;
sl@0
   199
		return KErrNone;
sl@0
   200
		}
sl@0
   201
sl@0
   202
	TInt CUT_PBASE_T_USBDI_1234::Interface2ResumedL(TAny* aPtr)
sl@0
   203
		{
sl@0
   204
		LOG_CFUNC
sl@0
   205
		RDebug::Printf("Interface 2 resumed");
sl@0
   206
		CUT_PBASE_T_USBDI_1234* self =
sl@0
   207
				reinterpret_cast<CUT_PBASE_T_USBDI_1234*>(aPtr);
sl@0
   208
		RDebug::Printf("watcher 2 iStatus=%d",
sl@0
   209
				self->iInterface2Watcher->CompletionCode());
sl@0
   210
		self->iSuspendedI2 = EFalse;
sl@0
   211
		return KErrNone;
sl@0
   212
		}
sl@0
   213
sl@0
   214
	void CUT_PBASE_T_USBDI_1234::DeviceStateChangeL(
sl@0
   215
			RUsbDevice::TDeviceState aPreviousState,
sl@0
   216
			RUsbDevice::TDeviceState aNewState, TInt aCompletionCode)
sl@0
   217
		{
sl@0
   218
		LOG_FUNC
sl@0
   219
		Cancel();
sl@0
   220
sl@0
   221
		RDebug::Printf(
sl@0
   222
				"Device State change from %d to %d err=%d",
sl@0
   223
				aPreviousState, aNewState, aCompletionCode);
sl@0
   224
		}
sl@0
   225
sl@0
   226
	void CUT_PBASE_T_USBDI_1234::Ep0TransferCompleteL(TInt aCompletionCode)
sl@0
   227
		{
sl@0
   228
		LOG_FUNC
sl@0
   229
sl@0
   230
		RDebug::Printf(
sl@0
   231
				"Ep0TransferCompleteL with aCompletionCode = %d",
sl@0
   232
				aCompletionCode);
sl@0
   233
sl@0
   234
		if (aCompletionCode != KErrNone)
sl@0
   235
			{
sl@0
   236
			if (iCaseStep == EFailed)
sl@0
   237
				{// ignore error, and catch the TestFailed method called further down.
sl@0
   238
				RDebug::Printf("***Failure sending FAIL message to client on endpoint 0***");
sl@0
   239
				}
sl@0
   240
			else
sl@0
   241
				{
sl@0
   242
				TBuf<256> msg;
sl@0
   243
				msg.Format(_L("<Error %d> Transfer to control endpoint 0 was not successful"),aCompletionCode);
sl@0
   244
				RDebug::Print(msg);
sl@0
   245
				iCaseStep = EFailed;
sl@0
   246
				TTestCaseFailed request(aCompletionCode, msg);
sl@0
   247
				iControlEp0->SendRequest(request, this);
sl@0
   248
				return;
sl@0
   249
				}
sl@0
   250
			}
sl@0
   251
sl@0
   252
		switch (iCaseStep)
sl@0
   253
			{
sl@0
   254
			// Test case passed
sl@0
   255
			case EPassed:
sl@0
   256
				TestPassed();
sl@0
   257
				break;
sl@0
   258
sl@0
   259
				// Test case failed	
sl@0
   260
			case EFailed:
sl@0
   261
				TestFailed(KErrCompletion);
sl@0
   262
				break;
sl@0
   263
sl@0
   264
			case EBulkTransferOutWhenResume:
sl@0
   265
				RDebug::Printf("Try to send data");
sl@0
   266
				iOutTransfer[0]->TransferOut(KLiteralEnglish8().Mid(0, KHostNumWriteBytes1), EFalse);
sl@0
   267
				iOutTransfer[1]->TransferOut(KLiteralEnglish8().Mid(KHostNumWriteBytes1, KHostNumWriteBytes2), EFalse);
sl@0
   268
				iOutTransfer[2]->TransferOut(KLiteralEnglish8().Mid(KHostNumWriteBytes1+KHostNumWriteBytes2,
sl@0
   269
						KHostNumWriteBytes3), ETrue); //do not suppress ZLP on this last one  (though should be irrelevant here)    
sl@0
   270
				break;
sl@0
   271
sl@0
   272
			case EValidBulkTransfeOut:
sl@0
   273
				RDebug::Printf("Try to receive data");
sl@0
   274
				iInTransfer[0]->TransferIn(KHostNumReadBytes1);
sl@0
   275
				iInTransfer[1]->TransferIn(KHostNumReadBytes2);
sl@0
   276
				iInTransfer[2]->TransferIn(KHostNumReadBytes3);
sl@0
   277
				break;
sl@0
   278
sl@0
   279
			default:
sl@0
   280
				RDebug::Printf("<Error> Unknown test step");
sl@0
   281
				TestFailed(KErrUnknown);
sl@0
   282
				break;
sl@0
   283
			}
sl@0
   284
		}
sl@0
   285
sl@0
   286
	void CUT_PBASE_T_USBDI_1234::TransferCompleteL(TInt aTransferId,
sl@0
   287
			TInt aCompletionCode)
sl@0
   288
		{
sl@0
   289
		LOG_FUNC
sl@0
   290
		Cancel();
sl@0
   291
sl@0
   292
		TInt err(KErrNone);
sl@0
   293
		TBuf<256> msg;
sl@0
   294
		RDebug::Printf("Transfer completed (id=%d), aCompletionCode = %d",
sl@0
   295
				aTransferId, aCompletionCode);
sl@0
   296
sl@0
   297
		switch (iCaseStep)
sl@0
   298
			{
sl@0
   299
			case EBulkTransferOutWhenResume:
sl@0
   300
				if (aCompletionCode != KErrNone)
sl@0
   301
					{
sl@0
   302
					err = KErrCorrupt;
sl@0
   303
					msg.Format(_L("<Error %d> No data sent on bulk OUT request"),aCompletionCode);
sl@0
   304
					break; // switch(iCaseStep)
sl@0
   305
					}
sl@0
   306
sl@0
   307
				switch (aTransferId)
sl@0
   308
					{
sl@0
   309
					case KBulkTransferOutId0:
sl@0
   310
					case KBulkTransferOutId1:
sl@0
   311
					case KBulkTransferOutId2:
sl@0
   312
						iTransferComplete |= aTransferId;
sl@0
   313
						RDebug::Printf("Transfer %d completed", aTransferId);
sl@0
   314
						break; // switch(aTransferId)
sl@0
   315
sl@0
   316
					default:
sl@0
   317
						iTransferComplete = 0; //reset
sl@0
   318
						err = KUnexpectedTransferID;
sl@0
   319
						msg.Format(_L("<Error %d> Unexpected transfer ID, wanted %d, %d or %d, got %d"),
sl@0
   320
						err, KBulkTransferOutId0, KBulkTransferOutId1, KBulkTransferOutId2, aTransferId);
sl@0
   321
						break; // switch(aTransferId)
sl@0
   322
					}
sl@0
   323
sl@0
   324
				if (err == KErrNone && iTransferComplete
sl@0
   325
						== (KBulkTransferOutId0 | KBulkTransferOutId1
sl@0
   326
								| KBulkTransferOutId2))
sl@0
   327
					{
sl@0
   328
					RDebug::Printf(
sl@0
   329
							"Try to receive back sent data. Transfers Completed %d",
sl@0
   330
							iTransferComplete);
sl@0
   331
					iCaseStep = EValidBulkTransfeOut;
sl@0
   332
					TUint numBytes[KNumSplitWriteSections] =
sl@0
   333
						{
sl@0
   334
						KHostNumReadBytes1, KHostNumReadBytes2,
sl@0
   335
								KHostNumReadBytes3
sl@0
   336
						};
sl@0
   337
					TSplitWriteCachedReadDataRequest request(1, 1, 1, numBytes);
sl@0
   338
					iControlEp0->SendRequest(request, this);
sl@0
   339
					iTransferComplete = 0; //reset
sl@0
   340
					}
sl@0
   341
				break; // switch(iCaseStep)
sl@0
   342
sl@0
   343
			case EValidBulkTransfeOut: //transfer in
sl@0
   344
				if (aCompletionCode != KErrNone)
sl@0
   345
					{
sl@0
   346
					err = KErrCorrupt;
sl@0
   347
					msg.Format(_L("<Error %d> No data sent on bulk IN request"),aCompletionCode);
sl@0
   348
					break; // switch(iCaseStep)
sl@0
   349
					}
sl@0
   350
sl@0
   351
				switch (aTransferId)
sl@0
   352
					{
sl@0
   353
					case KBulkTransferInId0:
sl@0
   354
					case KBulkTransferInId1:
sl@0
   355
					case KBulkTransferInId2:
sl@0
   356
						iTransferComplete |= aTransferId;
sl@0
   357
						break; // switch(aTransferId)
sl@0
   358
sl@0
   359
					default:
sl@0
   360
						iTransferComplete = 0; //reset
sl@0
   361
						err = KUnexpectedTransferID;
sl@0
   362
						msg.Format(_L("<Error %d> Unexpected transfer ID, wanted %d, %d or %d, got %d"),
sl@0
   363
						err, KBulkTransferInId0, KBulkTransferInId1, KBulkTransferInId2, aTransferId);
sl@0
   364
						break; // switch(aTransferId)
sl@0
   365
					}
sl@0
   366
sl@0
   367
				if (err==KErrNone && iTransferComplete == (KBulkTransferInId0
sl@0
   368
						| KBulkTransferInId1 | KBulkTransferInId2))
sl@0
   369
					{
sl@0
   370
					// compare data rcvd now
sl@0
   371
					TPtrC8 data1(iInTransfer[0]->DataPolled());
sl@0
   372
					TPtrC8 data2(iInTransfer[1]->DataPolled());
sl@0
   373
					TPtrC8 data3(iInTransfer[2]->DataPolled());
sl@0
   374
					if (ValidateData(data1, KLiteralEnglish8().Mid(0, KHostNumReadBytes1)) == EFalse)
sl@0
   375
						{
sl@0
   376
						err = KErrCompletion; //indicates data validation failure
sl@0
   377
						break; // switch(iCaseStep)
sl@0
   378
						}
sl@0
   379
sl@0
   380
					if (ValidateData(data2, KLiteralEnglish8().Mid(KHostNumReadBytes1, KHostNumReadBytes2))
sl@0
   381
							== EFalse)
sl@0
   382
						{
sl@0
   383
						err = KErrCompletion; //indicates data validation failure
sl@0
   384
						break; // switch(iCaseStep)
sl@0
   385
						}
sl@0
   386
sl@0
   387
					if (ValidateData(data3, KLiteralEnglish8().Mid(KHostNumReadBytes1+KHostNumReadBytes2,
sl@0
   388
							KHostNumReadBytes3)) == EFalse)
sl@0
   389
						{
sl@0
   390
						err = KErrCompletion; //indicates data validation failure
sl@0
   391
						break; // switch(iCaseStep)
sl@0
   392
						}
sl@0
   393
sl@0
   394
					// Comparison is a match
sl@0
   395
					RDebug::Printf("Comparison for IN transfer is a match");
sl@0
   396
					iCaseStep = EPassed;
sl@0
   397
					TTestCasePassed request;
sl@0
   398
					iControlEp0->SendRequest(request, this);
sl@0
   399
					iTransferComplete = 0; //reset
sl@0
   400
					}
sl@0
   401
				break; // switch(iCaseStep)
sl@0
   402
sl@0
   403
			default:
sl@0
   404
				err = KUndefinedStep;
sl@0
   405
				msg.Format(_L("<Error %d> Undefined case step %d reached"),KUndefinedStep, iCaseStep);
sl@0
   406
				break; // switch(iCaseStep)
sl@0
   407
			}
sl@0
   408
sl@0
   409
		if (err == KErrCompletion)
sl@0
   410
			{
sl@0
   411
			//indicates data validation failure
sl@0
   412
			msg.Format(_L("<Error %d> Bulk transfer IN data received does not match Bulk Transfer OUT data"), err);
sl@0
   413
			}
sl@0
   414
sl@0
   415
		if (err!=KErrNone)
sl@0
   416
			{
sl@0
   417
			RDebug::Print(msg);
sl@0
   418
			iCaseStep = EFailed;
sl@0
   419
			TTestCaseFailed request(err, msg);
sl@0
   420
			iControlEp0->SendRequest(request, this);
sl@0
   421
			}
sl@0
   422
sl@0
   423
		}
sl@0
   424
sl@0
   425
	void CUT_PBASE_T_USBDI_1234::TrySuspendDeviceByInterfaces()
sl@0
   426
		{
sl@0
   427
		// Suspend interface 0
sl@0
   428
		RDebug::Printf("Suspending interface 0");
sl@0
   429
		iInterface0Watcher->SuspendAndWatch();
sl@0
   430
		iSuspendedI0 = ETrue;
sl@0
   431
sl@0
   432
		// Suspend interface 1
sl@0
   433
		RDebug::Printf("Suspending interface 1");
sl@0
   434
		iInterface1Watcher->SuspendAndWatch();
sl@0
   435
		iSuspendedI1 = ETrue;
sl@0
   436
sl@0
   437
		// Suspend interface 2
sl@0
   438
		RDebug::Printf("Suspending interface 2");
sl@0
   439
		iInterface2Watcher->SuspendAndWatch();
sl@0
   440
		iSuspendedI2 = ETrue;
sl@0
   441
sl@0
   442
		TimeoutIn(10); // Give 10 seconds for device to suspend
sl@0
   443
sl@0
   444
		// scenario2 : device could do the bulk transfer must wait device really resumed. 
sl@0
   445
		iUsbInterface0.CancelPermitSuspend();
sl@0
   446
sl@0
   447
		iCaseStep = EValidateResumebyInterface;
sl@0
   448
sl@0
   449
		}
sl@0
   450
sl@0
   451
	void CUT_PBASE_T_USBDI_1234::SendEpRequest()
sl@0
   452
		{
sl@0
   453
		TTestCasePassed request;
sl@0
   454
		iControlEp0->SendRequest(request, this);
sl@0
   455
		}
sl@0
   456
	void CUT_PBASE_T_USBDI_1234::SendEpTransferRequest()
sl@0
   457
		{
sl@0
   458
		TEndpointReadRequest request(1, 1, KBulkTransferSize);// EP1 means endpoint index 1 not the actual endpoint number
sl@0
   459
		iControlEp0->SendRequest(request, this);
sl@0
   460
		}
sl@0
   461
sl@0
   462
	}//end namespace
sl@0
   463
sl@0
   464