hot fix for csq async problem
This commit is contained in:
@@ -649,272 +649,209 @@
|
|||||||
atcmd: this.atcmd,
|
atcmd: this.atcmd,
|
||||||
})
|
})
|
||||||
).then((response) => {
|
).then((response) => {
|
||||||
response.text().then((data) => {
|
response
|
||||||
const rawdata = data;
|
.text()
|
||||||
const lines = rawdata.split("\n");
|
.then((data) => {
|
||||||
// delete first element of the array
|
const rawdata = data;
|
||||||
lines.shift();
|
const lines = rawdata.split("\n");
|
||||||
console.log(lines);
|
// delete first element of the array
|
||||||
|
lines.shift();
|
||||||
|
console.log(lines);
|
||||||
|
|
||||||
// Parse the temperature
|
// Parse the temperature
|
||||||
const temp1 = lines[15].split(",")[1].replace(/"/g, "").trim();
|
const temp1 = lines[15]
|
||||||
const temp2 = lines[16].split(",")[1].replace(/"/g, "").trim();
|
.split(",")[1]
|
||||||
// Average the 2 temperatures then add degree symbol
|
.replace(/"/g, "")
|
||||||
this.temperature = (parseInt(temp1) + parseInt(temp2)) / 2;
|
.trim();
|
||||||
// Round the temperature to only show whole numbers
|
const temp2 = lines[16]
|
||||||
this.temperature = Math.round(this.temperature).toString();
|
.split(",")[1]
|
||||||
|
.replace(/"/g, "")
|
||||||
|
.trim();
|
||||||
|
// Average the 2 temperatures then add degree symbol
|
||||||
|
this.temperature = (parseInt(temp1) + parseInt(temp2)) / 2;
|
||||||
|
// Round the temperature to only show whole numbers
|
||||||
|
this.temperature = Math.round(this.temperature).toString();
|
||||||
|
|
||||||
// Parse the active sim
|
// Parse the active sim
|
||||||
this.active_sim = lines[18]
|
this.active_sim = lines[18]
|
||||||
.split(":")[1]
|
.split(":")[1]
|
||||||
.replace(/"/g, "")
|
.replace(/"/g, "")
|
||||||
.trim();
|
.trim();
|
||||||
|
|
||||||
// Parse the network provider
|
// Parse the network provider
|
||||||
this.network_provider = lines[20]
|
|
||||||
.split(",")[1]
|
|
||||||
.replace(/"/g, "")
|
|
||||||
.replace(/ /g, "");
|
|
||||||
|
|
||||||
// Check if the network provider is only numbers and no letters
|
|
||||||
if (this.network_provider.match(/^[0-9]+$/) != null) {
|
|
||||||
// If it is only numbers, then it is the MCCMNC
|
|
||||||
this.mccmnc = this.network_provider;
|
|
||||||
this.network_provider = lines[20]
|
this.network_provider = lines[20]
|
||||||
.split(",")[2]
|
.split(",")[1]
|
||||||
.replace(/"/g, "");
|
.replace(/"/g, "")
|
||||||
} else {
|
.replace(/ /g, "");
|
||||||
// If it is not only numbers, then it is the network provider
|
|
||||||
this.mccmnc = lines[20].split(",")[4].replace(/"/g, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse the APN
|
// Check if the network provider is only numbers and no letters
|
||||||
this.apn = lines[22].split(",")[2].replace(/"/g, "");
|
if (this.network_provider.match(/^[0-9]+$/) != null) {
|
||||||
|
// If it is only numbers, then it is the MCCMNC
|
||||||
|
this.mccmnc = this.network_provider;
|
||||||
|
this.network_provider = lines[20]
|
||||||
|
.split(",")[2]
|
||||||
|
.replace(/"/g, "");
|
||||||
|
} else {
|
||||||
|
// If it is not only numbers, then it is the network provider
|
||||||
|
this.mccmnc = lines[20].split(",")[4].replace(/"/g, "");
|
||||||
|
}
|
||||||
|
|
||||||
// Parse the WAN IPs
|
// Parse the APN
|
||||||
this.ipv4 = lines[24].split(",")[4].replace(/"/g, "");
|
this.apn = lines[22].split(",")[2].replace(/"/g, "");
|
||||||
this.ipv6 = lines[25].split(",")[4].replace(/"/g, "");
|
|
||||||
|
|
||||||
// If no network IP detected, consider as disconnected. Return all values as unknown (except temperature, sim, network provider, mccmnc, and apn)
|
// Parse the WAN IPs
|
||||||
if (this.ipv4 == "0.0.0.0" && this.ipv6 == "0:0:0:0:0:0:0:0") {
|
this.ipv4 = lines[24].split(",")[4].replace(/"/g, "");
|
||||||
this.temperature = this.temperature;
|
this.ipv6 = lines[25].split(",")[4].replace(/"/g, "");
|
||||||
this.active_sim = this.active_sim;
|
|
||||||
this.network_provider = this.network_provider;
|
|
||||||
this.mccmnc = this.mccmnc;
|
|
||||||
this.apn = this.apn;
|
|
||||||
this.network_mode =
|
|
||||||
"Network Disconnected. Please check your SIM card and network settings.";
|
|
||||||
this.bands = "Unknown";
|
|
||||||
this.bandwidth = "Unknown";
|
|
||||||
this.earfcns = "Unknown";
|
|
||||||
this.pcc_pci = "Unknown";
|
|
||||||
this.scc_pci = "Unknown";
|
|
||||||
this.csq = "Unknown";
|
|
||||||
this.rssi = "Unknown";
|
|
||||||
this.cellID = "Unknown";
|
|
||||||
this.eNBID = "Unknown";
|
|
||||||
this.tac = "Unknown";
|
|
||||||
this.rsrqLTE = "Unknown";
|
|
||||||
this.rsrqNR = "Unknown";
|
|
||||||
this.rsrqLTEPercentage = "0%";
|
|
||||||
this.rsrqNRPercentage = "0%";
|
|
||||||
this.rsrpLTE = "Unknown";
|
|
||||||
this.rsrpNR = "Unknown";
|
|
||||||
this.rsrpLTEPercentage = "0%";
|
|
||||||
this.rsrpNRPercentage = "0%";
|
|
||||||
this.sinrLTE = "Unknown";
|
|
||||||
this.sinrNR = "Unknown";
|
|
||||||
this.sinrLTEPercentage = "0%";
|
|
||||||
this.sinrNRPercentage = "0%";
|
|
||||||
this.signalPercentage = "0";
|
|
||||||
this.internetConnection = "Disconnected";
|
|
||||||
this.lastUpdate = new Date().toLocaleString();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse the network mode
|
|
||||||
const networkMode1 = lines[27].split(",")[2];
|
|
||||||
|
|
||||||
if (networkMode1 === '"NR5G-SA"') {
|
|
||||||
this.network_mode = networkMode1;
|
|
||||||
this.network_mode = this.network_mode.replace(/"/g, "");
|
|
||||||
} else {
|
|
||||||
let networkMode2, networkMode3;
|
|
||||||
|
|
||||||
|
// If no network IP detected, consider as disconnected. Return all values as unknown (except temperature, sim, network provider, mccmnc, and apn)
|
||||||
if (
|
if (
|
||||||
lines[27] !== undefined &&
|
this.ipv4 == "0.0.0.0" &&
|
||||||
lines[27] !== "OK" &&
|
this.ipv6 == "0:0:0:0:0:0:0:0"
|
||||||
lines[27] !== "" &&
|
|
||||||
lines[27] !== "/r"
|
|
||||||
) {
|
) {
|
||||||
// Check if lines[27] doesnt have TDD or FDD
|
this.temperature = this.temperature;
|
||||||
|
this.active_sim = this.active_sim;
|
||||||
|
this.network_provider = this.network_provider;
|
||||||
|
this.mccmnc = this.mccmnc;
|
||||||
|
this.apn = this.apn;
|
||||||
|
this.network_mode =
|
||||||
|
"Network Disconnected. Please check your SIM card and network settings.";
|
||||||
|
this.bands = "Unknown";
|
||||||
|
this.bandwidth = "Unknown";
|
||||||
|
this.earfcns = "Unknown";
|
||||||
|
this.pcc_pci = "Unknown";
|
||||||
|
this.scc_pci = "Unknown";
|
||||||
|
this.csq = "Unknown";
|
||||||
|
this.rssi = "Unknown";
|
||||||
|
this.cellID = "Unknown";
|
||||||
|
this.eNBID = "Unknown";
|
||||||
|
this.tac = "Unknown";
|
||||||
|
this.rsrqLTE = "Unknown";
|
||||||
|
this.rsrqNR = "Unknown";
|
||||||
|
this.rsrqLTEPercentage = "0%";
|
||||||
|
this.rsrqNRPercentage = "0%";
|
||||||
|
this.rsrpLTE = "Unknown";
|
||||||
|
this.rsrpNR = "Unknown";
|
||||||
|
this.rsrpLTEPercentage = "0%";
|
||||||
|
this.rsrpNRPercentage = "0%";
|
||||||
|
this.sinrLTE = "Unknown";
|
||||||
|
this.sinrNR = "Unknown";
|
||||||
|
this.sinrLTEPercentage = "0%";
|
||||||
|
this.sinrNRPercentage = "0%";
|
||||||
|
this.signalPercentage = "0";
|
||||||
|
this.internetConnection = "Disconnected";
|
||||||
|
this.lastUpdate = new Date().toLocaleString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse the network mode
|
||||||
|
const networkMode1 = lines[27].split(",")[2];
|
||||||
|
|
||||||
|
if (networkMode1 === '"NR5G-SA"') {
|
||||||
|
this.network_mode = networkMode1;
|
||||||
|
this.network_mode = this.network_mode.replace(/"/g, "");
|
||||||
|
} else {
|
||||||
|
let networkMode2, networkMode3;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
lines[27].match(/FDD/) != null ||
|
lines[27] !== undefined &&
|
||||||
lines[27].match(/TDD/) != null
|
lines[27] !== "OK" &&
|
||||||
|
lines[27] !== "" &&
|
||||||
|
lines[27] !== "/r"
|
||||||
) {
|
) {
|
||||||
networkMode2 = lines[27].split(",")[2].replace(/"/g, "");
|
// Check if lines[27] doesnt have TDD or FDD
|
||||||
networkMode2 = networkMode2.split(",")[0].trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (networkMode2 !== "LTE") {
|
|
||||||
networkMode2 = lines[28].split(":")[1].replace(/"/g, "");
|
|
||||||
networkMode2 = networkMode2.split(",")[0];
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
lines[29] !== undefined &&
|
lines[27].match(/FDD/) != null ||
|
||||||
lines[29] !== "OK" &&
|
lines[27].match(/TDD/) != null
|
||||||
lines[29] !== ""
|
|
||||||
) {
|
) {
|
||||||
networkMode3 = lines[29]
|
networkMode2 = lines[27]
|
||||||
.split(":")[1]
|
.split(",")[2]
|
||||||
.split(",")[0]
|
|
||||||
.replace(/"/g, "");
|
.replace(/"/g, "");
|
||||||
networkMode3 = networkMode3.split(",")[0];
|
networkMode2 = networkMode2.split(",")[0].trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (networkMode2 !== "LTE") {
|
||||||
|
networkMode2 = lines[28]
|
||||||
|
.split(":")[1]
|
||||||
|
.replace(/"/g, "");
|
||||||
|
networkMode2 = networkMode2.split(",")[0];
|
||||||
|
|
||||||
|
if (
|
||||||
|
lines[29] !== undefined &&
|
||||||
|
lines[29] !== "OK" &&
|
||||||
|
lines[29] !== ""
|
||||||
|
) {
|
||||||
|
networkMode3 = lines[29]
|
||||||
|
.split(":")[1]
|
||||||
|
.split(",")[0]
|
||||||
|
.replace(/"/g, "");
|
||||||
|
networkMode3 = networkMode3.split(",")[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if networkMode3 is not empty
|
||||||
|
if (networkMode3 !== undefined) {
|
||||||
|
this.network_mode = networkMode2 + ", " + networkMode3;
|
||||||
|
} else {
|
||||||
|
this.network_mode = networkMode2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if networkMode3 is not empty
|
// Parse the bands
|
||||||
if (networkMode3 !== undefined) {
|
let bands = [];
|
||||||
this.network_mode = networkMode2 + ", " + networkMode3;
|
let earfcns = [];
|
||||||
} else {
|
let earfcnValues;
|
||||||
this.network_mode = networkMode2;
|
let bandValues;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse the bands
|
// get lines length
|
||||||
let bands = [];
|
const linesLength = lines.length;
|
||||||
let earfcns = [];
|
|
||||||
let earfcnValues;
|
|
||||||
let bandValues;
|
|
||||||
|
|
||||||
// get lines length
|
// Only lines 31 - 35 have the bands information
|
||||||
const linesLength = lines.length;
|
for (let i = 29; i <= 35; i++) {
|
||||||
|
if (i < linesLength) {
|
||||||
// Only lines 31 - 35 have the bands information
|
// Check if the line is not "OK" or empty
|
||||||
for (let i = 29; i <= 35; i++) {
|
if (lines[i] !== "OK" && lines[i] !== "") {
|
||||||
if (i < linesLength) {
|
bandValues = lines[i].split(",")[3];
|
||||||
// Check if the line is not "OK" or empty
|
earfcnValues = lines[i].split(",")[1];
|
||||||
if (lines[i] !== "OK" && lines[i] !== "") {
|
// If bandvalues is only numbers and no letters or undefined, then move to the next line
|
||||||
bandValues = lines[i].split(",")[3];
|
if (bandValues !== undefined) {
|
||||||
earfcnValues = lines[i].split(",")[1];
|
if (bandValues.match(/^[0-9]+$/) != null) {
|
||||||
// If bandvalues is only numbers and no letters or undefined, then move to the next line
|
continue;
|
||||||
if (bandValues !== undefined) {
|
} else {
|
||||||
if (bandValues.match(/^[0-9]+$/) != null) {
|
bandValues = bandValues.replace(/"/g, "");
|
||||||
continue;
|
earfcnValues = earfcnValues.replace(/"/g, "");
|
||||||
|
earfcns.push(earfcnValues);
|
||||||
|
bands.push(bandValues);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
bandValues = bandValues.replace(/"/g, "");
|
continue;
|
||||||
earfcnValues = earfcnValues.replace(/"/g, "");
|
|
||||||
earfcns.push(earfcnValues);
|
|
||||||
bands.push(bandValues);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Convert bands to a single string seperated by a comma
|
// Convert bands to a single string seperated by a comma
|
||||||
this.bands = bands.join(", ");
|
this.bands = bands.join(", ");
|
||||||
this.earfcns = earfcns.join(", ");
|
this.earfcns = earfcns.join(", ");
|
||||||
|
|
||||||
// Parse the bandwidth
|
// Parse the bandwidth
|
||||||
if (this.network_mode === "NR5G-SA") {
|
if (this.network_mode === "NR5G-SA") {
|
||||||
let nr_bw = lines[27].split(",")[11].replace(/"/g, "");
|
let nr_bw = lines[27].split(",")[11].replace(/"/g, "");
|
||||||
nr_bw = parseInt(nr_bw);
|
nr_bw = parseInt(nr_bw);
|
||||||
|
|
||||||
// Calculate the NR bandwidth
|
// Calculate the NR bandwidth
|
||||||
this.bandwidth =
|
|
||||||
"NR " + this.calculate_nr_bw(nr_bw).toString() + " MHz";
|
|
||||||
|
|
||||||
// Parse the PCIs
|
|
||||||
this.pcc_pci = lines[27].split(",")[7].replace(/"/g, "");
|
|
||||||
//TODO: Add the scc_pci for NR-CA SA later
|
|
||||||
|
|
||||||
// Parse the Cell ID
|
|
||||||
const longCID = lines[27].split(",")[6].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[27].split(",")[8].replace(/"/g, "");
|
|
||||||
|
|
||||||
this.cellID =
|
|
||||||
"Short " +
|
|
||||||
shortCID +
|
|
||||||
"(" +
|
|
||||||
parseInt(shortCID, 16) +
|
|
||||||
")" +
|
|
||||||
", " +
|
|
||||||
"Long " +
|
|
||||||
longCID +
|
|
||||||
"(" +
|
|
||||||
parseInt(longCID, 16) +
|
|
||||||
")";
|
|
||||||
|
|
||||||
// Get the RSRQ
|
|
||||||
this.rsrqNR = lines[27].split(",")[13].replace(/"/g, "");
|
|
||||||
let rsrq = parseInt(this.rsrqNR);
|
|
||||||
|
|
||||||
// Calculate the RSRQ percentage
|
|
||||||
this.rsrqNRPercentage = this.calculateRSRQPercentage(rsrq);
|
|
||||||
|
|
||||||
// Get the RSRP
|
|
||||||
this.rsrpNR = lines[27].split(",")[12].replace(/"/g, "");
|
|
||||||
|
|
||||||
// Calculate the RSRP percentage
|
|
||||||
this.rsrpNRPercentage = this.calculateRSRPPercentage(
|
|
||||||
parseInt(this.rsrpNR)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Get the SINR
|
|
||||||
this.sinrNR = lines[27].split(",")[14].replace(/"/g, "");
|
|
||||||
|
|
||||||
// Calculate the SINR percentage
|
|
||||||
this.sinrNRPercentage = this.calculateSINRPercentage(
|
|
||||||
parseInt(this.sinrNR)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Calculate Signal Percentage
|
|
||||||
this.signalPercentage = this.calculateSignalPercentage(
|
|
||||||
parseInt(this.rsrpNRPercentage),
|
|
||||||
parseInt(this.sinrNRPercentage)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Get the Signal Assessment
|
|
||||||
this.signalAssessment = this.signalQuality(
|
|
||||||
this.signalPercentage
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
if (
|
|
||||||
this.network_mode.match(/LTE/) != null &&
|
|
||||||
this.network_mode.match(/NR5G-NSA/) == 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);
|
|
||||||
|
|
||||||
// Calculate the LTE bandwidth
|
|
||||||
this.bandwidth =
|
this.bandwidth =
|
||||||
"UL " +
|
"NR " + this.calculate_nr_bw(nr_bw).toString() + " MHz";
|
||||||
this.calculate_lte_bw(lte_bw_ul) +
|
|
||||||
" MHz / " +
|
|
||||||
"DL " +
|
|
||||||
this.calculate_lte_bw(lte_bw_dl) +
|
|
||||||
" MHz";
|
|
||||||
|
|
||||||
// Get the Cell ID
|
// Parse the PCIs
|
||||||
|
this.pcc_pci = lines[27].split(",")[7].replace(/"/g, "");
|
||||||
|
//TODO: Add the scc_pci for NR-CA SA later
|
||||||
|
|
||||||
|
// Parse the Cell ID
|
||||||
const longCID = lines[27].split(",")[6].replace(/"/g, "");
|
const longCID = lines[27].split(",")[6].replace(/"/g, "");
|
||||||
|
|
||||||
// Get the eNBID. Its just Cell ID minus the last 2 characters
|
// Get the eNBID. Its just Cell ID minus the last 2 characters
|
||||||
@@ -924,8 +861,7 @@
|
|||||||
const shortCID = longCID.substring(longCID.length - 2);
|
const shortCID = longCID.substring(longCID.length - 2);
|
||||||
|
|
||||||
// Get the TAC
|
// Get the TAC
|
||||||
this.tac = lines[27].split(",")[12].replace(/"/g, "");
|
this.tac = lines[27].split(",")[8].replace(/"/g, "");
|
||||||
this.tac = this.tac + " (" + parseInt(this.tac, 16) + ")";
|
|
||||||
|
|
||||||
this.cellID =
|
this.cellID =
|
||||||
"Short " +
|
"Short " +
|
||||||
@@ -940,163 +876,23 @@
|
|||||||
parseInt(longCID, 16) +
|
parseInt(longCID, 16) +
|
||||||
")";
|
")";
|
||||||
|
|
||||||
// Parse the PCIs
|
|
||||||
this.pcc_pci = lines[27].split(",")[7].replace(/"/g, "");
|
|
||||||
|
|
||||||
// Get the RSRQ
|
// Get the RSRQ
|
||||||
this.rsrqLTE = lines[27].split(",")[14].replace(/"/g, "");
|
this.rsrqNR = lines[27].split(",")[13].replace(/"/g, "");
|
||||||
let rsrq = parseInt(this.rsrqLTE);
|
let rsrq = parseInt(this.rsrqNR);
|
||||||
|
|
||||||
// Calculate the RSRQ percentage
|
|
||||||
this.rsrqLTEPercentage = this.calculateRSRQPercentage(rsrq);
|
|
||||||
|
|
||||||
// Get the RSRP
|
|
||||||
this.rsrpLTE = lines[27].split(",")[13].replace(/"/g, "");
|
|
||||||
|
|
||||||
// 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[27].split(",")[16].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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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 =
|
|
||||||
"UL " +
|
|
||||||
this.calculate_lte_bw(lte_bw_ul) +
|
|
||||||
" MHz / " +
|
|
||||||
"DL " +
|
|
||||||
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, "");
|
|
||||||
let 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);
|
|
||||||
|
|
||||||
// Calculate the NR bandwidth
|
|
||||||
this.bandwidth +=
|
|
||||||
" / NR " +
|
|
||||||
this.calculate_nr_bw(nr_bw).toString() +
|
|
||||||
" MHz";
|
|
||||||
|
|
||||||
// Parse the PCIs
|
|
||||||
this.pcc_pci = lines[28].split(",")[5].replace(/"/g, "");
|
|
||||||
this.scc_pci = lines[29].split(",")[3].replace(/"/g, "");
|
|
||||||
|
|
||||||
// Get the RSSI
|
|
||||||
this.rssi = lines[28].split(",")[13].replace(/"/g, "");
|
|
||||||
|
|
||||||
// Get the RSRQ NR
|
|
||||||
this.rsrqNR = lines[29].split(",")[6].replace(/"/g, "");
|
|
||||||
rsrq = parseInt(this.rsrqNR);
|
|
||||||
|
|
||||||
// Calculate the RSRQ percentage
|
// Calculate the RSRQ percentage
|
||||||
this.rsrqNRPercentage = this.calculateRSRQPercentage(rsrq);
|
this.rsrqNRPercentage = this.calculateRSRQPercentage(rsrq);
|
||||||
|
|
||||||
// Get the RSRP NR
|
// Get the RSRP
|
||||||
this.rsrpNR = lines[29].split(",")[4].replace(/"/g, "");
|
this.rsrpNR = lines[27].split(",")[12].replace(/"/g, "");
|
||||||
|
|
||||||
// Calculate the RSRP percentage
|
// Calculate the RSRP percentage
|
||||||
this.rsrpNRPercentage = this.calculateRSRPPercentage(
|
this.rsrpNRPercentage = this.calculateRSRPPercentage(
|
||||||
parseInt(this.rsrpNR)
|
parseInt(this.rsrpNR)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get the SINR NR
|
// Get the SINR
|
||||||
this.sinrNR = lines[29].split(",")[5].replace(/"/g, "");
|
this.sinrNR = lines[27].split(",")[14].replace(/"/g, "");
|
||||||
|
|
||||||
// Calculate the SINR percentage
|
// Calculate the SINR percentage
|
||||||
this.sinrNRPercentage = this.calculateSINRPercentage(
|
this.sinrNRPercentage = this.calculateSINRPercentage(
|
||||||
@@ -1104,25 +900,271 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Calculate Signal Percentage
|
// Calculate Signal Percentage
|
||||||
const nrSignalPercentage = this.calculateSignalPercentage(
|
this.signalPercentage = this.calculateSignalPercentage(
|
||||||
parseInt(this.rsrpNRPercentage),
|
parseInt(this.rsrpNRPercentage),
|
||||||
parseInt(this.sinrNRPercentage)
|
parseInt(this.sinrNRPercentage)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get the average of the LTE and NR Signal Percentage
|
|
||||||
this.signalPercentage =
|
|
||||||
(this.signalPercentage + nrSignalPercentage) / 2;
|
|
||||||
|
|
||||||
// Round the signalPercentage value
|
|
||||||
this.signalPercentage = Math.round(this.signalPercentage);
|
|
||||||
|
|
||||||
// Get the Signal Assessment
|
// Get the Signal Assessment
|
||||||
this.signalAssessment = this.signalQuality(
|
this.signalAssessment = this.signalQuality(
|
||||||
this.signalPercentage
|
this.signalPercentage
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
if (
|
||||||
|
this.network_mode.match(/LTE/) != null &&
|
||||||
|
this.network_mode.match(/NR5G-NSA/) == 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);
|
||||||
|
|
||||||
|
// Calculate the LTE bandwidth
|
||||||
|
this.bandwidth =
|
||||||
|
"UL " +
|
||||||
|
this.calculate_lte_bw(lte_bw_ul) +
|
||||||
|
" MHz / " +
|
||||||
|
"DL " +
|
||||||
|
this.calculate_lte_bw(lte_bw_dl) +
|
||||||
|
" MHz";
|
||||||
|
|
||||||
|
// Get the Cell ID
|
||||||
|
const longCID = lines[27].split(",")[6].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[27].split(",")[12].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[27].split(",")[7].replace(/"/g, "");
|
||||||
|
|
||||||
|
// Get the RSRQ
|
||||||
|
this.rsrqLTE = lines[27].split(",")[14].replace(/"/g, "");
|
||||||
|
let rsrq = parseInt(this.rsrqLTE);
|
||||||
|
|
||||||
|
// Calculate the RSRQ percentage
|
||||||
|
this.rsrqLTEPercentage =
|
||||||
|
this.calculateRSRQPercentage(rsrq);
|
||||||
|
|
||||||
|
// Get the RSRP
|
||||||
|
this.rsrpLTE = lines[27].split(",")[13].replace(/"/g, "");
|
||||||
|
|
||||||
|
// 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[27].split(",")[16].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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 =
|
||||||
|
"UL " +
|
||||||
|
this.calculate_lte_bw(lte_bw_ul) +
|
||||||
|
" MHz / " +
|
||||||
|
"DL " +
|
||||||
|
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, "");
|
||||||
|
let 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);
|
||||||
|
|
||||||
|
// Calculate the NR bandwidth
|
||||||
|
this.bandwidth +=
|
||||||
|
" / NR " +
|
||||||
|
this.calculate_nr_bw(nr_bw).toString() +
|
||||||
|
" MHz";
|
||||||
|
|
||||||
|
// Parse the PCIs
|
||||||
|
this.pcc_pci = lines[28].split(",")[5].replace(/"/g, "");
|
||||||
|
this.scc_pci = lines[29].split(",")[3].replace(/"/g, "");
|
||||||
|
|
||||||
|
// Get the RSSI
|
||||||
|
this.rssi = lines[28].split(",")[13].replace(/"/g, "");
|
||||||
|
|
||||||
|
// Get the RSRQ NR
|
||||||
|
this.rsrqNR = lines[29].split(",")[6].replace(/"/g, "");
|
||||||
|
rsrq = parseInt(this.rsrqNR);
|
||||||
|
|
||||||
|
// Calculate the RSRQ percentage
|
||||||
|
this.rsrqNRPercentage =
|
||||||
|
this.calculateRSRQPercentage(rsrq);
|
||||||
|
|
||||||
|
// Get the RSRP NR
|
||||||
|
this.rsrpNR = lines[29].split(",")[4].replace(/"/g, "");
|
||||||
|
|
||||||
|
// Calculate the RSRP percentage
|
||||||
|
this.rsrpNRPercentage = this.calculateRSRPPercentage(
|
||||||
|
parseInt(this.rsrpNR)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Get the SINR NR
|
||||||
|
this.sinrNR = lines[29].split(",")[5].replace(/"/g, "");
|
||||||
|
|
||||||
|
// Calculate the SINR percentage
|
||||||
|
this.sinrNRPercentage = this.calculateSINRPercentage(
|
||||||
|
parseInt(this.sinrNR)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Calculate Signal Percentage
|
||||||
|
const nrSignalPercentage = this.calculateSignalPercentage(
|
||||||
|
parseInt(this.rsrpNRPercentage),
|
||||||
|
parseInt(this.sinrNRPercentage)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Get the average of the LTE and NR Signal Percentage
|
||||||
|
this.signalPercentage =
|
||||||
|
(this.signalPercentage + nrSignalPercentage) / 2;
|
||||||
|
|
||||||
|
// Round the signalPercentage value
|
||||||
|
this.signalPercentage = Math.round(this.signalPercentage);
|
||||||
|
|
||||||
|
// Get the Signal Assessment
|
||||||
|
this.signalAssessment = this.signalQuality(
|
||||||
|
this.signalPercentage
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
.then(() => {
|
||||||
|
if (this.network_mode !== "NR5G-SA") {
|
||||||
|
this.atcmd = "AT+CSQ";
|
||||||
|
fetch(
|
||||||
|
"/cgi-bin/get_atcommand?" +
|
||||||
|
new URLSearchParams({
|
||||||
|
atcmd: this.atcmd,
|
||||||
|
})
|
||||||
|
).then((response) => {
|
||||||
|
response.text().then((data) => {
|
||||||
|
const rawdata = data;
|
||||||
|
|
||||||
|
const lines = rawdata.split("\n");
|
||||||
|
console.log("CSQ: ", lines);
|
||||||
|
|
||||||
|
this.csq = lines[1].split(":")[1].split(",")[0].trim();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1230,27 +1272,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchCSQ() {
|
|
||||||
if (this.network_mode !== "NR5G-SA") {
|
|
||||||
this.atcmd = "AT+CSQ";
|
|
||||||
fetch(
|
|
||||||
"/cgi-bin/get_atcommand?" +
|
|
||||||
new URLSearchParams({
|
|
||||||
atcmd: this.atcmd,
|
|
||||||
})
|
|
||||||
).then((response) => {
|
|
||||||
response.text().then((data) => {
|
|
||||||
const rawdata = data;
|
|
||||||
|
|
||||||
const lines = rawdata.split("\n");
|
|
||||||
console.log("CSQ: ", lines);
|
|
||||||
|
|
||||||
this.csq = lines[1].split(":")[1].split(",")[0].trim();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
fetchSIMInfo() {
|
fetchSIMInfo() {
|
||||||
this.atcmd = "AT+QSIMSTAT?";
|
this.atcmd = "AT+QSIMSTAT?";
|
||||||
|
|
||||||
@@ -1281,9 +1302,6 @@
|
|||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.fetchNetworkInfo();
|
this.fetchNetworkInfo();
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
this.fetchCSQ();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -1486,11 +1504,6 @@
|
|||||||
// Ensure fetchSIMInfo returns a promise
|
// Ensure fetchSIMInfo returns a promise
|
||||||
this.fetchSIMInfo();
|
this.fetchSIMInfo();
|
||||||
|
|
||||||
// // sleep for 2 seconds
|
|
||||||
// setTimeout(() => {
|
|
||||||
// this.fetchCSQ();
|
|
||||||
// }, 2000);
|
|
||||||
|
|
||||||
this.requestPing()
|
this.requestPing()
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
const response = data.trim();
|
const response = data.trim();
|
||||||
@@ -1540,4 +1553,4 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user