From 6a0ce865940d6759adc913d0f0019deb83854edc Mon Sep 17 00:00:00 2001 From: John Zhao Date: Wed, 27 Feb 2019 16:33:13 +0800 Subject: [PATCH] feat(android): add more interfaces --- .../slightech/mynteye/demo/MyApplication.java | 3 +- .../mynteye/demo/camera/Mynteye.java | 99 +++- .../mynteye/demo/ui/MainActivity.java | 89 +++- .../app/src/main/res/menu/menu_main.xml | 32 +- .../app/src/main/res/values/strings.xml | 8 + wrappers/android/mynteye/build.gradle | 2 +- .../src/main/cpp/mynteye/cpp/addon.hpp | 28 ++ .../cpp/mynteye/cpp/calibration_model.hpp | 30 ++ .../src/main/cpp/mynteye/cpp/capability.hpp | 42 ++ .../src/main/cpp/mynteye/cpp/device.hpp | 52 ++ .../src/main/cpp/mynteye/cpp/extrinsics.hpp | 25 + .../main/cpp/mynteye/cpp/imu_intrinsics.hpp | 38 ++ .../src/main/cpp/mynteye/cpp/info.hpp | 40 ++ .../src/main/cpp/mynteye/cpp/intrinsics.hpp | 55 +++ .../cpp/mynteye/cpp/motion_intrinsics.hpp | 25 + .../src/main/cpp/mynteye/cpp/option.hpp | 115 +++++ .../src/main/cpp/mynteye/cpp/option_info.hpp | 29 ++ .../src/main/cpp/mynteye/impl/device_impl.cpp | 82 ++++ .../src/main/cpp/mynteye/impl/device_impl.hpp | 44 +- .../main/cpp/mynteye/impl/type_conversion.hpp | 462 ++++++++++++++---- .../src/main/cpp/mynteye/jni/NativeAddon.hpp | 26 + .../mynteye/jni/NativeCalibrationModel.hpp | 26 + .../main/cpp/mynteye/jni/NativeCapability.hpp | 26 + .../src/main/cpp/mynteye/jni/NativeDevice.cpp | 150 ++++++ .../main/cpp/mynteye/jni/NativeExtrinsics.cpp | 30 ++ .../main/cpp/mynteye/jni/NativeExtrinsics.hpp | 33 ++ .../cpp/mynteye/jni/NativeImuIntrinsics.cpp | 34 ++ .../cpp/mynteye/jni/NativeImuIntrinsics.hpp | 35 ++ .../src/main/cpp/mynteye/jni/NativeInfo.hpp | 26 + .../main/cpp/mynteye/jni/NativeIntrinsics.cpp | 43 ++ .../main/cpp/mynteye/jni/NativeIntrinsics.hpp | 39 ++ .../mynteye/jni/NativeMotionIntrinsics.cpp | 30 ++ .../mynteye/jni/NativeMotionIntrinsics.hpp | 33 ++ .../src/main/cpp/mynteye/jni/NativeOption.hpp | 26 + .../main/cpp/mynteye/jni/NativeOptionInfo.cpp | 32 ++ .../main/cpp/mynteye/jni/NativeOptionInfo.hpp | 34 ++ .../java/com/slightech/mynteye/Addon.java | 16 + .../slightech/mynteye/CalibrationModel.java | 18 + .../com/slightech/mynteye/Capability.java | 33 ++ .../java/com/slightech/mynteye/Device.java | 161 ++++++ .../com/slightech/mynteye/Extrinsics.java | 45 ++ .../com/slightech/mynteye/ImuIntrinsics.java | 72 +++ .../main/java/com/slightech/mynteye/Info.java | 28 ++ .../com/slightech/mynteye/Intrinsics.java | 109 +++++ .../slightech/mynteye/MotionIntrinsics.java | 44 ++ .../java/com/slightech/mynteye/Option.java | 103 ++++ .../com/slightech/mynteye/OptionInfo.java | 52 ++ .../android/mynteye/scripts/mynteye.djinni | 36 ++ .../mynteye/scripts/mynteye_types.djinni | 194 ++++++++ 49 files changed, 2708 insertions(+), 126 deletions(-) create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/addon.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/calibration_model.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/capability.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/extrinsics.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/imu_intrinsics.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/info.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/intrinsics.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/motion_intrinsics.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/option.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/option_info.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeAddon.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeCalibrationModel.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeCapability.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeExtrinsics.cpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeExtrinsics.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeImuIntrinsics.cpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeImuIntrinsics.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeInfo.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeIntrinsics.cpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeIntrinsics.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeMotionIntrinsics.cpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeMotionIntrinsics.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeOption.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeOptionInfo.cpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeOptionInfo.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Addon.java create mode 100644 wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/CalibrationModel.java create mode 100644 wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Capability.java create mode 100644 wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Extrinsics.java create mode 100644 wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/ImuIntrinsics.java create mode 100644 wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Info.java create mode 100644 wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Intrinsics.java create mode 100644 wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/MotionIntrinsics.java create mode 100644 wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Option.java create mode 100644 wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/OptionInfo.java diff --git a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MyApplication.java b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MyApplication.java index 7eed9ec..1bddf50 100644 --- a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MyApplication.java +++ b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MyApplication.java @@ -1,9 +1,10 @@ package com.slightech.mynteye.demo; import android.app.Application; -//import com.stericson.RootShell.RootShell; import timber.log.Timber; +//import com.stericson.RootShell.RootShell; + public class MyApplication extends Application { static { diff --git a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/camera/Mynteye.java b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/camera/Mynteye.java index bfff986..4f3c243 100644 --- a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/camera/Mynteye.java +++ b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/camera/Mynteye.java @@ -4,12 +4,17 @@ import android.os.Handler; import android.os.HandlerThread; import com.slightech.mynteye.Device; import com.slightech.mynteye.DeviceUsbInfo; +import com.slightech.mynteye.Info; import com.slightech.mynteye.MotionData; +import com.slightech.mynteye.MotionIntrinsics; +import com.slightech.mynteye.Option; import com.slightech.mynteye.Source; import com.slightech.mynteye.Stream; import com.slightech.mynteye.StreamData; import com.slightech.mynteye.StreamRequest; import java.util.ArrayList; +import java.util.Map; +import timber.log.Timber; public final class Mynteye implements Runnable { @@ -19,6 +24,7 @@ public final class Mynteye implements Runnable { private Handler mBackgroundHandler; private boolean mOpened; + private boolean mImuEnabled; public interface OnStreamDataReceiveListener { void onStreamDataReceive(Stream stream, StreamData data, Handler handler); @@ -33,9 +39,12 @@ public final class Mynteye implements Runnable { private OnStreamDataReceiveListener mOnStreamDataReceiveListener; private OnMotionDataReceiveListener mOnMotionDataReceiveListener; + private StreamRequest mStreamRequest; + public Mynteye(DeviceUsbInfo info) { mDevice = Device.create(info); mOpened = false; + mImuEnabled = false; } public void setOnStreamDataReceiveListener(OnStreamDataReceiveListener l) { @@ -50,15 +59,95 @@ public final class Mynteye implements Runnable { return mDevice.getStreamRequests(); } + public String getDeviceInfos() { + StringBuffer sb = new StringBuffer(); + for (Info info : Info.values()) { + sb.append(info.toString()); + sb.append(": "); + sb.append(mDevice.getInfo(info)); + sb.append('\n'); + } + return sb.toString(); + } + + public String getImageParams() { + StringBuffer sb = new StringBuffer(); + sb.append(Stream.LEFT).append('\n').append(mDevice.getIntrinsics(Stream.LEFT)); + sb.append("\n\n"); + sb.append(Stream.RIGHT).append('\n').append(mDevice.getIntrinsics(Stream.RIGHT)); + sb.append("\n\n"); + sb.append(Stream.LEFT).append(" > ").append(Stream.RIGHT); + sb.append('\n'); + sb.append(mDevice.getExtrinsics(Stream.LEFT, Stream.RIGHT)); + return sb.toString(); + } + + public String getImuParams() { + StringBuffer sb = new StringBuffer(); + MotionIntrinsics in = mDevice.getMotionIntrinsics(); + sb.append("Accel\n").append(in.getAccel()); + sb.append("\n\n"); + sb.append("Gyro\n").append(in.getGyro()); + sb.append("\n\n"); + sb.append("Imu > ").append(Stream.LEFT).append('\n') + .append(mDevice.getMotionExtrinsics(Stream.LEFT)); + return sb.toString(); + } + + public String getOptionInfos() { + StringBuffer sb = new StringBuffer(); + for (Option op : Option.values()) { + if (!mDevice.supportsOption(op)) { + continue; + } + sb.append(op.toString()); + sb.append(": "); + sb.append(mDevice.getOptionValue(op)); + sb.append("\n "); + sb.append(mDevice.getOptionInfo(op)); + sb.append('\n'); + } + return sb.toString(); + } + + public boolean isOpened() { + return mOpened; + } + + public boolean isImuEnabled() { + return mImuEnabled; + } + + public void setImuEnabled(boolean enabled) { + mImuEnabled = enabled; + if (mOpened) { + Timber.w("Will enable imu when open next time"); + } + } + + public void open() { + if (mOpened) return; + if (mStreamRequest == null) { + Timber.w("Should open with stream request"); + return; + } + open(mStreamRequest); + } + public void open(StreamRequest request) { if (mOpened) return; mOpened = true; + mStreamRequest = request; + startBackgroundThread(); mDevice.configStreamRequest(request); - //mDevice.enableMotionDatas(Integer.MAX_VALUE); - //mDevice.start(Source.ALL); - mDevice.start(Source.VIDEO_STREAMING); + if (mImuEnabled) { + mDevice.enableMotionDatas(Integer.MAX_VALUE); + mDevice.start(Source.ALL); + } else { + mDevice.start(Source.VIDEO_STREAMING); + } mBackgroundHandler.post(this); } @@ -92,14 +181,12 @@ public final class Mynteye implements Runnable { } //Timber.i("get motions"); - /* - { + if (mImuEnabled) { ArrayList datas = mDevice.getMotionDatas(); if (mOnMotionDataReceiveListener != null) { mOnMotionDataReceiveListener.onMotionDataReceive(datas, mBackgroundHandler); } } - */ if (mOpened) mBackgroundHandler.post(this); } diff --git a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/ui/MainActivity.java b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/ui/MainActivity.java index 2072c9a..3ec846b 100644 --- a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/ui/MainActivity.java +++ b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/ui/MainActivity.java @@ -1,12 +1,10 @@ package com.slightech.mynteye.demo.ui; import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.hardware.usb.UsbDevice; import android.os.Bundle; import android.os.Handler; import android.text.TextUtils; -import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.ArrayAdapter; @@ -15,10 +13,8 @@ import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import androidx.appcompat.app.AlertDialog; -import androidx.fragment.app.FragmentActivity; import butterknife.BindView; import butterknife.ButterKnife; -import com.slightech.mynteye.Device; import com.slightech.mynteye.DeviceUsbInfo; import com.slightech.mynteye.Frame; import com.slightech.mynteye.MotionData; @@ -27,13 +23,11 @@ import com.slightech.mynteye.StreamData; import com.slightech.mynteye.StreamRequest; import com.slightech.mynteye.demo.R; import com.slightech.mynteye.demo.camera.Mynteye; -import com.slightech.mynteye.demo.util.RootUtils; import com.slightech.mynteye.usb.CameraDialog; import com.slightech.mynteye.usb.USBMonitor; import com.slightech.mynteye.usb.USBMonitor.OnDeviceConnectListener; import com.slightech.mynteye.usb.USBMonitor.UsbControlBlock; import com.slightech.mynteye.util.BitmapUtils; -import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Locale; import timber.log.Timber; @@ -50,12 +44,13 @@ public class MainActivity extends BaseActivity implements CameraDialog.CameraDia private Mynteye mMynteye; private Bitmap mLeftBitmap, mRightBitmap; + private boolean mImuEnabled; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); - mUSBMonitor = new USBMonitor(this, mOnDeviceConnectListener); } @@ -63,6 +58,9 @@ public class MainActivity extends BaseActivity implements CameraDialog.CameraDia protected void onStart() { super.onStart(); mUSBMonitor.register(); + if (mMynteye == null) { + //actionOpen(); + } } @Override @@ -144,29 +142,72 @@ public class MainActivity extends BaseActivity implements CameraDialog.CameraDia @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); - MenuItem item = menu.findItem(R.id.action_open); - if (item != null) { - item.setEnabled(false); - actionOpen(() -> item.setEnabled(true)); - } return true; } + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + if (mMynteye == null) { + menu.findItem(R.id.action_open).setVisible(true); + menu.findItem(R.id.action_close).setVisible(false); + } else { + menu.findItem(R.id.action_open).setVisible(!mMynteye.isOpened()); + menu.findItem(R.id.action_close).setVisible(mMynteye.isOpened()); + } + menu.findItem(R.id.check_imu_data).setChecked(mImuEnabled); + boolean featuresUsable = mMynteye != null && mMynteye.isOpened(); + menu.findItem(R.id.show_device_infos).setVisible(featuresUsable); + menu.findItem(R.id.show_image_params).setVisible(featuresUsable); + menu.findItem(R.id.show_imu_params).setVisible(featuresUsable); + menu.findItem(R.id.show_option_infos).setVisible(featuresUsable); + return super.onPrepareOptionsMenu(menu); + } + @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_open: - item.setEnabled(false); - actionOpen(() -> item.setEnabled(true)); + actionOpen(); + return true; + case R.id.action_close: + actionClose(); + return true; + case R.id.check_imu_data: + mImuEnabled = !item.isChecked(); + item.setChecked(mImuEnabled); + return true; + case R.id.show_device_infos: + alert(R.string.device_infos, mMynteye.getDeviceInfos()); + return true; + case R.id.show_image_params: + alert(R.string.image_params, mMynteye.getImageParams()); + return true; + case R.id.show_imu_params: + alert(R.string.imu_params, mMynteye.getImuParams()); + return true; + case R.id.show_option_infos: + alert(R.string.option_infos, mMynteye.getOptionInfos()); return true; default: return super.onOptionsItemSelected(item); } } - private void actionOpen(final Runnable completeEvent) { - if (completeEvent != null) completeEvent.run(); - CameraDialog.showDialog(this); + private void actionOpen() { + if (mMynteye == null) { + CameraDialog.showDialog(this); + } else { + mMynteye.setImuEnabled(mImuEnabled); + mMynteye.open(); + } + } + + private void actionClose() { + if (mMynteye != null) { + mMynteye.close(); + mMynteye = null; + } + invalidateOptionsMenu(); } private void openDevice(DeviceUsbInfo info) { @@ -174,6 +215,7 @@ public class MainActivity extends BaseActivity implements CameraDialog.CameraDia ArrayList requests = mMynteye.getStreamRequests(); if (requests.isEmpty()) { alert("Warning", "There are no streams to request :("); + mMynteye = null; } else { ArrayList items = new ArrayList<>(); for (StreamRequest req : requests) { @@ -189,7 +231,12 @@ public class MainActivity extends BaseActivity implements CameraDialog.CameraDia dialog.dismiss(); mMynteye.setOnStreamDataReceiveListener(this); mMynteye.setOnMotionDataReceiveListener(this); + mMynteye.setImuEnabled(mImuEnabled); mMynteye.open(requests.get(position)); + invalidateOptionsMenu(); + }); + dialog.setOnCancelListener(dlg -> { + mMynteye = null; }); dialog.setView(listView); dialog.show(); @@ -237,10 +284,18 @@ public class MainActivity extends BaseActivity implements CameraDialog.CameraDia mTextView.post(() -> mTextView.setText(datas.get(0).imu().toString())); } + private void toast(int textId) { + toast(getString(textId)); + } + private void toast(CharSequence text) { Toast.makeText(this, text, Toast.LENGTH_LONG).show(); } + private void alert(int titleId, CharSequence message) { + alert(getString(titleId), message); + } + private void alert(CharSequence title, CharSequence message) { new AlertDialog.Builder(this) .setTitle(title) diff --git a/wrappers/android/mynteye/app/src/main/res/menu/menu_main.xml b/wrappers/android/mynteye/app/src/main/res/menu/menu_main.xml index cc4a0f6..219cafc 100644 --- a/wrappers/android/mynteye/app/src/main/res/menu/menu_main.xml +++ b/wrappers/android/mynteye/app/src/main/res/menu/menu_main.xml @@ -3,7 +3,37 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> + + + + + + + + + + diff --git a/wrappers/android/mynteye/app/src/main/res/values/strings.xml b/wrappers/android/mynteye/app/src/main/res/values/strings.xml index 4cb552d..e21f2cb 100644 --- a/wrappers/android/mynteye/app/src/main/res/values/strings.xml +++ b/wrappers/android/mynteye/app/src/main/res/values/strings.xml @@ -2,4 +2,12 @@ mynteye Open + Close + + Imu Data + + Device Infos + Image Params + Imu Params + Option Infos diff --git a/wrappers/android/mynteye/build.gradle b/wrappers/android/mynteye/build.gradle index 76a5905..4bf3f28 100644 --- a/wrappers/android/mynteye/build.gradle +++ b/wrappers/android/mynteye/build.gradle @@ -8,7 +8,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.3.0' + classpath 'com.android.tools.build:gradle:3.3.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/addon.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/addon.hpp new file mode 100644 index 0000000..8ce01b5 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/addon.hpp @@ -0,0 +1,28 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include + +namespace mynteye_jni { + +enum class Addon : int { + /** Infrared */ + INFRARED, + /** Second infrared */ + INFRARED2, +}; + +} // namespace mynteye_jni + +namespace std { + +template <> +struct hash<::mynteye_jni::Addon> { + size_t operator()(::mynteye_jni::Addon type) const { + return std::hash()(static_cast(type)); + } +}; + +} // namespace std diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/calibration_model.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/calibration_model.hpp new file mode 100644 index 0000000..4d7dcb7 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/calibration_model.hpp @@ -0,0 +1,30 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include + +namespace mynteye_jni { + +enum class CalibrationModel : int { + /** Pinhole */ + PINHOLE, + /** Equidistant: KANNALA_BRANDT */ + KANNALA_BRANDT, + /** Unknow */ + UNKNOW, +}; + +} // namespace mynteye_jni + +namespace std { + +template <> +struct hash<::mynteye_jni::CalibrationModel> { + size_t operator()(::mynteye_jni::CalibrationModel type) const { + return std::hash()(static_cast(type)); + } +}; + +} // namespace std diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/capability.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/capability.hpp new file mode 100644 index 0000000..4d62601 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/capability.hpp @@ -0,0 +1,42 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include + +namespace mynteye_jni { + +enum class Capability : int { + /** Provides stereo stream */ + STEREO, + /** Provide stereo color stream */ + STEREO_COLOR, + /** Provides color stream */ + COLOR, + /** Provides depth stream */ + DEPTH, + /** Provides point cloud stream */ + POINTS, + /** Provides fisheye stream */ + FISHEYE, + /** Provides infrared stream */ + INFRARED, + /** Provides second infrared stream */ + INFRARED2, + /** Provides IMU (accelerometer, gyroscope) data */ + IMU, +}; + +} // namespace mynteye_jni + +namespace std { + +template <> +struct hash<::mynteye_jni::Capability> { + size_t operator()(::mynteye_jni::Capability type) const { + return std::hash()(static_cast(type)); + } +}; + +} // namespace std diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/device.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/device.hpp index b36fa90..667ec59 100644 --- a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/device.hpp +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/device.hpp @@ -3,14 +3,24 @@ #pragma once +#include "addon.hpp" +#include "capability.hpp" #include "device_usb_info.hpp" +#include "extrinsics.hpp" +#include "info.hpp" +#include "intrinsics.hpp" +#include "model.hpp" #include "motion_data.hpp" +#include "motion_intrinsics.hpp" +#include "option.hpp" +#include "option_info.hpp" #include "source.hpp" #include "stream.hpp" #include "stream_data.hpp" #include "stream_request.hpp" #include #include +#include #include namespace mynteye_jni { @@ -23,12 +33,54 @@ public: /** Create the device instance */ static std::shared_ptr Create(const ::mynteye_jni::DeviceUsbInfo & info); + /** Get the model */ + virtual ::mynteye_jni::Model GetModel() = 0; + + /** Supports the stream or not */ + virtual bool SupportsStream(::mynteye_jni::Stream stream) = 0; + + /** Supports the capability or not */ + virtual bool SupportsCapability(::mynteye_jni::Capability capabilities) = 0; + + /** Supports the option or not */ + virtual bool SupportsOption(::mynteye_jni::Option option) = 0; + + /** Supports the addon or not */ + virtual bool SupportsAddon(::mynteye_jni::Addon addon) = 0; + /** Get all stream requests */ virtual std::vector<::mynteye_jni::StreamRequest> GetStreamRequests() = 0; /** Config the stream request */ virtual void ConfigStreamRequest(const ::mynteye_jni::StreamRequest & request) = 0; + /** Get the device info */ + virtual std::string GetInfo(::mynteye_jni::Info info) = 0; + + /** Get the intrinsics of stream */ + virtual ::mynteye_jni::Intrinsics GetIntrinsics(::mynteye_jni::Stream stream) = 0; + + /** Get the extrinsics of stream */ + virtual ::mynteye_jni::Extrinsics GetExtrinsics(::mynteye_jni::Stream from, ::mynteye_jni::Stream to) = 0; + + /** Get the intrinsics of motion */ + virtual ::mynteye_jni::MotionIntrinsics GetMotionIntrinsics() = 0; + + /** Get the extrinsics from one stream to motion */ + virtual ::mynteye_jni::Extrinsics GetMotionExtrinsics(::mynteye_jni::Stream from) = 0; + + /** Get the option info */ + virtual ::mynteye_jni::OptionInfo GetOptionInfo(::mynteye_jni::Option option) = 0; + + /** Get the option value */ + virtual int32_t GetOptionValue(::mynteye_jni::Option option) = 0; + + /** Set the option value */ + virtual void SetOptionValue(::mynteye_jni::Option option, int32_t value) = 0; + + /** Run the option value */ + virtual bool RunOptionAction(::mynteye_jni::Option option) = 0; + /** Start capturing the source */ virtual void Start(::mynteye_jni::Source source) = 0; diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/extrinsics.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/extrinsics.hpp new file mode 100644 index 0000000..38e4c7f --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/extrinsics.hpp @@ -0,0 +1,25 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include +#include + +namespace mynteye_jni { + +/** Extrinsics, represent how the different datas are connected */ +struct Extrinsics final { + /** Rotation matrix, 3x3 */ + std::vector rotation; + /** Translation vector, 1x3 */ + std::vector translation; + + Extrinsics(std::vector rotation_, + std::vector translation_) + : rotation(std::move(rotation_)) + , translation(std::move(translation_)) + {} +}; + +} // namespace mynteye_jni diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/imu_intrinsics.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/imu_intrinsics.hpp new file mode 100644 index 0000000..eb95676 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/imu_intrinsics.hpp @@ -0,0 +1,38 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include +#include + +namespace mynteye_jni { + +/** IMU intrinsics: scale, drift and variances */ +struct ImuIntrinsics final { + /** + * Scale matrix 3x3 + * Scale X cross axis cross axis + * cross axis Scale Y cross axis + * cross axis cross axis Scale Z + */ + std::vector scale; + /** Zero-drift: X, Y, Z 1x3 */ + std::vector drift; + /** Noise density variances 1x3 */ + std::vector noise; + /** Random walk variances 1x3 */ + std::vector bias; + + ImuIntrinsics(std::vector scale_, + std::vector drift_, + std::vector noise_, + std::vector bias_) + : scale(std::move(scale_)) + , drift(std::move(drift_)) + , noise(std::move(noise_)) + , bias(std::move(bias_)) + {} +}; + +} // namespace mynteye_jni diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/info.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/info.hpp new file mode 100644 index 0000000..d02c921 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/info.hpp @@ -0,0 +1,40 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include + +namespace mynteye_jni { + +enum class Info : int { + /** Device name */ + DEVICE_NAME, + /** Serial number */ + SERIAL_NUMBER, + /** Firmware version */ + FIRMWARE_VERSION, + /** Hardware version */ + HARDWARE_VERSION, + /** Spec version */ + SPEC_VERSION, + /** Lens type */ + LENS_TYPE, + /** IMU type */ + IMU_TYPE, + /** Nominal baseline */ + NOMINAL_BASELINE, +}; + +} // namespace mynteye_jni + +namespace std { + +template <> +struct hash<::mynteye_jni::Info> { + size_t operator()(::mynteye_jni::Info type) const { + return std::hash()(static_cast(type)); + } +}; + +} // namespace std diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/intrinsics.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/intrinsics.hpp new file mode 100644 index 0000000..549a279 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/intrinsics.hpp @@ -0,0 +1,55 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include "calibration_model.hpp" +#include +#include +#include + +namespace mynteye_jni { + +/** Stream intrinsics */ +struct Intrinsics final { + /** The calibration model */ + CalibrationModel calib_model; + /** The width of the image in pixels */ + int32_t width; + /** The height of the image in pixels */ + int32_t height; + /** The focal length of the image plane, as a multiple of pixel width (pinhole) */ + double fx; + /** The focal length of the image plane, as a multiple of pixel height (pinhole) */ + double fy; + /** The horizontal coordinate of the principal point of the image (pinhole) */ + double cx; + /** The vertical coordinate of the principal point of the image (pinhole) */ + double cy; + /** + * The distortion coefficients + * pinhole: k1,k2,p1,p2,k3 + * kannala_brandt: k2,k3,k4,k5,mu,mv,u0,v0 + */ + std::vector coeffs; + + Intrinsics(CalibrationModel calib_model_, + int32_t width_, + int32_t height_, + double fx_, + double fy_, + double cx_, + double cy_, + std::vector coeffs_) + : calib_model(std::move(calib_model_)) + , width(std::move(width_)) + , height(std::move(height_)) + , fx(std::move(fx_)) + , fy(std::move(fy_)) + , cx(std::move(cx_)) + , cy(std::move(cy_)) + , coeffs(std::move(coeffs_)) + {} +}; + +} // namespace mynteye_jni diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/motion_intrinsics.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/motion_intrinsics.hpp new file mode 100644 index 0000000..cd5fbb3 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/motion_intrinsics.hpp @@ -0,0 +1,25 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include "imu_intrinsics.hpp" +#include + +namespace mynteye_jni { + +/** Motion intrinsics, including accelerometer and gyroscope */ +struct MotionIntrinsics final { + /** Accelerometer intrinsics */ + ImuIntrinsics accel; + /** Gyroscope intrinsics */ + ImuIntrinsics gyro; + + MotionIntrinsics(ImuIntrinsics accel_, + ImuIntrinsics gyro_) + : accel(std::move(accel_)) + , gyro(std::move(gyro_)) + {} +}; + +} // namespace mynteye_jni diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/option.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/option.hpp new file mode 100644 index 0000000..6363de9 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/option.hpp @@ -0,0 +1,115 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include + +namespace mynteye_jni { + +enum class Option : int { + /** + * Image gain, valid if manual-exposure + * range: [0,48], default: 24 + */ + GAIN, + /** + * Image brightness, valid if manual-exposure + * range: [0,240], default: 120 + */ + BRIGHTNESS, + /** + * Image contrast, valid if manual-exposure + * range: [0,255], default: 127 + */ + CONTRAST, + /** + * Image frame rate, must set IMU_FREQUENCY together + * values: {10,15,20,25,30,35,40,45,50,55,60}, default: 25 + */ + FRAME_RATE, + /** + * IMU frequency, must set FRAME_RATE together + * values: {100,200,250,333,500}, default: 200 + */ + IMU_FREQUENCY, + /** + * Exposure mode + * 0: enable auto-exposure + * 1: disable auto-exposure (manual-exposure) + */ + EXPOSURE_MODE, + /** + * Max gain, valid if auto-exposure + * range of standard 1: [0,48], default: 48 + * range of standard 2: [0,255], default: 8 + */ + MAX_GAIN, + /** + * Max exposure time, valid if auto-exposure + * range of standard 1: [0,240], default: 240 + * range of standard 2: [0,1000], default: 333 + */ + MAX_EXPOSURE_TIME, + /** + * min exposure time, valid if auto-exposure + * range: [0,1000], default: 0 + */ + MIN_EXPOSURE_TIME, + /** + * Desired brightness, valid if auto-exposure + * range of standard 1: [0,255], default: 192 + * range of standard 2: [1,255], default: 122 + */ + DESIRED_BRIGHTNESS, + /** + * IR control + * range: [0,160], default: 0 + */ + IR_CONTROL, + /** + * HDR mode + * 0: 10-bit + * 1: 12-bit + */ + HDR_MODE, + /** + * The range of accelerometer + * value of standard 1: {4,8,16,32}, default: 8 + * value of standard 2: {6,12,24,48}, default: 12 + */ + ACCELEROMETER_RANGE, + /** + * The range of gyroscope + * value of standard 1: {500,1000,2000,4000}, default: 1000 + * value of standard 2: {250,500,1000,2000,4000}, default: 1000 + */ + GYROSCOPE_RANGE, + /** + * The parameter of accelerometer low pass filter + * values: {0,1,2}, default: 2 + */ + ACCELEROMETER_LOW_PASS_FILTER, + /** + * The parameter of gyroscope low pass filter + * values: {23,64}, default: 64 + */ + GYROSCOPE_LOW_PASS_FILTER, + /** Zero drift calibration */ + ZERO_DRIFT_CALIBRATION, + /** Erase chip */ + ERASE_CHIP, +}; + +} // namespace mynteye_jni + +namespace std { + +template <> +struct hash<::mynteye_jni::Option> { + size_t operator()(::mynteye_jni::Option type) const { + return std::hash()(static_cast(type)); + } +}; + +} // namespace std diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/option_info.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/option_info.hpp new file mode 100644 index 0000000..d8f738d --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/option_info.hpp @@ -0,0 +1,29 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include +#include + +namespace mynteye_jni { + +/** Option info */ +struct OptionInfo final { + /** Minimum value */ + int32_t min; + /** Maximum value */ + int32_t max; + /** Default value */ + int32_t def; + + OptionInfo(int32_t min_, + int32_t max_, + int32_t def_) + : min(std::move(min_)) + , max(std::move(max_)) + , def(std::move(def_)) + {} +}; + +} // namespace mynteye_jni diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.cpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.cpp index a5e4ee0..d0c4150 100644 --- a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.cpp +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.cpp @@ -70,6 +70,26 @@ DeviceImpl::~DeviceImpl() { VLOG(2) << __func__; } +::mynteye_jni::Model DeviceImpl::GetModel() { + return to_jni(device_->GetModel()); +} + +bool DeviceImpl::SupportsStream(::mynteye_jni::Stream stream) { + return device_->Supports(from_jni(stream)); +} + +bool DeviceImpl::SupportsCapability(::mynteye_jni::Capability capabilities) { + return device_->Supports(from_jni(capabilities)); +} + +bool DeviceImpl::SupportsOption(::mynteye_jni::Option option) { + return device_->Supports(from_jni(option)); +} + +bool DeviceImpl::SupportsAddon(::mynteye_jni::Addon addon) { + return device_->Supports(from_jni(addon)); +} + std::vector<::mynteye_jni::StreamRequest> DeviceImpl::GetStreamRequests() { VLOG(2) << __func__; std::vector<::mynteye_jni::StreamRequest> requests; @@ -97,6 +117,68 @@ void DeviceImpl::ConfigStreamRequest( } } +std::string DeviceImpl::GetInfo(::mynteye_jni::Info info) { + return device_->GetInfo(from_jni(info)); +} + +::mynteye_jni::Intrinsics DeviceImpl::GetIntrinsics( + ::mynteye_jni::Stream stream) { + auto in = device_->GetIntrinsics(from_jni(stream)); + if (in->calib_model() == MYNTEYE_NAMESPACE::CalibrationModel::PINHOLE) { + auto in_p = std::dynamic_pointer_cast(in); + return {CalibrationModel::PINHOLE, in_p->width, in_p->height, + in_p->fx, in_p->fy, in_p->cx, in_p->cy, + to_vector<5>(in_p->coeffs)}; + } else if (in->calib_model() == MYNTEYE_NAMESPACE::CalibrationModel::KANNALA_BRANDT) { + auto in_k = std::dynamic_pointer_cast(in); + return {CalibrationModel::KANNALA_BRANDT, in_k->width, in_k->height, + 0, 0, 0, 0, to_vector<8>(in_k->coeffs)}; + } else { + LOG(WARNING) << "Unknown calibration model"; + return {CalibrationModel::UNKNOW, 0, 0, 0, 0, 0, 0, {}}; + } +} + +::mynteye_jni::Extrinsics DeviceImpl::GetExtrinsics( + ::mynteye_jni::Stream from, ::mynteye_jni::Stream to) { + auto ex = device_->GetExtrinsics(from_jni(from), from_jni(to)); + return {to_vector<3, 3>(ex.rotation), to_vector<3>(ex.translation)}; +} + +::mynteye_jni::MotionIntrinsics DeviceImpl::GetMotionIntrinsics() { + auto in = device_->GetMotionIntrinsics(); + auto in_to_jni = [](MYNTEYE_NAMESPACE::ImuIntrinsics& in) { + return ImuIntrinsics{ + to_vector<3, 3>(in.scale), to_vector<3>(in.drift), + to_vector<3>(in.noise), to_vector<3>(in.bias) + }; + }; + return {in_to_jni(in.accel), in_to_jni(in.gyro)}; +} + +::mynteye_jni::Extrinsics DeviceImpl::GetMotionExtrinsics( + ::mynteye_jni::Stream from) { + auto ex = device_->GetMotionExtrinsics(from_jni(from)); + return {to_vector<3, 3>(ex.rotation), to_vector<3>(ex.translation)}; +} + +::mynteye_jni::OptionInfo DeviceImpl::GetOptionInfo(::mynteye_jni::Option option) { + auto info = device_->GetOptionInfo(from_jni(option)); + return {info.min, info.max, info.def}; +} + +int32_t DeviceImpl::GetOptionValue(::mynteye_jni::Option option) { + return device_->GetOptionValue(from_jni(option)); +} + +void DeviceImpl::SetOptionValue(::mynteye_jni::Option option, int32_t value) { + return device_->SetOptionValue(from_jni(option), value); +} + +bool DeviceImpl::RunOptionAction(::mynteye_jni::Option option) { + return device_->RunOptionAction(from_jni(option)); +} + void DeviceImpl::Start(::mynteye_jni::Source source) { device_->Start(from_jni(source)); } diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.hpp index 3068633..4526eb6 100644 --- a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.hpp +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.hpp @@ -16,12 +16,54 @@ class DeviceImpl : public Device { explicit DeviceImpl(const device_t & device); ~DeviceImpl(); + /** Get the model */ + ::mynteye_jni::Model GetModel() override; + + /** Supports the stream or not */ + bool SupportsStream(::mynteye_jni::Stream stream) override; + + /** Supports the capability or not */ + bool SupportsCapability(::mynteye_jni::Capability capabilities) override; + + /** Supports the option or not */ + bool SupportsOption(::mynteye_jni::Option option) override; + + /** Supports the addon or not */ + bool SupportsAddon(::mynteye_jni::Addon addon) override; + /** Get all stream requests */ std::vector<::mynteye_jni::StreamRequest> GetStreamRequests() override; /** Config the stream request */ void ConfigStreamRequest(const ::mynteye_jni::StreamRequest & request) override; + /** Get the device info */ + std::string GetInfo(::mynteye_jni::Info info) override; + + /** Get the intrinsics of stream */ + ::mynteye_jni::Intrinsics GetIntrinsics(::mynteye_jni::Stream stream) override; + + /** Get the extrinsics of stream */ + ::mynteye_jni::Extrinsics GetExtrinsics(::mynteye_jni::Stream from, ::mynteye_jni::Stream to) override; + + /** Get the intrinsics of motion */ + ::mynteye_jni::MotionIntrinsics GetMotionIntrinsics() override; + + /** Get the extrinsics from one stream to motion */ + ::mynteye_jni::Extrinsics GetMotionExtrinsics(::mynteye_jni::Stream from) override; + + /** Get the option info */ + ::mynteye_jni::OptionInfo GetOptionInfo(::mynteye_jni::Option option) override; + + /** Get the option value */ + int32_t GetOptionValue(::mynteye_jni::Option option) override; + + /** Set the option value */ + void SetOptionValue(::mynteye_jni::Option option, int32_t value) override; + + /** Run the option value */ + bool RunOptionAction(::mynteye_jni::Option option) override; + /** Start capturing the source */ void Start(::mynteye_jni::Source source) override; @@ -37,7 +79,7 @@ class DeviceImpl : public Device { /** Get the datas of stream */ std::vector> GetStreamDatas(::mynteye_jni::Stream stream) override; - /** Enable cache motion datas until get them, otherwise using callback instead */ + /** Enable cache motion datas until get them, otherwise using callback instead */ void EnableMotionDatas(int32_t max_size) override; /** Get the motion datas */ diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/type_conversion.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/type_conversion.hpp index b68c6b7..16ff6a9 100644 --- a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/type_conversion.hpp +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/type_conversion.hpp @@ -5,9 +5,14 @@ #include "mynteye/logger.h" #include "mynteye/types.h" +#include "addon.hpp" +#include "calibration_model.hpp" +#include "capability.hpp" #include "device_usb_info.hpp" #include "format.hpp" +#include "info.hpp" #include "model.hpp" +#include "option.hpp" #include "source.hpp" #include "stream.hpp" @@ -15,105 +20,7 @@ namespace mynteye_jni { -using RawModel = MYNTEYE_NAMESPACE::Model; -using JniModel = mynteye_jni::Model; - -inline -RawModel from_jni(const JniModel& model) { - switch (model) { - case JniModel::STANDARD: return RawModel::STANDARD; - case JniModel::STANDARD2: return RawModel::STANDARD2; - case JniModel::STANDARD210A: return RawModel::STANDARD210A; - default: - LOG(FATAL) << "Model is unknown"; - } -} - -inline -JniModel to_jni(const RawModel& model) { - switch (model) { - case RawModel::STANDARD: return JniModel::STANDARD; - case RawModel::STANDARD2: return JniModel::STANDARD2; - case RawModel::STANDARD210A: return JniModel::STANDARD210A; - default: - LOG(FATAL) << "Model is unknown"; - } -} - -using RawFormat = MYNTEYE_NAMESPACE::Format; -using JniFormat = mynteye_jni::Format; - -inline -RawFormat from_jni(const JniFormat& format) { - switch (format) { - case JniFormat::GREY: return RawFormat::GREY; - case JniFormat::YUYV: return RawFormat::YUYV; - case JniFormat::BGR888: return RawFormat::BGR888; - case JniFormat::RGB888: return RawFormat::RGB888; - default: - LOG(FATAL) << "Format is unknown"; - } -} - -inline -JniFormat to_jni(const RawFormat& format) { - switch (format) { - case RawFormat::GREY: return JniFormat::GREY; - case RawFormat::YUYV: return JniFormat::YUYV; - case RawFormat::BGR888: return JniFormat::BGR888; - case RawFormat::RGB888: return JniFormat::RGB888; - default: - LOG(FATAL) << "Format is unknown"; - } -} - -using RawSource = MYNTEYE_NAMESPACE::Source; -using JniSource = mynteye_jni::Source; - -inline -RawSource from_jni(const JniSource& source) { - switch (source) { - case JniSource::VIDEO_STREAMING: return RawSource::VIDEO_STREAMING; - case JniSource::MOTION_TRACKING: return RawSource::MOTION_TRACKING; - case JniSource::ALL: return RawSource::ALL; - default: - LOG(FATAL) << "Source is unknown"; - } -} - -inline -JniSource to_jni(const RawSource& source) { - switch (source) { - case RawSource::VIDEO_STREAMING: return JniSource::VIDEO_STREAMING; - case RawSource::MOTION_TRACKING: return JniSource::MOTION_TRACKING; - case RawSource::ALL: return JniSource::ALL; - default: - LOG(FATAL) << "Source is unknown"; - } -} - -using RawStream = MYNTEYE_NAMESPACE::Stream; -using JniStream = mynteye_jni::Stream; - -inline -RawStream from_jni(const JniStream& stream) { - switch (stream) { - case JniStream::LEFT: return RawStream::LEFT; - case JniStream::RIGHT: return RawStream::RIGHT; - default: - LOG(FATAL) << "Stream is unknown"; - } -} - -inline -JniStream to_jni(const RawStream& stream) { - switch (stream) { - case RawStream::LEFT: return JniStream::LEFT; - case RawStream::RIGHT: return JniStream::RIGHT; - default: - LOG(FATAL) << "Stream is unknown"; - } -} +// device_usb_info using RawUsbInfo = MYNTEYE_NAMESPACE::UsbInfo; using JniUsbInfo = mynteye_jni::DeviceUsbInfo; @@ -146,4 +53,361 @@ JniUsbInfo to_jni(const RawUsbInfo& info) { }; } +// model + +using RawModel = MYNTEYE_NAMESPACE::Model; +using JniModel = mynteye_jni::Model; + +inline +RawModel from_jni(const JniModel& model) { + switch (model) { + case JniModel::STANDARD: return RawModel::STANDARD; + case JniModel::STANDARD2: return RawModel::STANDARD2; + case JniModel::STANDARD210A: return RawModel::STANDARD210A; + default: + LOG(FATAL) << "Model is unknown"; + } +} + +inline +JniModel to_jni(const RawModel& model) { + switch (model) { + case RawModel::STANDARD: return JniModel::STANDARD; + case RawModel::STANDARD2: return JniModel::STANDARD2; + case RawModel::STANDARD210A: return JniModel::STANDARD210A; + default: + LOG(FATAL) << "Model is unknown"; + } +} + +// format + +using RawFormat = MYNTEYE_NAMESPACE::Format; +using JniFormat = mynteye_jni::Format; + +inline +RawFormat from_jni(const JniFormat& format) { + switch (format) { + case JniFormat::GREY: return RawFormat::GREY; + case JniFormat::YUYV: return RawFormat::YUYV; + case JniFormat::BGR888: return RawFormat::BGR888; + case JniFormat::RGB888: return RawFormat::RGB888; + default: + LOG(FATAL) << "Format is unknown"; + } +} + +inline +JniFormat to_jni(const RawFormat& format) { + switch (format) { + case RawFormat::GREY: return JniFormat::GREY; + case RawFormat::YUYV: return JniFormat::YUYV; + case RawFormat::BGR888: return JniFormat::BGR888; + case RawFormat::RGB888: return JniFormat::RGB888; + default: + LOG(FATAL) << "Format is unknown"; + } +} + +// source + +using RawSource = MYNTEYE_NAMESPACE::Source; +using JniSource = mynteye_jni::Source; + +inline +RawSource from_jni(const JniSource& source) { + switch (source) { + case JniSource::VIDEO_STREAMING: return RawSource::VIDEO_STREAMING; + case JniSource::MOTION_TRACKING: return RawSource::MOTION_TRACKING; + case JniSource::ALL: return RawSource::ALL; + default: + LOG(FATAL) << "Source is unknown"; + } +} + +inline +JniSource to_jni(const RawSource& source) { + switch (source) { + case RawSource::VIDEO_STREAMING: return JniSource::VIDEO_STREAMING; + case RawSource::MOTION_TRACKING: return JniSource::MOTION_TRACKING; + case RawSource::ALL: return JniSource::ALL; + default: + LOG(FATAL) << "Source is unknown"; + } +} + +// stream + +using RawStream = MYNTEYE_NAMESPACE::Stream; +using JniStream = mynteye_jni::Stream; + +inline +RawStream from_jni(const JniStream& stream) { + switch (stream) { + case JniStream::LEFT: return RawStream::LEFT; + case JniStream::RIGHT: return RawStream::RIGHT; + default: + LOG(FATAL) << "Stream is unknown"; + } +} + +inline +JniStream to_jni(const RawStream& stream) { + switch (stream) { + case RawStream::LEFT: return JniStream::LEFT; + case RawStream::RIGHT: return JniStream::RIGHT; + default: + LOG(FATAL) << "Stream is unknown"; + } +} + +// capability + +using RawCapability = MYNTEYE_NAMESPACE::Capabilities; +using JniCapability = mynteye_jni::Capability; + +inline +RawCapability from_jni(const JniCapability& Capability) { + switch (Capability) { + case JniCapability::STEREO: return RawCapability::STEREO; + case JniCapability::STEREO_COLOR: return RawCapability::STEREO_COLOR; + case JniCapability::COLOR: return RawCapability::COLOR; + case JniCapability::DEPTH: return RawCapability::DEPTH; + case JniCapability::POINTS: return RawCapability::POINTS; + case JniCapability::FISHEYE: return RawCapability::FISHEYE; + case JniCapability::INFRARED: return RawCapability::INFRARED; + case JniCapability::INFRARED2: return RawCapability::INFRARED2; + case JniCapability::IMU: return RawCapability::IMU; + default: + LOG(FATAL) << "Capability is unknown"; + } +} + +inline +JniCapability to_jni(const RawCapability& Capability) { + switch (Capability) { + case RawCapability::STEREO: return JniCapability::STEREO; + case RawCapability::STEREO_COLOR: return JniCapability::STEREO_COLOR; + case RawCapability::COLOR: return JniCapability::COLOR; + case RawCapability::DEPTH: return JniCapability::DEPTH; + case RawCapability::POINTS: return JniCapability::POINTS; + case RawCapability::FISHEYE: return JniCapability::FISHEYE; + case RawCapability::INFRARED: return JniCapability::INFRARED; + case RawCapability::INFRARED2: return JniCapability::INFRARED2; + case RawCapability::IMU: return JniCapability::IMU; + default: + LOG(FATAL) << "Capability is unknown"; + } +} + +// info + +using RawInfo = MYNTEYE_NAMESPACE::Info; +using JniInfo = mynteye_jni::Info; + +inline +RawInfo from_jni(const JniInfo& Info) { + switch (Info) { + case JniInfo::DEVICE_NAME: return RawInfo::DEVICE_NAME; + case JniInfo::SERIAL_NUMBER: return RawInfo::SERIAL_NUMBER; + case JniInfo::FIRMWARE_VERSION: return RawInfo::FIRMWARE_VERSION; + case JniInfo::HARDWARE_VERSION: return RawInfo::HARDWARE_VERSION; + case JniInfo::SPEC_VERSION: return RawInfo::SPEC_VERSION; + case JniInfo::LENS_TYPE: return RawInfo::LENS_TYPE; + case JniInfo::IMU_TYPE: return RawInfo::IMU_TYPE; + case JniInfo::NOMINAL_BASELINE: return RawInfo::NOMINAL_BASELINE; + default: + LOG(FATAL) << "Info is unknown"; + } +} + +inline +JniInfo to_jni(const RawInfo& Info) { + switch (Info) { + case RawInfo::DEVICE_NAME: return JniInfo::DEVICE_NAME; + case RawInfo::SERIAL_NUMBER: return JniInfo::SERIAL_NUMBER; + case RawInfo::FIRMWARE_VERSION: return JniInfo::FIRMWARE_VERSION; + case RawInfo::HARDWARE_VERSION: return JniInfo::HARDWARE_VERSION; + case RawInfo::SPEC_VERSION: return JniInfo::SPEC_VERSION; + case RawInfo::LENS_TYPE: return JniInfo::LENS_TYPE; + case RawInfo::IMU_TYPE: return JniInfo::IMU_TYPE; + case RawInfo::NOMINAL_BASELINE: return JniInfo::NOMINAL_BASELINE; + default: + LOG(FATAL) << "Info is unknown"; + } +} + +// option + +using RawOption = MYNTEYE_NAMESPACE::Option; +using JniOption = mynteye_jni::Option; + +inline +RawOption from_jni(const JniOption& Option) { + switch (Option) { + case JniOption::GAIN: + return RawOption::GAIN; + case JniOption::BRIGHTNESS: + return RawOption::BRIGHTNESS; + case JniOption::CONTRAST: + return RawOption::CONTRAST; + case JniOption::FRAME_RATE: + return RawOption::FRAME_RATE; + case JniOption::IMU_FREQUENCY: + return RawOption::IMU_FREQUENCY; + case JniOption::EXPOSURE_MODE: + return RawOption::EXPOSURE_MODE; + case JniOption::MAX_GAIN: + return RawOption::MAX_GAIN; + case JniOption::MAX_EXPOSURE_TIME: + return RawOption::MAX_EXPOSURE_TIME; + case JniOption::MIN_EXPOSURE_TIME: + return RawOption::MIN_EXPOSURE_TIME; + case JniOption::DESIRED_BRIGHTNESS: + return RawOption::DESIRED_BRIGHTNESS; + case JniOption::IR_CONTROL: + return RawOption::IR_CONTROL; + case JniOption::HDR_MODE: + return RawOption::HDR_MODE; + case JniOption::ACCELEROMETER_RANGE: + return RawOption::ACCELEROMETER_RANGE; + case JniOption::GYROSCOPE_RANGE: + return RawOption::GYROSCOPE_RANGE; + case JniOption::ACCELEROMETER_LOW_PASS_FILTER: + return RawOption::ACCELEROMETER_LOW_PASS_FILTER; + case JniOption::GYROSCOPE_LOW_PASS_FILTER: + return RawOption::GYROSCOPE_LOW_PASS_FILTER; + case JniOption::ZERO_DRIFT_CALIBRATION: + return RawOption::ZERO_DRIFT_CALIBRATION; + case JniOption::ERASE_CHIP: + return RawOption::ERASE_CHIP; + default: + LOG(FATAL) << "Option is unknown"; + } +} + +inline +JniOption to_jni(const RawOption& Option) { + switch (Option) { + case RawOption::GAIN: + return JniOption::GAIN; + case RawOption::BRIGHTNESS: + return JniOption::BRIGHTNESS; + case RawOption::CONTRAST: + return JniOption::CONTRAST; + case RawOption::FRAME_RATE: + return JniOption::FRAME_RATE; + case RawOption::IMU_FREQUENCY: + return JniOption::IMU_FREQUENCY; + case RawOption::EXPOSURE_MODE: + return JniOption::EXPOSURE_MODE; + case RawOption::MAX_GAIN: + return JniOption::MAX_GAIN; + case RawOption::MAX_EXPOSURE_TIME: + return JniOption::MAX_EXPOSURE_TIME; + case RawOption::MIN_EXPOSURE_TIME: + return JniOption::MIN_EXPOSURE_TIME; + case RawOption::DESIRED_BRIGHTNESS: + return JniOption::DESIRED_BRIGHTNESS; + case RawOption::IR_CONTROL: + return JniOption::IR_CONTROL; + case RawOption::HDR_MODE: + return JniOption::HDR_MODE; + case RawOption::ACCELEROMETER_RANGE: + return JniOption::ACCELEROMETER_RANGE; + case RawOption::GYROSCOPE_RANGE: + return JniOption::GYROSCOPE_RANGE; + case RawOption::ACCELEROMETER_LOW_PASS_FILTER: + return JniOption::ACCELEROMETER_LOW_PASS_FILTER; + case RawOption::GYROSCOPE_LOW_PASS_FILTER: + return JniOption::GYROSCOPE_LOW_PASS_FILTER; + case RawOption::ZERO_DRIFT_CALIBRATION: + return JniOption::ZERO_DRIFT_CALIBRATION; + case RawOption::ERASE_CHIP: + return JniOption::ERASE_CHIP; + default: + LOG(FATAL) << "Option is unknown"; + } +} + +// addon + +using RawAddon = MYNTEYE_NAMESPACE::AddOns; +using JniAddon = mynteye_jni::Addon; + +inline +RawAddon from_jni(const JniAddon& Addon) { + switch (Addon) { + case JniAddon::INFRARED: return RawAddon::INFRARED; + case JniAddon::INFRARED2: return RawAddon::INFRARED2; + default: + LOG(FATAL) << "Addon is unknown"; + } +} + +inline +JniAddon to_jni(const RawAddon& Addon) { + switch (Addon) { + case RawAddon::INFRARED: return JniAddon::INFRARED; + case RawAddon::INFRARED2: return JniAddon::INFRARED2; + default: + LOG(FATAL) << "Addon is unknown"; + } +} + +// calibration_model + +using RawCalibrationModel = MYNTEYE_NAMESPACE::CalibrationModel; +using JniCalibrationModel = mynteye_jni::CalibrationModel; + +inline +RawCalibrationModel from_jni(const JniCalibrationModel& CalibrationModel) { + switch (CalibrationModel) { + case JniCalibrationModel::PINHOLE: + return RawCalibrationModel::PINHOLE; + case JniCalibrationModel::KANNALA_BRANDT: + return RawCalibrationModel::KANNALA_BRANDT; + case JniCalibrationModel::UNKNOW: + return RawCalibrationModel::UNKNOW; + default: + LOG(FATAL) << "CalibrationModel is unknown"; + } +} + +inline +JniCalibrationModel to_jni(const RawCalibrationModel& CalibrationModel) { + switch (CalibrationModel) { + case RawCalibrationModel::PINHOLE: + return JniCalibrationModel::PINHOLE; + case RawCalibrationModel::KANNALA_BRANDT: + return JniCalibrationModel::KANNALA_BRANDT; + case RawCalibrationModel::UNKNOW: + return JniCalibrationModel::UNKNOW; + default: + LOG(FATAL) << "CalibrationModel is unknown"; + } +} + +// others + +template +std::vector to_vector(double (&vector)[n]) { + std::vector datas; + for (int i = 0; i < n; i++) { + datas.push_back(vector[i]); + } + return datas; +} + +template +std::vector to_vector(double (&matrix)[rows][cols]) { + std::vector datas; + for (int i = 0; i < rows; i++) { + for (int j = 0; j < cols; j++) { + datas.push_back(matrix[i][j]); + } + } + return datas; +} + } // namespace mynteye_jni diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeAddon.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeAddon.hpp new file mode 100644 index 0000000..d235748 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeAddon.hpp @@ -0,0 +1,26 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include "addon.hpp" +#include "djinni_support.hpp" + +namespace djinni_generated { + +class NativeAddon final : ::djinni::JniEnum { +public: + using CppType = ::mynteye_jni::Addon; + using JniType = jobject; + + using Boxed = NativeAddon; + + static CppType toCpp(JNIEnv* jniEnv, JniType j) { return static_cast(::djinni::JniClass::get().ordinal(jniEnv, j)); } + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass::get().create(jniEnv, static_cast(c)); } + +private: + NativeAddon() : JniEnum("com/slightech/mynteye/Addon") {} + friend ::djinni::JniClass; +}; + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeCalibrationModel.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeCalibrationModel.hpp new file mode 100644 index 0000000..f474c13 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeCalibrationModel.hpp @@ -0,0 +1,26 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include "calibration_model.hpp" +#include "djinni_support.hpp" + +namespace djinni_generated { + +class NativeCalibrationModel final : ::djinni::JniEnum { +public: + using CppType = ::mynteye_jni::CalibrationModel; + using JniType = jobject; + + using Boxed = NativeCalibrationModel; + + static CppType toCpp(JNIEnv* jniEnv, JniType j) { return static_cast(::djinni::JniClass::get().ordinal(jniEnv, j)); } + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass::get().create(jniEnv, static_cast(c)); } + +private: + NativeCalibrationModel() : JniEnum("com/slightech/mynteye/CalibrationModel") {} + friend ::djinni::JniClass; +}; + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeCapability.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeCapability.hpp new file mode 100644 index 0000000..c827013 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeCapability.hpp @@ -0,0 +1,26 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include "capability.hpp" +#include "djinni_support.hpp" + +namespace djinni_generated { + +class NativeCapability final : ::djinni::JniEnum { +public: + using CppType = ::mynteye_jni::Capability; + using JniType = jobject; + + using Boxed = NativeCapability; + + static CppType toCpp(JNIEnv* jniEnv, JniType j) { return static_cast(::djinni::JniClass::get().ordinal(jniEnv, j)); } + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass::get().create(jniEnv, static_cast(c)); } + +private: + NativeCapability() : JniEnum("com/slightech/mynteye/Capability") {} + friend ::djinni::JniClass; +}; + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDevice.cpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDevice.cpp index 178c70f..5416fe6 100644 --- a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDevice.cpp +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDevice.cpp @@ -3,8 +3,17 @@ #include "NativeDevice.hpp" // my header #include "Marshal.hpp" +#include "NativeAddon.hpp" +#include "NativeCapability.hpp" #include "NativeDeviceUsbInfo.hpp" +#include "NativeExtrinsics.hpp" +#include "NativeInfo.hpp" +#include "NativeIntrinsics.hpp" +#include "NativeModel.hpp" #include "NativeMotionData.hpp" +#include "NativeMotionIntrinsics.hpp" +#include "NativeOption.hpp" +#include "NativeOptionInfo.hpp" #include "NativeSource.hpp" #include "NativeStream.hpp" #include "NativeStreamData.hpp" @@ -34,6 +43,56 @@ CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_creat } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) } +CJNIEXPORT ::djinni_generated::NativeModel::JniType JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1getModel(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + auto r = ref->GetModel(); + return ::djinni::release(::djinni_generated::NativeModel::fromCpp(jniEnv, r)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) +} + +CJNIEXPORT jboolean JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1supportsStream(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeStream::JniType j_stream) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + auto r = ref->SupportsStream(::djinni_generated::NativeStream::toCpp(jniEnv, j_stream)); + return ::djinni::release(::djinni::Bool::fromCpp(jniEnv, r)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) +} + +CJNIEXPORT jboolean JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1supportsCapability(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeCapability::JniType j_capabilities) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + auto r = ref->SupportsCapability(::djinni_generated::NativeCapability::toCpp(jniEnv, j_capabilities)); + return ::djinni::release(::djinni::Bool::fromCpp(jniEnv, r)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) +} + +CJNIEXPORT jboolean JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1supportsOption(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeOption::JniType j_option) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + auto r = ref->SupportsOption(::djinni_generated::NativeOption::toCpp(jniEnv, j_option)); + return ::djinni::release(::djinni::Bool::fromCpp(jniEnv, r)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) +} + +CJNIEXPORT jboolean JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1supportsAddon(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeAddon::JniType j_addon) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + auto r = ref->SupportsAddon(::djinni_generated::NativeAddon::toCpp(jniEnv, j_addon)); + return ::djinni::release(::djinni::Bool::fromCpp(jniEnv, r)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) +} + CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1getStreamRequests(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef) { try { @@ -53,6 +112,97 @@ CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1 } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) } +CJNIEXPORT jstring JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1getInfo(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeInfo::JniType j_info) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + auto r = ref->GetInfo(::djinni_generated::NativeInfo::toCpp(jniEnv, j_info)); + return ::djinni::release(::djinni::String::fromCpp(jniEnv, r)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) +} + +CJNIEXPORT ::djinni_generated::NativeIntrinsics::JniType JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1getIntrinsics(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeStream::JniType j_stream) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + auto r = ref->GetIntrinsics(::djinni_generated::NativeStream::toCpp(jniEnv, j_stream)); + return ::djinni::release(::djinni_generated::NativeIntrinsics::fromCpp(jniEnv, r)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) +} + +CJNIEXPORT ::djinni_generated::NativeExtrinsics::JniType JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1getExtrinsics(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeStream::JniType j_from, ::djinni_generated::NativeStream::JniType j_to) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + auto r = ref->GetExtrinsics(::djinni_generated::NativeStream::toCpp(jniEnv, j_from), + ::djinni_generated::NativeStream::toCpp(jniEnv, j_to)); + return ::djinni::release(::djinni_generated::NativeExtrinsics::fromCpp(jniEnv, r)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) +} + +CJNIEXPORT ::djinni_generated::NativeMotionIntrinsics::JniType JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1getMotionIntrinsics(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + auto r = ref->GetMotionIntrinsics(); + return ::djinni::release(::djinni_generated::NativeMotionIntrinsics::fromCpp(jniEnv, r)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) +} + +CJNIEXPORT ::djinni_generated::NativeExtrinsics::JniType JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1getMotionExtrinsics(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeStream::JniType j_from) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + auto r = ref->GetMotionExtrinsics(::djinni_generated::NativeStream::toCpp(jniEnv, j_from)); + return ::djinni::release(::djinni_generated::NativeExtrinsics::fromCpp(jniEnv, r)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) +} + +CJNIEXPORT ::djinni_generated::NativeOptionInfo::JniType JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1getOptionInfo(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeOption::JniType j_option) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + auto r = ref->GetOptionInfo(::djinni_generated::NativeOption::toCpp(jniEnv, j_option)); + return ::djinni::release(::djinni_generated::NativeOptionInfo::fromCpp(jniEnv, r)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) +} + +CJNIEXPORT jint JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1getOptionValue(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeOption::JniType j_option) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + auto r = ref->GetOptionValue(::djinni_generated::NativeOption::toCpp(jniEnv, j_option)); + return ::djinni::release(::djinni::I32::fromCpp(jniEnv, r)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) +} + +CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1setOptionValue(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeOption::JniType j_option, jint j_value) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + ref->SetOptionValue(::djinni_generated::NativeOption::toCpp(jniEnv, j_option), + ::djinni::I32::toCpp(jniEnv, j_value)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) +} + +CJNIEXPORT jboolean JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1runOptionAction(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeOption::JniType j_option) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + auto r = ref->RunOptionAction(::djinni_generated::NativeOption::toCpp(jniEnv, j_option)); + return ::djinni::release(::djinni::Bool::fromCpp(jniEnv, r)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) +} + CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1start(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeSource::JniType j_source) { try { diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeExtrinsics.cpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeExtrinsics.cpp new file mode 100644 index 0000000..1e979a1 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeExtrinsics.cpp @@ -0,0 +1,30 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#include "NativeExtrinsics.hpp" // my header +#include "Marshal.hpp" + +namespace djinni_generated { + +NativeExtrinsics::NativeExtrinsics() = default; + +NativeExtrinsics::~NativeExtrinsics() = default; + +auto NativeExtrinsics::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef { + const auto& data = ::djinni::JniClass::get(); + auto r = ::djinni::LocalRef{jniEnv->NewObject(data.clazz.get(), data.jconstructor, + ::djinni::get(::djinni::List<::djinni::F64>::fromCpp(jniEnv, c.rotation)), + ::djinni::get(::djinni::List<::djinni::F64>::fromCpp(jniEnv, c.translation)))}; + ::djinni::jniExceptionCheck(jniEnv); + return r; +} + +auto NativeExtrinsics::toCpp(JNIEnv* jniEnv, JniType j) -> CppType { + ::djinni::JniLocalScope jscope(jniEnv, 3); + assert(j != nullptr); + const auto& data = ::djinni::JniClass::get(); + return {::djinni::List<::djinni::F64>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mRotation)), + ::djinni::List<::djinni::F64>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mTranslation))}; +} + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeExtrinsics.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeExtrinsics.hpp new file mode 100644 index 0000000..0a1a047 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeExtrinsics.hpp @@ -0,0 +1,33 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include "djinni_support.hpp" +#include "extrinsics.hpp" + +namespace djinni_generated { + +class NativeExtrinsics final { +public: + using CppType = ::mynteye_jni::Extrinsics; + using JniType = jobject; + + using Boxed = NativeExtrinsics; + + ~NativeExtrinsics(); + + static CppType toCpp(JNIEnv* jniEnv, JniType j); + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, const CppType& c); + +private: + NativeExtrinsics(); + friend ::djinni::JniClass; + + const ::djinni::GlobalRef clazz { ::djinni::jniFindClass("com/slightech/mynteye/Extrinsics") }; + const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "", "(Ljava/util/ArrayList;Ljava/util/ArrayList;)V") }; + const jfieldID field_mRotation { ::djinni::jniGetFieldID(clazz.get(), "mRotation", "Ljava/util/ArrayList;") }; + const jfieldID field_mTranslation { ::djinni::jniGetFieldID(clazz.get(), "mTranslation", "Ljava/util/ArrayList;") }; +}; + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeImuIntrinsics.cpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeImuIntrinsics.cpp new file mode 100644 index 0000000..9c449ca --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeImuIntrinsics.cpp @@ -0,0 +1,34 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#include "NativeImuIntrinsics.hpp" // my header +#include "Marshal.hpp" + +namespace djinni_generated { + +NativeImuIntrinsics::NativeImuIntrinsics() = default; + +NativeImuIntrinsics::~NativeImuIntrinsics() = default; + +auto NativeImuIntrinsics::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef { + const auto& data = ::djinni::JniClass::get(); + auto r = ::djinni::LocalRef{jniEnv->NewObject(data.clazz.get(), data.jconstructor, + ::djinni::get(::djinni::List<::djinni::F64>::fromCpp(jniEnv, c.scale)), + ::djinni::get(::djinni::List<::djinni::F64>::fromCpp(jniEnv, c.drift)), + ::djinni::get(::djinni::List<::djinni::F64>::fromCpp(jniEnv, c.noise)), + ::djinni::get(::djinni::List<::djinni::F64>::fromCpp(jniEnv, c.bias)))}; + ::djinni::jniExceptionCheck(jniEnv); + return r; +} + +auto NativeImuIntrinsics::toCpp(JNIEnv* jniEnv, JniType j) -> CppType { + ::djinni::JniLocalScope jscope(jniEnv, 5); + assert(j != nullptr); + const auto& data = ::djinni::JniClass::get(); + return {::djinni::List<::djinni::F64>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mScale)), + ::djinni::List<::djinni::F64>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mDrift)), + ::djinni::List<::djinni::F64>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mNoise)), + ::djinni::List<::djinni::F64>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mBias))}; +} + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeImuIntrinsics.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeImuIntrinsics.hpp new file mode 100644 index 0000000..f12e35e --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeImuIntrinsics.hpp @@ -0,0 +1,35 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include "djinni_support.hpp" +#include "imu_intrinsics.hpp" + +namespace djinni_generated { + +class NativeImuIntrinsics final { +public: + using CppType = ::mynteye_jni::ImuIntrinsics; + using JniType = jobject; + + using Boxed = NativeImuIntrinsics; + + ~NativeImuIntrinsics(); + + static CppType toCpp(JNIEnv* jniEnv, JniType j); + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, const CppType& c); + +private: + NativeImuIntrinsics(); + friend ::djinni::JniClass; + + const ::djinni::GlobalRef clazz { ::djinni::jniFindClass("com/slightech/mynteye/ImuIntrinsics") }; + const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "", "(Ljava/util/ArrayList;Ljava/util/ArrayList;Ljava/util/ArrayList;Ljava/util/ArrayList;)V") }; + const jfieldID field_mScale { ::djinni::jniGetFieldID(clazz.get(), "mScale", "Ljava/util/ArrayList;") }; + const jfieldID field_mDrift { ::djinni::jniGetFieldID(clazz.get(), "mDrift", "Ljava/util/ArrayList;") }; + const jfieldID field_mNoise { ::djinni::jniGetFieldID(clazz.get(), "mNoise", "Ljava/util/ArrayList;") }; + const jfieldID field_mBias { ::djinni::jniGetFieldID(clazz.get(), "mBias", "Ljava/util/ArrayList;") }; +}; + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeInfo.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeInfo.hpp new file mode 100644 index 0000000..8b0e716 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeInfo.hpp @@ -0,0 +1,26 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include "djinni_support.hpp" +#include "info.hpp" + +namespace djinni_generated { + +class NativeInfo final : ::djinni::JniEnum { +public: + using CppType = ::mynteye_jni::Info; + using JniType = jobject; + + using Boxed = NativeInfo; + + static CppType toCpp(JNIEnv* jniEnv, JniType j) { return static_cast(::djinni::JniClass::get().ordinal(jniEnv, j)); } + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass::get().create(jniEnv, static_cast(c)); } + +private: + NativeInfo() : JniEnum("com/slightech/mynteye/Info") {} + friend ::djinni::JniClass; +}; + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeIntrinsics.cpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeIntrinsics.cpp new file mode 100644 index 0000000..a99b966 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeIntrinsics.cpp @@ -0,0 +1,43 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#include "NativeIntrinsics.hpp" // my header +#include "Marshal.hpp" +#include "NativeCalibrationModel.hpp" + +namespace djinni_generated { + +NativeIntrinsics::NativeIntrinsics() = default; + +NativeIntrinsics::~NativeIntrinsics() = default; + +auto NativeIntrinsics::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef { + const auto& data = ::djinni::JniClass::get(); + auto r = ::djinni::LocalRef{jniEnv->NewObject(data.clazz.get(), data.jconstructor, + ::djinni::get(::djinni_generated::NativeCalibrationModel::fromCpp(jniEnv, c.calib_model)), + ::djinni::get(::djinni::I32::fromCpp(jniEnv, c.width)), + ::djinni::get(::djinni::I32::fromCpp(jniEnv, c.height)), + ::djinni::get(::djinni::F64::fromCpp(jniEnv, c.fx)), + ::djinni::get(::djinni::F64::fromCpp(jniEnv, c.fy)), + ::djinni::get(::djinni::F64::fromCpp(jniEnv, c.cx)), + ::djinni::get(::djinni::F64::fromCpp(jniEnv, c.cy)), + ::djinni::get(::djinni::List<::djinni::F64>::fromCpp(jniEnv, c.coeffs)))}; + ::djinni::jniExceptionCheck(jniEnv); + return r; +} + +auto NativeIntrinsics::toCpp(JNIEnv* jniEnv, JniType j) -> CppType { + ::djinni::JniLocalScope jscope(jniEnv, 9); + assert(j != nullptr); + const auto& data = ::djinni::JniClass::get(); + return {::djinni_generated::NativeCalibrationModel::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mCalibModel)), + ::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mWidth)), + ::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mHeight)), + ::djinni::F64::toCpp(jniEnv, jniEnv->GetDoubleField(j, data.field_mFx)), + ::djinni::F64::toCpp(jniEnv, jniEnv->GetDoubleField(j, data.field_mFy)), + ::djinni::F64::toCpp(jniEnv, jniEnv->GetDoubleField(j, data.field_mCx)), + ::djinni::F64::toCpp(jniEnv, jniEnv->GetDoubleField(j, data.field_mCy)), + ::djinni::List<::djinni::F64>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mCoeffs))}; +} + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeIntrinsics.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeIntrinsics.hpp new file mode 100644 index 0000000..69c137e --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeIntrinsics.hpp @@ -0,0 +1,39 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include "djinni_support.hpp" +#include "intrinsics.hpp" + +namespace djinni_generated { + +class NativeIntrinsics final { +public: + using CppType = ::mynteye_jni::Intrinsics; + using JniType = jobject; + + using Boxed = NativeIntrinsics; + + ~NativeIntrinsics(); + + static CppType toCpp(JNIEnv* jniEnv, JniType j); + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, const CppType& c); + +private: + NativeIntrinsics(); + friend ::djinni::JniClass; + + const ::djinni::GlobalRef clazz { ::djinni::jniFindClass("com/slightech/mynteye/Intrinsics") }; + const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "", "(Lcom/slightech/mynteye/CalibrationModel;IIDDDDLjava/util/ArrayList;)V") }; + const jfieldID field_mCalibModel { ::djinni::jniGetFieldID(clazz.get(), "mCalibModel", "Lcom/slightech/mynteye/CalibrationModel;") }; + const jfieldID field_mWidth { ::djinni::jniGetFieldID(clazz.get(), "mWidth", "I") }; + const jfieldID field_mHeight { ::djinni::jniGetFieldID(clazz.get(), "mHeight", "I") }; + const jfieldID field_mFx { ::djinni::jniGetFieldID(clazz.get(), "mFx", "D") }; + const jfieldID field_mFy { ::djinni::jniGetFieldID(clazz.get(), "mFy", "D") }; + const jfieldID field_mCx { ::djinni::jniGetFieldID(clazz.get(), "mCx", "D") }; + const jfieldID field_mCy { ::djinni::jniGetFieldID(clazz.get(), "mCy", "D") }; + const jfieldID field_mCoeffs { ::djinni::jniGetFieldID(clazz.get(), "mCoeffs", "Ljava/util/ArrayList;") }; +}; + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeMotionIntrinsics.cpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeMotionIntrinsics.cpp new file mode 100644 index 0000000..10936a9 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeMotionIntrinsics.cpp @@ -0,0 +1,30 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#include "NativeMotionIntrinsics.hpp" // my header +#include "NativeImuIntrinsics.hpp" + +namespace djinni_generated { + +NativeMotionIntrinsics::NativeMotionIntrinsics() = default; + +NativeMotionIntrinsics::~NativeMotionIntrinsics() = default; + +auto NativeMotionIntrinsics::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef { + const auto& data = ::djinni::JniClass::get(); + auto r = ::djinni::LocalRef{jniEnv->NewObject(data.clazz.get(), data.jconstructor, + ::djinni::get(::djinni_generated::NativeImuIntrinsics::fromCpp(jniEnv, c.accel)), + ::djinni::get(::djinni_generated::NativeImuIntrinsics::fromCpp(jniEnv, c.gyro)))}; + ::djinni::jniExceptionCheck(jniEnv); + return r; +} + +auto NativeMotionIntrinsics::toCpp(JNIEnv* jniEnv, JniType j) -> CppType { + ::djinni::JniLocalScope jscope(jniEnv, 3); + assert(j != nullptr); + const auto& data = ::djinni::JniClass::get(); + return {::djinni_generated::NativeImuIntrinsics::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mAccel)), + ::djinni_generated::NativeImuIntrinsics::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mGyro))}; +} + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeMotionIntrinsics.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeMotionIntrinsics.hpp new file mode 100644 index 0000000..0c3f49f --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeMotionIntrinsics.hpp @@ -0,0 +1,33 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include "djinni_support.hpp" +#include "motion_intrinsics.hpp" + +namespace djinni_generated { + +class NativeMotionIntrinsics final { +public: + using CppType = ::mynteye_jni::MotionIntrinsics; + using JniType = jobject; + + using Boxed = NativeMotionIntrinsics; + + ~NativeMotionIntrinsics(); + + static CppType toCpp(JNIEnv* jniEnv, JniType j); + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, const CppType& c); + +private: + NativeMotionIntrinsics(); + friend ::djinni::JniClass; + + const ::djinni::GlobalRef clazz { ::djinni::jniFindClass("com/slightech/mynteye/MotionIntrinsics") }; + const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "", "(Lcom/slightech/mynteye/ImuIntrinsics;Lcom/slightech/mynteye/ImuIntrinsics;)V") }; + const jfieldID field_mAccel { ::djinni::jniGetFieldID(clazz.get(), "mAccel", "Lcom/slightech/mynteye/ImuIntrinsics;") }; + const jfieldID field_mGyro { ::djinni::jniGetFieldID(clazz.get(), "mGyro", "Lcom/slightech/mynteye/ImuIntrinsics;") }; +}; + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeOption.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeOption.hpp new file mode 100644 index 0000000..a095d38 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeOption.hpp @@ -0,0 +1,26 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include "djinni_support.hpp" +#include "option.hpp" + +namespace djinni_generated { + +class NativeOption final : ::djinni::JniEnum { +public: + using CppType = ::mynteye_jni::Option; + using JniType = jobject; + + using Boxed = NativeOption; + + static CppType toCpp(JNIEnv* jniEnv, JniType j) { return static_cast(::djinni::JniClass::get().ordinal(jniEnv, j)); } + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass::get().create(jniEnv, static_cast(c)); } + +private: + NativeOption() : JniEnum("com/slightech/mynteye/Option") {} + friend ::djinni::JniClass; +}; + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeOptionInfo.cpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeOptionInfo.cpp new file mode 100644 index 0000000..0d76aa8 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeOptionInfo.cpp @@ -0,0 +1,32 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#include "NativeOptionInfo.hpp" // my header +#include "Marshal.hpp" + +namespace djinni_generated { + +NativeOptionInfo::NativeOptionInfo() = default; + +NativeOptionInfo::~NativeOptionInfo() = default; + +auto NativeOptionInfo::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef { + const auto& data = ::djinni::JniClass::get(); + auto r = ::djinni::LocalRef{jniEnv->NewObject(data.clazz.get(), data.jconstructor, + ::djinni::get(::djinni::I32::fromCpp(jniEnv, c.min)), + ::djinni::get(::djinni::I32::fromCpp(jniEnv, c.max)), + ::djinni::get(::djinni::I32::fromCpp(jniEnv, c.def)))}; + ::djinni::jniExceptionCheck(jniEnv); + return r; +} + +auto NativeOptionInfo::toCpp(JNIEnv* jniEnv, JniType j) -> CppType { + ::djinni::JniLocalScope jscope(jniEnv, 4); + assert(j != nullptr); + const auto& data = ::djinni::JniClass::get(); + return {::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mMin)), + ::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mMax)), + ::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mDef))}; +} + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeOptionInfo.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeOptionInfo.hpp new file mode 100644 index 0000000..97b2a14 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeOptionInfo.hpp @@ -0,0 +1,34 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +#pragma once + +#include "djinni_support.hpp" +#include "option_info.hpp" + +namespace djinni_generated { + +class NativeOptionInfo final { +public: + using CppType = ::mynteye_jni::OptionInfo; + using JniType = jobject; + + using Boxed = NativeOptionInfo; + + ~NativeOptionInfo(); + + static CppType toCpp(JNIEnv* jniEnv, JniType j); + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, const CppType& c); + +private: + NativeOptionInfo(); + friend ::djinni::JniClass; + + const ::djinni::GlobalRef clazz { ::djinni::jniFindClass("com/slightech/mynteye/OptionInfo") }; + const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "", "(III)V") }; + const jfieldID field_mMin { ::djinni::jniGetFieldID(clazz.get(), "mMin", "I") }; + const jfieldID field_mMax { ::djinni::jniGetFieldID(clazz.get(), "mMax", "I") }; + const jfieldID field_mDef { ::djinni::jniGetFieldID(clazz.get(), "mDef", "I") }; +}; + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Addon.java b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Addon.java new file mode 100644 index 0000000..eddd323 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Addon.java @@ -0,0 +1,16 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +package com.slightech.mynteye; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +/** Add-On are peripheral modules of our hardware */ +public enum Addon { + /** Infrared */ + INFRARED, + /** Second infrared */ + INFRARED2, + ; +} diff --git a/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/CalibrationModel.java b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/CalibrationModel.java new file mode 100644 index 0000000..c99cf76 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/CalibrationModel.java @@ -0,0 +1,18 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +package com.slightech.mynteye; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +/** Camera calibration model */ +public enum CalibrationModel { + /** Pinhole */ + PINHOLE, + /** Equidistant: KANNALA_BRANDT */ + KANNALA_BRANDT, + /** Unknow */ + UNKNOW, + ; +} diff --git a/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Capability.java b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Capability.java new file mode 100644 index 0000000..45497cc --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Capability.java @@ -0,0 +1,33 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +package com.slightech.mynteye; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +/** + * Capabilities define the full set of functionality that the device + * might provide + */ +public enum Capability { + /** Provides stereo stream */ + STEREO, + /** Provide stereo color stream */ + STEREO_COLOR, + /** Provides color stream */ + COLOR, + /** Provides depth stream */ + DEPTH, + /** Provides point cloud stream */ + POINTS, + /** Provides fisheye stream */ + FISHEYE, + /** Provides infrared stream */ + INFRARED, + /** Provides second infrared stream */ + INFRARED2, + /** Provides IMU (accelerometer, gyroscope) data */ + IMU, + ; +} diff --git a/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Device.java b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Device.java index 8126805..f0fa410 100644 --- a/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Device.java +++ b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Device.java @@ -10,6 +10,22 @@ import java.util.concurrent.atomic.AtomicBoolean; /** Device class to communicate with MYNT® EYE device */ public interface Device { + /** Get the model */ + @NonNull + public com.slightech.mynteye.Model getModel(); + + /** Supports the stream or not */ + public boolean supportsStream(@NonNull com.slightech.mynteye.Stream stream); + + /** Supports the capability or not */ + public boolean supportsCapability(@NonNull com.slightech.mynteye.Capability capabilities); + + /** Supports the option or not */ + public boolean supportsOption(@NonNull com.slightech.mynteye.Option option); + + /** Supports the addon or not */ + public boolean supportsAddon(@NonNull com.slightech.mynteye.Addon addon); + /** Get all stream requests */ @NonNull public ArrayList getStreamRequests(); @@ -17,6 +33,39 @@ public interface Device { /** Config the stream request */ public void configStreamRequest(@NonNull com.slightech.mynteye.StreamRequest request); + /** Get the device info */ + @NonNull + public String getInfo(@NonNull com.slightech.mynteye.Info info); + + /** Get the intrinsics of stream */ + @NonNull + public com.slightech.mynteye.Intrinsics getIntrinsics(@NonNull com.slightech.mynteye.Stream stream); + + /** Get the extrinsics of stream */ + @NonNull + public com.slightech.mynteye.Extrinsics getExtrinsics(@NonNull com.slightech.mynteye.Stream from, @NonNull com.slightech.mynteye.Stream to); + + /** Get the intrinsics of motion */ + @NonNull + public com.slightech.mynteye.MotionIntrinsics getMotionIntrinsics(); + + /** Get the extrinsics from one stream to motion */ + @NonNull + public com.slightech.mynteye.Extrinsics getMotionExtrinsics(@NonNull com.slightech.mynteye.Stream from); + + /** Get the option info */ + @NonNull + public com.slightech.mynteye.OptionInfo getOptionInfo(@NonNull com.slightech.mynteye.Option option); + + /** Get the option value */ + public int getOptionValue(@NonNull com.slightech.mynteye.Option option); + + /** Set the option value */ + public void setOptionValue(@NonNull com.slightech.mynteye.Option option, int value); + + /** Run the option value */ + public boolean runOptionAction(@NonNull com.slightech.mynteye.Option option); + /** Start capturing the source */ public void start(@NonNull com.slightech.mynteye.Source source); @@ -71,6 +120,46 @@ public interface Device { super.finalize(); } + @Override + public com.slightech.mynteye.Model getModel() + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + return native_getModel(this.nativeRef); + } + private native com.slightech.mynteye.Model native_getModel(long _nativeRef); + + @Override + public boolean supportsStream(com.slightech.mynteye.Stream stream) + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + return native_supportsStream(this.nativeRef, stream); + } + private native boolean native_supportsStream(long _nativeRef, com.slightech.mynteye.Stream stream); + + @Override + public boolean supportsCapability(com.slightech.mynteye.Capability capabilities) + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + return native_supportsCapability(this.nativeRef, capabilities); + } + private native boolean native_supportsCapability(long _nativeRef, com.slightech.mynteye.Capability capabilities); + + @Override + public boolean supportsOption(com.slightech.mynteye.Option option) + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + return native_supportsOption(this.nativeRef, option); + } + private native boolean native_supportsOption(long _nativeRef, com.slightech.mynteye.Option option); + + @Override + public boolean supportsAddon(com.slightech.mynteye.Addon addon) + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + return native_supportsAddon(this.nativeRef, addon); + } + private native boolean native_supportsAddon(long _nativeRef, com.slightech.mynteye.Addon addon); + @Override public ArrayList getStreamRequests() { @@ -87,6 +176,78 @@ public interface Device { } private native void native_configStreamRequest(long _nativeRef, com.slightech.mynteye.StreamRequest request); + @Override + public String getInfo(com.slightech.mynteye.Info info) + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + return native_getInfo(this.nativeRef, info); + } + private native String native_getInfo(long _nativeRef, com.slightech.mynteye.Info info); + + @Override + public com.slightech.mynteye.Intrinsics getIntrinsics(com.slightech.mynteye.Stream stream) + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + return native_getIntrinsics(this.nativeRef, stream); + } + private native com.slightech.mynteye.Intrinsics native_getIntrinsics(long _nativeRef, com.slightech.mynteye.Stream stream); + + @Override + public com.slightech.mynteye.Extrinsics getExtrinsics(com.slightech.mynteye.Stream from, com.slightech.mynteye.Stream to) + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + return native_getExtrinsics(this.nativeRef, from, to); + } + private native com.slightech.mynteye.Extrinsics native_getExtrinsics(long _nativeRef, com.slightech.mynteye.Stream from, com.slightech.mynteye.Stream to); + + @Override + public com.slightech.mynteye.MotionIntrinsics getMotionIntrinsics() + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + return native_getMotionIntrinsics(this.nativeRef); + } + private native com.slightech.mynteye.MotionIntrinsics native_getMotionIntrinsics(long _nativeRef); + + @Override + public com.slightech.mynteye.Extrinsics getMotionExtrinsics(com.slightech.mynteye.Stream from) + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + return native_getMotionExtrinsics(this.nativeRef, from); + } + private native com.slightech.mynteye.Extrinsics native_getMotionExtrinsics(long _nativeRef, com.slightech.mynteye.Stream from); + + @Override + public com.slightech.mynteye.OptionInfo getOptionInfo(com.slightech.mynteye.Option option) + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + return native_getOptionInfo(this.nativeRef, option); + } + private native com.slightech.mynteye.OptionInfo native_getOptionInfo(long _nativeRef, com.slightech.mynteye.Option option); + + @Override + public int getOptionValue(com.slightech.mynteye.Option option) + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + return native_getOptionValue(this.nativeRef, option); + } + private native int native_getOptionValue(long _nativeRef, com.slightech.mynteye.Option option); + + @Override + public void setOptionValue(com.slightech.mynteye.Option option, int value) + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + native_setOptionValue(this.nativeRef, option, value); + } + private native void native_setOptionValue(long _nativeRef, com.slightech.mynteye.Option option, int value); + + @Override + public boolean runOptionAction(com.slightech.mynteye.Option option) + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + return native_runOptionAction(this.nativeRef, option); + } + private native boolean native_runOptionAction(long _nativeRef, com.slightech.mynteye.Option option); + @Override public void start(com.slightech.mynteye.Source source) { diff --git a/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Extrinsics.java b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Extrinsics.java new file mode 100644 index 0000000..de57bfd --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Extrinsics.java @@ -0,0 +1,45 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +package com.slightech.mynteye; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.ArrayList; + +/** Extrinsics, represent how the different datas are connected */ +public final class Extrinsics { + + + /*package*/ final ArrayList mRotation; + + /*package*/ final ArrayList mTranslation; + + public Extrinsics( + @NonNull ArrayList rotation, + @NonNull ArrayList translation) { + this.mRotation = rotation; + this.mTranslation = translation; + } + + /** Rotation matrix, 3x3 */ + @NonNull + public ArrayList getRotation() { + return mRotation; + } + + /** Translation vector, 1x3 */ + @NonNull + public ArrayList getTranslation() { + return mTranslation; + } + + @Override + public String toString() { + return "Extrinsics{" + + "mRotation=" + mRotation + + "," + "mTranslation=" + mTranslation + + "}"; + } + +} diff --git a/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/ImuIntrinsics.java b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/ImuIntrinsics.java new file mode 100644 index 0000000..e26c167 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/ImuIntrinsics.java @@ -0,0 +1,72 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +package com.slightech.mynteye; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.ArrayList; + +/** IMU intrinsics: scale, drift and variances */ +public final class ImuIntrinsics { + + + /*package*/ final ArrayList mScale; + + /*package*/ final ArrayList mDrift; + + /*package*/ final ArrayList mNoise; + + /*package*/ final ArrayList mBias; + + public ImuIntrinsics( + @NonNull ArrayList scale, + @NonNull ArrayList drift, + @NonNull ArrayList noise, + @NonNull ArrayList bias) { + this.mScale = scale; + this.mDrift = drift; + this.mNoise = noise; + this.mBias = bias; + } + + /** + * Scale matrix 3x3 + * Scale X cross axis cross axis + * cross axis Scale Y cross axis + * cross axis cross axis Scale Z + */ + @NonNull + public ArrayList getScale() { + return mScale; + } + + /** Zero-drift: X, Y, Z 1x3 */ + @NonNull + public ArrayList getDrift() { + return mDrift; + } + + /** Noise density variances 1x3 */ + @NonNull + public ArrayList getNoise() { + return mNoise; + } + + /** Random walk variances 1x3 */ + @NonNull + public ArrayList getBias() { + return mBias; + } + + @Override + public String toString() { + return "ImuIntrinsics{" + + "mScale=" + mScale + + "," + "mDrift=" + mDrift + + "," + "mNoise=" + mNoise + + "," + "mBias=" + mBias + + "}"; + } + +} diff --git a/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Info.java b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Info.java new file mode 100644 index 0000000..a406565 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Info.java @@ -0,0 +1,28 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +package com.slightech.mynteye; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +/** Camera info fields are read-only strings that can be queried from the device */ +public enum Info { + /** Device name */ + DEVICE_NAME, + /** Serial number */ + SERIAL_NUMBER, + /** Firmware version */ + FIRMWARE_VERSION, + /** Hardware version */ + HARDWARE_VERSION, + /** Spec version */ + SPEC_VERSION, + /** Lens type */ + LENS_TYPE, + /** IMU type */ + IMU_TYPE, + /** Nominal baseline */ + NOMINAL_BASELINE, + ; +} diff --git a/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Intrinsics.java b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Intrinsics.java new file mode 100644 index 0000000..504db06 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Intrinsics.java @@ -0,0 +1,109 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +package com.slightech.mynteye; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.ArrayList; + +/** Stream intrinsics */ +public final class Intrinsics { + + + /*package*/ final CalibrationModel mCalibModel; + + /*package*/ final int mWidth; + + /*package*/ final int mHeight; + + /*package*/ final double mFx; + + /*package*/ final double mFy; + + /*package*/ final double mCx; + + /*package*/ final double mCy; + + /*package*/ final ArrayList mCoeffs; + + public Intrinsics( + @NonNull CalibrationModel calibModel, + int width, + int height, + double fx, + double fy, + double cx, + double cy, + @NonNull ArrayList coeffs) { + this.mCalibModel = calibModel; + this.mWidth = width; + this.mHeight = height; + this.mFx = fx; + this.mFy = fy; + this.mCx = cx; + this.mCy = cy; + this.mCoeffs = coeffs; + } + + /** The calibration model */ + @NonNull + public CalibrationModel getCalibModel() { + return mCalibModel; + } + + /** The width of the image in pixels */ + public int getWidth() { + return mWidth; + } + + /** The height of the image in pixels */ + public int getHeight() { + return mHeight; + } + + /** The focal length of the image plane, as a multiple of pixel width (pinhole) */ + public double getFx() { + return mFx; + } + + /** The focal length of the image plane, as a multiple of pixel height (pinhole) */ + public double getFy() { + return mFy; + } + + /** The horizontal coordinate of the principal point of the image (pinhole) */ + public double getCx() { + return mCx; + } + + /** The vertical coordinate of the principal point of the image (pinhole) */ + public double getCy() { + return mCy; + } + + /** + * The distortion coefficients + * pinhole: k1,k2,p1,p2,k3 + * kannala_brandt: k2,k3,k4,k5,mu,mv,u0,v0 + */ + @NonNull + public ArrayList getCoeffs() { + return mCoeffs; + } + + @Override + public String toString() { + return "Intrinsics{" + + "mCalibModel=" + mCalibModel + + "," + "mWidth=" + mWidth + + "," + "mHeight=" + mHeight + + "," + "mFx=" + mFx + + "," + "mFy=" + mFy + + "," + "mCx=" + mCx + + "," + "mCy=" + mCy + + "," + "mCoeffs=" + mCoeffs + + "}"; + } + +} diff --git a/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/MotionIntrinsics.java b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/MotionIntrinsics.java new file mode 100644 index 0000000..1ed8d08 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/MotionIntrinsics.java @@ -0,0 +1,44 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +package com.slightech.mynteye; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +/** Motion intrinsics, including accelerometer and gyroscope */ +public final class MotionIntrinsics { + + + /*package*/ final ImuIntrinsics mAccel; + + /*package*/ final ImuIntrinsics mGyro; + + public MotionIntrinsics( + @NonNull ImuIntrinsics accel, + @NonNull ImuIntrinsics gyro) { + this.mAccel = accel; + this.mGyro = gyro; + } + + /** Accelerometer intrinsics */ + @NonNull + public ImuIntrinsics getAccel() { + return mAccel; + } + + /** Gyroscope intrinsics */ + @NonNull + public ImuIntrinsics getGyro() { + return mGyro; + } + + @Override + public String toString() { + return "MotionIntrinsics{" + + "mAccel=" + mAccel + + "," + "mGyro=" + mGyro + + "}"; + } + +} diff --git a/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Option.java b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Option.java new file mode 100644 index 0000000..121f421 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Option.java @@ -0,0 +1,103 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +package com.slightech.mynteye; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +/** Camera control options define general configuration controls */ +public enum Option { + /** + * Image gain, valid if manual-exposure + * range: [0,48], default: 24 + */ + GAIN, + /** + * Image brightness, valid if manual-exposure + * range: [0,240], default: 120 + */ + BRIGHTNESS, + /** + * Image contrast, valid if manual-exposure + * range: [0,255], default: 127 + */ + CONTRAST, + /** + * Image frame rate, must set IMU_FREQUENCY together + * values: {10,15,20,25,30,35,40,45,50,55,60}, default: 25 + */ + FRAME_RATE, + /** + * IMU frequency, must set FRAME_RATE together + * values: {100,200,250,333,500}, default: 200 + */ + IMU_FREQUENCY, + /** + * Exposure mode + * 0: enable auto-exposure + * 1: disable auto-exposure (manual-exposure) + */ + EXPOSURE_MODE, + /** + * Max gain, valid if auto-exposure + * range of standard 1: [0,48], default: 48 + * range of standard 2: [0,255], default: 8 + */ + MAX_GAIN, + /** + * Max exposure time, valid if auto-exposure + * range of standard 1: [0,240], default: 240 + * range of standard 2: [0,1000], default: 333 + */ + MAX_EXPOSURE_TIME, + /** + * min exposure time, valid if auto-exposure + * range: [0,1000], default: 0 + */ + MIN_EXPOSURE_TIME, + /** + * Desired brightness, valid if auto-exposure + * range of standard 1: [0,255], default: 192 + * range of standard 2: [1,255], default: 122 + */ + DESIRED_BRIGHTNESS, + /** + * IR control + * range: [0,160], default: 0 + */ + IR_CONTROL, + /** + * HDR mode + * 0: 10-bit + * 1: 12-bit + */ + HDR_MODE, + /** + * The range of accelerometer + * value of standard 1: {4,8,16,32}, default: 8 + * value of standard 2: {6,12,24,48}, default: 12 + */ + ACCELEROMETER_RANGE, + /** + * The range of gyroscope + * value of standard 1: {500,1000,2000,4000}, default: 1000 + * value of standard 2: {250,500,1000,2000,4000}, default: 1000 + */ + GYROSCOPE_RANGE, + /** + * The parameter of accelerometer low pass filter + * values: {0,1,2}, default: 2 + */ + ACCELEROMETER_LOW_PASS_FILTER, + /** + * The parameter of gyroscope low pass filter + * values: {23,64}, default: 64 + */ + GYROSCOPE_LOW_PASS_FILTER, + /** Zero drift calibration */ + ZERO_DRIFT_CALIBRATION, + /** Erase chip */ + ERASE_CHIP, + ; +} diff --git a/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/OptionInfo.java b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/OptionInfo.java new file mode 100644 index 0000000..e35946c --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/OptionInfo.java @@ -0,0 +1,52 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye_types.djinni + +package com.slightech.mynteye; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +/** Option info */ +public final class OptionInfo { + + + /*package*/ final int mMin; + + /*package*/ final int mMax; + + /*package*/ final int mDef; + + public OptionInfo( + int min, + int max, + int def) { + this.mMin = min; + this.mMax = max; + this.mDef = def; + } + + /** Minimum value */ + public int getMin() { + return mMin; + } + + /** Maximum value */ + public int getMax() { + return mMax; + } + + /** Default value */ + public int getDef() { + return mDef; + } + + @Override + public String toString() { + return "OptionInfo{" + + "mMin=" + mMin + + "," + "mMax=" + mMax + + "," + "mDef=" + mDef + + "}"; + } + +} diff --git a/wrappers/android/mynteye/scripts/mynteye.djinni b/wrappers/android/mynteye/scripts/mynteye.djinni index 1f20091..63d94d5 100644 --- a/wrappers/android/mynteye/scripts/mynteye.djinni +++ b/wrappers/android/mynteye/scripts/mynteye.djinni @@ -5,11 +5,47 @@ device = interface +c { # Create the device instance static create(info: device_usb_info): device; + # Get the model + get_model(): model; + + # Supports the stream or not + supports_stream(stream: stream): bool; + # Supports the capability or not + supports_capability(capabilities: capability): bool; + # Supports the option or not + supports_option(option: option): bool; + # Supports the addon or not + supports_addon(addon: addon): bool; + # Get all stream requests get_stream_requests(): list; # Config the stream request config_stream_request(request: stream_request); + # Get the device info + get_info(info: info): string; + + # Get the intrinsics of stream + get_intrinsics(stream: stream): intrinsics; + # Get the extrinsics of stream + get_extrinsics(from: stream, to: stream): extrinsics; + + # Get the intrinsics of motion + get_motion_intrinsics(): motion_intrinsics; + # Get the extrinsics from one stream to motion + get_motion_extrinsics(from: stream): extrinsics; + + # Get the option info + get_option_info(option: option): option_info; + + # Get the option value + get_option_value(option: option): i32; + # Set the option value + set_option_value(option: option, value: i32); + + # Run the option value + run_option_action(option: option): bool; + # Start capturing the source start(source: source); # Stop capturing the source diff --git a/wrappers/android/mynteye/scripts/mynteye_types.djinni b/wrappers/android/mynteye/scripts/mynteye_types.djinni index 7f8520c..e6681eb 100644 --- a/wrappers/android/mynteye/scripts/mynteye_types.djinni +++ b/wrappers/android/mynteye/scripts/mynteye_types.djinni @@ -73,6 +73,125 @@ stream = enum { right; } +# Capabilities define the full set of functionality that the device +# might provide +capability = enum { + # Provides stereo stream + stereo; + # Provide stereo color stream + stereo_color; + # Provides color stream + color; + # Provides depth stream + depth; + # Provides point cloud stream + points; + # Provides fisheye stream + fisheye; + # Provides infrared stream + infrared; + # Provides second infrared stream + infrared2; + # Provides IMU (accelerometer, gyroscope) data + imu; +} + +# Camera info fields are read-only strings that can be queried from the device +info = enum { + # Device name + device_name; + # Serial number + serial_number; + # Firmware version + firmware_version; + # Hardware version + hardware_version; + # Spec version + spec_version; + # Lens type + lens_type; + # IMU type + imu_type; + # Nominal baseline + nominal_baseline; +} + +# Camera control options define general configuration controls +option = enum { + # Image gain, valid if manual-exposure + # range: [0,48], default: 24 + gain; + # Image brightness, valid if manual-exposure + # range: [0,240], default: 120 + brightness; + # Image contrast, valid if manual-exposure + # range: [0,255], default: 127 + contrast; + + # Image frame rate, must set IMU_FREQUENCY together + # values: {10,15,20,25,30,35,40,45,50,55,60}, default: 25 + frame_rate; + # IMU frequency, must set FRAME_RATE together + # values: {100,200,250,333,500}, default: 200 + imu_frequency; + + # Exposure mode + # 0: enable auto-exposure + # 1: disable auto-exposure (manual-exposure) + exposure_mode; + # Max gain, valid if auto-exposure + # range of standard 1: [0,48], default: 48 + # range of standard 2: [0,255], default: 8 + max_gain; + # Max exposure time, valid if auto-exposure + # range of standard 1: [0,240], default: 240 + # range of standard 2: [0,1000], default: 333 + max_exposure_time; + # min exposure time, valid if auto-exposure + # range: [0,1000], default: 0 + min_exposure_time; + # Desired brightness, valid if auto-exposure + # range of standard 1: [0,255], default: 192 + # range of standard 2: [1,255], default: 122 + desired_brightness; + + # IR control + # range: [0,160], default: 0 + ir_control; + # HDR mode + # 0: 10-bit + # 1: 12-bit + hdr_mode; + + # The range of accelerometer + # value of standard 1: {4,8,16,32}, default: 8 + # value of standard 2: {6,12,24,48}, default: 12 + accelerometer_range; + # The range of gyroscope + # value of standard 1: {500,1000,2000,4000}, default: 1000 + # value of standard 2: {250,500,1000,2000,4000}, default: 1000 + gyroscope_range; + # The parameter of accelerometer low pass filter + # values: {0,1,2}, default: 2 + accelerometer_low_pass_filter; + # The parameter of gyroscope low pass filter + # values: {23,64}, default: 64 + gyroscope_low_pass_filter; + + # Zero drift calibration + zero_drift_calibration; + # Erase chip + erase_chip; +} + +# Add-On are peripheral modules of our hardware +addon = enum { + # Infrared + infrared; + # Second infrared + infrared2; +} + # Frame with raw data frame = interface +c { # Get the width @@ -127,3 +246,78 @@ stream_data = interface +c { motion_data = interface +c { imu(): imu_data; } + +# Camera calibration model +calibration_model = enum { + # Pinhole + pinhole; + # Equidistant: KANNALA_BRANDT + kannala_brandt; + # Unknow + unknow; +} + +# Stream intrinsics +intrinsics = record { + # The calibration model + calib_model: calibration_model; + # The width of the image in pixels + width: i32; + # The height of the image in pixels + height: i32; + + # The focal length of the image plane, as a multiple of pixel width (pinhole) + fx: f64; + # The focal length of the image plane, as a multiple of pixel height (pinhole) + fy: f64; + # The horizontal coordinate of the principal point of the image (pinhole) + cx: f64; + # The vertical coordinate of the principal point of the image (pinhole) + cy: f64; + + # The distortion coefficients + # pinhole: k1,k2,p1,p2,k3 + # kannala_brandt: k2,k3,k4,k5,mu,mv,u0,v0 + coeffs: list; +} + +# IMU intrinsics: scale, drift and variances +imu_intrinsics = record { + # Scale matrix 3x3 + # Scale X cross axis cross axis + # cross axis Scale Y cross axis + # cross axis cross axis Scale Z + scale: list; + # Zero-drift: X, Y, Z 1x3 + drift: list; + # Noise density variances 1x3 + noise: list; + # Random walk variances 1x3 + bias: list; +} + +# Motion intrinsics, including accelerometer and gyroscope +motion_intrinsics = record { + # Accelerometer intrinsics + accel: imu_intrinsics; + # Gyroscope intrinsics + gyro: imu_intrinsics; +} + +# Extrinsics, represent how the different datas are connected +extrinsics = record { + # Rotation matrix, 3x3 + rotation: list; + # Translation vector, 1x3 + translation: list; +} + +# Option info +option_info = record { + # Minimum value + min: i32; + # Maximum value + max: i32; + # Default value + def: i32; +}