opcua 0.7 → 0.8
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 +101 -101
- data/example/server.rb +10 -10
- data/ext/opcua/client/client.c +0 -32
- data/ext/opcua/client/client.h +2 -0
- data/ext/opcua/log_none.h +4 -0
- data/ext/opcua/server/server.c +278 -79
- data/ext/opcua/server/server.h +4 -0
- data/ext/opcua/strnautocat.h +15 -0
- data/ext/opcua/values.h +43 -0
- data/opcua.gemspec +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3a9f25384117833c6ce8890d90e736454f6c1d033861f7d4e059eb2d642fc474
|
|
4
|
+
data.tar.gz: e3047ad3ee37d7b48a50891ebc292e3aa8bc240bccb8cf142e97e1e98c10ce05
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 566c8b06c3ebf55791dcafe681242c041104c9d32179585b3c18d38c6748c200960fc2d37dbeffe97e5be92c8bfeec25826c556aa1115bd0a89ba1c33d2c986e
|
|
7
|
+
data.tar.gz: 0c567af4caffdd155c300dc2847b1902c62ea4df5d3afa4f5b6a8a5c06c4dc3aa5ec718934d76c6007a4a894fff719834f09cf657945948079747ddac3933e65
|
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, 0x04, 0x5b, 0x6e, 0x30, 0x28, 0x5e, 0xcf, 0xdd, 0x1a,
|
|
4
|
+
0xd4, 0xc0, 0x1a, 0xcb, 0x29, 0xcc, 0x5d, 0x60, 0x89, 0x6e, 0x7a, 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,
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
0x61, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x39, 0x30, 0x35, 0x30, 0x37, 0x32,
|
|
9
|
+
0x30, 0x31, 0x31, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x32, 0x30, 0x30, 0x34,
|
|
10
|
+
0x32, 0x36, 0x32, 0x30, 0x31, 0x31, 0x30, 0x30, 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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, 0x94, 0x36, 0x95, 0x94, 0x0d, 0xa5,
|
|
40
|
+
0x0a, 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
|
+
0xba, 0x6e, 0x59, 0x6a, 0x83, 0x42, 0x04, 0x58, 0x26, 0x55, 0x37, 0x1c,
|
|
48
|
+
0x3e, 0x51, 0x7c, 0x9c, 0x9c, 0xf2, 0x6c, 0xfd, 0x08, 0xcf, 0x39, 0x39,
|
|
49
|
+
0x95, 0xec, 0x4e, 0x74, 0x53, 0x33, 0xb6, 0xe7, 0x47, 0x58, 0xe0, 0x63,
|
|
50
|
+
0x93, 0xf1, 0x4b, 0xa9, 0xf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 0xae, 0xd0,
|
|
64
|
+
0x1a, 0x8e, 0xc9, 0x92, 0xd2, 0x5e, 0x80, 0x25, 0xfd, 0xa6, 0x48, 0x5c,
|
|
65
|
+
0x6e, 0x1c, 0x6f, 0xca, 0xdd, 0x16, 0x95, 0x50, 0x19, 0x42, 0x7b, 0x2c,
|
|
66
|
+
0xcb, 0x36, 0x3a, 0xae, 0xfe, 0x36, 0xc0, 0x5f, 0x44, 0x8d, 0x61, 0xf1,
|
|
67
|
+
0x7a, 0x31, 0xc6, 0x9d, 0xe0, 0xa4, 0x2a, 0xee, 0x14, 0x32, 0x7c, 0xb0,
|
|
68
|
+
0x1e, 0x2d, 0x9b, 0x8b
|
|
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
|
-
0x30, 0x82, 0x04,
|
|
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
|
-
|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1, 0x39,
|
|
63
|
+
0x44, 0x39, 0x60, 0x74, 0x89, 0x95, 0x4c, 0xdd, 0xe8, 0x8f, 0x5a, 0xda,
|
|
64
|
+
0x03, 0xd3, 0x85, 0x92, 0x0b, 0x44, 0xc3, 0xc7, 0x06, 0x8c, 0x87, 0xb0,
|
|
65
|
+
0x33, 0xea, 0xdb, 0x8f, 0x62, 0x0b, 0x49, 0x08, 0x0b, 0x43, 0xfd, 0xd2,
|
|
66
|
+
0x3b, 0x7d, 0x21, 0x41, 0xe4, 0xde, 0x70, 0x50, 0x5c, 0xaa, 0x1d, 0x18,
|
|
67
|
+
0x20, 0xa2, 0x5e, 0x4a, 0x9a, 0x54, 0x88, 0x7c, 0x34, 0xa3, 0xf0, 0x41,
|
|
68
|
+
0x28, 0x93, 0x1f, 0x17, 0xab, 0x02, 0x81, 0x81, 0x00, 0xf0, 0x86, 0xa1,
|
|
69
|
+
0xf6, 0x25, 0x31, 0x68, 0x8b, 0xcf, 0xd7, 0x39, 0x85, 0x14, 0xcc, 0x23,
|
|
70
|
+
0xba, 0xf2, 0xf9, 0xfa, 0xce, 0x1c, 0xfe, 0x36, 0x96, 0x7d, 0xee, 0x95,
|
|
71
|
+
0x63, 0xc1, 0x00, 0xdb, 0x38, 0x05, 0x3f, 0xc0, 0xd4, 0x0e, 0x93, 0x8f,
|
|
72
|
+
0x0a, 0x76, 0xaa, 0x15, 0x95, 0xe2, 0x0f, 0x14, 0x7b, 0x16, 0xce, 0x47,
|
|
73
|
+
0x90, 0x5a, 0xa6, 0x52, 0x2c, 0xef, 0x0f, 0xcb, 0x03, 0x21, 0x85, 0x0d,
|
|
74
|
+
0x72, 0x9f, 0x28, 0x35, 0x48, 0xbe, 0x6f, 0xef, 0xb3, 0xb2, 0x36, 0xec,
|
|
75
|
+
0xe8, 0xd6, 0x60, 0x51, 0xad, 0x5b, 0x72, 0x54, 0x55, 0x52, 0x1a, 0xea,
|
|
76
|
+
0x1d, 0x55, 0x04, 0xb8, 0x50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, 0x75, 0x1a,
|
|
90
|
+
0xa1, 0x5a, 0xf5, 0xf5, 0x02, 0x81, 0x80, 0x1b, 0x6a, 0x42, 0xc0, 0x15,
|
|
91
|
+
0x9e, 0xf5, 0x94, 0x40, 0x0c, 0xfd, 0x07, 0x2f, 0x3c, 0xf3, 0x42, 0xd3,
|
|
92
|
+
0x1a, 0x9d, 0x6d, 0x34, 0xf7, 0xd4, 0x09, 0xf6, 0x44, 0x86, 0xd3, 0x76,
|
|
93
|
+
0xf8, 0xec, 0x0e, 0xf7, 0x78, 0x5a, 0x4c, 0xa2, 0xd2, 0xfa, 0xfd, 0x39,
|
|
94
|
+
0xbf, 0x5c, 0xd8, 0x3a, 0x29, 0xdb, 0x8c, 0x0f, 0x20, 0x8c, 0xeb, 0xfe,
|
|
95
|
+
0xc8, 0xd6, 0x16, 0x89, 0xfa, 0xae, 0xe0, 0x8f, 0x99, 0x41, 0x6b, 0x9e,
|
|
96
|
+
0xb7, 0xc5, 0x64, 0x8c, 0x85, 0x17, 0x33, 0xa2, 0xab, 0x90, 0x67, 0xf9,
|
|
97
|
+
0xf7, 0xaa, 0x28, 0xd4, 0x7d, 0x73, 0xc1, 0x95, 0x5d, 0x9a, 0xb5, 0xef,
|
|
98
|
+
0xb6, 0xfb, 0xc6, 0xd5, 0x82, 0x68, 0xe4, 0xdb, 0x1e, 0x2d, 0x5b, 0x93,
|
|
99
|
+
0x79, 0xd9, 0xb7, 0xe1, 0xde, 0x5b, 0x06, 0x7c, 0x5e, 0x82, 0x71, 0x88,
|
|
100
|
+
0x54, 0xa3, 0x4d, 0x5b, 0x26, 0xaf, 0xd5, 0x0a, 0xf3, 0xb8, 0x64, 0xc6,
|
|
101
|
+
0xe9, 0xd1, 0xb9
|
|
102
102
|
};
|
|
103
|
-
unsigned int cert_key_der_len =
|
|
103
|
+
unsigned int cert_key_der_len = 1191;
|
data/example/server.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/ruby
|
|
2
|
-
|
|
3
|
-
require 'opcua/server'
|
|
2
|
+
require_relative '../lib/opcua/server'
|
|
3
|
+
#require 'opcua/server'
|
|
4
4
|
|
|
5
5
|
Daemonite.new do
|
|
6
6
|
|
|
@@ -17,27 +17,27 @@ Daemonite.new do
|
|
|
17
17
|
t.add_variable :DuploNumber
|
|
18
18
|
t.add_variable :testValue1
|
|
19
19
|
t.add_object(:Measurements, server.types.folder).tap{ |u|
|
|
20
|
-
u.add_object :M, mt, OPCUA::
|
|
20
|
+
u.add_object :M, mt, OPCUA::OPTIONAL
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
pt = server.types.add_object_type(:PresetterType).tap{ |t|
|
|
24
24
|
t.add_variable :ManufacturerName
|
|
25
25
|
t.add_object(:Tools, server.types.folder).tap{ |u|
|
|
26
|
-
u.add_object :Tool, tt, OPCUA::
|
|
26
|
+
u.add_object :Tool, tt, OPCUA::OPTIONAL
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
tools = server.objects.
|
|
30
|
+
tools = server.objects.manifest(:KalimatC34, pt).find(:Tools)
|
|
31
31
|
|
|
32
|
-
t1 = tools.
|
|
33
|
-
t2 = tools.
|
|
34
|
-
t3 = tools.
|
|
32
|
+
t1 = tools.manifest(:Tool1,tt)
|
|
33
|
+
t2 = tools.manifest(:Tool2,tt)
|
|
34
|
+
t3 = tools.manifest(:Tool3,tt)
|
|
35
35
|
|
|
36
36
|
tn = t1.find(:ToolNumber)
|
|
37
37
|
|
|
38
38
|
measurments_t1 = t1.find(:Measurements)
|
|
39
|
-
measurments_t1.
|
|
40
|
-
measurments_t1.
|
|
39
|
+
measurments_t1.manifest(:M1,mt)
|
|
40
|
+
measurments_t1.manifest(:M2,mt)
|
|
41
41
|
|
|
42
42
|
p tn.id
|
|
43
43
|
|
data/ext/opcua/client/client.c
CHANGED
|
@@ -6,38 +6,6 @@ VALUE mOPCUA = Qnil;
|
|
|
6
6
|
VALUE cClient = Qnil;
|
|
7
7
|
VALUE cNode = Qnil;
|
|
8
8
|
|
|
9
|
-
void UA_Log_None_log(void *_, UA_LogLevel level, UA_LogCategory category, const char *msg, va_list args) { }
|
|
10
|
-
void UA_Log_None_clear(void *logContext) { }
|
|
11
|
-
const UA_Logger UA_Log_None_ = {UA_Log_None_log, NULL, UA_Log_None_clear};
|
|
12
|
-
const UA_Logger *UA_Log_None = &UA_Log_None_;
|
|
13
|
-
|
|
14
|
-
/* -- */
|
|
15
|
-
static VALUE extract_value(UA_Variant value) { //{{{
|
|
16
|
-
VALUE ret = rb_ary_new2(2);
|
|
17
|
-
rb_ary_store(ret,0,Qnil);
|
|
18
|
-
rb_ary_store(ret,1,Qnil);
|
|
19
|
-
if (UA_Variant_hasScalarType(&value, &UA_TYPES[UA_TYPES_DATETIME])) {
|
|
20
|
-
UA_DateTime raw = *(UA_DateTime *) value.data;
|
|
21
|
-
rb_ary_store(ret,0,rb_time_new(UA_DateTime_toUnixTime(raw),0));
|
|
22
|
-
rb_ary_store(ret,1,ID2SYM(rb_intern("VariantType.Double")));
|
|
23
|
-
} else if (UA_Variant_hasScalarType(&value, &UA_TYPES[UA_TYPES_BOOLEAN])) {
|
|
24
|
-
UA_Boolean raw = *(UA_Boolean *) value.data;
|
|
25
|
-
rb_ary_store(ret,0,raw ? Qtrue : Qfalse);
|
|
26
|
-
rb_ary_store(ret,1,ID2SYM(rb_intern("VariantType.Boolean")));
|
|
27
|
-
} else if (UA_Variant_hasScalarType(&value, &UA_TYPES[UA_TYPES_DOUBLE])) {
|
|
28
|
-
UA_Double raw = *(UA_Double *) value.data;
|
|
29
|
-
rb_ary_store(ret,0,DBL2NUM(raw));
|
|
30
|
-
rb_ary_store(ret,1,ID2SYM(rb_intern("VariantType.Double")));
|
|
31
|
-
} else if (UA_Variant_hasScalarType(&value, &UA_TYPES[UA_TYPES_STRING])) {
|
|
32
|
-
UA_String raw = *(UA_String *) value.data;
|
|
33
|
-
rb_ary_store(ret,0,rb_str_export_locale(rb_str_new((char *)(raw.data),raw.length)));
|
|
34
|
-
rb_ary_store(ret,1,ID2SYM(rb_intern("VariantType.String")));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return ret;
|
|
38
|
-
} //}}}
|
|
39
|
-
/* ++ */
|
|
40
|
-
|
|
41
9
|
/* -- */
|
|
42
10
|
static void node_free(node_struct *ns) { //{{{
|
|
43
11
|
if (ns != NULL) {
|
data/ext/opcua/client/client.h
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
void UA_Log_None_log(void *_, UA_LogLevel level, UA_LogCategory category, const char *msg, va_list args) { }
|
|
2
|
+
void UA_Log_None_clear(void *logContext) { }
|
|
3
|
+
const UA_Logger UA_Log_None_ = {UA_Log_None_log, NULL, UA_Log_None_clear};
|
|
4
|
+
const UA_Logger *UA_Log_None = &UA_Log_None_;
|
data/ext/opcua/server/server.c
CHANGED
|
@@ -11,7 +11,7 @@ VALUE cLeafNode = Qnil;
|
|
|
11
11
|
static void node_free(node_struct *ns) { //{{{
|
|
12
12
|
if (ns != NULL) { free(ns); }
|
|
13
13
|
} //}}}
|
|
14
|
-
static
|
|
14
|
+
static node_struct * node_alloc(server_struct *server, UA_NodeId nodeid) { //{{{
|
|
15
15
|
node_struct *ns;
|
|
16
16
|
ns = (node_struct *)malloc(sizeof(node_struct));
|
|
17
17
|
if (ns == NULL)
|
|
@@ -20,13 +20,17 @@ static VALUE node_alloc(VALUE klass, server_struct *server, UA_NodeId nodeid) {
|
|
|
20
20
|
ns->server = server;
|
|
21
21
|
ns->id = nodeid;
|
|
22
22
|
|
|
23
|
+
return ns;
|
|
24
|
+
} //}}}
|
|
25
|
+
static VALUE node_wrap(VALUE klass, node_struct *ns) { //{{{
|
|
23
26
|
return Data_Wrap_Struct(klass, NULL, node_free, ns);
|
|
24
27
|
} //}}}
|
|
25
28
|
/* ++ */
|
|
29
|
+
|
|
26
30
|
static VALUE node_type_folder(VALUE self) { //{{{
|
|
27
31
|
node_struct *ns;
|
|
28
32
|
Data_Get_Struct(self, node_struct, ns);
|
|
29
|
-
return
|
|
33
|
+
return node_wrap(cTypesTopNode, node_alloc(ns->server, UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE)));
|
|
30
34
|
} //}}}
|
|
31
35
|
static VALUE node_add_object_type(VALUE self, VALUE name) { //{{{
|
|
32
36
|
node_struct *ns;
|
|
@@ -51,10 +55,62 @@ static VALUE node_add_object_type(VALUE self, VALUE name) { //{{{
|
|
|
51
55
|
NULL,
|
|
52
56
|
NULL);
|
|
53
57
|
|
|
54
|
-
return
|
|
58
|
+
return node_wrap(cTypesSubNode,node_alloc(ns->server,n));
|
|
55
59
|
} //}}}
|
|
56
|
-
|
|
60
|
+
|
|
61
|
+
static VALUE node_to_s(VALUE self) { //{{{
|
|
57
62
|
node_struct *ns;
|
|
63
|
+
VALUE ret;
|
|
64
|
+
|
|
65
|
+
Data_Get_Struct(self, node_struct, ns);
|
|
66
|
+
|
|
67
|
+
if (ns->id.identifierType == UA_NODEIDTYPE_NUMERIC) {
|
|
68
|
+
ret = rb_sprintf("ns=%d;n=%d", ns->id.namespaceIndex, ns->id.identifier.numeric);
|
|
69
|
+
} else if(ns->id.identifierType == UA_NODEIDTYPE_STRING) {
|
|
70
|
+
ret = rb_sprintf("ns=%d;s=%.*s", ns->id.namespaceIndex, (int)ns->id.identifier.string.length, ns->id.identifier.string.data);
|
|
71
|
+
} else {
|
|
72
|
+
ret = rb_sprintf("ns=%d;unsupported",ns->id.namespaceIndex);
|
|
73
|
+
}
|
|
74
|
+
return ret;
|
|
75
|
+
} //}}}
|
|
76
|
+
|
|
77
|
+
static UA_NodeId node_add_variable_ua(UA_Int32 type, UA_NodeId n, UA_LocalizedText dn, UA_QualifiedName qn, node_struct *parent, VALUE ref) { //{{{
|
|
78
|
+
UA_VariableAttributes mnAttr = UA_VariableAttributes_default;
|
|
79
|
+
mnAttr.displayName = dn;
|
|
80
|
+
|
|
81
|
+
UA_Server_addVariableNode(parent->server->server,
|
|
82
|
+
n,
|
|
83
|
+
parent->id,
|
|
84
|
+
UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
|
|
85
|
+
qn,
|
|
86
|
+
UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE),
|
|
87
|
+
mnAttr,
|
|
88
|
+
NULL,
|
|
89
|
+
NULL);
|
|
90
|
+
|
|
91
|
+
if (ref != Qnil) {
|
|
92
|
+
UA_Server_addReference(parent->server->server,
|
|
93
|
+
n,
|
|
94
|
+
UA_NODEID_NUMERIC(0, UA_NS0ID_HASMODELLINGRULE),
|
|
95
|
+
UA_EXPANDEDNODEID_NUMERIC(0, type),
|
|
96
|
+
true);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return n;
|
|
100
|
+
|
|
101
|
+
} //}}}
|
|
102
|
+
static UA_NodeId node_add_variable_ua_simple(UA_Int32 type, char* nstr, node_struct *parent, VALUE ref) { //{{{
|
|
103
|
+
return node_add_variable_ua(
|
|
104
|
+
type,
|
|
105
|
+
UA_NODEID_STRING(parent->server->default_ns,nstr),
|
|
106
|
+
UA_LOCALIZEDTEXT("en-US", nstr),
|
|
107
|
+
UA_QUALIFIEDNAME(parent->server->default_ns, nstr),
|
|
108
|
+
parent,
|
|
109
|
+
ref
|
|
110
|
+
);
|
|
111
|
+
} //}}}
|
|
112
|
+
static VALUE node_add_variable(int argc, VALUE* argv, VALUE self) { //{{{
|
|
113
|
+
node_struct *parent;
|
|
58
114
|
|
|
59
115
|
if (argc > 2 || argc == 0) { // there should only be 1 or 2 arguments
|
|
60
116
|
rb_raise(rb_eArgError, "wrong number of arguments");
|
|
@@ -67,45 +123,58 @@ static VALUE node_add_variable(int argc, VALUE* argv, VALUE self) { //{{{
|
|
|
67
123
|
type = UA_NS0ID_MODELLINGRULE_MANDATORY;
|
|
68
124
|
}
|
|
69
125
|
|
|
70
|
-
Data_Get_Struct(self, node_struct,
|
|
126
|
+
Data_Get_Struct(self, node_struct, parent);
|
|
71
127
|
|
|
72
128
|
VALUE str = rb_obj_as_string(argv[0]);
|
|
73
129
|
if (NIL_P(str) || TYPE(str) != T_STRING)
|
|
74
130
|
rb_raise(rb_eTypeError, "cannot convert obj to string");
|
|
75
131
|
char *nstr = (char *)StringValuePtr(str);
|
|
76
132
|
|
|
77
|
-
|
|
78
|
-
|
|
133
|
+
return node_wrap(cLeafNode,node_alloc(parent->server,node_add_variable_ua_simple(type,nstr,parent,argv[1])));
|
|
134
|
+
} //}}}
|
|
135
|
+
static VALUE node_add_variable_without(VALUE self, VALUE name) { //{{{
|
|
136
|
+
VALUE argv[] = { name, Qnil };
|
|
137
|
+
return node_add_variable(2,argv,self);
|
|
138
|
+
} //}}}
|
|
79
139
|
|
|
80
|
-
|
|
140
|
+
static UA_NodeId node_add_object_ua(UA_Int32 type, UA_NodeId n, UA_LocalizedText dn, UA_QualifiedName qn, node_struct *parent, node_struct *datatype, VALUE ref) { //{{{
|
|
141
|
+
UA_ObjectAttributes oAttr = UA_ObjectAttributes_default;
|
|
142
|
+
oAttr.displayName = dn;
|
|
81
143
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
144
|
+
UA_Server_addObjectNode(parent->server->server,
|
|
145
|
+
n,
|
|
146
|
+
parent->id,
|
|
147
|
+
UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
|
|
148
|
+
qn,
|
|
149
|
+
datatype->id,
|
|
150
|
+
oAttr,
|
|
151
|
+
NULL,
|
|
152
|
+
NULL);
|
|
91
153
|
|
|
92
|
-
if (
|
|
93
|
-
UA_Server_addReference(
|
|
154
|
+
if (ref != Qnil) {
|
|
155
|
+
UA_Server_addReference(parent->server->server,
|
|
94
156
|
n,
|
|
95
157
|
UA_NODEID_NUMERIC(0, UA_NS0ID_HASMODELLINGRULE),
|
|
96
158
|
UA_EXPANDEDNODEID_NUMERIC(0, type),
|
|
97
159
|
true);
|
|
98
160
|
}
|
|
99
161
|
|
|
100
|
-
return
|
|
162
|
+
return n;
|
|
101
163
|
} //}}}
|
|
102
|
-
static
|
|
103
|
-
|
|
104
|
-
|
|
164
|
+
static UA_NodeId node_add_object_ua_simple(UA_Int32 type, char* nstr, node_struct *parent, node_struct *datatype, VALUE ref) { //{{{
|
|
165
|
+
return node_add_object_ua(
|
|
166
|
+
type,
|
|
167
|
+
UA_NODEID_STRING(parent->server->default_ns,nstr),
|
|
168
|
+
UA_LOCALIZEDTEXT("en-US", nstr),
|
|
169
|
+
UA_QUALIFIEDNAME(parent->server->default_ns, nstr),
|
|
170
|
+
parent,
|
|
171
|
+
datatype,
|
|
172
|
+
ref
|
|
173
|
+
);
|
|
105
174
|
} //}}}
|
|
106
175
|
static VALUE node_add_object(int argc, VALUE* argv, VALUE self) { //{{{
|
|
107
|
-
node_struct *
|
|
108
|
-
node_struct *
|
|
176
|
+
node_struct *parent;
|
|
177
|
+
node_struct *datatype;
|
|
109
178
|
|
|
110
179
|
if (argc > 3 || argc < 2) { // there should only be 2 or 3 arguments
|
|
111
180
|
rb_raise(rb_eArgError, "wrong number of arguments");
|
|
@@ -122,42 +191,183 @@ static VALUE node_add_object(int argc, VALUE* argv, VALUE self) { //{{{
|
|
|
122
191
|
rb_raise(rb_eArgError, "argument 2 has to be a type.");
|
|
123
192
|
}
|
|
124
193
|
|
|
125
|
-
Data_Get_Struct(self, node_struct,
|
|
126
|
-
Data_Get_Struct(argv[1], node_struct,
|
|
194
|
+
Data_Get_Struct(self, node_struct, parent);
|
|
195
|
+
Data_Get_Struct(argv[1], node_struct, datatype);
|
|
127
196
|
|
|
128
197
|
VALUE str = rb_obj_as_string(argv[0]);
|
|
129
198
|
if (NIL_P(str) || TYPE(str) != T_STRING)
|
|
130
199
|
rb_raise(rb_eTypeError, "cannot convert obj to string");
|
|
131
200
|
char *nstr = (char *)StringValuePtr(str);
|
|
132
201
|
|
|
133
|
-
|
|
202
|
+
return node_wrap(CLASS_OF(self),node_alloc(parent->server,node_add_object_ua_simple(type,nstr,parent,datatype,argv[2])));
|
|
203
|
+
} //}}}
|
|
204
|
+
static VALUE node_add_object_without(VALUE self, VALUE name, VALUE parent) { //{{{
|
|
205
|
+
VALUE argv[] = { name, parent, Qnil };
|
|
206
|
+
return node_add_object(3,argv,self);
|
|
207
|
+
} //}}}
|
|
208
|
+
|
|
209
|
+
static UA_BrowsePathResult node_browse_path(UA_Server *server, UA_NodeId relative, UA_NodeId ref, UA_QualifiedName mqn) { //{{{
|
|
210
|
+
UA_RelativePathElement rpe;
|
|
211
|
+
UA_RelativePathElement_init(&rpe);
|
|
212
|
+
rpe.referenceTypeId = ref;
|
|
213
|
+
rpe.isInverse = false;
|
|
214
|
+
rpe.includeSubtypes = false;
|
|
215
|
+
rpe.targetName = mqn;
|
|
216
|
+
|
|
217
|
+
UA_BrowsePath bp;
|
|
218
|
+
UA_BrowsePath_init(&bp);
|
|
219
|
+
bp.startingNode = relative;
|
|
220
|
+
bp.relativePath.elementsSize = 1;
|
|
221
|
+
bp.relativePath.elements = &rpe;
|
|
222
|
+
|
|
223
|
+
return UA_Server_translateBrowsePathToNodeIds(server, &bp);
|
|
224
|
+
} //}}}
|
|
225
|
+
|
|
226
|
+
static bool node_get_reference(UA_Server *server, UA_NodeId parent, UA_NodeId *result) { //{{{
|
|
227
|
+
UA_BrowseDescription bDes;
|
|
228
|
+
UA_BrowseDescription_init(&bDes);
|
|
229
|
+
bDes.nodeId = parent;
|
|
230
|
+
bDes.resultMask = UA_BROWSERESULTMASK_ALL;
|
|
231
|
+
UA_BrowseResult bRes = UA_Server_browse(server, 1, &bDes);
|
|
232
|
+
|
|
233
|
+
if (bRes.referencesSize > 0) {
|
|
234
|
+
UA_ReferenceDescription *ref = &(bRes.references[0]);
|
|
235
|
+
|
|
236
|
+
*result = ref->nodeId.nodeId;
|
|
237
|
+
UA_BrowseResult_clear(&bRes);
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
return false;
|
|
241
|
+
} //}}}
|
|
242
|
+
|
|
243
|
+
static UA_StatusCode node_manifest_iter(UA_NodeId child_id, UA_Boolean is_inverse, UA_NodeId reference_type_id, void *handle) { //{{{
|
|
244
|
+
if (is_inverse) return UA_STATUSCODE_GOOD;
|
|
245
|
+
|
|
246
|
+
node_struct **tandle = (node_struct **)handle;
|
|
247
|
+
node_struct *parent = tandle[0];
|
|
248
|
+
node_struct *newnode = tandle[1];
|
|
249
|
+
|
|
250
|
+
if (child_id.namespaceIndex == parent->server->default_ns) {
|
|
251
|
+
UA_NodeClass nc; UA_NodeClass_init(&nc);
|
|
252
|
+
|
|
253
|
+
UA_LocalizedText dn; UA_LocalizedText_init(&dn);
|
|
254
|
+
UA_QualifiedName qn; UA_QualifiedName_init(&qn);
|
|
255
|
+
UA_QualifiedName pqn; UA_QualifiedName_init(&pqn);
|
|
256
|
+
UA_QualifiedName nqn; UA_QualifiedName_init(&nqn);
|
|
257
|
+
|
|
258
|
+
UA_Server_readNodeClass(parent->server->server, child_id, &nc);
|
|
259
|
+
UA_Server_readBrowseName(parent->server->server, child_id, &qn);
|
|
260
|
+
UA_Server_readDisplayName(parent->server->server, child_id, &dn);
|
|
261
|
+
UA_Server_readBrowseName(parent->server->server, parent->id, &pqn);
|
|
262
|
+
UA_Server_readBrowseName(parent->server->server, newnode->id, &nqn);
|
|
263
|
+
|
|
264
|
+
// printf("%d ---> NodeId %d, %-16.*s, %-16.*s, ref: %d, nc: %d\n",
|
|
265
|
+
// reference_type_id.identifier.numeric,
|
|
266
|
+
// child_id.namespaceIndex,
|
|
267
|
+
// (int)pqn.name.length,
|
|
268
|
+
// pqn.name.data,
|
|
269
|
+
// (int)qn.name.length,
|
|
270
|
+
// qn.name.data,
|
|
271
|
+
// reference_type_id.identifier.numeric,
|
|
272
|
+
// nc
|
|
273
|
+
// );
|
|
274
|
+
|
|
275
|
+
if (child_id.namespaceIndex == parent->server->default_ns) {
|
|
276
|
+
UA_QualifiedName mqn;UA_QualifiedName_init(&mqn);
|
|
277
|
+
UA_Server_readBrowseName(parent->server->server, UA_NODEID_NUMERIC(0, UA_NS0ID_MODELLINGRULE_MANDATORY), &mqn);
|
|
278
|
+
|
|
279
|
+
UA_BrowsePathResult mandatory = node_browse_path(parent->server->server, child_id, UA_NODEID_NUMERIC(0, UA_NS0ID_HASMODELLINGRULE), mqn);
|
|
280
|
+
|
|
281
|
+
if (mandatory.statusCode == UA_STATUSCODE_GOOD && (nc == UA_NODECLASS_OBJECT || nc == UA_NODECLASS_VARIABLE)) {
|
|
282
|
+
char * buffer = strnautocat(NULL,"",0);
|
|
283
|
+
if (newnode->id.identifier.string.data[0] != '/') {
|
|
284
|
+
buffer = strnautocat(buffer,"/",1);
|
|
285
|
+
}
|
|
286
|
+
buffer = strnautocat(buffer,(char *)newnode->id.identifier.string.data,newnode->id.identifier.string.length);
|
|
287
|
+
buffer = strnautocat(buffer,"/",1);
|
|
288
|
+
buffer = strnautocat(buffer,(char *)qn.name.data,qn.name.length);
|
|
289
|
+
if(nc == UA_NODECLASS_OBJECT) {
|
|
290
|
+
UA_NodeId typeid;
|
|
291
|
+
node_get_reference(parent->server->server, child_id, &typeid);
|
|
292
|
+
|
|
293
|
+
node_struct *thetype = node_alloc(parent->server,typeid);
|
|
294
|
+
node_struct *downnode = node_alloc(parent->server,node_add_object_ua(UA_NS0ID_MODELLINGRULE_MANDATORY,UA_NODEID_STRING(parent->server->default_ns,buffer),dn,qn,newnode,thetype,Qtrue));
|
|
295
|
+
|
|
296
|
+
node_struct *newparent = node_alloc(parent->server,child_id);
|
|
297
|
+
node_struct *downhandle[2] = { newparent, downnode };
|
|
298
|
+
|
|
299
|
+
// printf("---->\n");
|
|
300
|
+
UA_Server_forEachChildNodeCall(parent->server->server, child_id, node_manifest_iter, (void *)downhandle);
|
|
301
|
+
// printf("<----\n");
|
|
302
|
+
|
|
303
|
+
free(thetype);
|
|
304
|
+
free(downnode);
|
|
305
|
+
free(newparent);
|
|
306
|
+
}
|
|
307
|
+
if(nc == UA_NODECLASS_VARIABLE) {
|
|
308
|
+
node_add_variable_ua(UA_NS0ID_MODELLINGRULE_MANDATORY,UA_NODEID_STRING(parent->server->default_ns,buffer),dn,qn,newnode,Qtrue);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
UA_BrowsePathResult_clear(&mandatory);
|
|
312
|
+
UA_QualifiedName_clear(&mqn);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
UA_NodeClass_clear(&nc);
|
|
316
|
+
UA_QualifiedName_clear(&qn);
|
|
317
|
+
UA_QualifiedName_clear(&pqn);
|
|
318
|
+
UA_LocalizedText_clear(&dn);
|
|
319
|
+
}
|
|
320
|
+
return UA_STATUSCODE_GOOD;
|
|
321
|
+
} //}}}
|
|
322
|
+
static VALUE node_manifest(VALUE self, VALUE name, VALUE parent) { //{{{
|
|
323
|
+
node_struct *ns;
|
|
324
|
+
node_struct *ts;
|
|
325
|
+
|
|
326
|
+
if (!(rb_obj_is_kind_of(parent,cTypesTopNode) || rb_obj_is_kind_of(parent,cTypesSubNode))) {
|
|
327
|
+
rb_raise(rb_eArgError, "argument 2 has to be a type.");
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
Data_Get_Struct(self, node_struct, ns);
|
|
331
|
+
Data_Get_Struct(parent, node_struct, ts);
|
|
332
|
+
|
|
333
|
+
VALUE str = rb_obj_as_string(name);
|
|
334
|
+
if (NIL_P(str) || TYPE(str) != T_STRING)
|
|
335
|
+
rb_raise(rb_eTypeError, "cannot convert obj to string");
|
|
336
|
+
char *nstr = (char *)StringValuePtr(str);
|
|
337
|
+
|
|
338
|
+
char *nidstr = strnautocat(NULL,"",1);
|
|
339
|
+
if (ns->id.identifierType == UA_NODEIDTYPE_STRING) {
|
|
340
|
+
nidstr = strnautocat(nidstr,ns->id.identifier.string.data,ns->id.identifier.string.length);
|
|
341
|
+
nidstr = strnautocat(nidstr,"/",1);
|
|
342
|
+
}
|
|
343
|
+
nidstr = strnautocat(nidstr,nstr,strlen(nstr));
|
|
344
|
+
|
|
345
|
+
UA_NodeId n = UA_NODEID_STRING(ns->server->default_ns, nidstr);
|
|
134
346
|
|
|
135
347
|
UA_ObjectAttributes oAttr = UA_ObjectAttributes_default;
|
|
136
348
|
oAttr.displayName = UA_LOCALIZEDTEXT("en-US", nstr);
|
|
137
|
-
|
|
349
|
+
|
|
350
|
+
UA_Server_addNode_begin(ns->server->server,
|
|
351
|
+
UA_NODECLASS_OBJECT,
|
|
138
352
|
n,
|
|
139
353
|
ns->id,
|
|
140
354
|
UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
|
|
141
355
|
UA_QUALIFIEDNAME(ns->server->default_ns, nstr),
|
|
142
356
|
ts->id,
|
|
143
|
-
oAttr,
|
|
357
|
+
(const UA_NodeAttributes*)&oAttr,
|
|
358
|
+
&UA_TYPES[UA_TYPES_OBJECTATTRIBUTES],
|
|
144
359
|
NULL,
|
|
145
360
|
NULL);
|
|
146
361
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
UA_NODEID_NUMERIC(0, UA_NS0ID_HASMODELLINGRULE),
|
|
151
|
-
UA_EXPANDEDNODEID_NUMERIC(0, type),
|
|
152
|
-
true);
|
|
153
|
-
}
|
|
362
|
+
node_struct *ret = node_alloc(ns->server,n);
|
|
363
|
+
node_struct *handle[2] = { ts, ret };
|
|
364
|
+
UA_Server_forEachChildNodeCall(ns->server->server, ts->id, node_manifest_iter, (void *)handle);
|
|
154
365
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
VALUE argv[] = { name, parent, Qnil };
|
|
159
|
-
return node_add_object(3,argv,self);
|
|
366
|
+
UA_Server_addNode_finish(ns->server->server,n);
|
|
367
|
+
|
|
368
|
+
return Data_Wrap_Struct(CLASS_OF(self), NULL, node_free, ret);
|
|
160
369
|
} //}}}
|
|
370
|
+
|
|
161
371
|
static VALUE node_find(VALUE self, VALUE qname) { //{{{
|
|
162
372
|
node_struct *ns;
|
|
163
373
|
|
|
@@ -168,28 +378,15 @@ static VALUE node_find(VALUE self, VALUE qname) { //{{{
|
|
|
168
378
|
rb_raise(rb_eTypeError, "cannot convert obj to string");
|
|
169
379
|
char *nstr = (char *)StringValuePtr(str);
|
|
170
380
|
|
|
171
|
-
|
|
172
|
-
UA_RelativePathElement rpe;
|
|
173
|
-
UA_RelativePathElement_init(&rpe);
|
|
174
|
-
rpe.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT);
|
|
175
|
-
rpe.isInverse = false;
|
|
176
|
-
rpe.includeSubtypes = false;
|
|
177
|
-
rpe.targetName = UA_QUALIFIEDNAME(ns->server->default_ns, nstr);
|
|
178
|
-
|
|
179
|
-
UA_BrowsePath bp;
|
|
180
|
-
UA_BrowsePath_init(&bp);
|
|
181
|
-
bp.startingNode = ns->id;
|
|
182
|
-
bp.relativePath.elementsSize = 1;
|
|
183
|
-
bp.relativePath.elements = &rpe;
|
|
184
|
-
|
|
185
|
-
UA_BrowsePathResult bpr = UA_Server_translateBrowsePathToNodeIds(ns->server->server, &bp);
|
|
381
|
+
UA_BrowsePathResult bpr = node_browse_path(ns->server->server, ns->id, UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT), UA_QUALIFIEDNAME(ns->server->default_ns, nstr));
|
|
186
382
|
|
|
187
383
|
if(bpr.statusCode != UA_STATUSCODE_GOOD || bpr.targetsSize < 1) {
|
|
188
384
|
return Qnil;
|
|
189
385
|
} else {
|
|
190
|
-
UA_NodeId ret
|
|
386
|
+
UA_NodeId ret;UA_NodeId_init(&ret);
|
|
387
|
+
UA_NodeId_copy(&bpr.targets[0].targetId.nodeId,&ret);
|
|
191
388
|
UA_BrowsePathResult_clear(&bpr);
|
|
192
|
-
return
|
|
389
|
+
return node_wrap(CLASS_OF(self),node_alloc(ns->server,ret));
|
|
193
390
|
}
|
|
194
391
|
} //}}}
|
|
195
392
|
|
|
@@ -238,6 +435,15 @@ static VALUE node_value_set(VALUE self, VALUE value) { //{{{
|
|
|
238
435
|
UA_Server_writeValue(ns->server->server, ns->id, variant);
|
|
239
436
|
break;
|
|
240
437
|
}
|
|
438
|
+
case T_ARRAY:
|
|
439
|
+
{
|
|
440
|
+
// UA_UInt32 arrayDims = 0;
|
|
441
|
+
// attr.valueRank = UA_VALUERANK_ONE_DIMENSION;
|
|
442
|
+
// attr.arrayDimensions = &arrayDims;
|
|
443
|
+
// attr.arrayDimensionsSize = 1;
|
|
444
|
+
// UA_Variant_setArray(&attr.value, UA_Array_new(10, &UA_TYPES[type]), 10, &UA_TYPES[type]);
|
|
445
|
+
}
|
|
446
|
+
|
|
241
447
|
}
|
|
242
448
|
}
|
|
243
449
|
return self;
|
|
@@ -251,21 +457,10 @@ static VALUE node_value(VALUE self) { //{{{
|
|
|
251
457
|
UA_Variant_init(&value);
|
|
252
458
|
UA_StatusCode retval = UA_Server_readValue(ns->server->server, ns->id, &value);
|
|
253
459
|
|
|
460
|
+
|
|
254
461
|
VALUE ret = Qnil;
|
|
255
462
|
if (retval == UA_STATUSCODE_GOOD) {
|
|
256
|
-
|
|
257
|
-
UA_DateTime raw = *(UA_DateTime *) value.data;
|
|
258
|
-
ret = rb_time_new(UA_DateTime_toUnixTime(raw),0);
|
|
259
|
-
} else if (UA_Variant_hasScalarType(&value, &UA_TYPES[UA_TYPES_BOOLEAN])) {
|
|
260
|
-
UA_Boolean raw = *(UA_Boolean *) value.data;
|
|
261
|
-
ret = raw ? Qtrue : Qfalse;
|
|
262
|
-
} else if (UA_Variant_hasScalarType(&value, &UA_TYPES[UA_TYPES_DOUBLE])) {
|
|
263
|
-
UA_Double raw = *(UA_Double *) value.data;
|
|
264
|
-
ret = DBL2NUM(raw);
|
|
265
|
-
} else if (UA_Variant_hasScalarType(&value, &UA_TYPES[UA_TYPES_STRING])) {
|
|
266
|
-
UA_String raw = *(UA_String *) value.data;
|
|
267
|
-
ret = rb_str_new((char *)(raw.data),raw.length);
|
|
268
|
-
}
|
|
463
|
+
ret = extract_value(value);
|
|
269
464
|
}
|
|
270
465
|
|
|
271
466
|
UA_Variant_clear(&value);
|
|
@@ -289,6 +484,7 @@ static VALUE node_id(VALUE self) { //{{{
|
|
|
289
484
|
}
|
|
290
485
|
return ret;
|
|
291
486
|
} //}}}
|
|
487
|
+
|
|
292
488
|
/* -- */
|
|
293
489
|
static void server_free(server_struct *pss) { //{{{
|
|
294
490
|
if (pss != NULL) {
|
|
@@ -310,7 +506,8 @@ static VALUE server_alloc(VALUE self) { //{{{
|
|
|
310
506
|
|
|
311
507
|
return Data_Wrap_Struct(self, NULL, server_free, pss);
|
|
312
508
|
} //}}}
|
|
313
|
-
/* ++ */
|
|
509
|
+
/* ++ */
|
|
510
|
+
|
|
314
511
|
static VALUE server_init(VALUE self) { //{{{
|
|
315
512
|
server_struct *pss;
|
|
316
513
|
|
|
@@ -348,12 +545,12 @@ static VALUE server_add_namespace(VALUE self, VALUE name) { //{{{
|
|
|
348
545
|
static VALUE server_types(VALUE self) { //{{{
|
|
349
546
|
server_struct *pss;
|
|
350
547
|
Data_Get_Struct(self, server_struct, pss);
|
|
351
|
-
return
|
|
548
|
+
return node_wrap(cTypesTopNode, node_alloc(pss, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE)));
|
|
352
549
|
} //}}}
|
|
353
550
|
static VALUE server_objects(VALUE self) { //{{{
|
|
354
551
|
server_struct *pss;
|
|
355
552
|
Data_Get_Struct(self, server_struct, pss);
|
|
356
|
-
return
|
|
553
|
+
return node_wrap(cObjectsNode, node_alloc(pss, UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER)));
|
|
357
554
|
} //}}}
|
|
358
555
|
|
|
359
556
|
void Init_server(void) {
|
|
@@ -363,11 +560,11 @@ void Init_server(void) {
|
|
|
363
560
|
rb_define_const(mOPCUA, "OPTIONAL", INT2NUM(UA_NS0ID_MODELLINGRULE_OPTIONAL));
|
|
364
561
|
rb_define_const(mOPCUA, "OPTIONALPLACEHOLDER", INT2NUM(UA_NS0ID_MODELLINGRULE_OPTIONALPLACEHOLDER));
|
|
365
562
|
|
|
366
|
-
cServer
|
|
563
|
+
cServer = rb_define_class_under(mOPCUA, "Server", rb_cObject);
|
|
367
564
|
cObjectsNode = rb_define_class_under(mOPCUA, "cObjectsNode", rb_cObject);
|
|
368
|
-
cTypesTopNode
|
|
369
|
-
cTypesSubNode
|
|
370
|
-
cLeafNode
|
|
565
|
+
cTypesTopNode = rb_define_class_under(mOPCUA, "cTypesTopNode", rb_cObject);
|
|
566
|
+
cTypesSubNode = rb_define_class_under(mOPCUA, "cTypesSubNode", rb_cObject);
|
|
567
|
+
cLeafNode = rb_define_class_under(mOPCUA, "cLeafNode", rb_cObject);
|
|
371
568
|
|
|
372
569
|
rb_define_alloc_func(cServer, server_alloc);
|
|
373
570
|
rb_define_method(cServer, "initialize", server_init, 0);
|
|
@@ -384,9 +581,11 @@ void Init_server(void) {
|
|
|
384
581
|
rb_define_method(cTypesSubNode, "id", node_id, 0);
|
|
385
582
|
|
|
386
583
|
rb_define_method(cObjectsNode, "instantiate", node_add_object_without, 2);
|
|
584
|
+
rb_define_method(cObjectsNode, "manifest", node_manifest, 2);
|
|
387
585
|
rb_define_method(cObjectsNode, "add_variable", node_add_variable_without, 1);
|
|
388
586
|
rb_define_method(cObjectsNode, "find", node_find, 1);
|
|
389
587
|
rb_define_method(cObjectsNode, "value", node_value, 0);
|
|
390
588
|
rb_define_method(cObjectsNode, "value=", node_value_set, 1);
|
|
589
|
+
rb_define_method(cObjectsNode, "to_s", node_to_s, 0);
|
|
391
590
|
rb_define_method(cObjectsNode, "id", node_id, 0);
|
|
392
591
|
}
|
data/ext/opcua/server/server.h
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
char *strnautocat(char *str, char *s2, size_t num) {
|
|
2
|
+
int len = 0;
|
|
3
|
+
char *s;
|
|
4
|
+
if (str == NULL) {
|
|
5
|
+
str = (char *)malloc(sizeof(*str));
|
|
6
|
+
str[0] = '\0';
|
|
7
|
+
} else {
|
|
8
|
+
len = strlen(str);
|
|
9
|
+
}
|
|
10
|
+
len += num + 1 * sizeof(*s2);
|
|
11
|
+
s = realloc(str, len);
|
|
12
|
+
strncat(s, s2, num);
|
|
13
|
+
return s;
|
|
14
|
+
}
|
|
15
|
+
|
data/ext/opcua/values.h
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* -- */
|
|
2
|
+
static VALUE extract_value(UA_Variant value) { //{{{
|
|
3
|
+
VALUE ret = rb_ary_new2(2);
|
|
4
|
+
rb_ary_store(ret,0,Qnil);
|
|
5
|
+
rb_ary_store(ret,1,Qnil);
|
|
6
|
+
// printf("type: %s\n",value.type->typeName);
|
|
7
|
+
if (UA_Variant_hasScalarType(&value, &UA_TYPES[UA_TYPES_DATETIME])) {
|
|
8
|
+
UA_DateTime raw = *(UA_DateTime *) value.data;
|
|
9
|
+
rb_ary_store(ret,0,rb_time_new(UA_DateTime_toUnixTime(raw),0));
|
|
10
|
+
rb_ary_store(ret,1,ID2SYM(rb_intern("VariantType.Double")));
|
|
11
|
+
} else if (UA_Variant_hasScalarType(&value, &UA_TYPES[UA_TYPES_BOOLEAN])) {
|
|
12
|
+
UA_Boolean raw = *(UA_Boolean *) value.data;
|
|
13
|
+
rb_ary_store(ret,0,raw ? Qtrue : Qfalse);
|
|
14
|
+
rb_ary_store(ret,1,ID2SYM(rb_intern("VariantType.Boolean")));
|
|
15
|
+
} else if (UA_Variant_hasScalarType(&value, &UA_TYPES[UA_TYPES_DOUBLE])) {
|
|
16
|
+
UA_Double raw = *(UA_Double *) value.data;
|
|
17
|
+
rb_ary_store(ret,0,DBL2NUM(raw));
|
|
18
|
+
rb_ary_store(ret,1,ID2SYM(rb_intern("VariantType.Double")));
|
|
19
|
+
} else if (UA_Variant_hasScalarType(&value, &UA_TYPES[UA_TYPES_INT32])) {
|
|
20
|
+
UA_Int32 raw = *(UA_Int32 *) value.data;
|
|
21
|
+
rb_ary_store(ret,0,INT2NUM(raw));
|
|
22
|
+
rb_ary_store(ret,1,ID2SYM(rb_intern("VariantType.Int32")));
|
|
23
|
+
} else if (UA_Variant_hasScalarType(&value, &UA_TYPES[UA_TYPES_INT16])) {
|
|
24
|
+
UA_Int16 raw = *(UA_Int16 *) value.data;
|
|
25
|
+
rb_ary_store(ret,0,INT2NUM(raw));
|
|
26
|
+
rb_ary_store(ret,1,ID2SYM(rb_intern("VariantType.Int16")));
|
|
27
|
+
} else if (UA_Variant_hasScalarType(&value, &UA_TYPES[UA_TYPES_UINT32])) {
|
|
28
|
+
UA_UInt32 raw = *(UA_UInt32 *) value.data;
|
|
29
|
+
rb_ary_store(ret,0,UINT2NUM(raw));
|
|
30
|
+
rb_ary_store(ret,1,ID2SYM(rb_intern("VariantType.UInt32")));
|
|
31
|
+
} else if (UA_Variant_hasScalarType(&value, &UA_TYPES[UA_TYPES_UINT16])) {
|
|
32
|
+
UA_UInt16 raw = *(UA_UInt16 *) value.data;
|
|
33
|
+
rb_ary_store(ret,0,UINT2NUM(raw));
|
|
34
|
+
rb_ary_store(ret,1,ID2SYM(rb_intern("VariantType.UInt16")));
|
|
35
|
+
} else if (UA_Variant_hasScalarType(&value, &UA_TYPES[UA_TYPES_STRING])) {
|
|
36
|
+
UA_String raw = *(UA_String *) value.data;
|
|
37
|
+
rb_ary_store(ret,0,rb_str_export_locale(rb_str_new((char *)(raw.data),raw.length)));
|
|
38
|
+
rb_ary_store(ret,1,ID2SYM(rb_intern("VariantType.String")));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return ret;
|
|
42
|
+
} //}}}
|
|
43
|
+
/* ++ */
|
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.8"
|
|
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."
|
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.8'
|
|
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-
|
|
12
|
+
date: 2019-05-07 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: daemonite
|
|
@@ -80,9 +80,12 @@ files:
|
|
|
80
80
|
- ext/opcua/client/client.c
|
|
81
81
|
- ext/opcua/client/client.h
|
|
82
82
|
- ext/opcua/client/extconf.rb
|
|
83
|
+
- ext/opcua/log_none.h
|
|
83
84
|
- ext/opcua/server/extconf.rb
|
|
84
85
|
- ext/opcua/server/server.c
|
|
85
86
|
- ext/opcua/server/server.h
|
|
87
|
+
- ext/opcua/strnautocat.h
|
|
88
|
+
- ext/opcua/values.h
|
|
86
89
|
- lib/opcua/client.rb
|
|
87
90
|
- lib/opcua/server.rb
|
|
88
91
|
- opcua.gemspec
|
|
@@ -106,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
106
109
|
version: '0'
|
|
107
110
|
requirements: []
|
|
108
111
|
rubyforge_project:
|
|
109
|
-
rubygems_version: 2.7.6
|
|
112
|
+
rubygems_version: 2.7.6.2
|
|
110
113
|
signing_key:
|
|
111
114
|
specification_version: 4
|
|
112
115
|
summary: Preliminary release of opcua (open62541) ruby bindings. C performance, Ruby
|