jmri.jmrix.can.cbus
Class CbusDccOpsModeProgrammer

java.lang.Object
  extended by jmri.jmrix.AbstractProgrammer
      extended by jmri.jmrix.can.cbus.CbusDccProgrammer
          extended by jmri.jmrix.can.cbus.CbusDccOpsModeProgrammer
All Implemented Interfaces:
EventListener, AbstractMRListener, CanListener, Programmer

public class CbusDccOpsModeProgrammer
extends CbusDccProgrammer

Provide an Ops Mode Programmer via a wrapper what works with the CBUS command station object.

Functionally, this just creates packets to send via the command station.

Author:
Andrew Crosland Copyright (C) 2009
See Also:
Programmer

Field Summary
 
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
CbusDccOpsModeProgrammer(int pAddress, boolean pLongAddr)
           
 
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)
          Signifies mode's available
 void readCV(int CV, ProgListener p)
          Perform a CV read in the system-specific manner, and using the specified programming mode.
 void reply(CanReply m)
           
 void setMode(int mode)
          Switch to a new programming mode.
 void writeCV(int CV, int val, ProgListener p)
          Forward a write request to an ops-mode write operation
 
Methods inherited from class jmri.jmrix.can.cbus.CbusDccProgrammer
controller, instance, message, notifyProgListenerEnd, notifyPropertyChange, timeout, useProgrammer
 
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
 

Constructor Detail

CbusDccOpsModeProgrammer

public CbusDccOpsModeProgrammer(int pAddress,
                                boolean pLongAddr)
Method Detail

writeCV

public void writeCV(int CV,
                    int val,
                    ProgListener p)
             throws ProgrammerException
Forward a write request to an ops-mode write operation

Specified by:
writeCV in interface Programmer
Overrides:
writeCV in class CbusDccProgrammer
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
Overrides:
readCV in class CbusDccProgrammer
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
Overrides:
confirmCV in class CbusDccProgrammer
Throws:
ProgrammerException

setMode

public void setMode(int mode)
Description copied from class: CbusDccProgrammer
Switch to a new programming mode. SPROG currently supports bit direct and paged mode. If you attempt to switch to any others, the new mode will set & notify, then set back to the original. This lets the listeners know that a change happened, and then was undone.

Specified by:
setMode in interface Programmer
Overrides:
setMode in class CbusDccProgrammer
Parameters:
mode - The new mode, use values from the jmri.Programmer interface

getMode

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

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

hasMode

public boolean hasMode(int mode)
Description copied from class: CbusDccProgrammer
Signifies mode's available

Specified by:
hasMode in interface Programmer
Overrides:
hasMode in class CbusDccProgrammer
Parameters:
mode - Availability of this mode is returned
Returns:
True if paged or direct or register mode

reply

public void reply(CanReply m)
Specified by:
reply in interface CanListener
Overrides:
reply in class CbusDccProgrammer

getCanRead

public boolean getCanRead()
Can this ops-mode programmer read back values?

Specified by:
getCanRead in interface Programmer
Overrides:
getCanRead in class CbusDccProgrammer
Returns:
always false


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