DigitalInput
Source locationmrx/io/Io.hpp
Inherits:
QObject
An acquired digital input, released when the handle is destroyed.
Keep and use it in its Io’s thread; do not move either object to another thread while the input exists.
Public Methods
Section titled “Public Methods”| Return | Name | Description |
|---|---|---|
~DigitalInput override | ||
bool | read const | Read synchronously; value is unchanged on failure. |
QMetaObject::Connection | listen | Subscribe to samples. |
override
~DigitalInput
Section titled “~DigitalInput”Source locationmrx/io/Io.hpp
const
Source locationmrx/io/Io.hpp
Read synchronously; value is unchanged on failure.
Returns
Section titled “Returns”Whether reading succeeded.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
value | bool* | Non-null destination. |
error | QString* | Optional error. |
listen
Section titled “listen”Source locationmrx/io/Io.hpp
Subscribe to samples.
Returns
Section titled “Returns”Disconnectable connection, or an invalid connection for invalid arguments or unavailable monitoring. Unavailable monitoring also emits monitoringError.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
context | QObject* | Callback lifetime owner. |
handler | const std::function<void(bool)>& | Sample handler. |
invert | bool | Invert only this callback’s values. |
Signals
Section titled “Signals”| Return | Name | Description |
|---|---|---|
void | sampled | Emitted for every successful sample, including unchanged values. |
void | monitoringError | Emitted and logged when monitoring fails or its Io is destroyed; synchronous reads remain available. |
sampled
Section titled “sampled”Source locationmrx/io/Io.hpp
Emitted for every successful sample, including unchanged values.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
value | bool | Sample value. |
monitoringError
Section titled “monitoringError”Source locationmrx/io/Io.hpp
Emitted and logged when monitoring fails or its Io is destroyed; synchronous reads remain available.
A failed read is retried at the next tick and reported once until it recovers.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
error | const QString& | Failure description. |