X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=blobdiff_plain;f=bindings%2Fswig%2Fclasses.i;h=b6ddbbcad261d131c657d309f88c14add22f25e7;hp=b688a857494fdb0a4b273b60b6db0720188eadc6;hb=5a3e34285da1544941fd314079f05a1715fc3de3;hpb=1411f7d8e9fa5d90d8140fc51eb44562dd626b7c diff --git a/bindings/swig/classes.i b/bindings/swig/classes.i index b688a857..b6ddbbca 100644 --- a/bindings/swig/classes.i +++ b/bindings/swig/classes.i @@ -20,7 +20,7 @@ #pragma SWIG nowarn=325,401 %{ -#include "libsigrok/libsigrok.hpp" +#include using namespace std; %} @@ -84,6 +84,7 @@ template< class T > class enable_shared_from_this; %shared_ptr(sigrok::Trigger); %shared_ptr(sigrok::TriggerStage); %shared_ptr(sigrok::TriggerMatch); +%shared_ptr(sigrok::UserDevice); %template(StringMap) std::map; @@ -160,11 +161,11 @@ typedef std::map map_ConfigKey_Variant; } -%attributeval(sigrok::Context, +%attributemap(Context, map_string_Driver, drivers, drivers); -%attributeval(sigrok::Context, +%attributemap(Context, map_string_InputFormat, input_formats, input_formats); -%attributeval(sigrok::Context, +%attributemap(Context, map_string_OutputFormat, output_formats, output_formats); %attributestring(sigrok::Context, @@ -196,28 +197,27 @@ typedef std::map %attributestring(sigrok::Option, std::string, description, description); /* Currently broken on Python due to some issue with variant typemaps. */ -/* %attributeval(sigrok::Option, +/* %attributevector(Option, Glib::VariantBase, default_value, default_value); */ -%attributeval(sigrok::Option, +%attributevector(Option, std::vector, values, values); %attributestring(sigrok::OutputFormat, std::string, name, name); %attributestring(sigrok::OutputFormat, std::string, description, description); -%attributeval(sigrok::OutputFormat, +%attributemap(OutputFormat, map_string_Option, options, options); -%attributestring(sigrok::Device, std::string, description, description); %attributestring(sigrok::Device, std::string, vendor, vendor); %attributestring(sigrok::Device, std::string, model, model); %attributestring(sigrok::Device, std::string, version, version); -%attributeval(sigrok::Device, +%attributevector(Device, std::vector >, channels, channels); -%attributeval(sigrok::Device, map_string_ChannelGroup, +%attributemap(Device, map_string_ChannelGroup, channel_groups, channel_groups); /* Using %attributestring for shared_ptr attribute. See @@ -231,17 +231,17 @@ typedef std::map %attribute(sigrok::Channel, unsigned int, index, index); %attributestring(sigrok::ChannelGroup, std::string, name, name); -%attributeval(sigrok::ChannelGroup, +%attributevector(ChannelGroup, std::vector >, channels, channels); %attributestring(sigrok::Trigger, std::string, name, name); -%attributeval(sigrok::Trigger, +%attributevector(Trigger, std::vector >, stages, stages); %attribute(sigrok::TriggerStage, int, number, number); -%attributeval(sigrok::TriggerStage, +%attributevector(TriggerStage, std::vector >, matches, matches); @@ -250,7 +250,7 @@ typedef std::map %attribute(sigrok::TriggerMatch, const sigrok::TriggerMatchType *, type, type); %attribute(sigrok::TriggerMatch, float, value, value); -%attributeval(sigrok::Session, +%attributevector(Session, std::vector >, devices, devices); @@ -261,18 +261,20 @@ typedef std::map %attribute(sigrok::Packet, const sigrok::PacketType *, type, type); -%attributestring(sigrok::Packet, - std::shared_ptr, payload, payload); -%attributeval(sigrok::Meta, map_ConfigKey_Variant, config, config); +%attributemap(Meta, map_ConfigKey_Variant, config, config); +%attributevector(Analog, + std::vector >, channels, channels); %attribute(sigrok::Analog, int, num_samples, num_samples); %attribute(sigrok::Analog, const sigrok::Quantity *, mq, mq); %attribute(sigrok::Analog, const sigrok::Unit *, unit, unit); -%attributeval(sigrok::Analog, std::vector, mq_flags, mq_flags); +%attributevector(Analog, std::vector, mq_flags, mq_flags); -%include "libsigrok/libsigrok.hpp" +%include + +%include "swig/enums.i" namespace sigrok { -%include "libsigrok/enums.hpp" +%include }