Package jmri.jmrit.decoderdefn
Class IdentifyDecoder
- java.lang.Object
-
- jmri.jmrit.AbstractIdentify
-
- jmri.jmrit.decoderdefn.IdentifyDecoder
-
- All Implemented Interfaces:
java.util.EventListener,ProgListener
public abstract class IdentifyDecoder extends AbstractIdentify
Interact with a programmer to identify theDecoderIndexFileentry for a decoder on the programming track. Create a subclass of this which implementsdone(int, int, int)to handle the results of the identification.This is a class (instead of a
DecoderIndexFilemember function) to simplify use ofProgrammercallbacks.Contains manufacturer-specific code to generate a 3rd "productID" identifier, in addition to the manufacturer ID and model ID:
- Dietz (mfgID == 115) CV128 is 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
- 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
- Harman: (mfgID == 98) CV112 is high byte, CV113 is low byte of ID
- Hornby: (mfgID == 48)
- If CV7 = 254, this is a HN7000 series decoder. The ID is in CV200(MSB), CV201 (LSB)
- Otherwise CV159 is the 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()andisOptionalCv()as documented below.)
- QSI: (mfgID == 113) write 254=>CV49, write 4=>CV50, then CV56 is high byte, write 5=>CV50, then CV56 is low byte of ID
- SoundTraxx: (mfgID == 141, modelID == 70, 71 or 72) The product ID is made from
- CV 256 bits 0-7
- CV 255 bits 8-10
- CV 253 bit 11-18
- TCS: (mfgID == 153) CV249 is physical hardware id, V5 and above use CV248, CV110 and CV111 to identify specific sound sets and features. New productID process triggers if (CV249 > 128).
- Train-O-Matic: (mfgID == 78) CV508 lowest byte, CV509 low byte and CV510 high byte
- Zimo: (mfgID == 145) CV250 is ID
- Optional CVs:
-
Some decoders have CVs that may or may not be present. In this case:
- Call
setOptionalCv(true)prior to thereadCV(cv)call. - At the next step, check the returned value of
isOptionalCv(). If it is stilltrue, the CV read failed (despite retries) and the contents of thevaluefield are undefined. You can either:
return trueto indicate the Identify process has completed successfully without using the failed CV.- Set up an alternate CV read/write procedure and
return falseto continue. Don't forget to callsetOptionalCv(false)if the next CV read is not intended to be optional.
- Call
TODO:
The RailCom® Product ID is a 32 bit unsigned value.productIDis currentlyintwith -1 signifying a null value. Potential for value conflict exists but changing would involve significant code changes elsewhere.- See Also:
CombinedLocoSelPane,NewLocoSelPane
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classIdentifyDecoder.ManufacturerRepresents specific CV8 values.
-
Field Summary
Fields Modifier and Type Field Description (package private) intintMfg(package private) IdentifyDecoder.ManufacturermfgID(package private) intmodelID(package private) intproductID(package private) intproductIDhigh(package private) intproductIDhighest(package private) intproductIDlow(package private) intproductIDlowest-
Fields inherited from interface jmri.ProgListener
CommError, ConfirmFailed, FailedTimeout, NoAck, NoLocoDetected, NotImplemented, OK, ProgrammerBusy, ProgrammingShort, SequenceError, UnknownError, UserAborted
-
-
Constructor Summary
Constructors Constructor Description IdentifyDecoder(Programmer programmer)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voiddone(int mfgID, int modelID, int productID)Indicate when identification is complete.protected abstract voidmessage(java.lang.String m)Provide a user-readable message about progress.protected voidstatusUpdate(java.lang.String s)Update the status field (if any).booleantest1()booleantest2(int value)booleantest3(int value)booleantest4(int value)booleantest5(int value)booleantest6(int value)booleantest7(int value)booleantest8(int value)booleantest9(int value)-
Methods inherited from class jmri.jmrit.AbstractIdentify
error, identifyDone, isOptionalCv, isRunning, programmingOpReply, readCV, setOptionalCv, start, writeCV
-
-
-
-
Field Detail
-
intMfg
int intMfg
-
modelID
int modelID
-
productIDhigh
int productIDhigh
-
productIDlow
int productIDlow
-
productIDhighest
int productIDhighest
-
productIDlowest
int productIDlowest
-
productID
int productID
-
-
Constructor Detail
-
IdentifyDecoder
public IdentifyDecoder(Programmer programmer)
-
-
Method Detail
-
test1
public boolean test1()
- Specified by:
test1in classAbstractIdentify
-
test2
public boolean test2(int value)
- Specified by:
test2in classAbstractIdentify
-
test3
public boolean test3(int value)
- Specified by:
test3in classAbstractIdentify
-
test4
public boolean test4(int value)
- Specified by:
test4in classAbstractIdentify
-
test5
public boolean test5(int value)
- Specified by:
test5in classAbstractIdentify
-
test6
public boolean test6(int value)
- Specified by:
test6in classAbstractIdentify
-
test7
public boolean test7(int value)
- Specified by:
test7in classAbstractIdentify
-
test8
public boolean test8(int value)
- Specified by:
test8in classAbstractIdentify
-
test9
public boolean test9(int value)
- Specified by:
test9in classAbstractIdentify
-
statusUpdate
protected void statusUpdate(java.lang.String s)
Description copied from class:AbstractIdentifyUpdate the status field (if any). Invoked with "Done" when the results are in.- Specified by:
statusUpdatein classAbstractIdentify- Parameters:
s- the new status
-
done
protected abstract void done(int mfgID, int modelID, int productID)
Indicate when identification is complete.- Parameters:
mfgID- identified manufacturer identitymodelID- identified model identityproductID- identified product identity
-
message
protected abstract void message(java.lang.String m)
Provide a user-readable message about progress.- Parameters:
m- the message to provide
-
-