Merge branch 'develop' of http://gitlab.mynt.com/mynteye/mynt-eye-sdk-2 into develop
This commit is contained in:
commit
ad64476ee6
|
@ -77,6 +77,7 @@ struct glog_init {
|
|||
#include "mynteye/mynteye.h"
|
||||
|
||||
#define MYNTEYE_MAX_LOG_LEVEL google::INFO
|
||||
// #define MYNTEYE_MAX_LOG_LEVEL 2
|
||||
|
||||
#include "mynteye/miniglog.h"
|
||||
|
||||
|
|
|
@ -157,9 +157,6 @@ class MYNTEYE_API LogSink {
|
|||
// Global set of log sinks. The actual object is defined in logging.cc.
|
||||
MYNTEYE_API extern std::set<LogSink *> log_sinks_global;
|
||||
|
||||
// Added by chachi - a runtime global maximum log level. Defined in logging.cc
|
||||
MYNTEYE_API extern int log_severity_global;
|
||||
|
||||
inline void InitGoogleLogging(char */*argv*/) {
|
||||
// Do nothing; this is ignored.
|
||||
}
|
||||
|
@ -315,9 +312,8 @@ class MYNTEYE_API LoggerVoidify {
|
|||
|
||||
// Log only if condition is met. Otherwise evaluates to void.
|
||||
#define LOG_IF(severity, condition) \
|
||||
(static_cast<int>(severity) > google::log_severity_global || !(condition)) ? \
|
||||
(void) 0 : LoggerVoidify() & \
|
||||
MessageLogger((char *)__FILE__, __LINE__, "native", severity).stream()
|
||||
!(condition) ? (void) 0 : LoggerVoidify() & \
|
||||
MessageLogger((char *)__FILE__, __LINE__, "native", severity).stream()
|
||||
|
||||
// Log only if condition is NOT met. Otherwise evaluates to void.
|
||||
#define LOG_IF_FALSE(severity, condition) LOG_IF(severity, !(condition))
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#define MYNTEYE_API_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
||||
#define MYNTEYE_API_VERSION_MINOR @PROJECT_VERSION_MINOR@
|
||||
#define MYNTEYE_API_VERSION_PATCH @PROJECT_VERSION_PATCH@
|
||||
#define MYNTEYE_API_VERSION_MAJOR @mynteye_VERSION_MAJOR@
|
||||
#define MYNTEYE_API_VERSION_MINOR @mynteye_VERSION_MINOR@
|
||||
#define MYNTEYE_API_VERSION_PATCH @mynteye_VERSION_PATCH@
|
||||
|
||||
/* MYNTEYE_API_VERSION is (major << 16) + (minor << 8) + patch */
|
||||
#define MYNTEYE_API_VERSION \
|
||||
|
|
|
@ -617,8 +617,8 @@ void Device::ReadAllInfos() {
|
|||
SetIntrinsics(Stream::LEFT, img_params.in_left);
|
||||
SetIntrinsics(Stream::RIGHT, img_params.in_right);
|
||||
SetExtrinsics(Stream::LEFT, Stream::RIGHT, img_params.ex_right_to_left);
|
||||
VLOG(2) << "Intrinsics left: {" << GetIntrinsics(Stream::LEFT) << "}";
|
||||
VLOG(2) << "Intrinsics right: {" << GetIntrinsics(Stream::RIGHT) << "}";
|
||||
VLOG(2) << "Intrinsics left: {" << *GetIntrinsics(Stream::LEFT) << "}";
|
||||
VLOG(2) << "Intrinsics right: {" << *GetIntrinsics(Stream::RIGHT) << "}";
|
||||
VLOG(2) << "Extrinsics left to right: {"
|
||||
<< GetExtrinsics(Stream::LEFT, Stream::RIGHT) << "}";
|
||||
break;
|
||||
|
@ -662,8 +662,8 @@ void Device::UpdateStreamIntrinsics(
|
|||
SetIntrinsics(Stream::LEFT, img_params.in_left);
|
||||
SetIntrinsics(Stream::RIGHT, img_params.in_right);
|
||||
SetExtrinsics(Stream::LEFT, Stream::RIGHT, img_params.ex_right_to_left);
|
||||
VLOG(2) << "Intrinsics left: {" << GetIntrinsics(Stream::LEFT) << "}";
|
||||
VLOG(2) << "Intrinsics right: {" << GetIntrinsics(Stream::RIGHT) << "}";
|
||||
VLOG(2) << "Intrinsics left: {" << *GetIntrinsics(Stream::LEFT) << "}";
|
||||
VLOG(2) << "Intrinsics right: {" << *GetIntrinsics(Stream::RIGHT) << "}";
|
||||
VLOG(2) << "Extrinsics left to right: {"
|
||||
<< GetExtrinsics(Stream::LEFT, Stream::RIGHT) << "}";
|
||||
break;
|
||||
|
|
|
@ -120,12 +120,12 @@ bool unpack_stereo_img_data(
|
|||
<< static_cast<int>(img_packet.header) << " now";
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
std::uint8_t checksum = 0;
|
||||
for (std::size_t i = 2, n = packet_n - 2; i <= n; i++) { // content: [2,9]
|
||||
checksum = (checksum ^ packet[i]);
|
||||
}
|
||||
/*
|
||||
|
||||
if (img_packet.checksum != checksum) {
|
||||
VLOG(2) << "Image packet checksum should be 0x" << std::hex
|
||||
<< std::uppercase << std::setw(2) << std::setfill('0')
|
||||
|
|
|
@ -36,6 +36,4 @@ namespace google {
|
|||
// that there is only one instance of this across the entire program.
|
||||
std::set<google::LogSink *> log_sinks_global;
|
||||
|
||||
int log_severity_global(INFO);
|
||||
|
||||
} // namespace google
|
||||
|
|
|
@ -166,6 +166,7 @@ const char *to_string(const Format &value) {
|
|||
CASE(GREY)
|
||||
CASE(YUYV)
|
||||
CASE(BGR888)
|
||||
CASE(RGB888)
|
||||
default:
|
||||
return "Format::UNKNOWN";
|
||||
}
|
||||
|
|
8
wrappers/android/mynteye/.gitignore
vendored
Normal file
8
wrappers/android/mynteye/.gitignore
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
11
wrappers/android/mynteye/README.md
Normal file
11
wrappers/android/mynteye/README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# MYNT® EYE Android Wrapper
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Android device need be rooted and support [USB3 OTG](https://en.wikipedia.org/wiki/USB_On-The-Go) feature.
|
||||
|
||||
## Build & Run
|
||||
|
||||
1. Download and install [Android Studio](https://developer.android.com/studio/index.html)
|
||||
2. Start Android Studio and [download the NDK and build tools](https://developer.android.com/studio/projects/add-native-code)
|
||||
3. Open this project using `Open an existing Android Studio project`
|
1
wrappers/android/mynteye/app/.gitignore
vendored
Normal file
1
wrappers/android/mynteye/app/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
45
wrappers/android/mynteye/app/build.gradle
Normal file
45
wrappers/android/mynteye/app/build.gradle
Normal file
|
@ -0,0 +1,45 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion xversions.compileSdk
|
||||
defaultConfig {
|
||||
applicationId "com.slightech.mynteye.demo"
|
||||
minSdkVersion xversions.minSdk
|
||||
targetSdkVersion xversions.targetSdk
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
ndk {
|
||||
abiFilters xabis
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
|
||||
|
||||
implementation 'com.jakewharton.timber:timber:4.7.1'
|
||||
|
||||
implementation 'com.jakewharton:butterknife:10.0.0'
|
||||
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
|
||||
|
||||
implementation project(':libmynteye')
|
||||
implementation project(':libshell')
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test:runner:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
||||
}
|
21
wrappers/android/mynteye/app/proguard-rules.pro
vendored
Normal file
21
wrappers/android/mynteye/app/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
|
@ -0,0 +1,26 @@
|
|||
package com.slightech.mynteye.demo;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
assertEquals("com.slightech.mynteye.demo", appContext.getPackageName());
|
||||
}
|
||||
}
|
26
wrappers/android/mynteye/app/src/main/AndroidManifest.xml
Normal file
26
wrappers/android/mynteye/app/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.slightech.mynteye.demo">
|
||||
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
android:label="@string/app_name"
|
||||
android:name=".MyApplication"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
tools:ignore="GoogleAppIndexingWarning">
|
||||
<activity android:name=".ui.MainActivity"
|
||||
android:screenOrientation="landscape">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,35 @@
|
|||
package com.slightech.mynteye.demo;
|
||||
|
||||
import android.app.Application;
|
||||
import timber.log.Timber;
|
||||
|
||||
//import com.stericson.RootShell.RootShell;
|
||||
|
||||
public class MyApplication extends Application {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("mynteye_jni");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("mynteye_jni library failed to load.\n" + e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onCreate() {
|
||||
super.onCreate();
|
||||
Timber.plant(new Timber.DebugTree());
|
||||
//RootShell.debugMode = true;
|
||||
}
|
||||
|
||||
@Override public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
}
|
||||
|
||||
@Override public void onTrimMemory(int level) {
|
||||
super.onTrimMemory(level);
|
||||
}
|
||||
|
||||
@Override public void onTerminate() {
|
||||
super.onTerminate();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,213 @@
|
|||
package com.slightech.mynteye.demo.camera;
|
||||
|
||||
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 {
|
||||
|
||||
private Device mDevice;
|
||||
|
||||
private HandlerThread mBackgroundThread;
|
||||
private Handler mBackgroundHandler;
|
||||
|
||||
private boolean mOpened;
|
||||
private boolean mImuEnabled;
|
||||
|
||||
public interface OnStreamDataReceiveListener {
|
||||
void onStreamDataReceive(Stream stream, StreamData data, Handler handler);
|
||||
void onStreamLeftReceive(StreamData data, Handler handler);
|
||||
void onStreamRightReceive(StreamData data, Handler handler);
|
||||
}
|
||||
|
||||
public interface OnMotionDataReceiveListener {
|
||||
void onMotionDataReceive(ArrayList<MotionData> datas, Handler handler);
|
||||
}
|
||||
|
||||
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) {
|
||||
mOnStreamDataReceiveListener = l;
|
||||
}
|
||||
|
||||
public void setOnMotionDataReceiveListener(OnMotionDataReceiveListener l) {
|
||||
mOnMotionDataReceiveListener = l;
|
||||
}
|
||||
|
||||
public ArrayList<StreamRequest> getStreamRequests() {
|
||||
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);
|
||||
if (mImuEnabled) {
|
||||
mDevice.enableMotionDatas(Integer.MAX_VALUE);
|
||||
mDevice.start(Source.ALL);
|
||||
} else {
|
||||
mDevice.start(Source.VIDEO_STREAMING);
|
||||
}
|
||||
|
||||
mBackgroundHandler.post(this);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
if (!mOpened) return;
|
||||
mOpened = false;
|
||||
stopBackgroundThread();
|
||||
mDevice.stop(Source.ALL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
//Timber.i("wait streams");
|
||||
mDevice.waitForStreams();
|
||||
|
||||
//Timber.i("get streams");
|
||||
{
|
||||
StreamData data = mDevice.getStreamData(Stream.LEFT);
|
||||
if (mOnStreamDataReceiveListener != null) {
|
||||
mOnStreamDataReceiveListener.onStreamDataReceive(Stream.LEFT, data, mBackgroundHandler);
|
||||
mOnStreamDataReceiveListener.onStreamLeftReceive(data, mBackgroundHandler);
|
||||
}
|
||||
}
|
||||
{
|
||||
StreamData data = mDevice.getStreamData(Stream.RIGHT);
|
||||
if (mOnStreamDataReceiveListener != null) {
|
||||
mOnStreamDataReceiveListener.onStreamDataReceive(Stream.RIGHT, data, mBackgroundHandler);
|
||||
mOnStreamDataReceiveListener.onStreamRightReceive(data, mBackgroundHandler);
|
||||
}
|
||||
}
|
||||
|
||||
//Timber.i("get motions");
|
||||
if (mImuEnabled) {
|
||||
ArrayList<MotionData> datas = mDevice.getMotionDatas();
|
||||
if (mOnMotionDataReceiveListener != null) {
|
||||
mOnMotionDataReceiveListener.onMotionDataReceive(datas, mBackgroundHandler);
|
||||
}
|
||||
}
|
||||
|
||||
if (mOpened) mBackgroundHandler.post(this);
|
||||
}
|
||||
|
||||
private void startBackgroundThread() {
|
||||
mBackgroundThread = new HandlerThread("MynteyeBackground");
|
||||
mBackgroundThread.start();
|
||||
mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
|
||||
}
|
||||
|
||||
private void stopBackgroundThread() {
|
||||
mBackgroundThread.quitSafely();
|
||||
//mBackgroundThread.interrupt();
|
||||
try {
|
||||
mBackgroundHandler.removeCallbacksAndMessages(null);
|
||||
mBackgroundThread.join();
|
||||
mBackgroundThread = null;
|
||||
mBackgroundHandler = null;
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.slightech.mynteye.demo.ui;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import static android.Manifest.permission.CAMERA;
|
||||
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||
|
||||
@SuppressLint("Registered")
|
||||
public class BaseActivity extends AppCompatActivity {
|
||||
|
||||
private final int REQ_PERMISSIONS = 1;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
requestPermissions();
|
||||
}
|
||||
|
||||
private void requestPermissions() {
|
||||
final String[] permissions = new String[]{WRITE_EXTERNAL_STORAGE, CAMERA};
|
||||
|
||||
boolean granted = true;
|
||||
for (String permission : permissions) {
|
||||
if (ContextCompat.checkSelfPermission(this, permission)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
granted = false;
|
||||
}
|
||||
}
|
||||
if (granted) return;
|
||||
|
||||
ActivityCompat.requestPermissions(this, permissions, REQ_PERMISSIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
|
||||
@NonNull int[] grantResults) {
|
||||
if (requestCode == REQ_PERMISSIONS) {
|
||||
boolean granted = true;
|
||||
if (grantResults.length < 1) {
|
||||
granted = false;
|
||||
} else {
|
||||
for (int result : grantResults) {
|
||||
if (result != PackageManager.PERMISSION_GRANTED) {
|
||||
granted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!granted) {
|
||||
Toast.makeText(this, "Permission denied :(", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} else {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,323 @@
|
|||
package com.slightech.mynteye.demo.ui;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.hardware.usb.UsbDevice;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import com.slightech.mynteye.DeviceUsbInfo;
|
||||
import com.slightech.mynteye.Frame;
|
||||
import com.slightech.mynteye.ImuData;
|
||||
import com.slightech.mynteye.MotionData;
|
||||
import com.slightech.mynteye.Stream;
|
||||
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.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.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import timber.log.Timber;
|
||||
|
||||
public class MainActivity extends BaseActivity implements CameraDialog.CameraDialogParent,
|
||||
Mynteye.OnStreamDataReceiveListener, Mynteye.OnMotionDataReceiveListener {
|
||||
|
||||
@BindView(R.id.text) TextView mTextView;
|
||||
@BindView(R.id.image_left) ImageView mLeftImageView;
|
||||
@BindView(R.id.image_right) ImageView mRightImageView;
|
||||
|
||||
private USBMonitor mUSBMonitor;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mUSBMonitor.register();
|
||||
if (mMynteye == null) {
|
||||
//actionOpen();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
if (mUSBMonitor != null) {
|
||||
mUSBMonitor.unregister();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mMynteye != null) {
|
||||
mMynteye.close();
|
||||
mMynteye = null;
|
||||
}
|
||||
if (mUSBMonitor != null) {
|
||||
mUSBMonitor.destroy();
|
||||
mUSBMonitor = null;
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
private final OnDeviceConnectListener mOnDeviceConnectListener = new OnDeviceConnectListener() {
|
||||
|
||||
@Override
|
||||
public void onAttach(final UsbDevice device) {
|
||||
toast("USB_DEVICE_ATTACHED");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnect(final UsbDevice device, final UsbControlBlock ctrlBlock, final boolean createNew) {
|
||||
toast(String.format(Locale.getDefault(), "CONNECT, %s: %s", ctrlBlock.getProductName(), ctrlBlock.getSerial()));
|
||||
openDevice(new DeviceUsbInfo(
|
||||
ctrlBlock.getVenderId(),
|
||||
ctrlBlock.getProductId(),
|
||||
ctrlBlock.getFileDescriptor(),
|
||||
ctrlBlock.getBusNum(),
|
||||
ctrlBlock.getDevNum(),
|
||||
getUSBFSName(ctrlBlock),
|
||||
ctrlBlock.getProductName(),
|
||||
ctrlBlock.getSerial()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnect(final UsbDevice device, final UsbControlBlock ctrlBlock) {
|
||||
toast(String.format(Locale.getDefault(), "DISCONNECT, %s: %s", ctrlBlock.getProductName(), ctrlBlock.getSerial()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach(final UsbDevice device) {
|
||||
toast("USB_DEVICE_DETACHED");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(final UsbDevice device) {
|
||||
}
|
||||
|
||||
private static final String DEFAULT_USBFS = "/dev/bus/usb";
|
||||
|
||||
private final String getUSBFSName(final UsbControlBlock ctrlBlock) {
|
||||
String result = null;
|
||||
final String name = ctrlBlock.getDeviceName();
|
||||
final String[] v = !TextUtils.isEmpty(name) ? name.split("/") : null;
|
||||
if ((v != null) && (v.length > 2)) {
|
||||
final StringBuilder sb = new StringBuilder(v[0]);
|
||||
for (int i = 1; i < v.length - 2; i++)
|
||||
sb.append("/").append(v[i]);
|
||||
result = sb.toString();
|
||||
}
|
||||
if (TextUtils.isEmpty(result)) {
|
||||
Timber.w("failed to get USBFS path, try to use default path: %s", name);
|
||||
result = DEFAULT_USBFS;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu_main, menu);
|
||||
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).setEnabled(featuresUsable);
|
||||
menu.findItem(R.id.show_image_params).setEnabled(featuresUsable);
|
||||
menu.findItem(R.id.show_imu_params).setEnabled(featuresUsable);
|
||||
menu.findItem(R.id.show_option_infos).setEnabled(featuresUsable);
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_open:
|
||||
actionOpen();
|
||||
return true;
|
||||
case R.id.action_close:
|
||||
actionClose();
|
||||
return true;
|
||||
case R.id.check_imu_data:
|
||||
mImuEnabled = !mImuEnabled;
|
||||
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() {
|
||||
mTextView.setText("");
|
||||
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) {
|
||||
mMynteye = new Mynteye(info);
|
||||
ArrayList<StreamRequest> requests = mMynteye.getStreamRequests();
|
||||
if (requests.isEmpty()) {
|
||||
alert("Warning", "There are no streams to request :(");
|
||||
mMynteye = null;
|
||||
} else {
|
||||
ArrayList<String> items = new ArrayList<>();
|
||||
for (StreamRequest req : requests) {
|
||||
items.add(req.toString());
|
||||
}
|
||||
|
||||
AlertDialog dialog = new AlertDialog.Builder(this)
|
||||
.setTitle("StreamRequests")
|
||||
.create();
|
||||
ListView listView = new ListView(this);
|
||||
listView.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, items));
|
||||
listView.setOnItemClickListener((parent, view, position, id) -> {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public USBMonitor getUSBMonitor() {
|
||||
return mUSBMonitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDialogResult(boolean canceled) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamDataReceive(Stream stream, StreamData data, Handler handler) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamLeftReceive(StreamData data, Handler handler) {
|
||||
//Timber.i("onStreamLeftReceive");
|
||||
Frame frame = data.frame();
|
||||
if (mLeftBitmap == null) {
|
||||
mLeftBitmap = Bitmap.createBitmap(frame.width(), frame.height(), Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
BitmapUtils.copyPixels(frame, mLeftBitmap);
|
||||
mLeftImageView.post(() -> mLeftImageView.setImageBitmap(mLeftBitmap));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamRightReceive(StreamData data, Handler handler) {
|
||||
//Timber.i("onStreamRightReceive");
|
||||
Frame frame = data.frame();
|
||||
if (mRightBitmap == null) {
|
||||
mRightBitmap = Bitmap.createBitmap(frame.width(), frame.height(), Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
BitmapUtils.copyPixels(frame, mRightBitmap);
|
||||
mRightImageView.post(() -> mRightImageView.setImageBitmap(mRightBitmap));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMotionDataReceive(ArrayList<MotionData> datas, Handler handler) {
|
||||
if (datas.isEmpty()) return;
|
||||
ImuData data = datas.get(0).imu();
|
||||
mTextView.post(() -> {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
final int flag = data.getFlag();
|
||||
if (flag == 0) { // accel & gyro
|
||||
sb.append("Accel: ").append(data.getAccel());
|
||||
sb.append("\nGyro: ").append(data.getGyro());
|
||||
} else if (flag == 1) { // accel
|
||||
sb.append("Accel: ").append(data.getAccel());
|
||||
sb.append("\nGyro: -");
|
||||
} else if (flag == 2) { // gyro
|
||||
sb.append("Accel: -");
|
||||
sb.append("\nGyro: ").append(data.getGyro());
|
||||
}
|
||||
mTextView.setText(sb.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)
|
||||
.setMessage(message)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.slightech.mynteye.demo.util;
|
||||
|
||||
import com.stericson.RootShell.RootShell;
|
||||
import com.stericson.RootShell.exceptions.RootDeniedException;
|
||||
import com.stericson.RootShell.execution.Command;
|
||||
import com.stericson.RootShell.execution.Shell;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import timber.log.Timber;
|
||||
|
||||
public final class RootUtils {
|
||||
|
||||
public interface OnRequestAccessibleListener {
|
||||
void onRequestAccessible(boolean ok);
|
||||
}
|
||||
|
||||
public static boolean isRooted() {
|
||||
if (!RootShell.isRootAvailable()) {
|
||||
Timber.e("Root not found");
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
RootShell.getShell(true);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} catch (TimeoutException e) {
|
||||
Timber.e("TIMEOUT EXCEPTION!");
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} catch (RootDeniedException e) {
|
||||
Timber.e("ROOT DENIED EXCEPTION!");
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!RootShell.isAccessGiven()) {
|
||||
Timber.e("ERROR: No root access to this device.");
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Timber.e("ERROR: could not determine root access to this device.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void requestAccessible(OnRequestAccessibleListener l) {
|
||||
try {
|
||||
Shell sh = RootShell.getShell(true);
|
||||
sh.add(new Command(1, "chmod 666 /dev/video*") {
|
||||
@Override
|
||||
public void commandOutput(int id, String line) {
|
||||
Timber.d("commandOutput: %s", line);
|
||||
super.commandOutput(id, line);
|
||||
}
|
||||
@Override
|
||||
public void commandTerminated(int id, String reason) {
|
||||
Timber.d("commandTerminated: %s", reason);
|
||||
}
|
||||
@Override
|
||||
public void commandCompleted(int id, int exitcode) {
|
||||
Timber.d("commandCompleted: %s", ((exitcode == 0) ? "ok" : "fail"));
|
||||
if (l != null) l.onRequestAccessible(exitcode == 0);
|
||||
}
|
||||
});
|
||||
sh.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
tools:context=".ui.MainActivity"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="@string/tip_open"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/layout_image"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_left"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/image_right"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_weight="1"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_right"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/image_left"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_weight="1"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
36
wrappers/android/mynteye/app/src/main/res/menu/menu_main.xml
Normal file
36
wrappers/android/mynteye/app/src/main/res/menu/menu_main.xml
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_open"
|
||||
android:title="@string/open"
|
||||
app:showAsAction="ifRoom|withText" />
|
||||
<item
|
||||
android:id="@+id/action_close"
|
||||
android:title="@string/close"
|
||||
app:showAsAction="ifRoom|withText" />
|
||||
|
||||
<item
|
||||
android:id="@+id/check_imu_data"
|
||||
android:title="@string/imu_data"
|
||||
android:checkable="true"
|
||||
android:checked="false"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/show_device_infos"
|
||||
android:title="@string/device_infos"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/show_image_params"
|
||||
android:title="@string/image_params"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/show_imu_params"
|
||||
android:title="@string/imu_params"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/show_option_infos"
|
||||
android:title="@string/option_infos"
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#008577</color>
|
||||
<color name="colorPrimaryDark">#00574B</color>
|
||||
<color name="colorAccent">#D81B60</color>
|
||||
</resources>
|
15
wrappers/android/mynteye/app/src/main/res/values/strings.xml
Normal file
15
wrappers/android/mynteye/app/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<resources>
|
||||
<string name="app_name">MYNTEYE-S SDK Sample</string>
|
||||
|
||||
<string name="tip_open">Please \"Open\" the camera!</string>
|
||||
|
||||
<string name="open">Open</string>
|
||||
<string name="close">Close</string>
|
||||
|
||||
<string name="imu_data">Imu Data</string>
|
||||
|
||||
<string name="device_infos">Device Infos</string>
|
||||
<string name="image_params">Image Params</string>
|
||||
<string name="imu_params">Imu Params</string>
|
||||
<string name="option_infos">Option Infos</string>
|
||||
</resources>
|
11
wrappers/android/mynteye/app/src/main/res/values/styles.xml
Normal file
11
wrappers/android/mynteye/app/src/main/res/values/styles.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
|
@ -0,0 +1,17 @@
|
|||
package com.slightech.mynteye.demo;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
27
wrappers/android/mynteye/build.gradle
Normal file
27
wrappers/android/mynteye/build.gradle
Normal file
|
@ -0,0 +1,27 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
apply from: rootProject.file('gradle/dependencies.gradle')
|
||||
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
17
wrappers/android/mynteye/gradle.properties
Normal file
17
wrappers/android/mynteye/gradle.properties
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
android.enableJetifier=true
|
||||
android.useAndroidX=true
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
|
||||
|
10
wrappers/android/mynteye/gradle/dependencies.gradle
Normal file
10
wrappers/android/mynteye/gradle/dependencies.gradle
Normal file
|
@ -0,0 +1,10 @@
|
|||
ext {
|
||||
xversions = [
|
||||
'compileSdk': 28,
|
||||
'minSdk': 24,
|
||||
'targetSdk': 28,
|
||||
]
|
||||
|
||||
xabis = ['arm64-v8a', 'armeabi-v7a'] as String[]
|
||||
//xabis = ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'] as String[]
|
||||
}
|
BIN
wrappers/android/mynteye/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
wrappers/android/mynteye/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
wrappers/android/mynteye/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
wrappers/android/mynteye/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
#Tue Jan 15 14:54:17 CST 2019
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
|
172
wrappers/android/mynteye/gradlew
vendored
Executable file
172
wrappers/android/mynteye/gradlew
vendored
Executable file
|
@ -0,0 +1,172 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
84
wrappers/android/mynteye/gradlew.bat
vendored
Normal file
84
wrappers/android/mynteye/gradlew.bat
vendored
Normal file
|
@ -0,0 +1,84 @@
|
|||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
1
wrappers/android/mynteye/libmynteye/.gitignore
vendored
Normal file
1
wrappers/android/mynteye/libmynteye/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
122
wrappers/android/mynteye/libmynteye/CMakeLists.txt
Normal file
122
wrappers/android/mynteye/libmynteye/CMakeLists.txt
Normal file
|
@ -0,0 +1,122 @@
|
|||
# For more information about using CMake with Android Studio, read the
|
||||
# documentation: https://d.android.com/studio/projects/add-native-code.html
|
||||
|
||||
# Sets the minimum version of CMake required to build the native library.
|
||||
|
||||
cmake_minimum_required(VERSION 3.4.1)
|
||||
|
||||
get_filename_component(MYNTETE_ROOT "${PROJECT_SOURCE_DIR}/../../../.." ABSOLUTE)
|
||||
message(STATUS "MYNTETE_ROOT: ${MYNTETE_ROOT}")
|
||||
|
||||
get_filename_component(PRO_ROOT "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
|
||||
message(STATUS "PRO_ROOT: ${PRO_ROOT}")
|
||||
|
||||
set(LIB_ROOT "${PROJECT_SOURCE_DIR}")
|
||||
message(STATUS "LIB_ROOT: ${LIB_ROOT}")
|
||||
|
||||
if(NOT DJINNI_DIR)
|
||||
if(DEFINED ENV{DJINNI_DIR})
|
||||
set(DJINNI_DIR $ENV{DJINNI_DIR})
|
||||
else()
|
||||
set(DJINNI_DIR "${PRO_ROOT}/third_party/djinni")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# libs
|
||||
|
||||
## log
|
||||
|
||||
find_library(log-lib log)
|
||||
|
||||
## jnigraphics
|
||||
|
||||
find_library(jnigraphics-lib jnigraphics)
|
||||
|
||||
## djinni_jni
|
||||
|
||||
include_directories(
|
||||
${DJINNI_DIR}/support-lib/jni
|
||||
)
|
||||
add_library(djinni_jni STATIC
|
||||
${DJINNI_DIR}/support-lib/jni/djinni_support.cpp
|
||||
)
|
||||
|
||||
## mynteye_internal
|
||||
|
||||
add_library(mynteye_internal SHARED IMPORTED)
|
||||
set_target_properties(mynteye_internal PROPERTIES
|
||||
IMPORTED_LOCATION "${LIB_ROOT}/src/main/jniLibs/${ANDROID_ABI}/libmynteye_internal.so"
|
||||
)
|
||||
|
||||
# targets
|
||||
|
||||
## libmynteye
|
||||
|
||||
add_definitions(-DMYNTEYE_EXPORTS)
|
||||
|
||||
set(MYNTEYE_NAMESPACE "mynteye")
|
||||
#message(STATUS "Namespace: ${MYNTEYE_NAMESPACE}")
|
||||
|
||||
configure_file(
|
||||
${MYNTETE_ROOT}/include/mynteye/mynteye.h.in
|
||||
include/mynteye/mynteye.h @ONLY
|
||||
)
|
||||
|
||||
set(MYNTEYE_SRCS
|
||||
#${MYNTETE_ROOT}/src/mynteye/uvc/linux/uvc-v4l2.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/types.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/util/files.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/util/strings.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/device/channel/bytes.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/device/channel/channels.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/device/channel/file_channel.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/device/config.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/device/context.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/device/device.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/device/motions.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/device/standard/channels_adapter_s.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/device/standard/device_s.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/device/standard/streams_adapter_s.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/device/standard2/channels_adapter_s2.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/device/standard2/device_s2.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/device/standard2/streams_adapter_s2.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/device/streams.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/device/types.cc
|
||||
${MYNTETE_ROOT}/src/mynteye/device/utils.cc
|
||||
)
|
||||
|
||||
list(APPEND MYNTEYE_SRCS ${MYNTETE_ROOT}/src/mynteye/miniglog.cc)
|
||||
|
||||
add_library(mynteye STATIC ${MYNTEYE_SRCS})
|
||||
target_link_libraries(mynteye ${log-lib})
|
||||
|
||||
target_include_directories(mynteye PUBLIC
|
||||
"$<BUILD_INTERFACE:${MYNTETE_ROOT}/include>"
|
||||
"$<BUILD_INTERFACE:${MYNTETE_ROOT}/src>"
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
|
||||
"$<INSTALL_INTERFACE:include>"
|
||||
)
|
||||
|
||||
## libmynteye_jni
|
||||
|
||||
set(CPP_DIR "${PROJECT_SOURCE_DIR}/src/main/cpp")
|
||||
|
||||
include_directories(
|
||||
${CPP_DIR}/mynteye/cpp
|
||||
${CPP_DIR}/mynteye/impl
|
||||
${CPP_DIR}/mynteye/jni
|
||||
)
|
||||
|
||||
set(MYNTEYE_JNI_SRCS "")
|
||||
foreach(__dir cpp impl jni)
|
||||
file(GLOB __srcs "${CPP_DIR}/mynteye/${__dir}/*.cpp")
|
||||
list(APPEND MYNTEYE_JNI_SRCS ${__srcs})
|
||||
endforeach()
|
||||
#message(STATUS "MYNTEYE_JNI_SRCS: ${MYNTEYE_JNI_SRCS}")
|
||||
|
||||
add_library(mynteye_jni SHARED
|
||||
${DJINNI_DIR}/support-lib/jni/djinni_main.cpp
|
||||
${CPP_DIR}/mynteye/impl/util/jni_util.cpp
|
||||
${MYNTEYE_JNI_SRCS}
|
||||
)
|
||||
target_link_libraries(mynteye_jni ${log-lib} ${jnigraphics-lib} djinni_jni mynteye mynteye_internal)
|
53
wrappers/android/mynteye/libmynteye/build.gradle
Normal file
53
wrappers/android/mynteye/libmynteye/build.gradle
Normal file
|
@ -0,0 +1,53 @@
|
|||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion xversions.compileSdk
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion xversions.minSdk
|
||||
targetSdkVersion xversions.targetSdk
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
externalNativeBuild {
|
||||
// https://developer.android.com/ndk/guides/cmake
|
||||
cmake {
|
||||
cppFlags "-std=c++11 -frtti -fexceptions"
|
||||
}
|
||||
}
|
||||
|
||||
ndk {
|
||||
abiFilters xabis
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation 'androidx.annotation:annotation:1.0.1'
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test:runner:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
||||
}
|
21
wrappers/android/mynteye/libmynteye/proguard-rules.pro
vendored
Normal file
21
wrappers/android/mynteye/libmynteye/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
|
@ -0,0 +1,26 @@
|
|||
package com.slightech.mynteye;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
assertEquals("com.slightech.mynteye.test", appContext.getPackageName());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.slightech.mynteye"/>
|
|
@ -0,0 +1,28 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
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<int>()(static_cast<int>(type));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
|
@ -0,0 +1,30 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
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<int>()(static_cast<int>(type));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
|
@ -0,0 +1,42 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
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<int>()(static_cast<int>(type));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
|
@ -0,0 +1,106 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye.djinni
|
||||
|
||||
#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 <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
/** Device class to communicate with MYNT® EYE device */
|
||||
class Device {
|
||||
public:
|
||||
virtual ~Device() {}
|
||||
|
||||
/** Create the device instance */
|
||||
static std::shared_ptr<Device> 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;
|
||||
|
||||
/** Stop capturing the source */
|
||||
virtual void Stop(::mynteye_jni::Source source) = 0;
|
||||
|
||||
/** Wait the streams are ready */
|
||||
virtual void WaitForStreams() = 0;
|
||||
|
||||
/** Get the latest data of stream */
|
||||
virtual std::shared_ptr<::mynteye_jni::StreamData> GetStreamData(::mynteye_jni::Stream stream) = 0;
|
||||
|
||||
/** Get the datas of stream */
|
||||
virtual std::vector<std::shared_ptr<::mynteye_jni::StreamData>> GetStreamDatas(::mynteye_jni::Stream stream) = 0;
|
||||
|
||||
/** Enable cache motion datas until get them, otherwise using callback instead */
|
||||
virtual void EnableMotionDatas(int32_t max_size) = 0;
|
||||
|
||||
/** Get the motion datas */
|
||||
virtual std::vector<std::shared_ptr<::mynteye_jni::MotionData>> GetMotionDatas() = 0;
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
|
@ -0,0 +1,50 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
/** Device USB information */
|
||||
struct DeviceUsbInfo final {
|
||||
/** Vendor id */
|
||||
int32_t vid;
|
||||
/** Product id */
|
||||
int32_t pid;
|
||||
/** File descriptor */
|
||||
int32_t fd;
|
||||
/** Bus number */
|
||||
int32_t bus_num;
|
||||
/** Dev number */
|
||||
int32_t dev_num;
|
||||
/** Usb file system path */
|
||||
std::string usb_fs;
|
||||
/** Product name */
|
||||
std::string name;
|
||||
/** Serial number */
|
||||
std::string serial;
|
||||
|
||||
DeviceUsbInfo(int32_t vid_,
|
||||
int32_t pid_,
|
||||
int32_t fd_,
|
||||
int32_t bus_num_,
|
||||
int32_t dev_num_,
|
||||
std::string usb_fs_,
|
||||
std::string name_,
|
||||
std::string serial_)
|
||||
: vid(std::move(vid_))
|
||||
, pid(std::move(pid_))
|
||||
, fd(std::move(fd_))
|
||||
, bus_num(std::move(bus_num_))
|
||||
, dev_num(std::move(dev_num_))
|
||||
, usb_fs(std::move(usb_fs_))
|
||||
, name(std::move(name_))
|
||||
, serial(std::move(serial_))
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
|
@ -0,0 +1,25 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
/** Extrinsics, represent how the different datas are connected */
|
||||
struct Extrinsics final {
|
||||
/** Rotation matrix, 3x3 */
|
||||
std::vector<double> rotation;
|
||||
/** Translation vector, 1x3 */
|
||||
std::vector<double> translation;
|
||||
|
||||
Extrinsics(std::vector<double> rotation_,
|
||||
std::vector<double> translation_)
|
||||
: rotation(std::move(rotation_))
|
||||
, translation(std::move(translation_))
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
|
@ -0,0 +1,32 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
enum class Format : int {
|
||||
/** Greyscale, 8 bits per pixel */
|
||||
GREY,
|
||||
/** YUV 4:2:2, 16 bits per pixel */
|
||||
YUYV,
|
||||
/** BGR 8:8:8, 24 bits per pixel */
|
||||
BGR888,
|
||||
/** RGB 8:8:8, 24 bits per pixel */
|
||||
RGB888,
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
||||
|
||||
namespace std {
|
||||
|
||||
template <>
|
||||
struct hash<::mynteye_jni::Format> {
|
||||
size_t operator()(::mynteye_jni::Format type) const {
|
||||
return std::hash<int>()(static_cast<int>(type));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
|
@ -0,0 +1,34 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
enum class Format;
|
||||
|
||||
/** Frame with raw data */
|
||||
class Frame {
|
||||
public:
|
||||
virtual ~Frame() {}
|
||||
|
||||
/** Get the width */
|
||||
virtual int32_t Width() = 0;
|
||||
|
||||
/** Get the height */
|
||||
virtual int32_t Height() = 0;
|
||||
|
||||
/** Get the pixel format */
|
||||
virtual ::mynteye_jni::Format Format() = 0;
|
||||
|
||||
/** Get the size */
|
||||
virtual int32_t Size() = 0;
|
||||
|
||||
/** Get the data */
|
||||
virtual std::vector<uint8_t> Data() = 0;
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
|
@ -0,0 +1,29 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
/** Image data */
|
||||
struct ImgData final {
|
||||
/** Image frame id */
|
||||
int64_t frame_id;
|
||||
/** Image timestamp in 1us */
|
||||
int64_t timestamp;
|
||||
/** Image exposure time, virtual value in [1, 480] */
|
||||
int64_t exposure_time;
|
||||
|
||||
ImgData(int64_t frame_id_,
|
||||
int64_t timestamp_,
|
||||
int64_t exposure_time_)
|
||||
: frame_id(std::move(frame_id_))
|
||||
, timestamp(std::move(timestamp_))
|
||||
, exposure_time(std::move(exposure_time_))
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
|
@ -0,0 +1,47 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
/** IMU data */
|
||||
struct ImuData final {
|
||||
/** IMU frame id */
|
||||
int64_t frame_id;
|
||||
/**
|
||||
* IMU accel or gyro flag
|
||||
* 0: accel and gyro are both valid
|
||||
* 1: accel is valid
|
||||
* 2: gyro is valid
|
||||
*/
|
||||
int32_t flag;
|
||||
/** IMU timestamp in 1us */
|
||||
int64_t timestamp;
|
||||
/** IMU accelerometer data for 3-axis: X, Y, Z. */
|
||||
std::vector<double> accel;
|
||||
/** IMU gyroscope data for 3-axis: X, Y, Z. */
|
||||
std::vector<double> gyro;
|
||||
/** IMU temperature */
|
||||
double temperature;
|
||||
|
||||
ImuData(int64_t frame_id_,
|
||||
int32_t flag_,
|
||||
int64_t timestamp_,
|
||||
std::vector<double> accel_,
|
||||
std::vector<double> gyro_,
|
||||
double temperature_)
|
||||
: frame_id(std::move(frame_id_))
|
||||
, flag(std::move(flag_))
|
||||
, timestamp(std::move(timestamp_))
|
||||
, accel(std::move(accel_))
|
||||
, gyro(std::move(gyro_))
|
||||
, temperature(std::move(temperature_))
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
|
@ -0,0 +1,38 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
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<double> scale;
|
||||
/** Zero-drift: X, Y, Z 1x3 */
|
||||
std::vector<double> drift;
|
||||
/** Noise density variances 1x3 */
|
||||
std::vector<double> noise;
|
||||
/** Random walk variances 1x3 */
|
||||
std::vector<double> bias;
|
||||
|
||||
ImuIntrinsics(std::vector<double> scale_,
|
||||
std::vector<double> drift_,
|
||||
std::vector<double> noise_,
|
||||
std::vector<double> bias_)
|
||||
: scale(std::move(scale_))
|
||||
, drift(std::move(drift_))
|
||||
, noise(std::move(noise_))
|
||||
, bias(std::move(bias_))
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
|
@ -0,0 +1,40 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
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<int>()(static_cast<int>(type));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
|
@ -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 <cstdint>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
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<double> coeffs;
|
||||
|
||||
Intrinsics(CalibrationModel calib_model_,
|
||||
int32_t width_,
|
||||
int32_t height_,
|
||||
double fx_,
|
||||
double fy_,
|
||||
double cx_,
|
||||
double cy_,
|
||||
std::vector<double> 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
|
|
@ -0,0 +1,30 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
enum class Model : int {
|
||||
/** Standard */
|
||||
STANDARD,
|
||||
/** Standard 2 */
|
||||
STANDARD2,
|
||||
/** Standard 210a */
|
||||
STANDARD210A,
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
||||
|
||||
namespace std {
|
||||
|
||||
template <>
|
||||
struct hash<::mynteye_jni::Model> {
|
||||
size_t operator()(::mynteye_jni::Model type) const {
|
||||
return std::hash<int>()(static_cast<int>(type));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
|
@ -0,0 +1,18 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
struct ImuData;
|
||||
|
||||
/** Device motion data */
|
||||
class MotionData {
|
||||
public:
|
||||
virtual ~MotionData() {}
|
||||
|
||||
virtual ImuData Imu() = 0;
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
|
@ -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 <utility>
|
||||
|
||||
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
|
|
@ -0,0 +1,115 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
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<int>()(static_cast<int>(type));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
|
@ -0,0 +1,29 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
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
|
|
@ -0,0 +1,30 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
enum class Source : int {
|
||||
/** Video streaming of stereo, color, depth, etc. */
|
||||
VIDEO_STREAMING,
|
||||
/** Motion tracking of IMU (accelerometer, gyroscope) */
|
||||
MOTION_TRACKING,
|
||||
/** Enable everything together */
|
||||
ALL,
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
||||
|
||||
namespace std {
|
||||
|
||||
template <>
|
||||
struct hash<::mynteye_jni::Source> {
|
||||
size_t operator()(::mynteye_jni::Source type) const {
|
||||
return std::hash<int>()(static_cast<int>(type));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
|
@ -0,0 +1,28 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
enum class Stream : int {
|
||||
/** Left stream */
|
||||
LEFT,
|
||||
/** Right stream */
|
||||
RIGHT,
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
||||
|
||||
namespace std {
|
||||
|
||||
template <>
|
||||
struct hash<::mynteye_jni::Stream> {
|
||||
size_t operator()(::mynteye_jni::Stream type) const {
|
||||
return std::hash<int>()(static_cast<int>(type));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
|
@ -0,0 +1,26 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
class Frame;
|
||||
struct ImgData;
|
||||
|
||||
/** Device stream data */
|
||||
class StreamData {
|
||||
public:
|
||||
virtual ~StreamData() {}
|
||||
|
||||
virtual ImgData Img() = 0;
|
||||
|
||||
virtual std::shared_ptr<::mynteye_jni::Frame> Frame() = 0;
|
||||
|
||||
virtual int64_t FrameId() = 0;
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
|
@ -0,0 +1,38 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "format.hpp"
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
/** Stream request */
|
||||
struct StreamRequest final {
|
||||
/** Stream index */
|
||||
int32_t index;
|
||||
/** Stream width in pixels */
|
||||
int32_t width;
|
||||
/** Stream height in pixels */
|
||||
int32_t height;
|
||||
/** Stream pixel format */
|
||||
Format format;
|
||||
/** Stream frames per second */
|
||||
int32_t fps;
|
||||
|
||||
StreamRequest(int32_t index_,
|
||||
int32_t width_,
|
||||
int32_t height_,
|
||||
Format format_,
|
||||
int32_t fps_)
|
||||
: index(std::move(index_))
|
||||
, width(std::move(width_))
|
||||
, height(std::move(height_))
|
||||
, format(std::move(format_))
|
||||
, fps(std::move(fps_))
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
|
@ -0,0 +1,223 @@
|
|||
#include "device_impl.hpp"
|
||||
|
||||
#include "mynteye/device/context.h"
|
||||
#include "mynteye/device/device.h"
|
||||
#include "mynteye/logger.h"
|
||||
|
||||
#include "device_usb_info.hpp"
|
||||
#include "stream_request.hpp"
|
||||
#include "type_conversion.hpp"
|
||||
|
||||
#include "frame_impl.hpp"
|
||||
#include "motion_data_impl.hpp"
|
||||
#include "stream_data_impl.hpp"
|
||||
|
||||
#include "mynteye/uvc/uvc.h"
|
||||
#include "mynteye/util/strings.h"
|
||||
#include "internal/uvc_device.h"
|
||||
|
||||
MYNTEYE_USE_NAMESPACE
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
/*
|
||||
std::vector<::mynteye_jni::DeviceUsbInfo> Device::Query() {
|
||||
VLOG(2) << __func__;
|
||||
std::vector<DeviceUsbInfo> infos;
|
||||
|
||||
Context context;
|
||||
int32_t i = 0;
|
||||
for (auto&& d : context.devices()) {
|
||||
infos.emplace_back(i,
|
||||
d->GetInfo(Info::DEVICE_NAME),
|
||||
d->GetInfo(Info::SERIAL_NUMBER));
|
||||
++i;
|
||||
}
|
||||
|
||||
return infos;
|
||||
}
|
||||
|
||||
std::shared_ptr<Device> Device::Create(const ::mynteye_jni::DeviceUsbInfo & info) {
|
||||
VLOG(2) << __func__;
|
||||
Context context;
|
||||
int32_t i = 0;
|
||||
for (auto&& d : context.devices()) {
|
||||
if (i == info.index) {
|
||||
return std::make_shared<DeviceImpl>(d);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
*/
|
||||
|
||||
std::shared_ptr<Device> Device::Create(const ::mynteye_jni::DeviceUsbInfo & info) {
|
||||
VLOG(2) << __func__;
|
||||
auto device = uvc::create_device(from_jni(info));
|
||||
auto name = uvc::get_name(*device);
|
||||
auto vid = uvc::get_vendor_id(*device);
|
||||
auto pid = uvc::get_product_id(*device);
|
||||
VLOG(2) << "UVC device detected, name: " << name << ", vid: 0x" << std::hex
|
||||
<< vid << ", pid: 0x" << std::hex << pid;
|
||||
return std::make_shared<DeviceImpl>(
|
||||
MYNTEYE_NAMESPACE::Device::Create(name, device));
|
||||
}
|
||||
|
||||
DeviceImpl::DeviceImpl(const device_t & device) : Device(), device_(device) {
|
||||
VLOG(2) << __func__;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
int32_t i = 0;
|
||||
for (auto&& req : device_->GetStreamRequests()) {
|
||||
requests.emplace_back(i,
|
||||
req.width, req.height, to_jni(req.format), req.fps);
|
||||
++i;
|
||||
}
|
||||
|
||||
return requests;
|
||||
}
|
||||
|
||||
void DeviceImpl::ConfigStreamRequest(
|
||||
const ::mynteye_jni::StreamRequest & request) {
|
||||
VLOG(2) << __func__;
|
||||
int32_t i = 0;
|
||||
for (auto&& req : device_->GetStreamRequests()) {
|
||||
if (i == request.index) {
|
||||
device_->ConfigStreamRequest(req);
|
||||
return;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
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<IntrinsicsPinhole>(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<IntrinsicsEquidistant>(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));
|
||||
}
|
||||
|
||||
void DeviceImpl::Stop(::mynteye_jni::Source source) {
|
||||
device_->Stop(from_jni(source));
|
||||
}
|
||||
|
||||
void DeviceImpl::WaitForStreams() {
|
||||
device_->WaitForStreams();
|
||||
}
|
||||
|
||||
std::shared_ptr<::mynteye_jni::StreamData> DeviceImpl::GetStreamData(
|
||||
::mynteye_jni::Stream stream) {
|
||||
auto&& data = device_->GetStreamData(from_jni(stream));
|
||||
return std::make_shared<StreamDataImpl>(data);
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<::mynteye_jni::StreamData>>
|
||||
DeviceImpl::GetStreamDatas(::mynteye_jni::Stream stream) {
|
||||
std::vector<std::shared_ptr<::mynteye_jni::StreamData>> datas;
|
||||
for (auto&& data : device_->GetStreamDatas(from_jni(stream))) {
|
||||
datas.push_back(std::make_shared<StreamDataImpl>(data));
|
||||
}
|
||||
return datas;
|
||||
}
|
||||
|
||||
void DeviceImpl::EnableMotionDatas(int32_t max_size) {
|
||||
device_->EnableMotionDatas(max_size);
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<::mynteye_jni::MotionData>>
|
||||
DeviceImpl::GetMotionDatas() {
|
||||
std::vector<std::shared_ptr<::mynteye_jni::MotionData>> datas;
|
||||
for (auto&& data : device_->GetMotionDatas()) {
|
||||
datas.push_back(std::make_shared<MotionDataImpl>(data));
|
||||
}
|
||||
return datas;
|
||||
}
|
||||
|
||||
} // namespace mynteye_jni
|
|
@ -0,0 +1,92 @@
|
|||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include "mynteye/device/device.h"
|
||||
|
||||
#include "device.hpp"
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
class DeviceImpl : public Device {
|
||||
public:
|
||||
using device_t = std::shared_ptr<MYNTEYE_NAMESPACE::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;
|
||||
|
||||
/** Stop capturing the source */
|
||||
void Stop(::mynteye_jni::Source source) override;
|
||||
|
||||
/** Wait the streams are ready */
|
||||
void WaitForStreams() override;
|
||||
|
||||
/** Get the latest data of stream */
|
||||
std::shared_ptr<::mynteye_jni::StreamData> GetStreamData(::mynteye_jni::Stream stream) override;
|
||||
|
||||
/** Get the datas of stream */
|
||||
std::vector<std::shared_ptr<::mynteye_jni::StreamData>> GetStreamDatas(::mynteye_jni::Stream stream) override;
|
||||
|
||||
/** Enable cache motion datas until get them, otherwise using callback instead */
|
||||
void EnableMotionDatas(int32_t max_size) override;
|
||||
|
||||
/** Get the motion datas */
|
||||
std::vector<std::shared_ptr<::mynteye_jni::MotionData>> GetMotionDatas() override;
|
||||
|
||||
private:
|
||||
device_t device_;
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
|
@ -0,0 +1,50 @@
|
|||
#pragma once
|
||||
|
||||
#include "mynteye/device/callbacks.h"
|
||||
|
||||
#include "frame.hpp"
|
||||
#include "type_conversion.hpp"
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
class FrameImpl : public Frame {
|
||||
public:
|
||||
using frame_t = std::shared_ptr<MYNTEYE_NAMESPACE::device::Frame>;
|
||||
|
||||
explicit FrameImpl(const frame_t& frame) : frame_(frame) {}
|
||||
~FrameImpl() {}
|
||||
|
||||
/** Get the width */
|
||||
int32_t Width() override {
|
||||
return frame_->width();
|
||||
}
|
||||
|
||||
/** Get the height */
|
||||
int32_t Height() override {
|
||||
return frame_->height();
|
||||
}
|
||||
|
||||
/** Get the pixel format */
|
||||
::mynteye_jni::Format Format() override {
|
||||
return to_jni(frame_->format());
|
||||
}
|
||||
|
||||
/** Get the size */
|
||||
int32_t Size() override {
|
||||
return frame_->size();
|
||||
}
|
||||
|
||||
/** Get the data */
|
||||
std::vector<uint8_t> Data() override {
|
||||
return std::vector<uint8_t>(frame_->data(), frame_->data() + frame_->size());
|
||||
}
|
||||
|
||||
frame_t RawFrame() const {
|
||||
return frame_;
|
||||
}
|
||||
|
||||
private:
|
||||
frame_t frame_;
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
|
||||
#include "mynteye/mynteye.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
struct MYNTEYE_API UsbInfo {
|
||||
int vid;
|
||||
int pid;
|
||||
int fd;
|
||||
int busnum;
|
||||
int devaddr;
|
||||
std::string usbfs;
|
||||
std::string name;
|
||||
std::string serial;
|
||||
};
|
||||
|
||||
MYNTEYE_API void set_usb_infos(const std::vector<UsbInfo> &infos);
|
||||
MYNTEYE_API std::vector<UsbInfo> get_usb_infos();
|
||||
|
||||
MYNTEYE_END_NAMESPACE
|
|
@ -0,0 +1,17 @@
|
|||
#pragma once
|
||||
|
||||
#include "usb_info.h"
|
||||
|
||||
MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
namespace uvc {
|
||||
|
||||
struct device;
|
||||
|
||||
MYNTEYE_API std::shared_ptr<device> create_device(UsbInfo info);
|
||||
|
||||
MYNTEYE_API void set_bytes_per_packet(int bytes);
|
||||
|
||||
} // namespace uvc
|
||||
|
||||
MYNTEYE_END_NAMESPACE
|
|
@ -0,0 +1,33 @@
|
|||
#pragma once
|
||||
|
||||
#include "mynteye/device/callbacks.h"
|
||||
|
||||
#include "imu_data.hpp"
|
||||
#include "motion_data.hpp"
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
class MotionDataImpl : public MotionData {
|
||||
public:
|
||||
using motion_data_t = MYNTEYE_NAMESPACE::device::MotionData;
|
||||
|
||||
explicit MotionDataImpl(const motion_data_t& data) : data_(data) {}
|
||||
~MotionDataImpl() {}
|
||||
|
||||
ImuData Imu() override {
|
||||
auto&& imu = data_.imu;
|
||||
return {
|
||||
imu->frame_id,
|
||||
imu->flag,
|
||||
static_cast<int64_t>(imu->timestamp),
|
||||
std::vector<double>(imu->accel, imu->accel + 3),
|
||||
std::vector<double>(imu->gyro, imu->gyro + 3),
|
||||
imu->temperature,
|
||||
};
|
||||
}
|
||||
|
||||
private:
|
||||
motion_data_t data_;
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
|
@ -0,0 +1,39 @@
|
|||
#pragma once
|
||||
|
||||
#include "mynteye/device/callbacks.h"
|
||||
|
||||
#include "frame_impl.hpp"
|
||||
#include "img_data.hpp"
|
||||
#include "stream_data.hpp"
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
class StreamDataImpl : public StreamData {
|
||||
public:
|
||||
using stream_data_t = MYNTEYE_NAMESPACE::device::StreamData;
|
||||
|
||||
explicit StreamDataImpl(const stream_data_t& data) : data_(data) {}
|
||||
~StreamDataImpl() {}
|
||||
|
||||
ImgData Img() override {
|
||||
auto&& img = data_.img;
|
||||
return {
|
||||
img->frame_id,
|
||||
static_cast<int64_t>(img->timestamp),
|
||||
img->exposure_time,
|
||||
};
|
||||
}
|
||||
|
||||
std::shared_ptr<::mynteye_jni::Frame> Frame() override {
|
||||
return std::make_shared<::mynteye_jni::FrameImpl>(data_.frame);
|
||||
}
|
||||
|
||||
int64_t FrameId() override {
|
||||
return data_.frame_id;
|
||||
}
|
||||
|
||||
private:
|
||||
stream_data_t data_;
|
||||
};
|
||||
|
||||
} // namespace mynteye_jni
|
|
@ -0,0 +1,413 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#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"
|
||||
|
||||
#include "internal/usb_info.h"
|
||||
|
||||
namespace mynteye_jni {
|
||||
|
||||
// device_usb_info
|
||||
|
||||
using RawUsbInfo = MYNTEYE_NAMESPACE::UsbInfo;
|
||||
using JniUsbInfo = mynteye_jni::DeviceUsbInfo;
|
||||
|
||||
inline
|
||||
RawUsbInfo from_jni(const JniUsbInfo& info) {
|
||||
RawUsbInfo raw;
|
||||
raw.vid = info.vid;
|
||||
raw.pid = info.pid;
|
||||
raw.fd = info.fd;
|
||||
raw.busnum = info.bus_num;
|
||||
raw.devaddr = info.dev_num;
|
||||
raw.usbfs = info.usb_fs;
|
||||
raw.name = info.name;
|
||||
raw.serial = info.serial;
|
||||
return std::move(raw);
|
||||
}
|
||||
|
||||
inline
|
||||
JniUsbInfo to_jni(const RawUsbInfo& info) {
|
||||
return JniUsbInfo{
|
||||
info.vid,
|
||||
info.pid,
|
||||
info.fd,
|
||||
info.busnum,
|
||||
info.devaddr,
|
||||
info.usbfs,
|
||||
info.name,
|
||||
info.serial,
|
||||
};
|
||||
}
|
||||
|
||||
// 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<int n>
|
||||
std::vector<double> to_vector(double (&vector)[n]) {
|
||||
std::vector<double> datas;
|
||||
for (int i = 0; i < n; i++) {
|
||||
datas.push_back(vector[i]);
|
||||
}
|
||||
return datas;
|
||||
}
|
||||
|
||||
template<int rows, int cols>
|
||||
std::vector<double> to_vector(double (&matrix)[rows][cols]) {
|
||||
std::vector<double> 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
|
|
@ -0,0 +1,117 @@
|
|||
#include <android/bitmap.h>
|
||||
#include <android/log.h>
|
||||
#include <jni.h>
|
||||
|
||||
#ifndef LOG_TAG
|
||||
#define LOG_TAG "native"
|
||||
#endif
|
||||
|
||||
#define LOGI(...) \
|
||||
((void)__android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
|
||||
#define LOGW(...) \
|
||||
((void)__android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__))
|
||||
#define LOGE(...) \
|
||||
((void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
|
||||
|
||||
#include "NativeFrame.hpp"
|
||||
|
||||
#include "frame_impl.hpp"
|
||||
|
||||
// BitmapUtils
|
||||
|
||||
// RGBA
|
||||
typedef struct {
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t a;
|
||||
} rgba_t;
|
||||
|
||||
void copyPixelsGray(std::uint8_t *from, rgba_t *to, uint32_t n);
|
||||
void copyPixelsBGR3(std::uint8_t *from, rgba_t *to, uint32_t n);
|
||||
void copyPixelsRGB3(std::uint8_t *from, rgba_t *to, uint32_t n);
|
||||
|
||||
void copyPixels(mynteye_jni::FrameImpl::frame_t from, rgba_t *to,
|
||||
const AndroidBitmapInfo &info) {
|
||||
if (info.width != from->width() || info.height != from->height()) {
|
||||
LOGE("Frame size is not same");
|
||||
return;
|
||||
}
|
||||
uint32_t n = info.width * info.height;
|
||||
switch (from->format()) {
|
||||
case MYNTEYE_NAMESPACE::Format::GREY:
|
||||
copyPixelsGray(from->data(), to, n);
|
||||
return;
|
||||
case MYNTEYE_NAMESPACE::Format::BGR888:
|
||||
copyPixelsBGR3(from->data(), to, n);
|
||||
return;
|
||||
case MYNTEYE_NAMESPACE::Format::RGB888:
|
||||
copyPixelsRGB3(from->data(), to, n);
|
||||
return;
|
||||
case MYNTEYE_NAMESPACE::Format::YUYV:
|
||||
default:
|
||||
LOGE("Frame format is not supported");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
CJNIEXPORT void JNICALL Java_com_slightech_mynteye_util_BitmapUtils_copyPixels(
|
||||
JNIEnv *env, jclass clazz, jobject j_frame, jobject bitmap) {
|
||||
auto frame = ::djinni_generated::NativeFrame::toCpp(env, j_frame);
|
||||
// LOGI("frame format: %dx%d", frame->Width(), frame->Height());
|
||||
auto frame_raw = std::dynamic_pointer_cast<mynteye_jni::FrameImpl>(frame)->RawFrame();
|
||||
|
||||
AndroidBitmapInfo info;
|
||||
int result;
|
||||
if ((result = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {
|
||||
LOGE("AndroidBitmap_getInfo() failed, error=%d", result);
|
||||
return;
|
||||
}
|
||||
if (info.format != ANDROID_BITMAP_FORMAT_RGBA_8888) {
|
||||
LOGE("Bitmap format is not RGBA_8888!");
|
||||
return;
|
||||
}
|
||||
|
||||
void *pixels;
|
||||
if ((result = AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0) {
|
||||
LOGE("AndroidBitmap_lockPixels() failed, error=%d", result);
|
||||
}
|
||||
rgba_t *rgba_pixels = static_cast<rgba_t*>(pixels);
|
||||
|
||||
copyPixels(frame_raw, rgba_pixels, info);
|
||||
|
||||
AndroidBitmap_unlockPixels(env, bitmap);
|
||||
}
|
||||
|
||||
void copyPixelsGray(std::uint8_t *from, rgba_t *to, uint32_t n) {
|
||||
for (uint32_t i = 0; i < n; ++i) {
|
||||
std::uint8_t &gray = from[i];
|
||||
rgba_t &rgba = to[i];
|
||||
rgba.r = gray;
|
||||
rgba.g = gray;
|
||||
rgba.b = gray;
|
||||
rgba.a = 255;
|
||||
}
|
||||
}
|
||||
|
||||
void copyPixelsBGR3(std::uint8_t *from, rgba_t *to, uint32_t n) {
|
||||
for (uint32_t i = 0; i < n; ++i) {
|
||||
std::uint8_t *bgr = from + (i*3);
|
||||
rgba_t &rgba = to[i];
|
||||
rgba.r = *(bgr + 2);
|
||||
rgba.g = *(bgr + 1);
|
||||
rgba.b = *(bgr);
|
||||
rgba.a = 255;
|
||||
}
|
||||
}
|
||||
|
||||
void copyPixelsRGB3(std::uint8_t *from, rgba_t *to, uint32_t n) {
|
||||
for (uint32_t i = 0; i < n; ++i) {
|
||||
std::uint8_t *rgb = from + (i*3);
|
||||
rgba_t &rgba = to[i];
|
||||
rgba.r = *(rgb);
|
||||
rgba.g = *(rgb + 1);
|
||||
rgba.b = *(rgb + 2);
|
||||
rgba.a = 255;
|
||||
}
|
||||
}
|
|
@ -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<CppType>(::djinni::JniClass<NativeAddon>::get().ordinal(jniEnv, j)); }
|
||||
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass<NativeAddon>::get().create(jniEnv, static_cast<jint>(c)); }
|
||||
|
||||
private:
|
||||
NativeAddon() : JniEnum("com/slightech/mynteye/Addon") {}
|
||||
friend ::djinni::JniClass<NativeAddon>;
|
||||
};
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -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<CppType>(::djinni::JniClass<NativeCalibrationModel>::get().ordinal(jniEnv, j)); }
|
||||
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass<NativeCalibrationModel>::get().create(jniEnv, static_cast<jint>(c)); }
|
||||
|
||||
private:
|
||||
NativeCalibrationModel() : JniEnum("com/slightech/mynteye/CalibrationModel") {}
|
||||
friend ::djinni::JniClass<NativeCalibrationModel>;
|
||||
};
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -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<CppType>(::djinni::JniClass<NativeCapability>::get().ordinal(jniEnv, j)); }
|
||||
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass<NativeCapability>::get().create(jniEnv, static_cast<jint>(c)); }
|
||||
|
||||
private:
|
||||
NativeCapability() : JniEnum("com/slightech/mynteye/Capability") {}
|
||||
friend ::djinni::JniClass<NativeCapability>;
|
||||
};
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -0,0 +1,272 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye.djinni
|
||||
|
||||
#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"
|
||||
#include "NativeStreamRequest.hpp"
|
||||
|
||||
namespace djinni_generated {
|
||||
|
||||
NativeDevice::NativeDevice() : ::djinni::JniInterface<::mynteye_jni::Device, NativeDevice>("com/slightech/mynteye/Device$CppProxy") {}
|
||||
|
||||
NativeDevice::~NativeDevice() = default;
|
||||
|
||||
|
||||
CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
||||
{
|
||||
try {
|
||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||
delete reinterpret_cast<::djinni::CppProxyHandle<::mynteye_jni::Device>*>(nativeRef);
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
|
||||
}
|
||||
|
||||
CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_create(JNIEnv* jniEnv, jobject /*this*/, ::djinni_generated::NativeDeviceUsbInfo::JniType j_info)
|
||||
{
|
||||
try {
|
||||
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
|
||||
auto r = ::mynteye_jni::Device::Create(::djinni_generated::NativeDeviceUsbInfo::toCpp(jniEnv, j_info));
|
||||
return ::djinni::release(::djinni_generated::NativeDevice::fromCpp(jniEnv, r));
|
||||
} 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 {
|
||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef);
|
||||
auto r = ref->GetStreamRequests();
|
||||
return ::djinni::release(::djinni::List<::djinni_generated::NativeStreamRequest>::fromCpp(jniEnv, r));
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
|
||||
}
|
||||
|
||||
CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1configStreamRequest(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeStreamRequest::JniType j_request)
|
||||
{
|
||||
try {
|
||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef);
|
||||
ref->ConfigStreamRequest(::djinni_generated::NativeStreamRequest::toCpp(jniEnv, j_request));
|
||||
} 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 {
|
||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef);
|
||||
ref->Start(::djinni_generated::NativeSource::toCpp(jniEnv, j_source));
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
|
||||
}
|
||||
|
||||
CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1stop(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeSource::JniType j_source)
|
||||
{
|
||||
try {
|
||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef);
|
||||
ref->Stop(::djinni_generated::NativeSource::toCpp(jniEnv, j_source));
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
|
||||
}
|
||||
|
||||
CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1waitForStreams(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
||||
{
|
||||
try {
|
||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef);
|
||||
ref->WaitForStreams();
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
|
||||
}
|
||||
|
||||
CJNIEXPORT ::djinni_generated::NativeStreamData::JniType JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1getStreamData(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->GetStreamData(::djinni_generated::NativeStream::toCpp(jniEnv, j_stream));
|
||||
return ::djinni::release(::djinni_generated::NativeStreamData::fromCpp(jniEnv, r));
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
|
||||
}
|
||||
|
||||
CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1getStreamDatas(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->GetStreamDatas(::djinni_generated::NativeStream::toCpp(jniEnv, j_stream));
|
||||
return ::djinni::release(::djinni::List<::djinni_generated::NativeStreamData>::fromCpp(jniEnv, r));
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
|
||||
}
|
||||
|
||||
CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1enableMotionDatas(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jint j_maxSize)
|
||||
{
|
||||
try {
|
||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef);
|
||||
ref->EnableMotionDatas(::djinni::I32::toCpp(jniEnv, j_maxSize));
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
|
||||
}
|
||||
|
||||
CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1getMotionDatas(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
||||
{
|
||||
try {
|
||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef);
|
||||
auto r = ref->GetMotionDatas();
|
||||
return ::djinni::release(::djinni::List<::djinni_generated::NativeMotionData>::fromCpp(jniEnv, r));
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
|
||||
}
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -0,0 +1,32 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "device.hpp"
|
||||
#include "djinni_support.hpp"
|
||||
|
||||
namespace djinni_generated {
|
||||
|
||||
class NativeDevice final : ::djinni::JniInterface<::mynteye_jni::Device, NativeDevice> {
|
||||
public:
|
||||
using CppType = std::shared_ptr<::mynteye_jni::Device>;
|
||||
using CppOptType = std::shared_ptr<::mynteye_jni::Device>;
|
||||
using JniType = jobject;
|
||||
|
||||
using Boxed = NativeDevice;
|
||||
|
||||
~NativeDevice();
|
||||
|
||||
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeDevice>::get()._fromJava(jniEnv, j); }
|
||||
static ::djinni::LocalRef<JniType> fromCppOpt(JNIEnv* jniEnv, const CppOptType& c) { return {jniEnv, ::djinni::JniClass<NativeDevice>::get()._toJava(jniEnv, c)}; }
|
||||
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return fromCppOpt(jniEnv, c); }
|
||||
|
||||
private:
|
||||
NativeDevice();
|
||||
friend ::djinni::JniClass<NativeDevice>;
|
||||
friend ::djinni::JniInterface<::mynteye_jni::Device, NativeDevice>;
|
||||
|
||||
};
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -0,0 +1,42 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#include "NativeDeviceUsbInfo.hpp" // my header
|
||||
#include "Marshal.hpp"
|
||||
|
||||
namespace djinni_generated {
|
||||
|
||||
NativeDeviceUsbInfo::NativeDeviceUsbInfo() = default;
|
||||
|
||||
NativeDeviceUsbInfo::~NativeDeviceUsbInfo() = default;
|
||||
|
||||
auto NativeDeviceUsbInfo::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
|
||||
const auto& data = ::djinni::JniClass<NativeDeviceUsbInfo>::get();
|
||||
auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
|
||||
::djinni::get(::djinni::I32::fromCpp(jniEnv, c.vid)),
|
||||
::djinni::get(::djinni::I32::fromCpp(jniEnv, c.pid)),
|
||||
::djinni::get(::djinni::I32::fromCpp(jniEnv, c.fd)),
|
||||
::djinni::get(::djinni::I32::fromCpp(jniEnv, c.bus_num)),
|
||||
::djinni::get(::djinni::I32::fromCpp(jniEnv, c.dev_num)),
|
||||
::djinni::get(::djinni::String::fromCpp(jniEnv, c.usb_fs)),
|
||||
::djinni::get(::djinni::String::fromCpp(jniEnv, c.name)),
|
||||
::djinni::get(::djinni::String::fromCpp(jniEnv, c.serial)))};
|
||||
::djinni::jniExceptionCheck(jniEnv);
|
||||
return r;
|
||||
}
|
||||
|
||||
auto NativeDeviceUsbInfo::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
|
||||
::djinni::JniLocalScope jscope(jniEnv, 9);
|
||||
assert(j != nullptr);
|
||||
const auto& data = ::djinni::JniClass<NativeDeviceUsbInfo>::get();
|
||||
return {::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mVid)),
|
||||
::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mPid)),
|
||||
::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mFd)),
|
||||
::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mBusNum)),
|
||||
::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mDevNum)),
|
||||
::djinni::String::toCpp(jniEnv, (jstring)jniEnv->GetObjectField(j, data.field_mUsbFs)),
|
||||
::djinni::String::toCpp(jniEnv, (jstring)jniEnv->GetObjectField(j, data.field_mName)),
|
||||
::djinni::String::toCpp(jniEnv, (jstring)jniEnv->GetObjectField(j, data.field_mSerial))};
|
||||
}
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -0,0 +1,39 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "device_usb_info.hpp"
|
||||
#include "djinni_support.hpp"
|
||||
|
||||
namespace djinni_generated {
|
||||
|
||||
class NativeDeviceUsbInfo final {
|
||||
public:
|
||||
using CppType = ::mynteye_jni::DeviceUsbInfo;
|
||||
using JniType = jobject;
|
||||
|
||||
using Boxed = NativeDeviceUsbInfo;
|
||||
|
||||
~NativeDeviceUsbInfo();
|
||||
|
||||
static CppType toCpp(JNIEnv* jniEnv, JniType j);
|
||||
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
|
||||
|
||||
private:
|
||||
NativeDeviceUsbInfo();
|
||||
friend ::djinni::JniClass<NativeDeviceUsbInfo>;
|
||||
|
||||
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/slightech/mynteye/DeviceUsbInfo") };
|
||||
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(IIIIILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V") };
|
||||
const jfieldID field_mVid { ::djinni::jniGetFieldID(clazz.get(), "mVid", "I") };
|
||||
const jfieldID field_mPid { ::djinni::jniGetFieldID(clazz.get(), "mPid", "I") };
|
||||
const jfieldID field_mFd { ::djinni::jniGetFieldID(clazz.get(), "mFd", "I") };
|
||||
const jfieldID field_mBusNum { ::djinni::jniGetFieldID(clazz.get(), "mBusNum", "I") };
|
||||
const jfieldID field_mDevNum { ::djinni::jniGetFieldID(clazz.get(), "mDevNum", "I") };
|
||||
const jfieldID field_mUsbFs { ::djinni::jniGetFieldID(clazz.get(), "mUsbFs", "Ljava/lang/String;") };
|
||||
const jfieldID field_mName { ::djinni::jniGetFieldID(clazz.get(), "mName", "Ljava/lang/String;") };
|
||||
const jfieldID field_mSerial { ::djinni::jniGetFieldID(clazz.get(), "mSerial", "Ljava/lang/String;") };
|
||||
};
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -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<JniType> {
|
||||
const auto& data = ::djinni::JniClass<NativeExtrinsics>::get();
|
||||
auto r = ::djinni::LocalRef<JniType>{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<NativeExtrinsics>::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
|
|
@ -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<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
|
||||
|
||||
private:
|
||||
NativeExtrinsics();
|
||||
friend ::djinni::JniClass<NativeExtrinsics>;
|
||||
|
||||
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/slightech/mynteye/Extrinsics") };
|
||||
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(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
|
|
@ -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 "format.hpp"
|
||||
|
||||
namespace djinni_generated {
|
||||
|
||||
class NativeFormat final : ::djinni::JniEnum {
|
||||
public:
|
||||
using CppType = ::mynteye_jni::Format;
|
||||
using JniType = jobject;
|
||||
|
||||
using Boxed = NativeFormat;
|
||||
|
||||
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return static_cast<CppType>(::djinni::JniClass<NativeFormat>::get().ordinal(jniEnv, j)); }
|
||||
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass<NativeFormat>::get().create(jniEnv, static_cast<jint>(c)); }
|
||||
|
||||
private:
|
||||
NativeFormat() : JniEnum("com/slightech/mynteye/Format") {}
|
||||
friend ::djinni::JniClass<NativeFormat>;
|
||||
};
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -0,0 +1,73 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#include "NativeFrame.hpp" // my header
|
||||
#include "Marshal.hpp"
|
||||
#include "NativeFormat.hpp"
|
||||
|
||||
namespace djinni_generated {
|
||||
|
||||
NativeFrame::NativeFrame() : ::djinni::JniInterface<::mynteye_jni::Frame, NativeFrame>("com/slightech/mynteye/Frame$CppProxy") {}
|
||||
|
||||
NativeFrame::~NativeFrame() = default;
|
||||
|
||||
|
||||
CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Frame_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
||||
{
|
||||
try {
|
||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||
delete reinterpret_cast<::djinni::CppProxyHandle<::mynteye_jni::Frame>*>(nativeRef);
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
|
||||
}
|
||||
|
||||
CJNIEXPORT jint JNICALL Java_com_slightech_mynteye_Frame_00024CppProxy_native_1width(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
||||
{
|
||||
try {
|
||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Frame>(nativeRef);
|
||||
auto r = ref->Width();
|
||||
return ::djinni::release(::djinni::I32::fromCpp(jniEnv, r));
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
|
||||
}
|
||||
|
||||
CJNIEXPORT jint JNICALL Java_com_slightech_mynteye_Frame_00024CppProxy_native_1height(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
||||
{
|
||||
try {
|
||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Frame>(nativeRef);
|
||||
auto r = ref->Height();
|
||||
return ::djinni::release(::djinni::I32::fromCpp(jniEnv, r));
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
|
||||
}
|
||||
|
||||
CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_Frame_00024CppProxy_native_1format(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
||||
{
|
||||
try {
|
||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Frame>(nativeRef);
|
||||
auto r = ref->Format();
|
||||
return ::djinni::release(::djinni_generated::NativeFormat::fromCpp(jniEnv, r));
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
|
||||
}
|
||||
|
||||
CJNIEXPORT jint JNICALL Java_com_slightech_mynteye_Frame_00024CppProxy_native_1size(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
||||
{
|
||||
try {
|
||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Frame>(nativeRef);
|
||||
auto r = ref->Size();
|
||||
return ::djinni::release(::djinni::I32::fromCpp(jniEnv, r));
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
|
||||
}
|
||||
|
||||
CJNIEXPORT jbyteArray JNICALL Java_com_slightech_mynteye_Frame_00024CppProxy_native_1data(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
||||
{
|
||||
try {
|
||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Frame>(nativeRef);
|
||||
auto r = ref->Data();
|
||||
return ::djinni::release(::djinni::Binary::fromCpp(jniEnv, r));
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
|
||||
}
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -0,0 +1,32 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "djinni_support.hpp"
|
||||
#include "frame.hpp"
|
||||
|
||||
namespace djinni_generated {
|
||||
|
||||
class NativeFrame final : ::djinni::JniInterface<::mynteye_jni::Frame, NativeFrame> {
|
||||
public:
|
||||
using CppType = std::shared_ptr<::mynteye_jni::Frame>;
|
||||
using CppOptType = std::shared_ptr<::mynteye_jni::Frame>;
|
||||
using JniType = jobject;
|
||||
|
||||
using Boxed = NativeFrame;
|
||||
|
||||
~NativeFrame();
|
||||
|
||||
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeFrame>::get()._fromJava(jniEnv, j); }
|
||||
static ::djinni::LocalRef<JniType> fromCppOpt(JNIEnv* jniEnv, const CppOptType& c) { return {jniEnv, ::djinni::JniClass<NativeFrame>::get()._toJava(jniEnv, c)}; }
|
||||
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return fromCppOpt(jniEnv, c); }
|
||||
|
||||
private:
|
||||
NativeFrame();
|
||||
friend ::djinni::JniClass<NativeFrame>;
|
||||
friend ::djinni::JniInterface<::mynteye_jni::Frame, NativeFrame>;
|
||||
|
||||
};
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -0,0 +1,32 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#include "NativeImgData.hpp" // my header
|
||||
#include "Marshal.hpp"
|
||||
|
||||
namespace djinni_generated {
|
||||
|
||||
NativeImgData::NativeImgData() = default;
|
||||
|
||||
NativeImgData::~NativeImgData() = default;
|
||||
|
||||
auto NativeImgData::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
|
||||
const auto& data = ::djinni::JniClass<NativeImgData>::get();
|
||||
auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
|
||||
::djinni::get(::djinni::I64::fromCpp(jniEnv, c.frame_id)),
|
||||
::djinni::get(::djinni::I64::fromCpp(jniEnv, c.timestamp)),
|
||||
::djinni::get(::djinni::I64::fromCpp(jniEnv, c.exposure_time)))};
|
||||
::djinni::jniExceptionCheck(jniEnv);
|
||||
return r;
|
||||
}
|
||||
|
||||
auto NativeImgData::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
|
||||
::djinni::JniLocalScope jscope(jniEnv, 4);
|
||||
assert(j != nullptr);
|
||||
const auto& data = ::djinni::JniClass<NativeImgData>::get();
|
||||
return {::djinni::I64::toCpp(jniEnv, jniEnv->GetLongField(j, data.field_mFrameId)),
|
||||
::djinni::I64::toCpp(jniEnv, jniEnv->GetLongField(j, data.field_mTimestamp)),
|
||||
::djinni::I64::toCpp(jniEnv, jniEnv->GetLongField(j, data.field_mExposureTime))};
|
||||
}
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -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 "img_data.hpp"
|
||||
|
||||
namespace djinni_generated {
|
||||
|
||||
class NativeImgData final {
|
||||
public:
|
||||
using CppType = ::mynteye_jni::ImgData;
|
||||
using JniType = jobject;
|
||||
|
||||
using Boxed = NativeImgData;
|
||||
|
||||
~NativeImgData();
|
||||
|
||||
static CppType toCpp(JNIEnv* jniEnv, JniType j);
|
||||
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
|
||||
|
||||
private:
|
||||
NativeImgData();
|
||||
friend ::djinni::JniClass<NativeImgData>;
|
||||
|
||||
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/slightech/mynteye/ImgData") };
|
||||
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(JJJ)V") };
|
||||
const jfieldID field_mFrameId { ::djinni::jniGetFieldID(clazz.get(), "mFrameId", "J") };
|
||||
const jfieldID field_mTimestamp { ::djinni::jniGetFieldID(clazz.get(), "mTimestamp", "J") };
|
||||
const jfieldID field_mExposureTime { ::djinni::jniGetFieldID(clazz.get(), "mExposureTime", "J") };
|
||||
};
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -0,0 +1,38 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#include "NativeImuData.hpp" // my header
|
||||
#include "Marshal.hpp"
|
||||
|
||||
namespace djinni_generated {
|
||||
|
||||
NativeImuData::NativeImuData() = default;
|
||||
|
||||
NativeImuData::~NativeImuData() = default;
|
||||
|
||||
auto NativeImuData::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
|
||||
const auto& data = ::djinni::JniClass<NativeImuData>::get();
|
||||
auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
|
||||
::djinni::get(::djinni::I64::fromCpp(jniEnv, c.frame_id)),
|
||||
::djinni::get(::djinni::I32::fromCpp(jniEnv, c.flag)),
|
||||
::djinni::get(::djinni::I64::fromCpp(jniEnv, c.timestamp)),
|
||||
::djinni::get(::djinni::List<::djinni::F64>::fromCpp(jniEnv, c.accel)),
|
||||
::djinni::get(::djinni::List<::djinni::F64>::fromCpp(jniEnv, c.gyro)),
|
||||
::djinni::get(::djinni::F64::fromCpp(jniEnv, c.temperature)))};
|
||||
::djinni::jniExceptionCheck(jniEnv);
|
||||
return r;
|
||||
}
|
||||
|
||||
auto NativeImuData::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
|
||||
::djinni::JniLocalScope jscope(jniEnv, 7);
|
||||
assert(j != nullptr);
|
||||
const auto& data = ::djinni::JniClass<NativeImuData>::get();
|
||||
return {::djinni::I64::toCpp(jniEnv, jniEnv->GetLongField(j, data.field_mFrameId)),
|
||||
::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mFlag)),
|
||||
::djinni::I64::toCpp(jniEnv, jniEnv->GetLongField(j, data.field_mTimestamp)),
|
||||
::djinni::List<::djinni::F64>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mAccel)),
|
||||
::djinni::List<::djinni::F64>::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mGyro)),
|
||||
::djinni::F64::toCpp(jniEnv, jniEnv->GetDoubleField(j, data.field_mTemperature))};
|
||||
}
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -0,0 +1,37 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "djinni_support.hpp"
|
||||
#include "imu_data.hpp"
|
||||
|
||||
namespace djinni_generated {
|
||||
|
||||
class NativeImuData final {
|
||||
public:
|
||||
using CppType = ::mynteye_jni::ImuData;
|
||||
using JniType = jobject;
|
||||
|
||||
using Boxed = NativeImuData;
|
||||
|
||||
~NativeImuData();
|
||||
|
||||
static CppType toCpp(JNIEnv* jniEnv, JniType j);
|
||||
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
|
||||
|
||||
private:
|
||||
NativeImuData();
|
||||
friend ::djinni::JniClass<NativeImuData>;
|
||||
|
||||
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/slightech/mynteye/ImuData") };
|
||||
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(JIJLjava/util/ArrayList;Ljava/util/ArrayList;D)V") };
|
||||
const jfieldID field_mFrameId { ::djinni::jniGetFieldID(clazz.get(), "mFrameId", "J") };
|
||||
const jfieldID field_mFlag { ::djinni::jniGetFieldID(clazz.get(), "mFlag", "I") };
|
||||
const jfieldID field_mTimestamp { ::djinni::jniGetFieldID(clazz.get(), "mTimestamp", "J") };
|
||||
const jfieldID field_mAccel { ::djinni::jniGetFieldID(clazz.get(), "mAccel", "Ljava/util/ArrayList;") };
|
||||
const jfieldID field_mGyro { ::djinni::jniGetFieldID(clazz.get(), "mGyro", "Ljava/util/ArrayList;") };
|
||||
const jfieldID field_mTemperature { ::djinni::jniGetFieldID(clazz.get(), "mTemperature", "D") };
|
||||
};
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -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<JniType> {
|
||||
const auto& data = ::djinni::JniClass<NativeImuIntrinsics>::get();
|
||||
auto r = ::djinni::LocalRef<JniType>{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<NativeImuIntrinsics>::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
|
|
@ -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<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
|
||||
|
||||
private:
|
||||
NativeImuIntrinsics();
|
||||
friend ::djinni::JniClass<NativeImuIntrinsics>;
|
||||
|
||||
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/slightech/mynteye/ImuIntrinsics") };
|
||||
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(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
|
|
@ -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<CppType>(::djinni::JniClass<NativeInfo>::get().ordinal(jniEnv, j)); }
|
||||
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass<NativeInfo>::get().create(jniEnv, static_cast<jint>(c)); }
|
||||
|
||||
private:
|
||||
NativeInfo() : JniEnum("com/slightech/mynteye/Info") {}
|
||||
friend ::djinni::JniClass<NativeInfo>;
|
||||
};
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -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<JniType> {
|
||||
const auto& data = ::djinni::JniClass<NativeIntrinsics>::get();
|
||||
auto r = ::djinni::LocalRef<JniType>{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<NativeIntrinsics>::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
|
|
@ -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<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
|
||||
|
||||
private:
|
||||
NativeIntrinsics();
|
||||
friend ::djinni::JniClass<NativeIntrinsics>;
|
||||
|
||||
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/slightech/mynteye/Intrinsics") };
|
||||
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(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
|
|
@ -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 "model.hpp"
|
||||
|
||||
namespace djinni_generated {
|
||||
|
||||
class NativeModel final : ::djinni::JniEnum {
|
||||
public:
|
||||
using CppType = ::mynteye_jni::Model;
|
||||
using JniType = jobject;
|
||||
|
||||
using Boxed = NativeModel;
|
||||
|
||||
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return static_cast<CppType>(::djinni::JniClass<NativeModel>::get().ordinal(jniEnv, j)); }
|
||||
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass<NativeModel>::get().create(jniEnv, static_cast<jint>(c)); }
|
||||
|
||||
private:
|
||||
NativeModel() : JniEnum("com/slightech/mynteye/Model") {}
|
||||
friend ::djinni::JniClass<NativeModel>;
|
||||
};
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -0,0 +1,32 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#include "NativeMotionData.hpp" // my header
|
||||
#include "NativeImuData.hpp"
|
||||
|
||||
namespace djinni_generated {
|
||||
|
||||
NativeMotionData::NativeMotionData() : ::djinni::JniInterface<::mynteye_jni::MotionData, NativeMotionData>("com/slightech/mynteye/MotionData$CppProxy") {}
|
||||
|
||||
NativeMotionData::~NativeMotionData() = default;
|
||||
|
||||
|
||||
CJNIEXPORT void JNICALL Java_com_slightech_mynteye_MotionData_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
||||
{
|
||||
try {
|
||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||
delete reinterpret_cast<::djinni::CppProxyHandle<::mynteye_jni::MotionData>*>(nativeRef);
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
|
||||
}
|
||||
|
||||
CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_MotionData_00024CppProxy_native_1imu(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
||||
{
|
||||
try {
|
||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::MotionData>(nativeRef);
|
||||
auto r = ref->Imu();
|
||||
return ::djinni::release(::djinni_generated::NativeImuData::fromCpp(jniEnv, r));
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
|
||||
}
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -0,0 +1,32 @@
|
|||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||
// This file generated by Djinni from mynteye_types.djinni
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "djinni_support.hpp"
|
||||
#include "motion_data.hpp"
|
||||
|
||||
namespace djinni_generated {
|
||||
|
||||
class NativeMotionData final : ::djinni::JniInterface<::mynteye_jni::MotionData, NativeMotionData> {
|
||||
public:
|
||||
using CppType = std::shared_ptr<::mynteye_jni::MotionData>;
|
||||
using CppOptType = std::shared_ptr<::mynteye_jni::MotionData>;
|
||||
using JniType = jobject;
|
||||
|
||||
using Boxed = NativeMotionData;
|
||||
|
||||
~NativeMotionData();
|
||||
|
||||
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeMotionData>::get()._fromJava(jniEnv, j); }
|
||||
static ::djinni::LocalRef<JniType> fromCppOpt(JNIEnv* jniEnv, const CppOptType& c) { return {jniEnv, ::djinni::JniClass<NativeMotionData>::get()._toJava(jniEnv, c)}; }
|
||||
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return fromCppOpt(jniEnv, c); }
|
||||
|
||||
private:
|
||||
NativeMotionData();
|
||||
friend ::djinni::JniClass<NativeMotionData>;
|
||||
friend ::djinni::JniInterface<::mynteye_jni::MotionData, NativeMotionData>;
|
||||
|
||||
};
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -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<JniType> {
|
||||
const auto& data = ::djinni::JniClass<NativeMotionIntrinsics>::get();
|
||||
auto r = ::djinni::LocalRef<JniType>{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<NativeMotionIntrinsics>::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
|
|
@ -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<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
|
||||
|
||||
private:
|
||||
NativeMotionIntrinsics();
|
||||
friend ::djinni::JniClass<NativeMotionIntrinsics>;
|
||||
|
||||
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/slightech/mynteye/MotionIntrinsics") };
|
||||
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(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
|
|
@ -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<CppType>(::djinni::JniClass<NativeOption>::get().ordinal(jniEnv, j)); }
|
||||
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass<NativeOption>::get().create(jniEnv, static_cast<jint>(c)); }
|
||||
|
||||
private:
|
||||
NativeOption() : JniEnum("com/slightech/mynteye/Option") {}
|
||||
friend ::djinni::JniClass<NativeOption>;
|
||||
};
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -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<JniType> {
|
||||
const auto& data = ::djinni::JniClass<NativeOptionInfo>::get();
|
||||
auto r = ::djinni::LocalRef<JniType>{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<NativeOptionInfo>::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
|
|
@ -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<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
|
||||
|
||||
private:
|
||||
NativeOptionInfo();
|
||||
friend ::djinni::JniClass<NativeOptionInfo>;
|
||||
|
||||
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/slightech/mynteye/OptionInfo") };
|
||||
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(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
|
|
@ -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 "source.hpp"
|
||||
|
||||
namespace djinni_generated {
|
||||
|
||||
class NativeSource final : ::djinni::JniEnum {
|
||||
public:
|
||||
using CppType = ::mynteye_jni::Source;
|
||||
using JniType = jobject;
|
||||
|
||||
using Boxed = NativeSource;
|
||||
|
||||
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return static_cast<CppType>(::djinni::JniClass<NativeSource>::get().ordinal(jniEnv, j)); }
|
||||
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass<NativeSource>::get().create(jniEnv, static_cast<jint>(c)); }
|
||||
|
||||
private:
|
||||
NativeSource() : JniEnum("com/slightech/mynteye/Source") {}
|
||||
friend ::djinni::JniClass<NativeSource>;
|
||||
};
|
||||
|
||||
} // namespace djinni_generated
|
|
@ -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 "stream.hpp"
|
||||
|
||||
namespace djinni_generated {
|
||||
|
||||
class NativeStream final : ::djinni::JniEnum {
|
||||
public:
|
||||
using CppType = ::mynteye_jni::Stream;
|
||||
using JniType = jobject;
|
||||
|
||||
using Boxed = NativeStream;
|
||||
|
||||
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return static_cast<CppType>(::djinni::JniClass<NativeStream>::get().ordinal(jniEnv, j)); }
|
||||
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass<NativeStream>::get().create(jniEnv, static_cast<jint>(c)); }
|
||||
|
||||
private:
|
||||
NativeStream() : JniEnum("com/slightech/mynteye/Stream") {}
|
||||
friend ::djinni::JniClass<NativeStream>;
|
||||
};
|
||||
|
||||
} // namespace djinni_generated
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user