From: Uwe Hermann Date: Tue, 11 Nov 2014 10:51:53 +0000 (+0100) Subject: Add sr_dev_inst_channels_get() and sr_dev_inst_channel_groups_get(). X-Git-Tag: libsigrok-0.4.0~810 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=e437da2b86ba7604fc315996dd89014dbb94d101 Add sr_dev_inst_channels_get() and sr_dev_inst_channel_groups_get(). --- diff --git a/include/libsigrok/proto.h b/include/libsigrok/proto.h index 51e02eca..7ff6a150 100644 --- a/include/libsigrok/proto.h +++ b/include/libsigrok/proto.h @@ -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 ------------------------------------------------------------*/ diff --git a/src/device.c b/src/device.c index 051616f5..8e06fc18 100644 --- a/src/device.c +++ b/src/device.c @@ -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; +} + /** @} */