Created
February 21, 2026 01:17
-
-
Save Geofferey/ff8199a695d4f110ae95d6360d7a54ba to your computer and use it in GitHub Desktop.
Pineapple Pager Payload for receiving streamed NMEA from a remote device
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Title: GPSd Listener | |
| # Author: Geofferey | |
| # Description: Listens for NMEA on IP and port specified | |
| # Version: 1.0 | |
| DEF_PORT=29470 | |
| DEF_HOST=172.16.52.1 | |
| LOG "" | |
| LOG green "Listens on specified ip and port for incoming NMEA" | |
| LOG "" | |
| # Prompt user for host IP address or name | |
| host=$(TEXT_PICKER "Enter local IP" $DEF_HOST) | |
| case $? in | |
| $DUCKYSCRIPT_CANCELLED) | |
| LOG "User cancelled" | |
| exit 1 | |
| ;; | |
| $DUCKYSCRIPT_REJECTED) | |
| LOG "Dialog rejected" | |
| exit 1 | |
| ;; | |
| $DUCKYSCRIPT_ERROR) | |
| LOG "An error occurred" | |
| exit 1 | |
| ;; | |
| esac | |
| port=$(NUMBER_PICKER "Input port" $DEF_PORT) | |
| case $? in | |
| $DUCKYSCRIPT_CANCELLED) | |
| LOG "User cancelled" | |
| exit 1 | |
| ;; | |
| $DUCKYSCRIPT_REJECTED) | |
| LOG "Using default port: $DEF_PORT" | |
| port=$DEF_PORT | |
| ;; | |
| $DUCKYSCRIPT_ERROR) | |
| LOG "An error occurred, using default port: $DEF_PORT" | |
| port=$DEF_PORT | |
| ;; | |
| esac | |
| killall gpsd | |
| gpsd -b -G udp://$host:$port | |
| sleep 5 | |
| id=$(START_SPINNER "Checking...") # Only one word, because of bug in 1.0.4 | |
| if timeout 5 gpspipe -r | grep -v '"class":'; then | |
| STOP_SPINNER ${id} | |
| LOG green "GPS data is flowing" | |
| else | |
| STOP_SPINNER ${id} | |
| LOG yellow "No GPS data | |
| restarting gpsd | |
| & checking again" | |
| sleep 1 | |
| id=$(START_SPINNER "Checking...") # Only one word, because of bug in 1.0.4 | |
| killall gpsd | |
| #service gpsd restart | |
| gpsd -b -G udp://$ip:$port | |
| if timeout 5 gpspipe -r | grep -v '"class":'; then | |
| STOP_SPINNER ${id} | |
| LOG green "GPS data is flowing" | |
| else | |
| STOP_SPINNER ${id} | |
| LOG red "Could not get GPS working, please check config or hardware." | |
| exit 1 | |
| fi | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment