Merge pull request #42 from dr-dolomite/development-socat

Added LTE Network Mode Parsing Bug Fix and Browser Tab Icon
This commit is contained in:
Cameron Thompson
2024-05-08 11:34:40 -04:00
committed by GitHub
7 changed files with 186 additions and 94 deletions

View File

@@ -11,12 +11,12 @@
crossorigin="anonymous"
/> -->
<!-- Import all the bootstrap css files from css folder -->
<link rel="stylesheet" href="/css/styles.css" />
<link rel="stylesheet" href="/css/bootstrap.min.css" />
<link rel="stylesheet" href="css/styles.css" />
<link rel="stylesheet" href="css/bootstrap.min.css" />
<!-- Import BootStrap Javascript -->
<script src="/js/bootstrap.bundle.min.js"></script>
<script src="/js/alpinejs.min.js" defer></script>
<script src="js/bootstrap.bundle.min.js"></script>
<script src="js/alpinejs.min.js" defer></script>
</head>
<body>
<main>
@@ -209,7 +209,7 @@
</div>
</div>
</main>
<script src="/js/dark-mode.js"></script>
<script src="js/dark-mode.js"></script>
<script>
function fetchDeviceInfo() {
return {

BIN
simpleadmin/www/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -14,9 +14,12 @@
<link rel="stylesheet" href="css/styles.css" />
<link rel="stylesheet" href="css/bootstrap.min.css" />
<!-- Logo -->
<link rel="simpleadmin-logo" href="favicon.ico">
<!-- Import BootStrap Javascript -->
<script src="/js/bootstrap.bundle.min.js"></script>
<script src="/js/alpinejs.min.js" defer></script>
<script src="js/bootstrap.bundle.min.js"></script>
<script src="js/alpinejs.min.js" defer></script>
</head>
<body>
<main>
@@ -514,7 +517,7 @@
</div>
</div>
</main>
<script src="/js/dark-mode.js"></script>
<script src="js/dark-mode.js"></script>
<script>
function getStaticNetworkInfo() {
return {
@@ -554,7 +557,7 @@
internetConnection: "Disconnected",
lastUpdate: new Date().toLocaleString(),
newRefreshRate: null,
refreshRate: 30,
refreshRate: 5,
intervalId: null,
fetchNetworkInfo() {
this.atcmd =
@@ -630,10 +633,12 @@
lines[27] !== "/r"
) {
// Check if lines[27] doesnt have TDD or FDD
if (lines[27].match(/FDD/) != null || lines[27].match(/TDD/) != null) {
if (
lines[27].match(/FDD/) != null ||
lines[27].match(/TDD/) != null
) {
networkMode2 = lines[27].split(",")[2].replace(/"/g, "");
networkMode2 = networkMode2.split(",")[0].trim();
console.log(networkMode2);
}
if (networkMode2 !== "LTE") {
@@ -654,7 +659,6 @@
}
}
console.log(networkMode2, networkMode3);
// Check if networkMode3 is not empty
if (networkMode3 !== undefined) {
this.network_mode = networkMode2 + ", " + networkMode3;
@@ -776,86 +780,167 @@
this.signalPercentage
);
} else {
let lte_bw_ul = lines[28].split(",")[8].replace(/"/g, "");
let lte_bw_dl = lines[28].split(",")[9].replace(/"/g, "");
if (this.network_mode.match(/LTE/) != null) {
let lte_bw_ul = lines[27].split(",")[10].replace(/"/g, "");
let lte_bw_dl = lines[27].split(",")[11].replace(/"/g, "");
lte_bw_dl = parseInt(lte_bw_dl);
lte_bw_ul = parseInt(lte_bw_ul);
lte_bw_dl = parseInt(lte_bw_dl);
lte_bw_ul = parseInt(lte_bw_ul);
// Calculate the LTE bandwidth
this.bandwidth =
this.calculate_lte_bw(lte_bw_ul) +
" MHz / " +
this.calculate_lte_bw(lte_bw_dl) +
" MHz";
// Calculate the LTE bandwidth
this.bandwidth =
this.calculate_lte_bw(lte_bw_ul) +
" MHz / " +
this.calculate_lte_bw(lte_bw_dl) +
" MHz";
// Get the RSSI
this.rssi = lines[28].split(",")[13].replace(/"/g, "");
// Get the Cell ID
const longCID = lines[27].split(",")[6].replace(/"/g, "");
// Get the Cell ID
const longCID = lines[28].split(",")[4].replace(/"/g, "");
// Get the eNBID. Its just Cell ID minus the last 2 characters
this.eNBID = longCID.substring(0, longCID.length - 2);
// Get the eNBID. Its just Cell ID minus the last 2 characters
this.eNBID = longCID.substring(0, longCID.length - 2);
// Get the short Cell ID (Last 2 characters of the Cell ID)
const shortCID = longCID.substring(longCID.length - 2);
// Get the short Cell ID (Last 2 characters of the Cell ID)
const shortCID = longCID.substring(longCID.length - 2);
// Get the TAC
this.tac = lines[27].split(",")[12].replace(/"/g, "");
this.tac = this.tac + " (" + parseInt(this.tac, 16) + ")";
// Get the TAC
this.tac = lines[28].split(",")[10].replace(/"/g, "");
this.tac = this.tac + " (" + parseInt(this.tac, 16) + ")";
this.cellID =
"Short " +
shortCID +
"(" +
parseInt(shortCID, 16) +
")" +
", " +
"Long " +
longCID +
"(" +
parseInt(longCID, 16) +
")";
this.cellID =
"Short " +
shortCID +
"(" +
parseInt(shortCID, 16) +
")" +
", " +
"Long " +
longCID +
"(" +
parseInt(longCID, 16) +
")";
// Parse the PCIs
this.pcc_pci = lines[27].split(",")[7].replace(/"/g, "");
// Parse the PCIs
this.pcc_pci = lines[28].split(",")[5].replace(/"/g, "");
// Get the RSRQ
this.rsrqLTE = lines[27].split(",")[14].replace(/"/g, "");
let rsrq = parseInt(this.rsrqLTE);
// Get the RSRQ
this.rsrqLTE = lines[28].split(",")[12].replace(/"/g, "");
let rsrq = parseInt(this.rsrqLTE);
// Calculate the RSRQ percentage
this.rsrqLTEPercentage = this.calculateRSRQPercentage(rsrq);
// Calculate the RSRQ percentage
this.rsrqLTEPercentage = this.calculateRSRQPercentage(rsrq);
// Get the RSRP
this.rsrpLTE = lines[27].split(",")[13].replace(/"/g, "");
// Get the RSRP
this.rsrpLTE = lines[28].split(",")[11].replace(/"/g, "");
// Calculate the RSRP percentage
this.rsrpLTEPercentage = this.calculateRSRPPercentage(
parseInt(this.rsrpLTE)
);
// Calculate the RSRP percentage
this.rsrpLTEPercentage = this.calculateRSRPPercentage(
parseInt(this.rsrpLTE)
);
// Get the RSSI
this.rssi = lines[27].split(",")[15].replace(/"/g, "");
// Get the SINR
this.sinrLTE = lines[28].split(",")[14].replace(/"/g, "");
// Get the SINR
this.sinrLTE = lines[27].split(",")[16].replace(/"/g, "");
// Calculate the SINR percentage
this.sinrLTEPercentage = this.calculateSINRPercentage(
parseInt(this.sinrLTE)
);
// Calculate the SINR percentage
this.sinrLTEPercentage = this.calculateSINRPercentage(
parseInt(this.sinrLTE)
);
// Calculate Signal Percentage
this.signalPercentage = this.calculateSignalPercentage(
parseInt(this.rsrpLTEPercentage),
parseInt(this.sinrLTEPercentage)
);
// Calculate Signal Percentage
this.signalPercentage = this.calculateSignalPercentage(
parseInt(this.rsrpLTEPercentage),
parseInt(this.sinrLTEPercentage)
);
// Get the Signal Assessment
this.signalAssessment = this.signalQuality(
this.signalPercentage
);
// Get the Signal Assessment
this.signalAssessment = this.signalQuality(
this.signalPercentage
);
}
if (this.network_mode.match(/NR5G-NSA/) != null) {
let lte_bw_ul = lines[28].split(",")[8].replace(/"/g, "");
let lte_bw_dl = lines[28].split(",")[9].replace(/"/g, "");
lte_bw_dl = parseInt(lte_bw_dl);
lte_bw_ul = parseInt(lte_bw_ul);
// Calculate the LTE bandwidth
this.bandwidth =
this.calculate_lte_bw(lte_bw_ul) +
" MHz / " +
this.calculate_lte_bw(lte_bw_dl) +
" MHz";
// Get the RSSI
this.rssi = lines[28].split(",")[13].replace(/"/g, "");
// Get the Cell ID
const longCID = lines[28].split(",")[4].replace(/"/g, "");
// Get the eNBID. Its just Cell ID minus the last 2 characters
this.eNBID = longCID.substring(0, longCID.length - 2);
// Get the short Cell ID (Last 2 characters of the Cell ID)
const shortCID = longCID.substring(longCID.length - 2);
// Get the TAC
this.tac = lines[28].split(",")[10].replace(/"/g, "");
this.tac = this.tac + " (" + parseInt(this.tac, 16) + ")";
this.cellID =
"Short " +
shortCID +
"(" +
parseInt(shortCID, 16) +
")" +
", " +
"Long " +
longCID +
"(" +
parseInt(longCID, 16) +
")";
// Parse the PCIs
this.pcc_pci = lines[28].split(",")[5].replace(/"/g, "");
// Get the RSRQ
this.rsrqLTE = lines[28].split(",")[12].replace(/"/g, "");
rsrq = parseInt(this.rsrqLTE);
// Calculate the RSRQ percentage
this.rsrqLTEPercentage = this.calculateRSRQPercentage(rsrq);
// Get the RSRP
this.rsrpLTE = lines[28].split(",")[11].replace(/"/g, "");
// Calculate the RSRP percentage
this.rsrpLTEPercentage = this.calculateRSRPPercentage(
parseInt(this.rsrpLTE)
);
// Get the SINR
this.sinrLTE = lines[28].split(",")[14].replace(/"/g, "");
// Calculate the SINR percentage
this.sinrLTEPercentage = this.calculateSINRPercentage(
parseInt(this.sinrLTE)
);
// Calculate Signal Percentage
this.signalPercentage = this.calculateSignalPercentage(
parseInt(this.rsrpLTEPercentage),
parseInt(this.sinrLTEPercentage)
);
// Get the Signal Assessment
this.signalAssessment = this.signalQuality(
this.signalPercentage
);
let nr_bw = lines[29].split(",")[9].replace(/"/g, "");
nr_bw = parseInt(nr_bw);

View File

@@ -7,8 +7,8 @@
<!-- change to a much simpler tab title -->
<title>Simple Admin</title>
<link rel="stylesheet" href="/css/bulma.css" />
<link rel="stylesheet" type="text/css" href="/css/admin.css" />
<link rel="stylesheet" href="css/bulma.css" />
<link rel="stylesheet" type="text/css" href="css/admin.css" />
<link rel="stylesheet" href="styles.css" />
</head>

View File

@@ -13,6 +13,9 @@
<!-- Import all the bootstrap css files from css folder -->
<link rel="stylesheet" href="css/styles.css" />
<link rel="stylesheet" href="css/bootstrap.min.css" />
<!-- Logo -->
<link rel="simpleadmin-logo" href="favicon.ico">
<!-- Import BootStrap Javascript -->
<script src="js/bootstrap.bundle.min.js"></script>
@@ -790,11 +793,10 @@
}
// Construct the AT command using the valid pairs
let atcmd = `+QNWLOCK="common/4g",${cellNum},${validPairs
let atcmd = `AT+QNWLOCK="common/4g",${cellNum},${validPairs
.map((pair) => `${pair.earfcn},${pair.pci}`)
.join(",")}`;
atcmd = "AT+CFUN=0;" + atcmd + ";+CFUN=1";
// Mock data
this.showModal = true;
@@ -827,8 +829,7 @@
}
// Construct the AT command using the valid pairs
let atcmd = `+QNWLOCK="common/5g",${earfcn},${pci},${scs},${band}`;
atcmd = "AT+CFUN=0;" + atcmd + ";+CFUN=1";
let atcmd = `AT+QNWLOCK="common/5g",${earfcn},${pci},${scs},${band}`;
// Mock data
this.showModal = true;
@@ -847,7 +848,7 @@
},
cellLockDisableLTE() {
// Send the atcmd command to reset the locked bands
const atcmd = 'AT+CFUN=0;+QNWLOCK="common/4g,0;+CFUN=1"';
const atcmd = 'AT+QNWLOCK="common/4g,0"';
this.showModal = true;
this.sendATcommand(atcmd);
@@ -863,7 +864,7 @@
},
cellLockDisableNR() {
// Send the atcmd command to reset the locked bands
const atcmd = 'AT+CFUN=0;+QNWLOCK="common/5g,0;+CFUN=1"';
const atcmd = 'AT+QNWLOCK="common/5g,0"';
this.showModal = true;
@@ -928,6 +929,6 @@
});
});
</script>
<script src="/js/dark-mode.js"></script>
<script src="js/dark-mode.js"></script>
</body>
</html>

View File

@@ -4,12 +4,15 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Simple Admin</title>
<link rel="stylesheet" href="/css/styles.css" />
<link rel="stylesheet" href="/css/bootstrap.min.css" />
<link rel="stylesheet" href="css/styles.css" />
<link rel="stylesheet" href="css/bootstrap.min.css" />
<!-- Logo -->
<link rel="simpleadmin-logo" href="favicon.ico">
<!-- Import BootStrap Javascript -->
<script src="/js/bootstrap.bundle.min.js"></script>
<script src="/js/alpinejs.min.js" defer></script>
<script src="js/bootstrap.bundle.min.js"></script>
<script src="js/alpinejs.min.js" defer></script>
</head>
<body>
<main>
@@ -397,7 +400,7 @@
</div>
</div>
</main>
<script src="/js/dark-mode.js"></script>
<script src="js/dark-mode.js"></script>
<script>
function simpleSettings() {
return {

View File

@@ -11,13 +11,16 @@
crossorigin="anonymous"
/> -->
<!-- Import all the bootstrap css files from css folder -->
<link rel="stylesheet" href="/css/styles.css" />
<link rel="stylesheet" href="/css/bootstrap.min.css" />
<link rel="stylesheet" href="css/styles.css" />
<link rel="stylesheet" href="css/bootstrap.min.css" />
<!-- Logo -->
<link rel="simpleadmin-logo" href="favicon.ico">
<!-- Import BootStrap Javascript -->
<script src="/js/bootstrap.bundle.min.js"></script>
<script src="/js/alpinejs.min.js" defer></script>
<script src="/js/auth.js"></script>
<script src="js/bootstrap.bundle.min.js"></script>
<script src="js/alpinejs.min.js" defer></script>
<script src="js/auth.js"></script>
</head>
<body onload="isAuthenticated()">
<main>
@@ -176,7 +179,7 @@
</div>
</div>
</main>
<script src="/js/dark-mode.js"></script>
<script src="js/dark-mode.js"></script>
<script>
function fetchSMS() {
return {