|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrix.sprog.SprogCommandStation
public class SprogCommandStation
Controls a collection of slots, acting as a soft command station for SPROG
A SlotListener can register to hear changes. By registering here, the SlotListener is saying that it wants to be notified of a change in any slot. Alternately, the SlotListener can register with some specific slot, done via the SprogSlot object itself.
This Programmer implementation is single-user only. It's not clear whether the command stations can have multiple programming requests outstanding (e.g. service mode and ops mode, or two ops mode) at the same time, but this code definitely can't.
Updated by Andrew Berridge, January 2010 - state management code now safer, uses enum, etc. Amalgamated with Sprog Slot Manager into a single class - reduces code duplication
| Constructor Summary | |
|---|---|
SprogCommandStation()
|
|
| Method Summary | |
|---|---|
void |
addSlotListener(SprogSlotListener l)
|
void |
estopAll()
Send emergency stop to all slots |
void |
forwardCommandChangeToLayout(int address,
boolean closed)
|
void |
function0Through4Packet(int address,
boolean f0,
boolean f0Momentary,
boolean f1,
boolean f1Momentary,
boolean f2,
boolean f2Momentary,
boolean f3,
boolean f3Momentary,
boolean f4,
boolean f4Momentary)
|
void |
function5Through8Packet(int address,
boolean f5,
boolean f5Momentary,
boolean f6,
boolean f6Momentary,
boolean f7,
boolean f7Momentary,
boolean f8,
boolean f8Momentary)
|
void |
function9Through12Packet(int address,
boolean f9,
boolean f9Momentary,
boolean f10,
boolean f10Momentary,
boolean f11,
boolean f11Momentary,
boolean f12,
boolean f12Momentary)
|
int |
getInUseCount()
Provide a count of the slots in use |
static SprogCommandStation |
instance()
method to find the existing SlotManager object, if need be creating one |
boolean |
isBusy()
|
void |
notifyMessage(SprogMessage m)
|
void |
notifyReply(SprogReply m)
|
void |
opsModepacket(int address,
boolean longAddr,
int cv,
int val)
|
void |
release(int address)
|
void |
removeSlotListener(SprogSlotListener l)
|
void |
run()
|
void |
sendPacket(byte[] packet,
int repeats)
Send a specific packet to the rails. |
void |
setSpeed(int address,
int spd,
boolean isForward)
|
SprogSlot |
slot(int i)
Return contents of Queue slot i |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SprogCommandStation()
| Method Detail |
|---|
public void sendPacket(byte[] packet,
int repeats)
sendPacket in interface CommandStationpacket - Byte array representing the packet, including
the error-correction byte. Must not be null.repeats - number of times to repeat the packetpublic SprogSlot slot(int i)
i - int
public void forwardCommandChangeToLayout(int address,
boolean closed)
public void function0Through4Packet(int address,
boolean f0,
boolean f0Momentary,
boolean f1,
boolean f1Momentary,
boolean f2,
boolean f2Momentary,
boolean f3,
boolean f3Momentary,
boolean f4,
boolean f4Momentary)
public void function5Through8Packet(int address,
boolean f5,
boolean f5Momentary,
boolean f6,
boolean f6Momentary,
boolean f7,
boolean f7Momentary,
boolean f8,
boolean f8Momentary)
public void function9Through12Packet(int address,
boolean f9,
boolean f9Momentary,
boolean f10,
boolean f10Momentary,
boolean f11,
boolean f11Momentary,
boolean f12,
boolean f12Momentary)
public void setSpeed(int address,
int spd,
boolean isForward)
public void opsModepacket(int address,
boolean longAddr,
int cv,
int val)
public void release(int address)
public void estopAll()
public static final SprogCommandStation instance()
public void addSlotListener(SprogSlotListener l)
public void removeSlotListener(SprogSlotListener l)
public void run()
run in interface Runnablepublic void notifyMessage(SprogMessage m)
notifyMessage in interface SprogListenerpublic void notifyReply(SprogReply m)
notifyReply in interface SprogListenerpublic int getInUseCount()
public boolean isBusy()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||