diff --git a/aprsd/cmds/webchat.py b/aprsd/cmds/webchat.py
index bb79472..ec02fec 100644
--- a/aprsd/cmds/webchat.py
+++ b/aprsd/cmds/webchat.py
@@ -358,7 +358,7 @@ class WebChatFlask(flask_classful.FlaskView):
html_template = "index.html"
# For development
- # html_template = "mobile.html"
+ html_template = "mobile.html"
LOG.debug(f"Template {html_template}")
@@ -443,7 +443,7 @@ class SendMessageNamespace(Namespace):
data["from"] = self._config["aprs"]["login"]
msg = messaging.TextMessage(
data["from"],
- data["to"],
+ data["to"].upper(),
data["message"],
)
self.msg = msg
diff --git a/aprsd/web/chat/static/js/gps.js b/aprsd/web/chat/static/js/gps.js
new file mode 100644
index 0000000..e9520c6
--- /dev/null
+++ b/aprsd/web/chat/static/js/gps.js
@@ -0,0 +1,63 @@
+
+function init_gps() {
+ console.log("init_gps Called.")
+ $("#send_beacon").click(function() {
+ console.log("Send a beacon!")
+ getLocation();
+ });
+}
+
+function getLocation() {
+ if (navigator.geolocation) {
+ console.log("getCurrentPosition");
+ navigator.geolocation.getCurrentPosition(showPosition, showError);
+ } else {
+ var msg = "Geolocation is not supported by this browser."
+ console.log(msg);
+ alert(msg)
+ }
+}
+
+function showError(error) {
+ console.log("showError");
+ console.log(error);
+ var msg = "";
+ switch(error.code) {
+ case error.PERMISSION_DENIED:
+ msg = "User denied the request for Geolocation."
+ break;
+ case error.POSITION_UNAVAILABLE:
+ msg = "Location information is unavailable."
+ break;
+ case error.TIMEOUT:
+ msg = "The request to get user location timed out."
+ break;
+ case error.UNKNOWN_ERROR:
+ msg = "An unknown error occurred."
+ break;
+ }
+ console.log(msg);
+ $.toast({
+ title: 'GPS Error',
+ message: msg,
+ showProgress: 'bottom',
+ classProgress: 'red'
+ });
+}
+
+function showPosition(position) {
+ console.log("showPosition Called");
+ msg = {
+ 'latitude': position.coords.latitude,
+ 'longitude': position.coords.longitude
+ }
+ console.log(msg);
+ $.toast({
+ title: 'Sending GPS Beacon',
+ message: "Latitude: "+position.coords.latitude+"
Longitude: "+position.coords.longitude,
+ showProgress: 'bottom',
+ classProgress: 'red'
+ });
+
+ socket.emit("gps", msg);
+}
diff --git a/aprsd/web/chat/static/js/send-message-mobile.js b/aprsd/web/chat/static/js/send-message-mobile.js
index 57b7ab7..d5fd126 100644
--- a/aprsd/web/chat/static/js/send-message-mobile.js
+++ b/aprsd/web/chat/static/js/send-message-mobile.js
@@ -38,13 +38,15 @@ function init_chat() {
$("#sendform").submit(function(event) {
event.preventDefault();
- msg = {'to': $('#to_call').val(),
+ msg = {'to': $('#to_call').val().toUpperCase(),
'message': $('#message').val(),
}
socket.emit("send", msg);
$('#message').val('');
$('#to_call').val('');
});
+
+ init_gps();
}
@@ -76,16 +78,16 @@ function append_message(callsign, msg, msg_html) {
message_list[callsign] = new Array();
}
message_list[callsign].push(msg);
+
+ // Find the right div to place the html
+ new_callsign = add_callsign(callsign);
+ append_message_html(callsign, msg_html, new_callsign);
if (new_callsign) {
//click on the new tab
click_div = '#'+tab_string(callsign);
console.log("Click on "+click_div);
$(click_div).click();
}
-
- // Find the right div to place the html
- new_callsign = add_callsign(callsign);
- append_message_html(callsign, msg_html, new_callsign);
}
function tab_string(callsign) {
diff --git a/aprsd/web/chat/static/js/send-message.js b/aprsd/web/chat/static/js/send-message.js
index a03dad8..28b9d28 100644
--- a/aprsd/web/chat/static/js/send-message.js
+++ b/aprsd/web/chat/static/js/send-message.js
@@ -45,56 +45,9 @@ function init_chat() {
$('#message').val('');
});
- $("#send_beacon").click(function() {
- console.log("Send a beacon!")
- getLocation();
- });
+ init_gps();
}
-function getLocation() {
- if (navigator.geolocation) {
- console.log("getCurrentPosition");
- navigator.geolocation.getCurrentPosition(showPosition, showError);
- } else {
- var msg = "Geolocation is not supported by this browser."
- console.log(msg);
- alert(msg)
- }
-}
-
-function showError(error) {
- console.log("showError");
- console.log(error);
- var msg = "";
- switch(error.code) {
- case error.PERMISSION_DENIED:
- msg = "User denied the request for Geolocation."
- break;
- case error.POSITION_UNAVAILABLE:
- msg = "Location information is unavailable."
- break;
- case error.TIMEOUT:
- msg = "The request to get user location timed out."
- break;
- case error.UNKNOWN_ERROR:
- msg = "An unknown error occurred."
- break;
- }
- console.log(msg);
- alert(msg);
-}
-
-function showPosition(position) {
- console.log("showPosition Called");
- msg = {
- 'latitude': position.coords.latitude,
- 'longitude': position.coords.longitude
- }
- console.log(msg);
- socket.emit("gps", msg);
-}
-
-
function add_callsign(callsign) {
/* Ensure a callsign exists in the left hand nav */
diff --git a/aprsd/web/chat/templates/index.html b/aprsd/web/chat/templates/index.html
index a3a5d19..c528ba3 100644
--- a/aprsd/web/chat/templates/index.html
+++ b/aprsd/web/chat/templates/index.html
@@ -6,15 +6,15 @@
-
-
+
+
+
-
+