IRSOL
C++ code implementing socket server for interacting with Baumer camera.
irsol::server::handlers::CommandAbortHandler Class Reference

Handler for aborting ongoing operations for a client session. More...

#include <command_abort.hpp>

Inheritance diagram for irsol::server::handlers::CommandAbortHandler:
irsol::server::handlers::internal::HandlerBase< T, >

Public Member Functions

 CommandAbortHandler (std::shared_ptr< Context > ctx)
 Constructs the CommandAbortHandler.
 
- Public Member Functions inherited from irsol::server::handlers::internal::HandlerBase< T, >
virtual std::vector< out_message_toperator() (const irsol::types::client_id_t &clientId, T &&message)
 Invokes the handler for a given client and message.
 

Protected Member Functions

std::vector< out_message_tprocess (std::shared_ptr< irsol::server::ClientSession > session, irsol::protocol::Command &&message) final override
 Processes an abort command.
 
- Protected Member Functions inherited from irsol::server::handlers::internal::HandlerBase< T, >
 HandlerBase (std::shared_ptr< Context > ctx)
 Constructs the handler base.
 
virtual std::vector< out_message_tprocess (std::shared_ptr< irsol::server::ClientSession > session, T &&message)=0
 Processes the protocol message for the given session.
 

Additional Inherited Members

- Protected Attributes inherited from irsol::server::handlers::internal::HandlerBase< T, >
std::shared_ptr< Contextctx
 Handler context (provides access to app and utilities).
 

Detailed Description

Handler for aborting ongoing operations for a client session.

Processes abort commands to stop frame collection gis.

Definition at line 22 of file command_abort.hpp.

Constructor & Destructor Documentation

◆ CommandAbortHandler()

irsol::server::handlers::CommandAbortHandler::CommandAbortHandler ( std::shared_ptr< Context ctx)

Constructs the CommandAbortHandler.

Parameters
ctxHandler context.

Definition at line 9 of file command_abort.cpp.

std::shared_ptr< Context > ctx
Handler context (provides access to app and utilities).
Definition base.hpp:81
internal::HandlerBase< protocol::Command > CommandHandler
Handler type for command messages.
Definition base.hpp:96

Member Function Documentation

◆ process()

std::vector< out_message_t > irsol::server::handlers::CommandAbortHandler::process ( std::shared_ptr< irsol::server::ClientSession session,
irsol::protocol::Command &&  message 
)
finaloverrideprotected

Processes an abort command.

Parameters
sessionThe client session.
messageThe abort command message.
Returns
Vector of outbound messages (success or error).

Definition at line 12 of file command_abort.cpp.

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}
#define IRSOL_NAMED_LOG_INFO(name,...)
Logs an info-level message using a named logger.
Definition logging.hpp:176
constexpr auto makeHandler(std::shared_ptr< Context > ctx, Args &&... args)
Constructs a handler instance of the given type.
Definition factory.hpp:28
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

The documentation for this class was generated from the following files: