Separated FLEX baud rate from channel, baud field now integer.

This commit is contained in:
Marat Fayzullin 2024-05-04 20:13:45 -04:00
parent e63e8f59a4
commit 90ba932321
3 changed files with 22 additions and 14 deletions

View File

@ -18,7 +18,7 @@ class Rtl433Module(ExecModule):
class MultimonModule(ExecModule): class MultimonModule(ExecModule):
def __init__(self, decoders: list[str]): def __init__(self, decoders: list[str]):
pm = Config.get() pm = Config.get()
cmd = ["multimon-ng", "-", "-v0", "-c", "-C", pm["paging_charset"]] cmd = ["multimon-ng", "-", "-v0", "-C", pm["paging_charset"], "-c"]
for x in decoders: for x in decoders:
cmd += ["-a", x] cmd += ["-a", x]
super().__init__(Format.SHORT, Format.CHAR, cmd) super().__init__(Format.SHORT, Format.CHAR, cmd)

View File

@ -303,14 +303,18 @@ PageMessagePanel.prototype.render = function() {
PageMessagePanel.prototype.pushMessage = function(msg) { PageMessagePanel.prototype.pushMessage = function(msg) {
// Get color from the message, default to white // Get color from the message, default to white
var color = msg.hasOwnProperty('color')? msg.color : "#FFF"; var color = msg.hasOwnProperty('color')? msg.color : '#FFF';
// Get channel from the message (FLEX only)
var channel = msg.hasOwnProperty('channel')? '/' + msg.channel : '';
// Append message header (address, time, etc) // Append message header (address, time, etc)
var $b = $(this.el).find('tbody'); var $b = $(this.el).find('tbody');
$b.append($( $b.append($(
'<tr>' + '<tr>' +
'<td class="address">' + msg.address + '</td>' + '<td class="address">' + msg.address + '</td>' +
'<td class="mode">' + msg.mode + msg.baud + '</td>' + '<td class="mode">' + msg.mode + msg.baud + channel + '</td>' +
'<td class="timestamp" style="text-align:right;">' + Utils.HHMMSS(msg.timestamp) + '</td>' + '<td class="timestamp" style="text-align:right;">' + Utils.HHMMSS(msg.timestamp) + '</td>' +
'</tr>' '</tr>'
).css('background-color', color).css('color', '#000')); ).css('background-color', color).css('color', '#000'));

View File

@ -197,11 +197,11 @@ class PageParser(TextParser):
self.rePocsag = re.compile(r"POCSAG(\d+):\s*Address:\s*(\S+)\s+Function:\s*(-?\d+)(\s+Certainty:\s*(-?\d+))?(\s+(\S+):\s*(.*))?") self.rePocsag = re.compile(r"POCSAG(\d+):\s*Address:\s*(\S+)\s+Function:\s*(-?\d+)(\s+Certainty:\s*(-?\d+))?(\s+(\S+):\s*(.*))?")
# FLEX|NNNN-NN-NN NN:NN:NN|<baud>/<value>/C/C|NN.NNN|NNNNNNNNN|<type>|<message> # FLEX|NNNN-NN-NN NN:NN:NN|<baud>/<value>/C/C|NN.NNN|NNNNNNNNN|<type>|<message>
# FLEX|NNNN-NN-NN NN:NN:NN|<baud>/<value>/C/C|NN.NNN|NNNNNNNNN NNNNNNNNN|<type>|<message> # FLEX|NNNN-NN-NN NN:NN:NN|<baud>/<value>/C/C|NN.NNN|NNNNNNNNN NNNNNNNNN|<type>|<message>
self.reFlex1 = re.compile(r"FLEX\|(\d\d\d\d-\d\d-\d\d\s+\d\d:\d\d:\d\d)\|(\d+/\d+/\S/\S)\|(\d\d\.\d\d\d)\|(\d+(?:\s+\d+)?)\|(\S+)\|(.*)") self.reFlex1 = re.compile(r"FLEX\|(\d\d\d\d-\d\d-\d\d\s+\d\d:\d\d:\d\d)\|(\d+)/(\d+/\S/\S)\|(\d\d\.\d\d\d)\|(\d+(?:\s+\d+)?)\|(\S+)\|(.*)")
# FLEX: NNNN-NN-NN NN:NN:NN <baud>/<value>/C NN.NNN [NNNNNNNNN] <type> <message> # FLEX: NNNN-NN-NN NN:NN:NN <baud>/<value>/C NN.NNN [NNNNNNNNN] <type> <message>
self.reFlex2 = re.compile(r"FLEX:\s+(\d\d\d\d-\d\d-\d\d\s+\d\d:\d\d:\d\d)\s+(\d+/\d+/\S)\s+(\d\d\.\d\d\d)\s+\[(\d+)\]\s+(\S+)\s+(.*)") self.reFlex2 = re.compile(r"FLEX:\s+(\d\d\d\d-\d\d-\d\d\s+\d\d:\d\d:\d\d)\s+(\d+)/(\d+/\S)\s+(\d\d\.\d\d\d)\s+\[(\d+)\]\s+(\S+)\s+(.*)")
# FLEX message status # FLEX message status
self.reFlex3 = re.compile(r"(\d+/\d+)(/\S)?/\S") self.reFlex3 = re.compile(r"(\d+)(/\S)?/\S")
# Message filtering patterns # Message filtering patterns
self.reControl = re.compile(r"<[\w\d]{2,3}>") self.reControl = re.compile(r"<[\w\d]{2,3}>")
self.reSpaces = re.compile(r"[\000-\037\s]+") self.reSpaces = re.compile(r"[\000-\037\s]+")
@ -266,7 +266,7 @@ class PageParser(TextParser):
if not self.filtering or (msgtype=="Alpha" and len(msg)>0): if not self.filtering or (msgtype=="Alpha" and len(msg)>0):
out = { out = {
"mode": "POCSAG", "mode": "POCSAG",
"baud": baud, "baud": int(baud),
"timestamp": round(datetime.now().timestamp() * 1000), "timestamp": round(datetime.now().timestamp() * 1000),
"address": capcode, "address": capcode,
"function": int(function), "function": int(function),
@ -294,13 +294,14 @@ class PageParser(TextParser):
if r is not None: if r is not None:
time = datetime.strptime(r.group(1), "%Y-%m-%d %H:%M:%S") time = datetime.strptime(r.group(1), "%Y-%m-%d %H:%M:%S")
time = time.replace(tzinfo=timezone.utc) time = time.replace(tzinfo=timezone.utc)
state = r.group(2) baud = r.group(2)
frame = r.group(3) state = r.group(3)
capcode = r.group(4) frame = r.group(4)
msgtype = r.group(5) capcode = r.group(5)
msg = r.group(6) msgtype = r.group(6)
msg = r.group(7)
rm = self.reFlex3.match(state) rm = self.reFlex3.match(state)
baud = "" if not rm else rm.group(1) channel = "" if not rm else rm.group(1)
frag = "" if not rm or not rm.group(2) else rm.group(2)[1] frag = "" if not rm or not rm.group(2) else rm.group(2)[1]
# Assemble fragmented messages in flexBuf # Assemble fragmented messages in flexBuf
if frag == "F" or frag == "C": if frag == "F" or frag == "C":
@ -326,13 +327,16 @@ class PageParser(TextParser):
if not self.filtering or (msgtype=="ALN" and self.isReadable(msg)): if not self.filtering or (msgtype=="ALN" and self.isReadable(msg)):
out = { out = {
"mode": "FLEX", "mode": "FLEX",
"baud": baud, "baud": int(baud),
"timestamp": round(time.timestamp() * 1000), "timestamp": round(time.timestamp() * 1000),
"state": state, "state": state,
"frame": frame, "frame": frame,
"address": capcode, "address": capcode,
"type": msgtype "type": msgtype
} }
# Output channel
if len(channel)>0:
out["channel"] = int(channel)
# Output message # Output message
if len(msg)>0: if len(msg)>0:
out["message"] = msg out["message"] = msg