|
ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
|
Heidenhain LSV/2 telegram codec (PC_ENABLE_LSV2) - a zero-heap codec for the LSV/2 protocol Heidenhain TNC controls (iTNC 530, TNC 320/620/640, ...) speak for DNC and data access over a serial link or, as implemented here, LSV/2-over-TCP (default port 19000). A CNC-native southbound source for the common European control, alongside services/focas (Fanuc) and services/haas_mdc (Haas).
More...
#include "protocore_config.h"Go to the source code of this file.
Heidenhain LSV/2 telegram codec (PC_ENABLE_LSV2) - a zero-heap codec for the LSV/2 protocol Heidenhain TNC controls (iTNC 530, TNC 320/620/640, ...) speak for DNC and data access over a serial link or, as implemented here, LSV/2-over-TCP (default port 19000). A CNC-native southbound source for the common European control, alongside services/focas (Fanuc) and services/haas_mdc (Haas).
Wire framing (byte-exact, both directions): a telegram is a 4-byte big-endian payload-length prefix, then a 4-character ASCII command / response mnemonic, then payload-length payload bytes. The length counts ONLY the payload - the mnemonic is not included - so a telegram with no payload is exactly 8 bytes on the wire (e.g. a bare T_OK acknowledgement is ‘00 00 00 00 'T’ '_' 'O' 'K'). The command mnemonics group into login / logout (A_LG/A_LO), file system (C_*write,R_*read), and run / status inspection (R_RI/R_ST/R_VR); the control answers with a response mnemonic (T_OKdone,T_FDfile-data finished,S_*a data reply, orT_ER/T_BD` a two-byte error-class + error-code).
This codec owns the framing and the request builders: pc_lsv2_build frames an arbitrary mnemonic + payload, pc_lsv2_parse slices one complete telegram off a byte stream (reporting how many bytes it consumed so a caller can re-frame the rest), and the typed helpers build the common requests (pc_lsv2_build_login, pc_lsv2_build_filename, pc_lsv2_build_run_info) and read the response (pc_lsv2_is_ok, pc_lsv2_error). The TCP / serial link to the control is the application's.
Reference: the LSV/2 telegram framing + the command / response mnemonic set, cross-checked byte-for-byte against the pyLSV2 reference implementation (drunsinn/pyLSV2, the widely-used open Python LSV/2 client) - the !L big-endian length prefix, the 4-character mnemonic, and the !H big-endian run-info selector.
Definition in file lsv2.h.