NxLib

nxLibInitialize

void nxLibInitialize(int32_t *result, int32_t waitForInitialCameraRefresh)

Explicitly initializes the library and starts to enumerate the connected cameras. When omitting this function call, the library is initialized on first access to the tree.

Note

After nxLibFinalize() was called, the library will no longer be initialized automatically when you access the tree. You can reinitialize it by explicitly calling nxLibInitialize.

Parameters
  • result – A pointer to a variable for the return code of the operation. The following return codes can occur:

    • NxLibOperationSucceeded - The operation completed successfully. No error occurred.

    • NxLibInternalError - An unknown internal error occurred.

  • waitForInitialCameraRefresh – Specifies whether to wait for all cameras to be enumerated. If this parameter is disabled, the function will return immediately while the camera list might not be fully populated yet. You can still access the tree normally and the camera list will be completed eventually.

static void nxLibInitialize(bool waitForInitialCameraRefresh = true)

See

nxLibInitialize(int32_t*, int32_t)

Note

C++ only This function is an overload accessible only in C++. Instead of returning the result code as an output parameter like its C counterpart, it throws an NxLibException in case of an error.

nxLibFinalize

void nxLibFinalize(int32_t *result)

Explicitly closes the library, terminating all internal threads and freeing allocated memory. It is important to explicitly call nxLibFinalize() before unloading the NxLib library when your process is not terminating afterwards, because Windows doesn’t allow to cleanly exit threads during DLL unload.

Note

After closing the library with nxLibFinalize(), it will no longer be automatically initialized when you attempt to access the tree. You can call nxLibInitialize() explicitly to initialize the library again.

Parameters

result – A pointer to a variable for the return code of the operation. The following return codes can occur:

  • NxLibOperationSucceeded - The operation completed successfully. No error occurred.

  • NxLibInternalError - An unknown internal error occurred.

static void nxLibFinalize()

See

nxLibFinalize(int32_t*)

Note

C++ only This function is an overload accessible only in C++. Instead of returning the result code as an output parameter like its C counterpart, it throws an NxLibException in case of an error.

nxLibOpenTcpPort

void nxLibOpenTcpPort(int32_t *result, int32_t portNumber, int32_t *openedPort)

Opens a TCP port through which NxLibRemote can connect to the current NxLib instance.

Note

This function is only available in the NxLib interface. NxLibRemote provides the corresponding functions nxLibConnect() and nxLibDisconnect().

Parameters
  • result – A pointer to a variable for the return code of the operation. The following return codes can occur:

    • NxLibOperationSucceeded - The operation completed successfully. No error occurred.

    • NxLibCouldNotOpenPort - The specified port could not be allocated.

    • NxLibInternalError - An unknown internal error occurred.

    • NxLibInitializationNotAllowed - Executing the function would require to implicitly initialize the NxLib, but this is not allowed because nxLibFinalize() was called before.

  • portNumber – The port to open. Specify 0 here to automatically select a port in the range 24000 to 25000. Note that on Linux ports in the range 1 to 1023 can only be opened with root permissions.

  • openedPort – A pointer to a variable that gets the number of the opened port.

static void nxLibOpenTcpPort(int portNumber = 0, int *openedPort = 0)

See

nxLibOpenTcpPort(int32_t*, int32_t, int32_t*)

Note

C++ only This function is an overload accessible only in C++. Instead of returning the result code as an output parameter like its C counterpart, it throws an NxLibException in case of an error.

nxLibCloseTcpPort

void nxLibCloseTcpPort(int32_t *result)

Disconnects all connected NxLibRemote instances and closes the open TCP port, if any.

Note

This function is only available in the NxLib interface. NxLibRemote provides the corresponding functions nxLibConnect() and nxLibDisconnect().

Parameters

result – A pointer to a variable for the return code of the operation. The following return codes can occur:

  • NxLibOperationSucceeded - The operation completed successfully. No error occurred.

  • NxLibInternalError - An unknown internal error occurred.

  • NxLibInitializationNotAllowed - Executing the function would require to implicitly initialize the NxLib, but this is not allowed because nxLibFinalize() was called before.

static void nxLibCloseTcpPort()

See

nxLibCloseTcpPort(int32_t*)

Note

C++ only This function is an overload accessible only in C++. Instead of returning the result code as an output parameter like its C counterpart, it throws an NxLibException in case of an error.

nxLibOpenDebugBlock

void nxLibOpenDebugBlock(int32_t *result, const char *blockName, int32_t level)

Starts a debug block. This information is used by NxProfiler for its visualization. Open debug blocks can be closed with nxLibCloseDebugBlock().

Possible Debug Levels

nxdInherit: The block will inherit the debug level of its parent. When the block does not have a parent, this will correspond to the debug level "Info".

nxdInfo: Corresponds to the debug level "Info".

nxdDebug: Corresponds to the debug level "Debug".

nxdTrace: Corresponds to the debug level "Trace".

Parameters
  • result – A pointer to a variable for the return code of the operation. The following return codes can occur:

    • NxLibOperationSucceeded - The operation completed successfully. No error occurred.

    • NxLibInvalidParameters - One, multiple, or a combination of parameters are invalid.

    • NxLibNestingLimitReached - The maximum number of open debug blocks has been reached.

    • NxLibInternalError - An unknown internal error occurred.

  • blockName – Debug block name.

  • level – Debug level of this block.

nxLibCloseDebugBlock

void nxLibCloseDebugBlock(int32_t *result)

Closes the current debug block at the inner most nesting level. This information is used by the NxProfiler for its visualization. Debug blocks can be started with nxLibOpenDebugBlock().

Parameters

result – A pointer to a variable for the return code of the operation. The following return codes can occur:

  • NxLibOperationSucceeded - The operation completed successfully. No error occurred.

  • NxLibNoOpenProfileBlock - There is no open debug block that could be closed.

  • NxLibInternalError - An unknown internal error occurred.

nxLibSetDebugThreadName

void nxLibSetDebugThreadName(int32_t *result, const char *threadName)

Sets the debug name of the current thread. This name is used by the NxProfiler for the visualization of the debug information. Multiple threads with the same name and no simultaneously open blocks will be grouped together to a common time line.

Parameters
  • result – A pointer to a variable for the return code of the operation. The following return codes can occur:

    • NxLibOperationSucceeded - The operation completed successfully. No error occurred.

    • NxLibInvalidParameters - One, multiple, or a combination of parameters are invalid.

    • NxLibInternalError - An unknown internal error occurred.

  • threadName – Debug thread name.

static void nxLibSetDebugThreadName(std::string const &threadName)

See

nxLibSetDebugThreadName(int32_t *, const char*)

Note

C++ only This function is an overload accessible only in C++. Instead of returning the result code as an output parameter like its C counterpart, it throws an NxLibException in case of an error.