Class SerialAddress

java.lang.Object
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 Details

  • Constructor Details

  • Method Details

    • validateSystemNameFormat

      String validateSystemNameFormat(String name, char type, Locale locale)
      Validate the format for a system name.
      Parameters:
      name - the name to validate
      type - the type letter for the name
      locale - the locale for messages to the user
      Returns:
      the name, unchanged
    • validSystemNameFormat

      public Manager.NameValidity validSystemNameFormat(String systemName, char type)
      Public static method to validate system name format.
      Parameters:
      systemName - name to test
      type - Letter indicating device type expected
      Returns:
      VALID if system name has a valid format, else return INVALID
    • 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'.
      Parameters:
      systemName - name to test
      type - type to test
      Returns:
      true for valid names
    • isInsteon

      public boolean isInsteon(String systemName)
      Public static method determines whether a systemName names an Insteon device.
      Parameters:
      systemName - name to test
      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.

      Parameters:
      systemName - name to process
      Returns:
      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.

      Parameters:
      systemName - system name
      Returns:
      house code letter
    • deviceCodeFromSystemName

      public String deviceCodeFromSystemName(String systemName)
      Extract devicecode from system name, as a string 1-16.
      Parameters:
      systemName - name
      Returns:
      If the supplied system name does not have a valid format, an empty string is returned. X10 type device code
    • x10HouseCodeAsValueFromSystemName

      public int x10HouseCodeAsValueFromSystemName(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.

      Parameters:
      systemName - name
      Returns:
      valid 1-16, invalid, return -1
    • x10DeviceCodeAsValueFromSystemName

      public int x10DeviceCodeAsValueFromSystemName(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.

      Parameters:
      systemName - name
      Returns:
      value of X10 device code, -1 if invalid
    • insteonIdHighCodeAsValueFromSystemName

      Extract Insteon high device id from system name.

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

      Parameters:
      systemName - name
      Returns:
      Insteon high byte value
    • insteonIdMiddleCodeAsValueFromSystemName

      Extract Insteon middle device id from system name.

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

      Parameters:
      systemName - name
      Returns:
      Insteon middle id value, -1 if invalid
    • insteonIdLowCodeAsValueFromSystemName

      Extract Insteon low device id from system name.

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

      Parameters:
      systemName - name
      Returns:
      Insteon low value id, -1 if invalid
    • dmxUnitIdCodeAsValueFromSystemName

      public int dmxUnitIdCodeAsValueFromSystemName(String systemName)
      Extract DMX unit id from system name.

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

      Parameters:
      systemName - name
      Returns:
      dmx unit id, -1 if invalid