: Class SerialServer

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

## com.dalsemi.shell.server.serial
Class SerialServer

    java.lang.Object
      |
      +--java.lang.Thread
            |
            +--com.dalsemi.shell.server.Server
                  |
                  +--com.dalsemi.shell.server.serial.SerialServer

public class SerialServer
extends Server

A server that uses a serial port to listen for user connections. For each connection made, a Serial session is created. All command processing is handled by the session, not this server.

Fields inherited from class com.dalsemi.shell.server.Server
`sessions, shutdown`

Fields inherited from class java.lang.Thread
`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

Constructor Summary
`SerialServer(String portName, int speed, int dataBits, int stopBits, int parity)` Prepares the server to listen on an arbitrary port.

Method Summary
`protected Session` | `acceptNewSession()` Listens on the serial port for connection requests.
`void` | `broadcast(String sendThis)` Displays this message to all sessions initiated by this server.
`void` | `closeAllPorts()` Closes and releases ownership of this server's serial port.

Methods inherited from class com.dalsemi.shell.server.Server
`checkForNewSessions, getConnectedUsers, run, sessionEnded, shutDown`

Methods inherited from class java.lang.Thread
`activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### SerialServer

    public SerialServer(String portName,
                        int speed,
                        int dataBits,
                        int stopBits,
                        int parity)
                 throws Exception

  Prepares the server to listen on an arbitrary port. The server will not be started and no connections will be accepted until its `run()` method is executed.
  Parameters:
    `portName` - the name of the serial port
    `speed` - the baud rate for the serial port communications
    `dataBits` - the data bits used by the serial port communications
    `stopBits` - the stop bits used by the serial port communications
    `parity` - the parity of the serial port communications
  Throws:
    Exception - if the serial port could not be opened or any of the specified parameters are invalid

Method Detail

### acceptNewSession

    protected Session acceptNewSession()

  Listens on the serial port for connection requests. Once a request is made, it creates, initializes, and returns a new SerialSession to handle that request. This method will block until a connection is made. Since only one connection is allowed at any time on the serial server, if a connection already exists, this method suspends the server. The server will be resumed when the current connection terminates.
  Overrides:
    acceptNewSession in class Server
  Returns:
    a new `SerialSession`

### closeAllPorts

    public void closeAllPorts()
                       throws IOException

  Closes and releases ownership of this server's serial port.
  Overrides:
    closeAllPorts in class Server

### broadcast

    public void broadcast(String sendThis)

  Displays this message to all sessions initiated by this server.
  Overrides:
    broadcast in class Server
  Parameters:
    `sendThis` - the message to display

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