IRSOL
C++ code implementing socket server for interacting with Baumer camera.
command_abort.cpp
Go to the documentation of this file.
2
3#include "irsol/macros.hpp"
5
6namespace irsol {
7namespace server {
8namespace handlers {
9CommandAbortHandler::CommandAbortHandler(std::shared_ptr<Context> ctx): CommandHandler(ctx) {}
10
11std::vector<out_message_t>
13 std::shared_ptr<irsol::server::ClientSession> session,
15{
16 auto& state = session->userData().frameListeningState;
17 if(!state.running()) {
19 session->id(), "Session is not listening to frames. Ignoring abort request.");
20 return {};
21 }
22
23 IRSOL_NAMED_LOG_INFO(session->id(), "Stopping request set to detached background thread..");
24 state.stop();
25 std::vector<out_message_t> result;
27 return result;
28}
29
30}
31}
32}
CommandAbortHandler(std::shared_ptr< Context > ctx)
Constructs the CommandAbortHandler.
std::vector< out_message_t > process(std::shared_ptr< irsol::server::ClientSession > session, irsol::protocol::Command &&message) final override
Processes an abort command.
Generic handler base class for protocol messages.
Definition base.hpp:39
Declaration of the CommandAbortHandler class.
#define IRSOL_NAMED_LOG_INFO(name,...)
Logs an info-level message using a named logger.
Definition logging.hpp:176
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
Declaration of the ClientSession class.
Represents a command invocation in the protocol.
Definition command.hpp:33
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
auto result