Class CbusOpCodes

java.lang.Object
jmri.jmrix.can.cbus.CbusOpCodes

public class CbusOpCodes
extends Object
Methods to decode CBUS opcodes https://github.com/MERG-DEV/CBUSlib
  • Constructor Details

  • Method Details

    • fullDecode

      @Nonnull public static final String fullDecode​(AbstractMessage msg)
      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

      @Nonnull public static final String getCbusErr​(AbstractMessage msg)
      Return CBUS ERR OPC String.
      Parameters:
      msg - CanMessage or CanReply containing the CBUSERR OPC
      Returns:
      Error String
    • locoFromBytes

      @Nonnull public static final String locoFromBytes​(int byteA, int byteB)
      Return Loco Address String
      Parameters:
      byteA - 1st loco byte
      byteB - 2nd loco byte
      Returns:
      Loco Address String
    • decode

      @Nonnull public static final String decode​(AbstractMessage msg)
      Return a string representation of a decoded CBUS Message
      Parameters:
      msg - CbusMessage to be decoded
      Returns:
      decoded message after extended frame check
    • decodeExtended

      @Nonnull public static final String decodeExtended​(CanFrame msg)
      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

      @Nonnull public static final String decodeopcNonExtended​(AbstractMessage msg)
      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

      @Nonnull public static final String decodeopc​(AbstractMessage msg)
      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

      public static final boolean isKnownOpc​(AbstractMessage msg)
      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

      public static final boolean isEvent​(int opc)
      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

      public static final boolean isEventNotRequest​(int opc)
      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

      public static final boolean isDcc​(int opc)
      Test if CBUS opcode represents a DCC Command Station Message

      TOF, 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, RDCC5, WCVOA, RDCC6, PLOC, STAT, RSTAT

      Parameters:
      opc - CBUS op code
      Returns:
      True if opcode represents a dcc command
    • isOnEvent

      public static final boolean isOnEvent​(int opc)
      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

      public static final boolean isEventRequest​(int opc)
      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

      public static final boolean isShortEvent​(int opc)
      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

      @Nonnull public static final EnumSet<CbusFilterType> getOpcFilters​(int opc)
      Get the filters for a CBUS OpCode.
      Parameters:
      opc - CBUS op code
      Returns:
      Filter EnumSet
    • getOpcName

      @Nonnull public static final String getOpcName​(int opc)
      Get the Name of a CBUS OpCode.
      Parameters:
      opc - CBUS op code
      Returns:
      Name if known, else empty String.
    • getOpcMinPriority

      public static final int getOpcMinPriority​(int opc)
      Get the Minimum Priority for a CBUS OpCode.
      Parameters:
      opc - CBUS op code
      Returns:
      Minimum Priority