Package com.orbbec.obsensor

## Class OBContext

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

All Implemented Interfaces:
  `java.lang.AutoCloseable`

    public class OBContext
    extends LobClass

### Field Summary

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

`handle, owner`

### Constructor Summary

Constructors
`OBContext​(DeviceChangedCallback callback)` Create SDK context, apply for authorization, and enable device listening
`OBContext​(java.lang.String configPath, DeviceChangedCallback callback)` Create SDK context, apply for authorization, and enable device listening

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `close()` SDK Context resource release
`Device` `createNetDevice​(java.lang.String address, int port)` Create a network device object
`void` `enableDeviceClockSync​(long repeatIntervalMs)` Activates device clock synchronization to synchronize the clock of the host and all created devices (if supported).
`void` `enableNetDeviceEnumeration​(boolean enable)` enable or disable net device enumeration.
`static java.lang.String` `getStageVersion()` Get sdk stage version.
`static int` `getVersionCode()` Get SDK version number
`static java.lang.String` `getVersionName()` Get SDK version name
`DeviceList` `queryDevices()` Query device list
`void` `removeDevicesChangedCallback()` Remove device plug and unplug listener callback
`void` `setDevicesChangedCallback​(DeviceChangedCallback callback)` Set device plug and unplug listener callback
`static void` `setLoggerSeverity​(LogSeverity severity)` Setting the level of the global log will affect both the log level output to the console and the log output to the file
`static void` `setLoggerToConsole​(LogSeverity severity)` Set log parameters and output to console
`static void` `setLoggerToFile​(LogSeverity severity, java.lang.String directory)` Set log parameters and output to the specified file

### 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`

### Constructor Detail

#### OBContext

    public OBContext​(DeviceChangedCallback callback)

Create SDK context, apply for authorization, and enable device listening

Parameters:
  `callback` - Device listening `DeviceChangedCallback`

#### OBContext

    public OBContext​(java.lang.String configPath,
                     DeviceChangedCallback callback)

Create SDK context, apply for authorization, and enable device listening

Parameters:
  `configPath` - configuration file path
  `callback` - Device listening `DeviceChangedCallback`

### Method Detail

#### setLoggerSeverity

    public static void setLoggerSeverity​(LogSeverity severity)

Setting the level of the global log will affect both the log level output to the console and the log output to the file

Parameters:
  `severity` - Output log level`LogSeverity`

#### setLoggerToConsole

    public static void setLoggerToConsole​(LogSeverity severity)

Set log parameters and output to console

Parameters:
  `severity` - Log output level `LogSeverity`

#### setLoggerToFile

    public static void setLoggerToFile​(LogSeverity severity,
                                       java.lang.String directory)

Set log parameters and output to the specified file

Parameters:
  `severity` - Log output level `LogSeverity`
  `directory` - Save log file directory

#### getVersionName

    public static java.lang.String getVersionName()

Get SDK version name

Returns:
  SDK version name

#### getVersionCode

    public static int getVersionCode()

Get SDK version number

Returns:
  SDK version number

#### getStageVersion

    public static java.lang.String getStageVersion()

Get sdk stage version.

Returns:
  sdk stage version.

#### setDevicesChangedCallback

    public void setDevicesChangedCallback​(DeviceChangedCallback callback)

Set device plug and unplug listener callback

Parameters:
  `callback` - Device plugging and unplugging monitor `DeviceChangedCallback`

#### removeDevicesChangedCallback

    public void removeDevicesChangedCallback()

Remove device plug and unplug listener callback

#### queryDevices

    public DeviceList queryDevices()

Query device list

Returns:
  Device List `DeviceList`

#### enableDeviceClockSync

    public void enableDeviceClockSync​(long repeatIntervalMs)

Activates device clock synchronization to synchronize the clock of the host and all created devices (if supported).

Parameters:
  `repeatIntervalMs` - The interval for auto-repeated synchronization, in milliseconds. If the value is 0, synchronization is performed only once.

#### enableNetDeviceEnumeration

    public void enableNetDeviceEnumeration​(boolean enable)

enable or disable net device enumeration. after enable, the net device will be discovered automatically and can be retrieved by @ref queryDeviceList. The default state can be set in the configuration file.

Net device enumeration by gvcp protocol, if the device is not in the same subnet as the host, it will be discovered but cannot be connected.

Parameters:
  `enable` - true to enable, false to disable

#### createNetDevice

    public Device createNetDevice​(java.lang.String address,
                                  int port)

Create a network device object

Parameters:
  `address` - ip address
  `port` - port
Returns:
  Target network device object

#### close

    public void close()

SDK Context resource release