/*
 * Copyright 2013 Klaus Reimer <k@ailis.de>
 * See LICENSE.txt for licensing information.
 * 
 * Based on libusbx <http://libusbx.org/>:  
 * 
 * Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
 * Copyright 2007-2008 Daniel Drake <dsd@gentoo.org>
 * Copyright 2012 Pete Batard <pete@akeo.ie>
 */

package de.ailis.usb4java.libusb;

import java.nio.ByteBuffer;

/**
 * The generic USB transfer structure.
 * 
 * The user populates this structure and then submits it in order to request a
 * transfer. After the transfer has completed, the library populates the
 * transfer with the results and passes it back to the user.
 */
public final class Transfer
{
    /** The native pointer to the transfer structure. */
    private long pointer;

    /**
     * Returns the native pointer.
     * 
     * @return The native pointer.
     */
    public long getPointer()
    {
        return this.pointer;
    }
        
    /**
     * Returns the handle of the device that this transfer will be submitted to.
     * 
     * @return The handle of the device.
     */
    public native DeviceHandle getDevHandle();

    /**
     * Sets the handle of the device that this transfer will be submitted to.
     * 
     * @param handle
     *            The handle of the device.
     */
    public native void setDevHandle(final DeviceHandle handle);

    /**
     * Returns the bitwise OR combination of libusb transfer flags.
     * 
     * @return The transfer flags.
     */
    public native int getFlags();

    /**
     * Sets the bitwise OR combination of libusb transfer flags.
     * 
     * @param flags
     *            The transfer flags to set.
     */
    public native void setFlags(final int flags);

    /**
     * Returns the address of the endpoint where this transfer will be sent.
     * 
     * @return The endpoint address.
     */
    public native int getEndpoint();

    /**
     * Sets the address of the endpoint where this transfer will be sent.
     * 
     * @param endpoint
     *            The endpoint address to set
     */
    public native void setEndpoint(final int endpoint);

    /**
     * Returns the type of the endpoint.
     * 
     * @return The endpoint type.
     */
    public native int getType();

    /**
     * Sets the type of the endpoint.
     * 
     * @param type
     *            The endpoint type to set.
     */
    public native void setType(final int type);

    /**
     * Returns the timeout for this transfer in milliseconds. A value of 0
     * indicates no timeout.
     * 
     * @return The timeout.
     */
    public native long getTimeout();

    /**
     * Sets the timeout for this transfer in milliseconds. A value of 0
     * indicates no timeout.
     * 
     * @param timeout
     *            The timeout to set.
     */
    public native void setTimeout(final int timeout);

    /**
     * Returns the status of the transfer. Read-only, and only for use within
     * transfer callback function.
     * 
     * If this is an isochronous transfer, this field may read
     * {@link LibUSB#TRANSFER_COMPLETED} even if there were errors in the
     * frames. Use the status field in each packet to determine if errors
     * occurred.
     * 
     * @return The transfer status.
     */
    public native int getStatus();

    public native int getLength();

    public native void setLength(final int length);

    public native int getActualLength();

    public native ByteBuffer getBuffer();

    public native void setBuffer(final ByteBuffer buffer);

    public native int getNumIsoPackets();

    public native void setNumIsoPackets(final int numIsoPackets);
}

@@ -906,24 +906,16 @@
 ;%0A    %7D%0A
-        
 %0A    /**
@@ -3294,280 +3294,1334 @@
     
-public native int getLength();%0A%0A    public native void setLength(final int length);%0A%0A    public native int getActualLength();%0A%0A    public native ByteBuffer getBuffer();%0A%0A    public native void setBuffer(final ByteBuffer buffer);%0A%0A    public native int getNumIsoPackets();%0A
+/**%0A     * Returns the length of the data buffer.%0A     * %0A     * @return The data buffer length.%0A     */%0A    public native int getLength();%0A%0A    /**%0A     * Sets the length of the data buffer.%0A     * %0A     * @param length%0A     *            The data buffer length to set.%0A     */%0A    public native void setLength(final int length);%0A%0A    /**%0A     * Returns the actual length of data that was transferred. Read-only, and%0A     * only for use within transfer callback function. Not valid for isochronous%0A     * endpoint transfers.%0A     * %0A     * @return The actual length of the transferred data.%0A     */%0A    public native int getActualLength();%0A%0A    /**%0A     * Returns the data buffer.%0A     * %0A     * @return The data buffer.%0A     */%0A    public native ByteBuffer getBuffer();%0A%0A    /**%0A     * Sets the data buffer.%0A     * %0A     * @param buffer%0A     *            The data buffer to set.%0A     */%0A    public native void setBuffer(final ByteBuffer buffer);%0A%0A    /**%0A     * Returns the number of isochronous packets. Only used for I/O with%0A     * isochronous endpoints.%0A     * %0A     * @return The number of isochronous packets.%0A     */%0A    public native int getNumIsoPackets();%0A%0A    /**%0A     * Sets the number of isochronous packets.%0A     * %0A     * @param numIsoPackets%0A     *            The number of isochronous packets to set.%0A     */
 %0A   

Add missing API doc