001package jmri.jmrix.lenz;
002
003/**
004 * XNetListener provides the call-back interface for notification when a new
005 * XNet message arrives from the layout.
006 * <p>
007 * Note that the XNetListener implementation cannot assume that messages will be
008 * returned in any particular thread. We may eventually revisit this, as
009 * returning messages in the Swing GUI thread would result in some
010 * simplification of client code. We've not done that yet because we're not sure
011 * that deadlocks can be avoided in that case.
012 *
013 * @author Bob Jacobsen Copyright (C) 2002
014 * @author Bob Jacobsen Copyright (C) 2010
015 */
016public interface XNetListener extends jmri.jmrix.AbstractMRListener {
017
018    /**
019     * Member function that will be invoked by an XNetInterface implementation to
020     * forward an XNet message from the layout.
021     *
022     * @param msg The received XNet message. Note that this same object may be
023     *            presented to multiple users. It should not be modified here.
024     */
025    void message(XNetReply msg);
026
027    /**
028     * Member function that will be invoked by an XNetInterface implementation to
029     * forward an XNet message sent to the layout. Normally, this function will
030     * do nothing.
031     *
032     * @param msg The received XNet message. Note that this same object may be
033     *            presented to multiple users. It should not be modified here.
034     */
035    void message(XNetMessage msg);
036
037    /**
038     * Member function invoked by an XNetInterface implementation to notify a
039     * sender that an outgoing message timed out and was dropped from the
040     * queue.
041     * @param msg message which has timed out.
042     */
043    void notifyTimeout(XNetMessage msg);
044
045}
046