]> sigrok.org Git - libsigrok.git/blobdiff - bindings/swig/classes.i
Update bindings for new input API.
[libsigrok.git] / bindings / swig / classes.i
index ff4435c118e792dfc6f526c683b9221d73b4527b..cc4aa7429bdc6f973ba9cbacbb013de3fbda3718 100644 (file)
@@ -17,6 +17,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#pragma SWIG nowarn=325,401
+
 %{
 #include "libsigrok/libsigrok.hpp"
 using namespace std;
@@ -68,10 +70,14 @@ template< class T > class enable_shared_from_this;
 %shared_ptr(sigrok::Session);
 %shared_ptr(sigrok::Packet);
 %shared_ptr(sigrok::PacketPayload);
+%shared_ptr(sigrok::Header);
+%shared_ptr(sigrok::Meta);
 %shared_ptr(sigrok::Analog);
 %shared_ptr(sigrok::Logic);
 %shared_ptr(sigrok::InputFormat);
-%shared_ptr(sigrok::InputFileDevice);
+%shared_ptr(sigrok::Input);
+%shared_ptr(sigrok::InputDevice);
+%shared_ptr(sigrok::Option);
 %shared_ptr(sigrok::OutputFormat);
 %shared_ptr(sigrok::Output);
 %shared_ptr(sigrok::Trigger);
@@ -107,6 +113,16 @@ template< class T > class enable_shared_from_this;
 %template(ConfigMap)
     std::map<const sigrok::ConfigKey *, Glib::VariantBase>;
 
+%template(OptionVector)
+    std::vector<std::shared_ptr<sigrok::Option> >;
+%template(OptionMap)
+    std::map<std::string, std::shared_ptr<sigrok::Option> >;
+
+%template(VariantVector)
+    std::vector<Glib::VariantBase>;
+%template(VariantMap)
+    std::map<std::string, Glib::VariantBase>;
+
 %template(QuantityFlagVector)
     std::vector<const sigrok::QuantityFlag *>;
 
@@ -141,6 +157,12 @@ typedef std::map<std::string, std::shared_ptr<sigrok::OutputFormat> >
     map_string_OutputFormat;
 typedef std::map<std::string, std::shared_ptr<sigrok::ChannelGroup> >
     map_string_ChannelGroup;
+typedef std::map<std::string, std::shared_ptr<sigrok::Option> >
+    map_string_Option;
+typedef std::map<std::string, Glib::VariantBase>
+    map_string_Variant;
+typedef std::map<const sigrok::ConfigKey *, Glib::VariantBase>
+    map_ConfigKey_Variant;
 }
 
 %attributeval(sigrok::Context,
@@ -169,11 +191,29 @@ typedef std::map<std::string, std::shared_ptr<sigrok::ChannelGroup> >
 %attributestring(sigrok::InputFormat,
     std::string, description, get_description);
 
+%attributestring(sigrok::Input,
+    std::shared_ptr<sigrok::InputDevice>, device, get_device);
+
+%attributestring(sigrok::Option,
+    std::string, id, get_id);
+%attributestring(sigrok::Option,
+    std::string, name, get_name);
+%attributestring(sigrok::Option,
+    std::string, description, get_description);
+/* Currently broken on Python due to some issue with variant typemaps. */
+/* %attributeval(sigrok::Option,
+    Glib::VariantBase, default_value, get_default_value); */
+%attributeval(sigrok::Option,
+    std::vector<Glib::VariantBase>, values, get_values);
+
 %attributestring(sigrok::OutputFormat,
     std::string, name, get_name);
 %attributestring(sigrok::OutputFormat,
     std::string, description, get_description);
+%attributeval(sigrok::OutputFormat,
+    map_string_Option, options, get_options);
 
+%attributestring(sigrok::Device, std::string, description, get_description);
 %attributestring(sigrok::Device, std::string, vendor, get_vendor);
 %attributestring(sigrok::Device, std::string, model, get_model);
 %attributestring(sigrok::Device, std::string, version, get_version);
@@ -182,17 +222,18 @@ typedef std::map<std::string, std::shared_ptr<sigrok::ChannelGroup> >
     std::vector<std::shared_ptr<sigrok::Channel> >,
     channels, get_channels);
 
+%attributeval(sigrok::Device, map_string_ChannelGroup,
+    channel_groups, get_channel_groups);
+
 /* Using %attributestring for shared_ptr attribute. See
    http://sourceforge.net/p/swig/mailman/message/31832070/ */
 %attributestring(sigrok::HardwareDevice,
     std::shared_ptr<sigrok::Driver>, driver, get_driver);
 
-%attributeval(sigrok::HardwareDevice, map_string_ChannelGroup,
-    channel_groups, get_channel_groups);
-
 %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,
@@ -218,7 +259,13 @@ typedef std::map<std::string, std::shared_ptr<sigrok::ChannelGroup> >
     std::vector<std::shared_ptr<sigrok::Device> >,
     devices, get_devices);
 
-%attribute(sigrok::Packet, sigrok::PacketPayload *, payload, get_payload);
+%attributestring(sigrok::Session,
+    std::shared_ptr<sigrok::Trigger>, trigger, get_trigger, set_trigger);
+
+%attributestring(sigrok::Packet,
+    std::shared_ptr<sigrok::PacketPayload>, payload, get_payload);
+
+%attributeval(sigrok::Meta, map_ConfigKey_Variant, config, get_config);
 
 %attribute(sigrok::Analog, int, num_samples, get_num_samples);
 %attribute(sigrok::Analog, const sigrok::Quantity *, mq, get_mq);