cpee-handlerwrapper-opcua 0.6 → 0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cpee-handlerwrapper-opcua.gemspec +1 -1
- data/lib/cpee-handlerwrapper-opcua.rb +24 -23
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cb7646ac5ff089ca0ac0bea1777fc036bfca8bd327571f5a5a8480b03693ad2
|
4
|
+
data.tar.gz: 32a6fefce360b6861698eff18ef0d81d5f68a14f5c80f41c2c71b9dd81393581
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dbc3f405eb2c8987641b19b815244ceb39314ccbc2b71f9223b251f595d3a8a38fee068980fe8d268a60a6d7069666a9092d94b69cb121d07176e0d14821332
|
7
|
+
data.tar.gz: 3176c8652ec62abdc8bb81a95b89c4bd86961578f9702caa2c307997cad4f7f1e1648892f3fa9aafa0ee352101094f952f53bc541c367c09e73e7d513c7fc85c
|
@@ -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
|
|
@@ -73,14 +74,14 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
|
|
73
74
|
if s.respond_to?(:mimetype)
|
74
75
|
params << Riddl::Parameter::Complex.new(s.name.to_s,v.mimetype,v.value)
|
75
76
|
else
|
76
|
-
if s.name.to_s =~ /^
|
77
|
-
params << Riddl::Parameter::Simple.new(s.name.to_s.sub(/^
|
78
|
-
elsif s.name.to_s =~ /^
|
79
|
-
params << Riddl::Parameter::Simple.new(s.name.to_s.sub(/^
|
80
|
-
elsif s.name.to_s =~ /^
|
81
|
-
params << Riddl::Header.new(s.name.to_s.sub(/^
|
82
|
-
elsif s.name.to_s =~ /^
|
83
|
-
params << Riddl::Parameter::Complex.new(s.name.to_s.sub(/^
|
77
|
+
if s.name.to_s =~ /^_Q_/
|
78
|
+
params << Riddl::Parameter::Simple.new(s.name.to_s.sub(/^_Q_/,''),CPEE::ValueHelper::generate(s.value),:query)
|
79
|
+
elsif s.name.to_s =~ /^_B_/
|
80
|
+
params << Riddl::Parameter::Simple.new(s.name.to_s.sub(/^_B_/,''),CPEE::ValueHelper::generate(s.value),:body)
|
81
|
+
elsif s.name.to_s =~ /^_H_/
|
82
|
+
params << Riddl::Header.new(s.name.to_s.sub(/^_H_/,''),CPEE::ValueHelper::generate(s.value))
|
83
|
+
elsif s.name.to_s =~ /^_C_/
|
84
|
+
params << Riddl::Parameter::Complex.new(s.name.to_s.sub(/^_C_/,''),*CPEE::ValueHelper::generate(s.value).split(';',2))
|
84
85
|
else
|
85
86
|
params << Riddl::Parameter::Simple.new(s.name.to_s,CPEE::ValueHelper::generate(s.value))
|
86
87
|
end
|
@@ -116,7 +117,7 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
|
|
116
117
|
callback([ Riddl::Parameter::Complex.new('error','application/json',StringIO.new(JSON::generate({ 'status' => status, 'error' => c }))) ], headers)
|
117
118
|
else
|
118
119
|
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)
|
120
|
+
@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
121
|
end
|
121
122
|
if headers['CPEE_CALLBACK'] && headers['CPEE_CALLBACK'] == 'true' && result.any?
|
122
123
|
headers['CPEE_UPDATE'] = true
|
@@ -195,10 +196,10 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
|
|
195
196
|
def activity_handle(passthrough, parameters) # {{{
|
196
197
|
raise "Wrong endpoint" if @handler_endpoint.nil? || @handler_endpoint.empty?
|
197
198
|
@label = parameters[:label]
|
198
|
-
@sensors = parameters
|
199
|
-
@aggregators = parameters
|
200
|
-
@costs = parameters
|
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)
|
199
|
+
@sensors = parameters.dig(:stream,:sensors)
|
200
|
+
@aggregators = parameters.dig(:stream,:aggregators)
|
201
|
+
@costs = parameters.dig(:stream,:costs)
|
202
|
+
@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
203
|
if passthrough.to_s.empty?
|
203
204
|
if @handler_endpoint.start_with?('opc.tcp')
|
204
205
|
proto_opcua parameters
|
@@ -235,36 +236,36 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
|
|
235
236
|
end # }}}
|
236
237
|
|
237
238
|
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)
|
239
|
+
@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
240
|
end # }}}
|
240
241
|
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)
|
242
|
+
@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
243
|
end # }}}
|
243
244
|
def inform_activity_failed(err) # {{{
|
244
245
|
puts err.message
|
245
246
|
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)
|
247
|
+
@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
248
|
end # }}}
|
248
249
|
def inform_manipulate_change(status,changed_dataelements,changed_endpoints,dataelements,endpoints) # {{{
|
249
250
|
unless status.nil?
|
250
251
|
@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"))
|
252
|
+
@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
253
|
end
|
253
254
|
unless changed_dataelements.nil?
|
254
255
|
@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"))
|
256
|
+
@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
257
|
end
|
257
258
|
unless changed_endpoints.nil?
|
258
259
|
@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"))
|
260
|
+
@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
261
|
end
|
261
262
|
end # }}}
|
262
263
|
|
263
264
|
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"))
|
265
|
+
@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
266
|
end # }}}
|
266
267
|
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"))
|
268
|
+
@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
269
|
end # }}}
|
269
270
|
|
270
271
|
def simplify_result(result)
|
@@ -323,13 +324,13 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
|
|
323
324
|
end
|
324
325
|
|
325
326
|
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)
|
327
|
+
@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
328
|
result = simplify_result(result)
|
328
329
|
@handler_returnValue = result
|
329
330
|
@handler_returnOptions = options
|
330
331
|
if options['CPEE_UPDATE']
|
331
332
|
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)
|
333
|
+
@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
334
|
end
|
334
335
|
@handler_continue.continue WEEL::Signal::Again
|
335
336
|
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.
|
4
|
+
version: '0.11'
|
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
|
+
date: 2019-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cpee
|