Package jmri.jmrix.can.cbus
Class CbusCommandStation
java.lang.Object
jmri.jmrix.can.cbus.CbusCommandStation
- All Implemented Interfaces:
CommandStation
CommandStation for CBUS communications.
Unlike some other systems, we will hold minimal command station state
in the software model. The actual command station state
should always be referred to.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CbusNodeGet the master command station from the CBUS Node Tableprotected booleanGet if Share is available on the Command Station.protected booleanGet if Steal is available on the Command Stationprotected voidreleaseSession(int handle) Release a session freeing up the slot for reuse.protected voidsendKeepAlive(int handle) Send keep alive (DKEEP) packet for a throttle.booleansendPacket(byte[] packet, int repeats) Send a specific packet to the rails.protected voidsetFunctions(int group, int handle, int functions) Send a CBUS message to set functions.protected voidsetSpeedDir(int handle, int speed_dir) Set loco speed and direction.protected voidsetSpeedSteps(int handle, int mode) Send a CBUS message to change the session speed step mode.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jmri.CommandStation
sendAccSignalDecoderPkt, sendAltAccSignalDecoderPkt
-
Constructor Details
-
CbusCommandStation
-
-
Method Details
-
sendPacket
Send a specific packet to the rails.- Specified by:
sendPacketin interfaceCommandStation- Parameters:
packet- Byte array representing the packet, including the error-correction byte. Must not be null.repeats- Number of times to repeat the transmission, but is ignored in the current implementation- Returns:
trueif the operation succeeds,falseotherwise.
-
releaseSession
Release a session freeing up the slot for reuse.- Parameters:
handle- the handle for the session to be released
-
sendKeepAlive
Send keep alive (DKEEP) packet for a throttle.- Parameters:
handle- The handle of the session to which it applies
-
setSpeedDir
Set loco speed and direction.- Parameters:
handle- The handle of the session to which it appliesspeed_dir- Bit 7 is direction (1 = forward) 6:0 are speed
-
setFunctions
Send a CBUS message to set functions.- Parameters:
group- The function grouphandle- The handle of the session for the loco being controlledfunctions- Function bits
-
setSpeedSteps
Send a CBUS message to change the session speed step mode.- Parameters:
handle- The handle of the session to which it appliesmode- the speed step mode
-
getMasterCommandStation
Get the master command station from the CBUS Node TableFull CBUS spec is defined as to comply with CBUS Developers Guide Version 6b
eg. CANCMD FW v3 supports the main loco OPCs but not full spec, will return null. eg. CANCMD FW v4 supports the full steal / share spec, will return the CbusNode.
- Returns:
- the Master Command Station, else null if not found
-
isStealAvailable
Get if Steal is available on the Command StationSteal availability can change, so CbusThrottleManager checks this value when it struggles on initial attempt to obtain a throttle
- Returns:
- false if not available, defaults to true
-
getUserName
- Specified by:
getUserNamein interfaceCommandStation
-
getSystemPrefix
- Specified by:
getSystemPrefixin interfaceCommandStation
-