OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
Loading...
Searching...
No Matches
protocol_message_network.h File Reference

Core message network protocol handler. More...

Go to the source code of this file.

Data Structures

struct  interface_openlcb_protocol_message_network_t
 Callback interface for message network protocol notifications. More...
 

Functions

void ProtocolMessageNetwork_initialize (const interface_openlcb_protocol_message_network_t *interface_openlcb_protocol_message_network)
 Stores the callback interface. Call once at startup.
 
void ProtocolMessageNetwork_handle_initialization_complete (openlcb_statemachine_info_t *statemachine_info)
 Handle Initialization Complete (full node). No automatic response.
 
void ProtocolMessageNetwork_handle_initialization_complete_simple (openlcb_statemachine_info_t *statemachine_info)
 Handle Initialization Complete Simple. No automatic response.
 
void ProtocolMessageNetwork_handle_protocol_support_inquiry (openlcb_statemachine_info_t *statemachine_info)
 Handle Protocol Support Inquiry — replies with this node’s PSI flags.
 
void ProtocolMessageNetwork_handle_protocol_support_reply (openlcb_statemachine_info_t *statemachine_info)
 Handle Protocol Support Reply. No automatic response.
 
void ProtocolMessageNetwork_handle_verify_node_id_global (openlcb_statemachine_info_t *statemachine_info)
 Handle global Verify Node ID — replies if payload matches or is empty.
 
void ProtocolMessageNetwork_handle_verify_node_id_addressed (openlcb_statemachine_info_t *statemachine_info)
 Handle addressed Verify Node ID — always replies.
 
void ProtocolMessageNetwork_handle_verified_node_id (openlcb_statemachine_info_t *statemachine_info)
 Handle Verified Node ID — checks for duplicate Node ID.
 
void ProtocolMessageNetwork_handle_optional_interaction_rejected (openlcb_statemachine_info_t *statemachine_info)
 Handle Optional Interaction Rejected. No automatic response.
 
void ProtocolMessageNetwork_handle_terminate_due_to_error (openlcb_statemachine_info_t *statemachine_info)
 Handle Terminate Due To Error. No automatic response.
 

Detailed Description

Core message network protocol handler.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Implements Verify Node ID (addressed and global), Protocol Support Inquiry/Reply, Initialization Complete, Optional Interaction Rejected, and Terminate Due To Error. Also detects duplicate Node IDs on the network.

Author
Jim Kueneman
Date
4 Mar 2026
See also
MessageNetworkS.pdf

Function Documentation

◆ ProtocolMessageNetwork_initialize()

void ProtocolMessageNetwork_initialize ( const interface_openlcb_protocol_message_network_t * interface_openlcb_protocol_message_network)
extern

Stores the callback interface. Call once at startup.

Parameters
interface_openlcb_protocol_message_networkPointer to interface_openlcb_protocol_message_network_t (must remain valid for application lifetime).
* @param interface_openlcb_protocol_message_network  Populated table.
* 

◆ ProtocolMessageNetwork_handle_initialization_complete()

void ProtocolMessageNetwork_handle_initialization_complete ( openlcb_statemachine_info_t * statemachine_info)
extern

Handle Initialization Complete (full node). No automatic response.

Parameters
statemachine_infoPointer to openlcb_statemachine_info_t context.

Handle Initialization Complete (full node). No automatic response.

◆ ProtocolMessageNetwork_handle_initialization_complete_simple()

void ProtocolMessageNetwork_handle_initialization_complete_simple ( openlcb_statemachine_info_t * statemachine_info)
extern

Handle Initialization Complete Simple. No automatic response.

Parameters
statemachine_infoPointer to openlcb_statemachine_info_t context.

Handle Initialization Complete Simple. No automatic response.

◆ ProtocolMessageNetwork_handle_protocol_support_inquiry()

void ProtocolMessageNetwork_handle_protocol_support_inquiry ( openlcb_statemachine_info_t * statemachine_info)
extern

Handle Protocol Support Inquiry — replies with this node’s PSI flags.

Parameters
statemachine_infoPointer to openlcb_statemachine_info_t context.

Handle Protocol Support Inquiry — replies with this node’s PSI flags.

Swaps PSI_FIRMWARE_UPGRADE → PSI_FIRMWARE_UPGRADE_ACTIVE when a firmware upgrade is in progress.

◆ ProtocolMessageNetwork_handle_protocol_support_reply()

void ProtocolMessageNetwork_handle_protocol_support_reply ( openlcb_statemachine_info_t * statemachine_info)
extern

Handle Protocol Support Reply. No automatic response.

Parameters
statemachine_infoPointer to openlcb_statemachine_info_t context.

◆ ProtocolMessageNetwork_handle_verify_node_id_global()

void ProtocolMessageNetwork_handle_verify_node_id_global ( openlcb_statemachine_info_t * statemachine_info)
extern

Handle global Verify Node ID — replies if payload matches or is empty.

Parameters
statemachine_infoPointer to openlcb_statemachine_info_t context.

◆ ProtocolMessageNetwork_handle_verify_node_id_addressed()

void ProtocolMessageNetwork_handle_verify_node_id_addressed ( openlcb_statemachine_info_t * statemachine_info)
extern

Handle addressed Verify Node ID — always replies.

Parameters
statemachine_infoPointer to openlcb_statemachine_info_t context.

Handle addressed Verify Node ID — always replies.

◆ ProtocolMessageNetwork_handle_verified_node_id()

void ProtocolMessageNetwork_handle_verified_node_id ( openlcb_statemachine_info_t * statemachine_info)
extern

Handle Verified Node ID — checks for duplicate Node ID.

Parameters
statemachine_infoPointer to openlcb_statemachine_info_t context.

Handle Verified Node ID — checks for duplicate Node ID.

◆ ProtocolMessageNetwork_handle_optional_interaction_rejected()

void ProtocolMessageNetwork_handle_optional_interaction_rejected ( openlcb_statemachine_info_t * statemachine_info)
extern

Handle Optional Interaction Rejected. No automatic response.

Parses the 2-byte error code (payload bytes 0-1) and 2-byte rejected MTI (payload bytes 2-3). If the interface callback on_optional_interaction_rejected is non-NULL, it is invoked with the parsed values. Per MessageNetworkS Section 3.5.2.

Parameters
statemachine_infoPointer to openlcb_statemachine_info_t context.

Handle Optional Interaction Rejected. No automatic response.

Parses error code (bytes 0-1) and rejected MTI (bytes 2-3). Invokes the application callback if non-NULL. No automatic response.

◆ ProtocolMessageNetwork_handle_terminate_due_to_error()

void ProtocolMessageNetwork_handle_terminate_due_to_error ( openlcb_statemachine_info_t * statemachine_info)
extern

Handle Terminate Due To Error. No automatic response.

Parses the 2-byte error code (payload bytes 0-1) and 2-byte rejected MTI (payload bytes 2-3). If the interface callback on_terminate_due_to_error is non-NULL, it is invoked with the parsed values. Per MessageNetworkS Section 3.5.2.

Parameters
statemachine_infoPointer to openlcb_statemachine_info_t context.

Handle Terminate Due To Error. No automatic response.

Parses error code (bytes 0-1) and rejected MTI (bytes 2-3). Invokes the application callback if non-NULL. No automatic response.


Copyright (c) 2026 Jim Kueneman all rights reserved. See the License