jmri.jmrix.can.cbus
Class CbusCommandStation

java.lang.Object
  extended by jmri.jmrix.can.cbus.CbusCommandStation
All Implemented Interfaces:
EventListener, CommandStation, AbstractMRListener, CanListener, DccCommandStation

public class CbusCommandStation
extends Object
implements CommandStation, DccCommandStation, CanListener

Implement CommandStation for CBUS communications. The intention is that, unlike some other systems, we will hold no or minimal command station state in the software model. The actual command station state should always be referred to.

Author:
Andrew Crosland Copyright (C) 2009

Constructor Summary
CbusCommandStation()
           
 
Method Summary
 boolean getHasServiceMode()
          Does this command station have a "service mode", where it stops normal train operation while programming?
 boolean getInServiceMode()
          If this command station has a service mode, is the command station currently in that mode?
 String getVersionString()
          Provides an-implementation specific version string from the command station.
static CbusCommandStation instance()
           
 void message(CanMessage m)
           
 void releaseSession(int handle)
          Release a session freeing up the slot for reuse
 void reply(CanReply m)
           
 void sendPacket(byte[] packet, int repeats)
          Send a specific packet to the rails.
protected  void setFunctions(int group, int handle, int functions)
          Send a CBUS message to set functions
 void setSpeedDir(int handle, int speed_dir)
          Set loco speed and direction
protected  void setSpeedSteps(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, wait
 

Constructor Detail

CbusCommandStation

public CbusCommandStation()
Method Detail

instance

public static CbusCommandStation instance()

sendPacket

public void sendPacket(byte[] packet,
                       int repeats)
Send a specific packet to the rails.

Specified by:
sendPacket in interface CommandStation
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

releaseSession

public void releaseSession(int handle)
Release a session freeing up the slot for reuse

Parameters:
handle - the handle for the session to be released

setSpeedDir

public void setSpeedDir(int handle,
                        int speed_dir)
Set loco speed and direction

Parameters:
handle - The handle of the session to which it applies
speed_dir - Bit 7 is direction (1 = forward) 6:0 are speed

setFunctions

protected void setFunctions(int group,
                            int handle,
                            int functions)
Send a CBUS message to set functions

Parameters:
group - The function group
handle - The handle of the session for the loco being controlled
functions - Function bits

setSpeedSteps

protected void setSpeedSteps(int handle,
                             int mode)
Send a CBUS message to change the session speed step mode

Parameters:
mode - the speed step mode

message

public void message(CanMessage m)
Specified by:
message in interface CanListener

reply

public void reply(CanReply m)
Specified by:
reply in interface CanListener

getHasServiceMode

public boolean getHasServiceMode()
Does this command station have a "service mode", where it stops normal train operation while programming?

Specified by:
getHasServiceMode in interface DccCommandStation

getInServiceMode

public boolean getInServiceMode()
If this command station has a service mode, is the command station currently in that mode?

Specified by:
getInServiceMode in interface DccCommandStation

getVersionString

public String getVersionString()
Provides an-implementation specific version string from the command station. In general, this should be as close as possible to what the command station replied when asked; it should not be reformatted

Specified by:
getVersionString in interface DccCommandStation


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads