kerneltest/e32test/usbho/t_usbdi/src/hostinterrupttransfers.cpp
changeset 0 a41df078684a
child 253 d37db4dcc88d
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // @file hostinterrupttransfers.cpp
       
    15 // @internalComponent
       
    16 // 
       
    17 //
       
    18 
       
    19 #include "hosttransfers.h"
       
    20 #include "testdebug.h"
       
    21 
       
    22 namespace NUnitTesting_USBDI
       
    23 	{
       
    24 	
       
    25 	
       
    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
       
    29 	{
       
    30 
       
    31 	}
       
    32 	
       
    33 CInterruptTransfer::~CInterruptTransfer()
       
    34 	{
       
    35 	LOG_FUNC 
       
    36 	
       
    37 	// Cancel the transfer
       
    38 
       
    39 	Cancel();
       
    40 	}
       
    41 	
       
    42 	
       
    43 TPtrC8 CInterruptTransfer::DataPolled()
       
    44 	{
       
    45 	return iTransferDescriptor.Buffer();
       
    46 	}
       
    47 	
       
    48 	
       
    49 TInt CInterruptTransfer::TransferInL(TInt aSize)
       
    50 	{
       
    51 	LOG_FUNC
       
    52 	
       
    53 	// Activate the asynchronous transfer 	
       
    54 	RDebug::Printf("Activating interrupt in transfer");
       
    55 	iTransferDescriptor.SaveData(aSize);
       
    56 	Pipe().Transfer(iTransferDescriptor,iStatus);
       
    57 	SetActive();
       
    58 	return KErrNone;
       
    59 	}
       
    60 
       
    61 TInt CInterruptTransfer::RegisterTransferDescriptor()
       
    62 	{
       
    63 	LOG_FUNC
       
    64 	
       
    65 	// Register the transfer descriptor with the interface	
       
    66 	TInt err(Interface().RegisterTransferDescriptor(iTransferDescriptor));
       
    67 	if(err != KErrNone)
       
    68 		{
       
    69 		RDebug::Printf("<Error %d> Unable to register transfer descriptor",err);
       
    70 		}
       
    71 	return err;
       
    72 	}
       
    73 	
       
    74 
       
    75 		
       
    76 	}