Package jmri.jmrix.can.cbus.node
Class CbusNodeNVManager
java.lang.Object
jmri.jmrix.can.cbus.node.CbusNodeNVManager
Class to manage Node Variables for a CbusNode.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new CbusNodeNVManager -
Method Summary
Modifier and TypeMethodDescriptionintgetNV(int index) Get a specific Node Variableint[]Get the Node Variable int ArrayintgetNvDifference(CbusNode testAgainst) Get number of difference between this and another Nodes Node VariablesGet the NV String in Hex Byte FormatintNumber of unknown Node Variables.intNumber of Node Variables on the node.protected voidreset()Reset this CbusNodeNVManager.protected voidSend a request for the next unknown Node Variable.protected voidLoop 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 booleanGet Flag for if any outstanding Teach NV operations are due.toString()
-
Constructor Details
-
CbusNodeNVManager
Create a new CbusNodeNVManager- Parameters:
node- The Node
-
-
Method Details
-
reset
Reset this CbusNodeNVManager. Array is set to null and NV SendError Count 0. -
teachOutstandingNvs
Get Flag for if any outstanding Teach NV operations are due.- Returns:
- true if outstanding teaches, else false.
-
setNVs
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
-
setNV
Set a single Node Variableso Index 1 is NV1 .. Index 255 is NV255 Index 0 is set by Node Parameter
- Parameters:
index- NV Indexnewnv- min 1, max 255
-
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
-
getTotalNVs
Number of Node Variables on the node.- Returns:
- 0 if number of NV's unknown, else number of NV's.
-
getNV
Get a specific Node Variable- Parameters:
index- NV Index- Returns:
- -1 if NV's unknown, else Node Variable value.
-
getNvDifference
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
-
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.
-
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
-
sendNvsToNode
Send and teach updated Node Variables to this node- Parameters:
newnv- array of variables, index 0 i the array is total variables
-
sendNextNvToNode
Loop for NV teaching -
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
-
toString
-