Package jmri.jmrix.loconet
Class LnSensorAddress
- java.lang.Object
- 
- jmri.jmrix.loconet.LnSensorAddress
 
- 
 public class LnSensorAddress extends java.lang.Object Utilities for handling LocoNet sensor addresses.There are three addressing spaces for LocoNet sensors: - The space used for DS54 inputs, where the least-significant-bit in the address refers to the "Aux" and "Switch" inputs. These are represented by system names of the form LSnnnA and LSnnnS respectively. nnn is then the turnout number of the DS54 channel.
- The space used for BDL16 inputs, where the card and section numbers are part of the address. These are represented by names of the form LScccA1 through LScccA4, LScccB1 through LScccB4, and on through LScccD4. ccc is the BDL16 card number.
- A straight-forward numeric space, represented by LSmmm. Note that this is a 1-4096 scheme, not a 0-4095.
 
- 
- 
Constructor SummaryConstructors Constructor Description LnSensorAddress(int sw1, int sw2, java.lang.String prefix)LnSensorAddress(java.lang.String s, java.lang.String prefix)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intasInt()intgetASBit()The bit representing the Aux or Sensor inputjava.lang.StringgetBDL16Address()Name in the BDL16 spacejava.lang.StringgetDS54Address()Name in the DS54 spaceintgetHighBits()intgetLowBits()java.lang.StringgetNumericAddress()Name in the 1-4096 spacevoidinsertAddress(LocoNetMessage m)Update a LocoNet message to have this address.booleanisValid()booleanmatchAddress(int a1, int a2)(package private) voidreportParseError(java.lang.String s)java.lang.StringtoString()
 
- 
- 
- 
Constructor Detail- 
LnSensorAddresspublic LnSensorAddress(int sw1, int sw2, java.lang.String prefix) 
 - 
LnSensorAddresspublic LnSensorAddress(java.lang.String s, java.lang.String prefix) 
 
- 
 - 
Method Detail- 
reportParseErrorvoid reportParseError(java.lang.String s) 
 - 
insertAddresspublic void insertAddress(LocoNetMessage m) Update a LocoNet message to have this address. It is assumed that the sensor address may be encoded into bytes 1 and 2 of the message.- Parameters:
- m- a LocoNetmessage to be updated to contain this object's sensor address
 
 - 
matchAddresspublic boolean matchAddress(int a1, int a2) 
 - 
asIntprotected int asInt() - Returns:
- integer value of this address in 0-4095 space
 
 - 
getLowBitspublic int getLowBits() 
 - 
getHighBitspublic int getHighBits() 
 - 
getASBitpublic int getASBit() The bit representing the Aux or Sensor input- Returns:
- 0x20 for aux input, 0x00 for switch input
 
 - 
isValidpublic boolean isValid() 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
getNumericAddresspublic java.lang.String getNumericAddress() Name in the 1-4096 space- Returns:
- LSnnn
 
 - 
getDS54Addresspublic java.lang.String getDS54Address() Name in the DS54 space- Returns:
- LSnnnA or LSnnnS, depending on Aux or Switch input
 
 - 
getBDL16Addresspublic java.lang.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
 
 
- 
 
-