Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::SNIPHandler Class Reference

Handler for the Simple Node Information Protocol requests. More...

#include <SimpleNodeInfo.hxx>

Inheritance diagram for openlcb::SNIPHandler:
openlcb::IncomingMessageStateFlow StateFlow< Buffer< GenMessage >, QList< 4 > > TypedStateFlow< MessageType, Base > FlowInterface< MessageType >

Public Member Functions

 SNIPHandler (If *iface, Node *node, SimpleInfoFlow *response_flow)
 
Action entry () OVERRIDE
 Entry into the StateFlow activity.
 
Action send_response_request ()
 
- Public Member Functions inherited from openlcb::IncomingMessageStateFlow
 IncomingMessageStateFlow (If *iface)
 
Ififace ()
 
GenMessagenmsg ()
 Returns the NMRAnet message we received.
 
- Public Member Functions inherited from StateFlow< Buffer< GenMessage >, QList< 4 > >
 StateFlow (Service *service)
 Constructor.
 
- Public Member Functions inherited from TypedStateFlow< MessageType, Base >
 TypedStateFlow (Service *service)
 Constructor.
 
virtual ~TypedStateFlow ()
 Destructor.
 
void send (MessageType *msg, unsigned priority=UINT_MAX) OVERRIDE
 Sends a message to the state flow for processing.
 
- Public Member Functions inherited from FlowInterface< MessageType >
virtual Poolpool ()
 
virtual MessageType * type_helper ()
 This function is never user in the code, but GDB can use it to infer the correct message types.
 
MessageType * alloc ()
 Synchronously allocates a message buffer from the pool of this flow.
 
void alloc_async (Executable *target)
 Asynchronously allocates a message buffer from the pool of this flow.
 

Private Attributes

Nodenode_
 
SimpleInfoFlowresponseFlow_
 

Static Private Attributes

static const SimpleInfoDescriptor SNIP_RESPONSE []
 Defines the SNIP response fields.
 
static const SimpleInfoDescriptor SNIP_STATIC_RESPONSE []
 Defines the SNIP response fields without dynamic file.
 

Additional Inherited Members

- Public Types inherited from TypedStateFlow< MessageType, Base >
typedef Base::Action Action
 Allows using Action without having StateFlowBase:: prefix in front of it.
 
- Public Types inherited from FlowInterface< MessageType >
typedef MessageType message_type
 Stores the message template type for external reference.
 
- Static Public Member Functions inherited from FlowInterface< MessageType >
static MessageType * cast_alloc (QMember *entry)
 Down casts and initializes an asynchronous allocation result to the appropriate flow's buffer type.
 
- Protected Member Functions inherited from TypedStateFlow< MessageType, Base >
void release () OVERRIDE
 Unrefs the current buffer.
 
void return_buffer ()
 For state flows that are operated using invoke_subflow_and_wait this is a way to hand back the buffer to the caller.
 
MessageType * message ()
 
MessageType * transfer_message ()
 Releases ownership of the current message.
 

Detailed Description

Handler for the Simple Node Information Protocol requests.

Uses the generic SimpleInfoProtocol handler with a specific response structure (SNIPHandler::SNIP_RESPONSE) to assemble the necessary response packets.

Definition at line 56 of file SimpleNodeInfo.hxx.

Constructor & Destructor Documentation

◆ SNIPHandler()

openlcb::SNIPHandler::SNIPHandler ( If iface,
Node node,
SimpleInfoFlow response_flow 
)
inline

Definition at line 59 of file SimpleNodeInfo.hxx.

◆ ~SNIPHandler()

openlcb::SNIPHandler::~SNIPHandler ( )
inline

Definition at line 69 of file SimpleNodeInfo.hxx.

Member Function Documentation

◆ entry()

Action openlcb::SNIPHandler::entry ( )
inlinevirtual

Entry into the StateFlow activity.

Pure virtual which must be defined by derived class.

Returns
function pointer to next state

Implements TypedStateFlow< MessageType, Base >.

Definition at line 75 of file SimpleNodeInfo.hxx.

◆ send_response_request()

Action openlcb::SNIPHandler::send_response_request ( )
inline

Definition at line 84 of file SimpleNodeInfo.hxx.

Member Data Documentation

◆ node_

Node* openlcb::SNIPHandler::node_
private

Definition at line 98 of file SimpleNodeInfo.hxx.

◆ responseFlow_

SimpleInfoFlow* openlcb::SNIPHandler::responseFlow_
private

Definition at line 99 of file SimpleNodeInfo.hxx.

◆ SNIP_RESPONSE

const SimpleInfoDescriptor openlcb::SNIPHandler::SNIP_RESPONSE
staticprivate
Initial value:
=
{
{SimpleInfoDescriptor::LITERAL_BYTE, 4, 0, nullptr},
{SimpleInfoDescriptor::C_STRING, 0, 0, SNIP_STATIC_DATA.manufacturer_name},
{SimpleInfoDescriptor::C_STRING, 0, 0, SNIP_STATIC_DATA.model_name},
{SimpleInfoDescriptor::C_STRING, 0, 0, SNIP_STATIC_DATA.hardware_version},
{SimpleInfoDescriptor::C_STRING, 0, 0, SNIP_STATIC_DATA.software_version},
{SimpleInfoDescriptor::LITERAL_BYTE, 2, 0, nullptr},
{SimpleInfoDescriptor::LITERAL_BYTE, 0, 0, nullptr},
{SimpleInfoDescriptor::LITERAL_BYTE, 0, 0, nullptr},
{SimpleInfoDescriptor::END_OF_DATA, 0, 0, 0}
}
const SimpleNodeStaticValues SNIP_STATIC_DATA
This static data will be exported as the first block of SNIP.

Defines the SNIP response fields.

Definition at line 94 of file SimpleNodeInfo.hxx.

◆ SNIP_STATIC_RESPONSE

const SimpleInfoDescriptor openlcb::SNIPHandler::SNIP_STATIC_RESPONSE
staticprivate
Initial value:
=
{
{SimpleInfoDescriptor::LITERAL_BYTE, 4, 0, nullptr},
{SimpleInfoDescriptor::C_STRING, 0, 0, SNIP_STATIC_DATA.manufacturer_name},
{SimpleInfoDescriptor::C_STRING, 0, 0, SNIP_STATIC_DATA.model_name},
{SimpleInfoDescriptor::C_STRING, 0, 0, SNIP_STATIC_DATA.hardware_version},
{SimpleInfoDescriptor::C_STRING, 0, 0, SNIP_STATIC_DATA.software_version},
{SimpleInfoDescriptor::LITERAL_BYTE, 2, 0, nullptr},
{SimpleInfoDescriptor::LITERAL_BYTE, 0, 0, nullptr},
{SimpleInfoDescriptor::LITERAL_BYTE, 0, 0, nullptr},
{SimpleInfoDescriptor::END_OF_DATA, 0, 0, 0}
}

Defines the SNIP response fields without dynamic file.

Definition at line 96 of file SimpleNodeInfo.hxx.


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