rsmp 0.13.1 → 0.13.2

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: c1840c079564613302ef539e2c0a502c2cafdabe8c875ab2dfb3b389470becf8
4
- data.tar.gz: 35eda6efcfabe4624ba58d5150b3c1263a34a2a0b1f363b1a704566acc65cfed
3
+ metadata.gz: dfc37b07159cf717f60f293434f6fda0ff6935ad209967b7d5ddb025a9794600
4
+ data.tar.gz: 5c5e6b1e7728bdffd50776e95a7beb0fd6261dbb58b4ec3f530f7b33ee15cdf4
5
5
  SHA512:
6
- metadata.gz: 32c6bb82731643e24000e2056a19896fa591755b1336ccad74df28b82ee9800cdb16ee96e6d6e1996e09137fa22cfed5c64801d8b131953a4abc94d32ba9ab08
7
- data.tar.gz: d588d1e92eb16473ee86e25e0a595d6bd03c4744f113860bbe89be6f3c3df6ab19bb522daea617f28e8b32708a048d4a2895700cda8de34fed6fd986de85c6a4
6
+ metadata.gz: 201cad0d07ee914d79af82d8ad2ee10740fbe49002e1f3cbb2740b3d573df61c26532688651e6f6f70ea538e0475f51cbe0a46055b2b6331cd5fff48aa4b8d3e
7
+ data.tar.gz: 74a44c4ac848c9dbe5f0fbd772f2839c5565a8322d7292218d64f7e31f5fdf8e4849e59845fee361d0ca1ed0ecaa2ce067fdc71a86eaf0e50959e0d826742b2f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.13.1)
4
+ rsmp (0.13.2)
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.20)
71
+ json_schemer (0.2.21)
72
72
  ecma-re-validator (~> 0.3)
73
73
  hana (~> 1.3)
74
74
  regexp_parser (~> 2.0)
@@ -79,7 +79,7 @@ GEM
79
79
  multi_test (0.1.2)
80
80
  nio4r (2.5.8)
81
81
  rake (13.0.6)
82
- regexp_parser (2.3.1)
82
+ regexp_parser (2.4.0)
83
83
  rsmp_schemer (0.4.0)
84
84
  json_schemer (~> 0.2.18)
85
85
  rspec (3.10.0)
@@ -1,7 +1,7 @@
1
1
  module RSMP
2
2
  # RSMP component
3
3
  class Component < ComponentBase
4
- def initialize node:, id:, grouped: false
4
+ def initialize node:, id:, ntsOId: nil, xNId: nil, grouped: false
5
5
  super
6
6
  end
7
7
 
@@ -5,7 +5,8 @@ module RSMP
5
5
  class ComponentBase
6
6
  include Inspect
7
7
 
8
- attr_reader :c_id, :node, :alarms, :statuses, :aggregated_status, :aggregated_status_bools, :grouped
8
+ attr_reader :c_id, :ntsOId, :xNId, :node, :alarms, :statuses,
9
+ :aggregated_status, :aggregated_status_bools, :grouped
9
10
 
10
11
  AGGREGATED_STATUS_KEYS = [ :local_control,
11
12
  :communication_distruption,
@@ -16,8 +17,13 @@ module RSMP
16
17
  :rest,
17
18
  :not_connected ]
18
19
 
19
- def initialize node:, id:, grouped: false
20
+ def initialize node:, id:, ntsOId: nil, xNId: nil, grouped: false
21
+ if grouped==false && (ntsOId || xNId)
22
+ raise RSMP::ConfigurationError.new("ntsOId and xNId are only allowed for grouped objects")
23
+ end
20
24
  @c_id = id
25
+ @ntsOId = ntsOId
26
+ @xNId = xNId
21
27
  @node = node
22
28
  @grouped = grouped
23
29
  clear_aggregated_status
data/lib/rsmp/proxy.rb CHANGED
@@ -643,5 +643,13 @@ module RSMP
643
643
  return { sent: message }
644
644
  end
645
645
  end
646
+
647
+ 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
653
+ end
646
654
  end
647
655
  end
@@ -114,13 +114,11 @@ module RSMP
114
114
  def request_aggregated_status component, options={}
115
115
  validate_ready 'request aggregated status'
116
116
  m_id = options[:m_id] || RSMP::Message.make_m_id
117
-
118
117
  message = RSMP::AggregatedStatusRequest.new({
119
- "ntsOId" => @ntsOId,
120
- "xNId" => @xNId,
121
- "cId" => component,
122
- "mId" => m_id
118
+ "cId" => component,
119
+ "mId" => m_id
123
120
  })
121
+ set_nts_message_attributes message
124
122
  send_and_optionally_collect message, options do |collect_options|
125
123
  AggregatedStatusCollector.new(
126
124
  self,
@@ -187,12 +185,11 @@ module RSMP
187
185
  request_list = status_list.map { |item| item.slice('sCI','n') }
188
186
 
189
187
  message = RSMP::StatusRequest.new({
190
- "ntsOId" => @ntsOId,
191
- "xNId" => @xNId,
192
188
  "cId" => component,
193
189
  "sS" => request_list,
194
190
  "mId" => m_id
195
191
  })
192
+ set_nts_message_attributes message
196
193
  send_and_optionally_collect message, options do |collect_options|
197
194
  StatusCollector.new(
198
195
  self,
@@ -232,12 +229,11 @@ module RSMP
232
229
  component.allow_repeat_updates subscribe_list
233
230
 
234
231
  message = RSMP::StatusSubscribe.new({
235
- "ntsOId" => @ntsOId,
236
- "xNId" => @xNId,
237
232
  "cId" => component_id,
238
233
  "sS" => subscribe_list,
239
234
  'mId' => m_id
240
235
  })
236
+ set_nts_message_attributes message
241
237
  send_and_optionally_collect message, options do |collect_options|
242
238
  StatusCollector.new(
243
239
  self,
@@ -262,11 +258,10 @@ module RSMP
262
258
  end
263
259
 
264
260
  message = RSMP::StatusUnsubscribe.new({
265
- "ntsOId" => @ntsOId,
266
- "xNId" => @xNId,
267
261
  "cId" => component_id,
268
262
  "sS" => status_list
269
263
  })
264
+ set_nts_message_attributes message
270
265
  send_message message, validate: options[:validate]
271
266
  message
272
267
  end
@@ -292,12 +287,11 @@ module RSMP
292
287
  validate_ready 'send command'
293
288
  m_id = options[:m_id] || RSMP::Message.make_m_id
294
289
  message = RSMP::CommandRequest.new({
295
- "ntsOId" => @ntsOId,
296
- "xNId" => @xNId,
297
290
  "cId" => component,
298
291
  "arg" => command_list,
299
292
  "mId" => m_id
300
293
  })
294
+ set_nts_message_attributes message
301
295
  send_and_optionally_collect message, options do |collect_options|
302
296
  CommandResponseCollector.new(
303
297
  self,
@@ -369,8 +363,6 @@ module RSMP
369
363
  @site_settings = find_site_settings @site_id
370
364
  if @site_settings
371
365
  @sxl = @site_settings['sxl']
372
- @ntsOId = @site_settings['ntsOId']
373
- @xNId = @site_settings['xNId']
374
366
  setup_components @site_settings['components']
375
367
  else
376
368
  dont_acknowledge message, 'Rejected', "No config found for site #{@site_id}"
@@ -15,8 +15,6 @@ module RSMP
15
15
  @port = options[:port]
16
16
  @status_subscriptions = {}
17
17
  @sxl = @site_settings['sxl']
18
- @ntsOId = @site_settings['ntsOId']
19
- @xNId = @site_settings['xNId']
20
18
  @synthetic_id = Supervisor.build_id_from_ip_port @ip, @port
21
19
  end
22
20
 
@@ -162,9 +160,7 @@ module RSMP
162
160
  "se" => component.aggregated_status_bools,
163
161
  "mId" => m_id,
164
162
  })
165
- message.attributes['ntsOId'] = @site_settings['ntsOId'] if @site_settings['ntsOId']
166
- message.attributes['xNId'] = @site_settings['xNId'] if @site_settings['xNId']
167
-
163
+ set_nts_message_attributes message
168
164
  send_and_optionally_collect message, options do |collect_options|
169
165
  Collector.new self, collect_options.merge(task:@task, type: 'MessageAck')
170
166
  end
@@ -9,9 +9,9 @@ module RSMP
9
9
  :functional_position,
10
10
  :startup_sequence_active, :startup_sequence, :startup_sequence_pos
11
11
 
12
- def initialize node:, id:, cycle_time: 10, signal_plans:,
12
+ def initialize node:, id:, ntsOId: nil, xNId: nil, cycle_time: 10, signal_plans:,
13
13
  startup_sequence:, live_output:nil, inputs:{}
14
- super node: node, id: id, grouped: true
14
+ super node: node, id: id, ntsOId: ntsOId, xNId: xNId, grouped: true
15
15
  @signal_groups = []
16
16
  @detector_logics = []
17
17
  @plans = signal_plans
@@ -52,7 +52,10 @@ 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, id: id,
55
+ @main = TrafficController.new node: self,
56
+ id: id,
57
+ ntsOId: settings['ntsOId'],
58
+ xNId: settings['xNId'],
56
59
  cycle_time: settings['cycle_time'],
57
60
  startup_sequence: @startup_sequence,
58
61
  signal_plans: @signal_plans,
data/lib/rsmp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RSMP
2
- VERSION = "0.13.1"
2
+ VERSION = "0.13.2"
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.1
4
+ version: 0.13.2
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-26 00:00:00.000000000 Z
11
+ date: 2022-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async