Esempio n. 1
0
def mainServer():
    
    pool=connectPool()
    
    #_thread.start_new_thread(busDataServe, (0, ))
    #_thread.start_new_thread(reciveHeartBeat, (pool, ))
    #_thread.start_new_thread(netConfigServer, (pool, ))
    
    busdataserver=busDataServer(busCalculate.calculateBusPosition)
    busdataserver.start()
    
    heartbeatserver=heartBeatServer(pool)
    heartbeatserver.start()
    
    infosendingserver=infoSendingServer(pool)
    infosendingserver.start()
    return
Esempio n. 2
0
    file.close()
    return

def printRet(businfo):
    s=businfo.id+'\t'+str(businfo.lineName)+'\t'+str(businfo.lng)+'\t'+str(businfo.lat)
    print(s)

def logRet(businfo):
    s=businfo.id+'\t'+str(businfo.lineName)+'\t'+str(businfo.lng)+'\t'+str(businfo.lat)
    log.debug(s)
    return

###########################################

if __name__=='__main__':
    # simple test
    '''
    busdataserver=busDataServer.busDataServer(printRet)
    busdataserver.start()
    '''
    
    # test with busPosition calculate
    import busCalculate
    bc = busCalculate.busCalculate()
    #busdataserver=busDataServer.busDataServer(bc.calculateBusPosition)
    #busdataserver=busDataServer.busDataServer(logRet)
    import test_calculateBusPosition
    busdataserver=busDataServer.busDataServer(test_calculateBusPosition.calculateBusPosition)
    
    busdataserver.start()
Esempio n. 3
0
    try:
        file=open(FILENAME, 'w')
    except IOError:
        print('open file error')
    else:
        print('open file ok')
    s=''
    s+=businfo.id+'\t'+str(businfo.lineName)+'\t'+str(businfo.lng)+'\t'+str(businfo.lat)+'\n'
    file.write(s)
    file.flush()
    file.close()
    return

def printRet(businfo):
    s=businfo.id+'\t'+str(businfo.lineName)+'\t'+str(businfo.lng)+'\t'+str(businfo.lat)
    print(s)
###########################################

if __name__=='__main__':
    # simple test
    '''
    busdataserver=busDataServer.busDataServer(printRet)
    busdataserver.start()
    '''
    
    # test with busPosition calculate
    import busCalculate
    bc = busCalculate.busCalculate()
    busdataserver=busDataServer.busDataServer(bc.calculateBusPosition)
    busdataserver.start()