我将以下 NMEA 消息保存到文件中messages.txt
:
$GPRMC,131131.00,A,5956.4298,N,03015.4464,E,00.00,310.5,130123,,,D*53
$GPRMC,131132.00,A,5956.4298,N,03015.4464,E,00.01,097.3,130123,,,D*5B
$GNGSA,A,3,25,01,06,12,17,19,24,32,,,,,01.2,00.6,01.0*12
$GNGSA,A,3,66,86,77,76,75,85,67,68,84,,,,01.2,00.6,01.0*1B
$GPRMC,131133.00,A,5956.4298,N,03015.4464,E,00.00,181.5,130123,,,D*5B
$GNGSA,A,3,25,01,06,12,17,19,24,32,,,,,01.2,00.6,01.0*12
$GNGSA,A,3,66,86,77,76,75,85,67,68,84,,,,01.2,00.6,01.0*1B
$GPGNS,131134.00,,,,,,08,,,,02.2,0005*75
$GLGNS,131134.00,,,,,,09,,,,07.0,0005*6F
并执行:
gpsfake messages.txt
之后命令的输出:
lsof -i -P -n | grep LISTEN
曾是
...
gpsd 71964 den 4u IPv4 310168 0t0 TCP 127.0.0.1:2947 (LISTEN)
gpsd 71964 den 5u IPv6 310169 0t0 TCP [::1]:2947 (LISTEN)
...
当我尝试阅读消息时:
cat </dev/tcp/127.0.0.1/2947
输出仅包含:
{"class":"VERSION","release":"3.22","rev":"3.22","proto_major":3,"proto_minor":14}
尝试使用 gpspipe 读取它们,但其输出也不包含 GPS 数据:
sudo gpspipe -n 10 -w
{"class":"VERSION","release":"3.22","rev":"3.22","proto_major":3,"proto_minor":14}
{"class":"DEVICES","devices":[]}
{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false}
执行上述命令后,gpsfake 的输出更改为:
Processing messages.txt
gpsfake: log cycle of messages.txt begins.
...
gpsd:ERROR: SER: device open of /dev/pts/12 failed: Permission denied - retrying read-only
gpsd:ERROR: SER: read-only device open of /dev/pts/12 failed: Permission denied
gpsd:ERROR: /dev/pts/12: device activation failed, freeing device.
如何gpsfake
正确读取数据?