write an nmea trace to a unix socket for indoor maps testing

while : ; do fennel fake-nmea.fnl foo.nmea ./fake-nmea.sock ; done
This commit is contained in:
Daniel 2025-05-18 18:00:49 +00:00
parent 97440603f3
commit 015caf45c6

10
pkgs/maps/fake-nmea.fnl Normal file
View File

@ -0,0 +1,10 @@
(local { : sleep } (require :posix.unistd))
(let [[filename socketname] arg
socket (io.popen (.. "socat - unix-listen:" socketname) :w)]
(with-open [handle (io.open filename :r)]
(each [l (handle:lines "L")]
(if (string.match l "GNS") (sleep 1))
(socket:write l)
(socket:flush)
)))