rsmp 0.9.3 → 0.9.6

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: b4eb81e9be58fe5645d41ffe88fad923aac8ba5db14382ce0532d17721b18b0c
4
- data.tar.gz: 806810e243027d1349631b1b0153c452557e9b7ad01470ff51376c6a181a3810
3
+ metadata.gz: 41a71b0cd593d1ab4c3f9d0707929106b73d9ec6d8ce36a0f087f3efa73dccc3
4
+ data.tar.gz: 553a83ff465de1d07cc7e82531100059686caaf59710f7a452adbf07452f0bb0
5
5
  SHA512:
6
- metadata.gz: cfa09b0e9692c42999c97866166631e5e805c16741af046b21670a5cdaad862afa9fd532d266877da1c623b0ebb42f4d23854bac9dcb1884e095dabf6027b97a
7
- data.tar.gz: 493156ab24d418536dd57a5d0a68d008320b9c896e99b33e9ed6023c061f597467569865645895b106f3e13423c686f5c3c89c2177cafbd28a1707c387a5a00c
6
+ metadata.gz: df2053f172e30f6fd57fe6794b99636729a0909ae1e382b12171ec5927fa744b3ec9ba689ebdde117fb8744c2b2182bff1d91c97e8936aeb1dafff53fb663fd5
7
+ data.tar.gz: 5eefd3e4c7ebe6c9eeeaf5e9c29f7681b52f69dc42e122afeda559b81698644ceb64b8321e4785df8c485f9fc8c235751ac5676e0a3d0e9289a0857847bedd2d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.9.3)
4
+ rsmp (0.9.6)
5
5
  async (~> 1.29.1)
6
6
  async-io (~> 1.32.2)
7
7
  colorize (~> 0.8.1)
@@ -1,8 +1,8 @@
1
1
  module RSMP
2
2
  # Class for waiting for specific command responses
3
3
  class AlarmCollector < Collector
4
- def initialize proxy, want, options={}
5
- @want = want
4
+ def initialize proxy,options={}
5
+ @query = options[:query] || {}
6
6
  super proxy, options.merge(
7
7
  type: 'Alarm',
8
8
  title:'alarm'
@@ -11,8 +11,23 @@ module RSMP
11
11
 
12
12
  def type_match? message
13
13
  return false if super(message) == false
14
- [:aCId, :aSp, :ack, :aS, :sS, :cat, :pri].each do |key|
15
- return false if @want[key] && @want[key] != message.attribute(key.to_s)
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
16
31
  end
17
32
  true
18
33
  end
@@ -268,14 +268,16 @@ module RSMP
268
268
  def handle_m0006 arg
269
269
  @node.verify_security_code 2, arg['securityCode']
270
270
  input = arg['input'].to_i
271
+ unless input>0 && input<=@num_inputs
272
+ raise MessageRejected.new("Input #{idx} is invalid, must be in the range 1-#{@num_inputs}")
273
+ end
271
274
  idx = input - 1
272
- return unless idx>=0 && input<@num_inputs # TODO should NotAck
273
275
  @input_activations[idx] = bool_string_to_digit arg['status']
274
276
  recompute_input idx
275
- if @input_activations[idx]
276
- log "Activating input #{idx+1}", level: :info
277
+ if @input_activations[idx] == '1'
278
+ log "Activating input #{input}", level: :info
277
279
  else
278
- log "Deactivating input #{idx+1}", level: :info
280
+ log "Deactivating input #{input}", level: :info
279
281
  end
280
282
  end
281
283
 
data/lib/rsmp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RSMP
2
- VERSION = "0.9.3"
2
+ VERSION = "0.9.6"
3
3
  end
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.3
4
+ version: 0.9.6
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-03-09 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