33#ifndef PROTOCORE_SCPI_H
34#define PROTOCORE_SCPI_H
44#define PC_SCPI_PORT 5025
47#define SCPI_ESR_OPC 0x01
48#define SCPI_ESR_RQC 0x02
49#define SCPI_ESR_QYE 0x04
50#define SCPI_ESR_DDE 0x08
51#define SCPI_ESR_EXE 0x10
52#define SCPI_ESR_CME 0x20
53#define SCPI_ESR_URQ 0x40
54#define SCPI_ESR_PON 0x80
57#define SCPI_STB_EAV 0x04
58#define SCPI_STB_QSB 0x08
59#define SCPI_STB_MAV 0x10
60#define SCPI_STB_ESB 0x20
61#define SCPI_STB_MSS 0x40
62#define SCPI_STB_OSB 0x80
65enum class ScpiCommon : uint8_t
83const char *pc_scpi_common(ScpiCommon c);
94size_t pc_scpi_build(
char *buf,
size_t cap,
const char *header,
const char *
const *args,
size_t argc);
101size_t pc_scpi_fmt_real(
char *buf,
size_t cap,
double v);
108bool pc_scpi_parse_number(
const char *s,
size_t len,
double *out);
114bool pc_scpi_parse_bool(
const char *s,
size_t len,
bool *out);
121size_t pc_scpi_parse_string(
const char *s,
size_t len,
char *out,
size_t cap);
131bool pc_scpi_parse_block(
const uint8_t *buf,
size_t len,
const uint8_t **data,
size_t *data_len,
size_t *consumed);
155void pc_scpi_status_init(ScpiStatus *s);
158void pc_scpi_event(ScpiStatus *s, uint8_t esr_bits);
165void pc_scpi_push_error(ScpiStatus *s, int16_t number,
const char *msg);
172bool pc_scpi_pop_error(ScpiStatus *s, ScpiError *out);
175uint8_t pc_scpi_stb(
const ScpiStatus *s);
178void pc_scpi_cls(ScpiStatus *s);
181const char *pc_scpi_std_error(int16_t number);
195bool pc_scpi_match(
const char *input,
size_t input_len,
const char *pattern);
User-facing configuration for ProtoCore.
#define PC_SCPI_ERR_QUEUE
SCPI error/event queue depth (entries). The SCPI status model requires a queue; when it overflows the...