QOpcUaErrorState Class

QOpcUaErrorState 允许对来自后端的错误状态进行调查和交互。更多

头文件: #include <QOpcUaErrorState>
CMake: find_package(Qt6 REQUIRED COMPONENTS OpcUa)
target_link_libraries(mytarget PRIVATE Qt6::OpcUa)
qmake: QT += opcua
QtOpcUa 5.13

公共类型

enum class ConnectionStep { Unknown, CertificateValidation, OpenSecureChannel, CreateSession, ActivateSession }

公共函数

QOpcUaErrorState()
QOpcUaErrorState(const QOpcUaErrorState &other)
QOpcUaErrorState::ConnectionStep connectionStep() const
QOpcUa::UaStatusCode errorCode() const
bool ignoreError() const
bool isClientSideError() const
void setClientSideError(bool clientSideError)
void setConnectionStep(QOpcUaErrorState::ConnectionStep step)
void setErrorCode(QOpcUa::UaStatusCode error)
void setIgnoreError(bool ignore = true)
QOpcUaErrorState &operator=(const QOpcUaErrorState &rhs)

详细说明

无需在代码中实例化该类。如果在建立连接时发生错误,客户端将通过QOpcUaClient::connectError 发送错误状态。

错误可能由后端本身引起,也可能由服务器拒绝连接引起。如果是本地后端出错,可以通过调用函数setIgnoreError() 来忽略。

成员类型文档

enum class QOpcUaErrorState::ConnectionStep

指定错误发生在建立连接的哪一步。

常数说明
QOpcUaErrorState::ConnectionStep::Unknown0x00连接步骤未知。
QOpcUaErrorState::ConnectionStep::CertificateValidation0x1在证书验证步骤中出错。
QOpcUaErrorState::ConnectionStep::OpenSecureChannel0x2打开安全通道时出错。
QOpcUaErrorState::ConnectionStep::CreateSession0x3创建会话时出错。
QOpcUaErrorState::ConnectionStep::ActivateSession0x4激活会话时出错。

成员函数文档

QOpcUaErrorState::QOpcUaErrorState()

默认情况下会构建一个未设置参数的错误状态。

QOpcUaErrorState::QOpcUaErrorState(const QOpcUaErrorState &other)

other 构建错误状态。

QOpcUaErrorState::ConnectionStep QOpcUaErrorState::connectionStep() const

返回发生错误的连接步骤。

另请参阅 setConnectionStep()。

QOpcUa::UaStatusCode QOpcUaErrorState::errorCode() const

返回发生错误时的 OPC UA 状态代码。

另请参阅 setErrorCode().

bool QOpcUaErrorState::ignoreError() const

返回是否应忽略客户端错误。

另请参阅 setIgnoreError().

bool QOpcUaErrorState::isClientSideError() const

返回发生的错误是否是客户端错误。

void QOpcUaErrorState::setClientSideError(bool clientSideError)

设置发生的错误是否为客户端错误,clientSideError

另请参阅 isClientSideError() 。

void QOpcUaErrorState::setConnectionStep(QOpcUaErrorState::ConnectionStep step)

将发生错误的连接步骤设置为step

另请参阅 connectionStep() 。

void QOpcUaErrorState::setErrorCode(QOpcUa::UaStatusCode error)

将发生错误的 OPC UA 状态代码设置为error

另请参阅 errorCode() 。

void QOpcUaErrorState::setIgnoreError(bool ignore = true)

设置该客户端错误是否应被忽略,ignore

只有当错误实际上是客户端错误时,设置此标志才有效。

另请参阅 ignoreError() 。

QOpcUaErrorState &QOpcUaErrorState::operator=(const QOpcUaErrorState &rhs)

设置rhs 在此错误状态下的值。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.