#include <Context.hpp>
|
| typedef std::function< void(std::shared_ptr< DeviceList > removedList, std::shared_ptr< DeviceList > addedList)> | DeviceChangedCallback |
| | Type definition for the device changed callback function.
|
| typedef std::function< void(OBLogSeverity severity, const char *logMsg)> | LogCallback |
| | Type definition for the log output callback function.
|
|
| static void | setLoggerSeverity (OBLogSeverity severity) |
| | Set the level of the global log, which affects both the log level output to the console, output to the file and output the user defined callback.
|
| static void | setLoggerToFile (OBLogSeverity severity, const char *directory) |
| | Set log output to a file.
|
| static void | setLoggerFileName (const std::string &fileName) |
| | Set the log file name for file output.
|
| static void | setLoggerToConsole (OBLogSeverity severity) |
| | Set log output to the console.
|
| static void | setLoggerToCallback (OBLogSeverity severity, LogCallback callback) |
| | Set the logger to callback.
|
| static void | logExternalMessage (OBLogSeverity severity, const std::string &module, const std::string &message, const std::string &file, const std::string &func, int line) |
| | Logs a message with severity, file, function, and line info.
|
| static void | setExtensionsDirectory (const char *directory) |
| | Set the extensions directory.
|
Definition at line 29 of file Context.hpp.
◆ DeviceChangedCallback
Type definition for the device changed callback function.
- Parameters
-
| [in] | removedList | The list of removed devices. |
| [in] | addedList | The list of added devices. |
Definition at line 37 of file Context.hpp.
◆ LogCallback
Type definition for the log output callback function.
- Parameters
-
| [in] | severity | The current callback log level. |
| [in] | logMsg | The log message. |
Definition at line 45 of file Context.hpp.
◆ Context()
| ob::Context::Context |
( |
const char * | configPath = "" | ) |
|
|
inlineexplicit |
Context constructor.
The Context class is a management class that describes the runtime of the SDK. It is responsible for applying and releasing resources for the SDK. The context has the ability to manage multiple devices, enumerate devices, monitor device callbacks, and enable functions such as multi-device synchronization.
- Parameters
-
| [in] | configPath | The path to the configuration file. If the path is empty, the default configuration will be used. |
Definition at line 72 of file Context.hpp.
◆ ~Context()
| ob::Context::~Context |
( |
| ) |
|
|
inlinenoexcept |
◆ queryDeviceList()
| std::shared_ptr< DeviceList > ob::Context::queryDeviceList |
( |
| ) |
const |
|
inline |
Queries the enumerated device list.
- Returns
- std::shared_ptr<DeviceList> A pointer to the device list class.
Definition at line 93 of file Context.hpp.
◆ enableNetDeviceEnumeration()
| void ob::Context::enableNetDeviceEnumeration |
( |
bool | enable | ) |
const |
|
inline |
enable or disable net device enumeration.
after enable, the net device will be discovered automatically and can be retrieved by queryDeviceList. The default state can be set in the configuration file.
- Attention
- 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
-
| [in] | enable | true to enable, false to disable |
Definition at line 109 of file Context.hpp.
◆ forceIp()
| bool ob::Context::forceIp |
( |
const char * | macAddress, |
|
|
const OBNetIpConfig & | config ) |
|
inline |
"Force" a static IP address configuration in a device identified by its MAC Address.
- Parameters
-
| [in] | macAddress | MAC address of the network device. You can obtain it from ob_device_info_get_uid, or specify it manually in the format xx:xx:xx:xx:xx:xx, where each xx is a two-digit hexadecimal value. |
| [in] | config | The new IP configuration. |
- Returns
- bool true if the configuration command was processed successfully, false otherwise.
- Note
- This applies to all GigE Vision devices
Definition at line 126 of file Context.hpp.
◆ createNetDevice()
Creates a network device with the specified IP address and port.
- Parameters
-
| [in] | address | The IP address, ipv4 only. such as "192.168.1.10" |
| [in] | port | The port number, currently only support 8090 |
| [in] | accessMode | Device access mode. ob_device_access_mode. If the device does not support setting the Access Mode, the default OB_DEVICE_DEFAULT_ACCESS is used. Applies only on first device creation or after release and re-creation; subsequent calls ignore it. |
- Returns
- std::shared_ptr<Device> The created device object.
Definition at line 144 of file Context.hpp.
◆ setDeviceChangedCallback()
Set the device plug-in callback function.
- Deprecated
- This function is deprecated. Please use registerDeviceChangedCallback() instead.
- Attention
- This function supports multiple callbacks. Each call to this function adds a new callback to an internal list.
- Parameters
-
| [in] | callback | The function triggered when the device is plugged and unplugged. |
Definition at line 160 of file Context.hpp.
◆ registerDeviceChangedCallback()
◆ unregisterDeviceChangedCallback()
| void ob::Context::unregisterDeviceChangedCallback |
( |
OBCallbackId | id | ) |
|
|
inline |
◆ enableDeviceClockSync()
| void ob::Context::enableDeviceClockSync |
( |
uint64_t | repeatIntervalMsec | ) |
const |
|
inline |
Activates device clock synchronization to synchronize the clock of the host and all created devices (if supported).
- Parameters
-
| [in] | repeatIntervalMsec | The interval for auto-repeated synchronization, in milliseconds. If the value is 0, synchronization is performed only once. |
Definition at line 202 of file Context.hpp.
◆ freeIdleMemory()
| void ob::Context::freeIdleMemory |
( |
| ) |
const |
|
inline |
Frees idle memory from the internal frame memory pool.
The SDK includes an internal frame memory pool that caches memory allocated for frames received from devices.
Definition at line 212 of file Context.hpp.
◆ setUvcBackendType()
For linux, there are two ways to enable the UVC backend: libuvc and v4l2. This function is used to set the backend type.
It is effective when the new device is created.
- Attention
- This interface is only available for Linux.
- Parameters
-
| [in] | type | The backend type to be used. |
Definition at line 226 of file Context.hpp.
◆ setLoggerSeverity()
Set the level of the global log, which affects both the log level output to the console, output to the file and output the user defined callback.
- Parameters
-
| [in] | severity | The log output level. |
Definition at line 238 of file Context.hpp.
◆ setLoggerToFile()
| void ob::Context::setLoggerToFile |
( |
OBLogSeverity | severity, |
|
|
const char * | directory ) |
|
inlinestatic |
Set log output to a file.
- Parameters
-
| [in] | severity | The log level output to the file. |
| [in] | directory | The log file output path. 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). |
Definition at line 251 of file Context.hpp.
◆ setLoggerFileName()
| void ob::Context::setLoggerFileName |
( |
const std::string & | fileName | ) |
|
|
inlinestatic |
Set the log file name for file output.
- Parameters
-
| [in] | fileName | Log file name. Must not be empty. |
- Note
- Other settings, such as log level and output directory, remain unchanged.
Definition at line 264 of file Context.hpp.
◆ setLoggerToConsole()
Set log output to the console.
- Parameters
-
| [in] | severity | The log level output to the console. |
Definition at line 275 of file Context.hpp.
◆ setLoggerToCallback()
Set the logger to callback.
- Parameters
-
| [in] | severity | The callback log level. |
| [in] | callback | The callback function. |
Definition at line 287 of file Context.hpp.
◆ logExternalMessage()
| void ob::Context::logExternalMessage |
( |
OBLogSeverity | severity, |
|
|
const std::string & | module, |
|
|
const std::string & | message, |
|
|
const std::string & | file, |
|
|
const std::string & | func, |
|
|
int | line ) |
|
inlinestatic |
Logs a message with severity, file, function, and line info.
- Parameters
-
| severity | Log level, see OBLogSeverity for details |
| module | The module or component the log belongs to |
| message | Message string to log |
| file | Source file name, e.g., FILE |
| func | Function name, e.g., func |
| line | Line number, e.g., LINE |
Definition at line 304 of file Context.hpp.
◆ setExtensionsDirectory()
| void ob::Context::setExtensionsDirectory |
( |
const char * | directory | ) |
|
|
inlinestatic |
Set the extensions directory.
The extensions directory is used to search for dynamic libraries that provide additional functionality to the SDK, such as the Frame filters.
- Attention
- Should be called before creating the context and pipeline, otherwise the default extensions directory (./extensions) will be used.
- Parameters
-
| [in] | directory | Path to the extensions directory. If the path is empty, the existing settings will continue to be used (if the existing |
Definition at line 319 of file Context.hpp.
The documentation for this class was generated from the following file: