rsmp 0.12.0 → 0.12.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: 957caaa3191011a85a0284ef530434184e15620b7762e4971a8547f45a955ec3
4
- data.tar.gz: 8905eb13b36d26d6c50fe0e4466f40e2f742d18384e93bc2b7e67d2e77975441
3
+ metadata.gz: d97c24017cb23ab7159bebda96f262f50813d902365e2fa1fabeb90d4771df01
4
+ data.tar.gz: fde070792556ef05d68ebfe5d7757d696f81921d75e64ced80f2a1c4878d39ef
5
5
  SHA512:
6
- metadata.gz: 100b1c357a27939ec7142ac0f63e9589ee36a044bfc54fcaea30303c2fb1eba277a3d0e1927f578fabe99717f9ffeaa83f5eceeb65dd7492d260458ab4d61689
7
- data.tar.gz: 729b6355adef1914f9621c10c69bd88318c688b40ef2881125a0783ed83533a4f34bc1e1192e338d073f44af4e7ae6c416732693622fa7ef478a48b63c31ba7d
6
+ metadata.gz: 2b58d0ed3307893fdd43fcd361b5da63e541baf199ac21860fa11cca756fe4339a63b4bf3420164232c248667e3cf75fe0b467928642e9fcd99f951308fa6e67
7
+ data.tar.gz: 3c5cb9a04f22a56a16f51c41faff55a5d587fe51dd2774e6a018846da40b5bf066f08bbbfc7848382ec2a76c64a0b17cad372972b0357d7182359e934864b771
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.12.0)
4
+ rsmp (0.12.3)
5
5
  async (~> 1.29.1)
6
6
  async-io (~> 1.32.2)
7
7
  colorize (~> 0.8.1)
@@ -68,7 +68,7 @@ GEM
68
68
  ffi (1.15.5-x64-mingw32)
69
69
  fiber-local (1.0.0)
70
70
  hana (1.3.7)
71
- json_schemer (0.2.19)
71
+ json_schemer (0.2.20)
72
72
  ecma-re-validator (~> 0.3)
73
73
  hana (~> 1.3)
74
74
  regexp_parser (~> 2.0)
@@ -80,7 +80,7 @@ GEM
80
80
  nio4r (2.5.8)
81
81
  rake (13.0.6)
82
82
  regexp_parser (2.2.1)
83
- rsmp_schemer (0.3.2)
83
+ rsmp_schemer (0.4.0)
84
84
  json_schemer (~> 0.2.18)
85
85
  rspec (3.10.0)
86
86
  rspec-core (~> 3.10.0)
@@ -21,5 +21,13 @@ module RSMP
21
21
  def resume
22
22
  @suspended = false
23
23
  end
24
+
25
+ def activate
26
+ @active = true
27
+ end
28
+
29
+ def deactivate
30
+ @active = false
31
+ end
24
32
  end
25
33
  end
@@ -20,31 +20,35 @@ module RSMP
20
20
  end
21
21
 
22
22
  def suspend_alarm alarm_code
23
- alarm_state = get_alarm_state alarm_code
24
- if alarm.suspended == false
25
- log "Suspending alarm #{alarm_code}", level: :info
26
- alarm.suspend
27
- @node.alarm_suspended_or_resumed alarm
28
- else
29
- log "Alarm #{alarm_code} already suspended", level: :info
30
- end
23
+ alarm = get_alarm_state alarm_code
24
+ return if alarm.suspended
25
+ log "Suspending alarm #{alarm_code}", level: :info
26
+ alarm.suspend
27
+ @node.alarm_changed alarm
31
28
  end
32
29
 
33
30
  def resume_alarm alarm_code
34
- alarm_state = get_alarm_state alarm_code
35
- if alarm.suspended
36
- log "Resuming alarm #{alarm_code}", level: :info
37
- alarm.resume
38
- @node.alarm_suspended_or_resumed alarm
39
- else
40
- log "Alarm #{alarm_code} not suspended", level: :info
41
- end
31
+ alarm = get_alarm_state alarm_code
32
+ return unless alarm.suspended
33
+ log "Resuming alarm #{alarm_code}", level: :info
34
+ alarm.resume
35
+ @node.alarm_changed alarm
42
36
  end
43
37
 
44
- # send alarm
45
- def send_alarm code:, status:
46
- @node.alarm_changed self, alarm
38
+ def activate_alarm alarm_code
39
+ alarm = get_alarm_state alarm_code
40
+ return if alarm.active
41
+ log "Activating alarm #{alarm_code}", level: :info
42
+ alarm.activate
43
+ @node.alarm_changed alarm
47
44
  end
48
45
 
46
+ def deactivate_alarm alarm_code
47
+ alarm = get_alarm_state alarm_code
48
+ return unless alarm.active
49
+ log "Deactivating alarm #{alarm_code}", level: :info
50
+ alarm.deactivate
51
+ @node.alarm_changed alarm
52
+ end
49
53
  end
50
54
  end
data/lib/rsmp/site.rb CHANGED
@@ -108,7 +108,7 @@ module RSMP
108
108
  )
109
109
  end
110
110
 
111
- def alarm_suspended_or_resumed alarm_state
111
+ def alarm_changed alarm_state
112
112
  alarm = alarm_state_to_message alarm_state
113
113
  @proxies.each do |proxy|
114
114
  proxy.send_message alarm if proxy.ready?
@@ -228,7 +228,6 @@ module RSMP
228
228
  @status_subscriptions[component_id][sCI][n]['uRt'] = uRt
229
229
  end
230
230
 
231
- p @status_subscriptions
232
231
  component = find_component component_id
233
232
  component.allow_repeat_updates subscribe_list
234
233
 
@@ -264,10 +264,10 @@ module RSMP
264
264
  alarm_code = actions['raise']
265
265
  if change
266
266
  log "Activating alarm #{alarm_code}, because input #{input} was activated", level: :info
267
- send_alarm code:alarm_code, status:'Active'
267
+ activate_alarm alarm_code
268
268
  else
269
269
  log "Deactivating alarm #{alarm_code}, because input #{input} was deactivated", level: :info
270
- send_alarm code:alarm_code, status:'inActive'
270
+ deactivate_alarm alarm_code
271
271
  end
272
272
  end
273
273
  end
data/lib/rsmp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RSMP
2
- VERSION = "0.12.0"
2
+ VERSION = "0.12.3"
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.12.0
4
+ version: 0.12.3
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-04-01 00:00:00.000000000 Z
11
+ date: 2022-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async