com.datecs.printer

## Class ProtocolAdapter.Channel

- java.lang.Object
- - com.datecs.printer.ProtocolAdapter.Channel

- Enclosing class:
    ProtocolAdapter

      public class ProtocolAdapter.Channel
      extends java.lang.Object

  This class represents a protocol channel.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close channel.
    `int` | `getChannel()` Gets the channel number.
    `java.io.InputStream` | `getInputStream()` Gets the input stream from channel.
    `java.io.OutputStream` | `getOutputStream()` Gets the input stream from channel.
    `byte[]` | `getStatus()` Gets status data from channel.
    `void` | `open()` Open channel.
    `void` | `resume()`
    `void` | `setChannel(int speed, int flow)` Sets channel associated port.
    `void` | `setLedMode(int mode)` Set LED indicator mode.
    `void` | `suspend()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### suspend

          public void suspend()

    - #### resume

          public void resume()

    - #### getChannel

          public int getChannel()

      Gets the channel number.
      Returns:
        the channel number.

    - #### open

          public void open()
                    throws java.io.IOException

      Open channel.

      Call this method before any other.

      The `CHANNEL_PRINTER` is opened by default.

      Throws:
        `java.io.IOException` - if an I/O error occurs.

    - #### close

          public void close()
                     throws java.io.IOException

      Close channel.

      The `CHANNEL_PRINTER` must not be closed.

      Throws:
        `java.io.IOException` - if an I/O error occurs.

    - #### setChannel

          public void setChannel(int speed,
                                 int flow)
                          throws java.io.IOException

      Sets channel associated port.
      Parameters:
        `speed` - the speed of channel.
        `flow` - the flow control of channel.
      Throws:
        `java.io.IOException` - if an I/O error occurs.

    - #### setLedMode

          public void setLedMode(int mode)
                          throws java.io.IOException

      Set LED indicator mode.
      Parameters:
        `mode` - the LED mode. The valid values can be:
        - 0 - Set LED off.
        - 1 - Set LED on.
        - 2 - Set LED blink.
      Throws:
        `java.io.IOException` - if an I/O error occurs.

    - #### getStatus

          public byte[] getStatus()
                           throws java.io.IOException

      Gets status data from channel.
      Returns:
        the status data.
      Throws:
        `java.io.IOException` - if an I/O error occurs.

    - #### getInputStream

          public java.io.InputStream getInputStream()

      Gets the input stream from channel.
      Returns:
        the input stream assigned to channel.

    - #### getOutputStream

          public java.io.OutputStream getOutputStream()

      Gets the input stream from channel.
      Returns:
        the output stream assigned to channel.