このページでは

EndpointDiscovery QML Type

サーバー上で利用可能なエンドポイントに関する情報を提供します。詳細...

Import Statement: import QtOpcUa
Since: QtOpcUa 5.13
Status: Deprecated since 6.9

この型はQtOpcUa 6.9以降非推奨です。新しいコードでは使用しないことを強くお勧めします。

プロパティ

信号

方法

  • 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も参照してください

シグナルのドキュメント

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 です。

statuscountatStatusEndpointDescriptionも参照

メソッド・ドキュメント

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
}

countstatusEndpointDescriptionも参照して ください。

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