Interface XNetInterface

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ALL
      Mask value to request notification of all incoming messages
      static int COMMINFO
      Mask value to request notification of communications related messages generated by the computer interface
      static int CONSIST
      Mask value to request notification of messages associated with consists
      static int CS_INFO
      Mask value to request notification of Command Station informational messages This includes all broadcast messages, except for the feedback broadcast and all programming messages
      static int FEEDBACK
      Mask value to request notification of XpressNet FeedBack (i.e. sensor) related messages
      static int INTERFACE
      Mask value to request notification of messages associated with the interface
      static int PROGRAMMING
      Mask value to request notification of messages associated with programming
      static int THROTTLE
      Mask value to request notification of messages associated with throttle status
    • Field Detail

      • COMMINFO

        static final int COMMINFO
        Mask value to request notification of communications related messages generated by the computer interface
        See Also:
        Constant Field Values
      • CS_INFO

        static final int CS_INFO
        Mask value to request notification of Command Station informational messages This includes all broadcast messages, except for the feedback broadcast and all programming messages
        See Also:
        Constant Field Values
      • FEEDBACK

        static final int FEEDBACK
        Mask value to request notification of XpressNet FeedBack (i.e. sensor) related messages
        See Also:
        Constant Field Values
      • THROTTLE

        static final int THROTTLE
        Mask value to request notification of messages associated with throttle status
        See Also:
        Constant Field Values
    • Method Detail

      • sendXNetMessage

        void sendXNetMessage​(XNetMessage msg,
                             XNetListener replyTo)
        Request a message be sent to the attached XNet. Return is immediate, with the message being queued for eventual sending. If you're interested in a reply, you need to register an XNetListener object to watch the message stream. When sending, you specify (in 2nd parameter) who you are so you're not redundantly notified of this message.
        Parameters:
        msg - the XNet message to send.
        replyTo - sending listener to NOT notify.
      • addXNetListener

        void addXNetListener​(int mask,
                             XNetListener l)
        Request notification of things happening on the XNet.

        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)
        l - Object to be notified of new messages as they arrive.
      • removeXNetListener

        void removeXNetListener​(int mask,
                                XNetListener listener)
        Stop notification of things happening on the XNet.

        Note that mask and XNetListener must match a previous request exactly.

        Parameters:
        mask - listening mask.
        listener - listener to remove notifications for.
      • status

        boolean status()
        Check whether an implementation is operational.
        Returns:
        true if OK, else false.