Add kiss stuff to config.
This commit is contained in:
parent
ef5765e87f
commit
2ca627f973
|
@ -10,3 +10,10 @@ station_lon = -97.027000
|
||||||
|
|
||||||
# How long to keep packets (frames) e.g., "2 days", "5 minutes"
|
# How long to keep packets (frames) e.g., "2 days", "5 minutes"
|
||||||
keep_time = "2 days"
|
keep_time = "2 days"
|
||||||
|
|
||||||
|
# KISS settings
|
||||||
|
kiss_host = 192.168.0.30
|
||||||
|
kiss_port = 8001
|
||||||
|
|
||||||
|
# Development settings (not operational yet)
|
||||||
|
mycall = W1CDN-15
|
||||||
|
|
|
@ -6,10 +6,6 @@ import json
|
||||||
import aprslib
|
import aprslib
|
||||||
import configparser
|
import configparser
|
||||||
|
|
||||||
MYCALL = os.environ.get("MYCALL", "W1CDN")
|
|
||||||
KISS_HOST = os.environ.get("KISS_HOST", "192.168.0.30")
|
|
||||||
KISS_PORT = os.environ.get("KISS_PORT", "8001")
|
|
||||||
|
|
||||||
db_fields = ("id",
|
db_fields = ("id",
|
||||||
"addresse",
|
"addresse",
|
||||||
"alive",
|
"alive",
|
||||||
|
@ -44,6 +40,7 @@ db_fields = ("id",
|
||||||
"station_lat",
|
"station_lat",
|
||||||
"station_lon",
|
"station_lon",
|
||||||
"status",
|
"status",
|
||||||
|
"subpacket",
|
||||||
"symbol",
|
"symbol",
|
||||||
"symbol_table",
|
"symbol_table",
|
||||||
"telemetry",
|
"telemetry",
|
||||||
|
@ -70,18 +67,22 @@ def main():
|
||||||
|
|
||||||
# Add the call and location of this station to the packet info
|
# Add the call and location of this station to the packet info
|
||||||
config = read_config()
|
config = read_config()
|
||||||
|
# MYCALL = os.environ.get("MYCALL", "W1CDN")
|
||||||
|
# KISS_HOST = os.environ.get("KISS_HOST", "192.168.0.30")
|
||||||
|
# KISS_PORT = os.environ.get("KISS_PORT", "8001")
|
||||||
|
|
||||||
ki = aprs.TCPKISS(host=KISS_HOST, port=int(KISS_PORT))
|
|
||||||
|
ki = aprs.TCPKISS(host=config['Settings']['kiss_host'], port=int(config['Settings']['kiss_port']))
|
||||||
ki.start()
|
ki.start()
|
||||||
|
|
||||||
# Make a simple frame and send it
|
# Make a simple frame and send it
|
||||||
frame = aprs.APRSFrame.ui(
|
frame = aprs.APRSFrame.ui(
|
||||||
destination="APZ001",
|
destination="APZ001",
|
||||||
source=MYCALL,
|
source=config['Settings']['mycall'],
|
||||||
path=["WIDE1-1"],
|
path=["WIDE1-1"],
|
||||||
info=b">Hello World!",
|
info=b">Hello World!",
|
||||||
)
|
)
|
||||||
#ki.write(frame)
|
ki.write(frame)
|
||||||
|
|
||||||
# Watch for new packets to come in
|
# Watch for new packets to come in
|
||||||
while True:
|
while True:
|
||||||
|
@ -94,11 +95,15 @@ def main():
|
||||||
print(a)
|
print(a)
|
||||||
# Make this a string and deal with it later (probably a mistake)
|
# Make this a string and deal with it later (probably a mistake)
|
||||||
a['path'] = str(a['path'])
|
a['path'] = str(a['path'])
|
||||||
|
# Store true/false as 1/0
|
||||||
|
if 'alive' in a:
|
||||||
|
if a['alive'] == True:
|
||||||
|
a['alive'] = 1
|
||||||
|
else:
|
||||||
|
a['alive'] = 0
|
||||||
# Build an INSERT statement based on the fields we have from the frame
|
# Build an INSERT statement based on the fields we have from the frame
|
||||||
#attrib_names = ', '.join(f'"{w}"' for w in a.keys())
|
|
||||||
attrib_names = ', '.join('"%s"' % w for w in a.keys())
|
attrib_names = ', '.join('"%s"' % w for w in a.keys())
|
||||||
attrib_values = ", ".join("?" * len(a.keys()))
|
attrib_values = ", ".join("?" * len(a.keys()))
|
||||||
#sql = f"INSERT INTO frames ({attrib_names}) VALUES ({attrib_values})"
|
|
||||||
sql = "INSERT INTO frames ("+attrib_names+") VALUES ("+attrib_values+")"
|
sql = "INSERT INTO frames ("+attrib_names+") VALUES ("+attrib_values+")"
|
||||||
try:
|
try:
|
||||||
# Insert data
|
# Insert data
|
||||||
|
|
|
@ -35,6 +35,7 @@ CREATE TABLE frames (
|
||||||
station_lat REAL,
|
station_lat REAL,
|
||||||
station_lon REAL,
|
station_lon REAL,
|
||||||
status TEXT,
|
status TEXT,
|
||||||
|
subpacket TEXT,
|
||||||
symbol TEXT,
|
symbol TEXT,
|
||||||
symbol_table TEXT,
|
symbol_table TEXT,
|
||||||
telemetry TEXT,
|
telemetry TEXT,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user