jmri.jmrix.lenz
Class XNetOpsModeProgrammer

java.lang.Object
  extended by jmri.jmrix.AbstractProgrammer
      extended by jmri.jmrix.lenz.XNetOpsModeProgrammer
All Implemented Interfaces:
EventListener, AbstractMRListener, XNetListener, Programmer

public class XNetOpsModeProgrammer
extends AbstractProgrammer
implements XNetListener

Provides an Ops mode programing interface for XPressNet Currently only Byte mode is implemented, though XPressNet also supports bit mode writes for POM

Author:
Paul Bender Copyright (C) 2003-2010, Girgio Terdina Copyright (C) 2007
See Also:
Programmer

Field Summary
protected  XNetTrafficController tc
           
 
Fields inherited from class jmri.jmrix.AbstractProgrammer
LONG_TIMEOUT, propListeners, SHORT_TIMEOUT
 
Fields inherited from interface jmri.Programmer
ADDRESSMODE, CBUSNODEVARMODE, DIRECTBITMODE, DIRECTBYTEMODE, NONE, OPSACCBITMODE, OPSACCBYTEMODE, OPSACCEXTBITMODE, OPSACCEXTBYTEMODE, OPSBITMODE, OPSBYTEMODE, PAGEMODE, REGISTERMODE
 
Constructor Summary
XNetOpsModeProgrammer(int pAddress, XNetTrafficController controller)
           
 
Method Summary
 void confirmCV(int CV, int val, ProgListener p)
          Confirm the value of a CV using the specified programming mode.
 boolean getCanRead()
          Can this ops-mode programmer read back values?
 int getMode()
          Get the current programming mode
 boolean hasMode(int mode)
          Check if a given mode is available
 void message(XNetMessage l)
          Member function that will be invoked by a XNetInterface implementation to forward a XNet message sent to the layout.
 void message(XNetReply l)
          Member function that will be invoked by a XNetInterface implementation to forward a XNet message from the layout.
 void notifyTimeout(XNetMessage msg)
          Member function invoked by an XNetInterface implementation to notify * a sender that an outgoing message timed out and was dropped from the * queue.
 void readCV(int CV, ProgListener p)
          Perform a CV read in the system-specific manner, and using the specified programming mode.
 void setMode(int mode)
          Set the programmer to a particular mode.
protected  void timeout()
          Internal routine to handle a timeout, should be synchronized!
 void writeCV(int CV, int val, ProgListener p)
          Send an ops-mode write request to the XPressnet.
 
Methods inherited from class jmri.jmrix.AbstractProgrammer
addPropertyChangeListener, decodeErrorCode, registerFromCV, removePropertyChangeListener, restartTimer, startLongTimer, startShortTimer, stopTimer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tc

protected XNetTrafficController tc
Constructor Detail

XNetOpsModeProgrammer

public XNetOpsModeProgrammer(int pAddress,
                             XNetTrafficController controller)
Method Detail

writeCV

public void writeCV(int CV,
                    int val,
                    ProgListener p)
             throws ProgrammerException
Send an ops-mode write request to the XPressnet.

Specified by:
writeCV in interface Programmer
Throws:
ProgrammerException

readCV

public void readCV(int CV,
                   ProgListener p)
            throws ProgrammerException
Description copied from interface: Programmer
Perform a CV read in the system-specific manner, and using the specified programming mode. Note that this returns before the read is complete; you have to provide a ProgListener to hear about completion. The exceptions will only be thrown at the start, not during the actual programming sequence. A typical exception would be due to an invalid mode (though that should be prevented earlier)

Specified by:
readCV in interface Programmer
Throws:
ProgrammerException

confirmCV

public void confirmCV(int CV,
                      int val,
                      ProgListener p)
               throws ProgrammerException
Description copied from interface: Programmer
Confirm the value of a CV using the specified programming mode. On some systems, this is faster than a read. Note that this returns before the confirm is complete; you have to provide a ProgListener to hear about completion. The exceptions will only be thrown at the start, not during the actual programming sequence. A typical exception would be due to an invalid mode (though that should be prevented earlier)

Specified by:
confirmCV in interface Programmer
Throws:
ProgrammerException

setMode

public void setMode(int mode)
Description copied from interface: Programmer
Set the programmer to a particular mode. Only certain modes may be available for any particular implementation. If an invalid mode is requested, the active mode is unchanged.

Specified by:
setMode in interface Programmer
Parameters:
mode - One of the class-constant mode values

getMode

public int getMode()
Description copied from interface: Programmer
Get the current programming mode

Specified by:
getMode in interface Programmer
Returns:
one of the class constants identifying a mode

hasMode

public boolean hasMode(int mode)
Description copied from interface: Programmer
Check if a given mode is available

Specified by:
hasMode in interface Programmer
Parameters:
mode - Availability of this mode is returned
Returns:
True if the mode is available

getCanRead

public boolean getCanRead()
Can this ops-mode programmer read back values? Indirectly we can, though this requires an external display (a Lenz LRC120) and enabling railcom.

Specified by:
getCanRead in interface Programmer
Returns:
true to allow us to trigger an ops mode read

message

public void message(XNetReply l)
Description copied from interface: XNetListener
Member function that will be invoked by a XNetInterface implementation to forward a XNet message from the layout.

Specified by:
message in interface XNetListener
Parameters:
l - The received XNet message. Note that this same object may be presented to multiple users. It should not be modified here.

message

public void message(XNetMessage l)
Description copied from interface: XNetListener
Member function that will be invoked by a XNetInterface implementation to forward a XNet message sent to the layout. Normally, this function will do nothing.

Specified by:
message in interface XNetListener
Parameters:
l - The received XNet message. Note that this same object may be presented to multiple users. It should not be modified here.

notifyTimeout

public void notifyTimeout(XNetMessage msg)
Description copied from interface: XNetListener
Member function invoked by an XNetInterface implementation to notify * a sender that an outgoing message timed out and was dropped from the * queue.

Specified by:
notifyTimeout in interface XNetListener

timeout

protected void timeout()
Description copied from class: AbstractProgrammer
Internal routine to handle a timeout, should be synchronized!

Specified by:
timeout in class AbstractProgrammer


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