rsmp 0.7.0 → 0.7.4

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: c9a318474a865aca223c43e6bfe2bb2bf55a1e0a4584a7d28c80fc87295bc1f9
4
- data.tar.gz: 64e892b4fe5b4dbd4aa910542634d82e9120f6c698eb57920c718657be200c1d
3
+ metadata.gz: 8e33d1daa5e26bfea0abc96970804ebc66f294200c5e952c4febf8105b4a9041
4
+ data.tar.gz: 6bb4d576fb0f9738f10a885265d3f58d56df78cac77ea520671d3d269de981f4
5
5
  SHA512:
6
- metadata.gz: 0c9cada8fb00a82666968a656e6896f35942ef480d0ee0e5a442be38b25cc20b89460c6317e13b3087a2c2e7b70432bd8dd69d33a010cca13685f100fc4c0aed
7
- data.tar.gz: 305d823c21f5de5f32fc143fdc5d7ad0e2c7947940fd4b261e6dd94b222c58657173cacf14c7a4aae59b263eebb1d5d7060d1b0645a99cd414a76cc8d65d55e0
6
+ metadata.gz: ec2bda9f884954830d81b65bdee1bdfeee7183e3e7655e4677defad2d0a47e76bc4004c966ef6119f7623570d9febc03a84358897803733c07255b471503097f
7
+ data.tar.gz: b660975c624bb275c7853cc8060d0c95c0abac5a60f79ab0c2327324d9e7757b618c6dc4e2e91de4924fe1b1de0c5eb480e5cf35fd620e6c4c19aa923e33051e
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.0.3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.7.0)
4
+ rsmp (0.7.4)
5
5
  async (~> 1.29.1)
6
6
  async-io (~> 1.32.1)
7
7
  colorize (~> 0.8.1)
@@ -34,7 +34,7 @@ GEM
34
34
  childprocess (4.1.0)
35
35
  colorize (0.8.1)
36
36
  concurrent-ruby (1.1.9)
37
- console (1.13.1)
37
+ console (1.14.0)
38
38
  fiber-local
39
39
  contracts (0.17)
40
40
  cucumber (6.1.0)
@@ -124,6 +124,7 @@ GEM
124
124
 
125
125
  PLATFORMS
126
126
  x86_64-darwin-20
127
+ x86_64-darwin-21
127
128
 
128
129
  DEPENDENCIES
129
130
  aruba (~> 1.1.2)
@@ -136,4 +137,4 @@ DEPENDENCIES
136
137
  timecop (~> 0.9.4)
137
138
 
138
139
  BUNDLED WITH
139
- 2.2.21
140
+ 2.2.32
data/lib/rsmp/cli.rb CHANGED
@@ -3,6 +3,10 @@ require 'rsmp'
3
3
 
4
4
  module RSMP
5
5
  class CLI < Thor
6
+ desc "version", "Show version"
7
+ def version
8
+ puts RSMP::VERSION
9
+ end
6
10
 
7
11
  desc "site", "Run RSMP site"
8
12
  method_option :config, :type => :string, :aliases => "-c", banner: 'Path to .yaml config file'
@@ -85,7 +85,7 @@ module RSMP
85
85
  raise RepeatedAlarmError.new("no changes from previous alarm #{previous.m_id_short}")
86
86
  end
87
87
  if Time.parse(message.attribute('aTs')) < Time.parse(previous.attribute('aTs'))
88
- raise RepeatedAlarmError.new("timestamp is earlier than previous alarm #{previous.m_id_short}")
88
+ raise TimestampError.new("timestamp is earlier than previous alarm #{previous.m_id_short}")
89
89
  end
90
90
  end
91
91
  ensure
data/lib/rsmp/logger.rb CHANGED
@@ -50,7 +50,7 @@ module RSMP
50
50
  'statuses' => ['StatusRequest','StatusSubscribe','StatusUnsubscribe','StatusResponse','StatusUpdate'],
51
51
  'commands' => ['CommandRequest','CommandResponse'],
52
52
  'watchdogs' => 'Watchdog',
53
- 'alarms' => ['Alarm','AlarmRequest'],
53
+ 'alarms' => ['Alarm'],
54
54
  'aggregated_status' => ['AggregatedStatus','AggregatedStatusRequest']
55
55
  }
56
56
 
@@ -105,12 +105,10 @@ module RSMP
105
105
 
106
106
  if item[:message]
107
107
  type = item[:message].type
108
- ack = type == "MessageAck" || type == "MessageNotAck"
108
+ ack = (type == "MessageAck" || type == "MessageNotAck")
109
109
  @ignorable.each_pair do |key,types|
110
- next unless types
111
110
  ignore = [types].flatten
112
111
  if @settings[key] == false
113
- #p [type,ignore_type, [ignore_type].flatten.include?(type)]
114
112
  return false if ignore.include?(type)
115
113
  if ack
116
114
  return false if item[:message].original && ignore.include?(item[:message].original.type)
@@ -68,7 +68,7 @@ module RSMP
68
68
  else
69
69
  super message
70
70
  end
71
- rescue RSMP::RepeatedAlarmError, RSMP::RepeatedStatusError => e
71
+ rescue RSMP::RepeatedAlarmError, RSMP::RepeatedStatusError, TimestampError => e
72
72
  str = "Rejected #{message.type} message,"
73
73
  dont_acknowledge message, str, "#{e}"
74
74
  notify_error e.exception("#{str}#{e.message} #{message.json}")
@@ -244,10 +244,13 @@ module RSMP
244
244
  @status_subscriptions[component] ||= {}
245
245
  update_list[component] ||= {}
246
246
  now = Time.now # internal timestamp
247
+ subs = @status_subscriptions[component]
247
248
 
248
249
  message.attributes["sS"].each do |arg|
249
250
  sCI = arg["sCI"]
250
251
  subcription = {interval: arg["uRt"].to_i, last_sent_at: now}
252
+ subs[sCI] ||= {}
253
+ subs[sCI][arg["n"]] = subcription
251
254
  update_list[component][sCI] ||= []
252
255
  update_list[component][sCI] << arg["n"]
253
256
  end
@@ -19,7 +19,12 @@ module RSMP
19
19
  @signal_plans = {}
20
20
  return unless signal_plans
21
21
  signal_plans.each_pair do |id,settings|
22
- @signal_plans[id.to_i] = SignalPlan.new(nr: id.to_i, states:settings['states'],dynamic_bands:settings['dynamic_bands'])
22
+ states = nil
23
+ bands = nil
24
+ states = settings['states'] if settings
25
+ dynamic_bands = settings['dynamic_bands'] if settings
26
+
27
+ @signal_plans[id.to_i] = SignalPlan.new(nr: id.to_i, states:states,dynamic_bands:dynamic_bands)
23
28
  end
24
29
  end
25
30
 
data/lib/rsmp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RSMP
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.4"
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.7.0
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Tin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-18 00:00:00.000000000 Z
11
+ date: 2021-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -189,6 +189,7 @@ files:
189
189
  - ".gitignore"
190
190
  - ".gitmodules"
191
191
  - ".rspec"
192
+ - ".ruby-version"
192
193
  - CHANGELOG.md
193
194
  - Gemfile
194
195
  - Gemfile.lock
@@ -262,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
263
  - !ruby/object:Gem::Version
263
264
  version: '0'
264
265
  requirements: []
265
- rubygems_version: 3.2.15
266
+ rubygems_version: 3.2.32
266
267
  signing_key:
267
268
  specification_version: 4
268
269
  summary: RoadSide Message Protocol (RSMP) library.