opcua_types/service_types/
read_value_id.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    node_id::NodeId,
17    string::UAString,
18    qualified_name::QualifiedName,
19};
20
21#[derive(Debug, Clone, PartialEq, Serialize)]
22pub struct ReadValueId {
23    pub node_id: NodeId,
24    pub attribute_id: u32,
25    pub index_range: UAString,
26    pub data_encoding: QualifiedName,
27}
28
29impl MessageInfo for ReadValueId {
30    fn object_id(&self) -> ObjectId {
31        ObjectId::ReadValueId_Encoding_DefaultBinary
32    }
33}
34
35impl BinaryEncoder<ReadValueId> for ReadValueId {
36    fn byte_len(&self) -> usize {
37        let mut size = 0;
38        size += self.node_id.byte_len();
39        size += self.attribute_id.byte_len();
40        size += self.index_range.byte_len();
41        size += self.data_encoding.byte_len();
42        size
43    }
44
45    #[allow(unused_variables)]
46    fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize> {
47        let mut size = 0;
48        size += self.node_id.encode(stream)?;
49        size += self.attribute_id.encode(stream)?;
50        size += self.index_range.encode(stream)?;
51        size += self.data_encoding.encode(stream)?;
52        Ok(size)
53    }
54
55    #[allow(unused_variables)]
56    fn decode<S: Read>(stream: &mut S, decoding_options: &DecodingOptions) -> EncodingResult<Self> {
57        let node_id = NodeId::decode(stream, decoding_options)?;
58        let attribute_id = u32::decode(stream, decoding_options)?;
59        let index_range = UAString::decode(stream, decoding_options)?;
60        let data_encoding = QualifiedName::decode(stream, decoding_options)?;
61        Ok(ReadValueId {
62            node_id,
63            attribute_id,
64            index_range,
65            data_encoding,
66        })
67    }
68}