32#ifndef PROTOCORE_HAAS_MDC_H
33#define PROTOCORE_HAAS_MDC_H
37#if PROTOCORE_ENABLE_HAAS_MDC
42#define PROTOCORE_HAAS_MDC_TCP_PORT 5051
44#define PROTOCORE_HAAS_MDC_STX 0x02
46#define PROTOCORE_HAAS_MDC_ETB 0x17
48#define PROTOCORE_HAAS_MDC_PROMPT 0x3E
50#define PROTOCORE_HAAS_MDC_MAX_FIELDS 8
59 HAAS_Q_SOFTWARE = 101,
62 HAAS_Q_TOOL_CHANGES = 200,
63 HAAS_Q_TOOL_IN_USE = 201,
64 HAAS_Q_POWERON_TIME = 300,
65 HAAS_Q_CUTTING_TIME = 301,
66 HAAS_Q_LAST_CYCLE = 303,
67 HAAS_Q_PREV_CYCLE = 304,
68 HAAS_Q_M30_COUNTER_1 = 402,
69 HAAS_Q_M30_COUNTER_2 = 403,
70 HAAS_Q_PROGRAM_STATUS = 500,
77 const char *field[PROTOCORE_HAAS_MDC_MAX_FIELDS];
78 size_t field_len[PROTOCORE_HAAS_MDC_MAX_FIELDS];
99size_t protocore_haas_mdc_build_q(
char *buf,
size_t cap, uint16_t qnum);
106size_t protocore_haas_mdc_build_var(
char *buf,
size_t cap, uint32_t var);
115proto_bool protocore_haas_mdc_parse(
const char *buf,
size_t len, HaasMdcResp *out);
121proto_bool protocore_haas_mdc_field(
const HaasMdcResp *r,
size_t idx,
const char **p,
size_t *l);
128proto_bool protocore_haas_mdc_value(
const HaasMdcResp *r,
const char **p,
size_t *l);
133proto_bool protocore_haas_mdc_is_error(
const HaasMdcResp *r);
141proto_bool protocore_haas_mdc_parse_status(
const HaasMdcResp *r, HaasMdcStatus *out);
149proto_bool protocore_haas_mdc_parse_macro(
const HaasMdcResp *r, uint32_t *var,
const char **value,
size_t *value_len);
159proto_bool protocore_haas_mdc_dprnt_line(
const char *buf,
size_t len,
const char **text,
size_t *text_len);
#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