|
Open Model Railroad Network (OpenMRN)
|
#include "utils/constants.hxx"Go to the source code of this file.
Functions | |
| DECLARE_CONST (gc_generate_newlines) | |
| Whether gridconnect format should create newline characters at the end of packets. | |
| int | gc_format_parse (const char *buf, struct can_frame *can_frame) |
| Parses a GridConnect packet. | |
| char * | gc_format_generate (const struct can_frame *can_frame, char *buf, int double_format) |
| Formats a can frame in the GridConnect protocol. | |
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.
Headers for conversion to gridconnect format.
Definition in file gc_format.h.
| char * gc_format_generate | ( | const struct can_frame * | can_frame, |
| char * | buf, | ||
| int | double_format | ||
| ) |
Formats a can frame in the GridConnect protocol.
If requested, it can create the double protocol with leading !!, trailing ;; and all the characters doubled.
If the input frame is an error frame, then does not output anything and returns the input pointer.
| can_frame | is the input frame. |
| buf | is the output buffer. The caller must ensure this is big enough to hold the resulting frame (28 or 56 bytes). |
| double_format | if non-zero, the doubling format will be generated. |
Definition at line 199 of file gc_format.cxx.
| int gc_format_parse | ( | const char * | buf, |
| struct can_frame * | can_frame | ||
| ) |
Parses a GridConnect packet.
| buf | points to a character buffer that contains the packet. The leading ":" must be already removed, the tailing ';' must be replaced by a \0 char. |
| can_frame | is the CAN frame that will be filled based on the source packet. |
Definition at line 82 of file gc_format.cxx.