|
OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
|
Implementation of the CAN alias / Node ID mapping buffer. More...
Functions | |
| void | AliasMappings_initialize (void) |
| Initializes the alias mapping buffer, clearing all entries and flags. | |
| alias_mapping_info_t * | AliasMappings_get_alias_mapping_info (void) |
| Returns a pointer to the internal alias mapping info structure. | |
| void | AliasMappings_set_has_duplicate_alias_flag (void) |
| Sets the has_duplicate_alias flag to signal an alias conflict. | |
| void | AliasMappings_clear_has_duplicate_alias_flag (void) |
| Clears the has_duplicate_alias flag after conflict resolution. | |
| alias_mapping_t * | AliasMappings_register (uint16_t alias, node_id_t node_id) |
| Registers a CAN alias / Node ID pair in the buffer. | |
| void | AliasMappings_unregister (uint16_t alias) |
| Removes the entry matching the given alias from the buffer. | |
| alias_mapping_t * | AliasMappings_find_mapping_by_alias (uint16_t alias) |
| Finds the mapping entry for the given alias. | |
| alias_mapping_t * | AliasMappings_find_mapping_by_node_id (node_id_t node_id) |
| Finds the mapping entry for the given Node ID. | |
| void | AliasMappings_flush (void) |
| Clears all alias mappings and resets all flags. Runtime equivalent of initialize(). | |
Implementation of the CAN alias / Node ID mapping buffer.
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.
Single static buffer instance using a linear array. Empty slots are marked by alias = 0 and node_id = 0. First-fit allocation. One alias per Node ID enforced. NOT thread-safe.
| void AliasMappings_initialize | ( | void | ) |
Initializes the alias mapping buffer, clearing all entries and flags.
| alias_mapping_info_t * AliasMappings_get_alias_mapping_info | ( | void | ) |
Returns a pointer to the internal alias mapping info structure.
| void AliasMappings_set_has_duplicate_alias_flag | ( | void | ) |
Sets the has_duplicate_alias flag to signal an alias conflict.
Signals the main loop that an incoming message used one of our reserved aliases.
| void AliasMappings_clear_has_duplicate_alias_flag | ( | void | ) |
Clears the has_duplicate_alias flag after conflict resolution.
Clears the duplicate alias flag after the conflict has been resolved.
| alias_mapping_t * AliasMappings_register | ( | uint16_t | alias, |
| node_id_t | node_id ) |
Registers a CAN alias / Node ID pair in the buffer.
Algorithm:
Use cases:
* @param alias 12-bit CAN alias (valid range: 0x001–0xFFF). * @param node_id 48-bit OpenLCB Node ID (valid range: 0x000000000001–0xFFFFFFFFFFFF). *
| void AliasMappings_unregister | ( | uint16_t | alias | ) |
Removes the entry matching the given alias from the buffer.
Algorithm:
* @param alias 12-bit CAN alias to remove. *
| alias_mapping_t * AliasMappings_find_mapping_by_alias | ( | uint16_t | alias | ) |
Finds the mapping entry for the given alias.
Algorithm:
* @param alias 12-bit CAN alias to search for. *
| alias_mapping_t * AliasMappings_find_mapping_by_node_id | ( | node_id_t | node_id | ) |
Finds the mapping entry for the given Node ID.
Algorithm:
* @param node_id 48-bit OpenLCB Node ID to search for. *
| void AliasMappings_flush | ( | void | ) |
Clears all alias mappings and resets all flags. Runtime equivalent of initialize().
Clears all alias mappings and resets all flags.
Copyright (c) 2026 Jim Kueneman all rights reserved. See the License