jmri.jmrix.loconet
Class LnSensorAddress

Show UML class diagram
java.lang.Object
  extended by jmri.jmrix.loconet.LnSensorAddress

public class LnSensorAddress
extends Object

Utilities for handling LocoNet sensor addresses.

There are three addressing spaces for LocoNet sensors:

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.


Field Summary
(package private)  int _as
           
(package private)  int _high
           
(package private)  int _low
           
(package private)  boolean _valid
           
(package private) static org.slf4j.Logger log
           
(package private)  String prefix
           
 
Constructor Summary
LnSensorAddress(int sw1, int sw2)
          Deprecated. 2.9.4
LnSensorAddress(int sw1, int sw2, String prefix)
           
LnSensorAddress(String s)
          Deprecated. 2.9.4
LnSensorAddress(String s, String prefix)
           
 
Method Summary
protected  int asInt()
           
 int getASBit()
          The bit representing the Aux or Sensor input
 String getBDL16Address()
          Name in the BDL16 space
 String getDS54Address()
          Name in the DS54 space
 int getHighBits()
           
 int getLowBits()
           
 String getNumericAddress()
          Name in the 1-4096 space
 void insertAddress(LocoNetMessage m)
          Update a LocoNet message to have this address.
 boolean isValid()
           
 boolean matchAddress(int a1, int a2)
           
(package private)  void reportParseError(String s)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_low

int _low

_high

int _high

_as

int _as

prefix

String prefix

_valid

boolean _valid

log

static org.slf4j.Logger log
Constructor Detail

LnSensorAddress

public LnSensorAddress(int sw1,
                       int sw2,
                       String prefix)

LnSensorAddress

@Deprecated
public LnSensorAddress(int sw1,
                                  int sw2)
Deprecated. 2.9.4

Old style ctor for e.g. CATS migration. Cannot handle multiple system connections.


LnSensorAddress

@Deprecated
public LnSensorAddress(String s)
Deprecated. 2.9.4

Old style ctor for e.g. CATS migration. Cannot handle multiple system connections.


LnSensorAddress

public LnSensorAddress(String s,
                       String prefix)
Method Detail

reportParseError

void reportParseError(String s)

insertAddress

public void insertAddress(LocoNetMessage m)
Update a LocoNet message to have this address.

Parameters:
m -

matchAddress

public boolean matchAddress(int a1,
                            int a2)

asInt

protected int asInt()
Returns:
integer value of this address in 0-4095 space

getLowBits

public int getLowBits()

getHighBits

public int getHighBits()

getASBit

public int getASBit()
The bit representing the Aux or Sensor input

Returns:
0x20 for aux input, 0x00 for switch input

isValid

public boolean isValid()

toString

public String toString()
Overrides:
toString in class Object

getNumericAddress

public String getNumericAddress()
Name in the 1-4096 space

Returns:
LSnnn

getDS54Address

public String getDS54Address()
Name in the DS54 space

Returns:
LSnnnA or LSnnnS, depending on Aux or Switch input

getBDL16Address

public String getBDL16Address()
Name in the BDL16 space

Returns:
e.g. LSnnnA3, with nnn the BDL16 number, A the section number, and 3 the channel number


Copyright © 1997-2013 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