public class Drawer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
Drawer.ConnectionListener
This interface is used to notify when connection state is changed.
|
static interface |
Drawer.StateListener
This interface is used to notify when device state is changed.
|
Constructor and Description |
---|
Drawer(java.io.InputStream inputStream,
java.io.OutputStream outputStream)
Constructs a new instance of this class from a given streams.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the streams and release all associated resources.
|
void |
enableEvents(boolean on)
Open drawer with default impulse (30).
|
boolean |
getState()
Get drawer state.
|
void |
open()
Open drawer with default impulse (30).
|
void |
open(int impulse)
Open drawer with specified impulse.
|
void |
setConnectionListener(Drawer.ConnectionListener listener)
Set a callback listener to notify the connection state is changed.
|
static void |
setDebug(boolean on)
Turn on/off debugging.
|
void |
setStateListener(Drawer.StateListener listener)
Set a callback listener to notify when device state is changed.
|
public Drawer(java.io.InputStream inputStream, java.io.OutputStream outputStream)
inputStream
- the input stream.outputStream
- the output stream.public void close() throws java.io.IOException
java.io.IOException
- If an I/O error occurs.public static void setDebug(boolean on)
on
- the debugging state.public void setConnectionListener(Drawer.ConnectionListener listener)
listener
- the listener.public void setStateListener(Drawer.StateListener listener)
listener
- the listener.public boolean getState() throws java.io.IOException
java.io.IOException
- If an I/O error occurs.public void open(int impulse) throws java.io.IOException
impulse
- impulse durationjava.io.IOException
- If an I/O error occurs.public void open() throws java.io.IOException
java.io.IOException
- If an I/O error occurs.public void enableEvents(boolean on) throws java.io.IOException
on
- true to enable eventsjava.io.IOException
- If an I/O error occurs.