Skip to content
Permalink
Browse files

read/write CV as int deprecation

  • Loading branch information...
bobjacobsen committed Sep 22, 2018
1 parent 4602c81 commit 2a7efa64487401c2027d9b9ab4e1808344218112
Showing with 89 additions and 29 deletions.
  1. +3 −3 java/src/jmri/Programmer.java
  2. +2 −2 java/src/jmri/implementation/OffsetHighCvProgrammerFacade.java
  3. +2 −2 java/src/jmri/jmris/AbstractProgrammerServer.java
  4. +16 −11 java/src/jmri/jmrix/AbstractProgrammer.java
  5. +3 −3 java/src/jmri/jmrix/AbstractProgrammerFacade.java
  6. +1 −1 java/src/jmri/jmrix/bachrus/SpeedoConsoleFrame.java
  7. +2 −0 java/src/jmri/jmrix/can/cbus/CbusDccOpsModeProgrammer.java
  8. +2 −0 java/src/jmri/jmrix/can/cbus/CbusDccProgrammer.java
  9. +2 −0 java/src/jmri/jmrix/can/cbus/CbusProgrammer.java
  10. +2 −0 java/src/jmri/jmrix/dcc4pc/Dcc4PcOpsModeProgrammer.java
  11. +2 −0 java/src/jmri/jmrix/dccpp/DCCppOpsModeProgrammer.java
  12. +2 −0 java/src/jmri/jmrix/dccpp/DCCppProgrammer.java
  13. +2 −0 java/src/jmri/jmrix/easydcc/EasyDccOpsModeProgrammer.java
  14. +2 −0 java/src/jmri/jmrix/easydcc/EasyDccProgrammer.java
  15. +2 −0 java/src/jmri/jmrix/ecos/EcosProgrammer.java
  16. +2 −0 java/src/jmri/jmrix/lenz/XNetOpsModeProgrammer.java
  17. +2 −0 java/src/jmri/jmrix/lenz/XNetProgrammer.java
  18. +2 −0 java/src/jmri/jmrix/lenz/hornbyelite/EliteXNetProgrammer.java
  19. +2 −0 java/src/jmri/jmrix/lenz/li100/LI100XNetProgrammer.java
  20. +3 −4 java/src/jmri/jmrix/loconet/LnOpsModeProgrammer.java
  21. +2 −0 java/src/jmri/jmrix/loconet/SlotManager.java
  22. +2 −0 java/src/jmri/jmrix/mrc/MrcOpsModeProgrammer.java
  23. +2 −0 java/src/jmri/jmrix/mrc/MrcProgrammer.java
  24. +2 −0 java/src/jmri/jmrix/nce/NceOpsModeProgrammer.java
  25. +2 −0 java/src/jmri/jmrix/nce/NceProgrammer.java
  26. +2 −2 java/src/jmri/jmrix/openlcb/OlcbProgrammer.java
  27. +2 −0 java/src/jmri/jmrix/qsi/QsiProgrammer.java
  28. +2 −0 java/src/jmri/jmrix/roco/z21/Z21XNetOpsModeProgrammer.java
  29. +2 −0 java/src/jmri/jmrix/roco/z21/Z21XNetProgrammer.java
  30. +2 −0 java/src/jmri/jmrix/sprog/SprogOpsModeProgrammer.java
  31. +2 −0 java/src/jmri/jmrix/sprog/SprogProgrammer.java
  32. +2 −0 java/src/jmri/jmrix/srcp/SRCPProgrammer.java
  33. +2 −0 java/src/jmri/jmrix/tams/TamsOpsModeProgrammer.java
  34. +2 −0 java/src/jmri/jmrix/tams/TamsProgrammer.java
  35. +2 −0 java/src/jmri/jmrix/zimo/Mx1Programmer.java
  36. +3 −1 java/src/jmri/progdebugger/ProgDebugger.java
@@ -68,7 +68,7 @@
* @deprecated As of 4.1.1, use #writeCV(java.lang.String, int,
* jmri.ProgListener)
*/
@Deprecated
@Deprecated // 4.1.1
public void writeCV(int CV, int val, ProgListener p) throws ProgrammerException;

/**
@@ -115,7 +115,7 @@
* @deprecated As of 4.1.1, use #readCV(java.lang.String, int,
* jmri.ProgListener)
*/
@Deprecated
@Deprecated // 4.1.1
public void readCV(int CV, ProgListener p) throws ProgrammerException;

/**
@@ -162,7 +162,7 @@
* @deprecated As of 4.1.1, use #confirmCV(java.lang.String, int,
* jmri.ProgListener)
*/
@Deprecated
@Deprecated // 4.1.1
public void confirmCV(int CV, int val, ProgListener p) throws ProgrammerException;

/**
@@ -78,7 +78,7 @@ public void readCV(String CV, jmri.ProgListener p) throws jmri.ProgrammerExcepti
useProgrammer(p);
if (prog.getCanRead(CV) || _cv <= top) {
state = ProgState.PROGRAMMING;
prog.readCV(_cv, this);
prog.readCV(CV, this);
} else {
// write index first
state = ProgState.FINISHREAD;
@@ -143,7 +143,7 @@ public void programmingOpReply(int value, int status) {
case FINISHREAD:
try {
state = ProgState.PROGRAMMING;
prog.readCV(_cv % modulo, this);
prog.readCV(String.valueOf(_cv % modulo), this);
} catch (jmri.ProgrammerException e) {
log.error("Exception doing final read", e);
}
@@ -55,7 +55,7 @@ public void writeCV(jmri.ProgrammingMode mode, int CV, int value) {
lastCV = CV;
try {
p.setMode(mode); // need to check if mode is available
p.writeCV(CV, value, this);
p.writeCV(String.valueOf(CV), value, this);
} catch (jmri.ProgrammerException ex) {
//Send failure Status.
try {
@@ -78,7 +78,7 @@ public void readCV(jmri.ProgrammingMode mode, int CV) {
lastCV = CV;
try {
p.setMode(mode); // need to check if mode is available
p.readCV(CV, this);
p.readCV(String.valueOf(CV), this);
} catch (jmri.ProgrammerException ex) {
//Send failure Status.
try {
@@ -25,6 +25,7 @@
*/
public abstract class AbstractProgrammer implements Programmer {

/** {@inheritDoc} */
@Override
public String decodeErrorCode(int code) {
if (code == ProgListener.OK) {
@@ -84,16 +85,13 @@ public String decodeErrorCode(int code) {
*/
private final PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);

/**
* Add a PropertyChangeListener to the listener list.
*
* @param listener The PropertyChangeListener to be added
*/
/** {@inheritDoc} */
@Override
public void addPropertyChangeListener(PropertyChangeListener listener) {
propertyChangeSupport.addPropertyChangeListener(listener);
}

/** {@inheritDoc} */
@Override
public void removePropertyChangeListener(PropertyChangeListener listener) {
propertyChangeSupport.removePropertyChangeListener(listener);
@@ -103,31 +101,36 @@ protected void notifyPropertyChange(String key, Object oldValue, Object value) {
propertyChangeSupport.firePropertyChange(key, oldValue, value);
}

/** {@inheritDoc} */
@Override
@SuppressWarnings("deprecation") // this is a migration call, to be removed when writeCV(int, int, ProgListener) is removed
public void writeCV(String CV, int val, ProgListener p) throws ProgrammerException {
writeCV(Integer.parseInt(CV), val, p);
}

/** {@inheritDoc} */
@Override
@SuppressWarnings("deprecation") // this is a migration call, to be removed when readCV(int, ProgListener) is removed
public void readCV(String CV, ProgListener p) throws ProgrammerException {
readCV(Integer.parseInt(CV), p);
}

/** {@inheritDoc} */
@Override
@SuppressWarnings("deprecation") // parent Programmer method deprecated, will remove at same time
@Deprecated // 4.1.1
public final void confirmCV(int CV, int val, ProgListener p) throws ProgrammerException {
confirmCV(""+CV, val, p);
}

/**
/** {@inheritDoc}
* Basic implementation. Override this to turn reading on and off globally.
*/
@Override
public boolean getCanRead() {
return true;
}

/**
/** {@inheritDoc}
* Checks using the current default programming mode
*/
@Override
@@ -141,6 +144,7 @@ public boolean getCanRead(String addr) {
// handle mode
private ProgrammingMode mode = null;

/** {@inheritDoc} */
@Override
public final void setMode(ProgrammingMode m) {
List<ProgrammingMode> validModes = getSupportedModes();
@@ -179,6 +183,7 @@ public ProgrammingMode getBestMode() {
return null;
}

/** {@inheritDoc} */
@Override
public final ProgrammingMode getMode() {
if (mode == null) {
@@ -190,23 +195,23 @@ public final ProgrammingMode getMode() {
@Override
abstract @Nonnull public List<ProgrammingMode> getSupportedModes();

/**
/** {@inheritDoc}
* Basic implementation. Override this to turn writing on and off globally.
*/
@Override
public boolean getCanWrite() {
return true;
}

/**
/** {@inheritDoc}
* Checks using the current default programming mode.
*/
@Override
public boolean getCanWrite(String addr) {
return getCanWrite();
}

/**
/** {@inheritDoc}
* By default, say that no verification is done.
*
* @param addr A CV address to check (in case this varies with CV range) or null for any
@@ -46,7 +46,7 @@ public synchronized void removePropertyChangeListener(PropertyChangeListener l)
* jmri.ProgListener)
* @see jmri.Programmer#writeCV(int, int, jmri.ProgListener)
*/
@Deprecated
@Deprecated // 4.1.1
@Override
public void writeCV(int CV, int val, ProgListener p) throws ProgrammerException {
prog.writeCV(CV, val, p);
@@ -65,7 +65,7 @@ public void writeCV(String CV, int val, ProgListener p) throws ProgrammerExcepti
* jmri.ProgListener)
* @see jmri.Programmer#readCV(int, jmri.ProgListener)
*/
@Deprecated
@Deprecated // 4.1.1
@Override
public void readCV(int CV, ProgListener p) throws ProgrammerException {
prog.readCV(CV, p);
@@ -87,7 +87,7 @@ public void readCV(String CV, ProgListener p) throws ProgrammerException {
* jmri.ProgListener) instead.
*/
@Override
@Deprecated
@Deprecated // 4.1.1
public final void confirmCV(int CV, int val, ProgListener p) throws ProgrammerException {
prog.confirmCV(CV, val, p);
}
@@ -1299,7 +1299,7 @@ protected void readAddress() {

protected void startRead(int cv) {
try {
prog.readCV(cv, this);
prog.readCV(String.valueOf(cv), this);
} catch (ProgrammerException e) {
log.error("Exception reading CV " + cv + " " + e);
}
@@ -35,6 +35,7 @@ public CbusDccOpsModeProgrammer(int pAddress, boolean pLongAddr, jmri.jmrix.can.
* Forward a write request to an ops-mode write operation
*/
@Override
@Deprecated // 4.1.1
synchronized public void writeCV(int CV, int val, ProgListener p) throws ProgrammerException {
log.debug("ops mode write CV=" + CV + " val=" + val);

@@ -51,6 +52,7 @@ synchronized public void writeCV(int CV, int val, ProgListener p) throws Program
}

@Override
@Deprecated // 4.1.1
synchronized public void readCV(int CV, ProgListener p) throws ProgrammerException {
if (log.isDebugEnabled()) {
log.debug("read CV=" + CV);
@@ -50,6 +50,7 @@ public CbusDccProgrammer(jmri.jmrix.can.TrafficController tc) {

// programming interface
@Override
@Deprecated // 4.1.1
synchronized public void writeCV(int CV, int val, jmri.ProgListener p) throws jmri.ProgrammerException {
if (log.isDebugEnabled()) {
log.debug("writeCV " + CV + " listens " + p);
@@ -78,6 +79,7 @@ synchronized public void confirmCV(String CV, int val, jmri.ProgListener p) thro
}

@Override
@Deprecated // 4.1.1
synchronized public void readCV(int CV, jmri.ProgListener p) throws jmri.ProgrammerException {
if (log.isDebugEnabled()) {
log.debug("readCV " + CV + " listens " + p);
@@ -52,6 +52,7 @@ public CbusProgrammer(int nodenumber, TrafficController tc) {

// programming interface
@Override
@Deprecated // 4.1.1
synchronized public void writeCV(int varnum, int val, jmri.ProgListener p) throws jmri.ProgrammerException {
if (log.isDebugEnabled()) {
log.debug("write " + varnum + " listens " + p);
@@ -79,6 +80,7 @@ synchronized public void confirmCV(String varnum, int val, jmri.ProgListener p)
}

@Override
@Deprecated // 4.1.1
synchronized public void readCV(int varnum, jmri.ProgListener p) throws jmri.ProgrammerException {
if (log.isDebugEnabled()) {
log.debug("readCV " + varnum + " listens " + p);
@@ -46,13 +46,15 @@ public Dcc4PcOpsModeProgrammer(boolean pLongAddress, int pAddress, AddressedProg
* Send an ops-mode write request to the XPressnet.
*/
@Override
@Deprecated // 4.1.1
synchronized public void writeCV(int CV, int val, ProgListener p) throws ProgrammerException {
rcTag.setExpectedCv(cv);
progListener = p;
defaultProgrammer.writeCV(CV, val, new ProxyProgList());
}

@Override
@Deprecated // 4.1.1
synchronized public void readCV(int cv, ProgListener p) throws ProgrammerException {
rcTag.addPropertyChangeListener(this);
rcTag.setExpectedCv(cv);
@@ -50,6 +50,7 @@ public DCCppOpsModeProgrammer(int pAddress, DCCppTrafficController controller) {
* Send an ops-mode write request to the DCC++.
*/
@Override
@Deprecated // 4.1.1
synchronized public void writeCV(int CV, int val, ProgListener p) throws ProgrammerException {
DCCppMessage msg = DCCppMessage.makeWriteOpsModeCVMsg(mAddress, CV, val);
tc.sendDCCppMessage(msg, this);
@@ -80,6 +81,7 @@ synchronized public void writeCV(int CV, int val, ProgListener p) throws Program
}

@Override
@Deprecated // 4.1.1
synchronized public void readCV(int CV, ProgListener p) throws ProgrammerException {
//DCCppMessage msg = DCCppMessage.getVerifyOpsModeCVMsg(mAddressHigh, mAddressLow, CV, value);
//tc.sendDCCppMessage(msg, this);
@@ -123,6 +123,7 @@ public boolean getCanWrite(String addr) {
// programming interface

@Override
@Deprecated // 4.1.1
synchronized public void writeCV(int CV, int val, jmri.ProgListener p) throws jmri.ProgrammerException {
if (log.isDebugEnabled()) {
log.debug("writeCV " + CV + " listens " + p);
@@ -161,6 +162,7 @@ synchronized public void confirmCV(String CV, int val, jmri.ProgListener p) thro
}

@Override
@Deprecated // 4.1.1
synchronized public void readCV(int CV, jmri.ProgListener p) throws jmri.ProgrammerException {
if (log.isDebugEnabled()) {
log.debug("readCV " + CV + " listens " + p);
@@ -34,6 +34,7 @@ public EasyDccOpsModeProgrammer(int pAddress, boolean pLongAddr, EasyDccSystemCo
* Forward a write request to an ops-mode write operation.
*/
@Override
@Deprecated // 4.1.1
public synchronized void writeCV(int CV, int val, ProgListener p) throws ProgrammerException {
log.debug("write CV={} val={}", CV, val);
// create the message and fill it,
@@ -65,6 +66,7 @@ public synchronized void writeCV(int CV, int val, ProgListener p) throws Program
}

@Override
@Deprecated // 4.1.1
public synchronized void readCV(int CV, ProgListener p) throws ProgrammerException {
log.debug("read CV={}", CV);
log.error("readCV not available in this protocol");
@@ -44,6 +44,7 @@ public EasyDccProgrammer(EasyDccSystemConnectionMemo memo) {

// programming interface
@Override
@Deprecated // 4.1.1
public synchronized void writeCV(int CV, int val, jmri.ProgListener p) throws jmri.ProgrammerException {
if (log.isDebugEnabled()) {
log.debug("writeCV " + CV + " listens " + p);
@@ -73,6 +74,7 @@ public synchronized void confirmCV(String CV, int val, jmri.ProgListener p) thro
}

@Override
@Deprecated // 4.1.1
public synchronized void readCV(int CV, jmri.ProgListener p) throws jmri.ProgrammerException {
if (log.isDebugEnabled()) {
log.debug("readCV " + CV + " listens " + p);
@@ -47,6 +47,7 @@ public EcosProgrammer(EcosTrafficController etc) {
// programming interface

@Override
@Deprecated // 4.1.1
synchronized public void writeCV(int CV, int val, jmri.ProgListener p) throws jmri.ProgrammerException {
if (log.isDebugEnabled()) {
log.debug("writeCV " + CV + " listens " + p);
@@ -74,6 +75,7 @@ synchronized public void confirmCV(String CV, int val, jmri.ProgListener p) thro
}

@Override
@Deprecated // 4.1.1
synchronized public void readCV(int CV, jmri.ProgListener p) throws jmri.ProgrammerException {
if (log.isDebugEnabled()) {
log.debug("readCV " + CV + " listens " + p);
@@ -51,6 +51,7 @@ public XNetOpsModeProgrammer(int pAddress, XNetTrafficController controller) {
* Send an ops-mode write request to the Xpressnet.
*/
@Override
@Deprecated // 4.1.1
synchronized public void writeCV(int CV, int val, ProgListener p) throws ProgrammerException {
XNetMessage msg = XNetMessage.getWriteOpsModeCVMsg(mAddressHigh, mAddressLow, CV, val);
tc.sendXNetMessage(msg, this);
@@ -64,6 +65,7 @@ synchronized public void writeCV(int CV, int val, ProgListener p) throws Program
}

@Override
@Deprecated // 4.1.1
synchronized public void readCV(int CV, ProgListener p) throws ProgrammerException {
XNetMessage msg = XNetMessage.getVerifyOpsModeCVMsg(mAddressHigh, mAddressLow, CV, value);
tc.sendXNetMessage(msg, this);
@@ -188,6 +188,7 @@ public boolean getCanWrite(String addr) {

// programming interface
@Override
@Deprecated // 4.1.1
synchronized public void writeCV(int CV, int val, jmri.ProgListener p) throws jmri.ProgrammerException {
if (log.isDebugEnabled()) {
log.debug("writeCV " + CV + " listens " + p);
@@ -226,6 +227,7 @@ synchronized public void confirmCV(String CV, int val, jmri.ProgListener p) thro
}

@Override
@Deprecated // 4.1.1
synchronized public void readCV(int CV, jmri.ProgListener p) throws jmri.ProgrammerException {
if (log.isDebugEnabled()) {
log.debug("readCV " + CV + " listens " + p);

0 comments on commit 2a7efa6

Please sign in to comment.
You can’t perform that action at this time.