Interface Layer1ApiAdminListener

All Known Subinterfaces:
Layer1ApiAdapter, Layer1ApiAdminAdapter, Layer1ApiListener
All Known Implementing Classes:
Layer1ApiDepthFreezer, Layer1ApiInjectorRelay, Layer1ApiRelay, Layer1ApiStrategiesEchoMessagesLayer, Layer1ApiUpstreamRelay

@DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class) public interface Layer1ApiAdminListener
Listens to general events, such as login and connection state, system messages and upstream user messages.
  • Method Details

    • onLoginFailed

      void onLoginFailed(LoginFailedReason reason, @Nullable String message)
      Failed to log in with specified credentials
      Parameters:
      reason - Reason code
      message - test message associated with login fail
    • onLoginSuccessful

      void onLoginSuccessful()
      Successful login.
    • onConnectionLost

      void onConnectionLost(DisconnectionReason reason, @Nullable String message)
      Connection to server lost. Provider can call this method multiple times in sequence if the reason was changed (i.e. from DisconnectionReason.NO_INTERNET to DisconnectionReason.FATAL)
      Parameters:
      reason - Reason code
      message - text message associated with login disconnection
    • onConnectionRestored

      void onConnectionRestored()
      Connection to server restored. A provider should call it only if it previously invoked onConnectionLost(DisconnectionReason, String)
    • onSystemTextMessage

      void onSystemTextMessage(String message, SystemTextMessageType messageType)
      Passes the message into Bookmap and shows it as a popup. It is suitable for 1-time notifications, but for the general case take a look at the notifications API - Layer1ApiSoundAlertMessage
      Parameters:
      message - message itself
      messageType - message type
      See Also:
    • onUserMessage

      void onUserMessage(Object data)
      Send an upstream event. Allows incorporating arbitrary functionality into protocol.

      This is the extension point of the upstream direction: any layer or the provider may emit an arbitrary object, and it travels towards the GUI through every layer above the origin. The counterpart for the downstream direction is Layer1ApiAdminProvider.sendUserMessage(Object).

      Contract for layers: inspect the message by type, act on the ones you understand and pass every other message on unchanged. Swallowing an unknown message breaks layers above you.

      Messages emitted by Bookmap use classes from velox.api.layer1.messages. Some of them are sent in response to a downstream request and arrive asynchronously, after the corresponding sendUserMessage call has already returned.

      Parameters:
      data - Message content, never null