| |
- CaChannel.CaChannel
-
- epicsPV
- callBack
class callBack |
|
This class is used by the epicsPV class to handle callbacks. It is required
to avoid circular references to the epicsPV object itself when dealing with
callbacks, in order to allow the CaChannel destructor to be called.
Users will only be interested in the fields that are copied to this class in
the callback resulting from a call to epicsPV.getControl(). |
|
Methods defined here:
- __init__(self)
Data and non-method functions defined here:
- __doc__ = '\n This class is used by the epicsPV class to h...esulting from a call to epicsPV.getControl().\n '
- str(object) -> string
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
- __module__ = 'epicsPV'
- str(object) -> string
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
|
class epicsPV(CaChannel.CaChannel) |
|
This class subclasses Geoff Savage's CaChannel class to add the following
features:
- If a PV name is given then the class constructor will do a searchw()
by default.
- setMonitor() sets a generic callback routine for value change events.
Subsequent getw(), getValue() or array_get() calls will return the
value from the most recent callback, and hence do not result in any
network activity or latency. This can greatly improve performance.
- checkMonitor() returns a flag to indicate if a callback has occured
since the last call to checkMonitor(), getw(), getValue() or
array_get(). It can be used to increase efficiency in polling
applications.
- getControl() reads the "control" and other information from an
EPICS PV without having to use callbacks.
In addition to the PV value, this will return the graphic, control and
alarm limits, etc.
- putWait() calls array_put_callback() and waits for the callback to
occur before it returns. This allows programs to use array_put_callback()
synchronously and without user-written callbacks.
Created: Mark Rivers, Sept. 16, 2002.
Modifications: |
|
Methods defined here:
- __init__(self, pvName=None, wait=1)
- Keywords:
pvName:
An optional name of an EPICS Process Variable.
wait:
If wait==1 and pvName != None then this constructor will do a
CaChannel.searchw() on the PV. If wait==0 and pvName != None then
this constructor will do a CaChannel.search() on the PV, and the user
must subsequently do a pend_io() on this or another epicsPV or CaChannel
object.
Procedure:
Invokes CaChannel.__init__() and then searchw() or search() as explained
above
- array_get(self, req_type=None, count=None)
- If setMonitor() has not been called then this function simply calls
CaChannel.array_get(). If setMonitor has been called then it calls
CaChannel.pend_event() with a very short timeout, and then returns the
PV value from the last callback.
- checkMonitor(self)
- Returns 1 to indicate if a value callback has occured
since the last call to checkMonitor(), getw(), getValue() or
array_get(), indicating that a new value is available. Returns 0 if
no such callback has occurred.
It can be used to increase efficiency in polling applications.
- clearMonitor(self)
- Cancels the effect of a previous call to setMonitor().
Calls CaChannel.clear_event().
Subsequent getw(), getValue() or array_get() calls will no longer
return the value from the most recent callback, but will actually result
in channel access calls.
- getControl(self, req_type=None, count=None, wait=1, poll=0.01)
- Provides a method to read the "control" and other information from an
EPICS PV without having to use callbacks.
It calls CaChannel.array_get_callback() with a database request type of
CaChannel.ca.dbf_type_to_DBR_CTRL(req_type).
In addition to the PV value, this will return the graphic, control and
alarm limits, etc.
Example:
>>> pv = epicsPV('13IDC:m1')
>>> pv.getControl()
>>> for field in dir(pv.callBack):
>>> print field, ':', getattr(pv.callBack, field)
chid : _bfffec34_chid_p
count : 1
monitorState : 0
newMonitor : 1
putComplete : 0
pv_loalarmlim : 0.0
pv_loctrllim : -22.0
pv_lodislim : -22.0
pv_lowarnlim : 0.0
pv_precision : 4
pv_riscpad0 : 256
pv_severity : 0
pv_status : 0
pv_units : mm
pv_upalarmlim : 0.0
pv_upctrllim : 28.0
pv_updislim : 28.0
pv_upwarnlim : 0.0
pv_value : -15.0
status : 1
type : 34
Note the fields such as pv_plocrtllim, the lower control limit, and
pv_precision, the display precision.
Keywords:
wait:
If this keyword is 1 (the default) then this routine waits for
the callback before returning. If this keyword is 0 then it is
the user's responsibility to wait or check for the callback
by calling checkMonitor().
poll:
The timeout for pend_event() calls, waiting for the callback
to occur. Shorter times reduce the latency at the price of CPU
cycles.
- getValue(self)
- If setMonitor() has not been called then this function simply calls
CaChannel.getValue(). If setMonitor has been called then it calls
CaChannel.pend_event() with a very short timeout, and then returns the
PV value from the last callback.
- getw(self, req_type=None, count=None)
- If setMonitor() has not been called then this function simply calls
CaChannel.getw(). If setMonitor has been called then it calls
CaChannel.pend_event() with a very short timeout, and then returns the
PV value from the last callback.
- putWait(self, value, req_type=None, count=None, poll=0.01)
- Calls CaChannel.array_put_callback() and waits for the callback to
occur before it returns. This allows programs to use array_put_callback()
without having to handle asynchronous callbacks.
Keywords:
req_type:
See CaChannel.array_put_callback()
count:
See CaChannel.array_put_callback()
poll:
The timeout for pend_event() calls, waiting for the callback
to occur. Shorter times reduce the latency at the price of CPU
cycles.
- setMonitor(self)
- Sets a generic callback routine for value change events.
Subsequent getw(), getValue() or array_get() calls will return the
value from the most recent callback, do not result in any network
latency. This can greatly improve efficiency.
Data and non-method functions defined here:
- __doc__ = "\n This class subclasses Geoff Savage's CaChann...ark Rivers, Sept. 16, 2002.\n Modifications:\n "
- str(object) -> string
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
- __module__ = 'epicsPV'
- str(object) -> string
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
Methods inherited from CaChannel.CaChannel:
- _CaChannel__build_array = __build_array(self, items, nitems, req_type)
- # Build and initialize a C array using the SWIG pointer library.
# If EPICS array is longer than nitems the values at the
# end will not be overwritten.
- _CaChannel__build_list = __build_list(self, pvals, nitems)
- # Build and initialize a Python list from a SWIG pointer to a C array.
- _CaChannel__setup_get = __setup_get(self, req_type)
- # Use the swig pointer library to allocate C variables
# to hold the data read.
- _CaChannel__setup_put = __setup_put(self, value, req_type)
- # Use the swig pointer library to allocate and initialize
# C variables to hold the value to be written.
- __del__(self)
- add_masked_array_event(self, req_type, count, mask, callback, *user_args)
- # Creates a new event id and stores it on self.__evid. Only one event registered
# per CaChannel object. If an event is already registered the event is cleared
# before registering a new event.
- array_get_callback(self, req_type, count, callback, *user_args)
- array_put(self, value, req_type=None, count=None)
- array_put_callback(self, value, req_type, count, callback, *user_args)
- clear_channel(self)
- clear_event(self)
- element_count(self)
- field_type(self)
- flush_io(self)
- getTimeout(self)
- # Retrieve the default timeout value
- host_name(self)
- name(self)
- pend_event(self, timeout=None)
- pend_io(self, timeout=None)
- poll(self)
- putw(self, value, req_type=None)
- read_access(self)
- search(self, pvName=None)
- search_and_connect(self, pvName, callback, *user_args)
- searchw(self, pvName=None)
- setTimeout(self, timeout)
- # Set the default timeout value.
# Used by default if no timeout is specified where needed.
- state(self)
- version(self)
- write_access(self)
Data and non-method functions inherited from CaChannel.CaChannel:
- ca_timeout = 1.0
- float(x) -> floating point number
Convert a string or number to a floating point number, if possible.
- dbr_d = {0: {'c_type': 'char', 'convert': <type 'str'>}, 1: {'c_type': 'short', 'convert': <type 'int'>}, 2: {'c_type': 'float', 'convert': <type 'float'>}, 3: {'c_type': 'short', 'convert': <type 'int'>}, 4: {'c_type': 'char', 'convert': <type 'str'>}, 5: {'c_type': 'int', 'convert': <type 'int'>}, 6: {'c_type': 'double', 'convert': <type 'float'>}}
- dict() -> new empty dictionary.
dict(mapping) -> new dictionary initialized from a mapping object's
(key, value) pairs.
dict(seq) -> new dictionary initialized as if via:
d = {}
for k, v in seq:
d[k] = v
| |