opcua 0.14 → 0.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@ Daemonite.new do
14
14
  t.add_object :M, mt, OPCUA::MANDATORY
15
15
  }
16
16
 
17
- tools = server.objects.instantiate(:KalimatC34, tt)
17
+ tools = server.objects.manifest(:KalimatC34, tt)
18
18
 
19
19
  run do
20
20
  sleep server.run
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/ruby
2
+ require_relative '../lib/opcua/client'
3
+
4
+ client = OPCUA::Client.new("opc.tcp://128.130.57.76:4840")
5
+ client.subscription_interval = 100 # default 500
6
+
7
+ if (node = client.get 1, 'DISPLAY_VOLTAGE') # get node from nodeid
8
+ p node
9
+ p node.value
10
+ else
11
+ p 'invalid nodeid'
12
+ end
@@ -13,6 +13,9 @@ client.default_ns = 2
13
13
  # p node.call 'abcde', Time.now
14
14
  # client.disconnect
15
15
 
16
- node = client.get 0, 11492
17
- p node
18
- p node.call 2
16
+ # node = client.get 1, 62541
17
+ # p node.to_s
18
+ # p node.call 'a'
19
+
20
+ node = client.get '/KalimatC34/Tools/Tool3/testRetMethod'
21
+ p node.call 'abcde'
@@ -27,6 +27,14 @@ Daemonite.new do
27
27
  p test2
28
28
  puts '-' * 10
29
29
  end
30
+ t.add_method :testRetMethod, test1: OPCUA::TYPES::STRING, return: OPCUA::TYPES::STRING do |node, test1|
31
+ ns, nid = node.id
32
+ puts '-' * 10
33
+ p nid
34
+ p test1
35
+ puts '-' * 10
36
+ "hello world"
37
+ end
30
38
  t.add_object(:Measurements, opts['server'].types.folder).tap{ |u|
31
39
  u.add_object :M, mt, OPCUA::OPTIONAL
32
40
  }
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/ruby
2
+ require_relative '../lib/opcua/server'
3
+
4
+ srv = OPCUA::Server.new
5
+ srv.add_namespace "https://centurio.work/kelch"
6
+ p srv.typens::References
@@ -0,0 +1,40 @@
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['count'] = 500
8
+ opts['server'] = OPCUA::Server.new
9
+ opts['server'].add_namespace "https://centurio.work/kelch"
10
+
11
+ t = opts['server'].types.add_object_type(:Test).tap{ |t|
12
+ 0.upto opts['count'] do |e|
13
+ t.add_variable :"Wert#{e}"
14
+ end
15
+ }
16
+
17
+ opts['values'] = []
18
+ v = opts['server'].objects.manifest(:Tester, t)
19
+ 0.upto opts['count'] do |e|
20
+ opts['values'][e] = v.find :"Wert#{e}"
21
+ opts['values'][e].value = rand
22
+ end
23
+ rescue => e
24
+ puts e.message
25
+ end
26
+
27
+ run do |opts|
28
+ opts['server'].run
29
+ opts['values'].each do |v|
30
+ v.value = rand
31
+ end
32
+ rescue => e
33
+ puts e.message
34
+ end
35
+
36
+ on exit do
37
+ # we could disconnect here, but OPCUA::Server does not have an explicit disconnect
38
+ puts 'bye.'
39
+ end
40
+ end.loop!
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/ruby
2
+ require_relative '../lib/opcua/server'
3
+
4
+ Daemonite.new do
5
+ on startup do |opts|
6
+ srv = opts['server'] = OPCUA::Server.new
7
+ srv.import_UA # FIX
8
+ srv.import_nodeset File::read('nodeset1.xml')
9
+ srv.import_nodeset File::read('nodeset1.xml')
10
+ srv.import_nodeset File::read('nodeset1.xml')
11
+ DI = srv.imports['http://xxxxx/DI']
12
+ AID = srv.imports['http://xxxxx/AutoID']
13
+
14
+ srv.objects
15
+
16
+ # ab 106 im nodesets.rb
17
+ x = srv.data_types.add(qualifiedname,referencetype=UA::HasSubtype,nodeid=rand())
18
+ x.displayname['en-US'] = 'rrr'
19
+ x.displayname['de'] = 'rrr'
20
+ x.displayname.delete('de')
21
+
22
+ srv.data_types.bla.blurg.add(wieheissts')
23
+ srv.data_types.bla.blurg.push(wieheissts')
24
+ srv.data_types.bla.blurg.<<('wieheissts')
25
+ x = srv.data_types.bla.find name: 'bla', type: SUBXXXX
26
+ [x] = srv.data_types.bla.find_all name: 'bla', type: SUBXXXX
27
+ [x] = srv.data_types.bla.select name: 'bla', type: SUBXXXX
28
+ srv.data_types.bla.parent
29
+
30
+ # srv.event_types
31
+ # srv.interfaces_types
32
+
33
+ srv.reference_types.add(qualifiedname,symmetric,referencetype,nodeid)
34
+ srv.reference_types.add_symmetric(qualifiedname,referencetype,nodeid)
35
+
36
+ srv.variable_types
37
+ srv.object_types
38
+
39
+ p server.add_namespace "https://centurio.work/kelch"
40
+ p server.active_namespace
41
+ server.active_namespace = 0
42
+ p server.active_namespace
43
+ p server.namespaces
44
+
45
+
46
+ tools = opts['server'].objects.manifest(:KalimatC34, pt).find(:Tools)
47
+
48
+ t1 = tools.manifest(:Tool1,tt)
49
+ t2 = tools.manifest(:Tool2,tt)
50
+ t3 = tools.manifest(:Tool3,tt)
51
+
52
+ opts[:tn] = t1.find(:ToolNumber)
53
+ opts[:tn].description = 'test test'
54
+ opts[:tn].value = [0,1]
55
+ p opts[:tn].description
56
+ p opts[:tn].to_s
57
+ p opts[:tn].name
58
+
59
+ measurments_t1 = t1.find(:Measurements)
60
+ measurments_t1.manifest(:M1,mt)
61
+ m2 = measurments_t1.manifest(:M2,mt)
62
+ rescue => e
63
+ puts e.message
64
+ end
65
+
66
+
67
+ counter = 0
68
+ run do |opts|
69
+ GC.start
70
+ sleep opts['server'].run
71
+ # if counter % 100 == 0
72
+ # opts[:tn].value = [counter, counter]
73
+ # # opts[:tn].value = 1
74
+ # p opts[:tn].value
75
+ # end
76
+ # counter += 1
77
+ rescue => e
78
+ puts e.message
79
+ end
80
+
81
+ on exit do
82
+ # we could disconnect here, but OPCUA::Server does not have an explicit disconnect
83
+ puts 'bye.'
84
+ end
85
+ end.loop!
@@ -0,0 +1,22 @@
1
+ class Types
2
+ NAME = [ :TYPES ]
3
+ def self::defined?
4
+ end
5
+
6
+ def self::const_missing(name)
7
+ kelf = self
8
+ c = Class.new(Types) do
9
+ const_set :NAME, kelf::NAME << name
10
+ end
11
+ c
12
+ end
13
+ end
14
+
15
+
16
+ 1.upto 5000000 do |i|
17
+ a = Types::B::C::D
18
+ a::NAME
19
+ if i % 1000 == 0
20
+ GC::start
21
+ end
22
+ end
@@ -0,0 +1,85 @@
1
+ F_HEAD(1120403455,25,0.2,,120,1,1,8.5,-8.2,390,200,0.4,4000,6000,71,0,43663,,60,,20,6,6,100,100,100,1,205.5,,8650751,16015,2,0,6,120,0,,-100,-80,6,100,100,100,10,10,0,0,,200,50,720);*RO*
2
+ MSG("JUERGEN43")
3
+ $MAS_SPINDLE_PARAMETER[1,AX6]=31.5
4
+ F_ROUGH("SCHRUPPER-A-L","",1,0.1,3,250,2,0,54273,5,25,90,0.5,90,-0.8,90,0,90,-0.8,90,0,90,0,0,0,0,0.8,0,0.1,0,90,90,0,0,0);*RO*
5
+ F_TS("FRAESER-10-AXHS",,1,1000,1,2,5,,,0,0,0,0);*RO*
6
+ F_DRILL("FRAESER-10-AXHS","",1,200,1,3500,1,0,40,0.5,90,-2.2,90,50,85,3,5,0,17,0,100);*RO*
7
+ F_CON("HS_BOHR",4,"E_LAB_A_HS_BOHR","E_LAB_E_HS_BOHR");*RO*
8
+ F_ROU_Z("BOHRSTANGE-10/12L","",1,0.12,3,200,2,0,0,,,,"202006301043360",,,,"202006301043361",321321,0.05,10,0.2,1.5,2,0.2,0.05,0.1,0,0,0,1,10,90,0.1,90,110,,,10,,,,2,2,,,,,0,,,,0,0,0,1,1,0,0.08);*RO*
9
+ F_CON("HS",4,"E_LAB_A_HS","E_LAB_E_HS");*RO*
10
+ F_ROU_Z("SCHRUPPER-A-L","",1,0.15,3,250,2,0,0,,,,"202006301047382",,,,"202006301047383",321111,0.1,10,0.2,2,2,4.711,0.2,0.1,0,0,0,1,25,90,0.1,90,110,,,10,,,,2,2,,,,,0,,,,0,0,0,1,1,0);*RO*
11
+ F_ROU_Z("SCHLICHTER-A-L","",1,0.15,3,250,2,10,0,,,,"202006301051164","202006301047383",,,"202006301051165",311111,0.05,0.2,0.07,1,6,4.711,0.1,0.1,0,0.2,0,1,0,91,0,91,31,,1,,-41.5,,,2,2,,,,,0,,,,0,0,0,1,1,0);*RO*
12
+ F_ROU_Z("EINSTI_2N-LR-HS","",1,0.1,3,200,2,12,0,,,,"2020063011000810","202006301051165",,,"2020063011000811",301111,0.08,0.1,0.1,0.8,6,0.2,1,0.1,0,0,0,1,0,91,0,91,30,,-8,,-5,,,2,2,1,30,,,0,,,,0,0,0,1,1,0);*RO*
13
+ F_ROU_Z("EINSTI_2N-LR-HS","",1,0.1,3,200,2,12,0,,,,"2020063011011512","2020063011000811",,,"2020063011011513",301211,0.08,0.1,0.1,1,6,0.2,0.5,0.1,0,0,0,1,0,91,0,91,31,,-41.1,,-46.9,,,2,2,1,30,,,0,,,,0,0,0,1,1,0);*RO*
14
+ F_ROU_Z("SCHLICHTER-A-L","",1,0.471,3,250,2,0,0,,,,"2020063011091716",,,,"2020063011091717",311211,0.1,10,0.2,1.5,2,0.2,0.2,0.1,0,0,0,1,25,90,0.1,90,31,,1,,-41.8,,,2,2,,,,,0,,,,0,0,0,1,1,0);*RO*
15
+ F_ROU_Z("SCHLICHTER-A-L","",1,0.471,3,250,2,0,0,,,,"2020063011113318",,,,"2020063011113319",311211,0.1,10,0.2,1.5,2,0.2,0.2,0.1,0,0,0,1,25,90,0.1,90,23,21,-46,,-53,,,2,2,,,,,0,,,,0,0,0,1,1,0);*RO*
16
+ F_TS("EINSTICH-ABSTICH3",,1,,0,1,5,,,0,0,0,0);*RO*
17
+ F_SUB_SP(11004,3,50,0,-29,1,90,1500,2000,2,-50,0,720,100,-50,,2,,0);*RO*
18
+ F_PARTOF("EINSTICH-ABSTICH3","",1,0.08,3,200,2,0,22,-50.1,1,90,0,90,0,1500,0.04,0.2,0,4000,0,0,0,1);*RO*
19
+ F_ROUGH("SCHLICHTER-A-R","",1,0.08,3,250,2,0,46082,5,22,90,0.2,90,-1,90,0,90,-1,90,0,90,0,0,0,0.4,0.2,0.1,0,1,90,90,0,0,0);*RO*
20
+ F_TS("SCHRUPPER-A-R",,1,,0,1,5,,,0,0,0,0);*RO*
21
+ M9
22
+ G0 D0 G53 X431.4;X431.4
23
+ G53 D0 Z601.5 C2=0;Z601.5
24
+ ;M2=25 M9 ;M2=71
25
+ G04 F1
26
+ ENDE:M30
27
+ F_END(0,1,0);*RO*
28
+ M30 ;#SM;*RO*
29
+ E_LAB_A_HS: ;#SM Z:2
30
+ ;#7__DlgK contour definition begin - Don't change!;*GP*;*RO*;*HD*
31
+ G18 G90 DIAM90;*GP*
32
+ G0 Z0 X16 ;*GP*
33
+ G1 X22 RND=.4 ;*GP*
34
+ Z-5.2 RND=.4 ;*GP*
35
+ G2 Z-24.8 K=AC(-15) I=AC(67.998) RND=.4 ;*GP*
36
+ G1 Z-30.67 RND=.4 ;*GP*
37
+ Z-35 X17 RND=.8 ;*GP*
38
+ Z-39.33 X22 RND=.4 ;*GP*
39
+ Z-41.5 RND=.04 ;*GP*
40
+ X16 RND=.4 ;*GP*
41
+ Z-46.5 RND=.4 ;*GP*
42
+ X22 RND=.4 ;*GP*
43
+ Z-53.3 ;*GP*
44
+ X25 ;*GP*
45
+ ;CON,V64,2,0.0000,12,12,MST:3,2,AX:Z,X,K,I,TRANS:0;*GP*;*RO*;*HD*
46
+ ;S,EX:0,EY:16,ASE:90;*GP*;*RO*;*HD*
47
+ ;R,RROUND:0;*GP*;*RO*;*HD*
48
+ ;LU,EY:22;*GP*;*RO*;*HD*
49
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
50
+ ;LL,EX:-5.2;*GP*;*RO*;*HD*
51
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
52
+ ;ACW,DIA:0/235,EX:-24.8,EY:22,RAD:25;*GP*;*RO*;*HD*
53
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
54
+ ;LL,EX:-30.67;*GP*;*RO*;*HD*
55
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
56
+ ;LA,EX:-35,EY:17;*GP*;*RO*;*HD*
57
+ ;R,RROUND:.8;*GP*;*RO*;*HD*
58
+ ;LA,EX:-39.33,EY:22;*GP*;*RO*;*HD*
59
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
60
+ ;LL,EX:-41.5;*GP*;*RO*;*HD*
61
+ ;R,RROUND:.04;*GP*;*RO*;*HD*
62
+ ;LD,EY:16;*GP*;*RO*;*HD*
63
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
64
+ ;LL,EX:-46.5;*GP*;*RO*;*HD*
65
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
66
+ ;LU,EY:22;*GP*;*RO*;*HD*
67
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
68
+ ;LL,EX:-53.3;*GP*;*RO*;*HD*
69
+ ;LU,EY:25;*GP*;*RO*;*HD*
70
+ ;#End contour definition end - Don't change!;*GP*;*RO*;*HD*
71
+ E_LAB_E_HS:
72
+ E_LAB_A_HS_BOHR: ;#SM Z:2
73
+ ;#7__DlgK contour definition begin - Don't change!;*GP*;*RO*;*HD*
74
+ G18 G90 DIAM90;*GP*
75
+ G0 Z0 X17.8 ;*GP*
76
+ G1 X17 RND=.4 ;*GP*
77
+ Z-2 ;*GP*
78
+ X9 ;*GP*
79
+ ;CON,V64,2,0.0000,2,2,MST:3,2,AX:Z,X,K,I,TRANS:0;*GP*;*RO*;*HD*
80
+ ;S,EX:0,EY:17,ASE:270;*GP*;*RO*;*HD*
81
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
82
+ ;LL,EX:-2;*GP*;*RO*;*HD*
83
+ ;LD,EY:9;*GP*;*RO*;*HD*
84
+ ;#End contour definition end - Don't change!;*GP*;*RO*;*HD*
85
+ E_LAB_E_HS_BOHR:
@@ -0,0 +1,12 @@
1
+ class A
2
+ Ref = 12
3
+
4
+ def initialize
5
+
6
+ end
7
+ end
8
+
9
+ a = A.new
10
+
11
+
12
+
@@ -0,0 +1,85 @@
1
+ F_HEAD(1120403455,25,0.2,,120,1,1,8.5,-8.2,390,200,0.4,4000,6000,71,0,43663,,60,,20,6,6,100,100,100,1,205.5,,8650751,16015,2,0,6,120,0,,-100,-80,6,100,100,100,10,10,0,0,,200,50,720);*RO*
2
+ MSG("JUERGEN1")
3
+ $MAS_SPINDLE_PARAMETER[1,AX6]=31.5
4
+ F_ROUGH("SCHRUPPER-A-L","",1,0.1,3,250,2,0,54273,5,25,90,0.5,90,-0.8,90,0,90,-0.8,90,0,90,0,0,0,0,0.8,0,0.1,0,90,90,0,0,0);*RO*
5
+ F_TS("FRAESER-10-AXHS",,1,1000,1,2,5,,,0,0,0,0);*RO*
6
+ F_DRILL("FRAESER-10-AXHS","",1,200,1,3500,1,0,40,0.5,90,-2.2,90,50,85,3,5,0,17,0,100);*RO*
7
+ F_CON("HS_BOHR",4,"E_LAB_A_HS_BOHR","E_LAB_E_HS_BOHR");*RO*
8
+ F_ROU_Z("BOHRSTANGE-10/12L","",1,0.12,3,200,2,0,0,,,,"202006301043360",,,,"202006301043361",321321,0.05,10,0.2,1.5,2,0.2,0.05,0.1,0,0,0,1,10,90,0.1,90,110,,,10,,,,2,2,,,,,0,,,,0,0,0,1,1,0,0.08);*RO*
9
+ F_CON("HS",4,"E_LAB_A_HS","E_LAB_E_HS");*RO*
10
+ F_ROU_Z("SCHRUPPER-A-L","",1,0.15,3,250,2,0,0,,,,"202006301047382",,,,"202006301047383",321111,0.1,10,0.2,2,2,4.711,0.2,0.1,0,0,0,1,25,90,0.1,90,110,,,10,,,,2,2,,,,,0,,,,0,0,0,1,1,0);*RO*
11
+ F_ROU_Z("SCHLICHTER-A-L","",1,0.15,3,250,2,10,0,,,,"202006301051164","202006301047383",,,"202006301051165",311111,0.05,0.2,0.07,1,6,4.711,0.1,0.1,0,0.2,0,1,0,91,0,91,31,,1,,-41.5,,,2,2,,,,,0,,,,0,0,0,1,1,0);*RO*
12
+ F_ROU_Z("EINSTI_2N-LR-HS","",1,0.1,3,200,2,12,0,,,,"2020063011000810","202006301051165",,,"2020063011000811",301111,0.08,0.1,0.1,0.8,6,0.2,1,0.1,0,0,0,1,0,91,0,91,30,,-8,,-5,,,2,2,1,30,,,0,,,,0,0,0,1,1,0);*RO*
13
+ F_ROU_Z("EINSTI_2N-LR-HS","",1,0.1,3,200,2,12,0,,,,"2020063011011512","2020063011000811",,,"2020063011011513",301211,0.08,0.1,0.1,1,6,0.2,0.5,0.1,0,0,0,1,0,91,0,91,31,,-41.1,,-46.9,,,2,2,1,30,,,0,,,,0,0,0,1,1,0);*RO*
14
+ F_ROU_Z("SCHLICHTER-A-L","",1,0.471,3,250,2,0,0,,,,"2020063011091716",,,,"2020063011091717",311211,0.1,10,0.2,1.5,2,0.2,0.2,0.1,0,0,0,1,25,90,0.1,90,31,,1,,-41.8,,,2,2,,,,,0,,,,0,0,0,1,1,0);*RO*
15
+ F_ROU_Z("SCHLICHTER-A-L","",1,0.471,3,250,2,0,0,,,,"2020063011113318",,,,"2020063011113319",311211,0.1,10,0.2,1.5,2,0.2,0.2,0.1,0,0,0,1,25,90,0.1,90,23,21,-46,,-53,,,2,2,,,,,0,,,,0,0,0,1,1,0);*RO*
16
+ F_TS("EINSTICH-ABSTICH3",,1,,0,1,5,,,0,0,0,0);*RO*
17
+ F_SUB_SP(11004,3,50,0,-29,1,90,1500,2000,2,-50,0,720,100,-50,,2,,0);*RO*
18
+ F_PARTOF("EINSTICH-ABSTICH3","",1,0.08,3,200,2,0,22,-50.1,1,90,0,90,0,1500,0.04,0.2,0,4000,0,0,0,1);*RO*
19
+ F_ROUGH("SCHLICHTER-A-R","",1,0.08,3,250,2,0,46082,5,22,90,0.2,90,-1,90,0,90,-1,90,0,90,0,0,0,0.4,0.2,0.1,0,1,90,90,0,0,0);*RO*
20
+ F_TS("SCHRUPPER-A-R",,1,,0,1,5,,,0,0,0,0);*RO*
21
+ M9
22
+ G0 D0 G53 X431.4;X431.4
23
+ G53 D0 Z601.5 C2=0;Z601.5
24
+ ;M2=25 M9 ;M2=71
25
+ G04 F1
26
+ ENDE:M30
27
+ F_END(0,1,0);*RO*
28
+ M30 ;#SM;*RO*
29
+ E_LAB_A_HS: ;#SM Z:2
30
+ ;#7__DlgK contour definition begin - Don't change!;*GP*;*RO*;*HD*
31
+ G18 G90 DIAM90;*GP*
32
+ G0 Z0 X16 ;*GP*
33
+ G1 X22 RND=.4 ;*GP*
34
+ Z-5.2 RND=.4 ;*GP*
35
+ G2 Z-24.8 K=AC(-15) I=AC(67.998) RND=.4 ;*GP*
36
+ G1 Z-30.67 RND=.4 ;*GP*
37
+ Z-35 X17 RND=.8 ;*GP*
38
+ Z-39.33 X22 RND=.4 ;*GP*
39
+ Z-41.5 RND=.04 ;*GP*
40
+ X16 RND=.4 ;*GP*
41
+ Z-46.5 RND=.4 ;*GP*
42
+ X22 RND=.4 ;*GP*
43
+ Z-53.3 ;*GP*
44
+ X25 ;*GP*
45
+ ;CON,V64,2,0.0000,12,12,MST:3,2,AX:Z,X,K,I,TRANS:0;*GP*;*RO*;*HD*
46
+ ;S,EX:0,EY:16,ASE:90;*GP*;*RO*;*HD*
47
+ ;R,RROUND:0;*GP*;*RO*;*HD*
48
+ ;LU,EY:22;*GP*;*RO*;*HD*
49
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
50
+ ;LL,EX:-5.2;*GP*;*RO*;*HD*
51
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
52
+ ;ACW,DIA:0/235,EX:-24.8,EY:22,RAD:25;*GP*;*RO*;*HD*
53
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
54
+ ;LL,EX:-30.67;*GP*;*RO*;*HD*
55
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
56
+ ;LA,EX:-35,EY:17;*GP*;*RO*;*HD*
57
+ ;R,RROUND:.8;*GP*;*RO*;*HD*
58
+ ;LA,EX:-39.33,EY:22;*GP*;*RO*;*HD*
59
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
60
+ ;LL,EX:-41.5;*GP*;*RO*;*HD*
61
+ ;R,RROUND:.04;*GP*;*RO*;*HD*
62
+ ;LD,EY:16;*GP*;*RO*;*HD*
63
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
64
+ ;LL,EX:-46.5;*GP*;*RO*;*HD*
65
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
66
+ ;LU,EY:22;*GP*;*RO*;*HD*
67
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
68
+ ;LL,EX:-53.3;*GP*;*RO*;*HD*
69
+ ;LU,EY:25;*GP*;*RO*;*HD*
70
+ ;#End contour definition end - Don't change!;*GP*;*RO*;*HD*
71
+ E_LAB_E_HS:
72
+ E_LAB_A_HS_BOHR: ;#SM Z:2
73
+ ;#7__DlgK contour definition begin - Don't change!;*GP*;*RO*;*HD*
74
+ G18 G90 DIAM90;*GP*
75
+ G0 Z0 X17.8 ;*GP*
76
+ G1 X17 RND=.4 ;*GP*
77
+ Z-2 ;*GP*
78
+ X9 ;*GP*
79
+ ;CON,V64,2,0.0000,2,2,MST:3,2,AX:Z,X,K,I,TRANS:0;*GP*;*RO*;*HD*
80
+ ;S,EX:0,EY:17,ASE:270;*GP*;*RO*;*HD*
81
+ ;R,RROUND:.4;*GP*;*RO*;*HD*
82
+ ;LL,EX:-2;*GP*;*RO*;*HD*
83
+ ;LD,EY:9;*GP*;*RO*;*HD*
84
+ ;#End contour definition end - Don't change!;*GP*;*RO*;*HD*
85
+ E_LAB_E_HS_BOHR:
@@ -0,0 +1,13 @@
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:SUNRISE1@localhost:4840")
7
+
8
+ #node = client.get 2, '/Methods/CopyFileToServer'
9
+ #prog = File.read('test.mpf')
10
+ #p node.call 'Sinumerik/FileSystem/Work Pieces/CDP/TURM_PSC.MPF', prog, true
11
+
12
+ node = client.get 2, '/Methods/CopyFileFromServer '
13
+ puts node.call 'Sinumerik/FileSystem/Work Pieces/CDP/TURM_PSC.MPF'
@@ -502,7 +502,11 @@ static VALUE node_call(int argc, VALUE* argv, VALUE self) { //{{{
502
502
  Data_Get_Struct(self, node_struct, ns);
503
503
 
504
504
  UA_NodeId parent;
505
- client_node_get_reference_by_type(ns->master->master, ns->id, UA_NODEID_NUMERIC(0,UA_NS0ID_HASCOMPONENT), &parent, true);
505
+ if (!client_node_get_reference_by_type(ns->master->master, ns->id, UA_NODEID_NUMERIC(0,UA_NS0ID_HASCOMPONENT), &parent, true)) {
506
+ if (!client_node_get_reference_by_type(ns->master->master, ns->id, UA_NODEID_NUMERIC(0,UA_NS0ID_HASORDEREDCOMPONENT), &parent, true)) {
507
+ rb_raise(rb_eRuntimeError, "Cant find parent node, neither hascomponent nor hasorderedcomponent is there!");
508
+ }
509
+ }
506
510
 
507
511
  UA_NodeId ia;
508
512
  client_node_get_reference_by_name(ns->master->master, ns->id, UA_QUALIFIEDNAME(0,"InputArguments"), &ia, false);
@@ -525,21 +529,27 @@ static VALUE node_call(int argc, VALUE* argv, VALUE self) { //{{{
525
529
  value_to_variant(RARRAY_AREF(splat, i),&inputArguments[i],proposal[i]);
526
530
  }
527
531
 
532
+ size_t outputSize;
533
+ UA_Variant *output;
534
+
528
535
  retval = UA_Client_call(
529
536
  ns->master->master,
530
537
  parent,
531
538
  ns->id,
532
539
  RARRAY_LEN(splat),
533
540
  (UA_Variant *)&inputArguments,
534
- 0,
535
- NULL
541
+ &outputSize,
542
+ &output
536
543
  );
537
544
 
538
-
539
- if(retval == UA_STATUSCODE_GOOD) {
540
- return Qtrue;
545
+ if (retval == UA_STATUSCODE_GOOD && outputSize > 0) {
546
+ VALUE ret = rb_ary_new2(outputSize);
547
+ for (int i=0; i<outputSize; i++) {
548
+ rb_ary_store(ret,i,rb_ary_entry(extract_value(output[i]),0));
549
+ }
550
+ return rb_ary_entry(ret,0);
541
551
  } else {
542
- return Qfalse;
552
+ return Qnil;
543
553
  }
544
554
  } //}}}
545
555
 
@@ -621,7 +631,7 @@ void Init_client(void) {
621
631
  cMethodNode = rb_define_class_under(cClient, "cMethodNode", cNode);
622
632
  cVarNode = rb_define_class_under(cClient, "cVarNode", cNode);
623
633
 
624
- Init_types();
634
+ Init_types(mOPCUA);
625
635
 
626
636
  rb_define_alloc_func(cClient, client_alloc);
627
637
  rb_define_method(cClient, "initialize", client_init, 3);