cut 3.3.0
Loading...
Searching...
No Matches
taurusmalps.taurusmalpsattribute.TaurusMalPSAttribute Class Reference

More...

Public Member Functions

 encode (self, value)
 Taurus overriden methods.
 
 read (self, bool cache=False)
 Returns the current or default value of the attribute.
 
 decode (self, new_value, timestamp_src)
 Decodes a value that was received from MAL publisher into the expected representation.
 
 change_subscription_state (self, new_state)
 Subscribtion methods.
 
 push_event (self, new_value, timestamp_src)
 Takes a new TaurusAttrValue and generates the appropiate Change Event, which notifies listeners of the new value.
 
 set_throttling_rate (self, rate)
 Sets rate at which received data will be throtled.
 
 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

 _validate_struct (self)
 We try to get member variables of the struct.
 
 _from_mal_get_dimensions (self, attrib)
 Get data type from MAL member.
 
(TaurusEventType, TaurusAttrValue) _pushAttrEvent (self, new_value, timestamp_src)
 Handler of events from MAL publisher.
 
 _convert_to_TAI (self, calendar_clock_timestamp)
 Convert calendar clock timestamp to TAI clock timestamp.
 
 _subscribe (self)
 Subscribes to mal topic.
 

Detailed Description

. 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

◆ _pushAttrEvent()

(TaurusEventType, TaurusAttrValue) taurusmalps.taurusmalpsattribute.TaurusMalPSAttribute._pushAttrEvent ( self,
new_value,
timestamp_src )
protected

Handler of events from MAL publisher.

It handles the subscription

Parameters
new_valueNew value received from MAL publisher
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

◆ _validate_struct()

taurusmalps.taurusmalpsattribute.TaurusMalPSAttribute._validate_struct ( self)
protected

We try to get member variables of the struct.

Because the implementation covers simple data types, the struct must contain only one member. Otherwise an exception will be thrown

◆ addListener()

taurusmalps.taurusmalpsattribute.TaurusMalPSAttribute.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.

◆ getSubscriptionState()

SubscriptionState taurusmalps.taurusmalpsattribute.TaurusMalPSAttribute.getSubscriptionState ( self)

Returns the SubscriptionState enumeration value.

Returns
SubscriptionState Subscription state of the attribute.

◆ isUsingEvents()

taurusmalps.taurusmalpsattribute.TaurusMalPSAttribute.isUsingEvents ( self)

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

Returns
bool True if subscribed, false if not.

◆ read()

taurusmalps.taurusmalpsattribute.TaurusMalPSAttribute.read ( self,
bool cache = False )

Returns the current or default value of the attribute.

In subscription mechanism, the function is necessary to set initial value of the attribute do that when new data arrives, change event could be triggered

◆ removeListener()

taurusmalps.taurusmalpsattribute.TaurusMalPSAttribute.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_throttling_rate()

taurusmalps.taurusmalpsattribute.TaurusMalPSAttribute.set_throttling_rate ( self,
rate )

Sets rate at which received data will be throtled.

E if rate is 10Hz, then within 1s approx 10 data samples should be pushed as new value, no matter what is the frequency of data publisher.

By default the rate is defined in tauruscustomsettings. If, by any reason, the rate cannot be found in tauruscustomsettings, it gets default value of 10 Hz which is defined in MalPSSubscription class.

Parameters
ratethrottling rate [Hz]

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