QOpcUaBinaryDataEncoding Class

QOpcUaBinaryDataEncoding은 OPC UA 파트 6에 설명된 OPC UA 이진 데이터 인코딩의 부분적인 구현입니다. 더 보기...

헤더: #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()

상세 설명

확장 객체를 읽고 쓰기 위한 데이터 인코딩 및 디코딩을 위한 템플릿 함수를 제공합니다.

지원되는 유형은 다음과 같습니다:

Qt 유형OPC UA 유형
quint8uint8
qint8int8
quint16uint16
qint16int16
quint32uint32
qint32int32
quint64uint64
qint64int64
floatfloat
doubledouble
QStringString
QOpcUaQualifiedName한정된 이름
QOpcUaLocalizedTextLocalizedText
QOpcUaEUInformationEU정보
QOpcUaRange범위
QOpcUaComplexNumber복소수
QOpcUaDoubleComplexNumber복소수
QOpcUaAxisInformation축 정보
QOpcUaXValueXV
QUuidGUID
QString 노드 IDNodeId
QByteArray바이트 문자열
QDateTime날짜/시간
QOpcUa::UaStatusCodeStatusCode
QOpcUaExpandedNodeId확장노드아이디
QOpcUaExtensionObject확장 오브젝트
QOpcUaArgument인수
QOpcUaDiagnosticInfo (Qt 6.7 이후)진단 정보
QOpcUaApplicationRecordDataType어플리케이션 레코드 데이터 타입
QOpcUaStructureDefinition (Qt 6.7부터)구조체 정의
QOpcUaStructureField (Qt 6.7부터)StructureField
QOpcUaEnumDefinition (Qt 6.7부터)EnumDefintion
QOpcUaEnumField (Qt 6.7부터)EnumField
QOpcUaVariant (Qt 6.7부터)Variant
QOpcUaDataValue (Qt 6.7부터)DataValue

멤버 함수 문서

QOpcUaBinaryDataEncoding::QOpcUaBinaryDataEncoding(QByteArray *buffer)

데이터 버퍼에 대한 바이너리 데이터 인코딩 객체를 구축합니다 buffer. buffer 이 바이너리 데이터 인코딩 객체를 사용하는 한 삭제해서는 안 됩니다.

QOpcUaBinaryDataEncoding::QOpcUaBinaryDataEncoding(QOpcUaExtensionObject &object)

object 의 인코딩된 본문을 데이터 버퍼로 사용하여 바이너리 데이터 인코딩 객체를 구축합니다.

object 이 바이너리 데이터 인코딩 객체가 사용되는 한 삭제해서는 안 됩니다.

template <typename T, QOpcUa::Types OVERLAY = QOpcUa::Types::Undefined> T QOpcUaBinaryDataEncoding::decode(bool &success)

데이터 버퍼에서 T 타입의 스칼라 값을 디코딩합니다. 디코딩에 성공하면 successtrue 으로 설정되고, 실패하면 false 으로 설정됩니다.

디코딩된 값이 반환됩니다. success 이 거짓이면 반환된 값은 유효하지 않습니다.

decodeArray()도 참조하세요 .

template <typename T, QOpcUa::Types OVERLAY = QOpcUa::Types::Undefined> QList<T> QOpcUaBinaryDataEncoding::decodeArray(bool &success)

데이터 버퍼에서 유형 T의 배열을 디코딩합니다. success 디코딩에 성공하면 true, 실패하면 false 로 설정됩니다.

디코딩된 값이 반환됩니다. success 이 거짓이면 반환된 값은 유효하지 않습니다.

decode()도 참조하세요 .

template <typename T, QOpcUa::Types OVERLAY = QOpcUa::Types::Undefined> bool QOpcUaBinaryDataEncoding::encode(const T &src)

T 타입의 src 을 인코딩하고 인코딩된 값을 데이터 버퍼에 추가합니다. 값이 성공적으로 인코딩되면 true 을 반환합니다.

encodeArray()도 참조하세요 .

template <typename T, QOpcUa::Types OVERLAY = QOpcUa::Types::Undefined> bool QOpcUaBinaryDataEncoding::encodeArray(const QList<T> &src)

src 에서 T 타입의 모든 요소를 인코딩하고 인코딩된 값을 데이터 버퍼에 추가합니다.

값이 성공적으로 인코딩되면 true 을 반환합니다.

encode()도 참조하세요 .

int QOpcUaBinaryDataEncoding::offset() const

데이터 버퍼의 현재 오프셋을 반환합니다.

setOffset()도 참조하세요 .

void QOpcUaBinaryDataEncoding::setOffset(int offset)

데이터 버퍼의 현재 오프셋을 offset 으로 설정합니다. 버퍼의 첫 번째 바이트는 오프셋이 0입니다.

offset()도 참조하세요 .

void QOpcUaBinaryDataEncoding::truncateBufferToOffset()

데이터 버퍼를 현재 offset()로 잘라냅니다. 오프셋이 현재 버퍼 크기보다 뒤에 있으면 이 메서드는 아무 작업도 수행하지 않습니다.

이 메서드는 인코딩에 실패한 후 이전 오프셋을 설정하고 truncateBufferToOffset()을 호출하여 롤백하는 데 사용할 수 있습니다.

© 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.