33#ifndef PROTOCORE_SCPI_H
34#define PROTOCORE_SCPI_H
38#if PROTOCORE_ENABLE_SCPI
43#define PROTOCORE_SCPI_PORT 5025
46#define SCPI_ESR_OPC 0x01
47#define SCPI_ESR_RQC 0x02
48#define SCPI_ESR_QYE 0x04
49#define SCPI_ESR_DDE 0x08
50#define SCPI_ESR_EXE 0x10
51#define SCPI_ESR_CME 0x20
52#define SCPI_ESR_URQ 0x40
53#define SCPI_ESR_PON 0x80
56#define SCPI_STB_EAV 0x04
57#define SCPI_STB_QSB 0x08
58#define SCPI_STB_MAV 0x10
59#define SCPI_STB_ESB 0x20
60#define SCPI_STB_MSS 0x40
61#define SCPI_STB_OSB 0x80
82const char *protocore_scpi_common(ScpiCommon c);
93size_t protocore_scpi_build(
char *buf,
size_t cap,
const char *header,
const char *
const *args,
size_t argc);
100size_t protocore_scpi_fmt_real(
char *buf,
size_t cap,
double v);
107proto_bool protocore_scpi_parse_number(
const char *s,
size_t len,
double *out);
120size_t protocore_scpi_parse_string(
const char *s,
size_t len,
char *out,
size_t cap);
130proto_bool protocore_scpi_parse_block(
const uint8_t *buf,
size_t len,
const uint8_t **data,
size_t *data_len,
155void protocore_scpi_status_init(ScpiStatus *s);
158void protocore_scpi_event(ScpiStatus *s, uint8_t esr_bits);
165void protocore_scpi_push_error(ScpiStatus *s, int16_t number,
const char *msg);
172proto_bool protocore_scpi_pop_error(ScpiStatus *s, ScpiError *out);
175uint8_t protocore_scpi_stb(
const ScpiStatus *s);
178void protocore_scpi_cls(ScpiStatus *s);
181const char *protocore_scpi_std_error(int16_t number);
195proto_bool protocore_scpi_match(
const char *input,
size_t input_len,
const char *pattern);
#define PROTOCORE_SCPI_ERR_QUEUE
SCPI error/event queue depth (entries). The SCPI status model requires a queue; when it overflows the...
PROTO_ENUM_PACKED
Application protocol spoken on a listener port or connection slot.
#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