Announce NMEA over TCP via mDNS

Peplink mobile routers that support GPS broadcast the location data in NMEA format on port 60660 to be used by other applications on the network. Geoclue (which is among others being used by Firefox) would automatically pickup those data if the Peplink router would announce that service via mDNS as service of the type _nmea-0183._tcp.

3 Likes

Hey Snoack,

That is an interesting suggestion.

Would that be to use GPS location from Peplink rather than a device?
What would the use case be here, beyond nice-to-have?

We use software that take a UDP NMEA stream which we relay from one network to another via Peplink - but if this mDNS service was available, it would be a easier to integrate.

+1 from here, but please share use case.

Cheers

2 Likes

My use case is laptops connected to the network that don’t have their own GPS. By announcing the NMEA over TCP service which is already provided via mDNS, clients can automatically discover it without manual configuration. One application for example that supports this is Firefox via Geoclue.

1 Like

Interesting - and I think it would be useful for multiple clients and software providers.

@Giedrius - thoughts on this one?

1 Like

Theoretically you could build something to do this and use a docker container to deploy it on a peplink device.

1 Like

You absolutely could do this - and we have done already.
However, I can see merit in having the GPS/HDG broadcast over mDNS built-in rather than doing a docker.

For example, on a lot of vehicle deployments we use BR1 Pro or BR1 Mini which does not support dockers…

4 Likes

OH having it built-in would be awesome for exactly the reason you have stated! Having this available on a BR1 Mini would make me extremely happy :smiley:

Is the build you have built able to be shared? If not I understand, but would be cool for a bunch of uses, not just marine, as you noted.

1 Like

I have a docker that compiles TCP & UDP into an mDNS broadcast as per Snoack request - so would be up to Peplink to interface this into the firmware.

Loads of use cases, far from just Marine indeed.
Vehicles, Buses, trains, anything that needs GPS really…

Python Code Snippet

import socket
import time
from zeroconf import ServiceInfo, Zeroconf

UDP settings

UDP_IP = “0.0.0.0” # Listen on all interfaces
UDP_PORT = 10110 # Common NMEA UDP port, adjustable

mDNS settings

SERVICE_TYPE = “_nmea-0183._tcp.local.”
SERVICE_NAME = “NMEA_GPS_Service._nmea-0183._tcp.local.”
SERVICE_PORT = 10110 # Same as UDP port for simplicity

Set up UDP socket

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((UDP_IP, UDP_PORT))

Set up mDNS

zeroconf = Zeroconf()
info = ServiceInfo(
SERVICE_TYPE,
SERVICE_NAME,
addresses=[socket.inet_aton(“0.0.0.0”)], # Advertise on all interfaces
port=SERVICE_PORT,
properties={“description”: “NMEA GPS Data over UDP”},
)
zeroconf.register_service(info)

print(f"Listening for NMEA data on UDP {UDP_IP}:{UDP_PORT}“)
print(f"Advertising mDNS service: {SERVICE_NAME}”)

try:
while True:
data, addr = sock.recvfrom(1024) # Buffer size of 1024 bytes
print(f"Received NMEA data from {addr}: {data.decode(‘utf-8’).strip()}")
except KeyboardInterrupt:
print(“Shutting down…”)
finally:
zeroconf.unregister_service(info)
zeroconf.close()
sock.close()

3 Likes

Supported… I have devices that accept NMEA data over TCPIP to provide other insights into wireless connectivity, such as elevation deltas and Fresnel zone calcs… Would be good if I could use the BR1 5G GPS data for these devices… Also would be good to lever arm the data to show that the GPS and the router are vertically displaced…

3 Likes