Class SerialAddress


  • public class SerialAddress
    extends java.lang.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

    • Method Detail

      • validateSystemNameFormat

        java.lang.String validateSystemNameFormat​(java.lang.String name,
                                                  char type,
                                                  java.util.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​(java.lang.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​(java.lang.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​(java.lang.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 java.lang.String normalizeSystemName​(java.lang.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 java.lang.String houseCodeFromSystemName​(java.lang.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 java.lang.String deviceCodeFromSystemName​(java.lang.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​(java.lang.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​(java.lang.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

        public int insteonIdHighCodeAsValueFromSystemName​(java.lang.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.

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

        public int insteonIdMiddleCodeAsValueFromSystemName​(java.lang.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.

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

        public int insteonIdLowCodeAsValueFromSystemName​(java.lang.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.

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

        public int dmxUnitIdCodeAsValueFromSystemName​(java.lang.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