feat(android): add types and interfaces
This commit is contained in:
parent
1f7621debd
commit
cabaeb4794
|
@ -3,29 +3,55 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "device_usb_info.hpp"
|
||||||
|
#include "motion_data.hpp"
|
||||||
|
#include "source.hpp"
|
||||||
|
#include "stream.hpp"
|
||||||
|
#include "stream_data.hpp"
|
||||||
|
#include "stream_request.hpp"
|
||||||
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace mynteye_jni {
|
namespace mynteye_jni {
|
||||||
|
|
||||||
struct DeviceUsbInfo;
|
/** Device class to communicate with MYNT® EYE device */
|
||||||
struct StreamRequest;
|
|
||||||
|
|
||||||
class Device {
|
class Device {
|
||||||
public:
|
public:
|
||||||
virtual ~Device() {}
|
virtual ~Device() {}
|
||||||
|
|
||||||
static std::vector<DeviceUsbInfo> Query();
|
/** Query devices */
|
||||||
|
static std::vector<::mynteye_jni::DeviceUsbInfo> Query();
|
||||||
|
|
||||||
static std::shared_ptr<Device> Create(const DeviceUsbInfo & info);
|
/** Create the device instance */
|
||||||
|
static std::shared_ptr<Device> Create(const ::mynteye_jni::DeviceUsbInfo & info);
|
||||||
|
|
||||||
virtual std::vector<StreamRequest> GetStreamRequests() = 0;
|
/** Get all stream requests */
|
||||||
|
virtual std::vector<::mynteye_jni::StreamRequest> GetStreamRequests() = 0;
|
||||||
|
|
||||||
virtual void ConfigStreamRequest(const StreamRequest & request) = 0;
|
/** Config the stream request */
|
||||||
|
virtual void ConfigStreamRequest(const ::mynteye_jni::StreamRequest & request) = 0;
|
||||||
|
|
||||||
virtual void Start() = 0;
|
/** Start capturing the source */
|
||||||
|
virtual void Start(::mynteye_jni::Source source) = 0;
|
||||||
|
|
||||||
virtual void Stop() = 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 */
|
||||||
|
virtual void EnableCacheMotionDatas(int32_t max_size) = 0;
|
||||||
|
|
||||||
|
/** Get the motion datas */
|
||||||
|
virtual std::vector<std::shared_ptr<::mynteye_jni::MotionData>> GetMotionDatas() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mynteye_jni
|
} // namespace mynteye_jni
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
// This file generated by Djinni from mynteye.djinni
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -9,9 +9,13 @@
|
||||||
|
|
||||||
namespace mynteye_jni {
|
namespace mynteye_jni {
|
||||||
|
|
||||||
|
/** Device USB information */
|
||||||
struct DeviceUsbInfo final {
|
struct DeviceUsbInfo final {
|
||||||
|
/** Device index */
|
||||||
int32_t index;
|
int32_t index;
|
||||||
|
/** Device name */
|
||||||
std::string name;
|
std::string name;
|
||||||
|
/** Device serial number */
|
||||||
std::string sn;
|
std::string sn;
|
||||||
|
|
||||||
DeviceUsbInfo(int32_t index_,
|
DeviceUsbInfo(int32_t index_,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
// This file generated by Djinni from mynteye.djinni
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -8,9 +8,13 @@
|
||||||
namespace mynteye_jni {
|
namespace mynteye_jni {
|
||||||
|
|
||||||
enum class Format : int {
|
enum class Format : int {
|
||||||
|
/** Greyscale, 8 bits per pixel */
|
||||||
GREY,
|
GREY,
|
||||||
|
/** YUV 4:2:2, 16 bits per pixel */
|
||||||
YUYV,
|
YUYV,
|
||||||
|
/** BGR 8:8:8, 24 bits per pixel */
|
||||||
BGR888,
|
BGR888,
|
||||||
|
/** RGB 8:8:8, 24 bits per pixel */
|
||||||
RGB888,
|
RGB888,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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,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,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
|
|
@ -1,5 +1,5 @@
|
||||||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
// This file generated by Djinni from mynteye.djinni
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -9,11 +9,17 @@
|
||||||
|
|
||||||
namespace mynteye_jni {
|
namespace mynteye_jni {
|
||||||
|
|
||||||
|
/** Stream request */
|
||||||
struct StreamRequest final {
|
struct StreamRequest final {
|
||||||
|
/** Stream index */
|
||||||
int32_t index;
|
int32_t index;
|
||||||
|
/** Stream width in pixels */
|
||||||
int32_t width;
|
int32_t width;
|
||||||
|
/** Stream height in pixels */
|
||||||
int32_t height;
|
int32_t height;
|
||||||
|
/** Stream pixel format */
|
||||||
Format format;
|
Format format;
|
||||||
|
/** Stream frames per second */
|
||||||
int32_t fps;
|
int32_t fps;
|
||||||
|
|
||||||
StreamRequest(int32_t index_,
|
StreamRequest(int32_t index_,
|
||||||
|
|
|
@ -8,11 +8,15 @@
|
||||||
#include "stream_request.hpp"
|
#include "stream_request.hpp"
|
||||||
#include "type_conversion.hpp"
|
#include "type_conversion.hpp"
|
||||||
|
|
||||||
|
#include "frame_impl.hpp"
|
||||||
|
#include "motion_data_impl.hpp"
|
||||||
|
#include "stream_data_impl.hpp"
|
||||||
|
|
||||||
MYNTEYE_USE_NAMESPACE
|
MYNTEYE_USE_NAMESPACE
|
||||||
|
|
||||||
namespace mynteye_jni {
|
namespace mynteye_jni {
|
||||||
|
|
||||||
std::vector<DeviceUsbInfo> Device::Query() {
|
std::vector<::mynteye_jni::DeviceUsbInfo> Device::Query() {
|
||||||
VLOG(2) << __func__;
|
VLOG(2) << __func__;
|
||||||
std::vector<DeviceUsbInfo> infos;
|
std::vector<DeviceUsbInfo> infos;
|
||||||
|
|
||||||
|
@ -28,7 +32,7 @@ std::vector<DeviceUsbInfo> Device::Query() {
|
||||||
return infos;
|
return infos;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Device> Device::Create(const DeviceUsbInfo & info) {
|
std::shared_ptr<Device> Device::Create(const ::mynteye_jni::DeviceUsbInfo & info) {
|
||||||
VLOG(2) << __func__;
|
VLOG(2) << __func__;
|
||||||
Context context;
|
Context context;
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
|
@ -49,9 +53,9 @@ DeviceImpl::~DeviceImpl() {
|
||||||
VLOG(2) << __func__;
|
VLOG(2) << __func__;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<StreamRequest> DeviceImpl::GetStreamRequests() {
|
std::vector<::mynteye_jni::StreamRequest> DeviceImpl::GetStreamRequests() {
|
||||||
VLOG(2) << __func__;
|
VLOG(2) << __func__;
|
||||||
std::vector<StreamRequest> requests;
|
std::vector<::mynteye_jni::StreamRequest> requests;
|
||||||
|
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
for (auto&& req : device_->GetStreamRequests()) {
|
for (auto&& req : device_->GetStreamRequests()) {
|
||||||
|
@ -63,7 +67,8 @@ std::vector<StreamRequest> DeviceImpl::GetStreamRequests() {
|
||||||
return requests;
|
return requests;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceImpl::ConfigStreamRequest(const StreamRequest & request) {
|
void DeviceImpl::ConfigStreamRequest(
|
||||||
|
const ::mynteye_jni::StreamRequest & request) {
|
||||||
VLOG(2) << __func__;
|
VLOG(2) << __func__;
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
for (auto&& req : device_->GetStreamRequests()) {
|
for (auto&& req : device_->GetStreamRequests()) {
|
||||||
|
@ -75,12 +80,31 @@ void DeviceImpl::ConfigStreamRequest(const StreamRequest & request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceImpl::Start() {
|
void DeviceImpl::Start(::mynteye_jni::Source source) {
|
||||||
VLOG(2) << __func__;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceImpl::Stop() {
|
void DeviceImpl::Stop(::mynteye_jni::Source source) {
|
||||||
VLOG(2) << __func__;
|
}
|
||||||
|
|
||||||
|
void DeviceImpl::WaitForStreams() {
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<::mynteye_jni::StreamData> DeviceImpl::GetStreamData(
|
||||||
|
::mynteye_jni::Stream stream) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::shared_ptr<::mynteye_jni::StreamData>>
|
||||||
|
DeviceImpl::GetStreamDatas(::mynteye_jni::Stream stream) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceImpl::EnableCacheMotionDatas(int32_t max_size) {
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::shared_ptr<::mynteye_jni::MotionData>>
|
||||||
|
DeviceImpl::GetMotionDatas() {
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mynteye_jni
|
} // namespace mynteye_jni
|
||||||
|
|
|
@ -16,13 +16,32 @@ class DeviceImpl : public Device {
|
||||||
explicit DeviceImpl(const device_t & device);
|
explicit DeviceImpl(const device_t & device);
|
||||||
~DeviceImpl();
|
~DeviceImpl();
|
||||||
|
|
||||||
std::vector<StreamRequest> GetStreamRequests() override;
|
/** Get all stream requests */
|
||||||
|
std::vector<::mynteye_jni::StreamRequest> GetStreamRequests() override;
|
||||||
|
|
||||||
void ConfigStreamRequest(const StreamRequest & request) override;
|
/** Config the stream request */
|
||||||
|
void ConfigStreamRequest(const ::mynteye_jni::StreamRequest & request) override;
|
||||||
|
|
||||||
void Start() override;
|
/** Start capturing the source */
|
||||||
|
void Start(::mynteye_jni::Source source) override;
|
||||||
|
|
||||||
void Stop() 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 */
|
||||||
|
void EnableCacheMotionDatas(int32_t max_size) override;
|
||||||
|
|
||||||
|
/** Get the motion datas */
|
||||||
|
std::vector<std::shared_ptr<::mynteye_jni::MotionData>> GetMotionDatas() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
device_t device_;
|
device_t device_;
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
#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());
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
frame_t frame_;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace mynteye_jni
|
|
@ -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 = std::shared_ptr<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 = std::shared_ptr<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
|
|
@ -1,12 +1,42 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "mynteye/logger.h"
|
#include "mynteye/logger.h"
|
||||||
#include "mynteye/types.h"
|
#include "mynteye/types.h"
|
||||||
|
|
||||||
#include "format.hpp"
|
#include "format.hpp"
|
||||||
|
#include "model.hpp"
|
||||||
|
#include "source.hpp"
|
||||||
|
#include "stream.hpp"
|
||||||
|
|
||||||
namespace mynteye_jni {
|
namespace mynteye_jni {
|
||||||
|
|
||||||
|
using RawModel = MYNTEYE_NAMESPACE::Model;
|
||||||
|
using JniModel = mynteye_jni::Model;
|
||||||
|
|
||||||
|
inline
|
||||||
|
RawModel from_jni(const JniModel& model) {
|
||||||
|
switch (model) {
|
||||||
|
case JniModel::STANDARD: return RawModel::STANDARD;
|
||||||
|
case JniModel::STANDARD2: return RawModel::STANDARD2;
|
||||||
|
case JniModel::STANDARD210A: return RawModel::STANDARD210A;
|
||||||
|
default:
|
||||||
|
LOG(FATAL) << "Model is unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
JniModel to_jni(const RawModel& model) {
|
||||||
|
switch (model) {
|
||||||
|
case RawModel::STANDARD: return JniModel::STANDARD;
|
||||||
|
case RawModel::STANDARD2: return JniModel::STANDARD2;
|
||||||
|
case RawModel::STANDARD210A: return JniModel::STANDARD210A;
|
||||||
|
default:
|
||||||
|
LOG(FATAL) << "Model is unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
using RawFormat = MYNTEYE_NAMESPACE::Format;
|
using RawFormat = MYNTEYE_NAMESPACE::Format;
|
||||||
using JniFormat = mynteye_jni::Format;
|
using JniFormat = mynteye_jni::Format;
|
||||||
|
|
||||||
|
@ -34,4 +64,52 @@ JniFormat to_jni(const RawFormat& format) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using RawSource = MYNTEYE_NAMESPACE::Source;
|
||||||
|
using JniSource = mynteye_jni::Source;
|
||||||
|
|
||||||
|
inline
|
||||||
|
RawSource from_jni(const JniSource& source) {
|
||||||
|
switch (source) {
|
||||||
|
case JniSource::VIDEO_STREAMING: return RawSource::VIDEO_STREAMING;
|
||||||
|
case JniSource::MOTION_TRACKING: return RawSource::MOTION_TRACKING;
|
||||||
|
case JniSource::ALL: return RawSource::ALL;
|
||||||
|
default:
|
||||||
|
LOG(FATAL) << "Source is unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
JniSource to_jni(const RawSource& source) {
|
||||||
|
switch (source) {
|
||||||
|
case RawSource::VIDEO_STREAMING: return JniSource::VIDEO_STREAMING;
|
||||||
|
case RawSource::MOTION_TRACKING: return JniSource::MOTION_TRACKING;
|
||||||
|
case RawSource::ALL: return JniSource::ALL;
|
||||||
|
default:
|
||||||
|
LOG(FATAL) << "Source is unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
using RawStream = MYNTEYE_NAMESPACE::Stream;
|
||||||
|
using JniStream = mynteye_jni::Stream;
|
||||||
|
|
||||||
|
inline
|
||||||
|
RawStream from_jni(const JniStream& stream) {
|
||||||
|
switch (stream) {
|
||||||
|
case JniStream::LEFT: return RawStream::LEFT;
|
||||||
|
case JniStream::RIGHT: return RawStream::RIGHT;
|
||||||
|
default:
|
||||||
|
LOG(FATAL) << "Stream is unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
JniStream to_jni(const RawStream& stream) {
|
||||||
|
switch (stream) {
|
||||||
|
case RawStream::LEFT: return JniStream::LEFT;
|
||||||
|
case RawStream::RIGHT: return JniStream::RIGHT;
|
||||||
|
default:
|
||||||
|
LOG(FATAL) << "Stream is unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace mynteye_jni
|
} // namespace mynteye_jni
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
#include "NativeDevice.hpp" // my header
|
#include "NativeDevice.hpp" // my header
|
||||||
#include "Marshal.hpp"
|
#include "Marshal.hpp"
|
||||||
#include "NativeDeviceUsbInfo.hpp"
|
#include "NativeDeviceUsbInfo.hpp"
|
||||||
|
#include "NativeMotionData.hpp"
|
||||||
|
#include "NativeSource.hpp"
|
||||||
|
#include "NativeStream.hpp"
|
||||||
|
#include "NativeStreamData.hpp"
|
||||||
#include "NativeStreamRequest.hpp"
|
#include "NativeStreamRequest.hpp"
|
||||||
|
|
||||||
namespace djinni_generated {
|
namespace djinni_generated {
|
||||||
|
@ -30,7 +34,7 @@ CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_query
|
||||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
|
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
|
||||||
}
|
}
|
||||||
|
|
||||||
CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_create(JNIEnv* jniEnv, jobject /*this*/, jobject j_info)
|
CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_create(JNIEnv* jniEnv, jobject /*this*/, ::djinni_generated::NativeDeviceUsbInfo::JniType j_info)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
|
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
|
||||||
|
@ -49,7 +53,7 @@ CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_nativ
|
||||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
|
} 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, jobject j_request)
|
CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1configStreamRequest(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeStreamRequest::JniType j_request)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||||
|
@ -58,22 +62,70 @@ CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1
|
||||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
|
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
|
||||||
}
|
}
|
||||||
|
|
||||||
CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1start(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1start(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeSource::JniType j_source)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||||
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef);
|
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef);
|
||||||
ref->Start();
|
ref->Start(::djinni_generated::NativeSource::toCpp(jniEnv, j_source));
|
||||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
|
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
|
||||||
}
|
}
|
||||||
|
|
||||||
CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1stop(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1stop(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeSource::JniType j_source)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||||
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef);
|
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef);
|
||||||
ref->Stop();
|
ref->Stop(::djinni_generated::NativeSource::toCpp(jniEnv, j_source));
|
||||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
|
} 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_1enableCacheMotionDatas(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->EnableCacheMotionDatas(::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
|
} // namespace djinni_generated
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
// This file generated by Djinni from mynteye.djinni
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
#include "NativeDeviceUsbInfo.hpp" // my header
|
#include "NativeDeviceUsbInfo.hpp" // my header
|
||||||
#include "Marshal.hpp"
|
#include "Marshal.hpp"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
// This file generated by Djinni from mynteye.djinni
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
// This file generated by Djinni from mynteye.djinni
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
|
@ -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,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,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
|
|
@ -0,0 +1,54 @@
|
||||||
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
|
#include "NativeStreamData.hpp" // my header
|
||||||
|
#include "Marshal.hpp"
|
||||||
|
#include "NativeFrame.hpp"
|
||||||
|
#include "NativeImgData.hpp"
|
||||||
|
|
||||||
|
namespace djinni_generated {
|
||||||
|
|
||||||
|
NativeStreamData::NativeStreamData() : ::djinni::JniInterface<::mynteye_jni::StreamData, NativeStreamData>("com/slightech/mynteye/StreamData$CppProxy") {}
|
||||||
|
|
||||||
|
NativeStreamData::~NativeStreamData() = default;
|
||||||
|
|
||||||
|
|
||||||
|
CJNIEXPORT void JNICALL Java_com_slightech_mynteye_StreamData_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||||
|
delete reinterpret_cast<::djinni::CppProxyHandle<::mynteye_jni::StreamData>*>(nativeRef);
|
||||||
|
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
|
||||||
|
}
|
||||||
|
|
||||||
|
CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_StreamData_00024CppProxy_native_1img(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||||
|
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::StreamData>(nativeRef);
|
||||||
|
auto r = ref->Img();
|
||||||
|
return ::djinni::release(::djinni_generated::NativeImgData::fromCpp(jniEnv, r));
|
||||||
|
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
|
||||||
|
}
|
||||||
|
|
||||||
|
CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_StreamData_00024CppProxy_native_1frame(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||||
|
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::StreamData>(nativeRef);
|
||||||
|
auto r = ref->Frame();
|
||||||
|
return ::djinni::release(::djinni_generated::NativeFrame::fromCpp(jniEnv, r));
|
||||||
|
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
|
||||||
|
}
|
||||||
|
|
||||||
|
CJNIEXPORT jlong JNICALL Java_com_slightech_mynteye_StreamData_00024CppProxy_native_1frameId(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
|
||||||
|
const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::StreamData>(nativeRef);
|
||||||
|
auto r = ref->FrameId();
|
||||||
|
return ::djinni::release(::djinni::I64::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 "stream_data.hpp"
|
||||||
|
|
||||||
|
namespace djinni_generated {
|
||||||
|
|
||||||
|
class NativeStreamData final : ::djinni::JniInterface<::mynteye_jni::StreamData, NativeStreamData> {
|
||||||
|
public:
|
||||||
|
using CppType = std::shared_ptr<::mynteye_jni::StreamData>;
|
||||||
|
using CppOptType = std::shared_ptr<::mynteye_jni::StreamData>;
|
||||||
|
using JniType = jobject;
|
||||||
|
|
||||||
|
using Boxed = NativeStreamData;
|
||||||
|
|
||||||
|
~NativeStreamData();
|
||||||
|
|
||||||
|
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeStreamData>::get()._fromJava(jniEnv, j); }
|
||||||
|
static ::djinni::LocalRef<JniType> fromCppOpt(JNIEnv* jniEnv, const CppOptType& c) { return {jniEnv, ::djinni::JniClass<NativeStreamData>::get()._toJava(jniEnv, c)}; }
|
||||||
|
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return fromCppOpt(jniEnv, c); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
NativeStreamData();
|
||||||
|
friend ::djinni::JniClass<NativeStreamData>;
|
||||||
|
friend ::djinni::JniInterface<::mynteye_jni::StreamData, NativeStreamData>;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace djinni_generated
|
|
@ -1,5 +1,5 @@
|
||||||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
// This file generated by Djinni from mynteye.djinni
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
#include "NativeStreamRequest.hpp" // my header
|
#include "NativeStreamRequest.hpp" // my header
|
||||||
#include "Marshal.hpp"
|
#include "Marshal.hpp"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
// This file generated by Djinni from mynteye.djinni
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
|
@ -8,24 +8,49 @@ import androidx.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
/** Device class to communicate with MYNT® EYE device */
|
||||||
public interface Device {
|
public interface Device {
|
||||||
|
/** Get all stream requests */
|
||||||
@NonNull
|
@NonNull
|
||||||
public ArrayList<StreamRequest> getStreamRequests();
|
public ArrayList<com.slightech.mynteye.StreamRequest> getStreamRequests();
|
||||||
|
|
||||||
public void configStreamRequest(@NonNull StreamRequest request);
|
/** Config the stream request */
|
||||||
|
public void configStreamRequest(@NonNull com.slightech.mynteye.StreamRequest request);
|
||||||
|
|
||||||
public void start();
|
/** Start capturing the source */
|
||||||
|
public void start(@NonNull com.slightech.mynteye.Source source);
|
||||||
|
|
||||||
public void stop();
|
/** Stop capturing the source */
|
||||||
|
public void stop(@NonNull com.slightech.mynteye.Source source);
|
||||||
|
|
||||||
|
/** Wait the streams are ready */
|
||||||
|
public void waitForStreams();
|
||||||
|
|
||||||
|
/** Get the latest data of stream */
|
||||||
|
@Nullable
|
||||||
|
public com.slightech.mynteye.StreamData getStreamData(@NonNull com.slightech.mynteye.Stream stream);
|
||||||
|
|
||||||
|
/** Get the datas of stream */
|
||||||
@NonNull
|
@NonNull
|
||||||
public static ArrayList<DeviceUsbInfo> query()
|
public ArrayList<com.slightech.mynteye.StreamData> getStreamDatas(@NonNull com.slightech.mynteye.Stream stream);
|
||||||
|
|
||||||
|
/** Enable cache motion datas */
|
||||||
|
public void enableCacheMotionDatas(int maxSize);
|
||||||
|
|
||||||
|
/** Get the motion datas */
|
||||||
|
@NonNull
|
||||||
|
public ArrayList<com.slightech.mynteye.MotionData> getMotionDatas();
|
||||||
|
|
||||||
|
/** Query devices */
|
||||||
|
@NonNull
|
||||||
|
public static ArrayList<com.slightech.mynteye.DeviceUsbInfo> query()
|
||||||
{
|
{
|
||||||
return CppProxy.query();
|
return CppProxy.query();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create the device instance */
|
||||||
@Nullable
|
@Nullable
|
||||||
public static Device create(@NonNull DeviceUsbInfo info)
|
public static Device create(@NonNull com.slightech.mynteye.DeviceUsbInfo info)
|
||||||
{
|
{
|
||||||
return CppProxy.create(info);
|
return CppProxy.create(info);
|
||||||
}
|
}
|
||||||
|
@ -54,41 +79,81 @@ public interface Device {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<StreamRequest> getStreamRequests()
|
public ArrayList<com.slightech.mynteye.StreamRequest> getStreamRequests()
|
||||||
{
|
{
|
||||||
assert !this.destroyed.get() : "trying to use a destroyed object";
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
return native_getStreamRequests(this.nativeRef);
|
return native_getStreamRequests(this.nativeRef);
|
||||||
}
|
}
|
||||||
private native ArrayList<StreamRequest> native_getStreamRequests(long _nativeRef);
|
private native ArrayList<com.slightech.mynteye.StreamRequest> native_getStreamRequests(long _nativeRef);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configStreamRequest(StreamRequest request)
|
public void configStreamRequest(com.slightech.mynteye.StreamRequest request)
|
||||||
{
|
{
|
||||||
assert !this.destroyed.get() : "trying to use a destroyed object";
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
native_configStreamRequest(this.nativeRef, request);
|
native_configStreamRequest(this.nativeRef, request);
|
||||||
}
|
}
|
||||||
private native void native_configStreamRequest(long _nativeRef, StreamRequest request);
|
private native void native_configStreamRequest(long _nativeRef, com.slightech.mynteye.StreamRequest request);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start()
|
public void start(com.slightech.mynteye.Source source)
|
||||||
{
|
{
|
||||||
assert !this.destroyed.get() : "trying to use a destroyed object";
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
native_start(this.nativeRef);
|
native_start(this.nativeRef, source);
|
||||||
}
|
}
|
||||||
private native void native_start(long _nativeRef);
|
private native void native_start(long _nativeRef, com.slightech.mynteye.Source source);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stop()
|
public void stop(com.slightech.mynteye.Source source)
|
||||||
{
|
{
|
||||||
assert !this.destroyed.get() : "trying to use a destroyed object";
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
native_stop(this.nativeRef);
|
native_stop(this.nativeRef, source);
|
||||||
}
|
}
|
||||||
private native void native_stop(long _nativeRef);
|
private native void native_stop(long _nativeRef, com.slightech.mynteye.Source source);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void waitForStreams()
|
||||||
|
{
|
||||||
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
|
native_waitForStreams(this.nativeRef);
|
||||||
|
}
|
||||||
|
private native void native_waitForStreams(long _nativeRef);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public com.slightech.mynteye.StreamData getStreamData(com.slightech.mynteye.Stream stream)
|
||||||
|
{
|
||||||
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
|
return native_getStreamData(this.nativeRef, stream);
|
||||||
|
}
|
||||||
|
private native com.slightech.mynteye.StreamData native_getStreamData(long _nativeRef, com.slightech.mynteye.Stream stream);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<com.slightech.mynteye.StreamData> getStreamDatas(com.slightech.mynteye.Stream stream)
|
||||||
|
{
|
||||||
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
|
return native_getStreamDatas(this.nativeRef, stream);
|
||||||
|
}
|
||||||
|
private native ArrayList<com.slightech.mynteye.StreamData> native_getStreamDatas(long _nativeRef, com.slightech.mynteye.Stream stream);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enableCacheMotionDatas(int maxSize)
|
||||||
|
{
|
||||||
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
|
native_enableCacheMotionDatas(this.nativeRef, maxSize);
|
||||||
|
}
|
||||||
|
private native void native_enableCacheMotionDatas(long _nativeRef, int maxSize);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<com.slightech.mynteye.MotionData> getMotionDatas()
|
||||||
|
{
|
||||||
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
|
return native_getMotionDatas(this.nativeRef);
|
||||||
|
}
|
||||||
|
private native ArrayList<com.slightech.mynteye.MotionData> native_getMotionDatas(long _nativeRef);
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public static native ArrayList<DeviceUsbInfo> query();
|
public static native ArrayList<com.slightech.mynteye.DeviceUsbInfo> query();
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static native Device create(@NonNull DeviceUsbInfo info);
|
public static native Device create(@NonNull com.slightech.mynteye.DeviceUsbInfo info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
// This file generated by Djinni from mynteye.djinni
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
package com.slightech.mynteye;
|
package com.slightech.mynteye;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
/** Device USB information */
|
||||||
public final class DeviceUsbInfo {
|
public final class DeviceUsbInfo {
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,15 +25,18 @@ public final class DeviceUsbInfo {
|
||||||
this.mSn = sn;
|
this.mSn = sn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Device index */
|
||||||
public int getIndex() {
|
public int getIndex() {
|
||||||
return mIndex;
|
return mIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Device name */
|
||||||
@NonNull
|
@NonNull
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return mName;
|
return mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Device serial number */
|
||||||
@NonNull
|
@NonNull
|
||||||
public String getSn() {
|
public String getSn() {
|
||||||
return mSn;
|
return mSn;
|
||||||
|
|
|
@ -1,15 +1,20 @@
|
||||||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
// This file generated by Djinni from mynteye.djinni
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
package com.slightech.mynteye;
|
package com.slightech.mynteye;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
/** Formats define how each stream can be encoded */
|
||||||
public enum Format {
|
public enum Format {
|
||||||
|
/** Greyscale, 8 bits per pixel */
|
||||||
GREY,
|
GREY,
|
||||||
|
/** YUV 4:2:2, 16 bits per pixel */
|
||||||
YUYV,
|
YUYV,
|
||||||
|
/** BGR 8:8:8, 24 bits per pixel */
|
||||||
BGR888,
|
BGR888,
|
||||||
|
/** RGB 8:8:8, 24 bits per pixel */
|
||||||
RGB888,
|
RGB888,
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
|
package com.slightech.mynteye;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
/** Frame with raw data */
|
||||||
|
public interface Frame {
|
||||||
|
/** Get the width */
|
||||||
|
public int width();
|
||||||
|
|
||||||
|
/** Get the height */
|
||||||
|
public int height();
|
||||||
|
|
||||||
|
/** Get the pixel format */
|
||||||
|
@NonNull
|
||||||
|
public Format format();
|
||||||
|
|
||||||
|
/** Get the size */
|
||||||
|
public int size();
|
||||||
|
|
||||||
|
/** Get the data */
|
||||||
|
@NonNull
|
||||||
|
public byte[] data();
|
||||||
|
|
||||||
|
static final class CppProxy implements Frame
|
||||||
|
{
|
||||||
|
private final long nativeRef;
|
||||||
|
private final AtomicBoolean destroyed = new AtomicBoolean(false);
|
||||||
|
|
||||||
|
private CppProxy(long nativeRef)
|
||||||
|
{
|
||||||
|
if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
|
||||||
|
this.nativeRef = nativeRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
private native void nativeDestroy(long nativeRef);
|
||||||
|
public void _djinni_private_destroy()
|
||||||
|
{
|
||||||
|
boolean destroyed = this.destroyed.getAndSet(true);
|
||||||
|
if (!destroyed) nativeDestroy(this.nativeRef);
|
||||||
|
}
|
||||||
|
protected void finalize() throws java.lang.Throwable
|
||||||
|
{
|
||||||
|
_djinni_private_destroy();
|
||||||
|
super.finalize();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int width()
|
||||||
|
{
|
||||||
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
|
return native_width(this.nativeRef);
|
||||||
|
}
|
||||||
|
private native int native_width(long _nativeRef);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int height()
|
||||||
|
{
|
||||||
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
|
return native_height(this.nativeRef);
|
||||||
|
}
|
||||||
|
private native int native_height(long _nativeRef);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Format format()
|
||||||
|
{
|
||||||
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
|
return native_format(this.nativeRef);
|
||||||
|
}
|
||||||
|
private native Format native_format(long _nativeRef);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int size()
|
||||||
|
{
|
||||||
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
|
return native_size(this.nativeRef);
|
||||||
|
}
|
||||||
|
private native int native_size(long _nativeRef);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] data()
|
||||||
|
{
|
||||||
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
|
return native_data(this.nativeRef);
|
||||||
|
}
|
||||||
|
private native byte[] native_data(long _nativeRef);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
|
package com.slightech.mynteye;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
/** Image data */
|
||||||
|
public final class ImgData {
|
||||||
|
|
||||||
|
|
||||||
|
/*package*/ final long mFrameId;
|
||||||
|
|
||||||
|
/*package*/ final long mTimestamp;
|
||||||
|
|
||||||
|
/*package*/ final long mExposureTime;
|
||||||
|
|
||||||
|
public ImgData(
|
||||||
|
long frameId,
|
||||||
|
long timestamp,
|
||||||
|
long exposureTime) {
|
||||||
|
this.mFrameId = frameId;
|
||||||
|
this.mTimestamp = timestamp;
|
||||||
|
this.mExposureTime = exposureTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Image frame id */
|
||||||
|
public long getFrameId() {
|
||||||
|
return mFrameId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Image timestamp in 1us */
|
||||||
|
public long getTimestamp() {
|
||||||
|
return mTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Image exposure time, virtual value in [1, 480] */
|
||||||
|
public long getExposureTime() {
|
||||||
|
return mExposureTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ImgData{" +
|
||||||
|
"mFrameId=" + mFrameId +
|
||||||
|
"," + "mTimestamp=" + mTimestamp +
|
||||||
|
"," + "mExposureTime=" + mExposureTime +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
|
package com.slightech.mynteye;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/** IMU data */
|
||||||
|
public final class ImuData {
|
||||||
|
|
||||||
|
|
||||||
|
/*package*/ final long mFrameId;
|
||||||
|
|
||||||
|
/*package*/ final int mFlag;
|
||||||
|
|
||||||
|
/*package*/ final long mTimestamp;
|
||||||
|
|
||||||
|
/*package*/ final ArrayList<Double> mAccel;
|
||||||
|
|
||||||
|
/*package*/ final ArrayList<Double> mGyro;
|
||||||
|
|
||||||
|
/*package*/ final double mTemperature;
|
||||||
|
|
||||||
|
public ImuData(
|
||||||
|
long frameId,
|
||||||
|
int flag,
|
||||||
|
long timestamp,
|
||||||
|
@NonNull ArrayList<Double> accel,
|
||||||
|
@NonNull ArrayList<Double> gyro,
|
||||||
|
double temperature) {
|
||||||
|
this.mFrameId = frameId;
|
||||||
|
this.mFlag = flag;
|
||||||
|
this.mTimestamp = timestamp;
|
||||||
|
this.mAccel = accel;
|
||||||
|
this.mGyro = gyro;
|
||||||
|
this.mTemperature = temperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** IMU frame id */
|
||||||
|
public long getFrameId() {
|
||||||
|
return mFrameId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMU accel or gyro flag
|
||||||
|
* 0: accel and gyro are both valid
|
||||||
|
* 1: accel is valid
|
||||||
|
* 2: gyro is valid
|
||||||
|
*/
|
||||||
|
public int getFlag() {
|
||||||
|
return mFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** IMU timestamp in 1us */
|
||||||
|
public long getTimestamp() {
|
||||||
|
return mTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** IMU accelerometer data for 3-axis: X, Y, Z. */
|
||||||
|
@NonNull
|
||||||
|
public ArrayList<Double> getAccel() {
|
||||||
|
return mAccel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** IMU gyroscope data for 3-axis: X, Y, Z. */
|
||||||
|
@NonNull
|
||||||
|
public ArrayList<Double> getGyro() {
|
||||||
|
return mGyro;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** IMU temperature */
|
||||||
|
public double getTemperature() {
|
||||||
|
return mTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ImuData{" +
|
||||||
|
"mFrameId=" + mFrameId +
|
||||||
|
"," + "mFlag=" + mFlag +
|
||||||
|
"," + "mTimestamp=" + mTimestamp +
|
||||||
|
"," + "mAccel=" + mAccel +
|
||||||
|
"," + "mGyro=" + mGyro +
|
||||||
|
"," + "mTemperature=" + mTemperature +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
|
package com.slightech.mynteye;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
/** Device model */
|
||||||
|
public enum Model {
|
||||||
|
/** Standard */
|
||||||
|
STANDARD,
|
||||||
|
/** Standard 2 */
|
||||||
|
STANDARD2,
|
||||||
|
/** Standard 210a */
|
||||||
|
STANDARD210A,
|
||||||
|
;
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
|
package com.slightech.mynteye;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
/** Device motion data */
|
||||||
|
public interface MotionData {
|
||||||
|
@NonNull
|
||||||
|
public ImuData imu();
|
||||||
|
|
||||||
|
static final class CppProxy implements MotionData
|
||||||
|
{
|
||||||
|
private final long nativeRef;
|
||||||
|
private final AtomicBoolean destroyed = new AtomicBoolean(false);
|
||||||
|
|
||||||
|
private CppProxy(long nativeRef)
|
||||||
|
{
|
||||||
|
if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
|
||||||
|
this.nativeRef = nativeRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
private native void nativeDestroy(long nativeRef);
|
||||||
|
public void _djinni_private_destroy()
|
||||||
|
{
|
||||||
|
boolean destroyed = this.destroyed.getAndSet(true);
|
||||||
|
if (!destroyed) nativeDestroy(this.nativeRef);
|
||||||
|
}
|
||||||
|
protected void finalize() throws java.lang.Throwable
|
||||||
|
{
|
||||||
|
_djinni_private_destroy();
|
||||||
|
super.finalize();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ImuData imu()
|
||||||
|
{
|
||||||
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
|
return native_imu(this.nativeRef);
|
||||||
|
}
|
||||||
|
private native ImuData native_imu(long _nativeRef);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
|
package com.slightech.mynteye;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
/** Source allows the user to choose which data to be captured */
|
||||||
|
public enum Source {
|
||||||
|
/** Video streaming of stereo, color, depth, etc. */
|
||||||
|
VIDEO_STREAMING,
|
||||||
|
/** Motion tracking of IMU (accelerometer, gyroscope) */
|
||||||
|
MOTION_TRACKING,
|
||||||
|
/** Enable everything together */
|
||||||
|
ALL,
|
||||||
|
;
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
|
package com.slightech.mynteye;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
/** Streams define different type of data */
|
||||||
|
public enum Stream {
|
||||||
|
/** Left stream */
|
||||||
|
LEFT,
|
||||||
|
/** Right stream */
|
||||||
|
RIGHT,
|
||||||
|
;
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
|
package com.slightech.mynteye;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
/** Device stream data */
|
||||||
|
public interface StreamData {
|
||||||
|
@NonNull
|
||||||
|
public ImgData img();
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public Frame frame();
|
||||||
|
|
||||||
|
public long frameId();
|
||||||
|
|
||||||
|
static final class CppProxy implements StreamData
|
||||||
|
{
|
||||||
|
private final long nativeRef;
|
||||||
|
private final AtomicBoolean destroyed = new AtomicBoolean(false);
|
||||||
|
|
||||||
|
private CppProxy(long nativeRef)
|
||||||
|
{
|
||||||
|
if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
|
||||||
|
this.nativeRef = nativeRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
private native void nativeDestroy(long nativeRef);
|
||||||
|
public void _djinni_private_destroy()
|
||||||
|
{
|
||||||
|
boolean destroyed = this.destroyed.getAndSet(true);
|
||||||
|
if (!destroyed) nativeDestroy(this.nativeRef);
|
||||||
|
}
|
||||||
|
protected void finalize() throws java.lang.Throwable
|
||||||
|
{
|
||||||
|
_djinni_private_destroy();
|
||||||
|
super.finalize();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ImgData img()
|
||||||
|
{
|
||||||
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
|
return native_img(this.nativeRef);
|
||||||
|
}
|
||||||
|
private native ImgData native_img(long _nativeRef);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Frame frame()
|
||||||
|
{
|
||||||
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
|
return native_frame(this.nativeRef);
|
||||||
|
}
|
||||||
|
private native Frame native_frame(long _nativeRef);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long frameId()
|
||||||
|
{
|
||||||
|
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||||
|
return native_frameId(this.nativeRef);
|
||||||
|
}
|
||||||
|
private native long native_frameId(long _nativeRef);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,11 +1,12 @@
|
||||||
// AUTOGENERATED FILE - DO NOT MODIFY!
|
// AUTOGENERATED FILE - DO NOT MODIFY!
|
||||||
// This file generated by Djinni from mynteye.djinni
|
// This file generated by Djinni from mynteye_types.djinni
|
||||||
|
|
||||||
package com.slightech.mynteye;
|
package com.slightech.mynteye;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
/** Stream request */
|
||||||
public final class StreamRequest {
|
public final class StreamRequest {
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,23 +33,28 @@ public final class StreamRequest {
|
||||||
this.mFps = fps;
|
this.mFps = fps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Stream index */
|
||||||
public int getIndex() {
|
public int getIndex() {
|
||||||
return mIndex;
|
return mIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Stream width in pixels */
|
||||||
public int getWidth() {
|
public int getWidth() {
|
||||||
return mWidth;
|
return mWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Stream height in pixels */
|
||||||
public int getHeight() {
|
public int getHeight() {
|
||||||
return mHeight;
|
return mHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Stream pixel format */
|
||||||
@NonNull
|
@NonNull
|
||||||
public Format getFormat() {
|
public Format getFormat() {
|
||||||
return mFormat;
|
return mFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Stream frames per second */
|
||||||
public int getFps() {
|
public int getFps() {
|
||||||
return mFps;
|
return mFps;
|
||||||
}
|
}
|
||||||
|
|
1
wrappers/android/mynteye/scripts/.gitignore
vendored
1
wrappers/android/mynteye/scripts/.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
/djinni-output-temp/
|
/djinni-output-temp/
|
||||||
|
/*.yaml
|
|
@ -1,33 +1,33 @@
|
||||||
|
@extern "mynteye_types.yaml"
|
||||||
|
|
||||||
format = enum {
|
# Device class to communicate with MYNT® EYE device
|
||||||
grey;
|
|
||||||
yuyv;
|
|
||||||
bgr888;
|
|
||||||
rgb888;
|
|
||||||
}
|
|
||||||
|
|
||||||
stream_request = record {
|
|
||||||
index: i32;
|
|
||||||
width: i32;
|
|
||||||
height: i32;
|
|
||||||
format: format;
|
|
||||||
fps: i32;
|
|
||||||
}
|
|
||||||
|
|
||||||
device_usb_info = record {
|
|
||||||
index: i32;
|
|
||||||
name: string;
|
|
||||||
sn: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
device = interface +c {
|
device = interface +c {
|
||||||
|
# Query devices
|
||||||
static query(): list<device_usb_info>;
|
static query(): list<device_usb_info>;
|
||||||
|
|
||||||
|
# Create the device instance
|
||||||
static create(info: device_usb_info): device;
|
static create(info: device_usb_info): device;
|
||||||
|
|
||||||
|
# Get all stream requests
|
||||||
get_stream_requests(): list<stream_request>;
|
get_stream_requests(): list<stream_request>;
|
||||||
|
# Config the stream request
|
||||||
config_stream_request(request: stream_request);
|
config_stream_request(request: stream_request);
|
||||||
|
|
||||||
start();
|
# Start capturing the source
|
||||||
stop();
|
start(source: source);
|
||||||
|
# Stop capturing the source
|
||||||
|
stop(source: source);
|
||||||
|
|
||||||
|
# Wait the streams are ready
|
||||||
|
wait_for_streams();
|
||||||
|
|
||||||
|
# Get the latest data of stream
|
||||||
|
get_stream_data(stream: stream): stream_data;
|
||||||
|
# Get the datas of stream
|
||||||
|
get_stream_datas(stream: stream): list<stream_data>;
|
||||||
|
|
||||||
|
# Enable cache motion datas
|
||||||
|
enable_cache_motion_datas(max_size: i32);
|
||||||
|
# Get the motion datas
|
||||||
|
get_motion_datas(): list<motion_data>;
|
||||||
}
|
}
|
||||||
|
|
119
wrappers/android/mynteye/scripts/mynteye_types.djinni
Normal file
119
wrappers/android/mynteye/scripts/mynteye_types.djinni
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
|
||||||
|
# Device USB information
|
||||||
|
device_usb_info = record {
|
||||||
|
# Device index
|
||||||
|
index: i32;
|
||||||
|
# Device name
|
||||||
|
name: string;
|
||||||
|
# Device serial number
|
||||||
|
sn: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Device model
|
||||||
|
model = enum {
|
||||||
|
# Standard
|
||||||
|
standard;
|
||||||
|
# Standard 2
|
||||||
|
standard2;
|
||||||
|
# Standard 210a
|
||||||
|
standard210a;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Formats define how each stream can be encoded
|
||||||
|
format = enum {
|
||||||
|
# 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Stream request
|
||||||
|
stream_request = record {
|
||||||
|
# Stream index
|
||||||
|
index: i32;
|
||||||
|
# Stream width in pixels
|
||||||
|
width: i32;
|
||||||
|
# Stream height in pixels
|
||||||
|
height: i32;
|
||||||
|
# Stream pixel format
|
||||||
|
format: format;
|
||||||
|
# Stream frames per second
|
||||||
|
fps: i32;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Source allows the user to choose which data to be captured
|
||||||
|
source = enum {
|
||||||
|
# Video streaming of stereo, color, depth, etc.
|
||||||
|
video_streaming;
|
||||||
|
# Motion tracking of IMU (accelerometer, gyroscope)
|
||||||
|
motion_tracking;
|
||||||
|
# Enable everything together
|
||||||
|
all;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Streams define different type of data
|
||||||
|
stream = enum {
|
||||||
|
# Left stream
|
||||||
|
left;
|
||||||
|
# Right stream
|
||||||
|
right;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Frame with raw data
|
||||||
|
frame = interface +c {
|
||||||
|
# Get the width
|
||||||
|
width(): i32;
|
||||||
|
# Get the height
|
||||||
|
height(): i32;
|
||||||
|
# Get the pixel format
|
||||||
|
format(): format;
|
||||||
|
# Get the size
|
||||||
|
size(): i32;
|
||||||
|
# Get the data
|
||||||
|
data(): binary;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Image data
|
||||||
|
img_data = record {
|
||||||
|
# Image frame id
|
||||||
|
frame_id: i64;
|
||||||
|
# Image timestamp in 1us
|
||||||
|
timestamp: i64;
|
||||||
|
# Image exposure time, virtual value in [1, 480]
|
||||||
|
exposure_time: i64;
|
||||||
|
}
|
||||||
|
|
||||||
|
# IMU data
|
||||||
|
imu_data = record {
|
||||||
|
# IMU frame id
|
||||||
|
frame_id: i64;
|
||||||
|
# IMU accel or gyro flag
|
||||||
|
# 0: accel and gyro are both valid
|
||||||
|
# 1: accel is valid
|
||||||
|
# 2: gyro is valid
|
||||||
|
flag: i32;
|
||||||
|
# IMU timestamp in 1us
|
||||||
|
timestamp: i64;
|
||||||
|
# IMU accelerometer data for 3-axis: X, Y, Z.
|
||||||
|
accel: list<f64>;
|
||||||
|
# IMU gyroscope data for 3-axis: X, Y, Z.
|
||||||
|
gyro: list<f64>;
|
||||||
|
# IMU temperature
|
||||||
|
temperature: f64;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Device stream data
|
||||||
|
stream_data = interface +c {
|
||||||
|
img(): img_data;
|
||||||
|
frame(): frame;
|
||||||
|
frame_id(): i64;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Device motion data
|
||||||
|
motion_data = interface +c {
|
||||||
|
imu(): imu_data;
|
||||||
|
}
|
|
@ -6,11 +6,10 @@ base_dir=$(cd "$(dirname "$0")" && pwd)
|
||||||
|
|
||||||
# options
|
# options
|
||||||
|
|
||||||
while getopts "d:i:" opt; do
|
while getopts "d:" opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
d) djinni_dir="$OPTARG" ;;
|
d) djinni_dir="$OPTARG" ;;
|
||||||
i) in_idl="$OPTARG" ;;
|
?) echo "Usage: $0 <-d DJINNI_DIR>"
|
||||||
?) echo "Usage: $0 <-d DJINNI_DIR> [-i IN_IDL]"
|
|
||||||
exit 2 ;;
|
exit 2 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
@ -20,8 +19,6 @@ if [ -z "$djinni_dir" ]; then
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$in_idl" ] || in_idl="$base_dir/mynteye.djinni"
|
|
||||||
|
|
||||||
# generate
|
# generate
|
||||||
|
|
||||||
djinni_run="$djinni_dir/src/run-assume-built"
|
djinni_run="$djinni_dir/src/run-assume-built"
|
||||||
|
@ -36,6 +33,9 @@ java_package="com.slightech.mynteye"
|
||||||
cpp_namespace="mynteye_jni"
|
cpp_namespace="mynteye_jni"
|
||||||
|
|
||||||
[ ! -e "$temp_out" ] || rm -r "$temp_out"
|
[ ! -e "$temp_out" ] || rm -r "$temp_out"
|
||||||
|
|
||||||
|
djinni_build() {
|
||||||
|
local in_idl="$1"; shift
|
||||||
"$djinni_run" \
|
"$djinni_run" \
|
||||||
--java-out "$temp_out/java" \
|
--java-out "$temp_out/java" \
|
||||||
--java-package "$java_package" \
|
--java-package "$java_package" \
|
||||||
|
@ -54,7 +54,14 @@ cpp_namespace="mynteye_jni"
|
||||||
--ident-jni-class NativeFooBar \
|
--ident-jni-class NativeFooBar \
|
||||||
--ident-jni-file NativeFooBar \
|
--ident-jni-file NativeFooBar \
|
||||||
\
|
\
|
||||||
|
--yaml-out $(dirname "$in_idl") \
|
||||||
|
--yaml-out-file "$(basename "$in_idl" .djinni).yaml" \
|
||||||
|
\
|
||||||
--idl "$in_idl"
|
--idl "$in_idl"
|
||||||
|
}
|
||||||
|
|
||||||
|
djinni_build "$base_dir/mynteye_types.djinni"
|
||||||
|
djinni_build "$base_dir/mynteye.djinni"
|
||||||
|
|
||||||
# copy
|
# copy
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user