REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches
msg::handlers::MessageHandler Class Reference

A MessageHandler is a functor/closure like event handler. More...

#include <handler.h>

Inheritance diagram for msg::handlers::MessageHandler:

Public Member Functions

constexpr int error (int internal_code)
 
virtual int handle (JsonObjectConst msg_in, JsonObject &msg_out)
 The actual handler method gets a message and returns a message next to the status code.
 
virtual int handle (JsonObjectConst msg_in, JsonObject &msg_out, net::auth::AuthentificationContext &user_context)
 A handler variant that allows access to the authentification context of the client.
 
virtual int handle (JsonObjectConst msg_in, utils::StreamingJson &msg_out)
 Handler for streaming responses.
 

Public Attributes

int result_prefix = 0
 Following the HRESULT idiom, this number is an assigned prefix by the registry.
 

Static Public Attributes

static constexpr int not_implemented = -99
 
static constexpr int success = 0
 

Detailed Description

A MessageHandler is a functor/closure like event handler.

Different method signatures are "probed" by the registry.

Definition at line 21 of file handler.h.

Member Function Documentation

◆ error()

◆ handle() [1/3]

◆ handle() [2/3]

virtual int msg::handlers::MessageHandler::handle ( JsonObjectConst msg_in,
JsonObject & msg_out,
net::auth::AuthentificationContext & user_context )
inlinevirtual

A handler variant that allows access to the authentification context of the client.

Reimplemented in msg::handlers::GetSystemIdent, msg::handlers::LockAcquire, msg::handlers::LockRelease, and msg::handlers::LoginHandler.

Definition at line 49 of file handler.h.

References not_implemented.

◆ handle() [3/3]

virtual int msg::handlers::MessageHandler::handle ( JsonObjectConst msg_in,
utils::StreamingJson & msg_out )
inlinevirtual

Handler for streaming responses.

Reimplemented in msg::handlers::SyslogHandler.

Definition at line 56 of file handler.h.

References not_implemented.

Member Data Documentation

◆ not_implemented

int msg::handlers::MessageHandler::not_implemented = -99
staticconstexpr

Definition at line 23 of file handler.h.

Referenced by handle(), handle(), handle(), and msg::JsonLinesProtocol::handleMessage().

◆ result_prefix

int msg::handlers::MessageHandler::result_prefix = 0

Following the HRESULT idiom, this number is an assigned prefix by the registry.

It should always be addded to the return value of handle(). You can use the helper routine error(...) to simplify this.

Definition at line 31 of file handler.h.

Referenced by error(), and msg::handlers::DynamicRegistry::set().

◆ success


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