SafeVisionaryControl.h
Go to the documentation of this file.
1 // -- BEGIN LICENSE BLOCK ----------------------------------------------
20 // -- END LICENSE BLOCK ------------------------------------------------
21 
22 #pragma once
23 
24 #include "CoLaCommand.h"
25 #include "ControlSession.h"
26 #include "IAuthentication.h"
27 #include "IProtocolHandler.h"
28 #include "TcpSocket.h"
29 #include <cstdint>
30 #include <memory>
31 #include <string>
32 
33 namespace visionary {
35 {
36 public:
39  {
41  COLA_2 = 2122
42  };
43 
45  static const uint8_t kSessionTimeout_s = 5u;
46 
49 
59  bool open(const std::string& hostname, uint8_t sessionTimeout_s = kSessionTimeout_s);
60 
65  void close();
66 
72  bool login(IAuthentication::UserLevel userLevel, const std::string password);
73 
76  bool logout();
77 
82  std::string getDeviceIdent();
83 
88 
89 private:
90  std::string receiveCoLaResponse();
92 
93  std::unique_ptr<TcpSocket> m_pTransport;
94  std::unique_ptr<IProtocolHandler> m_pProtocolHandler;
95  std::unique_ptr<IAuthentication> m_pAuthentication;
96  std::unique_ptr<ControlSession> m_pControlSession;
97 };
98 
99 } // namespace visionary
visionary::SafeVisionaryControl::COLA_2
@ COLA_2
Definition: SafeVisionaryControl.h:41
visionary::IAuthentication::UserLevel
UserLevel
Available CoLa user levels.
Definition: IAuthentication.h:31
visionary::SafeVisionaryControl::m_pAuthentication
std::unique_ptr< IAuthentication > m_pAuthentication
Definition: SafeVisionaryControl.h:95
IAuthentication.h
TcpSocket.h
visionary::SafeVisionaryControl::login
bool login(IAuthentication::UserLevel userLevel, const std::string password)
Definition: SafeVisionaryControl.cpp:97
visionary
Definition: AuthenticationLegacy.h:25
visionary::SafeVisionaryControl::close
void close()
Definition: SafeVisionaryControl.cpp:74
visionary::CoLaCommand
Definition: CoLaCommand.h:32
visionary::SafeVisionaryControl::getDeviceIdent
std::string getDeviceIdent()
Get device information by calling the "DeviceIdent" method on the device.
Definition: SafeVisionaryControl.cpp:107
visionary::SafeVisionaryControl::logout
bool logout()
Logout from the device.
Definition: SafeVisionaryControl.cpp:102
ControlSession.h
visionary::SafeVisionaryControl::~SafeVisionaryControl
~SafeVisionaryControl()
Definition: SafeVisionaryControl.cpp:37
visionary::SafeVisionaryControl::sendCommand
CoLaCommand sendCommand(CoLaCommand &command)
Send a CoLaBCommand to the device and waits for the result.
Definition: SafeVisionaryControl.cpp:122
IProtocolHandler.h
visionary::SafeVisionaryControl::open
bool open(const std::string &hostname, uint8_t sessionTimeout_s=kSessionTimeout_s)
Definition: SafeVisionaryControl.cpp:39
visionary::SafeVisionaryControl::m_pProtocolHandler
std::unique_ptr< IProtocolHandler > m_pProtocolHandler
Definition: SafeVisionaryControl.h:94
visionary::SafeVisionaryControl::SafeVisionaryControl
SafeVisionaryControl()
Definition: SafeVisionaryControl.cpp:35
visionary::SafeVisionaryControl::kSessionTimeout_s
static const uint8_t kSessionTimeout_s
Default session timeout in seconds.
Definition: SafeVisionaryControl.h:45
visionary::SafeVisionaryControl::m_pTransport
std::unique_ptr< TcpSocket > m_pTransport
Definition: SafeVisionaryControl.h:93
visionary::SafeVisionaryControl::m_pControlSession
std::unique_ptr< ControlSession > m_pControlSession
Definition: SafeVisionaryControl.h:96
visionary::SafeVisionaryControl
Definition: SafeVisionaryControl.h:34
CoLaCommand.h
visionary::SafeVisionaryControl::receiveCoLaResponse
std::string receiveCoLaResponse()
visionary::SafeVisionaryControl::ProtocolType
ProtocolType
The numbers used for the protocols are the port numbers.
Definition: SafeVisionaryControl.h:38
visionary::SafeVisionaryControl::INVALID_PROTOCOL
@ INVALID_PROTOCOL
Definition: SafeVisionaryControl.h:40
visionary::SafeVisionaryControl::receiveCoLaCommand
CoLaCommand receiveCoLaCommand()


sick_safevisionary_base
Author(s):
autogenerated on Sat Oct 21 2023 02:24:26