X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=bindings%2Fswig%2Fclasses.i;h=8f57e4186de996061f5bfc654051052b1fea53a8;hb=782b16447b25ce31d41764ae91681a6aa4f3fe0d;hp=ff4435c118e792dfc6f526c683b9221d73b4527b;hpb=608b848d8be3488c2a38fd8a2fd78fce07d99b21;p=libsigrok.git
diff --git a/bindings/swig/classes.i b/bindings/swig/classes.i
index ff4435c1..8f57e418 100644
--- a/bindings/swig/classes.i
+++ b/bindings/swig/classes.i
@@ -17,8 +17,10 @@
* along with this program. If not, see .
*/
+#pragma SWIG nowarn=325,401
+
%{
-#include "libsigrok/libsigrok.hpp"
+#include
using namespace std;
%}
@@ -66,17 +68,23 @@ template< class T > class enable_shared_from_this;
%shared_ptr(sigrok::ChannelGroup);
%shared_ptr(sigrok::EventSource);
%shared_ptr(sigrok::Session);
+%shared_ptr(sigrok::SessionDevice);
%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);
%shared_ptr(sigrok::TriggerStage);
%shared_ptr(sigrok::TriggerMatch);
+%shared_ptr(sigrok::UserDevice);
%template(StringMap) std::map;
@@ -107,6 +115,16 @@ template< class T > class enable_shared_from_this;
%template(ConfigMap)
std::map;
+%template(OptionVector)
+ std::vector >;
+%template(OptionMap)
+ std::map >;
+
+%template(VariantVector)
+ std::vector;
+%template(VariantMap)
+ std::map;
+
%template(QuantityFlagVector)
std::vector;
@@ -122,12 +140,6 @@ template< class T > class enable_shared_from_this;
%ignore sigrok::DatafeedCallbackData;
%ignore sigrok::SourceCallbackData;
-%include "libsigrok/libsigrok.hpp"
-
-namespace sigrok {
-%include "libsigrok/enums.hpp"
-}
-
#define SWIG_ATTRIBUTE_TEMPLATE
%include "attribute.i"
@@ -141,86 +153,125 @@ typedef std::map >
map_string_OutputFormat;
typedef std::map >
map_string_ChannelGroup;
+typedef std::map >
+ map_string_Option;
+typedef std::map
+ map_string_Variant;
+typedef std::map
+ map_ConfigKey_Variant;
}
-%attributeval(sigrok::Context,
- map_string_Driver, drivers, get_drivers);
-%attributeval(sigrok::Context,
- map_string_InputFormat, input_formats, get_input_formats);
-%attributeval(sigrok::Context,
- map_string_OutputFormat, output_formats, get_output_formats);
+%attributemap(Context,
+ map_string_Driver, drivers, drivers);
+%attributemap(Context,
+ map_string_InputFormat, input_formats, input_formats);
+%attributemap(Context,
+ map_string_OutputFormat, output_formats, output_formats);
%attributestring(sigrok::Context,
- std::string, package_version, get_package_version);
+ std::string, package_version, package_version);
%attributestring(sigrok::Context,
- std::string, lib_version, get_lib_version);
+ std::string, lib_version, lib_version);
%attribute(sigrok::Context,
- const sigrok::LogLevel *, log_level, get_log_level, set_log_level);
+ const sigrok::LogLevel *, log_level, log_level, set_log_level);
-%attributestring(sigrok::Context,
- std::string, log_domain, get_log_domain, set_log_domain);
-
-%attributestring(sigrok::Driver, std::string, name, get_name);
-%attributestring(sigrok::Driver, std::string, long_name, get_long_name);
+%attributestring(sigrok::Driver, std::string, name, name);
+%attributestring(sigrok::Driver, std::string, long_name, long_name);
%attributestring(sigrok::InputFormat,
- std::string, name, get_name);
+ std::string, name, name);
%attributestring(sigrok::InputFormat,
- std::string, description, get_description);
+ std::string, description, description);
+
+%attributestring(sigrok::Input,
+ std::shared_ptr, device, device);
+
+%attributestring(sigrok::Option,
+ std::string, id, id);
+%attributestring(sigrok::Option,
+ std::string, name, name);
+%attributestring(sigrok::Option,
+ std::string, description, description);
+/* Currently broken on Python due to some issue with variant typemaps. */
+/* %attributevector(Option,
+ Glib::VariantBase, default_value, default_value); */
+%attributevector(Option,
+ std::vector, values, values);
%attributestring(sigrok::OutputFormat,
- std::string, name, get_name);
+ std::string, name, name);
%attributestring(sigrok::OutputFormat,
- std::string, description, get_description);
+ std::string, description, description);
+%attributemap(OutputFormat,
+ map_string_Option, options, options);
-%attributestring(sigrok::Device, std::string, vendor, get_vendor);
-%attributestring(sigrok::Device, std::string, model, get_model);
-%attributestring(sigrok::Device, std::string, version, get_version);
+%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, get_channels);
+ channels, channels);
+
+%attributemap(Device, map_string_ChannelGroup,
+ channel_groups, channel_groups);
/* Using %attributestring for shared_ptr attribute. See
http://sourceforge.net/p/swig/mailman/message/31832070/ */
%attributestring(sigrok::HardwareDevice,
- std::shared_ptr, driver, get_driver);
+ std::shared_ptr, driver, driver);
-%attributeval(sigrok::HardwareDevice, map_string_ChannelGroup,
- channel_groups, get_channel_groups);
+%attributestring(sigrok::Channel, std::string, name, name, set_name);
+%attribute(sigrok::Channel, bool, enabled, enabled, set_enabled);
+%attribute(sigrok::Channel, const sigrok::ChannelType *, type, type);
+%attribute(sigrok::Channel, unsigned int, index, index);
-%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);
-
-%attributestring(sigrok::ChannelGroup, std::string, name, get_name);
-%attributeval(sigrok::ChannelGroup,
+%attributestring(sigrok::ChannelGroup, std::string, name, name);
+%attributevector(ChannelGroup,
std::vector >,
- channels, get_channels);
+ channels, channels);
-%attributestring(sigrok::Trigger, std::string, name, get_name);
-%attributeval(sigrok::Trigger,
+%attributestring(sigrok::Trigger, std::string, name, name);
+%attributevector(Trigger,
std::vector >,
- stages, get_stages);
+ stages, stages);
-%attribute(sigrok::TriggerStage, int, number, get_number);
-%attributeval(sigrok::TriggerStage,
+%attribute(sigrok::TriggerStage, int, number, number);
+%attributevector(TriggerStage,
std::vector >,
- matches, get_matches);
+ matches, matches);
%attributestring(sigrok::TriggerMatch,
- std::shared_ptr, channel, get_channel);
-%attribute(sigrok::TriggerMatch, const sigrok::TriggerMatchType *, type, get_type);
-%attribute(sigrok::TriggerMatch, float, value, get_value);
+ std::shared_ptr, channel, channel);
+%attribute(sigrok::TriggerMatch, const sigrok::TriggerMatchType *, type, type);
+%attribute(sigrok::TriggerMatch, float, value, value);
-%attributeval(sigrok::Session,
+%attributevector(Session,
std::vector >,
- devices, get_devices);
+ devices, devices);
+
+%attributestring(sigrok::Session,
+ std::shared_ptr, trigger, trigger, set_trigger);
+
+%attributestring(sigrok::Session, std::string, filename, filename);
+
+%attribute(sigrok::Packet,
+ const sigrok::PacketType *, type, type);
+
+%attributemap(Meta, map_ConfigKey_Variant, config, config);
-%attribute(sigrok::Packet, sigrok::PacketPayload *, payload, get_payload);
+%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);
+%attributevector(Analog, std::vector, mq_flags, mq_flags);
-%attribute(sigrok::Analog, int, num_samples, get_num_samples);
-%attribute(sigrok::Analog, const sigrok::Quantity *, mq, get_mq);
-%attribute(sigrok::Analog, const sigrok::Unit *, unit, get_unit);
-%attributeval(sigrok::Analog, std::vector, mq_flags, get_mq_flags);
+%include
+
+%include "swig/enums.i"
+
+namespace sigrok {
+%include
+}