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

Handler for the gis command (sequence frame acquisition). More...

#include <command_gis.hpp>

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

Public Member Functions

 CommandGISHandler (std::shared_ptr< Context > ctx)
 Constructs the CommandGISHandler.
 
- Public Member Functions inherited from irsol::server::handlers::internal::CommandGIBaseHandler
 CommandGIBaseHandler (std::shared_ptr< Context > ctx)
 Constructs the CommandGIBaseHandler.
 
- 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.
 

Private Member Functions

std::vector< irsol::protocol::OutMessagevalidate (const protocol::Command &message, std::shared_ptr< irsol::server::ClientSession > session) const override
 Validates the gis command parameters.
 
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.
 
double getFrameRate (const protocol::Command &message, std::shared_ptr< irsol::server::ClientSession > session) const override
 Returns the frame rate for the gis command.
 

Additional Inherited Members

- Protected Member Functions inherited from irsol::server::handlers::internal::CommandGIBaseHandler
std::vector< out_message_tprocess (std::shared_ptr< irsol::server::ClientSession > session, protocol::Command &&message) final override
 Processes a frame acquisition command, starting the frame collection thread.
 
- 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.
 
- 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 the gis command (sequence frame acquisition).

Processes the gis command to acquire a sequence of frames from the camera.

Definition at line 24 of file command_gis.hpp.

Constructor & Destructor Documentation

◆ CommandGISHandler()

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

Constructs the CommandGISHandler.

Parameters
ctxHandler context.

Definition at line 9 of file command_gis.cpp.

10 : internal::CommandGIBaseHandler(ctx)
11{}
std::shared_ptr< Context > ctx
Handler context (provides access to app and utilities).
Definition base.hpp:81

Member Function Documentation

◆ getFrameRate()

double irsol::server::handlers::CommandGISHandler::getFrameRate ( const protocol::Command message,
std::shared_ptr< irsol::server::ClientSession session 
) const
overrideprivatevirtual

Returns the frame rate for the gis command.

Parameters
messageThe command message.
sessionThe client session.
Returns
Frame rate for acquisition.
Note
This method picks the frame rate from the irsol::server::ClientSession state.

Implements irsol::server::handlers::internal::CommandGIBaseHandler.

Definition at line 46 of file command_gis.cpp.

49{
50 const auto& state = session->userData().frameListeningState;
51 return state.gisParams.frameRate;
52}
constexpr auto makeHandler(std::shared_ptr< Context > ctx, Args &&... args)
Constructs a handler instance of the given type.
Definition factory.hpp:28

◆ getInputSequenceLength()

uint64_t irsol::server::handlers::CommandGISHandler::getInputSequenceLength ( const protocol::Command message,
std::shared_ptr< irsol::server::ClientSession session 
) const
overrideprivatevirtual

Returns the input sequence length for the gis command.

Parameters
messageThe command message.
sessionThe client session.
Returns
Number of frames to acquire.
Note
This method picks the input sequence length from the irsol::server::ClientSession state.

Implements irsol::server::handlers::internal::CommandGIBaseHandler.

Definition at line 38 of file command_gis.cpp.

41{
42 const auto& state = session->userData().frameListeningState;
43 return state.gisParams.inputSequenceLength;
44}

◆ validate()

std::vector< irsol::protocol::OutMessage > irsol::server::handlers::CommandGISHandler::validate ( const protocol::Command message,
std::shared_ptr< irsol::server::ClientSession session 
) const
overrideprivatevirtual

Validates the gis command parameters.

Parameters
messageThe command message.
sessionThe client session.
Returns
Vector of outbound error messages (empty if valid).

Implements irsol::server::handlers::internal::CommandGIBaseHandler.

Definition at line 14 of file command_gis.cpp.

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}
#define IRSOL_NAMED_LOG_WARN(name,...)
Logs a warning-level message using a named logger.
Definition logging.hpp:178
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

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