Sensor.java
Go to the documentation of this file.
1 package com.intel.realsense.librealsense;
2 
3 import java.util.ArrayList;
4 import java.util.List;
5 
6 public class Sensor extends Options {
7 
8  Sensor(long h) {
9  mHandle = h;
10  }
11 
12  public List<StreamProfile> getStreamProfiles(){
13  long[] streamProfilesHandles = nGetStreamProfiles(mHandle);
14  List<StreamProfile> rv = new ArrayList<>();
15  for(long h : streamProfilesHandles){
16  rv.add(new StreamProfile(h));
17  }
18  return rv;
19  }
20 
21  public <T extends Sensor> T as(Extension extension) throws RuntimeException {
22  if (this.is(extension)) {
23  switch (extension){
24  case ROI: return (T) new RoiSensor(mHandle);
25  case DEPTH_SENSOR: return (T) new DepthSensor(mHandle);
26  case COLOR_SENSOR: return (T) new ColorSensor(mHandle);
27  default: throw new RuntimeException("this API version does not support " + extension.name());
28  }
29  } else{
30  throw new RuntimeException("this sensor is not extendable to " + extension.name());
31  }
32  }
33 
34  public boolean is(Extension extension) {
35  return nIsSensorExtendableTo(mHandle, extension.value());
36  }
37 
38  @Override
39  public void close() {
40  if(mOwner)
41  nRelease(mHandle);
42  }
43 
44  private static native long[] nGetStreamProfiles(long handle);
45  private static native void nRelease(long handle);
46  private static native boolean nIsSensorExtendableTo(long handle, int extension);
47 }
boolean is(Extension extension)
Definition: Sensor.java:34
List< StreamProfile > getStreamProfiles()
Definition: Sensor.java:12
GLuint64 GLenum void * handle
Definition: glext.h:7785
static native void nRelease(long handle)
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:1960
static native long[] nGetStreamProfiles(long handle)
static native boolean nIsSensorExtendableTo(long handle, int extension)


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:41