更新插件
This commit is contained in:
parent
889cbb39a0
commit
74452a5d47
@ -14,7 +14,7 @@ function index()
|
||||
entry({"admin", "network", "modem"}, alias("admin", "network", "modem", "modem_info"), translate("Modem"), 100).dependent = true
|
||||
|
||||
--模块状态
|
||||
entry({"admin", "network", "modem", "modem_info"}, template("modem/modem_info"), translate("Modem Info"),10).leaf = true
|
||||
entry({"admin", "network", "modem", "modem_info"}, template("modem/modem_info"), translate("Modem Information"),10).leaf = true
|
||||
entry({"admin", "network", "modem", "get_modem_info"}, call("getModemInfo"))
|
||||
|
||||
--模块设置
|
||||
@ -76,7 +76,7 @@ function getModemBaseInfo(at_port)
|
||||
--获取数据接口
|
||||
local data_interface=modem_device["data_interface"]:upper()
|
||||
--获取连接状态
|
||||
local connect_status
|
||||
local connect_status="unknown"
|
||||
if modem_device["at_port"] then
|
||||
connect_status=getModemConnectStatus(modem_device["at_port"])
|
||||
end
|
||||
@ -94,10 +94,16 @@ end
|
||||
|
||||
-- 获取模组更多信息
|
||||
function getModemMoreInfo(at_port,manufacturer)
|
||||
local modem_more_info={}
|
||||
|
||||
-- if manufacturer == "unknown" then
|
||||
-- return modem_more_info
|
||||
-- end
|
||||
|
||||
local odpall = io.popen("sh "..script_path.."modem_info.sh".." "..at_port.." "..manufacturer)
|
||||
local opd = odpall:read("*a")
|
||||
odpall:close()
|
||||
local modem_more_info=json.parse(opd)
|
||||
modem_more_info=json.parse(opd)
|
||||
return modem_more_info
|
||||
end
|
||||
|
||||
@ -107,7 +113,7 @@ function getModemInfo()
|
||||
--获取AT串口
|
||||
local at_port = http.formvalue("port")
|
||||
|
||||
--获取值
|
||||
--获取信息
|
||||
local modem_base_info
|
||||
local modem_more_info
|
||||
if at_port then
|
||||
@ -115,38 +121,74 @@ function getModemInfo()
|
||||
modem_more_info=getModemMoreInfo(at_port,modem_base_info["manufacturer"])
|
||||
end
|
||||
|
||||
--设置值
|
||||
--设置信息
|
||||
local modem_info={}
|
||||
modem_info["base_info"]=modem_base_info
|
||||
modem_info["more_info"]=modem_more_info
|
||||
|
||||
--设置翻译
|
||||
local translation={}
|
||||
if modem_more_info["sim_info"] then
|
||||
for key in pairs(modem_more_info["sim_info"]) do
|
||||
local key_origin=modem_more_info["sim_info"][key]:upper()
|
||||
translation[key_origin]=luci.i18n.translate(key_origin)
|
||||
end
|
||||
end
|
||||
|
||||
if modem_more_info["cell_info"] then
|
||||
for key in pairs(modem_more_info["cell_info"]) do
|
||||
local network_mode=modem_more_info["cell_info"][key]
|
||||
for i = 1, #network_mode do
|
||||
local value = network_mode[i]
|
||||
for key in pairs(value) do
|
||||
translation[key]=luci.i18n.translate(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--整合数据
|
||||
local data={}
|
||||
data["modem_info"]=modem_info
|
||||
data["translation"]=translation
|
||||
|
||||
-- 写入Web界面
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(modem_info)
|
||||
luci.http.write_json(data)
|
||||
end
|
||||
|
||||
-- 获取模组信息
|
||||
function getModems()
|
||||
|
||||
local modems={}
|
||||
|
||||
|
||||
-- 获取所有模组
|
||||
local modems={}
|
||||
local translation={}
|
||||
uci:foreach("modem", "modem-device", function (modem_device)
|
||||
--获取连接状态
|
||||
local connect_status
|
||||
-- 获取连接状态
|
||||
local connect_status="unknown"
|
||||
if modem_device["at_port"] then
|
||||
connect_status=getModemConnectStatus(modem_device["at_port"])
|
||||
end
|
||||
|
||||
--设置值
|
||||
-- 获取翻译
|
||||
translation[connect_status]=luci.i18n.translate(connect_status)
|
||||
translation[modem_device["name"]]=luci.i18n.translate(modem_device["name"])
|
||||
translation[modem_device["mode"]]=luci.i18n.translate(modem_device["mode"])
|
||||
|
||||
-- 设置值
|
||||
local modem=modem_device
|
||||
modem["connect_status"]=connect_status
|
||||
modems[modem_device[".name"]]=modem
|
||||
end)
|
||||
|
||||
-- 设置值
|
||||
local data={}
|
||||
data["modems"]=modems
|
||||
data["translation"]=translation
|
||||
|
||||
-- 写入Web界面
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(modems)
|
||||
luci.http.write_json(data)
|
||||
end
|
||||
|
||||
-- 模块列表状态函数
|
||||
@ -245,13 +287,22 @@ end
|
||||
function getATPort()
|
||||
local at_ports={}
|
||||
uci:foreach("modem", "modem-device", function (modem_device)
|
||||
--获取模块的备注
|
||||
--获取模组的备注
|
||||
local network=modem_device["network"]
|
||||
local remarks=getModemRemarks(network)
|
||||
|
||||
local name=modem_device["name"]:upper()..remarks
|
||||
local at_port = modem_device["at_port"]
|
||||
at_ports[at_port]=name
|
||||
--设置模组AT串口
|
||||
if modem_device["name"] and modem_device["at_port"] then
|
||||
|
||||
local name=modem_device["name"]:upper()..remarks
|
||||
if modem_device["name"] == "unknown" then
|
||||
-- name=modem_device["at_port"]..remarks
|
||||
name=modem_device["name"]..remarks
|
||||
end
|
||||
|
||||
local at_port = modem_device["at_port"]
|
||||
at_ports[at_port]=name
|
||||
end
|
||||
end)
|
||||
-- 写入Web界面
|
||||
luci.http.prepare_content("application/json")
|
||||
|
@ -1,111 +1,89 @@
|
||||
<%+header%>
|
||||
|
||||
<%
|
||||
local uci = luci.model.uci.cursor()
|
||||
|
||||
-- 获取模组的备注
|
||||
-- @Param network 移动网络
|
||||
function getModemRemarks(network)
|
||||
local remarks=""
|
||||
uci:foreach("modem", "config", function (config)
|
||||
---配置启用,且备注存在
|
||||
if network == config["network"] and config["enable"] == "1" then
|
||||
if config["remarks"] then
|
||||
remarks=" ("..config["remarks"]..")" --" (备注)"
|
||||
return true --跳出循环
|
||||
end
|
||||
end
|
||||
end)
|
||||
return remarks
|
||||
end
|
||||
|
||||
-- 获取AT串口
|
||||
function getATPort()
|
||||
local at_ports={}
|
||||
uci:foreach("modem", "modem-device", function (modem_device)
|
||||
--获取模块的备注
|
||||
local network=modem_device["network"]
|
||||
local remarks=getModemRemarks(network)
|
||||
|
||||
local name=modem_device["name"]:upper()..remarks
|
||||
local at_port = modem_device["at_port"]
|
||||
at_ports[at_port]=name
|
||||
end)
|
||||
return at_ports
|
||||
end
|
||||
%>
|
||||
<h2 name="content"><%:AT Commands%></h2>
|
||||
<div class="cbi-map-descr"><%:Debugging Your Module with AT Command%></div>
|
||||
<p></p>
|
||||
<h4><br/></h4>
|
||||
<div class="table" width="100%">
|
||||
|
||||
<div class="tr">
|
||||
<div class="td left" width="25%"><%:Modem Select%>:</div>
|
||||
<div class="td left" style="width:50%;">
|
||||
<select name="modem_select" id="modem_select" onclick="afunction()">
|
||||
<% at_ports=getATPort() %>
|
||||
<% for key in pairs(at_ports) do %>
|
||||
<option value="<%= key %>"><%= at_ports[key] %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
<fieldset class="cbi-section" id="cbi-info" style="display: block;">
|
||||
<h3><%:Message%></h3>
|
||||
<table width="550" border="0">
|
||||
<tr>
|
||||
<td width="10%"></td>
|
||||
<td width="60%">
|
||||
<div align="left" id="info_message" style="font-size:1.875em">
|
||||
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle"/>
|
||||
<%:Loading modem%>...
|
||||
</div>
|
||||
</td>
|
||||
<td width="30%"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<div id="at_command_view" style="display: none;">
|
||||
<h4><br/></h4>
|
||||
<div class="table" width="100%">
|
||||
<div class="tr">
|
||||
<div class="td left" width="25%"><%:Modem Select%>:</div>
|
||||
<div class="td left" style="width:50%;">
|
||||
<select name="modem_select" id="modem_select" onclick="afunction()"></select>
|
||||
</div>
|
||||
<div class="td left" style="width:50%;"></div>
|
||||
</div>
|
||||
<div class="td left" style="width:50%;"></div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="td left" width="25%"><%:User AT Commands%>:</div>
|
||||
<div class="td left" style="width:50%;">
|
||||
<select name="command_choose" id="command_choose" onclick="copyToSend()"></select>
|
||||
<div class="tr">
|
||||
<div class="td left" width="25%"><%:User AT Commands%>:</div>
|
||||
<div class="td left" style="width:50%;">
|
||||
<select name="command_choose" id="command_choose" onclick="copyToSend()"></select>
|
||||
</div>
|
||||
<div class="td left" style="width:50%;"></div>
|
||||
</div>
|
||||
<div class="td left" style="width:50%;"></div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="td left" style="width:25%;"><%:Command to send%>:</div>
|
||||
<div class="td left" ><input type="text" id="at_command" required size="20" ></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="td left" style="width:25%;"><%:Command to send%>:</div>
|
||||
<div class="td left" ><input type="text" id="at_command" required size="20" ></div>
|
||||
<div class="table" width="100%">
|
||||
<div class="td left" style="width:25%;"><%:Reply%>:
|
||||
<p>
|
||||
<pre id="odp" style="visibility: hidden; width:75%;"></pre></div>
|
||||
|
||||
<div class="tr cbi-rowstyle-2">
|
||||
<div class="td right"><input type="button" style="margin-right: 26%"; id="sendcmd" class="btn cbi-button cbi-button-neutral" value="<%:Send Command%>" /></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="table" width="100%">
|
||||
<div class="td left" style="width:25%;"><%:Reply%>:
|
||||
<p>
|
||||
<pre id="odp" style="visibility: hidden; width:75%;"></pre></div>
|
||||
|
||||
<div class="tr cbi-rowstyle-2">
|
||||
<div class="td right"><input type="button" style="margin-right: 26%"; id="sendcmd" class="btn cbi-button cbi-button-neutral" value="<%:Send Command%>" /></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
window.onload = function readData()
|
||||
{
|
||||
// 选择AT命令
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "user_at_command")%>', null,
|
||||
function(x, json)
|
||||
{
|
||||
select = document.getElementById('command_choose');
|
||||
// 遍历序号
|
||||
for (var command in json) {
|
||||
// 遍历AT命令
|
||||
for (var key in json[command]) {
|
||||
var option = document.createElement('option');
|
||||
option.text = key;
|
||||
option.value = json[command][key].trim();
|
||||
option.innerHTML = key;
|
||||
select.appendChild(option);
|
||||
window.onload = function readData()
|
||||
{
|
||||
// 获取AT命令
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "user_at_command")%>', null,
|
||||
function(x, json)
|
||||
{
|
||||
select = document.getElementById('command_choose');
|
||||
// 遍历序号
|
||||
for (var command in json) {
|
||||
// 遍历AT命令
|
||||
for (var key in json[command]) {
|
||||
var option = document.createElement('option');
|
||||
option.text = key;
|
||||
option.value = json[command][key].trim();
|
||||
option.innerHTML = key;
|
||||
select.appendChild(option);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
};
|
||||
|
||||
// 定时触发更新AT串口
|
||||
XHR.poll(5,'<%=luci.dispatcher.build_url("admin", "network", "modem", "get_at_port")%>', null,
|
||||
function(x, port)
|
||||
{
|
||||
{
|
||||
//获取模块选择框元素
|
||||
var modem_select = document.getElementById('modem_select');
|
||||
// 记录所选
|
||||
@ -116,8 +94,15 @@ window.onload = function readData()
|
||||
for (var key in port)
|
||||
{
|
||||
var option = document.createElement('option');
|
||||
option.text = port[key].trim();
|
||||
option.value = key;
|
||||
if (port[key].includes("unknown"))
|
||||
{
|
||||
option.text = port[key].replace("unknown", key);
|
||||
}
|
||||
else
|
||||
{
|
||||
option.text = port[key];
|
||||
}
|
||||
modem_select.appendChild(option);
|
||||
}
|
||||
// 恢复原来的选择
|
||||
@ -129,84 +114,101 @@ window.onload = function readData()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 界面显示控制
|
||||
if (Object.keys(port).length==0)
|
||||
{
|
||||
// 更新提示信息
|
||||
document.getElementById("info_message").innerHTML="<strong><%:No modems found%></strong>";
|
||||
// 显示提示信息
|
||||
document.getElementById("cbi-info").style.display="block";
|
||||
// 隐藏AT命令界面
|
||||
document.getElementById("at_command_view").style.display="none";
|
||||
}
|
||||
else
|
||||
{
|
||||
// 显示AT命令界面
|
||||
document.getElementById("at_command_view").style.display="block";
|
||||
// 隐藏提示信息
|
||||
document.getElementById("cbi-info").style.display="none";
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
// 根据所选的模组改变AT命令
|
||||
function afunction()
|
||||
{
|
||||
// var node = document.getElementById('odp');
|
||||
// node.style.visibility = 'hidden';
|
||||
// 根据所选的模组改变AT命令
|
||||
function afunction()
|
||||
{
|
||||
// var node = document.getElementById('odp');
|
||||
// node.style.visibility = 'hidden';
|
||||
|
||||
// var x = document.getElementById("at_command").value;
|
||||
// document.getElementById("code").value = x;
|
||||
// document.getElementById("odp").innerHTML = "";
|
||||
}
|
||||
|
||||
//自动填写到命令输入框
|
||||
function copyToSend()
|
||||
{
|
||||
var node = document.getElementById('odp');
|
||||
node.style.visibility = 'hidden';
|
||||
|
||||
var command_choose = document.getElementById("command_choose").value;
|
||||
document.getElementById("at_command").value = command_choose;
|
||||
document.getElementById("odp").innerHTML = "";
|
||||
}
|
||||
|
||||
|
||||
function postCommand(at_port,at_command) {
|
||||
(new XHR()).post('<%=luci.dispatcher.build_url("admin", "network", "modem", "send_at_command")%>', {"port":at_port,"command":at_command}, function(x) {
|
||||
console.log(x.response)
|
||||
console.log(x)
|
||||
|
||||
var aStr = x.response;
|
||||
var myre = /^[\s\t]*(\r\n|\n|\r)/gm;
|
||||
var bStr = aStr.replace(myre,"");
|
||||
document.getElementById("odp").innerHTML = bStr;
|
||||
var el = document.getElementsByName("odp")[0];
|
||||
el.value.replace(/(\r\n|\n|\r)/gm, "");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function (ev) {var button = document.getElementById("sendcmd");
|
||||
button.addEventListener("click", function () {
|
||||
|
||||
//获取AT串口
|
||||
var at_port = document.getElementById("modem_select").value;
|
||||
if ( at_port.length == 0 )
|
||||
{
|
||||
document.getElementById("odp").innerHTML = "";
|
||||
alert("<%:Please choose a Modem%>");
|
||||
return false;
|
||||
}
|
||||
|
||||
//获取AT命令
|
||||
var at_command = document.getElementById("at_command").value;
|
||||
if ( at_command.length == 0 )
|
||||
{
|
||||
document.getElementById("odp").innerHTML = "";
|
||||
alert("<%:Please enter a AT Command%>");
|
||||
return false;
|
||||
}
|
||||
|
||||
//发送AT命令
|
||||
postCommand(at_port,at_command);
|
||||
at_command = "";
|
||||
// var x = document.getElementById("at_command").value;
|
||||
// document.getElementById("code").value = x;
|
||||
// document.getElementById("odp").innerHTML = "";
|
||||
}
|
||||
|
||||
//自动填写到命令输入框
|
||||
function copyToSend()
|
||||
{
|
||||
var node = document.getElementById('odp');
|
||||
if (node.style.visibility=='visible') {
|
||||
node.style.visibility = 'hidden';
|
||||
}
|
||||
else
|
||||
node.style.visibility = 'visible'
|
||||
node.style.visibility = 'hidden';
|
||||
|
||||
return true;
|
||||
var command_choose = document.getElementById("command_choose").value;
|
||||
document.getElementById("at_command").value = command_choose;
|
||||
document.getElementById("odp").innerHTML = "";
|
||||
}
|
||||
|
||||
function postCommand(at_port,at_command)
|
||||
{
|
||||
(new XHR()).post('<%=luci.dispatcher.build_url("admin", "network", "modem", "send_at_command")%>', {"port":at_port,"command":at_command}, function(x) {
|
||||
console.log(x.response)
|
||||
console.log(x)
|
||||
|
||||
var aStr = x.response;
|
||||
var myre = /^[\s\t]*(\r\n|\n|\r)/gm;
|
||||
var bStr = aStr.replace(myre,"");
|
||||
document.getElementById("odp").innerHTML = bStr;
|
||||
var el = document.getElementsByName("odp")[0];
|
||||
el.value.replace(/(\r\n|\n|\r)/gm, "");
|
||||
});
|
||||
}, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function (ev) {var button = document.getElementById("sendcmd");
|
||||
button.addEventListener("click", function () {
|
||||
|
||||
//获取AT串口
|
||||
var at_port = document.getElementById("modem_select").value;
|
||||
if ( at_port.length == 0 )
|
||||
{
|
||||
document.getElementById("odp").innerHTML = "";
|
||||
alert("<%:Please choose a Modem%>");
|
||||
return false;
|
||||
}
|
||||
|
||||
//获取AT命令
|
||||
var at_command = document.getElementById("at_command").value;
|
||||
if ( at_command.length == 0 )
|
||||
{
|
||||
document.getElementById("odp").innerHTML = "";
|
||||
alert("<%:Please enter a AT Command%>");
|
||||
return false;
|
||||
}
|
||||
|
||||
//发送AT命令
|
||||
postCommand(at_port,at_command);
|
||||
at_command = "";
|
||||
|
||||
var node = document.getElementById('odp');
|
||||
if (node.style.visibility=='visible') {
|
||||
node.style.visibility = 'hidden';
|
||||
}
|
||||
else
|
||||
node.style.visibility = 'visible'
|
||||
|
||||
return true;
|
||||
});
|
||||
}, true);
|
||||
|
||||
|
||||
</script>
|
||||
|
@ -11,37 +11,6 @@ havegps = 0
|
||||
if fs.stat("/etc/havegps") then
|
||||
havegps = 1
|
||||
end
|
||||
|
||||
-- 获取模组的备注
|
||||
-- @Param network 移动网络
|
||||
function getModemRemarks(network)
|
||||
local remarks=""
|
||||
uci:foreach("modem", "config", function (config)
|
||||
---配置启用,且备注存在
|
||||
if network == config["network"] and config["enable"] == "1" then
|
||||
if config["remarks"] then
|
||||
remarks=" ("..config["remarks"]..")" --" (备注)"
|
||||
return true --跳出循环
|
||||
end
|
||||
end
|
||||
end)
|
||||
return remarks
|
||||
end
|
||||
|
||||
-- 获取AT串口
|
||||
function getATPort()
|
||||
local at_ports={}
|
||||
uci:foreach("modem", "modem-device", function (modem_device)
|
||||
--获取模块的备注
|
||||
local network=modem_device["network"]
|
||||
local remarks=getModemRemarks(network)
|
||||
|
||||
local name=modem_device["name"]:upper()..remarks
|
||||
local at_port = modem_device["at_port"]
|
||||
at_ports[at_port]=name
|
||||
end)
|
||||
return at_ports
|
||||
end
|
||||
%>
|
||||
<style>g {color:grey; font-size:75%; vertical-align: super;}</style>
|
||||
<script type="text/javascript" src="<%=resource%>/xhr.js?v=git-23.159.15540-7154b89"></script>
|
||||
@ -57,158 +26,93 @@ end
|
||||
// 更新数据
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
//更新模组数据
|
||||
// XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "modem", "get_modem_info")%>', {"port":at_port},
|
||||
// function(x, modem_info)
|
||||
// {
|
||||
// console.log(modem_info);
|
||||
|
||||
// // 基本信息
|
||||
// // document.getElementById('modem').innerHTML=modem_info.modem;
|
||||
// document.getElementById('manufacturer').innerHTML=modem_info.manufacturer;
|
||||
// document.getElementById('at_port').innerHTML=modem_info.at_port;
|
||||
// document.getElementById('mode').innerHTML=modem_info.mode;
|
||||
// document.getElementById('temperature').innerHTML=modem_info.temperature;
|
||||
// document.getElementById('date').innerHTML=modem_info.date;
|
||||
|
||||
// //SIM卡信息
|
||||
// document.getElementById('csq').innerHTML=modem_info.csq;
|
||||
// document.getElementById('per').innerHTML=modem_info.per;
|
||||
// document.getElementById('rssi').innerHTML=modem_info.rssi;
|
||||
// document.getElementById('cops').innerHTML=modem_info.cops;
|
||||
// document.getElementById('net_type').innerHTML=modem_info.net_type;
|
||||
// document.getElementById('lac').innerHTML=modem_info.lac;
|
||||
// document.getElementById('cid').innerHTML=modem_info.cid;
|
||||
// document.getElementById('lacn').innerHTML=modem_info.lacn;
|
||||
// document.getElementById('cidn').innerHTML=modem_info.cidn;
|
||||
// document.getElementById('mcc').innerHTML=modem_info.mcc;
|
||||
// document.getElementById('mnc').innerHTML=modem_info.mnc;
|
||||
// document.getElementById('rnc').innerHTML=modem_info.rnc;
|
||||
// document.getElementById('rncn').innerHTML=modem_info.rncn;
|
||||
// document.getElementById('down').innerHTML=modem_info.down;
|
||||
// document.getElementById('up').innerHTML=modem_info.up;
|
||||
// document.getElementById('ecio').innerHTML=modem_info.ecio;
|
||||
// document.getElementById('rscp').innerHTML=modem_info.rscp;
|
||||
// document.getElementById('ecio1').innerHTML=modem_info.ecio1;
|
||||
// document.getElementById('rscp1').innerHTML=modem_info.rscp1;
|
||||
// document.getElementById('chan').innerHTML=modem_info.channel;
|
||||
// document.getElementById('lband').innerHTML=modem_info.lband;
|
||||
// document.getElementById('conmon').innerHTML=modem_info.netmode;
|
||||
// document.getElementById('tempur').innerHTML=modem_info.tempur;
|
||||
|
||||
// document.getElementById('pci').innerHTML=modem_info.pci;
|
||||
// document.getElementById('sinr').innerHTML=modem_info.sinr;
|
||||
|
||||
// document.getElementById('imei').innerHTML=modem_info.imei;
|
||||
// document.getElementById('imsi').innerHTML=modem_info.imsi;
|
||||
// document.getElementById('iccid').innerHTML=modem_info.iccid;
|
||||
// document.getElementById('phone').innerHTML=modem_info.phone;
|
||||
//获取小区信息视图
|
||||
function get_cell_info_view(network_mode_info,translation)
|
||||
{
|
||||
//初始化视图
|
||||
var cell_info_view='';
|
||||
//遍历每一条信息
|
||||
for (var info of network_mode_info)
|
||||
{
|
||||
//遍历每一条信息里的键
|
||||
for (var key in info)
|
||||
{
|
||||
var full_name=info["full_name"];
|
||||
if (full_name==null)
|
||||
{
|
||||
full_name='';
|
||||
}
|
||||
//不显示空的信息
|
||||
if (key!="full_name"&&info[key]!="")
|
||||
{
|
||||
//添加单位
|
||||
if (key=="UL Bandwidth"||key=="DL Bandwidth") {
|
||||
info[key]=info[key]+" MHz"
|
||||
}
|
||||
else if (key=="RSRP"||key=="RxLev") {
|
||||
info[key]=info[key]+" dbm"
|
||||
}
|
||||
else if (key=="RSRQ"||key=="RSSNR") {
|
||||
info[key]=info[key]+" dB"
|
||||
}
|
||||
cell_info_view+='<tr><td width="20%" title="'+full_name+'">'+translation[key]+' :</td><td id="'+key+'">'+info[key]+'</td><td></td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
return cell_info_view;
|
||||
}
|
||||
|
||||
//获取小区信息
|
||||
function show_cell_info(cell_info,translation) {
|
||||
//获取网络模式
|
||||
var network_mode=Object.keys(cell_info)[0];
|
||||
//获取网络模式下的信息
|
||||
var network_mode_info=cell_info[network_mode];
|
||||
//获取表格
|
||||
var cell_info_Element=document.getElementById("cell_info");
|
||||
|
||||
// <% if havegps == 1 then %>
|
||||
// document.getElementById('lat').innerHTML=modem_info.lat;
|
||||
// document.getElementById('long').innerHTML=modem_info.long;
|
||||
// <% end %>
|
||||
// // document.getElementById('idvp').innerHTML=modem_info.modid;
|
||||
// // document.getElementById('proto').innerHTML=modem_info.proto;
|
||||
// // document.getElementById('port').innerHTML=modem_info.port;
|
||||
|
||||
// // document.getElementById('crate').innerHTML=modem_info.crate;
|
||||
// // if (phonenx == "")
|
||||
// // {
|
||||
// // document.getElementById('phone').value=modem_info.phone;
|
||||
// // document.getElementById('phonen').value=modem_info.phonen;
|
||||
// // phonenx = document.getElementById('phone').value;
|
||||
// // document.getElementById("phone").disabled=false;
|
||||
// // document.getElementById("phonen").disabled=false;
|
||||
// // document.getElementById("pho").disabled=false;
|
||||
// // }
|
||||
|
||||
// // if (modem_info.phone == "-")
|
||||
// // {
|
||||
// // document.getElementById('phone').value="-";
|
||||
// // document.getElementById('phonen').value="-";
|
||||
// // document.getElementById("pho").disabled=true;
|
||||
// // document.getElementById("phone").disabled=true;
|
||||
// // document.getElementById("phonen").disabled=true;
|
||||
// // phonenx = "";
|
||||
// // }
|
||||
|
||||
// // simerr = modem_info.simerr;
|
||||
// // if (simerr == "0")
|
||||
// // {
|
||||
// // document.getElementById("simwarn").style.display="none";
|
||||
// // }
|
||||
// // else
|
||||
// // {
|
||||
// // document.getElementById("simwarn").style.display="block";
|
||||
// // document.getElementById("simsg").style.color = "red";
|
||||
// // if (simerr == "1")
|
||||
// // {
|
||||
// // document.getElementById("simsg").innerHTML = "<%:SIM卡已锁定,个人资料中未输入SIM Pin!!%>";
|
||||
// // }
|
||||
// // else
|
||||
// // {
|
||||
// // if (simerr == "2")
|
||||
// // {
|
||||
// // document.getElementById("simsg").innerHTML = "<%:解锁SIM卡的Pin不正确%>";
|
||||
// // }
|
||||
// // else
|
||||
// // {
|
||||
// // if (simerr == "3")
|
||||
// // {
|
||||
// // document.getElementById("simsg").innerHTML = "<%:无效SIM卡%>";
|
||||
// // } else
|
||||
// // {
|
||||
// // document.getElementById("simsg").innerHTML = "<%:SIM卡未锁定.错误的SIM卡%>";
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
|
||||
|
||||
// // reslt=modem_info.result
|
||||
|
||||
// // portx=modem_info.port
|
||||
// // if (portx == "-" )
|
||||
// // {
|
||||
// // document.getElementById('inc1').style.display="none";
|
||||
// // document.getElementById('dec1').style.display="none";
|
||||
// // }
|
||||
// // else
|
||||
// // {
|
||||
// // document.getElementById('inc1').style.display="block";
|
||||
// // document.getElementById('dec1').style.display="block";
|
||||
// // }
|
||||
|
||||
// // host = modem_info.host;
|
||||
// // if(host == "1")
|
||||
// // {
|
||||
// // document.getElementById("pho").disabled=true;
|
||||
// // }
|
||||
// }
|
||||
// );
|
||||
|
||||
//初始化视图
|
||||
var cell_info_view='<caption>'+<%:network_mode%>+'</caption>';
|
||||
if (network_mode=="EN-DC Mode")
|
||||
{
|
||||
var lte=network_mode_info[0]["LTE"];
|
||||
cell_info_view+='<tr><td colspan="3">LTE</td></tr>';
|
||||
cell_info_view+=get_cell_info_view(lte,translation);
|
||||
var nsa=network_mode_info[1]["NR5G-NSA"];
|
||||
cell_info_view+='<tr><td colspan="3">NR5G-NSA</td></tr>';
|
||||
cell_info_view+=get_cell_info_view(nsa,translation);
|
||||
}
|
||||
else
|
||||
{
|
||||
// cell_info_view+='<tr><td colspan="3">NR5G-NSA</td></tr>';
|
||||
cell_info_view+=get_cell_info_view(network_mode_info,translation);
|
||||
}
|
||||
cell_info_Element.innerHTML=cell_info_view;
|
||||
}
|
||||
|
||||
// 更新模组数据
|
||||
function update()
|
||||
{
|
||||
var at_port="";
|
||||
if (modem_select.options.length!=0) {
|
||||
at_port=modem_select.options[modem_select.selectedIndex].value;
|
||||
}
|
||||
else {
|
||||
return
|
||||
}
|
||||
// var at_port="";
|
||||
// if (modem_select.options.length!=0) {
|
||||
var at_port=modem_select.options[modem_select.selectedIndex].value;
|
||||
// }
|
||||
// else {
|
||||
// return
|
||||
// }
|
||||
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "get_modem_info")%>', {"port":at_port},
|
||||
function(x, modem_info)
|
||||
function(x, data)
|
||||
{
|
||||
console.log(modem_info);
|
||||
console.log(data);
|
||||
|
||||
var modem_info=data["modem_info"];
|
||||
var translation=data["translation"];
|
||||
|
||||
var base_info=modem_info["base_info"];
|
||||
var connect_status=base_info["connect_status"];
|
||||
for (var key in base_info)
|
||||
{
|
||||
var base_info_Element=document.getElementById(key);
|
||||
@ -219,14 +123,80 @@ end
|
||||
}
|
||||
|
||||
var more_info=modem_info["more_info"];
|
||||
for (var key in more_info)
|
||||
//基本信息
|
||||
base_info=more_info["base_info"];
|
||||
for (var key in base_info)
|
||||
{
|
||||
var more_info_Element=document.getElementById(key);
|
||||
if (more_info_Element!=null)
|
||||
var base_info_Element=document.getElementById(key);
|
||||
if (base_info_Element!=null)
|
||||
{
|
||||
more_info_Element.innerHTML=more_info[key];
|
||||
base_info_Element.innerHTML=base_info[key];
|
||||
}
|
||||
}
|
||||
|
||||
// 界面显示控制
|
||||
// 隐藏提示信息
|
||||
document.getElementById("cbi-info").style.display="none";
|
||||
// 显示基本信息
|
||||
document.getElementById("cbi-baseinfo").style.display="block";
|
||||
|
||||
//SIM卡信息
|
||||
var sim_info=more_info["sim_info"];
|
||||
for (var key in sim_info)
|
||||
{
|
||||
var sim_info_Element=document.getElementById(key);
|
||||
if (sim_info_Element!=null)
|
||||
{
|
||||
sim_info_Element.innerHTML=translation[sim_info[key]];
|
||||
}
|
||||
}
|
||||
|
||||
// 界面显示控制
|
||||
if (base_info["manufacturer"]!="unknown")
|
||||
{
|
||||
// 显示SIM卡信息
|
||||
document.getElementById("cbi-siminfo").style.display="block";
|
||||
}
|
||||
else
|
||||
{
|
||||
// 隐藏SIM卡信息
|
||||
document.getElementById("cbi-siminfo").style.display="none";
|
||||
return
|
||||
}
|
||||
|
||||
//网络信息
|
||||
var network_info=more_info["network_info"];
|
||||
for (var key in network_info)
|
||||
{
|
||||
var network_info_Element=document.getElementById(key);
|
||||
if (network_info_Element!=null)
|
||||
{
|
||||
network_info_Element.innerHTML=network_info[key];
|
||||
}
|
||||
}
|
||||
|
||||
//小区信息
|
||||
var cell_info=more_info["cell_info"];
|
||||
if (cell_info!=null)
|
||||
{
|
||||
show_cell_info(cell_info,translation);
|
||||
}
|
||||
|
||||
// 界面显示控制
|
||||
if (connect_status=="connect")
|
||||
{
|
||||
// 显示网络信息
|
||||
document.getElementById("cbi-networkinfo").style.display="block";
|
||||
// 显示小区信息
|
||||
document.getElementById("cbi-cellinfo").style.display="block";
|
||||
}
|
||||
else
|
||||
{
|
||||
// 隐藏网络信息
|
||||
document.getElementById("cbi-networkinfo").style.display="none";
|
||||
// 隐藏小区信息
|
||||
document.getElementById("cbi-cellinfo").style.display="none";
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -258,6 +228,25 @@ end
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 界面显示控制
|
||||
if (Object.keys(port).length==0)
|
||||
{
|
||||
// 更新提示信息
|
||||
document.getElementById("info_message").innerHTML="<strong><%:No modems found%></strong>";
|
||||
// 显示提示信息
|
||||
document.getElementById("cbi-info").style.display="block";
|
||||
// 隐藏基本信息
|
||||
document.getElementById("cbi-baseinfo").style.display="none";
|
||||
// 隐藏SIM卡信息
|
||||
document.getElementById("cbi-siminfo").style.display="none";
|
||||
// 隐藏网络信息
|
||||
document.getElementById("cbi-networkinfo").style.display="none";
|
||||
// 隐藏小区信息
|
||||
document.getElementById("cbi-cellinfo").style.display="none";
|
||||
return
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
);
|
||||
@ -297,7 +286,6 @@ end
|
||||
document.getElementById('conmon').innerHTML="-";
|
||||
document.getElementById('phone').value="-";
|
||||
|
||||
|
||||
document.getElementById('imei').innerHTML="-";
|
||||
document.getElementById('imsi').innerHTML="-";
|
||||
document.getElementById('iccid').innerHTML="-";
|
||||
@ -315,10 +303,10 @@ end
|
||||
</script>
|
||||
|
||||
<div class="cbi-map" id="cbi-modem">
|
||||
<h2 name="content"><%:Modem Info%></h2>
|
||||
<h2 name="content"><%:Modem Information%></h2>
|
||||
<div class="cbi-map-descr"><%:%></div>
|
||||
|
||||
<fieldset class="cbi-section" id="simwarn" style="display:none;">
|
||||
<!-- <fieldset class="cbi-section" id="simwarn" style="display:none;">
|
||||
<legend><%:SIM警告%></legend>
|
||||
<table width="550" border="0">
|
||||
<tr>
|
||||
@ -327,100 +315,124 @@ end
|
||||
<td width="30%"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</fieldset> -->
|
||||
|
||||
<% at_ports = getATPort() %>
|
||||
<% if next(at_ports) == nil then %>
|
||||
|
||||
<fieldset class="cbi-section" id="info">
|
||||
<h3><%:信息%></h3>
|
||||
<table width="550" border="0">
|
||||
<fieldset class="cbi-section" id="cbi-info" style="display: block;">
|
||||
<h3><%:Message%></h3>
|
||||
<table width="550" border="0">
|
||||
<tr>
|
||||
<td width="10%"></td>
|
||||
<td width="60%"><div align="left" id="simsg" style="font-size:1.875em"><strong><%:No modems found%></strong></div></td>
|
||||
<td width="60%">
|
||||
<div align="left" id="info_message" style="font-size:1.875em">
|
||||
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle"/>
|
||||
<%:Loading modem information%>...
|
||||
</div>
|
||||
</td>
|
||||
<td width="30%"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% else %>
|
||||
<fieldset class="cbi-section" id="cbi-baseinfo">
|
||||
<h3><%:基本信息%></h3>
|
||||
<fieldset class="cbi-section" id="cbi-baseinfo" style="display: none;">
|
||||
<h3><%:Base Information%></h3>
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="20%"><%:模组 :%></td><td id="modem_name">
|
||||
<select name="modem_select" id="modem_select">
|
||||
<% at_ports = getATPort() %>
|
||||
<% for key in pairs(at_ports) do %>
|
||||
<option value="<%= key %>"><%= at_ports[key] %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
<tr><td width="20%"><%:Modem%> :</td><td id="modem_name">
|
||||
<select name="modem_select" id="modem_select"></select>
|
||||
</td><td></td></tr>
|
||||
<tr><td width="20%"><%:制造商 :%></td><td id="manufacturer"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:固件版本 :%></td><td id="revision"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:数据接口 : %></td><td id="data_interface"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:拨号模式 : %></td><td id="mode"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:AT串口 : %></td><td id="at_port"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:移动网络 : %></td><td id="network"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:温度 : %></td><td id="temperature"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:更新时间 : %></td><td id="update_time"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:Manufacturer%> :</td><td id="manufacturer"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:Revision%>:</td><td id="revision"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:Data Interface%> :</td><td id="data_interface"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:Mode%> :</td><td id="mode"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:AT Port%> :</td><td id="at_port"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:Mobile Network%> :</td><td id="network"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:Temperature%> :</td><td id="temperature"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:Update Time%> :</td><td id="update_time"></td><td></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if nosms == 0 then %>
|
||||
<% end %>
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-siminfo">
|
||||
<h3><%:SIM卡信息%></h3>
|
||||
<fieldset class="cbi-section" id="cbi-siminfo" style="display: none;">
|
||||
<h3><%:SIM Information%></h3>
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="20%"><%:运营商 : %></td><td id="isp"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:IMEI :%></td><td id="imei"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:IMSI : %></td><td id="imsi"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:ICCID : %></td><td id="iccid"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:SIM卡号码 : %></td><td id="phone"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:ISP%> :</td><td id="isp"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:IMEI%> :</td><td id="imei"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:IMSI%> :</td><td id="imsi"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:ICCID%> :</td><td id="iccid"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:SIM Number%> :</td><td id="sim_number"></td><td></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-networkinfo">
|
||||
<fieldset class="cbi-section" id="cbi-networkinfo" style="display: none;">
|
||||
<h3><%:Network Information%></h3>
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="20%"><%:Network Type%> :</td><td id="network_type"></td><td></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-cellinfo" style="display: none;">
|
||||
<h3><%:Cell Information%></h3>
|
||||
<table width="100%" cellspacing="10" id="cell_info">
|
||||
<!-- <tr><td width="20%"><%:MCC/MNC 国家码/网络码 %> :</td><td id="nr_mcc"></td><td id="nr_mnc"></td></tr>
|
||||
<tr><td width="20%"><%:Duplex Mode 双工模式 %> :</td><td id="nr_duplex_mode"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:Cell ID 小区ID %> :</td><td><ul><span id="nr_cell_id" class="r"></span><span id="cidn" class="r"></span></ul></td><td></td></tr>
|
||||
<tr><td width="20%"><%:Physical Cell ID 物理小区ID %> :</td><td id="nr_physical_cell_id"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:TAC 跟踪区编码 %> :</td><td id="nr_tac"></td><td></td></tr>
|
||||
<tr><td width="20%" title="<%:Absolute Radio-Frequency Channel Number%>"><%:ARFCN 绝对射频信道号 : %></td><td id="nr_arfcn"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:Band 频段 : %></td><td id="nr_band"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:UL Bandwidth 上行带宽 %> :</td><td id="nr_ul_bandwidth"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:DL Bandwidth 下行带宽 %> :</td><td id="nr_dl_bandwidth"></td><td></td></tr>
|
||||
<tr><td width="20%" title="<%:Reference Signal Received Power%>"><%:RSRP 参考信号接收功率 %> :</td><td id="nr_rsrp"></td><td></td></tr>
|
||||
<tr><td width="20%" title="<%:Reference Signal Received Quality%>"><%:RSRQ 参考信号接收质量 %> :</td><td id="nr_rsrq"></td><td></td></tr>
|
||||
<tr><td width="20%" title="<%:Signal to Interference plus Noise Ratio Bandwidth%>"><%:SINR 信号与干扰加噪声比 %> :</td><td id="nr_sinr"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:SCS NR子载波间隔 %> :</td><td id="nr_scs"></td><td></td></tr>
|
||||
<tr><td width="20%"title="<%:Received Signal Level%>"><%:RxLev 接收信号电平 %> :</td><td id="nr_rxlev"></td><td></td></tr> -->
|
||||
</table>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<!-- <fieldset class="cbi-section" id="cbi-networkinfo" style="display: none;">
|
||||
<h3><%:网络信息%></h3>
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="20%"><%:网络类型 :%></td><td id="net_type"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:Network Type 网络类型 %> :</td><td id="network_type"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:CSQ : %></td><td id="csq"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:信号强度 : %></td><td id="per"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:信号接收强度 RSSI : %></td><td id="rssi"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:参考信号接收质量 RSRQ : %></td><td><ul><span id="ecio" class="r"></span><span id="ecio1" class="r"></span></ul></td><td></td></tr>
|
||||
<tr><td width="20%"><%:参考信号接收功率 RSRP : %></td><td><ul><span id="rscp" class="r"></span><span id="rscp1" class="r"></span></ul></td><td></td></tr>
|
||||
<tr><td width="20%"><%:信噪比 SINR : %></td><td id="sinr"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:RSSI 信号接收强度 : %></td><td id="rssi"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:RSRQ 参考信号接收质量 : %></td><td><ul><span id="ecio" class="r"></span><span id="ecio1" class="r"></span></ul></td><td></td></tr>
|
||||
<tr><td width="20%"><%:RSRP 参考信号接收功率 : %></td><td><ul><span id="rscp" class="r"></span><span id="rscp1" class="r"></span></ul></td><td></td></tr>
|
||||
<tr><td width="20%"><%:SINR 信噪比 : %></td><td id="sinr"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:连接状态监控 : %></td><td id="conmon"></td><td></td></tr>
|
||||
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-sig">
|
||||
<fieldset class="cbi-section" id="cbi-stationinfo" style="display: none;">
|
||||
<h3><%:基站信息%></h3>
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="20%"><%:MCC / MNC :%></td><td id="mcc"></td><td id="mnc"></td></tr>
|
||||
<tr><td width="20%"><%:MCC/MNC 国家码/网络码 %> :</td><td id="mcc"></td><td id="mnc"></td></tr>
|
||||
<tr><td width="20%"><%:eNB ID : %></td><td><ul><span id="rnc" class="r"></span><span id="rncn" class="r"></span></ul></td><td></td></tr>
|
||||
<tr><td width="20%"><%:TAC : %></td><td><ul><span id="lac" class="r"></span><span id="lacn" class="r"></span></ul></td><td></td></tr>
|
||||
<tr><td width="20%"><%:Cell ID : %></td><td><ul><span id="cid" class="r"></span><span id="cidn" class="r"></span></ul></td><td></td></tr>
|
||||
<tr><td width="20%"><%:频段 Band : %></td><td id="lband"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:频点 Channel : %></td><td id="chan"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:物理小区标识 PCI : %></td><td id="pci"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:最大Qos级别 Maximum Qos : %></td><td><ul><span id="down" class="r"></span><span id="up" class="r"></span></ul></td><td></td></tr>
|
||||
<tr><td width="20%"><%:Band 频段 : %></td><td id="lband"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:Channel 频点 : %></td><td id="channel"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:PCI 物理小区标识 : %></td><td id="pci"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:Maximum Qos 最大Qos级别 : %></td><td><ul><span id="down" class="r"></span><span id="up" class="r"></span></ul></td><td></td></tr>
|
||||
|
||||
</table>
|
||||
</fieldset>
|
||||
</fieldset> -->
|
||||
|
||||
<% if havegps == 1 then %>
|
||||
<fieldset class="cbi-section" id="cbi-gpsinfo">
|
||||
<h3><%:GPS 定位%></h3>
|
||||
<table width="550" border="0">
|
||||
<tr>
|
||||
<td width="30%"><div align="right"><%:纬度 :%></div></td>
|
||||
<td width="30%"><div align="right"><%:纬度 %> :</div></td>
|
||||
<td><ul id="lat"></ul></td>
|
||||
<td width="1%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><div align="right"><%:经度 :%></div></td>
|
||||
<td><div align="right"><%:经度 %> :</div></td>
|
||||
<td><ul id="long"></ul></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
@ -428,8 +440,6 @@ end
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<%+footer%>
|
||||
|
||||
|
@ -5,29 +5,66 @@
|
||||
-%>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
|
||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "modem", "get_modems")%>', null,
|
||||
function(x, modems)
|
||||
function(x, data)
|
||||
{
|
||||
console.log(modems);
|
||||
var modemsDiv = document.getElementById('modem_status_text');
|
||||
if (modems.length!=0)
|
||||
var modems=data["modems"];
|
||||
var translation=data["translation"];
|
||||
|
||||
var modems_div=document.getElementById('modem_status_view');
|
||||
if (Object.keys(modems).length!=0)
|
||||
{
|
||||
var modem_view = '';
|
||||
var modem_view = "";
|
||||
for ( var key in modems)
|
||||
{
|
||||
var modem=modems[key];
|
||||
// 获取拨号模式
|
||||
var mode="unknown mode";
|
||||
if (modem["mode"]!=null) {
|
||||
mode=modem["mode"].toUpperCase()
|
||||
|
||||
var language=navigator.language;
|
||||
// 检查模组名
|
||||
var name=modem["name"];
|
||||
if (name==null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// 获取连接状态
|
||||
var connect_status;
|
||||
if (modem["connect_status"]!=null) {
|
||||
// 首字母大写
|
||||
connect_status=modem["connect_status"].charAt(0).toUpperCase() + modem["connect_status"].slice(1);
|
||||
else if (name=="unknown")
|
||||
{
|
||||
language=="en" ? name=name.toUpperCase() : translation[name];
|
||||
}
|
||||
else
|
||||
{
|
||||
name=name.toUpperCase();
|
||||
}
|
||||
|
||||
// 检查拨号模式
|
||||
var mode=modem["mode"]
|
||||
if (mode==null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (mode=="unknown")
|
||||
{
|
||||
language=="en" ? mode=mode.toUpperCase() : translation[mode];
|
||||
}
|
||||
else
|
||||
{
|
||||
name=name.toUpperCase();
|
||||
}
|
||||
|
||||
// 获取连接状态
|
||||
var connect_status=modem["connect_status"];
|
||||
if (modem["connect_status"]!=null)
|
||||
{
|
||||
if (language=="en") {
|
||||
// 首字母大写
|
||||
connect_status=connect_status.charAt(0).toUpperCase() + modem["connect_status"].slice(1);
|
||||
}
|
||||
else if (language=="zh-CN"||language=="zh") {
|
||||
connect_status=translation[connect_status];
|
||||
}
|
||||
}
|
||||
|
||||
// 设置显示样式
|
||||
var state = '';
|
||||
var css = '';
|
||||
switch (modem["connect_status"])
|
||||
@ -41,10 +78,12 @@
|
||||
css = 'danger';
|
||||
break;
|
||||
default:
|
||||
state = '<%:Disabled%>';
|
||||
state = '<%:unknown%>';
|
||||
css = 'warning';
|
||||
break;
|
||||
}
|
||||
|
||||
// 设置显示内容
|
||||
modem_view += String.format(
|
||||
'<div class="alert-message %s">',
|
||||
css
|
||||
@ -55,7 +94,7 @@
|
||||
);
|
||||
modem_view += String.format(
|
||||
'<div><strong><%:Modem Name%>: </strong>%s</div>',
|
||||
modem.name.toUpperCase()
|
||||
name
|
||||
);
|
||||
modem_view += String.format(
|
||||
'<div><strong><%:Data Interface%>: </strong>%s</div>',
|
||||
@ -71,15 +110,25 @@
|
||||
);
|
||||
modem_view += String.format(
|
||||
'<div><strong><%:Connect Status%>: </strong>%s</div>',
|
||||
<%:connect_status%>
|
||||
connect_status
|
||||
);
|
||||
modem_view += '</div>'
|
||||
modem_view += '</div>';
|
||||
}
|
||||
|
||||
// 有参数不存在,则不显示模块状态
|
||||
if (modem_view != "")
|
||||
{
|
||||
modems_div.innerHTML=modem_view;
|
||||
// 显示模块状态(状态加载完成才显示)
|
||||
document.getElementById("modem_status_field").style.display="block";
|
||||
}
|
||||
modemsDiv.innerHTML = modem_view;
|
||||
}
|
||||
else
|
||||
{
|
||||
modemsDiv.innerHTML = '<strong><%:No modems found%></strong>';
|
||||
var modem_view="<strong><%:No modems found%></strong>";
|
||||
modems_div.innerHTML=modem_view;
|
||||
// 隐藏模块状态
|
||||
document.getElementById("modem_status_field").style.display="none";
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -87,7 +136,7 @@
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
#modem_status_text > div {
|
||||
#modem_status_view > div {
|
||||
display: inline-block;
|
||||
margin: 1rem;
|
||||
padding: 1rem;
|
||||
@ -97,11 +146,12 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<fieldset id="modem_field" class="cbi-section">
|
||||
<!-- 默认隐藏模块状态 -->
|
||||
<fieldset id="modem_status_field" class="cbi-section" style="display: none;">
|
||||
<!-- <legend><%:Modem Status%></legend> -->
|
||||
<h3><%:Modem Status%></h3>
|
||||
<div id="modem_status_text">
|
||||
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
|
||||
<%:Loading modem status...%>
|
||||
<div id="modem_status_view">
|
||||
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle"/>
|
||||
<%:Loading modem status%>...
|
||||
</div>
|
||||
</fieldset>
|
||||
|
@ -19,16 +19,22 @@ msgstr "选择模组"
|
||||
msgid "Check information about adapted modem on this page"
|
||||
msgstr "在此页面查看已适配模组的信息"
|
||||
|
||||
msgid "Loading modem status..."
|
||||
msgid "Loading modem information"
|
||||
msgstr "正在加载模组信息"
|
||||
|
||||
msgid "Loading modem status"
|
||||
msgstr "正在加载模组状态"
|
||||
|
||||
msgid "Connect"
|
||||
msgid "Loading modem"
|
||||
msgstr "正在加载模组"
|
||||
|
||||
msgid "connect"
|
||||
msgstr "已连接"
|
||||
|
||||
msgid "Disconnect"
|
||||
msgid "disconnect"
|
||||
msgstr "未连接"
|
||||
|
||||
msgid "Disabled"
|
||||
msgid "disabled"
|
||||
msgstr "未启用"
|
||||
|
||||
msgid "Data Interface"
|
||||
@ -52,7 +58,7 @@ msgstr "AT命令"
|
||||
msgid "Debugging Your Module with AT Command"
|
||||
msgstr "使用AT命令调试你的模组"
|
||||
|
||||
msgid "Modem Info"
|
||||
msgid "Modem Information"
|
||||
msgstr "模组信息"
|
||||
|
||||
msgid "No modems found"
|
||||
@ -76,6 +82,9 @@ msgstr "移动网络"
|
||||
msgid "UNKNOWN"
|
||||
msgstr "未知"
|
||||
|
||||
msgid "unknown"
|
||||
msgstr "未知"
|
||||
|
||||
msgid "Mobile network not found"
|
||||
msgstr "未发现移动网络"
|
||||
|
||||
@ -125,4 +134,202 @@ msgid "Authentication Type"
|
||||
msgstr "认证类型"
|
||||
|
||||
msgid "NONE"
|
||||
msgstr "无"
|
||||
msgstr "无"
|
||||
|
||||
msgid "Message"
|
||||
msgstr "信息"
|
||||
|
||||
msgid "Base Information"
|
||||
msgstr "基本信息"
|
||||
|
||||
msgid "Manufacturer"
|
||||
msgstr "制造商"
|
||||
|
||||
msgid "Revision"
|
||||
msgstr "固件版本"
|
||||
|
||||
msgid "AT Port"
|
||||
msgstr "AT串口"
|
||||
|
||||
msgid "Temperature"
|
||||
msgstr "温度"
|
||||
|
||||
msgid "Update Time"
|
||||
msgstr "更新时间"
|
||||
|
||||
msgid "SIM Information"
|
||||
msgstr "SIM卡信息"
|
||||
|
||||
msgid "ISP"
|
||||
msgstr "运营商"
|
||||
|
||||
msgid "IMEI"
|
||||
msgstr "IMEI"
|
||||
|
||||
msgid "IMSI"
|
||||
msgstr "IMSI"
|
||||
|
||||
msgid "ICCID"
|
||||
msgstr "ICCID"
|
||||
|
||||
msgid "SIM Number"
|
||||
msgstr "SIM卡号码"
|
||||
|
||||
msgid "Network Information"
|
||||
msgstr "网络信息"
|
||||
|
||||
msgid "Network Type"
|
||||
msgstr "网络类型"
|
||||
|
||||
msgid "Cell Information"
|
||||
msgstr "小区信息"
|
||||
|
||||
msgid "Network Mode"
|
||||
msgstr "网络模式"
|
||||
|
||||
msgid "NR5G-SA Mode"
|
||||
msgstr "NR5G-SA 模式"
|
||||
|
||||
msgid "EN-DC Mode"
|
||||
msgstr "EN-DC 模式"
|
||||
|
||||
msgid "LTE Mode"
|
||||
msgstr "LTE 模式"
|
||||
|
||||
msgid "WCDMA Mode"
|
||||
msgstr "WCDMA 模式"
|
||||
|
||||
msgid "MCC"
|
||||
msgstr "移动国家代码"
|
||||
|
||||
msgid "MNC"
|
||||
msgstr "移动网络代码"
|
||||
|
||||
msgid "Duplex Mode"
|
||||
msgstr "双工模式"
|
||||
|
||||
msgid "LAC"
|
||||
msgstr "位置区码"
|
||||
|
||||
msgid "Cell ID"
|
||||
msgstr "小区ID"
|
||||
|
||||
msgid "Physical Cell ID"
|
||||
msgstr "物理小区ID"
|
||||
|
||||
msgid "TAC"
|
||||
msgstr "跟踪区编码"
|
||||
|
||||
msgid "ARFCN"
|
||||
msgstr "绝对射频信道号"
|
||||
|
||||
msgid "EARFCN"
|
||||
msgstr "E-UTRA绝对射频信道号"
|
||||
|
||||
msgid "UARFCN"
|
||||
msgstr "UTRA绝对射频信道号"
|
||||
|
||||
msgid "Band"
|
||||
msgstr "频段"
|
||||
|
||||
msgid "Freq band indicator"
|
||||
msgstr "频带指示"
|
||||
|
||||
msgid "UL Bandwidth"
|
||||
msgstr "上行带宽"
|
||||
|
||||
msgid "DL Bandwidth"
|
||||
msgstr "下行带宽"
|
||||
|
||||
msgid "RSRP"
|
||||
msgstr "参考信号接收功率"
|
||||
|
||||
msgid "RSRQ"
|
||||
msgstr "参考信号接收质量"
|
||||
|
||||
msgid "RSSI"
|
||||
msgstr "接收信号强度指示"
|
||||
|
||||
msgid "SINR"
|
||||
msgstr "信号与干扰加噪声比"
|
||||
|
||||
msgid "RSSNR"
|
||||
msgstr "信号干扰比"
|
||||
|
||||
msgid "SCS"
|
||||
msgstr "NR子载波间隔"
|
||||
|
||||
msgid "CQI"
|
||||
msgstr "信道质量指示"
|
||||
|
||||
msgid "TX Power"
|
||||
msgstr "TX 功率"
|
||||
|
||||
msgid "PSC"
|
||||
msgstr "主扰码"
|
||||
|
||||
msgid "RAC"
|
||||
msgstr "路由区域码"
|
||||
|
||||
msgid "RSCP"
|
||||
msgstr "接收信号码功率"
|
||||
|
||||
msgid "Ec/Io"
|
||||
msgstr "Ec/Io"
|
||||
|
||||
msgid "Ec/No"
|
||||
msgstr "Ec/No"
|
||||
|
||||
msgid "Physical Channel"
|
||||
msgstr "物理信道"
|
||||
|
||||
msgid "Spreading Factor"
|
||||
msgstr "扩频因子"
|
||||
|
||||
msgid "Slot"
|
||||
msgstr "插槽格式"
|
||||
|
||||
msgid "Speech Code"
|
||||
msgstr "语音编码"
|
||||
|
||||
msgid "Compression Mode"
|
||||
msgstr "压缩模式"
|
||||
|
||||
msgid "RxLev"
|
||||
msgstr "接收信号功率"
|
||||
|
||||
msgid "CHN-CMCC"
|
||||
msgstr "中国移动"
|
||||
|
||||
msgid "CMCC"
|
||||
msgstr "中国移动"
|
||||
|
||||
msgid "46000"
|
||||
msgstr "中国移动"
|
||||
|
||||
msgid "CHN-UNICOM"
|
||||
msgstr "中国联通"
|
||||
|
||||
msgid "UNICOM"
|
||||
msgstr "中国联通"
|
||||
|
||||
msgid "CUCC"
|
||||
msgstr "中国联通"
|
||||
|
||||
msgid "46001"
|
||||
msgstr "中国联通"
|
||||
|
||||
msgid "CHN-CT"
|
||||
msgstr "中国电信"
|
||||
|
||||
msgid "CHN-TELECOM"
|
||||
msgstr "中国电信"
|
||||
|
||||
msgid "CTCC"
|
||||
msgstr "中国电信"
|
||||
|
||||
msgid "CT"
|
||||
msgstr "中国电信"
|
||||
|
||||
msgid "46011"
|
||||
msgstr "中国电信"
|
||||
|
@ -25,7 +25,7 @@ USE_PROCD=1
|
||||
# "mbim") mode_num='2' ;;
|
||||
# "rndis") mode_num='3' ;;
|
||||
# "ncm") mode_num='5' ;;
|
||||
# "*") mode_num='0' ;;
|
||||
# *) mode_num='0' ;;
|
||||
# esac
|
||||
|
||||
# #查询当前拨号模式
|
||||
@ -41,7 +41,7 @@ USE_PROCD=1
|
||||
# "mbim") command='AT+QCFG="usbnet",2' ;;
|
||||
# "rndis") command='AT+QCFG="usbnet",3' ;;
|
||||
# "ncm") command='AT+QCFG="usbnet",5' ;;
|
||||
# "*") command='AT+QCFG="usbnet",0' ;;
|
||||
# *) command='AT+QCFG="usbnet",0' ;;
|
||||
# esac
|
||||
# at_result=$(sh /usr/share/modem/modem_at.sh "$at_port" "$command")
|
||||
# #移远切换模式后,还需要重启模块,待测试
|
||||
@ -58,7 +58,7 @@ USE_PROCD=1
|
||||
# "mbim") mode_num='29' ;;
|
||||
# "rndis") mode_num='24' ;;
|
||||
# "ncm") mode_num='23' ;;
|
||||
# "*") mode_num='32' ;;
|
||||
# *) mode_num='32' ;;
|
||||
# esac
|
||||
|
||||
# #查询当前拨号模式
|
||||
@ -73,7 +73,7 @@ USE_PROCD=1
|
||||
# "mbim") command='AT+GTUSBMODE=29' ;;
|
||||
# "rndis") command='AT+GTUSBMODE=24' ;;
|
||||
# "ncm") command='AT+GTUSBMODE=23' ;;
|
||||
# "*") command='AT+GTUSBMODE=32' ;;
|
||||
# *) command='AT+GTUSBMODE=32' ;;
|
||||
# esac
|
||||
# at_result=$(sh /usr/share/modem/modem_at.sh "$at_port" "$command")
|
||||
# sleep 5
|
||||
@ -157,7 +157,7 @@ set_interface()
|
||||
set_ipv4_interface "wwan_5g_$1" $2
|
||||
set_ipv6_interface "wwan6_5g_$1" $2
|
||||
;;
|
||||
"*")
|
||||
*)
|
||||
set_ipv4_interface "wwan_5g_$1" $2
|
||||
set_ipv6_interface "wwan6_5g_$1" $2
|
||||
;;
|
||||
@ -185,7 +185,7 @@ qmi()
|
||||
"ipv4") procd_append_param command -4 ;;
|
||||
"ipv6") procd_append_param command -6 ;;
|
||||
"ipv4_ipv6") procd_append_param command -4 -6 ;;
|
||||
"*") procd_append_param command -4 -6 ;;
|
||||
*) procd_append_param command -4 -6 ;;
|
||||
esac
|
||||
|
||||
if [ "$apn" != "" ]; then
|
||||
@ -505,7 +505,7 @@ stop_service()
|
||||
"ecm") stop_ecm ;;
|
||||
"rndis") stop_rndis ;;
|
||||
"ncm") stop_ncm ;;
|
||||
"*") stop_ecm ;;
|
||||
*) stop_ecm ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
@ -22,11 +22,36 @@ get_fibocom_mode()
|
||||
"30") mode="mbim" ;;
|
||||
"24") mode="rndis" ;;
|
||||
"18") mode='ncm' ;;
|
||||
"*") mode="$mode_num" ;;
|
||||
*) mode="$mode_num" ;;
|
||||
esac
|
||||
echo "$mode"
|
||||
}
|
||||
|
||||
#获取SIM卡状态
|
||||
get_fibocom_sim_status()
|
||||
{
|
||||
debug "检查SIM状态"
|
||||
local sim_status
|
||||
|
||||
local at_command="AT+CPIN?"
|
||||
local response=$(sh $current_dir/modem_at.sh $at_port $at_command)
|
||||
local sim_error=$(echo "$response" | grep "ERROR")
|
||||
if [ -n "$sim_error" ]; then
|
||||
debug "未插入SIM卡"
|
||||
sim_status="miss"
|
||||
return
|
||||
fi
|
||||
local sim_ready=$(echo "$response" | grep "READY")
|
||||
if [ -n "$sim_ready" ]; then
|
||||
debug "SIM卡正常"
|
||||
sim_status="ready"
|
||||
else
|
||||
debug "SIM卡被锁定"
|
||||
sim_status="locked"
|
||||
return
|
||||
fi
|
||||
echo "$sim_status"
|
||||
}
|
||||
|
||||
#基本信息
|
||||
fibocom_base_info()
|
||||
@ -62,13 +87,13 @@ fibocom_sim_info()
|
||||
#ISP(互联网服务提供商)
|
||||
local at_command="AT+COPS?"
|
||||
isp=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'"' '{print $2}')
|
||||
if [ "$isp" = "CHN-CMCC" ] || [ "$isp" = "CMCC" ]|| [ "$isp" = "46000" ]; then
|
||||
isp="中国移动"
|
||||
elif [ "$isp" = "CHN-UNICOM" ] || [ "$isp" = "UNICOM" ] || [ "$isp" = "46001" ]; then
|
||||
isp="中国联通"
|
||||
elif [ "$isp" = "CHN-CT" ] || [ "$isp" = "CT" ] || [ "$isp" = "46011" ]; then
|
||||
isp="中国电信"
|
||||
fi
|
||||
# if [ "$isp" = "CHN-CMCC" ] || [ "$isp" = "CMCC" ]|| [ "$isp" = "46000" ]; then
|
||||
# isp="中国移动"
|
||||
# elif [ "$isp" = "CHN-UNICOM" ] || [ "$isp" = "UNICOM" ] || [ "$isp" = "46001" ]; then
|
||||
# isp="中国联通"
|
||||
# elif [ "$isp" = "CHN-CT" ] || [ "$isp" = "CT" ] || [ "$isp" = "46011" ]; then
|
||||
# isp="中国电信"
|
||||
# fi
|
||||
|
||||
#IMEI
|
||||
at_command="AT+CGSN"
|
||||
@ -81,39 +106,235 @@ fibocom_sim_info()
|
||||
#ICCID
|
||||
at_command="AT+ICCID"
|
||||
iccid=$(sh $current_dir/modem_at.sh $at_port $at_command | grep -o "+ICCID:[ ]*[-0-9]\+" | grep -o "[-0-9]\{1,4\}")
|
||||
|
||||
|
||||
#SIM卡号码(手机号)
|
||||
at_command="AT+CNUM?"
|
||||
phone=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'"' '{print $2}')
|
||||
sim_number=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'"' '{print $2}')
|
||||
}
|
||||
|
||||
#网络信息
|
||||
fibocom_net_info()
|
||||
fibocom_network_info()
|
||||
{
|
||||
debug "Fibocom net info"
|
||||
debug "Fibocom network info"
|
||||
|
||||
#Network Type(网络类型)
|
||||
local at_command="AT+PSRAT?"
|
||||
net_type=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | sed 's/+PSRAT: //g' | sed 's/\r//g')
|
||||
network_type=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | sed 's/+PSRAT: //g' | sed 's/\r//g')
|
||||
|
||||
#CSQ
|
||||
local at_command="AT+CSQ"
|
||||
csq=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'[ ,]+' '{print $2}')
|
||||
if [ $CSQ = "99" ]; then
|
||||
csq=""
|
||||
fi
|
||||
# #CSQ
|
||||
# local at_command="AT+CSQ"
|
||||
# csq=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'[ ,]+' '{print $2}')
|
||||
# if [ $CSQ = "99" ]; then
|
||||
# csq=""
|
||||
# fi
|
||||
|
||||
#PER(信号强度)
|
||||
if [ -n "$csq" ]; then
|
||||
per=$(($csq * 100/31))"%"
|
||||
fi
|
||||
# #PER(信号强度)
|
||||
# if [ -n "$csq" ]; then
|
||||
# per=$(($csq * 100/31))"%"
|
||||
# fi
|
||||
|
||||
#RSSI(信号接收强度)
|
||||
if [ -n "$csq" ]; then
|
||||
rssi=$((2 * $csq - 113))" dBm"
|
||||
fi
|
||||
# #RSSI(信号接收强度)
|
||||
# if [ -n "$csq" ]; then
|
||||
# rssi=$((2 * $csq - 113))" dBm"
|
||||
# fi
|
||||
}
|
||||
|
||||
#获取上行带宽
|
||||
# $1:上行带宽数字
|
||||
get_ul_bandwidth()
|
||||
{
|
||||
local ul_bandwidth
|
||||
case $1 in
|
||||
"6") ul_bandwidth="1.4" ;;
|
||||
"15"|"25"|"50"|"75"|"100") ul_bandwidth=$(( $1 / 5 )) ;;
|
||||
esac
|
||||
echo "$ul_bandwidth"
|
||||
}
|
||||
|
||||
#获取下行带宽
|
||||
# $1:下行带宽数字
|
||||
get_dl_bandwidth()
|
||||
{
|
||||
local dl_bandwidth
|
||||
case $1 in
|
||||
"6") ul_bandwidth="1.4" ;;
|
||||
"15"|"25"|"50"|"75"|"100") ul_bandwidth=$(( $1 / 5 )) ;;
|
||||
esac
|
||||
echo "$dl_bandwidth"
|
||||
}
|
||||
|
||||
#获取NR下行带宽
|
||||
# $1:下行带宽数字
|
||||
get_nr_dl_bandwidth()
|
||||
{
|
||||
local nr_dl_bandwidth
|
||||
case $1 in
|
||||
"0") nr_dl_bandwidth="5" ;;
|
||||
"10"|"15"|"20"|"25"|"30"|"40"|"50"|"60"|"70"|"80"|"90"|"100"|"200"|"400") nr_dl_bandwidth="$1" ;;
|
||||
esac
|
||||
echo "$nr_dl_bandwidth"
|
||||
}
|
||||
|
||||
#获取参考信号接收功率
|
||||
# $1:网络类型
|
||||
# $2:参考信号接收功率数字
|
||||
get_rsrp()
|
||||
{
|
||||
local rsrp
|
||||
case $1 in
|
||||
"LTE") rsrp=$(($2-141)) ;;
|
||||
"NR") rsrp=$(($2-157)) ;;
|
||||
esac
|
||||
echo "$rsrp"
|
||||
}
|
||||
|
||||
#获取参考信号接收质量
|
||||
# $1:网络类型
|
||||
# $2:参考信号接收质量数字
|
||||
get_rsrq()
|
||||
{
|
||||
local rsrq
|
||||
case $1 in
|
||||
"LTE") rsrq=$(awk 'BEGIN{ printf "%.2f", $2 * 0.5 - 20 }' | sed 's/\.*0*$//') ;;
|
||||
"NR") rsrq=$(awk -v num="$2" 'BEGIN{ printf "%.2f", (num+1) * 0.5 - 44 }' | sed 's/\.*0*$//') ;;
|
||||
esac
|
||||
echo "$rsrq"
|
||||
}
|
||||
|
||||
#获取信号干扰比
|
||||
# $1:信号干扰比数字
|
||||
get_rssnr()
|
||||
{
|
||||
#去掉小数点后的0
|
||||
local rssnr=$(awk 'BEGIN{ printf "%.2f", $1 / 2 }' | sed 's/\.*0*$//')
|
||||
echo "$rssnr"
|
||||
}
|
||||
|
||||
#获取接收信号功率
|
||||
# $1:网络类型
|
||||
# $2:接收信号功率数字
|
||||
get_rxlev()
|
||||
{
|
||||
local rxlev
|
||||
case $1 in
|
||||
"WCDMA") rxlev=$(($2-121)) ;;
|
||||
"LTE") rxlev=$(($2-141)) ;;
|
||||
"NR") rxlev=$(($2-157)) ;;
|
||||
esac
|
||||
echo "$rxlev"
|
||||
}
|
||||
|
||||
|
||||
#网络信息
|
||||
fibocom_cell_info()
|
||||
{
|
||||
debug "Fibocom cell info"
|
||||
|
||||
#RSRQ,RSRP,SINR
|
||||
at_command='AT+GTCCINFO?'
|
||||
local response=$(sh $current_dir/modem_at.sh $at_port $at_command)
|
||||
local rat=$(echo "$response" | grep "service" | awk -F' ' '{print $1}')
|
||||
response=$(echo "$response" | sed -n '4p')
|
||||
case $rat in
|
||||
"NR")
|
||||
network_mode="NR5G-SA Mode"
|
||||
nr_mcc=$(echo "$response" | awk -F',' '{print $3}')
|
||||
nr_mnc=$(echo "$response" | awk -F',' '{print $4}')
|
||||
nr_tac=$(echo "$response" | awk -F',' '{print $5}')
|
||||
nr_cell_id=$(echo "$response" | awk -F',' '{print $6}')
|
||||
nr_arfcn=$(echo "$response" | awk -F',' '{print $7}')
|
||||
nr_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}')
|
||||
nr_band=$(echo "$response" | awk -F',' '{print $9}')
|
||||
nr_dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}')
|
||||
nr_dl_bandwidth=$(get_nr_dl_bandwidth $nr_dl_bandwidth_num)
|
||||
nr_sinr=$(echo "$response" | awk -F',' '{print $11}')
|
||||
nr_rxlev_num=$(echo "$response" | awk -F',' '{print $12}')
|
||||
nr_rxlev=$(get_rxlev "NR" $nr_rxlev_num)
|
||||
nr_rsrp_num=$(echo "$response" | awk -F',' '{print $13}')
|
||||
nr_rsrp=$(get_rsrp "NR" $nr_rsrp_num)
|
||||
nr_rsrq_num=$(echo "$response" | awk -F',' '{print $14}' | sed 's/\r//g')
|
||||
nr_rsrq=$(get_rsrq "NR" $nr_rsrq_num)
|
||||
;;
|
||||
"LTE-NR")
|
||||
network_mode="EN-DC Mode"
|
||||
#LTE
|
||||
endc_lte_mcc=$(echo "$response" | awk -F',' '{print $3}')
|
||||
endc_lte_mnc=$(echo "$response" | awk -F',' '{print $4}')
|
||||
endc_lte_tac=$(echo "$response" | awk -F',' '{print $5}')
|
||||
endc_lte_cell_id=$(echo "$response" | awk -F',' '{print $6}')
|
||||
endc_lte_earfcn=$(echo "$response" | awk -F',' '{print $7}')
|
||||
endc_lte_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}')
|
||||
endc_lte_band=$(echo "$response" | awk -F',' '{print $9}')
|
||||
ul_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}')
|
||||
endc_lte_ul_bandwidth=$(get_ul_bandwidth $ul_bandwidth_num)
|
||||
endc_lte_dl_bandwidth="$endc_lte_ul_bandwidth"
|
||||
endc_lte_rssnr_num=$(echo "$response" | awk -F',' '{print $11}')
|
||||
endc_lte_rssnr=$(get_rssnr $endc_lte_rssnr_num)
|
||||
endc_lte_rxlev_num=$(echo "$response" | awk -F',' '{print $12}')
|
||||
endc_lte_rxlev=$(get_rxlev "LTE" $endc_lte_rxlev_num)
|
||||
endc_lte_rsrp_num=$(echo "$response" | awk -F',' '{print $13}')
|
||||
endc_lte_rsrp=$(get_rsrp "LTE" $endc_lte_rsrp_num)
|
||||
endc_lte_rsrq_num=$(echo "$response" | awk -F',' '{print $14}' | sed 's/\r//g')
|
||||
endc_lte_rsrq=$(get_rsrq "LTE" $endc_lte_rsrq_num)
|
||||
#NR5G-NSA
|
||||
endc_nr_mcc=$(echo "$response" | awk -F',' '{print $3}')
|
||||
endc_nr_mnc=$(echo "$response" | awk -F',' '{print $4}')
|
||||
endc_nr_tac=$(echo "$response" | awk -F',' '{print $5}')
|
||||
endc_nr_cell_id=$(echo "$response" | awk -F',' '{print $6}')
|
||||
endc_nr_arfcn=$(echo "$response" | awk -F',' '{print $7}')
|
||||
endc_nr_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}')
|
||||
endc_nr_band=$(echo "$response" | awk -F',' '{print $9}')
|
||||
nr_dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}')
|
||||
endc_nr_dl_bandwidth=$(get_nr_dl_bandwidth $nr_dl_bandwidth_num)
|
||||
endc_nr_sinr=$(echo "$response" | awk -F',' '{print $11}')
|
||||
endc_nr_rxlev_num=$(echo "$response" | awk -F',' '{print $12}')
|
||||
endc_nr_rxlev=$(get_rxlev "NR" $endc_nr_rxlev_num)
|
||||
endc_nr_rsrp_num=$(echo "$response" | awk -F',' '{print $13}')
|
||||
endc_nr_rsrp=$(get_rsrp "NR" $endc_nr_rsrp_num)
|
||||
endc_nr_rsrq_num=$(echo "$response" | awk -F',' '{print $14}' | sed 's/\r//g')
|
||||
endc_nr_rsrq=$(get_rsrq "NR" $endc_nr_rsrq_num)
|
||||
;;
|
||||
"LTE"|"eMTC"|"NB-IoT")
|
||||
network_mode="LTE Mode"
|
||||
lte_mcc=$(echo "$response" | awk -F',' '{print $3}')
|
||||
lte_mnc=$(echo "$response" | awk -F',' '{print $4}')
|
||||
lte_tac=$(echo "$response" | awk -F',' '{print $5}')
|
||||
lte_cell_id=$(echo "$response" | awk -F',' '{print $6}')
|
||||
lte_earfcn=$(echo "$response" | awk -F',' '{print $7}')
|
||||
lte_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}')
|
||||
lte_band=$(echo "$response" | awk -F',' '{print $9}')
|
||||
ul_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}')
|
||||
lte_ul_bandwidth=$(get_ul_bandwidth $ul_bandwidth_num)
|
||||
lte_dl_bandwidth="$lte_ul_bandwidth"
|
||||
lte_rssnr=$(echo "$response" | awk -F',' '{print $11}')
|
||||
lte_rxlev_num=$(echo "$response" | awk -F',' '{print $12}')
|
||||
lte_rxlev=$(get_rxlev "LTE" $lte_rxlev_num)
|
||||
lte_rsrp_num=$(echo "$response" | awk -F',' '{print $13}')
|
||||
lte_rsrp=$(get_rsrp "LTE" $lte_rsrp_num)
|
||||
lte_rsrq_num=$(echo "$response" | awk -F',' '{print $14}' | sed 's/\r//g')
|
||||
lte_rsrq=$(get_rsrq "LTE" $lte_rsrq_num)
|
||||
;;
|
||||
"WCDMA"|"UMTS")
|
||||
network_mode="WCDMA Mode"
|
||||
wcdma_mcc=$(echo "$response" | awk -F',' '{print $3}')
|
||||
wcdma_mnc=$(echo "$response" | awk -F',' '{print $4}')
|
||||
wcdma_lac=$(echo "$response" | awk -F',' '{print $5}')
|
||||
wcdma_cell_id=$(echo "$response" | awk -F',' '{print $6}')
|
||||
wcdma_uarfcn=$(echo "$response" | awk -F',' '{print $7}')
|
||||
wcdma_psc=$(echo "$response" | awk -F',' '{print $8}')
|
||||
wcdma_band=$(echo "$response" | awk -F',' '{print $9}')
|
||||
wcdma_ecno=$(echo "$response" | awk -F',' '{print $10}')
|
||||
wcdma_rscp=$(echo "$response" | awk -F',' '{print $11}')
|
||||
wcdma_rac=$(echo "$response" | awk -F',' '{print $12}')
|
||||
wcdma_rxlev_num=$(echo "$response" | awk -F',' '{print $13}')
|
||||
wcdma_rxlev=$(get_rxlev "WCDMA" $wcdma_rxlev_num)
|
||||
wcdma_reserved=$(echo "$response" | awk -F',' '{print $14}')
|
||||
wcdma_ecio=$(echo "$response" | awk -F',' '{print $15}' | sed 's/\r//g')
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
# fibocom获取基站信息
|
||||
Fibocom_Cellinfo()
|
||||
{
|
||||
@ -255,10 +476,19 @@ get_fibocom_info()
|
||||
|
||||
#基本信息
|
||||
fibocom_base_info
|
||||
|
||||
#获取SIM状态
|
||||
sim_status=$(get_fibocom_sim_status)
|
||||
if [ "$sim_status" != "ready" ];then
|
||||
return
|
||||
fi
|
||||
|
||||
#SIM卡信息
|
||||
fibocom_sim_info
|
||||
#网络信息
|
||||
fibocom_net_info
|
||||
fibocom_network_info
|
||||
#小区信息
|
||||
fibocom_cell_info
|
||||
|
||||
return
|
||||
# Fibocom_Cellinfo
|
||||
|
@ -50,10 +50,10 @@ get_mode()
|
||||
"quectel") mode=$(get_quectel_mode "$2") ;;
|
||||
"fibocom") mode=$(get_fibocom_mode "$2") ;;
|
||||
"simcom") mode=$(get_simcom_mode "$2") ;;
|
||||
"*")
|
||||
*)
|
||||
debug "未适配该模块"
|
||||
mode="unknown"
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
echo "$mode"
|
||||
}
|
@ -13,72 +13,295 @@ init_modem_info()
|
||||
manufacturer='' #制造商
|
||||
revision='-' #固件版本
|
||||
at_port='-' #AT串口
|
||||
mode='' #拨号模式
|
||||
mode='unknown' #拨号模式
|
||||
temperature="NaN $(printf "\xc2\xb0")C" #温度
|
||||
update_time='' #更新时间
|
||||
|
||||
#SIM卡信息
|
||||
isp="-" #运营商(互联网服务提供商)
|
||||
imei='-' #IMEI
|
||||
imsi='-' #IMSI
|
||||
iccid='-' #ICCID
|
||||
phone='-' #SIM卡号码(手机号)
|
||||
sim_status="miss" #SIM卡状态
|
||||
isp="-" #运营商(互联网服务提供商)
|
||||
imei='-' #IMEI
|
||||
imsi='-' #IMSI
|
||||
iccid='-' #ICCID
|
||||
sim_number='-' #SIM卡号码(手机号)
|
||||
|
||||
#网络信息
|
||||
network_type="-" #蜂窝网络类型
|
||||
|
||||
#小区信息
|
||||
network_mode="-" #网络模式
|
||||
#NR5G-SA模式
|
||||
nr_mcc=''
|
||||
nr_mnc=''
|
||||
nr_duplex_mode=''
|
||||
nr_cell_id=''
|
||||
nr_physical_cell_id=''
|
||||
nr_tac=''
|
||||
nr_arfcn=''
|
||||
nr_band=''
|
||||
nr_dl_bandwidth=''
|
||||
nr_rsrp=''
|
||||
nr_rsrq=''
|
||||
nr_sinr=''
|
||||
nr_scs=''
|
||||
nr_rxlev=''
|
||||
#EN-DC模式(LTE)
|
||||
endc_lte_mcc=''
|
||||
endc_lte_mnc=''
|
||||
endc_lte_duplex_mode=''
|
||||
endc_lte_cell_id=''
|
||||
endc_lte_physical_cell_id=''
|
||||
endc_lte_earfcn=''
|
||||
endc_lte_freq_band_ind=''
|
||||
endc_lte_ul_bandwidth=''
|
||||
endc_lte_dl_bandwidth=''
|
||||
endc_lte_tac=''
|
||||
endc_lte_rsrp=''
|
||||
endc_lte_rsrq=''
|
||||
endc_lte_rssi=''
|
||||
endc_lte_sinr=''
|
||||
endc_lte_cql=''
|
||||
endc_lte_tx_power=''
|
||||
endc_lte_rxlev=''
|
||||
#EN-DC模式(NR5G-NSA)
|
||||
endc_nr_mcc=''
|
||||
endc_nr_mnc=''
|
||||
endc_nr_physical_cell_id=''
|
||||
endc_nr_arfcn=''
|
||||
endc_nr_band=''
|
||||
endc_nr_dl_bandwidth=''
|
||||
endc_nr_rsrp=''
|
||||
endc_nr_rsrq=''
|
||||
endc_nr_sinr=''
|
||||
endc_nr_scs=''
|
||||
#LTE模式
|
||||
lte_mcc=''
|
||||
lte_mnc=''
|
||||
lte_duplex_mode=''
|
||||
lte_cell_id=''
|
||||
lte_physical_cell_id=''
|
||||
lte_earfcn=''
|
||||
lte_freq_band_ind=''
|
||||
lte_ul_bandwidth=''
|
||||
lte_dl_bandwidth=''
|
||||
lte_tac=''
|
||||
lte_rsrp=''
|
||||
lte_rsrq=''
|
||||
lte_rssi=''
|
||||
lte_sinr=''
|
||||
lte_cql=''
|
||||
lte_tx_power=''
|
||||
lte_rxlev=''
|
||||
#WCDMA模式
|
||||
wcdma_mcc=''
|
||||
wcdma_mnc=''
|
||||
wcdma_lac=''
|
||||
wcdma_cell_id=''
|
||||
wcdma_uarfcn=''
|
||||
wcdma_psc=''
|
||||
wcdma_rac=''
|
||||
wcdma_rscp=''
|
||||
wcdma_ecio=''
|
||||
wcdma_phych=''
|
||||
wcdma_sf=''
|
||||
wcdma_slot=''
|
||||
wcdma_speech_code=''
|
||||
wcdma_com_mod=''
|
||||
|
||||
#信号信息
|
||||
net_type="-" #蜂窝网络类型
|
||||
csq="" #CSQ
|
||||
per="" #信号强度
|
||||
rssi="" #信号接收强度 RSSI
|
||||
ECIO="-" #参考信号接收质量 RSRQ ecio
|
||||
ECIO1=" " #参考信号接收质量 RSRQ ecio1
|
||||
ecio="-" #参考信号接收质量 RSRQ ecio
|
||||
ecio1=" " #参考信号接收质量 RSRQ ecio1
|
||||
RSCP="-" #参考信号接收功率 RSRP rscp0
|
||||
RSCP1=" " #参考信号接收功率 RSRP rscp1
|
||||
SINR="-" #信噪比 SINR rv["sinr"]
|
||||
NETMODE="-" #连接状态监控 rv["netmode"]
|
||||
|
||||
#基站信息
|
||||
MCC=""
|
||||
mcc="-"
|
||||
mnc="-"
|
||||
eNBID=""
|
||||
TAC=""
|
||||
cell_id=""
|
||||
LBAND="-" #频段
|
||||
CHANNEL="-" #频点
|
||||
channel="-" #频点
|
||||
PCI="-" #物理小区标识
|
||||
qos="" #最大Qos级别
|
||||
}
|
||||
|
||||
#保存模块数据
|
||||
info_to_json()
|
||||
#获取基本信息
|
||||
get_base_info()
|
||||
{
|
||||
modem_info="{
|
||||
base_info="\"base_info\":{
|
||||
\"manufacturer\":\"$manufacturer\",
|
||||
\"revision\":\"$revision\",
|
||||
\"at_port\":\"$at_port\",
|
||||
\"mode\":\"$mode\",
|
||||
\"temperature\":\"$temperature\",
|
||||
\"update_time\":\"$update_time\",
|
||||
\"update_time\":\"$update_time\"
|
||||
},"
|
||||
}
|
||||
|
||||
#获取SIM卡信息
|
||||
get_sim_info()
|
||||
{
|
||||
sim_info="\"sim_info\":{
|
||||
\"isp\":\"$isp\",
|
||||
\"imei\":\"$imei\",
|
||||
\"imsi\":\"$imsi\",
|
||||
\"iccid\":\"$iccid\",
|
||||
\"phone\":\"$phone\",
|
||||
\"sim_number\":\"$sim_number\"
|
||||
},"
|
||||
}
|
||||
|
||||
\"net_type\":\"$net_type\",
|
||||
\"csq\":\"$csq\",
|
||||
\"per\":\"$per\",
|
||||
\"rssi\":\"$rssi\"
|
||||
#获取网络信息
|
||||
get_network_info()
|
||||
{
|
||||
network_info="\"network_info\":{
|
||||
\"network_type\":\"$network_type\"
|
||||
},"
|
||||
}
|
||||
|
||||
|
||||
}"
|
||||
#获取信号信息
|
||||
get_cell_info()
|
||||
{
|
||||
if [ "$network_mode" = "NR5G-SA Mode" ]; then
|
||||
cell_info="\"cell_info\":{
|
||||
\"NR5G-SA Mode\":[
|
||||
{\"MCC\":\"$nr_mcc\", \"full_name\":\"Mobile Country Code\"},
|
||||
{\"MNC\":\"$nr_mnc\", \"full_name\":\"Mobile Network Code\"},
|
||||
{\"Duplex Mode\":\"$nr_duplex_mode\", \"full_name\":\"Duplex Mode\"},
|
||||
{\"Cell ID\":\"$nr_cell_id\", \"full_name\":\"Cell ID\"},
|
||||
{\"Physical Cell ID\":\"$nr_physical_cell_id\", \"full_name\":\"Physical Cell ID\"},
|
||||
{\"TAC\":\"$nr_tac\", \"full_name\":\"Tracking area code of cell servedby neighbor Enb\"},
|
||||
{\"ARFCN\":\"$nr_arfcn\", \"full_name\":\"Absolute Radio-Frequency Channel Number\"},
|
||||
{\"Band\":\"$nr_band\", \"full_name\":\"Band\"},
|
||||
{\"DL Bandwidth\":\"$nr_dl_bandwidth\", \"full_name\":\"DL Bandwidth\"},
|
||||
{\"RSRP\":\"$nr_rsrp\", \"full_name\":\"Reference Signal Received Power\"},
|
||||
{\"RSRQ\":\"$nr_rsrq\", \"full_name\":\"Reference Signal Received Quality\"},
|
||||
{\"SINR\":\"$nr_sinr\", \"full_name\":\"Signal to Interference plus Noise Ratio Bandwidth\"},
|
||||
{\"SCS\":\"$nr_scs\", \"full_name\":\"SCS\"},
|
||||
{\"RxLev\":\"$nr_rxlev\", \"full_name\":\"Received Signal Level\"}
|
||||
]
|
||||
}"
|
||||
elif [ "$network_mode" = "EN-DC Mode" ]; then
|
||||
cell_info="\"cell_info\":{
|
||||
\"EN-DC Mode\":[
|
||||
{\"LTE\":[
|
||||
{\"MCC\":\"$endc_lte_mcc\", \"full_name\":\"Mobile Country Code\"},
|
||||
{\"MNC\":\"$endc_lte_mnc\", \"full_name\":\"Mobile Network Code\"},
|
||||
{\"Duplex Mode\":\"$endc_lte_duplex_mode\", \"full_name\":\"Duplex Mode\"},
|
||||
{\"Cell ID\":\"$endc_lte_cell_id\", \"full_name\":\"Cell ID\"},
|
||||
{\"Physical Cell ID\":\"$endc_lte_physical_cell_id\", \"full_name\":\"Physical Cell ID\"},
|
||||
{\"EARFCN\":\"$endc_lte_earfcn\", \"full_name\":\"E-UTRA Absolute Radio Frequency Channel Number\"},
|
||||
{\"Freq band indicator\":\"$endc_lte_freq_band_ind\", \"full_name\":\"Freq band indicator\"},
|
||||
{\"UL Bandwidth\":\"$endc_lte_ul_bandwidth\", \"full_name\":\"UL Bandwidth\"},
|
||||
{\"DL Bandwidth\":\"$endc_lte_dl_bandwidth\", \"full_name\":\"DL Bandwidth\"},
|
||||
{\"TAC\":\"$endc_lte_tac\", \"full_name\":\"Tracking area code of cell servedby neighbor Enb\"},
|
||||
{\"RSRP\":\"$endc_lte_rsrp\", \"full_name\":\"Reference Signal Received Power\"},
|
||||
{\"RSRQ\":\"$endc_lte_rsrq\", \"full_name\":\"Reference Signal Received Quality\"},
|
||||
{\"RSSI\":\"$endc_lte_rssi\", \"full_name\":\"Received Signal Strength Indicator\"},
|
||||
{\"SINR\":\"$endc_lte_sinr\", \"full_name\":\"Signal to Interference plus Noise Ratio Bandwidth\"},
|
||||
{\"RSSNR\":\"$endc_lte_rssnr\", \"full_name\":\"Radio Signal Strength Noise Ratio\"},
|
||||
{\"CQI\":\"$endc_lte_cql\", \"full_name\":\"Channel Quality Indicator\"},
|
||||
{\"TX Power\":\"$endc_lte_tx_power\", \"full_name\":\"TX Power\"},
|
||||
{\"RxLev\":\"$endc_lte_rxlev\", \"full_name\":\"Received Signal Level\"}
|
||||
]
|
||||
},
|
||||
|
||||
{\"NR5G-NSA\":[
|
||||
{\"MCC\":\"$endc_nr_mcc\", \"full_name\":\"Mobile Country Code\"},
|
||||
{\"MNC\":\"$endc_nr_mnc\", \"full_name\":\"Mobile Network Code\"},
|
||||
{\"Physical Cell ID\":\"$endc_nr_physical_cell_id\", \"full_name\":\"Physical Cell ID\"},
|
||||
{\"ARFCN\":\"$endc_nr_arfcn\", \"full_name\":\"Absolute Radio-Frequency Channel Number\"},
|
||||
{\"Band\":\"$endc_nr_band\", \"full_name\":\"Band\"},
|
||||
{\"DL Bandwidth\":\"$endc_nr_dl_bandwidth\", \"full_name\":\"DL Bandwidth\"},
|
||||
{\"RSRP\":\"$endc_nr_rsrp\", \"full_name\":\"Reference Signal Received Power\"},
|
||||
{\"RSRQ\":\"$endc_nr_rsrq\", \"full_name\":\"Reference Signal Received Quality\"},
|
||||
{\"SINR\":\"$endc_nr_sinr\", \"full_name\":\"Signal to Interference plus Noise Ratio Bandwidth\"},
|
||||
{\"SCS\":\"$endc_nr_scs\", \"full_name\":\"SCS\"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}"
|
||||
elif [ "$network_mode" = "LTE Mode" ]; then
|
||||
cell_info="\"cell_info\":{
|
||||
\"LTE Mode\":[
|
||||
{\"MCC\":\"$lte_mcc\", \"full_name\":\"Mobile Country Code\"},
|
||||
{\"MNC\":\"$lte_mnc\", \"full_name\":\"Mobile Network Code\"},
|
||||
{\"Duplex Mode\":\"$lte_duplex_mode\", \"full_name\":\"Duplex Mode\"},
|
||||
{\"Cell ID\":\"$lte_cell_id\", \"full_name\":\"Cell ID\"},
|
||||
{\"Physical Cell ID\":\"$lte_physical_cell_id\", \"full_name\":\"Physical Cell ID\"},
|
||||
{\"EARFCN\":\"$lte_earfcn\", \"full_name\":\"E-UTRA Absolute Radio Frequency Channel Number\"},
|
||||
{\"Freq band indicator\":\"$lte_freq_band_ind\", \"full_name\":\"Freq band indicator\"},
|
||||
{\"UL Bandwidth\":\"$lte_ul_bandwidth\", \"full_name\":\"UL Bandwidth\"},
|
||||
{\"DL Bandwidth\":\"$lte_dl_bandwidth\", \"full_name\":\"DL Bandwidth\"},
|
||||
{\"TAC\":\"$lte_tac\", \"full_name\":\"Tracking area code of cell servedby neighbor Enb\"},
|
||||
{\"RSRP\":\"$lte_rsrp\", \"full_name\":\"Reference Signal Received Power\"},
|
||||
{\"RSRQ\":\"$lte_rsrq\", \"full_name\":\"Reference Signal Received Quality\"},
|
||||
{\"RSSI\":\"$lte_rssi\", \"full_name\":\"Received Signal Strength Indicator\"},
|
||||
{\"SINR\":\"$lte_sinr\", \"full_name\":\"Signal to Interference plus Noise Ratio Bandwidth\"},
|
||||
{\"RSSNR\":\"$lte_rssnr\", \"full_name\":\"Radio Signal Strength Noise Ratio\"},
|
||||
{\"CQI\":\"$lte_cql\", \"full_name\":\"Channel Quality Indicator\"},
|
||||
{\"TX Power\":\"$lte_tx_power\", \"full_name\":\"TX Power\"},
|
||||
{\"RxLev\":\"$lte_rxlev\", \"full_name\":\"RxLev\"}
|
||||
]
|
||||
}"
|
||||
elif [ "$network_mode" = "WCDMA Mode" ]; then
|
||||
cell_info="\"cell_info\":{
|
||||
\"WCDMA Mode\":[
|
||||
{\"MCC\":\"$wcdma_mcc\", \"full_name\":\"Mobile Country Code\"},
|
||||
{\"MNC\":\"$wcdma_mnc\", \"full_name\":\"Mobile Network Code\"},
|
||||
{\"LAC\":\"$wcdma_lac\", \"full_name\":\"Location Area Code\"},
|
||||
{\"Cell ID\":\"$wcdma_cell_id\", \"full_name\":\"Cell ID\"},
|
||||
{\"UARFCN\":\"$wcdma_uarfcn\", \"full_name\":\"UTRA Absolute Radio Frequency Channel Number\"},
|
||||
{\"PSC\":\"$wcdma_psc\", \"full_name\":\"Primary Scrambling Code\"},
|
||||
{\"RAC\":\"$wcdma_rac\", \"full_name\":\"Routing Area Code\"},
|
||||
{\"RSCP\":\"$wcdma_rscp\", \"full_name\":\"Received Signal Code Power\"},
|
||||
{\"Ec/Io\":\"$wcdma_ecio\", \"full_name\":\"Ec/Io\"},
|
||||
{\"Ec/No\":\"$wcdma_ecno\", \"full_name\":\"Ec/No\"},
|
||||
{\"Physical Channel\":\"$wcdma_phych\", \"full_name\":\"Physical Channel\"},
|
||||
{\"Spreading Factor\":\"$wcdma_sf\", \"full_name\":\"Spreading Factor\"},
|
||||
{\"Slot\":\"$wcdma_slot\", \"full_name\":\"Slot\"},
|
||||
{\"Speech Code\":\"$wcdma_speech_code\", \"full_name\":\"Speech Code\"},
|
||||
{\"Compression Mode\":\"$wcdma_com_mod\", \"full_name\":\"Compression Mode\"},
|
||||
{\"RxLev\":\"$wcdma_rxlev\", \"full_name\":\"RxLev\"}
|
||||
]
|
||||
}"
|
||||
fi
|
||||
}
|
||||
|
||||
#以Json格式保存模组信息
|
||||
info_to_json()
|
||||
{
|
||||
base_info="\"base_info\":{},"
|
||||
sim_info="\"sim_info\":{},"
|
||||
network_info="\"network_info\":{},"
|
||||
cell_info="\"cell_info\":{}"
|
||||
|
||||
#获取基本信息
|
||||
get_base_info
|
||||
|
||||
if [ "$sim_status" = "ready" ];then
|
||||
#获取SIM卡信息
|
||||
get_sim_info
|
||||
#获取网络信息
|
||||
get_network_info
|
||||
#获取小区信息
|
||||
get_cell_info
|
||||
fi
|
||||
|
||||
#拼接所有信息(不要漏掉最后一个})
|
||||
modem_info="{$base_info$modem_info$sim_info$network_info$cell_info}"
|
||||
}
|
||||
# echo $ECIO #参考信号接收质量 RSRQ ecio
|
||||
# echo $ECIO1 #参考信号接收质量 RSRQ ecio1
|
||||
# echo $RSCP #参考信号接收功率 RSRP rscp0
|
||||
# echo $RSCP1 #参考信号接收功率 RSRP rscp1
|
||||
# echo $SINR #信噪比 SINR rv["sinr"]
|
||||
# echo $NETMODE #连接状态监控 rv["netmode"]
|
||||
# echo '---------------------------------'
|
||||
|
||||
# #基站信息
|
||||
# echo $COPS_MCC #MCC
|
||||
# echo $$COPS_MNC #MNC
|
||||
@ -89,7 +312,7 @@ info_to_json()
|
||||
# echo $CID
|
||||
# echo '' #CID_NUM
|
||||
# echo $LBAND
|
||||
# echo $CHANNEL
|
||||
# echo $channel
|
||||
# echo $PCI
|
||||
# echo $MODTYPE
|
||||
# echo $QTEMP
|
||||
@ -99,37 +322,20 @@ get_modem_info()
|
||||
{
|
||||
update_time=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
|
||||
debug "检查模块的AT串口"
|
||||
debug "检查模组的AT串口"
|
||||
#获取模块AT串口
|
||||
if [ -z "$at_port" ]; then
|
||||
debug "模块0没有找到AT串口"
|
||||
debug "模组没有AT串口"
|
||||
return
|
||||
fi
|
||||
|
||||
debug "检查SIM状态"
|
||||
local sim_status=$(echo `sh $current_dir/modem_at.sh $at_port "AT+CPIN?"`)
|
||||
local sim_error=$(echo "$sim_status" | grep "ERROR")
|
||||
if [ -n "$sim_error" ]; then
|
||||
debug "未插入SIM卡"
|
||||
sleep 1s
|
||||
return
|
||||
fi
|
||||
local sim_ready=$(echo "$sim_status" | grep "READY")
|
||||
if [ -n "$sim_ready" ]; then
|
||||
debug "SIM卡正常"
|
||||
else
|
||||
debug "SIM卡被锁定"
|
||||
sleep 1s
|
||||
return
|
||||
fi
|
||||
|
||||
debug "根据模块类型开始采集数据"
|
||||
debug "根据模组的制造商获取信息"
|
||||
#更多信息获取
|
||||
case $manufacturer in
|
||||
"quectel") get_quectel_info $at_port ;;
|
||||
"fibocom") get_fibocom_info $at_port ;;
|
||||
"simcom") get_simcom_info $at_port ;;
|
||||
"*") debug "未适配该模块" ;;
|
||||
*) debug "未适配该模组" ;;
|
||||
esac
|
||||
|
||||
#获取更新时间
|
||||
|
@ -126,11 +126,19 @@ setModemInfoConfig()
|
||||
if [ "$data_interface" = "$data_interface_info" ]; then
|
||||
#获取模块名
|
||||
local modem_name=$(echo "$line_context" | cut -d ";" -f 2)
|
||||
#获取AT命令返回的内容
|
||||
local at_result=$(echo `sh $current_dir/modem_at.sh $2 "ATI" | sed -n '3p' | tr 'A-Z' 'a-z'`)
|
||||
|
||||
local at_result
|
||||
if [ "$modem_name" != "unknown" ]; then
|
||||
#获取AT命令返回的内容
|
||||
at_result=$(echo `sh $current_dir/modem_at.sh $2 "ATI" | sed -n '3p' | tr 'A-Z' 'a-z'`)
|
||||
else
|
||||
#数据库中没有此模块的信息,使用默认值
|
||||
at_result="unknown"
|
||||
fi
|
||||
|
||||
if [[ "$at_result" = *"$modem_name"* ]]; then
|
||||
#设置模块名
|
||||
uci set modem.modem$1.name="$modem_name"
|
||||
uci set modem.modem$1.name="$modem_name"
|
||||
|
||||
#设置制造商
|
||||
local manufacturer=$(echo "$line_context" | cut -d ";" -f 1)
|
||||
@ -152,22 +160,22 @@ setModemInfoConfig()
|
||||
break
|
||||
fi
|
||||
|
||||
#数据库中没有此模块的信息,使用默认值
|
||||
if [ $i -ge $(($line_count-1)) ]; then
|
||||
# #数据库中没有此模块的信息,使用默认值
|
||||
# if [ $i -ge $(($line_count-1)) ]; then
|
||||
|
||||
#设置模块名
|
||||
uci set modem.modem$1.name="$modem_name"
|
||||
#设置制造商
|
||||
local manufacturer=$(echo "$line_context" | cut -d ";" -f 1)
|
||||
uci set modem.modem$1.manufacturer="$manufacturer"
|
||||
#删除原来的拨号模式列表
|
||||
uci -q del modem.modem$1.modes
|
||||
#添加新的拨号模式列表
|
||||
for mode in $modes; do
|
||||
uci add_list modem.modem$1.modes="$mode"
|
||||
done
|
||||
break
|
||||
fi
|
||||
# #设置模块名
|
||||
# uci set modem.modem$1.name="$modem_name"
|
||||
# #设置制造商
|
||||
# local manufacturer=$(echo "$line_context" | cut -d ";" -f 1)
|
||||
# uci set modem.modem$1.manufacturer="$manufacturer"
|
||||
# #删除原来的拨号模式列表
|
||||
# uci -q del modem.modem$1.modes
|
||||
# #添加新的拨号模式列表
|
||||
# for mode in $modes; do
|
||||
# uci add_list modem.modem$1.modes="$mode"
|
||||
# done
|
||||
# break
|
||||
# fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -7,4 +7,4 @@ fibocom;fm150-ae;usb;qmi,gobinet,ecm,mbim,rndis,ncm
|
||||
fibocom;fm150-ae;pcie;qmi
|
||||
fibocom;fm160-cn;usb;qmi,gobinet,ecm,mbim,rndis,ncm
|
||||
unknown;unknown;usb;qmi,gobinet,ecm,mbim,rndis,ncm
|
||||
unknown;unknown;pcie;qmi,gobinet,mbim
|
||||
unknown;unknown;pcie;qmi,gobinet,mbim
|
||||
|
@ -65,7 +65,7 @@ modem_network_task()
|
||||
case "$4" in
|
||||
"ecm") ecm_dial $at_port $3 ;;
|
||||
"gobinet") gobinet_dial $at_port $3 ;;
|
||||
"*") ecm_dial $at_port $3 ;;
|
||||
*) ecm_dial $at_port $3 ;;
|
||||
esac
|
||||
fi
|
||||
debug "结束网络连接检查任务"
|
||||
|
@ -17,11 +17,37 @@ get_quectel_mode()
|
||||
"2") mode="mbim" ;;
|
||||
"3") mode="rndis" ;;
|
||||
"5") mode='ncm' ;;
|
||||
"*") mode="$mode_num" ;;
|
||||
*) mode="$mode_num" ;;
|
||||
esac
|
||||
echo "$mode"
|
||||
}
|
||||
|
||||
#获取SIM卡状态
|
||||
get_quectel_sim_status()
|
||||
{
|
||||
debug "检查SIM状态"
|
||||
local sim_status
|
||||
|
||||
local at_command="AT+CPIN?"
|
||||
local response=$(sh $current_dir/modem_at.sh $at_port $at_command)
|
||||
local sim_error=$(echo "$response" | grep "ERROR")
|
||||
if [ -n "$sim_error" ]; then
|
||||
debug "未插入SIM卡"
|
||||
sim_status="miss"
|
||||
return
|
||||
fi
|
||||
local sim_ready=$(echo "$response" | grep "READY")
|
||||
if [ -n "$sim_ready" ]; then
|
||||
debug "SIM卡正常"
|
||||
sim_status="ready"
|
||||
else
|
||||
debug "SIM卡被锁定"
|
||||
sim_status="locked"
|
||||
return
|
||||
fi
|
||||
echo "$sim_status"
|
||||
}
|
||||
|
||||
#基本信息
|
||||
quectel_base_info()
|
||||
{
|
||||
@ -70,15 +96,15 @@ quectel_sim_info()
|
||||
#ISP(互联网服务提供商)
|
||||
local at_command="AT+COPS?"
|
||||
isp=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'"' '{print $2}')
|
||||
if [ "$isp" = "CHN-CMCC" ] || [ "$isp" = "CMCC" ]|| [ "$isp" = "46000" ]; then
|
||||
isp="中国移动"
|
||||
# elif [ "$isp" = "CHN-UNICOM" ] || [ "$isp" = "UNICOM" ] || [ "$isp" = "46001" ]; then
|
||||
elif [ "$isp" = "CHN-UNICOM" ] || [ "$isp" = "CUCC" ] || [ "$isp" = "46001" ]; then
|
||||
isp="中国联通"
|
||||
# elif [ "$isp" = "CHN-CT" ] || [ "$isp" = "CT" ] || [ "$isp" = "46011" ]; then
|
||||
elif [ "$isp" = "CHN-TELECOM" ] || [ "$isp" = "CTCC" ] || [ "$isp" = "46011" ]; then
|
||||
isp="中国电信"
|
||||
fi
|
||||
# if [ "$isp" = "CHN-CMCC" ] || [ "$isp" = "CMCC" ]|| [ "$isp" = "46000" ]; then
|
||||
# isp="中国移动"
|
||||
# # elif [ "$isp" = "CHN-UNICOM" ] || [ "$isp" = "UNICOM" ] || [ "$isp" = "46001" ]; then
|
||||
# elif [ "$isp" = "CHN-UNICOM" ] || [ "$isp" = "CUCC" ] || [ "$isp" = "46001" ]; then
|
||||
# isp="中国联通"
|
||||
# # elif [ "$isp" = "CHN-CT" ] || [ "$isp" = "CT" ] || [ "$isp" = "46011" ]; then
|
||||
# elif [ "$isp" = "CHN-TELECOM" ] || [ "$isp" = "CTCC" ] || [ "$isp" = "46011" ]; then
|
||||
# isp="中国电信"
|
||||
# fi
|
||||
|
||||
#IMEI
|
||||
at_command="AT+CGSN"
|
||||
@ -94,21 +120,21 @@ quectel_sim_info()
|
||||
|
||||
#SIM卡号码(手机号)
|
||||
at_command="AT+CNUM"
|
||||
phone=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'"' '{print $4}')
|
||||
sim_number=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'"' '{print $4}')
|
||||
}
|
||||
|
||||
#网络信息
|
||||
quectel_net_info()
|
||||
quectel_network_info()
|
||||
{
|
||||
debug "Quectel net info"
|
||||
debug "Quectel network info"
|
||||
|
||||
#Network Type(网络类型)
|
||||
# local at_command="AT+COPS?"
|
||||
local at_command="AT+QNWINFO"
|
||||
net_type=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'"' '{print $2}')
|
||||
network_type=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'"' '{print $2}')
|
||||
|
||||
#CSQ
|
||||
local at_command="AT+CSQ"
|
||||
at_command="AT+CSQ"
|
||||
csq=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'[ ,]+' '{print $2}')
|
||||
if [ $CSQ = "99" ]; then
|
||||
csq=""
|
||||
@ -125,31 +151,345 @@ quectel_net_info()
|
||||
fi
|
||||
}
|
||||
|
||||
#quectel
|
||||
lte_bw() {
|
||||
BW=$(echo $BW | grep -o "[0-5]\{1\}")
|
||||
case $BW in
|
||||
"0")
|
||||
BW="1.4" ;;
|
||||
"1")
|
||||
BW="3" ;;
|
||||
"2"|"3"|"4"|"5")
|
||||
BW=$((($(echo $BW) - 1) * 5)) ;;
|
||||
#UL_bandwidth
|
||||
# $1:上行带宽数字
|
||||
get_lte_ul_bandwidth()
|
||||
{
|
||||
local ul_bandwidth
|
||||
case $1 in
|
||||
"0") ul_bandwidth="1.4" ;;
|
||||
"1") ul_bandwidth="3" ;;
|
||||
"2"|"3"|"4"|"5") ul_bandwidth=$((($1 - 1) * 5)) ;;
|
||||
esac
|
||||
echo "$ul_bandwidth"
|
||||
}
|
||||
#quectel
|
||||
nr_bw() {
|
||||
BW=$(echo $BW | grep -o "[0-9]\{1,2\}")
|
||||
case $BW in
|
||||
"0"|"1"|"2"|"3"|"4"|"5")
|
||||
BW=$((($(echo $BW) + 1) * 5)) ;;
|
||||
"6"|"7"|"8"|"9"|"10"|"11"|"12")
|
||||
BW=$((($(echo $BW) - 2) * 10)) ;;
|
||||
"13")
|
||||
BW="200" ;;
|
||||
"14")
|
||||
BW="400" ;;
|
||||
|
||||
#DL_bandwidth
|
||||
# $1:下行带宽数字
|
||||
get_lte_dl_bandwidth()
|
||||
{
|
||||
local dl_bandwidth
|
||||
case $1 in
|
||||
"0") dl_bandwidth="1.4" ;;
|
||||
"1") dl_bandwidth="3" ;;
|
||||
"2"|"3"|"4"|"5") dl_bandwidth=$((($1 - 1) * 5)) ;;
|
||||
esac
|
||||
echo "$dl_bandwidth"
|
||||
}
|
||||
|
||||
#NR_DL_bandwidth
|
||||
# $1:下行带宽数字
|
||||
get_nr_dl_bandwidth()
|
||||
{
|
||||
local nr_dl_bandwidth
|
||||
case $1 in
|
||||
"0"|"1"|"2"|"3"|"4"|"5") nr_dl_bandwidth=$((($1 + 1) * 5)) ;;
|
||||
"6"|"7"|"8"|"9"|"10"|"11"|"12") nr_dl_bandwidth=$((($1 - 2) * 10)) ;;
|
||||
"13") nr_dl_bandwidth="200" ;;
|
||||
"14") nr_dl_bandwidth="400" ;;
|
||||
esac
|
||||
echo "$nr_dl_bandwidth"
|
||||
}
|
||||
|
||||
#scs
|
||||
# $1:NR子载波间隔数字
|
||||
get_scs()
|
||||
{
|
||||
local scs
|
||||
case $1 in
|
||||
"0") scs="15" ;;
|
||||
"1") scs="30" ;;
|
||||
"2") scs="60" ;;
|
||||
"3") scs="120" ;;
|
||||
"4") scs="240" ;;
|
||||
esac
|
||||
echo "$scs"
|
||||
}
|
||||
|
||||
#小区信息
|
||||
quectel_cell_info()
|
||||
{
|
||||
debug "Quectel cell info"
|
||||
|
||||
local at_command='AT+QENG="servingcell"'
|
||||
local response=$(sh $current_dir/modem_at.sh $at_port $at_command)
|
||||
|
||||
local lte=$(echo "$response" | grep "+QENG: \"LTE\"")
|
||||
local nr5g_nsa=$(echo "$response" | grep "+QENG: \"NR5G-NSA\"")
|
||||
if [ -n "$lte" ] && [ -n "$nr5g_nsa" ] ; then
|
||||
#EN-DC模式
|
||||
network_mode="EN-DC Mode"
|
||||
#LTE
|
||||
endc_lte_duplex_mode=$(echo "$lte" | awk -F',' '{print $2}' | sed 's/"//g')
|
||||
endc_lte_mcc=$(echo "$lte" | awk -F',' '{print $3}')
|
||||
endc_lte_mnc=$(echo "$lte" | awk -F',' '{print $4}')
|
||||
endc_lte_cell_id=$(echo "$lte" | awk -F',' '{print $5}')
|
||||
endc_lte_physical_cell_id=$(echo "$lte" | awk -F',' '{print $6}')
|
||||
endc_lte_earfcn=$(echo "$lte" | awk -F',' '{print $7}')
|
||||
endc_lte_freq_band_ind=$(echo "$lte" | awk -F',' '{print $8}')
|
||||
ul_bandwidth_num=$(echo "$lte" | awk -F',' '{print $9}')
|
||||
endc_lte_ul_bandwidth=$(get_lte_ul_bandwidth $ul_bandwidth_num)
|
||||
dl_bandwidth_num=$(echo "$lte" | awk -F',' '{print $10}')
|
||||
endc_lte_dl_bandwidth=$(get_lte_dl_bandwidth $dl_bandwidth_num)
|
||||
endc_lte_tac=$(echo "$lte" | awk -F',' '{print $11}')
|
||||
endc_lte_rsrp=$(echo "$lte" | awk -F',' '{print $12}')
|
||||
endc_lte_rsrq=$(echo "$lte" | awk -F',' '{print $13}')
|
||||
endc_lte_rssi=$(echo "$lte" | awk -F',' '{print $14}')
|
||||
endc_lte_sinr=$(echo "$lte" | awk -F',' '{print $15}')
|
||||
endc_lte_cql=$(echo "$lte" | awk -F',' '{print $16}')
|
||||
endc_lte_tx_power=$(echo "$lte" | awk -F',' '{print $17}')
|
||||
endc_lte_rxlev=$(echo "$lte" | awk -F',' '{print $18}')
|
||||
#NR5G-NSA
|
||||
endc_nr_mcc=$(echo "$nr5g_nsa" | awk -F',' '{print $2}')
|
||||
endc_nr_mnc=$(echo "$nr5g_nsa" | awk -F',' '{print $3}')
|
||||
endc_nr_physical_cell_id=$(echo "$nr5g_nsa" | awk -F',' '{print $4}')
|
||||
endc_nr_rsrp=$(echo "$nr5g_nsa" | awk -F',' '{print $5}')
|
||||
endc_nr_sinr=$(echo "$nr5g_nsa" | awk -F',' '{print $6}')
|
||||
endc_nr_rsrq=$(echo "$nr5g_nsa" | awk -F',' '{print $7}')
|
||||
endc_nr_arfcn=$(echo "$nr5g_nsa" | awk -F',' '{print $8}')
|
||||
endc_nr_band=$(echo "$nr5g_nsa" | awk -F',' '{print $9}')
|
||||
nr_dl_bandwidth_num=$(echo "$nr5g_nsa" | awk -F',' '{print $10}')
|
||||
endc_nr_dl_bandwidth=$(get_nr_dl_bandwidth $nr_dl_bandwidth_num)
|
||||
scs_num=$(echo "$nr5g_nsa" | awk -F',' '{print $16}')
|
||||
endc_nr_scs=$(get_scs $scs_num)
|
||||
else
|
||||
#SA,LTE,WCDMA模式
|
||||
response=$(echo "$response" | grep "+QENG:")
|
||||
local rat=$(echo "$response" | awk -F',' '{print $3}' | sed 's/"//g')
|
||||
case $rat in
|
||||
"NR5G-SA")
|
||||
network_mode="NR5G-SA Mode"
|
||||
nr_duplex_mode=$(echo "$response" | awk -F',' '{print $4}' | sed 's/"//g')
|
||||
nr_mcc=$(echo "$response" | awk -F',' '{print $5}')
|
||||
nr_mnc=$(echo "$response" | awk -F',' '{print $6}')
|
||||
nr_cell_id=$(echo "$response" | awk -F',' '{print $7}')
|
||||
nr_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}')
|
||||
nr_tac=$(echo "$response" | awk -F',' '{print $9}')
|
||||
nr_arfcn=$(echo "$response" | awk -F',' '{print $10}')
|
||||
nr_band=$(echo "$response" | awk -F',' '{print $11}')
|
||||
nr_dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $12}')
|
||||
nr_dl_bandwidth=$(get_nr_dl_bandwidth $nr_dl_bandwidth_num)
|
||||
nr_rsrp=$(echo "$response" | awk -F',' '{print $13}')
|
||||
nr_rsrq=$(echo "$response" | awk -F',' '{print $14}')
|
||||
nr_sinr=$(echo "$response" | awk -F',' '{print $15}')
|
||||
nr_scs=$(echo "$response" | awk -F',' '{print $16}')
|
||||
nr_rxlev=$(echo "$response" | awk -F',' '{print $17}')
|
||||
;;
|
||||
"LTE"|"CAT-M"|"CAT-NB")
|
||||
network_mode="LTE Mode"
|
||||
lte_duplex_mode=$(echo "$response" | awk -F',' '{print $4}' | sed 's/"//g')
|
||||
lte_mcc=$(echo "$response" | awk -F',' '{print $5}')
|
||||
lte_mnc=$(echo "$response" | awk -F',' '{print $6}')
|
||||
lte_cell_id=$(echo "$response" | awk -F',' '{print $7}')
|
||||
lte_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}')
|
||||
lte_earfcn=$(echo "$response" | awk -F',' '{print $9}')
|
||||
lte_freq_band_ind=$(echo "$response" | awk -F',' '{print $10}')
|
||||
ul_bandwidth_num=$(echo "$response" | awk -F',' '{print $11}')
|
||||
lte_ul_bandwidth=$(get_lte_ul_bandwidth $ul_bandwidth_num)
|
||||
dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $12}')
|
||||
lte_dl_bandwidth=$(get_lte_dl_bandwidth $dl_bandwidth_num)
|
||||
lte_tac=$(echo "$response" | awk -F',' '{print $13}')
|
||||
lte_rsrp=$(echo "$response" | awk -F',' '{print $14}')
|
||||
lte_rsrq=$(echo "$response" | awk -F',' '{print $15}')
|
||||
lte_rssi=$(echo "$response" | awk -F',' '{print $16}')
|
||||
lte_sinr=$(echo "$response" | awk -F',' '{print $17}')
|
||||
lte_cql=$(echo "$response" | awk -F',' '{print $18}')
|
||||
lte_tx_power=$(echo "$response" | awk -F',' '{print $19}')
|
||||
lte_rxlev=$(echo "$response" | awk -F',' '{print $20}')
|
||||
;;
|
||||
"WCDMA")
|
||||
network_mode="WCDMA Mode"
|
||||
wcdma_mcc=$(echo "$response" | awk -F',' '{print $4}')
|
||||
wcdma_mnc=$(echo "$response" | awk -F',' '{print $5}')
|
||||
wcdma_lac=$(echo "$response" | awk -F',' '{print $6}')
|
||||
wcdma_cell_id=$(echo "$response" | awk -F',' '{print $7}')
|
||||
wcdma_uarfcn=$(echo "$response" | awk -F',' '{print $8}')
|
||||
wcdma_psc=$(echo "$response" | awk -F',' '{print $9}')
|
||||
wcdma_rac=$(echo "$response" | awk -F',' '{print $10}')
|
||||
wcdma_rscp=$(echo "$response" | awk -F',' '{print $11}')
|
||||
wcdma_ecio=$(echo "$response" | awk -F',' '{print $12}')
|
||||
wcdma_phych=$(echo "$response" | awk -F',' '{print $13}')
|
||||
wcdma_sf=$(echo "$response" | awk -F',' '{print $14}')
|
||||
wcdma_slot=$(echo "$response" | awk -F',' '{print $15}')
|
||||
wcdma_speech_code=$(echo "$response" | awk -F',' '{print $16}')
|
||||
wcdma_com_mod=$(echo "$response" | awk -F',' '{print $17}')
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
return
|
||||
|
||||
NR_NSA=$(echo $response | grep -o -i "+QENG:[ ]\?\"NR5G-NSA\",")
|
||||
NR_SA=$(echo $response | grep -o -i "+QENG: \"SERVINGCELL\",[^,]\+,\"NR5G-SA\",\"[DFT]\{3\}\",")
|
||||
if [ -n "$NR_NSA" ]; then
|
||||
QENG=",,"$(echo $response" " | grep -o -i "+QENG: \"LTE\".\+\"NR5G-NSA\"," | tr " " ",")
|
||||
QENG5=$(echo $response | grep -o -i "+QENG:[ ]\?\"NR5G-NSA\",[0-9]\{3\},[0-9]\{2,3\},[0-9]\{1,5\},-[0-9]\{2,5\},[-0-9]\{1,3\},-[0-9]\{2,3\},[0-9]\{1,7\},[0-9]\{1,3\}.\{1,6\}")
|
||||
if [ -z "$QENG5" ]; then
|
||||
QENG5=$(echo $response | grep -o -i "+QENG:[ ]\?\"NR5G-NSA\",[0-9]\{3\},[0-9]\{2,3\},[0-9]\{1,5\},-[0-9]\{2,3\},[-0-9]\{1,3\},-[0-9]\{2,3\}")
|
||||
if [ -n "$QENG5" ]; then
|
||||
QENG5=$QENG5",,"
|
||||
fi
|
||||
fi
|
||||
elif [ -n "$NR_SA" ]; then
|
||||
QENG=$(echo $NR_SA | tr " " ",")
|
||||
QENG5=$(echo $response | grep -o -i "+QENG: \"SERVINGCELL\",[^,]\+,\"NR5G-SA\",\"[DFT]\{3\}\",[ 0-9]\{3,4\},[0-9]\{2,3\},[0-9A-F]\{1,10\},[0-9]\{1,5\},[0-9A-F]\{2,6\},[0-9]\{6,7\},[0-9]\{1,3\},[0-9]\{1,2\},-[0-9]\{2,5\},-[0-9]\{2,3\},[-0-9]\{1,3\}")
|
||||
else
|
||||
QENG=$(echo $response" " | grep -o -i "+QENG: [^ ]\+ " | tr " " ",")
|
||||
fi
|
||||
|
||||
RAT=$(echo $QENG | cut -d, -f4 | grep -o "[-A-Z5]\{3,7\}")
|
||||
case $RAT in
|
||||
"GSM")
|
||||
# MODE="GSM"
|
||||
;;
|
||||
"WCDMA")
|
||||
channel=$(echo $QENG | cut -d, -f9)
|
||||
rscp="-"$(echo $QENG | cut -d, -f12 | grep -o "[0-9]\{1,3\}")
|
||||
ecio=$(echo $QENG | cut -d, -f13)
|
||||
ecio="-"$(echo $ecio | grep -o "[0-9]\{1,3\}")
|
||||
;;
|
||||
"LTE"|"CAT-M"|"CAT-NB")
|
||||
PCI=$(echo $QENG | cut -d, -f9)
|
||||
channel=$(echo $QENG | cut -d, -f10)
|
||||
LBAND=$(echo $QENG | cut -d, -f11 | grep -o "[0-9]\{1,3\}")
|
||||
BW=$(echo $QENG | cut -d, -f12)
|
||||
lte_bw
|
||||
BWU=$BW
|
||||
BW=$(echo $QENG | cut -d, -f13)
|
||||
lte_bw
|
||||
BWD=$BW
|
||||
if [ -z "$BWD" ]; then
|
||||
BWD="unknown"
|
||||
fi
|
||||
if [ -z "$BWU" ]; then
|
||||
BWU="unknown"
|
||||
fi
|
||||
if [ -n "$LBAND" ]; then
|
||||
LBAND="B"$LBAND" (Bandwidth $BWD MHz Down | $BWU MHz Up)"
|
||||
fi
|
||||
RSRP=$(echo $QENG | cut -d, -f15 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$RSRP" ]; then
|
||||
RSCP="-"$RSRP
|
||||
RSRPLTE=$RSCP
|
||||
fi
|
||||
rsrq=$(echo $QENG | cut -d, -f16 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$rsrq" ]; then
|
||||
ecio="-"$rsrq
|
||||
fi
|
||||
rssi=$(echo $QENG | cut -d, -f17 | grep -o "\-[0-9]\{1,3\}")
|
||||
if [ -n "$rssi" ]; then
|
||||
CSQ_RSSI=$rssi" dBm"
|
||||
fi
|
||||
sinrr=$(echo $QENG | cut -d, -f18 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$sinrr" ]; then
|
||||
if [ $sinrr -le 25 ]; then
|
||||
sinrr=$((($(echo $sinrr) * 2) -20))" dB"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$NR_NSA" ]; then
|
||||
if [ -n "$QENG5" ] && [ -n "$LBAND" ] && [ "$RSCP" != "-" ] && [ "$ecio" != "-" ]; then
|
||||
PCI="$PCI, "$(echo $QENG5 | cut -d, -f4)
|
||||
SCHV=$(echo $QENG5 | cut -d, -f8)
|
||||
SLBV=$(echo $QENG5 | cut -d, -f9)
|
||||
BW=$(echo $QENG5 | cut -d, -f10 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$SLBV" ]; then
|
||||
LBAND=$LBAND"<br />n"$SLBV
|
||||
if [ -n "$BW" ]; then
|
||||
nr_bw
|
||||
LBAND=$LBAND" (Bandwidth $BW MHz)"
|
||||
fi
|
||||
if [ "$SCHV" -ge 123400 ]; then
|
||||
channel=$channel", "$SCHV
|
||||
else
|
||||
channel=$channel", -"
|
||||
fi
|
||||
else
|
||||
LBAND=$LBAND"<br />nxx (unknown NR5G band)"
|
||||
channel=$channel", -"
|
||||
fi
|
||||
RSCP=$RSCP" dBm<br />"$(echo $QENG5 | cut -d, -f5)
|
||||
sinrr=$(echo $QENG5 | cut -d, -f6 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$sinrr" ]; then
|
||||
if [ $sinrr -le 30 ]; then
|
||||
SINR=$SINR"<br />"$((($(echo $sinrr) * 2) -20))" dB"
|
||||
fi
|
||||
fi
|
||||
ecio=$ecio" (4G) dB<br />"$(echo $QENG5 | cut -d, -f7)" (5G) "
|
||||
fi
|
||||
fi
|
||||
if [ -z "$LBAND" ]; then
|
||||
LBAND="-"
|
||||
else
|
||||
if [ -n "$QCA" ]; then
|
||||
QCA=$(echo $QCA | grep -o "\"S[CS]\{2\}\"[-0-9A-Z,\"]\+")
|
||||
for QCAL in $(echo "$QCA"); do
|
||||
if [ $(echo "$QCAL" | cut -d, -f7) = "2" ]; then
|
||||
SCHV=$(echo $QCAL | cut -d, -f2 | grep -o "[0-9]\+")
|
||||
SRATP="B"
|
||||
if [ -n "$SCHV" ]; then
|
||||
channel="$channel, $SCHV"
|
||||
if [ "$SCHV" -gt 123400 ]; then
|
||||
SRATP="n"
|
||||
fi
|
||||
fi
|
||||
SLBV=$(echo $QCAL | cut -d, -f6 | grep -o "[0-9]\{1,2\}")
|
||||
if [ -n "$SLBV" ]; then
|
||||
LBAND=$LBAND"<br />"$SRATP$SLBV
|
||||
BWD=$(echo $QCAL | cut -d, -f3 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$BWD" ]; then
|
||||
UPDOWN=$(echo $QCAL | cut -d, -f13)
|
||||
case "$UPDOWN" in
|
||||
"UL" )
|
||||
CATYPE="CA"$(printf "\xe2\x86\x91") ;;
|
||||
"DL" )
|
||||
CATYPE="CA"$(printf "\xe2\x86\x93") ;;
|
||||
* )
|
||||
CATYPE="CA" ;;
|
||||
esac
|
||||
if [ $BWD -gt 14 ]; then
|
||||
LBAND=$LBAND" ("$CATYPE", Bandwidth "$(($(echo $BWD) / 5))" MHz)"
|
||||
else
|
||||
LBAND=$LBAND" ("$CATYPE", Bandwidth 1.4 MHz)"
|
||||
fi
|
||||
fi
|
||||
LBAND=$LBAND
|
||||
fi
|
||||
PCI="$PCI, "$(echo $QCAL | cut -d, -f8)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
if [ $RAT = "CAT-M" ] || [ $RAT = "CAT-NB" ]; then
|
||||
LBAND="B$(echo $QENG | cut -d, -f11) ($RAT)"
|
||||
fi
|
||||
;;
|
||||
"NR5G-SA")
|
||||
if [ -n "$QENG5" ]; then
|
||||
#AT+qnwcfg="NR5G_AMBR" #查询速度
|
||||
PCI=$(echo $QENG5 | cut -d, -f8)
|
||||
channel=$(echo $QENG5 | cut -d, -f10)
|
||||
LBAND=$(echo $QENG5 | cut -d, -f11)
|
||||
BW=$(echo $QENG5 | cut -d, -f12)
|
||||
nr_bw
|
||||
LBAND="n"$LBAND" (Bandwidth $BW MHz)"
|
||||
RSCP=$(echo $QENG5 | cut -d, -f13)
|
||||
ecio=$(echo $QENG5 | cut -d, -f14)
|
||||
if [ "$CSQ_PER" = "-" ]; then
|
||||
RSSI=$(rsrp2rssi $RSCP $BW)
|
||||
CSQ_PER=$((100 - (($RSSI + 51) * 100/-62)))"%"
|
||||
CSQ=$((($RSSI + 113) / 2))
|
||||
CSQ_RSSI=$RSSI" dBm"
|
||||
fi
|
||||
SINRR=$(echo $QENG5 | cut -d, -f15 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$SINRR" ]; then
|
||||
if [ $SINRR -le 30 ]; then
|
||||
SINR=$((($(echo $SINRR) * 2) -20))" dB"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# SIMCOM获取基站信息
|
||||
@ -290,205 +630,24 @@ get_quectel_info()
|
||||
|
||||
#基本信息
|
||||
quectel_base_info
|
||||
|
||||
#获取SIM状态
|
||||
sim_status=$(get_quectel_sim_status)
|
||||
if [ "$sim_status" != "ready" ];then
|
||||
return
|
||||
fi
|
||||
|
||||
#SIM卡信息
|
||||
quectel_sim_info
|
||||
#网络信息
|
||||
quectel_net_info
|
||||
quectel_network_info
|
||||
#小区信息
|
||||
quectel_cell_info
|
||||
|
||||
return
|
||||
|
||||
# Quectel_Cellinfo
|
||||
|
||||
#
|
||||
OX=$( sh modem_at.sh $at_port 'AT+QENG="servingcell"' | grep "+QENG:" )
|
||||
NR_NSA=$(echo $OX | grep -o -i "+QENG:[ ]\?\"NR5G-NSA\",")
|
||||
NR_SA=$(echo $OX | grep -o -i "+QENG: \"SERVINGCELL\",[^,]\+,\"NR5G-SA\",\"[DFT]\{3\}\",")
|
||||
if [ -n "$NR_NSA" ]; then
|
||||
QENG=",,"$(echo $OX" " | grep -o -i "+QENG: \"LTE\".\+\"NR5G-NSA\"," | tr " " ",")
|
||||
QENG5=$(echo $OX | grep -o -i "+QENG:[ ]\?\"NR5G-NSA\",[0-9]\{3\},[0-9]\{2,3\},[0-9]\{1,5\},-[0-9]\{2,5\},[-0-9]\{1,3\},-[0-9]\{2,3\},[0-9]\{1,7\},[0-9]\{1,3\}.\{1,6\}")
|
||||
if [ -z "$QENG5" ]; then
|
||||
QENG5=$(echo $OX | grep -o -i "+QENG:[ ]\?\"NR5G-NSA\",[0-9]\{3\},[0-9]\{2,3\},[0-9]\{1,5\},-[0-9]\{2,3\},[-0-9]\{1,3\},-[0-9]\{2,3\}")
|
||||
if [ -n "$QENG5" ]; then
|
||||
QENG5=$QENG5",,"
|
||||
fi
|
||||
fi
|
||||
elif [ -n "$NR_SA" ]; then
|
||||
QENG=$(echo $NR_SA | tr " " ",")
|
||||
QENG5=$(echo $OX | grep -o -i "+QENG: \"SERVINGCELL\",[^,]\+,\"NR5G-SA\",\"[DFT]\{3\}\",[ 0-9]\{3,4\},[0-9]\{2,3\},[0-9A-F]\{1,10\},[0-9]\{1,5\},[0-9A-F]\{2,6\},[0-9]\{6,7\},[0-9]\{1,3\},[0-9]\{1,2\},-[0-9]\{2,5\},-[0-9]\{2,3\},[-0-9]\{1,3\}")
|
||||
else
|
||||
QENG=$(echo $OX" " | grep -o -i "+QENG: [^ ]\+ " | tr " " ",")
|
||||
fi
|
||||
|
||||
|
||||
# debug "$QENG"
|
||||
# debug "$QENG5"
|
||||
|
||||
RAT=$(echo $QENG | cut -d, -f4 | grep -o "[-A-Z5]\{3,7\}")
|
||||
case $RAT in
|
||||
"GSM")
|
||||
MODE="GSM"
|
||||
;;
|
||||
"WCDMA")
|
||||
MODE="WCDMA"
|
||||
CHANNEL=$(echo $QENG | cut -d, -f9)
|
||||
RSCP=$(echo $QENG | cut -d, -f12)
|
||||
RSCP="-"$(echo $RSCP | grep -o "[0-9]\{1,3\}")
|
||||
ECIO=$(echo $QENG | cut -d, -f13)
|
||||
ECIO="-"$(echo $ECIO | grep -o "[0-9]\{1,3\}")
|
||||
;;
|
||||
"LTE"|"CAT-M"|"CAT-NB")
|
||||
MODE=$(echo $QENG | cut -d, -f5 | grep -o "[DFT]\{3\}")
|
||||
if [ -n "$MODE" ]; then
|
||||
MODE="$RAT $MODE"
|
||||
else
|
||||
MODE="$RAT"
|
||||
fi
|
||||
PCI=$(echo $QENG | cut -d, -f9)
|
||||
CHANNEL=$(echo $QENG | cut -d, -f10)
|
||||
LBAND=$(echo $QENG | cut -d, -f11 | grep -o "[0-9]\{1,3\}")
|
||||
BW=$(echo $QENG | cut -d, -f12)
|
||||
lte_bw
|
||||
BWU=$BW
|
||||
BW=$(echo $QENG | cut -d, -f13)
|
||||
lte_bw
|
||||
BWD=$BW
|
||||
if [ -z "$BWD" ]; then
|
||||
BWD="unknown"
|
||||
fi
|
||||
if [ -z "$BWU" ]; then
|
||||
BWU="unknown"
|
||||
fi
|
||||
if [ -n "$LBAND" ]; then
|
||||
LBAND="B"$LBAND" (Bandwidth $BWD MHz Down | $BWU MHz Up)"
|
||||
fi
|
||||
RSRP=$(echo $QENG | cut -d, -f15 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$RSRP" ]; then
|
||||
RSCP="-"$RSRP
|
||||
RSRPLTE=$RSCP
|
||||
fi
|
||||
RSRQ=$(echo $QENG | cut -d, -f16 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$RSRQ" ]; then
|
||||
ECIO="-"$RSRQ
|
||||
fi
|
||||
RSSI=$(echo $QENG | cut -d, -f17 | grep -o "\-[0-9]\{1,3\}")
|
||||
if [ -n "$RSSI" ]; then
|
||||
CSQ_RSSI=$RSSI" dBm"
|
||||
fi
|
||||
SINRR=$(echo $QENG | cut -d, -f18 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$SINRR" ]; then
|
||||
if [ $SINRR -le 25 ]; then
|
||||
SINR=$((($(echo $SINRR) * 2) -20))" dB"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$NR_NSA" ]; then
|
||||
MODE="LTE/NR EN-DC"
|
||||
echo "0" > /tmp/modnetwork
|
||||
if [ -n "$QENG5" ] && [ -n "$LBAND" ] && [ "$RSCP" != "-" ] && [ "$ECIO" != "-" ]; then
|
||||
PCI="$PCI, "$(echo $QENG5 | cut -d, -f4)
|
||||
SCHV=$(echo $QENG5 | cut -d, -f8)
|
||||
SLBV=$(echo $QENG5 | cut -d, -f9)
|
||||
BW=$(echo $QENG5 | cut -d, -f10 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$SLBV" ]; then
|
||||
LBAND=$LBAND"<br />n"$SLBV
|
||||
if [ -n "$BW" ]; then
|
||||
nr_bw
|
||||
LBAND=$LBAND" (Bandwidth $BW MHz)"
|
||||
fi
|
||||
if [ "$SCHV" -ge 123400 ]; then
|
||||
CHANNEL=$CHANNEL", "$SCHV
|
||||
else
|
||||
CHANNEL=$CHANNEL", -"
|
||||
fi
|
||||
else
|
||||
LBAND=$LBAND"<br />nxx (unknown NR5G band)"
|
||||
CHANNEL=$CHANNEL", -"
|
||||
fi
|
||||
RSCP=$RSCP" dBm<br />"$(echo $QENG5 | cut -d, -f5)
|
||||
SINRR=$(echo $QENG5 | cut -d, -f6 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$SINRR" ]; then
|
||||
if [ $SINRR -le 30 ]; then
|
||||
SINR=$SINR"<br />"$((($(echo $SINRR) * 2) -20))" dB"
|
||||
fi
|
||||
fi
|
||||
ECIO=$ECIO" (4G) dB<br />"$(echo $QENG5 | cut -d, -f7)" (5G) "
|
||||
fi
|
||||
fi
|
||||
if [ -z "$LBAND" ]; then
|
||||
LBAND="-"
|
||||
else
|
||||
if [ -n "$QCA" ]; then
|
||||
QCA=$(echo $QCA | grep -o "\"S[CS]\{2\}\"[-0-9A-Z,\"]\+")
|
||||
for QCAL in $(echo "$QCA"); do
|
||||
if [ $(echo "$QCAL" | cut -d, -f7) = "2" ]; then
|
||||
SCHV=$(echo $QCAL | cut -d, -f2 | grep -o "[0-9]\+")
|
||||
SRATP="B"
|
||||
if [ -n "$SCHV" ]; then
|
||||
CHANNEL="$CHANNEL, $SCHV"
|
||||
if [ "$SCHV" -gt 123400 ]; then
|
||||
SRATP="n"
|
||||
fi
|
||||
fi
|
||||
SLBV=$(echo $QCAL | cut -d, -f6 | grep -o "[0-9]\{1,2\}")
|
||||
if [ -n "$SLBV" ]; then
|
||||
LBAND=$LBAND"<br />"$SRATP$SLBV
|
||||
BWD=$(echo $QCAL | cut -d, -f3 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$BWD" ]; then
|
||||
UPDOWN=$(echo $QCAL | cut -d, -f13)
|
||||
case "$UPDOWN" in
|
||||
"UL" )
|
||||
CATYPE="CA"$(printf "\xe2\x86\x91") ;;
|
||||
"DL" )
|
||||
CATYPE="CA"$(printf "\xe2\x86\x93") ;;
|
||||
* )
|
||||
CATYPE="CA" ;;
|
||||
esac
|
||||
if [ $BWD -gt 14 ]; then
|
||||
LBAND=$LBAND" ("$CATYPE", Bandwidth "$(($(echo $BWD) / 5))" MHz)"
|
||||
else
|
||||
LBAND=$LBAND" ("$CATYPE", Bandwidth 1.4 MHz)"
|
||||
fi
|
||||
fi
|
||||
LBAND=$LBAND
|
||||
fi
|
||||
PCI="$PCI, "$(echo $QCAL | cut -d, -f8)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
if [ $RAT = "CAT-M" ] || [ $RAT = "CAT-NB" ]; then
|
||||
LBAND="B$(echo $QENG | cut -d, -f11) ($RAT)"
|
||||
fi
|
||||
;;
|
||||
"NR5G-SA")
|
||||
MODE="NR5G-SA"
|
||||
if [ -n "$QENG5" ]; then
|
||||
#AT+qnwcfg="NR5G_AMBR" #查询速度
|
||||
MODE="$RAT $(echo $QENG5 | cut -d, -f4)"
|
||||
PCI=$(echo $QENG5 | cut -d, -f8)
|
||||
CHANNEL=$(echo $QENG5 | cut -d, -f10)
|
||||
LBAND=$(echo $QENG5 | cut -d, -f11)
|
||||
BW=$(echo $QENG5 | cut -d, -f12)
|
||||
nr_bw
|
||||
LBAND="n"$LBAND" (Bandwidth $BW MHz)"
|
||||
RSCP=$(echo $QENG5 | cut -d, -f13)
|
||||
ECIO=$(echo $QENG5 | cut -d, -f14)
|
||||
if [ "$CSQ_PER" = "-" ]; then
|
||||
RSSI=$(rsrp2rssi $RSCP $BW)
|
||||
CSQ_PER=$((100 - (($RSSI + 51) * 100/-62)))"%"
|
||||
CSQ=$((($RSSI + 113) / 2))
|
||||
CSQ_RSSI=$RSSI" dBm"
|
||||
fi
|
||||
SINRR=$(echo $QENG5 | cut -d, -f15 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$SINRR" ]; then
|
||||
if [ $SINRR -le 30 ]; then
|
||||
SINR=$((($(echo $SINRR) * 2) -20))" dB"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
#
|
||||
OX=$( sh modem_at.sh $at_port "AT+QCAINFO" | grep "+QCAINFO:" )
|
||||
QCA=$(echo $OX" " | grep -o -i "+QCAINFO: \"S[CS]\{2\}\".\+NWSCANMODE" | tr " " ",")
|
||||
|
Loading…
x
Reference in New Issue
Block a user