public class TransportUsb extends BaseTransport
_address, _byteQueue, _connState, _connType, _devName, _devType, _macAddress, DUMP, INFO, IO, TAG| Constructor and Description |
|---|
TransportUsb(DeviceType deviceType,
UsbDevice device) |
TransportUsb(DeviceType deviceType,
UsbDevice device,
boolean forceToUsb)
Constructor for TransportUsb.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Returns the length of data that can be read with the read method.
|
boolean |
connect()
Attempts to connect to the appliance using an instance of the Transport class.
|
void |
destroy()
Destroys the instance and returns the resource.
|
void |
disconnect()
An instance of the Transport class closes the connection to the device to which the device
is connected.
|
String |
getAddress()
Returns the address of the device to which the BaseTransport instance is connected.
|
boolean |
isForceToUsb()
Returns the flag indicating whether the transport is forced to USB.
|
void |
listen()
An instance of the BaseTransport class waits for the device to connect.
|
int |
read(byte[] data,
int offset,
int length)
Read data received from the device.
|
int |
read(byte[] data,
int offset,
int length,
int timeout)
Read data received from the device.
|
int |
write(byte[] data,
int offset,
int length)
Transfer data to the device.
|
int |
write(byte[] data,
int offset,
int length,
int timeout)
Transfer data to the device.
|
checkBufferSize, getConnectType, getDeviceName, getDeviceType, getMacAddress, getState, read, read, resetBuffer, setAddress, setDeviceName, setDeviceType, setMacAddress, setState, setStateListener, toString, write, writepublic TransportUsb(DeviceType deviceType, UsbDevice device, boolean forceToUsb)
deviceType - the type of device (e.g., DeviceType.RP300)device - the USB device to be used for transportforceToUsb - a flag indicating whether to force the transport to USBpublic TransportUsb(DeviceType deviceType, UsbDevice device)
public String getAddress()
BaseTransportgetAddress in class BaseTransportpublic int available()
BaseTransportavailable in class BaseTransportpublic boolean connect()
BaseTransportconnect in class BaseTransportpublic void disconnect()
BaseTransportdisconnect in class BaseTransportpublic void listen()
BaseTransportlisten in class BaseTransportpublic void destroy()
BaseTransportdestroy in class BaseTransportpublic int read(byte[] data,
int offset,
int length)
BaseTransportread in class BaseTransportdata - A byte array to store the data received from the device.offset - Integer specifying the start address at which data received from device will
begin to be stored in a byte array.length - An integer specifying the maximum length at which data received from the
device can be stored in a byte array.public int read(byte[] data,
int offset,
int length,
int timeout)
BaseTransportread in class BaseTransportdata - A byte array to store the data received from the device.offset - Integer specifying the start address at which data received from device will
begin to be stored in a byte array.length - An integer specifying the maximum length at which data received from the
device can be stored in a byte array.timeout - An integer that specifies the timeout for reading data received from the device.public int write(byte[] data,
int offset,
int length)
BaseTransportwrite in class BaseTransportdata - A byte array that specifies the data to transfer to the Device.offset - An integer indicating the start address of the data to be transferred to the Device.length - An integer indicating the length of the data to be transferred to the Device.public int write(byte[] data,
int offset,
int length,
int timeout)
BaseTransportwrite in class BaseTransportdata - A byte array that specifies the data to transfer to the Device.offset - An integer indicating the start address of the data to be transferred to the Device.length - An integer indicating the length of the data to be transferred to the Device.timeout - An integer specifying the timeout of data transmission to the device.public boolean isForceToUsb()