feat(android): view mynteye datas
This commit is contained in:
@@ -47,8 +47,8 @@ public:
|
||||
/** 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;
|
||||
/** 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;
|
||||
|
||||
@@ -81,30 +81,43 @@ void DeviceImpl::ConfigStreamRequest(
|
||||
}
|
||||
|
||||
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) {
|
||||
return nullptr;
|
||||
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) {
|
||||
return {};
|
||||
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::EnableCacheMotionDatas(int32_t max_size) {
|
||||
void DeviceImpl::EnableMotionDatas(int32_t max_size) {
|
||||
device_->EnableMotionDatas(max_size);
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<::mynteye_jni::MotionData>>
|
||||
DeviceImpl::GetMotionDatas() {
|
||||
return {};
|
||||
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
|
||||
|
||||
@@ -37,8 +37,8 @@ class DeviceImpl : public Device {
|
||||
/** 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;
|
||||
/** 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;
|
||||
|
||||
@@ -9,13 +9,13 @@ namespace mynteye_jni {
|
||||
|
||||
class MotionDataImpl : public MotionData {
|
||||
public:
|
||||
using motion_data_t = std::shared_ptr<MYNTEYE_NAMESPACE::device::MotionData>;
|
||||
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;
|
||||
auto&& imu = data_.imu;
|
||||
return {
|
||||
imu->frame_id,
|
||||
imu->flag,
|
||||
|
||||
@@ -10,13 +10,13 @@ namespace mynteye_jni {
|
||||
|
||||
class StreamDataImpl : public StreamData {
|
||||
public:
|
||||
using stream_data_t = std::shared_ptr<MYNTEYE_NAMESPACE::device::StreamData>;
|
||||
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;
|
||||
auto&& img = data_.img;
|
||||
return {
|
||||
img->frame_id,
|
||||
static_cast<int64_t>(img->timestamp),
|
||||
@@ -25,11 +25,11 @@ class StreamDataImpl : public StreamData {
|
||||
}
|
||||
|
||||
std::shared_ptr<::mynteye_jni::Frame> Frame() override {
|
||||
return std::make_shared<::mynteye_jni::FrameImpl>(data_->frame);
|
||||
return std::make_shared<::mynteye_jni::FrameImpl>(data_.frame);
|
||||
}
|
||||
|
||||
int64_t FrameId() override {
|
||||
return data_->frame_id;
|
||||
return data_.frame_id;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -109,12 +109,12 @@ CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_nativ
|
||||
} 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)
|
||||
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->EnableCacheMotionDatas(::djinni::I32::toCpp(jniEnv, j_maxSize));
|
||||
ref->EnableMotionDatas(::djinni::I32::toCpp(jniEnv, j_maxSize));
|
||||
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
|
||||
}
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ public interface Device {
|
||||
@NonNull
|
||||
public ArrayList<com.slightech.mynteye.StreamData> getStreamDatas(@NonNull com.slightech.mynteye.Stream stream);
|
||||
|
||||
/** Enable cache motion datas */
|
||||
public void enableCacheMotionDatas(int maxSize);
|
||||
/** Enable cache motion datas until get them, otherwise using callback instead */
|
||||
public void enableMotionDatas(int maxSize);
|
||||
|
||||
/** Get the motion datas */
|
||||
@NonNull
|
||||
@@ -135,12 +135,12 @@ public interface Device {
|
||||
private native ArrayList<com.slightech.mynteye.StreamData> native_getStreamDatas(long _nativeRef, com.slightech.mynteye.Stream stream);
|
||||
|
||||
@Override
|
||||
public void enableCacheMotionDatas(int maxSize)
|
||||
public void enableMotionDatas(int maxSize)
|
||||
{
|
||||
assert !this.destroyed.get() : "trying to use a destroyed object";
|
||||
native_enableCacheMotionDatas(this.nativeRef, maxSize);
|
||||
native_enableMotionDatas(this.nativeRef, maxSize);
|
||||
}
|
||||
private native void native_enableCacheMotionDatas(long _nativeRef, int maxSize);
|
||||
private native void native_enableMotionDatas(long _nativeRef, int maxSize);
|
||||
|
||||
@Override
|
||||
public ArrayList<com.slightech.mynteye.MotionData> getMotionDatas()
|
||||
|
||||
Reference in New Issue
Block a user