Class IdentifyDecoder

java.lang.Object
jmri.jmrit.AbstractIdentify
jmri.jmrit.decoderdefn.IdentifyDecoder
All Implemented Interfaces:
EventListener, ProgListener

public abstract class IdentifyDecoder
extends AbstractIdentify
Interact with a programmer to identify the DecoderIndexFile entry for a decoder on the programming track. Create a subclass of this which implements done(int, int, int) to handle the results of the identification.

This is a class (instead of a DecoderIndexFile member function) to simplify use of Programmer callbacks.

Contains manufacturer-specific code to generate a 3rd "productID" identifier, in addition to the manufacturer ID and model ID:

  • QSI: (mfgID == 113) write 254=>CV49, write 4=>CV50, then CV56 is high byte, write 5=>CV50, then CV56 is low byte of ID
  • Harman: (mfgID = 98) CV112 is high byte, CV113 is low byte of ID
  • Hornby: (mfgID == 48) CV159 is usually ID. If (CV159 == 143), CV159 is low byte of ID and CV158 is high byte of ID. C159 is not present in some models, in which case no "productID" can be determined. (This code uses setOptionalCv() and isOptionalCv() as documented below.)
  • TCS: (mfgID == 153) CV249 is ID
  • Zimo: (mfgID == 145) CV250 is ID
  • SoundTraxx: (mfgID == 141, modelID == 70 or 71) CV253 is high byte, CV256 is low byte of ID
  • ESU: (mfgID == 151, modelID == 255) use RailCom® Product ID CVs; write 0=>CV31, write 255=>CV32, then CVs 261 (lowest) to 264 (highest) are a four byte ID
  • DIY: (mfgID == 13) CV47 is the highest byte, CV48 is high byte, CV49 is low byte, CV50 is the lowest byte; (CV47 == 1) is reserved for the Czech Republic
  • Doehler & Haass: (mfgID == 97) CV261 is ID from 2020 firmwares
Optional CVs:
Some decoders have CVs that may or may not be present. In this case:
  • Call setOptionalCv(true) prior to the readCV(cv) call.
  • At the next step, check the returned value of isOptionalCv(). If it is still true, the CV read failed (despite retries) and the contents of the value field are undefined. You can either:
    • return true to indicate the Identify process has completed successfully without using the failed CV.
    • Set up an alternate CV read/write procedure and return false to continue. Don't forget to call setOptionalCv(false) if the next CV read is not intended to be optional.

TODO:
The RailCom® Product ID is a 32 bit unsigned value. productID is currently int with -1 signifying a null value. Potential for value conflict exists but changing would involve significant code changes elsewhere.

See Also:
CombinedLocoSelPane, NewLocoSelPane