pub struct Client { /* private fields */ }Expand description
An OPC-UA client. SecurityMode None by default; call
set_security (feature crypto) for a secured
SecurityPolicy.
Implementations§
Source§impl Client
impl Client
Sourcepub fn session_id(&self) -> &NodeId
pub fn session_id(&self) -> &NodeId
The activated session id (null until connected).
Sourcepub fn open_channel<T: Transport>(
&mut self,
transport: &mut T,
endpoint_url: &str,
) -> Result<(), ClientError>
pub fn open_channel<T: Transport>( &mut self, transport: &mut T, endpoint_url: &str, ) -> Result<(), ClientError>
Opens just the transport + SecureChannel (Hello + OpenSecureChannel),
without a session — enough for the session-less Discovery services
(get_endpoints / find_servers).
§Errors
ClientError on a Hello/OpenSecureChannel failure.
Sourcepub fn connect<T: Transport>(
&mut self,
transport: &mut T,
endpoint_url: &str,
) -> Result<(), ClientError>
pub fn connect<T: Transport>( &mut self, transport: &mut T, endpoint_url: &str, ) -> Result<(), ClientError>
Runs the full connect handshake: Hello, OpenSecureChannel, CreateSession, ActivateSession.
§Errors
ClientError on any handshake step failing.
Sourcepub fn read_values<T: Transport>(
&mut self,
transport: &mut T,
node_ids: &[NodeId],
) -> Result<Vec<DataValue>, ClientError>
pub fn read_values<T: Transport>( &mut self, transport: &mut T, node_ids: &[NodeId], ) -> Result<Vec<DataValue>, ClientError>
Sourcepub fn write_values<T: Transport>(
&mut self,
transport: &mut T,
writes: &[(NodeId, DataValue)],
) -> Result<Vec<u32>, ClientError>
pub fn write_values<T: Transport>( &mut self, transport: &mut T, writes: &[(NodeId, DataValue)], ) -> Result<Vec<u32>, ClientError>
Writes the Value attribute of each (node, value) pair, returning one
StatusCode per write.
§Errors
ClientError if not connected or the service fails.
Sourcepub fn get_endpoints<T: Transport>(
&mut self,
transport: &mut T,
endpoint_url: &str,
) -> Result<Vec<EndpointDescription>, ClientError>
pub fn get_endpoints<T: Transport>( &mut self, transport: &mut T, endpoint_url: &str, ) -> Result<Vec<EndpointDescription>, ClientError>
Calls the session-less Discovery service GetEndpoints (Part 4 §5.5.4).
Requires only an open channel (open_channel or a
full connect).
§Errors
ClientError if the channel is not open or the service fails.
Sourcepub fn find_servers<T: Transport>(
&mut self,
transport: &mut T,
endpoint_url: &str,
) -> Result<Vec<ApplicationDescription>, ClientError>
pub fn find_servers<T: Transport>( &mut self, transport: &mut T, endpoint_url: &str, ) -> Result<Vec<ApplicationDescription>, ClientError>
Calls the session-less Discovery service FindServers (Part 4 §5.5.2).
§Errors
ClientError if the channel is not open or the service fails.
Sourcepub fn create_subscription<T: Transport>(
&mut self,
transport: &mut T,
) -> Result<u32, ClientError>
pub fn create_subscription<T: Transport>( &mut self, transport: &mut T, ) -> Result<u32, ClientError>
Creates a subscription with default parameters and returns its id.
§Errors
ClientError if not connected or the service fails.
Sourcepub fn create_monitored_items<T: Transport>(
&mut self,
transport: &mut T,
subscription_id: u32,
items: &[(NodeId, u32)],
) -> Result<Vec<MonitoredItemCreateResult>, ClientError>
pub fn create_monitored_items<T: Transport>( &mut self, transport: &mut T, subscription_id: u32, items: &[(NodeId, u32)], ) -> Result<Vec<MonitoredItemCreateResult>, ClientError>
Creates monitored items (one per (node, client_handle)) on a
subscription and returns the per-item results.
§Errors
ClientError if not connected or the service fails.
Sourcepub fn publish<T: Transport>(
&mut self,
transport: &mut T,
) -> Result<(u32, Vec<MonitoredItemNotification>), ClientError>
pub fn publish<T: Transport>( &mut self, transport: &mut T, ) -> Result<(u32, Vec<MonitoredItemNotification>), ClientError>
Sends a Publish and returns (subscriptionId, changed monitored items)
decoded from the response’s DataChangeNotification(s).
§Errors
ClientError if not connected or the service fails.
Sourcepub fn delete_subscriptions<T: Transport>(
&mut self,
transport: &mut T,
subscription_ids: &[u32],
) -> Result<Vec<u32>, ClientError>
pub fn delete_subscriptions<T: Transport>( &mut self, transport: &mut T, subscription_ids: &[u32], ) -> Result<Vec<u32>, ClientError>
Deletes subscriptions and returns the per-subscription StatusCodes.
§Errors
ClientError if not connected or the service fails.
Sourcepub fn browse<T: Transport>(
&mut self,
transport: &mut T,
node_id: NodeId,
) -> Result<Vec<ReferenceDescription>, ClientError>
pub fn browse<T: Transport>( &mut self, transport: &mut T, node_id: NodeId, ) -> Result<Vec<ReferenceDescription>, ClientError>
Browses a node’s forward hierarchical references (all reference types, all node classes, full result mask) and returns the references found.
§Errors
ClientError if not connected or the service fails.