URL
https://opencores.org/ocsvn/usb_fpga_1_11/usb_fpga_1_11/trunk
Subversion Repositories usb_fpga_1_11
[/] [usb_fpga_1_11/] [trunk/] [docs/] [java/] [ch/] [ntb/] [usb/] [Device.html] - Rev 2
Go to most recent revision | Compare with Previous | Blame | View Log
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_02) on Fri Jun 11 14:15:44 CEST 2010 --> <TITLE> Device </TITLE> <META NAME="date" CONTENT="2010-06-11"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Device"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> PREV CLASS <A HREF="../../../ch/ntb/usb/LibLoader.html" title="class in ch.ntb.usb"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?ch/ntb/usb/Device.html" target="_top"><B>FRAMES</B></A> <A HREF="Device.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> ch.ntb.usb</FONT> <BR> Class Device</H2> <PRE> java.lang.Object <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>ch.ntb.usb.Device</B> </PRE> <HR> <DL> <DT><PRE>public class <B>Device</B><DT>extends java.lang.Object</DL> </PRE> <P> This class represents an USB device.<br> To get an instance of an USB device use <code>USB.getDevice(...)</code>. <P> <P> <HR> <P> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#Device(short, short)">Device</A></B>(short idVendor, short idProduct)</CODE> <BR> </TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#Device(short, short, java.lang.String)">Device</A></B>(short idVendor, short idProduct, java.lang.String filename)</CODE> <BR> </TD> </TR> </TABLE> <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#close()">close</A></B>()</CODE> <BR> Release the claimed interface and close the opened device.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#controlMsg(int, int, int, int, byte[], int, int, boolean)">controlMsg</A></B>(int requestType, int request, int value, int index, byte[] data, int size, int timeout, boolean reopenOnTimeout)</CODE> <BR> Performs a control request to the default control pipe on a device.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#getAltinterface()">getAltinterface</A></B>()</CODE> <BR> Returns the alternative interface.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../ch/ntb/usb/Usb_Config_Descriptor.html" title="class in ch.ntb.usb">Usb_Config_Descriptor</A>[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#getConfigDescriptors()">getConfigDescriptors</A></B>()</CODE> <BR> Returns the configuration descriptors associated with this device.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#getConfiguration()">getConfiguration</A></B>()</CODE> <BR> Returns the current configuration used.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../ch/ntb/usb/Usb_Device.html" title="class in ch.ntb.usb">Usb_Device</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#getDevice()">getDevice</A></B>()</CODE> <BR> Returns the Usb_Device instance associated with this device.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../ch/ntb/usb/Usb_Device_Descriptor.html" title="class in ch.ntb.usb">Usb_Device_Descriptor</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#getDeviceDescriptor()">getDeviceDescriptor</A></B>()</CODE> <BR> Returns the device descriptor associated with this device.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#getFilename()">getFilename</A></B>()</CODE> <BR> Returns the optional filename which is set when there are multiple devices with the same vendor and product id.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#getIdProduct()">getIdProduct</A></B>()</CODE> <BR> Returns the product ID of the device.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#getIdVendor()">getIdVendor</A></B>()</CODE> <BR> Returns the vendor ID of the device.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#getInterface()">getInterface</A></B>()</CODE> <BR> Returns the current interface.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#getMaxPacketSize()">getMaxPacketSize</A></B>()</CODE> <BR> Returns the maximum packet size in bytes which is allowed to be transmitted at once.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#isOpen()">isOpen</A></B>()</CODE> <BR> Check if the device is open.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#open(int, int, int)">open</A></B>(int configuration, int interface_, int altinterface)</CODE> <BR> Opens the device and claims the specified configuration, interface and altinterface.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#readBulk(int, byte[], int, int, boolean)">readBulk</A></B>(int in_ep_address, byte[] data, int size, int timeout, boolean reopenOnTimeout)</CODE> <BR> Read data from the device using a bulk transfer.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#readInterrupt(int, byte[], int, int, boolean)">readInterrupt</A></B>(int in_ep_address, byte[] data, int size, int timeout, boolean reopenOnTimeout)</CODE> <BR> Read data from the device using a interrupt transfer.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#reset()">reset</A></B>()</CODE> <BR> Sends an USB reset to the device.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#setResetOnFirstOpen(boolean, int)">setResetOnFirstOpen</A></B>(boolean enable, int timeout)</CODE> <BR> If enabled, the device is reset when first opened.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#updateDescriptors()">updateDescriptors</A></B>()</CODE> <BR> Updates the device and descriptor information from the bus.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#writeBulk(int, byte[], int, int, boolean)">writeBulk</A></B>(int out_ep_address, byte[] data, int size, int timeout, boolean reopenOnTimeout)</CODE> <BR> Write data to the device using a bulk transfer.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../ch/ntb/usb/Device.html#writeInterrupt(int, byte[], int, int, boolean)">writeInterrupt</A></B>(int out_ep_address, byte[] data, int size, int timeout, boolean reopenOnTimeout)</CODE> <BR> Write data to the device using a interrupt transfer.</TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="Device(short, short)"><!-- --></A><H3> Device</H3> <PRE> protected <B>Device</B>(short idVendor, short idProduct)</PRE> <DL> </DL> <HR> <A NAME="Device(short, short, java.lang.String)"><!-- --></A><H3> Device</H3> <PRE> protected <B>Device</B>(short idVendor, short idProduct, java.lang.String filename)</PRE> <DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="updateDescriptors()"><!-- --></A><H3> updateDescriptors</H3> <PRE> public void <B>updateDescriptors</B>() throws <A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></PRE> <DL> <DD>Updates the device and descriptor information from the bus.<br> The descriptors can be read with <A HREF="../../../ch/ntb/usb/Device.html#getDeviceDescriptor()"><CODE>getDeviceDescriptor()</CODE></A> and <A HREF="../../../ch/ntb/usb/Device.html#getConfigDescriptors()"><CODE>getConfigDescriptors()</CODE></A>. <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></CODE></DL> </DD> </DL> <HR> <A NAME="getDeviceDescriptor()"><!-- --></A><H3> getDeviceDescriptor</H3> <PRE> public <A HREF="../../../ch/ntb/usb/Usb_Device_Descriptor.html" title="class in ch.ntb.usb">Usb_Device_Descriptor</A> <B>getDeviceDescriptor</B>()</PRE> <DL> <DD>Returns the device descriptor associated with this device.<br> The descriptor is updated by calling <A HREF="../../../ch/ntb/usb/Device.html#updateDescriptors()"><CODE>updateDescriptors()</CODE></A> or <A HREF="../../../ch/ntb/usb/Device.html#open(int, int, int)"><CODE>open(int, int, int)</CODE></A>. <P> <DD><DL> <DT><B>Returns:</B><DD>the device descriptor associated with this device or <code>null</code></DL> </DD> </DL> <HR> <A NAME="getConfigDescriptors()"><!-- --></A><H3> getConfigDescriptors</H3> <PRE> public <A HREF="../../../ch/ntb/usb/Usb_Config_Descriptor.html" title="class in ch.ntb.usb">Usb_Config_Descriptor</A>[] <B>getConfigDescriptors</B>()</PRE> <DL> <DD>Returns the configuration descriptors associated with this device.<br> The descriptors are updated by calling <A HREF="../../../ch/ntb/usb/Device.html#updateDescriptors()"><CODE>updateDescriptors()</CODE></A> or <A HREF="../../../ch/ntb/usb/Device.html#open(int, int, int)"><CODE>open(int, int, int)</CODE></A>. <P> <DD><DL> <DT><B>Returns:</B><DD>the configuration descriptors associated with this device or <code>null</code></DL> </DD> </DL> <HR> <A NAME="open(int, int, int)"><!-- --></A><H3> open</H3> <PRE> public void <B>open</B>(int configuration, int interface_, int altinterface) throws <A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></PRE> <DL> <DD>Opens the device and claims the specified configuration, interface and altinterface.<br> First the bus is enumerated. If the device is found its descriptors are read and the <code>maxPacketSize</code> value is updated. If no endpoints are found in the descriptors an exception is thrown. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>configuration</CODE> - the configuration, see <A HREF="../../../ch/ntb/usb/Usb_Config_Descriptor.html#getBConfigurationValue()"><CODE>Usb_Config_Descriptor.getBConfigurationValue()</CODE></A><DD><CODE>interface_</CODE> - the interface, see <A HREF="../../../ch/ntb/usb/Usb_Interface_Descriptor.html#getBInterfaceNumber()"><CODE>Usb_Interface_Descriptor.getBInterfaceNumber()</CODE></A><DD><CODE>altinterface</CODE> - the alternate interface, see <A HREF="../../../ch/ntb/usb/Usb_Interface_Descriptor.html#getBAlternateSetting()"><CODE>Usb_Interface_Descriptor.getBAlternateSetting()</CODE></A>. If no alternate interface must be set <i>-1</i> can be used. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></CODE></DL> </DD> </DL> <HR> <A NAME="close()"><!-- --></A><H3> close</H3> <PRE> public void <B>close</B>() throws <A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></PRE> <DL> <DD>Release the claimed interface and close the opened device.<br> <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></CODE></DL> </DD> </DL> <HR> <A NAME="reset()"><!-- --></A><H3> reset</H3> <PRE> public void <B>reset</B>() throws <A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></PRE> <DL> <DD>Sends an USB reset to the device. The device handle will no longer be valid. To use the device again, <A HREF="../../../ch/ntb/usb/Device.html#open(int, int, int)"><CODE>open(int, int, int)</CODE></A> must be called. <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></CODE></DL> </DD> </DL> <HR> <A NAME="writeBulk(int, byte[], int, int, boolean)"><!-- --></A><H3> writeBulk</H3> <PRE> public int <B>writeBulk</B>(int out_ep_address, byte[] data, int size, int timeout, boolean reopenOnTimeout) throws <A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></PRE> <DL> <DD>Write data to the device using a bulk transfer.<br> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>out_ep_address</CODE> - endpoint address to write to<DD><CODE>data</CODE> - data to write to this endpoint<DD><CODE>size</CODE> - size of the data<DD><CODE>timeout</CODE> - amount of time in ms the device will try to send the data until a timeout exception is thrown<DD><CODE>reopenOnTimeout</CODE> - if set to true, the device will try to open the connection and send the data again before a timeout exception is thrown <DT><B>Returns:</B><DD>the actual number of bytes written <DT><B>Throws:</B> <DD><CODE><A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></CODE></DL> </DD> </DL> <HR> <A NAME="readBulk(int, byte[], int, int, boolean)"><!-- --></A><H3> readBulk</H3> <PRE> public int <B>readBulk</B>(int in_ep_address, byte[] data, int size, int timeout, boolean reopenOnTimeout) throws <A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></PRE> <DL> <DD>Read data from the device using a bulk transfer.<br> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>in_ep_address</CODE> - endpoint address to read from<DD><CODE>data</CODE> - data buffer for the data to be read<DD><CODE>size</CODE> - the maximum requested data size<DD><CODE>timeout</CODE> - amount of time in ms the device will try to receive data until a timeout exception is thrown<DD><CODE>reopenOnTimeout</CODE> - if set to true, the device will try to open the connection and receive the data again before a timeout exception is thrown <DT><B>Returns:</B><DD>the actual number of bytes read <DT><B>Throws:</B> <DD><CODE><A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></CODE></DL> </DD> </DL> <HR> <A NAME="writeInterrupt(int, byte[], int, int, boolean)"><!-- --></A><H3> writeInterrupt</H3> <PRE> public int <B>writeInterrupt</B>(int out_ep_address, byte[] data, int size, int timeout, boolean reopenOnTimeout) throws <A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></PRE> <DL> <DD>Write data to the device using a interrupt transfer.<br> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>out_ep_address</CODE> - endpoint address to write to<DD><CODE>data</CODE> - data to write to this endpoint<DD><CODE>size</CODE> - size of the data<DD><CODE>timeout</CODE> - amount of time in ms the device will try to send the data until a timeout exception is thrown<DD><CODE>reopenOnTimeout</CODE> - if set to true, the device will try to open the connection and send the data again before a timeout exception is thrown <DT><B>Returns:</B><DD>the actual number of bytes written <DT><B>Throws:</B> <DD><CODE><A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></CODE></DL> </DD> </DL> <HR> <A NAME="readInterrupt(int, byte[], int, int, boolean)"><!-- --></A><H3> readInterrupt</H3> <PRE> public int <B>readInterrupt</B>(int in_ep_address, byte[] data, int size, int timeout, boolean reopenOnTimeout) throws <A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></PRE> <DL> <DD>Read data from the device using a interrupt transfer.<br> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>in_ep_address</CODE> - endpoint address to read from<DD><CODE>data</CODE> - data buffer for the data to be read<DD><CODE>size</CODE> - the maximum requested data size<DD><CODE>timeout</CODE> - amount of time in ms the device will try to receive data until a timeout exception is thrown<DD><CODE>reopenOnTimeout</CODE> - if set to true, the device will try to open the connection and receive the data again before a timeout exception is thrown <DT><B>Returns:</B><DD>the actual number of bytes read <DT><B>Throws:</B> <DD><CODE><A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></CODE></DL> </DD> </DL> <HR> <A NAME="controlMsg(int, int, int, int, byte[], int, int, boolean)"><!-- --></A><H3> controlMsg</H3> <PRE> public int <B>controlMsg</B>(int requestType, int request, int value, int index, byte[] data, int size, int timeout, boolean reopenOnTimeout) throws <A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></PRE> <DL> <DD>Performs a control request to the default control pipe on a device.<br> The parameters mirror the types of the same name in the USB specification. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>requestType</CODE> - USB device request type (USB specification 9.3, bmRequestType). Use constants from <A HREF="../../../ch/ntb/usb/USB.html" title="class in ch.ntb.usb"><CODE>USB</CODE></A> (REQ_TYPE_xxx).<DD><CODE>request</CODE> - specific request (USB specification 9.4, bRequest). Use constants from <A HREF="../../../ch/ntb/usb/USB.html" title="class in ch.ntb.usb"><CODE>USB</CODE></A> (REQ_xxx).<DD><CODE>value</CODE> - field that varies according to request (USB specification 9.4, wValue)<DD><CODE>index</CODE> - field that varies according to request (USB specification 9.4, wIndex)<DD><CODE>data</CODE> - the send/receive buffer<DD><CODE>size</CODE> - the buffer size. 0 is a valid value, but there must still be a dummy data buffer provided.<DD><CODE>timeout</CODE> - amount of time in ms the device will try to send/receive data until a timeout exception is thrown<DD><CODE>reopenOnTimeout</CODE> - if set to true, the device will try to open the connection and send/receive the data again before a timeout exception is thrown <DT><B>Returns:</B><DD>the number of bytes written/read <DT><B>Throws:</B> <DD><CODE><A HREF="../../../ch/ntb/usb/USBException.html" title="class in ch.ntb.usb">USBException</A></CODE></DL> </DD> </DL> <HR> <A NAME="getIdProduct()"><!-- --></A><H3> getIdProduct</H3> <PRE> public int <B>getIdProduct</B>()</PRE> <DL> <DD>Returns the product ID of the device.<br> <P> <DD><DL> <DT><B>Returns:</B><DD>the product ID of the device.</DL> </DD> </DL> <HR> <A NAME="getIdVendor()"><!-- --></A><H3> getIdVendor</H3> <PRE> public int <B>getIdVendor</B>()</PRE> <DL> <DD>Returns the vendor ID of the device.<br> <P> <DD><DL> <DT><B>Returns:</B><DD>the vendor ID of the device.</DL> </DD> </DL> <HR> <A NAME="getAltinterface()"><!-- --></A><H3> getAltinterface</H3> <PRE> public int <B>getAltinterface</B>()</PRE> <DL> <DD>Returns the alternative interface.<br> This value is only valid after opening the device. <P> <DD><DL> <DT><B>Returns:</B><DD>the alternative interface. This value is only valid after opening the device.</DL> </DD> </DL> <HR> <A NAME="getConfiguration()"><!-- --></A><H3> getConfiguration</H3> <PRE> public int <B>getConfiguration</B>()</PRE> <DL> <DD>Returns the current configuration used.<br> This value is only valid after opening the device. <P> <DD><DL> <DT><B>Returns:</B><DD>the current configuration used. This value is only valid after opening the device.</DL> </DD> </DL> <HR> <A NAME="getInterface()"><!-- --></A><H3> getInterface</H3> <PRE> public int <B>getInterface</B>()</PRE> <DL> <DD>Returns the current interface.<br> This value is only valid after opening the device. <P> <DD><DL> <DT><B>Returns:</B><DD>the current interface. This value is only valid after opening the device.</DL> </DD> </DL> <HR> <A NAME="getMaxPacketSize()"><!-- --></A><H3> getMaxPacketSize</H3> <PRE> public int <B>getMaxPacketSize</B>()</PRE> <DL> <DD>Returns the maximum packet size in bytes which is allowed to be transmitted at once.<br> The value is determined by reading the endpoint descriptor(s) when opening the device. It is invalid before the device is opened! Note that if some endpoints use different packet sizes the maximum packet size is return. This value may be used to determine if a device is opened in fullspeed or highspeed mode. <P> <DD><DL> <DT><B>Returns:</B><DD>the maximum packet size</DL> </DD> </DL> <HR> <A NAME="isOpen()"><!-- --></A><H3> isOpen</H3> <PRE> public boolean <B>isOpen</B>()</PRE> <DL> <DD>Check if the device is open.<br> This checks only for a valid device handle. It doesn't check if the device is still attached or working. <P> <DD><DL> <DT><B>Returns:</B><DD>true if the device is open</DL> </DD> </DL> <HR> <A NAME="setResetOnFirstOpen(boolean, int)"><!-- --></A><H3> setResetOnFirstOpen</H3> <PRE> public void <B>setResetOnFirstOpen</B>(boolean enable, int timeout)</PRE> <DL> <DD>If enabled, the device is reset when first opened. <br> This will only happen once. When the application is started, the device state is unknown. If the device is not reset, read or write may result in a <A HREF="../../../ch/ntb/usb/USBTimeoutException.html" title="class in ch.ntb.usb"><CODE>USBTimeoutException</CODE></A>.<br> <br> This feature is disabled by default. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>enable</CODE> - true if the device should be reset when first opened<DD><CODE>timeout</CODE> - the timeout between the reset and the reopening</DL> </DD> </DL> <HR> <A NAME="getFilename()"><!-- --></A><H3> getFilename</H3> <PRE> protected java.lang.String <B>getFilename</B>()</PRE> <DL> <DD>Returns the optional filename which is set when there are multiple devices with the same vendor and product id. See <A HREF="../../../ch/ntb/usb/USB.html#getDevice(short, short, java.lang.String)"><CODE>USB.getDevice(short, short, String)</CODE></A>. Use <A HREF="../../../ch/ntb/usb/Usb_Device.html#getFilename()"><CODE>Usb_Device.getFilename()</CODE></A> to read the filename of a device. <P> <DD><DL> <DT><B>Returns:</B><DD>the filename if set or null</DL> </DD> </DL> <HR> <A NAME="getDevice()"><!-- --></A><H3> getDevice</H3> <PRE> public <A HREF="../../../ch/ntb/usb/Usb_Device.html" title="class in ch.ntb.usb">Usb_Device</A> <B>getDevice</B>()</PRE> <DL> <DD>Returns the Usb_Device instance associated with this device. This value is only valid after opening the device. <P> <DD><DL> <DT><B>Returns:</B><DD>the Usb_Device instance associated with this device.</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> PREV CLASS <A HREF="../../../ch/ntb/usb/LibLoader.html" title="class in ch.ntb.usb"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?ch/ntb/usb/Device.html" target="_top"><B>FRAMES</B></A> <A HREF="Device.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
Go to most recent revision | Compare with Previous | Blame | View Log