Class that implements the USB specific communication and extends the AComm class. More...
Public Member Functions | |
| UsbConnection () | |
| Initialize new class instance based on vendorId and productId. More... | |
| UsbConnection (short vendorId) | |
| UsbConnection (short vendorId, short productId) | |
| UsbConnection (String descriptor) | |
| Initialize new class instance based on descriptor string. More... | |
| int | BytesAvailable () |
| Number of bytes available to read. This is estimate and number can change as data is received. | |
| void | Close () |
| Closes a connection. | |
| boolean | Connected () |
| true if connection is established | |
| String | Descriptor () |
| Returns a string description of the connection. More... | |
| void | Open () |
| Opens a connection. | |
| short | P_ID () |
| Product ID. | |
| byte[] | Read () |
| Read all bytes available. | |
| void | Read (OutputStream binDataIn) throws IOException |
| Reads all bytes available into the stream passed in. | |
| short | V_ID () |
| Vendor ID. | |
| void | WaitForData (int msTimeOut) |
| Waits until data available BytesAvailable in current thread. Current thread sleeps until data received or timeout reached. Blocking call. More... | |
| void | Write (byte[] dataOut) |
| Writes all bytes from the array passed in. | |
| void | Write (InputStream binReader) throws IOException |
| Write from input stream to output stream More... | |
| byte[] | WriteAndWaitForResponse (byte[] dataOut, int responseStartTimeOut, int responseEndTimeOut, String completetionToken) throws IOException |
| Write byte data to output stream and return data received. Data returned is any data received or up to completion token if received. Wait for response timeout before returning. More... | |
| void | WriteAndWaitForResponse (OutputStream binDataIn, InputStream binDataOut, int responseStartTimeOut, int responseEndTimeOut, String completetionToken) throws IOException |
| Write binDataOut stream data to output stream and return data received in binDataIn stream. Data returned is any data received or up to completion token if received. Wait for response timeout before returning. More... | |
Static Public Member Functions | |
| static List< Tuple< Short, Short > > | AvaliableDevices () |
| Return the list of available devices in the format of List<Tuple<Short, Short>>. More... | |
| static List< Short > | DescriptorValidate (String descriptorHint) |
| Validate descriptor string from hint. More... | |
Static Public Attributes | |
| static final short | PTX_USB_VID = 0x14ae |
| static final short | TSC_USB_VID = 0x1203 |
Class that implements the USB specific communication and extends the AComm class.
| UsbConnection | ( | ) |
Initialize new class instance based on vendorId and productId.
| [in] | vendorId | Vendor ID (e.g., TSC or Printronix). Optional. |
| [in] | productId | Product ID. Optional. |
| UsbConnection | ( | String | descriptor | ) |
Initialize new class instance based on descriptor string.
| descriptor | Acceptable formats:
|
|
static |
Return the list of available devices in the format of List<Tuple<Short, Short>>.
v_id means Vendor ID; p_id means Product ID.
| String Descriptor | ( | ) |
Returns a string description of the connection.
Format returned:
Implements IComm.
|
static |
Validate descriptor string from hint.
Acceptable formats:
|
inherited |
Waits until data available BytesAvailable in current thread. Current thread sleeps until data received or timeout reached. Blocking call.
| [in] | msTimeOut | Millisecond timeout before return if no data received. |
Implements IComm.
|
inherited |
Write from input stream to output stream
| [in] | binReader | Source data to send |
Implements IComm.
|
inherited |
Write byte data to output stream and return data received. Data returned is any data received or up to completion token if received. Wait for response timeout before returning.
| byte[] | Array of bytes received from connection. Data returned is any data received or up to completetionToken if token received |
| [in] | dataOut | Source byte array to write to connection. |
| [in] | responseStartTimeOut | Timeout to wait for first data to be received. Time to first byte. |
| [in] | responseEndTimeOut | Timeout of no new data received. Time after last byte. |
| [in] | completetionToken | String token denoting the end of the response expected. This can be empty string if simply want to wait for response after writing data to connection. |
Implements IComm.
|
inherited |
Write binDataOut stream data to output stream and return data received in binDataIn stream. Data returned is any data received or up to completion token if received. Wait for response timeout before returning.
| [out] | binDataIn | Destination stream to store response received from connection. |
| [in] | binDataOut | Source stream data to write to connection. |
| [in] | responseStartTimeOut | Timeout to wait for first data to be received. Time to first byte. |
| [in] | responseEndTimeOut | Timeout of no new data received. Time after last byte. |
| [in] | completetionToken | String token denoting the end of the response expected. This can be empty string if simply want to wait for response after writing data to connection. |
Implements IComm.