jmri.jmrix.loconet
Class LocoNetSlot

java.lang.Object
  extended by jmri.jmrix.loconet.LocoNetSlot

public class LocoNetSlot
extends Object

Represents the contents of a single slot in the LocoNet command station.

A SlotListener can be registered to hear of changes in this slot. All changes in values will result in notification.

Strictly speaking, functions 9 through 28 are not in the actual slot, but it's convenient to imagine there's an "extended slot" and keep track of them here. This is a partial implementation, though, because setting is still done directly in LocoNetThrottle. In particular, if this slot has not been read from the command station, the first message directly setting F9 through F28 will not have a place to store information. Instead, it will trigger a slot read, so the following messages will be properly handled.

Some of the message formats used in this class are Copyright Digitrax, Inc. and used with permission as part of the JMRI project. That permission does not extend to uses in other software products. If you wish to use this code, algorithm or these message formats outside of JMRI, please contact Digitrax Inc for separate permission.

Author:
Bob Jacobsen Copyright (C) 2001, Stephen Williams Copyright (C) 2008

Constructor Summary
LocoNetSlot(int slotNum)
           
LocoNetSlot(LocoNetMessage l)
           
 
Method Summary
 void addSlotListener(SlotListener l)
           
 int consistStatus()
           
 int cvval()
           
 int decoderType()
           
 int dirf()
           
 LocoNetMessage dispatchSlot()
           
 void functionMessage(long pkt)
          Load functions 9 through 28 from loconet "Set Direct" message.
 int getFcDays()
          Only valid for fast-clock slot.
 int getFcFracMins()
          Only valid for fast-clock slot.
 int getFcHours()
          Only valid for fast-clock slot.
 int getFcMinutes()
          Only valid for fast-clock slot.
 int getFcRate()
          Only valid for fast-clock slot.
 long getLastUpdateTime()
           
 int getSlot()
           
 int id()
           
 boolean isF0()
           
 boolean isF1()
           
 boolean isF10()
           
 boolean isF11()
           
 boolean isF12()
           
 boolean isF13()
           
 boolean isF14()
           
 boolean isF15()
           
 boolean isF16()
           
 boolean isF17()
           
 boolean isF18()
           
 boolean isF19()
           
 boolean isF2()
           
 boolean isF20()
           
 boolean isF21()
           
 boolean isF22()
           
 boolean isF23()
           
 boolean isF24()
           
 boolean isF25()
           
 boolean isF26()
           
 boolean isF27()
           
 boolean isF28()
           
 boolean isF3()
           
 boolean isF4()
           
 boolean isF5()
           
 boolean isF6()
           
 boolean isF7()
           
 boolean isF8()
           
 boolean isF9()
           
 boolean isForward()
           
 int locoAddr()
           
protected  void notifySlotListeners()
           
 int pcmd()
           
 void removeSlotListener(SlotListener l)
           
 void setFcDays(int val)
          For fast-clock slot, set "days" value.
 void setFcFracMins(int val)
          For fast-clock slot, set "frac_mins" value.
 void setFcHours(int val)
          For fast-clock slot, set "hours" value.
 void setFcMinutes(int val)
          For fast-clock slot, set "minutes" value.
 void setFcRate(int val)
          For fast-clock slot, set "rate" value.
 void setSlot(LocoNetMessage l)
           
 int slotStatus()
           
 int snd()
           
 int speed()
           
 LocoNetMessage writeSlot()
           
 LocoNetMessage writeStatus(int status)
          Update the status bits in STAT1 (D5, D4)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocoNetSlot

public LocoNetSlot(int slotNum)

LocoNetSlot

public LocoNetSlot(LocoNetMessage l)
            throws LocoNetException
Throws:
LocoNetException
Method Detail

getSlot

public int getSlot()

decoderType

public int decoderType()

slotStatus

public int slotStatus()

consistStatus

public int consistStatus()

isForward

public boolean isForward()

isF0

public boolean isF0()

isF1

public boolean isF1()

isF2

public boolean isF2()

isF3

public boolean isF3()

isF4

public boolean isF4()

isF5

public boolean isF5()

isF6

public boolean isF6()

isF7

public boolean isF7()

isF8

public boolean isF8()

isF9

public boolean isF9()

isF10

public boolean isF10()

isF11

public boolean isF11()

isF12

public boolean isF12()

isF13

public boolean isF13()

isF14

public boolean isF14()

isF15

public boolean isF15()

isF16

public boolean isF16()

isF17

public boolean isF17()

isF18

public boolean isF18()

isF19

public boolean isF19()

isF20

public boolean isF20()

isF21

public boolean isF21()

isF22

public boolean isF22()

isF23

public boolean isF23()

isF24

public boolean isF24()

isF25

public boolean isF25()

isF26

public boolean isF26()

isF27

public boolean isF27()

isF28

public boolean isF28()

locoAddr

public int locoAddr()

speed

public int speed()

dirf

public int dirf()

snd

public int snd()

id

public int id()

pcmd

public int pcmd()

cvval

public int cvval()

setSlot

public void setSlot(LocoNetMessage l)
             throws LocoNetException
Throws:
LocoNetException

functionMessage

public void functionMessage(long pkt)
Load functions 9 through 28 from loconet "Set Direct" message.


writeStatus

public LocoNetMessage writeStatus(int status)
Update the status bits in STAT1 (D5, D4)

Parameters:
status - New values for STAT1 (D5, D4)
Returns:
Formatted LocoNet message to change value.

dispatchSlot

public LocoNetMessage dispatchSlot()

writeSlot

public LocoNetMessage writeSlot()

addSlotListener

public void addSlotListener(SlotListener l)

removeSlotListener

public void removeSlotListener(SlotListener l)

getLastUpdateTime

public long getLastUpdateTime()

notifySlotListeners

protected void notifySlotListeners()

getFcDays

public int getFcDays()
Only valid for fast-clock slot.

Returns:
"Days" value currently in fast-clock slot.

setFcDays

public void setFcDays(int val)
For fast-clock slot, set "days" value.


getFcHours

public int getFcHours()
Only valid for fast-clock slot.

Returns:
"Hours" value currently stored in fast clock slot.

setFcHours

public void setFcHours(int val)
For fast-clock slot, set "hours" value.


getFcMinutes

public int getFcMinutes()
Only valid for fast-clock slot.

Returns:
Return minutes value currently stored in the fast clock slot.

setFcMinutes

public void setFcMinutes(int val)
For fast-clock slot, set "minutes" value.


getFcFracMins

public int getFcFracMins()
Only valid for fast-clock slot.

Returns:
Return frac_mins field which is the number of 65ms ticks until then next minute rollover. These ticks step at the current fast clock rate

setFcFracMins

public void setFcFracMins(int val)
For fast-clock slot, set "frac_mins" value.


getFcRate

public int getFcRate()
Only valid for fast-clock slot.

Returns:
Rate stored in fast clock slot.

setFcRate

public void setFcRate(int val)
For fast-clock slot, set "rate" value.



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