opcua 0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c05caea956fbd579ec55c4b67a461b5af27778b2668547b611489e17ef732133
4
+ data.tar.gz: 8f1b04172329e0e886dea7352ed76713c3a29d16462d3e20dd14922e5d0718f6
5
+ SHA512:
6
+ metadata.gz: 1cbf9155c1ff412538808c41cc70b9b89c5a6385aae5828b0327bc7c3d3df225d105f9f81ebd1120ab0b445aeb93f572e5aa8d3e65174d1969c6344faf6ad8c7
7
+ data.tar.gz: cd845c266988c49f09e2a6f0d1f915dfec6099180a65d9df847362cd099a5a4314ed1982ae948f71414ff09f551ced9912621ddf53595eeae66e7d3514e0d820
data/COPYING ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # OPCUA Ruby Bindings
2
+
3
+ Copyright (C) 2019-* Jürgen "eTM" Mangler <juergen.mangler@gmail.com>.
4
+
5
+ ui-scaler.html is freely distributable according to the terms of the GNU Lesser
6
+ General Public License 3.0 (see the file 'COPYING').
7
+
8
+ This code is distributed without any warranty. See the file 'COPYING' for
9
+ details.
10
+
11
+ ## Installation
12
+
13
+ Dependency: https://github.com/open62541/open62541 >= 0.4
14
+
15
+ ```sh
16
+ git clone https://github.com/open62541/open62541.git
17
+ cd open62541
18
+ mkdir build
19
+ cd build
20
+ cmake ..
21
+ ccmake ..
22
+ # Configuration, see picture below
23
+ make
24
+ sudo make install
25
+ gem install opcua
26
+ ```
27
+
28
+ ![ccmake Config](config.png)
29
+
30
+ ## EXAMPLES
31
+
32
+ TBD. See examples subdirectory.
data/Rakefile ADDED
@@ -0,0 +1,33 @@
1
+ require 'rubygems/package_task'
2
+ require 'rake/extensiontask'
3
+
4
+ spec = eval(File.read('opcua.gemspec'))
5
+
6
+ puts `cert/generate_certificate.sh`
7
+
8
+ spec.extensions.each do |f|
9
+ Rake.application.clear
10
+
11
+ task :default => [:compile]
12
+
13
+ t = Rake::ExtensionTask.new "opcua/" + File.basename(File.dirname(f)), spec
14
+ Rake::Task[:default].invoke
15
+ end
16
+ Rake.application.clear
17
+
18
+ task :default => [:gem]
19
+
20
+ Gem::PackageTask.new(spec) do |pkg|
21
+ pkg.need_zip = true
22
+ pkg.need_tar = true
23
+ `rm pkg/* -rf`
24
+ `ln -sf #{pkg.name}.gem #{pkg.package_dir}/#{spec.name}.gem`
25
+ end
26
+
27
+ task :push => :gem do |r|
28
+ `gem push pkg/opcua.gem`
29
+ end
30
+
31
+ task :install => :gem do |r|
32
+ `gem install pkg/opcua.gem`
33
+ end
data/example/client.rb ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/ruby
2
+ require_relative '../lib/opcua/client'
3
+
4
+ ### username & pass in url
5
+ # client = OPCUA::Client.new("opc.tcp://OpcUaClient:SUNRISE@localhost:4840")
6
+
7
+ client = OPCUA::Client.new("opc.tcp://localhost:4840")
8
+
9
+ node = client.get 2, 874565491
10
+ node.on_change do |value,timestamp|
11
+ p value
12
+ end
13
+
14
+ client.publishing_interval = 100
15
+ while true
16
+ client.check_subscription
17
+ sleep client.publishing_interval / 1000
18
+ end
data/example/kelch.KMT ADDED
@@ -0,0 +1,28 @@
1
+ ; 20.02.2019 15:20:54
2
+ #ST
3
+ #WZ 1
4
+ #MP 1
5
+ #G1 -49.427
6
+ #G2 -114.815
7
+ #WZ 2
8
+ #WT Testwkz
9
+ #AA HSK 63
10
+ #GR .\0102s.plt
11
+ #GZ .\120grad.plt
12
+ #MA HT65PM
13
+ #MF HSK63
14
+ #MS 2
15
+ #ZA 120
16
+ #ZW 100
17
+ #MP 1
18
+ #G1 -44.345
19
+ #G2 -94.533
20
+ #MP 2
21
+ #G1 -44.345
22
+ #G2 -94.533
23
+ #WZ CNC-Test
24
+ #MP 1
25
+ #MK CNCTest.par
26
+
27
+ #EN
28
+
data/example/server.rb ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/ruby
2
+ require_relative '../lib/opcua/server'
3
+
4
+ Daemonite.new do
5
+ server = OPCUA::Server.new
6
+ server.add_namespace "https://centurio.work/kelch"
7
+
8
+ mt = server.types.add_object_type(:MeasurementType).tap{ |t|
9
+ t.add_variable :SollWertX
10
+ t.add_variable :SollWertY
11
+ t.add_variable :SollWertZ
12
+ }
13
+ tt = server.types.add_object_type(:ToolType).tap{ |t|
14
+ t.add_variable :ToolNumber
15
+ t.add_variable :DuploNumber
16
+ t.add_variable :testValue1
17
+ t.add_object(:Measurements, server.types.folder).tap{ |u|
18
+ u.add_object :M, mt, OPCUA::OPTIONALPLACEHOLDER
19
+ }
20
+ }
21
+ pt = server.types.add_object_type(:PresetterType).tap{ |t|
22
+ t.add_variable :ManufacturerName
23
+ t.add_object(:Tools, server.types.folder).tap{ |u|
24
+ u.add_object :Tool, tt, OPCUA::OPTIONALPLACEHOLDER
25
+ }
26
+ }
27
+
28
+ tools = server.objects.instantiate(:KalimatC34, pt).find(:Tools)
29
+
30
+ t1 = tools.instantiate(:Tool1,tt)
31
+ t2 = tools.instantiate(:Tool2,tt)
32
+ t3 = tools.instantiate(:Tool3,tt)
33
+
34
+ tn = t1.find(:ToolNumber)
35
+
36
+ measurments_t1 = t1.find(:Measurements)
37
+ measurments_t1.instantiate(:M1,mt)
38
+ measurments_t1.instantiate(:M2,mt)
39
+
40
+ p tn.id
41
+
42
+ run do
43
+ sleep server.run
44
+ tn.value = Time.now
45
+ end
46
+ end.loop!
data/example/test.rb ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/ruby
2
+
3
+
4
+ tools = {}
5
+ active = false
6
+ current = nil
7
+ File.read('kelch.KMT').lines.each do |l|
8
+ l.chop!
9
+ next if l.empty?
10
+ if l == "#ST"
11
+ active = true
12
+ next
13
+ end
14
+ active = false if l == "#EN"
15
+ if active
16
+ parts = l.split(' ',2)
17
+ if parts[0] == '#WZ'
18
+ current = parts[1]
19
+ tools[current] = {}
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,9 @@
1
+ require 'mkmf'
2
+
3
+ spec = eval(File.read(__dir__ + '/../../../opcua.gemspec'))
4
+
5
+ $CFLAGS = '-g -Wall ' + $CFLAGS
6
+ $CFLAGS << ''
7
+ $LDFLAGS << ' -lopen62541'
8
+ dir_config('client')
9
+ create_makefile('client')
@@ -0,0 +1,9 @@
1
+ require 'mkmf'
2
+
3
+ spec = eval(File.read(__dir__ + '/../../../opcua.gemspec'))
4
+
5
+ $CFLAGS = '-g -Wall ' + $CFLAGS
6
+ $CFLAGS << ''
7
+ $LDFLAGS << ' -lopen62541'
8
+ dir_config('server')
9
+ create_makefile('server')
@@ -0,0 +1,15 @@
1
+ require_relative 'client.so'
2
+
3
+ module OPCUA
4
+ class Client
5
+ alias_method :initialize_base, :initialize
6
+
7
+ def initialize(url)
8
+ if url =~ /(^[^:]+):\/\/([^:]+):([^@]+)@(.*)$/
9
+ initialize_base("#{$1}://#{$4}",$2,$3)
10
+ else
11
+ initialize_base(url,nil,nil)
12
+ end
13
+ end
14
+ end
15
+ end
Binary file
@@ -0,0 +1,2 @@
1
+ require_relative 'server.so'
2
+ require 'daemonite'
Binary file
data/opcua.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "opcua"
3
+ s.version = "0.1"
4
+ s.platform = Gem::Platform::RUBY
5
+ s.license = "LGPL-3.0"
6
+ s.summary = "Preliminary release of cloud process execution engine (cpee). If you just need workflow execution, without a rest/xmpp service exposing it, then use WEEL"
7
+
8
+ s.description = "see http://centurio.work"
9
+
10
+ s.files = Dir['{example/**/*,tools/**/*,lib/**/*,contrib/logo*}'] + %w(COPYING Rakefile opcua.gemspec README.md)
11
+ s.extensions = Dir["ext/**/extconf.rb"]
12
+ p s.extensions
13
+ s.require_path = 'lib'
14
+ s.extra_rdoc_files = ['README.md']
15
+ s.bindir = 'tools'
16
+
17
+ s.required_ruby_version = '>=2.3.0'
18
+
19
+ s.authors = ['Juergen eTM Mangler','Florian Pauker']
20
+
21
+ s.email = 'juergen.mangler@gmail.com'
22
+ s.homepage = 'http://centurio.work/'
23
+
24
+ s.add_runtime_dependency 'riddl', '~> 0.99'
25
+ s.add_development_dependency 'rake-compiler', '~> 1.0'
26
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: opcua
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Juergen eTM Mangler
8
+ - Florian Pauker
9
+ autorequire:
10
+ bindir: tools
11
+ cert_chain: []
12
+ date: 2019-04-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: riddl
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '0.99'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '0.99'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake-compiler
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.0'
42
+ description: see http://centurio.work
43
+ email: juergen.mangler@gmail.com
44
+ executables: []
45
+ extensions:
46
+ - ext/opcua/server/extconf.rb
47
+ - ext/opcua/client/extconf.rb
48
+ extra_rdoc_files:
49
+ - README.md
50
+ files:
51
+ - COPYING
52
+ - README.md
53
+ - Rakefile
54
+ - example/client.rb
55
+ - example/kelch.KMT
56
+ - example/server.rb
57
+ - example/test.rb
58
+ - ext/opcua/client/extconf.rb
59
+ - ext/opcua/server/extconf.rb
60
+ - lib/opcua/client.rb
61
+ - lib/opcua/client.so
62
+ - lib/opcua/server.rb
63
+ - lib/opcua/server.so
64
+ - opcua.gemspec
65
+ homepage: http://centurio.work/
66
+ licenses:
67
+ - LGPL-3.0
68
+ metadata: {}
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: 2.3.0
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project:
85
+ rubygems_version: 2.7.6
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: Preliminary release of cloud process execution engine (cpee). If you just
89
+ need workflow execution, without a rest/xmpp service exposing it, then use WEEL
90
+ test_files: []