jmri.jmrix.lenz
Interface XNetInterface

All Known Implementing Classes:
LI100XNetPacketizer, LIUSBServerXNetPacketizer, LIUSBXNetPacketizer, XNetPacketizer, XNetTrafficController, XNetTrafficRouter, XnTcpXNetPacketizer, ZTC640XNetPacketizer

public interface XNetInterface

XNetInterface defines the general connection to a XNet layout.

Use this interface to send messages to a XNet layout. Classes implementing the XNetListener interface can register here to receive incoming XNet messages as events.

The jmri.jrmix.lenz.XNetTrafficControler provides the first implementation of this interface.

How do you locate an implemenation of this interface? That's an interesting question. This is inherently XNet 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 XNetTrafficController implementation to locate _any_ implementation; this clearly needs to be improved.

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

Author:
Bob Jacobsen Copyright (C) 2001, 2002
See Also:
XNetListener, XNetTrafficController

Field Summary
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 consists
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
 
Method Summary
 void addXNetListener(int mask, XNetListener l)
          Request notification of things happening on the XNet.
 void removeXNetListener(int mask, XNetListener listener)
           
 void sendXNetMessage(XNetMessage msg, XNetListener replyTo)
           
 boolean status()
           
 

Field Detail

ALL

static final int ALL
Mask value to request notification of all incoming messages

See Also:
Constant Field Values

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

PROGRAMMING

static final int PROGRAMMING
Mask value to request notification of messages associated with programming

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

CONSIST

static final int CONSIST
Mask value to request notification of messages associated with consists

See Also:
Constant Field Values

INTERFACE

static final int INTERFACE
Mask value to request notification of messages associated with consists

See Also:
Constant Field Values
Method Detail

sendXNetMessage

void sendXNetMessage(XNetMessage msg,
                     XNetListener replyTo)

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)

status

boolean status()


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads