my_gpsd_client 0.02.01 → 0.02.02

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: 0bf724ca9a22125086a4bca0663a86a0e8429ec8572eda9e90d237155d74ef4c
4
- data.tar.gz: c8db37075c61c42f159caaf707ff5035f9f92cfd2ff3b561cbe504c70a0d380d
3
+ metadata.gz: 97febebcc160956fb040c4facaf04e81fdd9100ec45cfd5dbd47a20dc754e192
4
+ data.tar.gz: 1705002705b8c247b07d57f1f16a38bfda0a1df2977f9e74badbadaa88ecc1dc
5
5
  SHA512:
6
- metadata.gz: 05ff6625e0c4e0436a818e31c33ebe65a3b0d85e94d22675ff7de495d552bd11d18a0b24dbc52968e93bf8e9dacefd831ed04f3ece8250da92d2e15676a523ab
7
- data.tar.gz: d62a9fabcb1f58880b71308a8a487fde582eebf374c1e63f2bdb95eb0602c2dd6026829f7c17fde929ddea64cbbd10af1bfc929d4a353dda1d7cad477c77f711
6
+ metadata.gz: d50ea29c9bef3ef88768a33372d5824a3a253526a7f5625ce32b68b88d7262d4abfdbdcc8a0a54ce5d47e3945b97674181d2fad272552c114bd2d0de8c5f8aa2
7
+ data.tar.gz: 4273baa90163fa5f645c4b3bdec80979e0bef2800192958954885f1641e82990ce02d06ed6a7ef28da21759699ce0195cae5b8707c2d336df0500d844305b80b
@@ -319,59 +319,68 @@ class MyGpsdClient
319
319
  # are used the most as they give info about satellites used and gps locations
320
320
  # @param [JSON] json The object returned by the daemon
321
321
  def parse_socket_json(json:)
322
- case json['class']
323
- when 'TOFF'
324
- @msg_counts[:toff] += 1
325
- when 'ATT'
326
- @msg_counts[:att] += 1
327
- when 'ERR'
328
- @msg_counts[:err] += 1
329
- when 'GST'
330
- @msg_counts[:gst] += 1
331
- when 'POL'
332
- @msg_counts[:pol] += 1
333
- when 'DEVICE'
334
- @msg_counts[:dev] += 1
335
- when 'DEVICES'
336
- # devices that are found, not needed
337
- @msg_counts[:devs] += 1
338
- when 'WATCH'
339
- # gps deamon is ready and will send other packets, not needed yet
340
- @msg_counts[:wtch] += 1
341
- when 'TPV'
342
- # gps position
343
- # "tag"=>"RMC", # "device"=>"/dev/ttyS0", # "mode"=>3,
344
- # "time"=>"2017-11-28T12:54:54.000Z", # "ept"=>0.005, # "lat"=>52.368576667,
345
- # "lon"=>4.901715, # "alt"=>-6.2, # "epx"=>2.738, # "epy"=>3.5,
346
- # "epv"=>5.06, # "track"=>198.53, # "speed"=>0.19, # "climb"=>0.0,
347
- # "eps"=>7.0, # "epc"=>10.12
348
- @msg_counts[:tpv] += 1
349
- if json['mode'] > 1
350
- #we have a 2d or 3d fix
351
- if is_new_measurement(json: json)
352
- json['time'] = DateTime.parse(json['time'])
353
- my_logger level: 'info', msg: "lat: #{json['lat']}, lng: #{json['lon']}, alt: #{json['alt']}, speed: #{json['speed']} at #{json['time']}, which is #{(Time.now - json['time'].to_time) * 1000}ms old"
354
- @json_pos_callback.call(json) if @json_pos_callback
355
- end
356
- end
357
- when 'SKY'
358
- # report on found satellites
359
- @msg_counts[:sky] += 1
360
- sats = json['satellites']
361
- if satellites_changed(sats: sats)
362
- my_logger level: 'info', msg: "found #{sats.length} satellites, of which #{sats.count{|sat| sat['used']}} are used"
363
- @json_sat_callback.call(sats) if @json_sat_callback
364
- end
365
- when 'PPS'
366
- @msg_counts[:pps] += 1
367
- my_logger level: 'info', msg: "found PPS tag: #{json.inspect}"
368
- @json_pps_callback.call(json) if @json_pps_callback
369
- else
370
- @msg_counts[:unk] += 1
371
- my_logger level: 'info', msg: "found unknown tag: #{json.inspect}"
372
- @json_unk_callback.call(json) if @json_unk_callback
373
- end
374
- @json_raw_callback.call(json) if @json_raw_callback
322
+ @json_raw_callback.call(json) if @json_raw_callback
323
+
324
+ case json['class']
325
+ when 'TOFF'
326
+ @msg_counts[:toff] += 1
327
+ when 'ATT'
328
+ @msg_counts[:att] += 1
329
+ when 'ERR'
330
+ @msg_counts[:err] += 1
331
+ when 'GST'
332
+ @msg_counts[:gst] += 1
333
+ when 'POL'
334
+ @msg_counts[:pol] += 1
335
+ when 'DEVICE'
336
+ @msg_counts[:dev] += 1
337
+ when 'DEVICES'
338
+ # devices that are found, not needed
339
+ @msg_counts[:devs] += 1
340
+ when 'WATCH'
341
+ # gps deamon is ready and will send other packets, not needed yet
342
+ @msg_counts[:wtch] += 1
343
+ when 'TPV'
344
+ # gps position
345
+ # "tag"=>"RMC", # "device"=>"/dev/ttyS0", # "mode"=>3,
346
+ # "time"=>"2017-11-28T12:54:54.000Z", # "ept"=>0.005, # "lat"=>52.368576667,
347
+ # "lon"=>4.901715, # "alt"=>-6.2, # "epx"=>2.738, # "epy"=>3.5,
348
+ # "epv"=>5.06, # "track"=>198.53, # "speed"=>0.19, # "climb"=>0.0,
349
+ # "eps"=>7.0, # "epc"=>10.12
350
+ @msg_counts[:tpv] += 1
351
+ =begin
352
+ if json['mode'] > 1
353
+ #we have a 2d or 3d fix
354
+ if is_new_measurement(json: json)
355
+ json['time'] = DateTime.parse(json['time'])
356
+ my_logger level: 'info', msg: "lat: #{json['lat']}, lng: #{json['lon']}, alt: #{json['alt']}, speed: #{json['speed']} at #{json['time']}, which is #{(Time.now - json['time'].to_time) * 1000}ms old"
357
+ @json_pos_callback.call(json) if @json_pos_callback
358
+ end
359
+ end
360
+ =end
361
+ when 'SKY'
362
+ # report on found satellites
363
+ @msg_counts[:sky] += 1
364
+ =begin
365
+ sats = json['satellites']
366
+ if satellites_changed(sats: sats)
367
+ my_logger level: 'info', msg: "found #{sats.length} satellites, of which #{sats.count{|sat| sat['used']}} are used"
368
+ @json_sat_callback.call(sats) if @json_sat_callback
369
+ end
370
+ =end
371
+ when 'PPS'
372
+ @msg_counts[:pps] += 1
373
+ =begin
374
+ my_logger level: 'info', msg: "found PPS tag: #{json.inspect}"
375
+ @json_pps_callback.call(json) if @json_pps_callback
376
+ =end
377
+ else
378
+ @msg_counts[:unk] += 1
379
+ =begin
380
+ my_logger level: 'info', msg: "found unknown tag: #{json.inspect}"
381
+ @json_unk_callback.call(json) if @json_unk_callback
382
+ =end
383
+ end
375
384
  end
376
385
 
377
386
  # checks if the new satellites object return by the deamon is different enough compared
@@ -1,3 +1,3 @@
1
1
  class MyGpsdClient_version
2
- VERSION = "0.02.01"
2
+ VERSION = "0.02.02"
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.01
4
+ version: 0.02.02
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-20 00:00:00.000000000 Z
11
+ date: 2019-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler