rsmp 0.13.5 → 0.13.9

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: 71b36c94ecbd9272b5ae78759835c9ea1bfa4180badc3194b9be53bedb79afd3
4
- data.tar.gz: 31804088149dac7cd977cbb1a5245275b940f5c949b7568cd16173822cddbf4a
3
+ metadata.gz: '08492adc58ab046ad5b4ff844ce630aa3dba8962b768ec1787b4867c9d221a38'
4
+ data.tar.gz: a3f3d1182268d14369bbca723b3bc72cc1969327a4e0c3a6c268f7e920b0b1bb
5
5
  SHA512:
6
- metadata.gz: 9a76596f45499c98ed5935ff4464f9111a43981042447d3900b0ad155ec146627e9241133820385494c51ecf12dc5799fcd8cc48b108b8f4f5278d05c458c5a3
7
- data.tar.gz: 508136a654c2040c024405b25a03c1edb8bd179144e5c6e1b6b92ecce86a6fd4d4a447ca8a84b1b41381ff6c6519bd6a87ad8e929df9a3e8ac47bf7d8cb53503
6
+ metadata.gz: 3a1379ea993e6bb1bce084a27fd347db40859113b1d55cbfac6c175e9f66ba47b95aa1f2a41cdd933c4dcc2c0174a217861c13c88f3491b2e5c40bcb393cdcdb
7
+ data.tar.gz: ed45664a849d801cb9ab385365653055349c4ce4138c701ff5bf3413f71289524fdac532bd14d1b2b6a6d06db964529cef5ac845343428eea061143a440e9f04
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.0
1
+ 3.1.2
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.13.5)
5
- async (~> 1.29.1)
6
- async-io (~> 1.32.2)
4
+ rsmp (0.13.9)
5
+ async (~> 1.30.3)
6
+ async-io (~> 1.33.0)
7
7
  colorize (~> 0.8.1)
8
8
  rsmp_schemer
9
9
  thor (~> 1.2.1)
@@ -11,18 +11,18 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- aruba (2.0.0)
14
+ aruba (2.0.1)
15
15
  bundler (>= 1.17, < 3.0)
16
16
  childprocess (>= 2.0, < 5.0)
17
17
  contracts (>= 0.16.0, < 0.18.0)
18
18
  cucumber (>= 4.0, < 8.0)
19
19
  rspec-expectations (~> 3.4)
20
20
  thor (~> 1.0)
21
- async (1.29.2)
21
+ async (1.30.3)
22
22
  console (~> 1.10)
23
23
  nio4r (~> 2.3)
24
24
  timers (~> 4.1)
25
- async-io (1.32.2)
25
+ async-io (1.33.0)
26
26
  async
27
27
  builder (3.2.4)
28
28
  childprocess (4.1.0)
@@ -79,26 +79,26 @@ GEM
79
79
  multi_test (0.1.2)
80
80
  nio4r (2.5.8)
81
81
  rake (13.0.6)
82
- regexp_parser (2.4.0)
83
- rsmp_schemer (0.4.0)
84
- json_schemer (~> 0.2.18)
82
+ regexp_parser (2.5.0)
83
+ rsmp_schemer (0.4.2)
84
+ json_schemer (~> 0.2.21)
85
85
  rspec (3.10.0)
86
86
  rspec-core (~> 3.10.0)
87
87
  rspec-expectations (~> 3.10.0)
88
88
  rspec-mocks (~> 3.10.0)
89
- rspec-core (3.10.1)
89
+ rspec-core (3.10.2)
90
90
  rspec-support (~> 3.10.0)
91
91
  rspec-expectations (3.10.2)
92
92
  diff-lcs (>= 1.2.0, < 2.0)
93
93
  rspec-support (~> 3.10.0)
94
- rspec-mocks (3.10.2)
94
+ rspec-mocks (3.10.3)
95
95
  diff-lcs (>= 1.2.0, < 2.0)
96
96
  rspec-support (~> 3.10.0)
97
97
  rspec-support (3.10.3)
98
98
  sys-uname (1.2.2)
99
99
  ffi (~> 1.1)
100
100
  thor (1.2.1)
101
- timecop (0.9.4)
101
+ timecop (0.9.5)
102
102
  timers (4.3.3)
103
103
  uri_template (0.7.0)
104
104
 
@@ -112,7 +112,7 @@ PLATFORMS
112
112
 
113
113
  DEPENDENCIES
114
114
  aruba (~> 2.0.0)
115
- bundler (~> 2.3.6)
115
+ bundler (~> 2.3.7)
116
116
  cucumber (~> 7.1.0)
117
117
  rake (~> 13.0.6)
118
118
  rsmp!
@@ -121,4 +121,4 @@ DEPENDENCIES
121
121
  timecop (~> 0.9.4)
122
122
 
123
123
  BUNDLED WITH
124
- 2.3.6
124
+ 2.3.7
data/config/tlc.yaml CHANGED
@@ -8,6 +8,7 @@ components:
8
8
  main:
9
9
  TC:
10
10
  cycle_time: 6
11
+ ntsOId: KK+AG9998=001TC000
11
12
  signal_group:
12
13
  A1:
13
14
  A2:
@@ -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.5"
2
+ VERSION = "0.13.9"
3
3
  end
data/rsmp.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.description = %q{Easy RSMP site and supervisor communication.}
14
14
  spec.homepage = "https://github.com/rsmp-nordic/rsmp"
15
15
  spec.licenses = ['MIT']
16
- spec.required_ruby_version = '>= 2.0.0'
16
+ spec.required_ruby_version = '>= 3.0.0'
17
17
 
18
18
  spec.metadata["homepage_uri"] = spec.homepage
19
19
  spec.metadata["source_code_uri"] = "https://github.com/rsmp-nordic/rsmp"
@@ -30,13 +30,13 @@ Gem::Specification.new do |spec|
30
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
 
33
- spec.add_dependency "async", "~> 1.29.1"
34
- spec.add_dependency "async-io", "~> 1.32.2"
33
+ spec.add_dependency "async", "~> 1.30.3"
34
+ spec.add_dependency "async-io", "~> 1.33.0"
35
35
  spec.add_dependency "colorize", "~> 0.8.1"
36
36
  spec.add_dependency "thor", "~> 1.2.1"
37
37
  spec.add_dependency "rsmp_schemer"
38
38
 
39
- spec.add_development_dependency "bundler", "~> 2.3.6"
39
+ spec.add_development_dependency "bundler", "~> 2.3.7"
40
40
  spec.add_development_dependency "rake", "~> 13.0.6"
41
41
  spec.add_development_dependency "rspec", "~> 3.10.0"
42
42
  spec.add_development_dependency "rspec-expectations", "~> 3.10.2"
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.5
4
+ version: 0.13.9
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-05-16 00:00:00.000000000 Z
11
+ date: 2022-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.29.1
19
+ version: 1.30.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.29.1
26
+ version: 1.30.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: async-io
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.32.2
33
+ version: 1.33.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.32.2
40
+ version: 1.33.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: colorize
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 2.3.6
89
+ version: 2.3.7
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 2.3.6
96
+ version: 2.3.7
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -269,14 +269,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
269
269
  requirements:
270
270
  - - ">="
271
271
  - !ruby/object:Gem::Version
272
- version: 2.0.0
272
+ version: 3.0.0
273
273
  required_rubygems_version: !ruby/object:Gem::Requirement
274
274
  requirements:
275
275
  - - ">="
276
276
  - !ruby/object:Gem::Version
277
277
  version: '0'
278
278
  requirements: []
279
- rubygems_version: 3.3.3
279
+ rubygems_version: 3.3.7
280
280
  signing_key:
281
281
  specification_version: 4
282
282
  summary: RoadSide Message Protocol (RSMP) library.