pub struct DataValue {
pub value: Option<Variant>,
pub status: Option<StatusCode>,
pub source_timestamp: Option<DateTime>,
pub source_picoseconds: Option<u16>,
pub server_timestamp: Option<DateTime>,
pub server_picoseconds: Option<u16>,
}Expand description
A data value is a value of a variable in the OPC UA server and contains information about its value, status and change timestamps.
Fields§
§value: Option<Variant>The value. BaseDataType Not present if the Value bit in the EncodingMask is False.
status: Option<StatusCode>The status associated with the value. Not present if the StatusCode bit in the EncodingMask is False
source_timestamp: Option<DateTime>The source timestamp associated with the value. Not present if the SourceTimestamp bit in the EncodingMask is False.
source_picoseconds: Option<u16>The number of 10 picosecond intervals for the SourceTimestamp. Not present if the SourcePicoSeconds bit in the EncodingMask is False. If the source timestamp is missing the picoseconds are ignored.
server_timestamp: Option<DateTime>The Server timestamp associated with the value. Not present if the ServerTimestamp bit in the EncodingMask is False.
server_picoseconds: Option<u16>The number of 10 picosecond intervals for the ServerTimestamp. Not present if the ServerPicoSeconds bit in the EncodingMask is False. If the Server timestamp is missing the picoseconds are ignored.
Implementations§
Source§impl DataValue
impl DataValue
Sourcepub fn value_only<V>(value: V) -> DataValue
pub fn value_only<V>(value: V) -> DataValue
Creates a DataValue from the supplied value with nothing else.
Sourcepub fn new_now<V>(value: V) -> DataValue
pub fn new_now<V>(value: V) -> DataValue
Creates a DataValue from the supplied value AND a timestamp for now. If you are passing a value to the Attribute::Write service
on a server from a server, you may consider this from the specification:
If the SourceTimestamp or the ServerTimestamp is specified, the Server shall use these values. The Server returns a Bad_WriteNotSupported error if it does not support writing of timestamps
In which case, use the value_only() constructor, or make explicit which fields you pass.
Sourcepub fn new_at<V>(value: V, time: DateTime) -> DataValue
pub fn new_at<V>(value: V, time: DateTime) -> DataValue
Creates a DataValue from the supplied value and timestamp. If you are passing a value to the Attribute::Write service
on a server from a server, you may consider this from the specification:
If the SourceTimestamp or the ServerTimestamp is specified, the Server shall use these values. The Server returns a Bad_WriteNotSupported error if it does not support writing of timestamps
In which case, use the value_only() constructor, or make explicit which fields you pass.
Sourcepub fn new_now_status<V>(value: V, status: StatusCode) -> DataValue
pub fn new_now_status<V>(value: V, status: StatusCode) -> DataValue
Creates a DataValue from the supplied value AND a timestamp for now. If you are passing a value to the Attribute::Write service
on a server from a server, you may consider this from the specification:
If the SourceTimestamp or the ServerTimestamp is specified, the Server shall use these values. The Server returns a Bad_WriteNotSupported error if it does not support writing of timestamps
In which case, use the value_only() constructor, or make explicit which fields you pass.
Sourcepub fn new_at_status<V>(
value: V,
time: DateTime,
status: StatusCode,
) -> DataValue
pub fn new_at_status<V>( value: V, time: DateTime, status: StatusCode, ) -> DataValue
Creates a DataValue from the supplied value and timestamp. If you are passing a value to the Attribute::Write service
on a server from a server, you may consider this from the specification:
If the SourceTimestamp or the ServerTimestamp is specified, the Server shall use these values. The Server returns a Bad_WriteNotSupported error if it does not support writing of timestamps
In which case, use the value_only() constructor, or make explicit which fields you pass.
Sourcepub fn set_value<V>(
&mut self,
value: V,
source_timestamp: &DateTime,
server_timestamp: &DateTime,
)
pub fn set_value<V>( &mut self, value: V, source_timestamp: &DateTime, server_timestamp: &DateTime, )
Sets the value of the data value, updating the timestamps at the same point
Sourcepub fn set_timestamps(
&mut self,
timestamps_to_return: TimestampsToReturn,
source_timestamp: DateTime,
server_timestamp: DateTime,
)
pub fn set_timestamps( &mut self, timestamps_to_return: TimestampsToReturn, source_timestamp: DateTime, server_timestamp: DateTime, )
Sets the timestamps of the data value based on supplied timestamps to return
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Returns the status code or Good if there is no code on the value
Trait Implementations§
Source§impl BinaryDecodable for DataValue
impl BinaryDecodable for DataValue
Source§fn decode<S: Read + ?Sized>(
stream: &mut S,
ctx: &Context<'_>,
) -> EncodingResult<Self>
fn decode<S: Read + ?Sized>( stream: &mut S, ctx: &Context<'_>, ) -> EncodingResult<Self>
BadDecodingError as soon as possible.Source§impl BinaryEncodable for DataValue
impl BinaryEncodable for DataValue
Source§fn byte_len(&self, ctx: &Context<'_>) -> usize
fn byte_len(&self, ctx: &Context<'_>) -> usize
encode were called.
This may be called prior to writing to ensure the correct amount of space is available.