|
OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
|
Application-provided callbacks required by the OpenLCB library. More...
Data Fields | |
| bool(* | send_openlcb_msg )(openlcb_msg_t *openlcb_msg) |
| Queues an outgoing OpenLCB message for transmission. | |
| uint16_t(* | config_memory_read )(openlcb_node_t *openlcb_node, uint32_t address, uint16_t count, configuration_memory_buffer_t *buffer) |
| Reads bytes from the node's configuration memory. | |
| uint16_t(* | config_memory_write )(openlcb_node_t *openlcb_node, uint32_t address, uint16_t count, configuration_memory_buffer_t *buffer) |
| Writes bytes to the node's configuration memory. | |
Application-provided callbacks required by the OpenLCB library.
All three function pointers must be set before calling OpenLcbApplication_initialize(). The library calls these to send messages and to read or write configuration memory. The structure must remain valid for the entire lifetime of the program.
| bool(* send_openlcb_msg) (openlcb_msg_t *openlcb_msg) |
Queues an outgoing OpenLCB message for transmission.
The implementation must queue the message for the transport layer (CAN, TCP/IP, etc.) and return immediately without blocking.
| openlcb_msg | Pointer to the openlcb_msg_t to transmit. |
| uint16_t(* config_memory_read) (openlcb_node_t *openlcb_node, uint32_t address, uint16_t count, configuration_memory_buffer_t *buffer) |
Reads bytes from the node's configuration memory.
Called when the library needs to read from the node's persistent storage (CDI, ACDI, SNIP data, user-configurable parameters). The callback is responsible for address validation and bounds checking.
| openlcb_node | Pointer to the requesting openlcb_node_t. |
| address | Starting address within the configuration address space. |
| count | Number of bytes to read (64 or fewer for network operations). |
| buffer | Destination configuration_memory_buffer_t (must hold at least count bytes). |
| uint16_t(* config_memory_write) (openlcb_node_t *openlcb_node, uint32_t address, uint16_t count, configuration_memory_buffer_t *buffer) |
Writes bytes to the node's configuration memory.
Called when the library needs to write to the node's persistent storage. Read-only spaces (CDI, ACDI, manufacturer data) should return 0xFFFF. The application is responsible for the persistence mechanism (EEPROM, flash, etc.) and for address validation.
| openlcb_node | Pointer to the requesting openlcb_node_t. |
| address | Starting address within the configuration address space. |
| count | Number of bytes to write (64 or fewer for network operations). |
| buffer | Source configuration_memory_buffer_t containing the data. |
Copyright (c) 2026 Jim Kueneman all rights reserved. See the License