parse nmea from socket
This commit is contained in:
parent
59c7b53022
commit
bf7eac5fac
@ -1,5 +1,6 @@
|
|||||||
; (local { : view } (require :fennel))
|
; (local { : view } (require :fennel))
|
||||||
(local { : fdopen } (require :posix.stdio))
|
(local { : fdopen } (require :posix.stdio))
|
||||||
|
(local nmea (require :nmea))
|
||||||
|
|
||||||
(local {
|
(local {
|
||||||
: Gtk
|
: Gtk
|
||||||
@ -71,7 +72,10 @@ label.readout {
|
|||||||
|
|
||||||
(fn read-gnss [socket]
|
(fn read-gnss [socket]
|
||||||
(each [l #(socket:read "l")]
|
(each [l #(socket:read "l")]
|
||||||
(print "gnss" l))
|
; (print "gnss" l)
|
||||||
|
(if (not (= l ""))
|
||||||
|
(print (view (nmea.parse l)))))
|
||||||
|
|
||||||
true)
|
true)
|
||||||
|
|
||||||
(let [sock (gnss-socket:get_socket)
|
(let [sock (gnss-socket:get_socket)
|
||||||
|
@ -3,9 +3,8 @@
|
|||||||
;; 3-5 are the message type
|
;; 3-5 are the message type
|
||||||
;; fields are comma-delimited
|
;; fields are comma-delimited
|
||||||
|
|
||||||
;; we assume that we can parse the message based only on type
|
;; we can parse the message based only on type (i.e. the same type is
|
||||||
;; (i.e. that the same type should always be parsed the same way no
|
;; always parsed the same way no matter who the talker)
|
||||||
;; matter who the talker)
|
|
||||||
|
|
||||||
;; outline: split message into lines, extract values between
|
;; outline: split message into lines, extract values between
|
||||||
;; $ and * as talker, type, fields
|
;; $ and * as talker, type, fields
|
||||||
@ -177,3 +176,5 @@
|
|||||||
:speed-kmh 2.9
|
:speed-kmh 2.9
|
||||||
:mode :A
|
:mode :A
|
||||||
})
|
})
|
||||||
|
|
||||||
|
{ :parse parse-line }
|
||||||
|
Loading…
Reference in New Issue
Block a user