更新模块插件
This commit is contained in:
parent
88d5b7e5b8
commit
ada33b3158
@ -147,9 +147,30 @@ function getModemInfo()
|
|||||||
|
|
||||||
--设置翻译
|
--设置翻译
|
||||||
local translation={}
|
local translation={}
|
||||||
|
--设备信息翻译
|
||||||
|
if modem_device_info then
|
||||||
|
-- local name=modem_device_info["name"]
|
||||||
|
-- translation[name]=luci.i18n.translate(name)
|
||||||
|
-- local manufacturer=modem_device_info["manufacturer"]
|
||||||
|
-- translation[manufacturer]=luci.i18n.translate(manufacturer)
|
||||||
|
-- local mode=modem_device_info["mode"]
|
||||||
|
-- translation[mode]=luci.i18n.translate(mode)
|
||||||
|
local data_interface=modem_device_info["data_interface"]
|
||||||
|
translation[data_interface]=luci.i18n.translate(data_interface)
|
||||||
|
local network=modem_device_info["network"]
|
||||||
|
translation[network]=luci.i18n.translate(network)
|
||||||
|
end
|
||||||
|
|
||||||
|
--基本信息翻译
|
||||||
|
if modem_more_info["base_info"] then
|
||||||
|
for key in pairs(modem_more_info["base_info"]) do
|
||||||
|
local value=modem_more_info["base_info"][key]
|
||||||
|
--翻译值
|
||||||
|
translation[value]=luci.i18n.translate(value)
|
||||||
|
end
|
||||||
|
end
|
||||||
--SIM卡信息翻译
|
--SIM卡信息翻译
|
||||||
if modem_more_info["sim_info"] then
|
if modem_more_info["sim_info"] then
|
||||||
|
|
||||||
local sim_info=modem_more_info["sim_info"]
|
local sim_info=modem_more_info["sim_info"]
|
||||||
for i = 1, #sim_info do
|
for i = 1, #sim_info do
|
||||||
local info = sim_info[i]
|
local info = sim_info[i]
|
||||||
@ -165,9 +186,11 @@ function getModemInfo()
|
|||||||
--网络信息翻译
|
--网络信息翻译
|
||||||
if modem_more_info["network_info"] then
|
if modem_more_info["network_info"] then
|
||||||
for key in pairs(modem_more_info["network_info"]) do
|
for key in pairs(modem_more_info["network_info"]) do
|
||||||
|
--翻译键
|
||||||
translation[key]=luci.i18n.translate(key)
|
translation[key]=luci.i18n.translate(key)
|
||||||
local value=modem_more_info["network_info"][key]
|
local value=modem_more_info["network_info"][key]
|
||||||
if hasLetters(value) then
|
if hasLetters(value) then
|
||||||
|
--翻译值
|
||||||
translation[value]=luci.i18n.translate(value)
|
translation[value]=luci.i18n.translate(value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -216,7 +239,10 @@ function getModems()
|
|||||||
-- 设置值
|
-- 设置值
|
||||||
local modem=modem_device
|
local modem=modem_device
|
||||||
modem["connect_status"]=connect_status
|
modem["connect_status"]=connect_status
|
||||||
modems[modem_device[".name"]]=modem
|
|
||||||
|
local modem_tmp={}
|
||||||
|
modem_tmp[modem_device[".name"]]=modem
|
||||||
|
table.insert(modems,modem_tmp)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- 设置值
|
-- 设置值
|
||||||
@ -252,6 +278,7 @@ function getModemRemarks(network)
|
|||||||
if network == config["network"] and config["enable"] == "1" then
|
if network == config["network"] and config["enable"] == "1" then
|
||||||
if config["remarks"] then
|
if config["remarks"] then
|
||||||
remarks=" ("..config["remarks"]..")" --" (备注)"
|
remarks=" ("..config["remarks"]..")" --" (备注)"
|
||||||
|
|
||||||
return true --跳出循环
|
return true --跳出循环
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -263,7 +290,10 @@ end
|
|||||||
@Description 获取AT串口
|
@Description 获取AT串口
|
||||||
]]
|
]]
|
||||||
function getATPort()
|
function getATPort()
|
||||||
|
|
||||||
local at_ports={}
|
local at_ports={}
|
||||||
|
local translation={}
|
||||||
|
|
||||||
uci:foreach("modem", "modem-device", function (modem_device)
|
uci:foreach("modem", "modem-device", function (modem_device)
|
||||||
--获取模组的备注
|
--获取模组的备注
|
||||||
local network=modem_device["network"]
|
local network=modem_device["network"]
|
||||||
@ -274,17 +304,26 @@ function getATPort()
|
|||||||
|
|
||||||
local name=modem_device["name"]:upper()..remarks
|
local name=modem_device["name"]:upper()..remarks
|
||||||
if modem_device["name"] == "unknown" then
|
if modem_device["name"] == "unknown" then
|
||||||
-- name=modem_device["at_port"]..remarks
|
translation[modem_device["name"]]=luci.i18n.translate(modem_device["name"])
|
||||||
name=modem_device["name"]..remarks
|
name=modem_device["name"]..remarks
|
||||||
end
|
end
|
||||||
|
|
||||||
local at_port = modem_device["at_port"]
|
local at_port = modem_device["at_port"]
|
||||||
at_ports[at_port]=name
|
--排序插入
|
||||||
|
at_port_tmp={}
|
||||||
|
at_port_tmp[at_port]=name
|
||||||
|
table.insert(at_ports, at_port_tmp)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- 设置值
|
||||||
|
local data={}
|
||||||
|
data["at_ports"]=at_ports
|
||||||
|
data["translation"]=translation
|
||||||
|
|
||||||
-- 写入Web界面
|
-- 写入Web界面
|
||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(at_ports)
|
luci.http.write_json(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
@ -304,6 +343,7 @@ function getQuickCommands()
|
|||||||
if at_port == modem_device["at_port"] then
|
if at_port == modem_device["at_port"] then
|
||||||
--获取制造商
|
--获取制造商
|
||||||
manufacturer=modem_device["manufacturer"]
|
manufacturer=modem_device["manufacturer"]
|
||||||
|
return true --跳出循环
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -355,6 +395,7 @@ function setNetworkPrefer()
|
|||||||
if at_port == modem_device["at_port"] then
|
if at_port == modem_device["at_port"] then
|
||||||
--获取制造商
|
--获取制造商
|
||||||
manufacturer=modem_device["manufacturer"]
|
manufacturer=modem_device["manufacturer"]
|
||||||
|
return true --跳出循环
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -390,6 +431,7 @@ function setMode()
|
|||||||
if at_port == modem_device["at_port"] then
|
if at_port == modem_device["at_port"] then
|
||||||
--获取制造商
|
--获取制造商
|
||||||
manufacturer=modem_device["manufacturer"]
|
manufacturer=modem_device["manufacturer"]
|
||||||
|
return true --跳出循环
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -425,7 +467,7 @@ function getModeInfo(at_port,manufacturer)
|
|||||||
--设置模组AT串口
|
--设置模组AT串口
|
||||||
if at_port == modem_device["at_port"] then
|
if at_port == modem_device["at_port"] then
|
||||||
modes=modem_device["modes"]
|
modes=modem_device["modes"]
|
||||||
return
|
return true --跳出循环
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -473,6 +515,7 @@ function getModemDebugInfo()
|
|||||||
if at_port == modem_device["at_port"] then
|
if at_port == modem_device["at_port"] then
|
||||||
--获取制造商
|
--获取制造商
|
||||||
manufacturer=modem_device["manufacturer"]
|
manufacturer=modem_device["manufacturer"]
|
||||||
|
return true --跳出循环
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
modem_select.addEventListener('change', function() {
|
modem_select.addEventListener('change', function() {
|
||||||
//获取快捷命令
|
//获取快捷命令
|
||||||
get_quick_commands();
|
get_quick_commands();
|
||||||
|
//获取模组调试信息
|
||||||
|
get_modem_debug_info();
|
||||||
});
|
});
|
||||||
|
|
||||||
//获取快捷选项父元素
|
//获取快捷选项父元素
|
||||||
@ -106,7 +108,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 设置AT串口选项
|
// 设置AT串口选项
|
||||||
function set_at_port(port)
|
function set_at_port(at_ports,translation)
|
||||||
{
|
{
|
||||||
// 获取模组选择框元素
|
// 获取模组选择框元素
|
||||||
var modem_select = document.getElementById('modem_select');
|
var modem_select = document.getElementById('modem_select');
|
||||||
@ -114,20 +116,25 @@
|
|||||||
var selected=modem_select.value;
|
var selected=modem_select.value;
|
||||||
// 删除原来的选项
|
// 删除原来的选项
|
||||||
modem_select.options.length=0;
|
modem_select.options.length=0;
|
||||||
// 更新(key:AT串口,value:模组名称)
|
//遍历每一个AT串口
|
||||||
for (var key in port)
|
for (var port of at_ports)
|
||||||
{
|
{
|
||||||
var option = document.createElement('option');
|
//更新(key:AT串口,value:模块名称)
|
||||||
option.value = key;
|
for (var key in port)
|
||||||
if (port[key].includes("unknown"))
|
|
||||||
{
|
{
|
||||||
option.text = port[key].replace("unknown", key);
|
var option = document.createElement('option');
|
||||||
|
option.value = key;
|
||||||
|
var language=navigator.language;
|
||||||
|
if (port[key].includes("unknown"))
|
||||||
|
{
|
||||||
|
option.text = port[key].replace("unknown", key);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
option.text = port[key];
|
||||||
|
}
|
||||||
|
modem_select.appendChild(option);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
option.text = port[key];
|
|
||||||
}
|
|
||||||
modem_select.appendChild(option);
|
|
||||||
}
|
}
|
||||||
// 恢复原来的选择
|
// 恢复原来的选择
|
||||||
for (let i = 0; i < modem_select.options.length; i++)
|
for (let i = 0; i < modem_select.options.length; i++)
|
||||||
@ -549,13 +556,16 @@
|
|||||||
|
|
||||||
// 定时触发更新AT串口
|
// 定时触发更新AT串口
|
||||||
XHR.poll(5,'<%=luci.dispatcher.build_url("admin", "network", "modem", "get_at_port")%>', null,
|
XHR.poll(5,'<%=luci.dispatcher.build_url("admin", "network", "modem", "get_at_port")%>', null,
|
||||||
function(x, port)
|
function(x, data)
|
||||||
{
|
{
|
||||||
|
var at_ports=data["at_ports"];
|
||||||
|
var translation=data["translation"];
|
||||||
|
|
||||||
//设置AT串口选项
|
//设置AT串口选项
|
||||||
set_at_port(port);
|
set_at_port(at_ports,translation);
|
||||||
|
|
||||||
//获取快捷命令
|
//获取快捷命令
|
||||||
if (Object.keys(port).length==0)
|
if (Object.keys(at_ports).length==0)
|
||||||
{
|
{
|
||||||
//显示无模组界面
|
//显示无模组界面
|
||||||
no_modems_view();
|
no_modems_view();
|
||||||
|
@ -180,14 +180,14 @@ end
|
|||||||
}
|
}
|
||||||
|
|
||||||
//显示信息
|
//显示信息
|
||||||
function set_info(info)
|
function set_info(info,translation)
|
||||||
{
|
{
|
||||||
for (var key in info)
|
for (var key in info)
|
||||||
{
|
{
|
||||||
var info_Element=document.getElementById(key);
|
var info_Element=document.getElementById(key);
|
||||||
if (info_Element!=null)
|
if (info_Element!=null)
|
||||||
{
|
{
|
||||||
info_Element.innerHTML=info[key];
|
info_Element.innerHTML=translation[info[key]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,6 +208,8 @@ end
|
|||||||
document.getElementById("info_message").innerHTML="<strong><%:Not adapted to this modem%></strong>";
|
document.getElementById("info_message").innerHTML="<strong><%:Not adapted to this modem%></strong>";
|
||||||
// 显示提示信息
|
// 显示提示信息
|
||||||
document.getElementById("cbi-info").style.display="block";
|
document.getElementById("cbi-info").style.display="block";
|
||||||
|
// 显示基本信息
|
||||||
|
document.getElementById("cbi-baseinfo").style.display="block";
|
||||||
// 隐藏SIM卡信息
|
// 隐藏SIM卡信息
|
||||||
document.getElementById("cbi-siminfo").style.display="none";
|
document.getElementById("cbi-siminfo").style.display="none";
|
||||||
// 隐藏网络信息
|
// 隐藏网络信息
|
||||||
@ -297,13 +299,13 @@ end
|
|||||||
|
|
||||||
// 设备信息
|
// 设备信息
|
||||||
var device_info=modem_info["device_info"];
|
var device_info=modem_info["device_info"];
|
||||||
set_info(device_info);
|
set_info(device_info,translation);
|
||||||
|
|
||||||
// 更多信息
|
// 更多信息
|
||||||
var more_info=modem_info["more_info"];
|
var more_info=modem_info["more_info"];
|
||||||
//基本信息
|
//基本信息
|
||||||
var base_info=more_info["base_info"];
|
var base_info=more_info["base_info"];
|
||||||
set_info(base_info);
|
set_info(base_info,translation);
|
||||||
|
|
||||||
//基本信息界面控制
|
//基本信息界面控制
|
||||||
base_info_view(base_info["manufacturer"]);
|
base_info_view(base_info["manufacturer"]);
|
||||||
@ -326,7 +328,7 @@ end
|
|||||||
|
|
||||||
//网络信息
|
//网络信息
|
||||||
var network_info=more_info["network_info"];
|
var network_info=more_info["network_info"];
|
||||||
set_info(network_info);
|
set_info(network_info,translation);
|
||||||
|
|
||||||
//小区信息
|
//小区信息
|
||||||
var cell_info=more_info["cell_info"];
|
var cell_info=more_info["cell_info"];
|
||||||
@ -339,7 +341,7 @@ end
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 设置AT串口选项
|
// 设置AT串口选项
|
||||||
function set_at_port(port)
|
function set_at_port(at_ports,translation)
|
||||||
{
|
{
|
||||||
//获取模块选择框元素
|
//获取模块选择框元素
|
||||||
var modem_select = document.getElementById('modem_select');
|
var modem_select = document.getElementById('modem_select');
|
||||||
@ -347,13 +349,25 @@ end
|
|||||||
var selected=modem_select.value;
|
var selected=modem_select.value;
|
||||||
// 删除原来的选项
|
// 删除原来的选项
|
||||||
modem_select.options.length=0;
|
modem_select.options.length=0;
|
||||||
// 更新(key:AT串口,value:模块名称)
|
//遍历每一个AT串口
|
||||||
for (var key in port)
|
for (var port of at_ports)
|
||||||
{
|
{
|
||||||
var option = document.createElement('option');
|
//更新(key:AT串口,value:模块名称)
|
||||||
option.text = port[key].trim();
|
for (var key in port)
|
||||||
option.value = key;
|
{
|
||||||
modem_select.appendChild(option);
|
var option = document.createElement('option');
|
||||||
|
option.value = key;
|
||||||
|
var language=navigator.language;
|
||||||
|
if (port[key].includes("unknown"))
|
||||||
|
{
|
||||||
|
option.text = translation[port[key]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
option.text = port[key];
|
||||||
|
}
|
||||||
|
modem_select.appendChild(option);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 恢复原来的选择
|
// 恢复原来的选择
|
||||||
for (let i = 0; i < modem_select.options.length; i++)
|
for (let i = 0; i < modem_select.options.length; i++)
|
||||||
@ -368,12 +382,15 @@ end
|
|||||||
|
|
||||||
// 定时触发更新AT串口和模组数据
|
// 定时触发更新AT串口和模组数据
|
||||||
XHR.poll(5,'<%=luci.dispatcher.build_url("admin", "network", "modem", "get_at_port")%>', null,
|
XHR.poll(5,'<%=luci.dispatcher.build_url("admin", "network", "modem", "get_at_port")%>', null,
|
||||||
function(x, port)
|
function(x, data)
|
||||||
{
|
{
|
||||||
|
var at_ports=data["at_ports"];
|
||||||
|
var translation=data["translation"];
|
||||||
|
|
||||||
//设置AT串口选项
|
//设置AT串口选项
|
||||||
set_at_port(port);
|
set_at_port(at_ports,translation);
|
||||||
//更新模组信息
|
//更新模组信息
|
||||||
if (Object.keys(port).length==0)
|
if (Object.keys(at_ports).length==0)
|
||||||
{
|
{
|
||||||
no_modems_view();
|
no_modems_view();
|
||||||
}
|
}
|
||||||
@ -432,7 +449,7 @@ end
|
|||||||
<table class="table" id="base_info">
|
<table class="table" id="base_info">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="tr">
|
<tr class="tr">
|
||||||
<td class="td left"><%:Modem%></td>
|
<td class="td left"><%:Modem Name%></td>
|
||||||
<td class="td left" id="modem_name">
|
<td class="td left" id="modem_name">
|
||||||
<select name="modem_select" id="modem_select"></select>
|
<select name="modem_select" id="modem_select"></select>
|
||||||
</td>
|
</td>
|
||||||
|
@ -1,9 +1,3 @@
|
|||||||
<%#
|
|
||||||
Copyright 2014 Aedan Renner <chipdankly@gmail.com>
|
|
||||||
Copyright 2018 Florian Eckert <fe@dev.tdt.de>
|
|
||||||
Licensed to the public under the GNU General Public License v2.
|
|
||||||
-%>
|
|
||||||
|
|
||||||
<script type="text/javascript">//<![CDATA[
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
|
||||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "modem", "get_modems")%>', null,
|
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "modem", "get_modems")%>', null,
|
||||||
@ -16,105 +10,109 @@
|
|||||||
if (Object.keys(modems).length!=0)
|
if (Object.keys(modems).length!=0)
|
||||||
{
|
{
|
||||||
var modem_view = "";
|
var modem_view = "";
|
||||||
for ( var key in modems)
|
//遍历每一个模组
|
||||||
|
for (var modem of modems)
|
||||||
{
|
{
|
||||||
var modem=modems[key];
|
//遍历模组里面的信息
|
||||||
|
for ( var key in modem)
|
||||||
|
{
|
||||||
|
var modem=modem[key];
|
||||||
|
|
||||||
var language=navigator.language;
|
var language=navigator.language;
|
||||||
// 检查模组名
|
// 检查模组名
|
||||||
var name=modem["name"];
|
var name=modem["name"];
|
||||||
if (name==null)
|
if (name==null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
else if (name=="unknown")
|
|
||||||
{
|
|
||||||
language=="en" ? name=name.toUpperCase() : name=translation[name];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
name=name.toUpperCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查拨号模式
|
|
||||||
var mode=modem["mode"]
|
|
||||||
if (mode==null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (mode=="unknown")
|
|
||||||
{
|
|
||||||
language=="en" ? mode=mode.toUpperCase() : mode=translation[mode];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mode=mode.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") {
|
else if (name=="unknown")
|
||||||
connect_status=translation[connect_status];
|
{
|
||||||
|
language=="en" ? name=name.toUpperCase() : name=translation[name];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
name=name.toUpperCase();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 设置显示样式
|
// 检查拨号模式
|
||||||
var state = '';
|
var mode=modem["mode"]
|
||||||
var css = '';
|
if (mode==null)
|
||||||
switch (modem["connect_status"])
|
{
|
||||||
{
|
continue;
|
||||||
case 'connect':
|
}
|
||||||
state = '<%:Connect%>';
|
else if (mode=="unknown")
|
||||||
css = 'success';
|
{
|
||||||
break;
|
language=="en" ? mode=mode.toUpperCase() : mode=translation[mode];
|
||||||
case 'disconnect':
|
}
|
||||||
state = '<%:Disconnect%>';
|
else
|
||||||
css = 'danger';
|
{
|
||||||
break;
|
mode=mode.toUpperCase();
|
||||||
default:
|
}
|
||||||
state = '<%:unknown%>';
|
|
||||||
css = 'warning';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置显示内容
|
// 获取连接状态
|
||||||
modem_view += String.format(
|
var connect_status=modem["connect_status"];
|
||||||
'<div class="alert-message %s">',
|
if (modem["connect_status"]!=null)
|
||||||
css
|
{
|
||||||
);
|
if (language=="en") {
|
||||||
modem_view += String.format(
|
// 首字母大写
|
||||||
'<div><strong>No: </strong>%s</div>',
|
connect_status=connect_status.charAt(0).toUpperCase() + modem["connect_status"].slice(1);
|
||||||
modem[".name"].slice(-1)
|
}
|
||||||
);
|
else if (language=="zh-CN"||language=="zh") {
|
||||||
modem_view += String.format(
|
connect_status=translation[connect_status];
|
||||||
'<div><strong><%:Modem Name%>: </strong>%s</div>',
|
}
|
||||||
name
|
}
|
||||||
);
|
|
||||||
modem_view += String.format(
|
// 设置显示样式
|
||||||
'<div><strong><%:Data Interface%>: </strong>%s</div>',
|
var state = '';
|
||||||
modem.data_interface.toUpperCase()
|
var css = '';
|
||||||
);
|
switch (modem["connect_status"])
|
||||||
modem_view += String.format(
|
{
|
||||||
'<div><strong><%:Mode%>: </strong>%s</div>',
|
case 'connect':
|
||||||
mode
|
state = '<%:Connect%>';
|
||||||
);
|
css = 'success';
|
||||||
modem_view += String.format(
|
break;
|
||||||
'<div><strong><%:Mobile Network%>: </strong>%s</div>',
|
case 'disconnect':
|
||||||
modem.network
|
state = '<%:Disconnect%>';
|
||||||
);
|
css = 'danger';
|
||||||
modem_view += String.format(
|
break;
|
||||||
'<div><strong><%:Connect Status%>: </strong>%s</div>',
|
default:
|
||||||
connect_status
|
state = '<%:unknown%>';
|
||||||
);
|
css = 'warning';
|
||||||
modem_view += '</div>';
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置显示内容
|
||||||
|
modem_view += String.format(
|
||||||
|
'<div class="alert-message %s">',
|
||||||
|
css
|
||||||
|
);
|
||||||
|
modem_view += String.format(
|
||||||
|
'<div><strong>No: </strong>%s</div>',
|
||||||
|
modem[".name"].slice(-1)
|
||||||
|
);
|
||||||
|
modem_view += String.format(
|
||||||
|
'<div><strong><%:Modem Name%>: </strong>%s</div>',
|
||||||
|
name
|
||||||
|
);
|
||||||
|
modem_view += String.format(
|
||||||
|
'<div><strong><%:Data Interface%>: </strong>%s</div>',
|
||||||
|
modem.data_interface.toUpperCase()
|
||||||
|
);
|
||||||
|
modem_view += String.format(
|
||||||
|
'<div><strong><%:Mode%>: </strong>%s</div>',
|
||||||
|
mode
|
||||||
|
);
|
||||||
|
modem_view += String.format(
|
||||||
|
'<div><strong><%:Mobile Network%>: </strong>%s</div>',
|
||||||
|
modem.network
|
||||||
|
);
|
||||||
|
modem_view += String.format(
|
||||||
|
'<div><strong><%:Connect Status%>: </strong>%s</div>',
|
||||||
|
connect_status
|
||||||
|
);
|
||||||
|
modem_view += '</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 有参数不存在,则不显示模块状态
|
// 有参数不存在,则不显示模块状态
|
||||||
if (modem_view != "")
|
if (modem_view != "")
|
||||||
{
|
{
|
||||||
|
@ -189,7 +189,7 @@ fibocom_base_info()
|
|||||||
revision=$(echo "$response" | sed -n '4p' | sed 's/Revision: //g' | sed 's/\r//g')
|
revision=$(echo "$response" | sed -n '4p' | sed 's/Revision: //g' | sed 's/\r//g')
|
||||||
|
|
||||||
#Mode(拨号模式)
|
#Mode(拨号模式)
|
||||||
mode=$(get_fibocom_mode $at_port | tr 'a-z' 'A-Z')
|
mode=$(get_mode $at_port | tr 'a-z' 'A-Z')
|
||||||
|
|
||||||
#Temperature(温度)
|
#Temperature(温度)
|
||||||
at_command="AT+MTSM=1,6"
|
at_command="AT+MTSM=1,6"
|
||||||
|
@ -9,13 +9,13 @@ source "$current_dir/simcom.sh"
|
|||||||
init_modem_info()
|
init_modem_info()
|
||||||
{
|
{
|
||||||
#基本信息
|
#基本信息
|
||||||
name='' #名称
|
name='unknown' #名称
|
||||||
manufacturer='' #制造商
|
manufacturer='unknown' #制造商
|
||||||
revision='-' #固件版本
|
revision='-' #固件版本
|
||||||
at_port='-' #AT串口
|
at_port='-' #AT串口
|
||||||
mode='unknown' #拨号模式
|
mode='unknown' #拨号模式
|
||||||
temperature="NaN $(printf "\xc2\xb0")C" #温度
|
temperature="NaN $(printf "\xc2\xb0")C" #温度
|
||||||
update_time='-' #更新时间
|
update_time='-' #更新时间
|
||||||
|
|
||||||
#SIM卡信息
|
#SIM卡信息
|
||||||
sim_status="miss" #SIM卡状态
|
sim_status="miss" #SIM卡状态
|
||||||
@ -305,9 +305,13 @@ info_to_json()
|
|||||||
#设置基本信息
|
#设置基本信息
|
||||||
set_base_info
|
set_base_info
|
||||||
|
|
||||||
#设置SIM卡信息
|
#判断是否适配
|
||||||
set_sim_info
|
if [ "$manufacturer" != "unknown" ]; then
|
||||||
|
#设置SIM卡信息
|
||||||
|
set_sim_info
|
||||||
|
fi
|
||||||
|
|
||||||
|
#判断插卡和连接状态
|
||||||
if [ "$sim_status" = "ready" ] && [ "$connect_status" = "connect" ]; then
|
if [ "$sim_status" = "ready" ] && [ "$connect_status" = "connect" ]; then
|
||||||
#设置网络信息
|
#设置网络信息
|
||||||
set_network_info
|
set_network_info
|
||||||
|
@ -172,7 +172,7 @@ quectel_base_info()
|
|||||||
revision=$(echo "$response" | sed -n '4p' | sed 's/Revision: //g' | sed 's/\r//g')
|
revision=$(echo "$response" | sed -n '4p' | sed 's/Revision: //g' | sed 's/\r//g')
|
||||||
|
|
||||||
#Mode(拨号模式)
|
#Mode(拨号模式)
|
||||||
mode=$(get_quectel_mode $at_port | tr 'a-z' 'A-Z')
|
mode=$(get_mode $at_port | tr 'a-z' 'A-Z')
|
||||||
|
|
||||||
#Temperature(温度)
|
#Temperature(温度)
|
||||||
at_command="AT+QTEMP"
|
at_command="AT+QTEMP"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user