QOpcUaApplicationIdentity Class | Qt OPC UA 6.4.1

- Qt 6.4
- Qt OPC UA
- C++ Classes
- QOpcUaApplicationIdentity
- Qt 6.4.1 Reference Documentation

# QOpcUaApplicationIdentity Class

QOpcUaApplicationIdentity defines the identity of the application. More...

Header: | #include <QOpcUaApplicationIdentity>
CMake: | find_package(Qt6 REQUIRED COMPONENTS OpcUa) target_link_libraries(mytarget PRIVATE Qt6::OpcUa)
qmake: | QT += opcua
Since: | QtOpcUa 5.13

- List of all members, including inherited members

## Public Functions

| QOpcUaApplicationIdentity(const QOpcUaApplicationIdentity &other)
QOpcUaApplicationIdentity & | operator=(const QOpcUaApplicationIdentity &rhs)
QString | applicationName() const
QOpcUaApplicationDescription::ApplicationType | applicationType() const
QString | applicationUri() const
bool | isValid() const
QString | productUri() const
void | setApplicationName(const QString &value)
void | setApplicationType(QOpcUaApplicationDescription::ApplicationType value)
void | setApplicationUri(const QString &value)
void | setProductUri(const QString &value)

## Detailed Description

This info must be configured using QOpcUaClient::setApplicationIdentity. The application identity can be set up manually or derived from a certificate.

     QOpcUaApplicationIdentity identity;

     const QString applicationUri = QStringLiteral("urn:%1:%2:%3")
             .arg(QHostInfo::localHostName())
             .arg(QCoreApplication::organizationName())
             .arg(QCoreApplication::applicationName());
     const QString productUri = QStringLiteral("urn:%1:%2")
             .arg(QCoreApplication::organizationName())
             .arg(QCoreApplication::applicationName());

     identity.setProductUri(productUri);
     identity.setApplicationUri(applicationUri);
     identity.setApplicationName(QCoreApplication::applicationName());
     identity.setApplicationType(QOpcUaApplicationDescription::Client);

     client->setApplicationIdentity(identity);

In case your application authenticates using certificates the application identity has to match the used certificate. In this case all information is extracted from the certificate given in the PKI configuration.

     QOpcUaApplicationIdentity identity;
     identity = pkiConfig.applicationIdentity();

## Member Function Documentation

### QOpcUaApplicationIdentity::QOpcUaApplicationIdentity(const QOpcUaApplicationIdentity &other)

Constructs an application identity from other.

### QOpcUaApplicationIdentity &QOpcUaApplicationIdentity::operator=(const QOpcUaApplicationIdentity &rhs)

Sets the values of rhs in this QOpcUaApplicationIdentity.

### QString QOpcUaApplicationIdentity::applicationName() const

Returns the human readable name of the application. This does not need to be unique.

See also setApplicationName().

### QOpcUaApplicationDescription::ApplicationType QOpcUaApplicationIdentity::applicationType() const

Returns the application's type.

See also setApplicationType().

### QString QOpcUaApplicationIdentity::applicationUri() const

Returns the application's application URI.

This must be unique for each installation instance of the application and must match the ApplicationURI in the application's certificate.

See also setApplicationUri().

### bool QOpcUaApplicationIdentity::isValid() const

Returns true if the application identity contains valid data.

### QString QOpcUaApplicationIdentity::productUri() const

Returns the application's productUri.

This uniquely identifies the product.

See also setProductUri().

### void QOpcUaApplicationIdentity::setApplicationName(const QString &value)

Sets the application name to value.

See also applicationName().

### void QOpcUaApplicationIdentity::setApplicationType(QOpcUaApplicationDescription::ApplicationType value)

Sets the type of the application. Client applications should set value to Client.

The default value is Client.

See also applicationType().

### void QOpcUaApplicationIdentity::setApplicationUri(const QString &value)

Sets the applicationUri to value.

See also applicationUri() and setApplicationName().

### void QOpcUaApplicationIdentity::setProductUri(const QString &value)

Sets the productUri to value.

See also productUri().