Interface ServerConnection

All Superinterfaces:
RemoteDevice
All Known Implementing Classes:
SocketServerConnection

public interface ServerConnection extends RemoteDevice
Each connection from a remote is represented by a class implementing this interface. MenuManagerServer holds a series of ServerConnectionManager objects, that in turn contain a series of these connections. Running connections are managed by MenuManagerServer where it will deal with heartbeating, bootstrapping, incoming updates and sending local updates to the remote.
See Also:
  • Method Details

    • getHeartbeatFrequency

      int getHeartbeatFrequency()
      Returns:
      the heartbeat frequency for this connection
    • closeConnection

      void closeConnection()
      close the current connection if it is open
    • lastReceivedHeartbeat

      long lastReceivedHeartbeat()
      Returns:
      the last time a message was received
    • lastTransmittedHeartbeat

      long lastTransmittedHeartbeat()
      Returns:
      the last successful message transmission
    • sendCommand

      void sendCommand(MenuCommand command)
      Send a command to the remote
      Parameters:
      command - the command to send
    • registerConnectionListener

      void registerConnectionListener(BiConsumer<ServerConnection,Boolean> connectionListener)
      Register the connection listener to this connection that will receive udpates on connection changes.
      Parameters:
      connectionListener - the connection state
    • registerMessageHandler

      void registerMessageHandler(BiConsumer<ServerConnection,MenuCommand> messageHandler)
      Register the message handler that will receive all messages from the connection
      Parameters:
      messageHandler - the message handler
    • setConnectionMode

      void setConnectionMode(ServerConnectionMode mode)
      Set the connection mode for this connection, usually called by the menu manager to indicate state
      Parameters:
      mode - the mode
    • getConnectionMode

      ServerConnectionMode getConnectionMode()
      Returns:
      the connection mode for this connection
    • getUserName

      String getUserName()
      get the username of this connection
      Specified by:
      getUserName in interface RemoteDevice
      Returns:
      the username