IRSOL
C++ code implementing socket server for interacting with Baumer camera.
command_gis.cpp
Go to the documentation of this file.
2
3#include "irsol/protocol.hpp"
5
6namespace irsol {
7namespace server {
8namespace handlers {
9CommandGISHandler::CommandGISHandler(std::shared_ptr<Context> ctx)
10 : internal::CommandGIBaseHandler(ctx)
11{}
12
13std::vector<irsol::protocol::OutMessage>
16 std::shared_ptr<irsol::server::ClientSession> session) const
17{
18 auto& state = session->userData().frameListeningState;
19 std::vector<out_message_t> result;
20 // For 'gi' command, no further validation to do.
21 if(state.gisParams.inputSequenceLength == 0) {
22 IRSOL_NAMED_LOG_WARN(session->id(), "Gis inputSequenceLength param is 0, this is not allowed.");
24 message, "Gis inputSequenceLength param is 0, this is not allowed"));
25 return result;
26 }
27 if(state.gisParams.frameRate <= 0) {
29 session->id(), "Gis frameRate param is non-positive, this is not allowed.");
31 message, "Gis frameRate param is non-positive, this is not allowed."));
32 return result;
33 }
34 return result;
35}
36
40 std::shared_ptr<irsol::server::ClientSession> session) const
41{
42 const auto& state = session->userData().frameListeningState;
43 return state.gisParams.inputSequenceLength;
44}
45double
48 std::shared_ptr<irsol::server::ClientSession> session) const
49{
50 const auto& state = session->userData().frameListeningState;
51 return state.gisParams.frameRate;
52}
53
54} // namespace handlers
55} // namespace server
56} // namespace irsol
CommandGISHandler(std::shared_ptr< Context > ctx)
Constructs the CommandGISHandler.
double getFrameRate(const protocol::Command &message, std::shared_ptr< irsol::server::ClientSession > session) const override
Returns the frame rate for the gis command.
uint64_t getInputSequenceLength(const protocol::Command &message, std::shared_ptr< irsol::server::ClientSession > session) const override
Returns the input sequence length for the gis command.
std::vector< irsol::protocol::OutMessage > validate(const protocol::Command &message, std::shared_ptr< irsol::server::ClientSession > session) const override
Validates the gis command parameters.
Declaration of the CommandGISHandler class.
#define IRSOL_NAMED_LOG_WARN(name,...)
Logs a warning-level message using a named logger.
Definition logging.hpp:178
#define IRSOL_MAYBE_UNUSED
Suppresses compiler warnings about unused variables or parameters.
Definition macros.hpp:39
constexpr auto makeHandler(std::shared_ptr< Context > ctx, Args &&... args)
Constructs a handler instance of the given type.
Definition factory.hpp:28
Declaration of the ClientSession class.
Represents a command invocation in the protocol.
Definition command.hpp:33
static Error from(const T &msg, const std::string &description)
Creates an error from a specific incoming message type.
Definition error.hpp:63
auto result