QOpcUaBinaryDataEncoding is a partial implementation of the OPC UA binary data encoding described in OPC UA part 6. 更多...
头: | #include <QOpcUaBinaryDataEncoding> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS OpcUa)
target_link_libraries(mytarget PRIVATE Qt6::OpcUa) |
qmake: | QT += opcua |
QOpcUaBinaryDataEncoding (QByteArray * buffer ) | |
QOpcUaBinaryDataEncoding (QOpcUaExtensionObject & object ) | |
T | decode (bool & success ) |
QList<T> | decodeArray (bool & success ) |
bool | encode (const T & src ) |
bool | encodeArray (const QList<T> & src ) |
int | offset () const |
void | setOffset (int offset ) |
void | truncateBufferToOffset () |
It offers template functions for encoding and decoding data for reading and writing extension objects.
The following types are supported:
Qt 类型 | OPC UA type |
---|---|
quint8 | uint8 |
qint8 | int8 |
quint16 | uint16 |
qint16 | int16 |
quint32 | uint32 |
qint32 | int32 |
quint64 | uint64 |
qint64 | int64 |
float | float |
double | double |
QString | 字符串 |
QOpcUaQualifiedName | QualifiedName |
QOpcUaLocalizedText | LocalizedText |
QOpcUaEUInformation | EUInformation |
QOpcUaRange | Range |
QOpcUaComplexNumber | ComplexNumber |
QOpcUaDoubleComplexNumber | DoubleComplexNumber |
QOpcUaAxisInformation | AxisInformation |
QOpcUaXValue | XV |
QUuid | GUID |
QString node id | NodeId |
QByteArray | ByteString |
QDateTime | DateTime |
QOpcUa::UaStatusCode | StatusCode |
QOpcUaExpandedNodeId | ExpandedNodeId |
QOpcUaExtensionObject | ExtensionObject |
QOpcUaArgument | 自变量 |
QOpcUaDiagnosticInfo (since Qt 6.7) | DiagnosticInfo |
QOpcUaApplicationRecordDataType | ApplicationRecordDataType |
QOpcUaStructureDefinition (since Qt 6.7) | StructureDefintion |
QOpcUaStructureField (since Qt 6.7) | StructureField |
QOpcUaEnumDefinition (since Qt 6.7) | EnumDefintion |
QOpcUaEnumField (since Qt 6.7) | EnumField |
QOpcUaVariant (since Qt 6.7) | Variant |
QOpcUaDataValue (since Qt 6.7) | DataValue |
Constructs a binary data encoding object for the data buffer buffer . buffer must not be deleted as long as this binary data encoding object is used.
Constructs a binary data encoding object using the encoded body of object as data buffer.
object must not be deleted as long as this binary data encoding object is used.
Decodes a scalar value of type T from the data buffer.
success
被设为
true
if the decoding was successful,
false
若不。
The decoded value is returned. If success is false, the returned value is invalid.
另请参阅 decodeArray ().
Decodes an array of type T from the data buffer.
success
被设为
true
if the decoding was successful,
false
若不。
The decoded value is returned. If success is false, the returned value is invalid.
另请参阅 decode ().
Encodes
src
of type T and appends the encoded value to the data buffer. Returns
true
if the value has been successfully encoded.
另请参阅 encodeArray ().
Encodes all elements of type T in src and appends the encoded values to the data buffer.
返回
true
if the value has been successfully encoded.
另请参阅 encode ().
Returns the current offset in the data buffer.
另请参阅 setOffset ().
Sets the current offset in the data buffer to offset . The first byte in the buffer has the offset 0.
另请参阅 offset ().
Truncates the data buffer to the current offset (). If the offset is behind the current buffer size, this method does nothing.
This method can be used to roll back after an unsuccessful encode by setting the old offset and calling truncateBufferToOffset().