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<R, S, V>(
node_id: &NodeId,
browse_name: R,
display_name: S,
value: V,
) -> Variable
pub fn new<R, S, V>( node_id: &NodeId, browse_name: R, display_name: S, value: V, ) -> 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.
pub fn from_attributes<S>(
node_id: &NodeId,
browse_name: S,
attributes: VariableAttributes,
) -> Result<Self, ()>where
S: Into<QualifiedName>,
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
pub fn is_valid(&self) -> bool
pub fn value( &self, timestamps_to_return: TimestampsToReturn, index_range: NumericRange, data_encoding: &QualifiedName, max_age: f64, ) -> DataValue
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.
pub fn set_value_range( &mut self, value: Variant, index_range: NumericRange, status_code: StatusCode, server_timestamp: &DateTime, source_timestamp: &DateTime, ) -> Result<(), StatusCode>
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_value_getter(
&mut self,
value_getter: Arc<Mutex<dyn AttributeGetter + Send>>,
)
pub fn set_value_getter( &mut self, value_getter: Arc<Mutex<dyn AttributeGetter + Send>>, )
Sets a getter function that will be called to get the value of this variable.
Sourcepub fn set_value_setter(
&mut self,
value_setter: Arc<Mutex<dyn AttributeSetter + Send>>,
)
pub fn set_value_setter( &mut self, value_setter: Arc<Mutex<dyn AttributeSetter + Send>>, )
Sets a setter function that will be called to set the value of this variable.
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) -> UserAccessLevel
pub fn user_access_level(&self) -> UserAccessLevel
Returns the user access level of the variable.
Sourcepub fn set_user_access_level(&mut self, user_access_level: UserAccessLevel)
pub fn set_user_access_level(&mut self, user_access_level: UserAccessLevel)
Set the user access level of the variable.
pub fn value_rank(&self) -> i32
pub fn set_value_rank(&mut self, value_rank: i32)
pub fn historizing(&self) -> bool
pub fn set_historizing(&mut self, historizing: bool)
pub fn array_dimensions(&self) -> Option<Vec<u32>>
pub fn set_array_dimensions(&mut self, array_dimensions: &[u32])
pub fn data_type(&self) -> NodeId
pub fn set_data_type<T>(&mut self, data_type: T)
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: &QualifiedName,
max_age: f64,
) -> Option<DataValue>
fn get_attribute_max_age( &self, timestamps_to_return: TimestampsToReturn, attribute_id: AttributeId, index_range: NumericRange, data_encoding: &QualifiedName, max_age: f64, ) -> Option<DataValue>
max_age is a hint in milliseconds: Read more