Struct open62541::AsyncClient
source · pub struct AsyncClient { /* private fields */ }Expand description
Connected OPC UA client (with asynchronous API).
Implementations§
source§impl AsyncClient
impl AsyncClient
sourcepub fn new(endpoint_url: &str, cycle_time: Duration) -> Result<Self, Error>
pub fn new(endpoint_url: &str, cycle_time: Duration) -> Result<Self, Error>
Creates client connected to endpoint.
If you need more control over the initialization, use ClientBuilder instead, and turn it
into Client by calling connect(), followed by
into_async() to get the asynchronous API.
§Errors
See ClientBuilder::connect() and Client::into_async().
§Panics
sourcepub fn state(&self) -> Result<ClientState, Error>
pub fn state(&self) -> Result<ClientState, Error>
Gets current channel and session state, and connect status.
§Errors
This only fails when the client has an internal error.
sourcepub async fn read_value(&self, node_id: &NodeId) -> Result<DataValue, Error>
pub async fn read_value(&self, node_id: &NodeId) -> Result<DataValue, Error>
Reads value from server.
§Errors
This fails when the node does not exist or its value attribute cannot be read.
sourcepub async fn write_value(
&self,
node_id: &NodeId,
value: &DataValue
) -> Result<(), Error>
pub async fn write_value( &self, node_id: &NodeId, value: &DataValue ) -> Result<(), Error>
Writes value from server.
§Errors
This fails when the node does not exist or its value attribute cannot be written.
sourcepub async fn call_method(
&self,
object_id: &NodeId,
method_id: &NodeId,
input_arguments: &[Variant]
) -> Result<Option<Vec<Variant>>, Error>
pub async fn call_method( &self, object_id: &NodeId, method_id: &NodeId, input_arguments: &[Variant] ) -> Result<Option<Vec<Variant>>, Error>
Calls specific method node at object node.
§Errors
This fails when the object or method node does not exist, the method cannot be called, or the input arguments are unexpected.
sourcepub async fn browse_many(
&self,
node_ids: &[impl Borrow<NodeId>]
) -> Result<Vec<Option<Vec<ReferenceDescription>>>, Error>
pub async fn browse_many( &self, node_ids: &[impl Borrow<NodeId>] ) -> Result<Vec<Option<Vec<ReferenceDescription>>>, Error>
Browses several nodes at once.
This issues only a single request to the OPC UA server (and should be preferred over several
individual requests with browse() when browsing multiple nodes).
The size and order of the result list matches the size and order of the given node ID list.
§Errors
This fails when any of the given nodes does not exist or cannot be browsed.