Package jmri.jmrix.can.cbus.node
Class CbusBasicNode
- java.lang.Object
-
- jmri.jmrix.can.cbus.node.CbusBasicNode
-
- Direct Known Subclasses:
CbusBasicNodeWithManagers
public class CbusBasicNode extends java.lang.Object
Class to represent a node.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.CopyOnWriteArraySet<java.beans.PropertyChangeListener>
_listeners
protected CanSystemConnectionMemo
_memo
CbusSend
send
-
Constructor Summary
Constructors Constructor Description CbusBasicNode(CanSystemConnectionMemo connmemo, int nodenumber)
Create a new CbusBasicNodeWithChangeListener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPropertyChangeListener(java.beans.PropertyChangeListener l)
Register for notification if any of the properties change.CanSystemConnectionMemo
getMemo()
int
getNodeCanId()
Get the Node CAN ID.boolean
getNodeInFLiMMode()
Get if the Node is in FLiM Mode.boolean
getNodeInLearnMode()
Get if the Node is in Learn Mode.boolean
getNodeInSetupMode()
Get if this Node is in Setup Mode.int
getNodeNumber()
Returns Node Number.protected void
notifyPropertyChangeListener(java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)
Trigger the notification of Node PropertyChangeListeners.void
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove notification listener.void
setCanId(int newcanid)
Set Node CAN ID.void
setCanId(CanSystemConnectionMemo memo)
Set CAN ID by System Connection.void
setNodeInFLiMMode(boolean inFlimMode)
Set if the Node is in FLiM Mode.void
setNodeInLearnMode(boolean inlearnmode)
Set if the Node is in Learn Mode.void
setNodeInSetupMode(boolean setup)
Set flag for this Node in Setup Mode.void
setNodeNumber(int newnumber)
Set Node Number.
-
-
-
Field Detail
-
_memo
protected CanSystemConnectionMemo _memo
-
_listeners
protected final java.util.concurrent.CopyOnWriteArraySet<java.beans.PropertyChangeListener> _listeners
-
-
Constructor Detail
-
CbusBasicNode
public CbusBasicNode(@CheckForNull CanSystemConnectionMemo connmemo, int nodenumber)
Create a new CbusBasicNodeWithChangeListener.- Parameters:
connmemo
- The CAN Connection to usenodenumber
- The Node Number
-
-
Method Detail
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Register for notification if any of the properties change.- Parameters:
l
- The Listener to attach to Node
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove notification listener.- Parameters:
l
- Listener to remove
-
notifyPropertyChangeListener
protected void notifyPropertyChangeListener(java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)
Trigger the notification of Node PropertyChangeListeners. Properties include PARAMETER, BACKUPS, SINGLENVUPDATE ( newValue NV index (0 is NV1, 5 is NV6) ) ALLNVUPDATE SINGLEEVUPDATE ( newValue event row ) ALLEVUPDATE DELETEEVCOMPLETE ( newValue Error String else empty String ) ADDEVCOMPLETE ( newValue Error String else null ) ADDALLEVCOMPLETE ( Event Teach Loop Completed, newValue error count ) TEACHNVCOMPLETE ( newValue error count ) NAMECHANGE- Parameters:
property
- Node propertyoldValue
- Old ValuenewValue
- New Value
-
getNodeNumber
public int getNodeNumber()
Returns Node Number.- Returns:
- Node Number,1-65535
-
setNodeNumber
public void setNodeNumber(int newnumber)
Set Node Number.- Parameters:
newnumber
- Node Number, should be 1-65535
-
setCanId
public final void setCanId(int newcanid)
Set Node CAN ID.- Parameters:
newcanid
- CAN ID of the node
-
setCanId
public final void setCanId(CanSystemConnectionMemo memo)
Set CAN ID by System Connection.Leaves unchanged if no System Connection or Traffic Controller.
- Parameters:
memo
- System Connection of the Node.
-
getNodeCanId
public int getNodeCanId()
Get the Node CAN ID. min 1 , ( max 128? )- Returns:
- CAN ID of the node, default 1.
-
setNodeInSetupMode
public void setNodeInSetupMode(boolean setup)
Set flag for this Node in Setup Mode.Does NOT send instruction to actual node
- Parameters:
setup
- use true if in Setup, else false
-
getNodeInSetupMode
public boolean getNodeInSetupMode()
Get if this Node is in Setup Mode.- Returns:
- true if in Setup, else false
-
setNodeInLearnMode
public void setNodeInLearnMode(boolean inlearnmode)
Set if the Node is in Learn Mode. Used to track node status, does NOT update Physical Node- Parameters:
inlearnmode
- set true if in Learn else false
-
getNodeInLearnMode
public boolean getNodeInLearnMode()
Get if the Node is in Learn Mode.Defaults to false if unset
- Returns:
- true if in Learn else false
-
setNodeInFLiMMode
public void setNodeInFLiMMode(boolean inFlimMode)
Set if the Node is in FLiM Mode.Defaults to true if unset
- Parameters:
inFlimMode
- set true if in FlIM else false
-
getNodeInFLiMMode
public boolean getNodeInFLiMMode()
Get if the Node is in FLiM Mode.Defaults to true if unset
- Returns:
- true if in FlIM else false
-
getMemo
public CanSystemConnectionMemo getMemo()
-
-