Package jmri.jmrix.roco.z21
Class Z21CanBusAddress
- java.lang.Object
-
- jmri.jmrix.roco.z21.Z21CanBusAddress
-
public class Z21CanBusAddress extends java.lang.Object
Utility Class supporting parsing and testing of addresses for Z21 CanBusOne address format is supported for Reporters and Sensors:
- Ztmm:pp where t is either R or S, mm is the module address and pp is the contact pin number (1-8).
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
buildDecimalSystemNameFromParts(java.lang.String prefix, char typeLetter, int userAddress, int pin)
static java.lang.String
buildHexSystemNameFromParts(java.lang.String prefix, char typeLetter, int globalCANaddress, int pin)
static int
getBitFromSystemName(java.lang.String systemName, java.lang.String prefix)
Public static method to parse a Z21CanBus system name.static java.lang.String
getEncoderAddressString(java.lang.String systemName, java.lang.String prefix)
static java.lang.String
getUserNameFromSystemName(java.lang.String systemName, java.lang.String prefix)
Public static method to check the user name for a valid system name.static java.lang.String
validateSystemNameFormat(java.lang.String name, Manager<?> manager, java.util.Locale locale)
Validate a system name format.static Manager.NameValidity
validSystemNameFormat(java.lang.String systemName, char type, java.lang.String prefix)
Public static method to validate system name format.
-
-
-
Method Detail
-
getBitFromSystemName
public static int getBitFromSystemName(java.lang.String systemName, java.lang.String prefix)
Public static method to parse a Z21CanBus system name. Note: Bits are numbered from 0.- Parameters:
systemName
- system name.prefix
- system prefix.- Returns:
- the hardware address number, return -1 if an error is found
-
getEncoderAddressString
public static java.lang.String getEncoderAddressString(java.lang.String systemName, java.lang.String prefix)
-
validateSystemNameFormat
public static java.lang.String validateSystemNameFormat(java.lang.String name, Manager<?> manager, java.util.Locale locale)
Validate a system name format.- Parameters:
name
- the name to validatemanager
- the manager requesting validationlocale
- the locale for user messages- Returns:
- name, unchanged
- See Also:
Manager.validateSystemNameFormat(java.lang.String, java.util.Locale)
-
validSystemNameFormat
public static Manager.NameValidity validSystemNameFormat(@Nonnull java.lang.String systemName, char type, java.lang.String prefix)
Public static method to validate system name format. Logging of handled cases no higher than WARN.- Parameters:
systemName
- system name.type
- bean type, S for Sensor, T for Turnout.prefix
- system prefix.- Returns:
- VALID if system name has a valid format, else return INVALID
-
getUserNameFromSystemName
public static java.lang.String getUserNameFromSystemName(java.lang.String systemName, java.lang.String prefix)
Public static method to check the user name for a valid system name.- Parameters:
systemName
- system name.prefix
- system prefix.- Returns:
- "" (null string) if the system name is not valid or does not exist
-
buildDecimalSystemNameFromParts
public static java.lang.String buildDecimalSystemNameFromParts(java.lang.String prefix, char typeLetter, int userAddress, int pin)
-
buildHexSystemNameFromParts
public static java.lang.String buildHexSystemNameFromParts(java.lang.String prefix, char typeLetter, int globalCANaddress, int pin)
-
-