com.datecs.drawer

## Class Drawer

- java.lang.Object
- - com.datecs.drawer.Drawer

-     public class Drawer
      extends java.lang.Object

  Created by lkm on 8.9.2017 г..

- - ### Nested Class Summary

    Nested Classes
    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 Summary

    Constructors
    Constructor and Description
    `Drawer(java.io.InputStream inputStream, java.io.OutputStream outputStream)` Constructs a new instance of this class from a given streams.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    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.

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

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

- - ### Constructor Detail

    - #### Drawer

          public Drawer(java.io.InputStream inputStream,
                        java.io.OutputStream outputStream)

      Constructs a new instance of this class from a given streams.
      Parameters:
        `inputStream` - the input stream.
        `outputStream` - the output stream.

  - ### Method Detail

    - #### close

          public void close()
                     throws java.io.IOException

      Close the streams and release all associated resources.
      Throws:
        `java.io.IOException` - If an I/O error occurs.

    - #### setDebug

          public static void setDebug(boolean on)

      Turn on/off debugging.
      Parameters:
        `on` - the debugging state.

    - #### setConnectionListener

          public void setConnectionListener(Drawer.ConnectionListener listener)

      Set a callback listener to notify the connection state is changed.
      Parameters:
        `listener` - the listener.

    - #### setStateListener

          public void setStateListener(Drawer.StateListener listener)

      Set a callback listener to notify when device state is changed.
      Parameters:
        `listener` - the listener.

    - #### getState

          public boolean getState()
                           throws java.io.IOException

      Get drawer state.
      Returns:
        True if drawer is opened, otherwise returns false.
      Throws:
        `java.io.IOException` - If an I/O error occurs.

    - #### open

          public void open(int impulse)
                    throws java.io.IOException

      Open drawer with specified impulse.
      Parameters:
        `impulse` - impulse duration
      Throws:
        `java.io.IOException` - If an I/O error occurs.

    - #### open

          public void open()
                    throws java.io.IOException

      Open drawer with default impulse (30).
      Throws:
        `java.io.IOException` - If an I/O error occurs.

    - #### enableEvents

          public void enableEvents(boolean on)
                            throws java.io.IOException

      Open drawer with default impulse (30).
      Parameters:
        `on` - true to enable events
      Throws:
        `java.io.IOException` - If an I/O error occurs.