rsmp 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rsmp/node.rb +7 -0
- data/lib/rsmp/probe.rb +12 -2
- data/lib/rsmp/site_proxy.rb +12 -4
- data/lib/rsmp/supervisor.rb +4 -1
- data/lib/rsmp/supervisor_proxy.rb +1 -0
- data/lib/rsmp/version.rb +1 -1
- data/lib/rsmp/wait.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cabe89d692eb93c0d2e5af449152ff5967b1318fd0163384a57c975673ffe87
|
4
|
+
data.tar.gz: cb53ef7c36c6609eed242e67db16fbf7a57455ca06de90599cb15e324a4cbc87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9520a1bd0b66eb19d7b17fda09cc8fcd1efb2219c098bf315faa0d04ba953a0e4b5ab823a8bbc425697635fac49e04b777b9dd2ec481f7651c0397c832aed2b0
|
7
|
+
data.tar.gz: a09905ee1f2128a44cbff599f36fa166601a69d97bd2f814c4d0523dfb68bbe5deafdea599b42d6dc9a251e14a48fb5b8b5f8b5a32af2b3dd8ada964b928b59b
|
data/lib/rsmp/node.rb
CHANGED
@@ -17,6 +17,7 @@ module RSMP
|
|
17
17
|
task.annotate self.class
|
18
18
|
@task = task
|
19
19
|
start_action
|
20
|
+
idle
|
20
21
|
end
|
21
22
|
rescue Errno::EADDRINUSE => e
|
22
23
|
log "Cannot start: #{e.to_s}", level: :error
|
@@ -25,6 +26,12 @@ module RSMP
|
|
25
26
|
exiting
|
26
27
|
end
|
27
28
|
|
29
|
+
def idle
|
30
|
+
loop do
|
31
|
+
@task.sleep 60
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
28
35
|
def stop
|
29
36
|
@task.stop if @task
|
30
37
|
end
|
data/lib/rsmp/probe.rb
CHANGED
@@ -94,10 +94,20 @@ module RSMP
|
|
94
94
|
|
95
95
|
def matches? item
|
96
96
|
raise ArgumentError unless item
|
97
|
-
|
97
|
+
|
98
|
+
if @options[:type]
|
99
|
+
return false if item[:message] == nil
|
100
|
+
if @options[:type].is_a? Array
|
101
|
+
return false unless @options[:type].include? item[:message].type
|
102
|
+
else
|
103
|
+
return false unless item[:message].type == @options[:type]
|
104
|
+
end
|
105
|
+
end
|
98
106
|
return if @options[:level] && item[:level] != @options[:level]
|
99
107
|
return false if @options[:with_message] && !(item[:direction] && item[:message])
|
100
|
-
|
108
|
+
if @block
|
109
|
+
return false if @block.call(item) == false
|
110
|
+
end
|
101
111
|
true
|
102
112
|
end
|
103
113
|
end
|
data/lib/rsmp/site_proxy.rb
CHANGED
@@ -134,7 +134,7 @@ module RSMP
|
|
134
134
|
"sS" => status_list
|
135
135
|
})
|
136
136
|
send_message message
|
137
|
-
return message, wait_for_status_response(
|
137
|
+
return message, wait_for_status_response(message: message, timeout: timeout)
|
138
138
|
end
|
139
139
|
|
140
140
|
def process_status_response message
|
@@ -143,9 +143,17 @@ module RSMP
|
|
143
143
|
end
|
144
144
|
|
145
145
|
def wait_for_status_response options
|
146
|
-
raise ArgumentError unless options[:
|
147
|
-
item = @archive.capture(@task, options.merge(
|
148
|
-
|
146
|
+
raise ArgumentError unless options[:message]
|
147
|
+
item = @archive.capture(@task, options.merge(
|
148
|
+
type: ['StatusResponse','MessageNotAck'],
|
149
|
+
with_message: true,
|
150
|
+
num: 1
|
151
|
+
)) do |item|
|
152
|
+
if item[:message].type == 'MessageNotAck'
|
153
|
+
next item[:message].attribute('oMId') == options[:message].m_id
|
154
|
+
elsif item[:message].type == 'StatusResponse'
|
155
|
+
next item[:message].attribute('cId') == options[:message].attribute('cId')
|
156
|
+
end
|
149
157
|
end
|
150
158
|
item[:message] if item
|
151
159
|
end
|
data/lib/rsmp/supervisor.rb
CHANGED
@@ -30,7 +30,8 @@ module RSMP
|
|
30
30
|
'status_response_timeout' => 1,
|
31
31
|
'status_update_timeout' => 1,
|
32
32
|
'site_connect_timeout' => 2,
|
33
|
-
'site_ready_timeout' => 1
|
33
|
+
'site_ready_timeout' => 1,
|
34
|
+
'stop_after_first_session' => false
|
34
35
|
}
|
35
36
|
|
36
37
|
if options[:supervisor_settings]
|
@@ -128,6 +129,8 @@ module RSMP
|
|
128
129
|
proxy.run # will run until the site disconnects
|
129
130
|
@proxies.delete proxy
|
130
131
|
site_ids_changed
|
132
|
+
|
133
|
+
stop if @supervisor_settings['stop_after_first_session']
|
131
134
|
end
|
132
135
|
|
133
136
|
def site_ids_changed
|
@@ -174,6 +174,7 @@ module RSMP
|
|
174
174
|
def process_status_subcribe message
|
175
175
|
log "Received #{message.type}", message: message, level: :log
|
176
176
|
|
177
|
+
|
177
178
|
# @status_subscriptions is organized by component/code/name, for example:
|
178
179
|
#
|
179
180
|
# {"AA+BBCCC=DDDEE002"=>{"S001"=>["number"]}}
|
data/lib/rsmp/version.rb
CHANGED
data/lib/rsmp/wait.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emil Tin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -357,7 +357,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
357
357
|
- !ruby/object:Gem::Version
|
358
358
|
version: '0'
|
359
359
|
requirements: []
|
360
|
-
rubygems_version: 3.0.
|
360
|
+
rubygems_version: 3.0.3
|
361
361
|
signing_key:
|
362
362
|
specification_version: 4
|
363
363
|
summary: RoadSide Message Protocol (RSMP) library.
|