Exemplo n.º 1
0
    def privmsg(self, user, channel, msg):
        ## /msg ZeusBot start to start watching server
        if msg == "start":
            global Zeus
            Zeus = self

            watch_server = NWatcher(database="GV",
                                   email_fn=functions.sendMail,
                                   print_msg_fn=zeusMsg)

            watch_server.attachAlgo(variables=('coraw_al',),
                start_fn=functions.setup_co,
                process_fn=functions.process_co)

            l = task.LoopingCall(watch_server.run)
            l.start(0.01)
        elif msg == "stop":
            pass
## --------------------------------------------------------------------------
from NCARFlightMonitor.watch import NWatcher
import datetime
import functions

## System
import os

## --------------------------------------------------------------------------
## Start command line interface (main)
## --------------------------------------------------------------------------

if __name__ == "__main__":
    import sys

    watch_server = NWatcher(database="GV",
                            email_fn=functions.sendmail)

    watch_server.attachAlgo(variables=('coraw_al',),
                            start_fn=functions.setup_co,
                            process_fn=functions.process_co,
                            description="CO raw cal checker")

    watch_server.attachAlgo(variables=('coraw_al',),
                            start_fn=functions.setup_lost_satcom,
                            process_fn=functions.process_lost_satcom,
                            run_mode="every update",
                            description="Satcom loss indicator")

    watch_server.startWatching()
Exemplo n.º 3
0
    self.cal = False

def process_co(self, tm, data):
    coraw_al = data[0]

    if coraw_al <= 8000 and self.cal == False:
        self.log.print_msg("CO cal occuring.", tm)
        self.cal = True
    ## Reset so that the log message does not appear thousands of times.
    elif coraw_al > 8000 and self.cal == True:
        self.cal = False

## Main
watch_server = NWatcher(database="hippo5_rf05",
                        host="192.168.1.49",
                        user="******",
                        simulate_start_time=
                          datetime.datetime(2011, 8, 19, 18, 0, 0)
                        )

watch_server.attachAlgo(variables=('coraw_al',),
                        start_fn=setup_co,
                        process_fn=process_co,
                        description="CO raw cal checker")

## Spend less time waiting for flight, should only be used in simulation mode.
watch_server._speedWait(100)

## Run for only one flight, then quit.
watch_server.runNumFlights(1)