Made FLEX a service.
This commit is contained in:
parent
5f53b8ff02
commit
9c1554c77b
|
|
@ -158,6 +158,7 @@ class Modes(object):
|
|||
underlying=["nfm"],
|
||||
bandpass=Bandpass(-6000, 6000),
|
||||
requirements=["flex"],
|
||||
service=True,
|
||||
squelch=False,
|
||||
),
|
||||
DigitalMode("cwdecoder", "CWDecoder", underlying=["usb"]),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue