This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Signalk / Issue resuming GPSD connection
#2
To all,

I have found a work around ; please fell free to comment as it is certainly not the most appropriate.

Idea:
 * Use local GPSD daemon on openplotter to retrieve the GPS (and potential AIS data) so that the connection to GPSD is never lost.
 * Concern : what happen if local GPSD loose the link to GPSD running tinycore
 * Solution : small batch called by systemd for keepalive (systemd rather than

Code:
/home/pi/gpsd_keepalive
#!/bin/bash

# GPSD Keep Alive
# Initiate a connection to remote GPSD and ensure this connection stay alive
# XT211214

# Variables
SOURCE=gpsd://192.168.20.199:2947

# Script
gpsdevices=`gpspipe -r -n 2 | sed -e '$!d' -e 's/.*\[\([^]]*\)\].*/\1/g'`
#echo $gpsdevices

if [ -n "$gpsdevices" ] && [[ "$gpsdevices" =~ "$SOURCE" ]]; then
 #echo "OK"
 true
else
 #echo "Missing $SOURCE"
 # Missing source
 /usr/sbin/gpsdctl remove "$SOURCE"
 /usr/sbin/gpsdctl add "$SOURCE"
fi

Code:
/etc/systemd/system/gpsd_keepalive.timer
[Unit]
Description=Timer for GPSD KeepAlive (to cope with GPSD via networks breaks)

[Timer]
OnBootSec=30s
OnUnitInactiveSec=5s
AccuracySec=1s

[Install]
WantedBy=timers.target

Code:
/etc/systemd/system/gpsd_keepalive.service
[Unit]
Description=GPSD Keep Alive (to cope with GPSD via networks breaks)
#Documentation=
After=network.target

[Service]
WorkingDirectory=/home/pi
User=root
ExecStart=/home/pi/gpsd_keepalive
Starting the services (in root):
  • systemctl start gpsd_keepalive.timer gpsd.keepalive.service
Xavier.
Reply


Messages In This Thread
RE: Signalk / Issue resuming GPSD connection - by damien - 2021-12-14, 01:29 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)