Package jmri.jmrix.bidib
Class BiDiBAddress
java.lang.Object
jmri.jmrix.bidib.BiDiBAddress
Utilities for handling BiDiB addresses.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBiDiBAddress(String systemName, char typeLetter, BiDiBSystemConnectionMemo memo) Construct from system name - needs prefix and type letter -
Method Summary
Modifier and TypeMethodDescriptionintgetAddr()Get the address inside the node.Get the address as string exactly as given when the instance has been createdprotected StringGet the address type as a lowercase single letter: t - DCC address of decoder (t stands for "Track") a - BiDiB Accessory Number p - BiDiB Port f - BiDiB Feedback Number (BM) Not a public method since we want to hide this letter, use isPortAddr() or isAccessoryAddr() instead.org.bidib.jbidibc.messages.NodegetNode()Get the BiDiB Node object.byte[]Get the BiDiB Node address.longGet the 40 bit unique ID of the found nodeorg.bidib.jbidibc.messages.enums.LcOutputTypeGet the port type as an LcOutputType object (SWITCHPORT, LIGHTPORT, ...)voidInvalidate this BiDiBAddress by removing the node.booleanCheck if the address is a BiDiB Accessory address.booleanisAddressEqual(BiDiBAddress other) Check address against a BiDiBAddress object.booleanisAddressEqual(org.bidib.jbidibc.messages.BidibPort bidibPort) Check address against a BiDiBAddress object.booleanisAddressEqual(org.bidib.jbidibc.messages.LcConfig lcConfig) Check address against a LcConfig object.booleanisAddressEqual(org.bidib.jbidibc.messages.LcConfigX lcConfigX) Check address against a LcConfigX object.booleanCheck if the address is a BiDiB feedback Number (BM).booleanCheck if the address is a BiDiB Port address (LC)booleanCheck if the object contains an address in the BiDiB type based address model.booleanCheck if the address is a BiDiB track address (i.e. a DCC accessory address).booleanisValid()Check if the object contains a valid BiDiB address The object is invalied the the system is syntactically wrong or if the requested node is not availablestatic booleanisValidAddress(String systemName, char typeLetter, BiDiBSystemConnectionMemo memo) Static method to parse a system Name.static booleanisValidSystemNameFormat(String systemName, char typeLetter, BiDiBSystemConnectionMemo memo) Static method to check system name syntax.org.bidib.jbidibc.messages.BidibPortCreate a BiDiBPort object from this objecttoString()
-
Field Details
-
addrRegex
- See Also:
-
-
Constructor Details
-
BiDiBAddress
Construct from system name - needs prefix and type letter- Parameters:
systemName- the JMRI system name for which the adress object is to be createdtypeLetter- the type letter from the calling manager (T, L, S, R)memo- connection memo object
-
-
Method Details
-
isValidSystemNameFormat
public static boolean isValidSystemNameFormat(String systemName, char typeLetter, BiDiBSystemConnectionMemo memo) Static method to check system name syntax. Does not check if the node is available- Parameters:
systemName- the JMRI system name for which the adress object is to be createdtypeLetter- the type letter from the calling manager (T, L, S, R)memo- connection memo object- Returns:
- true if the system name is syntactically valid.
-
invalidate
Invalidate this BiDiBAddress by removing the node. Used when the node gets lost. -
isValid
Check if the object contains a valid BiDiB address The object is invalied the the system is syntactically wrong or if the requested node is not available- Returns:
- true if valid
-
isPortAddr
Check if the address is a BiDiB Port address (LC)- Returns:
- true if the object represents a BiDiB Port address
-
isAccessoryAddr
Check if the address is a BiDiB Accessory address.- Returns:
- true if the object represents a BiDiB Accessory address
-
isFeedbackAddr
Check if the address is a BiDiB feedback Number (BM).- Returns:
- true if the object represents a BiDiB feedback Number
-
isTrackAddr
Check if the address is a BiDiB track address (i.e. a DCC accessory address).- Returns:
- true if the object represents a BiDiB track address
-
getNodeUID
Get the 40 bit unique ID of the found node- Returns:
- the 40 bit node unique ID
-
getAddr
Get the address inside the node. This may be a DCC address (for DCC-Accessories), an accessory number (for BiDiB accessories) or a port number (for LC ports)- Returns:
- address inside node
-
getAddrString
Get the address as string exactly as given when the instance has been created- Returns:
- address as string
-
getNode
Get the BiDiB Node object. If the node is not available, null is returned.- Returns:
- Node object or null, if node is not available
-
getNodeAddr
Get the BiDiB Node address. If the node is not available, an empty address array is returned. Note: The BiDiB node address is dynamically created address from the BiDiBbus and is not suitable as a node ID. Use the Unique ID for that purpose.- Returns:
- Node address (byte array) or empty address array, if node is not available
-
getPortType
Get the port type as an LcOutputType object (SWITCHPORT, LIGHTPORT, ...)- Returns:
- LcOutputType object
-
getAddrtype
Get the address type as a lowercase single letter: t - DCC address of decoder (t stands for "Track") a - BiDiB Accessory Number p - BiDiB Port f - BiDiB Feedback Number (BM) Not a public method since we want to hide this letter, use isPortAddr() or isAccessoryAddr() instead.- Returns:
- single letter address type
-
isPortTypeBasedModel
Check if the object contains an address in the BiDiB type based address model. Returns false if the address is in the flat address model.- Returns:
- true if address is in the BiDiB type based address model.
-
isAddressEqual
Check address against a BiDiBAddress object.- Parameters:
other- as BiDiBAddress- Returns:
- true if same
-
isAddressEqual
Check address against a LcConfig object.- Parameters:
lcConfig- as LcConfig- Returns:
- true if the address contained in the LcConfig object is the same
-
isAddressEqual
Check address against a LcConfigX object.- Parameters:
lcConfigX- as LcConfig- Returns:
- true if the address contained in the LcConfigX object is the same
-
isAddressEqual
Check address against a BiDiBAddress object.- Parameters:
bidibPort- as BiDiBPort- Returns:
- true if same
-
makeBidibPort
Create a BiDiBPort object from this object- Returns:
- new BiDiBPort object
-
isValidAddress
public static boolean isValidAddress(String systemName, char typeLetter, BiDiBSystemConnectionMemo memo) throws IllegalArgumentException Static method to parse a system Name. A temporary BiDiDAdress object is created.- Parameters:
systemName- the JMRI system name for which the adress object is to be createdtypeLetter- the type letter from the calling manager (T, L, S, R)memo- connection memo object- Returns:
- true if the system name is valid and the BiDiB Node is available
- Throws:
IllegalArgumentException- when needed
-
toString
-