45 lines
1.0 KiB
Python
Executable File
45 lines
1.0 KiB
Python
Executable File
#!/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
|
|
logging.debug("Serial port %s, Baud rate %s", config.PORT, config.BAUDRATE)
|
|
glob.ser = serial.Serial(config.PORT, config.BAUDRATE, timeout=None, rtscts=True, dsrdtr=True)
|
|
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
|
|
|
|
|