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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be4f1c4c5206353cb073d29786bcf42843ad23fc79db633a52db546311c7f94d
4
- data.tar.gz: d460dbb1f143ed168e897b61e957e071bf5ee050c54698b22c8cec2efa32e4c8
3
+ metadata.gz: cca72cd805fe4666ec09ab123acc03c901c815c6d02b5d35be1a413baf5ba167
4
+ data.tar.gz: 3e8c5649ed8a39cd03b2e0a2791159ce43f5f437fe089f7651f599e0edd6c606
5
5
  SHA512:
6
- metadata.gz: f7fa5f1b82865b37d52c00e509ea4dc3dd2cc4f73d85f60dcd07d7ff9c77f137d21b2d04aa29dda38f34b82d18452ea054db7da73142390e792e53b82fb2a901
7
- data.tar.gz: 506bcb5d6b8d151709a3419768940151d05add153719457d56cd84a69b40d44c21c074c8952e44dc734154b068eb768e935f97ed791cda1f30a625e462629d65
6
+ metadata.gz: 12ea53ddd4aaa482822d587d4825dc7049e824aa9b50e2022b808634e73e419a3093677c7462a863dda5012c3a6d1fd5a30436bf6ba76867dd423d833c9027b8
7
+ data.tar.gz: bbdaa19ca254d5d17368ab67d1d8b5d27337a115387410507a38096c89153e3a41dd954087608b12e1624698e9e58d75d714bdfc2c711bcd9623def20cc0e433
@@ -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
- my_logger msg: "Start: Starting Watchdog Thread"
222
- @watchdogthread = Thread.start do
223
- Thread.current[:name]=THREAD_NAMES[:WatchdogThread]
224
- my_logger msg: "Watchdog Thread: #{Thread.current[:name]}"
225
- @watchdog_count = 0.0
226
- @watchdog_enabled = true
227
- while @watchdog_enabled do
228
- my_logger msg: "Watchdog Thread: Watchdog Tick"
229
- if @watchdog_force
230
- @watchdog_force = false
231
- # force the watchdog to fire by killing the socket
232
- @socket.close if @socket && !@socket.closed?
233
- #@watchdog_count = @watchdog_max
234
- end
235
- if (@watchdog_count += WATCHDOG_STEP) >= @watchdog_max
236
- my_logger level: 'warn', msg: "Watchdog Fired"
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
- end
255
- sleep WATCHDOG_STEP
256
- end # while
257
- my_logger msg: "Closing Watchdog Thread"
258
- end # watchdog thread
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"
@@ -1,3 +1,3 @@
1
1
  class MyGpsdClient_version
2
- VERSION = "0.02.04"
2
+ VERSION = "0.02.05"
3
3
  end
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.04
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-28 00:00:00.000000000 Z
11
+ date: 2019-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler