mirror of
https://github.com/craigerl/aprsd.git
synced 2025-08-09 16:52:25 -04: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:
parent
87cbcaa47f
commit
9571b0bb38
@ -375,12 +375,9 @@ class SendMessageNamespace(Namespace):
|
|||||||
# now construct a beacon to send over the client connection
|
# now construct a beacon to send over the client connection
|
||||||
txt = (
|
txt = (
|
||||||
f"{self._config['aprs']['login']}>APZ100,WIDE2-1"
|
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 = messaging.RawMessage(txt)
|
||||||
beacon_msg.fromcall = self._config["aprs"]["login"]
|
beacon_msg.fromcall = self._config["aprs"]["login"]
|
||||||
beacon_msg.tocall = "APDW16"
|
beacon_msg.tocall = "APDW16"
|
||||||
|
@ -10,7 +10,14 @@ function init_gps() {
|
|||||||
function getLocation() {
|
function getLocation() {
|
||||||
if (navigator.geolocation) {
|
if (navigator.geolocation) {
|
||||||
console.log("getCurrentPosition");
|
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 {
|
} else {
|
||||||
var msg = "Geolocation is not supported by this browser."
|
var msg = "Geolocation is not supported by this browser."
|
||||||
console.log(msg);
|
console.log(msg);
|
||||||
@ -30,7 +37,7 @@ function showError(error) {
|
|||||||
msg = "Location information is unavailable."
|
msg = "Location information is unavailable."
|
||||||
break;
|
break;
|
||||||
case error.TIMEOUT:
|
case error.TIMEOUT:
|
||||||
msg = "The request to get user location timed out."
|
msg = "The location fix timed out."
|
||||||
break;
|
break;
|
||||||
case error.UNKNOWN_ERROR:
|
case error.UNKNOWN_ERROR:
|
||||||
msg = "An unknown error occurred."
|
msg = "An unknown error occurred."
|
||||||
@ -39,9 +46,11 @@ function showError(error) {
|
|||||||
console.log(msg);
|
console.log(msg);
|
||||||
$.toast({
|
$.toast({
|
||||||
title: 'GPS Error',
|
title: 'GPS Error',
|
||||||
|
class: 'warning',
|
||||||
|
position: 'middle center',
|
||||||
message: msg,
|
message: msg,
|
||||||
showProgress: 'bottom',
|
showProgress: 'top',
|
||||||
classProgress: 'red'
|
classProgress: 'blue',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,5 +68,6 @@ function showPosition(position) {
|
|||||||
classProgress: 'red'
|
classProgress: 'red'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("Sending GPS msg")
|
||||||
socket.emit("gps", msg);
|
socket.emit("gps", msg);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user