This commit is contained in:
Your Name
2025-02-27 11:54:53 +01:00
parent 3d507ae659
commit bf9ece8589
2 changed files with 45 additions and 0 deletions

View File

@@ -61,6 +61,12 @@ if ($type == "sys_RTC_module_time") {
echo $output; 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") { if ($type == "git_pull") {
$command = 'sudo git pull'; $command = 'sudo git pull';
$output = shell_exec($command); $output = shell_exec($command);

View File

@@ -225,6 +225,24 @@
</div> </div>
</div> </div>
--> -->
<h3>Test HTTP server comm.</h3>
<div class="row mb-3">
<!-- SET URL -->
<div class="col-sm-4">
<div class="card">
<div class="card-body">
<p class="card-text">Test communication with the server.</p>
<button class="btn btn-primary" onclick="ping_test()">Test</button>
<div id="loading_ping" class="spinner-border spinner-border-sm" style="display: none;" role="status"></div>
<div id="response_ping"></div>
</div>
</div>
</div>
</div>
<h3>Send message (test)</h3> <h3>Send message (test)</h3>
<div class="row mb-3"> <div class="row mb-3">
<!-- SET URL --> <!-- SET URL -->
@@ -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 <br> tags
const formattedResponse = response.replace(/\n/g, "<br>");
$("#response_ping").html(formattedResponse);
},
error: function(xhr, status, error) {
console.error('AJAX request failed:', status, error);
}
});
}
function writeMessage_saraR4(port, message, type){ function writeMessage_saraR4(port, message, type){
console.log(type +" message to SARA R4 memory (port "+port+" and message "+message+"):"); console.log(type +" message to SARA R4 memory (port "+port+" and message "+message+"):");
$("#loading_"+port+"_message_write").show(); $("#loading_"+port+"_message_write").show();