1// Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com
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 QOPCUATYPE
5#define QOPCUATYPE
6
7#include <QtOpcUa/qopcuaglobal.h>
8#include <QtOpcUa/qopcuanodeids.h>
9
10#include <QtCore/qmetatype.h>
11#include <QtCore/qpair.h>
12#include <QtCore/qvariant.h>
13
14QT_BEGIN_NAMESPACE
15
16namespace QOpcUa {
17Q_NAMESPACE_EXPORT(Q_OPCUA_EXPORT)
18Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
19
20// see OPC UA 1.05 Part 3, 5.2.3 & 8.29
21enum class NodeClass {
22 Undefined = 0,
23 Object = 1,
24 Variable = 2,
25 Method = 4,
26 ObjectType = 8,
27 VariableType = 16,
28 ReferenceType = 32,
29 DataType = 64,
30 View = 128,
31};
32Q_ENUM_NS(NodeClass)
33Q_DECLARE_FLAGS(NodeClasses, NodeClass)
34
35enum class NodeAttribute {
36 None = 0,
37 NodeId = (1 << 0),
38 NodeClass = (1 << 1),
39 BrowseName = (1 << 2),
40 DisplayName = (1 << 3),
41 Description = (1 << 4),
42 WriteMask = (1 << 5),
43 UserWriteMask = (1 << 6), // Base attributes, see OPC UA 1.05 part 3, 5.2.1
44 IsAbstract = (1 << 7),
45 Symmetric = (1 << 8),
46 InverseName = (1 << 9), // Reference attributes, see OPC UA 1.05 part 3, 5.3.1
47 ContainsNoLoops = (1 << 10),
48 EventNotifier = (1 << 11), // View attributes, see OPC UA 1.05 part 3, 5.4
49 // Objects also add the EventNotifier attribute, see OPC UA 1.05 part 3, 5.5.1
50 // ObjectType also add the IsAbstract attribute, see OPC UA 1.05 part 3, 5.5.2
51 Value = (1 << 12),
52 DataType = (1 << 13),
53 ValueRank = (1 << 14),
54 ArrayDimensions = (1 << 15),
55 AccessLevel = (1 << 16),
56 UserAccessLevel = (1 << 17),
57 MinimumSamplingInterval = (1 << 18),
58 Historizing = (1 << 19), // Value attributes, see OPC UA 1.05 part 3, 5.6.2
59 // VariableType also adds the Value, DataType, ValueRank, ArrayDimensions
60 // and isAbstract attributes, see OPC UA 1.05 part 3, 5.6.5
61 Executable = (1 << 20),
62 UserExecutable = (1 << 21), // Method attributes, see OPC UA 1.05 part 3, 5.7
63 // Data type attributes
64 DataTypeDefinition = (1 << 22),
65 RolePermissions = (1 << 23),
66 UserRolePermissions = (1 << 24),
67 AccessRestrictions = (1 << 25),
68 AccessLevelEx = (1 << 26),
69};
70Q_ENUM_NS(NodeAttribute)
71Q_DECLARE_FLAGS(NodeAttributes, NodeAttribute)
72
73// Defined in OPC UA 1.05 part 3, 8.60.
74enum class WriteMaskBit : quint32 {
75 None = 0,
76 AccessLevel = (1 << 0),
77 ArrayDimensions = (1 << 1),
78 BrowseName = (1 << 2),
79 ContainsNoLoops = (1 << 3),
80 DataType = (1 << 4),
81 Description = (1 << 5),
82 DisplayName = (1 << 6),
83 EventNotifier = (1 << 7),
84 Executable = (1 << 8),
85 Historizing = (1 << 9),
86 InverseName = (1 << 10),
87 IsAbstract = (1 << 11),
88 MinimumSamplingInterval = (1 << 12),
89 NodeClass = (1 << 13),
90 NodeId = (1 << 14),
91 Symmetric = (1 << 15),
92 UserAccessLevel = (1 << 16),
93 UserExecutable = (1 << 17),
94 UserWriteMask = (1 << 18),
95 ValueRank = (1 << 19),
96 WriteMask = (1 << 20),
97 ValueForVariableType = (1 << 21),
98 DataTypeDefinition = (1 << 22),
99 RolePermissions = (1 << 23),
100 AccessRestrictions = (1 << 24),
101 AccessLevelEx = (1 << 25),
102};
103Q_ENUM_NS(WriteMaskBit)
104Q_DECLARE_FLAGS(WriteMask, WriteMaskBit)
105
106// Defined in OPC UA 1.05 part 3, 8.57.
107enum class AccessLevelBit : quint8 {
108 None = 0,
109 CurrentRead = (1 << 0),
110 CurrentWrite = (1 << 1),
111 HistoryRead = (1 << 2),
112 HistoryWrite = (1 << 3),
113 SemanticChange = (1 << 4),
114 StatusWrite = (1 << 5),
115 TimestampWrite = (1 << 6),
116};
117Q_ENUM_NS(AccessLevelBit)
118Q_DECLARE_FLAGS(AccessLevel, AccessLevelBit)
119
120// Defined in OPC UA 1.05 part 3, 8.58.
121enum class AccessLevelExBit : quint32 {
122 None = 0,
123 CurrentRead = (1 << 0),
124 CurrentWrite = (1 << 1),
125 HistoryRead = (1 << 2),
126 HistoryWrite = (1 << 3),
127 SemanticChange = (1 << 4),
128 StatusWrite = (1 << 5),
129 TimestampWrite = (1 << 6),
130 // Bit #7 is marked as reserved
131 NonatomicRead = (1 << 8),
132 NonatomicWrite = (1 << 9),
133 WriteFullArrayOnly = (1 << 10),
134 NoSubDataTypes = (1 << 11),
135 NonVolatile = (1 << 12),
136 Constant = (1 << 13),
137};
138Q_ENUM_NS(AccessLevelExBit)
139Q_DECLARE_FLAGS(AccessLevelEx, AccessLevelExBit)
140
141// Defined in OPC UA 1.05 part 3, 8.59.
142enum class EventNotifierBit : quint8 {
143 None = 0,
144 SubscribeToEvents = (1 << 0),
145 HistoryRead = (1 << 2),
146 HistoryWrite = (1 << 3),
147};
148Q_ENUM_NS(EventNotifierBit)
149Q_DECLARE_FLAGS(EventNotifier, EventNotifierBit)
150
151enum class TimestampsToReturn {
152 Source = 0,
153 Server = 1,
154 Both = 2,
155 Neither = 4,
156 Invalid = 5,
157};
158Q_ENUM_NS(TimestampsToReturn)
159
160#if QT_VERSION >= 0x060000
161inline size_t qHash(const QOpcUa::NodeAttribute& attr)
162#else
163inline uint qHash(const QOpcUa::NodeAttribute& attr)
164#endif
165{
166 return ::qHash(key: static_cast<uint>(attr));
167}
168
169// The reference types are nodes in namespace 0, the enum value is their numeric identifier.
170// Identifiers are specified in https://opcfoundation.org/UA/schemas/1.05/NodeIds.csv
171enum class ReferenceTypeId : quint32 {
172 Unspecified = 0,
173 References = 31,
174 NonHierarchicalReferences = 32,
175 HierarchicalReferences = 33,
176 HasChild = 34,
177 Organizes = 35,
178 HasEventSource = 36,
179 HasModellingRule = 37,
180 HasEncoding = 38,
181 HasDescription = 39,
182 HasTypeDefinition = 40,
183 GeneratesEvent = 41,
184 Aggregates = 44,
185 HasSubtype = 45,
186 HasProperty = 46,
187 HasComponent = 47,
188 HasNotifier = 48,
189 HasOrderedComponent = 49,
190 FromState = 51,
191 ToState = 52,
192 HasCause = 53,
193 HasEffect = 54,
194 HasHistoricalConfiguration = 56,
195 HasSubStateMachine = 117,
196 HasArgumentDescription = 129,
197 HasOptionalInputArgumentDescription = 131,
198 AlwaysGeneratesEvent = 3065,
199 HasTrueSubState = 9004,
200 HasFalseSubState = 9005,
201 HasCondition = 9006,
202 HasPubSubConnection = 14476,
203 DataSetToWriter = 14936,
204 HasGuard = 15112,
205 HasDataSetWriter = 15296,
206 HasDataSetReader = 15297,
207 HasAlarmSuppressionGroup = 16361,
208 AlarmGroupMember = 16362,
209 HasEffectDisable = 17276,
210 HasDictionaryEntry = 17597,
211 HasInterface = 17603,
212 HasAddIn = 17604,
213 HasEffectEnable = 17983,
214 HasEffectSuppressed = 17984,
215 HasEffectUnsuppressed = 17985,
216 HasWriterGroup = 18804,
217 HasReaderGroup = 18805,
218 AliasFor = 23469,
219 IsDeprecated = 23562,
220 HasStructuredComponent = 24136,
221 AssociatedWith = 24137,
222 UsesPriorityMappingTable = 25237,
223 HasLowerLayerInterface = 25238,
224 IsExecutableOn = 25253,
225 Controls = 25254,
226 Utilizes = 25255,
227 Requires = 25256,
228 IsPhysicallyConnectedTo = 25257,
229 RepresentsSameEntityAs = 25258,
230 RepresentsSameHardwareAs = 25259,
231 RepresentsSameFunctionalityAs = 25260,
232 IsHostedBy = 25261,
233 HasPhysicalComponent = 25262,
234 HasContainedComponent = 25263,
235 HasAttachedComponent = 25264,
236 IsExecutingOn = 25265,
237 HasPushedSecurityGroup = 25345,
238 AlarmSuppressionGroupMember = 32059,
239 HasReferenceDescription = 32679,
240};
241Q_ENUM_NS(ReferenceTypeId)
242
243enum Types
244{
245 Boolean = 0,
246 Int32 = 1,
247 UInt32 = 2,
248 Double = 3,
249 Float = 4,
250 String = 5,
251 LocalizedText = 6,
252 DateTime = 7,
253 UInt16 = 8,
254 Int16 = 9,
255 UInt64 = 10,
256 Int64 = 11,
257 Byte = 12,
258 SByte = 13,
259 ByteString = 14,
260 XmlElement = 15,
261 NodeId = 16,
262 Guid = 17,
263 QualifiedName = 18,
264 StatusCode = 19,
265 ExtensionObject = 20,
266 Range = 21,
267 EUInformation = 22,
268 ComplexNumber = 23,
269 DoubleComplexNumber = 24,
270 AxisInformation = 25,
271 XV = 26,
272 ExpandedNodeId = 27,
273 Argument = 28,
274 StructureDefinition = 29,
275 StructureField = 30,
276 EnumDefinition = 31,
277 EnumField = 32,
278 DiagnosticInfo = 33,
279 SimpleAttributeOperand = 34,
280 AttributeOperand = 35,
281 LiteralOperand = 36,
282 ElementOperand = 37,
283 RelativePathElement = 38,
284 ContentFilterElement = 39,
285 EventFilter = 40,
286 Undefined = 0xFFFFFFFF,
287};
288Q_ENUM_NS(Types)
289
290// OpcUa Specification 1.05 Part 4, Chapter 7.39 "Status Code"
291// OpcUa Specification 1.05 Part 6, Annex A.2 "Status Codes
292enum UaStatusCode : quint32
293{
294 Good = 0x00000000,
295 Uncertain = 0x40000000,
296 Bad = 0x80000000,
297 BadUnexpectedError = 0x80010000,
298 BadInternalError = 0x80020000,
299 BadOutOfMemory = 0x80030000,
300 BadResourceUnavailable = 0x80040000,
301 BadCommunicationError = 0x80050000,
302 BadEncodingError = 0x80060000,
303 BadDecodingError = 0x80070000,
304 BadEncodingLimitsExceeded = 0x80080000,
305 BadRequestTooLarge = 0x80B80000,
306 BadResponseTooLarge = 0x80B90000,
307 BadUnknownResponse = 0x80090000,
308 BadTimeout = 0x800A0000,
309 BadServiceUnsupported = 0x800B0000,
310 BadShutdown = 0x800C0000,
311 BadServerNotConnected = 0x800D0000,
312 BadServerHalted = 0x800E0000,
313 BadNothingToDo = 0x800F0000,
314 BadTooManyOperations = 0x80100000,
315 BadTooManyMonitoredItems = 0x80DB0000,
316 BadDataTypeIdUnknown = 0x80110000,
317 BadCertificateInvalid = 0x80120000,
318 BadSecurityChecksFailed = 0x80130000,
319 BadCertificatePolicyCheckFailed = 0x81140000,
320 BadCertificateTimeInvalid = 0x80140000,
321 BadCertificateIssuerTimeInvalid = 0x80150000,
322 BadCertificateHostNameInvalid = 0x80160000,
323 BadCertificateUriInvalid = 0x80170000,
324 BadCertificateUseNotAllowed = 0x80180000,
325 BadCertificateIssuerUseNotAllowed = 0x80190000,
326 BadCertificateUntrusted = 0x801A0000,
327 BadCertificateRevocationUnknown = 0x801B0000,
328 BadCertificateIssuerRevocationUnknown = 0x801C0000,
329 BadCertificateRevoked = 0x801D0000,
330 BadCertificateIssuerRevoked = 0x801E0000,
331 BadCertificateChainIncomplete = 0x810D0000,
332 BadUserAccessDenied = 0x801F0000,
333 BadIdentityTokenInvalid = 0x80200000,
334 BadIdentityTokenRejected = 0x80210000,
335 BadSecureChannelIdInvalid = 0x80220000,
336 BadInvalidTimestamp = 0x80230000,
337 BadNonceInvalid = 0x80240000,
338 BadSessionIdInvalid = 0x80250000,
339 BadSessionClosed = 0x80260000,
340 BadSessionNotActivated = 0x80270000,
341 BadSubscriptionIdInvalid = 0x80280000,
342 BadRequestHeaderInvalid = 0x802A0000,
343 BadTimestampsToReturnInvalid = 0x802B0000,
344 BadRequestCancelledByClient = 0x802C0000,
345 BadTooManyArguments = 0x80E50000,
346 BadLicenseExpired = 0x810E0000,
347 BadLicenseLimitsExceeded = 0x810F0000,
348 BadLicenseNotAvailable = 0x81100000,
349 GoodSubscriptionTransferred = 0x002D0000,
350 GoodCompletesAsynchronously = 0x002E0000,
351 GoodOverload = 0x002F0000,
352 GoodClamped = 0x00300000,
353 BadNoCommunication = 0x80310000,
354 BadWaitingForInitialData = 0x80320000,
355 BadNodeIdInvalid = 0x80330000,
356 BadNodeIdUnknown = 0x80340000,
357 BadAttributeIdInvalid = 0x80350000,
358 BadIndexRangeInvalid = 0x80360000,
359 BadIndexRangeNoData = 0x80370000,
360 BadDataEncodingInvalid = 0x80380000,
361 BadDataEncodingUnsupported = 0x80390000,
362 BadNotReadable = 0x803A0000,
363 BadNotWritable = 0x803B0000,
364 BadOutOfRange = 0x803C0000,
365 BadNotSupported = 0x803D0000,
366 BadNotFound = 0x803E0000,
367 BadObjectDeleted = 0x803F0000,
368 BadNotImplemented = 0x80400000,
369 BadMonitoringModeInvalid = 0x80410000,
370 BadMonitoredItemIdInvalid = 0x80420000,
371 BadMonitoredItemFilterInvalid = 0x80430000,
372 BadMonitoredItemFilterUnsupported = 0x80440000,
373 BadFilterNotAllowed = 0x80450000,
374 BadStructureMissing = 0x80460000,
375 BadEventFilterInvalid = 0x80470000,
376 BadContentFilterInvalid = 0x80480000,
377 BadFilterOperatorInvalid = 0x80C10000,
378 BadFilterOperatorUnsupported = 0x80C20000,
379 BadFilterOperandCountMismatch = 0x80C30000,
380 BadFilterOperandInvalid = 0x80490000,
381 BadFilterElementInvalid = 0x80C40000,
382 BadFilterLiteralInvalid = 0x80C50000,
383 BadContinuationPointInvalid = 0x804A0000,
384 BadNoContinuationPoints = 0x804B0000,
385 BadReferenceTypeIdInvalid = 0x804C0000,
386 BadBrowseDirectionInvalid = 0x804D0000,
387 BadNodeNotInView = 0x804E0000,
388 BadNumericOverflow = 0x81120000,
389 BadServerUriInvalid = 0x804F0000,
390 BadServerNameMissing = 0x80500000,
391 BadDiscoveryUrlMissing = 0x80510000,
392 BadSempahoreFileMissing = 0x80520000,
393 BadRequestTypeInvalid = 0x80530000,
394 BadSecurityModeRejected = 0x80540000,
395 BadSecurityPolicyRejected = 0x80550000,
396 BadTooManySessions = 0x80560000,
397 BadUserSignatureInvalid = 0x80570000,
398 BadApplicationSignatureInvalid = 0x80580000,
399 BadNoValidCertificates = 0x80590000,
400 BadIdentityChangeNotSupported = 0x80C60000,
401 BadRequestCancelledByRequest = 0x805A0000,
402 BadParentNodeIdInvalid = 0x805B0000,
403 BadReferenceNotAllowed = 0x805C0000,
404 BadNodeIdRejected = 0x805D0000,
405 BadNodeIdExists = 0x805E0000,
406 BadNodeClassInvalid = 0x805F0000,
407 BadBrowseNameInvalid = 0x80600000,
408 BadBrowseNameDuplicated = 0x80610000,
409 BadNodeAttributesInvalid = 0x80620000,
410 BadTypeDefinitionInvalid = 0x80630000,
411 BadSourceNodeIdInvalid = 0x80640000,
412 BadTargetNodeIdInvalid = 0x80650000,
413 BadDuplicateReferenceNotAllowed = 0x80660000,
414 BadInvalidSelfReference = 0x80670000,
415 BadReferenceLocalOnly = 0x80680000,
416 BadNoDeleteRights = 0x80690000,
417 UncertainReferenceNotDeleted = 0x40BC0000,
418 BadServerIndexInvalid = 0x806A0000,
419 BadViewIdUnknown = 0x806B0000,
420 BadViewTimestampInvalid = 0x80C90000,
421 BadViewParameterMismatch = 0x80CA0000,
422 BadViewVersionInvalid = 0x80CB0000,
423 UncertainNotAllNodesAvailable = 0x40C00000,
424 GoodResultsMayBeIncomplete = 0x00BA0000,
425 BadNotTypeDefinition = 0x80C80000,
426 UncertainReferenceOutOfServer = 0x406C0000,
427 BadTooManyMatches = 0x806D0000,
428 BadQueryTooComplex = 0x806E0000,
429 BadNoMatch = 0x806F0000,
430 BadMaxAgeInvalid = 0x80700000,
431 BadSecurityModeInsufficient = 0x80E60000,
432 BadHistoryOperationInvalid = 0x80710000,
433 BadHistoryOperationUnsupported = 0x80720000,
434 BadInvalidTimestampArgument = 0x80BD0000,
435 BadWriteNotSupported = 0x80730000,
436 BadTypeMismatch = 0x80740000,
437 BadMethodInvalid = 0x80750000,
438 BadArgumentsMissing = 0x80760000,
439 BadNotExecutable = 0x81110000,
440 BadTooManySubscriptions = 0x80770000,
441 BadTooManyPublishRequests = 0x80780000,
442 BadNoSubscription = 0x80790000,
443 BadSequenceNumberUnknown = 0x807A0000,
444 GoodRetransmissionQueueNotSupported = 0x00DF0000,
445 BadMessageNotAvailable = 0x807B0000,
446 BadInsufficientClientProfile = 0x807C0000,
447 BadStateNotActive = 0x80BF0000,
448 BadAlreadyExists = 0x81150000,
449 BadTcpServerTooBusy = 0x807D0000,
450 BadTcpMessageTypeInvalid = 0x807E0000,
451 BadTcpSecureChannelUnknown = 0x807F0000,
452 BadTcpMessageTooLarge = 0x80800000,
453 BadTcpNotEnoughResources = 0x80810000,
454 BadTcpInternalError = 0x80820000,
455 BadTcpEndpointUrlInvalid = 0x80830000,
456 BadRequestInterrupted = 0x80840000,
457 BadRequestTimeout = 0x80850000,
458 BadSecureChannelClosed = 0x80860000,
459 BadSecureChannelTokenUnknown = 0x80870000,
460 BadSequenceNumberInvalid = 0x80880000,
461 BadProtocolVersionUnsupported = 0x80BE0000,
462 BadConfigurationError = 0x80890000,
463 BadNotConnected = 0x808A0000,
464 BadDeviceFailure = 0x808B0000,
465 BadSensorFailure = 0x808C0000,
466 BadOutOfService = 0x808D0000,
467 BadDeadbandFilterInvalid = 0x808E0000,
468 UncertainNoCommunicationLastUsableValue = 0x408F0000,
469 UncertainLastUsableValue = 0x40900000,
470 UncertainSubstituteValue = 0x40910000,
471 UncertainInitialValue = 0x40920000,
472 UncertainSensorNotAccurate = 0x40930000,
473 UncertainEngineeringUnitsExceeded = 0x40940000,
474 UncertainSubNormal = 0x40950000,
475 GoodLocalOverride = 0x00960000,
476 BadRefreshInProgress = 0x80970000,
477 BadConditionAlreadyDisabled = 0x80980000,
478 BadConditionAlreadyEnabled = 0x80CC0000,
479 BadConditionDisabled = 0x80990000,
480 BadEventIdUnknown = 0x809A0000,
481 BadEventNotAcknowledgeable = 0x80BB0000,
482 BadDialogNotActive = 0x80CD0000,
483 BadDialogResponseInvalid = 0x80CE0000,
484 BadConditionBranchAlreadyAcked = 0x80CF0000,
485 BadConditionBranchAlreadyConfirmed = 0x80D00000,
486 BadConditionAlreadyShelved = 0x80D10000,
487 BadConditionNotShelved = 0x80D20000,
488 BadShelvingTimeOutOfRange = 0x80D30000,
489 BadNoData = 0x809B0000,
490 BadBoundNotFound = 0x80D70000,
491 BadBoundNotSupported = 0x80D80000,
492 BadDataLost = 0x809D0000,
493 BadDataUnavailable = 0x809E0000,
494 BadEntryExists = 0x809F0000,
495 BadNoEntryExists = 0x80A00000,
496 BadTimestampNotSupported = 0x80A10000,
497 GoodEntryInserted = 0x00A20000,
498 GoodEntryReplaced = 0x00A30000,
499 UncertainDataSubNormal = 0x40A40000,
500 GoodNoData = 0x00A50000,
501 GoodMoreData = 0x00A60000,
502 BadAggregateListMismatch = 0x80D40000,
503 BadAggregateNotSupported = 0x80D50000,
504 BadAggregateInvalidInputs = 0x80D60000,
505 BadAggregateConfigurationRejected = 0x80DA0000,
506 GoodDataIgnored = 0x00D90000,
507 BadRequestNotAllowed = 0x80E40000,
508 BadRequestNotComplete = 0x81130000,
509 BadTransactionPending = 0x80E80000,
510 BadTicketRequired = 0x811F0000,
511 BadTicketInvalid = 0x81200000,
512 BadLocked = 0x80E90000,
513 GoodEdited = 0x00DC0000,
514 GoodPostActionFailed = 0x00DD0000,
515 UncertainDominantValueChanged = 0x40DE0000,
516 GoodDependentValueChanged = 0x00E00000,
517 BadDominantValueChanged = 0x80E10000,
518 UncertainDependentValueChanged = 0x40E20000,
519 BadDependentValueChanged = 0x80E30000,
520 GoodEdited_DependentValueChanged = 0x01160000,
521 GoodEdited_DominantValueChanged = 0x01170000,
522 GoodEdited_DominantValueChanged_DependentValueChanged = 0x01180000,
523 BadEdited_OutOfRange = 0x81190000,
524 BadInitialValue_OutOfRange = 0x811A0000,
525 BadOutOfRange_DominantValueChanged = 0x811B0000,
526 BadEdited_OutOfRange_DominantValueChanged = 0x811C0000,
527 BadOutOfRange_DominantValueChanged_DependentValueChanged = 0x811D0000,
528 BadEdited_OutOfRange_DominantValueChanged_DependentValueChanged = 0x811E0000,
529 GoodCommunicationEvent = 0x00A70000,
530 GoodShutdownEvent = 0x00A80000,
531 GoodCallAgain = 0x00A90000,
532 GoodNonCriticalTimeout = 0x00AA0000,
533 BadInvalidArgument = 0x80AB0000,
534 BadConnectionRejected = 0x80AC0000,
535 BadDisconnect = 0x80AD0000,
536 BadConnectionClosed = 0x80AE0000,
537 BadInvalidState = 0x80AF0000,
538 BadEndOfStream = 0x80B00000,
539 BadNoDataAvailable = 0x80B10000,
540 BadWaitingForResponse = 0x80B20000,
541 BadOperationAbandoned = 0x80B30000,
542 BadExpectedStreamToBlock = 0x80B40000,
543 BadWouldBlock = 0x80B50000,
544 BadSyntaxError = 0x80B60000,
545 BadMaxConnectionsReached = 0x80B70000,
546 UncertainTransducerInManual = 0x42080000,
547 UncertainSimulatedValue = 0x42090000,
548 UncertainSensorCalibration = 0x420A0000,
549 UncertainConfigurationError = 0x420F0000,
550 GoodCascadeInitializationAcknowledged = 0x04010000,
551 GoodCascadeInitializationRequest = 0x04020000,
552 GoodCascadeNotInvited = 0x04030000,
553 GoodCascadeNotSelected = 0x04040000,
554 GoodFaultStateActive = 0x04070000,
555 GoodInitiateFaultState = 0x04080000,
556 GoodCascade = 0x04090000,
557 BadDataSetIdInvalid = 0x80E70000,
558};
559Q_ENUM_NS(UaStatusCode)
560
561enum class ErrorCategory {
562 NoError,
563 NodeError,
564 AttributeError,
565 PermissionError,
566 ArgumentError,
567 TypeError,
568 ConnectionError,
569 UnspecifiedError,
570};
571Q_ENUM_NS(ErrorCategory)
572
573Q_OPCUA_EXPORT bool isSuccessStatus(QOpcUa::UaStatusCode statusCode);
574Q_OPCUA_EXPORT QOpcUa::ErrorCategory errorCategory(QOpcUa::UaStatusCode statusCode);
575Q_OPCUA_EXPORT QString statusToString(QOpcUa::UaStatusCode statusCode);
576Q_OPCUA_EXPORT bool isSecurePolicy(const QString &securityPolicy);
577
578// NodeId helpers
579Q_OPCUA_EXPORT QString nodeIdFromString(quint16 ns, const QString &identifier);
580Q_OPCUA_EXPORT QString nodeIdFromByteString(quint16 ns, const QByteArray &identifier);
581Q_OPCUA_EXPORT QString nodeIdFromGuid(quint16 ns, const QUuid &identifier);
582Q_OPCUA_EXPORT QString nodeIdFromInteger(quint16 ns, quint32 identifier);
583Q_OPCUA_EXPORT QString nodeIdFromReferenceType(QOpcUa::ReferenceTypeId referenceType);
584Q_OPCUA_EXPORT bool nodeIdStringSplit(const QString &nodeIdString, quint16 *nsIndex,
585 QString *identifier, char *identifierType);
586Q_OPCUA_EXPORT bool nodeIdEquals(const QString &first, const QString &second);
587Q_OPCUA_EXPORT QString namespace0Id(QOpcUa::NodeIds::Namespace0 id);
588Q_OPCUA_EXPORT QOpcUa::NodeIds::Namespace0 namespace0IdFromNodeId(const QString &nodeId);
589Q_OPCUA_EXPORT QString namespace0IdName(QOpcUa::NodeIds::Namespace0 id);
590
591typedef QPair<QVariant, QOpcUa::Types> TypedVariant;
592
593enum class AxisScale : quint32 {
594 Linear = 0,
595 Log = 1,
596 Ln = 2,
597};
598
599enum class IsAbstract {
600 NotAbstract = 0,
601 Abstract = 1,
602};
603Q_ENUM_NS(IsAbstract)
604
605Q_OPCUA_EXPORT QOpcUa::Types metaTypeToQOpcUaType(QMetaType::Type type);
606Q_OPCUA_EXPORT QOpcUa::Types opcUaDataTypeToQOpcUaType(const QString &type);
607}
608
609Q_DECLARE_TYPEINFO(QOpcUa::Types, Q_PRIMITIVE_TYPE);
610Q_DECLARE_TYPEINFO(QOpcUa::UaStatusCode, Q_PRIMITIVE_TYPE);
611Q_DECLARE_TYPEINFO(QOpcUa::ErrorCategory, Q_PRIMITIVE_TYPE);
612
613Q_DECLARE_TYPEINFO(QOpcUa::NodeClass, Q_PRIMITIVE_TYPE);
614Q_DECLARE_TYPEINFO(QOpcUa::NodeAttribute, Q_PRIMITIVE_TYPE);
615Q_DECLARE_OPERATORS_FOR_FLAGS(QOpcUa::NodeAttributes)
616Q_DECLARE_OPERATORS_FOR_FLAGS(QOpcUa::WriteMask)
617Q_DECLARE_OPERATORS_FOR_FLAGS(QOpcUa::AccessLevel)
618Q_DECLARE_OPERATORS_FOR_FLAGS(QOpcUa::EventNotifier)
619Q_DECLARE_OPERATORS_FOR_FLAGS(QOpcUa::NodeClasses)
620Q_DECLARE_TYPEINFO(QOpcUa::ReferenceTypeId, Q_PRIMITIVE_TYPE);
621
622QT_END_NAMESPACE
623
624Q_DECLARE_METATYPE(QOpcUa::Types)
625Q_DECLARE_METATYPE(QOpcUa::TypedVariant)
626Q_DECLARE_METATYPE(QOpcUa::UaStatusCode)
627Q_DECLARE_METATYPE(QOpcUa::ErrorCategory)
628Q_DECLARE_METATYPE(QOpcUa::NodeClass)
629Q_DECLARE_METATYPE(QOpcUa::NodeAttribute)
630Q_DECLARE_METATYPE(QOpcUa::NodeAttributes)
631Q_DECLARE_METATYPE(QOpcUa::WriteMaskBit)
632Q_DECLARE_METATYPE(QOpcUa::WriteMask)
633Q_DECLARE_METATYPE(QOpcUa::AccessLevelBit)
634Q_DECLARE_METATYPE(QOpcUa::AccessLevel)
635Q_DECLARE_METATYPE(QOpcUa::EventNotifierBit)
636Q_DECLARE_METATYPE(QOpcUa::EventNotifier)
637Q_DECLARE_METATYPE(QOpcUa::ReferenceTypeId)
638Q_DECLARE_METATYPE(QOpcUa::NodeClasses)
639
640#endif // QOPCUATYPE
641

source code of qtopcua/src/opcua/client/qopcuatype.h