qumbia-tango-controls 1.x
Library on top of cumbia-qtcontrols and cumbia-tango
Public Member Functions | List of all members
CuTControlsReader Class Reference

implements CuControlsReaderA abstract class and provides an interface to connect a Tango reader to a source. More...

#include <cutcontrolsreader.h>

Inheritance diagram for CuTControlsReader:
Inheritance graph
[legend]

Public Member Functions

 CuTControlsReader (Cumbia *cumbia_tango, CuDataListener *tl)
 class constructor that's configured with CumbiaTango and CuDataListener instances More...
 
virtual ~CuTControlsReader ()
 the class destructor. More...
 
void setSource (const QString &s)
 connect the reader to the Tango control system and start reading More...
 
QString source () const
 
void unsetSource ()
 Stops the reader. More...
 
void setOptions (const CuData &o)
 configures the reader through the options passed as parameter More...
 
void sendData (const CuData &d)
 forwards the data passed as parameter to the underlying CuTReader More...
 
void getData (CuData &d_ino) const
 send a CuData bundle as input argument to the CuTReader associated to this object with this source and get a reply. More...
 

Detailed Description

implements CuControlsReaderA abstract class and provides an interface to connect a Tango reader to a source.

Built with references to CumbiaTango and CuDataListener, CuTControlsReader implements CuControlsReaderA and connects a reader to the Tango control system through the setSource method. setOptions can discretionary be called before setSource.

For a list of options recognised by CuTReader, see CuTReader::getData

Parameters and configuration can be sent and queried with sendData and getData respectively.

unsetSource can finally be called in order to stop a running reader, and if CuTControlsReader is deleted, unsetSource is called automatically.

Constructor & Destructor Documentation

◆ CuTControlsReader()

CuTControlsReader::CuTControlsReader ( Cumbia *  cumbia_tango,
CuDataListener *  tl 
)

class constructor that's configured with CumbiaTango and CuDataListener instances

Parameters
cumbia_tangoa pointer to a CumbiaTango instance
CuDataListenera pointer to an object implementing the CuDataListener interface

◆ ~CuTControlsReader()

CuTControlsReader::~CuTControlsReader ( )
virtual

the class destructor.

The class destructors sets the invalidate flag on the listener, so that it won't be used later, and calls unsetSource

References unsetSource().

Member Function Documentation

◆ getData()

void CuTControlsReader::getData ( CuData &  d_ino) const

send a CuData bundle as input argument to the CuTReader associated to this object with this source and get a reply.

Parameters
d_inoa (non const) reference to a CuData compiled with the input arguments recognised by the CuTReader. When the function returns, the CuData will contain the reply.
options recognised by CuTReader.
For a list of options recognised by CuTReader, see CuTReader::getData
Note
CuTReader implements the CuTangoActionI interface.

This method finds the CuTangoActionI with the source of this reader and calls getData on it, passing d_ino as argument.

◆ sendData()

void CuTControlsReader::sendData ( const CuData &  data)

forwards the data passed as parameter to the underlying CuTReader

Note
CuTReader implements the CuTangoActionI interface.

This method finds the CuTangoActionI with the source of this reader and calls sendData on it.

◆ setOptions()

void CuTControlsReader::setOptions ( const CuData &  o)

configures the reader through the options passed as parameter

Parameters
oCuData with the options to set on the reader

See CuTReaderFactory::setOptions and CuTangoOptBuilder documentation.

This is usually called by CuTReaderFactory::create immediately after CuTControlsWriter is instantiated.

Referenced by CuTReaderFactory::create().

◆ setSource()

void CuTControlsReader::setSource ( const QString &  s)

connect the reader to the Tango control system and start reading

Parameters
sthe name of the source (Tango device attribute or command) for the reader
Usage
Normally, cumbia-qtcontrols widgets provide a setSource method that deals with reader set up through CuContext. If you need to implement a custom reader, please refer to the CuContext documentation and to the examples offered by QuLabel or QuWatcher.
Source syntax
  • test/device/1/double_scalar: read the Tango double_scalar attribute
  • inj/diagnostics/cm_inj.01->GetCharge(0,1000): read the Tango command and provide 0, 1000 as input parameters (argin)
  • $1->GetCharge(0,1000) same as above, but $1 is replaced by the first device name found in the command line arguments of the application
  • $1->GetCharge(&spinBoxMode, &spinBoxSamples) same as above, but the two parameters are sent according to the "value" property of the two spin boxes with the names specified in the arguments
This method starts two activities, one for attribute configuration (i.e. get attribute configuration or get command info) and one for the actual reader. The configuration step is exploited by graphical elements to set minimum, maximum, alarm values, units and so on.

References CuTControlsUtils::replaceWildcards().

◆ source()

QString CuTControlsReader::source ( ) const

returns the source of the reader.

note
The returned string will contain the actual source, after wildcards have been replaced.
See also
setSource

◆ unsetSource()

void CuTControlsReader::unsetSource ( )

Stops the reader.

This must be called from the main thread.

Developer note
Calls CumbiaTango::unlinkListener for CuTangoActionI::ReaderConfig and CuTangoActionI::Reader action types in a row.

Referenced by ~CuTControlsReader().


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