CloseSession.cpp
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 
24 // -- END LICENSE BLOCK ------------------------------------------------
25 
26 //----------------------------------------------------------------------
33 //----------------------------------------------------------------------
34 
35 
37 
40 
41 namespace sick {
42 namespace cola2 {
43 
45  : Command(session, 0x43, 0x58) // see cola2 manual 0x43 = C, 0x58 = X
46 {
47 }
48 
49 std::vector<uint8_t> CloseSession::addTelegramData(const std::vector<uint8_t>& telegram) const
50 {
51  return telegram;
52 }
53 
55 {
56  return false;
57 }
58 
60 {
61  bool result = false;
62  if ((getCommandType() == 'C' && getCommandMode() == 'A') ||
63  (getCommandType() == 0x43 && getCommandMode() == 0x41))
64  {
66  ROS_INFO("Successfully closed Cola2 session with sessionID: %u", m_session.getSessionID());
67  result = true;
68  }
69  else
70  {
71  ROS_WARN("Could not close Cola2 session with sessionID: %u", m_session.getSessionID());
72  }
73  return result;
74 }
75 
76 } // namespace cola2
77 } // namespace sick
uint8_t getCommandType() const
Returns the command type.
Definition: Command.cpp:81
CloseSession(Cola2Session &session)
Constructor of the command to close a cola2 session.
Base class for commands. Defines the base interface and does the common tasks.
Definition: Command.h:61
#define ROS_WARN(...)
uint32_t getSessionID() const
Returns the current session ID.
Definition: Command.cpp:101
#define ROS_INFO(...)
sick::cola2::Cola2Session & m_session
Definition: Command.h:192
bool processReply()
Processes the return from the sensor.
uint8_t getCommandMode() const
Returns the command mode.
Definition: Command.cpp:91
void setSessionID(const uint32_t &session_id)
Sets the current session ID.
bool canBeExecutedWithoutSessionID() const
Returns if the command can be executed without a session ID. Will return false for most commands exce...
std::vector< uint8_t > addTelegramData(const std::vector< uint8_t > &telegram) const
Adds data to the telegram. The close cola2 session command does not carry any extra data and therefor...
uint32_t getSessionID() const
Returns the current session ID.
Establishes a cola2 session with a sensor and enables execution of commands in this session...
Definition: Cola2Session.h:72


sick_safetyscanners
Author(s): Lennart Puck
autogenerated on Fri Apr 2 2021 02:45:41