rsmp 0.13.2 → 0.13.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dfc37b07159cf717f60f293434f6fda0ff6935ad209967b7d5ddb025a9794600
4
- data.tar.gz: 5c5e6b1e7728bdffd50776e95a7beb0fd6261dbb58b4ec3f530f7b33ee15cdf4
3
+ metadata.gz: 71b36c94ecbd9272b5ae78759835c9ea1bfa4180badc3194b9be53bedb79afd3
4
+ data.tar.gz: 31804088149dac7cd977cbb1a5245275b940f5c949b7568cd16173822cddbf4a
5
5
  SHA512:
6
- metadata.gz: 201cad0d07ee914d79af82d8ad2ee10740fbe49002e1f3cbb2740b3d573df61c26532688651e6f6f70ea538e0475f51cbe0a46055b2b6331cd5fff48aa4b8d3e
7
- data.tar.gz: 74a44c4ac848c9dbe5f0fbd772f2839c5565a8322d7292218d64f7e31f5fdf8e4849e59845fee361d0ca1ed0ecaa2ce067fdc71a86eaf0e50959e0d826742b2f
6
+ metadata.gz: 9a76596f45499c98ed5935ff4464f9111a43981042447d3900b0ad155ec146627e9241133820385494c51ecf12dc5799fcd8cc48b108b8f4f5278d05c458c5a3
7
+ data.tar.gz: 508136a654c2040c024405b25a03c1edb8bd179144e5c6e1b6b92ecce86a6fd4d4a447ca8a84b1b41381ff6c6519bd6a87ad8e929df9a3e8ac47bf7d8cb53503
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.13.2)
4
+ rsmp (0.13.5)
5
5
  async (~> 1.29.1)
6
6
  async-io (~> 1.32.2)
7
7
  colorize (~> 0.8.1)
@@ -27,7 +27,7 @@ GEM
27
27
  builder (3.2.4)
28
28
  childprocess (4.1.0)
29
29
  colorize (0.8.1)
30
- console (1.15.0)
30
+ console (1.15.3)
31
31
  fiber-local
32
32
  contracts (0.17)
33
33
  cucumber (7.1.0)
@@ -1,7 +1,7 @@
1
1
  module RSMP
2
2
  # A proxy to a remote RSMP component.
3
3
  class ComponentProxy < ComponentBase
4
- def initialize node:, id:, grouped: false
4
+ def initialize node:, id:, ntsOId: nil, xNId: nil, grouped: false
5
5
  super
6
6
  @alarms = {}
7
7
  @statuses = {}
@@ -2,10 +2,11 @@
2
2
 
3
3
  module RSMP
4
4
  module Components
5
- attr_reader :components
5
+ attr_reader :components, :main
6
6
 
7
7
  def initialize_components
8
8
  @components = {}
9
+ @main = nil
9
10
  end
10
11
 
11
12
  def aggregated_status_changed component, options={}
@@ -18,6 +19,7 @@ module RSMP
18
19
  if components_by_type
19
20
  components_by_type.each_pair do |id,settings|
20
21
  @components[id] = build_component(id:id, type:type, settings:settings)
22
+ @main = @components[id] if type=='main'
21
23
  end
22
24
  end
23
25
  end
@@ -36,10 +38,6 @@ module RSMP
36
38
  @components[component.c_id] = component
37
39
  end
38
40
 
39
- #def build_component id:, type:, settings:{}
40
- # Component.new id:id, node: self, grouped: type=='main'
41
- #end
42
-
43
41
  def infer_component_type component_id
44
42
  Component
45
43
  end
data/lib/rsmp/proxy.rb CHANGED
@@ -438,7 +438,6 @@ module RSMP
438
438
  end
439
439
 
440
440
  def will_not_handle message
441
- "WILL NOT HANDLE"
442
441
  reason = "since we're a #{self.class.name.downcase}" unless reason
443
442
  log "Ignoring #{message.type}, #{reason}", message: message, level: :warning
444
443
  dont_acknowledge message, nil, reason
@@ -645,11 +644,8 @@ module RSMP
645
644
  end
646
645
 
647
646
  def set_nts_message_attributes message
648
- return unless @site && @site.main
649
- ntsOId = @site.main.ntsOId
650
- xNId = @site.main.xNId
651
- message.attributes['ntsOId'] = ntsOId if ntsOId
652
- message.attributes['xNId'] = xNId if xNId
647
+ message.attributes['ntsOId'] = (main && main.ntsOId) ? main.ntsOId : ''
648
+ message.attributes['xNId'] = (main && main.xNId) ? main.xNId : ''
653
649
  end
654
650
  end
655
651
  end
data/lib/rsmp/site.rb CHANGED
@@ -161,7 +161,12 @@ module RSMP
161
161
  end
162
162
 
163
163
  def build_component id:, type:, settings:{}
164
- Component.new id:id, node: self, grouped: type=='main'
164
+ if type == 'main'
165
+ Component.new id:id, node: self, grouped: true,
166
+ ntsOId: settings['ntsOId'], xNId: settings['xNId']
167
+ else
168
+ Component.new id:id, node: self, grouped: false
169
+ end
165
170
  end
166
171
  end
167
172
  end
@@ -375,7 +375,13 @@ module RSMP
375
375
  end
376
376
 
377
377
  def build_component id:, type:, settings:{}
378
- ComponentProxy.new id:id, node: self, grouped: type=='main'
378
+ settings ||= {}
379
+ if type == 'main'
380
+ ComponentProxy.new id:id, node: self, grouped: true,
381
+ ntsOId: settings['ntsOId'], xNId: settings['xNId']
382
+ else
383
+ ComponentProxy.new id:id, node: self, grouped: false
384
+ end
379
385
  end
380
386
 
381
387
  end
@@ -254,6 +254,7 @@ module RSMP
254
254
  "cTS"=>clock.to_s,
255
255
  "rvs"=>rvs
256
256
  })
257
+ set_nts_message_attributes response
257
258
  acknowledge message
258
259
  send_message response
259
260
  end
@@ -272,6 +273,7 @@ module RSMP
272
273
  "sS"=>sS,
273
274
  "mId" => options[:m_id]
274
275
  })
276
+ set_nts_message_attributes response
275
277
  acknowledge message
276
278
  send_message response
277
279
  end
@@ -409,6 +411,7 @@ module RSMP
409
411
  "sTs"=>now,
410
412
  "sS"=>sS
411
413
  })
414
+ set_nts_message_attributes update
412
415
  send_message update
413
416
  store_last_sent_status update
414
417
  end
@@ -429,5 +432,8 @@ module RSMP
429
432
  def check_sxl_version message
430
433
  end
431
434
 
435
+ def main
436
+ @site.main
437
+ end
432
438
  end
433
439
  end
@@ -15,7 +15,7 @@ module RSMP
15
15
 
16
16
  super options
17
17
 
18
- unless @main
18
+ unless main
19
19
  raise ConfigurationError.new "TLC must have a main component"
20
20
  end
21
21
 
@@ -24,7 +24,7 @@ module RSMP
24
24
  def start
25
25
  super
26
26
  start_tlc_timer
27
- @main.initiate_startup_sequence
27
+ main.initiate_startup_sequence
28
28
  end
29
29
 
30
30
  def stop_subtasks
@@ -52,7 +52,7 @@ module RSMP
52
52
  def build_component id:, type:, settings:{}
53
53
  component = case type
54
54
  when 'main'
55
- @main = TrafficController.new node: self,
55
+ TrafficController.new node: self,
56
56
  id: id,
57
57
  ntsOId: settings['ntsOId'],
58
58
  xNId: settings['xNId'],
@@ -63,11 +63,11 @@ module RSMP
63
63
  inputs: @site_settings['inputs']
64
64
  when 'signal_group'
65
65
  group = SignalGroup.new node: self, id: id
66
- @main.add_signal_group group
66
+ main.add_signal_group group
67
67
  group
68
68
  when 'detector_logic'
69
69
  logic = DetectorLogic.new node: self, id: id
70
- @main.add_detector_logic logic
70
+ main.add_detector_logic logic
71
71
  logic
72
72
  end
73
73
  end
@@ -112,8 +112,8 @@ module RSMP
112
112
  end
113
113
 
114
114
  def timer now
115
- return unless @main
116
- @main.timer now
115
+ return unless main
116
+ main.timer now
117
117
  end
118
118
 
119
119
  def verify_security_code level, code
data/lib/rsmp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RSMP
2
- VERSION = "0.13.2"
2
+ VERSION = "0.13.5"
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.2
4
+ version: 0.13.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-05-12 00:00:00.000000000 Z
11
+ date: 2022-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async