trikRuntime
trikControl::AbstractVirtualSensorWorker Class Referenceabstract

Base class for all virtual sensor workers. More...

#include <abstractVirtualSensorWorker.h>

Inheritance diagram for trikControl::AbstractVirtualSensorWorker:
Collaboration diagram for trikControl::AbstractVirtualSensorWorker:

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

AbstractVirtualSensorWorker::AbstractVirtualSensorWorker ( const QString &  script,
const QString &  inputFile,
const QString &  outputFile,
DeviceState state,
trikHal::HardwareAbstractionInterface hardwareAbstraction 
)

Constructor.

Parameters
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.
AbstractVirtualSensorWorker::~AbstractVirtualSensorWorker ( )
override

Member Function Documentation

void AbstractVirtualSensorWorker::init ( )
protected

Launch sensor.

void AbstractVirtualSensorWorker::sendCommand ( const QString &  command)
protected

If sensor is ready, sends a command to its input FIFO, otherwise queues this command and sends it later.

AbstractVirtualSensorWorker::Status AbstractVirtualSensorWorker::status ( ) const
overridevirtual

Returns current status of the device.

Implements trikControl::DeviceInterface.

void AbstractVirtualSensorWorker::stop ( )
virtualslot

Stops detection until init() will be called again.

Todo:
Correctly stop starting sensor.
void trikControl::AbstractVirtualSensorWorker::stopped ( )
signal

Emitted when sensor is stopped successfully.


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