diff --git a/html/saraR4.html b/html/saraR4.html index 9315819..ea8b29d 100755 --- a/html/saraR4.html +++ b/html/saraR4.html @@ -97,7 +97,7 @@

SIM card information.

- +
@@ -105,6 +105,15 @@
+
+ + +
+
+
+ +
+
@@ -792,6 +801,79 @@ function getSimInfo(port, timeout) { }); } +function getImsiInfo(port, timeout) { + console.log("Getting IMSI from port " + port); + + $("#loading_ttyAMA2_AT_CIMI").show(); + $("#imsi_info_alert").empty(); + $("#response_ttyAMA2_AT_CIMI").empty(); + + $.ajax({ + url: 'launcher.php?type=sara&port=' + port + '&command=' + encodeURIComponent('AT+CIMI') + '&timeout=' + timeout, + dataType: 'text', + method: 'GET', + success: function(response) { + console.log("IMSI response:", response); + $("#loading_ttyAMA2_AT_CIMI").hide(); + + // Store raw logs + const formattedLogs = response.replace(/\n/g, "
"); + $("#response_ttyAMA2_AT_CIMI").html(formattedLogs); + + // Parse response to extract IMSI (15-digit number) + let alertHtml = ''; + const imsiMatch = response.match(/(\d{15})/); + + if (response.includes('OK') && imsiMatch) { + const imsiNumber = imsiMatch[1]; + alertHtml = ` + `; + } else if (response.includes('ERROR') || response.trim() === '' || !response.includes('OK')) { + alertHtml = ` + `; + } else { + alertHtml = ` + `; + } + + $("#imsi_info_alert").html(alertHtml); + }, + error: function(xhr, status, error) { + console.error('AJAX request failed:', status, error); + $("#loading_ttyAMA2_AT_CIMI").hide(); + $("#imsi_info_alert").html(` + `); + } + }); +} + // Cache for operators data let operatorsData = null;