EndpointDiscovery QML Type
서버에서 사용 가능한 엔드포인트에 대한 정보를 제공합니다. 더 보기...
Import Statement: | import QtOpcUa |
Since: | QtOpcUa 5.13 |
속성
- connection : Connection
- count : int
- serverUrl : string
- status : Status
신호
방법
- EndpointDescription at(index)
상세 설명
서버에서 사용 가능한 엔드포인트에 대한 정보를 가져오고 액세스할 수 있습니다.
QtOpcUa.Connection { id: connection backend: availableBackends[0] defaultConnection: true } QtOpcUa.ServerDiscovery { discoveryUrl: "opc.tcp://127.0.0.1:43344" onServersChanged: { if (status.isGood) { if (status.status == QtOpcUa.Status.GoodCompletesAsynchronusly) return; // wait until finished if (count > 0) { // choose right server endpointDiscovery.serverUrl = at(0).discoveryUrls[0]; console.log("Using server URL:", endpointDiscovery.serverUrl); } else { // no servers retrieved } } else { // Fetching servers failed console.log("Error fetching server:", servers.status.status); } } } QtOpcUa.EndpointDiscovery { id: endpointDiscovery onEndpointsChanged: { if (status.isGood) { if (status.status == QtOpcUa.Status.GoodCompletesAsynchronusly) return; // wait until finished if (count > 0) { // choose right endpoint console.log("Using endpoint", at(0).endpointUrl, at(0).securityPolicy); connection.connectToEndpoint(at(0)); } else { // no endpoints retrieved } } else { // Fetching endpoints failed console.log("Error fetching endpoints:", status.status); } } }
속성 문서
connection : Connection |
정보 요청에 사용할 연결입니다.
이 속성을 설정하지 않으면 기본 연결(있는 경우)이 사용됩니다.
Connection 및 Connection::defaultConnection 을참조하세요 .
count : int |
serverUrl : string |
엔드포인트를 가져올 서버의 검색 URL입니다. URL이 변경될 때마다 지정된 서버에 대한 요청이 시작됩니다.
요청을 시작하면 사용 가능한 엔드포인트 목록이 지워지고 상태가 Status.GoodCompletesAsynchronously 로 설정됩니다. 요청이 완료되면 status 으로 변경됩니다.
엔드포인트 목록에 액세스하기 전에 status 을 확인하세요.
endpointsChanged도 참조하세요 .
status : Status |
이 요소의 현재 상태입니다. 엔드포인트의 마지막 검색이 성공한 경우 상태는 Status.Good 입니다.
if (endpoints.status.isGood) { // do something } else { // handle error }
Status도 참조하세요 .
신호 문서
endpointsChanged() |
검색 요청이 시작, 완료 또는 실패했을 때 발생합니다. 호출된 함수에서 먼저 객체의 status 을 확인해야 합니다. 상태가 Status.GoodCompletesAsynchronously 인 경우 요청이 아직 실행 중입니다. 상태가 Status.Good 인 경우 요청이 완료되었으며 엔드포인트 설명을 읽을 수 있습니다. 상태가 좋지 않은 경우 오류가 발생했으며 status 에 반환된 오류 코드가 포함되어 있습니다.
onEndpointsChanged: { if (endpoints.status.isGood) { if (endpoints.status.status == QtOpcua.Status.GoodCompletesAsynchronusly) return; // wait until finished if (endpoints.count > 0) { var endpointUrl = endpoints.at(0).endpointUrl(); console.log(endpointUrl); } } else { // handle error } }
참고: 해당 핸들러는 onEndpointsChanged
입니다.
status, count, at, Status, EndpointDescription도 참조하세요 .
메서드 문서
EndpointDescription at(index) |
주어진 index 에 있는 엔드포인트 설명을 반환합니다. 사용 가능한 엔드포인트가 없거나 인덱스가 유효하지 않은 경우 유효하지 않은 엔드포인트 설명이 반환됩니다. 이 데이터를 사용하기 전에 status 에서 정보 검색에 성공했는지 확인해야 합니다.
if (endpoints.status.isGood) { if (endpoints.count > 0) var endpointUrl = endpoints.at(0).endpointUrl(); console.log(endpointUrl); } else { // handle error }
count, status, EndpointDescription도 참조하세요 .
© 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.