From 290b060f2b5377ada35e274aea15c7627be09636 Mon Sep 17 00:00:00 2001 From: Thomas Trautner Date: Tue, 7 Jan 2020 12:28:59 +0100 Subject: [PATCH] open62541 building on 64-bit systems --- README.md | 8 + example/{ => client}/bug5.rb | 2 +- example/{ => client}/client_get_sync.rb | 2 +- example/{ => client}/client_get_value.rb | 2 +- example/{ => client}/client_method.rb | 2 +- example/{ => client}/client_set_value.rb | 2 +- example/{ => client}/client_subscription.rb | 2 +- .../Example.Reference.1.0.NodeSet2.xml | 0 .../nodesets}/Opc.Ua.AutoID.1.0.NodeSet2.xml | 0 .../nodesets}/Opc.Ua.Di.1.2.NodeSet2.xml | 0 .../{ => nodeset}/server_import_nodeset.rb | 2 +- example/nodeset/small_nodeset.rb | 34 +++++ example/{ => server}/kelch.KMT | 0 example/{ => server}/server.rb | 2 +- example/{ => server}/server_deep.rb | 2 +- example/{ => server}/server_values.rb | 2 +- example/{ => server}/test.rb | 0 example/small_nodeset.rb | 11 -- ....NodeSet2.xml => Opc.Ua.thin.NodeSet2.xml} | 144 +++++++++++++++--- lib/opcua/server.rb | 2 +- 20 files changed, 179 insertions(+), 40 deletions(-) rename example/{ => client}/bug5.rb (91%) rename example/{ => client}/client_get_sync.rb (90%) rename example/{ => client}/client_get_value.rb (90%) rename example/{ => client}/client_method.rb (91%) rename example/{ => client}/client_set_value.rb (89%) rename example/{ => client}/client_subscription.rb (92%) rename example/{ => nodeset/nodesets}/Example.Reference.1.0.NodeSet2.xml (100%) rename example/{ => nodeset/nodesets}/Opc.Ua.AutoID.1.0.NodeSet2.xml (100%) rename example/{ => nodeset/nodesets}/Opc.Ua.Di.1.2.NodeSet2.xml (100%) rename example/{ => nodeset}/server_import_nodeset.rb (99%) create mode 100644 example/nodeset/small_nodeset.rb rename example/{ => server}/kelch.KMT (100%) rename example/{ => server}/server.rb (98%) rename example/{ => server}/server_deep.rb (92%) rename example/{ => server}/server_values.rb (95%) rename example/{ => server}/test.rb (100%) delete mode 100644 example/small_nodeset.rb rename lib/opcua/{Opc.Ua.tiny.NodeSet2.xml => Opc.Ua.thin.NodeSet2.xml} (95%) diff --git a/README.md b/README.md index de30e44..675acfb 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,14 @@ sudo ldconfig # update libs sudo ldconfig -p | grep libopen62541 # check if its there ``` +or on 64-bit systems: + +```sh +sudo echo "/usr/local/lib64" > /etc/ld.so.conf.d/local.conf # add to libs path +sudo ldconfig # update libs +sudo ldconfig -p | grep libopen62541 # check if its there +``` + ## Development Use rake to build c bindings: diff --git a/example/bug5.rb b/example/client/bug5.rb similarity index 91% rename from example/bug5.rb rename to example/client/bug5.rb index 85c5a01..c65c8d4 100755 --- a/example/bug5.rb +++ b/example/client/bug5.rb @@ -1,5 +1,5 @@ #!/usr/bin/ruby -require_relative '../lib/opcua/server' +require_relative '../../lib/opcua/server' Daemonite.new do server = OPCUA::Server.new diff --git a/example/client_get_sync.rb b/example/client/client_get_sync.rb similarity index 90% rename from example/client_get_sync.rb rename to example/client/client_get_sync.rb index af3ed5d..3fc8f0a 100755 --- a/example/client_get_sync.rb +++ b/example/client/client_get_sync.rb @@ -1,5 +1,5 @@ #!/usr/bin/ruby -require_relative '../lib/opcua/client' +require_relative '../../lib/opcua/client' #require 'opcua/client' ### username & pass in url (e.g. siemens) diff --git a/example/client_get_value.rb b/example/client/client_get_value.rb similarity index 90% rename from example/client_get_value.rb rename to example/client/client_get_value.rb index 2cb3ec5..20f1ef5 100755 --- a/example/client_get_value.rb +++ b/example/client/client_get_value.rb @@ -1,5 +1,5 @@ #!/usr/bin/ruby -require_relative '../lib/opcua/client' +require_relative '../../lib/opcua/client' #require 'opcua/client' ### username & pass in url (e.g. siemens) diff --git a/example/client_method.rb b/example/client/client_method.rb similarity index 91% rename from example/client_method.rb rename to example/client/client_method.rb index 1541c0d..00f1b4f 100755 --- a/example/client_method.rb +++ b/example/client/client_method.rb @@ -1,5 +1,5 @@ #!/usr/bin/ruby -require_relative '../lib/opcua/client' +require_relative '../../lib/opcua/client' #require 'opcua/client' ### username & pass in url (e.g. siemens) diff --git a/example/client_set_value.rb b/example/client/client_set_value.rb similarity index 89% rename from example/client_set_value.rb rename to example/client/client_set_value.rb index fc5b728..f495f29 100755 --- a/example/client_set_value.rb +++ b/example/client/client_set_value.rb @@ -1,5 +1,5 @@ #!/usr/bin/ruby -require_relative '../lib/opcua/client' +require_relative '../../lib/opcua/client' #require 'opcua/client' ### username & pass in url (e.g. siemens) diff --git a/example/client_subscription.rb b/example/client/client_subscription.rb similarity index 92% rename from example/client_subscription.rb rename to example/client/client_subscription.rb index 68cfcfc..2ab7146 100755 --- a/example/client_subscription.rb +++ b/example/client/client_subscription.rb @@ -1,5 +1,5 @@ #!/usr/bin/ruby -require_relative '../lib/opcua/client' +require_relative '../../lib/opcua/client' #require 'opcua/client' ### username & pass in url (e.g. siemens) diff --git a/example/Example.Reference.1.0.NodeSet2.xml b/example/nodeset/nodesets/Example.Reference.1.0.NodeSet2.xml similarity index 100% rename from example/Example.Reference.1.0.NodeSet2.xml rename to example/nodeset/nodesets/Example.Reference.1.0.NodeSet2.xml diff --git a/example/Opc.Ua.AutoID.1.0.NodeSet2.xml b/example/nodeset/nodesets/Opc.Ua.AutoID.1.0.NodeSet2.xml similarity index 100% rename from example/Opc.Ua.AutoID.1.0.NodeSet2.xml rename to example/nodeset/nodesets/Opc.Ua.AutoID.1.0.NodeSet2.xml diff --git a/example/Opc.Ua.Di.1.2.NodeSet2.xml b/example/nodeset/nodesets/Opc.Ua.Di.1.2.NodeSet2.xml similarity index 100% rename from example/Opc.Ua.Di.1.2.NodeSet2.xml rename to example/nodeset/nodesets/Opc.Ua.Di.1.2.NodeSet2.xml diff --git a/example/server_import_nodeset.rb b/example/nodeset/server_import_nodeset.rb similarity index 99% rename from example/server_import_nodeset.rb rename to example/nodeset/server_import_nodeset.rb index 0a568a1..ff3cc03 100644 --- a/example/server_import_nodeset.rb +++ b/example/nodeset/server_import_nodeset.rb @@ -1,6 +1,6 @@ #!/usr/bin/ruby # require 'opcua/server' -require_relative '../lib/opcua/server' +require_relative '../../lib/opcua/server' Daemonite.new do on startup do |opts| diff --git a/example/nodeset/small_nodeset.rb b/example/nodeset/small_nodeset.rb new file mode 100644 index 0000000..a0b00fc --- /dev/null +++ b/example/nodeset/small_nodeset.rb @@ -0,0 +1,34 @@ +require 'nokogiri' + +def is_necessary(node) + necessary = [ + "StateMachineType" + ] + find_follow(node) + false +end + +def find_follow(node) + follow = [ + "HasComponent", + "HasSubtype" + ] + node.xpath('xmlns:References/xmlns:Reference').each do |ref| + node.xpath("parent::*/*[@NodeId='#{ref.content}']").each do |fnode| + puts "lol" + end if follow.include? ref['ReferenceType'] + end + false +end + +nodeset = Nokogiri::XML(File.read(File.join(File.dirname(__FILE__), "../../lib/opcua/Opc.Ua.1.04.NodeSet2.xml"))) + +nodeset.xpath("/*/*").each do |node| + unless node.name == 'UAReferenceType' + if node['NodeId'] =~ /i=(.*)/ && $1.to_i > 1000 + node.remove unless is_necessary node + end + end +end + +File.write(File.join(File.dirname(__FILE__), "../../lib/opcua/Opc.Ua.thin.NodeSet2.xml"), nodeset.to_xml) \ No newline at end of file diff --git a/example/kelch.KMT b/example/server/kelch.KMT similarity index 100% rename from example/kelch.KMT rename to example/server/kelch.KMT diff --git a/example/server.rb b/example/server/server.rb similarity index 98% rename from example/server.rb rename to example/server/server.rb index 53a5067..76a06fe 100755 --- a/example/server.rb +++ b/example/server/server.rb @@ -1,5 +1,5 @@ #!/usr/bin/ruby -require_relative '../lib/opcua/server' +require_relative '../../lib/opcua/server' #require 'opcua/server' Daemonite.new do diff --git a/example/server_deep.rb b/example/server/server_deep.rb similarity index 92% rename from example/server_deep.rb rename to example/server/server_deep.rb index 37f60e8..bb290c8 100755 --- a/example/server_deep.rb +++ b/example/server/server_deep.rb @@ -1,5 +1,5 @@ #!/usr/bin/ruby -require_relative '../lib/opcua/server' +require_relative '../../lib/opcua/server' # require 'opcua/server' Daemonite.new do diff --git a/example/server_values.rb b/example/server/server_values.rb similarity index 95% rename from example/server_values.rb rename to example/server/server_values.rb index 0b3d4ae..38f046b 100755 --- a/example/server_values.rb +++ b/example/server/server_values.rb @@ -1,5 +1,5 @@ #!/usr/bin/ruby -require_relative '../lib/opcua/server' +require_relative '../../lib/opcua/server' #require 'opcua/server' Daemonite.new do diff --git a/example/test.rb b/example/server/test.rb similarity index 100% rename from example/test.rb rename to example/server/test.rb diff --git a/example/small_nodeset.rb b/example/small_nodeset.rb deleted file mode 100644 index d89afef..0000000 --- a/example/small_nodeset.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'nokogiri' - -nodeset = Nokogiri::XML(File.read(File.join(File.dirname(__FILE__), "../lib/opcua/Opc.Ua.1.04.NodeSet2.xml"))) - -nodeset.xpath("/*/*").each do |n| - if n.attr("NodeId") =~ /i=(.*)/ - n.remove if $1.to_i > 1000 - end -end - -File.write(File.join(File.dirname(__FILE__), "../lib/opcua/Opc.Ua.tiny.NodeSet2.xml"), nodeset.to_xml) \ No newline at end of file diff --git a/lib/opcua/Opc.Ua.tiny.NodeSet2.xml b/lib/opcua/Opc.Ua.thin.NodeSet2.xml similarity index 95% rename from lib/opcua/Opc.Ua.tiny.NodeSet2.xml rename to lib/opcua/Opc.Ua.thin.NodeSet2.xml index 176face..d35193e 100644 --- a/lib/opcua/Opc.Ua.tiny.NodeSet2.xml +++ b/lib/opcua/Opc.Ua.thin.NodeSet2.xml @@ -328,7 +328,13 @@ GeneratedBy - + + AlwaysGeneratesEvent + + i=41 + + AlwaysGeneratedBy + Aggregates @@ -1497,6 +1503,13 @@ + + HasGuard + + i=47 + + GuardOf + @@ -1839,10 +1852,31 @@ + + HasDictionaryEntry + + i=32 + + DictionaryEntryOf + + + HasInterface + + i=32 + + InterfaceOf + + + HasAddIn + + i=32 + + AddInOf + @@ -1892,6 +1926,34 @@ + + HasTrueSubState + + i=32 + + IsTrueSubStateOf + + + HasFalseSubState + + i=32 + + IsFalseSubStateOf + + + HasAlarmSuppressionGroup + + i=47 + + IsAlarmSuppressionGroupOf + + + AlarmGroupMember + + i=35 + + MemberOfAlarmGroup + @@ -2191,6 +2253,41 @@ + + HasCondition + + i=32 + + IsConditionOf + + + HasEffectDisable + + i=54 + + MayBeDisabledBy + + + HasEffectEnable + + i=54 + + MayBeEnabledBy + + + HasEffectSuppressed + + i=54 + + MayBeSuppressedBy + + + HasEffectUnsuppressed + + i=54 + + MayBeUnsuppressedBy + @@ -2983,6 +3080,13 @@ + + HasPubSubConnection + + i=47 + + PubSubConnectionOf + @@ -3006,6 +3110,13 @@ + + DataSetToWriter + + i=33 + + WriterToDataSet + @@ -3224,6 +3335,13 @@ + + HasDataSetWriter + + i=47 + + IsWriterInGroup + @@ -3293,23 +3411,13 @@ - - - - - - - - - - - - - - - - - + + HasDataSetReader + + i=47 + + IsReaderInGroup + diff --git a/lib/opcua/server.rb b/lib/opcua/server.rb index 26c4518..7deb248 100644 --- a/lib/opcua/server.rb +++ b/lib/opcua/server.rb @@ -17,7 +17,7 @@ def nodes end def import_ua - add_nodeset File.read(File.join(File.dirname(__FILE__), "Opc.Ua.tiny.NodeSet2.xml")) + add_nodeset File.read(File.join(File.dirname(__FILE__), "Opc.Ua.thin.NodeSet2.xml")) end def import_ua_full