QOpcUaBinaryDataEncoding Class
QOpcUaBinaryDataEncoding es una implementación parcial de la codificación de datos binarios OPC UA descrita en OPC UA parte 6. Más...
| Cabecera: | #include <QOpcUaBinaryDataEncoding> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS OpcUa)target_link_libraries(mytarget PRIVATE Qt6::OpcUa) |
| qmake: | QT += opcua |
Funciones públicas
| 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() |
Descripción detallada
Ofrece funciones de plantilla para codificar y descodificar datos para leer y escribir objetos de extensión.
Soporta los siguientes tipos:
| Tipo Qt | Tipo OPC UA |
|---|---|
| quint8 | uint8 |
| qint8 | int8 |
| quint16 | uint16 |
| qint16 | int16 |
| quint32 | uint32 |
| qint32 | int32 |
| quint64 | uint64 |
| qint64 | int64 |
| float | float |
| doble | double |
| QString | Cadena |
| QOpcUaQualifiedName | QualifiedName |
| QOpcUaLocalizedText | LocalizedText |
| QOpcUaEUInformation | Información UE |
| QOpcUaRange | Rango |
| QOpcUaComplexNumber | ComplexNumber |
| QOpcUaDoubleComplexNumber | DoubleComplexNumber |
| QOpcUaAxisInformation | Información del eje |
| QOpcUaXValue | XV |
| QUuid | GUID |
| QString id de nodo | NodeId |
| QByteArray | ByteString |
| QDateTime | FechaHora |
| QOpcUa::UaStatusCode | StatusCode |
| QOpcUaExpandedNodeId | ExpandedNodeId |
| QOpcUaExtensionObject | ExtensionObject |
| QOpcUaArgument | Argumento |
| QOpcUaDiagnosticInfo (desde Qt 6.7) | DiagnosticInfo |
| QOpcUaApplicationRecordDataType | ApplicationRecordDataType |
| QOpcUaStructureDefinition (desde Qt 6.7) | StructureDefintion |
| QOpcUaStructureField (desde Qt 6.7) | StructureField |
| QOpcUaEnumDefinition (desde Qt 6.7) | EnumDefintion |
| QOpcUaEnumField (desde Qt 6.7) | EnumField |
| QOpcUaVariant (desde Qt 6.7) | Variante |
| QOpcUaDataValue (desde Qt 6.7) | DataValue |
Documentación de la Función Miembro
QOpcUaBinaryDataEncoding::QOpcUaBinaryDataEncoding(QByteArray *buffer)
Construye un objeto de codificación de datos binarios para el búfer de datos buffer. buffer no debe borrarse mientras se utilice este objeto de codificación de datos binarios.
QOpcUaBinaryDataEncoding::QOpcUaBinaryDataEncoding(QOpcUaExtensionObject &object)
Construye un objeto de codificación de datos binarios utilizando el cuerpo codificado de object como búfer de datos.
object no debe borrarse mientras se utilice este objeto de codificación de datos binarios.
template <typename T, QOpcUa::Types OVERLAY = QOpcUa::Types::Undefined> T QOpcUaBinaryDataEncoding::decode(bool &success)
Decodifica un valor escalar de tipo T del búfer de datos. success se establece en true si la decodificación se ha realizado correctamente, false en caso contrario.
Se devuelve el valor descodificado. Si success es falso, el valor devuelto no es válido.
Véase también decodeArray().
template <typename T, QOpcUa::Types OVERLAY = QOpcUa::Types::Undefined> QList<T> QOpcUaBinaryDataEncoding::decodeArray(bool &success)
Decodifica una matriz de tipo T del búfer de datos. success se establece en true si la decodificación se ha realizado correctamente, false en caso contrario.
Se devuelve el valor decodificado. Si success es falso, el valor devuelto no es válido.
Véase también decode().
template <typename T, QOpcUa::Types OVERLAY = QOpcUa::Types::Undefined> bool QOpcUaBinaryDataEncoding::encode(const T &src)
Codifica src de tipo T y añade el valor codificado al búfer de datos. Devuelve true si el valor se ha codificado correctamente.
Véase también encodeArray().
template <typename T, QOpcUa::Types OVERLAY = QOpcUa::Types::Undefined> bool QOpcUaBinaryDataEncoding::encodeArray(const QList<T> &src)
Codifica todos los elementos de tipo T en src y añade los valores codificados al búfer de datos.
Devuelve true si el valor se ha codificado correctamente.
Véase también encode().
int QOpcUaBinaryDataEncoding::offset() const
Devuelve el desplazamiento actual en el búfer de datos.
Véase también setOffset().
void QOpcUaBinaryDataEncoding::setOffset(int offset)
Establece el desplazamiento actual en el búfer de datos en offset. El primer byte del búfer tiene el desplazamiento 0.
Véase también offset().
void QOpcUaBinaryDataEncoding::truncateBufferToOffset()
Trunca el búfer de datos hasta el actual offset(). Si el offset está por detrás del tamaño actual del buffer, este método no hace nada.
Este método puede usarse para retroceder después de una codificación fallida estableciendo el antiguo offset y llamando a truncateBufferToOffset().
© 2026 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.