示例#1
0
    # server connection
    watchdog = ConnectionWatchdog(globalData.serverComm,
                                  globalData.pingInterval,
                                  globalData.smtpAlert)
    # set thread to daemon
    # => threads terminates when main thread terminates
    watchdog.daemon = True
    watchdog.start()

    # start data collector thread
    dataCollector = LightningmapDataCollector(globalData.sensors)
    # set thread to daemon
    # => threads terminates when main thread terminates
    dataCollector.daemon = True
    dataCollector.start()

    # only start update checker if it is activated
    if updateActivated is True:
        updateChecker = UpdateChecker(updateServer, updatePort, updateLocation,
                                      updateCaFile, updateInterval,
                                      updateEmailNotification, globalData)
        # set thread to daemon
        # => threads terminates when main thread terminates
        updateChecker.daemon = True
        updateChecker.start()

    # set up sensor executer and execute it
    # (note: we will not return from the executer unless the client
    # is terminated)
    sensorExecuter = SensorExecuter(globalData.serverComm, globalData)
    sensorExecuter.execute()
示例#2
0
        time.sleep(5)

    # when connected => generate watchdog object to monitor the
    # server connection
    logging.info("[%s] Starting watchdog thread." % fileName)
    watchdog = ConnectionWatchdog(globalData.serverComm,
                                  globalData.pingInterval,
                                  globalData.smtpAlert)
    # set thread to daemon
    # => threads terminates when main thread terminates
    watchdog.daemon = True
    watchdog.start()

    # Set up sensor executer and execute it.
    logging.info("[%s] Starting sensor thread." % fileName)
    sensorExecuter = SensorExecuter(globalData)
    sensorExecuter.daemon = True
    sensorExecuter.start()

    # Wait until thread is initialized.
    while not sensorExecuter.isInitialized():
        time.sleep(0.1)

    logging.info("[%s] Client started." % fileName)

    # read keyboard input and toggle the sensors accordingly
    while True:

        print "--------"
        for sensor in globalData.sensors:
            dataString = ""