更新模块插件
This commit is contained in:
parent
4314a5f57d
commit
faf8288104
@ -18,7 +18,7 @@ function index()
|
|||||||
entry({"admin", "network", "modem", "get_modem_info"}, call("getModemInfo"))
|
entry({"admin", "network", "modem", "get_modem_info"}, call("getModemInfo"))
|
||||||
|
|
||||||
--模块设置
|
--模块设置
|
||||||
entry({"admin", "network", "modem", "index"},cbi("modem/index"),translate("Modem Config"),20).leaf = true
|
entry({"admin", "network", "modem", "index"},cbi("modem/index"),translate("Dial Config"),20).leaf = true
|
||||||
entry({"admin", "network", "modem", "config"}, cbi("modem/config")).leaf = true
|
entry({"admin", "network", "modem", "config"}, cbi("modem/config")).leaf = true
|
||||||
entry({"admin", "network", "modem", "get_modems"}, call("getModems"), nil).leaf = true
|
entry({"admin", "network", "modem", "get_modems"}, call("getModems"), nil).leaf = true
|
||||||
entry({"admin", "network", "modem", "status"}, call("act_status")).leaf = true
|
entry({"admin", "network", "modem", "status"}, call("act_status")).leaf = true
|
||||||
@ -28,8 +28,10 @@ function index()
|
|||||||
entry({"admin", "network", "modem", "get_at_port"}, call("getATPort"), nil).leaf = true
|
entry({"admin", "network", "modem", "get_at_port"}, call("getATPort"), nil).leaf = true
|
||||||
entry({"admin", "network", "modem", "get_quick_commands"}, call("getQuickCommands"), nil).leaf = true
|
entry({"admin", "network", "modem", "get_quick_commands"}, call("getQuickCommands"), nil).leaf = true
|
||||||
entry({"admin", "network", "modem", "send_at_command"}, call("sendATCommand"), nil).leaf = true
|
entry({"admin", "network", "modem", "send_at_command"}, call("sendATCommand"), nil).leaf = true
|
||||||
entry({"admin", "network", "modem", "user_at_command"}, call("userATCommand"), nil).leaf = true
|
entry({"admin", "network", "modem", "get_network_prefer"}, call("getNetworkPrefer"), nil).leaf = true
|
||||||
entry({"admin", "network", "modem", "mode_info"}, call("modeInfo"), nil).leaf = true
|
entry({"admin", "network", "modem", "set_network_prefer"}, call("setNetworkPrefer"), nil).leaf = true
|
||||||
|
entry({"admin", "network", "modem", "get_mode"}, call("getMode"), nil).leaf = true
|
||||||
|
entry({"admin", "network", "modem", "set_mode"}, call("setMode"), nil).leaf = true
|
||||||
|
|
||||||
--AT命令旧界面
|
--AT命令旧界面
|
||||||
entry({"admin", "network", "modem", "at_command_old"},template("modem/at_command_old")).leaf = true
|
entry({"admin", "network", "modem", "at_command_old"},template("modem/at_command_old")).leaf = true
|
||||||
@ -55,6 +57,7 @@ function at(at_port,at_command)
|
|||||||
local odpall = io.popen("cd "..script_path.." && source "..script_path.."modem_debug.sh && at "..at_port.." "..at_command)
|
local odpall = io.popen("cd "..script_path.." && source "..script_path.."modem_debug.sh && at "..at_port.." "..at_command)
|
||||||
local odp = odpall:read("*a")
|
local odp = odpall:read("*a")
|
||||||
odpall:close()
|
odpall:close()
|
||||||
|
odp=string.gsub(odp, "\r", "")
|
||||||
return odp
|
return odp
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -238,81 +241,6 @@ function act_status()
|
|||||||
luci.http.write_json(e)
|
luci.http.write_json(e)
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
|
||||||
@Description 模式信息
|
|
||||||
]]
|
|
||||||
function modeInfo()
|
|
||||||
-- 设置默认值
|
|
||||||
local modes={"qmi","gobinet","ecm","mbim","rndis","ncm"}
|
|
||||||
-- 获取移动网络
|
|
||||||
local network = http.formvalue("network")
|
|
||||||
|
|
||||||
local modem_number=uci:get('modem','global','modem_number')
|
|
||||||
for i=0,modem_number-1 do
|
|
||||||
local modem_network = uci:get('modem','modem'..i,'network')
|
|
||||||
if network == modem_network then
|
|
||||||
-- 清空表
|
|
||||||
modes={}
|
|
||||||
-- 把找到的模块存入表中
|
|
||||||
local modes_arr = uci:get_list('modem','modem'..i,'modes')
|
|
||||||
for i in ipairs(modes_arr) do
|
|
||||||
modes[i]=modes_arr[i]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- 写入Web界面
|
|
||||||
luci.http.prepare_content("application/json")
|
|
||||||
luci.http.write_json(modes)
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
|
||||||
@Description 发送AT命令
|
|
||||||
]]
|
|
||||||
function sendATCommand()
|
|
||||||
local at_port = http.formvalue("port")
|
|
||||||
local at_command = http.formvalue("command")
|
|
||||||
|
|
||||||
local response={}
|
|
||||||
if at_port and at_command then
|
|
||||||
response["response"]=at(at_port,at_command)
|
|
||||||
response["time"]=os.date("%Y-%m-%d %H:%M:%S")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 写入Web界面
|
|
||||||
luci.http.prepare_content("application/json")
|
|
||||||
luci.http.write_json(response)
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
|
||||||
@Description 用户AT命令
|
|
||||||
]]
|
|
||||||
function userATCommand()
|
|
||||||
local at_commands={}
|
|
||||||
-- 获取模块AT命令
|
|
||||||
local command_file
|
|
||||||
if nixio.fs.access("/etc/config/modem_command.user") then
|
|
||||||
command_file=io.popen("cat /etc/config/modem_command.user")
|
|
||||||
end
|
|
||||||
if command_file then
|
|
||||||
local i=0
|
|
||||||
for line in command_file:lines() do
|
|
||||||
if line then
|
|
||||||
-- 分割为{key,value}
|
|
||||||
local command_table=string.split(line, ";")
|
|
||||||
-- 整合为{0:{key:value},1:{key:value}}
|
|
||||||
local at_command={}
|
|
||||||
at_command[command_table[1]]=command_table[2]
|
|
||||||
at_commands[tostring(i)]=at_command
|
|
||||||
i=i+1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
command_file:close()
|
|
||||||
end
|
|
||||||
-- 写入Web界面
|
|
||||||
luci.http.prepare_content("application/json")
|
|
||||||
luci.http.write_json(at_commands)
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
@Description 获取模组的备注
|
@Description 获取模组的备注
|
||||||
@Params
|
@Params
|
||||||
@ -393,3 +321,158 @@ function getQuickCommands()
|
|||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(quick_commands)
|
luci.http.write_json(quick_commands)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[
|
||||||
|
@Description 发送AT命令
|
||||||
|
]]
|
||||||
|
function sendATCommand()
|
||||||
|
local at_port = http.formvalue("port")
|
||||||
|
local at_command = http.formvalue("command")
|
||||||
|
|
||||||
|
local response={}
|
||||||
|
if at_port and at_command then
|
||||||
|
response["response"]=at(at_port,at_command)
|
||||||
|
response["time"]=os.date("%Y-%m-%d %H:%M:%S")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 写入Web界面
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json(response)
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[
|
||||||
|
@Description 获取网络偏好
|
||||||
|
]]
|
||||||
|
function getNetworkPrefer()
|
||||||
|
local at_port = http.formvalue("port")
|
||||||
|
|
||||||
|
--获取制造商
|
||||||
|
local manufacturer
|
||||||
|
uci:foreach("modem", "modem-device", function (modem_device)
|
||||||
|
--设置模组AT串口
|
||||||
|
if at_port == modem_device["at_port"] then
|
||||||
|
--获取制造商
|
||||||
|
manufacturer=modem_device["manufacturer"]
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
--获取模组网络偏好
|
||||||
|
local network_prefer={}
|
||||||
|
if at_port and manufacturer and manufacturer~="unknown" then
|
||||||
|
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && get_network_prefer "..at_port)
|
||||||
|
local opd = odpall:read("*a")
|
||||||
|
network_prefer=json.parse(opd)
|
||||||
|
odpall:close()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 写入Web界面
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json(network_prefer)
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[
|
||||||
|
@Description 设置网络偏好
|
||||||
|
]]
|
||||||
|
function setNetworkPrefer()
|
||||||
|
local at_port = http.formvalue("port")
|
||||||
|
local network_prefer_config = json.stringify(http.formvalue("prefer_config"))
|
||||||
|
|
||||||
|
--获取制造商
|
||||||
|
local manufacturer
|
||||||
|
uci:foreach("modem", "modem-device", function (modem_device)
|
||||||
|
--设置模组AT串口
|
||||||
|
if at_port == modem_device["at_port"] then
|
||||||
|
--获取制造商
|
||||||
|
manufacturer=modem_device["manufacturer"]
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
--设置模组网络偏好
|
||||||
|
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && set_network_prefer "..at_port.." "..network_prefer_config)
|
||||||
|
odpall:close()
|
||||||
|
|
||||||
|
--获取设置好后的模组网络偏好
|
||||||
|
local network_prefer={}
|
||||||
|
if at_port and manufacturer and manufacturer~="unknown" then
|
||||||
|
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && get_network_prefer "..at_port)
|
||||||
|
local opd = odpall:read("*a")
|
||||||
|
network_prefer=json.parse(opd)
|
||||||
|
odpall:close()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 写入Web界面
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json(network_prefer)
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[
|
||||||
|
@Description 获取拨号模式
|
||||||
|
]]
|
||||||
|
function getMode()
|
||||||
|
local at_port = http.formvalue("port")
|
||||||
|
|
||||||
|
--获取制造商和支持的拨号模式
|
||||||
|
local manufacturer
|
||||||
|
local modes
|
||||||
|
uci:foreach("modem", "modem-device", function (modem_device)
|
||||||
|
--设置模组AT串口
|
||||||
|
if at_port == modem_device["at_port"] then
|
||||||
|
--获取制造商
|
||||||
|
manufacturer=modem_device["manufacturer"]
|
||||||
|
modes=modem_device["modes"]
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
--获取模组拨号模式
|
||||||
|
local mode
|
||||||
|
if at_port and manufacturer and manufacturer~="unknown" then
|
||||||
|
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && get_mode "..at_port)
|
||||||
|
mode = odpall:read("*a")
|
||||||
|
mode=string.gsub(mode, "\n", "")
|
||||||
|
odpall:close()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 设置值
|
||||||
|
local mode_info={}
|
||||||
|
mode_info["mode"]=mode
|
||||||
|
mode_info["modes"]=modes
|
||||||
|
|
||||||
|
-- 写入Web界面
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json(mode_info)
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[
|
||||||
|
@Description 设置拨号模式
|
||||||
|
]]
|
||||||
|
function setMode()
|
||||||
|
local at_port = http.formvalue("port")
|
||||||
|
local mode_config = http.formvalue("mode_config")
|
||||||
|
|
||||||
|
--获取制造商
|
||||||
|
local manufacturer
|
||||||
|
uci:foreach("modem", "modem-device", function (modem_device)
|
||||||
|
--设置模组AT串口
|
||||||
|
if at_port == modem_device["at_port"] then
|
||||||
|
--获取制造商
|
||||||
|
manufacturer=modem_device["manufacturer"]
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
--设置模组拨号模式
|
||||||
|
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && set_mode "..at_port.." "..mode_config)
|
||||||
|
odpall:close()
|
||||||
|
|
||||||
|
--获取设置好后的模组拨号模式
|
||||||
|
local mode
|
||||||
|
if at_port and manufacturer and manufacturer~="unknown" then
|
||||||
|
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && get_mode "..at_port)
|
||||||
|
mode = odpall:read("*a")
|
||||||
|
mode=string.gsub(mode, "\n", "")
|
||||||
|
odpall:close()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 写入Web界面
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json(mode)
|
||||||
|
end
|
@ -2,7 +2,7 @@ local d = require "luci.dispatcher"
|
|||||||
local uci = luci.model.uci.cursor()
|
local uci = luci.model.uci.cursor()
|
||||||
|
|
||||||
m = Map("modem")
|
m = Map("modem")
|
||||||
m.title = translate("Modem Config")
|
m.title = translate("Dial Config")
|
||||||
m.description = translate("Configuration panel for Modem, Add configuration to all modems on this page")
|
m.description = translate("Configuration panel for Modem, Add configuration to all modems on this page")
|
||||||
|
|
||||||
--全局配置
|
--全局配置
|
||||||
|
@ -13,27 +13,40 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
window.onload = function readData()
|
//第一次打开界面
|
||||||
|
first_start=1;
|
||||||
|
|
||||||
|
// 获取快捷命令
|
||||||
|
function get_quick_commands()
|
||||||
{
|
{
|
||||||
|
//获取快捷选项
|
||||||
|
var quick_option = "custom";
|
||||||
|
//获取选中的模组
|
||||||
|
var at_port = document.getElementById("modem_select").value;
|
||||||
|
|
||||||
//获取AT命令
|
//获取AT命令
|
||||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "user_at_command")%>', null,
|
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "get_quick_commands")%>', {"option":quick_option,"port":at_port},
|
||||||
function(x, json)
|
function(x, data)
|
||||||
|
{
|
||||||
|
//获取模组选择框元素
|
||||||
|
var command_select = document.getElementById('command_select');
|
||||||
|
//获取快捷命令
|
||||||
|
var quick_commands=data["quick_commands"];
|
||||||
|
//遍历每一条信息
|
||||||
|
for (var info of quick_commands)
|
||||||
|
{
|
||||||
|
//遍历每一条信息里的键
|
||||||
|
for (var key in info)
|
||||||
{
|
{
|
||||||
select = document.getElementById('command_choose');
|
|
||||||
// 遍历序号
|
|
||||||
for (var command in json) {
|
|
||||||
// 遍历AT命令
|
|
||||||
for (var key in json[command]) {
|
|
||||||
var option = document.createElement('option');
|
var option = document.createElement('option');
|
||||||
option.text = key;
|
option.text = key;
|
||||||
option.value = json[command][key].trim();
|
option.value = info[key];
|
||||||
option.innerHTML = key;
|
command_select.appendChild(option);
|
||||||
select.appendChild(option);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
// 定时触发更新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,
|
||||||
@ -82,6 +95,13 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//获取快捷命令
|
||||||
|
if (first_start)
|
||||||
|
{
|
||||||
|
get_quick_commands();
|
||||||
|
first_start=0
|
||||||
|
}
|
||||||
|
|
||||||
// 显示AT命令界面
|
// 显示AT命令界面
|
||||||
document.getElementById("at_command_view").style.display="block";
|
document.getElementById("at_command_view").style.display="block";
|
||||||
// 隐藏提示信息
|
// 隐藏提示信息
|
||||||
@ -90,42 +110,19 @@
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// 根据所选的模组改变AT命令
|
|
||||||
function afunction()
|
|
||||||
{
|
|
||||||
// var node = document.getElementById('response');
|
|
||||||
// node.style.visibility = 'hidden';
|
|
||||||
|
|
||||||
// var x = document.getElementById("at_command").value;
|
|
||||||
// document.getElementById("code").value = x;
|
|
||||||
// document.getElementById("response").innerHTML = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
//自动填写到命令输入框
|
//自动填写到命令输入框
|
||||||
function copyToSend()
|
function copy_to_input()
|
||||||
{
|
{
|
||||||
var node = document.getElementById('response');
|
var node = document.getElementById('response');
|
||||||
node.style.visibility = 'hidden';
|
node.style.visibility = 'hidden';
|
||||||
|
|
||||||
var command_choose = document.getElementById("command_choose").value;
|
var command_select = document.getElementById("command_select").value;
|
||||||
document.getElementById("at_command").value = command_choose;
|
document.getElementById("at_command").value = command_select;
|
||||||
document.getElementById("response").innerHTML = "";
|
document.getElementById("response").innerHTML = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function postCommand(at_port,at_command)
|
function post_command(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("response").innerHTML = bStr;
|
|
||||||
// var el = document.getElementsByName("response")[0];
|
|
||||||
// el.value.replace(/(\r\n|\n|\r)/gm, "");
|
|
||||||
// });
|
|
||||||
|
|
||||||
XHR.post('<%=luci.dispatcher.build_url("admin", "network", "modem", "send_at_command")%>', {"port":at_port,"command":at_command},
|
XHR.post('<%=luci.dispatcher.build_url("admin", "network", "modem", "send_at_command")%>', {"port":at_port,"command":at_command},
|
||||||
function(x, data)
|
function(x, data)
|
||||||
{
|
{
|
||||||
@ -164,7 +161,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//发送AT命令
|
//发送AT命令
|
||||||
postCommand(at_port,at_command);
|
post_command(at_port,at_command);
|
||||||
at_command = "";
|
at_command = "";
|
||||||
|
|
||||||
var node = document.getElementById('response');
|
var node = document.getElementById('response');
|
||||||
@ -182,45 +179,45 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h2 name="content"><%:AT Commands%></h2>
|
<h2 name="content"><%:AT Commands%></h2>
|
||||||
<div class="cbi-map-descr"><%:Debugging Your Module with AT Command%></div>
|
<div class="cbi-map-descr"><%:Debug Your Module%></div>
|
||||||
|
|
||||||
<fieldset class="cbi-section" id="cbi-info" style="display: block;">
|
<fieldset class="cbi-section" id="cbi-info" style="display: block;">
|
||||||
|
<div class="cbi-section fade-in">
|
||||||
<h3><%:Message%></h3>
|
<h3><%:Message%></h3>
|
||||||
<table width="550" border="0">
|
<table class="table" id="message">
|
||||||
<tr>
|
<tr class="tr">
|
||||||
<td width="10%"></td>
|
<td colspan="2" class="td left">
|
||||||
<td width="60%">
|
|
||||||
<div align="left" id="info_message" style="font-size:1.875em">
|
<div align="left" id="info_message" style="font-size:1.875em">
|
||||||
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle"/>
|
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle"/>
|
||||||
<%:Loading modem%>...
|
<%:Loading modem%>...
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td width="30%"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<div id="at_command_view" style="display: none;">
|
<div id="at_command_view" style="display: none;">
|
||||||
<h4><br/></h4>
|
<h4><br/></h4>
|
||||||
<div class="table" width="100%">
|
<div class="table" width="100%">
|
||||||
<div class="tr">
|
<div class="tr">
|
||||||
<div class="td left" style="width:25%;"><%:Modem Select%>:</div>
|
<div class="td left" style="width:25%;"><%:Modem Select%></div>
|
||||||
<div class="td left" style="width:50%;">
|
<div class="td left" style="width:50%;">
|
||||||
<select name="modem_select" id="modem_select" onclick="afunction()"></select>
|
<select name="modem_select" id="modem_select"></select>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="td left" style="width:50%;"></div> -->
|
<!-- <div class="td left" style="width:50%;"></div> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tr">
|
<div class="tr">
|
||||||
<div class="td left" style="width:25%;"><%:User AT Commands%>:</div>
|
<div class="td left" style="width:25%;"><%:Quick Commands%></div>
|
||||||
<div class="td left" style="width:50%;">
|
<div class="td left" style="width:50%;">
|
||||||
<select name="command_choose" id="command_choose" onclick="copyToSend()"></select>
|
<select name="command_select" id="command_select" onclick="copy_to_input()"></select>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="td left" style="width:50%;"></div> -->
|
<!-- <div class="td left" style="width:50%;"></div> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tr">
|
<div class="tr">
|
||||||
<div class="td left" style="width:25%;"><%:Command to send%>:</div>
|
<div class="td left" style="width:25%;"><%:Enter Command%></div>
|
||||||
<div class="td left" style="width:50%;">
|
<div class="td left" style="width:50%;">
|
||||||
<input type="text" id="at_command" required size="20" >
|
<input type="text" id="at_command" required size="20" >
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,16 +13,38 @@
|
|||||||
get_quick_commands();
|
get_quick_commands();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//获取快捷选项父元素
|
//获取快捷选项父元素
|
||||||
var quick_option = document.getElementById('quick_option_td');
|
var quick_option_element = document.getElementById('quick_option_td');
|
||||||
quick_option.addEventListener('change', function(event) {
|
//更换快捷选项时触发
|
||||||
|
quick_option_element.addEventListener('change', function(event) {
|
||||||
var target = event.target;
|
var target = event.target;
|
||||||
if (target.matches('input[type="radio"]')) {
|
if (target.matches('input[type="radio"]')) {
|
||||||
//获取快捷命令
|
//获取快捷命令
|
||||||
get_quick_commands();
|
get_quick_commands();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//获取网络偏好选项元素
|
||||||
|
var prefer_option_auto = document.getElementById('prefer_option_auto');
|
||||||
|
var prefer_option_custom = document.getElementById('prefer_option_custom');
|
||||||
|
//网络偏好选项为自动时触发
|
||||||
|
prefer_option_auto.addEventListener('change', function() {
|
||||||
|
if (prefer_option_auto.checked)
|
||||||
|
{
|
||||||
|
//禁用偏好复选框
|
||||||
|
disabled_prefer_custom_config(true);
|
||||||
|
//全选偏好复选框
|
||||||
|
all_choose_prefer_custom_config(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//网络偏好选项为自定义时触发
|
||||||
|
prefer_option_custom.addEventListener('change', function() {
|
||||||
|
if (prefer_option_custom.checked)
|
||||||
|
{
|
||||||
|
//禁用偏好复选框
|
||||||
|
disabled_prefer_custom_config(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送AT命令
|
// 发送AT命令
|
||||||
@ -37,6 +59,8 @@
|
|||||||
responseElement.value+=data["time"];
|
responseElement.value+=data["time"];
|
||||||
//显示返回值
|
//显示返回值
|
||||||
responseElement.value+=data["response"];
|
responseElement.value+=data["response"];
|
||||||
|
//滚动到底部
|
||||||
|
responseElement.scrollTop = responseElement.scrollHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -49,7 +73,6 @@
|
|||||||
var at_port = document.getElementById("modem_select").value;
|
var at_port = document.getElementById("modem_select").value;
|
||||||
if ( at_port.length == 0 )
|
if ( at_port.length == 0 )
|
||||||
{
|
{
|
||||||
// document.getElementById("odp").innerHTML = "";
|
|
||||||
alert("<%:Please choose a Modem%>");
|
alert("<%:Please choose a Modem%>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -58,11 +81,13 @@
|
|||||||
var at_command = document.getElementById("at_command").value;
|
var at_command = document.getElementById("at_command").value;
|
||||||
if ( at_command.length == 0 )
|
if ( at_command.length == 0 )
|
||||||
{
|
{
|
||||||
// document.getElementById("odp").innerHTML = "";
|
|
||||||
alert("<%:Please enter a AT Command%>");
|
alert("<%:Please enter a AT Command%>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//对双引号进行特殊处理
|
||||||
|
at_command=at_command.replaceAll("\"","\\\"");
|
||||||
|
|
||||||
//发送AT命令
|
//发送AT命令
|
||||||
send(at_port,at_command);
|
send(at_port,at_command);
|
||||||
return true;
|
return true;
|
||||||
@ -116,12 +141,91 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 自动填写到命令输入框
|
// 自动填写到命令输入框
|
||||||
function copyToSend()
|
function copy_to_input()
|
||||||
{
|
{
|
||||||
var command_select = document.getElementById("command_select").value;
|
var command_select = document.getElementById("command_select").value;
|
||||||
document.getElementById("at_command").value = command_select;
|
document.getElementById("at_command").value = command_select;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 无模组界面
|
||||||
|
function no_modems_view()
|
||||||
|
{
|
||||||
|
//更新提示信息
|
||||||
|
document.getElementById("info_message").innerHTML="<strong><%:No modems found%></strong>";
|
||||||
|
//显示提示信息
|
||||||
|
document.getElementById("cbi-info").style.display="block";
|
||||||
|
//隐藏模组选择界面
|
||||||
|
document.getElementById("cbi-modem").style.display="none";
|
||||||
|
//隐藏网络偏好界面
|
||||||
|
document.getElementById("cbi-mode").style.display="none";
|
||||||
|
//隐藏网络偏好界面
|
||||||
|
document.getElementById("cbi-network-prefer").style.display="none";
|
||||||
|
//隐藏AT界面
|
||||||
|
document.getElementById("cbi-at").style.display="none";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 有模组界面
|
||||||
|
function modems_view()
|
||||||
|
{
|
||||||
|
//显示模组选择界面
|
||||||
|
document.getElementById("cbi-modem").style.display="block";
|
||||||
|
//显示网络偏好界面
|
||||||
|
document.getElementById("cbi-mode").style.display="block";
|
||||||
|
//显示网络偏好界面
|
||||||
|
document.getElementById("cbi-network-prefer").style.display="block";
|
||||||
|
//显示AT命令界面
|
||||||
|
document.getElementById("cbi-at").style.display="block";
|
||||||
|
//隐藏提示信息
|
||||||
|
document.getElementById("cbi-info").style.display="none";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新选项
|
||||||
|
function update_option(select_element,data,order)
|
||||||
|
{
|
||||||
|
//记录所选
|
||||||
|
var selected=select_element.value;
|
||||||
|
//删除原来的选项
|
||||||
|
select_element.options.length=0;
|
||||||
|
|
||||||
|
//是否有顺序
|
||||||
|
if (order)
|
||||||
|
{
|
||||||
|
//遍历每一条信息
|
||||||
|
for (var info of data)
|
||||||
|
{
|
||||||
|
//遍历每一条信息里的键
|
||||||
|
for (var key in info)
|
||||||
|
{
|
||||||
|
var option = document.createElement('option');
|
||||||
|
option.text = key;
|
||||||
|
option.value = info[key];
|
||||||
|
select_element.appendChild(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//遍历每一条信息里的键
|
||||||
|
for (var key of data)
|
||||||
|
{
|
||||||
|
var option = document.createElement('option');
|
||||||
|
option.text = key;
|
||||||
|
option.value = info[key];
|
||||||
|
select_element.appendChild(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//恢复原来的选择
|
||||||
|
for (let i = 0; i < select_element.options.length; i++)
|
||||||
|
{
|
||||||
|
if(select_element.options[i].value == selected)
|
||||||
|
{
|
||||||
|
select_element.selectedIndex=i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 获取快捷命令
|
// 获取快捷命令
|
||||||
function get_quick_commands()
|
function get_quick_commands()
|
||||||
{
|
{
|
||||||
@ -132,62 +236,287 @@
|
|||||||
|
|
||||||
//获取AT命令
|
//获取AT命令
|
||||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "get_quick_commands")%>', {"option":quick_option,"port":at_port},
|
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "get_quick_commands")%>', {"option":quick_option,"port":at_port},
|
||||||
function(x, json)
|
function(x, data)
|
||||||
{
|
{
|
||||||
console.log(json);
|
|
||||||
|
|
||||||
//获取模组选择框元素
|
//获取模组选择框元素
|
||||||
var command_select = document.getElementById('command_select');
|
var command_select = document.getElementById('command_select');
|
||||||
//记录所选
|
//更新选项
|
||||||
var selected=command_select.value;
|
update_option(command_select,data["quick_commands"],true);
|
||||||
//删除原来的选项
|
|
||||||
command_select.options.length=0;
|
|
||||||
|
|
||||||
//获取快捷命令
|
//显示有模组界面
|
||||||
var quick_commands=json["quick_commands"];
|
modems_view();
|
||||||
//遍历每一条信息
|
|
||||||
for (var info of quick_commands)
|
|
||||||
{
|
|
||||||
//遍历每一条信息里的键
|
|
||||||
for (var key in info)
|
|
||||||
{
|
|
||||||
var option = document.createElement('option');
|
|
||||||
option.text = key;
|
|
||||||
option.value = info[key];
|
|
||||||
command_select.appendChild(option);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//恢复原来的选择
|
|
||||||
for (let i = 0; i < command_select.options.length; i++)
|
|
||||||
{
|
|
||||||
if(command_select.options[i].value == selected)
|
|
||||||
{
|
|
||||||
command_select.selectedIndex=i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
|
||||||
// 无模组界面
|
|
||||||
function no_modems_view()
|
|
||||||
{
|
|
||||||
//更新提示信息
|
|
||||||
document.getElementById("info_message").innerHTML="<strong><%:No modems found%></strong>";
|
|
||||||
//显示提示信息
|
|
||||||
document.getElementById("cbi-info").style.display="block";
|
|
||||||
//隐藏AT命令界面
|
|
||||||
document.getElementById("cbi-at").style.display="none";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 有模组界面
|
// 全选网络偏好复选框
|
||||||
function modems_view()
|
function all_choose_prefer_custom_config(status)
|
||||||
{
|
{
|
||||||
//显示AT命令界面
|
var checkboxes=document.getElementById('prefer_custom_config').querySelectorAll('input[type="checkbox"]');
|
||||||
document.getElementById("cbi-at").style.display="block";
|
for(checkbox of checkboxes)
|
||||||
//隐藏提示信息
|
{
|
||||||
document.getElementById("cbi-info").style.display="none";
|
//设置网络偏好复选框状态
|
||||||
|
checkbox.checked=status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 禁用网络偏好复选框
|
||||||
|
function disabled_prefer_custom_config(status)
|
||||||
|
{
|
||||||
|
var checkboxes=document.getElementById('prefer_custom_config').querySelectorAll('input[type="checkbox"]');
|
||||||
|
for(checkbox of checkboxes)
|
||||||
|
{
|
||||||
|
//禁用
|
||||||
|
checkbox.disabled=status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 禁用功能
|
||||||
|
function disabled_function(function_name,status)
|
||||||
|
{
|
||||||
|
//拨号模式
|
||||||
|
if (function_name=="mode")
|
||||||
|
{
|
||||||
|
//模式选项
|
||||||
|
document.getElementById('mode_option_qmi').disabled=status;
|
||||||
|
document.getElementById('mode_option_ecm').disabled=status;
|
||||||
|
document.getElementById('mode_option_mbim').disabled=status;
|
||||||
|
document.getElementById('mode_option_rndis').disabled=status;
|
||||||
|
document.getElementById('mode_option_ncm').disabled=status;
|
||||||
|
|
||||||
|
//模式按钮
|
||||||
|
document.getElementById('mode_button').disabled=status;
|
||||||
|
}
|
||||||
|
//网络偏好
|
||||||
|
else if (function_name=="network_prefer")
|
||||||
|
{
|
||||||
|
//偏好选项
|
||||||
|
document.getElementById('prefer_option_auto').disabled=status;
|
||||||
|
document.getElementById('prefer_option_custom').disabled=status;
|
||||||
|
|
||||||
|
//网络偏好为自动则不启用
|
||||||
|
var prefer_option_auto = document.getElementById('prefer_option_auto');
|
||||||
|
if (!prefer_option_auto.checked)
|
||||||
|
{
|
||||||
|
//偏好复选框
|
||||||
|
disabled_prefer_custom_config(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
//偏好按钮
|
||||||
|
document.getElementById('network_prefer_button').disabled=status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取拨号模式
|
||||||
|
function get_mode()
|
||||||
|
{
|
||||||
|
//获取选中的模组
|
||||||
|
var at_port = document.getElementById("modem_select").value;
|
||||||
|
|
||||||
|
//获取偏好
|
||||||
|
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "get_mode")%>', {"port":at_port},
|
||||||
|
function(x, data)
|
||||||
|
{
|
||||||
|
//获取当前拨号模式
|
||||||
|
var current_mode=data["mode"];
|
||||||
|
//获取支持的拨号模式
|
||||||
|
var modes=data["modes"];
|
||||||
|
|
||||||
|
//获取模式视图
|
||||||
|
var current_mode_view=current_mode.toUpperCase();
|
||||||
|
|
||||||
|
//设置当前拨号模式
|
||||||
|
document.getElementById('current_mode').innerHTML=current_mode_view;
|
||||||
|
|
||||||
|
var mode_first_element=document.getElementById('mode-first-checked');
|
||||||
|
if (mode_first_element.value=="true")
|
||||||
|
{
|
||||||
|
//设置支持的拨号模式
|
||||||
|
var mode_option_view='';
|
||||||
|
for(mode of modes)
|
||||||
|
{
|
||||||
|
if (mode=="gobinet")
|
||||||
|
{
|
||||||
|
mode_option_view=mode_option_view.replace("QMI","QMI/GobiNet");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mode_option_view+='<span class="cbi-radio"><input type="radio" name="mode_option" id="mode_option_'+mode+'" value="'+mode+'"><span>'+mode.toUpperCase()+'</span></span> ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.getElementById('mode_option').innerHTML=mode_option_view;
|
||||||
|
|
||||||
|
//设置拨号模式选项
|
||||||
|
document.getElementById('mode_option_'+current_mode).checked=true;
|
||||||
|
|
||||||
|
mode_first_element.value="false";
|
||||||
|
}
|
||||||
|
|
||||||
|
//显示有模组界面
|
||||||
|
// modems_view();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置拨号模式
|
||||||
|
function set_mode()
|
||||||
|
{
|
||||||
|
//禁用功能
|
||||||
|
disabled_function("mode",true);
|
||||||
|
|
||||||
|
//获取模式选项
|
||||||
|
var mode_config = document.querySelector('input[name="mode_option"]:checked').value;
|
||||||
|
//获取选中的模组
|
||||||
|
var at_port = document.getElementById("modem_select").value;
|
||||||
|
|
||||||
|
//设置偏好
|
||||||
|
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "set_mode")%>', {"port":at_port,"mode_config":mode_config},
|
||||||
|
function(x, data)
|
||||||
|
{
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
//获取模组拨号模式
|
||||||
|
var current_mode=data;
|
||||||
|
|
||||||
|
//获取模式视图
|
||||||
|
var current_mode_view=current_mode.toUpperCase();
|
||||||
|
|
||||||
|
//设置当前拨号模式
|
||||||
|
document.getElementById('current_mode').innerHTML=current_mode_view;
|
||||||
|
|
||||||
|
//启用功能
|
||||||
|
disabled_function("mode",false);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前网络视图
|
||||||
|
function get_current_prefer_view(network_prefer)
|
||||||
|
{
|
||||||
|
var current_prefer_view="";
|
||||||
|
|
||||||
|
//自动状态判断(全部选中为自动)
|
||||||
|
if (network_prefer["3G"]&&network_prefer["4G"]&&network_prefer["5G"])
|
||||||
|
{
|
||||||
|
//更新当前偏好
|
||||||
|
current_prefer_view="AUTO";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//更新当前偏好
|
||||||
|
for(key in network_prefer)
|
||||||
|
{
|
||||||
|
if (network_prefer[key]) {
|
||||||
|
current_prefer_view+=key+" ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return current_prefer_view;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取网络偏好
|
||||||
|
function get_network_prefer()
|
||||||
|
{
|
||||||
|
//获取选中的模组
|
||||||
|
var at_port = document.getElementById("modem_select").value;
|
||||||
|
|
||||||
|
//获取偏好
|
||||||
|
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "get_network_prefer")%>', {"port":at_port},
|
||||||
|
function(x, data)
|
||||||
|
{
|
||||||
|
//获取模组网络偏好
|
||||||
|
var network_prefer=data["network_prefer"];
|
||||||
|
|
||||||
|
//获取偏好视图
|
||||||
|
var current_prefer_view=get_current_prefer_view(network_prefer);
|
||||||
|
|
||||||
|
//设置当前网络偏好
|
||||||
|
document.getElementById('current_prefer').innerHTML=current_prefer_view;
|
||||||
|
|
||||||
|
//设置偏好选项和复选框
|
||||||
|
var prefer_first_element=document.getElementById('prefer-first-checked');
|
||||||
|
if (prefer_first_element.value=="true")
|
||||||
|
{
|
||||||
|
if (network_prefer["3G"]&&network_prefer["4G"]&&network_prefer["5G"])
|
||||||
|
{
|
||||||
|
//设置偏好选项
|
||||||
|
document.getElementById('prefer_option_auto').checked=true;
|
||||||
|
//更新偏好配置
|
||||||
|
all_choose_prefer_custom_config(true);
|
||||||
|
//禁用用偏好复选框
|
||||||
|
disabled_prefer_custom_config(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//设置偏好选项
|
||||||
|
document.getElementById('prefer_option_custom').checked=true;
|
||||||
|
//更新偏好配置
|
||||||
|
for (key in network_prefer)
|
||||||
|
{
|
||||||
|
//设置偏好配置
|
||||||
|
var prefer_config_element=document.getElementById('prefer_config_'+key.toLowerCase());
|
||||||
|
if (prefer_config_element!=null) {
|
||||||
|
prefer_config_element.checked=network_prefer[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//启用偏好复选框
|
||||||
|
disabled_prefer_custom_config(false);
|
||||||
|
}
|
||||||
|
prefer_first_element.value="false";
|
||||||
|
}
|
||||||
|
|
||||||
|
//显示有模组界面
|
||||||
|
// modems_view();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置网络偏好
|
||||||
|
function set_network_prefer()
|
||||||
|
{
|
||||||
|
//禁用功能
|
||||||
|
disabled_function("network_prefer",true);
|
||||||
|
|
||||||
|
//获取偏好选项
|
||||||
|
var prefer_option = document.querySelector('input[name="prefer_option"]:checked').value;
|
||||||
|
//获取选中的模组
|
||||||
|
var at_port = document.getElementById("modem_select").value;
|
||||||
|
|
||||||
|
//获取偏好配置
|
||||||
|
var network_prefer_config={};
|
||||||
|
if (prefer_option=="auto")
|
||||||
|
{
|
||||||
|
network_prefer_config["3G"]=1;
|
||||||
|
network_prefer_config["4G"]=1;
|
||||||
|
network_prefer_config["5G"]=1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var checkboxes=document.getElementById('prefer_custom_config').querySelectorAll('input[type="checkbox"]');
|
||||||
|
for(checkbox of checkboxes)
|
||||||
|
{
|
||||||
|
network_prefer_config[checkbox.value.toUpperCase()]=Number(checkbox.checked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置偏好
|
||||||
|
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "set_network_prefer")%>', {"port":at_port,"prefer_config":network_prefer_config},
|
||||||
|
function(x, data)
|
||||||
|
{
|
||||||
|
//获取模组网络偏好
|
||||||
|
var network_prefer=data["network_prefer"];
|
||||||
|
|
||||||
|
//获取当前偏好视图
|
||||||
|
var current_prefer_view=get_current_prefer_view(network_prefer);
|
||||||
|
|
||||||
|
//设置模组当前网络偏好
|
||||||
|
document.getElementById('current_prefer').innerHTML=current_prefer_view;
|
||||||
|
|
||||||
|
//启用功能
|
||||||
|
disabled_function("network_prefer",false);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 定时触发更新AT串口
|
// 定时触发更新AT串口
|
||||||
@ -210,8 +539,11 @@
|
|||||||
if (quick_option=="auto") {
|
if (quick_option=="auto") {
|
||||||
get_quick_commands();
|
get_quick_commands();
|
||||||
}
|
}
|
||||||
//显示有模组界面
|
//获取拨号模式
|
||||||
modems_view();
|
get_mode();
|
||||||
|
|
||||||
|
//获取网络偏好
|
||||||
|
get_network_prefer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -224,15 +556,34 @@
|
|||||||
<div class="cbi-map-descr"><%:Debug Your Module%></div>
|
<div class="cbi-map-descr"><%:Debug Your Module%></div>
|
||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
table {
|
/* table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-spacing: 10px;
|
border-spacing: 10px;
|
||||||
border: 0px;
|
border: 0px;
|
||||||
}
|
|
||||||
/* input {
|
|
||||||
vertical-align: bottom;
|
|
||||||
} */
|
} */
|
||||||
|
|
||||||
|
tr td:first-child {
|
||||||
|
width: 33%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* AT命令响应 */
|
||||||
|
/* #response_label {
|
||||||
|
font-size: 15px;
|
||||||
|
} */
|
||||||
|
|
||||||
|
/* 网络偏好第一次复选框 */
|
||||||
|
[name="first-checked"] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 终端 */
|
||||||
|
textarea {
|
||||||
|
background:#373737;
|
||||||
|
border:none;
|
||||||
|
color:#FFF;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
#popup {
|
#popup {
|
||||||
width:560px;
|
width:560px;
|
||||||
height:190px;
|
height:190px;
|
||||||
@ -248,80 +599,198 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
textarea {
|
|
||||||
background:#373737;
|
|
||||||
border:none;
|
|
||||||
color:#FFF;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
/* #command_select {
|
|
||||||
width: 100%;
|
|
||||||
} */
|
|
||||||
/* td {
|
|
||||||
width: 100%;
|
|
||||||
} */
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<fieldset class="cbi-section" id="cbi-info" style="display: block;">
|
<fieldset class="cbi-section" id="cbi-info" style="display: block;">
|
||||||
|
<div class="cbi-section fade-in">
|
||||||
<h3><%:Message%></h3>
|
<h3><%:Message%></h3>
|
||||||
<table>
|
<table class="table" id="message">
|
||||||
<tr>
|
<tr class="tr">
|
||||||
<td width="10%"></td>
|
<td colspan="2" class="td left">
|
||||||
<td width="60%">
|
|
||||||
<div align="left" id="info_message" style="font-size:1.875em">
|
<div align="left" id="info_message" style="font-size:1.875em">
|
||||||
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle"/>
|
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle"/>
|
||||||
<%:Loading modem information%>...
|
<%:Loading modem%>...
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td width="30%"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset class="cbi-section" id="cbi-modem" style="display: none;">
|
||||||
|
<div class="cbi-section fade-in">
|
||||||
|
<h3><%:Modem Select%></h3>
|
||||||
|
<div class="cbi-section-node">
|
||||||
|
<div class="cbi-value cbi-value-last">
|
||||||
|
<label class="cbi-value-title"><%:Modem Name%></label>
|
||||||
|
<div class="cbi-value-field">
|
||||||
|
<div class="cbi-checkbox">
|
||||||
|
<select name="modem_select" id="modem_select" class="cbi-input-select"></select>
|
||||||
|
</div>
|
||||||
|
<div class="cbi-value-description">
|
||||||
|
<%:Select a modem for debugging%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset class="cbi-section" id="cbi-mode" style="display: none;">
|
||||||
|
<div class="cbi-section cbi-tblsection">
|
||||||
|
<!-- <legend><%:AT Command%></legend> -->
|
||||||
|
<h3><%:Mode%></h3>
|
||||||
|
<table class="table cbi-section-table">
|
||||||
|
<tbody>
|
||||||
|
<tr class="tr cbi-section-table-titles anonymous">
|
||||||
|
<th class="th cbi-section-table-cell"><%:Current%></th>
|
||||||
|
<th class="th cbi-section-table-cell"><%:Config%></th>
|
||||||
|
<th class="th cbi-section-table-cell cbi-section-actions"></th>
|
||||||
|
</tr>
|
||||||
|
<tr class="tr cbi-section-table-row cbi-rowstyle-1">
|
||||||
|
<td class="td cbi-value-field" data-title="<%:Current%>" id="current_mode"></td>
|
||||||
|
<td class="td cbi-value-field" data-title="<%:Config%>" id="mode_option">
|
||||||
|
<!-- <div name="first-checked">
|
||||||
|
<input type="hidden" id="mode-first-checked" value="true">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span class="cbi-radio">
|
||||||
|
<input type="radio" name="mode_option" id="mode_option_qmi" value="qmi" checked="true">
|
||||||
|
<span>QMI</span>
|
||||||
|
</span>
|
||||||
|
<span class="cbi-radio">
|
||||||
|
<input type="radio" name="mode_option" id="mode_option_ecm" value="ecm">
|
||||||
|
<span>ECM</span>
|
||||||
|
</span>
|
||||||
|
<span class="cbi-radio">
|
||||||
|
<input type="radio" name="mode_option" id="mode_option_mbim" value="mbim">
|
||||||
|
<span>MBIM</span>
|
||||||
|
</span>
|
||||||
|
<span class="cbi-radio">
|
||||||
|
<input type="radio" name="mode_option" id="mode_option_rndis" value="rndis">
|
||||||
|
<span>RNDIS</span>
|
||||||
|
</span>
|
||||||
|
<span class="cbi-radio">
|
||||||
|
<input type="radio" name="mode_option" id="mode_option_ncm" value="ncm">
|
||||||
|
<span>NCM</span>
|
||||||
|
</span>
|
||||||
|
</div> -->
|
||||||
|
</td>
|
||||||
|
<td class="td">
|
||||||
|
<div name="first-checked">
|
||||||
|
<input type="hidden" id="mode-first-checked" value="true">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button class="btn cbi-button cbi-button-apply" id="mode_button" onclick="set_mode()" alt="<%:Apply%>" title="<%:Apply%>"><%:Apply%></button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset class="cbi-section" id="cbi-network-prefer" style="display: none;">
|
||||||
|
<div class="cbi-section cbi-tblsection">
|
||||||
|
<!-- <legend><%:AT Command%></legend> -->
|
||||||
|
<h3><%:Network Preferences%></h3>
|
||||||
|
<table class="table cbi-section-table">
|
||||||
|
<tbody>
|
||||||
|
<tr class="tr cbi-section-table-titles anonymous">
|
||||||
|
<th class="th cbi-section-table-cell"><%:Current%></th>
|
||||||
|
<th class="th cbi-section-table-cell"><%:Option%></th>
|
||||||
|
<th class="th cbi-section-table-cell"><%:Config%></th>
|
||||||
|
<th class="th cbi-section-table-cell cbi-section-actions"></th>
|
||||||
|
</tr>
|
||||||
|
<tr class="tr cbi-section-table-row cbi-rowstyle-1">
|
||||||
|
<td class="td cbi-value-field" data-title="<%:Current%>" id="current_prefer"></td>
|
||||||
|
<td class="td cbi-value-field" data-title="<%:Option%>" id="prefer_option">
|
||||||
|
<div>
|
||||||
|
<span class="cbi-radio">
|
||||||
|
<input type="radio" name="prefer_option" id="prefer_option_auto" value="auto" checked="true">
|
||||||
|
<span><%:Auto%></span>
|
||||||
|
</span>
|
||||||
|
<span class="cbi-radio">
|
||||||
|
<input type="radio" name="prefer_option" id="prefer_option_custom" value="custom">
|
||||||
|
<span><%:Custom%></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="td cbi-value-field" data-title="<%:Config%>" id="prefer_custom_config">
|
||||||
|
<div name="first-checked">
|
||||||
|
<input type="hidden" id="prefer-first-checked" value="true">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span class="cbi-checkbox">
|
||||||
|
<input id="prefer_config_3g" type="checkbox" class="cbi-input-checkbox" value="3g">
|
||||||
|
<span><%:3G%></span>
|
||||||
|
</span>
|
||||||
|
<span class="cbi-checkbox">
|
||||||
|
<input id="prefer_config_4g" type="checkbox" class="cbi-input-checkbox" value="4g">
|
||||||
|
<span><%:4G%></span>
|
||||||
|
</span>
|
||||||
|
<span class="cbi-checkbox">
|
||||||
|
<input id="prefer_config_5g" type="checkbox" class="cbi-input-checkbox" value="5g">
|
||||||
|
<span><%:5G%></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="td">
|
||||||
|
<div>
|
||||||
|
<button class="btn cbi-button cbi-button-apply" id="network_prefer_button" onclick="set_network_prefer()" alt="<%:Apply%>" title="<%:Apply%>"><%:Apply%></button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="cbi-section" id="cbi-at" style="display: none;">
|
<fieldset class="cbi-section" id="cbi-at" style="display: none;">
|
||||||
|
<div class="cbi-section fade-in">
|
||||||
<!-- <legend><%:AT Command%></legend> -->
|
<!-- <legend><%:AT Command%></legend> -->
|
||||||
<h3><%:AT Command%></h3>
|
<h3><%:AT Command%></h3>
|
||||||
|
<table class="table" id="at_command_info">
|
||||||
<table id="at_command_info">
|
<tbody>
|
||||||
<tr>
|
<!-- <tr class="tr">
|
||||||
<td style="width: 20%;"><div align="right"><%:Modem Select%></div></td>
|
<td class="td left"><%:Modem Select%></td>
|
||||||
<td><select name="modem_select" id="modem_select" class="cbi-input-select"></select></td>
|
<td class="td left"><select name="modem_select" id="modem_select" class="cbi-input-select"></select></td>
|
||||||
<td></td>
|
</tr> -->
|
||||||
<td></td>
|
<tr class="tr">
|
||||||
</tr>
|
<td class="td left"><%:Quick Option%></td>
|
||||||
<tr>
|
<td class="td left" id="quick_option_td">
|
||||||
<td style="width: 20%;"><div align="right"><%:Quick Option%></div></td>
|
<div>
|
||||||
<td id="quick_option_td">
|
<span class="cbi-radio">
|
||||||
<div align="left">
|
<input type="radio" name="quick_option" value="auto" checked="true">
|
||||||
<input type="radio" name="quick_option" value="auto" checked="checked"><%:Auto%>
|
<span><%:Auto%></span>
|
||||||
<input type="radio" name="quick_option" value="custom"><%:Custom%>
|
</span>
|
||||||
|
<span class="cbi-radio">
|
||||||
|
<input type="radio" name="quick_option" value="custom">
|
||||||
|
<span><%:Custom%></span>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr class="tr">
|
||||||
<td style="width: 20%;"><div align="right"><%:Quick Commands%></div></td>
|
<td class="td left"><%:Quick Commands%></td>
|
||||||
<td><select name="command_select" id="command_select" class="cbi-input-select" onclick="copyToSend()"></select></td>
|
<td class="td left"><select name="command_select" id="command_select" class="cbi-input-select" onclick="copy_to_input()"></select></td>
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr class="tr">
|
||||||
<td style="width: 20%;"><div align="right"><%:Enter Command%></div></td>
|
<td class="td left"><%:Enter Command%></td>
|
||||||
<td>
|
<td class="td left">
|
||||||
|
<div>
|
||||||
<input type="text" id="at_command" class="cbi-input-text"></input>
|
<input type="text" id="at_command" class="cbi-input-text"></input>
|
||||||
</td>
|
</div>
|
||||||
<td class="td cbi-section-table-cell nowrap cbi-section-actions" colspan="2">
|
|
||||||
<div>
|
<div>
|
||||||
<input class="cbi-button cbi-button-apply" type="button" value="<%:Send%>" onclick="send_at_command()" alt="<%:Send%>" title="<%:Send%>">
|
<input class="cbi-button cbi-button-apply" type="button" value="<%:Send%>" onclick="send_at_command()" alt="<%:Send%>" title="<%:Send%>">
|
||||||
<input class="cbi-button cbi-button-reset" type="button" value="<%:Clean%>" onclick="clean_at_command()" alt="<%:Clean%>" title="<%:Clean%>">
|
<input class="cbi-button cbi-button-reset" type="button" value="<%:Clean%>" onclick="clean_at_command()" alt="<%:Clean%>" title="<%:Clean%>">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr class="tr">
|
||||||
<td colspan="6">
|
<td colspan="2" class="td left">
|
||||||
<div><%:Response%></div>
|
<div id="response_label"><%:Response%></div><br/>
|
||||||
<div><textarea readonly="readonly" id="response" rows="20" maxlength="160"></textarea></div>
|
<div><textarea readonly="readonly" id="response" rows="20" maxlength="160"></textarea></div>
|
||||||
<div class="cbi-page-actions">
|
<div class="cbi-page-actions">
|
||||||
<input class="btn cbi-button cbi-button-link" type="button" value="<%:Return to old page%>" onclick="location.href='/cgi-bin/luci/admin/network/modem/at_command_old'">
|
<input class="btn cbi-button cbi-button-link" type="button" value="<%:Return to old page%>" onclick="location.href='/cgi-bin/luci/admin/network/modem/at_command_old'">
|
||||||
@ -329,7 +798,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -16,17 +16,26 @@ end
|
|||||||
g {color:grey; font-size:75%; vertical-align: super;}
|
g {color:grey; font-size:75%; vertical-align: super;}
|
||||||
|
|
||||||
/*移动端显示优化*/
|
/*移动端显示优化*/
|
||||||
@media (max-width: 768px) {
|
/* @media (max-width: 768px) {
|
||||||
tr td:first-child {
|
tr td:first-child {
|
||||||
width: 30%;
|
width: 30%;
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
table {
|
table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-spacing: 10px;
|
border-spacing: 10px;
|
||||||
border: 0px;
|
border: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr td:first-child {
|
||||||
|
width: 33%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 清除表格标题的样式 */
|
||||||
|
/* caption {
|
||||||
|
all: unset;
|
||||||
|
} */
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript" src="<%=resource%>/xhr.js"></script>
|
<script type="text/javascript" src="<%=resource%>/xhr.js"></script>
|
||||||
<script type="text/javascript">//<![CDATA[
|
<script type="text/javascript">//<![CDATA[
|
||||||
@ -69,7 +78,7 @@ end
|
|||||||
value=translation[value];
|
value=translation[value];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sim_info_view+='<tr><td width="20%" title="'+full_name+'">'+translation[key]+'</td><td id="'+key+'">'+value+'</td><td></td></tr>';
|
sim_info_view+='<tr class="tr"><td class="td left" title="'+full_name+'">'+translation[key]+'</td><td class="td left" id="'+key+'">'+value+'</td></tr>';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,7 +141,7 @@ end
|
|||||||
else if (key=="SCS") {
|
else if (key=="SCS") {
|
||||||
value=value+" KHz"
|
value=value+" KHz"
|
||||||
}
|
}
|
||||||
cell_info_view+='<tr><td width="20%" title="'+full_name+'">'+translation[key]+'</td><td id="'+key+'">'+value+'</td><td></td></tr>';
|
cell_info_view+='<tr class="tr"><td class="td left" title="'+full_name+'">'+translation[key]+'</td><td class="td left" id="'+key+'">'+value+'</td></tr>';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -147,16 +156,16 @@ end
|
|||||||
var network_mode=Object.keys(cell_info)[0];
|
var network_mode=Object.keys(cell_info)[0];
|
||||||
//获取视图
|
//获取视图
|
||||||
var cell_info_view='<caption>'+translation[network_mode]+'</caption>'; //网络模式视图
|
var cell_info_view='<caption>'+translation[network_mode]+'</caption>'; //网络模式视图
|
||||||
|
// var cell_info_view='<tr class="tr"><td class="td center" colspan="2">'+translation[network_mode]+'</td></tr>'; //网络模式视图
|
||||||
//获取网络模式下的信息
|
//获取网络模式下的信息
|
||||||
var network_mode_info=cell_info[network_mode];
|
var network_mode_info=cell_info[network_mode];
|
||||||
if (network_mode=="EN-DC Mode")
|
if (network_mode=="EN-DC Mode")
|
||||||
{
|
{
|
||||||
console.log(aaa);
|
|
||||||
var lte=network_mode_info[0]["LTE"];
|
var lte=network_mode_info[0]["LTE"];
|
||||||
cell_info_view+='<tr><td colspan="3">LTE</td></tr>';
|
cell_info_view+='<tr class="tr"><td class="td left" colspan="2">LTE</td></tr>';
|
||||||
cell_info_view+=get_cell_info_view(lte,"LTE",translation);
|
cell_info_view+=get_cell_info_view(lte,"LTE",translation);
|
||||||
var nsa=network_mode_info[1]["NR5G-NSA"];
|
var nsa=network_mode_info[1]["NR5G-NSA"];
|
||||||
cell_info_view+='<tr><td colspan="3">NR5G-NSA</td></tr>';
|
cell_info_view+='<tr class="tr"><td class="td left" colspan="2">NR5G-NSA</td></tr>';
|
||||||
cell_info_view+=get_cell_info_view(nsa,"NR",translation);
|
cell_info_view+=get_cell_info_view(nsa,"NR",translation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -396,97 +405,77 @@ end
|
|||||||
|
|
||||||
<div class="cbi-map" id="cbi-modem">
|
<div class="cbi-map" id="cbi-modem">
|
||||||
<h2 name="content"><%:Modem Information%></h2>
|
<h2 name="content"><%:Modem Information%></h2>
|
||||||
<div class="cbi-map-descr"><%:%></div>
|
<div class="cbi-map-descr"><%:Check information about adapted modem on this page%></div>
|
||||||
|
|
||||||
<!-- <fieldset class="cbi-section" id="simwarn" style="display:none;">
|
|
||||||
<legend><%:SIM警告%></legend>
|
|
||||||
<table width="550" border="0">
|
|
||||||
<tr>
|
|
||||||
<td width="10%"></td>
|
|
||||||
<td width="60%"><div align="left" id="simsg" style="font-size:1.875em"><strong></strong></div></td>
|
|
||||||
<td width="30%"></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</fieldset> -->
|
|
||||||
|
|
||||||
<fieldset class="cbi-section" id="cbi-info" style="display: block;">
|
<fieldset class="cbi-section" id="cbi-info" style="display: block;">
|
||||||
|
<div class="cbi-section fade-in">
|
||||||
<h3><%:Message%></h3>
|
<h3><%:Message%></h3>
|
||||||
<table>
|
<table class="table">
|
||||||
<tr>
|
<tbody id="message">
|
||||||
<td width="10%"></td>
|
<tr class="tr">
|
||||||
<td width="60%">
|
<td class="td left">
|
||||||
<div align="left" id="info_message" style="font-size:1.875em">
|
<div align="left" id="info_message" style="font-size:1.875em">
|
||||||
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle"/>
|
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle"/>
|
||||||
<%:Loading modem information%>...
|
<%:Loading modem information%>...
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td width="30%"></td>
|
<td class="td left"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="cbi-section" id="cbi-baseinfo" style="display: none;">
|
<fieldset class="cbi-section" id="cbi-baseinfo" style="display: none;">
|
||||||
|
<div class="cbi-section fade-in">
|
||||||
<h3><%:Base Information%></h3>
|
<h3><%:Base Information%></h3>
|
||||||
<table id="base_info">
|
<table class="table" id="base_info">
|
||||||
<tr>
|
<tbody>
|
||||||
<td width="20%"><%:Modem%></td><td id="modem_name">
|
<tr class="tr">
|
||||||
|
<td class="td left"><%:Modem%></td>
|
||||||
|
<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>
|
||||||
<td></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td width="20%"><%:Manufacturer%></td><td id="manufacturer"></td><td></td></tr>
|
<tr class="tr"><td class="td left"><%:Manufacturer%></td><td class="td left" id="manufacturer"></td></tr>
|
||||||
<tr><td width="20%"><%:Revision%></td><td id="revision"></td><td></td></tr>
|
<tr class="tr"><td class="td left"><%:Revision%></td><td class="td left" id="revision"></td></tr>
|
||||||
<tr><td width="20%"><%:Data Interface%></td><td id="data_interface"></td><td></td></tr>
|
<tr class="tr"><td class="td left"><%:Data Interface%></td><td class="td left" id="data_interface"></td></tr>
|
||||||
<tr><td width="20%"><%:Mode%></td><td id="mode"></td><td></td></tr>
|
<tr class="tr"><td class="td left"><%:Mode%></td><td class="td left" id="mode"></td></tr>
|
||||||
<tr><td width="20%"><%:AT Port%></td><td id="at_port"></td><td></td></tr>
|
<tr class="tr"><td class="td left"><%:AT Port%></td><td class="td left" id="at_port"></td></tr>
|
||||||
<tr><td width="20%"><%:Mobile Network%></td><td id="network"></td><td></td></tr>
|
<tr class="tr"><td class="td left"><%:Mobile Network%></td><td class="td left" id="network"></td></tr>
|
||||||
<tr><td width="20%"><%:Temperature%></td><td id="temperature"></td><td></td></tr>
|
<tr class="tr"><td class="td left"><%:Temperature%></td><td class="td left" id="temperature"></td></tr>
|
||||||
<tr><td width="20%"><%:Update Time%></td><td id="update_time"></td><td></td></tr>
|
<tr class="tr"><td class="td left"><%:Update Time%></td><td class="td left" id="update_time"></td></tr>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<% if nosms == 0 then %>
|
<% if nosms == 0 then %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<fieldset class="cbi-section" id="cbi-siminfo" style="display: none;">
|
<fieldset class="cbi-section" id="cbi-siminfo" style="display: none;">
|
||||||
|
<div class="cbi-section fade-in">
|
||||||
<h3><%:SIM Information%></h3>
|
<h3><%:SIM Information%></h3>
|
||||||
<table id="sim_info">
|
<table class="table" id="sim_info"></table>
|
||||||
<!-- <tr><td width="20%"><%:SIM Status%> :</td><td id="sim_status"></td><td></td></tr>
|
</div>
|
||||||
<tr><td width="20%"><%:ISP%> :</td><td id="isp"></td><td></td></tr>
|
|
||||||
<tr><td width="20%"><%:SIM Slot%> :</td><td id="sim_slot"></td><td></td></tr>
|
|
||||||
<tr><td width="20%"><%:SIM Number%> :</td><td id="sim_number"></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> -->
|
|
||||||
</table>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="cbi-section" id="cbi-networkinfo" style="display: none;">
|
<fieldset class="cbi-section" id="cbi-networkinfo" style="display: none;">
|
||||||
|
<div class="cbi-section fade-in">
|
||||||
<h3><%:Network Information%></h3>
|
<h3><%:Network Information%></h3>
|
||||||
<table>
|
<table id="network_info" class="table">
|
||||||
<tr><td width="20%"><%:Network Type%></td><td id="network_type"></td><td></td></tr>
|
<tbody>
|
||||||
|
<tr class="tr"><td class="td left"><%:Network Type%></td><td class="td left" id="network_type"></td></tr>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="cbi-section" id="cbi-cellinfo" style="display: none;">
|
<fieldset class="cbi-section" id="cbi-cellinfo" style="display: none;">
|
||||||
|
<div class="cbi-section fade-in">
|
||||||
<h3><%:Cell Information%></h3>
|
<h3><%:Cell Information%></h3>
|
||||||
<table id="cell_info">
|
<table class="table" id="cell_info"></table>
|
||||||
<!-- <tr><td width="20%"><%:MCC/MNC 国家码/网络码 %> :</td><td id="nr_mcc"></td><td id="nr_mnc"></td></tr>
|
</div>
|
||||||
<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>
|
||||||
|
|
||||||
<!-- <fieldset class="cbi-section" id="cbi-networkinfo" style="display: none;">
|
<!-- <fieldset class="cbi-section" id="cbi-networkinfo" style="display: none;">
|
||||||
|
@ -14,10 +14,10 @@ msgid "Modem Name"
|
|||||||
msgstr "模组名称"
|
msgstr "模组名称"
|
||||||
|
|
||||||
msgid "Modem Debug"
|
msgid "Modem Debug"
|
||||||
msgstr "模组名称"
|
msgstr "模组调试"
|
||||||
|
|
||||||
msgid "Modem Select"
|
msgid "Modem Select"
|
||||||
msgstr "选择模组"
|
msgstr "模组选择"
|
||||||
|
|
||||||
msgid "Check information about adapted modem on this page"
|
msgid "Check information about adapted modem on this page"
|
||||||
msgstr "在此页面查看已适配模组的信息"
|
msgstr "在此页面查看已适配模组的信息"
|
||||||
@ -34,8 +34,11 @@ msgstr "正在加载模组状态"
|
|||||||
msgid "Loading modem"
|
msgid "Loading modem"
|
||||||
msgstr "正在加载模组"
|
msgstr "正在加载模组"
|
||||||
|
|
||||||
msgid "Configuration panel for Modem, Add configuration to all modems on this page"
|
msgid "Dial Config"
|
||||||
msgstr "通信模组服务配置界面,在此页面给所有模组添加配置"
|
msgstr "拨号配置"
|
||||||
|
|
||||||
|
msgid "Add dialing configuration to all modules on this page"
|
||||||
|
msgstr "在此页面给所有模组添加拨号配置"
|
||||||
|
|
||||||
msgid "Global Config"
|
msgid "Global Config"
|
||||||
msgstr "全局配置"
|
msgstr "全局配置"
|
||||||
@ -64,6 +67,21 @@ msgstr "配置列表"
|
|||||||
msgid "Debug Your Module"
|
msgid "Debug Your Module"
|
||||||
msgstr "调试你的模组"
|
msgstr "调试你的模组"
|
||||||
|
|
||||||
|
msgid "Select a modem for debugging"
|
||||||
|
msgstr "选择一个模组进行调试"
|
||||||
|
|
||||||
|
msgid "Network Preferences"
|
||||||
|
msgstr "网络偏好"
|
||||||
|
|
||||||
|
msgid "Current"
|
||||||
|
msgstr "当前"
|
||||||
|
|
||||||
|
msgid "Option"
|
||||||
|
msgstr "选项"
|
||||||
|
|
||||||
|
msgid "Config"
|
||||||
|
msgstr "配置"
|
||||||
|
|
||||||
msgid "AT Command"
|
msgid "AT Command"
|
||||||
msgstr "AT命令"
|
msgstr "AT命令"
|
||||||
|
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
****************通用****************;ATI
|
|
||||||
模组信息 > ATI;ATI
|
|
||||||
查询SIM卡状态 > AT+CPIN?;AT+CPIN?
|
|
||||||
查询此时信号强度 > AT+CSQ;AT+CSQ
|
|
||||||
查询网络信息 > AT+COPS?;AT+COPS?
|
|
||||||
查询PDP信息 > AT+CGDCONT?;AT+CGDCONT?
|
|
||||||
最小功能模式 > AT+CFUN=0;AT+CFUN=0
|
|
||||||
全功能模式 > AT+CFUN=1;AT+CFUN=1
|
|
||||||
****************移远****************;ATI
|
|
||||||
SIM卡状态上报 > AT+QSIMSTAT?;AT+QSIMSTAT?
|
|
||||||
设置当前使用的为卡1 > AT+QUIMSLOT=1;AT+QUIMSLOT=1
|
|
||||||
设置当前使用的为卡2 > AT+QUIMSLOT=2;AT+QUIMSLOT=2
|
|
||||||
查询网络信息 > AT+QNWINFO;AT+QNWINFO
|
|
||||||
查询载波聚合参数 > AT+QCAINFO;AT+QCAINFO
|
|
||||||
查询当前拨号模式 > AT+QCFG="usbnet";AT+QCFG="usbnet"
|
|
||||||
QMI/GobiNet拨号 > AT+QCFG="usbnet",0;AT+QCFG="usbnet",0
|
|
||||||
ECM拨号 > AT+QCFG="usbnet",1;AT+QCFG="usbnet",1
|
|
||||||
MBIM拨号 > AT+QCFG="usbnet",2;AT+QCFG="usbnet",2
|
|
||||||
RNDIS拨号 > AT+QCFG="usbnet",3;AT+QCFG="usbnet",3
|
|
||||||
NCM拨号 > AT+QCFG="usbnet",5;AT+QCFG="usbnet",5
|
|
||||||
锁4G > AT+QNWPREFCFG="mode_pref",LTE;AT+QNWPREFCFG="mode_pref",LTE
|
|
||||||
锁5G > AT+QNWPREFCFG="mode_pref",NR5G;AT+QNWPREFCFG="mode_pref",NR5G
|
|
||||||
恢复自动搜索网络 > AT+QNWPREFCFG="mode_pref",AUTO;AT+QNWPREFCFG="mode_pref",AUTO
|
|
||||||
查询模组IMEI > AT+CGSN;AT+CGSN
|
|
||||||
查询模组IMEI > AT+GSN;AT+GSN
|
|
||||||
更改模组IMEI > AT+EGMR=1,7,"IMEI";AT+EGMR=1,7,"在此设置IMEI"
|
|
||||||
获取模组温度 > AT+QTEMP;AT+QTEMP
|
|
||||||
切换为USB通信端口 > AT+QCFG="data_interface",0,0;AT+QCFG="data_interface",0,0
|
|
||||||
切换为PCIE通信端口 > AT+QCFG="data_interface",1,0;AT+QCFG="data_interface",1,0
|
|
||||||
重置模组 > AT+CFUN=1,1;AT+CFUN=1,1
|
|
||||||
****************广和通****************;ATI
|
|
||||||
设置当前使用的为卡1 > AT+GTDUALSIM=0;AT+GTDUALSIM=0
|
|
||||||
设置当前使用的为卡2 > AT+GTDUALSIM=1;AT+GTDUALSIM=1
|
|
||||||
ECM手动拨号 > AT+GTRNDIS=1,1;AT+GTRNDIS=1,1
|
|
||||||
ECM拨号断开 > AT+GTRNDIS=0,1;AT+GTRNDIS=0,1
|
|
||||||
查询当前端口模式 > AT+GTUSBMODE?;AT+GTUSBMODE?
|
|
||||||
QMI/GobiNet拨号 > AT+GTUSBMODE=32;AT+GTUSBMODE=32
|
|
||||||
ECM拨号 > AT+GTUSBMODE=18;AT+GTUSBMODE=18
|
|
||||||
MBIM拨号 > AT+GTUSBMODE=30;AT+GTUSBMODE=30
|
|
||||||
RNDIS拨号 > AT+GTUSBMODE=24;AT+GTUSBMODE=24
|
|
||||||
NCM拨号 > AT+GTUSBMODE=18;AT+GTUSBMODE=18
|
|
||||||
锁4G > AT+GTACT=2;AT+GTACT=2
|
|
||||||
锁5G > AT+GTACT=14;AT+GTACT=14
|
|
||||||
恢复自动搜索网络 > AT+GTACT=20;AT+GTACT=20
|
|
||||||
查询当前连接的网络类型 > AT+PSRAT?;AT+PSRAT?
|
|
||||||
查询模组IMEI > AT+CGSN?;AT+CGSN?
|
|
||||||
查询模组IMEI > AT+GSN?;AT+GSN?
|
|
||||||
更改模组IMEI > AT+GTSN=1,7,"IMEI";AT+GTSN=1,7,"在此设置IMEI"
|
|
||||||
报告一次当前BBIC的温度 > AT+MTSM=1,6;AT+MTSM=1,6
|
|
||||||
报告一次当前射频的温度 > AT+MTSM=1,7;AT+MTSM=1,7
|
|
||||||
重置模组 > AT+CFUN=15;AT+CFUN=15
|
|
@ -106,7 +106,7 @@ set_firewall()
|
|||||||
set_ipv4_interface()
|
set_ipv4_interface()
|
||||||
{
|
{
|
||||||
#配置中不存在这个网络接口配置,或这个网络接口配置的设备不同
|
#配置中不存在这个网络接口配置,或这个网络接口配置的设备不同
|
||||||
[ "$(uci -q get network.$1.device)" != "$2" ] && {
|
if [ "$(uci -q get network.$1.device)" != "$2" ] && [ "$(uci -q get network.$1.ifname)" != "$2" ]; then
|
||||||
uci set network.$1='interface'
|
uci set network.$1='interface'
|
||||||
uci set network.$1.proto='dhcp'
|
uci set network.$1.proto='dhcp'
|
||||||
uci set network.$1.device="$2"
|
uci set network.$1.device="$2"
|
||||||
@ -118,7 +118,7 @@ set_ipv4_interface()
|
|||||||
|
|
||||||
#启动网络接口
|
#启动网络接口
|
||||||
ifup $1
|
ifup $1
|
||||||
}
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#设置IPv6网络接口
|
#设置IPv6网络接口
|
||||||
@ -126,7 +126,7 @@ set_ipv4_interface()
|
|||||||
# $2:网络接口
|
# $2:网络接口
|
||||||
set_ipv6_interface()
|
set_ipv6_interface()
|
||||||
{
|
{
|
||||||
if [ "$(uci -q get network.$1.device)" != "$2" ]; then
|
if [ "$(uci -q get network.$1.device)" != "$2" ] && [ "$(uci -q get network.$1.ifname)" != "$2" ] ; then
|
||||||
uci set network.$1='interface'
|
uci set network.$1='interface'
|
||||||
uci set network.$1.proto='dhcpv6'
|
uci set network.$1.proto='dhcpv6'
|
||||||
uci set network.$1.extendprefix='1'
|
uci set network.$1.extendprefix='1'
|
||||||
|
@ -3,7 +3,7 @@ current_dir="$(dirname "$0")"
|
|||||||
|
|
||||||
#获取拨号模式
|
#获取拨号模式
|
||||||
# $1:AT串口
|
# $1:AT串口
|
||||||
get_fibocom_mode()
|
get_mode()
|
||||||
{
|
{
|
||||||
local at_port="$1"
|
local at_port="$1"
|
||||||
at_command="AT+GTUSBMODE?"
|
at_command="AT+GTUSBMODE?"
|
||||||
@ -27,41 +27,130 @@ get_fibocom_mode()
|
|||||||
echo "$mode"
|
echo "$mode"
|
||||||
}
|
}
|
||||||
|
|
||||||
#获取AT命令
|
#设置拨号模式
|
||||||
get_fibocom_at_commands()
|
# $1:AT串口
|
||||||
|
# $2:拨号模式配置
|
||||||
|
set_mode()
|
||||||
{
|
{
|
||||||
local quick_commands="{\"quick_commands\":
|
#获取拨号模式配置
|
||||||
[
|
local mode_num
|
||||||
{\"模组信息 > ATI\":\"ATI\"},
|
|
||||||
{\"查询SIM卡状态 > AT+CPIN?\":\"AT+CPIN?\"},
|
case "$2" in
|
||||||
{\"查询此时信号强度 > AT+CSQ\":\"AT+CSQ\"},
|
"qmi") mode_num="32" ;;
|
||||||
{\"查询网络信息 > AT+COPS?\":\"AT+COPS?\"},
|
# "gobinet") mode_num="32" ;;
|
||||||
{\"查询PDP信息 > AT+CGDCONT?\":\"AT+CGDCONT?\"},
|
"ecm") mode_num="18" ;;
|
||||||
{\"最小功能模式 > AT+CFUN=0\":\"AT+CFUN=0\"},
|
"mbim") mode_num="30" ;;
|
||||||
{\"全功能模式 > AT+CFUN=1\":\"AT+CFUN=1\"},
|
"rndis") mode_num="24" ;;
|
||||||
{\"设置当前使用的为卡1 > AT+GTDUALSIM=0\":\"AT+GTDUALSIM=0\"},
|
"ncm") mode_num="18" ;;
|
||||||
{\"设置当前使用的为卡2 > AT+GTDUALSIM=1\":\"AT+GTDUALSIM=1\"},
|
*) mode_num="32" ;;
|
||||||
{\"ECM手动拨号 > AT+GTRNDIS=1,1\":\"AT+GTRNDIS=1,1\"},
|
esac
|
||||||
{\"ECM拨号断开 > AT+GTRNDIS=0,1\":\"AT+GTRNDIS=0,1\"},
|
|
||||||
{\"查询当前端口模式 > AT+GTUSBMODE?\":\"AT+GTUSBMODE?\"},
|
#设置模组
|
||||||
{\"QMI/GobiNet拨号 > AT+GTUSBMODE=32\":\"AT+GTUSBMODE=32\"},
|
local at_port="$1"
|
||||||
{\"ECM拨号 > AT+GTUSBMODE=18\":\"AT+GTUSBMODE=18\"},
|
at_command="AT+GTUSBMODE=$mode_num"
|
||||||
{\"MBIM拨号 > AT+GTUSBMODE=30\":\"AT+GTUSBMODE=30\"},
|
sh $current_dir/modem_at.sh $at_port "$at_command"
|
||||||
{\"RNDIS拨号 > AT+GTUSBMODE=24\":\"AT+GTUSBMODE=24\"},
|
}
|
||||||
{\"NCM拨号 > AT+GTUSBMODE=18\":\"AT+GTUSBMODE=18\"},
|
|
||||||
{\"锁4G > AT+GTACT=2\":\"AT+GTACT=2\"},
|
#获取网络偏好
|
||||||
{\"锁5G > AT+GTACT=14\":\"AT+GTACT=14\"},
|
# $1:AT串口
|
||||||
{\"恢复自动搜索网络 > AT+GTACT=20\":\"AT+GTACT=20\"},
|
get_network_prefer()
|
||||||
{\"查询当前连接的网络类型 > AT+PSRAT?\":\"AT+PSRAT?\"},
|
{
|
||||||
{\"查询模组IMEI > AT+CGSN?\":\"AT+CGSN?\"},
|
local at_port="$1"
|
||||||
{\"查询模组IMEI > AT+GSN?\":\"AT+GSN?\"},
|
at_command="AT+GTACT?"
|
||||||
{\"更改模组IMEI > AT+GTSN=1,7,\\\"IMEI\\\"\":\"AT+GTSN=1,7,\\\"在此设置IMEI\\\"\"},
|
local network_prefer_num=$(sh $current_dir/modem_at.sh $at_port $at_command | grep "+GTACT:" | awk -F',' '{print $1}' | sed 's/+GTACT: //g')
|
||||||
{\"报告一次当前BBIC的温度 > AT+MTSM=1,6\":\"AT+MTSM=1,6\"},
|
|
||||||
{\"报告一次当前射频的温度 > AT+MTSM=1,7\":\"AT+MTSM=1,7\"},
|
local network_prefer_3g="0";
|
||||||
{\"重置模组 > AT+CFUN=15\":\"AT+CFUN=15\"}
|
local network_prefer_4g="0";
|
||||||
]
|
local network_prefer_5g="0";
|
||||||
|
|
||||||
|
#匹配不同的网络类型
|
||||||
|
case "$network_prefer_num" in
|
||||||
|
"1") network_prefer_3g="1" ;;
|
||||||
|
"2") network_prefer_4g="1" ;;
|
||||||
|
"4")
|
||||||
|
network_prefer_3g="1"
|
||||||
|
network_prefer_4g="1"
|
||||||
|
;;
|
||||||
|
"10")
|
||||||
|
network_prefer_3g="1"
|
||||||
|
network_prefer_4g="1"
|
||||||
|
network_prefer_5g="1"
|
||||||
|
;;
|
||||||
|
"14") network_prefer_5g="1" ;;
|
||||||
|
"16")
|
||||||
|
network_prefer_3g="1"
|
||||||
|
network_prefer_5g="1"
|
||||||
|
;;
|
||||||
|
"17")
|
||||||
|
network_prefer_4g="1"
|
||||||
|
network_prefer_5g="1"
|
||||||
|
;;
|
||||||
|
"20")
|
||||||
|
network_prefer_3g="1"
|
||||||
|
network_prefer_4g="1"
|
||||||
|
network_prefer_5g="1"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
network_prefer_3g="1"
|
||||||
|
network_prefer_4g="1"
|
||||||
|
network_prefer_5g="1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
local network_prefer="{
|
||||||
|
\"network_prefer\":{
|
||||||
|
\"3G\":$network_prefer_3g,
|
||||||
|
\"4G\":$network_prefer_4g,
|
||||||
|
\"5G\":$network_prefer_5g
|
||||||
|
}
|
||||||
}"
|
}"
|
||||||
echo "$quick_commands"
|
echo "$network_prefer"
|
||||||
|
}
|
||||||
|
|
||||||
|
#设置网络偏好
|
||||||
|
# $1:AT串口
|
||||||
|
# $2:网络偏好配置
|
||||||
|
set_network_prefer()
|
||||||
|
{
|
||||||
|
local network_prefer="$2"
|
||||||
|
|
||||||
|
#获取网络偏好数字
|
||||||
|
local network_prefer_num
|
||||||
|
|
||||||
|
#获取选中的数量
|
||||||
|
local count=$(echo "$network_prefer" | grep -o "1" | wc -l)
|
||||||
|
#获取每个偏好的值
|
||||||
|
local network_prefer_3g=$(echo "$network_prefer" | jq -r '.["3G"]')
|
||||||
|
local network_prefer_4g=$(echo "$network_prefer" | jq -r '.["4G"]')
|
||||||
|
local network_prefer_5g=$(echo "$network_prefer" | jq -r '.["5G"]')
|
||||||
|
|
||||||
|
case "$count" in
|
||||||
|
"1")
|
||||||
|
if [ "$network_prefer_3g" = "1" ]; then
|
||||||
|
network_prefer_num="1"
|
||||||
|
elif [ "$network_prefer_4g" = "1" ]; then
|
||||||
|
network_prefer_num="2"
|
||||||
|
elif [ "$network_prefer_5g" = "1" ]; then
|
||||||
|
network_prefer_num="14"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"2")
|
||||||
|
if [ "$network_prefer_3g" = "1" ] && [ "$network_prefer_4g" = "1" ]; then
|
||||||
|
network_prefer_num="4"
|
||||||
|
elif [ "$network_prefer_3g" = "1" ] && [ "$network_prefer_5g" = "1" ]; then
|
||||||
|
network_prefer_num="16"
|
||||||
|
elif [ "$network_prefer_4g" = "1" ] && [ "$network_prefer_5g" = "1" ]; then
|
||||||
|
network_prefer_num="17"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"3") network_prefer_num="20" ;;
|
||||||
|
*) network_prefer_num="10" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
#设置模组
|
||||||
|
local at_port="$1"
|
||||||
|
at_command="AT+GTACT=$network_prefer_num"
|
||||||
|
sh $current_dir/modem_at.sh $at_port "$at_command"
|
||||||
}
|
}
|
||||||
|
|
||||||
#获取连接状态
|
#获取连接状态
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
模组信息 > ATI;ATI
|
|
||||||
查询SIM卡状态 > AT+CPIN?;AT+CPIN?
|
|
||||||
查询此时信号强度 > AT+CSQ;AT+CSQ
|
|
||||||
查询网络信息 > AT+COPS?;AT+COPS?
|
|
||||||
查询PDP信息 > AT+CGDCONT?;AT+CGDCONT?
|
|
||||||
最小功能模式 > AT+CFUN=0;AT+CFUN=0
|
|
||||||
全功能模式 > AT+CFUN=1;AT+CFUN=1
|
|
||||||
设置当前使用的为卡1 > AT+GTDUALSIM=0;AT+GTDUALSIM=0
|
|
||||||
设置当前使用的为卡2 > AT+GTDUALSIM=1;AT+GTDUALSIM=1
|
|
||||||
ECM手动拨号 > AT+GTRNDIS=1,1;AT+GTRNDIS=1,1
|
|
||||||
ECM拨号断开 > AT+GTRNDIS=0,1;AT+GTRNDIS=0,1
|
|
||||||
查询当前端口模式 > AT+GTUSBMODE?;AT+GTUSBMODE?
|
|
||||||
QMI/GobiNet拨号 > AT+GTUSBMODE=32;AT+GTUSBMODE=32
|
|
||||||
ECM拨号 > AT+GTUSBMODE=18;AT+GTUSBMODE=18
|
|
||||||
MBIM拨号 > AT+GTUSBMODE=30;AT+GTUSBMODE=30
|
|
||||||
RNDIS拨号 > AT+GTUSBMODE=24;AT+GTUSBMODE=24
|
|
||||||
NCM拨号 > AT+GTUSBMODE=18;AT+GTUSBMODE=18
|
|
||||||
锁4G > AT+GTACT=2;AT+GTACT=2
|
|
||||||
锁5G > AT+GTACT=14;AT+GTACT=14
|
|
||||||
恢复自动搜索网络 > AT+GTACT=20;AT+GTACT=20
|
|
||||||
查询当前连接的网络类型 > AT+PSRAT?;AT+PSRAT?
|
|
||||||
查询模组IMEI > AT+CGSN?;AT+CGSN?
|
|
||||||
查询模组IMEI > AT+GSN?;AT+GSN?
|
|
||||||
更改模组IMEI > AT+GTSN=1,7,"IMEI";AT+GTSN=1,7,"在此设置IMEI"
|
|
||||||
报告一次当前BBIC的温度 > AT+MTSM=1,6;AT+MTSM=1,6
|
|
||||||
报告一次当前射频的温度 > AT+MTSM=1,7;AT+MTSM=1,7
|
|
||||||
重置模组 > AT+CFUN=15;AT+CFUN=15
|
|
@ -40,24 +40,6 @@ at()
|
|||||||
# debug $1
|
# debug $1
|
||||||
# at $1 $2
|
# at $1 $2
|
||||||
|
|
||||||
#获取模块拨号模式
|
|
||||||
# $1:制造商
|
|
||||||
# $2:AT串口
|
|
||||||
get_mode()
|
|
||||||
{
|
|
||||||
local mode
|
|
||||||
case $1 in
|
|
||||||
"quectel") mode=$(get_$1_mode "$2") ;;
|
|
||||||
"fibocom") mode=$(get_$1_mode "$2") ;;
|
|
||||||
"simcom") mode=$(get_$1_mode "$2") ;;
|
|
||||||
*)
|
|
||||||
debug "未适配该模块"
|
|
||||||
mode="unknown"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo "$mode"
|
|
||||||
}
|
|
||||||
|
|
||||||
#获取快捷命令
|
#获取快捷命令
|
||||||
# $1:快捷选项
|
# $1:快捷选项
|
||||||
# $2:制造商
|
# $2:制造商
|
||||||
@ -66,7 +48,7 @@ get_quick_commands()
|
|||||||
local quick_commands
|
local quick_commands
|
||||||
case $1 in
|
case $1 in
|
||||||
"auto") quick_commands=$(cat $current_dir/$2_at_commands.json) ;;
|
"auto") quick_commands=$(cat $current_dir/$2_at_commands.json) ;;
|
||||||
"custom") quick_commands=$(cat $current_dir/custom_at_commands.json) ;;
|
"custom") quick_commands=$(cat /etc/modem/custom_at_commands.json) ;;
|
||||||
*) quick_commands=$(cat $current_dir/$2_at_commands.json) ;;
|
*) quick_commands=$(cat $current_dir/$2_at_commands.json) ;;
|
||||||
esac
|
esac
|
||||||
echo "$quick_commands"
|
echo "$quick_commands"
|
||||||
|
@ -145,7 +145,7 @@ setModemInfoConfig()
|
|||||||
uci set modem.modem$1.manufacturer="$manufacturer"
|
uci set modem.modem$1.manufacturer="$manufacturer"
|
||||||
|
|
||||||
#设置当前的拨号模式
|
#设置当前的拨号模式
|
||||||
local mode=$(get_mode $manufacturer $2)
|
local mode=$(source $current_dir/$manufacturer.sh && get_mode $2)
|
||||||
uci set modem.modem$1.mode="$mode"
|
uci set modem.modem$1.mode="$mode"
|
||||||
|
|
||||||
#设置支持的拨号模式
|
#设置支持的拨号模式
|
||||||
@ -159,23 +159,6 @@ setModemInfoConfig()
|
|||||||
done
|
done
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# #数据库中没有此模块的信息,使用默认值
|
|
||||||
# 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
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ current_dir="$(dirname "$0")"
|
|||||||
|
|
||||||
#获取拨号模式
|
#获取拨号模式
|
||||||
# $1:AT串口
|
# $1:AT串口
|
||||||
get_quectel_mode()
|
get_mode()
|
||||||
{
|
{
|
||||||
local at_port="$1"
|
local at_port="$1"
|
||||||
at_command='AT+QCFG="usbnet"'
|
at_command='AT+QCFG="usbnet"'
|
||||||
@ -22,40 +22,117 @@ get_quectel_mode()
|
|||||||
echo "$mode"
|
echo "$mode"
|
||||||
}
|
}
|
||||||
|
|
||||||
#获取AT命令
|
#设置拨号模式
|
||||||
get_quectel_at_commands()
|
# $1:AT串口
|
||||||
|
# $2:拨号模式配置
|
||||||
|
set_mode()
|
||||||
{
|
{
|
||||||
local quick_commands="\"quick_commands\":[
|
#获取拨号模式配置
|
||||||
{\"模组信息 > ATI\":\"ATI\"},
|
local mode_num
|
||||||
{\"查询SIM卡状态 > AT+CPIN?\":\"AT+CPIN?\"},
|
|
||||||
{\"查询此时信号强度 > AT+CSQ\":\"AT+CSQ\"},
|
case "$2" in
|
||||||
{\"查询网络信息 > AT+COPS?\":\"AT+COPS?\"},
|
"qmi") mode_num="0" ;;
|
||||||
{\"查询PDP信息 > AT+CGDCONT?\":\"AT+CGDCONT?\"},
|
# "gobinet") mode_num="0" ;;
|
||||||
{\"最小功能模式 > AT+CFUN=0\":\"AT+CFUN=0\"},
|
"ecm") mode_num="1" ;;
|
||||||
{\"全功能模式 > AT+CFUN=1\":\"AT+CFUN=1\"},
|
"mbim") mode_num="2" ;;
|
||||||
{\"SIM卡状态上报 > AT+QSIMSTAT?\":\"AT+QSIMSTAT?\"},
|
"rndis") mode_num="3" ;;
|
||||||
{\"设置当前使用的为卡1 > AT+QUIMSLOT=1\":\"AT+QUIMSLOT=1\"},
|
"ncm") mode_num="5" ;;
|
||||||
{\"设置当前使用的为卡2 > AT+QUIMSLOT=2\":\"AT+QUIMSLOT=2\"},
|
*) mode_num="0" ;;
|
||||||
{\"查询网络信息 > AT+QNWINFO\":\"AT+QNWINFO\"},
|
esac
|
||||||
{\"查询载波聚合参数 > AT+QCAINFO\":\"AT+QCAINFO\"},
|
|
||||||
{\"查询当前拨号模式 > AT+QCFG=\\\"usbnet\\\"\":\"AT+QCFG=\\\"usbnet\\\"\"},
|
#设置模组
|
||||||
{\"QMI/GobiNet拨号 > AT+QCFG=\\\"usbnet\\\",0\":\"AT+QCFG=\\\"usbnet\\\",0\"},
|
local at_port="$1"
|
||||||
{\"ECM拨号 > AT+QCFG=\\\"usbnet\\\",1\":\"AT+QCFG=\\\"usbnet\\\",1\"},
|
at_command='AT+QCFG="usbnet",'$mode_num
|
||||||
{\"MBIM拨号 > AT+QCFG=\\\"usbnet\\\",2\":\"AT+QCFG=\\\"usbnet\\\",2\"},
|
sh $current_dir/modem_at.sh $at_port "$at_command"
|
||||||
{\"RNDIS拨号 > AT+QCFG=\\\"usbnet\\\",3\":\"AT+QCFG=\\\"usbnet\\\",3\"},
|
}
|
||||||
{\"NCM拨号 > AT+QCFG=\\\"usbnet\\\",5\":\"AT+QCFG=\\\"usbnet\\\",5\"},
|
|
||||||
{\"锁4G > AT+QNWPREFCFG=\\\"mode_pref\\\",LTE\":\"AT+QNWPREFCFG=\\\"mode_pref\\\",LTE\"},
|
#获取网络偏好
|
||||||
{\"锁5G > AT+QNWPREFCFG=\\\"mode_pref\\\",NR5G\":\"AT+QNWPREFCFG=\\\"mode_pref\\\",NR5G\"},
|
# $1:AT串口
|
||||||
{\"恢复自动搜索网络 > AT+QNWPREFCFG=\\\"mode_pref\\\",AUTO\":\"AT+QNWPREFCFG=\\\"mode_pref\\\",AUTO\"},
|
get_network_prefer()
|
||||||
{\"查询模组IMEI > AT+CGSN\":\"AT+CGSN\"},
|
{
|
||||||
{\"查询模组IMEI > AT+GSN\":\"AT+GSN\"},
|
local at_port="$1"
|
||||||
{\"更改模组IMEI > AT+EGMR=1,7,\\\"IMEI\\\"\":\"AT+EGMR=1,7,\\\"在此设置IMEI\\\"\"},
|
at_command='AT+QNWPREFCFG="mode_pref"'
|
||||||
{\"获取模组温度 > AT+QTEMP\":\"AT+QTEMP\"},
|
local response=$(sh $current_dir/modem_at.sh $at_port $at_command | grep "+QNWPREFCFG:" | awk -F',' '{print $2}' | sed 's/\r//g')
|
||||||
{\"切换为USB通信端口 > AT+QCFG=\\\"data_interface\\\",0,0\":\"AT+QCFG=\\\"data_interface\\\",0,0\"},
|
|
||||||
{\"切换为PCIE通信端口 > AT+QCFG=\\\"data_interface\\\",1,0\":\"AT+QCFG=\\\"data_interface\\\",1,0\"},
|
local network_prefer_3g="0";
|
||||||
{\"重置模组 > AT+CFUN=1,1\":\"AT+CFUN=1,1\"}
|
local network_prefer_4g="0";
|
||||||
]"
|
local network_prefer_5g="0";
|
||||||
echo "$quick_commands"
|
|
||||||
|
#匹配不同的网络类型
|
||||||
|
local auto=$(echo $response | grep "AUTO")
|
||||||
|
if [ -n "$auto" ]; then
|
||||||
|
network_prefer_3g="1"
|
||||||
|
network_prefer_4g="1"
|
||||||
|
network_prefer_5g="1"
|
||||||
|
else
|
||||||
|
local wcdma=$(echo $response | grep "WCDMA")
|
||||||
|
local lte=$(echo $response | grep "LTE")
|
||||||
|
local nr=$(echo $response | grep "NR5G")
|
||||||
|
if [ -n "$wcdma" ]; then
|
||||||
|
network_prefer_3g="1"
|
||||||
|
fi
|
||||||
|
if [ -n "$lte" ]; then
|
||||||
|
network_prefer_4g="1"
|
||||||
|
fi
|
||||||
|
if [ -n "$nr" ]; then
|
||||||
|
network_prefer_5g="1"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
local network_prefer="{
|
||||||
|
\"network_prefer\":{
|
||||||
|
\"3G\":$network_prefer_3g,
|
||||||
|
\"4G\":$network_prefer_4g,
|
||||||
|
\"5G\":$network_prefer_5g
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
echo "$network_prefer"
|
||||||
|
}
|
||||||
|
|
||||||
|
#设置网络偏好
|
||||||
|
# $1:AT串口
|
||||||
|
# $2:网络偏好配置
|
||||||
|
set_network_prefer()
|
||||||
|
{
|
||||||
|
local network_prefer="$2"
|
||||||
|
|
||||||
|
#获取网络偏好配置
|
||||||
|
local network_prefer_config
|
||||||
|
|
||||||
|
#获取选中的数量
|
||||||
|
local count=$(echo "$network_prefer" | grep -o "1" | wc -l)
|
||||||
|
#获取每个偏好的值
|
||||||
|
local network_prefer_3g=$(echo "$network_prefer" | jq -r '.["3G"]')
|
||||||
|
local network_prefer_4g=$(echo "$network_prefer" | jq -r '.["4G"]')
|
||||||
|
local network_prefer_5g=$(echo "$network_prefer" | jq -r '.["5G"]')
|
||||||
|
|
||||||
|
case "$count" in
|
||||||
|
"1")
|
||||||
|
if [ "$network_prefer_3g" = "1" ]; then
|
||||||
|
network_prefer_config="WCDMA"
|
||||||
|
elif [ "$network_prefer_4g" = "1" ]; then
|
||||||
|
network_prefer_config="LTE"
|
||||||
|
elif [ "$network_prefer_5g" = "1" ]; then
|
||||||
|
network_prefer_config="NR5G"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"2")
|
||||||
|
if [ "$network_prefer_3g" = "1" ] && [ "$network_prefer_4g" = "1" ]; then
|
||||||
|
network_prefer_config="WCDMA:LTE"
|
||||||
|
elif [ "$network_prefer_3g" = "1" ] && [ "$network_prefer_5g" = "1" ]; then
|
||||||
|
network_prefer_config="WCDMA:NR5G"
|
||||||
|
elif [ "$network_prefer_4g" = "1" ] && [ "$network_prefer_5g" = "1" ]; then
|
||||||
|
network_prefer_config="LTE:NR5G"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"3") network_prefer_config="AUTO" ;;
|
||||||
|
*) network_prefer_config="AUTO" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
#设置模组
|
||||||
|
local at_port="$1"
|
||||||
|
at_command='AT+QNWPREFCFG="mode_pref",'$network_prefer_config
|
||||||
|
sh $current_dir/modem_at.sh $at_port "$at_command"
|
||||||
}
|
}
|
||||||
|
|
||||||
#获取连接状态
|
#获取连接状态
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
模组信息 > ATI;ATI
|
|
||||||
查询SIM卡状态 > AT+CPIN?;AT+CPIN?
|
|
||||||
查询此时信号强度 > AT+CSQ;AT+CSQ
|
|
||||||
查询网络信息 > AT+COPS?;AT+COPS?
|
|
||||||
查询PDP信息 > AT+CGDCONT?;AT+CGDCONT?
|
|
||||||
最小功能模式 > AT+CFUN=0;AT+CFUN=0
|
|
||||||
全功能模式 > AT+CFUN=1;AT+CFUN=1
|
|
||||||
SIM卡状态上报 > AT+QSIMSTAT?;AT+QSIMSTAT?
|
|
||||||
设置当前使用的为卡1 > AT+QUIMSLOT=1;AT+QUIMSLOT=1
|
|
||||||
设置当前使用的为卡2 > AT+QUIMSLOT=2;AT+QUIMSLOT=2
|
|
||||||
查询网络信息 > AT+QNWINFO;AT+QNWINFO
|
|
||||||
查询载波聚合参数 > AT+QCAINFO;AT+QCAINFO
|
|
||||||
查询当前拨号模式 > AT+QCFG="usbnet";AT+QCFG="usbnet"
|
|
||||||
QMI/GobiNet拨号 > AT+QCFG="usbnet",0;AT+QCFG="usbnet",0
|
|
||||||
ECM拨号 > AT+QCFG="usbnet",1;AT+QCFG="usbnet",1
|
|
||||||
MBIM拨号 > AT+QCFG="usbnet",2;AT+QCFG="usbnet",2
|
|
||||||
RNDIS拨号 > AT+QCFG="usbnet",3;AT+QCFG="usbnet",3
|
|
||||||
NCM拨号 > AT+QCFG="usbnet",5;AT+QCFG="usbnet",5
|
|
||||||
锁4G > AT+QNWPREFCFG="mode_pref",LTE;AT+QNWPREFCFG="mode_pref",LTE
|
|
||||||
锁5G > AT+QNWPREFCFG="mode_pref",NR5G;AT+QNWPREFCFG="mode_pref",NR5G
|
|
||||||
恢复自动搜索网络 > AT+QNWPREFCFG="mode_pref",AUTO;AT+QNWPREFCFG="mode_pref",AUTO
|
|
||||||
查询模组IMEI > AT+CGSN;AT+CGSN
|
|
||||||
查询模组IMEI > AT+GSN;AT+GSN
|
|
||||||
更改模组IMEI > AT+EGMR=1,7,"IMEI";AT+EGMR=1,7,"在此设置IMEI"
|
|
||||||
获取模组温度 > AT+QTEMP;AT+QTEMP
|
|
||||||
切换为USB通信端口 > AT+QCFG="data_interface",0,0;AT+QCFG="data_interface",0,0
|
|
||||||
切换为PCIE通信端口 > AT+QCFG="data_interface",1,0;AT+QCFG="data_interface",1,0
|
|
||||||
重置模组 > AT+CFUN=1,1;AT+CFUN=1,1
|
|
Loading…
x
Reference in New Issue
Block a user