Skip to content
Start free evaluation

pdcomm::opcua::license

Class

PDComm license of the OPC UA library: install license text, read the license status and this host id.

class license

Declared in: #include <pdcomm/opcua/pdcomm_opcua.hpp>

Client discovery and connect need a license for the opcua-client module and server creation one for opcua-server; without it those calls throw error with #PDCOMM_OPCUA_LICENSE_REQUIRED (see error::license_required()). Licenses installed here are merged with the PDCOMM_LICENSE and PDCOMM_LICENSE_FILE environment variables and pdcomm.license files. All members are static and thread-safe.

pdcomm::opcua::license::install(license_text);
std::cout << pdcomm::opcua::license::status() << '\n';

Members

host_id

Method

Returns this host id, PDH1-XXXX-XXXX-XXXX-XXXX.

static std::string host_id()

Declared in: #include <pdcomm/opcua/pdcomm_opcua.hpp>

Returns

The host id that host-bound licenses name.

Notes

  • Throws error: with #PDCOMM_OPCUA_RUNTIME_ERROR when the machine id cannot be read.

install

Method

Installs license text, replacing text installed earlier.

static void install(const std::string& text)

Declared in: #include <pdcomm/opcua/pdcomm_opcua.hpp>

Parameters

NameDescription
textText with one or more PDCOMM LICENSE blocks; empty text removes the installed text.

Notes

  • Throws error: with #PDCOMM_OPCUA_INVALID_INPUT when the text holds no block whose signature verifies, is larger than 1 MiB or is not UTF-8; the previous text stays installed.

status

Method

Returns the license status JSON (see pdcomm_opcua_license_status()).

static std::string status()

Declared in: #include <pdcomm/opcua/pdcomm_opcua.hpp>

Returns

UTF-8 JSON object with host_id, sources, licenses and the modules states.

Notes

  • Throws error: if the status cannot be read.