]> sigrok.org Git - libsigrok.git/blobdiff - bindings/java/org/sigrok/core/classes/classes.i
Add a public API to list available serial ports.
[libsigrok.git] / bindings / java / org / sigrok / core / classes / classes.i
index 25e5c38789e7c66f76d7f6ae95e51e03369cc281..867e8fcaaae53d20a9db466f1eaa89990fcdacf9 100644 (file)
@@ -137,6 +137,11 @@ VECTOR(std::shared_ptr<sigrok::HardwareDevice>, HardwareDevice)
 
 MAP_COMMON(std::string, std::string, String, String)
 
+%typemap(jni) std::map<std::string, std::string>
+  "jobject"
+%typemap(jtype) std::map<std::string, std::string>
+  "java.util.Map<String,String>"
+
 %typemap(out) std::map<std::string, std::string> {
   jclass HashMap = jenv->FindClass("java/util/HashMap");
   jmethodID init = jenv->GetMethodID(HashMap, "<init>", "()V");
@@ -224,6 +229,15 @@ MAP_COMMON(const sigrok::ConfigKey *, Glib::VariantBase, ConfigKey, Variant)
   }
 }
 
+/* Support InputFormat.create_input() with no options. */
+%extend sigrok::InputFormat {
+  std::shared_ptr<sigrok::Input> create_input()
+  {
+    std::map<std::string, Glib::VariantBase> options;
+    return $self->create_input(options);
+  }
+}
+
 /* Support OutputFormat.create_output(device) with no options. */
 %extend sigrok::OutputFormat {
   std::shared_ptr<sigrok::Output> create_output(
@@ -367,8 +381,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"
+