]> sigrok.org Git - libsigrok.git/blobdiff - src/scpi.h
scpi: Pass SCPI device instance to open and close callbacks.
[libsigrok.git] / src / scpi.h
index 36bc16270c6e3c19bcbc6f5e3a2340ec3c456ecc..aee1bfba836809c711c93849c529b24893267719 100644 (file)
@@ -58,6 +58,11 @@ enum {
        SCPI_CMD_GET_SAMPLE_RATE_LIVE,
 };
 
+struct scpi_command {
+       int command;
+       const char *string;
+};
+
 struct sr_scpi_hw_info {
        char *manufacturer;
        char *model;
@@ -72,7 +77,7 @@ struct sr_scpi_dev_inst {
        GSList *(*scan)(struct drv_context *drvc);
        int (*dev_inst_new)(void *priv, struct drv_context *drvc,
                const char *resource, char **params, const char *serialcomm);
-       int (*open)(void *priv);
+       int (*open)(struct sr_scpi_dev_inst *scpi);
        int (*source_add)(struct sr_session *session, void *priv, int events,
                int timeout, sr_receive_data_callback cb, void *cb_data);
        int (*source_remove)(struct sr_session *session, void *priv);
@@ -80,7 +85,7 @@ struct sr_scpi_dev_inst {
        int (*read_begin)(void *priv);
        int (*read_data)(void *priv, char *buf, int maxlen);
        int (*read_complete)(void *priv);
-       int (*close)(void *priv);
+       int (*close)(struct sr_scpi_dev_inst *scpi);
        void (*free)(void *priv);
        unsigned int read_timeout_ms;
        void *priv;
@@ -125,4 +130,12 @@ SR_PRIV int sr_scpi_get_hw_id(struct sr_scpi_dev_inst *scpi,
                        struct sr_scpi_hw_info **scpi_response);
 SR_PRIV void sr_scpi_hw_info_free(struct sr_scpi_hw_info *hw_info);
 
+SR_PRIV const char *sr_vendor_alias(const char *raw_vendor);
+SR_PRIV const char *scpi_cmd_get(const struct scpi_command *cmdtable, int command);
+SR_PRIV int scpi_cmd(const struct sr_dev_inst *sdi,
+               const struct scpi_command *cmdtable, int command, ...);
+SR_PRIV int scpi_cmd_resp(const struct sr_dev_inst *sdi,
+               const struct scpi_command *cmdtable,
+               GVariant **gvar, const GVariantType *gvtype, int command, ...);
+
 #endif