From: Martin Ling Date: Thu, 24 Jul 2014 14:01:26 +0000 (+0100) Subject: bindings: Add Channel::get_index() method. X-Git-Tag: libsigrok-0.4.0~1197 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=06bd935e161dd273788ce9f1b455732fb91efd84;p=libsigrok.git bindings: Add Channel::get_index() method. --- diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index 044e8c45..0d306a97 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -482,6 +482,11 @@ void Channel::set_enabled(bool value) check(sr_dev_channel_enable(parent->structure, structure->index, value)); } +unsigned int Channel::get_index() +{ + return structure->index; +} + ChannelGroup::ChannelGroup(Device *device, struct sr_channel_group *structure) : StructureWrapper(structure), diff --git a/bindings/cxx/include/libsigrok/libsigrok.hpp b/bindings/cxx/include/libsigrok/libsigrok.hpp index a6cca1d2..5435b83e 100644 --- a/bindings/cxx/include/libsigrok/libsigrok.hpp +++ b/bindings/cxx/include/libsigrok/libsigrok.hpp @@ -340,6 +340,8 @@ public: bool get_enabled(); /** Set the enabled status of this channel. */ void set_enabled(bool value); + /** Get the index number of this channel. */ + unsigned int get_index(); protected: Channel(struct sr_channel *structure); ~Channel(); diff --git a/bindings/swig/classes.i b/bindings/swig/classes.i index 253ce01b..d0227d6b 100644 --- a/bindings/swig/classes.i +++ b/bindings/swig/classes.i @@ -200,6 +200,7 @@ typedef std::map %attributestring(sigrok::Channel, std::string, name, get_name, set_name); %attribute(sigrok::Channel, bool, enabled, get_enabled, set_enabled); %attribute(sigrok::Channel, const sigrok::ChannelType *, type, get_type); +%attribute(sigrok::Channel, unsigned int, index, get_index); %attributestring(sigrok::ChannelGroup, std::string, name, get_name); %attributeval(sigrok::ChannelGroup,