|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.datecs.api.printer.ProtocolAdapter
public final class ProtocolAdapter
This class provides the protocol mode support for Datecs's printers over InputStream and OutputStream instances.
The InputStream
instance must provide a proper implementation of
InputStream.available()
method.
Nested Class Summary | |
---|---|
static interface |
ProtocolAdapter.BarcodeListener
Interface definition for a callbacks to notify for barcode event. |
static interface |
ProtocolAdapter.CardListener
Interface definition for a callbacks to notify for card event. |
class |
ProtocolAdapter.Channel
This class represents a protocol channel. |
static interface |
ProtocolAdapter.PrinterListener
Interface definition for a callbacks to notify for printer event. |
Field Summary | |
---|---|
static int |
CHANNEL_EMSR
|
static int |
CHANNEL_PRINTER
The channel associated with printer hardware module. |
static int |
CHANNEL_RFID
The channel associated with RFID reader. |
static int |
CHANNEL_UNIVERSAL_READER
The channel associated with Universal Reader hardware module. |
Constructor Summary | |
---|---|
ProtocolAdapter(java.io.InputStream in,
java.io.OutputStream out)
Constructs a new instance of this class from a given InputStream and OutputStream . |
Method Summary | |
---|---|
void |
close()
Close the streams and release all associated resources. |
ProtocolAdapter.Channel |
getChannel(int channel)
Gets an instance of ProtocolAdapter.Channel from specified channel
number. |
java.io.InputStream |
getRawInputStream()
Get input stream that is not wrap by protocol data. |
java.io.OutputStream |
getRawOutputStream()
Get output stream that is not wrap by protocol data. |
boolean |
isProtocolEnabled()
Return true if protocol mode is currently enabled. |
void |
setBarcodeListener(ProtocolAdapter.BarcodeListener listener)
Set a callback listener to notify for barcode event. |
void |
setCardListener(ProtocolAdapter.CardListener listener)
Set a callback listener to notify for card event. |
static void |
setDebug(boolean on)
Specify whether the object can output debug information |
void |
setPrinterListener(ProtocolAdapter.PrinterListener listener)
Set a callback listener to notify for printer event. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int CHANNEL_PRINTER
public static final int CHANNEL_EMSR
public static final int CHANNEL_UNIVERSAL_READER
public static final int CHANNEL_RFID
Constructor Detail |
---|
public ProtocolAdapter(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
InputStream
and OutputStream
.
If in
or out
is null
, a
NullPointerException
is thrown.
in
- the input stream.out
- the output stream.
java.io.IOException
Method Detail |
---|
public void close()
public static void setDebug(boolean on)
on
- True to enable debbuging; otherwise false.public void setBarcodeListener(ProtocolAdapter.BarcodeListener listener)
listener
- the listener.public void setCardListener(ProtocolAdapter.CardListener listener)
listener
- the listener.public void setPrinterListener(ProtocolAdapter.PrinterListener listener)
listener
- the listener.public boolean isProtocolEnabled()
true
if protocol mode is currently enabled.
public ProtocolAdapter.Channel getChannel(int channel)
ProtocolAdapter.Channel
from specified channel
number.
channel
- the channel number. See the CHANNEL_
*
constant field values.
ProtocolAdapter.Channel
.public java.io.InputStream getRawInputStream()
public java.io.OutputStream getRawOutputStream()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |