Commit Graph

284 Commits

Author SHA1 Message Date
Bert Vermeulen 2fb60e2329 Replace sr_config_info with sr_key_info.
The tables defined with this struct can now be used for information
on items other than config keys.

Functions to access these tables have been renamed sr_key_info_[name_]get.
These take an extra argument, keytype, which should be set to SR_KEY_CONFIG
to get the config key tables. Other key types will be added.
2015-08-26 01:08:42 +02:00
Daniel Elstner 5a3e34285d setup.py: Do VPATH search for swig/enums.i
Also, in swig/classes.i include swig/enums.i rather than plain
enums.i, to guard against future name clashes.
2015-08-16 18:28:13 +02:00
Daniel Elstner bc81463bb8 enums.py: Place swig/enums.i into build directory 2015-08-16 18:28:13 +02:00
Daniel Elstner b5f0731971 Build: Use angle brackets for enums.cpp include 2015-08-16 18:28:13 +02:00
Daniel Elstner 8b2a184327 Build: Prefix directory to include of enums.hpp
This fixes a build problem due to the reduced include search paths
introduced by my recent changes.  Also fix a couple of other
includes to use angle brackets.
2015-08-16 18:28:13 +02:00
Daniel Elstner b9eb8e1a8c Consistently use SR_PACKAGE_VERSION instead of VERSION 2015-08-16 18:28:13 +02:00
Soeren Apel 3cd4b38174 Introduce OutputFlag 2015-08-15 23:53:12 +02:00
Soeren Apel 81b3ce374c Add filename field to sr_output and make it accessible
This fixes parts of bug #570.
2015-07-30 19:21:42 +02:00
Alexandru Gagniuc aae2273b99 bindings/python: Handle import failures without crashing
When the import of gi.repository.GLib failed, we would get a NULL
pointer that we passed along without any checking. In this situation,
the entire program would crash with a segmentation fault, and no
message to indicate the problem.

When the import fails, abort the SWIG init and print a message. The
Python interpreter then prints out a backtrace, which can be useful
in tracking down the problem.
2015-06-16 13:04:24 +02:00
Alexandru Gagniuc 682fb08c88 python: classes.i: Declare strings with std::string
This makes it consistent with the rest of the string declarations in
this file, all of which use std::string.
2015-04-30 16:21:21 -07:00
Martin Ling 2b51d48b38 C++: Change arguments of Input::send() from std::string to data+length. 2015-04-20 10:12:39 +01:00
Uwe Hermann 032da34b78 sr_driver_list() now takes a context pointer.
This requires sr_hw_cleanup_all() and sanity_check_all_drivers()
to also take a context.

The (runtime) generation of the driver list now happens in sr_init()
and sr_driver_list() always returns that pre-generated list. This fixes
a segfault when (correctly) invoking multiple sr_init() and sr_exit()
calls with different contexts (caught by the unit tests).

This fixes bug #565.
2015-04-07 02:09:56 +02:00
Uwe Hermann c879dca3d7 bindings/cxx/classes.cpp: Fix sr_session_load() invocation. 2015-03-26 01:02:40 +01:00
Uwe Hermann 60f6b00144 bindings/cxx/classes.cpp: Fix a typo. 2015-03-26 01:02:40 +01:00
Martin Ling 61e6e2da45 Make sr_session_new() and sr_session_load() require a context. 2015-03-26 01:02:40 +01:00
Martin Ling 6f1346fbd7 Change API of channel accessor functions to take struct sr_channel *. 2015-03-19 21:57:31 +00:00
Joel Holdsworth 8a174d2342 output: Added preferred file extension field
This fixes parts of bug #541.
2015-01-27 18:05:29 +01:00
Joel Holdsworth c7bc82ffa1 input: Added preferred file extension field
This fixes parts of bug #541.
2015-01-27 18:05:25 +01:00
Uwe Hermann dc7125bb7c cxx: Fix a linking issue.
Fix "undefined reference to `sigrok::EnumValue<sigrok::LogLevel,
sr_loglevel>::_values'", which happens at least when using clang(++),
e.g. on Linux, Mac OS X, or FreeBSD.

This fixes bug #534.

Thanks to Uffe Jakobsen and Martin Ling for reporting and investigating!
2015-01-26 15:31:27 +01:00
Martin Ling 48d92e2c2e C++: Fix segfault where input/output options are NULL. 2015-01-18 22:43:02 +00:00
Uwe Hermann 161dc24d84 cxx: Rename include/libsigrok/ to include/libsigrokcxx/. 2015-01-17 20:26:14 +01:00
Uwe Hermann 1b40fdb881 Rename libsigrok.hpp to libsigrokcxx.hpp.
This avoids confusion of libsigrok.h vs. libsigrok.hpp and makes it
clearer that this is the main libsigrokcxx header.
2015-01-17 20:15:38 +01:00
Uwe Hermann e0e6aecc20 libsigrok.hpp: Fix incorrect glibmm.h #include.
As per upstream docs "#include <glibmm.h>" is the correct usage,
the "glibmm-2.4" directory is handled correctly via pkg-config:

 $ pkg-config --cflags glibmm-2.4
 -I/usr/include/glibmm-2.4 [...]
2015-01-17 19:59:44 +01:00
Uwe Hermann afba88adb5 libsigrokcxx: Drop Requires.private entry.
libsigrokcxx.pc has a "Requires" field listing "libsigrok" which
will cause libsigrok's "Requires.private" entries to be used/inherited
when 'pkg-config --libs --static libsigrokcxx' is used.
2015-01-17 19:53:44 +01:00
Uwe Hermann 52ff4f6a04 Rename libsigrokxx to the more common libsigrokcxx. 2015-01-17 18:52:43 +01:00
Aurelien Jacobs 24287ea9e3 Add a public API to list available serial ports. 2015-01-03 17:51:51 +01:00
Jiří Pinkava cd5623ca86 fix numpy include path 2014-12-29 23:34:42 +01:00
Uwe Hermann e835e8080b bindings: Session::set_trigger(): Fix segfault condition.
sr_session_trigger_set(sess, NULL) is a valid thing to do, meaning that
any trigger shall be removed from the session.

This closes bugs #491 and #496.
2014-11-24 01:11:17 +01:00
Uwe Hermann 5fcc5909cc python: Silence some warnings via -Wno-uninitialized.
Silence some warnings when building the Python bindings:

  sigrok/core/classes_wrap.cpp: In function ‘PyObject* _wrap_new_OutputFormatMap(PyObject*, PyObject*)’:
  sigrok/core/classes_wrap.cpp:5232:4: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0);
      ^
  sigrok/core/classes_wrap.cpp:14383:13: note: ‘argv[0]’ was declared here
     PyObject *argv[2];
               ^
  sigrok/core/classes_wrap.cpp: In function ‘PyObject* _wrap_new_ChannelGroupMap(PyObject*, PyObject*)’:
  sigrok/core/classes_wrap.cpp:5232:4: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0);
      ^
  sigrok/core/classes_wrap.cpp:23356:13: note: ‘argv[0]’ was declared here
     PyObject *argv[2];
               ^

We add -Wno-uninitialized since the warnings are harmless and we really
don't care about them in the generated classes_wrap.cpp.

This fixes parts of #417.
2014-11-22 22:06:02 +01:00
Uwe Hermann b8721d7cf0 bindings: Fix out-of-tree build.
This closes #473.
2014-11-14 20:01:12 +01:00
Uwe Hermann b71356d631 bindings: Re-enable Java, but ignore create_analog_packet().
This will need some fixing.
2014-11-14 16:58:38 +01:00
Martin Ling d2a929ab85 bindings: Fix enums.py compatibility with Python 3. 2014-11-13 20:38:56 +00:00
Uwe Hermann 624d16100e bindings: Add Session::context(). 2014-11-13 19:15:37 +01:00
Martin Ling 304be4a771 bindings: Add packet constructors. 2014-11-13 18:37:57 +01:00
Martin Ling b2db9f3bbe bindings: Add QuantityFlag::mask_from_flags() method. 2014-11-13 18:37:57 +01:00
Martin Ling 9fa5b426ec bindings: Add UserDevice wrapping. 2014-11-13 18:37:57 +01:00
Martin Ling ed6b4c4747 python: Wrap Analog::data() as a NumPy array. 2014-11-12 02:27:05 +01:00
Martin Ling b20635771c bindings: Expose Analog::channels() as an attribute. 2014-11-12 02:27:05 +01:00
Martin Ling ea22dc108b python: Return correct PacketPayload subclasses from Packet.payload() 2014-11-12 02:27:05 +01:00
Martin Ling 75fb30365e python: Fix error handling for callbacks. 2014-11-12 02:27:05 +01:00
Martin Ling f0c0dab5a9 python: Implement equality checks for EnumValue derived classes.
Fixes bug #443.
2014-11-12 02:27:05 +01:00
Martin Ling 7a36ceacb9 bindings: Support per-language extensions to EnumValue wrappers. 2014-11-12 02:27:05 +01:00
Martin Ling 444d6a3975 python: Fix mapping of vector & map attributes to Python types.
Fixes bug #382.
2014-11-12 02:27:05 +01:00
Martin Ling 062430a2fb bindings: Use new %attributevector and %attributemap macros. 2014-11-12 02:27:05 +01:00
Martin Ling e480df0c45 bindings: Expose ConfigKey::identifier as an attribute. 2014-11-12 02:27:04 +01:00
Martin Ling 189461b251 bindings: Expose EnumValue::id and EnumValue::name as attributes. 2014-11-12 02:27:04 +01:00
Martin Ling fe4096fde6 bindings: Wrap EnumValue base class. 2014-11-12 02:27:04 +01:00
Martin Ling 0bc1a7613a bindings: Rename ConfigKey::get(string) to get_by_identifier().
The polymorphism with get(int) causes problems here when a char * is passed.
2014-11-12 02:27:04 +01:00
Martin Ling 9d229ecb9e cxx: Implement more of EnumValue in template. 2014-11-12 02:27:04 +01:00
Uwe Hermann 80fe524740 bindings: Use getters now that 'struct sr_dev_inst' is opaque. 2014-11-11 16:55:37 +01:00
Martin Ling d3a401c15b bindings: Remove Device::description(). 2014-10-15 13:44:44 +02:00
Martin Ling 1411f7d8e9 bindings: Add Session::filename() and corresponding SWIG attribute. 2014-10-15 13:44:44 +02:00
Martin Ling 73a1eb017b bindings: Add accessor to obtain parent object. 2014-10-15 13:44:44 +02:00
Martin Ling f591826cc7 bindings: add SWIG attribute for Packet::type. 2014-10-15 13:44:44 +02:00
Martin Ling f36f7d0282 C++: Don't clear Session::_owned_devices() in Session::remove_devices().
Owned devices are freed only when the session is destroyed.
2014-10-15 13:44:25 +02:00
Jens Steinhauser 174bf146e5 bindings: Better error handling in enumeration get() function.
Prior to this patch a call to get() with an invalid enumeration value
would raise an exception that would, for example, terminate the python
interpreter, whereas now the exception is handled and translated into a
proper python exception.
2014-10-07 15:15:17 +02:00
Martin Ling 98d39b919a Return sensible Device::description() for session and input devices. 2014-09-30 17:32:09 +01:00
Martin Ling ca4e307a93 C++: Fix management of SessionDevice objects. 2014-09-30 16:05:27 +01:00
Martin Ling 584f76a78a C++: Add spaces in Device::description(). 2014-09-30 13:19:27 +01:00
Martin Ling d1075e5acf C++: Expose device serial number and connection ID. 2014-09-30 11:50:07 +01:00
Martin Ling 4c7c4194cb C++: Expose config key capabilities. 2014-09-30 11:07:55 +01:00
Martin Ling 9c51e8ec56 bindings: Update for input API changes. 2014-09-30 01:50:17 +02:00
Aurelien Jacobs 03a4c07aff C++: handle uint32_t SR_CONF keys which contain key capabilities
This adapts the C++ bindings according to commits 584560f and 5827f61.
2014-09-30 00:37:03 +02:00
Martin Ling a4e4745458 C++: Make hardware device instances user owned. 2014-09-14 05:33:24 +01:00
Martin Ling 8fa3fc7c60 bindings: Make documentation script work under python 3.x. 2014-09-14 05:32:00 +01:00
Martin Ling f90ed2d1af python: fix conversion to string variants. 2014-09-14 04:53:06 +01:00
Martin Ling db560903d1 C++: use constructors for default argument declarations. 2014-09-13 20:23:46 +01:00
Martin Ling 35114c3394 C++: include <cmath> for NAN. 2014-09-13 20:23:23 +01:00
Martin Ling 3b16108573 bindings: Remove 'get_' prefix from all accessors. 2014-09-11 21:27:32 +01:00
Martin Ling d4cf45e516 C++: Whitespace fix. 2014-09-08 19:27:38 +02:00
Martin Ling cac58676e9 C++: Add SessionDevice class for devices owned by loaded sessions. 2014-09-08 19:27:38 +02:00
Martin Ling be43d5d584 C++: Preserve original channel ordering. 2014-09-08 19:27:38 +02:00
Martin Ling d9eed47d5b C++: Add Configurable::config_check() method. 2014-09-08 19:27:38 +02:00
Martin Ling d54190a363 C++: Add Configurable::config_keys() method. 2014-09-08 19:27:38 +02:00
Martin Ling 59b74d28c9 C++: Make Driver inherit Configurable. 2014-09-08 19:27:38 +02:00
Martin Ling 4f7bcf0ec3 C++: Fix recursion loop in PacketPayload::get_shared_pointer(). 2014-09-08 19:27:37 +02:00
Martin Ling b4ed33a776 C++: Implement Deleter pattern in UserOwned template. 2014-09-02 22:35:16 +02:00
Martin Ling 90e89c2a42 C++: Add UserOwned base template for objects with resources owned by user. 2014-09-02 22:35:16 +02:00
Martin Ling 541c855e1d C++: Rename StructureWrapper to ParentOwned. 2014-09-02 22:35:16 +02:00
Martin Ling bf52cc8cf2 C++: Make StructureWrapper a recurring template, eliminating lots of casts. 2014-09-02 22:35:16 +02:00
Martin Ling ba4eac48d4 C++: Don't spell out arguments to StructureWrapper when not required. 2014-09-02 22:35:16 +02:00
Martin Ling 0d0170ae9e C++: Fix duplicated shared_ptr creation. 2014-09-02 21:33:47 +02:00
Martin Ling 3bc172a61f C++: Remove erroneous stray method. 2014-09-02 21:33:47 +02:00
Martin Ling 78132e2a13 C++: Add sanity checks in StructureWrapper. 2014-08-31 19:03:31 +02:00
Marcus Comstedt d92de05ad1 C++: Provide fallbacks for missing stoi/stod functions
Notably, Android does not provide these functions.  The fallback
implementation is based on the one in the GNU ISO C++ Library.
2014-08-31 13:31:35 +02:00
Martin Ling 4cd883a7f3 C++: Fix shared pointer handling for PacketPayload base class. 2014-08-29 20:06:49 +01:00
Martin Ling b31581f8a8 C++: Fix hash table initialisation in map_to_hash_variant. 2014-08-29 17:35:46 +01:00
Martin Ling d01d231487 C++: Fix shared pointer handling for Device base class. 2014-08-29 14:01:51 +01:00
Bert Vermeulen f88c73732c C++: Use sr_input_scan_*() API changes. 2014-08-28 12:19:55 +02:00
Martin Ling 7f5a036750 C++: Update InputFormat::get_options for latest version of input API. 2014-08-26 01:55:41 +02:00
Martin Ling 43942280bb C++: Implement InputFormat::get_options() 2014-08-26 01:55:41 +02:00
Martin Ling 6e5240f418 C++: Correct ownership of InputDevice objects. 2014-08-26 01:55:41 +02:00
Martin Ling ca3291e3ee Update bindings for new input API. 2014-08-26 01:55:41 +02:00
Marcus Comstedt 0e1a7fe91a Makefile.am: Fix out-of-tree build for Python bindings 2014-08-17 16:05:46 +02:00
Marcus Comstedt 33c84e8197 Makefile.am: Fix out-of-tree build for C++ and Java bindings 2014-08-17 12:58:39 +02:00
Martin Ling 70d3b20ba6 bindings: update for sr_output_options_{get,free} API change. 2014-08-17 11:44:05 +01:00
Uwe Hermann ac0db24ad4 Doxygen: Silence Doxygen warnings by default.
This allows for a clean build per default. Developers can enable
those switches while writing documentation to get a few useful
warnings.
2014-08-10 18:16:07 +02:00
Martin Ling 5cad31c708 bindings: Transfer C++ method parameter documentation to Python/Java bindings. 2014-08-10 15:47:14 +02:00
Martin Ling b6f411ac4e C++: Add parameter documentation and additional method descriptions. 2014-08-10 15:47:14 +02:00
Martin Ling 8a314e90ff java: Add documentation generation. 2014-08-10 15:47:14 +02:00
Martin Ling 6a8c1d6879 python: Add documentation generation. 2014-08-10 15:47:13 +02:00
Martin Ling bd4fda2407 bindings: Transfer C++ documentation strings to Python and Java wrappers. 2014-08-10 15:47:13 +02:00
Martin Ling 84c870852a C++ bindings: Attach documentation to enum wrapper classes. 2014-08-10 15:47:13 +02:00
Martin Ling 3532ed0125 C++ bindings: Reimplement enums.py using doxygen XML output instead of gccxml. 2014-08-10 15:47:13 +02:00
Martin Ling 7a958e2a07 Java: correct input map type in create_output() wrapper. 2014-07-26 21:28:05 +01:00
Martin Ling 90bd765640 Java: Move interfaces into org.sigrok.core.interfaces, tidy build system. 2014-07-26 20:41:08 +01:00
Martin Ling 9455b6df6f Java: ignore Meta::get_config() due to SWIG typemap issues. 2014-07-26 20:41:08 +01:00
Martin Ling 58aa1f8359 Update bindings to use new output API. 2014-07-26 16:03:25 +01:00
Martin Ling 06bd935e16 bindings: Add Channel::get_index() method. 2014-07-24 23:42:53 +01:00
Martin Ling f36ca8893d bindings: Add Device::get_description() method. 2014-07-24 23:42:53 +01:00
Martin Ling e194c01197 bindings: Change return type of config_list to Glib::VariantContainerBase. 2014-07-24 23:42:53 +01:00
Martin Ling 1d67cfb4ea bindings: Revise Session::append() API. 2014-07-24 23:42:53 +01:00
Martin Ling 6be7a7f287 bindings: Support get_channel_groups() on base Device class. 2014-07-24 23:42:53 +01:00
Martin Ling 2928f47d64 bindings: Overhaul packet & payload classes. 2014-07-24 23:42:53 +01:00
Martin Ling 7009a3921a C++: Fix leak of GVariant in ConfigKey::parse_string(). 2014-07-24 23:42:53 +01:00
Martin Ling 1797a887d7 C++: Fix Packet destructor for packets without payload. 2014-07-24 23:42:51 +01:00
Martin Ling 4178d9712f C++: Add internal lookup to find Channel object from sr_channel *. 2014-07-24 21:00:45 +01:00
Martin Ling 7649683c2a C++: Centralise code for preparing shared pointers. 2014-07-24 21:00:45 +01:00
Martin Ling 07443fd204 Add Doxyfile for C++ bindings and adaptations to C++ header file. 2014-07-23 22:45:37 +01:00
Martin Ling 90ba83f21d bindings: Add Packet.get_type() method. 2014-07-23 22:45:37 +01:00
Martin Ling 6fa0eb86af Add bindings for getting/setting session trigger. 2014-07-23 22:45:37 +01:00
Jens Steinhauser c6036f755a C++ bindings: Make enums.py work with newer versions of pygccxml. 2014-07-22 21:06:16 +02:00
Bert Vermeulen 9ae3eb121f python: Don't install as a zip file. 2014-07-19 22:25:39 +02:00
Bert Vermeulen 6884b52bde bindings: Filter out various pygccxml noise. 2014-07-19 19:48:01 +02:00
Martin Ling d615a3962a Suppress some SWIG warnings that don't matter. 2014-07-19 16:28:42 +02:00
Martin Ling abc7146d03 Fix building Python bindings with pygobject >= 3.7.91. 2014-07-19 16:12:34 +02:00
Martin Ling f0f1d90d9c Remove obsolete low-level language bindings. 2014-07-18 21:34:57 +01:00
Martin Ling 9fcf4d0b5b Add Java bindings. 2014-07-18 21:34:57 +01:00
Martin Ling f774095496 Reimplement high-level Python bindings on top of SWIG/C++ bindings. 2014-07-18 20:47:10 +01:00
Martin Ling 608b848d8b Add new generic SWIG bindings based on C++ classes. 2014-07-18 20:47:10 +01:00
Martin Ling c23c8659b8 Add C++ bindings. 2014-07-18 20:47:10 +01:00
Martin Ling 5a7e62211c SWIG: Rename libsigrok.i to lowlevel.i. 2014-07-17 18:30:49 +01:00
Martin Ling fb336bf9e5 SWIG: Remove obsolete lowlevel wrapper methods for sr_output_format. 2014-07-17 18:30:49 +01:00
Bert Vermeulen 5842817e45 swig: Use new output API. 2014-07-14 19:22:58 +02:00
Uwe Hermann 3f239f0803 Rename various *PROBE* macros to *CHANNEL*.
This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
Uwe Hermann 91aea754aa Rename 'struct sr_probe' to 'struct sr_channel' everywhere.
This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
Uwe Hermann 660e398fe9 Replace 'probe group' with 'channel group' everywhere.
The name 'probe' (and thus 'probe group') is a relic from the times when
sigrok was mostly about logic analyzers. Nowadays we support a lot more
device types where 'probe' is not really a good term and 'channel' is
much better suited.

This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
Martin Ling 865730188c python: Use OrderedDict for input formats. 2013-12-17 16:29:41 +00:00
Martin Ling 772b21d425 python: Split up Device class and add InputFileDevice class. 2013-12-17 16:10:08 +00:00
Martin Ling 01e9ff61c2 python: Give config keys an auto lowercase name if they have none defined. 2013-12-17 13:11:43 +00:00
Martin Ling cad0acef5d python: Add ConfigKey.info and ConfigKey.<id> shortcuts. 2013-12-17 13:01:35 +00:00
Martin Ling 14e8eb3353 python: ConfigInfo: return None from constructor if not available. 2013-12-17 13:01:11 +00:00
Martin Ling 8593c8e30d python: Add ConfigInfo and DataType classes. 2013-12-17 12:47:49 +00:00
Martin Ling 409d85b3ac python: Finish output format support. 2013-12-17 02:00:09 +01:00
Martin Ling f0e764de7b python: Finish input format support. 2013-12-17 02:00:09 +01:00
Martin Ling a64198c8ea python: Add initial support for input and output formats. 2013-12-17 02:00:09 +01:00
Martin Ling 945e23a57d python: fix setting device/probe group configuration. 2013-12-17 02:00:09 +01:00
Martin Ling 4e5c64e358 python: whitespace fix. 2013-12-17 02:00:09 +01:00
Martin Ling af54bac90a python: Map probe group configuration to ProbeGroup attributes. 2013-11-08 01:03:17 +01:00
Martin Ling 417e9f3ab4 python: Add classes for probes and probe groups. 2013-11-08 01:03:17 +01:00