pass through the mode on the map
This commit is contained in:
parent
acbf2939c9
commit
2470c2bfa6
@ -57,6 +57,7 @@
|
|||||||
title: update.callsign
|
title: update.callsign
|
||||||
}, getMarkerOpacityOptions(update.lastseen) ));
|
}, getMarkerOpacityOptions(update.lastseen) ));
|
||||||
marker.lastseen = update.lastseen;
|
marker.lastseen = update.lastseen;
|
||||||
|
marker.mode = update.mode;
|
||||||
|
|
||||||
// TODO the trim should happen on the server side
|
// TODO the trim should happen on the server side
|
||||||
if (expectedCallsign && expectedCallsign == update.callsign.trim()) {
|
if (expectedCallsign && expectedCallsign == update.callsign.trim()) {
|
||||||
@ -94,6 +95,7 @@
|
|||||||
}, getRectangleOpacityOptions(update.lastseen) ));
|
}, getRectangleOpacityOptions(update.lastseen) ));
|
||||||
rectangle.lastseen = update.lastseen;
|
rectangle.lastseen = update.lastseen;
|
||||||
rectangle.locator = update.location.locator;
|
rectangle.locator = update.location.locator;
|
||||||
|
rectangle.mode = update.mode;
|
||||||
|
|
||||||
if (expectedLocator && expectedLocator == update.location.locator) {
|
if (expectedLocator && expectedLocator == update.location.locator) {
|
||||||
map.panTo(center);
|
map.panTo(center);
|
||||||
@ -182,7 +184,7 @@
|
|||||||
var showLocatorInfoWindow = function(locator, pos) {
|
var showLocatorInfoWindow = function(locator, pos) {
|
||||||
if (!infowindow) infowindow = new google.maps.InfoWindow();
|
if (!infowindow) infowindow = new google.maps.InfoWindow();
|
||||||
var inLocator = $.map(rectangles, function(r, callsign) {
|
var inLocator = $.map(rectangles, function(r, callsign) {
|
||||||
return {callsign: callsign, locator: r.locator, lastseen: r.lastseen}
|
return {callsign: callsign, locator: r.locator, lastseen: r.lastseen, mode: r.mode}
|
||||||
}).filter(function(d) {
|
}).filter(function(d) {
|
||||||
return d.locator == locator;
|
return d.locator == locator;
|
||||||
}).sort(function(a, b){
|
}).sort(function(a, b){
|
||||||
@ -194,7 +196,7 @@
|
|||||||
'<ul>' +
|
'<ul>' +
|
||||||
inLocator.map(function(i){
|
inLocator.map(function(i){
|
||||||
var timestring = moment(i.lastseen).fromNow();
|
var timestring = moment(i.lastseen).fromNow();
|
||||||
return '<li>' + i.callsign + ' (' + timestring + ')</li>'
|
return '<li>' + i.callsign + ' (' + timestring + ' via ' + i.mode + ')</li>'
|
||||||
}).join("") +
|
}).join("") +
|
||||||
'</ul>'
|
'</ul>'
|
||||||
);
|
);
|
||||||
@ -208,7 +210,7 @@
|
|||||||
var timestring = moment(marker.lastseen).fromNow();
|
var timestring = moment(marker.lastseen).fromNow();
|
||||||
infowindow.setContent(
|
infowindow.setContent(
|
||||||
'<h3>' + callsign + '</h3>' +
|
'<h3>' + callsign + '</h3>' +
|
||||||
'<div>' + timestring + '</div>'
|
'<div>' + timestring + ' via ' + marker.mode + '</div>'
|
||||||
);
|
);
|
||||||
infowindow.open(map, marker);
|
infowindow.open(map, marker);
|
||||||
}
|
}
|
||||||
|
10
owrx/map.py
10
owrx/map.py
@ -44,7 +44,8 @@ class Map(object):
|
|||||||
{
|
{
|
||||||
"callsign": callsign,
|
"callsign": callsign,
|
||||||
"location": record["location"].__dict__(),
|
"location": record["location"].__dict__(),
|
||||||
"lastseen": record["updated"].timestamp() * 1000
|
"lastseen": record["updated"].timestamp() * 1000,
|
||||||
|
"mode" : record["mode"]
|
||||||
}
|
}
|
||||||
for (callsign, record) in self.positions.items()
|
for (callsign, record) in self.positions.items()
|
||||||
])
|
])
|
||||||
@ -55,14 +56,15 @@ class Map(object):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def updateLocation(self, callsign, loc: Location):
|
def updateLocation(self, callsign, loc: Location, mode: str):
|
||||||
ts = datetime.now()
|
ts = datetime.now()
|
||||||
self.positions[callsign] = {"location": loc, "updated": ts}
|
self.positions[callsign] = {"location": loc, "updated": ts, "mode": mode}
|
||||||
self.broadcast([
|
self.broadcast([
|
||||||
{
|
{
|
||||||
"callsign": callsign,
|
"callsign": callsign,
|
||||||
"location": loc.__dict__(),
|
"location": loc.__dict__(),
|
||||||
"lastseen": ts.timestamp() * 1000
|
"lastseen": ts.timestamp() * 1000,
|
||||||
|
"mode" : mode
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -71,7 +71,8 @@ class YsfMetaEnricher(object):
|
|||||||
def enrich(self, meta):
|
def enrich(self, meta):
|
||||||
if "source" in meta and "lat" in meta and "lon" in meta:
|
if "source" in meta and "lat" in meta and "lon" in meta:
|
||||||
# TODO parsing the float values should probably happen earlier
|
# TODO parsing the float values should probably happen earlier
|
||||||
Map.getSharedInstance().updateLocation(meta["source"], LatLngLocation(float(meta["lat"]), float(meta["lon"])))
|
loc = LatLngLocation(float(meta["lat"]), float(meta["lon"]))
|
||||||
|
Map.getSharedInstance().updateLocation(meta["source"], loc, "YSF")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
14
owrx/wsjt.py
14
owrx/wsjt.py
@ -118,9 +118,15 @@ class WsjtParser(object):
|
|||||||
self.handler = handler
|
self.handler = handler
|
||||||
self.locator_pattern = re.compile(".*\s([A-Z0-9]+)\s([A-R]{2}[0-9]{2})$")
|
self.locator_pattern = re.compile(".*\s([A-Z0-9]+)\s([A-R]{2}[0-9]{2})$")
|
||||||
|
|
||||||
|
modes = {
|
||||||
|
"~": "FT8"
|
||||||
|
}
|
||||||
|
|
||||||
def parse(self, data):
|
def parse(self, data):
|
||||||
try:
|
try:
|
||||||
msg = data.decode().rstrip()
|
msg = data.decode().rstrip()
|
||||||
|
# sample
|
||||||
|
# '222100 -15 -0.0 508 ~ CQ EA7MJ IM66'
|
||||||
# known debug messages we know to skip
|
# known debug messages we know to skip
|
||||||
if msg.startswith("<DecodeFinished>"):
|
if msg.startswith("<DecodeFinished>"):
|
||||||
return
|
return
|
||||||
@ -133,15 +139,17 @@ class WsjtParser(object):
|
|||||||
out["db"] = float(msg[7:10])
|
out["db"] = float(msg[7:10])
|
||||||
out["dt"] = float(msg[11:15])
|
out["dt"] = float(msg[11:15])
|
||||||
out["freq"] = int(msg[16:20])
|
out["freq"] = int(msg[16:20])
|
||||||
|
modeChar = msg[21:22]
|
||||||
|
out["mode"] = mode = WsjtParser.modes[modeChar] if modeChar in WsjtParser.modes else "unknown"
|
||||||
wsjt_msg = msg[24:60].strip()
|
wsjt_msg = msg[24:60].strip()
|
||||||
self.getLocator(wsjt_msg)
|
self.parseLocator(wsjt_msg, mode)
|
||||||
out["msg"] = wsjt_msg
|
out["msg"] = wsjt_msg
|
||||||
|
|
||||||
self.handler.write_wsjt_message(out)
|
self.handler.write_wsjt_message(out)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logger.exception("error while parsing wsjt message")
|
logger.exception("error while parsing wsjt message")
|
||||||
|
|
||||||
def getLocator(self, msg):
|
def parseLocator(self, msg, mode):
|
||||||
m = self.locator_pattern.match(msg)
|
m = self.locator_pattern.match(msg)
|
||||||
if m is None:
|
if m is None:
|
||||||
return
|
return
|
||||||
@ -149,4 +157,4 @@ class WsjtParser(object):
|
|||||||
# likely this just means roger roger goodbye.
|
# likely this just means roger roger goodbye.
|
||||||
if m.group(2) == "RR73":
|
if m.group(2) == "RR73":
|
||||||
return
|
return
|
||||||
Map.getSharedInstance().updateLocation(m.group(1), LocatorLocation(m.group(2)))
|
Map.getSharedInstance().updateLocation(m.group(1), LocatorLocation(m.group(2)), mode)
|
||||||
|
Loading…
Reference in New Issue
Block a user