X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=bindings%2Fjava%2Forg%2Fsigrok%2Fcore%2Fclasses%2Fclasses.i;h=413fb93ab44c6813672df832f51250dbc48ab371;hb=b71356d63104635116e556cd51daa0904e28fc99;hp=633ecdbee52145287d120295e81b590ab61f6003;hpb=bd4fda24074ce175d23a59cb15cceb19707fe6f1;p=libsigrok.git diff --git a/bindings/java/org/sigrok/core/classes/classes.i b/bindings/java/org/sigrok/core/classes/classes.i index 633ecdbe..413fb93a 100644 --- a/bindings/java/org/sigrok/core/classes/classes.i +++ b/bindings/java/org/sigrok/core/classes/classes.i @@ -7,11 +7,36 @@ } %} -/* Import interfaces. */ +/* Documentation & importing interfaces. */ %pragma(java) jniclassimports=%{ - import org.sigrok.core.interfaces.LogCallback; - import org.sigrok.core.interfaces.DatafeedCallback; - import org.sigrok.core.interfaces.SourceCallback; +/** + * @mainpage API Reference + * + * Introduction + * ------------ + * + * The sigrok-java API provides an object-oriented Java interface to the + * functionality in libsigrok. It is built on top of the sigrok++ C++ API. + * + * Getting started + * --------------- + * + * Usage of the sigrok-java API needs to begin with a call to Context.create(). + * This will create the global libsigrok context and returns a Context object. + * Methods on this object provide access to the hardware drivers, input and + * output formats supported by the library, as well as means of creating other + * objects such as sessions and triggers. + * + * Error handling + * -------------- + * + * When any libsigrok C API call returns an error, an Error exception is raised, + * which provides access to the error code and description. + */ + +import org.sigrok.core.interfaces.LogCallback; +import org.sigrok.core.interfaces.DatafeedCallback; +import org.sigrok.core.interfaces.SourceCallback; %} /* Map Java FileDescriptor objects to int fds */ @@ -199,6 +224,15 @@ MAP_COMMON(const sigrok::ConfigKey *, Glib::VariantBase, ConfigKey, Variant) } } +/* Support InputFormat.create_input() with no options. */ +%extend sigrok::InputFormat { + std::shared_ptr create_input() + { + std::map options; + return $self->create_input(options); + } +} + /* Support OutputFormat.create_output(device) with no options. */ %extend sigrok::OutputFormat { std::shared_ptr create_output( @@ -342,8 +376,21 @@ typedef jobject jsourcecallback; } } -/* Currently broken due to some std::map typemap issues. */ -%ignore sigrok::Meta::get_config; - %include "doc.i" + +%define %attributevector(Class, Type, Name, Get) +%attributeval(sigrok::Class, Type, Name, Get); +%enddef + +%define %attributemap(Class, Type, Name, Get) +%attributeval(sigrok::Class, Type, Name, Get); +%enddef + +%define %enumextras(Class) +%enddef + +/* Ignore this for now, needs a fix. */ +%ignore sigrok::Context::create_analog_packet; + %include "bindings/swig/classes.i" +