opcua_types/service_types/
history_read_request.rs

1// OPCUA for Rust
2// SPDX-License-Identifier: MPL-2.0
3// Copyright (C) 2017-2022 Adam Lock
4//
5// This file was autogenerated from Opc.Ua.Types.bsd by tools/schema/gen_types.js
6//
7// DO NOT EDIT THIS FILE
8#![allow(unused_attributes)]
9use std::io::{Read, Write};
10#[allow(unused_imports)]
11use crate::{
12    encoding::*,
13    basic_types::*,
14    service_types::impls::MessageInfo,
15    node_ids::ObjectId,
16    request_header::RequestHeader,
17    extension_object::ExtensionObject,
18    service_types::enums::TimestampsToReturn,
19    service_types::HistoryReadValueId,
20};
21
22#[derive(Debug, Clone, PartialEq)]
23pub struct HistoryReadRequest {
24    pub request_header: RequestHeader,
25    pub history_read_details: ExtensionObject,
26    pub timestamps_to_return: TimestampsToReturn,
27    pub release_continuation_points: bool,
28    pub nodes_to_read: Option<Vec<HistoryReadValueId>>,
29}
30
31impl MessageInfo for HistoryReadRequest {
32    fn object_id(&self) -> ObjectId {
33        ObjectId::HistoryReadRequest_Encoding_DefaultBinary
34    }
35}
36
37impl BinaryEncoder<HistoryReadRequest> for HistoryReadRequest {
38    fn byte_len(&self) -> usize {
39        let mut size = 0;
40        size += self.request_header.byte_len();
41        size += self.history_read_details.byte_len();
42        size += self.timestamps_to_return.byte_len();
43        size += self.release_continuation_points.byte_len();
44        size += byte_len_array(&self.nodes_to_read);
45        size
46    }
47
48    #[allow(unused_variables)]
49    fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize> {
50        let mut size = 0;
51        size += self.request_header.encode(stream)?;
52        size += self.history_read_details.encode(stream)?;
53        size += self.timestamps_to_return.encode(stream)?;
54        size += self.release_continuation_points.encode(stream)?;
55        size += write_array(stream, &self.nodes_to_read)?;
56        Ok(size)
57    }
58
59    #[allow(unused_variables)]
60    fn decode<S: Read>(stream: &mut S, decoding_options: &DecodingOptions) -> EncodingResult<Self> {
61        let request_header = RequestHeader::decode(stream, decoding_options)?;
62        let history_read_details = ExtensionObject::decode(stream, decoding_options)?;
63        let timestamps_to_return = TimestampsToReturn::decode(stream, decoding_options)?;
64        let release_continuation_points = bool::decode(stream, decoding_options)?;
65        let nodes_to_read: Option<Vec<HistoryReadValueId>> = read_array(stream, decoding_options)?;
66        Ok(HistoryReadRequest {
67            request_header,
68            history_read_details,
69            timestamps_to_return,
70            release_continuation_points,
71            nodes_to_read,
72        })
73    }
74}