37#ifndef PROTOCORE_LSV2_H
38#define PROTOCORE_LSV2_H
42#if PROTOCORE_ENABLE_LSV2
47#define PROTOCORE_LSV2_TCP_PORT 19000
49#define PROTOCORE_LSV2_MNEMONIC_LEN 4
51#define PROTOCORE_LSV2_HEADER_LEN 8
54#define PROTOCORE_LSV2_CMD_LOGIN "A_LG"
55#define PROTOCORE_LSV2_CMD_LOGOUT "A_LO"
56#define PROTOCORE_LSV2_CMD_FILE_LOAD "R_FL"
57#define PROTOCORE_LSV2_CMD_FILE_SEND "C_FL"
58#define PROTOCORE_LSV2_CMD_FILE_DELETE "C_FD"
59#define PROTOCORE_LSV2_CMD_FILE_INFO "R_FI"
60#define PROTOCORE_LSV2_CMD_DIR_CHANGE "C_DC"
61#define PROTOCORE_LSV2_CMD_DIR_MAKE "C_DM"
62#define PROTOCORE_LSV2_CMD_DIR_DELETE "C_DD"
63#define PROTOCORE_LSV2_CMD_DIR_READ "R_DR"
64#define PROTOCORE_LSV2_CMD_DIR_INFO "R_DI"
65#define PROTOCORE_LSV2_CMD_RUN_INFO "R_RI"
66#define PROTOCORE_LSV2_CMD_STATUS "R_ST"
67#define PROTOCORE_LSV2_CMD_VERSION "R_VR"
68#define PROTOCORE_LSV2_CMD_PARAM "R_PR"
71#define PROTOCORE_LSV2_RSP_OK "T_OK"
72#define PROTOCORE_LSV2_RSP_ERROR "T_ER"
73#define PROTOCORE_LSV2_RSP_FIN "T_FD"
74#define PROTOCORE_LSV2_RSP_XFER_ERR "T_BD"
75#define PROTOCORE_LSV2_RSP_LONG "M_CC"
76#define PROTOCORE_LSV2_RSP_RUN_INFO "S_RI"
77#define PROTOCORE_LSV2_RSP_STATUS "S_ST"
78#define PROTOCORE_LSV2_RSP_VERSION "S_VR"
79#define PROTOCORE_LSV2_RSP_FILE "S_FL"
80#define PROTOCORE_LSV2_RSP_DIR "S_DR"
83#define PROTOCORE_LSV2_LOGIN_INSPECT "INSPECT"
84#define PROTOCORE_LSV2_LOGIN_FILE "FILE"
85#define PROTOCORE_LSV2_LOGIN_DNC "DNC"
86#define PROTOCORE_LSV2_LOGIN_MONITOR "MONITOR"
87#define PROTOCORE_LSV2_LOGIN_DIAG "DIAGNOSTICS"
88#define PROTOCORE_LSV2_LOGIN_PLCDEBUG "PLCDEBUG"
91enum Lsv2RunInfo : uint16_t
94 LSV2_RI_EXEC_STATE = 23,
95 LSV2_RI_SELECTED_PGM = 24,
96 LSV2_RI_OVERRIDE = 25,
97 LSV2_RI_PGM_STATE = 26,
104 char mnemonic[PROTOCORE_LSV2_MNEMONIC_LEN];
105 const uint8_t *payload;
114size_t protocore_lsv2_build(uint8_t *buf,
size_t cap,
const char *mnemonic,
const uint8_t *payload,
size_t payload_len);
123proto_bool protocore_lsv2_parse(
const uint8_t *buf,
size_t len, Lsv2Telegram *out,
size_t *consumed);
128proto_bool protocore_lsv2_is(
const Lsv2Telegram *t,
const char *mnemonic4);
136size_t protocore_lsv2_build_login(uint8_t *buf,
size_t cap,
const char *login,
const char *password);
143size_t protocore_lsv2_build_logout(uint8_t *buf,
size_t cap,
const char *login);
150size_t protocore_lsv2_build_filename(uint8_t *buf,
size_t cap,
const char *mnemonic,
const char *filename);
157size_t protocore_lsv2_build_run_info(uint8_t *buf,
size_t cap, uint16_t info_code);
162proto_bool protocore_lsv2_is_ok(
const Lsv2Telegram *t);
167proto_bool protocore_lsv2_is_error(
const Lsv2Telegram *t);
173proto_bool protocore_lsv2_error(
const Lsv2Telegram *t, uint8_t *err_class, uint8_t *err_code);
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
_Bool proto_bool
The truth value.
#define PROTOCORE_END_DECLS