Barely parse a frame.
This commit is contained in:
parent
4f83f76bf5
commit
b06b87fe4e
|
@ -3,6 +3,7 @@ import os
|
|||
import sqlite3
|
||||
import aprs
|
||||
import json
|
||||
import aprslib
|
||||
|
||||
|
||||
MYCALL = os.environ.get("MYCALL", "W1CDN")
|
||||
|
@ -26,12 +27,12 @@ def main():
|
|||
ki.write(frame)
|
||||
while True:
|
||||
for frame in ki.read(min_frames=1):
|
||||
print(repr(frame))
|
||||
a = str(frame)
|
||||
#print(repr(frame))
|
||||
a = aprslib.parse(str(frame))
|
||||
print(a)
|
||||
conn = get_db_connection()
|
||||
conn.execute('INSERT INTO frames (frame) VALUES (?)',
|
||||
(a,))
|
||||
# conn.execute('INSERT INTO frames (frame) VALUES (?)',
|
||||
# (a,))
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
|
||||
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Send a test frame via TCP, then read & print KISS frames from a TCP Socket.
|
||||
For use with programs like Dire Wolf.
|
||||
"""
|
||||
import os
|
||||
import sqlite3
|
||||
from ax253 import Frame
|
||||
import kiss
|
||||
|
||||
|
||||
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")
|
||||
|
||||
def get_db_connection():
|
||||
conn = sqlite3.connect('database.db')
|
||||
conn.row_factory = sqlite3.Row
|
||||
return conn
|
||||
|
||||
def print_frame(frame):
|
||||
print(Frame.from_bytes(frame))
|
||||
a = str(Frame.from_bytes(frame))
|
||||
dir(frame)
|
||||
return(a)
|
||||
|
||||
def main():
|
||||
ki = kiss.TCPKISS(host=KISS_HOST, port=int(KISS_PORT), strip_df_start=True)
|
||||
ki.start()
|
||||
frame = Frame.ui(
|
||||
destination="PYKISS",
|
||||
source=MYCALL,
|
||||
path=["WIDE1-1"],
|
||||
info=">Hello World!",
|
||||
)
|
||||
#ki.write(frame)
|
||||
ki.read(callback=print_frame, min_frames=None)
|
||||
|
||||
conn = get_db_connection()
|
||||
print(ki.read(callback=print_frame, min_frames=None),)
|
||||
#conn.execute('INSERT INTO frames (frame) VALUES (?)',
|
||||
# ((,))
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in New Issue
Block a user