diff --git a/html/launcher.php b/html/launcher.php index 4d9cceb..3e49ed4 100755 --- a/html/launcher.php +++ b/html/launcher.php @@ -61,6 +61,12 @@ if ($type == "sys_RTC_module_time") { echo $output; } +if ($type == "sara_ping") { + $command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_ping.py'; + $output = shell_exec($command); + echo $output; +} + if ($type == "git_pull") { $command = 'sudo git pull'; $output = shell_exec($command); diff --git a/html/saraR4.html b/html/saraR4.html index 31cdf9b..b11b2de 100755 --- a/html/saraR4.html +++ b/html/saraR4.html @@ -225,6 +225,24 @@ --> +

Test HTTP server comm.

+
+ + +
+
+
+

Test communication with the server.

+ + +
+
+
+
+ + +
+

Send message (test)

@@ -543,6 +561,27 @@ function setURL_saraR4(port, url){ }); } +function ping_test(port, url){ + console.log("Test ping to data.nebuleair.fr:"); + $("#loading_ping").show(); + $.ajax({ + url: 'launcher.php?type=sara_ping', + dataType: 'text', + //dataType: 'json', // Specify that you expect a JSON response + method: 'GET', // Use GET or POST depending on your needs + success: function(response) { + console.log(response); + $("#loading_ping").hide(); + // Replace newline characters with
tags + const formattedResponse = response.replace(/\n/g, "
"); + $("#response_ping").html(formattedResponse); + }, + error: function(xhr, status, error) { + console.error('AJAX request failed:', status, error); + } + }); + } + function writeMessage_saraR4(port, message, type){ console.log(type +" message to SARA R4 memory (port "+port+" and message "+message+"):"); $("#loading_"+port+"_message_write").show();