com.amos.server.eventsender

## Class EventServer

- java.lang.Object
- - com.amos.server.eventsender.EventServer

- All Implemented Interfaces:
    java.lang.Runnable

      public class EventServer
      extends java.lang.Object
      implements java.lang.Runnable

  Pushes MotionEvents to EventWriter writing to a StreamSocket server. This is meant to be run in an independent thread in order to run networking components in the main thread. Events will be processed from the BlockingQueue, which can be filled from another thread.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EventServer(java.util.concurrent.BlockingQueue<TouchEvent> mq)` Create EventServer with a given input queue.
    `EventServer(java.util.concurrent.BlockingQueue<TouchEvent> mq, android.os.Handler ui)` Create EventServer with given input queua as well as UI handler to pass back messages to the UI thread.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `accept()` Accept a connection and send back one single event.
    `void` | `acceptQueue()` Accept connection and send messages from queue.
    `void` | `close()` Close server.
    `void` | `run()` Run the SocketServer and wait for connections.

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

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

- - ### Constructor Detail

    - #### EventServer

          public EventServer(java.util.concurrent.BlockingQueue<TouchEvent> mq)

      Create EventServer with a given input queue.
      Parameters:
        `mq` -

    - #### EventServer

          public EventServer(java.util.concurrent.BlockingQueue<TouchEvent> mq,
                             android.os.Handler ui)

      Create EventServer with given input queua as well as UI handler to pass back messages to the UI thread.
      Parameters:
        `mq` -
        `ui` -

  - ### Method Detail

    - #### accept

          public void accept()

      Accept a connection and send back one single event. This is meant for debugging purposes.

    - #### close

          public void close()

      Close server.

    - #### acceptQueue

          public void acceptQueue()

      Accept connection and send messages from queue. Connection will be kept alive, even if no items are in the input queue.

    - #### run

          public void run()

      Run the SocketServer and wait for connections.
      Specified by:
        `run` in interface `java.lang.Runnable`