]> sigrok.org Git - libsigrok.git/commitdiff
Add sr_dev_inst_channels_get() and sr_dev_inst_channel_groups_get().
authorUwe Hermann <redacted>
Tue, 11 Nov 2014 10:51:53 +0000 (11:51 +0100)
committerUwe Hermann <redacted>
Tue, 11 Nov 2014 10:59:23 +0000 (11:59 +0100)
include/libsigrok/proto.h
src/device.c

index 51e02eca083cd22590149d672b93383ef831e7ec..7ff6a1507205a76e800e2b5817b5605d6fd41103 100644 (file)
@@ -61,6 +61,8 @@ SR_API const char *sr_dev_inst_model_get(struct sr_dev_inst *sdi);
 SR_API const char *sr_dev_inst_version_get(struct sr_dev_inst *sdi);
 SR_API const char *sr_dev_inst_sernum_get(struct sr_dev_inst *sdi);
 SR_API const char *sr_dev_inst_connid_get(struct sr_dev_inst *sdi);
+SR_API GSList *sr_dev_inst_channels_get(struct sr_dev_inst *sdi);
+SR_API GSList *sr_dev_inst_channel_groups_get(struct sr_dev_inst *sdi);
 
 /*--- hwdriver.c ------------------------------------------------------------*/
 
index 051616f5ad7935e79041403d1bd97b39149872b8..8e06fc180359689016f43f66c9bf947d7f109d69 100644 (file)
@@ -630,4 +630,34 @@ SR_API const char *sr_dev_inst_connid_get(struct sr_dev_inst *sdi)
        return sdi->connection_id;
 }
 
+/**
+ * Queries a device instances' channel list.
+ *
+ * @param sdi Device instance to use. Must not be NULL.
+ *
+ * @return The GSList of channels or NULL.
+ */
+SR_API GSList *sr_dev_inst_channels_get(struct sr_dev_inst *sdi)
+{
+       if (!sdi)
+               return NULL;
+
+       return sdi->channels;
+}
+
+/**
+ * Queries a device instances' channel groups list.
+ *
+ * @param sdi Device instance to use. Must not be NULL.
+ *
+ * @return The GSList of channel groups or NULL.
+ */
+SR_API GSList *sr_dev_inst_channel_groups_get(struct sr_dev_inst *sdi)
+{
+       if (!sdi)
+               return NULL;
+
+       return sdi->channel_groups;
+}
+
 /** @} */