]> sigrok.org Git - libsigrok.git/blobdiff - include/libsigrok/libsigrok.h
Removal of sdi->index, step 1: remove it from headers and helper funcs
[libsigrok.git] / include / libsigrok / libsigrok.h
index 3ecc460a28fa9bb387443ec4e5f180615ebc22cd..61e0caa897ef8e27076a5ed7831911cf6b6d8cda 100644 (file)
@@ -486,7 +486,7 @@ struct sr_channel_group {
 /** Used for setting or getting value of a config item. */
 struct sr_config {
        /** Config key like SR_CONF_CONN, etc. */
-       int key;
+       uint32_t key;
        /** Key-specific data. */
        GVariant *data;
 };
@@ -494,7 +494,7 @@ struct sr_config {
 /** Information about a config key. */
 struct sr_config_info {
        /** Config key like SR_CONF_CONN, etc. */
-       int key;
+       uint32_t key;
        /** Data type like SR_T_STRING, etc. */
        int datatype;
        /** Id string, e.g. "serialcomm". */
@@ -505,6 +505,11 @@ struct sr_config_info {
        char *description;
 };
 
+#define SR_CONF_GET  (1 << 31)
+#define SR_CONF_SET  (1 << 30)
+#define SR_CONF_LIST (1 << 29)
+#define SR_CONF_MASK 0x1fffffff
+
 /** Constants for device classes */
 enum sr_configkey {
        /*--- Device classes ------------------------------------------------*/
@@ -851,8 +856,6 @@ enum sr_configkey {
 struct sr_dev_inst {
        /** Device driver. */
        struct sr_dev_driver *driver;
-       /** Index of device in driver. */
-       int index;
        /** Device instance status. SR_ST_NOT_FOUND, etc. */
        int status;
        /** Device instance type. SR_INST_USB, etc. */
@@ -863,6 +866,10 @@ struct sr_dev_inst {
        char *model;
        /** Device version. */
        char *version;
+       /** Serial number. */
+       char *serial_num;
+       /** Connection string to uniquely identify devices. */
+       char *connection_id;
        /** List of channels. */
        GSList *channels;
        /** List of sr_channel_group structs */
@@ -930,12 +937,12 @@ struct sr_dev_driver {
        /** Query value of a configuration key in driver or given device instance.
         *  @see sr_config_get().
         */
-       int (*config_get) (int id, GVariant **data,
+       int (*config_get) (uint32_t key, GVariant **data,
                        const struct sr_dev_inst *sdi,
                        const struct sr_channel_group *cg);
        /** Set value of a configuration key in driver or a given device instance.
         *  @see sr_config_set(). */
-       int (*config_set) (int id, GVariant *data,
+       int (*config_set) (uint32_t key, GVariant *data,
                        const struct sr_dev_inst *sdi,
                        const struct sr_channel_group *cg);
        /** Channel status change.
@@ -948,7 +955,7 @@ struct sr_dev_driver {
        /** List all possible values for a configuration key in a device instance.
         *  @see sr_config_list().
         */
-       int (*config_list) (int info_id, GVariant **data,
+       int (*config_list) (uint32_t key, GVariant **data,
                        const struct sr_dev_inst *sdi,
                        const struct sr_channel_group *cg);