|
OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
|
Implementation of GridConnect protocol conversion. More...
Functions | |
| bool | OpenLcbGridConnect_copy_out_gridconnect_when_done (uint8_t next_byte, gridconnect_buffer_t *gridconnect_buffer) |
| Processes incoming GridConnect byte stream and extracts complete message. | |
| void | OpenLcbGridConnect_to_can_msg (gridconnect_buffer_t *gridconnect_buffer, can_msg_t *can_msg) |
| Converts a GridConnect message string to a CAN message structure. | |
| void | OpenLcbGridConnect_from_can_msg (gridconnect_buffer_t *gridconnect_buffer, can_msg_t *can_msg) |
| Converts a CAN message structure to GridConnect format string. | |
Implementation of GridConnect protocol conversion.
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.
This module implements the GridConnect protocol, a human-readable ASCII encoding of CAN bus messages. The protocol is widely used in OpenLCB systems for serial and TCP/IP communication, debugging, and bridging applications.
Implementation features:
The parser state machine handles:
GridConnect Protocol Format:
| bool OpenLcbGridConnect_copy_out_gridconnect_when_done | ( | uint8_t | next_byte, |
| gridconnect_buffer_t * | gridconnect_buffer ) |
Processes incoming GridConnect byte stream and extracts complete message.
Feeds one byte into the streaming GridConnect parser.
Algorithm: Implements a three-state parser that processes GridConnect protocol data one byte at a time:
Use cases:
* @param next_byte Next byte from the incoming GridConnect stream * @param gridconnect_buffer Pointer to buffer where complete message will be stored *
| void OpenLcbGridConnect_to_can_msg | ( | gridconnect_buffer_t * | gridconnect_buffer, |
| can_msg_t * | can_msg ) |
Converts a GridConnect message string to a CAN message structure.
Converts a validated GridConnect string to a can_msg_t.
Algorithm:
Use cases:
* @param gridconnect_buffer Pointer to GridConnect message buffer (null-terminated) * @param can_msg Pointer to CAN message structure to populate *
| void OpenLcbGridConnect_from_can_msg | ( | gridconnect_buffer_t * | gridconnect_buffer, |
| can_msg_t * | can_msg ) |
Converts a CAN message structure to GridConnect format string.
Converts a can_msg_t to a null-terminated GridConnect string.
Algorithm:
Use cases:
* @param gridconnect_buffer Pointer to buffer where GridConnect message will be stored * @param can_msg Pointer to source CAN message structure to convert *
Copyright (c) 2026 Jim Kueneman all rights reserved. See the License