"""Responsible for user output to stdout and to log files"""
def __init__(self):
- self.__logFile = None
+ self.__logFile = "cm160Server.log"
self.__debug = False
self.__fileLock = Lock()
self.__stdoutLock = Lock()
ID_MSG = "%cIDTCMV001%c" % (MESSAGE_ID_0,1)
WAIT_MSG = "%cIDTWAITPCR" % (MESSAGE_ID_0)
- def __init__(self, uo, serverPort, dataStore, debug):
+ def __init__(self, uo, dataStore, debug):
self.__uo = uo
- self.__serverPort = serverPort
self.__dataStore = dataStore
self.__debug = debug
self.__queueReader = QueueReader(self.__queue, self.__dataStore, self.__uo)
self.__queueReader.start()
-# if self.__server != None:
-# self.__server.waitStop()
-
-# self.__server = Server(self.__uo, self.__serverPort, self.__queueReader, self.__dataStore)
-# self.__server.start()
def __serialPortScan(self):
"""scan for available serial ports. return a list of tuples [num, name]"""
opts, args = getopt.getopt(sys.argv[1:], 'toi:l:rf:p:qds:h', ["help"])
quietMode = False
- serverPort = CM160.DEFAULT_SERVER_PORT
serialPort = None
readDatabase=False
readStartTime=datetime.datetime.min
forwardToTextFile=False
for o, a in opts:
- if o == '-f':
- dbFile=a
- elif o == '-p':
- serverPort=int(a)
- elif o == '-q':
+ if o == '-q':
quietMode=True
elif o == '-s':
serialPort=int(a)
elif o == "-d":
debug = True
- elif o == "-r":
- readDatabase = True
- elif o == "-i":
- readStartTime=getDateTime(a)
- elif o == "-l":
- readStopTime=getDateTime(a)
elif o == "-o":
compatMode=True
- elif o == "-t":
- forwardToTextFile=True
elif o == "-h":
usage(uo)
sys.exit(0)
- #Don't really need to log stdout, uncomment if you really need to
- #uo.setLogFile("c:\\cm160.uo.log")
+ uo.setLogFile("cm160Server.log")
if not compatMode:
uo.info("CM160Server v %2.2f" % (VERSION) )
DataStore = MySQLDataStore()
# Démarrage du collect data
- cm160 = CM160(uo, serverPort, DataStore, debug)
+ cm160 = CM160(uo, DataStore, debug)
# Connexion au serial port :
if serialPort == None: