cpee-handlerwrapper-opcua 0.3 → 0.4

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: 75f8d367a1dc766fb0d718129b3df522b488c23c0851b223cd82361fb09bceab
4
+ data.tar.gz: 127104e0d36ad736b127c06c3cc415496db6b1f07744ac758dfe4ed60f486c05
5
5
  SHA512:
6
- metadata.gz: 21bdb6a8e9919b110965160535e112e2f75b69d8476912037de9408c6d2134561e7c3da0248531738a20f69566c8ca5ab05a1f0a98439c3d79f80de3c41381f6
7
- data.tar.gz: bc830bf16c10b98e94abad66c9737ff3b67dfb76b886ae84fd4f7bc3569f10b9887eca0af15ddb8acec40358af1b734d70d590ad1d78865ed97ea1f82f3ba34e
6
+ metadata.gz: a6cfc998614c19c4480ac9cfd41bbec4d3b975038b0eb1d773f19715f781728c4ba36bc068b8061f0a94a3a354c3cc95609ea7bc5c8c25ca3e7847e880de89a5
7
+ data.tar.gz: f3524fe41cf3409b909f489d5525c49a583e87d8fe8b16e9caa3c1c2c075391a30f546a8926dabb81572e4c5283c25f60d872ddaa738101216db45dcacd103a7
@@ -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.4"
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.5'
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,17 +44,22 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
44
44
  @handler_position = position
45
45
  @handler_passthrough = nil
46
46
  @handler_returnValue = nil
47
+ @handler_returnOptions = nil
47
48
  @label = ''
48
49
  end # }}}
49
50
 
50
51
  def prepare(readonly, endpoints, parameters) #{{{
51
52
  @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
53
+ params = parameters.dup
54
+ params[:arguments] = params[:arguments].dup if params[:arguments]
55
+ params[:arguments]&.map! do |ele|
56
+ t = ele.dup
57
+ if t.value.is_a?(Proc)
58
+ t.value = readonly.instance_exec &t.value
55
59
  end
60
+ t
56
61
  end
57
- parameters
62
+ params
58
63
  end #}}}
59
64
 
60
65
  def activity_handle(passthrough, parameters) # {{{
@@ -157,9 +162,10 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
157
162
 
158
163
  status, result, headers = client.request type => params
159
164
  if status < 200 || status >= 300
165
+ headers['CPEE_SALVAGE'] = true
160
166
  c = result[0]&.value
161
167
  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)
168
+ callback([ Riddl::Parameter::Complex.new('error','application/json',StringIO.new(JSON::generate({ 'status' => status, 'error' => c }))) ], headers)
163
169
  else
164
170
  if headers['CPEE_INSTANTIATION']
165
171
  @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)
@@ -170,7 +176,7 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
170
176
  elsif headers['CPEE_CALLBACK'] && headers['CPEE_CALLBACK'] == 'true' && result.empty?
171
177
  # do nothing, later on things will happend
172
178
  else
173
- callback result
179
+ callback result, headers
174
180
  end
175
181
  end
176
182
  end
@@ -186,6 +192,9 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
186
192
  def activity_result_value # {{{
187
193
  @handler_returnValue
188
194
  end # }}}
195
+ def activity_result_options # {{{
196
+ @handler_returnOptions
197
+ end # }}}
189
198
 
190
199
  def activity_stop # {{{
191
200
  unless @handler_passthrough.nil?
@@ -291,15 +300,15 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
291
300
  def callback(result=nil,options={})
292
301
  @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)
293
302
  result = simplify_result(result)
303
+ @handler_returnValue = result
304
+ @handler_returnOptions = options
294
305
  if options['CPEE_UPDATE']
295
- @handler_returnValue = result
296
306
  if options['CPEE_UPDATE_STATUS']
297
307
  @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)
298
308
  end
299
309
  @handler_continue.continue WEEL::Signal::Again
300
310
  else
301
311
  @controller.callbacks.delete(@handler_passthrough)
302
- @handler_returnValue = result
303
312
  @handler_passthrough = nil
304
313
  if options['CPEE_SALVAGE']
305
314
  @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.4'
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-10-15 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.5
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.5
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: opcua
35
35
  requirement: !ruby/object:Gem::Requirement