cpee-handlerwrapper-opcua 0.3 → 0.8

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: a5e99c034c7a91e6794c5c262c41cf7936f650181799dce95e20fcbc97fedf2e
4
- data.tar.gz: b624904fa7d53581424512348891c558bb0c2bcd485497f99734c8ffcbeb90d5
3
+ metadata.gz: a352e4ef2e00edcbbe1fdb1b9c0315631ed1f507f2e4c3d427dfd9b0a82e3a24
4
+ data.tar.gz: 9eda6cf84e69203d0d7e019dfe726d5c97b0ecdaf56295273d3689efc3a19813
5
5
  SHA512:
6
- metadata.gz: 21bdb6a8e9919b110965160535e112e2f75b69d8476912037de9408c6d2134561e7c3da0248531738a20f69566c8ca5ab05a1f0a98439c3d79f80de3c41381f6
7
- data.tar.gz: bc830bf16c10b98e94abad66c9737ff3b67dfb76b886ae84fd4f7bc3569f10b9887eca0af15ddb8acec40358af1b734d70d590ad1d78865ed97ea1f82f3ba34e
6
+ metadata.gz: 84b81740c9cf68c1b9b300ab756c923370511ae160bb3a483952b70ac1eb6daf318fd4b5b23cd6b9bf1d30cf32865e1b4e8dac6ba2a47ce49d32d84d29ccdbcf
7
+ data.tar.gz: d121a4fd0bf9d32c429126e38e55a78a5fe1ada093317a786a97f315459a2ae33124fd0ffe3c05d9059bdc2922311c2a0e4c55e88b1b6baeb76d41648d99f55f
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-handlerwrapper-opcua"
3
- s.version = "0.3"
3
+ s.version = "0.8"
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."
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.email = 'juergen.mangler@gmail.com'
19
19
  s.homepage = 'https://cpee.org//cpee-handlerwrapper-opcua'
20
20
 
21
- s.add_runtime_dependency 'cpee', '~>1.5', '>= 1.5.3'
21
+ s.add_runtime_dependency 'cpee', '~>1.5', '>= 1.5.8'
22
22
  s.add_runtime_dependency 'opcua', '~>0', '>= 0.13'
23
23
  s.add_development_dependency 'rake', '~> 12'
24
24
  s.add_development_dependency 'rake-compiler', '~> 1.0'
@@ -44,135 +44,167 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
44
44
  @handler_position = position
45
45
  @handler_passthrough = nil
46
46
  @handler_returnValue = nil
47
+ @handler_returnOptions = nil
48
+ @handler_activity_uuid = Digest::MD5.hexdigest(Kernel::rand().to_s)
47
49
  @label = ''
48
50
  end # }}}
49
51
 
50
- def prepare(readonly, endpoints, parameters) #{{{
51
- @handler_endpoint = endpoints.is_a?(Array) ? endpoints.map{ |ep| readonly.endpoints[ep] }.compact : readonly.endpoints[endpoints]
52
- parameters[:arguments]&.each do |ele|
53
- if ele.value.is_a?(Proc)
54
- ele.value = readonly.instance_exec &ele.value
52
+ def prepare(readonly, endpoints, parameters, replay=false) #{{{
53
+ if replay
54
+ @handler_endpoint = @controller.attributes[:replayer]
55
+ else
56
+ @handler_endpoint = endpoints.is_a?(Array) ? endpoints.map{ |ep| readonly.endpoints[ep] }.compact : readonly.endpoints[endpoints]
57
+ end
58
+ params = parameters.dup
59
+ params[:arguments] = params[:arguments].dup if params[:arguments]
60
+ params[:arguments]&.map! do |ele|
61
+ t = ele.dup
62
+ if t.value.is_a?(Proc)
63
+ t.value = readonly.instance_exec &t.value
55
64
  end
65
+ t
56
66
  end
57
- parameters
67
+ params
58
68
  end #}}}
59
69
 
60
- def activity_handle(passthrough, parameters) # {{{
61
- raise "Wrong endpoint" if @handler_endpoint.nil? || @handler_endpoint.empty?
62
- @label = parameters[:label]
63
- @sensors = parameters[:sensors]
64
- @aggregators = parameters[:aggregators]
65
- @costs = parameters[:costs]
66
- @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)
67
- if passthrough.to_s.empty?
68
- if @handler_endpoint.start_with?('opc.tcp')
69
- if @handler_endpoint =~ /^opc\.tcp-read:\/\/([^\/]+)\/(\d+)\/(.+)/
70
- nid = $3 == $3.to_i.to_s ? $3.to_i : $3
71
- ns = $2
72
- url = 'opc.tcp://' + $1
73
- client = OPCUA::Client.new(url)
74
- if (node = client.get ns.to_i, nid)
75
- result = node.value
76
- else
77
- raise 'invalid nodeid'
78
- end
79
- client.disconnect
80
- callback [Riddl::Parameter::Simple.new('value',result)], {}
81
- elsif @handler_endpoint =~ /^opc\.tcp-write:\/\/([^\/]+)\/(\d+)\/([^\?]+)(\?value=(.*))?/
82
- nid = $3 == $3.to_i.to_s ? $3.to_i : $3
83
- ns = $2
84
- par = $5
85
- url = 'opc.tcp://' + $1
86
- client = OPCUA::Client.new(url)
87
- if (node = client.get ns.to_i, nid)
88
- (parameters[:arguments] || [→(:name => 'value', :value => par)] || []).each do |ele|
89
- what = CPEE::ValueHelper::parse_extended(ele.value)
90
- node.value = what
91
- result = what
92
- end
93
- else
94
- raise 'invalid nodeid'
95
- end
96
- client.disconnect
97
- callback [Riddl::Parameter::Simple.new('value',result)], {}
98
- elsif @handler_endpoint =~ /^opc\.tcp-execute:\/\/([^\/]+)\/(\d+)\/([^\?]+)(\?value=(.*))?/
99
- nid = $3 == $3.to_i.to_s ? $3.to_i : $3
100
- ns = $2
101
- par = $5
102
- url = 'opc.tcp://' + $1
103
- client = OPCUA::Client.new(url)
104
- if (node = client.get ns.to_i, nid)
105
- params = []
106
- (parameters[:arguments] || []).each do |ele|
107
- what = CPEE::ValueHelper::parse_extended(ele.value)
108
- params << what
109
- end
110
- result = node.call *params
111
- else
112
- raise 'invalid nodeid'
113
- end
114
- client.disconnect
115
- callback [Riddl::Parameter::Simple.new('value',result)], {}
116
- end
70
+ def proto_curl(parameters) #{{{
71
+ params = []
72
+ callback = Digest::MD5.hexdigest(Kernel::rand().to_s)
73
+ (parameters[:arguments] || []).each do |s|
74
+ if s.respond_to?(:mimetype)
75
+ params << Riddl::Parameter::Complex.new(s.name.to_s,v.mimetype,v.value)
117
76
  else
118
- params = []
119
- callback = Digest::MD5.hexdigest(Kernel::rand().to_s)
120
- (parameters[:arguments] || []).each do |s|
121
- if s.respond_to?(:mimetype)
122
- params << Riddl::Parameter::Complex.new(s.name.to_s,v.mimetype,v.value)
123
- else
124
- if s.name.to_s =~ /^__Q_/
125
- params << Riddl::Parameter::Simple.new(s.name.to_s.sub(/^__Q_/,''),CPEE::ValueHelper::generate(s.value),:query)
126
- elsif s.name.to_s =~ /^__B_/
127
- params << Riddl::Parameter::Simple.new(s.name.to_s.sub(/^__B_/,''),CPEE::ValueHelper::generate(s.value),:body)
128
- elsif s.name.to_s =~ /^__H_/
129
- params << Riddl::Header.new(s.name.to_s.sub(/^__H_/,''),CPEE::ValueHelper::generate(s.value))
130
- elsif s.name.to_s =~ /^__C_/
131
- params << Riddl::Parameter::Complex.new(s.name.to_s.sub(/^__C_/,''),*CPEE::ValueHelper::generate(s.value).split(';',2))
132
- else
133
- params << Riddl::Parameter::Simple.new(s.name.to_s,CPEE::ValueHelper::generate(s.value))
134
- end
135
- end
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))
85
+ else
86
+ params << Riddl::Parameter::Simple.new(s.name.to_s,CPEE::ValueHelper::generate(s.value))
136
87
  end
88
+ end
89
+ end
137
90
 
138
- params << Riddl::Header.new("CPEE-BASE",@controller.base_url)
139
- params << Riddl::Header.new("CPEE-INSTANCE",@controller.instance)
140
- params << Riddl::Header.new("CPEE-INSTANCE-URL",@controller.instance_url)
141
- params << Riddl::Header.new("CPEE-INSTANCE-UUID",@controller.uuid)
142
- params << Riddl::Header.new("CPEE-CALLBACK",@controller.instance_url + '/callbacks/' + callback)
143
- params << Riddl::Header.new("CPEE-CALLBACK-ID",callback)
144
- params << Riddl::Header.new("CPEE-ACTIVITY",@handler_position)
145
- params << Riddl::Header.new("CPEE-LABEL",parameters[:label]||'')
146
- @controller.attributes.each do |key,value|
147
- params << Riddl::Header.new("CPEE-ATTR-#{key.to_s.gsub(/_/,'-')}",value)
148
- end
91
+ params << Riddl::Header.new("CPEE-BASE",@controller.base_url)
92
+ params << Riddl::Header.new("CPEE-INSTANCE",@controller.instance)
93
+ params << Riddl::Header.new("CPEE-INSTANCE-URL",@controller.instance_url)
94
+ params << Riddl::Header.new("CPEE-INSTANCE-UUID",@controller.uuid)
95
+ params << Riddl::Header.new("CPEE-CALLBACK",@controller.instance_url + '/callbacks/' + callback)
96
+ params << Riddl::Header.new("CPEE-CALLBACK-ID",callback)
97
+ params << Riddl::Header.new("CPEE-ACTIVITY",@handler_position)
98
+ params << Riddl::Header.new("CPEE-LABEL",@label||'')
99
+ params << Riddl::Header.new("CPEE-REPLAY",@controller.attributes['replayer_args'])
100
+ @controller.attributes.each do |key,value|
101
+ params << Riddl::Header.new("CPEE-ATTR-#{key.to_s.gsub(/_/,'-')}",value)
102
+ end
149
103
 
150
- tendpoint = @handler_endpoint.sub(/^http(s)?-(get|put|post|delete):/,'http\\1:')
151
- type = $2 || parameters[:method] || 'post'
104
+ tendpoint = @handler_endpoint.sub(/^http(s)?-(get|put|post|delete):/,'http\\1:')
105
+ type = $2 || parameters[:method] || 'post'
152
106
 
153
- client = Riddl::Client.new(tendpoint)
107
+ client = Riddl::Client.new(tendpoint)
154
108
 
155
- @controller.callbacks[callback] = CPEE::Callback.new("callback activity: #{@handler_position}",self,:callback,nil,nil,:http)
156
- @handler_passthrough = callback
109
+ @controller.callbacks[callback] = CPEE::Callback.new("callback activity: #{@handler_position}",self,:callback,nil,nil,:http)
110
+ @handler_passthrough = callback
111
+
112
+ status, result, headers = client.request type => params
113
+ if status < 200 || status >= 300
114
+ headers['CPEE_SALVAGE'] = true
115
+ c = result[0]&.value
116
+ c = c.read if c.respond_to? :read
117
+ callback([ Riddl::Parameter::Complex.new('error','application/json',StringIO.new(JSON::generate({ 'status' => status, 'error' => c }))) ], headers)
118
+ else
119
+ if headers['CPEE_INSTANTIATION']
120
+ @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)
121
+ end
122
+ if headers['CPEE_CALLBACK'] && headers['CPEE_CALLBACK'] == 'true' && result.any?
123
+ headers['CPEE_UPDATE'] = true
124
+ callback result, headers
125
+ elsif headers['CPEE_CALLBACK'] && headers['CPEE_CALLBACK'] == 'true' && result.empty?
126
+ # do nothing, later on things will happend
127
+ else
128
+ callback result, headers
129
+ end
130
+ end
131
+ end #}}}
157
132
 
158
- status, result, headers = client.request type => params
159
- if status < 200 || status >= 300
160
- c = result[0]&.value
161
- c = c.read if c.respond_to? :read
162
- callback([ Riddl::Parameter::Complex.new('error','application/json',StringIO.new(JSON::generate({ 'status' => status, 'error' => c }))) ], 'CPEE_SALVAGE' => true)
133
+ def proto_opcua(parameters)
134
+ if @handler_endpoint =~ /^opc\.tcp-read:\/\/([^\/]+)\/(\d+)\/(.+)/
135
+ nid = $3 == $3.to_i.to_s ? $3.to_i : $3
136
+ ns = $2
137
+ url = 'opc.tcp://' + $1
138
+ begin
139
+ client = OPCUA::Client.new(url)
140
+ if (node = client.get ns.to_i, nid)
141
+ result = node.value
163
142
  else
164
- if headers['CPEE_INSTANTIATION']
165
- @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)
143
+ raise 'invalid nodeid'
144
+ end
145
+ client.disconnect
146
+ callback [Riddl::Parameter::Simple.new('value',result)], {}
147
+ rescue => e
148
+ callback([ Riddl::Parameter::Complex.new('error','application/json',StringIO.new(JSON::generate({ 'status' => 0, 'error' => e.message }))) ], 'CPEE_SALVAGE' => true)
149
+ end
150
+ elsif @handler_endpoint =~ /^opc\.tcp-write:\/\/([^\/]+)\/(\d+)\/([^\?]+)(\?value=(.*))?/
151
+ nid = $3 == $3.to_i.to_s ? $3.to_i : $3
152
+ ns = $2
153
+ par = $5
154
+ url = 'opc.tcp://' + $1
155
+ begin
156
+ client = OPCUA::Client.new(url)
157
+ if (node = client.get ns.to_i, nid)
158
+ (parameters[:arguments] || [→(:name => 'value', :value => par)] || []).each do |ele|
159
+ what = CPEE::ValueHelper::parse_extended(ele.value)
160
+ node.value = what
161
+ result = what
166
162
  end
167
- if headers['CPEE_CALLBACK'] && headers['CPEE_CALLBACK'] == 'true' && result.any?
168
- headers['CPEE_UPDATE'] = true
169
- callback result, headers
170
- elsif headers['CPEE_CALLBACK'] && headers['CPEE_CALLBACK'] == 'true' && result.empty?
171
- # do nothing, later on things will happend
172
- else
173
- callback result
163
+ else
164
+ raise 'invalid nodeid'
165
+ end
166
+ client.disconnect
167
+ callback [Riddl::Parameter::Simple.new('value',result)], {}
168
+ rescue => e
169
+ callback([ Riddl::Parameter::Complex.new('error','application/json',StringIO.new(JSON::generate({ 'status' => 0, 'error' => e.message }))) ], 'CPEE_SALVAGE' => true)
170
+ end
171
+ elsif @handler_endpoint =~ /^opc\.tcp-execute:\/\/([^\/]+)\/(\d+)\/([^\?]+)(\?value=(.*))?/
172
+ nid = $3 == $3.to_i.to_s ? $3.to_i : $3
173
+ ns = $2
174
+ par = $5
175
+ url = 'opc.tcp://' + $1
176
+ begin
177
+ client = OPCUA::Client.new(url)
178
+ if (node = client.get ns.to_i, nid)
179
+ params = []
180
+ (parameters[:arguments] || []).each do |ele|
181
+ what = CPEE::ValueHelper::parse_extended(ele.value)
182
+ params << what
174
183
  end
184
+ result = node.call *params
185
+ else
186
+ raise 'invalid nodeid'
175
187
  end
188
+ client.disconnect
189
+ callback [Riddl::Parameter::Simple.new('value',result)], {}
190
+ rescue => e
191
+ callback([ Riddl::Parameter::Complex.new('error','application/json',StringIO.new(JSON::generate({ 'status' => 0, 'error' => e.message }))) ], 'CPEE_SALVAGE' => true)
192
+ end
193
+ end
194
+ end
195
+
196
+ def activity_handle(passthrough, parameters) # {{{
197
+ raise "Wrong endpoint" if @handler_endpoint.nil? || @handler_endpoint.empty?
198
+ @label = parameters[:label]
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)
203
+ if passthrough.to_s.empty?
204
+ if @handler_endpoint.start_with?('opc.tcp')
205
+ proto_opcua parameters
206
+ else
207
+ proto_curl parameters
176
208
  end
177
209
  else
178
210
  @controller.callbacks[passthrough] = CPEE::Callback.new("callback activity: #{@handler_position}",self,:callback,nil,nil,:http)
@@ -186,6 +218,9 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
186
218
  def activity_result_value # {{{
187
219
  @handler_returnValue
188
220
  end # }}}
221
+ def activity_result_options # {{{
222
+ @handler_returnOptions
223
+ end # }}}
189
224
 
190
225
  def activity_stop # {{{
191
226
  unless @handler_passthrough.nil?
@@ -201,15 +236,15 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
201
236
  end # }}}
202
237
 
203
238
  def inform_activity_done # {{{
204
- @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)
205
240
  end # }}}
206
241
  def inform_activity_manipulate # {{{
207
- @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)
208
243
  end # }}}
209
244
  def inform_activity_failed(err) # {{{
210
245
  puts err.message
211
246
  puts err.backtrace
212
- @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)
213
248
  end # }}}
214
249
  def inform_manipulate_change(status,changed_dataelements,changed_endpoints,dataelements,endpoints) # {{{
215
250
  unless status.nil?
@@ -227,10 +262,10 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
227
262
  end # }}}
228
263
 
229
264
  def vote_sync_after # {{{
230
- @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"))
231
266
  end # }}}
232
267
  def vote_sync_before(parameters=nil) # {{{
233
- @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"))
234
269
  end # }}}
235
270
 
236
271
  def simplify_result(result)
@@ -289,17 +324,17 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
289
324
  end
290
325
 
291
326
  def callback(result=nil,options={})
292
- @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)
293
328
  result = simplify_result(result)
329
+ @handler_returnValue = result
330
+ @handler_returnOptions = options
294
331
  if options['CPEE_UPDATE']
295
- @handler_returnValue = result
296
332
  if options['CPEE_UPDATE_STATUS']
297
- @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)
298
334
  end
299
335
  @handler_continue.continue WEEL::Signal::Again
300
336
  else
301
337
  @controller.callbacks.delete(@handler_passthrough)
302
- @handler_returnValue = result
303
338
  @handler_passthrough = nil
304
339
  if options['CPEE_SALVAGE']
305
340
  @handler_continue.continue WEEL::Signal::Salvage
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.3'
4
+ version: '0.8'
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-10-10 00:00:00.000000000 Z
11
+ date: 2019-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cpee
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '1.5'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.5.3
22
+ version: 1.5.8
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '1.5'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.5.3
32
+ version: 1.5.8
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: opcua
35
35
  requirement: !ruby/object:Gem::Requirement