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 유형 |
|---|---|
| quint8 | uint8 |
| qint8 | int8 |
| quint16 | uint16 |
| qint16 | int16 |
| quint32 | uint32 |
| qint32 | int32 |
| quint64 | uint64 |
| qint64 | int64 |
| float | float |
| double | double |
| QString | String |
| QOpcUaQualifiedName | QualifiedName |
| QOpcUaLocalizedText | LocalizedText |
| QOpcUaEUInformation | EU정보 |
| QOpcUaRange | 범위 |
| QOpcUaComplexNumber | 복소수 |
| QOpcUaDoubleComplexNumber | 복소수 |
| QOpcUaAxisInformation | 축 정보 |
| QOpcUaXValue | XV |
| QUuid | GUID |
| QString 노드 ID | NodeId |
| QByteArray | ByteString |
| QDateTime | DateTime |
| QOpcUa::UaStatusCode | 상태 코드 |
| QOpcUaExpandedNodeId | 확장된 노드 ID |
| QOpcUaExtensionObject | 확장 객체 |
| QOpcUaArgument | 인자 |
| QOpcUaDiagnosticInfo (Qt 6.7부터) | 진단 정보 |
| QOpcUaApplicationRecordDataType | ApplicationRecordDataType |
| QOpcUaStructureDefinition (Qt 6.7부터) | StructureDefinition |
| QOpcUaStructureField (Qt 6.7부터) | StructureField |
| QOpcUaEnumDefinition (Qt 6.7부터) | EnumDefinition |
| 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)
OVERLAY 로 지정된 OPC UA 내장 유형을 사용하여 데이터 버퍼에서 T 유형의 스칼라 값을 디코딩합니다. 디코딩이 성공하면 success 가 true 로 설정되고, 실패하면 false 로 설정됩니다.
디코딩된 값이 반환됩니다. success 가 false인 경우, 반환된 값은 유효하지 않습니다.
디코딩에 대한 최대 재귀 깊이는 500 로 제한됩니다. 제한에 도달하면 success 가 false로 설정되고 무효한 값이 반환됩니다.
decodeArray()도 참조하십시오 .
template <typename T, QOpcUa::Types OVERLAY = QOpcUa::Types::Undefined> QList<T> QOpcUaBinaryDataEncoding::decodeArray(bool &success)
OVERLAY 로 지정된 OPC UA 내장 유형을 사용하여 데이터 버퍼에서 T 유형의 배열을 디코딩합니다. 디코딩이 성공하면 success 가 true 로 설정되고, 실패하면 false 로 설정됩니다.
디코딩된 값이 반환됩니다. success 가 false인 경우, 반환된 값은 유효하지 않습니다.
디코딩에 대한 최대 재귀 깊이는 500 로 제한됩니다. 제한에 도달하면 success 가 false로 설정되고 무효한 값이 반환됩니다.
decode()도 참조하십시오 .
template <typename T, QOpcUa::Types OVERLAY = QOpcUa::Types::Undefined> bool QOpcUaBinaryDataEncoding::encode(const T &src)
OVERLAY 에 명시된 OPC UA 내장 유형을 사용하여 T 유형의 src 를 인코딩하고, 인코딩된 값을 데이터 버퍼에 추가합니다. 값이 성공적으로 인코딩된 경우 true 를 반환합니다.
encodeArray()도 참조하십시오 .
template <typename T, QOpcUa::Types OVERLAY = QOpcUa::Types::Undefined> bool QOpcUaBinaryDataEncoding::encodeArray(const QList<T> &src)
OVERLAY 에 명시된 OPC UA 내장 유형을 사용하여 ` src ` 내의 `T` 유형 요소들을 모두 인코딩하고, 인코딩된 값들을 데이터 버퍼에 추가합니다.
값이 성공적으로 인코딩된 경우 true 를 반환합니다.
encode()도 참조하십시오 .
int QOpcUaBinaryDataEncoding::offset() const
데이터 버퍼의 현재 오프셋을 반환합니다.
setOffset()도 참조하십시오 .
void QOpcUaBinaryDataEncoding::setOffset(int offset)
데이터 버퍼의 현재 오프셋을 offset 로 설정합니다. 버퍼의 첫 번째 바이트의 오프셋은 0입니다.
offset()도 참조하십시오 .
void QOpcUaBinaryDataEncoding::truncateBufferToOffset()
데이터 버퍼를 현재 offset() 값까지 잘라냅니다. 오프셋이 현재 버퍼 크기보다 뒤쪽인 경우, 이 메서드는 아무 작업도 수행하지 않습니다.
이 메서드는 인코딩에 실패한 후 이전 오프셋을 설정하고 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.