Class Command
Defined in File Command.h
Inheritance Relationships
Derived Types
public sick::cola2::CloseSession(Class CloseSession)public sick::cola2::CreateSession(Class CreateSession)public sick::cola2::MethodCommand(Class MethodCommand)public sick::cola2::VariableCommand(Class VariableCommand)
Class Documentation
-
class Command
Base class for commands. Defines the base interface and does the common tasks.
Subclassed by sick::cola2::CloseSession, sick::cola2::CreateSession, sick::cola2::MethodCommand, sick::cola2::VariableCommand
Public Functions
-
Command(sick::cola2::Cola2Session &session, uint16_t command_type, uint16_t command_mode)
Constructor of the command. Sets the common variables for a command to the sensor.
- Parameters:
session – The session in which the command will be executed.
command_type – Defines what type of command will be executed in the sensor (Read, Write, Invoking a method).
command_mode – Specifies the mode of the command. If the request is by index or name.
-
inline virtual ~Command()
We have virtual member functions, so a virtual destructor is needed.
-
void lockExecutionMutex()
Locks a mutex to prevent other commands being executed in parallel.
-
std::vector<uint8_t> constructTelegram(const std::vector<uint8_t> &telegram) const
Adds the data to the telegram and afterwards the header with the correct length.
- Parameters:
telegram – The telegram, which will be modified with the data and header.
- Returns:
Completed telegram.
-
void processReplyBase(const std::vector<uint8_t> &packet)
Parses the da incoming data package and then processes it with the inherited processReply. Afterwards the mutex will be unlocked to allow new commands to be send.
- Parameters:
packet – The incoming data package which will be processed.
-
void waitForCompletion()
Scooped call to the mutex, which will block until the reply was processed.
-
void setSessionID(uint32_t session_id)
Sets the session ID.
- Parameters:
session_id – The new session ID.
-
bool wasSuccessful() const
Returns if the command was successfully parsed.
- Returns:
If the command was successfully parsed.
-
void setCommandType(const uint8_t &command_type)
Sets the command type.
- Parameters:
command_type – The new command type.
-
void setCommandMode(const uint8_t &command_mode)
Sets the command mode.
- Parameters:
command_mode – The new command mode.
Protected Functions
Protected Attributes
-
sick::cola2::Cola2Session &m_session
-
Command(sick::cola2::Cola2Session &session, uint16_t command_type, uint16_t command_mode)