Class ChannelWrapper


  • public class ChannelWrapper
    extends Object
    A class that wraps a bit of additional functionality to the Channel class
    Author:
    yngvelevinsen
    • Constructor Detail

      • ChannelWrapper

        public ChannelWrapper​(xal.ca.Channel chan)
        Construct a new object from the Channel given, as well as connecting to it
        Parameters:
        chan - the channel to connect to
      • ChannelWrapper

        public ChannelWrapper​(xal.ca.Channel chan,
                              boolean tryConnect)
        Construct a new object from the Channel given, as well as connecting to it
        Parameters:
        chan - the channel to connect to
        tryConnect - attempt to connect to channel
      • ChannelWrapper

        public ChannelWrapper​(xal.smf.AcceleratorNode node,
                              String handle)
        Construct a new wrapper from the given node and handle. Used by PVTree Will not try to connect to channel (assumed orgnised outside)
        Parameters:
        node - The node handle belongs to
        handle - The name of the handle
      • ChannelWrapper

        public ChannelWrapper​(xal.ca.Channel chan,
                              xal.smf.AcceleratorNode node,
                              boolean tryConnect)
        Construct a new object from the Channel given, as well as connecting to it
        Parameters:
        chan - the channel to connect to
        node - the node channel belongs to
        tryConnect - attempt to connect to channel
    • Method Detail

      • putVal

        public void putVal​(double value,
                           double timeout)
                    throws xal.ca.PutException,
                           xal.ca.MonitorException
        Set value of the channel. If a node is known, and node has a readback channel, then the readback will be monitored with a currently hard-coded 1% error.
        Parameters:
        value - The new value to set
        timeout - Timeout if readback changes too slowly
        Throws:
        xal.ca.ConnectionException - If there was a connection issue
        xal.ca.PutException - If the new value was not successfully set
        xal.ca.MonitorException - If there was an issue with the channel monitor
      • putVal

        public void putVal​(double value)
                    throws xal.ca.PutException,
                           xal.ca.MonitorException
        Send a new value to the PV
        Parameters:
        value - The new value
        Throws:
        xal.ca.ConnectionException - if there is a problem with the connection
        xal.ca.PutException - if the new value cannot be set
        xal.ca.MonitorException - if there is a problem with the PV monitor
      • idProperty

        public javafx.beans.property.StringProperty idProperty()
        Returns:
        The channel ID/name
      • instanceProperty

        public javafx.beans.property.SimpleStringProperty instanceProperty()
        Returns:
        Unique number that identifies the object
      • unitProperty

        public javafx.beans.property.StringProperty unitProperty()
        Returns:
        The unit for this channel
      • typeProperty

        public javafx.beans.property.StringProperty typeProperty()
        Returns:
        Writeable or only readable
      • isScannedProperty

        public javafx.beans.property.SimpleBooleanProperty isScannedProperty()
        Set to true if this channel is selected to be scanned (ie is active)
        Returns:
        true if channel will be scanned
      • isReadProperty

        public javafx.beans.property.SimpleBooleanProperty isReadProperty()
        Set to true if this channel is selected to be read (ie is active)
        Returns:
        true if channel will be read
      • startProperty

        public javafx.beans.property.SimpleDoubleProperty startProperty()
        Returns:
        Start value when scanned
      • endProperty

        public javafx.beans.property.SimpleDoubleProperty endProperty()
        Returns:
        End value when scanned
      • refProperty

        public javafx.beans.property.SimpleDoubleProperty refProperty()
        The initial/reference value of this channel (i.e. the value it had when it was loaded into the application by default)
        Returns:
        The initial/reference value of this channel
      • numPointsProperty

        public javafx.beans.property.SimpleIntegerProperty numPointsProperty()
        Returns:
        Number of points scanned
      • getChannel

        public xal.ca.Channel getChannel()
        Returns:
        The Channel object
      • getAcceleratorNode

        public xal.smf.AcceleratorNode getAcceleratorNode()
        Returns:
        The node this channel belongs to
      • getAcceleratorNodeId

        public String getAcceleratorNodeId()
        Returns:
        The ID of the node this channel belongs to
      • getHandle

        public String getHandle()
        Returns:
        The handle for this channel, if it belongs to a node
      • getTypeHandle

        public String getTypeHandle()
        Returns:
        The type of handle, if it belongs to a node
      • hasNode

        public boolean hasNode()
        Returns:
        true if this wrapper has an AcceleratorNode
      • getChannelName

        public String getChannelName()
        Name (ID) of channel
      • getIsScanned

        public boolean getIsScanned()
        True if channel will be scanned
      • getIsScannable

        public boolean getIsScannable()
        Returns:
        True if channel belongs to a node and is settable
      • getIsRead

        public boolean getIsRead()
        True if channel will be read
      • getIsScalar

        public boolean getIsScalar()
        If the channel only has one element, it is considered a scalar
        Returns:
        true if the channel is scalar
      • getNumPoints

        public int getNumPoints()
        Get the number of points when measured
      • getScanPoints

        public double[] getScanPoints​(boolean reverse)
        Get the values to be scanned
        Parameters:
        reverse - If true, return array in reverse order
        Returns:
        An array of the values to scan
      • getScanPoints

        public double[] getScanPoints()
      • setInstance

        public void setInstance()
        Set the unique instance (integer) of this channel Returns the string ('x'+integer)
      • forceInstance

        public void forceInstance​(String shortName)
        Force the unique instance name of this channel rather than using the counter to obtain it
        Parameters:
        shortName - The name to be used
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • compareTo

        public int compareTo​(Object other)
        Compare the instance value to another ChannelWrapper object. Used for sorting in the UI
        Parameters:
        other - ChannelWrapper
        Returns:
        String comparison of the two instance values