Class CbusNodeNVManager


  • public class CbusNodeNVManager
    extends java.lang.Object
    Class to manage Node Variables for a CbusNode.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getNV​(int index)
      Get a specific Node Variable
      int[] getNvArray()
      Get the Node Variable int Array
      int getNvDifference​(CbusNode testAgainst)
      Get number of difference between this and another Nodes Node Variables
      java.lang.String getNvHexString()
      Get the NV String in Hex Byte Format
      int getOutstandingNvCount()
      Number of unknown Node Variables.
      int getTotalNVs()
      Number of Node Variables on the node.
      protected void reset()
      Reset this CbusNodeNVManager.
      protected void sendNextNVToFetch()
      Send a request for the next unknown Node Variable.
      protected void sendNextNvToNode()
      Loop for NV teaching
      void sendNvsToNode​(int[] newnv)
      Send and teach updated Node Variables to this node
      void setNV​(int index, int newnv)
      Set a single Node Variable
      void setNVs​(int[] newnvs)
      Set the Node Variables
      protected boolean teachOutstandingNvs()
      Get Flag for if any outstanding Teach NV operations are due.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • reset

        protected void reset()
        Reset this CbusNodeNVManager. Array is set to null and NV SendError Count 0.
      • teachOutstandingNvs

        protected boolean teachOutstandingNvs()
        Get Flag for if any outstanding Teach NV operations are due.
        Returns:
        true if outstanding teaches, else false.
      • setNVs

        public void setNVs​(@Nonnull
                           int[] newnvs)
        Set the Node Variables

        0th 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

        public void setNV​(int index,
                          int newnv)
        Set a single Node Variable

        so Index 1 is NV1 .. Index 255 is NV255 Index 0 is set by Node Parameter

        Parameters:
        index - NV Index
        newnv - min 1, max 255
      • getNvArray

        public int[] getNvArray()
        Get the Node Variable int Array

        0th 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

        public int getTotalNVs()
        Number of Node Variables on the node.
        Returns:
        0 if number of NV's unknown, else number of NV's.
      • getNV

        public int getNV​(int index)
        Get a specific Node Variable
        Parameters:
        index - NV Index
        Returns:
        -1 if NV's unknown, else Node Variable value.
      • getNvDifference

        public 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
      • getOutstandingNvCount

        public 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.
      • sendNextNVToFetch

        protected 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

      • sendNvsToNode

        public 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
      • getNvHexString

        public java.lang.String getNvHexString()
        Get the NV String in Hex Byte Format

        eg. for NV array [3,1,2,255] returns "0102FF"

        Returns:
        Full NV String WITHOUT leading number of NVs
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        descriptive string