cut 3.3.0
Loading...
Searching...
No Matches
tauruscii.taurusciiattribute.TaurusCiiAttribute Class Reference

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.
 

Detailed Description

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

Member Function Documentation

◆ _from_oldb_to_taurus_type()

DataType tauruscii.taurusciiattribute.TaurusCiiAttribute._from_oldb_to_taurus_type ( self)
protected

Helper methods.

Caches and returns the type of the attribute.

◆ _get_cii_datapoint()

CiiOldbDataPoint tauruscii.taurusciiattribute.TaurusCiiAttribute._get_cii_datapoint ( self)
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.

Returns
None in case connection was not established or datapoint has issues in OLDB. CiiOldbDataPoint type depending on the OLDB datapoint:
CiiOldbDataPointBINARY, CiiOldbDataPointBOOLEAN, CiiOldbDataPointSINGLE, CiiOldbDataPointDOUBLE,
CiiOldbDataPointINT8 CiiOldbDataPointINT16, CiiOldbDataPointINT32, CiiOldbDataPointINT64, CiiOldbDataPointUINT8 CiiOldbDataPointUINT16 CiiOldbDataPointUINT32 CiiOldbDataPointUINT64
CiiOldbDataPointSTRING, CiiOldbDataPointVectorSINGLE, CiiOldbDataPointVectorDOUBLE,
CiiOldbDataPointVectorINT16, CiiOldbDataPointVectorINT32, CiiOldbDataPointVectorINT64

◆ _get_oldb_instance()

CiiOldb tauruscii.taurusciiattribute.TaurusCiiAttribute._get_oldb_instance ( cls)
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

◆ _get_units()

tauruscii.taurusciiattribute.TaurusCiiAttribute._get_units ( self)
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.

◆ _pushAttrEvent()

(TaurusEventType, TaurusAttrValue) tauruscii.taurusciiattribute.TaurusCiiAttribute._pushAttrEvent ( self,
object new_value,
CiiOldbDpQuality quality,
TaurusTimeVal timestamp )
protected

Handler of (non-configuration) events from the OLDB layer.

It handles the subscription and the (de)activation of polling

Parameters
new_oldb_valueNew value reported by the OLDB subscription
type of CiiOldbDpValue:
Returns
Tuple containing the event type and the event value. evt_type is a TaurusEventType (or None to indicate that there should not be notification to listeners). evt_value is a TaurusValue, an Exception, or None.
return type of : evt_type, evt_value

◆ addListener()

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.

◆ decode()

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.

Parameters
new_valueCII OLDB data value
qualityQuality read from CII OLDB
timestampTimestamp read from CII OLDB
Returns
TaurusAttrValue object that represents CII OLDB value.

◆ decode_previous_or_default()

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

◆ encode()

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.

◆ getSubscriptionState()

SubscriptionState tauruscii.taurusciiattribute.TaurusCiiAttribute.getSubscriptionState ( self)

Returns the SubscriptionState enumeration value.

Returns
SubscriptionState Subscription state of the attribute.

◆ isUsingEvents()

tauruscii.taurusciiattribute.TaurusCiiAttribute.isUsingEvents ( self)

Indicates if the Attribute has succesfully subcribed to changes from the OLDB.

Returns
bool True if subscribed, false if not.

◆ poll()

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.

attr1 = Attribute('cii.oldb:///cut/demoservice/instance1/double-vector-current-radec')
attr1.activatePolling(1000)
attr1.enablePolling(force=True)
attr1.addListener(list1)
label = TaurusLabel(parent=None)

◆ read()

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.

Parameters
cacheBoolean that indicates if we used the cached value or for a read.
Returns
TaurusAttrValue A new object representation of the value

◆ removeListener()

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.

◆ set_value()

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.

Note
This method is gonna be removed.

The documentation for this class was generated from the following file: