opcua 0.9 → 0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/cert/cert.h +52 -52
- data/cert/cert_key.h +99 -99
- data/example/client_method.rb +14 -0
- data/example/{client.rb → client_subscription.rb} +4 -4
- data/example/server.pid +1 -0
- data/example/server.rb +16 -18
- data/ext/opcua/client/client.c +149 -12
- data/ext/opcua/client/client.h +1 -0
- data/ext/opcua/server/server.c +54 -86
- data/ext/opcua/values.h +56 -0
- data/opcua.gemspec +3 -3
- 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: 46817c5d71e8166b928cac3aec3f42b93403405f3a172d0526d3534f4491abf5
|
|
4
|
+
data.tar.gz: d0e49351d507bcb732812558b739b0f057b0fed106421a5a896f93975c17b37e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b42c035a309213970fe44e4d2ab76a3d2dd7381b5793ed05799cd8c9b23bb8661f63ef5c77e09b375e6694a17b57f74d4e965ddc8fe7944fa05a0f1496a63b8e
|
|
7
|
+
data.tar.gz: e95626a80b28162f523b913c19e97c56d93c1550410a549c11a3d2eeb6f9ad12aea62cb1fa8b803f49dd73d16003d7330850c2990e5ae524481fb72d8ef1390e
|
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, 0x36, 0x5c, 0xe6, 0x95, 0x91, 0x63, 0x22, 0x9c, 0xa8,
|
|
4
|
+
0x68, 0xa1, 0x1e, 0x9c, 0xfe, 0x08, 0x7b, 0x23, 0x8e, 0x4e, 0xa5, 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, 0x31, 0x39, 0x30, 0x35, 0x32,
|
|
9
|
-
|
|
10
|
-
0x31,
|
|
8
|
+
0x61, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x39, 0x30, 0x35, 0x32, 0x38, 0x32,
|
|
9
|
+
0x32, 0x32, 0x36, 0x31, 0x31, 0x5a, 0x17, 0x0d, 0x32, 0x30, 0x30, 0x35,
|
|
10
|
+
0x31, 0x37, 0x32, 0x32, 0x32, 0x36, 0x31, 0x31, 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
|
-
|
|
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, 0xd1, 0x9a, 0xaa, 0x60, 0xbc, 0xc9, 0x22,
|
|
40
|
+
0x60, 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
|
-
|
|
47
|
+
0x4a, 0x01, 0x85, 0xc4, 0x46, 0x48, 0xfe, 0xfc, 0x89, 0x82, 0xf0, 0x35,
|
|
48
|
+
0x3e, 0x5f, 0xce, 0xa8, 0x2c, 0x58, 0x38, 0xe4, 0x83, 0xa7, 0x1d, 0x26,
|
|
49
|
+
0x97, 0x19, 0x95, 0xac, 0xb0, 0xa3, 0x9d, 0xc9, 0x6a, 0xc1, 0x84, 0xa4,
|
|
50
|
+
0xfb, 0xf1, 0x36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fd, 0xd1, 0xb7, 0x45, 0x3f,
|
|
64
|
+
0x9d, 0x39, 0x30, 0x99, 0x2a, 0xfa, 0xef, 0x26, 0xa9, 0x44, 0xf4, 0x00,
|
|
65
|
+
0x7d, 0xfc, 0xf8, 0xbc, 0x27, 0x94, 0x6c, 0x9b, 0x8d, 0x96, 0x4b, 0x4b,
|
|
66
|
+
0xd7, 0x2c, 0xa0, 0xfd, 0x17, 0x4e, 0xe6, 0x77, 0x73, 0x63, 0x43, 0xd9,
|
|
67
|
+
0xca, 0xf7, 0x74, 0x9d, 0x92, 0x54, 0x85, 0x78, 0xfa, 0xdc, 0x85, 0x8b,
|
|
68
|
+
0x8f, 0x84, 0x99, 0x95
|
|
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
|
-
|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a, 0x92, 0x51, 0x66,
|
|
90
|
+
0x53, 0x4e, 0xb1, 0x02, 0x81, 0x81, 0x00, 0xb5, 0xf9, 0x07, 0x67, 0xb1,
|
|
91
|
+
0x2e, 0x3b, 0xfc, 0x83, 0x55, 0x2d, 0x8d, 0x0b, 0xd5, 0x22, 0xe0, 0x09,
|
|
92
|
+
0x9f, 0xa8, 0x60, 0x38, 0xff, 0x08, 0x45, 0x01, 0xe0, 0x1c, 0xee, 0x16,
|
|
93
|
+
0x63, 0x8c, 0x58, 0x2e, 0xfc, 0xd5, 0x8d, 0x6c, 0x81, 0x28, 0x7a, 0xbb,
|
|
94
|
+
0x13, 0x75, 0x91, 0x47, 0x3e, 0x45, 0x7f, 0x6a, 0x99, 0x6f, 0x18, 0x16,
|
|
95
|
+
0x7a, 0xce, 0xdd, 0xb1, 0x43, 0x9d, 0xca, 0xab, 0x65, 0x86, 0x0c, 0x8e,
|
|
96
|
+
0x69, 0xa4, 0xa8, 0xb4, 0x30, 0x12, 0xe5, 0x66, 0xa1, 0xda, 0x27, 0x27,
|
|
97
|
+
0x36, 0xa8, 0x64, 0x0a, 0xd7, 0xf7, 0xc0, 0x6a, 0x5e, 0x6b, 0x0b, 0x6c,
|
|
98
|
+
0x06, 0xbd, 0x83, 0x72, 0x72, 0x5b, 0x1e, 0x74, 0x3f, 0x46, 0x8b, 0x5f,
|
|
99
|
+
0xa2, 0xb3, 0x95, 0x11, 0xc9, 0x12, 0x1a, 0x03, 0xd3, 0x97, 0xd5, 0x04,
|
|
100
|
+
0xd4, 0xd3, 0xa8, 0x21, 0x9d, 0x09, 0x34, 0x98, 0x98, 0x04, 0x79, 0x96,
|
|
101
|
+
0xd7, 0xbe, 0x9d
|
|
102
102
|
};
|
|
103
103
|
unsigned int cert_key_der_len = 1191;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
require_relative '../lib/opcua/client'
|
|
3
|
+
#require 'opcua/client'
|
|
4
|
+
|
|
5
|
+
### username & pass in url (e.g. siemens)
|
|
6
|
+
# client = OPCUA::Client.new("opc.tcp://OpcUaClient:SUNRISE@localhost:4840")
|
|
7
|
+
|
|
8
|
+
client = OPCUA::Client.new("opc.tcp://localhost:4840")
|
|
9
|
+
client.debug = false
|
|
10
|
+
client.default_ns = 2
|
|
11
|
+
|
|
12
|
+
node = client.get '/KalimatC34/Tools/Tool3/testMethod'
|
|
13
|
+
node.call 'abcde', Time.now
|
|
14
|
+
client.disconnect
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/ruby
|
|
2
|
-
|
|
3
|
-
require 'opcua/client'
|
|
2
|
+
require_relative '../lib/opcua/client'
|
|
3
|
+
#require 'opcua/client'
|
|
4
4
|
|
|
5
5
|
### username & pass in url (e.g. siemens)
|
|
6
6
|
# client = OPCUA::Client.new("opc.tcp://OpcUaClient:SUNRISE@localhost:4840")
|
|
@@ -8,12 +8,12 @@ require 'opcua/client'
|
|
|
8
8
|
client = OPCUA::Client.new("opc.tcp://localhost:4840")
|
|
9
9
|
client.subscription_interval = 100 # default 500
|
|
10
10
|
|
|
11
|
-
node = client.get 2,
|
|
11
|
+
node = client.get 2, '/KalimatC34/Tools/Tool1/ToolNumber' # get node from nodeid
|
|
12
12
|
node.on_change do |value,timestamp|
|
|
13
13
|
p value
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
while true
|
|
17
17
|
client.check_subscription
|
|
18
|
-
sleep client.
|
|
18
|
+
sleep client.subscription_interval / 1000
|
|
19
19
|
end
|
data/example/server.pid
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
24202
|
data/example/server.rb
CHANGED
|
@@ -3,62 +3,60 @@ require_relative '../lib/opcua/server'
|
|
|
3
3
|
#require 'opcua/server'
|
|
4
4
|
|
|
5
5
|
Daemonite.new do
|
|
6
|
-
on startup do
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
on startup do |opts|
|
|
7
|
+
opts['server'] = OPCUA::Server.new
|
|
8
|
+
opts['server'].add_namespace "https://centurio.work/kelch"
|
|
9
9
|
|
|
10
|
-
mt =
|
|
10
|
+
mt = opts['server'].types.add_object_type(:MeasurementType).tap{ |t|
|
|
11
11
|
t.add_variable :SollWertX
|
|
12
12
|
t.add_variable :SollWertY
|
|
13
13
|
t.add_variable :SollWertZ
|
|
14
14
|
}
|
|
15
|
-
tt =
|
|
15
|
+
tt = opts['server'].types.add_object_type(:ToolType).tap{ |t|
|
|
16
16
|
t.add_variable :SollWertX
|
|
17
17
|
t.add_variable :SollWertY
|
|
18
18
|
t.add_variable :SollWertZ
|
|
19
19
|
t.add_variable :ToolNumber
|
|
20
20
|
t.add_variable :DuploNumber
|
|
21
21
|
t.add_variable :testValue1
|
|
22
|
-
t.add_method :testMethod, test1: OPCUA::TYPES::STRING, test2: OPCUA::TYPES::DATETIME do |node, test1, test2
|
|
22
|
+
t.add_method :testMethod, test1: OPCUA::TYPES::STRING, test2: OPCUA::TYPES::DATETIME do |node, test1, test2|
|
|
23
23
|
ns, nid = node.id
|
|
24
|
+
puts '-' * 10
|
|
24
25
|
p nid
|
|
25
26
|
p test1
|
|
26
27
|
p test2
|
|
27
|
-
|
|
28
|
-
puts 'me'
|
|
29
|
-
# do something
|
|
28
|
+
puts '-' * 10
|
|
30
29
|
end
|
|
31
|
-
t.add_object(:Measurements,
|
|
30
|
+
t.add_object(:Measurements, opts['server'].types.folder).tap{ |u|
|
|
32
31
|
u.add_object :M, mt, OPCUA::OPTIONAL
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
|
-
pt =
|
|
34
|
+
pt = opts['server'].types.add_object_type(:PresetterType).tap{ |t|
|
|
36
35
|
t.add_variable :ManufacturerName
|
|
37
|
-
t.add_object(:Tools,
|
|
36
|
+
t.add_object(:Tools, opts['server'].types.folder).tap{ |u|
|
|
38
37
|
u.add_object :Tool, tt, OPCUA::OPTIONAL
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
|
|
42
|
-
tools =
|
|
41
|
+
tools = opts['server'].objects.manifest(:KalimatC34, pt).find(:Tools)
|
|
43
42
|
|
|
44
43
|
t1 = tools.manifest(:Tool1,tt)
|
|
45
44
|
t2 = tools.manifest(:Tool2,tt)
|
|
46
45
|
t3 = tools.manifest(:Tool3,tt)
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
opts[:tn] = t1.find(:ToolNumber)
|
|
49
48
|
|
|
50
49
|
measurments_t1 = t1.find(:Measurements)
|
|
51
50
|
measurments_t1.manifest(:M1,mt)
|
|
52
51
|
measurments_t1.manifest(:M2,mt)
|
|
53
|
-
|
|
54
52
|
rescue => e
|
|
55
53
|
puts e.message
|
|
56
54
|
end
|
|
57
55
|
|
|
58
|
-
run do
|
|
56
|
+
run do |opts|
|
|
59
57
|
GC.start
|
|
60
|
-
sleep
|
|
61
|
-
|
|
58
|
+
sleep opts['server'].run
|
|
59
|
+
opts[:tn].value = Time.now
|
|
62
60
|
rescue => e
|
|
63
61
|
puts e.message
|
|
64
62
|
end
|
data/ext/opcua/client/client.c
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
VALUE mOPCUA = Qnil;
|
|
6
6
|
VALUE cClient = Qnil;
|
|
7
|
+
VALUE cVarNode = Qnil;
|
|
8
|
+
VALUE cMethodNode = Qnil;
|
|
7
9
|
VALUE cNode = Qnil;
|
|
8
10
|
|
|
9
11
|
#include "../values.h"
|
|
@@ -15,7 +17,7 @@ static void node_free(node_struct *ns) { //{{{
|
|
|
15
17
|
free(ns);
|
|
16
18
|
}
|
|
17
19
|
} //}}}
|
|
18
|
-
static
|
|
20
|
+
static node_struct * node_alloc(client_struct *client, UA_NodeId nodeid) { //{{{
|
|
19
21
|
node_struct *ns;
|
|
20
22
|
ns = (node_struct *)malloc(sizeof(node_struct));
|
|
21
23
|
if (ns == NULL)
|
|
@@ -25,9 +27,13 @@ static VALUE node_alloc(VALUE klass, client_struct *client, UA_NodeId nodeid) {
|
|
|
25
27
|
ns->id = nodeid;
|
|
26
28
|
ns->on_change = Qnil;
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
return ns;
|
|
31
|
+
} //}}}
|
|
32
|
+
static VALUE node_wrap(VALUE klass, node_struct *ns) { //{{{
|
|
33
|
+
return Data_Wrap_Struct(klass, NULL, node_free, ns);
|
|
29
34
|
} //}}}
|
|
30
35
|
/* ++ */
|
|
36
|
+
|
|
31
37
|
static VALUE node_value(VALUE self) { //{{{
|
|
32
38
|
node_struct *ns;
|
|
33
39
|
Data_Get_Struct(self, node_struct, ns);
|
|
@@ -88,6 +94,7 @@ static VALUE client_alloc(VALUE self) { //{{{
|
|
|
88
94
|
pss->subs = rb_ary_new();
|
|
89
95
|
pss->subs_changed = false;
|
|
90
96
|
pss->subscription_interval = 500;
|
|
97
|
+
pss->default_ns = 2;
|
|
91
98
|
|
|
92
99
|
UA_CreateSubscriptionRequest_init(&pss->subscription_request);
|
|
93
100
|
pss->subscription_request.requestedPublishingInterval = pss->subscription_interval;
|
|
@@ -97,10 +104,10 @@ static VALUE client_alloc(VALUE self) { //{{{
|
|
|
97
104
|
pss->subscription_request.publishingEnabled = true;
|
|
98
105
|
pss->subscription_request.priority = 0;
|
|
99
106
|
|
|
100
|
-
|
|
107
|
+
return Data_Wrap_Struct(self, NULL, client_free, pss);
|
|
101
108
|
} //}}}
|
|
109
|
+
/* ++ */
|
|
102
110
|
|
|
103
|
-
/* ++ */ //}}}
|
|
104
111
|
static VALUE client_init(VALUE self,VALUE url,VALUE user,VALUE pass) { //{{{
|
|
105
112
|
client_struct *pss;
|
|
106
113
|
UA_StatusCode retval;
|
|
@@ -209,23 +216,54 @@ static VALUE client_init(VALUE self,VALUE url,VALUE user,VALUE pass) { //{{{
|
|
|
209
216
|
|
|
210
217
|
return self;
|
|
211
218
|
} //}}}
|
|
212
|
-
static VALUE client_get(
|
|
219
|
+
static VALUE client_get(int argc, VALUE* argv, VALUE self) { //{{{
|
|
220
|
+
if (argc > 2 || argc < 1) { // there should only be 1 or 2 arguments
|
|
221
|
+
rb_raise(rb_eArgError, "wrong number of arguments");
|
|
222
|
+
}
|
|
223
|
+
|
|
213
224
|
client_struct *pss;
|
|
214
225
|
Data_Get_Struct(self, client_struct, pss);
|
|
215
226
|
if (!pss->started) rb_raise(rb_eRuntimeError, "Client disconnected.");
|
|
216
227
|
|
|
228
|
+
VALUE ns = UINT2NUM(pss->default_ns);
|
|
229
|
+
VALUE id;
|
|
230
|
+
|
|
231
|
+
if (argc == 1) {
|
|
232
|
+
id = argv[0];
|
|
233
|
+
} else {
|
|
234
|
+
ns = argv[0];
|
|
235
|
+
id = argv[1];
|
|
236
|
+
}
|
|
237
|
+
|
|
217
238
|
if (NIL_P(ns) || TYPE(ns) != T_FIXNUM)
|
|
218
239
|
rb_raise(rb_eTypeError, "ns is not a valid (numeric) namespace id");
|
|
240
|
+
|
|
241
|
+
node_struct *res;
|
|
219
242
|
if (TYPE(id) == T_FIXNUM) {
|
|
220
|
-
|
|
243
|
+
res = node_alloc(pss, UA_NODEID_NUMERIC(NUM2INT(ns), NUM2INT(id)));
|
|
221
244
|
} else {
|
|
222
245
|
VALUE str = rb_obj_as_string(id);
|
|
223
246
|
if (NIL_P(str) || TYPE(str) != T_STRING)
|
|
224
247
|
rb_raise(rb_eTypeError, "cannot convert url to string");
|
|
225
248
|
char *nstr = (char *)StringValuePtr(str);
|
|
226
249
|
|
|
227
|
-
|
|
250
|
+
res = node_alloc(pss, UA_NODEID_STRING(NUM2INT(ns), nstr));
|
|
228
251
|
}
|
|
252
|
+
|
|
253
|
+
UA_NodeClass nc;UA_NodeClass_init(&nc);
|
|
254
|
+
UA_Client_readNodeClassAttribute(pss->master, res->id, &nc);
|
|
255
|
+
|
|
256
|
+
VALUE node;
|
|
257
|
+
if (nc == UA_NODECLASS_VARIABLE) {
|
|
258
|
+
node = node_wrap(cVarNode,res);
|
|
259
|
+
} else if (nc == UA_NODECLASS_METHOD) {
|
|
260
|
+
node = node_wrap(cMethodNode,res);
|
|
261
|
+
} else {
|
|
262
|
+
node = node_wrap(cNode,res);
|
|
263
|
+
}
|
|
264
|
+
UA_NodeClass_clear(&nc);
|
|
265
|
+
|
|
266
|
+
return node;
|
|
229
267
|
} //}}}
|
|
230
268
|
static VALUE client_subscription_interval(VALUE self) { //{{{
|
|
231
269
|
client_struct *pss;
|
|
@@ -245,6 +283,24 @@ static VALUE client_subscription_interval_set(VALUE self, VALUE val) { //{{{
|
|
|
245
283
|
pss->subscription_request.requestedPublishingInterval = NUM2UINT(val);
|
|
246
284
|
return self;
|
|
247
285
|
} //}}}
|
|
286
|
+
static VALUE client_default_ns(VALUE self) { //{{{
|
|
287
|
+
client_struct *pss;
|
|
288
|
+
Data_Get_Struct(self, client_struct, pss);
|
|
289
|
+
if (!pss->started) rb_raise(rb_eRuntimeError, "Client disconnected.");
|
|
290
|
+
|
|
291
|
+
return UINT2NUM(pss->default_ns);
|
|
292
|
+
} //}}}
|
|
293
|
+
static VALUE client_default_ns_set(VALUE self, VALUE val) { //{{{
|
|
294
|
+
client_struct *pss;
|
|
295
|
+
Data_Get_Struct(self, client_struct, pss);
|
|
296
|
+
if (!pss->started) rb_raise(rb_eRuntimeError, "Client disconnected.");
|
|
297
|
+
|
|
298
|
+
if (NIL_P(val) || TYPE(val) != T_FIXNUM)
|
|
299
|
+
rb_raise(rb_eTypeError, "subscription interval is not an integer");
|
|
300
|
+
|
|
301
|
+
pss->default_ns = NUM2UINT(val);
|
|
302
|
+
return self;
|
|
303
|
+
} //}}}
|
|
248
304
|
static VALUE client_debug(VALUE self) { //{{{
|
|
249
305
|
client_struct *pss;
|
|
250
306
|
Data_Get_Struct(self, client_struct, pss);
|
|
@@ -267,6 +323,74 @@ static VALUE client_debug_set(VALUE self, VALUE val) { //{{{
|
|
|
267
323
|
return self;
|
|
268
324
|
} //}}}
|
|
269
325
|
|
|
326
|
+
static VALUE node_id(VALUE self) { //{{{
|
|
327
|
+
node_struct *ns;
|
|
328
|
+
|
|
329
|
+
Data_Get_Struct(self, node_struct, ns);
|
|
330
|
+
|
|
331
|
+
VALUE ret = rb_ary_new();
|
|
332
|
+
|
|
333
|
+
rb_ary_push(ret,UINT2NUM(ns->id.namespaceIndex));
|
|
334
|
+
if (ns->id.identifierType == UA_NODEIDTYPE_NUMERIC) {
|
|
335
|
+
VALUE id = UINT2NUM((UA_UInt32)(ns->id.identifier.numeric));
|
|
336
|
+
rb_ary_push(ret,id);
|
|
337
|
+
} else if (ns->id.identifierType == UA_NODEIDTYPE_STRING) {
|
|
338
|
+
rb_ary_push(ret,rb_str_new((const char *)ns->id.identifier.string.data,ns->id.identifier.string.length));
|
|
339
|
+
} else if (ns->id.identifierType == UA_NODEIDTYPE_BYTESTRING) {
|
|
340
|
+
rb_ary_push(ret,rb_str_new((const char *)ns->id.identifier.byteString.data,ns->id.identifier.byteString.length));
|
|
341
|
+
}
|
|
342
|
+
return ret;
|
|
343
|
+
} //}}}
|
|
344
|
+
static VALUE node_to_s(VALUE self) { //{{{
|
|
345
|
+
node_struct *ns;
|
|
346
|
+
VALUE ret;
|
|
347
|
+
|
|
348
|
+
Data_Get_Struct(self, node_struct, ns);
|
|
349
|
+
|
|
350
|
+
if (ns->id.identifierType == UA_NODEIDTYPE_NUMERIC) {
|
|
351
|
+
ret = rb_sprintf("ns=%d;n=%d", ns->id.namespaceIndex, ns->id.identifier.numeric);
|
|
352
|
+
} else if(ns->id.identifierType == UA_NODEIDTYPE_STRING) {
|
|
353
|
+
ret = rb_sprintf("ns=%d;s=%.*s", ns->id.namespaceIndex, (int)ns->id.identifier.string.length, ns->id.identifier.string.data);
|
|
354
|
+
} else {
|
|
355
|
+
ret = rb_sprintf("ns=%d;unsupported",ns->id.namespaceIndex);
|
|
356
|
+
}
|
|
357
|
+
return ret;
|
|
358
|
+
} //}}}
|
|
359
|
+
|
|
360
|
+
static VALUE node_call(int argc, VALUE* argv, VALUE self) {
|
|
361
|
+
node_struct *ns;
|
|
362
|
+
|
|
363
|
+
VALUE splat;
|
|
364
|
+
rb_scan_args(argc, argv, "*", &splat);
|
|
365
|
+
|
|
366
|
+
Data_Get_Struct(self, node_struct, ns);
|
|
367
|
+
|
|
368
|
+
UA_Variant inputArguments[RARRAY_LEN(splat)];
|
|
369
|
+
for (long i=0; i<RARRAY_LEN(splat); i++) {
|
|
370
|
+
value_to_variant(RARRAY_AREF(splat, i),&inputArguments[i]);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
VALUE path = rb_str_new((const char *)ns->id.identifier.string.data,ns->id.identifier.string.length);
|
|
374
|
+
VALUE pat = rb_str_new2("\\/[a-z0-9A-Z]+\\/?$");
|
|
375
|
+
VALUE obj = rb_funcall(path,rb_intern("sub"),2,rb_reg_new_str(pat, 0),rb_str_new2(""));
|
|
376
|
+
|
|
377
|
+
UA_StatusCode retval = UA_Client_call(
|
|
378
|
+
ns->master->master,
|
|
379
|
+
UA_NODEID_STRING(ns->id.namespaceIndex,StringValuePtr(obj)),
|
|
380
|
+
ns->id,
|
|
381
|
+
RARRAY_LEN(splat),
|
|
382
|
+
(UA_Variant *)&inputArguments,
|
|
383
|
+
0,
|
|
384
|
+
NULL
|
|
385
|
+
);
|
|
386
|
+
|
|
387
|
+
if(retval == UA_STATUSCODE_GOOD) {
|
|
388
|
+
return Qtrue;
|
|
389
|
+
} else {
|
|
390
|
+
return Qfalse;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
270
394
|
static void client_run_handler(UA_Client *client, UA_UInt32 subId, void *subContext, UA_UInt32 monId, void *monContext, UA_DataValue *value) { //{{{
|
|
271
395
|
VALUE val = (VALUE)monContext;
|
|
272
396
|
|
|
@@ -340,21 +464,34 @@ static VALUE client_disconnect(VALUE self) { //{{{
|
|
|
340
464
|
void Init_client(void) {
|
|
341
465
|
mOPCUA = rb_define_module("OPCUA");
|
|
342
466
|
|
|
343
|
-
cClient
|
|
344
|
-
cNode
|
|
467
|
+
cClient = rb_define_class_under(mOPCUA, "Client", rb_cObject);
|
|
468
|
+
cNode = rb_define_class_under(mOPCUA, "cNode", rb_cObject);
|
|
469
|
+
cMethodNode = rb_define_class_under(mOPCUA, "cMethodNode", rb_cObject);
|
|
470
|
+
cVarNode = rb_define_class_under(mOPCUA, "cVarNode", rb_cObject);
|
|
345
471
|
|
|
346
472
|
Init_types();
|
|
347
473
|
|
|
348
474
|
rb_define_alloc_func(cClient, client_alloc);
|
|
349
475
|
rb_define_method(cClient, "initialize", client_init, 3);
|
|
350
476
|
rb_define_method(cClient, "disconnect", client_disconnect, 0);
|
|
351
|
-
rb_define_method(cClient, "get", client_get,
|
|
477
|
+
rb_define_method(cClient, "get", client_get, -1);
|
|
352
478
|
rb_define_method(cClient, "check_subscription", client_run, 0);
|
|
353
479
|
rb_define_method(cClient, "subscription_interval", client_subscription_interval, 0);
|
|
354
480
|
rb_define_method(cClient, "subscription_interval=", client_subscription_interval_set, 1);
|
|
481
|
+
rb_define_method(cClient, "default_ns", client_default_ns, 0);
|
|
482
|
+
rb_define_method(cClient, "default_ns=", client_default_ns_set, 1);
|
|
355
483
|
rb_define_method(cClient, "debug", client_debug, 0);
|
|
356
484
|
rb_define_method(cClient, "debug=", client_debug_set, 1);
|
|
357
485
|
|
|
358
|
-
rb_define_method(cNode, "
|
|
359
|
-
rb_define_method(cNode, "
|
|
486
|
+
rb_define_method(cNode, "to_s", node_to_s, 0);
|
|
487
|
+
rb_define_method(cNode, "id", node_id, 0);
|
|
488
|
+
|
|
489
|
+
rb_define_method(cMethodNode, "to_s", node_to_s, 0);
|
|
490
|
+
rb_define_method(cMethodNode, "id", node_id, 0);
|
|
491
|
+
rb_define_method(cMethodNode, "call", node_call, -1);
|
|
492
|
+
|
|
493
|
+
rb_define_method(cVarNode, "to_s", node_to_s, 0);
|
|
494
|
+
rb_define_method(cVarNode, "id", node_id, 0);
|
|
495
|
+
rb_define_method(cVarNode, "value", node_value, 0);
|
|
496
|
+
rb_define_method(cVarNode, "on_change", node_on_change, 0);
|
|
360
497
|
}
|
data/ext/opcua/client/client.h
CHANGED
data/ext/opcua/server/server.c
CHANGED
|
@@ -5,67 +5,13 @@ VALUE cServer = Qnil;
|
|
|
5
5
|
VALUE cObjectsNode = Qnil;
|
|
6
6
|
VALUE cTypesTopNode = Qnil;
|
|
7
7
|
VALUE cTypesSubNode = Qnil;
|
|
8
|
-
VALUE
|
|
8
|
+
VALUE cVarNode = Qnil;
|
|
9
|
+
VALUE cMethodNode = Qnil;
|
|
9
10
|
|
|
10
11
|
#include "../values.h"
|
|
11
12
|
|
|
12
13
|
int nodecounter = 2000;
|
|
13
14
|
|
|
14
|
-
/* -- */
|
|
15
|
-
static void set_node_to_value(node_struct *ns, VALUE value) { //{{{
|
|
16
|
-
UA_Variant variant;
|
|
17
|
-
if (rb_obj_is_kind_of(value,rb_cTime)) {
|
|
18
|
-
UA_DateTime tmp = UA_DateTime_fromUnixTime(rb_time_timeval(value).tv_sec);
|
|
19
|
-
UA_Variant_setScalar(&variant, &tmp, &UA_TYPES[UA_TYPES_DATETIME]);
|
|
20
|
-
UA_Server_writeValue(ns->master->master, ns->id, variant);
|
|
21
|
-
} else {
|
|
22
|
-
switch (TYPE(value)) {
|
|
23
|
-
case T_FALSE:
|
|
24
|
-
{
|
|
25
|
-
UA_Boolean tmp = false;
|
|
26
|
-
UA_Variant_setScalar(&variant, &tmp, &UA_TYPES[UA_TYPES_BOOLEAN]);
|
|
27
|
-
UA_Server_writeValue(ns->master->master, ns->id, variant);
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
case T_TRUE:
|
|
31
|
-
{
|
|
32
|
-
UA_Boolean tmp = true;
|
|
33
|
-
UA_Variant_setScalar(&variant, &tmp, &UA_TYPES[UA_TYPES_BOOLEAN]);
|
|
34
|
-
UA_Server_writeValue(ns->master->master, ns->id, variant);
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
case T_FLOAT:
|
|
38
|
-
case T_FIXNUM:
|
|
39
|
-
{
|
|
40
|
-
UA_Double tmp = NUM2DBL(value);
|
|
41
|
-
UA_Variant_setScalar(&variant, &tmp, &UA_TYPES[UA_TYPES_DOUBLE]);
|
|
42
|
-
UA_Server_writeValue(ns->master->master, ns->id, variant);
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
case T_STRING:
|
|
46
|
-
case T_SYMBOL:
|
|
47
|
-
{
|
|
48
|
-
VALUE str = rb_obj_as_string(value);
|
|
49
|
-
if (NIL_P(str) || TYPE(str) != T_STRING)
|
|
50
|
-
rb_raise(rb_eTypeError, "cannot convert obj to string");
|
|
51
|
-
UA_String tmp = UA_STRING(StringValuePtr(str));
|
|
52
|
-
UA_Variant_setScalar(&variant, &tmp, &UA_TYPES[UA_TYPES_STRING]);
|
|
53
|
-
UA_Server_writeValue(ns->master->master, ns->id, variant);
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
case T_ARRAY:
|
|
57
|
-
{
|
|
58
|
-
// UA_UInt32 arrayDims = 0;
|
|
59
|
-
// attr.valueRank = UA_VALUERANK_ONE_DIMENSION;
|
|
60
|
-
// attr.arrayDimensions = &arrayDims;
|
|
61
|
-
// attr.arrayDimensionsSize = 1;
|
|
62
|
-
// UA_Variant_setArray(&attr.value, UA_Array_new(10, &UA_TYPES[type]), 10, &UA_TYPES[type]);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
} //}}}
|
|
67
|
-
/* ++ */
|
|
68
|
-
|
|
69
15
|
/* -- */
|
|
70
16
|
static void node_free(node_struct *ns) { //{{{
|
|
71
17
|
if (ns != NULL) {
|
|
@@ -123,6 +69,24 @@ static VALUE node_add_object_type(VALUE self, VALUE name) { //{{{
|
|
|
123
69
|
return node_wrap(cTypesSubNode,node_alloc(ns->master,n));
|
|
124
70
|
} //}}}
|
|
125
71
|
|
|
72
|
+
static VALUE node_id(VALUE self) { //{{{
|
|
73
|
+
node_struct *ns;
|
|
74
|
+
|
|
75
|
+
Data_Get_Struct(self, node_struct, ns);
|
|
76
|
+
|
|
77
|
+
VALUE ret = rb_ary_new();
|
|
78
|
+
|
|
79
|
+
rb_ary_push(ret,UINT2NUM(ns->id.namespaceIndex));
|
|
80
|
+
if (ns->id.identifierType == UA_NODEIDTYPE_NUMERIC) {
|
|
81
|
+
VALUE id = UINT2NUM((UA_UInt32)(ns->id.identifier.numeric));
|
|
82
|
+
rb_ary_push(ret,id);
|
|
83
|
+
} else if (ns->id.identifierType == UA_NODEIDTYPE_STRING) {
|
|
84
|
+
rb_ary_push(ret,rb_str_new((const char *)ns->id.identifier.string.data,ns->id.identifier.string.length));
|
|
85
|
+
} else if (ns->id.identifierType == UA_NODEIDTYPE_BYTESTRING) {
|
|
86
|
+
rb_ary_push(ret,rb_str_new((const char *)ns->id.identifier.byteString.data,ns->id.identifier.byteString.length));
|
|
87
|
+
}
|
|
88
|
+
return ret;
|
|
89
|
+
} //}}}
|
|
126
90
|
static VALUE node_to_s(VALUE self) { //{{{
|
|
127
91
|
node_struct *ns;
|
|
128
92
|
VALUE ret;
|
|
@@ -138,7 +102,8 @@ static VALUE node_to_s(VALUE self) { //{{{
|
|
|
138
102
|
}
|
|
139
103
|
return ret;
|
|
140
104
|
} //}}}
|
|
141
|
-
|
|
105
|
+
|
|
106
|
+
static UA_StatusCode node_add_method_callback( //{{{
|
|
142
107
|
UA_Server *server,
|
|
143
108
|
const UA_NodeId *sessionId, void *sessionContext,
|
|
144
109
|
const UA_NodeId *methodId, void *methodContext,
|
|
@@ -165,7 +130,7 @@ static UA_StatusCode node_add_method_callback(
|
|
|
165
130
|
rb_proc_call(me->method,args);
|
|
166
131
|
|
|
167
132
|
return UA_STATUSCODE_GOOD;
|
|
168
|
-
}
|
|
133
|
+
} //}}}
|
|
169
134
|
static UA_NodeId node_add_method_ua(UA_NodeId n, UA_LocalizedText dn, UA_QualifiedName qn, node_struct *parent,size_t inputArgumentsSize,const UA_Argument *inputArguments, VALUE blk) { //{{{
|
|
170
135
|
UA_MethodAttributes mnAttr = UA_MethodAttributes_default;
|
|
171
136
|
mnAttr.displayName = dn;
|
|
@@ -314,7 +279,7 @@ static VALUE node_add_variable_wrap(int argc, VALUE* argv, VALUE self, UA_Byte a
|
|
|
314
279
|
rb_raise(rb_eTypeError, "cannot convert obj to string");
|
|
315
280
|
char *nstr = (char *)StringValuePtr(str);
|
|
316
281
|
|
|
317
|
-
return node_wrap(
|
|
282
|
+
return node_wrap(cVarNode,node_alloc(parent->master,node_add_variable_ua_simple(type,nstr,parent,argv[1],accesslevelmask,numeric)));
|
|
318
283
|
} //}}}
|
|
319
284
|
static VALUE node_add_variable(int argc, VALUE* argv, VALUE self) { //{{{
|
|
320
285
|
return node_add_variable_wrap(argc,argv,self,UA_ACCESSLEVELMASK_READ,true);
|
|
@@ -585,14 +550,33 @@ static VALUE node_find(VALUE self, VALUE qname) { //{{{
|
|
|
585
550
|
UA_NodeId ret;UA_NodeId_init(&ret);
|
|
586
551
|
UA_NodeId_copy(&bpr.targets[0].targetId.nodeId,&ret);
|
|
587
552
|
UA_BrowsePathResult_clear(&bpr);
|
|
588
|
-
|
|
553
|
+
|
|
554
|
+
UA_NodeClass nc;UA_NodeClass_init(&nc);
|
|
555
|
+
UA_Server_readNodeClass(ns->master->master, ret, &nc);
|
|
556
|
+
|
|
557
|
+
VALUE node;
|
|
558
|
+
|
|
559
|
+
if (nc == UA_NODECLASS_VARIABLE) {
|
|
560
|
+
node = node_wrap(cVarNode,node_alloc(ns->master,ret));
|
|
561
|
+
} else if (nc == UA_NODECLASS_METHOD) {
|
|
562
|
+
node = node_wrap(cMethodNode,node_alloc(ns->master,ret));
|
|
563
|
+
} else {
|
|
564
|
+
node = node_wrap(cObjectsNode,node_alloc(ns->master,ret));
|
|
565
|
+
}
|
|
566
|
+
UA_NodeClass_clear(&nc);
|
|
567
|
+
|
|
568
|
+
return node;
|
|
589
569
|
}
|
|
590
570
|
} //}}}
|
|
591
571
|
|
|
592
572
|
static VALUE node_value_set(VALUE self, VALUE value) { //{{{
|
|
593
573
|
node_struct *ns;
|
|
594
574
|
Data_Get_Struct(self, node_struct, ns);
|
|
595
|
-
|
|
575
|
+
|
|
576
|
+
UA_Variant variant;
|
|
577
|
+
if (value_to_variant(value,&variant)) {
|
|
578
|
+
UA_Server_writeValue(ns->master->master, ns->id, variant);
|
|
579
|
+
}
|
|
596
580
|
return self;
|
|
597
581
|
} //}}}
|
|
598
582
|
static VALUE node_value(VALUE self) { //{{{
|
|
@@ -613,24 +597,6 @@ static VALUE node_value(VALUE self) { //{{{
|
|
|
613
597
|
UA_Variant_clear(&value);
|
|
614
598
|
return ret;
|
|
615
599
|
} //}}}
|
|
616
|
-
static VALUE node_id(VALUE self) { //{{{
|
|
617
|
-
node_struct *ns;
|
|
618
|
-
|
|
619
|
-
Data_Get_Struct(self, node_struct, ns);
|
|
620
|
-
|
|
621
|
-
VALUE ret = rb_ary_new();
|
|
622
|
-
|
|
623
|
-
rb_ary_push(ret,UINT2NUM(ns->id.namespaceIndex));
|
|
624
|
-
if (ns->id.identifierType == UA_NODEIDTYPE_NUMERIC) {
|
|
625
|
-
VALUE id = UINT2NUM((UA_UInt32)(ns->id.identifier.numeric));
|
|
626
|
-
rb_ary_push(ret,id);
|
|
627
|
-
} else if (ns->id.identifierType == UA_NODEIDTYPE_STRING) {
|
|
628
|
-
rb_ary_push(ret,rb_str_new((const char *)ns->id.identifier.string.data,ns->id.identifier.string.length));
|
|
629
|
-
} else if (ns->id.identifierType == UA_NODEIDTYPE_BYTESTRING) {
|
|
630
|
-
rb_ary_push(ret,rb_str_new((const char *)ns->id.identifier.byteString.data,ns->id.identifier.byteString.length));
|
|
631
|
-
}
|
|
632
|
-
return ret;
|
|
633
|
-
} //}}}
|
|
634
600
|
|
|
635
601
|
/* -- */
|
|
636
602
|
static void server_free(server_struct *pss) { //{{{
|
|
@@ -734,7 +700,8 @@ void Init_server(void) {
|
|
|
734
700
|
cObjectsNode = rb_define_class_under(mOPCUA, "cObjectsNode", rb_cObject);
|
|
735
701
|
cTypesTopNode = rb_define_class_under(mOPCUA, "cTypesTopNode", rb_cObject);
|
|
736
702
|
cTypesSubNode = rb_define_class_under(mOPCUA, "cTypesSubNode", rb_cObject);
|
|
737
|
-
|
|
703
|
+
cVarNode = rb_define_class_under(mOPCUA, "cVarNode", rb_cObject);
|
|
704
|
+
cMethodNode = rb_define_class_under(mOPCUA, "cMethodNode", rb_cObject);
|
|
738
705
|
|
|
739
706
|
rb_define_alloc_func(cServer, server_alloc);
|
|
740
707
|
rb_define_method(cServer, "initialize", server_init, 0);
|
|
@@ -759,11 +726,12 @@ void Init_server(void) {
|
|
|
759
726
|
rb_define_method(cObjectsNode, "find", node_find, 1);
|
|
760
727
|
rb_define_method(cObjectsNode, "to_s", node_to_s, 0);
|
|
761
728
|
rb_define_method(cObjectsNode, "id", node_id, 0);
|
|
762
|
-
rb_define_method(cObjectsNode, "value", node_value, 0);
|
|
763
|
-
rb_define_method(cObjectsNode, "value=", node_value_set, 1);
|
|
764
729
|
|
|
765
|
-
rb_define_method(
|
|
766
|
-
rb_define_method(
|
|
767
|
-
rb_define_method(
|
|
768
|
-
rb_define_method(
|
|
730
|
+
rb_define_method(cVarNode, "to_s", node_to_s, 0);
|
|
731
|
+
rb_define_method(cVarNode, "id", node_id, 0);
|
|
732
|
+
rb_define_method(cVarNode, "value", node_value, 0);
|
|
733
|
+
rb_define_method(cVarNode, "value=", node_value_set, 1);
|
|
734
|
+
|
|
735
|
+
rb_define_method(cMethodNode, "to_s", node_to_s, 0);
|
|
736
|
+
rb_define_method(cMethodNode, "id", node_id, 0);
|
|
769
737
|
}
|
data/ext/opcua/values.h
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
/* -- */
|
|
2
2
|
VALUE mTYPES = Qnil;
|
|
3
3
|
|
|
4
|
+
/* -- */
|
|
5
|
+
static bool value_to_variant(VALUE value, UA_Variant *variant) { //{{{
|
|
6
|
+
bool done = false;
|
|
7
|
+
if (rb_obj_is_kind_of(value,rb_cTime)) {
|
|
8
|
+
UA_DateTime tmp = UA_DateTime_fromUnixTime(rb_time_timeval(value).tv_sec);
|
|
9
|
+
UA_Variant_setScalarCopy(variant, &tmp, &UA_TYPES[UA_TYPES_DATETIME]);
|
|
10
|
+
done = true;
|
|
11
|
+
} else {
|
|
12
|
+
switch (TYPE(value)) {
|
|
13
|
+
case T_FALSE:
|
|
14
|
+
{
|
|
15
|
+
UA_Boolean tmp = false;
|
|
16
|
+
UA_Variant_setScalarCopy(variant, &tmp, &UA_TYPES[UA_TYPES_BOOLEAN]);
|
|
17
|
+
done = true;
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
case T_TRUE:
|
|
21
|
+
{
|
|
22
|
+
UA_Boolean tmp = true;
|
|
23
|
+
UA_Variant_setScalarCopy(variant, &tmp, &UA_TYPES[UA_TYPES_BOOLEAN]);
|
|
24
|
+
done = true;
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
case T_FLOAT:
|
|
28
|
+
case T_FIXNUM:
|
|
29
|
+
{
|
|
30
|
+
UA_Double tmp = NUM2DBL(value);
|
|
31
|
+
UA_Variant_setScalarCopy(variant, &tmp, &UA_TYPES[UA_TYPES_DOUBLE]);
|
|
32
|
+
done = true;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
case T_STRING:
|
|
36
|
+
case T_SYMBOL:
|
|
37
|
+
{
|
|
38
|
+
VALUE str = rb_obj_as_string(value);
|
|
39
|
+
if (NIL_P(str) || TYPE(str) != T_STRING)
|
|
40
|
+
rb_raise(rb_eTypeError, "cannot convert obj to string");
|
|
41
|
+
UA_String tmp = UA_STRING(StringValuePtr(str));
|
|
42
|
+
UA_Variant_setScalarCopy(variant, &tmp, &UA_TYPES[UA_TYPES_STRING]);
|
|
43
|
+
done = true;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
case T_ARRAY:
|
|
47
|
+
{
|
|
48
|
+
// UA_UInt32 arrayDims = 0;
|
|
49
|
+
// attr.valueRank = UA_VALUERANK_ONE_DIMENSION;
|
|
50
|
+
// attr.arrayDimensions = &arrayDims;
|
|
51
|
+
// attr.arrayDimensionsSize = 1;
|
|
52
|
+
// UA_Variant_setArray(&attr.value, UA_Array_new(10, &UA_TYPES[type]), 10, &UA_TYPES[type]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return done;
|
|
57
|
+
} //}}}
|
|
58
|
+
/* ++ */
|
|
59
|
+
|
|
4
60
|
static void Init_types() {/*{{{*/
|
|
5
61
|
mTYPES = rb_define_module_under(mOPCUA,"TYPES");
|
|
6
62
|
rb_define_const(mTYPES, "DATETIME", INT2NUM(UA_TYPES_DATETIME ));
|
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.10"
|
|
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."
|
|
@@ -13,14 +13,14 @@ Gem::Specification.new do |s|
|
|
|
13
13
|
s.extra_rdoc_files = ['README.md']
|
|
14
14
|
s.bindir = 'tools'
|
|
15
15
|
|
|
16
|
-
s.required_ruby_version = '>=2.
|
|
16
|
+
s.required_ruby_version = '>=2.5.0'
|
|
17
17
|
|
|
18
18
|
s.authors = ['Juergen eTM Mangler','Florian Pauker']
|
|
19
19
|
|
|
20
20
|
s.email = 'juergen.mangler@gmail.com'
|
|
21
21
|
s.homepage = 'https://github.com/etm/opcua-smart'
|
|
22
22
|
|
|
23
|
-
s.add_runtime_dependency 'daemonite', '~> 0', '>= 0.5'
|
|
23
|
+
s.add_runtime_dependency 'daemonite', '~> 0', '>= 0.5.4'
|
|
24
24
|
s.add_development_dependency 'rake', '~> 12'
|
|
25
25
|
s.add_development_dependency 'rake-compiler', '~> 1.0'
|
|
26
26
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: opcua
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '0.
|
|
4
|
+
version: '0.10'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juergen eTM Mangler
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: tools
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2019-05-
|
|
12
|
+
date: 2019-05-28 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: daemonite
|
|
@@ -20,7 +20,7 @@ dependencies:
|
|
|
20
20
|
version: '0'
|
|
21
21
|
- - ">="
|
|
22
22
|
- !ruby/object:Gem::Version
|
|
23
|
-
version:
|
|
23
|
+
version: 0.5.4
|
|
24
24
|
type: :runtime
|
|
25
25
|
prerelease: false
|
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -30,7 +30,7 @@ dependencies:
|
|
|
30
30
|
version: '0'
|
|
31
31
|
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 0.5.4
|
|
34
34
|
- !ruby/object:Gem::Dependency
|
|
35
35
|
name: rake
|
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -73,8 +73,10 @@ files:
|
|
|
73
73
|
- Rakefile
|
|
74
74
|
- cert/cert.h
|
|
75
75
|
- cert/cert_key.h
|
|
76
|
-
- example/
|
|
76
|
+
- example/client_method.rb
|
|
77
|
+
- example/client_subscription.rb
|
|
77
78
|
- example/kelch.KMT
|
|
79
|
+
- example/server.pid
|
|
78
80
|
- example/server.rb
|
|
79
81
|
- example/test.rb
|
|
80
82
|
- ext/opcua/client/client.c
|
|
@@ -101,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
101
103
|
requirements:
|
|
102
104
|
- - ">="
|
|
103
105
|
- !ruby/object:Gem::Version
|
|
104
|
-
version: 2.
|
|
106
|
+
version: 2.5.0
|
|
105
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
108
|
requirements:
|
|
107
109
|
- - ">="
|