Program Listing for File SafeVisionaryControl.h
↰ Return to documentation for file (include/sick_safevisionary_base/SafeVisionaryControl.h
)
// -- BEGIN LICENSE BLOCK ----------------------------------------------
// -- END LICENSE BLOCK ------------------------------------------------
#pragma once
#include "CoLaCommand.h"
#include "ControlSession.h"
#include "IAuthentication.h"
#include "IProtocolHandler.h"
#include "TcpSocket.h"
#include <cstdint>
#include <memory>
#include <string>
namespace visionary {
class SafeVisionaryControl
{
public:
enum ProtocolType
{
INVALID_PROTOCOL = -1,
COLA_2 = 2122
};
static const uint8_t kSessionTimeout_s = 5u;
SafeVisionaryControl();
~SafeVisionaryControl();
bool open(const std::string& hostname, uint8_t sessionTimeout_s = kSessionTimeout_s);
void close();
bool login(IAuthentication::UserLevel userLevel, const std::string password);
bool logout();
std::string getDeviceIdent();
CoLaCommand sendCommand(CoLaCommand& command);
private:
std::string receiveCoLaResponse();
CoLaCommand receiveCoLaCommand();
std::unique_ptr<TcpSocket> m_pTransport;
std::unique_ptr<IProtocolHandler> m_pProtocolHandler;
std::unique_ptr<IAuthentication> m_pAuthentication;
std::unique_ptr<ControlSession> m_pControlSession;
};
} // namespace visionary