add igate functionality

This commit is contained in:
Jakob Ketterl 2019-08-18 00:15:07 +02:00
parent 54bcba195d
commit 5fab3e3d36
3 changed files with 48 additions and 6 deletions

View File

@ -254,3 +254,12 @@ temporary_directory = "/tmp"
services_enabled = False services_enabled = False
services_decoders = ["ft8", "ft4", "wspr", "packet"] services_decoders = ["ft8", "ft4", "wspr", "packet"]
# === aprs igate settings ===
# if you want to share your APRS decodes with the aprs network, configure these settings accordingly
aprs_callsign = "N0CALL"
aprs_igate_enabled = False
aprs_igate_server = "euro.aprs2.net"
aprs_igate_password = ""
# beacon uses the receiver_gps setting, so if you enable this, make sure the location is correct there
aprs_igate_beacon = False

View File

@ -26,7 +26,7 @@ import signal
import threading import threading
from functools import partial from functools import partial
from owrx.kiss import KissClient from owrx.kiss import KissClient, DirewolfConfig
from owrx.wsjt import Ft8Chopper, WsprChopper, Jt9Chopper, Jt65Chopper, Ft4Chopper from owrx.wsjt import Ft8Chopper, WsprChopper, Jt9Chopper, Jt65Chopper, Ft4Chopper
import logging import logging
@ -562,11 +562,7 @@ class dsp(object):
self.direwolf_config = "{tmp_dir}/openwebrx_direwolf_{myid}.conf".format(tmp_dir=self.temporary_directory, myid=id(self)) self.direwolf_config = "{tmp_dir}/openwebrx_direwolf_{myid}.conf".format(tmp_dir=self.temporary_directory, myid=id(self))
self.direwolf_port = KissClient.getFreePort() self.direwolf_port = KissClient.getFreePort()
file = open(self.direwolf_config, "w") file = open(self.direwolf_config, "w")
file.write(""" file.write(DirewolfConfig().getConfig(self.direwolf_port))
MODEM 1200
KISSPORT {port}
AGWPORT off
""".format(port=self.direwolf_port))
file.close() file.close()
else: else:
self.direwolf_config = None self.direwolf_config = None

View File

@ -2,6 +2,7 @@ import socket
import time import time
import logging import logging
import random import random
from owrx.config import PropertyManager
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -11,6 +12,42 @@ TFEND = 0xDC
TFESC = 0xDD TFESC = 0xDD
class DirewolfConfig(object):
def getConfig(self, port):
pm = PropertyManager.getSharedInstance()
config = """
MYCALL {callsign}
MODEM 1200
KISSPORT {port}
AGWPORT off
""".format(
port=port,
callsign=pm["aprs_callsign"],
)
if pm["aprs_igate_enabled"]:
config += """
IGSERVER {server}
IGLOGIN {callsign} {password}
""".format(
server=pm["aprs_igate_server"],
callsign=pm["aprs_callsign"],
password=pm["aprs_igate_password"],
)
if pm["aprs_igate_beacon"]:
(lat, lon) = pm["receiver_gps"]
lat = "{0}^{1:.2f}{2}".format(int(lat), (lat - int(lat)) * 60, "N" if lat > 0 else "S")
lon = "{0}^{1:.2f}{2}".format(int(lon), (lon - int(lon)) * 60, "E" if lon > 0 else "W")
config += """
PBEACON sendto=IG delay=0:30 every=60:00 symbol="igate" overlay=R lat={lat} long={lon} comment="OpenWebRX APRS gateway"
""".format(lat=lat, lon=lon)
return config
class KissClient(object): class KissClient(object):
@staticmethod @staticmethod
def getFreePort(): def getFreePort():