51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
from pycsdr.types import Format
|
|
from csdr.module import PopenModule
|
|
|
|
|
|
class Rtl433Module(PopenModule):
|
|
def __init__(self, sampleRate: int = 48000, jsonOutput: bool = False):
|
|
self.sampleRate = sampleRate
|
|
self.jsonOutput = jsonOutput
|
|
super().__init__()
|
|
|
|
def getCommand(self):
|
|
return ["dummy433"]
|
|
|
|
def getCommandOK(self):
|
|
return [
|
|
"rtl_433", "-r", "cs16:-", "-s", str(self.sampleRate),
|
|
"-M", "time:utc", "-F", "json" if self.jsonOutput else "kv",
|
|
# These need 48kHz, 24kHz is not enough for them
|
|
# "-R", "-80", "-R", "-149", "-R", "-154", "-R", "-160",
|
|
# "-R", "-161",
|
|
# "-R", "64",
|
|
# These need >48kHz bandwidth
|
|
"-167", "-R", "-178",
|
|
"-A",
|
|
]
|
|
|
|
def getInputFormat(self) -> Format:
|
|
return Format.COMPLEX_SHORT
|
|
|
|
def getOutputFormat(self) -> Format:
|
|
return Format.CHAR
|
|
|
|
|
|
class MultimonModule(PopenModule):
|
|
def __init__(self, decoders: list[str]):
|
|
self.decoders = decoders
|
|
super().__init__()
|
|
|
|
def getCommand(self):
|
|
cmd = ["multimon-ng", "-", "-v0", "-c"]
|
|
for x in self.decoders:
|
|
cmd += ["-a", x]
|
|
return cmd
|
|
|
|
def getInputFormat(self) -> Format:
|
|
return Format.SHORT
|
|
|
|
def getOutputFormat(self) -> Format:
|
|
return Format.CHAR
|
|
|