QModbusReply Class
QModbusReply 클래스에는 QModbusClient 파생 클래스로 전송된 요청에 대한 데이터가 포함되어 있습니다. 더 보기...
헤더: | #include <QModbusReply> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS SerialBus) target_link_libraries(mytarget PRIVATE Qt6::SerialBus) |
qmake: | QT += serialbus |
상속합니다: | QObject |
공용 타입
enum | ReplyType { Raw, Common, Broadcast } |
공용 함수
QModbusReply(QModbusReply::ReplyType type, int serverAddress, QObject *parent = nullptr) | |
QModbusDevice::Error | error() const |
QString | errorString() const |
(since 6.0) QList<QModbusDevice::IntermediateError> | intermediateErrors() const |
bool | isFinished() const |
QModbusResponse | rawResult() const |
QModbusDataUnit | result() const |
int | serverAddress() const |
QModbusReply::ReplyType | type() const |
시그널
void | errorOccurred(QModbusDevice::Error error) |
void | finished() |
멤버 유형 문서
enum QModbusReply::ReplyType
이 열거형은 가능한 응답 유형을 설명합니다.
Constant | 값 | 설명 |
---|---|---|
QModbusReply::Raw | 0 | 응답은 원시 모드버스 요청에서 비롯됩니다. 참조 QModbusClient::sendRawRequest |
QModbusReply::Common | 1 | 응답은 일반적인 읽기, 쓰기 또는 읽기/쓰기 요청에서 비롯됩니다. QModbusClient::sendReadRequest , QModbusClient::sendWriteRequest 및 QModbusClient::sendReadWriteRequest |
QModbusReply::Broadcast | 2 | 응답은 모드버스 브로드캐스트 요청에서 비롯됩니다. serverAddress ()는 0 을 반환하고 finished() 신호는 즉시 방출됩니다. |
멤버 기능 문서
QModbusReply::QModbusReply(QModbusReply::ReplyType type, int serverAddress, QObject *parent = nullptr)
주어진 type 와 지정된 parent 로 QModbusReply 객체를 구축합니다.
응답은 serverAddress 로 표시되는 모드버스 클라이언트로 전송됩니다.
QModbusDevice::Error QModbusReply::error() const
이 응답의 오류 상태를 반환합니다.
errorString() 및 errorOccurred()도 참조하세요 .
[signal]
void QModbusReply::errorOccurred(QModbusDevice::Error error)
이 신호는 이 회신 처리 과정에서 오류가 감지되었을 때 전송됩니다. finished () 신호가 뒤따를 수 있습니다.
오류는 오류 코드 error 로 설명됩니다. errorString 이 비어 있지 않으면 오류에 대한 텍스트 설명이 포함됩니다. QModbusDevice::ProtocolError 의 경우 rawResult() 함수를 사용하여 원래 Modbus 예외 응답을 가져와 예외 코드를 가져올 수 있습니다.
참고: 이 신호에 연결된 슬롯에서 이 응답 개체를 삭제하지 마세요. 대신 deleteLater()를 사용하세요.
error() 및 errorString()도 참조하세요 .
QString QModbusReply::errorString() const
이 응답의 오류 상태를 텍스트로 표현한 내용을 반환합니다.
오류가 발생하지 않은 경우 빈 문자열을 반환합니다. 관련 텍스트 표현이 없는 오류가 발생했을 수도 있으며, 이 경우에도 빈 문자열을 반환합니다.
error() 및 errorOccurred()도 참조하세요 .
[signal]
void QModbusReply::finished()
이 신호는 회신 처리가 완료되면 전송됩니다. 회신이 여전히 오류와 함께 반환되었을 수 있습니다.
이 신호가 전송된 후에는 회신 데이터에 대한 업데이트가 더 이상 이루어지지 않습니다.
참고: 이 신호에 연결된 슬롯의 개체를 삭제하지 마세요. deleteLater ()를 사용합니다.
또한 isFinished()를 사용하여 finished() 신호를 받기 전에도 QNetworkReply가 완료되었는지 확인할 수 있습니다.
isFinished() 및 error()도 참조하세요 .
[since 6.0]
QList<QModbusDevice::IntermediateError> QModbusReply::intermediateErrors() const
QModbusReply 보고가 완료될 때까지 모드버스 요청의 송수신 주기 동안 발생했을 수 있는 중간 오류 목록을 반환합니다.
이 함수는 Qt 6.0에 도입되었습니다.
bool QModbusReply::isFinished() const
응답이 완료되었거나 중단된 경우 true
을 반환합니다.
QModbusResponse QModbusReply::rawResult() const
모드버스 요청의 원시 응답을 반환합니다.
요청이 완료되지 않은 경우 반환된 QModbusResponse 인스턴스는 유효하지 않습니다.
QModbusDataUnit QModbusReply::result() const
모드버스 요청의 사전 처리된 결과를 반환합니다.
읽기 요청과 QModbusClient::sendReadWriteRequest()를 통해 전송된 읽기/쓰기 결합 요청의 경우 서버 인스턴스에서 읽은 값을 포함합니다.
요청이 완료되지 않았거나 오류로 실패했거나 쓰기 요청인 경우 반환된 QModbusDataUnit 인스턴스는 유효하지 않습니다.
참고: 응답의 type()가 QModbusReply::Broadcast 인 경우 반환 값은 항상 유효하지 않습니다. 응답의 type()가 QModbusReply::Raw 인 경우 QModbusClient::processPrivateResponse()의 구현에 따라 반환 값이 유효하지 않을 수 있습니다.
type(), rawResult() 및 QModbusClient::processPrivateResponse()도 참조하세요 .
int QModbusReply::serverAddress() const
이 응답 객체가 대상으로 하는 서버 주소를 반환합니다.
QModbusReply::ReplyType QModbusReply::type() const
회신 유형을 반환합니다.
참고: 회신 유형이 QModbusReply::Raw 인 경우 result()의 반환 값은 항상 유효하지 않습니다.
© 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.