Class CbusOpCodes
-
Method Summary
Modifier and TypeMethodDescriptionstatic final Stringdecode(AbstractMessage msg) Return a string representation of a decoded CBUS Messagestatic final StringdecodeExtended(CanFrame msg) Return a string representation of a decoded Extended CBUS Messagestatic final Stringdecodeopc(AbstractMessage msg) Return a string OPC of a CBUS Messagestatic final StringReturn a string representation of a decoded CBUS OPCstatic final StringReturn a string representation of a decoded CBUS Message Used in CBUS Console Logstatic final StringReturn CBUS ERR OPC String.static StringgetDirectionFromByte(int speed) Get localised direction from speed byte.static final EnumSet<CbusFilterType>getOpcFilters(int opc) Get the filters for a CBUS OpCode.static final intgetOpcMinPriority(int opc) Get the Minimum Priority for a CBUS OpCode.static final StringgetOpcName(int opc) Get the Name of a CBUS OpCode.static StringgetSpeedFromByte(int speed) Get loco speed from byte value.static final booleanisDcc(int opc) Test if CBUS opcode represents a DCC Command Station Messagestatic final booleanisEvent(int opc) Test if CBUS OpCode represents a CBUS event.static final booleanisEventNotRequest(int opc) Test if CBUS opcode represents a JMRI event table event.static final booleanisEventRequest(int opc) Test if CBUS opcode represents an event request.static final booleanTest if CBUS OpCode is known to JMRI.static final booleanisOnEvent(int opc) Test if CBUS opcode represents an on event.static final booleanisShortEvent(int opc) Test if CBUS opcode represents a short event.static final StringlocoFromBytes(int byteA, int byteB) Return Loco Address Stringstatic final StringspeedDirFromByte(int byteA) Get text string of speed / direction.
-
Method Details
-
fullDecode
Return a string representation of a decoded CBUS Message Used in CBUS Console Log- Parameters:
msg- CbusMessage to be decoded Return String decoded message- Returns:
- decoded CBUS message
-
getCbusErr
Return CBUS ERR OPC String.- Parameters:
msg- CanMessage or CanReply containing the CBUSERR OPC- Returns:
- Error String
-
locoFromBytes
Return Loco Address String- Parameters:
byteA- 1st loco bytebyteB- 2nd loco byte- Returns:
- Loco Address String
-
speedDirFromByte
Get text string of speed / direction.- Parameters:
byteA- the Speed / Direction byte value.- Returns:
- translated String.
-
getSpeedFromByte
Get loco speed from byte value.- Parameters:
speed- byte value 0-255 of speed containing direction flag.- Returns:
- interpreted String, maybe with EStop localised text.
-
getDirectionFromByte
Get localised direction from speed byte.- Parameters:
speed- 0-255, 0-127 Reverse, else Forwards.- Returns:
- localised Forward or Reverse String.
-
decode
Return a string representation of a decoded CBUS Message- Parameters:
msg- CbusMessage to be decoded- Returns:
- decoded message after extended frame check
-
decodeExtended
Return a string representation of a decoded Extended CBUS Message- Parameters:
msg- Extended CBUS CAN Frame to be decoded- Returns:
- decoded message after extended frame check
-
decodeopcNonExtended
Return a string representation of a decoded CBUS OPC- Parameters:
msg- CbusMessage to be decoded Return String decoded OPC- Returns:
- decoded CBUS OPC, eg. "RTON" or "ACON2", else Reserved string.
-
decodeopc
Return a string OPC of a CBUS Message- Parameters:
msg- CbusMessage- Returns:
- decoded CBUS OPC, eg. "RTON" or "ACON2", else Reserved string. Empty String for Extended Frames as no OPC concept.
-
isKnownOpc
Test if CBUS OpCode is known to JMRI. Performs Extended / RTR Frame check.- Parameters:
msg- CanReply or CanMessage- Returns:
- True if opcode is known
-
isEvent
Test if CBUS OpCode represents a CBUS event.Defined in the CBUS Developer Manual as accessory commands. Excludes fast clock.
ACON, ACOF, AREQ, ARON, AROF, ASON, ASOF, ASRQ, ARSON, ARSOF, ACON1, ACOF1, ARON1, AROF1, ASON1, ASOF1, ARSON1, ARSOF1, ACON2, ACOF2, ARON2, AROF2, ASON2, ASOF2, ARSON2, ARSOF2
- Parameters:
opc- CBUS op code- Returns:
- True if opcode represents an event
-
isEventNotRequest
Test if CBUS opcode represents a JMRI event table event. Event codes excluding request codes + fastclock.ACON, ACOF, ARON, AROF, ASON, ASOF, ARSON, ARSOF, ACON1, ACOF1, ARON1, AROF1, ASON1, ASOF1, ARSON1, ARSOF1, ACON2, ACOF2, ARON2, AROF2, ASON2, ASOF2, ARSON2, ARSOF2, ACON3, ACOF3, ARON3, AROF3, ASON3, ASOF3, ARSON3, ARSOF3,
- Parameters:
opc- CBUS op code- Returns:
- True if opcode represents an event
-
isDcc
Test if CBUS opcode represents a DCC Command Station MessageTOF, TON, ESTOP, RTOF, RTON, RESTP, KLOC, QLOC, DKEEP, RLOC, QCON, ALOC, STMOD, PCON, KCON, DSPD, DFLG, DFNON, DFNOF, SSTAT, DFUN, GLOC, ERR, RDCC3, WCVO, WCVB, QCVS, PCVS, RDCC4, WCVS, VCVS, RDCC5, WCVOA, RDCC6, PLOC, STAT, RSTAT
- Parameters:
opc- CBUS op code- Returns:
- True if opcode represents a dcc command
-
isOnEvent
Test if CBUS opcode represents an on event.ACON, ARON, ASON, ARSON ACON1, ARON1, ASON1, ARSON1 ACON2, ARON2, ASON2, ARSON2 ACON3, ARON3, ASON3, ARSON3
- Parameters:
opc- CBUS op code- Returns:
- True if opcode represents an on event
-
isEventRequest
Test if CBUS opcode represents an event request. Excludes node data requests RQDAT + RQDDS. AREQ, ASRQ- Parameters:
opc- CBUS op code- Returns:
- True if opcode represents a short event
-
isShortEvent
Test if CBUS opcode represents a short event.ASON, ASOF, ASRQ, ARSON, ARSOF ASON1, ASOF1, ARSON1, ARSOF1 ASON2, ASOF2, ARSON2, ARSOF2 ASON3, ASOF3, ARSON3, ARSOF3
- Parameters:
opc- CBUS op code- Returns:
- True if opcode represents a short event
-
getOpcFilters
Get the filters for a CBUS OpCode.- Parameters:
opc- CBUS op code- Returns:
- Filter EnumSet
-
getOpcName
Get the Name of a CBUS OpCode.- Parameters:
opc- CBUS op code- Returns:
- Name if known, else empty String.
-
getOpcMinPriority
Get the Minimum Priority for a CBUS OpCode.- Parameters:
opc- CBUS op code- Returns:
- Minimum Priority
-