opcua 0.20 → 0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -1
- data/cert/cert.h +52 -52
- data/cert/cert_key.h +99 -99
- data/example/server_values_callback.rb +43 -0
- data/ext/opcua/helpers/values.c +8 -6
- data/ext/opcua/server/server.c +108 -20
- data/lib/opcua/server.rb +16 -4
- data/opcua.gemspec +2 -2
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f86b954296eb2837114b76e0a32dc36cabfa922dfa30bdfc9b79e188fff0777e
|
4
|
+
data.tar.gz: c504ae5111b2422237dd7890f68739555338b46363b3158dc84b6e91f6052d2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a559fc42fa3809c643eb0d62ac5a345418118da336d38a6867fd3dbe7550eea5d33d32a1ded00cc2c08bee62fe17ccaca8ad1c500c800930f18bc208b0e94229
|
7
|
+
data.tar.gz: a23f8d80d7075ddbdca95f6f8fbd93e0f51e0a26136720a295073cf45e02cbf1adef2d205fcb131cd1de4ba02ea2db7446762c4c2ca1a66463354b87df7cfbdd
|
data/README.md
CHANGED
@@ -122,11 +122,24 @@ Multible variables can be defined at once with the ```.add_variables``` command.
|
|
122
122
|
t.add_variables :TestVar1, :TestVar2
|
123
123
|
```
|
124
124
|
By default variables are read-only.
|
125
|
-
If you want to add a variable with read/write support you must use the ```.
|
125
|
+
If you want to add a variable with read/write support you must use the ```.add_variable_rw``` method.
|
126
126
|
```ruby
|
127
127
|
t.add_variable_rw :TestVar1
|
128
128
|
```
|
129
129
|
|
130
|
+
It is also possible to add a block to the variable. The block is called
|
131
|
+
whenever the variable is changed. Each block gets three parameters passed:
|
132
|
+
nodeid, new value, and if the value has been changed through a client (true) or
|
133
|
+
internally in the server (false).
|
134
|
+
|
135
|
+
```ruby
|
136
|
+
t.add_variable_rw :Value do |node,value,external|
|
137
|
+
p node.id # ObjectVarNode object, which has properties such as #id, #value
|
138
|
+
p value # new content of the variable
|
139
|
+
p external # true || false
|
140
|
+
end
|
141
|
+
```
|
142
|
+
|
130
143
|
##### Add Object
|
131
144
|
|
132
145
|
With ```.add_object(:TestObject)``` a new object named _TestObject_ is added. The second parameter is optional and definies of which type the new object is. Default the object is from _BaseObjectType_. In this example the created object is from _FolderType_. All child nodes of the object can be definded in the ```tap{}``` area.
|
data/cert/cert.h
CHANGED
@@ -1,70 +1,70 @@
|
|
1
1
|
unsigned char cert_der[] = {
|
2
2
|
0x30, 0x82, 0x03, 0x18, 0x30, 0x82, 0x02, 0x00, 0xa0, 0x03, 0x02, 0x01,
|
3
|
-
0x02, 0x02, 0x14,
|
4
|
-
|
3
|
+
0x02, 0x02, 0x14, 0x11, 0x2f, 0x7b, 0xb4, 0x32, 0x5f, 0x6d, 0xe3, 0x4f,
|
4
|
+
0x2c, 0x3a, 0x98, 0xb9, 0x10, 0xb5, 0x3a, 0x2b, 0xfa, 0xc1, 0x30, 0x30,
|
5
5
|
0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b,
|
6
6
|
0x05, 0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04,
|
7
7
|
0x03, 0x0c, 0x0a, 0x72, 0x75, 0x62, 0x79, 0x2d, 0x6f, 0x70, 0x63, 0x75,
|
8
|
-
0x61, 0x30, 0x1e, 0x17, 0x0d, 0x32,
|
9
|
-
|
10
|
-
|
8
|
+
0x61, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x31, 0x32, 0x37, 0x31,
|
9
|
+
0x36, 0x30, 0x30, 0x32, 0x39, 0x5a, 0x17, 0x0d, 0x32, 0x32, 0x30, 0x31,
|
10
|
+
0x31, 0x37, 0x31, 0x36, 0x30, 0x30, 0x32, 0x39, 0x5a, 0x30, 0x15, 0x31,
|
11
11
|
0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0a, 0x72, 0x75,
|
12
12
|
0x62, 0x79, 0x2d, 0x6f, 0x70, 0x63, 0x75, 0x61, 0x30, 0x82, 0x01, 0x22,
|
13
13
|
0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
|
14
14
|
0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a,
|
15
|
-
0x02, 0x82, 0x01, 0x01, 0x00,
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
15
|
+
0x02, 0x82, 0x01, 0x01, 0x00, 0xb0, 0xb5, 0x71, 0x62, 0xfe, 0x5b, 0xb7,
|
16
|
+
0xc2, 0xbc, 0x0e, 0x37, 0xf4, 0xa3, 0x73, 0x29, 0x2e, 0x6e, 0x19, 0x53,
|
17
|
+
0x60, 0xeb, 0xfe, 0x18, 0x78, 0xda, 0xf6, 0xbd, 0xc2, 0x2c, 0xdf, 0x1e,
|
18
|
+
0x45, 0x08, 0xef, 0x98, 0xe8, 0x14, 0x43, 0xb2, 0x82, 0x48, 0xa8, 0x85,
|
19
|
+
0xc1, 0x96, 0x19, 0x6c, 0x15, 0xee, 0x76, 0x4f, 0x7b, 0xe7, 0xcd, 0x49,
|
20
|
+
0x57, 0x8d, 0xb8, 0xde, 0x3b, 0xe6, 0xb2, 0x4b, 0xea, 0x88, 0xd8, 0x5d,
|
21
|
+
0x4f, 0x55, 0x97, 0x00, 0x22, 0x4f, 0xcf, 0x05, 0x84, 0xfe, 0x00, 0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b, 0x09, 0xa1,
|
36
|
+
0xa6, 0xf4, 0x2c, 0xec, 0x4f, 0xdf, 0xf1, 0xf4, 0x83, 0x02, 0x03, 0x01,
|
37
37
|
0x00, 0x01, 0xa3, 0x60, 0x30, 0x5e, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d,
|
38
|
-
0x0e, 0x04, 0x16, 0x04, 0x14,
|
39
|
-
|
40
|
-
|
38
|
+
0x0e, 0x04, 0x16, 0x04, 0x14, 0x94, 0x96, 0x95, 0x63, 0xe7, 0xf5, 0x26,
|
39
|
+
0x38, 0x3e, 0xdf, 0x99, 0xec, 0x11, 0x08, 0xaf, 0x91, 0xde, 0xc6, 0x01,
|
40
|
+
0x44, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04,
|
41
41
|
0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x1d,
|
42
42
|
0x11, 0x04, 0x15, 0x30, 0x13, 0x86, 0x11, 0x72, 0x75, 0x62, 0x79, 0x2d,
|
43
43
|
0x6f, 0x70, 0x63, 0x75, 0x61, 0x3a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74,
|
44
44
|
0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04,
|
45
45
|
0x03, 0x02, 0x05, 0xa0, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
|
46
46
|
0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00,
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
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 0x4e, 0x35, 0x22,
|
61
|
+
0x64, 0x97, 0x75, 0xe6, 0x32, 0x70, 0xf0, 0x32, 0xc3, 0x7c, 0x02, 0x5b,
|
62
|
+
0x6e, 0x82, 0x89, 0xa3, 0xd1, 0x33, 0x69, 0x0f, 0xf8, 0x1a, 0x3e, 0x35,
|
63
|
+
0x35, 0x0e, 0xe0, 0x54, 0x0f, 0x49, 0x00, 0xdc, 0x57, 0x89, 0x7b, 0x8b,
|
64
|
+
0x1c, 0x3b, 0xcc, 0x18, 0x81, 0x39, 0xfc, 0x80, 0x61, 0xc9, 0xc7, 0xd6,
|
65
|
+
0x9e, 0x5b, 0xfe, 0x54, 0x3b, 0x15, 0x9e, 0x9c, 0x8e, 0xe4, 0xb1, 0x77,
|
66
|
+
0x7a, 0x81, 0xfd, 0xc0, 0x75, 0x3b, 0xd9, 0xb3, 0x98, 0x4c, 0xa4, 0x53,
|
67
|
+
0xd0, 0xc3, 0xa8, 0x70, 0x95, 0x86, 0x1e, 0xc4, 0x77, 0xa4, 0x2f, 0x13,
|
68
|
+
0xe6, 0x36, 0x51, 0x1a
|
69
69
|
};
|
70
70
|
unsigned int cert_der_len = 796;
|
data/cert/cert_key.h
CHANGED
@@ -1,103 +1,103 @@
|
|
1
1
|
unsigned char cert_key_der[] = {
|
2
2
|
0x30, 0x82, 0x04, 0xa3, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00,
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
0x00,
|
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
|
-
|
3
|
+
0xb0, 0xb5, 0x71, 0x62, 0xfe, 0x5b, 0xb7, 0xc2, 0xbc, 0x0e, 0x37, 0xf4,
|
4
|
+
0xa3, 0x73, 0x29, 0x2e, 0x6e, 0x19, 0x53, 0x60, 0xeb, 0xfe, 0x18, 0x78,
|
5
|
+
0xda, 0xf6, 0xbd, 0xc2, 0x2c, 0xdf, 0x1e, 0x45, 0x08, 0xef, 0x98, 0xe8,
|
6
|
+
0x14, 0x43, 0xb2, 0x82, 0x48, 0xa8, 0x85, 0xc1, 0x96, 0x19, 0x6c, 0x15,
|
7
|
+
0xee, 0x76, 0x4f, 0x7b, 0xe7, 0xcd, 0x49, 0x57, 0x8d, 0xb8, 0xde, 0x3b,
|
8
|
+
0xe6, 0xb2, 0x4b, 0xea, 0x88, 0xd8, 0x5d, 0x4f, 0x55, 0x97, 0x00, 0x22,
|
9
|
+
0x4f, 0xcf, 0x05, 0x84, 0xfe, 0x00, 0x25, 0x3c, 0xeb, 0x74, 0x99, 0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 0x15, 0xd2,
|
93
|
+
0xd9, 0x45, 0x37, 0xbb, 0xf3, 0x2c, 0xa3, 0xce, 0xad, 0x88, 0xdc, 0x5d,
|
94
|
+
0xae, 0x08, 0x00, 0xf3, 0x3a, 0xdd, 0xa7, 0x8f, 0xe6, 0xd8, 0x7e, 0xf8,
|
95
|
+
0x73, 0xe1, 0x2e, 0x92, 0x40, 0xdd, 0xdc, 0x6d, 0xdd, 0xe3, 0x1c, 0x31,
|
96
|
+
0xbf, 0x7e, 0x9e, 0x8d, 0xb2, 0xf5, 0xb4, 0x85, 0x45, 0xf5, 0x9f, 0xd1,
|
97
|
+
0x7b, 0x16, 0x7e, 0x15, 0x5b, 0x31, 0xbf, 0x4b, 0x62, 0xda, 0x33, 0x4d,
|
98
|
+
0xc7, 0x9d, 0x07, 0xd5, 0x48, 0xdf, 0x22, 0x91, 0xc1, 0xdc, 0xfb, 0x1f,
|
99
|
+
0x4a, 0x03, 0x10, 0x5f, 0x80, 0x2e, 0x2c, 0x91, 0x75, 0x52, 0x84, 0xd8,
|
100
|
+
0x3c, 0x10, 0x21, 0xf7, 0x13, 0x62, 0xfa, 0x87, 0x9e, 0x9c, 0x9d, 0xa5,
|
101
|
+
0xfd, 0xf2, 0xc2
|
102
102
|
};
|
103
103
|
unsigned int cert_key_der_len = 1191;
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
require_relative '../lib/opcua/server'
|
3
|
+
#require 'opcua/server'
|
4
|
+
|
5
|
+
Daemonite.new do
|
6
|
+
on startup do |opts|
|
7
|
+
opts['server'] = OPCUA::Server.new
|
8
|
+
opts['server'].add_namespace "https://centurio.work/kelch"
|
9
|
+
|
10
|
+
t = opts['server'].types.add_object_type(:Test).tap{ |u|
|
11
|
+
u.add_object(:Measurements, opts['server'].types.folder).tap{ |v|
|
12
|
+
v.add_object(:BitRegister, opts['server'].types.folder).tap{ |w|
|
13
|
+
w.add_variable_rw :Wert do |node,value,external|
|
14
|
+
if external
|
15
|
+
p node.id
|
16
|
+
p value
|
17
|
+
end
|
18
|
+
end
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
v = opts['server'].objects.manifest(:Tester, t)
|
24
|
+
|
25
|
+
opts['mm'] = v.find :Measurements
|
26
|
+
opts['br'] = opts['mm'].find :BitRegister
|
27
|
+
opts['value'] = opts['br'].find :Wert
|
28
|
+
rescue => e
|
29
|
+
puts e.message
|
30
|
+
end
|
31
|
+
|
32
|
+
run do |opts|
|
33
|
+
opts['server'].run
|
34
|
+
opts['value'].value = rand
|
35
|
+
rescue => e
|
36
|
+
puts e.message
|
37
|
+
end
|
38
|
+
|
39
|
+
on exit do
|
40
|
+
# we could disconnect here, but OPCUA::Server does not have an explicit disconnect
|
41
|
+
puts 'bye.'
|
42
|
+
end
|
43
|
+
end.loop!
|
data/ext/opcua/helpers/values.c
CHANGED
@@ -154,15 +154,15 @@ bool value_to_variant(VALUE value, UA_Variant *variant, UA_UInt32 proposal) { //
|
|
154
154
|
case T_SYMBOL:
|
155
155
|
{
|
156
156
|
VALUE str = rb_obj_as_string(value);
|
157
|
-
if (proposal ==
|
158
|
-
|
159
|
-
UA_Variant_setScalarCopy(variant, &tmp, &UA_TYPES[
|
157
|
+
if (proposal == UA_TYPES_BYTESTRING) {
|
158
|
+
UA_ByteString tmp = UA_BYTESTRING(StringValuePtr(str));
|
159
|
+
UA_Variant_setScalarCopy(variant, &tmp, &UA_TYPES[UA_TYPES_BYTESTRING]);
|
160
160
|
} else if (proposal == UA_TYPES_NODEID) {
|
161
161
|
UA_NodeId tmp = UA_NODEID(StringValuePtr(str));
|
162
162
|
UA_Variant_setScalarCopy(variant, &tmp, &UA_TYPES[UA_TYPES_NODEID]);
|
163
|
-
} else
|
164
|
-
|
165
|
-
UA_Variant_setScalarCopy(variant, &tmp, &UA_TYPES[
|
163
|
+
} else {
|
164
|
+
UA_String tmp = UA_STRING(StringValuePtr(str));
|
165
|
+
UA_Variant_setScalarCopy(variant, &tmp, &UA_TYPES[UA_TYPES_STRING]);
|
166
166
|
}
|
167
167
|
done = true;
|
168
168
|
break;
|
@@ -190,6 +190,8 @@ void Init_types(VALUE mOPCUA) {/*{{{*/
|
|
190
190
|
rb_define_const(mTYPES, "UINT32", INT2NUM(UA_TYPES_UINT32 ));
|
191
191
|
rb_define_const(mTYPES, "UINT16", INT2NUM(UA_TYPES_UINT16 ));
|
192
192
|
rb_define_const(mTYPES, "STRING", INT2NUM(UA_TYPES_STRING ));
|
193
|
+
rb_define_const(mTYPES, "BYTESTRING", INT2NUM(UA_TYPES_BYTESTRING ));
|
194
|
+
rb_define_const(mTYPES, "NODEID", INT2NUM(UA_TYPES_NODEID ));
|
193
195
|
}/*}}}*/
|
194
196
|
|
195
197
|
static VALUE UA_TYPES_DATETIME_to_value(UA_DateTime data) { //{{{
|
data/ext/opcua/server/server.c
CHANGED
@@ -335,11 +335,56 @@ static VALUE node_add_method(int argc, VALUE* argv, VALUE self) { //{{{
|
|
335
335
|
return node_wrap(CLASS_OF(self),node_alloc(parent->master,node_add_method_ua_simple(nstr,parent,opts,blk)));
|
336
336
|
} //}}}
|
337
337
|
|
338
|
-
static
|
338
|
+
static void node_add_variable_callback( //{{{
|
339
|
+
UA_Server *server,
|
340
|
+
const UA_NodeId *sessionId, void *sessionContext,
|
341
|
+
const UA_NodeId *nodeId, void *nodeContext,
|
342
|
+
const UA_NumericRange *range, const UA_DataValue *data
|
343
|
+
) {
|
344
|
+
node_struct *me = (node_struct *)nodeContext;
|
345
|
+
UA_Guid internal = UA_GUID("00000001-0000-0000-0000-000000000000");
|
346
|
+
|
347
|
+
// if (sessionId->identifierType == UA_NODEIDTYPE_NUMERIC) {
|
348
|
+
// printf("sessionId ns=%d;i=%d\n", sessionId->namespaceIndex, sessionId->identifier.numeric);
|
349
|
+
// } else if(sessionId->identifierType == UA_NODEIDTYPE_STRING) {
|
350
|
+
// printf("sessionId ns=%d;s=%.*s\n", sessionId->namespaceIndex, (int)sessionId->identifier.string.length, sessionId->identifier.string.data);
|
351
|
+
// } else if(sessionId->identifierType == UA_NODEIDTYPE_GUID) {
|
352
|
+
// if (UA_Guid_equal(&(sessionId->identifier.guid),&internal)) {
|
353
|
+
// printf("sessionId internal session\n");
|
354
|
+
// } else {
|
355
|
+
// printf("sessionId ns=%d;g=%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",sessionId->namespaceIndex,UA_PRINTF_GUID_DATA(sessionId->identifier.guid));
|
356
|
+
// }
|
357
|
+
// } else if(sessionId->identifierType == UA_NODEIDTYPE_BYTESTRING) {
|
358
|
+
// printf("sessionId ns=%d;b=%.*s\n", sessionId->namespaceIndex, (int)sessionId->identifier.string.length, sessionId->identifier.string.data);
|
359
|
+
// } else if(UA_NodeId_isNull(sessionId)) {
|
360
|
+
// printf("sessionId is null");
|
361
|
+
// } else {
|
362
|
+
// printf("sessionId ns=%d;unsupported\n",sessionId->namespaceIndex);
|
363
|
+
// }
|
364
|
+
|
365
|
+
VALUE args = rb_ary_new();
|
366
|
+
rb_ary_push(args, Data_Wrap_Struct(cVarNode,NULL,NULL,me));
|
367
|
+
VALUE para = extract_value(data->value);
|
368
|
+
rb_ary_push(args,rb_ary_entry(para,0));
|
369
|
+
if (UA_Guid_equal(&(sessionId->identifier.guid),&internal)) {
|
370
|
+
rb_ary_push(args,Qfalse);
|
371
|
+
} else {
|
372
|
+
rb_ary_push(args,Qtrue);
|
373
|
+
}
|
374
|
+
if (me->method != Qnil) {
|
375
|
+
rb_proc_call(me->method,args);
|
376
|
+
}
|
377
|
+
} //}}}
|
378
|
+
static UA_NodeId node_add_variable_ua(UA_Int32 type, UA_NodeId n, UA_LocalizedText dn, UA_QualifiedName qn, node_struct *parent, UA_Byte accesslevelmask, VALUE blk) { //{{{
|
339
379
|
UA_VariableAttributes vAttr = UA_VariableAttributes_default;
|
340
380
|
vAttr.displayName = dn;
|
341
381
|
vAttr.accessLevel = accesslevelmask;
|
342
382
|
|
383
|
+
node_struct *me = node_alloc(parent->master,n);
|
384
|
+
me->method = blk;
|
385
|
+
rb_gc_register_address(&blk);
|
386
|
+
rb_gc_register_address(&me->method);
|
387
|
+
|
343
388
|
UA_Server_addVariableNode(parent->master->master,
|
344
389
|
n,
|
345
390
|
parent->id,
|
@@ -347,9 +392,13 @@ static UA_NodeId node_add_variable_ua(UA_Int32 type, UA_NodeId n, UA_LocalizedTe
|
|
347
392
|
qn,
|
348
393
|
UA_NODEID_NUMERIC(0, type),
|
349
394
|
vAttr,
|
350
|
-
|
395
|
+
(void *)me,
|
351
396
|
NULL);
|
352
397
|
|
398
|
+
UA_ValueCallback callback ;
|
399
|
+
callback.onWrite = node_add_variable_callback;
|
400
|
+
UA_Server_setVariableNode_valueCallback(parent->master->master, n, callback);
|
401
|
+
|
353
402
|
UA_Server_addReference(parent->master->master,
|
354
403
|
n,
|
355
404
|
UA_NODEID_NUMERIC(0, UA_NS0ID_HASMODELLINGRULE),
|
@@ -357,15 +406,28 @@ static UA_NodeId node_add_variable_ua(UA_Int32 type, UA_NodeId n, UA_LocalizedTe
|
|
357
406
|
true);
|
358
407
|
|
359
408
|
return n;
|
360
|
-
}
|
361
|
-
static UA_NodeId node_add_variable_ua_simple(UA_Int32 type,
|
409
|
+
} //}}}
|
410
|
+
static UA_NodeId node_add_variable_ua_simple(UA_Int32 type, VALUE str, node_struct *parent, UA_Byte accesslevelmask, bool numeric, VALUE blk) { //{{{
|
411
|
+
int nodeid = nodecounter++;
|
412
|
+
char *nstr = (char *)StringValuePtr(str);
|
413
|
+
|
414
|
+
UA_NodeId n;
|
415
|
+
if (numeric) {
|
416
|
+
n = UA_NODEID_NUMERIC(parent->master->default_ns,nodeid);
|
417
|
+
rb_hash_aset(parent->master->methods,INT2NUM(nodeid),blk);
|
418
|
+
} else {
|
419
|
+
n = UA_NODEID_STRING(parent->master->default_ns,nstr);
|
420
|
+
rb_hash_aset(parent->master->methods,str,blk);
|
421
|
+
}
|
422
|
+
rb_gc_register_address(&blk);
|
362
423
|
return node_add_variable_ua(
|
363
424
|
type,
|
364
|
-
|
425
|
+
n,
|
365
426
|
UA_LOCALIZEDTEXT("en-US", nstr),
|
366
427
|
UA_QUALIFIEDNAME(parent->master->default_ns, nstr),
|
367
428
|
parent,
|
368
|
-
accesslevelmask
|
429
|
+
accesslevelmask,
|
430
|
+
blk
|
369
431
|
);
|
370
432
|
} //}}}
|
371
433
|
static VALUE node_add_variable_wrap(int argc, VALUE* argv, VALUE self, UA_Byte accesslevelmask, bool numeric) { //{{{
|
@@ -375,22 +437,28 @@ static VALUE node_add_variable_wrap(int argc, VALUE* argv, VALUE self, UA_Byte a
|
|
375
437
|
rb_raise(rb_eArgError, "wrong number of arguments");
|
376
438
|
}
|
377
439
|
|
440
|
+
Data_Get_Struct(self, node_struct, parent);
|
441
|
+
if (!parent->exists) rb_raise(rb_eRuntimeError, "Node does not exist anymore.");
|
442
|
+
|
443
|
+
VALUE name;
|
444
|
+
VALUE ttype;
|
445
|
+
VALUE blk;
|
446
|
+
rb_gc_register_address(&blk);
|
447
|
+
|
448
|
+
rb_scan_args(argc, argv, "11&", &name, &ttype, &blk);
|
449
|
+
|
378
450
|
UA_UInt32 type;
|
379
|
-
if (
|
380
|
-
type = NUM2INT(argv[1]);
|
381
|
-
} else {
|
451
|
+
if (NIL_P(ttype)) {
|
382
452
|
type = UA_NS0ID_BASEDATAVARIABLETYPE;
|
453
|
+
} else {
|
454
|
+
type = NUM2INT(ttype);
|
383
455
|
}
|
384
456
|
|
385
|
-
|
386
|
-
if (!parent->exists) rb_raise(rb_eRuntimeError, "Node does not exist anymore.");
|
387
|
-
|
388
|
-
VALUE str = rb_obj_as_string(argv[0]);
|
457
|
+
VALUE str = rb_obj_as_string(name);
|
389
458
|
if (NIL_P(str) || TYPE(str) != T_STRING)
|
390
459
|
rb_raise(rb_eTypeError, "cannot convert obj to string");
|
391
|
-
char *nstr = (char *)StringValuePtr(str);
|
392
460
|
|
393
|
-
return node_wrap(cVarNode,node_alloc(parent->master,node_add_variable_ua_simple(type,
|
461
|
+
return node_wrap(cVarNode,node_alloc(parent->master,node_add_variable_ua_simple(type,str,parent,accesslevelmask,numeric,blk)));
|
394
462
|
} //}}}
|
395
463
|
static VALUE node_add_variable(int argc, VALUE* argv, VALUE self) { //{{{
|
396
464
|
return node_add_variable_wrap(argc,argv,self,UA_ACCESSLEVELMASK_READ,true);
|
@@ -449,10 +517,18 @@ static UA_NodeId node_add_object_ua(UA_Int32 type, UA_NodeId n, UA_LocalizedText
|
|
449
517
|
|
450
518
|
return n;
|
451
519
|
} //}}}
|
452
|
-
static UA_NodeId node_add_object_ua_simple(UA_Int32 type, char* nstr, node_struct *parent, node_struct *datatype, VALUE ref) { //{{{
|
520
|
+
static UA_NodeId node_add_object_ua_simple(UA_Int32 type, char* nstr, node_struct *parent, node_struct *datatype, VALUE ref, bool numeric) { //{{{
|
521
|
+
int nodeid = nodecounter++;
|
522
|
+
UA_NodeId n;
|
523
|
+
if (numeric) {
|
524
|
+
n = UA_NODEID_NUMERIC(parent->master->default_ns,nodeid);
|
525
|
+
} else {
|
526
|
+
n = UA_NODEID_STRING(parent->master->default_ns,nstr);
|
527
|
+
}
|
528
|
+
|
453
529
|
return node_add_object_ua(
|
454
530
|
type,
|
455
|
-
|
531
|
+
n,
|
456
532
|
UA_LOCALIZEDTEXT("en-US", nstr),
|
457
533
|
UA_QUALIFIEDNAME(parent->master->default_ns, nstr),
|
458
534
|
parent,
|
@@ -489,7 +565,7 @@ static VALUE node_add_object(int argc, VALUE* argv, VALUE self) { //{{{
|
|
489
565
|
rb_raise(rb_eTypeError, "cannot convert obj to string");
|
490
566
|
char *nstr = (char *)StringValuePtr(str);
|
491
567
|
|
492
|
-
return node_wrap(CLASS_OF(self),node_alloc(parent->master,node_add_object_ua_simple(type,nstr,parent,datatype,argv[2])));
|
568
|
+
return node_wrap(CLASS_OF(self),node_alloc(parent->master,node_add_object_ua_simple(type,nstr,parent,datatype,argv[2],true)));
|
493
569
|
} //}}}
|
494
570
|
|
495
571
|
static UA_StatusCode node_manifest_iter(UA_NodeId child_id, UA_Boolean is_inverse, UA_NodeId reference_type_id, void *handle) { //{{{
|
@@ -564,10 +640,22 @@ static UA_StatusCode node_manifest_iter(UA_NodeId child_id, UA_Boolean is_invers
|
|
564
640
|
UA_BrowsePathResult property = node_browse_path(parent->master->master, child_id, UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION), pqn, false);
|
565
641
|
UA_QualifiedName_clear(&pqn);
|
566
642
|
|
643
|
+
VALUE blk;
|
644
|
+
if (child_id.identifierType == UA_NODEIDTYPE_NUMERIC) {
|
645
|
+
blk = rb_hash_aref(parent->master->methods,INT2NUM(child_id.identifier.numeric));
|
646
|
+
} else if (child_id.identifierType == UA_NODEIDTYPE_STRING) {
|
647
|
+
blk = rb_hash_aref(parent->master->methods,rb_str_new((const char *)child_id.identifier.string.data,child_id.identifier.string.length));
|
648
|
+
} else if (child_id.identifierType == UA_NODEIDTYPE_BYTESTRING) {
|
649
|
+
blk = rb_hash_aref(parent->master->methods,rb_str_new((const char *)child_id.identifier.byteString.data,child_id.identifier.byteString.length));
|
650
|
+
} else {
|
651
|
+
blk = Qnil;
|
652
|
+
}
|
653
|
+
|
654
|
+
|
567
655
|
if (property.statusCode == UA_STATUSCODE_GOOD) {
|
568
|
-
node_add_variable_ua(UA_NS0ID_PROPERTYTYPE,UA_NODEID_STRING(parent->master->default_ns,buffer),dn,qn,newnode,al);
|
656
|
+
node_add_variable_ua(UA_NS0ID_PROPERTYTYPE,UA_NODEID_STRING(parent->master->default_ns,buffer),dn,qn,newnode,al,blk);
|
569
657
|
} else {
|
570
|
-
node_add_variable_ua(UA_NS0ID_BASEDATAVARIABLETYPE,UA_NODEID_STRING(parent->master->default_ns,buffer),dn,qn,newnode,al);
|
658
|
+
node_add_variable_ua(UA_NS0ID_BASEDATAVARIABLETYPE,UA_NODEID_STRING(parent->master->default_ns,buffer),dn,qn,newnode,al,blk);
|
571
659
|
}
|
572
660
|
|
573
661
|
UA_BrowsePathResult_clear(&property);
|
data/lib/opcua/server.rb
CHANGED
@@ -46,11 +46,23 @@ module OPCUA
|
|
46
46
|
def add_property_rw(*item)
|
47
47
|
item.each { |e| add_property_rw e }
|
48
48
|
end
|
49
|
-
def add_variables(*item)
|
50
|
-
item.each
|
49
|
+
def add_variables(*item,&blk)
|
50
|
+
item.each do |e|
|
51
|
+
if blk.nil?
|
52
|
+
add_variable e
|
53
|
+
else
|
54
|
+
add_variable e, &blk
|
55
|
+
end
|
56
|
+
end
|
51
57
|
end
|
52
|
-
def add_variables_rw(*item)
|
53
|
-
item.each
|
58
|
+
def add_variables_rw(*item,&blk)
|
59
|
+
item.each do |e|
|
60
|
+
if blk.nil?
|
61
|
+
add_variable_rw e
|
62
|
+
else
|
63
|
+
add_variable_rw e, &blk
|
64
|
+
end
|
65
|
+
end
|
54
66
|
end
|
55
67
|
end
|
56
68
|
end
|
data/opcua.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "opcua"
|
3
|
-
s.version = "0.
|
3
|
+
s.version = "0.25"
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.license = "LGPL-3.0"
|
6
6
|
s.summary = "Preliminary release of opcua (open62541) ruby bindings. C performance, Ruby elegance, simplicity, and productivity."
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
|
16
16
|
s.required_ruby_version = '>=2.5.0'
|
17
17
|
|
18
|
-
s.authors = ['Juergen eTM Mangler','Florian Pauker']
|
18
|
+
s.authors = ['Juergen eTM Mangler','Florian Pauker','Matthias Ehrendorfer']
|
19
19
|
|
20
20
|
s.email = 'juergen.mangler@gmail.com'
|
21
21
|
s.homepage = 'https://github.com/etm/opcua-smart'
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opcua
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.25'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen eTM Mangler
|
8
8
|
- Florian Pauker
|
9
|
-
|
9
|
+
- Matthias Ehrendorfer
|
10
|
+
autorequire:
|
10
11
|
bindir: tools
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2021-01-27 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: daemonite
|
@@ -84,6 +85,7 @@ files:
|
|
84
85
|
- example/server.rb
|
85
86
|
- example/server_deep.rb
|
86
87
|
- example/server_values.rb
|
88
|
+
- example/server_values_callback.rb
|
87
89
|
- example/server_xml.rb
|
88
90
|
- example/test.rb
|
89
91
|
- ext/opcua/client/client.c
|
@@ -123,7 +125,7 @@ homepage: https://github.com/etm/opcua-smart
|
|
123
125
|
licenses:
|
124
126
|
- LGPL-3.0
|
125
127
|
metadata: {}
|
126
|
-
post_install_message:
|
128
|
+
post_install_message:
|
127
129
|
rdoc_options: []
|
128
130
|
require_paths:
|
129
131
|
- lib
|
@@ -138,8 +140,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
140
|
- !ruby/object:Gem::Version
|
139
141
|
version: '0'
|
140
142
|
requirements: []
|
141
|
-
rubygems_version: 3.1.
|
142
|
-
signing_key:
|
143
|
+
rubygems_version: 3.1.4
|
144
|
+
signing_key:
|
143
145
|
specification_version: 4
|
144
146
|
summary: Preliminary release of opcua (open62541) ruby bindings. C performance, Ruby
|
145
147
|
elegance, simplicity, and productivity.
|