trikRuntime
trikControl::DeviceState Class Reference

Helper class to track device state (off, starting, ready, stopping, fail). More...

#include <deviceState.h>

Public Member Functions

 DeviceState (const QString &deviceName)
 Constructor. More...
 
DeviceInterface::Status status () const
 Returns current device state. More...
 
bool isReady () const
 Returns true if device is in "ready" state. More...
 
bool isFailed () const
 Returns true if device is in "failure" state. More...
 
void fail ()
 Set "failure" state. More...
 
void start ()
 Set "starting" state. Possible only from "off" state. More...
 
void ready ()
 Set "ready" state. Possible only from "off" and "starting" states. More...
 
void stop ()
 Set "stopping" state. Possible only from "ready" state. More...
 
void off ()
 Set "off" state. Possible only from "ready" and "stopping" states. More...
 
void resetFailure ()
 Clears "failed" state and returns state to "off". More...
 
QString deviceName () const
 Returns name of the device for debug purposes. More...
 

Detailed Description

Helper class to track device state (off, starting, ready, stopping, fail).

Thread-safe.

Constructor & Destructor Documentation

DeviceState::DeviceState ( const QString &  deviceName)

Constructor.

Parameters
deviceName- name of the device, used for debug output.

Member Function Documentation

QString DeviceState::deviceName ( ) const

Returns name of the device for debug purposes.

void DeviceState::fail ( )

Set "failure" state.

Possible from every state. Failure is permanent. If device is in this state, other state-changing commands are ignored quietly, so device can continue initialization sequence if possible, but still be in "failure" state as a result.

bool DeviceState::isFailed ( ) const

Returns true if device is in "failure" state.

bool DeviceState::isReady ( ) const

Returns true if device is in "ready" state.

void DeviceState::off ( )

Set "off" state. Possible only from "ready" and "stopping" states.

void DeviceState::ready ( )

Set "ready" state. Possible only from "off" and "starting" states.

void DeviceState::resetFailure ( )

Clears "failed" state and returns state to "off".

void DeviceState::start ( )

Set "starting" state. Possible only from "off" state.

DeviceInterface::Status DeviceState::status ( ) const

Returns current device state.

void DeviceState::stop ( )

Set "stopping" state. Possible only from "ready" state.


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