Package jmri.jmrix.can.cbus.node
Class CbusNodeNVManager
- java.lang.Object
- 
- jmri.jmrix.can.cbus.node.CbusNodeNVManager
 
- 
 public class CbusNodeNVManager extends java.lang.Object Class to manage Node Variables for a CbusNode.
- 
- 
Constructor SummaryConstructors Constructor Description CbusNodeNVManager(CbusBasicNodeWithManagers node)Create a new CbusNodeNVManager
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetNV(int index)Get a specific Node Variableint[]getNvArray()Get the Node Variable int ArrayintgetNvDifference(CbusNode testAgainst)Get number of difference between this and another Nodes Node Variablesjava.lang.StringgetNvHexString()Get the NV String in Hex Byte FormatintgetOutstandingNvCount()Number of unknown Node Variables.intgetTotalNVs()Number of Node Variables on the node.protected voidreset()Reset this CbusNodeNVManager.protected voidsendNextNVToFetch()Send a request for the next unknown Node Variable.protected voidsendNextNvToNode()Loop for NV teachingvoidsendNvsToNode(int[] newnv)Send and teach updated Node Variables to this nodevoidsetNV(int index, int newnv)Set a single Node VariablevoidsetNVs(int[] newnvs)Set the Node Variablesprotected booleanteachOutstandingNvs()Get Flag for if any outstanding Teach NV operations are due.java.lang.StringtoString()
 
- 
- 
- 
Constructor Detail- 
CbusNodeNVManagerpublic CbusNodeNVManager(CbusBasicNodeWithManagers node) Create a new CbusNodeNVManager- Parameters:
- node- The Node
 
 
- 
 - 
Method Detail- 
resetprotected void reset() Reset this CbusNodeNVManager. Array is set to null and NV SendError Count 0.
 - 
teachOutstandingNvsprotected boolean teachOutstandingNvs() Get Flag for if any outstanding Teach NV operations are due.- Returns:
- true if outstanding teaches, else false.
 
 - 
setNVspublic void setNVs(@Nonnull int[] newnvs) Set the Node Variables0th NV is total NVs so length of newnvs should already be num. of NV's +1 - Parameters:
- newnvs- an int array, the first value being the total number
 
 - 
setNVpublic void setNV(int index, int newnv) Set a single Node Variableso Index 1 is NV1 .. Index 255 is NV255 Index 0 is set by Node Parameter - Parameters:
- index- NV Index
- newnv- min 1, max 255
 
 - 
getNvArraypublic int[] getNvArray() Get the Node Variable int Array0th Index is total NVs so Index 1 is NV1 .. Index 255 is NV255 - Returns:
- Array of NV's, first in index is Total NV's
 
 - 
getTotalNVspublic int getTotalNVs() Number of Node Variables on the node.- Returns:
- 0 if number of NV's unknown, else number of NV's.
 
 - 
getNVpublic int getNV(int index) Get a specific Node Variable- Parameters:
- index- NV Index
- Returns:
- -1 if NV's unknown, else Node Variable value.
 
 - 
getNvDifferencepublic int getNvDifference(CbusNode testAgainst) Get number of difference between this and another Nodes Node Variables- Parameters:
- testAgainst- The CBUS Node to test against
- Returns:
- number of different NV's
 
 - 
getOutstandingNvCountpublic int getOutstandingNvCount() Number of unknown Node Variables. i.e. not yet fetched from a physical node.- Returns:
- -1 if number of NV's unknown, 0 if all NV's known, else number of outstanding.
 
 - 
sendNextNVToFetchprotected void sendNextNVToFetch() Send a request for the next unknown Node Variable.Only triggered from CBUS Node Manager. Does NOT send if the node has existing outstanding requests. Expected response from node NVANS 
 - 
sendNvsToNodepublic void sendNvsToNode(int[] newnv) Send and teach updated Node Variables to this node- Parameters:
- newnv- array of variables, index 0 i the array is total variables
 
 - 
sendNextNvToNodeprotected void sendNextNvToNode() Loop for NV teaching
 - 
getNvHexStringpublic java.lang.String getNvHexString() Get the NV String in Hex Byte Formateg. for NV array [3,1,2,255] returns "0102FF" - Returns:
- Full NV String WITHOUT leading number of NVs
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
- Returns:
- descriptive string
 
 
- 
 
-