00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- 00002 00003 // -- BEGIN LICENSE BLOCK ---------------------------------------------- 00004 00024 // -- END LICENSE BLOCK ------------------------------------------------ 00025 00026 //---------------------------------------------------------------------- 00033 //---------------------------------------------------------------------- 00034 00035 00036 #include <sick_safetyscanners/cola2/CloseSession.h> 00037 00038 #include <sick_safetyscanners/cola2/Cola2Session.h> 00039 #include <sick_safetyscanners/cola2/Command.h> 00040 00041 namespace sick { 00042 namespace cola2 { 00043 00044 CloseSession::CloseSession(Cola2Session& session) 00045 : Command(session, 0x43, 0x58) // see cola2 manual 0x43 = C, 0x58 = X 00046 { 00047 } 00048 00049 void CloseSession::addTelegramData(sick::datastructure::PacketBuffer::VectorBuffer& telegram) const 00050 { 00051 } 00052 00053 bool CloseSession::canBeExecutedWithoutSessionID() const 00054 { 00055 return false; 00056 } 00057 00058 bool CloseSession::processReply() 00059 { 00060 if ((getCommandType() == 'C' && getCommandMode() == 'A') || 00061 (getCommandType() == 0x43 && getCommandMode() == 0x41)) 00062 { 00063 m_session.setSessionID(getSessionID()); 00064 ROS_INFO("Successfully closed Cola2 session with sessionID: %u", m_session.getSessionID()); 00065 return true; 00066 } 00067 else 00068 { 00069 ROS_WARN("Could not close Cola2 session with sessionID: %u", m_session.getSessionID()); 00070 return false; 00071 } 00072 } 00073 00074 } // namespace cola2 00075 } // namespace sick