IRSOL
C++ code implementing socket server for interacting with Baumer camera.
inquiry_image_size.hpp
Go to the documentation of this file.
1
10#pragma once
11
12#include "irsol/macros.hpp"
13#include "irsol/server/app.hpp"
15
16#include <string_view>
17namespace irsol {
18namespace server {
19namespace handlers {
20namespace internal {
21
26{
27 static constexpr std::string_view name = "OffsetX";
28};
29
34{
35 static constexpr std::string_view name = "Width";
36};
37
42{
43 static constexpr std::string_view name = "OffsetY";
44};
45
50{
51 static constexpr std::string_view name = "Height";
52};
53
61template<typename InquiryCameraImageAttribute>
63{
64 static constexpr std::string_view name = InquiryCameraImageAttribute::name;
65
66public:
71 InquiryImgHandlerBase(std::shared_ptr<Context> ctx): InquiryHandler(ctx) {}
72
73protected:
80 std::vector<out_message_t> process(
81 IRSOL_MAYBE_UNUSED std::shared_ptr<irsol::server::ClientSession> session,
82 protocol::Inquiry&& message) final override
83 {
84 auto& cam = ctx->app.camera();
85 int value = cam.getParam<int>(std::string(name));
86 std::vector<out_message_t> result;
88 return result;
89 }
90};
91} // namespace internal
92
113
114} // namespace handlers
115} // namespace server
116} // namespace irsol
Main server application managing client connections and camera streaming.
Base handler templates for protocol message processing.
Generic handler base class for protocol messages.
Definition base.hpp:39
std::shared_ptr< Context > ctx
Handler context (provides access to app and utilities).
Definition base.hpp:81
Base handler template for inquiring a camera image region parameter.
std::vector< out_message_t > process(IRSOL_MAYBE_UNUSED std::shared_ptr< irsol::server::ClientSession > session, protocol::Inquiry &&message) final override
Processes an inquiry message to retrieve the camera image parameter.
InquiryImgHandlerBase(std::shared_ptr< Context > ctx)
Constructs the handler.
Common portability and diagnostic macros for the irsol library.
#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
std::variant< int, double, std::string > protocol_value_t
Variant type representing protocol values that can be one of several types.
Definition types.hpp:150
Represents a value inquiry in the protocol.
Definition inquiry.hpp:32
static Success from(const Assignment &msg, std::optional< irsol::types::protocol_value_t > overrideValue=std::nullopt)
Creates a success message from an Assignment.
Definition success.hpp:75
Tag type for the camera image height parameter ("Height").
Tag type for the camera image left offset parameter ("OffsetX").
Tag type for the camera image top offset parameter ("OffsetY").
Tag type for the camera image width parameter ("Width").
auto value
auto result