cumbia-http 1.x
Qt widgets on top of the cumbia C++ library
|
#include <cuhttpcontrolsreader.h>
Public Member Functions | |
CuHttpControlsReader (Cumbia *cumbia, CuDataListener *tl) | |
virtual | ~CuHttpControlsReader () |
void | setSource (const QString &s) |
Enqueue a request for either a single shot reading and an optional subscription for data updates through the channel. More... | |
QString | source () const |
void | unsetSource () |
unlink the listener and, if the source is "subscribed", send an "unsubscribe" request More... | |
void | setOptions (const CuData &o) |
CuData | getOptions () const |
virtual void | sendData (const CuData &d) |
Send data to the service managing this reader. More... | |
virtual void | getData (CuData &d_ino) const |
CuHttpControlsReader::CuHttpControlsReader | ( | Cumbia * | cumbia, |
CuDataListener * | tl | ||
) |
References CumbiaHttp::CumbiaHTTPType.
|
virtual |
|
virtual |
CuData CuHttpControlsReader::getOptions | ( | ) | const |
|
virtual |
Send data to the service managing this reader.
data | the data to send |
\list keys
On the other hand, if the "manual" option is enabled for the current reader, then a new read is requested through http, which should be quite safe.
References CuHTTPActionEditFactory::setOptions(), and setSource().
void CuHttpControlsReader::setOptions | ( | const CuData & | o | ) |
Referenced by CuHTTPReaderFactory::create().
void CuHttpControlsReader::setSource | ( | const QString & | s | ) |
Enqueue a request for either a single shot reading and an optional subscription for data updates through the channel.
s | the name of the source |
The reader always performs a synchronous immediate reading.
CuHttpControlsReader stores a method property that determines the behaviour of the reader and can either be:
The single shot only read mode is activated by either single-shot or manual option set on the CuHTTPReaderFactory.
Moreover, if the options contain the property key set to true, the synchronous reply shall contain the source configuration alongside its value. Otherwise, only the value will be fetched.
References CuHTTPActionReaderFactory::mergeOptions(), and CuHTTPSrc::prepare().
Referenced by sendData().
QString CuHttpControlsReader::source | ( | ) | const |
void CuHttpControlsReader::unsetSource | ( | ) |
unlink the listener and, if the source is "subscribed", send an "unsubscribe" request
unsetSource will send an unsubscribe request if the method for this source is "s" (the source is monitored on a channel).
On the other hand, the class destructor alone will not send an unsubscribe request, to avoid flooding the server with unsubscribe requests at application shutdown. In this case, a global unsubscribe request is sent by CumbiaHttp for the entire client application
The implementation somehow differs from the other cumbia engines (for example cumbia-tango, where the destructor actually performs a thorough disconnection from the Tango device) but ensures a consistent and simple unsetSource interface across the engines.