diff --git a/html/saraR4.html b/html/saraR4.html index 8a9aa44..b5aee77 100755 --- a/html/saraR4.html +++ b/html/saraR4.html @@ -186,13 +186,10 @@

LED status connexion (PCB)

Active la LED bleue du PCB qui indique l'état de la connexion réseau (GPIO 16 du modem).

- - -
-
- - -
+ + + +
@@ -1122,6 +1119,42 @@ function hardwareRebootSara() { }); } +function sendLedCommand(command, label) { + $("#loading_led").show(); + $("#response_led").empty(); + + $.ajax({ + url: 'launcher.php?type=sara&port=ttyAMA2&command=' + encodeURIComponent(command) + '&timeout=5', + dataType: 'text', + method: 'GET', + timeout: 10000, + success: function(response) { + $("#loading_led").hide(); + if (response.indexOf("OK") !== -1) { + $("#response_led").html(` +
+ ${label} — OK
+ Commande ${command} exécutée avec succès. +
`); + } else { + $("#response_led").html(` +
+ ${label} — Réponse inattendue
+ ${response} +
`); + } + }, + error: function(xhr, status, error) { + $("#loading_led").hide(); + $("#response_led").html(` +
+ Erreur de connexion avec le modem
+ ${error || 'Pas de réponse'} +
`); + } + }); +} + function getData_saraR4(port, command, timeout){ console.log("Data from SaraR4"); console.log("Port: " + port );