cpee-handlerwrapper-opcua 0.7 → 0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c53decc037d22d3802022844c8483b9e680121f36e28ad05ce3e3250126de6ef
4
- data.tar.gz: 999c8f9bd81fc344214559f82ab0e53b88212c4a49d37de1deb066ae0cf85905
3
+ metadata.gz: e84fc2efc66940913cc6999d05718b5b223099564e71f22e0458ccb51f7214d9
4
+ data.tar.gz: e81ee33294128cb96b9666f37681330abe582354ba43513c73da5dc68e5e6b4f
5
5
  SHA512:
6
- metadata.gz: 5f6f022ce8b077f2fa01ed2527f4a007847d97b63982b5334f9febd76f8829d4ff04ac250ac8bb320e786f7bac88ca9e1007c7872a183f45778dc046e000213b
7
- data.tar.gz: a1560af1df4d1eb928717ba8b6c200c2929266df7af7ba31d0a3a9066c6ee67cd8c3ae1167eaa76a13b373621a8d4e2af18efe7250e66dd2d970bec78326b394
6
+ metadata.gz: 9d73fae87eb2d62304d1644c2cd9ab5575b6bc7df37c8a57e1f07eda92175283646c654d3f5124acbc27526989912d2ce442b3e315d50fc4295e154fb3b7b1b1
7
+ data.tar.gz: 25581c7d42a66227a413fd287b3232e516965006e939d8d71df3aeb4d615360340f9ee217716ce6d69b7bdbd1e5a9138bccf29ddd79cce67f75561dfee8a33a7
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-handlerwrapper-opcua"
3
- s.version = "0.7"
3
+ s.version = "0.12"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "OPCUA for CPEE HandlerWrapper. Use opc.tcp-read|write|exececute:// links."
@@ -45,6 +45,7 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
45
45
  @handler_passthrough = nil
46
46
  @handler_returnValue = nil
47
47
  @handler_returnOptions = nil
48
+ @handler_activity_uuid = Digest::MD5.hexdigest(Kernel::rand().to_s)
48
49
  @label = ''
49
50
  end # }}}
50
51
 
@@ -66,6 +67,10 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
66
67
  params
67
68
  end #}}}
68
69
 
70
+ def additional
71
+ { :attributes => @controller.attributes_translated } rescue {}
72
+ end
73
+
69
74
  def proto_curl(parameters) #{{{
70
75
  params = []
71
76
  callback = Digest::MD5.hexdigest(Kernel::rand().to_s)
@@ -73,14 +78,14 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
73
78
  if s.respond_to?(:mimetype)
74
79
  params << Riddl::Parameter::Complex.new(s.name.to_s,v.mimetype,v.value)
75
80
  else
76
- if s.name.to_s =~ /^__Q_/
77
- params << Riddl::Parameter::Simple.new(s.name.to_s.sub(/^__Q_/,''),CPEE::ValueHelper::generate(s.value),:query)
78
- elsif s.name.to_s =~ /^__B_/
79
- params << Riddl::Parameter::Simple.new(s.name.to_s.sub(/^__B_/,''),CPEE::ValueHelper::generate(s.value),:body)
80
- elsif s.name.to_s =~ /^__H_/
81
- params << Riddl::Header.new(s.name.to_s.sub(/^__H_/,''),CPEE::ValueHelper::generate(s.value))
82
- elsif s.name.to_s =~ /^__C_/
83
- params << Riddl::Parameter::Complex.new(s.name.to_s.sub(/^__C_/,''),*CPEE::ValueHelper::generate(s.value).split(';',2))
81
+ if s.name.to_s =~ /^_Q_/
82
+ params << Riddl::Parameter::Simple.new(s.name.to_s.sub(/^_Q_/,''),CPEE::ValueHelper::generate(s.value),:query)
83
+ elsif s.name.to_s =~ /^_B_/
84
+ params << Riddl::Parameter::Simple.new(s.name.to_s.sub(/^_B_/,''),CPEE::ValueHelper::generate(s.value),:body)
85
+ elsif s.name.to_s =~ /^_H_/
86
+ params << Riddl::Header.new(s.name.to_s.sub(/^_H_/,''),CPEE::ValueHelper::generate(s.value))
87
+ elsif s.name.to_s =~ /^_C_/
88
+ params << Riddl::Parameter::Complex.new(s.name.to_s.sub(/^_C_/,''),*CPEE::ValueHelper::generate(s.value).split(';',2))
84
89
  else
85
90
  params << Riddl::Parameter::Simple.new(s.name.to_s,CPEE::ValueHelper::generate(s.value))
86
91
  end
@@ -116,7 +121,7 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
116
121
  callback([ Riddl::Parameter::Complex.new('error','application/json',StringIO.new(JSON::generate({ 'status' => status, 'error' => c }))) ], headers)
117
122
  else
118
123
  if headers['CPEE_INSTANTIATION']
119
- @controller.notify("task/instantiation", :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :endpoint => @handler_endpoint, :received => CPEE::ValueHelper.parse(headers['CPEE_INSTANTIATION']), :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
124
+ @controller.notify("task/instantiation", :activity_uuid => @handler_activity_uuid, :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :endpoint => @handler_endpoint, :received => CPEE::ValueHelper.parse(headers['CPEE_INSTANTIATION']), :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
120
125
  end
121
126
  if headers['CPEE_CALLBACK'] && headers['CPEE_CALLBACK'] == 'true' && result.any?
122
127
  headers['CPEE_UPDATE'] = true
@@ -198,7 +203,7 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
198
203
  @sensors = parameters.dig(:stream,:sensors)
199
204
  @aggregators = parameters.dig(:stream,:aggregators)
200
205
  @costs = parameters.dig(:stream,:costs)
201
- @controller.notify("activity/calling", :instance => @controller.instance, :instance_uuid => @controller.uuid, :label => @label, :instance_name => @controller.info, :activity => @handler_position, :passthrough => passthrough, :endpoint => @handler_endpoint, :parameters => parameters, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
206
+ @controller.notify("activity/calling", :activity_uuid => @handler_activity_uuid, :instance => @controller.instance, :instance_uuid => @controller.uuid, :label => @label, :instance_name => @controller.info, :activity => @handler_position, :passthrough => passthrough, :endpoint => @handler_endpoint, :parameters => parameters, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
202
207
  if passthrough.to_s.empty?
203
208
  if @handler_endpoint.start_with?('opc.tcp')
204
209
  proto_opcua parameters
@@ -235,36 +240,36 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
235
240
  end # }}}
236
241
 
237
242
  def inform_activity_done # {{{
238
- @controller.notify("activity/done", :endpoint => @handler_endpoint, :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
243
+ @controller.notify("activity/done", :activity_uuid => @handler_activity_uuid, :endpoint => @handler_endpoint, :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
239
244
  end # }}}
240
245
  def inform_activity_manipulate # {{{
241
- @controller.notify("activity/manipulating", :endpoint => @handler_endpoint, :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
246
+ @controller.notify("activity/manipulating", :activity_uuid => @handler_activity_uuid, :endpoint => @handler_endpoint, :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
242
247
  end # }}}
243
248
  def inform_activity_failed(err) # {{{
244
249
  puts err.message
245
250
  puts err.backtrace
246
- @controller.notify("activity/failed", :endpoint => @handler_endpoint, :label => @label, :instance_name => @controller.info, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :message => err.message, :line => err.backtrace[0].match(/(.*?):(\d+):/)[2], :where => err.backtrace[0].match(/(.*?):(\d+):/)[1], :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
251
+ @controller.notify("activity/failed", :activity_uuid => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :instance_name => @controller.info, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :message => err.message, :line => err.backtrace[0].match(/(.*?):(\d+):/)[2], :where => err.backtrace[0].match(/(.*?):(\d+):/)[1], :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
247
252
  end # }}}
248
253
  def inform_manipulate_change(status,changed_dataelements,changed_endpoints,dataelements,endpoints) # {{{
249
254
  unless status.nil?
250
255
  @controller.serialize_status!
251
- @controller.notify("status/change", :endpoint => @handler_endpoint, :label => @label, :instance_name => @controller.info, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :id => status.id, :message => status.message, :attributes => @controller.attributes_translated, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
256
+ @controller.notify("status/change", :activity_uuid => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :instance_name => @controller.info, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :id => status.id, :message => status.message, :attributes => @controller.attributes_translated, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
252
257
  end
253
258
  unless changed_dataelements.nil?
254
259
  @controller.serialize_dataelements!
255
- @controller.notify("dataelements/change", :endpoint => @handler_endpoint, :label => @label, :instance_name => @controller.info, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :changed => changed_dataelements, :values => dataelements, :attributes => @controller.attributes_translated, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
260
+ @controller.notify("dataelements/change", :activity_uuid => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :instance_name => @controller.info, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :changed => changed_dataelements, :values => dataelements, :attributes => @controller.attributes_translated, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
256
261
  end
257
262
  unless changed_endpoints.nil?
258
263
  @controller.serialize_endpoints!
259
- @controller.notify("endpoints/change", :endpoint => @handler_endpoint, :label => @label, :instance_name => @controller.info, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :changed => changed_endpoints, :values => endpoints, :attributes => @controller.attributes_translated, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
264
+ @controller.notify("endpoints/change", :activity_uuid => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :instance_name => @controller.info, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :changed => changed_endpoints, :values => endpoints, :attributes => @controller.attributes_translated, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
260
265
  end
261
266
  end # }}}
262
267
 
263
268
  def vote_sync_after # {{{
264
- @controller.call_vote("activity/syncing_after", :endpoint => @handler_endpoint, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
269
+ @controller.call_vote("activity/syncing_after", :activity_uuid => @handler_activity_uuid, :endpoint => @handler_endpoint, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
265
270
  end # }}}
266
271
  def vote_sync_before(parameters=nil) # {{{
267
- @controller.call_vote("activity/syncing_before", :endpoint => @handler_endpoint, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :parameters => parameters, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
272
+ @controller.call_vote("activity/syncing_before", :activity_uuid => @handler_activity_uuid, :endpoint => @handler_endpoint, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :parameters => parameters, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
268
273
  end # }}}
269
274
 
270
275
  def simplify_result(result)
@@ -323,13 +328,13 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
323
328
  end
324
329
 
325
330
  def callback(result=nil,options={})
326
- @controller.notify("activity/receiving", :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :endpoint => @handler_endpoint, :received => structurize_result(result), :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated, :sensors => @sensors, :aggregators => @aggregators, :costs => @costs)
331
+ @controller.notify("activity/receiving", :activity_uuid => @handler_activity_uuid, :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :endpoint => @handler_endpoint, :received => structurize_result(result), :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated, :sensors => @sensors, :aggregators => @aggregators, :costs => @costs)
327
332
  result = simplify_result(result)
328
333
  @handler_returnValue = result
329
334
  @handler_returnOptions = options
330
335
  if options['CPEE_UPDATE']
331
336
  if options['CPEE_UPDATE_STATUS']
332
- @controller.notify("activity/status", :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :endpoint => @handler_endpoint, :status => options['CPEE_UPDATE_STATUS'], :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
337
+ @controller.notify("activity/status", :activity_uuid => @handler_activity_uuid, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :endpoint => @handler_endpoint, :status => options['CPEE_UPDATE_STATUS'], :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
333
338
  end
334
339
  @handler_continue.continue WEEL::Signal::Again
335
340
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee-handlerwrapper-opcua
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.7'
4
+ version: '0.12'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
8
8
  autorequire:
9
9
  bindir: tools
10
10
  cert_chain: []
11
- date: 2019-11-22 00:00:00.000000000 Z
11
+ date: 2020-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cpee
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  requirements: []
113
- rubygems_version: 3.0.3
113
+ rubygems_version: 3.1.2
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: OPCUA for CPEE HandlerWrapper. Use opc.tcp-read|write|exececute:// links.