更新 simpleadmin/www/index.html
This commit is contained in:
parent
7fdd2f65b7
commit
8f7fc19477
@ -654,7 +654,7 @@
|
||||
this.atcmd =
|
||||
'AT+QTEMP;+QUIMSLOT?;+QSPN;+CGCONTRDP=1;+QMAP="WWANIP";+QENG="servingcell";+QCAINFO;+QSIMSTAT?;+CSQ;+QGDNRCNT?;+QGDCNT?';
|
||||
|
||||
// 定义运营商映射表 | Define operator mapping table
|
||||
// ---------- 运营商名称处理 | Operator Information Processing ----------
|
||||
const operatorMap = {
|
||||
// 中国大陆 (460) | Mainland China (460)
|
||||
"46000": "中国移动 (CMCC)",
|
||||
@ -832,45 +832,30 @@
|
||||
this.activeSim = "无SIM卡";
|
||||
}
|
||||
|
||||
// --- Network Provider ---
|
||||
// 获取 PLMN 码 | Get PLMN code
|
||||
const plmn = lines
|
||||
// ---------- 运营商信息处理 | Operator Information Processing ----------
|
||||
const parts = lines
|
||||
.find((line) => line.includes("+QSPN:"))
|
||||
.split(",")[4]
|
||||
.replace(/"/g, "")
|
||||
.trim();
|
||||
.split(",");
|
||||
|
||||
console.log("PLMN:", plmn);
|
||||
console.log("Mapped operator:", operatorMap[plmn]);
|
||||
|
||||
const network_provider = lines
|
||||
.find((line) => line.includes("+QSPN:"))
|
||||
.split(",")[0]
|
||||
.replace("+QSPN: ", "")
|
||||
.replace(/"/g, "")
|
||||
.trim();
|
||||
// 获取 PLMN 码和运营商名称 | Get PLMN code and operator name
|
||||
const plmn = parts[4]?.replace(/"/g, "").trim();
|
||||
const network_provider = parts[0]?.replace("+QSPN: ", "").replace(/"/g, "").trim();
|
||||
|
||||
// 按优先级处理运营商名称 | Process operator name by priority
|
||||
if (operatorMap[plmn]) {
|
||||
// 1. 优先使用预定义的运营商映射 | First priority: use predefined operator mapping
|
||||
this.networkProvider = operatorMap[plmn];
|
||||
} else if (network_provider.match(/^[0-9A-Fa-f]+$/) != null) {
|
||||
// 处理16进制编码的运营商名称
|
||||
// Process operator names encoded in hexadecimal
|
||||
// 2. 处理16进制编码的运营商名称 | Second priority: decode hex-encoded operator name
|
||||
try {
|
||||
const hexString = network_provider.replace(/^0x/, '');
|
||||
const bytes = new Uint8Array(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
|
||||
const decoder = new TextDecoder('utf-8');
|
||||
this.networkProvider = decoder.decode(bytes);
|
||||
} catch (e) {
|
||||
console.log("Error decoding hex operator name:", e);
|
||||
this.networkProvider = new TextDecoder('utf-8').decode(bytes);
|
||||
} catch {
|
||||
this.networkProvider = network_provider;
|
||||
}
|
||||
} else if (network_provider.match(/^[0-9]+$/) != null) {
|
||||
this.networkProvider = lines
|
||||
.find((line) => line.includes("+QSPN:"))
|
||||
.split(",")[2]
|
||||
.replace(/"/g, "")
|
||||
.trim();
|
||||
} else {
|
||||
// 3. 使用运营商提供的原始名称 | Third priority: use original operator name
|
||||
this.networkProvider = network_provider;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user