Signals interface. More...
#include <bpssignals.h>
Signals | |
| void | error (const QString &aMessage) |
| Combined failure signal from setOutputsError() and readInputsError(). | |
| void | ok () |
| Combined success signal from setOutputsOk() and readInputsOk(). | |
| void | readInputsError (const QString &aMessage) |
| Signal emitted after reading the inputs with readInputs() has failed. | |
| void | readInputsOk (const BpsSignalsMap &aInputs) |
| Signal emitted after reading the inputs wit readInputs() has completed successfully. | |
| void | setOutputsError (const QString &aMessage) |
| Signal emitted after setting the outputs with setOutputs() has failed. | |
| void | setOutputsOk (const BpsSignalsMap &aOutputs) |
| Signal emitted after setting the outputs with setOutputs() has completed successfully. | |
Public Member Functions | |
| BpsSignals (QObject *aParent=0) | |
| QMap< QString, QString > | config () const |
| virtual int | inputsCount () const =0 |
| virtual int | outputsCount () const =0 |
| virtual void | readInputs ()=0 |
| Request to read the inputs. | |
| void | setConfig (const QMap< QString, QString > &aConfig) |
| Set the signals configuration. | |
| virtual void | setOutputs (const BpsSignalsMap &aOutputs)=0 |
| Request to set outputs on/off. | |
| virtual | ~BpsSignals () |
| Virtual default destructor. | |
Signals interface.
Signals interfaces operate similar as a thread, where commands are given by request calls, and results are returned as signals. Background operations are however implemented with QTimer, so the requesting thread must have an event queue. Overlapped requests are not supported, subsequent requests should be made only after the previous has been answered by a signal.
| BpsSignals::BpsSignals | ( | QObject * | aParent = 0 | ) |
| [in] | aParent | The parent object. |
| QMap<QString,QString> BpsSignals::config | ( | ) | const |
| void BpsSignals::error | ( | const QString & | aMessage | ) | [signal] |
Combined failure signal from setOutputsError() and readInputsError().
| [in] | aMessage | Information about the failure reason (for example "Timeout", "Device not open" etc.) |
| virtual int BpsSignals::inputsCount | ( | ) | const [pure virtual] |
| virtual int BpsSignals::outputsCount | ( | ) | const [pure virtual] |
| virtual void BpsSignals::readInputs | ( | ) | [pure virtual] |
Request to read the inputs.
The result is reported by the inputs signal.
| void BpsSignals::readInputsError | ( | const QString & | aMessage | ) | [signal] |
Signal emitted after reading the inputs with readInputs() has failed.
| [in] | aMessage | The error message to display. |
| void BpsSignals::readInputsOk | ( | const BpsSignalsMap & | aInputs | ) | [signal] |
Signal emitted after reading the inputs wit readInputs() has completed successfully.
| [in] | aInputs | Map of the logical input numbers and states (true = on, false = off). |
| void BpsSignals::setConfig | ( | const QMap< QString, QString > & | aConfig | ) |
Set the signals configuration.
This should be done before making requests.
| [in] | aConfig | The signals configuration, usually the values in Central System Settings/Terminals/TERMINAL/Packlines/LINENO/Scales. |
| virtual void BpsSignals::setOutputs | ( | const BpsSignalsMap & | aOutputs | ) | [pure virtual] |
Request to set outputs on/off.
| [in] | aOutputs | Map of the logical output numbers and states to set (true = on, false = off). Outputs not listed in the map are left unchanged. |
| void BpsSignals::setOutputsError | ( | const QString & | aMessage | ) | [signal] |
Signal emitted after setting the outputs with setOutputs() has failed.
| [in] | aMessage | The error message to display. |
| void BpsSignals::setOutputsOk | ( | const BpsSignalsMap & | aOutputs | ) | [signal] |
Signal emitted after setting the outputs with setOutputs() has completed successfully.
| [in] | aOutputs | Map of the logical output numbers and states hey are set now (true = on, false = off). |