Package com.orbbec.obsensor

## Class Device

- java.lang.Object
- - com.orbbec.obsensor.LobClass
  - - com.orbbec.obsensor.Device

All Implemented Interfaces:
  `java.lang.AutoCloseable`

    public class Device
    extends LobClass

Expose orbbec device functions

### Nested Class Summary

Nested Classes
`static interface` `Device.OnStateChangeListener` Device Status Monitoring
`protected static class` `Device.PropertyRangeB`
`protected static class` `Device.PropertyRangeF`
`protected static class` `Device.PropertyRangeI`

### Field Summary

### Fields inherited from class com.orbbec.obsensor.LobClass

`handle, owner`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`boolean` `activateAuthorization​(java.lang.String authCode)` Activate the device with an authorization code
`void` `close()` release device resources
`CameraParamList` `getCalibrationCameraParamList()` Get the original parameter list of camera calibration saved in the device.
`DepthWorkMode` `getCurrentDepthWorkMode()` Get current depth work mode
`boolean` `getDefaultB​(DeviceProperty property)` Get the default value of the boolean type device property
`float` `getDefaultF​(DeviceProperty property)` Get the default value of the float type device property
`int` `getDefaultI​(DeviceProperty property)` Get the default value of the int type device property
`java.util.List<DepthWorkMode>` `getDepthWorkModeList()` Request support depth work mode list
`DeviceTemperature` `getDeviceTemperature()` Get device temperature information
`DeviceInfo` `getInfo()` Get device information
`float` `getMaxRangeF​(DeviceProperty property)` Get the maximum value supported by the float type device property
`int` `getMaxRangeI​(DeviceProperty property)` Get the maximum value supported by the int type device property
`float` `getMinRangeF​(DeviceProperty property)` Get the minimum value supported by the float type device property
`int` `getMinRangeI​(DeviceProperty property)` Get the minimum value supported by the int type device property
`MultiDeviceSyncConfig` `getMultiDeviceSyncConfig()` get the multi device sync configuration of the device.
`OBNetworkConfig` `getNetworkConfig()` Get network config Only for some network device, Such as Gemini 2 XL
`boolean` `getPropertyValueB​(DeviceProperty property)` Get the value of the boolean type device property
`void` `getPropertyValueDataType​(DeviceProperty property, DataType dataType)` Get the data structure of the corresponding device properties
`float` `getPropertyValueF​(DeviceProperty property)` Get the value of the float type device property
`int` `getPropertyValueI​(DeviceProperty property)` Get the value of the int type device property
`protected Device.PropertyRangeB` `getRangeB​(int propertyId)`
`protected Device.PropertyRangeF` `getRangeF​(int propertyId)`
`protected Device.PropertyRangeI` `getRangeI​(int propertyId)`
`Sensor` `getSensor​(SensorType type)` Get the sensor of the specified type
`float` `getStepF​(DeviceProperty property)` Get the step value at which the float type device property changes within the supported range
`int` `getStepI​(DeviceProperty property)` Get the step value at which the int type device property changes within the supported range
`java.util.List<DepthPrecisionLevel>` `getSupportedDepthPrecisionLevelList()` Get list of DevicePrecisionLevel
`java.util.List<DevicePropertyInfo>` `getSupportedPropertyList()` Get the list of property information supported by the device
`TimestampResetConfig` `getTimestampResetConfig()` get the timestamp reset configuration of the device.
`boolean` `hasSensor​(SensorType type)` Device is support SensorType
`boolean` `isPropertySupported​(DeviceProperty property, PermissionType permissionType)` Query whether the device supports setting the specified device property
`protected static boolean` `nActivateAuthorization​(long handle, java.lang.String authCode)`
`protected static void` `nDelete​(long handle)`
`protected static long` `nGetCalibrationCameraParamList​(long handle)`
`protected static DepthWorkMode` `nGetCurrentDepthWorkMode​(long handle)`
`protected static java.util.List<DepthWorkMode>` `nGetDepthWorkModeList​(long handle)`
`protected static DeviceInfo` `nGetDeviceInfo​(long handle)`
`protected static MultiDeviceSyncConfig` `nGetMultiDeviceSyncConfig​(long handle)`
`protected static OBNetworkConfig` `nGetNetworkConfig​(long handle)`
`protected static void` `nGetPropertyRangeB​(long handle, int property, Device.PropertyRangeB outParams)`
`protected static void` `nGetPropertyRangeF​(long handle, int property, Device.PropertyRangeF outParams)`
`protected static void` `nGetPropertyRangeI​(long handle, int property, Device.PropertyRangeI outParams)`
`protected static boolean` `nGetPropertyValueB​(long handle, int property)`
`protected static void` `nGetPropertyValueDataType​(long handle, int property, byte[] dataType)`
`protected static float` `nGetPropertyValueF​(long handle, int property)`
`protected static int` `nGetPropertyValueI​(long handle, int property)`
`protected static long` `nGetSensor​(long handle, int sensorType)`
`protected static int[]` `nGetSupportDepthPrecisionLevelList​(long handle)`
`protected static DevicePropertyInfo` `nGetSupportedProperty​(long handle, int index)`
`protected static int` `nGetSupportedPropertyCount​(long handle)`
`protected static TimestampResetConfig` `nGetTimestampResetConfig​(long handle)`
`protected static boolean` `nHasSensor​(long handle, int sensorType)`
`protected static boolean` `nIsPropertySupported​(long handle, int property, int permission)`
`protected static long[]` `nQuerySensor​(long handle)`
`protected static int[]` `nQuerySensorTypes​(long handle)`
`protected static void` `nReboot​(long handle)`
`protected static void` `nSetMultiDeviceSyncConfig​(long handle, MultiDeviceSyncConfig deviceSyncConfig)`
`protected static void` `nSetNetworkConfig​(long handle, OBNetworkConfig config)`
`protected static void` `nSetPropertyValueB​(long handle, int property, boolean value)`
`protected static void` `nSetPropertyValueDataType​(long handle, int property, byte[] dataType)`
`protected static void` `nSetPropertyValueF​(long handle, int property, float value)`
`protected static void` `nSetPropertyValueI​(long handle, int property, int value)`
`protected static void` `nSetStateChangeListener​(long handle, com.orbbec.obsensor.Device.OnStateChangeListenerImpl listener)`
`protected static void` `nSetTimestampResetConfig​(long handle, TimestampResetConfig config)`
`protected static void` `nSwitchDepthWorkMode​(long handle, java.lang.String modeName)`
`protected static void` `nTimerSyncWithHost​(long handle)`
`protected static void` `nTimestampReset​(long handle)`
`protected static void` `nTriggerCapture​(long handle)`
`protected static void` `nUpgrade​(long handle, java.lang.String fileName, UpgradeCallback callback)`
`protected static void` `nUpgrade​(long handle, java.nio.ByteBuffer buffer, UpgradeCallback callback)`
`java.util.List<Sensor>` `querySensors()` Query the list of sensors contained in the device
`void` `reboot()` The device restarts.
`void` `setMultiDeviceSyncConfig​(MultiDeviceSyncConfig deviceSyncConfig)` set the multi device sync configuration of the device.
`void` `setNetworkConfig​(OBNetworkConfig config)` Set network config Only for some network device, Such as Gemini 2 XL
`void` `setPropertyValueB​(DeviceProperty property, boolean value)` Set the value of the boolean type device property
`void` `setPropertyValueDataType​(DeviceProperty property, DataType dataType)` Set the data structure of the corresponding device properties
`void` `setPropertyValueF​(DeviceProperty property, float value)` Set the value of the float type device property
`void` `setPropertyValueI​(DeviceProperty property, int value)` Set the value of the int type device property
`void` `setStateChangeListener​(Device.OnStateChangeListener listener)` Set device status monitoring
`void` `setTimestampResetConfig​(TimestampResetConfig config)` set the timestamp reset configuration of the device.
`void` `switchDepthWorkMode​(java.lang.String modeName)` Switch depth work mode by work mode name.
`void` `timerSyncWithHost()` synchronize the timer of the device with the host.
`void` `timestampReset()` send the timestamp reset command to the device.
`void` `triggerCapture()` send the capture command to the device.
`void` `upgrade​(java.lang.String fileName, UpgradeCallback callback)` Upgrade device firmware Cautious: Not supported yet
`void` `upgrade​(java.nio.ByteBuffer buffer, UpgradeCallback callback)` Upgrade device firmware

### Methods inherited from class com.orbbec.obsensor.LobClass

`getHandle, throwInitializeException`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### getRangeB

    protected Device.PropertyRangeB getRangeB​(int propertyId)

#### getRangeI

    protected Device.PropertyRangeI getRangeI​(int propertyId)

#### getRangeF

    protected Device.PropertyRangeF getRangeF​(int propertyId)

#### getSupportedPropertyList

    public java.util.List<DevicePropertyInfo> getSupportedPropertyList()

Get the list of property information supported by the device

Returns:
  List of property information supported by the device

#### getSupportedDepthPrecisionLevelList

    public java.util.List<DepthPrecisionLevel> getSupportedDepthPrecisionLevelList()

Get list of DevicePrecisionLevel

Returns:
  list of DevicePrecisionLevel

#### isPropertySupported

    public boolean isPropertySupported​(DeviceProperty property,
                                       PermissionType permissionType)

Query whether the device supports setting the specified device property

Parameters:
  `property` - Device property
  `permissionType` - Required permission type
Returns:
  true supports, false does not support

#### setPropertyValueB

    public void setPropertyValueB​(DeviceProperty property,
                                  boolean value)

Set the value of the boolean type device property

Parameters:
  `property` - device property
  `value` - Set the value of the device property, boolean type

#### setPropertyValueI

    public void setPropertyValueI​(DeviceProperty property,
                                  int value)

Set the value of the int type device property

Parameters:
  `property` - device property
  `value` - Set the value of the device property, int type

#### setPropertyValueF

    public void setPropertyValueF​(DeviceProperty property,
                                  float value)

Set the value of the float type device property

Parameters:
  `property` - device property
  `value` - set the value of the device property, float type

#### setPropertyValueDataType

    public void setPropertyValueDataType​(DeviceProperty property,
                                         DataType dataType)

Set the data structure of the corresponding device properties

Parameters:
  `property` - device property
  `dataType` - device property data structure
Throws:
  `OBException` - When there is an error in the encapsulation of the data structure to be set

#### getPropertyValueB

    public boolean getPropertyValueB​(DeviceProperty property)

Get the value of the boolean type device property

Parameters:
  `property` - device property
Returns:
  The value of the device property, boolean type

#### getPropertyValueI

    public int getPropertyValueI​(DeviceProperty property)

Get the value of the int type device property

Parameters:
  `property` - device property
Returns:
  The value of the device property, int type

#### getPropertyValueF

    public float getPropertyValueF​(DeviceProperty property)

Get the value of the float type device property

Parameters:
  `property` - device property
Returns:
  The value of the device property, float type

#### getPropertyValueDataType

    public void getPropertyValueDataType​(DeviceProperty property,
                                         DataType dataType)

Get the data structure of the corresponding device properties

Parameters:
  `property` - device property
  `dataType` - device property data structure
Throws:
  `OBException` - When there is an error in parsing the obtained data structure

#### getMinRangeI

    public int getMinRangeI​(DeviceProperty property)

Get the minimum value supported by the int type device property

Parameters:
  `property` - device property
Returns:
  The minimum value supported by the device property, int type

#### getMinRangeF

    public float getMinRangeF​(DeviceProperty property)

Get the minimum value supported by the float type device property

Parameters:
  `property` - device property
Returns:
  The minimum value supported by the device property, float type

#### getMaxRangeI

    public int getMaxRangeI​(DeviceProperty property)

Get the maximum value supported by the int type device property

Parameters:
  `property` - device property
Returns:
  The maximum value supported by the device property, int type

#### getMaxRangeF

    public float getMaxRangeF​(DeviceProperty property)

Get the maximum value supported by the float type device property

Parameters:
  `property` - device
Returns:
  The maximum value supported by the device property, float type

#### getStepI

    public int getStepI​(DeviceProperty property)

Get the step value at which the int type device property changes within the supported range

Parameters:
  `property` - device property
Returns:
  The step value that changes within the range supported by the device property, int type

#### getStepF

    public float getStepF​(DeviceProperty property)

Get the step value at which the float type device property changes within the supported range

Parameters:
  `property` - device property
Returns:
  The step value that changes within the range supported by the device property, float type

#### getDefaultB

    public boolean getDefaultB​(DeviceProperty property)

Get the default value of the boolean type device property

Parameters:
  `property` - device property
Returns:
  The default value supported by the device property, boolean type

#### getDefaultI

    public int getDefaultI​(DeviceProperty property)

Get the default value of the int type device property

Parameters:
  `property` - device property
Returns:
  The default value supported by the device property, int type

#### getDefaultF

    public float getDefaultF​(DeviceProperty property)

Get the default value of the float type device property

Parameters:
  `property` - device property
Returns:
  The default value supported by the device property, float type

#### getInfo

    public DeviceInfo getInfo()

Get device information

Returns:
  device information

#### querySensors

    public java.util.List<Sensor> querySensors()

Query the list of sensors contained in the device

Returns:
  Sensor list

#### getSensor

    public Sensor getSensor​(SensorType type)

Get the sensor of the specified type

Parameters:
  `type` - sensor type
Returns:
  sensor

#### hasSensor

    public boolean hasSensor​(SensorType type)

Device is support SensorType

Parameters:
  `type` - sensorType
Returns:
  true: support sensorType, false: not support sensorType

#### upgrade

    public void upgrade​(java.lang.String fileName,
                        UpgradeCallback callback)

Upgrade device firmware Cautious: Not supported yet

Parameters:
  `fileName` - firmware path
  `callback` - callback during the upgrade process
Throws:
  `OBException` - The firmware path is abnormal

#### upgrade

    public void upgrade​(java.nio.ByteBuffer buffer,
                        UpgradeCallback callback)

Upgrade device firmware

Parameters:
  `buffer` - Firmware file content Caution: `Buffer.capacity()` is the valid data length.
  `callback` - callback during the upgrade process
Throws:
  `OBException` - The firmware path is abnormal

#### getDeviceTemperature

    public DeviceTemperature getDeviceTemperature()

Get device temperature information

Returns:
  temperature information

#### activateAuthorization

    public boolean activateAuthorization​(java.lang.String authCode)

Activate the device with an authorization code

Parameters:
  `authCode` - Authorization code
Returns:
  Whether the activation is successful, the activation succeeds: true, the activation fails: false

#### setStateChangeListener

    public void setStateChangeListener​(Device.OnStateChangeListener listener)

Set device status monitoring

Parameters:
  `listener` - callback when device status changes

#### triggerCapture

    public void triggerCapture()

send the capture command to the device. The device will start one time image capture after receiving the capture command when it is in the OB_MULTI_DEVICE_SYNC_MODE_SOFTWARE_TRIGGERING The frequency of the user call this function multiplied by the number of frames per trigger should be less than the frame rate of the stream. The number of frames per trigger can be set by @ref framesPerTrigger. For some modelsï¼Œreceive and execute the capture command will have a certain delay and performance consumption, so the frequency of calling this function should not be too high, please refer to the product manual for the specific supported frequency. If the device is not in the OB_MULTI_DEVICE_SYNC_MODE_HARDWARE_TRIGGERING mode, device will ignore the capture command.

#### setTimestampResetConfig

    public void setTimestampResetConfig​(TimestampResetConfig config)

set the timestamp reset configuration of the device.

Parameters:
  `config` - the timestamp reset configuration of the device.

#### getTimestampResetConfig

    public TimestampResetConfig getTimestampResetConfig()

get the timestamp reset configuration of the device.

Returns:
  OBDeviceTimestampResetConfig return the timestamp reset configuration of the device.

#### timestampReset

    public void timestampReset()

send the timestamp reset command to the device. The device will reset the timer for calculating the timestamp for output frames to 0 after receiving the timestamp reset command when the timestamp reset function is enabled. The timestamp reset function can be enabled by call @ref ob_device_set_timestamp_reset_config. Before calling this function, user should call @ref ob_device_set_timestamp_reset_config to disable the timestamp reset function (It is not required for some models, but it is still recommended to do so for code compatibility). If the stream of the device is started, the timestamp of the continuous frames output by the stream will jump once after the timestamp reset. Due to the timer of device is not high-accuracy, the timestamp of the continuous frames output by the stream will drift after a long time. User can call this function periodically to reset the timer to avoid the timestamp drift, the recommended interval time is 60 minutes.

#### timerSyncWithHost

    public void timerSyncWithHost()

synchronize the timer of the device with the host. After calling this function, the timer of the device will be synchronized with the host. User can call this function to multiple devices to synchronize all timers of the devices. If the stream of the device is started, the timestamp of the continuous frames output by the stream will may jump once after the timer sync. Due to the timer of device is not high-accuracy, the timestamp of the continuous frames output by the stream will drift after a long time. User can call this function periodically to synchronize the timer to avoid the timestamp drift, the recommended interval time is 60 minutes.

#### getCalibrationCameraParamList

    public CameraParamList getCalibrationCameraParamList()

Get the original parameter list of camera calibration saved in the device. The parameters in the list do not correspond to the current open-current configuration. You need to select the parameters according to the actual situation, and may need to do scaling, mirroring and other processing. Non-professional users are recommended to use the Pipeline#getCameraParam() interface.

Returns:
  Camera parameter list

#### getCurrentDepthWorkMode

    public DepthWorkMode getCurrentDepthWorkMode()

Get current depth work mode

Returns:
  ob_depth_work_mode Current depth work mode

#### switchDepthWorkMode

    public void switchDepthWorkMode​(java.lang.String modeName)

Switch depth work mode by work mode name.

Parameters:
  `modeName` - Depth work mode name which equals to DepthWorkMode.name

#### getDepthWorkModeList

    public java.util.List<DepthWorkMode> getDepthWorkModeList()

Request support depth work mode list

Returns:
  OBDepthWorkModeList list of ob_depth_work_mode

#### getNetworkConfig

    public OBNetworkConfig getNetworkConfig()

Get network config Only for some network device, Such as Gemini 2 XL

Returns:
  newwork config.

#### setNetworkConfig

    public void setNetworkConfig​(OBNetworkConfig config)

Set network config Only for some network device, Such as Gemini 2 XL

Parameters:
  `config` - network config.

#### getMultiDeviceSyncConfig

    public MultiDeviceSyncConfig getMultiDeviceSyncConfig()

get the multi device sync configuration of the device.

Returns:
  OBMultiDeviceSyncConfig return the multi device sync configuration of the device.

#### setMultiDeviceSyncConfig

    public void setMultiDeviceSyncConfig​(MultiDeviceSyncConfig deviceSyncConfig)

set the multi device sync configuration of the device.

Parameters:
  `deviceSyncConfig` - The multi device sync configuration.

#### reboot

    public void reboot()

The device restarts. After the device restarts, the original device resources need to be released, and can be re-acquired after the device is reconnected.

#### close

    public void close()

release device resources

#### nDelete

    protected static void nDelete​(long handle)

#### nQuerySensor

    protected static long[] nQuerySensor​(long handle)

#### nHasSensor

    protected static boolean nHasSensor​(long handle,
                                        int sensorType)

#### nQuerySensorTypes

    protected static int[] nQuerySensorTypes​(long handle)

#### nGetSensor

    protected static long nGetSensor​(long handle,
                                     int sensorType)

#### nGetCurrentDepthWorkMode

    protected static DepthWorkMode nGetCurrentDepthWorkMode​(long handle)

#### nSwitchDepthWorkMode

    protected static void nSwitchDepthWorkMode​(long handle,
                                               java.lang.String modeName)

#### nGetDepthWorkModeList

    protected static java.util.List<DepthWorkMode> nGetDepthWorkModeList​(long handle)

#### nGetSupportDepthPrecisionLevelList

    protected static int[] nGetSupportDepthPrecisionLevelList​(long handle)

#### nIsPropertySupported

    protected static boolean nIsPropertySupported​(long handle,
                                                  int property,
                                                  int permission)

#### nSetPropertyValueB

    protected static void nSetPropertyValueB​(long handle,
                                             int property,
                                             boolean value)

#### nSetPropertyValueI

    protected static void nSetPropertyValueI​(long handle,
                                             int property,
                                             int value)

#### nSetPropertyValueF

    protected static void nSetPropertyValueF​(long handle,
                                             int property,
                                             float value)

#### nSetPropertyValueDataType

    protected static void nSetPropertyValueDataType​(long handle,
                                                    int property,
                                                    byte[] dataType)

#### nGetPropertyValueB

    protected static boolean nGetPropertyValueB​(long handle,
                                                int property)

#### nGetPropertyValueI

    protected static int nGetPropertyValueI​(long handle,
                                            int property)

#### nGetPropertyValueF

    protected static float nGetPropertyValueF​(long handle,
                                              int property)

#### nGetPropertyValueDataType

    protected static void nGetPropertyValueDataType​(long handle,
                                                    int property,
                                                    byte[] dataType)

#### nGetPropertyRangeB

    protected static void nGetPropertyRangeB​(long handle,
                                             int property,
                                             Device.PropertyRangeB outParams)

#### nGetPropertyRangeI

    protected static void nGetPropertyRangeI​(long handle,
                                             int property,
                                             Device.PropertyRangeI outParams)

#### nGetPropertyRangeF

    protected static void nGetPropertyRangeF​(long handle,
                                             int property,
                                             Device.PropertyRangeF outParams)

#### nGetDeviceInfo

    protected static DeviceInfo nGetDeviceInfo​(long handle)

#### nUpgrade

    protected static void nUpgrade​(long handle,
                                   java.lang.String fileName,
                                   UpgradeCallback callback)

#### nUpgrade

    protected static void nUpgrade​(long handle,
                                   java.nio.ByteBuffer buffer,
                                   UpgradeCallback callback)

#### nActivateAuthorization

    protected static boolean nActivateAuthorization​(long handle,
                                                    java.lang.String authCode)

#### nSetStateChangeListener

    protected static void nSetStateChangeListener​(long handle,
                                                  com.orbbec.obsensor.Device.OnStateChangeListenerImpl listener)

#### nGetSupportedPropertyCount

    protected static int nGetSupportedPropertyCount​(long handle)

#### nGetSupportedProperty

    protected static DevicePropertyInfo nGetSupportedProperty​(long handle,
                                                              int index)

#### nTriggerCapture

    protected static void nTriggerCapture​(long handle)

#### nSetTimestampResetConfig

    protected static void nSetTimestampResetConfig​(long handle,
                                                   TimestampResetConfig config)

#### nGetTimestampResetConfig

    protected static TimestampResetConfig nGetTimestampResetConfig​(long handle)

#### nTimestampReset

    protected static void nTimestampReset​(long handle)

#### nTimerSyncWithHost

    protected static void nTimerSyncWithHost​(long handle)

#### nGetMultiDeviceSyncConfig

    protected static MultiDeviceSyncConfig nGetMultiDeviceSyncConfig​(long handle)

#### nSetMultiDeviceSyncConfig

    protected static void nSetMultiDeviceSyncConfig​(long handle,
                                                    MultiDeviceSyncConfig deviceSyncConfig)

#### nGetNetworkConfig

    protected static OBNetworkConfig nGetNetworkConfig​(long handle)

#### nSetNetworkConfig

    protected static void nSetNetworkConfig​(long handle,
                                            OBNetworkConfig config)

#### nGetCalibrationCameraParamList

    protected static long nGetCalibrationCameraParamList​(long handle)

#### nReboot

    protected static void nReboot​(long handle)