rsmp 0.9.2 → 0.9.5

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: 9fa8cde971466041262bd390c93f4f976cb0942ca6d78aadd2707e87e90fddb2
4
- data.tar.gz: f7970833a69ea2ed5741a5b7f6d3619bfca25df8343f0b6a02a304dc7a74fce7
3
+ metadata.gz: 774c3a61fac3a93f87f5d8512da860cbf28cbfb47ff568d2035006d08ac98cf1
4
+ data.tar.gz: 238b160b9786c76e78639f9c470abcb196aa24476466a1e2ca53cbca8f41eb03
5
5
  SHA512:
6
- metadata.gz: d3a857d4b29b9b1e2f9bbf0181ed86586ade1b15eedbbbd79fbc4ca0a3f65b5e67c8f96224b55a87a3c05622a75353fc7fb29d61e1ecfb8af464c99873cc0bae
7
- data.tar.gz: 499d7c02e691e0a3aa0fdf2f1f000f30bbda8bc9240836f00c6e8ca0114298666a92ffd20953d57887f359bec45ca983cf12624fc0b49eee952eb24eea8b80ca
6
+ metadata.gz: c8573e91e6d88cc6be7806d81098e4894d3b220f50997867fca64b8c1161f5f6019fed0383a70c7ee48d61182cdd0a38feb9be3509d2c624224235147839831c
7
+ data.tar.gz: 487cc05ad5fdb48ad7efbc5415640f2d1aeac49bebb7c2989b97e251a6d1d34e2bce6c6b03596190083c4eeb9b48eaaf33023d8ce382961c25f09a2c17c9db8b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.9.2)
4
+ rsmp (0.9.5)
5
5
  async (~> 1.29.1)
6
6
  async-io (~> 1.32.2)
7
7
  colorize (~> 0.8.1)
@@ -0,0 +1,35 @@
1
+ module RSMP
2
+ # Class for waiting for specific command responses
3
+ class AlarmCollector < Collector
4
+ def initialize proxy,options={}
5
+ @query = options[:query] || {}
6
+ super proxy, options.merge(
7
+ type: 'Alarm',
8
+ title:'alarm'
9
+ )
10
+ end
11
+
12
+ def type_match? message
13
+ return false if super(message) == false
14
+
15
+ # match fixed attributes
16
+ %w{aCId aSp ack aS sS cat pri}.each do |key|
17
+ return false if @query[key] && @query[key] != message.attribute(key)
18
+ end
19
+
20
+ # match rvs items
21
+ if @query['rvs']
22
+ query_rvs = @query['rvs']
23
+ message_rvs = message.attributes['rvs']
24
+ return false unless message_rvs
25
+ return false unless query_rvs.all? do |query_item|
26
+ return false unless message_rvs.any? do |message_item|
27
+ next message_item['n'] == query_item['n'] && message_item['v'] == query_item['v']
28
+ end
29
+ next true
30
+ end
31
+ end
32
+ true
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,15 @@
1
+ module RSMP
2
+ # Match a specific alarm
3
+ class AlarmQuery < Query
4
+ # Match an alarm value against a query
5
+ def match? item
6
+ return false if @want['n'] && @want['n'] != item['n']
7
+ if @want['v'].is_a? Regexp
8
+ return false if item['v'] !~ @want['v']
9
+ elsif @want['v']
10
+ return false if item['v'] != @want['v']
11
+ end
12
+ true
13
+ end
14
+ end
15
+ end
@@ -346,14 +346,5 @@ module RSMP
346
346
  @supervisor.notify_error e, options if @supervisor
347
347
  distribute_error e, options
348
348
  end
349
-
350
- def collect_alarms options={}
351
- collect(@task,options.merge(type: "Alarm")) do |alarm|
352
- next if options[:aCId] && options[:aCId] != alarm.attribute("aCId")
353
- next if options[:aSp] && options[:aSp] != alarm.attribute("aSp")
354
- next if options[:aS] && options[:aS] != alarm.attribute("aS")
355
- :keep
356
- end
357
- end
358
349
  end
359
350
  end
@@ -272,7 +272,7 @@ module RSMP
272
272
  return unless idx>=0 && input<@num_inputs # TODO should NotAck
273
273
  @input_activations[idx] = bool_string_to_digit arg['status']
274
274
  recompute_input idx
275
- if @input_activations[idx]
275
+ if @input_activations[idx] == '1'
276
276
  log "Activating input #{idx+1}", level: :info
277
277
  else
278
278
  log "Deactivating input #{idx+1}", level: :info
data/lib/rsmp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RSMP
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.5"
3
3
  end
data/lib/rsmp.rb CHANGED
@@ -25,9 +25,11 @@ require 'rsmp/collect/filter'
25
25
  require 'rsmp/collect/query'
26
26
  require 'rsmp/collect/status_query'
27
27
  require 'rsmp/collect/command_query'
28
+ require 'rsmp/collect/alarm_query'
28
29
  require 'rsmp/collect/status_collector'
29
30
  require 'rsmp/collect/command_response_collector'
30
31
  require 'rsmp/collect/aggregated_status_collector'
32
+ require 'rsmp/collect/alarm_collector'
31
33
  require 'rsmp/component'
32
34
  require 'rsmp/site'
33
35
  require 'rsmp/proxy'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsmp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Tin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-22 00:00:00.000000000 Z
11
+ date: 2022-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -211,6 +211,8 @@ files:
211
211
  - lib/rsmp/archive.rb
212
212
  - lib/rsmp/cli.rb
213
213
  - lib/rsmp/collect/aggregated_status_collector.rb
214
+ - lib/rsmp/collect/alarm_collector.rb
215
+ - lib/rsmp/collect/alarm_query.rb
214
216
  - lib/rsmp/collect/collector.rb
215
217
  - lib/rsmp/collect/command_query.rb
216
218
  - lib/rsmp/collect/command_response_collector.rb