rsmp 0.7.1 → 0.7.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: 75a0ca211283d5cb97be9e6f6eaf24209a68884b8e368358d0933feef870c743
4
- data.tar.gz: 4ca8a761d69ae30d8dab706cbe93cdd2dc3ae7667f73d8a9c217467f2f52844a
3
+ metadata.gz: ca0e580278192b1577388628e8a761a8b0fe61f175c40bdd6c40fc62ab61d700
4
+ data.tar.gz: 0dd69084856cd0ba08acd74655c6a856bc6222a00bfbfb0031aff24c8df2c17a
5
5
  SHA512:
6
- metadata.gz: f21887cb5550e4f7b242bbd2fbc42c3d5ffaeb99eddcebf4a5af64e8766961c50f20c9fb885d6e8a7e718615b18e6731f01256162b57c437283f50e94646427b
7
- data.tar.gz: 3875d442deeb61c61c75d46099967da3b7f93b7e35fbc206a7d87cc9f5474004a42b91d6dafe59f2eff5fd94f8b9d1eadbb1ae66ce63e2d4ae793ed6fc38692b
6
+ metadata.gz: 4fa7f6e6f31e8d47369fb769a95d3a519262098d0821387ddfc29ef865e08ccd8f0cd49f65697eeb3ea28e0fb33783291feb2be9706784fc53891c4aaf8f6b66
7
+ data.tar.gz: 10b21ec864bb578e281686f1926303741d3182f42a2d6a82bb7a90f744fd4b50cfd704eeb773da99d96cdc1796a1876ea2b7f9d0296f303c4644d132f1d46761
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.1)
4
+ rsmp (0.7.5)
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)
@@ -95,7 +95,7 @@ GEM
95
95
  thor
96
96
  thread_safe
97
97
  rake (13.0.3)
98
- regexp_parser (2.1.1)
98
+ regexp_parser (2.2.0)
99
99
  rsmp_schemer (0.3.2)
100
100
  json_schemer (~> 0.2.18)
101
101
  rspec (3.10.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'
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' => ['AlarmIssue','AlarmRequest','AlarmAcknowledged','AlarmSuspend','AlarmResume'],
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
@@ -279,11 +282,7 @@ module RSMP
279
282
  end
280
283
 
281
284
  def fetch_last_sent_status component, code, name
282
- if @last_status_sent && @last_status_sent[component] && @last_status_sent[component][code]
283
- @last_status_sent[component][code][name]
284
- else
285
- nil
286
- end
285
+ @last_status_sent.dig component, code, name
287
286
  end
288
287
 
289
288
  def store_last_sent_status message
@@ -307,10 +306,12 @@ module RSMP
307
306
  by_code.each_pair do |code,by_name|
308
307
  by_name.each_pair do |name,subscription|
309
308
  current = nil
309
+ should_send = false
310
310
  if subscription[:interval] == 0
311
311
  # send as soon as the data changes
312
312
  if component_object
313
313
  current, age = *(component_object.get_status code, name)
314
+ current = current.to_s
314
315
  end
315
316
  last_sent = fetch_last_sent_status component, code, name
316
317
  if current != last_sent
data/lib/rsmp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RSMP
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.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.7.1
4
+ version: 0.7.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: 2021-11-18 00:00:00.000000000 Z
11
+ date: 2022-01-04 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.