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