|
OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
|
Implementation of the application layer interface. More...
Functions | |
| void | OpenLcbApplication_initialize (const interface_openlcb_application_t *interface_openlcb_application) |
| Stores the application callback interface for use by all application layer functions. | |
| 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. | |
| void | OpenLcbApplication_clear_consumer_eventids (openlcb_node_t *openlcb_node) |
| Clears the consumer event list for a node by resetting its count to zero. | |
| void | OpenLcbApplication_clear_producer_eventids (openlcb_node_t *openlcb_node) |
| Clears the producer event list for a node by resetting its count to zero. | |
| 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. | |
| 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. | |
| void | OpenLcbApplication_clear_consumer_ranges (openlcb_node_t *openlcb_node) |
| Clears the consumer event-range list by resetting its range count to zero. | |
| void | OpenLcbApplication_clear_producer_ranges (openlcb_node_t *openlcb_node) |
| Clears the producer event-range list by resetting its range count to zero. | |
| 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. | |
| 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. | |
| 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. | |
| bool | OpenLcbApplication_send_teach_event (openlcb_node_t *openlcb_node, event_id_t event_id) |
| Sends a Learn Event (teach) message to the network. | |
| bool | OpenLcbApplication_send_initialization_event (openlcb_node_t *openlcb_node) |
| Sends an Initialization Complete message for the specified node. | |
| 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. | |
| 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. | |
Implementation of the application layer interface.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
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 the high-level application programming interface for the OpenLCB protocol stack. Maintains a single static pointer to the application-provided callback structure set by OpenLcbApplication_initialize(). All public functions are thin wrappers that either manipulate node data directly or call through to those callbacks.
| void OpenLcbApplication_initialize | ( | const interface_openlcb_application_t * | interface_openlcb_application | ) |
Stores the application callback interface for use by all application layer functions.
Algorithm:
* @param interface_openlcb_application Pointer to a fully initialised interface_openlcb_application_t. *
| 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.
Algorithm:
* @param openlcb_node Pointer to the sending openlcb_node_t. * @param event_id 64-bit event_id_t to include in the payload. * @param mti 16-bit MTI for the message. *
| void OpenLcbApplication_clear_consumer_eventids | ( | openlcb_node_t * | openlcb_node | ) |
Clears the consumer event list for a node by resetting its count to zero.
Algorithm:
* @param openlcb_node Pointer to the openlcb_node_t to clear. *
| void OpenLcbApplication_clear_producer_eventids | ( | openlcb_node_t * | openlcb_node | ) |
Clears the producer event list for a node by resetting its count to zero.
Algorithm:
* @param openlcb_node Pointer to the openlcb_node_t to clear. *
| 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.
Algorithm:
* @param openlcb_node Pointer to the openlcb_node_t receiving the registration. * @param event_id 64-bit event_id_t to register (8 bytes, MSB first). * @param event_status Initial status: one of the event_status_enum values. *
| 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.
Algorithm:
* @param openlcb_node Pointer to the openlcb_node_t receiving the registration. * @param event_id 64-bit event_id_t to register (8 bytes, MSB first). * @param event_status Initial status: one of the event_status_enum values. *
| void OpenLcbApplication_clear_consumer_ranges | ( | openlcb_node_t * | openlcb_node | ) |
Clears the consumer event-range list by resetting its range count to zero.
Clears the consumer event-range list for a node by resetting its range count to zero.
Algorithm:
* @param openlcb_node Pointer to the openlcb_node_t to clear. *
| void OpenLcbApplication_clear_producer_ranges | ( | openlcb_node_t * | openlcb_node | ) |
Clears the producer event-range list by resetting its range count to zero.
Clears the producer event-range list for a node by resetting its range count to zero.
Algorithm:
* @param openlcb_node Pointer to the openlcb_node_t to clear. *
| 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.
Algorithm:
* @param openlcb_node Pointer to the openlcb_node_t receiving the registration. * @param event_id_base Base event_id_t of the range. * @param range_size Number of consecutive event IDs (event_range_count_enum). *
| 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.
Algorithm:
* @param openlcb_node Pointer to the openlcb_node_t receiving the registration. * @param event_id_base Base event_id_t of the range. * @param range_size Number of consecutive event IDs (event_range_count_enum). *
| 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.
Algorithm:
* @param openlcb_node Pointer to the sending openlcb_node_t. * @param event_id 64-bit event_id_t to report. *
| bool OpenLcbApplication_send_teach_event | ( | openlcb_node_t * | openlcb_node, |
| event_id_t | event_id ) |
Sends a Learn Event (teach) message to the network.
Algorithm:
* @param openlcb_node Pointer to the sending openlcb_node_t. * @param event_id 64-bit event_id_t to teach. *
| bool OpenLcbApplication_send_initialization_event | ( | openlcb_node_t * | openlcb_node | ) |
Sends an Initialization Complete message for the specified node.
Algorithm:
* @param openlcb_node Pointer to the openlcb_node_t that has just finished login. *
| 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.
Algorithm:
* @param openlcb_node Pointer to the requesting openlcb_node_t. * @param address Starting address within the configuration address space. * @param count Number of bytes to read. * @param buffer Destination configuration_memory_buffer_t. *
| 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.
Algorithm:
* @param openlcb_node Pointer to the requesting openlcb_node_t. * @param address Starting address within the configuration address space. * @param count Number of bytes to write. * @param buffer Source configuration_memory_buffer_t. *
Copyright (c) 2026 Jim Kueneman all rights reserved. See the License