Interface Mx1Interface

All Known Implementing Classes:
Mx1Packetizer, Mx1TrafficController

public interface Mx1Interface
Mx1Interface defines the general connection to a MX-1 layout.

Use this interface to send messages to a MX-1 layout. Classes implementing the Mx1Listener interface can register here to receive incoming MX-1 messages as events.

The jmri.jrmix.zimo.Mx1TrafficManager provides the first implementation of this interface.

How do you locate an implemenation of this interface? That's an interesting question. This is inherently MX-1 specific, so it would be inappropriate to put it in the jmri.InterfaceManager. And Java interfaces can't have static members, so we can't provide an implementation() member. For now, we use a static implementation member in the Mx1TrafficManager implementation to locate _any_ implementation; this clearly needs to be improved.

Mx1Listener implementations registering for traffic updates cannot assume that messages will be returned in any particular thread. See the Mx1Listener doc for more background.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Mask value to request notification of all incoming messages
    static final int
    Mask value to request notification of messages associated with layout power
    static final int
    Mask value to request notification of messages associated with programming
    static final int
    Mask value to request notification of messages indicating changes in sensor status
    static final int
    Mask value to request notification of messages effecting slot status, including the programming slot
    static final int
    Mask value to request notification of messages indicating changes in turnout status
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addMx1Listener(int mask, Mx1Listener listener)
    Request notification of things happening on the MX-1.
    void
    removeMx1Listener(int mask, Mx1Listener listener)
     
    void
     
    boolean
     
  • Field Details

    • ALL

      static final int ALL
      Mask value to request notification of all incoming messages
      See Also:
    • SLOTINFO

      static final int SLOTINFO
      Mask value to request notification of messages effecting slot status, including the programming slot
      See Also:
    • PROGRAMMING

      static final int PROGRAMMING
      Mask value to request notification of messages associated with programming
      See Also:
    • TURNOUTS

      static final int TURNOUTS
      Mask value to request notification of messages indicating changes in turnout status
      See Also:
    • SENSORS

      static final int SENSORS
      Mask value to request notification of messages indicating changes in sensor status
      See Also:
    • POWER

      static final int POWER
      Mask value to request notification of messages associated with layout power
      See Also:
  • Method Details

    • sendMx1Message

      void sendMx1Message(Mx1Message msg, Mx1Listener replyTo)
    • addMx1Listener

      void addMx1Listener(int mask, Mx1Listener listener)
      Request notification of things happening on the MX-1.

      The same listener can register multiple times with different masks. (Multiple registrations with a single mask value are equivalent to a single registration) Mask values are defined as class constants. Note that these are bit masks, and should be OR'd, not added, if multiple values are desired.

      The event notification contains the received message as source, not this object, so that we can notify of an incoming message to multiple places and then move on.

      Parameters:
      mask - The OR of the key values of messages to be reported (to reduce traffic, provide for listeners interested in different things)
      listener - Object to be notified of new messages as they arrive.
    • removeMx1Listener

      void removeMx1Listener(int mask, Mx1Listener listener)
    • status

      boolean status()