Base handler for frame acquisition commands (gi
, gis
).
More...
#include <command_gi_base.hpp>
Base handler for frame acquisition commands (gi
, gis
).
Provides common logic for starting frame collection and managing client registration.
- See also
- irsol::server::handlers::CommandGIHandler
-
irsol::server::handlers::CommandGISHandler
Definition at line 32 of file command_gi_base.hpp.
◆ CommandGIBaseHandler()
irsol::server::handlers::internal::CommandGIBaseHandler::CommandGIBaseHandler |
( |
std::shared_ptr< Context > |
ctx | ) |
|
Constructs the CommandGIBaseHandler.
- Parameters
-
Definition at line 21 of file command_gi_base.cpp.
std::shared_ptr< Context > ctx
Handler context (provides access to app and utilities).
internal::HandlerBase< protocol::Command > CommandHandler
Handler type for command messages.
◆ getDescription()
Generates a description string for the command execution.
- Parameters
-
message | The command message. |
session | The client session. |
- Returns
- Description string.
Definition at line 55 of file command_gi_base.cpp.
58{
62}
constexpr auto makeHandler(std::shared_ptr< Context > ctx, Args &&... args)
Constructs a handler instance of the given type.
◆ getFrameRate()
◆ getInputSequenceLength()
◆ process()
Processes a frame acquisition command, starting the frame collection thread.
- Parameters
-
session | The client session. |
message | The command message. |
- Returns
- Vector of outbound messages (success or error).
Definition at line 24 of file command_gi_base.cpp.
27{
28
31
34 std::vector<out_message_t>
result;
37 }
38
41 }
42
45
49
51 return {};
52}
void startListeningThread(std::shared_ptr< irsol::server::ClientSession > session, std::shared_ptr< irsol::server::frame_collector::FrameCollector::frame_queue_t > queue, protocol::Command &&command, const std::string &description)
Starts the frame listening thread for the client session.
virtual std::vector< irsol::protocol::OutMessage > validate(const protocol::Command &message, std::shared_ptr< irsol::server::ClientSession > session) const =0
Validates parameters before starting listener thread.
virtual double getFrameRate(const protocol::Command &message, std::shared_ptr< irsol::server::ClientSession > session) const =0
Retrieves the frame rate to use to start the listening.
std::string getDescription(const protocol::Command &message, std::shared_ptr< irsol::server::ClientSession > session) const
Generates a description string for the command execution.
virtual uint64_t getInputSequenceLength(const protocol::Command &message, std::shared_ptr< irsol::server::ClientSession > session) const =0
Retrieves the input sequence length to use to start the listening.
#define IRSOL_NAMED_LOG_INFO(name,...)
Logs an info-level message using a named logger.
#define IRSOL_NAMED_LOG_WARN(name,...)
Logs a warning-level message using a named logger.
static Error from(const T &msg, const std::string &description)
Creates an error from a specific incoming message type.
◆ startListeningThread()
Starts the frame listening thread for the client session.
- Parameters
-
session | The client session. |
queue | The frame queue for collected frames. |
command | The command message. |
description | Description string for logging. |
- See also
- irsol::server::internal::FrameListeningState::start
Definition at line 65 of file command_gi_base.cpp.
70{
72
75 std::shared_ptr<std::atomic<bool>>
stopRequest)
mutable {
76
78 state.gisParams.inputSequenceNumber = 0;
79
81 session->id(),
"Started frame listening thread for {}",
message.toString());
82
83 std::unique_ptr<frame_collector::Frame>
framePtr;
88 "Sending frame {} to client: {}",
89 state.gisParams.inputSequenceNumber,
91 {
92 auto lock = std::scoped_lock(
session->socketMutex());
93 std::vector<irsol::protocol::OutMessage>
result;
96 "isn", {
static_cast<int>(
state.gisParams.inputSequenceNumber)}));
98 }
99 ++
state.gisParams.inputSequenceNumber;
102 }
103 }
104
107 session->id(),
"Stopping execution of frame-collection due to stop-request.");
108
109 return;
110 }
111
112 {
113 auto lock = std::scoped_lock(
session->socketMutex());
115 }
117 },
119}
#define IRSOL_NAMED_LOG_DEBUG(name,...)
Logs a debug-level message using a named logger.
std::variant< Success, BinaryDataBuffer, ImageBinaryData, ColorImageBinaryData, Error > OutMessage
Variant type representing any outgoing message.
static Success from(const Assignment &msg, std::optional< irsol::types::protocol_value_t > overrideValue=std::nullopt)
Creates a success message from an Assignment.
static Success asStatus(const std::string &identifier, irsol::types::protocol_value_t value)
Creates a standalone status message with a value.
◆ validate()
The documentation for this class was generated from the following files: