Package xal.app.scanner
Class ChannelWrapper
- java.lang.Object
-
- xal.app.scanner.ChannelWrapper
-
public class ChannelWrapper extends Object
A class that wraps a bit of additional functionality to the Channel class- Author:
- yngvelevinsen
-
-
Constructor Summary
Constructors Constructor Description ChannelWrapper(xal.ca.Channel chan)Construct a new object from the Channel given, as well as connecting to itChannelWrapper(xal.ca.Channel chan, boolean tryConnect)Construct a new object from the Channel given, as well as connecting to itChannelWrapper(xal.ca.Channel chan, xal.smf.AcceleratorNode node, boolean tryConnect)Construct a new object from the Channel given, as well as connecting to itChannelWrapper(xal.smf.AcceleratorNode node, String handle)Construct a new wrapper from the given node and handle.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Object other)Compare the instance value to another ChannelWrapper object.javafx.beans.property.SimpleDoublePropertyendProperty()booleanequals(Object other)voidforceInstance(String shortName)Force the unique instance name of this channel rather than using the counter to obtain itxal.smf.AcceleratorNodegetAcceleratorNode()StringgetAcceleratorNodeId()xal.ca.ChannelgetChannel()StringgetChannelName()Name (ID) of channelStringgetHandle()booleangetIsRead()True if channel will be readbooleangetIsScalar()If the channel only has one element, it is considered a scalarbooleangetIsScannable()booleangetIsScanned()True if channel will be scannedintgetNumPoints()Get the number of points when measureddouble[]getScanPoints()double[]getScanPoints(boolean reverse)Get the values to be scannedStringgetTypeHandle()inthashCode()booleanhasNode()javafx.beans.property.StringPropertyidProperty()javafx.beans.property.SimpleStringPropertyinstanceProperty()javafx.beans.property.SimpleBooleanPropertyisReadProperty()Set to true if this channel is selected to be read (ie is active)javafx.beans.property.SimpleBooleanPropertyisScannedProperty()Set to true if this channel is selected to be scanned (ie is active)javafx.beans.property.SimpleIntegerPropertynumPointsProperty()voidputVal(double value)Send a new value to the PVvoidputVal(double value, double timeout)Set value of the channel.javafx.beans.property.SimpleDoublePropertyrefProperty()The initial/reference value of this channel (i.e.voidsetInstance()Set the unique instance (integer) of this channel Returns the string ('x'+integer)javafx.beans.property.SimpleDoublePropertystartProperty()javafx.beans.property.StringPropertytypeProperty()javafx.beans.property.StringPropertyunitProperty()
-
-
-
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 totryConnect- 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 tohandle- 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 tonode- the node channel belongs totryConnect- attempt to connect to channel
-
-
Method Detail
-
putVal
public void putVal(double value, double timeout) throws xal.ca.PutException, xal.ca.MonitorExceptionSet 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 settimeout- Timeout if readback changes too slowly- Throws:
xal.ca.ConnectionException- If there was a connection issuexal.ca.PutException- If the new value was not successfully setxal.ca.MonitorException- If there was an issue with the channel monitor
-
putVal
public void putVal(double value) throws xal.ca.PutException, xal.ca.MonitorExceptionSend a new value to the PV- Parameters:
value- The new value- Throws:
xal.ca.ConnectionException- if there is a problem with the connectionxal.ca.PutException- if the new value cannot be setxal.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
-
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
-
-