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 theDecoderIndexFile
entry 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
DecoderIndexFile
member function) to simplify use ofProgrammer
callbacks.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 CV47(MSB), CV48, CV49 (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 thevalue
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 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.productID
is currentlyint
with -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 class
IdentifyDecoder.Manufacturer
Represents specific CV8 values.
-
Field Summary
Fields Modifier and Type Field Description (package private) int
intMfg
(package private) IdentifyDecoder.Manufacturer
mfgID
(package private) int
modelID
(package private) int
productID
(package private) int
productIDhigh
(package private) int
productIDhighest
(package private) int
productIDlow
(package private) int
productIDlowest
-
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 void
done(int mfgID, int modelID, int productID)
Indicate when identification is complete.protected abstract void
message(java.lang.String m)
Provide a user-readable message about progress.protected void
statusUpdate(java.lang.String s)
Update the status field (if any).boolean
test1()
boolean
test2(int value)
boolean
test3(int value)
boolean
test4(int value)
boolean
test5(int value)
boolean
test6(int value)
boolean
test7(int value)
boolean
test8(int value)
boolean
test9(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:
test1
in classAbstractIdentify
-
test2
public boolean test2(int value)
- Specified by:
test2
in classAbstractIdentify
-
test3
public boolean test3(int value)
- Specified by:
test3
in classAbstractIdentify
-
test4
public boolean test4(int value)
- Specified by:
test4
in classAbstractIdentify
-
test5
public boolean test5(int value)
- Specified by:
test5
in classAbstractIdentify
-
test6
public boolean test6(int value)
- Specified by:
test6
in classAbstractIdentify
-
test7
public boolean test7(int value)
- Specified by:
test7
in classAbstractIdentify
-
test8
public boolean test8(int value)
- Specified by:
test8
in classAbstractIdentify
-
test9
public boolean test9(int value)
- Specified by:
test9
in classAbstractIdentify
-
statusUpdate
protected void statusUpdate(java.lang.String s)
Description copied from class:AbstractIdentify
Update the status field (if any). Invoked with "Done" when the results are in.- Specified by:
statusUpdate
in 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
-
-