1
0
rtx/rtx.py

43 lines
919 B
Python
Raw Normal View History

2016-05-23 16:01:04 +02:00
#!/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" and glob.ser.getCD() == False:
break