| 1 | // Copyright (C) 2021 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef OPCUASTATUS_P_H |
| 5 | #define OPCUASTATUS_P_H |
| 6 | |
| 7 | #include <QStandardItemModel> |
| 8 | #include <QtOpcUa/qopcuatype.h> |
| 9 | #include <QOpcUaApplicationDescription> |
| 10 | #include <QtQml/qqml.h> |
| 11 | #include <QtCore/private/qglobal_p.h> |
| 12 | |
| 13 | // |
| 14 | // W A R N I N G |
| 15 | // ------------- |
| 16 | // |
| 17 | // This file is not part of the Qt API. It exists purely as an |
| 18 | // implementation detail. This header file may change from version to |
| 19 | // version without notice, or even be removed. |
| 20 | // |
| 21 | // We mean it. |
| 22 | // |
| 23 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | |
| 26 | class OpcUaConnection; |
| 27 | |
| 28 | class OpcUaStatus |
| 29 | { |
| 30 | Q_GADGET |
| 31 | Q_PROPERTY(bool isGood READ isGood) |
| 32 | Q_PROPERTY(bool isBad READ isBad) |
| 33 | Q_PROPERTY(Status status READ status) |
| 34 | |
| 35 | // This is a value type. Thus lowercase. The enums are taken care of below |
| 36 | QML_VALUE_TYPE(status) |
| 37 | QML_ADDED_IN_VERSION(5, 13) |
| 38 | |
| 39 | public: |
| 40 | enum class Status { |
| 41 | Good = 0x0000, |
| 42 | Uncertain = 0x4000, |
| 43 | Bad = 0x8000, |
| 44 | BadUnexpectedError = 0x8001, |
| 45 | BadInternalError = 0x8002, |
| 46 | BadOutOfMemory = 0x8003, |
| 47 | BadResourceUnavailable = 0x8004, |
| 48 | BadCommunicationError = 0x8005, |
| 49 | BadEncodingError = 0x8006, |
| 50 | BadDecodingError = 0x8007, |
| 51 | BadEncodingLimitsExceeded = 0x8008, |
| 52 | BadRequestTooLarge = 0x80B8, |
| 53 | BadResponseTooLarge = 0x80B9, |
| 54 | BadUnknownResponse = 0x8009, |
| 55 | BadTimeout = 0x800A, |
| 56 | BadServiceUnsupported = 0x800B, |
| 57 | BadShutdown = 0x800C, |
| 58 | BadServerNotConnected = 0x800D, |
| 59 | BadServerHalted = 0x800E, |
| 60 | BadNothingToDo = 0x800F, |
| 61 | BadTooManyOperations = 0x8010, |
| 62 | BadTooManyMonitoredItems = 0x80DB, |
| 63 | BadDataTypeIdUnknown = 0x8011, |
| 64 | BadCertificateInvalid = 0x8012, |
| 65 | BadSecurityChecksFailed = 0x8013, |
| 66 | BadCertificatePolicyCheckFailed = 0x8114, |
| 67 | BadCertificateTimeInvalid = 0x8014, |
| 68 | BadCertificateIssuerTimeInvalid = 0x8015, |
| 69 | BadCertificateHostNameInvalid = 0x8016, |
| 70 | BadCertificateUriInvalid = 0x8017, |
| 71 | BadCertificateUseNotAllowed = 0x8018, |
| 72 | BadCertificateIssuerUseNotAllowed = 0x8019, |
| 73 | BadCertificateUntrusted = 0x801A, |
| 74 | BadCertificateRevocationUnknown = 0x801B, |
| 75 | BadCertificateIssuerRevocationUnknown = 0x801C, |
| 76 | BadCertificateRevoked = 0x801D, |
| 77 | BadCertificateIssuerRevoked = 0x801E, |
| 78 | BadCertificateChainIncomplete = 0x810D, |
| 79 | BadUserAccessDenied = 0x801F, |
| 80 | BadIdentityTokenInvalid = 0x8020, |
| 81 | BadIdentityTokenRejected = 0x8021, |
| 82 | BadSecureChannelIdInvalid = 0x8022, |
| 83 | BadInvalidTimestamp = 0x8023, |
| 84 | BadNonceInvalid = 0x8024, |
| 85 | BadSessionIdInvalid = 0x8025, |
| 86 | BadSessionClosed = 0x8026, |
| 87 | BadSessionNotActivated = 0x8027, |
| 88 | BadSubscriptionIdInvalid = 0x8028, |
| 89 | = 0x802A, |
| 90 | BadTimestampsToReturnInvalid = 0x802B, |
| 91 | BadRequestCancelledByClient = 0x802C, |
| 92 | BadTooManyArguments = 0x80E5, |
| 93 | BadLicenseExpired = 0x810E, |
| 94 | BadLicenseLimitsExceeded = 0x810F, |
| 95 | BadLicenseNotAvailable = 0x8110, |
| 96 | GoodSubscriptionTransferred = 0x002D, |
| 97 | GoodCompletesAsynchronously = 0x002E, |
| 98 | GoodOverload = 0x002F, |
| 99 | GoodClamped = 0x0030, |
| 100 | BadNoCommunication = 0x8031, |
| 101 | BadWaitingForInitialData = 0x8032, |
| 102 | BadNodeIdInvalid = 0x8033, |
| 103 | BadNodeIdUnknown = 0x8034, |
| 104 | BadAttributeIdInvalid = 0x8035, |
| 105 | BadIndexRangeInvalid = 0x8036, |
| 106 | BadIndexRangeNoData = 0x8037, |
| 107 | BadDataEncodingInvalid = 0x8038, |
| 108 | BadDataEncodingUnsupported = 0x8039, |
| 109 | BadNotReadable = 0x803A, |
| 110 | BadNotWritable = 0x803B, |
| 111 | BadOutOfRange = 0x803C, |
| 112 | BadNotSupported = 0x803D, |
| 113 | BadNotFound = 0x803E, |
| 114 | BadObjectDeleted = 0x803F, |
| 115 | BadNotImplemented = 0x8040, |
| 116 | BadMonitoringModeInvalid = 0x8041, |
| 117 | BadMonitoredItemIdInvalid = 0x8042, |
| 118 | BadMonitoredItemFilterInvalid = 0x8043, |
| 119 | BadMonitoredItemFilterUnsupported = 0x8044, |
| 120 | BadFilterNotAllowed = 0x8045, |
| 121 | BadStructureMissing = 0x8046, |
| 122 | BadEventFilterInvalid = 0x8047, |
| 123 | BadContentFilterInvalid = 0x8048, |
| 124 | BadFilterOperatorInvalid = 0x80C1, |
| 125 | BadFilterOperatorUnsupported = 0x80C2, |
| 126 | BadFilterOperandCountMismatch = 0x80C3, |
| 127 | BadFilterOperandInvalid = 0x8049, |
| 128 | BadFilterElementInvalid = 0x80C4, |
| 129 | BadFilterLiteralInvalid = 0x80C5, |
| 130 | BadContinuationPointInvalid = 0x804A, |
| 131 | BadNoContinuationPoints = 0x804B, |
| 132 | BadReferenceTypeIdInvalid = 0x804C, |
| 133 | BadBrowseDirectionInvalid = 0x804D, |
| 134 | BadNodeNotInView = 0x804E, |
| 135 | BadNumericOverflow = 0x8112, |
| 136 | BadServerUriInvalid = 0x804F, |
| 137 | BadServerNameMissing = 0x8050, |
| 138 | BadDiscoveryUrlMissing = 0x8051, |
| 139 | BadSempahoreFileMissing = 0x8052, |
| 140 | BadRequestTypeInvalid = 0x8053, |
| 141 | BadSecurityModeRejected = 0x8054, |
| 142 | BadSecurityPolicyRejected = 0x8055, |
| 143 | BadTooManySessions = 0x8056, |
| 144 | BadUserSignatureInvalid = 0x8057, |
| 145 | BadApplicationSignatureInvalid = 0x8058, |
| 146 | BadNoValidCertificates = 0x8059, |
| 147 | BadIdentityChangeNotSupported = 0x80C6, |
| 148 | BadRequestCancelledByRequest = 0x805A, |
| 149 | BadParentNodeIdInvalid = 0x805B, |
| 150 | BadReferenceNotAllowed = 0x805C, |
| 151 | BadNodeIdRejected = 0x805D, |
| 152 | BadNodeIdExists = 0x805E, |
| 153 | BadNodeClassInvalid = 0x805F, |
| 154 | BadBrowseNameInvalid = 0x8060, |
| 155 | BadBrowseNameDuplicated = 0x8061, |
| 156 | BadNodeAttributesInvalid = 0x8062, |
| 157 | BadTypeDefinitionInvalid = 0x8063, |
| 158 | BadSourceNodeIdInvalid = 0x8064, |
| 159 | BadTargetNodeIdInvalid = 0x8065, |
| 160 | BadDuplicateReferenceNotAllowed = 0x8066, |
| 161 | BadInvalidSelfReference = 0x8067, |
| 162 | BadReferenceLocalOnly = 0x8068, |
| 163 | BadNoDeleteRights = 0x8069, |
| 164 | UncertainReferenceNotDeleted = 0x40BC, |
| 165 | BadServerIndexInvalid = 0x806A, |
| 166 | BadViewIdUnknown = 0x806B, |
| 167 | BadViewTimestampInvalid = 0x80C9, |
| 168 | BadViewParameterMismatch = 0x80CA, |
| 169 | BadViewVersionInvalid = 0x80CB, |
| 170 | UncertainNotAllNodesAvailable = 0x40C0, |
| 171 | GoodResultsMayBeIncomplete = 0x00BA, |
| 172 | BadNotTypeDefinition = 0x80C8, |
| 173 | UncertainReferenceOutOfServer = 0x406C, |
| 174 | BadTooManyMatches = 0x806D, |
| 175 | BadQueryTooComplex = 0x806E, |
| 176 | BadNoMatch = 0x806F, |
| 177 | BadMaxAgeInvalid = 0x8070, |
| 178 | BadSecurityModeInsufficient = 0x80E6, |
| 179 | BadHistoryOperationInvalid = 0x8071, |
| 180 | BadHistoryOperationUnsupported = 0x8072, |
| 181 | BadInvalidTimestampArgument = 0x80BD, |
| 182 | BadWriteNotSupported = 0x8073, |
| 183 | BadTypeMismatch = 0x8074, |
| 184 | BadMethodInvalid = 0x8075, |
| 185 | BadArgumentsMissing = 0x8076, |
| 186 | BadNotExecutable = 0x8111, |
| 187 | BadTooManySubscriptions = 0x8077, |
| 188 | BadTooManyPublishRequests = 0x8078, |
| 189 | BadNoSubscription = 0x8079, |
| 190 | BadSequenceNumberUnknown = 0x807A, |
| 191 | GoodRetransmissionQueueNotSupported = 0x00DF, |
| 192 | BadMessageNotAvailable = 0x807B, |
| 193 | BadInsufficientClientProfile = 0x807C, |
| 194 | BadStateNotActive = 0x80BF, |
| 195 | BadAlreadyExists = 0x8115, |
| 196 | BadTcpServerTooBusy = 0x807D, |
| 197 | BadTcpMessageTypeInvalid = 0x807E, |
| 198 | BadTcpSecureChannelUnknown = 0x807F, |
| 199 | BadTcpMessageTooLarge = 0x8080, |
| 200 | BadTcpNotEnoughResources = 0x8081, |
| 201 | BadTcpInternalError = 0x8082, |
| 202 | BadTcpEndpointUrlInvalid = 0x8083, |
| 203 | BadRequestInterrupted = 0x8084, |
| 204 | BadRequestTimeout = 0x8085, |
| 205 | BadSecureChannelClosed = 0x8086, |
| 206 | BadSecureChannelTokenUnknown = 0x8087, |
| 207 | BadSequenceNumberInvalid = 0x8088, |
| 208 | BadProtocolVersionUnsupported = 0x80BE, |
| 209 | BadConfigurationError = 0x8089, |
| 210 | BadNotConnected = 0x808A, |
| 211 | BadDeviceFailure = 0x808B, |
| 212 | BadSensorFailure = 0x808C, |
| 213 | BadOutOfService = 0x808D, |
| 214 | BadDeadbandFilterInvalid = 0x808E, |
| 215 | UncertainNoCommunicationLastUsableValue = 0x408F, |
| 216 | UncertainLastUsableValue = 0x4090, |
| 217 | UncertainSubstituteValue = 0x4091, |
| 218 | UncertainInitialValue = 0x4092, |
| 219 | UncertainSensorNotAccurate = 0x4093, |
| 220 | UncertainEngineeringUnitsExceeded = 0x4094, |
| 221 | UncertainSubNormal = 0x4095, |
| 222 | GoodLocalOverride = 0x0096, |
| 223 | BadRefreshInProgress = 0x8097, |
| 224 | BadConditionAlreadyDisabled = 0x8098, |
| 225 | BadConditionAlreadyEnabled = 0x80CC, |
| 226 | BadConditionDisabled = 0x8099, |
| 227 | BadEventIdUnknown = 0x809A, |
| 228 | BadEventNotAcknowledgeable = 0x80BB, |
| 229 | BadDialogNotActive = 0x80CD, |
| 230 | BadDialogResponseInvalid = 0x80CE, |
| 231 | BadConditionBranchAlreadyAcked = 0x80CF, |
| 232 | BadConditionBranchAlreadyConfirmed = 0x80D0, |
| 233 | BadConditionAlreadyShelved = 0x80D1, |
| 234 | BadConditionNotShelved = 0x80D2, |
| 235 | BadShelvingTimeOutOfRange = 0x80D3, |
| 236 | BadNoData = 0x809B, |
| 237 | BadBoundNotFound = 0x80D7, |
| 238 | BadBoundNotSupported = 0x80D8, |
| 239 | BadDataLost = 0x809D, |
| 240 | BadDataUnavailable = 0x809E, |
| 241 | BadEntryExists = 0x809F, |
| 242 | BadNoEntryExists = 0x80A0, |
| 243 | BadTimestampNotSupported = 0x80A1, |
| 244 | GoodEntryInserted = 0x00A2, |
| 245 | GoodEntryReplaced = 0x00A3, |
| 246 | UncertainDataSubNormal = 0x40A4, |
| 247 | GoodNoData = 0x00A5, |
| 248 | GoodMoreData = 0x00A6, |
| 249 | BadAggregateListMismatch = 0x80D4, |
| 250 | BadAggregateNotSupported = 0x80D5, |
| 251 | BadAggregateInvalidInputs = 0x80D6, |
| 252 | BadAggregateConfigurationRejected = 0x80DA, |
| 253 | GoodDataIgnored = 0x00D9, |
| 254 | BadRequestNotAllowed = 0x80E4, |
| 255 | BadRequestNotComplete = 0x8113, |
| 256 | BadTicketRequired = 0x811F, |
| 257 | BadTicketInvalid = 0x8120, |
| 258 | GoodEdited = 0x00DC, |
| 259 | GoodPostActionFailed = 0x00DD, |
| 260 | UncertainDominantValueChanged = 0x40DE, |
| 261 | GoodDependentValueChanged = 0x00E0, |
| 262 | BadDominantValueChanged = 0x80E1, |
| 263 | UncertainDependentValueChanged = 0x40E2, |
| 264 | BadDependentValueChanged = 0x80E3, |
| 265 | GoodEdited_DependentValueChanged = 0x0116, |
| 266 | GoodEdited_DominantValueChanged = 0x0117, |
| 267 | GoodEdited_DominantValueChanged_DependentValueChanged = 0x0118, |
| 268 | BadEdited_OutOfRange = 0x8119, |
| 269 | BadInitialValue_OutOfRange = 0x811A, |
| 270 | BadOutOfRange_DominantValueChanged = 0x811B, |
| 271 | BadEdited_OutOfRange_DominantValueChanged = 0x811C, |
| 272 | BadOutOfRange_DominantValueChanged_DependentValueChanged = 0x811D, |
| 273 | BadEdited_OutOfRange_DominantValueChanged_DependentValueChanged = 0x811E, |
| 274 | GoodCommunicationEvent = 0x00A7, |
| 275 | GoodShutdownEvent = 0x00A8, |
| 276 | GoodCallAgain = 0x00A9, |
| 277 | GoodNonCriticalTimeout = 0x00AA, |
| 278 | BadInvalidArgument = 0x80AB, |
| 279 | BadConnectionRejected = 0x80AC, |
| 280 | BadDisconnect = 0x80AD, |
| 281 | BadConnectionClosed = 0x80AE, |
| 282 | BadInvalidState = 0x80AF, |
| 283 | BadEndOfStream = 0x80B0, |
| 284 | BadNoDataAvailable = 0x80B1, |
| 285 | BadWaitingForResponse = 0x80B2, |
| 286 | BadOperationAbandoned = 0x80B3, |
| 287 | BadExpectedStreamToBlock = 0x80B4, |
| 288 | BadWouldBlock = 0x80B5, |
| 289 | BadSyntaxError = 0x80B6, |
| 290 | BadMaxConnectionsReached = 0x80B7, |
| 291 | UncertainTransducerInManual = 0x4208, |
| 292 | UncertainSimulatedValue = 0x4209, |
| 293 | UncertainSensorCalibration = 0x420A, |
| 294 | UncertainConfigurationError = 0x420F, |
| 295 | GoodCascadeInitializationAcknowledged = 0x0401, |
| 296 | GoodCascadeInitializationRequest = 0x0402, |
| 297 | GoodCascadeNotInvited = 0x0403, |
| 298 | GoodCascadeNotSelected = 0x0404, |
| 299 | GoodFaultStateActive = 0x0407, |
| 300 | GoodInitiateFaultState = 0x0408, |
| 301 | GoodCascade = 0x0409, |
| 302 | BadDataSetIdInvalid = 0x80E7, |
| 303 | }; |
| 304 | Q_ENUM(Status) |
| 305 | |
| 306 | OpcUaStatus(); |
| 307 | OpcUaStatus(QOpcUa::UaStatusCode); |
| 308 | OpcUaStatus(Status); |
| 309 | ~OpcUaStatus(); |
| 310 | |
| 311 | bool isGood() const; |
| 312 | bool isBad() const; |
| 313 | Status status() const; |
| 314 | |
| 315 | private: |
| 316 | quint32 m_statusCode{QOpcUa::Good}; |
| 317 | }; |
| 318 | |
| 319 | // Expose only the enums with the uppercase "Status" name |
| 320 | namespace OpcuaStatusForeign |
| 321 | { |
| 322 | Q_NAMESPACE |
| 323 | QML_FOREIGN_NAMESPACE(OpcUaStatus) |
| 324 | QML_NAMED_ELEMENT(Status) |
| 325 | QML_ADDED_IN_VERSION(5, 13) |
| 326 | }; |
| 327 | |
| 328 | QT_END_NAMESPACE |
| 329 | |
| 330 | #endif // OPCUASTATUS_P_H |
| 331 | |