cpee-handlerwrapper-opcua 0.2 → 0.3

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: 5097543e5a1b74cc025835261dc297194cb4ac7446187ca44a8d694ac86ce032
4
- data.tar.gz: 5aefcf1dc9ffe6d088993a7b64d6ce4a976a552870faad76b0cf9e7a7d37ace6
3
+ metadata.gz: a5e99c034c7a91e6794c5c262c41cf7936f650181799dce95e20fcbc97fedf2e
4
+ data.tar.gz: b624904fa7d53581424512348891c558bb0c2bcd485497f99734c8ffcbeb90d5
5
5
  SHA512:
6
- metadata.gz: 7932110d1fb1fde2e2f7fed5f5d958b7b6f9047942e3dd2ab6b01392b51fa292e1395e17ed73e444b32f18b90b280939943a94736781e241264f271e6d9cbc1a
7
- data.tar.gz: 607f6b0b17991b6b0226c7b8b4ba1a188f0a95b458a64e2d8dbd271773fa9448ce6ae3030bf62c1e64a4e4d817d39ad510a06126c3e8d409638a9e9504727556
6
+ metadata.gz: 21bdb6a8e9919b110965160535e112e2f75b69d8476912037de9408c6d2134561e7c3da0248531738a20f69566c8ca5ab05a1f0a98439c3d79f80de3c41381f6
7
+ data.tar.gz: bc830bf16c10b98e94abad66c9737ff3b67dfb76b886ae84fd4f7bc3569f10b9887eca0af15ddb8acec40358af1b734d70d590ad1d78865ed97ea1f82f3ba34e
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-handlerwrapper-opcua"
3
- s.version = "0.2"
3
+ s.version = "0.3"
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."
@@ -47,7 +47,7 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
47
47
  @label = ''
48
48
  end # }}}
49
49
 
50
- def prepare(readonly, endpoints, parameters)
50
+ def prepare(readonly, endpoints, parameters) #{{{
51
51
  @handler_endpoint = endpoints.is_a?(Array) ? endpoints.map{ |ep| readonly.endpoints[ep] }.compact : readonly.endpoints[endpoints]
52
52
  parameters[:arguments]&.each do |ele|
53
53
  if ele.value.is_a?(Proc)
@@ -55,7 +55,7 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
55
55
  end
56
56
  end
57
57
  parameters
58
- end
58
+ end #}}}
59
59
 
60
60
  def activity_handle(passthrough, parameters) # {{{
61
61
  raise "Wrong endpoint" if @handler_endpoint.nil? || @handler_endpoint.empty?
@@ -121,8 +121,14 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
121
121
  if s.respond_to?(:mimetype)
122
122
  params << Riddl::Parameter::Complex.new(s.name.to_s,v.mimetype,v.value)
123
123
  else
124
- if s.name.to_s =~ /__$/
125
- params << Riddl::Parameter::Simple.new(s.name.to_s.chop.chop,CPEE::ValueHelper::generate(s.value),:query)
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))
126
132
  else
127
133
  params << Riddl::Parameter::Simple.new(s.name.to_s,CPEE::ValueHelper::generate(s.value))
128
134
  end
@@ -151,7 +157,9 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
151
157
 
152
158
  status, result, headers = client.request type => params
153
159
  if status < 200 || status >= 300
154
- callback([ Riddl::Parameter::Complex.new('error','application/json',StringIO.new(JSON::generate({ 'status' => status, 'error' => result[0].value.read }))) ], 'CPEE_SALVAGE' => true)
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)
155
163
  else
156
164
  if headers['CPEE_INSTANTIATION']
157
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)
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.2'
4
+ version: '0.3'
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-08 00:00:00.000000000 Z
11
+ date: 2019-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cpee