public abstract class Device
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_BUFFER_SIZE
Size of the receive buffer
|
static int |
MAX_STREAM_SIZE
Size of the PipedInputStream
|
Constructor and Description |
---|
Device()
Create an instance of the Device class
|
Modifier and Type | Method and Description |
---|---|
abstract void |
connect(java.lang.String address)
Attempts to connect to the appliance using an instance of the Device class.
|
abstract void |
destroy()
Destroy an instance and release resources.
|
abstract void |
disconnect()
An instance of the Device class closes the connection to the device to which the device is connected.
|
abstract java.lang.String |
getAddress()
Returns address of device
|
abstract java.lang.String |
getName()
Returns name of device.
|
java.io.InputStream |
getReader()
Returns instance of the PipedInputStream.
|
ConnectionState |
getState()
Returns connection status of device
|
abstract void |
listen()
An instance of the Device class waits for the device to connect.
|
void |
setStateChangedListener(com.asreader.lib.device.event.ConnectionStateListener listener)
Sets the listener to receive the connection state.
|
abstract void |
waitConnection() |
abstract void |
write(byte[] data)
Write data to the device.
|
public static final int MAX_BUFFER_SIZE
public static final int MAX_STREAM_SIZE
public abstract void destroy()
public void setStateChangedListener(com.asreader.lib.device.event.ConnectionStateListener listener)
listener
- Instance of ConnectionStateListener to receive events.public ConnectionState getState()
public abstract java.lang.String getName()
public abstract java.lang.String getAddress()
public abstract void connect(java.lang.String address)
address
- public abstract void waitConnection()
public abstract void listen()
public abstract void disconnect()
public abstract void write(byte[] data) throws java.lang.Exception
data
- Array of byte that specifies the data to write to the Device.java.lang.Exception
- Exception is thrown if a failure occurs while writing data on device.public java.io.InputStream getReader()