rsmp 0.6.3 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/config/supervisor.yaml +0 -2
- data/config/tlc.yaml +0 -2
- data/lib/rsmp/component.rb +9 -8
- data/lib/rsmp/error.rb +3 -0
- data/lib/rsmp/logger.rb +20 -4
- data/lib/rsmp/message.rb +1 -1
- data/lib/rsmp/supervisor_proxy.rb +11 -4
- data/lib/rsmp/tlc/traffic_controller_site.rb +6 -1
- data/lib/rsmp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75a0ca211283d5cb97be9e6f6eaf24209a68884b8e368358d0933feef870c743
|
4
|
+
data.tar.gz: 4ca8a761d69ae30d8dab706cbe93cdd2dc3ae7667f73d8a9c217467f2f52844a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f21887cb5550e4f7b242bbd2fbc42c3d5ffaeb99eddcebf4a5af64e8766961c50f20c9fb885d6e8a7e718615b18e6731f01256162b57c437283f50e94646427b
|
7
|
+
data.tar.gz: 3875d442deeb61c61c75d46099967da3b7f93b7e35fbc206a7d87cc9f5474004a42b91d6dafe59f2eff5fd94f8b9d1eadbb1ae66ce63e2d4ae793ed6fc38692b
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -125,7 +125,7 @@ This will output messages form both the site and the supervisor, ordered chronol
|
|
125
125
|
```console
|
126
126
|
RN+SU0001 Starting supervisor RN+SU0001 on port 12111
|
127
127
|
RN+SI0001 Starting site RN+SI0001
|
128
|
-
RN+SI0001 Connecting to
|
128
|
+
RN+SI0001 Connecting to supervisor at 127.0.0.1:12111
|
129
129
|
RN+SI0001 <-- f8c7 Sent Version
|
130
130
|
RN+SU0001 Site connected from 127.0.0.1:53500
|
131
131
|
RN+SU0001 RN+SI0001 --> f8c7 Received Version message for sites [RN+SI0001] using RSMP 3.1.4
|
@@ -156,7 +156,7 @@ The ```site``` command will start an RSMP site, which will try to connect to one
|
|
156
156
|
```console
|
157
157
|
% rsmp site
|
158
158
|
2019-11-11 12:22:00 UTC Starting site RN+SI0001
|
159
|
-
2019-11-11 12:22:00 UTC Connecting to
|
159
|
+
2019-11-11 12:22:00 UTC Connecting to supervisor at 127.0.0.1:12111
|
160
160
|
2019-11-11 12:22:00 UTC <-- 792f Sent Version
|
161
161
|
2019-11-11 12:22:00 UTC RN+SU0001 --> e70e Received Version message, using RSMP 3.1.4
|
162
162
|
2019-11-11 12:22:00 UTC RN+SU0001 Connection to supervisor established
|
data/config/supervisor.yaml
CHANGED
data/config/tlc.yaml
CHANGED
data/lib/rsmp/component.rb
CHANGED
@@ -79,16 +79,17 @@ module RSMP
|
|
79
79
|
|
80
80
|
def handle_alarm message
|
81
81
|
code = message.attribute('aCId')
|
82
|
-
|
83
|
-
if
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
82
|
+
previous = @alarms[code]
|
83
|
+
if previous
|
84
|
+
unless message.differ?(previous)
|
85
|
+
raise RepeatedAlarmError.new("no changes from previous alarm #{previous.m_id_short}")
|
86
|
+
end
|
87
|
+
if Time.parse(message.attribute('aTs')) < Time.parse(previous.attribute('aTs'))
|
88
|
+
raise TimestampError.new("timestamp is earlier than previous alarm #{previous.m_id_short}")
|
88
89
|
end
|
89
|
-
else
|
90
|
-
@alarms[code] = message
|
91
90
|
end
|
91
|
+
ensure
|
92
|
+
@alarms[code] = message
|
92
93
|
end
|
93
94
|
|
94
95
|
# Handle an incoming status respone, by storing the values
|
data/lib/rsmp/error.rb
CHANGED
data/lib/rsmp/logger.rb
CHANGED
@@ -14,6 +14,7 @@ module RSMP
|
|
14
14
|
'hide_ip_and_port' => false,
|
15
15
|
'acknowledgements' => false,
|
16
16
|
'watchdogs' => false,
|
17
|
+
'alarms' => true,
|
17
18
|
'json'=>false,
|
18
19
|
'tabs'=>'-',
|
19
20
|
|
@@ -24,6 +25,7 @@ module RSMP
|
|
24
25
|
'ip'=>false,
|
25
26
|
'port'=>false,
|
26
27
|
'site_id'=>true,
|
28
|
+
'component'=>true,
|
27
29
|
'direction'=>false,
|
28
30
|
'level'=>false,
|
29
31
|
'id'=>true,
|
@@ -43,6 +45,15 @@ module RSMP
|
|
43
45
|
'id'=>4,
|
44
46
|
}
|
45
47
|
|
48
|
+
@ignorable = {
|
49
|
+
'versions' => ['Version'],
|
50
|
+
'statuses' => ['StatusRequest','StatusSubscribe','StatusUnsubscribe','StatusResponse','StatusUpdate'],
|
51
|
+
'commands' => ['CommandRequest','CommandResponse'],
|
52
|
+
'watchdogs' => 'Watchdog',
|
53
|
+
'alarms' => ['AlarmIssue','AlarmRequest','AlarmAcknowledged','AlarmSuspend','AlarmResume'],
|
54
|
+
'aggregated_status' => ['AggregatedStatus','AggregatedStatusRequest']
|
55
|
+
}
|
56
|
+
|
46
57
|
if settings
|
47
58
|
@settings = defaults.merge settings
|
48
59
|
else
|
@@ -95,10 +106,15 @@ module RSMP
|
|
95
106
|
if item[:message]
|
96
107
|
type = item[:message].type
|
97
108
|
ack = type == "MessageAck" || type == "MessageNotAck"
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
109
|
+
@ignorable.each_pair do |key,types|
|
110
|
+
next unless types
|
111
|
+
ignore = [types].flatten
|
112
|
+
if @settings[key] == false
|
113
|
+
#p [type,ignore_type, [ignore_type].flatten.include?(type)]
|
114
|
+
return false if ignore.include?(type)
|
115
|
+
if ack
|
116
|
+
return false if item[:message].original && ignore.include?(item[:message].original.type)
|
117
|
+
end
|
102
118
|
end
|
103
119
|
end
|
104
120
|
return false if ack && @settings["acknowledgements"] == false &&
|
data/lib/rsmp/message.rb
CHANGED
@@ -126,7 +126,7 @@ module RSMP
|
|
126
126
|
end
|
127
127
|
|
128
128
|
def initialize attributes = {}
|
129
|
-
@timestamp = Time.now # this timestamp is for internal use, and does not the clock
|
129
|
+
@timestamp = Time.now # this timestamp is for internal use, and does not use the clock
|
130
130
|
# in the node, which can be set by an rsmp supervisor
|
131
131
|
|
132
132
|
@attributes = { "mType"=> "rSMsg" }.merge attributes
|
@@ -23,15 +23,22 @@ module RSMP
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def start
|
26
|
-
log "Connecting to
|
26
|
+
log "Connecting to supervisor at #{@ip}:#{@port}", level: :info
|
27
27
|
super
|
28
28
|
connect
|
29
29
|
@logger.unmute @ip, @port
|
30
|
-
log "Connected to
|
30
|
+
log "Connected to supervisor at #{@ip}:#{@port}", level: :info
|
31
31
|
start_reader
|
32
32
|
send_version @site_settings['site_id'], @site_settings["rsmp_versions"]
|
33
|
-
rescue
|
34
|
-
log "
|
33
|
+
rescue SystemCallError => e
|
34
|
+
log "Could not connect to supervisor at #{@ip}:#{@port}: Errno #{e.errno} #{e}", level: :error
|
35
|
+
retry_notice
|
36
|
+
rescue StandardError => e
|
37
|
+
log "Error while connecting to supervisor at #{@ip}:#{@port}: #{e}", level: :error
|
38
|
+
retry_notice
|
39
|
+
end
|
40
|
+
|
41
|
+
def retry_notice
|
35
42
|
unless @site.site_settings['intervals']['reconnect'] == :no
|
36
43
|
log "Will try to reconnect again every #{@site.site_settings['intervals']['reconnect']} seconds..", level: :info
|
37
44
|
@logger.mute @ip, @port
|
@@ -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
|
-
|
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