Struct opcua_server::prelude::DataChangeFilter
source · pub struct DataChangeFilter {
pub trigger: DataChangeTrigger,
pub deadband_type: u32,
pub deadband_value: f64,
}Fields§
§trigger: DataChangeTrigger§deadband_type: u32§deadband_value: f64Implementations§
source§impl DataChangeFilter
impl DataChangeFilter
sourcepub fn compare(
&self,
v1: &DataValue,
v2: &DataValue,
eu_range: Option<(f64, f64)>
) -> bool
pub fn compare(
&self,
v1: &DataValue,
v2: &DataValue,
eu_range: Option<(f64, f64)>
) -> bool
Compares one data value to another and returns true if they differ, according to their trigger type of status, status/value or status/value/timestamp
pub fn compare_value_option(
&self,
v1: &Option<Variant>,
v2: &Option<Variant>,
eu_range: Option<(f64, f64)>
) -> bool
sourcepub fn compare_value(
&self,
v1: &Variant,
v2: &Variant,
eu_range: Option<(f64, f64)>
) -> Result<bool, StatusCode>
pub fn compare_value(
&self,
v1: &Variant,
v2: &Variant,
eu_range: Option<(f64, f64)>
) -> Result<bool, StatusCode>
Compares two values, either a straight value compare or a numeric comparison against the deadband settings. If deadband is asked for and the values are not convertible into a numeric value, the result is false. The value is true if the values are the same within the limits set.
The eu_range is the engineering unit range and represents the range that the value should typically operate between. It’s used for percentage change operations and ignored otherwise.
Errors
BadDeadbandFilterInvalid indicates the deadband settings were invalid, e.g. an invalid type, or the args were invalid. A (low, high) range must be supplied for a percentage deadband compare.
sourcepub fn abs_compare(v1: f64, v2: f64, threshold_diff: f64) -> bool
pub fn abs_compare(v1: f64, v2: f64, threshold_diff: f64) -> bool
Compares the difference between v1 and v2 to the threshold. The two values are considered equal if their difference is less than or equal to the threshold.
sourcepub fn pct_compare(
v1: f64,
v2: f64,
low: f64,
high: f64,
threshold_pct_change: f64
) -> bool
pub fn pct_compare(
v1: f64,
v2: f64,
low: f64,
high: f64,
threshold_pct_change: f64
) -> bool
Compares the percentage difference between v1 and v2 using the low-high range as the comparison. The two values are considered equal if their perentage difference is less than or equal to the threshold.
Trait Implementations§
source§impl BinaryEncoder<DataChangeFilter> for DataChangeFilter
impl BinaryEncoder<DataChangeFilter> for DataChangeFilter
source§fn byte_len(&self) -> usize
fn byte_len(&self) -> usize
source§fn encode<S>(&self, stream: &mut S) -> Result<usize, StatusCode>where
S: Write,
fn encode<S>(&self, stream: &mut S) -> Result<usize, StatusCode>where
S: Write,
source§fn decode<S>(
stream: &mut S,
decoding_limits: &DecodingLimits
) -> Result<DataChangeFilter, StatusCode>where
S: Read,
fn decode<S>(
stream: &mut S,
decoding_limits: &DecodingLimits
) -> Result<DataChangeFilter, StatusCode>where
S: Read,
BadDecodingError as soon as possible. Read morefn to_vec(&self) -> Vec<u8, Global> ⓘ
source§impl Clone for DataChangeFilter
impl Clone for DataChangeFilter
source§fn clone(&self) -> DataChangeFilter
fn clone(&self) -> DataChangeFilter
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more