This commit is contained in:
Your Name
2025-11-05 14:44:30 +01:00
parent 26ee893a96
commit 65beead82b
3 changed files with 94 additions and 47 deletions

View File

@@ -343,6 +343,13 @@ if ($type == "sara_ping") {
echo $output;
}
if ($type == "sara_psd_setup") {
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/R5/setPDP.py';
$output = shell_exec($command);
echo $output;
}
if ($type == "git_pull") {
$command = 'sudo git pull';
$output = shell_exec($command);
@@ -656,6 +663,20 @@ if ($type == "sara_connectNetwork") {
echo $output;
}
#Setup Hostnmae
if ($type == "sara_setupHostname") {
$port=$_GET['port'];
$server_hostname=$_GET['networkID'];
$profileID=$_GET['profileID'];
//echo "connecting to network... please wait...";
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_setURL.py ' . $port . ' ' . $server_hostname . ' ' . $profileID;
$output = shell_exec($command);
echo $output;
}
#SET THE URL for messaging (profile id 2)

View File

@@ -67,7 +67,7 @@
-->
<div class="row mb-3">
<div class="col-sm-3">
<div class="col-sm-2">
<div class="card">
<div class="card-body">
@@ -252,6 +252,34 @@
</div>
</div>
</div>
<div class="col-sm-4">
<div class="card">
<div class="card-body">
<p class="card-text">Setup PSD connection.</p>
<button class="btn btn-primary" onclick="PSD_setup()">Start</button>
<div id="loading_PSD" class="spinner-border spinner-border-sm" style="display: none;" role="status"></div>
<div id="response_psd_setup"></div>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="card">
<div class="card-body">
<p class="card-text">Setup Server Hostname.</p>
<div class="input-group input-group-sm mb-3">
<span class="input-group-text" id="inputGroup-sizing-sm">Server name</span>
<input type="text" id="messageInput_server" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-sm">
</div>
<button class="btn btn-primary" onclick="setupServerHostname('ttyAMA2', document.getElementById('messageInput_server').value, 0)">Set</button>
<div id="loading_serverHostname" class="spinner-border spinner-border-sm" style="display: none;" role="status"></div>
<div id="response_serverHostname"></div>
</div>
</div>
</div>
</div>
@@ -558,6 +586,28 @@ function connectNetwork_saraR4(port, networkID, timeout){
});
}
function setupServerHostname(port, serverName, timeout){
console.log(" Setupt server hostname "+serverName+"):");
$("#loading_serverHostname").show();
$.ajax({
url: 'launcher.php?type=sara_setupHostname&port='+port+'&networkID='+encodeURIComponent(serverName)+'&profileID=0',
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_serverHostname").hide();
// Replace newline characters with <br> tags
const formattedResponse = response.replace(/\n/g, "<br>");
$("#response_serverHostname").html(formattedResponse);
},
error: function(xhr, status, error) {
console.error('AJAX request failed:', status, error);
}
});
}
function mqtt_getConfig_saraR4(port, timeout){
console.log("GET MQTT config (port "+port+"):");
$("#loading_mqtt_getConfig").show();
@@ -690,6 +740,27 @@ function ping_test(port, url){
});
}
function PSD_setup(port, url){
console.log("Setup PSD connection:");
$("#loading_PSD").show();
$.ajax({
url: 'launcher.php?type=sara_psd_setup',
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_PSD").hide();
// Replace newline characters with <br> tags
const formattedResponse = response.replace(/\n/g, "<br>");
$("#response_psd_setup").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();