1
0
rtx/rtx.py

45 lines
1.0 KiB
Python
Raw Permalink 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
2016-10-31 15:43:43 +01:00
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)
2016-05-23 16:01:04 +02:00
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)
2016-05-31 15:35:32 +02:00
if config.MODE == "modem":
if glob.ser.getCD() == False:
break
2016-05-23 16:01:04 +02:00