diff --git a/owrx/modes.py b/owrx/modes.py index b2132c6b..c67dfddb 100644 --- a/owrx/modes.py +++ b/owrx/modes.py @@ -158,6 +158,7 @@ class Modes(object): underlying=["nfm"], bandpass=Bandpass(-6000, 6000), requirements=["flex"], + service=True, squelch=False, ), DigitalMode("cwdecoder", "CWDecoder", underlying=["usb"]), diff --git a/owrx/multimon.py b/owrx/multimon.py index edbcfaab..6a672b4d 100644 --- a/owrx/multimon.py +++ b/owrx/multimon.py @@ -16,6 +16,8 @@ class MultimonParser(ThreadModule): self.frequency = 0 self.data = bytearray(b'') self.file = None + self.maxLines = 10000 + self.cntLines = 0 super().__init__() def __del__(self): @@ -42,17 +44,27 @@ class MultimonParser(ThreadModule): self.fileName = Storage().getFilePath(fileName + ".txt") logger.debug("Opening log file '%s'..." % self.fileName) self.file = open(self.fileName, "wb") + self.cntLines = 0 except Exception as exptn: logger.debug("Exception opening file: %s" % str(exptn)) self.file = None def writeFile(self, data): + # If no file open, create and open a new file + if self.file is None: + self.newFile(Storage().makeFileName("MON-{0}", self.frequency)) + # If file open now... if self.file is not None: + # Write new line into the file try: self.file.write(data) except Exception: pass + # No more than maxLines per file + self.cntLines = self.cntLines + 1 + if self.cntLines >= self.maxLines: + self.closeFile() def getInputFormat(self) -> Format: return Format.CHAR diff --git a/owrx/service/__init__.py b/owrx/service/__init__.py index c5dd673f..af098551 100644 --- a/owrx/service/__init__.py +++ b/owrx/service/__init__.py @@ -318,6 +318,9 @@ class ServiceHandler(SdrSourceEventClient): elif mod == "fax": from csdr.chain.digimodes import FaxDemodulator return FaxDemodulator(service=True) + elif mod == "flex": + from csdr.chain.multimon import FlexDemodulator + return FlexDemodulator(service=True) raise ValueError("unsupported service modulation: {}".format(mod))