Ejemplo n.º 1
0
    bdb = BloodsDB()

    fname = sys.argv[1]
    
    if re.match('mythic-', fname):
        print "Mythic"
        analyser = Mythic("TEST", 115200)
    elif re.match('scEZ', fname):
        analyser = SpotChemEZ("TEST", 9600)
    elif re.match('scEL', fname):
        analyser = SpotChemEL("TEST")
    else:
        print "Unknown analyser for '%s'"%fname
        sys.exit(1)
    
    analyser.registerResultHandler(rhandler)
    
    analyser.start()

    print "Reading %s"%fname    
    dfile = open(fname, "rb")
        
    while True:
        d=dfile.read(16)
        if len(d) == 0:
            break
        analyser.testWrite(d)
            
    dfile.close()
    
    time.sleep(2)
Ejemplo n.º 2
0
from datetime import datetime

def rhandler(res):
    print res
    res.save()

if __name__ == '__main__':
    logging.basicConfig(filename=datetime.now().isoformat()[0:16]+'.log',level=logging.DEBUG)

    bdb = BloodsDB()

    mythic = Mythic("/dev/ttyUSB0", 115200)
    spotchemez = SpotChemEZ("/dev/ttyUSB1", 9600)
    spotchemel = SpotChemEL("/dev/ttyUSB2")
    
    mythic.registerResultHandler(rhandler)
    spotchemez.registerResultHandler(rhandler)
    spotchemel.registerResultHandler(rhandler)
    
    mythic.saveRaw()
    spotchemez.saveRaw()
    spotchemel.saveRaw()
    
    mythic.start()
    spotchemez.start()
    spotchemel.start()

#     def sigint_handler(sig, frame):
#         print 'You pressed Ctrl+C - exiting'
#         mythic.exit()
#         spotchem.exit()