def start_threads(runas): if runas not in ("console", "service"): print "Error invalid command line argument (%s)" % runas exit(1) print 'Echobase 1.0 starting services...' print 'mode=', runas #print 'Wait 30 seconds for network to startup' #time.sleep(30) print 'Done waiting...' rfThread = CpRf(rfDataReceived) rfThread.start() inetThread = CpInet(inetDataReceived) inetThread.start() dbThread = CpDbManager(inetThread) dbThread.start() ledThread = CpLed() ledThread.start() taskThread = CpTaskManager(rfThread, inetThread, dbThread, ledThread) taskThread.start() if(runas == 'service'): while(taskThread.isAlive()): time.sleep(.005) print 'Exiting App...' exit() else: consoleThread = CpConsole(taskThread) consoleThread.start() while(consoleThread.isAlive()): time.sleep(.005) print 'Exiting App...' exit()
while (datetime.now() - ts).seconds < timeout: pass print 'timeout' exit() """ # modem_init() modem_init2() rfThread = CpRf(rfDataReceived) rfThread.start() inetThread = CpInet(inetDataReceived) inetThread.start() taskThread = CpTaskManager(rfThread, inetThread) taskThread.start() # device = '/dev/tty.usbserial-FTELSNMW' modemThread = CpModem(modemDataReceived) modemThread.start() commThread = CpComm(modemThread) commThread.start()