OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
Loading...
Searching...
No Matches
openlcb_application.h
Go to the documentation of this file.
1
40// This is a guard condition so that contents of this file are not included
41// more than once.
42#ifndef __OPENLCB_OPENLCB_APPLICATION__
43#define __OPENLCB_OPENLCB_APPLICATION__
44
45#include <stdbool.h>
46#include <stdint.h>
47
48#include "openlcb_types.h"
49
62typedef struct {
63
76 bool (*send_openlcb_msg)(openlcb_msg_t *openlcb_msg);
77
95 uint16_t (*config_memory_read)(openlcb_node_t *openlcb_node, uint32_t address, uint16_t count, configuration_memory_buffer_t *buffer);
96
115 uint16_t (*config_memory_write)(openlcb_node_t *openlcb_node, uint32_t address, uint16_t count, configuration_memory_buffer_t *buffer);
116
118
119#ifdef __cplusplus
120extern "C" {
121#endif /* __cplusplus */
122
134 extern void OpenLcbApplication_initialize(const interface_openlcb_application_t *interface_openlcb_application);
135
144
153
170 extern uint16_t OpenLcbApplication_register_consumer_eventid(openlcb_node_t *openlcb_node, event_id_t event_id, event_status_enum event_status);
171
188 extern uint16_t OpenLcbApplication_register_producer_eventid(openlcb_node_t *openlcb_node, event_id_t event_id, event_status_enum event_status);
189
198
207
222 extern bool OpenLcbApplication_register_consumer_range(openlcb_node_t *openlcb_node, event_id_t event_id_base, event_range_count_enum range_size);
223
238 extern bool OpenLcbApplication_register_producer_range(openlcb_node_t *openlcb_node, event_id_t event_id_base, event_range_count_enum range_size);
239
256 extern bool OpenLcbApplication_send_event_pc_report(openlcb_node_t *openlcb_node, event_id_t event_id);
257
274 extern bool OpenLcbApplication_send_event_with_mti(openlcb_node_t *openlcb_node, event_id_t event_id, uint16_t mti);
275
292 extern bool OpenLcbApplication_send_teach_event(openlcb_node_t *openlcb_node, event_id_t event_id);
293
312
328 extern uint16_t OpenLcbApplication_read_configuration_memory(openlcb_node_t *openlcb_node, uint32_t address, uint16_t count, configuration_memory_buffer_t *buffer);
329
346 extern uint16_t OpenLcbApplication_write_configuration_memory(openlcb_node_t *openlcb_node, uint32_t address, uint16_t count, configuration_memory_buffer_t *buffer);
347
348#ifdef __cplusplus
349}
350#endif /* __cplusplus */
351
352#endif /* __OPENLCB_OPENLCB_APPLICATION__ */
uint16_t OpenLcbApplication_write_configuration_memory(openlcb_node_t *openlcb_node, uint32_t address, uint16_t count, configuration_memory_buffer_t *buffer)
Writes bytes to the node's configuration memory via the application callback.
Definition openlcb_application.c:554
bool OpenLcbApplication_send_initialization_event(openlcb_node_t *openlcb_node)
Sends an Initialization Complete message for the specified node.
Definition openlcb_application.c:469
bool OpenLcbApplication_register_consumer_range(openlcb_node_t *openlcb_node, event_id_t event_id_base, event_range_count_enum range_size)
Registers an event ID range in the node's consumer range list.
Definition openlcb_application.c:289
void OpenLcbApplication_clear_producer_eventids(openlcb_node_t *openlcb_node)
Clears the producer event list for a node by resetting its count to zero.
Definition openlcb_application.c:155
void OpenLcbApplication_clear_consumer_ranges(openlcb_node_t *openlcb_node)
Clears the consumer event-range list for a node by resetting its range count to zero.
Definition openlcb_application.c:245
bool OpenLcbApplication_send_event_pc_report(openlcb_node_t *openlcb_node, event_id_t event_id)
Sends a Producer/Consumer Event Report (PCER) message to the network.
Definition openlcb_application.c:363
void OpenLcbApplication_clear_consumer_eventids(openlcb_node_t *openlcb_node)
Clears the consumer event list for a node by resetting its count to zero.
Definition openlcb_application.c:137
bool OpenLcbApplication_send_teach_event(openlcb_node_t *openlcb_node, event_id_t event_id)
Sends a Learn Event (teach) message to the network.
Definition openlcb_application.c:415
void OpenLcbApplication_initialize(const interface_openlcb_application_t *interface_openlcb_application)
Stores the application callback interface for use by all application layer functions.
Definition openlcb_application.c:69
bool OpenLcbApplication_register_producer_range(openlcb_node_t *openlcb_node, event_id_t event_id_base, event_range_count_enum range_size)
Registers an event ID range in the node's producer range list.
Definition openlcb_application.c:325
uint16_t OpenLcbApplication_register_producer_eventid(openlcb_node_t *openlcb_node, event_id_t event_id, event_status_enum event_status)
Adds a producer event ID to the node's producer list.
Definition openlcb_application.c:217
bool OpenLcbApplication_send_event_with_mti(openlcb_node_t *openlcb_node, event_id_t event_id, uint16_t mti)
Sends an event message with an arbitrary MTI.
Definition openlcb_application.c:97
uint16_t OpenLcbApplication_read_configuration_memory(openlcb_node_t *openlcb_node, uint32_t address, uint16_t count, configuration_memory_buffer_t *buffer)
Reads bytes from the node's configuration memory via the application callback.
Definition openlcb_application.c:518
void OpenLcbApplication_clear_producer_ranges(openlcb_node_t *openlcb_node)
Clears the producer event-range list for a node by resetting its range count to zero.
Definition openlcb_application.c:263
uint16_t OpenLcbApplication_register_consumer_eventid(openlcb_node_t *openlcb_node, event_id_t event_id, event_status_enum event_status)
Adds a consumer event ID to the node's consumer list.
Definition openlcb_application.c:181
Core type definitions, structures, and configuration constants for the OpenLCB library.
uint64_t event_id_t
64-bit Event ID.
Definition openlcb_types.h:340
event_status_enum
Event status for Producer/Consumer identification messages.
Definition openlcb_types.h:230
uint8_t configuration_memory_buffer_t[LEN_DATAGRAM_MAX_PAYLOAD]
Configuration memory read/write operation buffer (64 bytes).
Definition openlcb_types.h:365
event_range_count_enum
Power-of-two event range sizes for range-identified events.
Definition openlcb_types.h:247
Application-provided callbacks required by the OpenLCB library.
Definition openlcb_application.h:62
Core OpenLCB message structure.
Definition openlcb_types.h:480
OpenLCB virtual node.
Definition openlcb_types.h:679

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