1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
use super::{UInt32};
pub const WRITE_MASK_ACCESS_LEVEL: UInt32 = 1 << 0;
pub const WRITE_MASK_ARRAY_DIMENSTIONS: UInt32 = 1 << 1;
pub const WRITE_MASK_BROWSE_NAME: UInt32 = 1 << 2;
pub const WRITE_MASK_CONTAINS_NO_LOOPS: UInt32 = 1 << 3;
pub const WRITE_MASK_DATA_TYPE: UInt32 = 1 << 4;
pub const WRITE_MASK_DESCRIPTION: UInt32 = 1 << 5;
pub const WRITE_MASK_DISPLAY_NAME: UInt32 = 1 << 6;
pub const WRITE_MASK_EVENT_NOTIFIER: UInt32 = 1 << 7;
pub const WRITE_MASK_EXECUTABLE: UInt32 = 1 << 8;
pub const WRITE_MASK_HISTORIZING: UInt32 = 1 << 9;
pub const WRITE_MASK_INVERSE_NAME: UInt32 = 1 << 10;
pub const WRITE_MASK_IS_ABSTRACT: UInt32 = 1 << 11;
pub const WRITE_MASK_MINIMUM_SAMPLING_INTERVAL: UInt32 = 1 << 12;
pub const WRITE_MASK_NODE_CLASS: UInt32 = 1 << 13;
pub const WRITE_MASK_NODE_ID: UInt32 = 1 << 14;
pub const WRITE_MASK_SYMMETRIC: UInt32 = 1 << 15;
pub const WRITE_MASK_USER_ACCESS_LEVEL: UInt32 = 1 << 16;
pub const WRITE_MASK_USER_EXECUTABLE: UInt32 = 1 << 17;
pub const WRITE_MASK_USER_WRITE_MASK: UInt32 = 1 << 18;
pub const WRITE_MASK_VALUE_RANK: UInt32 = 1 << 19;
pub const WRITE_MASK_WRITE_MASK: UInt32 = 1 << 20;
pub const WRITE_MASK_VALUE_FOR_VARIABLE_TYPE: UInt32 = 1 << 21;
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum AttributeId {
NodeId = 1,
NodeClass = 2,
BrowseName = 3,
DisplayName = 4,
Description = 5,
WriteMask = 6,
UserWriteMask = 7,
IsAbstract = 8,
Symmetric = 9,
InverseName = 10,
ContainsNoLoops = 11,
EventNotifier = 12,
Value = 13,
DataType = 14,
ValueRank = 15,
ArrayDimensions = 16,
AccessLevel = 17,
UserAccessLevel = 18,
MinimumSamplingInterval = 19,
Historizing = 20,
Executable = 21,
UserExecutable = 22,
}
impl AttributeId {
pub fn from_u32(attribute_id: UInt32) -> Result<AttributeId, ()> {
let attribute_id = match attribute_id {
1 => AttributeId::NodeId,
2 => AttributeId::NodeClass,
3 => AttributeId::BrowseName,
4 => AttributeId::DisplayName,
5 => AttributeId::Description,
6 => AttributeId::WriteMask,
7 => AttributeId::UserWriteMask,
8 => AttributeId::IsAbstract,
9 => AttributeId::Symmetric,
10 => AttributeId::InverseName,
11 => AttributeId::ContainsNoLoops,
12 => AttributeId::EventNotifier,
13 => AttributeId::Value,
14 => AttributeId::DataType,
15 => AttributeId::ValueRank,
16 => AttributeId::ArrayDimensions,
17 => AttributeId::AccessLevel,
18 => AttributeId::UserAccessLevel,
19 => AttributeId::MinimumSamplingInterval,
20 => AttributeId::Historizing,
21 => AttributeId::Executable,
22 => AttributeId::UserExecutable,
_ => {
debug!("Invalid attribute id {}", attribute_id);
return Err(());
}
};
Ok(attribute_id)
}
}