VisionaryControl.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2023 SICK AG, Waldkirch
3 //
4 // SPDX-License-Identifier: Unlicense
5 
6 #pragma once
7 
8 #include "CoLaCommand.h"
9 #include "ControlSession.h"
10 #include "IAuthentication.h"
11 #include "IProtocolHandler.h"
12 #include "TcpSocket.h"
13 #include <cstdint>
14 #include <memory>
15 #include <string>
16 
17 namespace visionary {
18 
20 {
21 public:
24  {
26  COLA_A = 2111,
27  COLA_B = 2112,
28  COLA_2 = 2122
29  };
30 
32  static constexpr uint32_t kSessionTimeout_ms = 5000;
33 
36 
51  bool open(ProtocolType type,
52  const std::string& hostname,
53  uint32_t sessionTimeout_ms = kSessionTimeout_ms,
54  bool autoReconnect = true,
55  uint32_t connectTimeout_ms = kSessionTimeout_ms);
56 
61  void close();
62 
68  bool login(IAuthentication::UserLevel userLevel, const std::string& password);
69 
72  bool logout();
73 
78  std::string getDeviceIdent();
79 
84  uint16_t GetBlobPort();
85 
91  bool burstAcquisition(uint16_t burstLen);
92 
97  bool startAcquisition();
98 
103  bool stepAcquisition();
104 
108  bool stopAcquisition();
109 
114  bool getDataStreamConfig();
115 
119  CoLaCommand sendCommand(const CoLaCommand& command);
120 
121 private:
122  std::string receiveCoLaResponse();
124 
125  std::unique_ptr<TcpSocket> m_pTransport;
126  std::unique_ptr<IProtocolHandler> m_pProtocolHandler;
127  std::unique_ptr<IAuthentication> m_pAuthentication;
128  std::unique_ptr<ControlSession> m_pControlSession;
129 
131  std::string m_hostname;
135 };
136 
137 } // namespace visionary
visionary::IAuthentication::UserLevel
UserLevel
Available CoLa user levels.
Definition: IAuthentication.h:15
IAuthentication.h
TcpSocket.h
visionary::VisionaryControl::GetBlobPort
uint16_t GetBlobPort()
Get blob port address.
Definition: VisionaryControl.cpp:223
visionary::VisionaryControl::startAcquisition
bool startAcquisition()
Start streaming the data by calling the "PLAYSTART" method on the device. Works only when acquisition...
Definition: VisionaryControl.cpp:168
visionary
Definition: MD5.cpp:44
visionary::CoLaCommand
Definition: CoLaCommand.h:17
visionary::VisionaryControl::~VisionaryControl
~VisionaryControl()
visionary::VisionaryControl::m_sessionTimeout_ms
uint32_t m_sessionTimeout_ms
Definition: VisionaryControl.h:132
visionary::VisionaryControl::VisionaryControl
VisionaryControl()
Definition: VisionaryControl.cpp:22
visionary::VisionaryControl::getDataStreamConfig
bool getDataStreamConfig()
Tells the device that there is a streaming channel by invoking a method named GetBlobClientConfig.
Definition: VisionaryControl.cpp:193
visionary::VisionaryControl::ProtocolType
ProtocolType
The numbers used for the protocols are the port numbers.
Definition: VisionaryControl.h:23
visionary::VisionaryControl::getDeviceIdent
std::string getDeviceIdent()
Get device information by calling the "DeviceIdent" method on the device.
Definition: VisionaryControl.cpp:143
visionary::VisionaryControl::m_hostname
std::string m_hostname
Definition: VisionaryControl.h:131
visionary::VisionaryControl::COLA_B
@ COLA_B
Definition: VisionaryControl.h:27
visionary::VisionaryControl::m_autoReconnect
bool m_autoReconnect
Definition: VisionaryControl.h:134
visionary::VisionaryControl::m_pControlSession
std::unique_ptr< ControlSession > m_pControlSession
Definition: VisionaryControl.h:128
visionary::VisionaryControl::COLA_A
@ COLA_A
Definition: VisionaryControl.h:26
ControlSession.h
visionary::VisionaryControl::stopAcquisition
bool stopAcquisition()
Stops the data stream. Works always, also when acquisition is already stopped before.
Definition: VisionaryControl.cpp:185
visionary::VisionaryControl::m_pProtocolHandler
std::unique_ptr< IProtocolHandler > m_pProtocolHandler
Definition: VisionaryControl.h:126
visionary::VisionaryControl::m_connectTimeout_ms
uint32_t m_connectTimeout_ms
Definition: VisionaryControl.h:133
IProtocolHandler.h
visionary::VisionaryControl::COLA_2
@ COLA_2
Definition: VisionaryControl.h:28
visionary::VisionaryControl::login
bool login(IAuthentication::UserLevel userLevel, const std::string &password)
Definition: VisionaryControl.cpp:133
visionary::VisionaryControl::INVALID_PROTOCOL
@ INVALID_PROTOCOL
Definition: VisionaryControl.h:25
visionary::VisionaryControl::m_protocolType
ProtocolType m_protocolType
Definition: VisionaryControl.h:130
visionary::VisionaryControl::open
bool open(ProtocolType type, const std::string &hostname, uint32_t sessionTimeout_ms=kSessionTimeout_ms, bool autoReconnect=true, uint32_t connectTimeout_ms=kSessionTimeout_ms)
Definition: VisionaryControl.cpp:29
visionary::VisionaryControl::kSessionTimeout_ms
static constexpr uint32_t kSessionTimeout_ms
Default session timeout.
Definition: VisionaryControl.h:32
visionary::VisionaryControl::m_pTransport
std::unique_ptr< TcpSocket > m_pTransport
Definition: VisionaryControl.h:125
visionary::VisionaryControl::logout
bool logout()
Logout from the device.
Definition: VisionaryControl.cpp:138
visionary::VisionaryControl::close
void close()
Definition: VisionaryControl.cpp:110
visionary::VisionaryControl::stepAcquisition
bool stepAcquisition()
Trigger a single image on the device. Works only when acquisition is stopped.
Definition: VisionaryControl.cpp:177
visionary::VisionaryControl::sendCommand
CoLaCommand sendCommand(const CoLaCommand &command)
Send a CoLaBCommand to the device and waits for the result.
Definition: VisionaryControl.cpp:201
CoLaCommand.h
visionary::VisionaryControl::m_pAuthentication
std::unique_ptr< IAuthentication > m_pAuthentication
Definition: VisionaryControl.h:127
visionary::VisionaryControl::receiveCoLaResponse
std::string receiveCoLaResponse()
visionary::VisionaryControl::burstAcquisition
bool burstAcquisition(uint16_t burstLen)
Start streaming a burst of data by calling the "PLAYBURST" method on the device. Works only when acqu...
Definition: VisionaryControl.cpp:158
visionary::VisionaryControl::receiveCoLaCommand
CoLaCommand receiveCoLaCommand()
visionary::VisionaryControl
Definition: VisionaryControl.h:19


sick_visionary_ros
Author(s): SICK AG TechSupport 3D Snapshot
autogenerated on Thu Feb 8 2024 03:56:19