Esempio n. 1
0
    def parse(self, messages):
        for data in messages:
            try:
                profile, freq, raw_msg = data
                self.dial_freq = freq
                msg = raw_msg.decode().rstrip()
                # known debug messages we know to skip
                if msg.startswith("<DecodeFinished>"):  # this is what jt9 std output
                    continue
                if msg.startswith(" EOF on input file"):  # this is what jt9 std output
                    continue

                if isinstance(profile, WsprProfile):
                    decoder = WsprDecoder()
                else:
                    decoder = JT9Decoder()
                out = decoder.parse(msg, freq)
                logging.info("[%s] %s T%s DB%2.1f DT%2.1f F%2.6f %s : %s %s",
                             self.getStation(),
                             out["mode"],
                             time.strftime("%H%M%S",  time.localtime(out["timestamp"])),
                             out["db"], out["dt"], out["freq"], out["msg"],
                             out["callsign"] if "callsign" in out else "-",
                             out["locator"] if "locator" in out else "")
                if "mode" in out:
                    if "callsign" in out and "locator" in out:
                        PskReporter.getSharedInstance(self.getStation()).spot(out)
                        # upload beacons to wsprnet as well
                        if out["mode"] in ["WSPR", "FST4W"]:
                            Wsprnet.getSharedInstance(self.getStation()).spot(out)

            except ValueError:
                logging.exception("error while parsing wsjt message")
Esempio n. 2
0
def cleanup():
    _run_event.clear()
    PskReporter.stop()
    Wsprnet.stop()
    [w.stop() for w in DecoderQueue.instance().workers]
    [r.stop() for r in _sr_tasks]
    [
        t.join() for t in threading.enumerate()
        if t is not threading.currentThread()
    ]