pub struct Contract(/* private fields */);Expand description
Validated, versioned requirements for one device, server and principal.
Implementations§
Source§impl Contract
impl Contract
Sourcepub fn validate_capture_nodes(&self) -> Result<(), SnapshotReadError>
pub fn validate_capture_nodes(&self) -> Result<(), SnapshotReadError>
Check that live acquisition will not read application evidence from reserved session bootstrap nodes. This can be used before connecting or as part of offline preparation.
Source§impl Contract
impl Contract
Sourcepub fn validate_capture(&self, snapshot: &Snapshot) -> Result<(), Error>
pub fn validate_capture(&self, snapshot: &Snapshot) -> Result<(), Error>
Check that the collector accounted for every signal under the requested identities. A row without evidence records an unresolved namespace. When a node resolves, each requested attribute needs a result, including non-Good statuses.
Use this before publishing a new capture. Offline compare also accepts
partial snapshots so previously collected evidence can still be assessed.
Source§impl Contract
impl Contract
Sourcepub fn new(
device: impl Into<String>,
application_uri: impl Into<String>,
principal: impl Into<String>,
signals: Vec<SignalRequirement>,
) -> Result<Self, Error>
pub fn new( device: impl Into<String>, application_uri: impl Into<String>, principal: impl Into<String>, signals: Vec<SignalRequirement>, ) -> Result<Self, Error>
Build a version 1 contract in memory using the same rules as parse_contract.
use opcua_kit::commissioning::{Contract, NodeId, SignalRequirement};
let node = NodeId::new("urn:plant:line-1", "s=PartsProduced")?;
let uint64 = NodeId::new("http://opcfoundation.org/UA/", "i=9")?;
let mut counter = SignalRequirement::new("PartsProduced", node, uint64);
counter.value_rank = Some(-1);
let contract = Contract::new("line-1", "urn:plant:server", "anonymous", vec![counter])?;
assert_eq!(contract.signals()[0].node.identifier(), "s=PartsProduced");Sourcepub fn application_uri(&self) -> &str
pub fn application_uri(&self) -> &str
Expected server ApplicationUri.
Sourcepub fn signals(&self) -> &[SignalRequirement]
pub fn signals(&self) -> &[SignalRequirement]
Validated signal requirements in declaration order, with canonical node identifiers.
Sourcepub fn signal_count(&self) -> usize
pub fn signal_count(&self) -> usize
Number of distinct signals required by this contract.