1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-12-20 16:41:13 -05:00

Fixed position report for webchat beacon

With more testing of the webchat beaconing, found a problem
with the packet format for the beacon.  This patch fixes the
packet format of the beacon.

Also added a timeout when trying to get the GPS location in the browser,
otherwise it could never come back.
This commit is contained in:
Hemna 2022-12-16 12:01:35 -05:00
parent 87cbcaa47f
commit 9571b0bb38
2 changed files with 15 additions and 8 deletions

View File

@ -375,12 +375,9 @@ class SendMessageNamespace(Namespace):
# now construct a beacon to send over the client connection
txt = (
f"{self._config['aprs']['login']}>APZ100,WIDE2-1"
f":!{lat}{long}#PHG7260 APRSD WebChat Beacon"
f":@{time_zulu}z{lat}/{long}l APRSD WebChat Beacon"
)
txt = f"@{time_zulu}z{lat}1{long}$APRSD WebChat Beacon"
LOG.debug(f"Sending {txt}")
beacon_msg = messaging.RawMessage(txt)
beacon_msg.fromcall = self._config["aprs"]["login"]
beacon_msg.tocall = "APDW16"

View File

@ -10,7 +10,14 @@ function init_gps() {
function getLocation() {
if (navigator.geolocation) {
console.log("getCurrentPosition");
navigator.geolocation.getCurrentPosition(showPosition, showError);
try {
navigator.geolocation.getCurrentPosition(
showPosition, showError,
{timeout:3000});
} catch(err) {
console.log("Failed to getCurrentPosition");
console.log(err);
}
} else {
var msg = "Geolocation is not supported by this browser."
console.log(msg);
@ -30,7 +37,7 @@ function showError(error) {
msg = "Location information is unavailable."
break;
case error.TIMEOUT:
msg = "The request to get user location timed out."
msg = "The location fix timed out."
break;
case error.UNKNOWN_ERROR:
msg = "An unknown error occurred."
@ -39,9 +46,11 @@ function showError(error) {
console.log(msg);
$.toast({
title: 'GPS Error',
class: 'warning',
position: 'middle center',
message: msg,
showProgress: 'bottom',
classProgress: 'red'
showProgress: 'top',
classProgress: 'blue',
});
}
@ -59,5 +68,6 @@ function showPosition(position) {
classProgress: 'red'
});
console.log("Sending GPS msg")
socket.emit("gps", msg);
}