Class LnDplxGrpInfoImpl
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- jmri.jmrix.loconet.duplexgroup.swing.LnDplxGrpInfoImpl
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,LocoNetListener
public class LnDplxGrpInfoImpl extends javax.swing.JComponent implements LocoNetListener
Provides a low-level interface to Digitrax Duplex Group Identity information.Implements the following "Property Change" events, which are defined as static strings in
LnDplxGrpInfoImplConstants
:- DPLX_PC_STAT_LN_UPDATE - Indicates that a GUI status line could be updated using provided string.
- DPLX_PC_STAT_LN_UPDATE_IF_NOT_CURRENTLY_ERROR - Indicates that a GUI status line could be updated using the provided string UNLESS the status line is currently showing an error.
- NumberOfUr92sUpdate - Indicates that the class has counted the number of UR92 devices
- DPLX_PC_NAME_UPDATE - Indicates that a LocoNet message has reported the Duplex Group Name
- DPLX_PC_CHANNEL_UPDATE - Indicates that a LocoNet message has reported the Duplex Group Channel
- DPLX_PC_PASSWORD_UPDATE - Indicates that a LocoNet message has reported the Duplex Group Password
- DPLX_PC_ID_UPDATE - Indicates that a LocoNet message has reported the Duplex Group Id
- DPLX_PC_NAME_VALIDITY - Indicates that the validity of GUI field showing the Duplex Group Name should be changed. NewValue() is true if a valid Duplex Group Name is available; is false if the Duplex Group Name should be considered invalid.
- DPLX_PC_CHANNEL_VALIDITY - Indicates that the validity of GUI field showing the Duplex Group Channel should be changed. NewValue() is true if a valid Duplex Group Channel is available; is false if the Duplex Group Channel should be considered invalid.
- DPLX_PC_PASSWORD_VALIDITY - Indicates that the validity of GUI field showing the Duplex Group Password should be changed. NewValue() is true if a valid Duplex Group Password is available; is false if the Duplex Group Password should be considered invalid.
- DPLX_PC_ID_VALIDITY - Indicates that the validity of GUI field showing the Duplex Group Id should be changed. NewValue() is true if a valid Duplex Group Id is available; is false if the Duplex Group Id should be considered invalid.
- DPLX_PC_RCD_DPLX_IDENTITY_QUERY - Indicates that a LocoNet message which queries the Duplex Group identity has been received.
- DPLX_PC_RCD_DPLX_IDENTITY_REPORT - Indicates that a LocoNet message which reports the Duplex Group identity has been received.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
LnDplxGrpInfoImpl.BasicIPLDeviceInfo
protected static class
LnDplxGrpInfoImpl.BasicIPLDeviceResponseInfo
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DPLX_IPL_DEVICE_DETAILS
static java.lang.String
DPLX_IPL_DEVICE_RESPONSE_DETAILS
static java.lang.String
DPLX_PC_CHANNEL_UPDATE
static java.lang.String
DPLX_PC_CHANNEL_VALIDITY
static java.lang.String
DPLX_PC_ID_UPDATE
static java.lang.String
DPLX_PC_ID_VALIDITY
static java.lang.String
DPLX_PC_NAME_UPDATE
static java.lang.String
DPLX_PC_NAME_VALIDITY
static java.lang.String
DPLX_PC_PASSWORD_UPDATE
static java.lang.String
DPLX_PC_PASSWORD_VALIDITY
static java.lang.String
DPLX_PC_RCD_DPLX_IDENTITY_QUERY
static java.lang.String
DPLX_PC_RCD_DPLX_IDENTITY_REPORT
static java.lang.String
DPLX_PC_STAT_LN_UPDATE
static java.lang.String
DPLX_PC_STAT_LN_UPDATE_IF_NOT_CURRENTLY_ERROR
(package private) static boolean
limitPasswordToNumericCharacters
(package private) LnDplxGrpInfoImpl
thisone
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description LnDplxGrpInfoImpl(LocoNetSystemConnectionMemo LNCMemo)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect(LnTrafficController t)
Connect this instance's LocoNetListener to the LocoNet Traffic Controllervoid
countUr92sAndQueryDuplexIdentityInfo()
Begins a sequence which includes counting available UR92s and similar and, if at least one UR92/UR93/LNWI is present, reads the Duplex Group Identity Info.static LocoNetMessage
createSetUr92GroupChannelPacket(java.lang.Integer iChannelNumber)
Create a LocoNet packet to set the Duplex group channel number.static LocoNetMessage
createSetUr92GroupIDPacket(java.lang.String s)
Create a LocoNet packet to set the Duplex group ID number.static LocoNetMessage
createSetUr92GroupNamePacket(java.lang.String sGroupName)
Create a LocoNet packet to set the Duplex group name.static LocoNetMessage
createSetUr92GroupPasswordPacket(java.lang.String sGroupPassword)
Create a LocoNet packet to set the Duplex group password.static LocoNetMessage
createUr92GroupChannelReportPacket(int dupChan)
static LocoNetMessage
createUr92GroupIdentityQueryPacket()
Create a LocoNet packet which queries UR92(s) for Duplex group identification information.static LocoNetMessage
createUr92GroupIdReportPacket(int dupId)
static LocoNetMessage
createUr92GroupNameReportPacket(java.lang.String dupName, java.lang.String dupPass, int dupChan, int dupId)
static LocoNetMessage
createUr92GroupPasswordReportPacket(java.lang.String dupPass)
void
dispose()
Break connection with the LnTrafficController and stop timers.static int
extractDuplexGroupChannel(LocoNetMessage m)
Checks that m is a message with a Duplex Group Channel encoded inside, then extracts and returns the Duplex Group Channel.static int
extractDuplexGroupID(LocoNetMessage m)
Checks that m is a message with a Duplex Group ID encoded inside, then extracts and returns the Duplex Group ID.static java.lang.String
extractDuplexGroupName(LocoNetMessage m)
Checks that m is a message with a Duplex Group Name encoded inside, then extracts the Duplex Group Name.static java.lang.String
extractDuplexGroupPassword(LocoNetMessage m)
Checks that m is a message with a Duplex Group Password encoded inside, then extracts and returns the Duplex Group Password.static DuplexGroupMessageType
getDuplexGroupIdentityMessageType(LocoNetMessage m)
Classifies a LocoNet Message to see if it is a Duplex Group Identity messagejava.lang.String
getFetchedDuplexGroupChannel()
java.lang.String
getFetchedDuplexGroupId()
java.lang.String
getFetchedDuplexGroupName()
java.lang.String
getFetchedDuplexGroupPassword()
int
getMessagesHandled()
Reports the number of LocoNet messages handled since object construction.int
getNumUr92s()
Reports the number of UR92 devices which responded to the most-recent LocoNet IPL query of UR92 devices.boolean
isAwaitingDuplexGroupReportMessage()
Reports whether this object is currently waiting for Duplex Group Name, etc.static boolean
isDuplexGroupMessage(LocoNetMessage m)
Checks message m to determine if it contains a Duplex Group Identity message, including queries, reports, and writes, for Name, Channel, Password, and ID.boolean
isDuplexGroupQueryRunning()
Reports whether the Duplex Group Info query timer is running.boolean
isIplQueryTimerRunning()
Reports whether the IPL query timer is running.static boolean
isPasswordLimitedToNumbers()
Report whether Duplex Group Password must only be numeric, or if Password is allowed to include characters 'A', 'B', and/or 'C'.boolean
isWaitingForFirstUr92IPLReport()
Reports whether this class is currently waiting for the first UR92 LocoNet IPL Device Report messages in response to a LocoNet IPL Device Query for UR92s sent by this class.void
message(LocoNetMessage m)
Process all incoming LocoNet messages to look for Duplex Group information operations.void
queryDuplexGroupIdentity()
Sends a LocoNet Message to query the Duplex Group Identity.void
setDuplexGroupChannel(java.lang.Integer dgc)
Creates and sends a LocoNet message which sets the Duplex Group Channel.void
setDuplexGroupId(java.lang.String dgi)
Creates and sends a LocoNet message which sets the Duplex Group Id.void
setDuplexGroupName(java.lang.String dgn)
Creates and sends a LocoNet message which sets the Duplex Group Name.void
setDuplexGroupPassword(java.lang.String dgp)
Creates and sends a LocoNet message which sets the Duplex Group Password.static boolean
validateGroupChannel(java.lang.Integer iGroupChannel)
Validate a Duplex Group Channel Number.static boolean
validateGroupID(java.lang.Integer iGroupId)
Validate the parameter as a Duplex Group ID number.static boolean
validateGroupName(java.lang.String sGroupName)
Validate a Duplex Group Name.static boolean
validateGroupPassword(java.lang.String sGroupPassword)
Validate a Duplex Group Password.-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
limitPasswordToNumericCharacters
static boolean limitPasswordToNumericCharacters
-
thisone
LnDplxGrpInfoImpl thisone
-
DPLX_PC_STAT_LN_UPDATE
public static final java.lang.String DPLX_PC_STAT_LN_UPDATE
- See Also:
- Constant Field Values
-
DPLX_PC_STAT_LN_UPDATE_IF_NOT_CURRENTLY_ERROR
public static final java.lang.String DPLX_PC_STAT_LN_UPDATE_IF_NOT_CURRENTLY_ERROR
- See Also:
- Constant Field Values
-
DPLX_PC_NAME_VALIDITY
public static final java.lang.String DPLX_PC_NAME_VALIDITY
- See Also:
- Constant Field Values
-
DPLX_PC_CHANNEL_VALIDITY
public static final java.lang.String DPLX_PC_CHANNEL_VALIDITY
- See Also:
- Constant Field Values
-
DPLX_PC_PASSWORD_VALIDITY
public static final java.lang.String DPLX_PC_PASSWORD_VALIDITY
- See Also:
- Constant Field Values
-
DPLX_PC_ID_VALIDITY
public static final java.lang.String DPLX_PC_ID_VALIDITY
- See Also:
- Constant Field Values
-
DPLX_PC_NAME_UPDATE
public static final java.lang.String DPLX_PC_NAME_UPDATE
- See Also:
- Constant Field Values
-
DPLX_PC_CHANNEL_UPDATE
public static final java.lang.String DPLX_PC_CHANNEL_UPDATE
- See Also:
- Constant Field Values
-
DPLX_PC_PASSWORD_UPDATE
public static final java.lang.String DPLX_PC_PASSWORD_UPDATE
- See Also:
- Constant Field Values
-
DPLX_PC_ID_UPDATE
public static final java.lang.String DPLX_PC_ID_UPDATE
- See Also:
- Constant Field Values
-
DPLX_PC_RCD_DPLX_IDENTITY_QUERY
public static final java.lang.String DPLX_PC_RCD_DPLX_IDENTITY_QUERY
- See Also:
- Constant Field Values
-
DPLX_PC_RCD_DPLX_IDENTITY_REPORT
public static final java.lang.String DPLX_PC_RCD_DPLX_IDENTITY_REPORT
- See Also:
- Constant Field Values
-
DPLX_IPL_DEVICE_DETAILS
public static final java.lang.String DPLX_IPL_DEVICE_DETAILS
- See Also:
- Constant Field Values
-
DPLX_IPL_DEVICE_RESPONSE_DETAILS
public static final java.lang.String DPLX_IPL_DEVICE_RESPONSE_DETAILS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LnDplxGrpInfoImpl
public LnDplxGrpInfoImpl(LocoNetSystemConnectionMemo LNCMemo)
-
-
Method Detail
-
isPasswordLimitedToNumbers
public static final boolean isPasswordLimitedToNumbers()
Report whether Duplex Group Password must only be numeric, or if Password is allowed to include characters 'A', 'B', and/or 'C'.- Returns:
- true if Password may only include digits.
-
validateGroupName
public static final boolean validateGroupName(java.lang.String sGroupName)
Validate a Duplex Group Name.A valid Duplex Group Name is an 8 character string. The calling method should append spaces or truncate to give correct length if necessary.
- Parameters:
sGroupName
- string containing group name to be validated- Returns:
- true if and only if groupName is a valid Duplex Group Name
-
validateGroupPassword
public static final boolean validateGroupPassword(java.lang.String sGroupPassword)
Validate a Duplex Group Password.Note that the password must be four digits if only numeric values are allowed, or must be four characters, each of pattern [0-9A-C] if alphanumeric values are allowed. (See private field limitPasswordToNumericCharacters.)
- Parameters:
sGroupPassword
- Duplex Group Password to be validated- Returns:
- true if and only if sGroupPassword is a valid Duplex Group Password.
-
validateGroupChannel
public static final boolean validateGroupChannel(java.lang.Integer iGroupChannel)
Validate a Duplex Group Channel Number.- Parameters:
iGroupChannel
- Duplex Group Channel number to be validated- Returns:
- true if and only if iGroupChannel is a valid Duplex Group Channel.
-
validateGroupID
public static final boolean validateGroupID(java.lang.Integer iGroupId)
Validate the parameter as a Duplex Group ID number.- Parameters:
iGroupId
- Duplex Group ID number to be validated- Returns:
- true if and only if iGroupId is a valid Duplex Group ID.
-
createUr92GroupIdentityQueryPacket
public static final LocoNetMessage createUr92GroupIdentityQueryPacket()
Create a LocoNet packet which queries UR92(s) for Duplex group identification information. The invoking method is responsible for sending the message to LocoNet.- Returns:
- LocoNetMessage containing IPL query of UR92s
-
createSetUr92GroupNamePacket
public static final LocoNetMessage createSetUr92GroupNamePacket(java.lang.String sGroupName) throws LocoNetException
Create a LocoNet packet to set the Duplex group name.Throws an exception if s provides a 0-length group name string. If s is too short, it is padded with spaces at the end of the string.
- Parameters:
sGroupName
- is the desired group name value as a string- Returns:
- The LocoNet packet which writes the Group Name to the UR92 device(s)
- Throws:
LocoNetException
- if sGroupName is not a valid Duplex Group Name
-
createSetUr92GroupChannelPacket
public static final LocoNetMessage createSetUr92GroupChannelPacket(java.lang.Integer iChannelNumber) throws LocoNetException
Create a LocoNet packet to set the Duplex group channel number.If s provides a 0-length group name, a bogus LocoNet message is returned. If s does not define an integer is too short, it is padded with spaces at the end of the string.
- Parameters:
iChannelNumber
- The desired group channel number value as an integer- Returns:
- The packet which writes the Group Channel Number to the UR92 device(s)
- Throws:
LocoNetException
- if sGroupName is not a valid Duplex Group Name
-
createSetUr92GroupPasswordPacket
public static final LocoNetMessage createSetUr92GroupPasswordPacket(java.lang.String sGroupPassword) throws LocoNetException
Create a LocoNet packet to set the Duplex group password.If s provides anything other than a 4 character length group password which uses only valid group ID characters (0-9, A-C), a bogus LocoNet message is returned.
- Parameters:
sGroupPassword
- The desired group password as a string- Returns:
- The packet which writes the Group Password to the UR92 device(s)
- Throws:
LocoNetException
- in case of invalid sGrooupPassword
-
createSetUr92GroupIDPacket
public static final LocoNetMessage createSetUr92GroupIDPacket(java.lang.String s) throws LocoNetException
Create a LocoNet packet to set the Duplex group ID number.If s provides anything other than a numeric value between 0 and 127, a LocoNetException is thrown.
- Parameters:
s
- The desired group ID number as a string- Returns:
- The packet which writes the Group ID Number to the UR92 device(s)
- Throws:
LocoNetException
- when an invalid id is provided
-
isDuplexGroupMessage
public static final boolean isDuplexGroupMessage(LocoNetMessage m)
Checks message m to determine if it contains a Duplex Group Identity message, including queries, reports, and writes, for Name, Channel, Password, and ID.- Parameters:
m
- LocoNet message to check- Returns:
- true if message is query, report, or write of Duplex Group Name, Channel, Password or ID
-
getDuplexGroupIdentityMessageType
public static final DuplexGroupMessageType getDuplexGroupIdentityMessageType(LocoNetMessage m)
Classifies a LocoNet Message to see if it is a Duplex Group Identity message- Parameters:
m
- a LocoNetMessage- Returns:
- DuplexGroupMessageType, encoded as one of the following NOT_A_DUPLEX_GROUP_MESSAGE DUPLEX_GROUP_CHANNEL_QUERY_MESSAGE DUPLEX_GROUP_CHANNEL_REPORT_MESSAGE DUPLEX_GROUP_CHANNEL_WRITE_MESSAGE DUPLEX_GROUP_NAME_QUERY_MESSAGE DUPLEX_GROUP_NAME_ETC_REPORT_MESSAGE DUPLEX_GROUP_NAME_WRITE_MESSAGE DUPLEX_GROUP_PASSWORD_QUERY_MESSAGE DUPLEX_GROUP_PASSWORD_REPORT_MESSAGE DUPLEX_GROUP_PASSWORD_WRITE_MESSAGE DUPLEX_GROUP_ID_QUERY_MESSAGE DUPLEX_GROUP_ID_REPORT_MESSAGE DUPLEX_GROUP_ID_WRITE_MESSAGE
-
extractDuplexGroupName
public static java.lang.String extractDuplexGroupName(LocoNetMessage m)
Checks that m is a message with a Duplex Group Name encoded inside, then extracts the Duplex Group Name. Note that the returned string is always 8 characters long.If m does not contain a Duplex Group Name, returns null.
- Parameters:
m
- LocoNet message from which a Duplex Group Name is to be extracted.- Returns:
- String containing Duplex Group Name as extracted from m
-
extractDuplexGroupChannel
public static int extractDuplexGroupChannel(LocoNetMessage m)
Checks that m is a message with a Duplex Group Channel encoded inside, then extracts and returns the Duplex Group Channel.Returns -1 if the m does not contain a Duplex Group Channel.
- Parameters:
m
- LocoNet message from which a Duplex Group Channel number will be extracted- Returns:
- Integer containing Duplex Group Name as extracted from m
-
extractDuplexGroupID
public static int extractDuplexGroupID(LocoNetMessage m)
Checks that m is a message with a Duplex Group ID encoded inside, then extracts and returns the Duplex Group ID.Returns -1 if the m does not contain a Duplex Group ID.
- Parameters:
m
- LocoNet message from which a Duplex Group ID will be extracted- Returns:
- Integer containing Duplex Group Name as extracted from m
-
extractDuplexGroupPassword
public static java.lang.String extractDuplexGroupPassword(LocoNetMessage m)
Checks that m is a message with a Duplex Group Password encoded inside, then extracts and returns the Duplex Group Password.Returns null if the m does not contain a Duplex Group Password.
- Parameters:
m
- LocoNet message to be checked for a duplex group password message- Returns:
- String containing the Duplex Group Password as extracted from m
-
message
public void message(LocoNetMessage m)
Process all incoming LocoNet messages to look for Duplex Group information operations. Only pays attention to LocoNet report of Duplex Group Name/password/channel/groupID, and ignores all other LocoNet messages.If tool has sent a query for Duplex group information and has not yet received a Duplex group report, the method updates the GUI with the received information.
If the tool is not currently waiting for a response to a query, then the method compares the received information against the information currently displayed in the GUI. If the received information does not match, a message is displayed on the status line in the GUI, else nothing is displayed in the GUI status line.
- Specified by:
message
in interfaceLocoNetListener
- Parameters:
m
- The received LocoNet message. Note that this same object may be presented to multiple users. It should not be modified here.
-
getFetchedDuplexGroupName
public java.lang.String getFetchedDuplexGroupName()
- Returns:
- String containing reported Duplex Group Name
-
getFetchedDuplexGroupChannel
public java.lang.String getFetchedDuplexGroupChannel()
- Returns:
- String containing reported Duplex Group Name
-
getFetchedDuplexGroupPassword
public java.lang.String getFetchedDuplexGroupPassword()
- Returns:
- String containing reported Duplex Group Name
-
getFetchedDuplexGroupId
public java.lang.String getFetchedDuplexGroupId()
- Returns:
- String containing reported Duplex Group Name
-
queryDuplexGroupIdentity
public void queryDuplexGroupIdentity()
Sends a LocoNet Message to query the Duplex Group Identity. Starts a timer to monitor completion.
-
setDuplexGroupName
public void setDuplexGroupName(java.lang.String dgn) throws LocoNetException
Creates and sends a LocoNet message which sets the Duplex Group Name.- Parameters:
dgn
- String containing the new Duplex Group Name- Throws:
LocoNetException
- if dgn is not a valid Duplex Group Name.
-
setDuplexGroupChannel
public void setDuplexGroupChannel(java.lang.Integer dgc) throws LocoNetException
Creates and sends a LocoNet message which sets the Duplex Group Channel.- Parameters:
dgc
- Integer containing the new Duplex Group Channel- Throws:
LocoNetException
- if dgc is not a valid Duplex Group Channel number.
-
setDuplexGroupPassword
public void setDuplexGroupPassword(java.lang.String dgp) throws LocoNetException
Creates and sends a LocoNet message which sets the Duplex Group Password.- Parameters:
dgp
- String containing the new Duplex Group Password- Throws:
LocoNetException
- if dgp is not a valid Duplex Group Password.
-
setDuplexGroupId
public void setDuplexGroupId(java.lang.String dgi) throws LocoNetException
Creates and sends a LocoNet message which sets the Duplex Group Id.- Parameters:
dgi
- String containing the new Duplex Group Id- Throws:
LocoNetException
- if dgi is not a valid Duplex Group Id.
-
countUr92sAndQueryDuplexIdentityInfo
public void countUr92sAndQueryDuplexIdentityInfo()
Begins a sequence which includes counting available UR92s and similar and, if at least one UR92/UR93/LNWI is present, reads the Duplex Group Identity Info.
-
createUr92GroupNameReportPacket
public static final LocoNetMessage createUr92GroupNameReportPacket(java.lang.String dupName, java.lang.String dupPass, int dupChan, int dupId)
-
createUr92GroupChannelReportPacket
public static final LocoNetMessage createUr92GroupChannelReportPacket(int dupChan)
-
createUr92GroupPasswordReportPacket
public static final LocoNetMessage createUr92GroupPasswordReportPacket(java.lang.String dupPass)
-
createUr92GroupIdReportPacket
public static final LocoNetMessage createUr92GroupIdReportPacket(int dupId)
-
getNumUr92s
public int getNumUr92s()
Reports the number of UR92 devices which responded to the most-recent LocoNet IPL query of UR92 devices.Note that code should ignore the value returned by this method if isWaitingForUr92DeviceReports() is true;
- Returns:
- the number of UR92 devices which reported in response to the LocoNet IPL device query which is sent by this class.
-
isWaitingForFirstUr92IPLReport
public boolean isWaitingForFirstUr92IPLReport()
Reports whether this class is currently waiting for the first UR92 LocoNet IPL Device Report messages in response to a LocoNet IPL Device Query for UR92s sent by this class.- Returns:
- true if the class is waiting for LocoNet IPL reply messages, else false.
-
getMessagesHandled
public int getMessagesHandled()
Reports the number of LocoNet messages handled since object construction.- Returns:
- the number of LocoNet messages since this object was constructed.
-
isIplQueryTimerRunning
public boolean isIplQueryTimerRunning()
Reports whether the IPL query timer is running.- Returns:
- true if the timer is running, else false.
-
isDuplexGroupQueryRunning
public boolean isDuplexGroupQueryRunning()
Reports whether the Duplex Group Info query timer is running.- Returns:
- true if the timer is running, else false.
-
isAwaitingDuplexGroupReportMessage
public boolean isAwaitingDuplexGroupReportMessage()
Reports whether this object is currently waiting for Duplex Group Name, etc. Report message.- Returns:
- true if currently waiting, else false
-
connect
public void connect(LnTrafficController t)
Connect this instance's LocoNetListener to the LocoNet Traffic Controller- Parameters:
t
- LocoNet traffic controller
-
dispose
public void dispose()
Break connection with the LnTrafficController and stop timers.
-
-