EndpointDiscovery QML Type
サーバー上で利用可能なエンドポイントに関する情報を提供します。詳細...
| Import Statement: | import QtOpcUa |
| Since: | QtOpcUa 5.13 |
| Status: | Deprecated since 6.9 |
この型は QtOpcUa 6.9 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
プロパティ
- 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
この要素に含まれるエンドポイントの現在の数。エンドポイント検出から取得したデータを使用する前に、status を確認し、情報が正常に取得されたかどうかを確認してください。
「 status 」および「Status 」も参照してください 。
serverUrl : string
エンドポイントを取得するサーバーのディスカバリーURL。URLが変更されるたびに、指定されたサーバーへのリクエストが開始されます。
リクエストを開始する際、利用可能なエンドポイントのリストはクリアされ、ステータスは「Status.GoodCompletesAsynchronously 」に設定されます。リクエストが完了すると、「status 」が更新されます。
エンドポイントのリストにアクセスする前に、必ずstatus を確認してください。
「endpointsChanged」も参照してください 。
status : Status
この要素の現在のステータス。エンドポイントの最後の取得が成功した場合、ステータスは「Status.Good 」となります。
if (endpoints.status.isGood) {
// do something
} else {
// handle error
}「Status」も参照してください 。
Signal ドキュメント
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も参照してください 。
© 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.