]> sigrok.org Git - libsigrok.git/commitdiff
bindings: Add Channel::get_index() method.
authorMartin Ling <redacted>
Thu, 24 Jul 2014 14:01:26 +0000 (15:01 +0100)
committerMartin Ling <redacted>
Thu, 24 Jul 2014 22:42:53 +0000 (23:42 +0100)
bindings/cxx/classes.cpp
bindings/cxx/include/libsigrok/libsigrok.hpp
bindings/swig/classes.i

index 044e8c4565b706e997ea95a84c8f72caff9a4ec3..0d306a97848b444a04751a279a48188ea77cf913 100644 (file)
@@ -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<Device, struct sr_channel_group>(structure),
index a6cca1d2b5c638bf45c5c117b0e0bb07622ef16b..5435b83e0d24f4a9b516e122e800ffa851176af3 100644 (file)
@@ -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();
index 253ce01b4b770dcaee17fbcbb6a7fbaebe41b850..d0227d6be410653d90cc29d410ff912603354da6 100644 (file)
@@ -200,6 +200,7 @@ typedef std::map<const sigrok::ConfigKey *, Glib::VariantBase>
 %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,