BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions
BeeeOn::OZWCommand Class Reference

OZWCommand handles OpenZWave command management. It allows to request a command to be executed and takes care of race conditions. More...

#include <OZWCommand.h>

Inheritance diagram for BeeeOn::OZWCommand:
BeeeOn::Loggable

Public Types

enum  Type { NONE, INCLUSION, REMOVE_NODE }
 

Public Member Functions

 OZWCommand (OZWNetwork &ozw)
 
Type type () const
 
bool wasRequested () const
 
bool isRunning () const
 
bool isCancelling () const
 
void request (Type type, uint32_t home)
 Request the given type of command to execute in the context of the given Z-Wave home ID. More...
 
bool cancelIf (Type type, const Poco::Timespan &timeout)
 Cancel the current command if it is of the given type. This allows to cancel e.g. INCLUSION without knowing whether INCLUSION is currently running. The cancel operation blocks at least for the given timeout. If the timeout exceeds, the cancelling operation is stopped. More...
 

Protected Member Functions

void onNormal ()
 
void onStarted ()
 
void onWaitUser ()
 
void onInProgress ()
 
void onSleeping ()
 
void onCancelled ()
 
void onError (OpenZWave::Driver::ControllerError error)
 
void onFailed ()
 
void onSuccess ()
 
void onNodeOK ()
 
void onNodeFailed ()
 

Static Protected Member Functions

static void handle (OpenZWave::Driver::ControllerState state, OpenZWave::Driver::ControllerError error, void *context)
 

Detailed Description

OZWCommand handles OpenZWave command management. It allows to request a command to be executed and takes care of race conditions.

Member Function Documentation

bool OZWCommand::cancelIf ( Type  type,
const Poco::Timespan &  timeout 
)

Cancel the current command if it is of the given type. This allows to cancel e.g. INCLUSION without knowing whether INCLUSION is currently running. The cancel operation blocks at least for the given timeout. If the timeout exceeds, the cancelling operation is stopped.

Returns
true if the given type matches the currently running command and the cancel has succeededl
Parameters
typeof operation to be cancelled
timeoutto block at maximum (must be at least 1 ms)
Exceptions
InvalidArgumentExceptionif the given timeout is invalid
IllegalStateExceptionwhen the command is already being cancelled
IllegalStateExceptionwhen no command has been requested
bool OZWCommand::isCancelling ( ) const
Returns
true if the current command is being cancelled (this can take some time)
bool OZWCommand::isRunning ( ) const
Returns
true if a command has been requested and is already in progress (running)
void OZWCommand::request ( Type  type,
uint32_t  home 
)

Request the given type of command to execute in the context of the given Z-Wave home ID.

Exceptions
IllegalStateExceptionwhen a command is already requested or running
IllegalStateExceptionwhen the command has failed to start
OZWCommand::Type OZWCommand::type ( ) const
Returns
type of command that is currently in progress
bool OZWCommand::wasRequested ( ) const
Returns
true if a command has been requested and did not finished yet

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