my_gpsd_client 0.02.04 → 0.02.05
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/my_gpsd_client.rb +43 -38
- data/lib/my_gpsd_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cca72cd805fe4666ec09ab123acc03c901c815c6d02b5d35be1a413baf5ba167
|
4
|
+
data.tar.gz: 3e8c5649ed8a39cd03b2e0a2791159ce43f5f437fe089f7651f599e0edd6c606
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12ea53ddd4aaa482822d587d4825dc7049e824aa9b50e2022b808634e73e419a3093677c7462a863dda5012c3a6d1fd5a30436bf6ba76867dd423d833c9027b8
|
7
|
+
data.tar.gz: bbdaa19ca254d5d17368ab67d1d8b5d27337a115387410507a38096c89153e3a41dd954087608b12e1624698e9e58d75d714bdfc2c711bcd9623def20cc0e433
|
data/lib/my_gpsd_client.rb
CHANGED
@@ -5,7 +5,7 @@ require 'date'
|
|
5
5
|
require 'logger'
|
6
6
|
|
7
7
|
class MyGpsdClient
|
8
|
-
attr_accessor :host, :port, :command, :min_speed, :watchdog_max, :watchdog_force,
|
8
|
+
attr_accessor :host, :port, :command, :min_speed, :watchdog_max, :watchdog_force, :watchdog_euthanized
|
9
9
|
:log_progname, :log_level, :log_path, :log_format, :log_time_format
|
10
10
|
attr_reader :version, :last_watch, :socket_ready, :socket, :msg_counts, :watchdog_fired_count,
|
11
11
|
:readthread, :socket_init_thread, :watchdogthread, :watchdog_count
|
@@ -71,6 +71,7 @@ class MyGpsdClient
|
|
71
71
|
@watchdog_max = DEFAULT_WATCHDOG_MAX
|
72
72
|
@watchdog_fired_count = 0
|
73
73
|
@watchdog_force = false
|
74
|
+
@watchdog_euthanized = false
|
74
75
|
@min_speed = 0 # speed needs to be higher than this to make the gps info count
|
75
76
|
@last = nil #last gps info
|
76
77
|
@sats = nil # last satellites info
|
@@ -218,44 +219,48 @@ class MyGpsdClient
|
|
218
219
|
|
219
220
|
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
220
221
|
# background thread to implement a watchdog timer
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
my_logger msg: "Watchdog Thread
|
225
|
-
@
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
@watchdog_count = 0.0
|
238
|
-
@watchdog_fired_count += 1
|
239
|
-
@watchdog_enabled = false
|
240
|
-
# Kill the readthread...
|
241
|
-
my_logger msg: "Watchdog Thread: Killing ReadThread"
|
242
|
-
Thread.kill(@readthread) if @readthread && @readthread.alive?
|
243
|
-
if @last_watch[:enable]
|
244
|
-
stop
|
245
|
-
sleep 0.5
|
246
|
-
my_logger msg: "Watchdog Thread: Send Last_Watch: #{@last_watch}"
|
247
|
-
@command = @last_watch
|
248
|
-
send_cmmd
|
249
|
-
my_logger msg: "Watchdog Thread: Thread.exit"
|
250
|
-
Thread.exit
|
251
|
-
else
|
252
|
-
close_socket
|
222
|
+
if @watchdog_euthanized
|
223
|
+
my_logger msg: "Watchdog has been euthanized!"
|
224
|
+
else
|
225
|
+
my_logger msg: "Start: Starting Watchdog Thread"
|
226
|
+
@watchdogthread = Thread.start do
|
227
|
+
Thread.current[:name]=THREAD_NAMES[:WatchdogThread]
|
228
|
+
my_logger msg: "Watchdog Thread: #{Thread.current[:name]}"
|
229
|
+
@watchdog_count = 0.0
|
230
|
+
@watchdog_enabled = true
|
231
|
+
while @watchdog_enabled && !@watchdog_euthanized do
|
232
|
+
my_logger msg: "Watchdog Thread: Watchdog Tick"
|
233
|
+
if @watchdog_force
|
234
|
+
@watchdog_force = false
|
235
|
+
# force the watchdog to fire by killing the socket
|
236
|
+
@socket.close if @socket && !@socket.closed?
|
237
|
+
#@watchdog_count = @watchdog_max
|
253
238
|
end
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
239
|
+
if (@watchdog_count += WATCHDOG_STEP) >= @watchdog_max
|
240
|
+
my_logger level: 'warn', msg: "Watchdog Fired"
|
241
|
+
@watchdog_count = 0.0
|
242
|
+
@watchdog_fired_count += 1
|
243
|
+
@watchdog_enabled = false
|
244
|
+
# Kill the readthread...
|
245
|
+
my_logger msg: "Watchdog Thread: Killing ReadThread"
|
246
|
+
Thread.kill(@readthread) if @readthread && @readthread.alive?
|
247
|
+
if @last_watch[:enable]
|
248
|
+
stop
|
249
|
+
sleep 0.5
|
250
|
+
my_logger msg: "Watchdog Thread: Send Last_Watch: #{@last_watch}"
|
251
|
+
@command = @last_watch
|
252
|
+
send_cmmd
|
253
|
+
my_logger msg: "Watchdog Thread: Thread.exit"
|
254
|
+
Thread.exit
|
255
|
+
else
|
256
|
+
close_socket
|
257
|
+
end
|
258
|
+
end
|
259
|
+
sleep WATCHDOG_STEP
|
260
|
+
end # while Wchdog enabled
|
261
|
+
my_logger msg: "Closing Watchdog Thread"
|
262
|
+
end # wtchdg thread start do
|
263
|
+
end # watchdog euthanize if
|
259
264
|
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
260
265
|
|
261
266
|
my_logger msg: "Start: Exiting Start"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: my_gpsd_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.02.
|
4
|
+
version: 0.02.05
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Finnegan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|