| OrbbecSDK 1.10.18 OrbbecSDK: Software-Development-Kit for Orbbec 3D Cameras

Loading...
Searching...
No Matches
Macros | Functions
Context.h File Reference

Context is a management class that describes the runtime of the SDK and is responsible for resource allocation and release of the SDK. Context has the ability to manage multiple devices. It is responsible for enumerating devices, monitoring device callbacks, and enabling multi-device synchronization. More...

`#include "ObTypes.h"`

Go to the source code of this file.

## Macros
#define | ob_enable_multi_device_sync ob_enable_device_clock_sync

## Functions
ob_context * | ob_create_context (ob_error **error)
| Create a context object.
ob_context * | ob_create_context_with_config (const char *config_path, ob_error **error)
| Create a context object with a specified configuration file.
void | ob_delete_context (ob_context *context, ob_error **error)
| Delete a context object.
ob_device_list * | ob_query_device_list (ob_context *context, ob_error **error)
| Get a list of enumerated devices.
void | ob_enable_net_device_enumeration (ob_context *context, bool enable, ob_error **error)
| Enable or disable network device enumeration.
ob_device * | ob_create_net_device (ob_context *context, const char *address, uint16_t port, ob_error **error)
| Create a network device object.
void | ob_set_device_changed_callback (ob_context *context, ob_device_changed_callback callback, void *user_data, ob_error **error)
| Set a device plug-in callback function.
void | ob_enable_device_clock_sync (ob_context *context, uint64_t repeatInterval, ob_error **error)
| Activates device clock synchronization to synchronize the clock of the host and all created devices (if supported).
void | ob_free_idle_memory (ob_context *context, ob_error **error)
| Free idle memory from the internal frame memory pool.
void | ob_set_logger_severity (ob_log_severity severity, ob_error **error)
| Set the global log level.
void | ob_set_logger_to_file (ob_log_severity severity, const char *directory, ob_error **error)
| Set the log output to a file.
void | ob_set_logger_callback (ob_log_severity severity, ob_log_callback callback, void *user_data, ob_error **error)
| Set the log callback function.
void | ob_set_logger_to_console (ob_log_severity severity, ob_error **error)
| Set the log output to the console.
void | ob_load_license (const char *filePath, const char *key, ob_error **error)
| Load a license file.
void | ob_load_license_from_data (const char *data, uint32_t dataLen, const char *key, ob_error **error)
| Load a license from data.
void | ob_set_uvc_backend (ob_context *context, ob_uvc_backend uvc_backend, ob_error **error)
| Set the UVC backend for the specified context This function configures the Universal Video Class (UVC) backend for the given context, allowing the selection of a specific backend for video capture operations.

## Detailed Description

Context is a management class that describes the runtime of the SDK and is responsible for resource allocation and release of the SDK. Context has the ability to manage multiple devices. It is responsible for enumerating devices, monitoring device callbacks, and enabling multi-device synchronization.

Definition in file Context.h.

## Macro Definition Documentation

## ◆ ob_enable_multi_device_sync

#define ob_enable_multi_device_sync ob_enable_device_clock_sync

Definition at line 93 of file Context.h.

## Function Documentation

## ◆ ob_create_context()

ob_context * ob_create_context | ( | ob_error ** | error | ) |

Create a context object.

Parameters

  [out] | error | Pointer to an error object that will be populated if an error occurs during context creation

Returns
  Pointer to the created context object

## ◆ ob_create_context_with_config()

ob_context * ob_create_context_with_config | ( | const char * | config_path,
|  | ob_error ** | error
| ) |  |

Create a context object with a specified configuration file.

Parameters

  [in] | config_path | Path to the configuration file. If NULL, the default configuration file will be used.
  [out] | error | Pointer to an error object that will be populated if an error occurs during context creation

Returns
  Pointer to the created context object

## ◆ ob_delete_context()

void ob_delete_context | ( | ob_context * | context,
|  | ob_error ** | error
| ) |  |

Delete a context object.

Parameters

  [in] | context | Pointer to the context object to be deleted
  [out] | error | Pointer to an error object that will be populated if an error occurs during context deletion

## ◆ ob_query_device_list()

ob_device_list * ob_query_device_list | ( | ob_context * | context,
|  | ob_error ** | error
| ) |  |

Get a list of enumerated devices.

Parameters

  [in] | context | Pointer to the context object
  [out] | error | Pointer to an error object that will be populated if an error occurs during device enumeration

Returns
  Pointer to the device list object

## ◆ ob_enable_net_device_enumeration()

void ob_enable_net_device_enumeration | ( | ob_context * | context,
|  | bool | enable,
|  | ob_error ** | error
| ) |  |

Enable or disable network device enumeration.

After enabling, the network device will be automatically discovered and can be retrieved through ob_query_device_list. The default state can be set in the configuration file.

Attention
  Network device enumeration is performed through the GVCP protocol. If the device is not in the same subnet as the host, it will be discovered but cannot be connected.

Parameters

  [in] | context | Pointer to the context object
  [in] | enable | true to enable, false to disable
  [out] | error | Pointer to an error object that will be populated if an error occurs.

## ◆ ob_create_net_device()

ob_device * ob_create_net_device | ( | ob_context * | context,
|  | const char * | address,
|  | uint16_t | port,
|  | ob_error ** | error
| ) |  |

Create a network device object.

Parameters

  [in] | context | Pointer to the context object
  [in] | address | IP address of the device
  [in] | port | Port number of the device
  [out] | error | Pointer to an error object that will be populated if an error occurs during device creation

Returns
  Pointer to the created device object

## ◆ ob_set_device_changed_callback()

void ob_set_device_changed_callback | ( | ob_context * | context,
|  | ob_device_changed_callback | callback,
|  | void * | user_data,
|  | ob_error ** | error
| ) |  |

Set a device plug-in callback function.

Attention
  The added and removed device lists returned through the callback interface need to be released manually

Parameters

  [in] | context | Pointer to the context object
  [in] | callback | Pointer to the callback function triggered when a device is plugged or unplugged
  [in] | user_data | Pointer to user data that can be passed to and retrieved from the callback function
  [out] | error | Pointer to an error object that will be populated if an error occurs during callback function setting

## ◆ ob_enable_device_clock_sync()

void ob_enable_device_clock_sync | ( | ob_context * | context,
|  | uint64_t | repeatInterval,
|  | ob_error ** | error
| ) |  |

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

Parameters

  [in] | context | Pointer to the context object
  [in] | repeatInterval | The interval for auto-repeated synchronization, in milliseconds. If the value is 0, synchronization is performed only once.
  [out] | error | Pointer to an error object that will be populated if an error occurs during execution

## ◆ ob_free_idle_memory()

void ob_free_idle_memory | ( | ob_context * | context,
|  | ob_error ** | error
| ) |  |

Free idle memory from the internal frame memory pool.

Parameters

  [in] | context | Pointer to the context object
  [out] | error | Pointer to an error object that will be populated if an error occurs during memory freeing

## ◆ ob_set_logger_severity()

void ob_set_logger_severity | ( | ob_log_severity | severity,
|  | ob_error ** | error
| ) |  |

Set the global log level.

Attention
  This interface setting will affect the output level of all logs (terminal, file, callback)

Parameters

  [in] | severity | Log level to set
  [out] | error | Pointer to an error object that will be populated if an error occurs during log level setting

## ◆ ob_set_logger_to_file()

void ob_set_logger_to_file | ( | ob_log_severity | severity,
|  | const char * | directory,
|  | ob_error ** | error
| ) |  |

Set the log output to a file.

Parameters

  [in] | severity | Log level to output to file
  [in] | directory | Path to the log file output directory. If the path is empty, the existing settings will continue to be used (if the existing configuration is also empty, the log will not be output to the file)
  [out] | error | Pointer to an error object that will be populated if an error occurs during log output setting

## ◆ ob_set_logger_callback()

void ob_set_logger_callback | ( | ob_log_severity | severity,
|  | ob_log_callback | callback,
|  | void * | user_data,
|  | ob_error ** | error
| ) |  |

Set the log callback function.

Parameters

  [in] | severity | Log level to set for the callback function
  [in] | callback | Pointer to the callback function
  [in] | user_data | Pointer to user data that can be passed to and retrieved from the callback function
  [out] | error | Pointer to an error object that will be populated if an error occurs during log callback function setting

## ◆ ob_set_logger_to_console()

void ob_set_logger_to_console | ( | ob_log_severity | severity,
|  | ob_error ** | error
| ) |  |

Set the log output to the console.

Parameters

  [in] | severity | Log level to output to the console
  [out] | error | Pointer to an error object that will be populated if an error occurs during log output setting

## ◆ ob_load_license()

void ob_load_license | ( | const char * | filePath,
|  | const char * | key,
|  | ob_error ** | error
| ) |  |

Load a license file.

Parameters

  [in] | filePath | Path to the license file
  [in] | key | Decryption key. "OB_DEFAULT_DECRYPT_KEY" can be used to represent the default key.
  [out] | error | Pointer to an error object that will be populated if an error occurs during license loading

## ◆ ob_load_license_from_data()

void ob_load_license_from_data | ( | const char * | data,
|  | uint32_t | dataLen,
|  | const char * | key,
|  | ob_error ** | error
| ) |  |

Load a license from data.

Parameters

  [in] | data | Pointer to the license data
  [in] | dataLen | Length of the license data
  [in] | key | Decryption key. "OB_DEFAULT_DECRYPT_KEY" can be used to represent the default key.
  [out] | error | Pointer to an error object that will be populated if an error occurs during license loading

## ◆ ob_set_uvc_backend()

void ob_set_uvc_backend | ( | ob_context * | context,
|  | ob_uvc_backend | uvc_backend,
|  | ob_error ** | error
| ) |  |

Set the UVC backend for the specified context This function configures the Universal Video Class (UVC) backend for the given context, allowing the selection of a specific backend for video capture operations.

Attention
  This function is only supported on Linux (ARM) platforms. Some devices, like the Dabai series, do not support V4L2. Therefore, the default backend is LIBUVC. Ensure that the device supports V4L2 before setting it as the backend.

Parameters

  [in] | context | Pointer to the context object
  [in] | uvc_backend | Specifies the UVC backend to use: `UVC_BACKEND_AUTO`: Automatically selects between V4L2 or libuvc based on metadata support. `UVC_BACKEND_LIBUVC`: Forces the use of libuvc. `UVC_BACKEND_V4L2`: Forces the use of V4L2.
  [out] | error | Pointer to an error object that will be populated if an error occurs.