Expand description
Reusable, presentation-free async client for the opcda-bridge gateway’s gRPC API.
This crate is the typed connect/read/write/browse/search/list-servers surface
extracted from opcda-bridge-client’s commands.rs: no clap, no
tabled, no serde_json/toml — just Client, the parameters its
methods take, and the plain result types they return (BrowsePage,
SearchEvent, TagValue, WriteResult, Value). opcda-bridge-client depends
on this crate and adds only CLI parsing and table/JSON rendering on top
of it; any other async Rust program that needs typed OPC DA
reads/writes/browses without shelling out to the CLI binary and parsing
its output can depend on this crate directly instead.
use opcda_bridge::{BrowsePageRequest, SearchMatchMode, SearchRequest};
let mut client = opcda_bridge::Client::connect("localhost:7600").await?;
let servers = client.list_servers().await?;
let root = client.browse(servers[0].clone(), 200).await?;
if let Some(token) = root.next_page_token.clone() {
let request =
BrowsePageRequest::next(servers[0].clone(), root.session_id.clone(), None, token, 200);
let _next_page = client.browse_page(request).await?;
}
let mut search = client
.search_stream(SearchRequest::new(
servers[0].clone(),
"Some",
SearchMatchMode::Prefix,
))
.await?;
while let Some(event) = search.message().await? {
println!("{event:?}");
}
let values = client
.read(servers[0].clone(), vec!["Some.Tag".into()])
.await?;
client.close_browse_session(root.session_id).await?;Structs§
- Browse
Breadcrumb - One navigation step associated with a search match.
- Browse
Node - One child returned by a browse page.
- Browse
Page - One bounded page of immediate children and its continuation metadata.
- Browse
Page Request - Parameters for one browse-page request.
- Capabilities
- Gateway and namespace features reported for one OPC server.
- Client
- A connected client for an opcda-bridge gateway’s gRPC API.
- Search
Completed - Terminal search metadata.
- Search
Match - A progressively emitted namespace-search result.
- Search
Progress - Progress emitted while a namespace search is still running.
- Search
Request - Parameters for a bounded namespace search.
- Search
Stream - A cancellable stream of typed namespace-search events.
- TagValue
- A single tag’s value returned by
crate::Client::read. - Write
Result - The result of a single
crate::Client::writecall.
Enums§
- Browse
Node Kind - Whether a browse node is expandable, selectable as an OPC item, or both.
- Browse
Source - Native or configured strategy that produced browse results.
- Error
- Errors that can occur while talking to an opcda-bridge gateway.
- Namespace
Organization - How the OPC server organizes its namespace.
- Search
Event - One event from the gateway’s search stream.
- Search
Match Mode - Match behavior for namespace search.
- Value
- A tag value to write, parsed from a raw string via
parse_value.
Constants§
- DEFAULT_
BRIDGE_ PORT - Default TCP port used by the gateway and clients.
- DEFAULT_
PAGE_ SIZE - Default number of children requested for one browse page.
- DEFAULT_
SEARCH_ MAX_ RESULTS - Default maximum number of matches requested by a search.
Functions§
- parse_
value - Parse a raw string into bool, integer, float, or string form.