public class Device extends fr.esrf.TangoApi.DeviceProxy implements IDevice, java.io.Serializable
Normally a Device object is obtained through the
DeviceFactory
to make sure that we do not
create two instances of the same physical device. The device sends out three
events, a Status-change event, a state-change event, and an error event.
Objects interested in receiving such events must register as listeners.
Modifier and Type | Field and Description |
---|---|
protected boolean |
devPropertiesLoaded |
static java.lang.String |
INSERT_EXTRACT_PROP |
static java.lang.String |
OPEN_CLOSE_PROP |
protected EventSupport |
propChanges |
protected java.util.Map<java.lang.String,DeviceProperty> |
propertyMap |
protected fr.esrf.TangoApi.DeviceProxy |
proxy |
access, check_access, check_access_done, classname, dev_src, device, device_2, device_3, device_4, device_5, devname, idl_version, ior, taco_device, transparent_reconnection, url
ALARM, CLOSE, DISABLE, EXTRACT, FAULT, INIT, INSERT, MOVING, OFF, ON, OPEN, RUNNING, STANDBY, UNKNOWN
ALL_ASYNCH, ATT_R, ATT_W, CALLBACK, CMD, D_TCP, D_UDP, FROM_ATTR, FROM_CMD, FROM_DBASE, FROM_IOR, LOGGING_DEBUG, LOGGING_ERROR, LOGGING_FATAL, LOGGING_INFO, LOGGING_OFF, LOGGING_WARN, MISC, NO_TIMEOUT, POLLING, protocol_name, PULL_CALLBACK, PUSH_CALLBACK, TACO, TANGO
Constructor and Description |
---|
Device(java.lang.String name)
Creates a new
Device instance. |
Device(java.lang.String name,
boolean connectionLess) |
Device(java.lang.String name,
java.lang.String host,
java.lang.String port) |
Modifier and Type | Method and Description |
---|---|
void |
addErrorListener(IErrorListener l) |
void |
addListener(IDeviceListener l)
addListener adds a listener to all device events |
void |
addStateListener(IStateListener l)
addStateListener adds a listener to state-events |
void |
addStatusListener(IStatusListener l)
addStatusListener adds a listener to status-events |
boolean |
areDevPropertiesLoaded() |
protected void |
deviceError(java.lang.String s,
java.lang.Throwable t)
deviceError fires of an error event from this device |
boolean |
doesEvent()
Returns true if this device supports event.
|
fr.esrf.TangoApi.DeviceData |
executeCommand(java.lang.String command,
fr.esrf.TangoApi.DeviceData argin)
executeCommand |
java.lang.String |
getAlias()
getAlias returns the alias of this device. |
fr.esrf.TangoApi.AttributeInfoEx |
getAttributeInfo(java.lang.String name)
getAttributeInfo gets the attribute config of an attribute |
fr.esrf.TangoApi.AttributeInfoEx[] |
getAttributeInfo(java.lang.String[] name)
getAttributeInfo returns the attribute configs for the
attributes named in the parameter. |
fr.esrf.TangoApi.CommandInfo |
getCommand(java.lang.String name)
getCommand returns a CommandInfo corresponding to the
given name. |
fr.esrf.TangoApi.CommandInfo[] |
getCommandList()
getCommandList returns the list of commands known to this
device |
int |
getDevTimeout()
This method is provided to ATK applications so that they don't need to
import fr.esrf.TangoApi.DeviceProxy to get the timeout for the
connection to the device.
|
int |
getIdlVersion()
Returns the IDL version number of this device.
|
boolean |
getInvertedInsertExtract() |
boolean |
getInvertedOpenClose() |
AtkEventListenerList |
getListenerList() |
java.lang.String |
getName()
getName returns the name of this device. |
EventSupport |
getPropChanges()
Returns the EventSupport object which manages ATKEvents for this device.
|
DeviceProperty |
getProperty(java.lang.String propertyName) |
java.util.Map |
getPropertyMap() |
long |
getRefreshCount()
Returns the number of call to refresh()
|
java.lang.String |
getState()
getState returns the state of the device as a string. |
static fr.esrf.Tango.DevState |
getStateFromString(java.lang.String st) |
java.lang.String |
getStatus()
getStatus returns the status of the device. |
java.lang.String |
getVersion() |
protected void |
init(java.lang.String name) |
boolean |
isAlive()
isAlive checks to see if this device is reachable |
boolean |
isConnected() |
void |
loadDevProperties() |
fr.esrf.TangoApi.DeviceAttribute |
readAttribute(java.lang.String name)
readAttribute reads the value of an attribute. |
fr.esrf.TangoApi.DeviceAttribute |
readAttributeFromDevice(java.lang.String name)
readAttributeFromDevice reads the value of an attribute. |
void |
reconnect() |
void |
refresh()
refresh sends out status and state events. |
void |
refreshPropertyMap()
You can use this method if you added or removed a property for this
device by using jive.
|
void |
removeErrorListener(IErrorListener l) |
void |
removeListener(IDeviceListener l)
removeListener removes a listener to this device. |
void |
removeStateListener(IStateListener l)
removeStateListener removes a listener to a state-events |
void |
removeStatusListener(IStatusListener l)
removeStatusListener removes a status listener |
void |
setDevTimeout(int tmout_ms)
This method is provided to ATK applications so that they don't need to
import fr.esrf.TangoApi.DeviceProxy to set the timeout for the
connection to the device.
|
void |
storeInfo(fr.esrf.TangoApi.AttributeInfoEx c)
storeInfo |
void |
storeProperty(java.lang.String propertyName)
Stores a property in database
|
java.lang.String |
toString() |
static java.lang.String |
toString(fr.esrf.Tango.DevState st) |
void |
writeAttribute(fr.esrf.TangoApi.DeviceAttribute a)
writeAttribute writes an attribute. |
add_device, add_logging_target, add_logging_target, attribute_history, attribute_history, check_asynch_reply, command_history, command_history, command_inout_asynch, command_inout_asynch, command_inout_asynch, command_inout_asynch, command_inout_asynch, command_inout_asynch, command_inout_reply, command_inout_reply, command_query, delete_attribute_property, delete_attribute_property, delete_attribute_property, delete_attribute_property, delete_attribute, delete_device, delete_property, delete_property, delete_property, dev_inform, export_device, finalize, fullName, get_adm_dev, get_alias, get_asynch_idl_cmd, get_asynch_replies, get_asynch_replies, get_attribute_config, get_attribute_config, get_attribute_config, get_attribute_info_ex, get_attribute_info_ex, get_attribute_info_ex, get_attribute_info, get_attribute_info, get_attribute_info, get_attribute_list, get_attribute_polling_period, get_attribute_property, get_attribute_property, get_class_inheritance, get_class, get_command_polling_period, get_db_obj, get_event_queue_size, get_event_queue_size, get_events, get_events, get_evt_import_info, get_info, get_last_event_date, get_logging_level, get_logging_target, get_next_event, get_next_event, get_property_list, get_property, get_property, get_property, get_rpc_protocol, getAdm_dev, getAttnames_array, getDb_dev, getDeviceProxy, getEventQueue, getFull_class_name, getLockerInfo, getLockerStatus, getPipeConfig, getPipeConfig, getPipeConfig, getPipeConfig, getPipeNames, getTangoVersion, import_admin_device, import_admin_device, import_device, isCheck_idl, isLocked, isLockedByMe, lock, lock, main, name, pending_asynch_call, poll_attribute, poll_command, polling_status, put_alias, put_attribute_property, put_attribute_property, put_property, put_property, read_attribute_asynch, read_attribute_asynch, read_attribute_asynch, read_attribute_asynch, read_attribute_reply, read_attribute_reply, read_attribute_value, read_attribute, read_attribute, readPipe, remove_logging_target, set_attribute_config, set_attribute_info, set_attribute_info, set_evt_import_info, set_logging_level, set_rpc_protocol, setAdm_dev, setAttnames_array, setDb_dev, setDeviceProxy, setEventQueue, setFull_class_name, setPipeConfig, setPipeConfig, setPipeConfig, state, state, status, status, stop_poll_attribute, stop_poll_command, subscribe_event, subscribe_event, subscribe_event, subscribe_event, subscribe_event, unexport_device, unlock, unsubscribe_event, use_db, write_attribute_asynch, write_attribute_asynch, write_attribute_asynch, write_attribute_asynch, write_attribute_asynch, write_attribute_asynch, write_attribute_reply, write_attribute_reply, write_attribute, write_attribute, write_read_attribute, write_read_attribute, write_read_attribute, writePipe, writePipe
adm_name, black_box, build_connection, checkIfTaco, checkIfTango, command_inout, command_inout, command_list_query, description, dev_import, deviceCreated, equals, get_class_name, get_device, get_host_name, get_idl_version, get_ior, get_name, get_server_name, get_source, get_tango_host, get_timeout_millis, get_timeout, get_transparency_reconnection, getAccessControl, getDev_timeout, getDevice_5, getFullTangoHost, getIConnection, getObj, getPrev_failed_t0, getPrev_failed, getUrl, info_3, info, is_taco, isAllowedCommand, isAlready_connected, isDevice_is_dbase, isPrev_failed, ping, set_source, set_timeout_millis, set_transparency_reconnection, setAccessControl, setAlready_connected, setDev_timeout, setDevice_is_dbase, setIConnection, setObj, setPrev_failed_t0, setPrev_failed, throw_dev_failed
public static final java.lang.String OPEN_CLOSE_PROP
public static final java.lang.String INSERT_EXTRACT_PROP
protected EventSupport propChanges
protected transient fr.esrf.TangoApi.DeviceProxy proxy
protected java.util.Map<java.lang.String,DeviceProperty> propertyMap
protected boolean devPropertiesLoaded
public Device(java.lang.String name) throws fr.esrf.Tango.DevFailed
Device
instance.name
- a String
containing the name of the device to
connect to.fr.esrf.Tango.DevFailed
- if an error occursDeviceProxy.DeviceProxy(java.lang.String, java.lang.String, java.lang.String)
public Device(java.lang.String name, java.lang.String host, java.lang.String port) throws fr.esrf.Tango.DevFailed
fr.esrf.Tango.DevFailed
public Device(java.lang.String name, boolean connectionLess) throws fr.esrf.Tango.DevFailed
fr.esrf.Tango.DevFailed
protected void init(java.lang.String name) throws fr.esrf.Tango.DevFailed
fr.esrf.Tango.DevFailed
public void reconnect()
public boolean isConnected()
public void addErrorListener(IErrorListener l)
public void removeErrorListener(IErrorListener l)
public void addStatusListener(IStatusListener l)
addStatusListener
adds a listener to status-eventsaddStatusListener
in interface IDevice
l
- an IDeviceListener
valueIDeviceListener
public void removeStatusListener(IStatusListener l)
removeStatusListener
removes a status listenerremoveStatusListener
in interface IDevice
l
- an IDeviceListener
valuepublic void addStateListener(IStateListener l)
addStateListener
adds a listener to state-eventsaddStateListener
in interface IDevice
l
- an IDeviceListener
valuepublic void removeStateListener(IStateListener l)
removeStateListener
removes a listener to a state-eventsremoveStateListener
in interface IDevice
l
- an IDeviceListener
valuepublic void addListener(IDeviceListener l)
addListener
adds a listener to all device eventsl
- an IDeviceListener
valuepublic void removeListener(IDeviceListener l)
removeListener
removes a listener to this device.l
- an IDeviceListener
valuepublic EventSupport getPropChanges()
public void refresh()
refresh
sends out status and state events. This forces a
synchronous device state and status reading.refresh
in interface IRefreshee
public boolean isAlive()
isAlive
checks to see if this device is reachableboolean
value which is true if the device is
reachable, false otherwiseConnection.ping()
public fr.esrf.TangoApi.CommandInfo[] getCommandList() throws fr.esrf.Tango.DevFailed
getCommandList
returns the list of commands known to this
deviceDevCmdInfo[]
valuefr.esrf.Tango.DevFailed
- if an error occurspublic fr.esrf.TangoApi.CommandInfo getCommand(java.lang.String name) throws fr.esrf.Tango.DevFailed
getCommand
returns a CommandInfo corresponding to the
given name.name
- Command namefr.esrf.Tango.DevFailed
- in case of failure.public fr.esrf.TangoApi.AttributeInfoEx[] getAttributeInfo(java.lang.String[] name) throws fr.esrf.Tango.DevFailed
getAttributeInfo
returns the attribute configs for the
attributes named in the parameter.name
- a String[]
value containing the names of the
attributes we want the configs of.AttributeConfig[]
valuefr.esrf.Tango.DevFailed
- if an error occurspublic fr.esrf.TangoApi.AttributeInfoEx getAttributeInfo(java.lang.String name) throws fr.esrf.Tango.DevFailed
getAttributeInfo
gets the attribute config of an attributename
- a String
value containing the name of the
attribute we want the config of.AttributeConfig
valuefr.esrf.Tango.DevFailed
- if an error occursgetAttributeInfo(String[] name)
public java.lang.String getName()
getName
returns the name of this device.public java.lang.String getAlias()
getAlias
returns the alias of this device.protected void deviceError(java.lang.String s, java.lang.Throwable t)
deviceError
fires of an error event from this devices
- a String
value containing an error message.t
- a Throwable
value containing the exception
which caused this error message to be called.public java.lang.String getState()
getState
returns the state of the device as a string.public static java.lang.String toString(fr.esrf.Tango.DevState st)
public static fr.esrf.Tango.DevState getStateFromString(java.lang.String st)
public java.lang.String getStatus()
getStatus
returns the status of the device. returns
UNKNOWN and sets an error if a DevFailed is thrown while obtaining the
status.public final fr.esrf.TangoApi.DeviceAttribute readAttribute(java.lang.String name) throws fr.esrf.Tango.DevFailed
readAttribute
reads the value of an attribute. It is made
final to be a bit quicker.name
- a String
valueDeviceAttribute
valuefr.esrf.Tango.DevFailed
- if an error occurspublic long getRefreshCount()
public int getIdlVersion()
getIdlVersion
in interface IDevice
public final fr.esrf.TangoApi.DeviceAttribute readAttributeFromDevice(java.lang.String name) throws fr.esrf.Tango.DevFailed
readAttributeFromDevice
reads the value of an attribute.
Force the reading from the tango device (ignore polling buffer).name
- a String
valueDeviceAttribute
valuefr.esrf.Tango.DevFailed
- if an error occurspublic void writeAttribute(fr.esrf.TangoApi.DeviceAttribute a) throws fr.esrf.Tango.DevFailed
writeAttribute
writes an attribute.a
- a DeviceAttribute
value to write.fr.esrf.Tango.DevFailed
- if an error occurspublic fr.esrf.TangoApi.DeviceData executeCommand(java.lang.String command, fr.esrf.TangoApi.DeviceData argin) throws fr.esrf.Tango.DevFailed
executeCommand
command
- a String
value containing the name of the
command, obtained by getCommandList();argin
- a DeviceData
value holding the in argumentDeviceData
value containing the resultfr.esrf.Tango.DevFailed
- if an error occurspublic void storeInfo(fr.esrf.TangoApi.AttributeInfoEx c) throws fr.esrf.Tango.DevFailed
storeInfo
c
- an AttributeInfo
value to storefr.esrf.Tango.DevFailed
- if an error occurspublic java.lang.String toString()
toString
in class fr.esrf.TangoApi.DeviceProxy
public boolean doesEvent()
public java.lang.String getVersion()
public DeviceProperty getProperty(java.lang.String propertyName)
public java.util.Map getPropertyMap()
public void storeProperty(java.lang.String propertyName)
propertyName
- the name of the property to storepublic void refreshPropertyMap()
Device
to refresh
its Map
of properties (DeviceProperty
).public int getDevTimeout() throws ConnectionException
ConnectionException
public void setDevTimeout(int tmout_ms) throws ConnectionException
ConnectionException
public AtkEventListenerList getListenerList()
getListenerList
in interface IDevice
public boolean getInvertedOpenClose()
getInvertedOpenClose
in interface IDevice
public boolean getInvertedInsertExtract()
getInvertedInsertExtract
in interface IDevice
public boolean areDevPropertiesLoaded()
public void loadDevProperties()