Package org.scictrl.csshell.epics
Class EPICSConnection<T>
java.lang.Object
org.scictrl.csshell.epics.EPICSConnection<T>
- Type Parameters:
T
- data type
- All Implemented Interfaces:
gov.aps.jca.event.ConnectionListener
,EventListener
,Connection<EPICSConnector,
T, gov.aps.jca.dbr.DBR>
public class EPICSConnection<T>
extends Object
implements Connection<EPICSConnector,T,gov.aps.jca.dbr.DBR>, gov.aps.jca.event.ConnectionListener
EPICSConnection class.
- Author:
- igor@scictrl.com
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Get request object, a callback for get calls.class
Put request object. -
Field Summary
Fields inherited from interface org.scictrl.csshell.Connection
PROPERTY_ALARM, PROPERTY_META_DATA, PROPERTY_POOP, PROPERTY_STATUS, PROPERTY_VALUE
-
Constructor Summary
ConstructorDescriptionEPICSConnection
(String name, DataType dataType, EPICSConnector connector) Constructor for EPICSConnection. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPropertyChangeListener.void
connectionChanged
(gov.aps.jca.event.ConnectionEvent ev) void
destroy()
destroy.void
fireMetaDataChange.void
fireValueChange
(gov.aps.jca.event.MonitorEvent ev) fireValueChange.gov.aps.jca.Channel
Getter for the fieldchannel
.Returns Connector object responsible for this connection.getDataType.getLastPoop.Returns value from last Poop converted to data type of the connection, if possible.getMetaData.void
getMetaDataAsync.getName()
Returns remote name for this connection.getPoop()
getPoop.getStatus.getValue()
Synchronously obtains remote value and returns it.getValue.boolean
hasLastPoop.boolean
hasMonitor.boolean
isConnected.boolean
Returnstrue
after destroy method was called.boolean
isReady()
Returns true, when this connection object is connected and has received at least one remote update.void
removePropertyChangeListener.void
setValue.setValue
(T value, ResponseListener<EPICSConnector> l) setValue.toString()
void
It will block this call until this connection is connected or timeout occurs and connection fails.
-
Constructor Details
-
EPICSConnection
public EPICSConnection(String name, DataType dataType, EPICSConnector connector) throws IllegalArgumentException, IllegalStateException, gov.aps.jca.CAException Constructor for EPICSConnection.
- Parameters:
name
- aString
objectdataType
- aDataType
objectconnector
- aEPICSConnector
object- Throws:
IllegalArgumentException
- if any.IllegalStateException
- if any.gov.aps.jca.CAException
- if any.
-
-
Method Details
-
connectionChanged
public void connectionChanged(gov.aps.jca.event.ConnectionEvent ev) - Specified by:
connectionChanged
in interfacegov.aps.jca.event.ConnectionListener
-
fireValueChange
public void fireValueChange(gov.aps.jca.event.MonitorEvent ev) fireValueChange.
- Parameters:
ev
- aMonitorEvent
object
-
fireMetaDataChange
fireMetaDataChange.
- Parameters:
md
- aMetaData
object
-
addPropertyChangeListener
public void addPropertyChangeListener(String pName, PropertyChangeListener l) throws RemoteException addPropertyChangeListener.
- Specified by:
addPropertyChangeListener
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Parameters:
pName
- aString
objectl
- aPropertyChangeListener
object- Throws:
RemoteException
- if any.
-
removePropertyChangeListener
removePropertyChangeListener.
- Specified by:
removePropertyChangeListener
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Parameters:
pName
- aString
objectl
- aPropertyChangeListener
object
-
getDataType
getDataType.
- Specified by:
getDataType
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Returns:
- a
DataType
object
-
getName
Returns remote name for this connection.- Specified by:
getName
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Returns:
- remote name
-
getChannel
public gov.aps.jca.Channel getChannel()Getter for the field
channel
.- Returns:
- a
Channel
object
-
getConnector
Returns Connector object responsible for this connection.- Specified by:
getConnector
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Returns:
- a C object
-
getMetaData
getMetaData.
- Specified by:
getMetaData
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Returns:
- a
MetaData
object
-
getMetaDataAsync
getMetaDataAsync.
- Specified by:
getMetaDataAsync
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Parameters:
l
- aPropertyChangeListener
object
-
getValue
Synchronously obtains remote value and returns it. This call is blocked until value is returned.- Specified by:
getValue
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Returns:
- remote value
- Throws:
RemoteException
- if retrieving value fails
-
getPoop
getPoop.
- Specified by:
getPoop
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Returns:
- a
Poop
object - Throws:
RemoteException
- if any.
-
setValue
setValue.
- Specified by:
setValue
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Parameters:
value
- a T object- Throws:
RemoteException
- if any.
-
getLastPoop
getLastPoop.
- Specified by:
getLastPoop
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Returns:
- a
Poop
object
-
getLastValue
Returns value from last Poop converted to data type of the connection, if possible.- Specified by:
getLastValue
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Returns:
- the last value from last Poop
-
hasLastPoop
public boolean hasLastPoop()hasLastPoop.
- Specified by:
hasLastPoop
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Returns:
- a boolean
-
hasMonitor
public boolean hasMonitor()hasMonitor.
- Returns:
- a boolean
-
destroy
public void destroy()destroy.
- Specified by:
destroy
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR>
-
isReady
public boolean isReady()Returns true, when this connection object is connected and has received at least one remote update. This means that remote connection is successfully established (CONNECTED status state) and alive (no warnings, alarms or errors states in status). As remote update counts that hasLastPoop() returns true, which is consequence of least one successful get call was made or there is property listener registered on this object and remote monitor has already returned at least one monitor update.- Specified by:
isReady
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Returns:
- returns true, when connection is ready to be used
-
isDestroyed
public boolean isDestroyed()Returnstrue
after destroy method was called.- Specified by:
isDestroyed
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Returns:
true
after destroy method was called
-
isConnected
public boolean isConnected()isConnected.
- Specified by:
isConnected
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Returns:
- a boolean
-
waitTillConnected
public void waitTillConnected()It will block this call until this connection is connected or timeout occurs and connection fails.- Specified by:
waitTillConnected
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR>
-
setValue
public Request<EPICSConnector> setValue(T value, ResponseListener<EPICSConnector> l) throws RemoteException setValue.
- Specified by:
setValue
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Parameters:
value
- a T objectl
- aResponseListener
object- Returns:
- a
Request
object - Throws:
RemoteException
- if any.
-
getValue
getValue.
- Specified by:
getValue
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Parameters:
l
- aResponseListener
object- Returns:
- a
Request
object - Throws:
RemoteException
- if any.
-
getStatus
getStatus.
- Specified by:
getStatus
in interfaceConnection<EPICSConnector,
T, gov.aps.jca.dbr.DBR> - Returns:
- a
Status
object
-
toString
-