Device.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 Device extends LrsClass {
7  private List<Sensor> _sensors = new ArrayList<>();
8 
9  Device(long handle){
10  mHandle = handle;
11  long[] sensorsHandles = nQuerySensors(mHandle);
12  for(long h : sensorsHandles){
13  _sensors.add(new Sensor(h));
14  }
15  }
16 
17  public List<Sensor> querySensors(){
18  return _sensors;
19  }
20 
21  public boolean supportsInfo(CameraInfo info){
22  return nSupportsInfo(mHandle, info.value());
23  }
24 
26  return nGetInfo(mHandle, info.value());
27  }
28 
29  public void toggleAdvancedMode(boolean enable){
30  nToggleAdvancedMode(mHandle, enable);
31  }
32 
33  public boolean isInAdvancedMode(){
34  return nIsInAdvancedMode(mHandle);
35  }
36 
37  public void loadPresetFromJson(byte[] data){
38  nLoadPresetFromJson(mHandle, data);
39  }
40 
42  return nSerializePresetToJson(mHandle);
43  }
44 
45  public boolean is(Extension extension) {
46  return nIsDeviceExtendableTo(mHandle, extension.value());
47  }
48 
49  public <T extends Device> T as(Extension extension) {
50  switch (extension){
51  case UPDATABLE: return (T) new Updatable(mHandle);
52  case UPDATE_DEVICE: return (T) new UpdateDevice(mHandle);
53  case DEBUG: return (T) new DebugProtocol(mHandle);
54  case FW_LOGGER: return (T) new FwLogger(mHandle);
55  }
56  throw new RuntimeException("this device is not extendable to " + extension.name());
57  }
58 
59  public void hardwareReset(){
60  nHardwareReset(mHandle);
61  }
62 
63  @Override
64  public void close() {
65  for (Sensor s : _sensors)
66  s.close();
67  if(mOwner)
68  nRelease(mHandle);
69  }
70 
71  private static native boolean nSupportsInfo(long handle, int info);
72  private static native String nGetInfo(long handle, int info);
73  private static native void nToggleAdvancedMode(long handle, boolean enable);
74  private static native boolean nIsInAdvancedMode(long handle);
75  private static native void nLoadPresetFromJson(long handle, byte[] data);
76  private static native byte[] nSerializePresetToJson(long handle);
77  private static native long[] nQuerySensors(long handle);
78  private static native void nHardwareReset(long handle);
79  private static native boolean nIsDeviceExtendableTo(long handle, int extension);
80  private static native void nRelease(long handle);
81 }
String getInfo(CameraInfo info)
Definition: Device.java:25
static native long[] nQuerySensors(long handle)
void loadPresetFromJson(byte[] data)
Definition: Device.java:37
GLdouble s
boolean is(Extension extension)
Definition: Device.java:45
GLuint64 GLenum void * handle
Definition: glext.h:7785
static native byte[] nSerializePresetToJson(long handle)
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:1960
::std_msgs::String_< std::allocator< void > > String
Definition: String.h:47
def info(name, value, persistent=False)
Definition: test.py:301
static native boolean nIsInAdvancedMode(long handle)
static native void nToggleAdvancedMode(long handle, boolean enable)
static native void nHardwareReset(long handle)
static native String nGetInfo(long handle, int info)
void toggleAdvancedMode(boolean enable)
Definition: Device.java:29
static native boolean nIsDeviceExtendableTo(long handle, int extension)
unsigned char byte
Definition: src/types.h:52
GLboolean enable
Definition: glext.h:5688
static native void nRelease(long handle)
static native void nLoadPresetFromJson(long handle, byte[] data)
static native boolean nSupportsInfo(long handle, int info)
Definition: parser.hpp:150
boolean supportsInfo(CameraInfo info)
Definition: Device.java:21


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