acn/rtx
acn
/
rtx
1
0
Fork 0
rtx/rtx.py

44 lines
923 B
Python

#!/usr/bin/python3
# -*- coding: UTF-8 -*-
'''
rtx - RetroText
v0.1
by Anna Christina Naß <acn@acn.wtf>
released under GPL
'''
from cept import *
from rtxPage import rtxPage
import glob # global variables
import config
import rtxHelpers
import rtxModem
import serial
import logging
####
# configure the logging format
logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s', level=config.LOGLEVEL, datefmt='%Y-%m-%d %I:%M:%S')
# initialize serial connection to client
glob.ser = serial.Serial(config.PORT, config.BAUDRATE, timeout=None)
logging.info("Serial port %s opened", glob.ser.name)
while True:
if config.MODE=="modem":
rtxModem.init_modem()
rtxModem.wait_for_caller()
rtxHelpers.send_welcome_page()
# main loop to read data from client
while True:
in_byte = glob.ser.read(1)
rtxHelpers.process_byte(in_byte)
if config.MODE == "modem":
if glob.ser.getCD() == False:
break