rsmp 0.13.6 → 0.13.7

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: 4cda7f9e8c968b04c5b584c0e9cb9af6ec139f955c3c305ddcb6d00b064d377f
4
- data.tar.gz: 57adfef975bb4cdb7adad247f8a3aebbd04d081e6cf92655b86925008c35f831
3
+ metadata.gz: 5e7dfc4d62630bc941181c506e6fe777e817a91270ff2797ecbfc5d0069e7d68
4
+ data.tar.gz: bacbfe1c630fdbae4eebf0604339820b00352b3cf7c312683f9e48751bef77a9
5
5
  SHA512:
6
- metadata.gz: 0e525d88e1b2f6a71a62ed3c711eee82c918a8b14d3f893b2d8ecf4351f7d4516e39ba4be6462bd398ab01be543c86a238e3de37c38bc785f18a1cc3fb2e8e6c
7
- data.tar.gz: ff0d0e1402d27b8952355cc3c65a2cb78166e334b35e281cf8707b063eb35ee606126d82650d7d94d37709cb70fbcf4e93710760bb659de13075bd8e8ce1792c
6
+ metadata.gz: c9ddb8ba148e22c1919f7ba04cb727138db1e4d56750eac87a0ab03e63431990a31950c0a1ee83d45ca09e105adb478709061e7e59cfebf5d0e794a841152341
7
+ data.tar.gz: 1bd48de932a481cec40499c0f82cf34daab58620bb3795ca3789098424baa32e47a014373c51e0e3631229d079e3facf7a703b7cbc02f0f14cab7e032ff6e75a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.13.6)
4
+ rsmp (0.13.7)
5
5
  async (~> 1.29.1)
6
6
  async-io (~> 1.32.2)
7
7
  colorize (~> 0.8.1)
@@ -17,6 +17,19 @@ module RSMP
17
17
  @rvs = []
18
18
  end
19
19
 
20
+ def to_hash
21
+ {
22
+ 'cId' => component_id,
23
+ 'aCId' => code,
24
+ 'aTs' => Clock.to_s(timestamp),
25
+ 'ack' => (acknowledged ? 'Acknowledged' : 'notAcknowledged'),
26
+ 'sS' => (suspended ? 'suspended' : 'notSuspended'),
27
+ 'aS' => (active ? 'Active' : 'inActive'),
28
+ 'cat' => category,
29
+ 'pri' => priority.to_s,
30
+ 'rvs' => rvs
31
+ }
32
+ end
20
33
  def suspend
21
34
  change, @suspended = !@suspended, true
22
35
  update_timestamp if change
@@ -89,6 +102,5 @@ module RSMP
89
102
  @priority = message.attribute('pri').to_i
90
103
  @rvs = message.attribute('rvs')
91
104
  end
92
-
93
105
  end
94
106
  end
@@ -50,8 +50,8 @@ module RSMP
50
50
  component = inferred.new node: self, id: component_id
51
51
  @components[ component_id] = component
52
52
  class_name = component.class.name.split('::').last
53
- class_name << " compoent" unless class_name == 'Component'
54
- log "Inferred #{class_name} #{component_id}", level: :debug
53
+ class_name << " component" unless (class_name == 'Component' || class_name == 'ComponentProxy')
54
+ log "Adding component #{component_id} with the inferred type #{class_name}", level: :debug
55
55
  component
56
56
  else
57
57
  raise UnknownComponent.new("Component #{component_id} not found") unless component
data/lib/rsmp/site.rb CHANGED
@@ -15,7 +15,6 @@ module RSMP
15
15
  @proxies = []
16
16
  @sleep_condition = Async::Notification.new
17
17
  @proxies_condition = Async::Notification.new
18
-
19
18
  build_proxies
20
19
  end
21
20
 
@@ -93,27 +92,13 @@ module RSMP
93
92
  end
94
93
  end
95
94
 
96
- def alarm_state_to_hash alarm_state
97
- {
98
- 'cId' => alarm_state.component_id,
99
- 'aCId' => alarm_state.code,
100
- 'aTs' => Clock.to_s(alarm_state.timestamp),
101
- 'ack' => (alarm_state.acknowledged ? 'Acknowledged' : 'notAcknowledged'),
102
- 'sS' => (alarm_state.suspended ? 'suspended' : 'notSuspended'),
103
- 'aS' => (alarm_state.active ? 'Active' : 'inActive'),
104
- 'cat' => alarm_state.category,
105
- 'pri' => alarm_state.priority.to_s,
106
- 'rvs' => alarm_state.rvs
107
- }
108
- end
109
-
110
95
  def alarm_suspended_or_resumed alarm_state
111
- alarm = AlarmIssue.new( alarm_state_to_hash(alarm_state).merge('aSp' => 'Suspend') )
96
+ alarm = AlarmIssue.new( alarm_state.to_hash.merge('aSp' => 'Suspend') )
112
97
  send_alarm alarm
113
98
  end
114
99
 
115
100
  def alarm_activated_or_deactivated alarm_state
116
- alarm = AlarmIssue.new( alarm_state_to_hash(alarm_state).merge('aSp' => 'Issue') )
101
+ alarm = AlarmIssue.new( alarm_state.to_hash.merge('aSp' => 'Issue') )
117
102
  send_alarm alarm
118
103
  end
119
104
 
@@ -384,5 +384,8 @@ module RSMP
384
384
  end
385
385
  end
386
386
 
387
+ def infer_component_type component_id
388
+ ComponentProxy
389
+ end
387
390
  end
388
391
  end
@@ -85,7 +85,10 @@ module RSMP
85
85
  sanitized_sxl_version = RSMP::Schemer.sanitize_version(sxl_version)
86
86
  log "Connection to supervisor established, using core #{@rsmp_version}, #{sxl} #{sanitized_sxl_version}", level: :info
87
87
  start_watchdog
88
- send_all_aggregated_status if @site_settings['send_after_connect']
88
+ if @site_settings['send_after_connect']
89
+ send_all_aggregated_status
90
+ send_active_alarms
91
+ end
89
92
  super
90
93
  end
91
94
 
@@ -116,9 +119,6 @@ module RSMP
116
119
  end
117
120
 
118
121
  def acknowledged_first_ingoing message
119
- # TODO
120
- # aggregateds status should only be send for later version of rsmp
121
- # to handle verison differences, we probably need inherited classes
122
122
  case message.type
123
123
  when "Watchdog"
124
124
  handshake_complete
@@ -133,6 +133,17 @@ module RSMP
133
133
  end
134
134
  end
135
135
 
136
+ def send_active_alarms
137
+ @site.components.each_pair do |c_id,component|
138
+ component.alarms.each_pair do |alarm_code, alarm_state|
139
+ if alarm_state.active
140
+ alarm = AlarmIssue.new( alarm_state.to_hash.merge('aSp' => 'Issue') )
141
+ send_message alarm
142
+ end
143
+ end
144
+ end
145
+ end
146
+
136
147
  def reconnect_delay
137
148
  return false if @site_settings['intervals']['reconnect'] == :no
138
149
  interval = @site_settings['intervals']['reconnect']
@@ -263,10 +263,10 @@ module RSMP
263
263
  if actions['raise']
264
264
  alarm_code = actions['raise']
265
265
  if change
266
- log "Activating alarm #{alarm_code}, because input #{input} was activated", level: :info
266
+ log "Activating input #{input} is programmed to activate alarm #{alarm_code}", level: :info
267
267
  activate_alarm alarm_code
268
268
  else
269
- log "Deactivating alarm #{alarm_code}, because input #{input} was deactivated", level: :info
269
+ log "Deactivating input #{input} is programmed to deactivate alarm #{alarm_code}", level: :info
270
270
  deactivate_alarm alarm_code
271
271
  end
272
272
  end
data/lib/rsmp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RSMP
2
- VERSION = "0.13.6"
2
+ VERSION = "0.13.7"
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.13.6
4
+ version: 0.13.7
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-08-04 00:00:00.000000000 Z
11
+ date: 2022-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async