jmri.jmrix.powerline
Class SerialAddress

java.lang.Object
  extended by jmri.jmrix.powerline.SerialAddress

public class SerialAddress
extends Object

Utility Class supporting parsing and testing of addresses

Two address formats are supported: For X10: Ptnxx where: t is the type code, 'S' for sensors, and 'L' for lights n is the house code of the input or output bit (A - P) xx is a bit number of the input or output bit (1-16) examples: PLA2 (House Code A, Unit 2), PSK1 (House Code K, Unit 1) For Insteon: Pthh.hh.hh where: t is the type code, 'S' for sensors, and 'L' for lights aa is two hexadecimal digits examples: PLA2.43.CB


Field Summary
(package private) static org.slf4j.Logger log
           
(package private)  SerialSystemConnectionMemo memo
           
 
Constructor Summary
SerialAddress(SerialSystemConnectionMemo m)
           
 
Method Summary
 int deviceCodeAsValueFromSystemName(String systemName)
          Extract devicecode from system name, as a value 1-16 If the supplied system name does not have a valid format, an -1 is returned.
 String deviceCodeFromSystemName(String systemName)
          Extract devicecode from system name, as a string 1-16 If the supplied system name does not have a valid format, an empty string is returned.
 int houseCodeAsValueFromSystemName(String systemName)
          Extract housecode from system name, as a value 1-16 If the supplied system name does not have a valid format, an -1 is returned.
 String houseCodeFromSystemName(String systemName)
          Extract housecode from system name, as a letter A-P If the supplied system name does not have a valid format, an empty string is returned.
 int idHighCodeAsValueFromSystemName(String systemName)
          Extract Insteon high device id from system name If the supplied system name does not have a valid format, an empty string is returned.
 int idLowCodeAsValueFromSystemName(String systemName)
          Extract Insteon low device id from system name If the supplied system name does not have a valid format, an empty string is returned.
 int idMiddleCodeAsValueFromSystemName(String systemName)
          Extract Insteon middle device id from system name If the supplied system name does not have a valid format, an empty string is returned.
 boolean isInsteon(String systemName)
          Public static method determines whether a systemName names an Insteon device.
 String normalizeSystemName(String systemName)
          Public static method to normalize a system name This routine is used to ensure that each system name is uniquely linked to one bit, by removing extra zeros inserted by the user.
 boolean validSystemNameConfig(String systemName, char type)
          Public static method to validate system name for configuration returns 'true' if system name has a valid meaning in current configuration, else returns 'false'
 boolean validSystemNameFormat(String systemName, char type)
          Public static method to validate system name format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

memo

SerialSystemConnectionMemo memo

log

static org.slf4j.Logger log
Constructor Detail

SerialAddress

public SerialAddress(SerialSystemConnectionMemo m)
Method Detail

validSystemNameFormat

public boolean validSystemNameFormat(String systemName,
                                     char type)
Public static method to validate system name format

Parameters:
type - Letter indicating device type expected
Returns:
'true' if system name has a valid format, else returns 'false'

validSystemNameConfig

public boolean validSystemNameConfig(String systemName,
                                     char type)
Public static method to validate system name for configuration returns 'true' if system name has a valid meaning in current configuration, else returns 'false'


isInsteon

public boolean isInsteon(String systemName)
Public static method determines whether a systemName names an Insteon device.

Returns:
true if system name corresponds to Insteon device

normalizeSystemName

public String normalizeSystemName(String systemName)
Public static method to normalize a system name

This routine is used to ensure that each system name is uniquely linked to one bit, by removing extra zeros inserted by the user.

If the supplied system name does not have a valid format, an empty string is returned. Otherwise a normalized name is returned in the same format as the input name.


houseCodeFromSystemName

public String houseCodeFromSystemName(String systemName)
Extract housecode from system name, as a letter A-P

If the supplied system name does not have a valid format, an empty string is returned.


deviceCodeFromSystemName

public String deviceCodeFromSystemName(String systemName)
Extract devicecode from system name, as a string 1-16

If the supplied system name does not have a valid format, an empty string is returned.


houseCodeAsValueFromSystemName

public int houseCodeAsValueFromSystemName(String systemName)
Extract housecode from system name, as a value 1-16

If the supplied system name does not have a valid format, an -1 is returned.


deviceCodeAsValueFromSystemName

public int deviceCodeAsValueFromSystemName(String systemName)
Extract devicecode from system name, as a value 1-16

If the supplied system name does not have a valid format, an -1 is returned.


idHighCodeAsValueFromSystemName

public int idHighCodeAsValueFromSystemName(String systemName)
Extract Insteon high device id from system name

If the supplied system name does not have a valid format, an empty string is returned.


idMiddleCodeAsValueFromSystemName

public int idMiddleCodeAsValueFromSystemName(String systemName)
Extract Insteon middle device id from system name

If the supplied system name does not have a valid format, an empty string is returned.


idLowCodeAsValueFromSystemName

public int idLowCodeAsValueFromSystemName(String systemName)
Extract Insteon low device id from system name

If the supplied system name does not have a valid format, an empty string is returned.



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