trikRuntime
|
Base class for all virtual sensor workers. More...
#include <abstractVirtualSensorWorker.h>
Public Slots | |
virtual void | stop () |
Stops detection until init() will be called again. More... | |
Signals | |
void | stopped () |
Emitted when sensor is stopped successfully. More... | |
Public Member Functions | |
AbstractVirtualSensorWorker (const QString &script, const QString &inputFile, const QString &outputFile, DeviceState &state, trikHal::HardwareAbstractionInterface &hardwareAbstraction) | |
Constructor. More... | |
~AbstractVirtualSensorWorker () override | |
Status | status () const override |
Returns current status of the device. More... | |
Public Member Functions inherited from trikControl::DeviceInterface | |
DeviceInterface ()=default | |
virtual | ~DeviceInterface ()=default |
Protected Member Functions | |
void | init () |
Launch sensor. More... | |
void | sendCommand (const QString &command) |
If sensor is ready, sends a command to its input FIFO, otherwise queues this command and sends it later. More... | |
Additional Inherited Members | |
Public Types inherited from trikControl::DeviceInterface | |
enum | Status { Status::permanentFailure, Status::temporaryFailure, Status::off, Status::starting, Status::ready, Status::stopping } |
Device status. More... | |
Static Public Member Functions inherited from trikControl::DeviceInterface | |
static Status | combine (const DeviceInterface &underlying, const DeviceInterface::Status &dependent) |
Helper method to return status of a device relying on other device to work. More... | |
Base class for all virtual sensor workers.
Virtual sensor is an external process that communicates using input and output FIFOs and uses script that allows to start, stop or restart it. This class is a worker that is intended to run in separate process and is responsible for technical side of communication with virtual server. Actual protocol and interpretation of data must be implemented in descendants.
AbstractVirtualSensorWorker::AbstractVirtualSensorWorker | ( | const QString & | script, |
const QString & | inputFile, | ||
const QString & | outputFile, | ||
DeviceState & | state, | ||
trikHal::HardwareAbstractionInterface & | hardwareAbstraction | ||
) |
Constructor.
script | - file name of a scrit used to start or stop a sensor. |
inputFile | - sensor input fifo. Note that we will write data here, not read it. |
outputFile | - sensor output fifo. Note that we will read sensor data from here. |
state | - shared state of a sensor. |
|
override |
|
protected |
Launch sensor.
|
protected |
If sensor is ready, sends a command to its input FIFO, otherwise queues this command and sends it later.
|
overridevirtual |
Returns current status of the device.
Implements trikControl::DeviceInterface.
|
virtualslot |
|
signal |
Emitted when sensor is stopped successfully.