First public contribution.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // @file hostinterrupttransfers.cpp
19 #include "hosttransfers.h"
20 #include "testdebug.h"
22 namespace NUnitTesting_USBDI
26 CInterruptTransfer::CInterruptTransfer(RUsbPipe& aPipe,RUsbInterface& aInterface,TInt aMaxTransferSize,MTransferObserver& aObserver,TInt aTransferId)
27 : CBaseTransfer(aPipe,aInterface,aObserver,aTransferId),
28 iTransferDescriptor(aMaxTransferSize) // Allocate the buffer for interrupt transfers
33 CInterruptTransfer::~CInterruptTransfer()
37 // Cancel the transfer
43 TPtrC8 CInterruptTransfer::DataPolled()
45 return iTransferDescriptor.Buffer();
49 TInt CInterruptTransfer::TransferInL(TInt aSize)
53 // Activate the asynchronous transfer
54 RDebug::Printf("Activating interrupt in transfer");
55 iTransferDescriptor.SaveData(aSize);
56 Pipe().Transfer(iTransferDescriptor,iStatus);
61 TInt CInterruptTransfer::RegisterTransferDescriptor()
65 // Register the transfer descriptor with the interface
66 TInt err(Interface().RegisterTransferDescriptor(iTransferDescriptor));
69 RDebug::Printf("<Error %d> Unable to register transfer descriptor",err);