Exemple #1
0
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()
Exemple #2
0
import time
import serial
from shared import Shared
from cpconsole import CpConsole


if __name__ == '__main__':
    
    Shared.theSerial = serial.Serial()
    
    consoleThread = CpConsole()
    consoleThread.start()
    
    while(consoleThread.isAlive()):
        time.sleep(.005)

    print 'Exiting App...'
    
    if Shared.theSerial.isOpen():
        print 'Closing serial...'
        Shared.theSerial.close()
    
    exit()
    
    


    
Exemple #3
0
    print data


def rfDataReceived(data):
    print data


def inetDataReceived(data):
    print data


if __name__ == '__main__':

    print "Init complete: ready for serial communication!"

    modemThread = CpModem(modemDataReceived)
    modemThread.start()

    commThread = CpComm(modemThread)
    commThread.start()

    consoleThread = CpConsole(modemThread, commThread)
    consoleThread.start()

    while (consoleThread.isAlive()):
        time.sleep(.005)

    print 'Exiting App...'
    print 'Exiting App...'
    exit()