|
cut 3.3.0
|
A :class:TaurusAttribute that gives access to a CII OLDB Datapoint.
More...
Public Member Functions | |
| set_value (self, TaurusAttrValue new_value, bool fire_event) | |
| Method that conducts blocking assignment of self.__attr_value. | |
| push_event (self, object new_value, CiiOldbDpQuality quality, TaurusTimeVal timestamp) | |
| Takes a new TaurusAttrValue and generates the appropiate Change Event, which notifies listeners of the new value. | |
| TaurusAttrValue | read (self, bool cache=True) |
| Taurus overriden methods. | |
| write (self, value, with_read=True) | |
| Write the value in a CII OLDB Datapoint. | |
| TaurusAttrValue | decode (self, new_value, quality, timestamp) |
| Takes the value from a reading of the CII OLDB, and transforms it to a TaurusAttrValue that Taurus can handle. | |
| decode_previous_or_default (self) | |
| When a notification is gotten, but no value could be parsed, this method returns a default value. | |
| encode (self, value) | |
| This prepares the value (Quantity, most likely) to be send to the underlying control system. | |
| poll (self, single=True, value=None, time=None, error=None) | |
| Notify listeners when the attribute has been polled. | |
| addListener (self, listener) | |
| API for listeners. | |
| removeListener (self, listener) | |
| Remove a TaurusListener from the listeners list. | |
| isUsingEvents (self) | |
| Indicates if the Attribute has succesfully subcribed to changes from the OLDB. | |
| SubscriptionState | getSubscriptionState (self) |
| Returns the SubscriptionState enumeration value. | |
Protected Member Functions | |
| CiiOldb | _get_oldb_instance (cls) |
| Static method that returns the CiiOldb object reference. | |
| CiiOldbDataPoint | _get_cii_datapoint (self) |
| CII DataPoint getters, for developers. | |
| _get_cii_metadata (self) | |
| Allows developer to access the Metadata for the datapoint from OLDB. | |
| _subscribe (self) | |
| Implemented subscription logic and calls to OLDB API. | |
| (TaurusEventType, TaurusAttrValue) | _pushAttrEvent (self, object new_value, CiiOldbDpQuality quality, TaurusTimeVal timestamp) |
| Handler of (non-configuration) events from the OLDB layer. | |
| DataType | _from_oldb_to_taurus_type (self) |
| Helper methods. | |
| _get_units (self) | |
| Units can be None, so we need an extra variable to track if we already have the units or not. | |
A :class:TaurusAttribute that gives access to a CII OLDB Datapoint.
.. seealso:: :mod:tauruscii
.. warning:: In most cases this class should not be instantiated directly. Instead it should be done via the :meth:TaurusCiiFactory.getAttribute
|
protected |
Helper methods.
Caches and returns the type of the attribute.
|
protected |
CII DataPoint getters, for developers.
Check if datapoints exists in OLDB, and return a reference to it.
Checks if OLDB Instance is available and if there is already a datapoint reference.
|
protected |
Static method that returns the CiiOldb object reference.
Since many widget start at the same time, this ensures that only one connection attempt is done, while the rest will automatically block and get the cached reference.
TODO Needs to handle the timeout TODO Needs to be done async
|
protected |
Units can be None, so we need an extra variable to track if we already have the units or not.
This clashes, though, with failure to read units during initialization, like when the quality of not OK.
|
protected |
Handler of (non-configuration) events from the OLDB layer.
It handles the subscription and the (de)activation of polling
| new_oldb_value | New value reported by the OLDB subscription type of CiiOldbDpValue: |
TaurusEventType (or None to indicate that there should not be notification to listeners). evt_value is a TaurusValue, an Exception, or None. | tauruscii.taurusciiattribute.TaurusCiiAttribute.addListener | ( | self, | |
| listener ) |
API for listeners.
Add a TaurusListener object in the listeners list. If it is the first element and Polling is enabled starts the polling mechanism. If the listener is already registered nothing happens.
| TaurusAttrValue tauruscii.taurusciiattribute.TaurusCiiAttribute.decode | ( | self, | |
| new_value, | |||
| quality, | |||
| timestamp ) |
Takes the value from a reading of the CII OLDB, and transforms it to a TaurusAttrValue that Taurus can handle.
| new_value | CII OLDB data value |
| quality | Quality read from CII OLDB |
| timestamp | Timestamp read from CII OLDB |
| tauruscii.taurusciiattribute.TaurusCiiAttribute.decode_previous_or_default | ( | self | ) |
When a notification is gotten, but no value could be parsed, this method returns a default value.
UPDATED only returns default
| tauruscii.taurusciiattribute.TaurusCiiAttribute.encode | ( | self, | |
| value ) |
This prepares the value (Quantity, most likely) to be send to the underlying control system.
It should prepare datatypes compatible with the control system.
| SubscriptionState tauruscii.taurusciiattribute.TaurusCiiAttribute.getSubscriptionState | ( | self | ) |
Returns the SubscriptionState enumeration value.
| tauruscii.taurusciiattribute.TaurusCiiAttribute.isUsingEvents | ( | self | ) |
Indicates if the Attribute has succesfully subcribed to changes from the OLDB.
| tauruscii.taurusciiattribute.TaurusCiiAttribute.poll | ( | self, | |
| single = True, | |||
| value = None, | |||
| time = None, | |||
| error = None ) |
Notify listeners when the attribute has been polled.
To properly use poll, it needs to be configure before any listener or widget that uses the Attribute is created. You can do this by getting the singleton reference to the attribute like this.
| TaurusAttrValue tauruscii.taurusciiattribute.TaurusCiiAttribute.read | ( | self, | |
| bool | cache = True ) |
Taurus overriden methods.
Returns the current value of the attribute.
Returns the last TaurusAttrValue corresponding to the attribute. In cache cache is False or the polling period has expired, an actual read to the OLDB is generated.
| cache | Boolean that indicates if we used the cached value or for a read. |
| tauruscii.taurusciiattribute.TaurusCiiAttribute.removeListener | ( | self, | |
| listener ) |
Remove a TaurusListener from the listeners list.
If polling enabled and it is the last element the stop the polling timer. If the listener is not registered nothing happens.
| tauruscii.taurusciiattribute.TaurusCiiAttribute.set_value | ( | self, | |
| TaurusAttrValue | new_value, | ||
| bool | fire_event ) |
Method that conducts blocking assignment of self.__attr_value.
This is the only point where the two threads can change the same attribute. We also save the previous value.