pub struct Variable { /* private fields */ }Expand description
A Variable is a type of node within the AddressSpace.
Implementations§
Source§impl Variable
impl Variable
Sourcepub fn new(
node_id: &NodeId,
browse_name: impl Into<QualifiedName>,
display_name: impl Into<LocalizedText>,
value: impl Into<Variant>,
) -> Variable
pub fn new( node_id: &NodeId, browse_name: impl Into<QualifiedName>, display_name: impl Into<LocalizedText>, value: impl Into<Variant>, ) -> Variable
Creates a new variable. Note that data type, value rank and historizing are mandatory
attributes of the Variable but not required by the constructor. The data type and value rank
are inferred from the value. Historizing is not supported so is always false. If the
inferred types for data type or value rank are wrong, they may be explicitly set, or
call new_data_value() instead.
Sourcepub fn new_full(
base: Base,
data_type: NodeId,
historizing: bool,
value_rank: i32,
value: DataValue,
access_level: u8,
user_access_level: u8,
array_dimensions: Option<Vec<u32>>,
minimum_sampling_interval: Option<f64>,
) -> Self
pub fn new_full( base: Base, data_type: NodeId, historizing: bool, value_rank: i32, value: DataValue, access_level: u8, user_access_level: u8, array_dimensions: Option<Vec<u32>>, minimum_sampling_interval: Option<f64>, ) -> Self
Create a new variable with all attributes, may change if new attributes are added to the OPC-UA standard.
Note: This uses the given value and data type directly, you must ensure that the type of the value matches the data type.
Sourcepub fn from_attributes(
node_id: &NodeId,
browse_name: impl Into<QualifiedName>,
attributes: VariableAttributes,
) -> Result<Self, FromAttributesError>
pub fn from_attributes( node_id: &NodeId, browse_name: impl Into<QualifiedName>, attributes: VariableAttributes, ) -> Result<Self, FromAttributesError>
Create a new variable from VariableAttributes.
Sourcepub fn new_data_value<S, R, N, V>(
node_id: &NodeId,
browse_name: R,
display_name: S,
data_type: N,
value_rank: Option<i32>,
array_dimensions: Option<u32>,
value: V,
) -> Variable
pub fn new_data_value<S, R, N, V>( node_id: &NodeId, browse_name: R, display_name: S, data_type: N, value_rank: Option<i32>, array_dimensions: Option<u32>, value: V, ) -> Variable
Constructs a new variable with the specified id, name, type and value
Sourcepub fn value(
&self,
timestamps_to_return: TimestampsToReturn,
index_range: &NumericRange,
_data_encoding: &DataEncoding,
_max_age: f64,
) -> DataValue
pub fn value( &self, timestamps_to_return: TimestampsToReturn, index_range: &NumericRange, _data_encoding: &DataEncoding, _max_age: f64, ) -> DataValue
Read the value of the variable.
Sourcepub fn set_value<V>(
&mut self,
index_range: &NumericRange,
value: V,
) -> Result<(), StatusCode>
pub fn set_value<V>( &mut self, index_range: &NumericRange, value: V, ) -> Result<(), StatusCode>
Sets the variable’s Variant value. The timestamps for the change are updated to now.
Sourcepub fn set_value_range(
&mut self,
value: Variant,
index_range: &NumericRange,
status_code: StatusCode,
server_timestamp: &DateTime,
source_timestamp: &DateTime,
) -> Result<(), StatusCode>
pub fn set_value_range( &mut self, value: Variant, index_range: &NumericRange, status_code: StatusCode, server_timestamp: &DateTime, source_timestamp: &DateTime, ) -> Result<(), StatusCode>
Set a part of the current value given by index_range.
Sourcepub fn set_value_direct<V>(
&mut self,
value: V,
status_code: StatusCode,
server_timestamp: &DateTime,
source_timestamp: &DateTime,
) -> Result<(), StatusCode>
pub fn set_value_direct<V>( &mut self, value: V, status_code: StatusCode, server_timestamp: &DateTime, source_timestamp: &DateTime, ) -> Result<(), StatusCode>
Sets the variable’s DataValue
Sourcepub fn set_data_value(&mut self, value: DataValue)
pub fn set_data_value(&mut self, value: DataValue)
Sets the variable type’s DataValue
Sourcepub fn minimum_sampling_interval(&self) -> Option<f64>
pub fn minimum_sampling_interval(&self) -> Option<f64>
Gets the minimum sampling interval, if the attribute was set
Sourcepub fn set_minimum_sampling_interval(&mut self, minimum_sampling_interval: f64)
pub fn set_minimum_sampling_interval(&mut self, minimum_sampling_interval: f64)
Sets the minimum sampling interval
Specifies in milliseconds how fast the server can reasonably sample the value for changes
The value 0 means server is to monitor the value continuously. The value -1 means indeterminate.
Sourcepub fn is_readable(&self) -> bool
pub fn is_readable(&self) -> bool
Test if the variable is readable. This will be called by services before getting the value of the node.
Sourcepub fn is_writable(&self) -> bool
pub fn is_writable(&self) -> bool
Test if the variable is writable. This will be called by services before setting the value on the node.
Sourcepub fn set_writable(&mut self, writable: bool)
pub fn set_writable(&mut self, writable: bool)
Sets the variable writable state.
Sourcepub fn access_level(&self) -> AccessLevel
pub fn access_level(&self) -> AccessLevel
Returns the access level of the variable.
Sourcepub fn set_access_level(&mut self, access_level: AccessLevel)
pub fn set_access_level(&mut self, access_level: AccessLevel)
Sets the access level of the variable.
Sourcepub fn is_user_readable(&self) -> bool
pub fn is_user_readable(&self) -> bool
Test if the variable is user readable.
Sourcepub fn is_user_writable(&self) -> bool
pub fn is_user_writable(&self) -> bool
Test if the variable is user writable.
Sourcepub fn user_access_level(&self) -> AccessLevel
pub fn user_access_level(&self) -> AccessLevel
Returns the user access level of the variable.
Sourcepub fn set_user_access_level(&mut self, user_access_level: AccessLevel)
pub fn set_user_access_level(&mut self, user_access_level: AccessLevel)
Set the user access level of the variable.
Sourcepub fn value_rank(&self) -> i32
pub fn value_rank(&self) -> i32
Get the variable value rank.
Sourcepub fn set_value_rank(&mut self, value_rank: i32)
pub fn set_value_rank(&mut self, value_rank: i32)
Set the variable value rank.
Sourcepub fn historizing(&self) -> bool
pub fn historizing(&self) -> bool
Get the Historizing attribute of the variable,
whether it stores new values in a historical store.
Sourcepub fn set_historizing(&mut self, historizing: bool)
pub fn set_historizing(&mut self, historizing: bool)
Set the Historizing attribute of the variable,
whether it stores new values in a historical store.
Sourcepub fn array_dimensions(&self) -> Option<Vec<u32>>
pub fn array_dimensions(&self) -> Option<Vec<u32>>
Get the array dimensions of this variable.
Sourcepub fn set_array_dimensions(&mut self, array_dimensions: &[u32])
pub fn set_array_dimensions(&mut self, array_dimensions: &[u32])
Set the array dimensions of this variable.
Sourcepub fn set_data_type(&mut self, data_type: impl Into<NodeId>)
pub fn set_data_type(&mut self, data_type: impl Into<NodeId>)
Set the data type of this variable.
Trait Implementations§
Source§impl Node for Variable
impl Node for Variable
Source§fn get_attribute_max_age(
&self,
timestamps_to_return: TimestampsToReturn,
attribute_id: AttributeId,
index_range: &NumericRange,
data_encoding: &DataEncoding,
max_age: f64,
) -> Option<DataValue>
fn get_attribute_max_age( &self, timestamps_to_return: TimestampsToReturn, attribute_id: AttributeId, index_range: &NumericRange, data_encoding: &DataEncoding, max_age: f64, ) -> Option<DataValue>
max_age is a hint in milliseconds: Read more