|
OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
|
Message handlers that convert OpenLCB messages to outgoing CAN frames. More...
Go to the source code of this file.
Data Structures | |
| struct | interface_can_tx_message_handler_t |
| Dependency-injection interface for the CAN transmit message handlers. More... | |
Functions | |
| void | CanTxMessageHandler_initialize (const interface_can_tx_message_handler_t *interface_can_tx_message_handler) |
| Registers the dependency-injection interface for this module. | |
| bool | CanTxMessageHandler_addressed_msg_frame (openlcb_msg_t *openlcb_msg, can_msg_t *can_msg_worker, uint16_t *openlcb_start_index) |
| Transmits one CAN frame for an addressed openlcb_msg_t. | |
| bool | CanTxMessageHandler_unaddressed_msg_frame (openlcb_msg_t *openlcb_msg, can_msg_t *can_msg_worker, uint16_t *openlcb_start_index) |
| Transmits one CAN frame for an unaddressed (broadcast) openlcb_msg_t. | |
| bool | CanTxMessageHandler_datagram_frame (openlcb_msg_t *openlcb_msg, can_msg_t *can_msg_worker, uint16_t *openlcb_start_index) |
| Transmits one CAN frame for a datagram openlcb_msg_t (up to 72 bytes total). | |
| bool | CanTxMessageHandler_stream_frame (openlcb_msg_t *openlcb_msg, can_msg_t *can_msg_worker, uint16_t *openlcb_start_index) |
| Placeholder for stream protocol transmit (not yet implemented). | |
| bool | CanTxMessageHandler_can_frame (can_msg_t *can_msg) |
| Transmits a pre-built raw can_msg_t directly to the hardware. | |
Message handlers that convert OpenLCB messages to outgoing CAN frames.
Handles fragmentation and framing-bit encoding for addressed, unaddressed, datagram, stream, and raw CAN frame types per the OpenLCB CAN Frame Transfer Standard.
|
extern |
Registers the dependency-injection interface for this module.
| interface_can_tx_message_handler | Pointer to a populated interface_can_tx_message_handler_t. Must remain valid for the lifetime of the application. |
Registers the dependency-injection interface for this module.
|
extern |
Transmits one CAN frame for an addressed openlcb_msg_t.
Encodes the destination alias into payload bytes 0-1 with framing flags (ONLY / FIRST / MIDDLE / LAST), copies up to 6 payload bytes, and transmits. On success, advances *openlcb_start_index by the number of bytes sent.
| openlcb_msg | Source message (dest_alias must be valid). |
| can_msg_worker | Scratch CAN frame buffer used to build the frame. |
| openlcb_start_index | Current position in the OpenLCB payload; updated on success. |
Transmits one CAN frame for an addressed openlcb_msg_t.
Algorithm:
* @param openlcb_msg Source message (dest_alias must be valid). * @param can_msg_worker Scratch CAN frame buffer. * @param openlcb_start_index Current payload position; updated on success. *
|
extern |
Transmits one CAN frame for an unaddressed (broadcast) openlcb_msg_t.
All 8 payload bytes are available (no destination alias overhead). Multi-frame unaddressed messages are not currently implemented. On success, advances *openlcb_start_index by the number of bytes sent.
| openlcb_msg | Source message. |
| can_msg_worker | Scratch CAN frame buffer. |
| openlcb_start_index | Current payload position; updated on success. |
Transmits one CAN frame for an unaddressed (broadcast) openlcb_msg_t.
Algorithm:
* @param openlcb_msg Source message (no dest_alias needed). * @param can_msg_worker Scratch CAN frame buffer. * @param openlcb_start_index Current payload position; updated on success. *
|
extern |
Transmits one CAN frame for a datagram openlcb_msg_t (up to 72 bytes total).
Selects the correct datagram frame type (ONLY / FIRST / MIDDLE / LAST) based on the current payload index and total size. On success, advances *openlcb_start_index by the number of bytes sent.
| openlcb_msg | Source datagram message. |
| can_msg_worker | Scratch CAN frame buffer. |
| openlcb_start_index | Current payload position; updated on success. |
Transmits one CAN frame for a datagram openlcb_msg_t (up to 72 bytes total).
Algorithm:
* @param openlcb_msg Source datagram message (max 72 bytes). * @param can_msg_worker Scratch CAN frame buffer. * @param openlcb_start_index Current payload position; updated on success. *
|
extern |
Placeholder for stream protocol transmit (not yet implemented).
| openlcb_msg | Source stream message. |
| can_msg_worker | Scratch CAN frame buffer. |
| openlcb_start_index | Current payload position. |
Placeholder for stream protocol transmit (not yet implemented).
|
extern |
Transmits a pre-built raw can_msg_t directly to the hardware.
No OpenLCB processing — frame must be fully constructed before calling. Used for CAN control frames (CID, RID, AMD) during alias allocation.
| can_msg | Fully-constructed CAN frame to transmit. |
Copyright (c) 2026 Jim Kueneman all rights reserved. See the License