Struct opcua_server::address_space::variable::Variable
source · [−]pub struct Variable { /* private fields */ }Expand description
A Variable is a type of node within the AddressSpace.
Implementations
sourceimpl Variable
impl Variable
sourcepub fn new<R, S, V>(
node_id: &NodeId,
browse_name: R,
display_name: S,
value: V
) -> Variable where
R: Into<QualifiedName>,
S: Into<LocalizedText>,
V: Into<Variant>,
pub fn new<R, S, V>(
node_id: &NodeId,
browse_name: R,
display_name: S,
value: V
) -> Variable where
R: Into<QualifiedName>,
S: Into<LocalizedText>,
V: Into<Variant>,
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 where
R: Into<QualifiedName>,
S: Into<LocalizedText>,
N: Into<NodeId>,
V: Into<Variant>,
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 where
R: Into<QualifiedName>,
S: Into<LocalizedText>,
N: Into<NodeId>,
V: Into<Variant>,
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> where
V: Into<Variant>,
pub fn set_value<V>(
&mut self,
index_range: NumericRange,
value: V
) -> Result<(), StatusCode> where
V: Into<Variant>,
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> where
V: Into<Variant>,
pub fn set_value_direct<V>(
&mut self,
value: V,
status_code: StatusCode,
server_timestamp: &DateTime,
source_timestamp: &DateTime
) -> Result<(), StatusCode> where
V: Into<Variant>,
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) where
T: Into<NodeId>,
Trait Implementations
sourceimpl Node for Variable
impl Node for Variable
sourcefn 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>
Finds the attribute and value. The param max_age is a hint in milliseconds: Read more
sourcefn set_attribute(
&mut self,
attribute_id: AttributeId,
value: Variant
) -> Result<(), StatusCode>
fn set_attribute(
&mut self,
attribute_id: AttributeId,
value: Variant
) -> Result<(), StatusCode>
Sets the attribute with the new value
sourcefn get_attribute(
&self,
timestamps_to_return: TimestampsToReturn,
attribute_id: AttributeId,
index_range: NumericRange,
data_encoding: &QualifiedName
) -> Option<DataValue>
fn get_attribute(
&self,
timestamps_to_return: TimestampsToReturn,
attribute_id: AttributeId,
index_range: NumericRange,
data_encoding: &QualifiedName
) -> Option<DataValue>
Finds the attribute and value.
sourceimpl NodeBase for Variable
impl NodeBase for Variable
sourcefn node_class(&self) -> NodeClass
fn node_class(&self) -> NodeClass
Returns the node class - Object, ObjectType, Method, DataType, ReferenceType, Variable, VariableType or View
sourcefn browse_name(&self) -> QualifiedName
fn browse_name(&self) -> QualifiedName
Returns the node’s browse name
sourcefn display_name(&self) -> LocalizedText
fn display_name(&self) -> LocalizedText
Returns the node’s display name
sourcefn set_display_name(&mut self, display_name: LocalizedText)
fn set_display_name(&mut self, display_name: LocalizedText)
Sets the node’s display name
fn description(&self) -> Option<LocalizedText>
fn set_description(&mut self, description: LocalizedText)
fn write_mask(&self) -> Option<WriteMask>
fn set_write_mask(&mut self, write_mask: WriteMask)
fn user_write_mask(&self) -> Option<WriteMask>
fn set_user_write_mask(&mut self, user_write_mask: WriteMask)
Auto Trait Implementations
impl RefUnwindSafe for Variable
impl Send for Variable
impl Sync for Variable
impl Unpin for Variable
impl UnwindSafe for Variable
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more