Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.datecs.api.printer
Class ProtocolAdapter

    java.lang.Object
      com.datecs.api.printer.ProtocolAdapter

    public final class ProtocolAdapter

extends java.lang.Object

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

### CHANNEL_PRINTER

    public static final int CHANNEL_PRINTER

  The channel associated with printer hardware module.

  See Also:
    Constant Field Values

### CHANNEL_EMSR

    public static final int CHANNEL_EMSR

See Also:
  Constant Field Values

### CHANNEL_UNIVERSAL_READER

    public static final int CHANNEL_UNIVERSAL_READER

  The channel associated with Universal Reader hardware module.

  See Also:
    Constant Field Values

### CHANNEL_RFID

    public static final int CHANNEL_RFID

  The channel associated with RFID reader.

  See Also:
    Constant Field Values

Constructor Detail

### ProtocolAdapter

    public ProtocolAdapter(java.io.InputStream in,
                           java.io.OutputStream out)
                    throws java.io.IOException

  Constructs a new instance of this class from a given `InputStream` and `OutputStream`.

  If `in` or `out` is `null`, a `NullPointerException` is thrown.

  Parameters:
    `in` - the input stream.
    `out` - the output stream.
  Throws:
    `java.io.IOException`

Method Detail

### close

    public void close()

  Close the streams and release all associated resources.

### setDebug

    public static void setDebug(boolean on)

  Specify whether the object can output debug information

  Parameters:
    `on` - True to enable debbuging; otherwise false.

### setBarcodeListener

    public void setBarcodeListener(ProtocolAdapter.BarcodeListener listener)

  Set a callback listener to notify for barcode event.

  Parameters:
    `listener` - the listener.

### setCardListener

    public void setCardListener(ProtocolAdapter.CardListener listener)

  Set a callback listener to notify for card event.

  Parameters:
    `listener` - the listener.

### setPrinterListener

    public void setPrinterListener(ProtocolAdapter.PrinterListener listener)

  Set a callback listener to notify for printer event.

  Parameters:
    `listener` - the listener.

### isProtocolEnabled

    public boolean isProtocolEnabled()

  Return `true` if protocol mode is currently enabled.

  Returns:
    true if the protocol mode adapter is enabled.

### getChannel

    public ProtocolAdapter.Channel getChannel(int channel)

  Gets an instance of `ProtocolAdapter.Channel` from specified channel number.

  Parameters:
    `channel` - the channel number. See the `CHANNEL_`* constant field values.
  Returns:
    an instance of `ProtocolAdapter.Channel`.

### getRawInputStream

    public java.io.InputStream getRawInputStream()

  Get input stream that is not wrap by protocol data.

  Returns:
    the input stream.

### getRawOutputStream

    public java.io.OutputStream getRawOutputStream()

  Get output stream that is not wrap by protocol data.

  Returns:
    the output stream.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD