Chan class - femanov/pycx4 GitHub Wiki
Inheritance chain: CdaObject -> BaseChan -> Chan
This class is single value typed channel. Instances of this class registers required cda events to track time/value of selected control system channel. You can get information about channel trough it's properties. All the properties are read-only. It's an error if you try to assign properties If you need a notifications use instance signals.
properties:
inherited:
int max_nelems
- max number of elements = 1
cda_dataref_t ref
- cda channel's id
cxdtype_t dtype
- cx data type
str name
- channel name (not full)
object context
- context
int64 time
- server-provided time of last value, us from UNIX epoch
int64 prev_time
- server-provided time of previous value, us from UNIX epoch
size_t itemsize
- value size, bytes
self-defined:
object val
- last-known value
object prev_val
- preveous value
Methods:
__cinit__(self, str name, object context=None, cxdtype_t dtype=CXDTYPE_DOUBLE)
__str__(self)
setValue(self, value)
- request to set channel value, value is casted to type you select on instantiation
if val != prev_val then value changed.
Signals:
valueMeasured(self)
- emitted when new value arrived
valueChanged(self)
- emitted when value changed
Signals can be cda.Signal or pyqtSignal depending on what you use pycda or cda. schan don't inherit Qobject in qcda, encapsulation is used to bring pyqtSignals to channel-like classes. Instance that emitted a signal will be passed as only argument to connected functions. Double in methods means that what ever you give will be casted to channel dtype. If it's not possible it's an error.