Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android add pipeline profile partial support #5344

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/android/jni/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,12 @@ Java_com_intel_realsense_librealsense_PipelineProfile_nDelete(JNIEnv *env, jclas
jlong handle) {
rs2_delete_pipeline_profile(reinterpret_cast<rs2_pipeline_profile *>(handle));
}

extern "C" JNIEXPORT jlong JNICALL
Java_com_intel_realsense_librealsense_PipelineProfile_nGetDevice(JNIEnv *env, jclass type,
jlong handle) {
rs2_error* e = NULL;
rs2_device *rv = rs2_pipeline_profile_get_device(reinterpret_cast<rs2_pipeline_profile *>(handle), &e);
handle_error(env, e);
return reinterpret_cast<jlong>(rv);
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
package com.intel.realsense.librealsense;


public class Pipeline extends LrsClass{
public Pipeline(){
RsContext ctx = new RsContext();
mHandle = nCreate(ctx.getHandle());
}

public void start() throws Exception{
PipelineProfile rv = new PipelineProfile(nStart(mHandle));
rv.close();//TODO: enable when PipelineProfile is implemented
public PipelineProfile start() throws Exception{
return new PipelineProfile(nStart(mHandle));
}

public void start(Config config) throws Exception {
public PipelineProfile start(Config config) throws Exception {
long h = nStartWithConfig(mHandle, config.getHandle());
PipelineProfile rv = new PipelineProfile(h);
rv.close();//TODO: enable when PipelineProfile is implemented
return new PipelineProfile(h);
}
public void stop() {
nStop(mHandle);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
package com.intel.realsense.librealsense;

class PipelineProfile extends LrsClass {
public class PipelineProfile extends LrsClass {

PipelineProfile(long handle){
mHandle = handle;
}

public Device getDevice() {
return new Device(nGetDevice(mHandle));
}

@Override
public void close() {
nDelete(mHandle);
}

private static native void nDelete(long handle);
private static native long nGetDevice(long handle);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
import com.intel.realsense.librealsense.Extension;
import com.intel.realsense.librealsense.FrameSet;
import com.intel.realsense.librealsense.MotionStreamProfile;
import com.intel.realsense.librealsense.Option;
import com.intel.realsense.librealsense.Pipeline;
import com.intel.realsense.librealsense.PipelineProfile;
import com.intel.realsense.librealsense.ProductLine;
import com.intel.realsense.librealsense.RsContext;
import com.intel.realsense.librealsense.Sensor;
import com.intel.realsense.librealsense.StreamProfile;
import com.intel.realsense.librealsense.VideoStreamProfile;

Expand Down Expand Up @@ -123,7 +126,13 @@ void configAndStart() throws Exception {
configStream(config);
if(mListener != null)
mListener.config(config);
mPipeline.start(config);
try (PipelineProfile pp = mPipeline.start(config)) {
List<Sensor> sensors = pp.getDevice().querySensors();
for (Sensor sen : sensors) {
if (sen.supports(Option.GLOBAL_TIME_ENABLED))
sen.setValue(Option.GLOBAL_TIME_ENABLED, 0);
ev-mp marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
}

Expand Down