更新模块插件
This commit is contained in:
parent
faf8288104
commit
88d5b7e5b8
@ -13,11 +13,12 @@ function index()
|
|||||||
|
|
||||||
entry({"admin", "network", "modem"}, alias("admin", "network", "modem", "modem_info"), translate("Modem"), 100).dependent = true
|
entry({"admin", "network", "modem"}, alias("admin", "network", "modem", "modem_info"), translate("Modem"), 100).dependent = true
|
||||||
|
|
||||||
--模块状态
|
--模块信息
|
||||||
entry({"admin", "network", "modem", "modem_info"}, template("modem/modem_info"), translate("Modem Information"),10).leaf = true
|
entry({"admin", "network", "modem", "modem_info"}, template("modem/modem_info"), translate("Modem Information"),10).leaf = true
|
||||||
entry({"admin", "network", "modem", "get_modem_info"}, call("getModemInfo"))
|
entry({"admin", "network", "modem", "get_at_port"}, call("getATPort"), nil).leaf = true
|
||||||
|
entry({"admin", "network", "modem", "get_modem_info"}, call("getModemInfo")).leaf = true
|
||||||
|
|
||||||
--模块设置
|
--拨号配置
|
||||||
entry({"admin", "network", "modem", "index"},cbi("modem/index"),translate("Dial 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
|
||||||
@ -25,14 +26,12 @@ function index()
|
|||||||
|
|
||||||
--模块调试
|
--模块调试
|
||||||
entry({"admin", "network", "modem", "modem_debug"},template("modem/modem_debug"),translate("Modem Debug"),30).leaf = true
|
entry({"admin", "network", "modem", "modem_debug"},template("modem/modem_debug"),translate("Modem Debug"),30).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", "get_network_prefer"}, call("getNetworkPrefer"), nil).leaf = true
|
entry({"admin", "network", "modem", "get_modem_debug_info"}, call("getModemDebugInfo"), 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
|
entry({"admin", "network", "modem", "set_mode"}, call("setMode"), nil).leaf = true
|
||||||
|
entry({"admin", "network", "modem", "set_network_prefer"}, call("setNetworkPrefer"), 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
|
||||||
end
|
end
|
||||||
@ -71,18 +70,18 @@ function getModemConnectStatus(at_port,manufacturer)
|
|||||||
|
|
||||||
local connect_status="unknown"
|
local connect_status="unknown"
|
||||||
|
|
||||||
if at_port and manufacturer then
|
if at_port and manufacturer~="unknown" then
|
||||||
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && get_connect_status "..at_port)
|
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && get_connect_status "..at_port)
|
||||||
connect_status = odpall:read("*a")
|
opd = odpall:read("*a")
|
||||||
connect_status = string.gsub(connect_status, "\n", "")
|
|
||||||
odpall:close()
|
odpall:close()
|
||||||
|
connect_status = string.gsub(opd, "\n", "")
|
||||||
end
|
end
|
||||||
|
|
||||||
return connect_status
|
return connect_status
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
@Description 获取模组基本信息
|
@Description 获取模组设备信息
|
||||||
@Params
|
@Params
|
||||||
at_port AT串口
|
at_port AT串口
|
||||||
]]
|
]]
|
||||||
@ -308,15 +307,17 @@ function getQuickCommands()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
--获取模组AT命令
|
--未适配模组时,快捷命令选项为自定义
|
||||||
local quick_commands={}
|
if manufacturer=="unknown" then
|
||||||
if quick_option and manufacturer then
|
quick_option="custom"
|
||||||
local odpall = io.popen("cd "..script_path.." && source "..script_path.."modem_debug.sh && get_quick_commands "..quick_option.." "..manufacturer)
|
|
||||||
local opd = odpall:read("*a")
|
|
||||||
quick_commands=json.parse(opd)
|
|
||||||
odpall:close()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--获取模组AT命令
|
||||||
|
local odpall = io.popen("cd "..script_path.." && source "..script_path.."modem_debug.sh && get_quick_commands "..quick_option.." "..manufacturer)
|
||||||
|
local opd = odpall:read("*a")
|
||||||
|
odpall:close()
|
||||||
|
local quick_commands=json.parse(opd)
|
||||||
|
|
||||||
-- 写入Web界面
|
-- 写入Web界面
|
||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(quick_commands)
|
luci.http.write_json(quick_commands)
|
||||||
@ -340,36 +341,6 @@ function sendATCommand()
|
|||||||
luci.http.write_json(response)
|
luci.http.write_json(response)
|
||||||
end
|
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 设置网络偏好
|
@Description 设置网络偏好
|
||||||
]]
|
]]
|
||||||
@ -405,43 +376,6 @@ function setNetworkPrefer()
|
|||||||
luci.http.write_json(network_prefer)
|
luci.http.write_json(network_prefer)
|
||||||
end
|
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 设置拨号模式
|
@Description 设置拨号模式
|
||||||
]]
|
]]
|
||||||
@ -475,4 +409,87 @@ function setMode()
|
|||||||
-- 写入Web界面
|
-- 写入Web界面
|
||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(mode)
|
luci.http.write_json(mode)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[
|
||||||
|
@Description 获取拨号模式信息
|
||||||
|
@Params
|
||||||
|
at_port AT串口
|
||||||
|
manufacturer 制造商
|
||||||
|
]]
|
||||||
|
function getModeInfo(at_port,manufacturer)
|
||||||
|
|
||||||
|
--获取支持的拨号模式
|
||||||
|
local modes
|
||||||
|
uci:foreach("modem", "modem-device", function (modem_device)
|
||||||
|
--设置模组AT串口
|
||||||
|
if at_port == modem_device["at_port"] then
|
||||||
|
modes=modem_device["modes"]
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
--获取模组拨号模式
|
||||||
|
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && get_mode "..at_port)
|
||||||
|
local opd = odpall:read("*a")
|
||||||
|
odpall:close()
|
||||||
|
local mode=string.gsub(opd, "\n", "")
|
||||||
|
|
||||||
|
-- 设置值
|
||||||
|
local mode_info={}
|
||||||
|
mode_info["mode"]=mode
|
||||||
|
mode_info["modes"]=modes
|
||||||
|
|
||||||
|
return mode_info
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[
|
||||||
|
@Description 获取网络偏好信息
|
||||||
|
@Params
|
||||||
|
at_port AT串口
|
||||||
|
manufacturer 制造商
|
||||||
|
]]
|
||||||
|
function getNetworkPreferInfo(at_port,manufacturer)
|
||||||
|
|
||||||
|
--获取模组网络偏好
|
||||||
|
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && get_network_prefer "..at_port)
|
||||||
|
local opd = odpall:read("*a")
|
||||||
|
odpall:close()
|
||||||
|
local network_prefer_info=json.parse(opd)
|
||||||
|
|
||||||
|
return network_prefer_info
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[
|
||||||
|
@Description 获取模组调试信息
|
||||||
|
]]
|
||||||
|
function getModemDebugInfo()
|
||||||
|
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 mode_info={}
|
||||||
|
local network_prefer_info={}
|
||||||
|
if manufacturer~="unknown" then
|
||||||
|
mode_info=getModeInfo(at_port,manufacturer)
|
||||||
|
network_prefer_info=getNetworkPreferInfo(at_port,manufacturer)
|
||||||
|
end
|
||||||
|
|
||||||
|
--设置值
|
||||||
|
local modem_debug_info={}
|
||||||
|
modem_debug_info["mode_info"]=mode_info
|
||||||
|
modem_debug_info["network_prefer_info"]=network_prefer_info
|
||||||
|
|
||||||
|
-- 写入Web界面
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json(modem_debug_info)
|
||||||
|
end
|
||||||
|
@ -156,7 +156,7 @@
|
|||||||
document.getElementById("cbi-info").style.display="block";
|
document.getElementById("cbi-info").style.display="block";
|
||||||
//隐藏模组选择界面
|
//隐藏模组选择界面
|
||||||
document.getElementById("cbi-modem").style.display="none";
|
document.getElementById("cbi-modem").style.display="none";
|
||||||
//隐藏网络偏好界面
|
//隐藏拨号模式界面
|
||||||
document.getElementById("cbi-mode").style.display="none";
|
document.getElementById("cbi-mode").style.display="none";
|
||||||
//隐藏网络偏好界面
|
//隐藏网络偏好界面
|
||||||
document.getElementById("cbi-network-prefer").style.display="none";
|
document.getElementById("cbi-network-prefer").style.display="none";
|
||||||
@ -169,15 +169,36 @@
|
|||||||
{
|
{
|
||||||
//显示模组选择界面
|
//显示模组选择界面
|
||||||
document.getElementById("cbi-modem").style.display="block";
|
document.getElementById("cbi-modem").style.display="block";
|
||||||
//显示网络偏好界面
|
|
||||||
document.getElementById("cbi-mode").style.display="block";
|
|
||||||
//显示网络偏好界面
|
|
||||||
document.getElementById("cbi-network-prefer").style.display="block";
|
|
||||||
//显示AT命令界面
|
//显示AT命令界面
|
||||||
document.getElementById("cbi-at").style.display="block";
|
document.getElementById("cbi-at").style.display="block";
|
||||||
//隐藏提示信息
|
//隐藏提示信息
|
||||||
|
// document.getElementById("cbi-info").style.display="none";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 未适配模组界面
|
||||||
|
function not_adapted_modems_view()
|
||||||
|
{
|
||||||
|
// 更新提示信息
|
||||||
|
document.getElementById("info_message").innerHTML="<strong><%:Not adapted to this modem%></strong>";
|
||||||
|
// 显示提示信息
|
||||||
|
document.getElementById("cbi-info").style.display="block";
|
||||||
|
//隐藏拨号模式界面
|
||||||
|
document.getElementById("cbi-mode").style.display="none";
|
||||||
|
//隐藏网络偏好界面
|
||||||
|
document.getElementById("cbi-network-prefer").style.display="none";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 全功能界面
|
||||||
|
function all_function_view()
|
||||||
|
{
|
||||||
|
//显示拨号模式界面
|
||||||
|
document.getElementById("cbi-mode").style.display="block";
|
||||||
|
//显示网络偏好界面
|
||||||
|
document.getElementById("cbi-network-prefer").style.display="block";
|
||||||
|
//隐藏提示信息
|
||||||
document.getElementById("cbi-info").style.display="none";
|
document.getElementById("cbi-info").style.display="none";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 更新选项
|
// 更新选项
|
||||||
function update_option(select_element,data,order)
|
function update_option(select_element,data,order)
|
||||||
@ -307,55 +328,41 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取拨号模式
|
// 设置拨号模式信息
|
||||||
function get_mode()
|
function set_mode_info(mode_info)
|
||||||
{
|
{
|
||||||
//获取选中的模组
|
//获取当前拨号模式
|
||||||
var at_port = document.getElementById("modem_select").value;
|
var current_mode=mode_info["mode"];
|
||||||
|
//获取支持的拨号模式
|
||||||
|
var modes=mode_info["modes"];
|
||||||
|
|
||||||
//获取偏好
|
//获取模式视图
|
||||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "get_mode")%>', {"port":at_port},
|
var current_mode_view=current_mode.toUpperCase();
|
||||||
function(x, data)
|
|
||||||
|
//设置当前拨号模式
|
||||||
|
document.getElementById('current_mode').innerHTML=current_mode_view;
|
||||||
|
|
||||||
|
var first_element=document.getElementById('first-checked');
|
||||||
|
if (first_element.value=="true")
|
||||||
|
{
|
||||||
|
//设置支持的拨号模式
|
||||||
|
var mode_option_view='';
|
||||||
|
for(mode of modes)
|
||||||
{
|
{
|
||||||
//获取当前拨号模式
|
if (mode=="gobinet")
|
||||||
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")
|
|
||||||
{
|
{
|
||||||
//设置支持的拨号模式
|
mode_option_view=mode_option_view.replace("QMI","QMI/GobiNet");
|
||||||
var mode_option_view='';
|
}
|
||||||
for(mode of modes)
|
else
|
||||||
{
|
{
|
||||||
if (mode=="gobinet")
|
mode_option_view+='<span class="cbi-radio"><input type="radio" name="mode_option" id="mode_option_'+mode+'" value="'+mode+'"><span>'+mode.toUpperCase()+'</span></span> ';
|
||||||
{
|
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
);
|
document.getElementById('mode_option').innerHTML=mode_option_view;
|
||||||
|
|
||||||
|
//设置拨号模式选项
|
||||||
|
document.getElementById('mode_option_'+current_mode).checked=true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置拨号模式
|
// 设置拨号模式
|
||||||
@ -415,61 +422,48 @@
|
|||||||
return current_prefer_view;
|
return current_prefer_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取网络偏好
|
// 设置网络偏好信息
|
||||||
function get_network_prefer()
|
function set_network_prefer_info(network_prefer_info)
|
||||||
{
|
{
|
||||||
//获取选中的模组
|
//获取模组网络偏好
|
||||||
var at_port = document.getElementById("modem_select").value;
|
var network_prefer=network_prefer_info["network_prefer"];
|
||||||
|
|
||||||
//获取偏好
|
//获取偏好视图
|
||||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "get_network_prefer")%>', {"port":at_port},
|
var current_prefer_view=get_current_prefer_view(network_prefer);
|
||||||
function(x, data)
|
|
||||||
|
//设置当前网络偏好
|
||||||
|
document.getElementById('current_prefer').innerHTML=current_prefer_view;
|
||||||
|
|
||||||
|
//设置偏好选项和复选框
|
||||||
|
var first_element=document.getElementById('first-checked');
|
||||||
|
if (first_element.value=="true")
|
||||||
|
{
|
||||||
|
if (network_prefer["3G"]&&network_prefer["4G"]&&network_prefer["5G"])
|
||||||
{
|
{
|
||||||
//获取模组网络偏好
|
//设置偏好选项
|
||||||
var network_prefer=data["network_prefer"];
|
document.getElementById('prefer_option_auto').checked=true;
|
||||||
|
//更新偏好配置
|
||||||
//获取偏好视图
|
all_choose_prefer_custom_config(true);
|
||||||
var current_prefer_view=get_current_prefer_view(network_prefer);
|
//禁用用偏好复选框
|
||||||
|
disabled_prefer_custom_config(true);
|
||||||
//设置当前网络偏好
|
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置网络偏好
|
// 设置网络偏好
|
||||||
@ -519,6 +513,40 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取模组调试信息
|
||||||
|
function get_modem_debug_info(params)
|
||||||
|
{
|
||||||
|
//获取选中的模组
|
||||||
|
var at_port = document.getElementById("modem_select").value;
|
||||||
|
|
||||||
|
//获取调试信息
|
||||||
|
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "get_modem_debug_info")%>', {"port":at_port},
|
||||||
|
function(x, data)
|
||||||
|
{
|
||||||
|
|
||||||
|
var mode_info=data["mode_info"];
|
||||||
|
var network_prefer_info=data["network_prefer_info"];
|
||||||
|
if (Object.keys(mode_info).length==0||Object.keys(network_prefer_info).length==0) {
|
||||||
|
//显示未适配模组界面
|
||||||
|
not_adapted_modems_view();
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置模式信息
|
||||||
|
set_mode_info(mode_info);
|
||||||
|
|
||||||
|
//设置网络偏好信息
|
||||||
|
set_network_prefer_info(network_prefer_info);
|
||||||
|
|
||||||
|
//设置第一次获取数据标志
|
||||||
|
document.getElementById('first-checked').value=false;
|
||||||
|
|
||||||
|
//显示全功能界面
|
||||||
|
all_function_view();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// 定时触发更新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, port)
|
||||||
@ -539,11 +567,8 @@
|
|||||||
if (quick_option=="auto") {
|
if (quick_option=="auto") {
|
||||||
get_quick_commands();
|
get_quick_commands();
|
||||||
}
|
}
|
||||||
//获取拨号模式
|
//获取模组调试信息
|
||||||
get_mode();
|
get_modem_debug_info();
|
||||||
|
|
||||||
//获取网络偏好
|
|
||||||
get_network_prefer();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -620,6 +645,7 @@
|
|||||||
|
|
||||||
<fieldset class="cbi-section" id="cbi-modem" style="display: none;">
|
<fieldset class="cbi-section" id="cbi-modem" style="display: none;">
|
||||||
<div class="cbi-section fade-in">
|
<div class="cbi-section fade-in">
|
||||||
|
<!-- <legend><%:Modem Select%></legend> -->
|
||||||
<h3><%:Modem Select%></h3>
|
<h3><%:Modem Select%></h3>
|
||||||
<div class="cbi-section-node">
|
<div class="cbi-section-node">
|
||||||
<div class="cbi-value cbi-value-last">
|
<div class="cbi-value cbi-value-last">
|
||||||
@ -634,12 +660,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div name="first-checked">
|
||||||
|
<input type="hidden" id="first-checked" value="true">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="cbi-section" id="cbi-mode" style="display: none;">
|
<fieldset class="cbi-section" id="cbi-mode" style="display: none;">
|
||||||
<div class="cbi-section cbi-tblsection">
|
<div class="cbi-section cbi-tblsection">
|
||||||
<!-- <legend><%:AT Command%></legend> -->
|
<!-- <legend><%:Mode%></legend> -->
|
||||||
<h3><%:Mode%></h3>
|
<h3><%:Mode%></h3>
|
||||||
<table class="table cbi-section-table">
|
<table class="table cbi-section-table">
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -651,10 +680,7 @@
|
|||||||
<tr class="tr cbi-section-table-row cbi-rowstyle-1">
|
<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="<%:Current%>" id="current_mode"></td>
|
||||||
<td class="td cbi-value-field" data-title="<%:Config%>" id="mode_option">
|
<td class="td cbi-value-field" data-title="<%:Config%>" id="mode_option">
|
||||||
<!-- <div name="first-checked">
|
<!-- <div>
|
||||||
<input type="hidden" id="mode-first-checked" value="true">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<span class="cbi-radio">
|
<span class="cbi-radio">
|
||||||
<input type="radio" name="mode_option" id="mode_option_qmi" value="qmi" checked="true">
|
<input type="radio" name="mode_option" id="mode_option_qmi" value="qmi" checked="true">
|
||||||
<span>QMI</span>
|
<span>QMI</span>
|
||||||
@ -678,9 +704,6 @@
|
|||||||
</div> -->
|
</div> -->
|
||||||
</td>
|
</td>
|
||||||
<td class="td">
|
<td class="td">
|
||||||
<div name="first-checked">
|
|
||||||
<input type="hidden" id="mode-first-checked" value="true">
|
|
||||||
</div>
|
|
||||||
<div>
|
<div>
|
||||||
<button class="btn cbi-button cbi-button-apply" id="mode_button" onclick="set_mode()" alt="<%:Apply%>" title="<%:Apply%>"><%:Apply%></button>
|
<button class="btn cbi-button cbi-button-apply" id="mode_button" onclick="set_mode()" alt="<%:Apply%>" title="<%:Apply%>"><%:Apply%></button>
|
||||||
</div>
|
</div>
|
||||||
@ -693,7 +716,7 @@
|
|||||||
|
|
||||||
<fieldset class="cbi-section" id="cbi-network-prefer" style="display: none;">
|
<fieldset class="cbi-section" id="cbi-network-prefer" style="display: none;">
|
||||||
<div class="cbi-section cbi-tblsection">
|
<div class="cbi-section cbi-tblsection">
|
||||||
<!-- <legend><%:AT Command%></legend> -->
|
<!-- <legend><%:Network Preferences%></legend> -->
|
||||||
<h3><%:Network Preferences%></h3>
|
<h3><%:Network Preferences%></h3>
|
||||||
<table class="table cbi-section-table">
|
<table class="table cbi-section-table">
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -718,9 +741,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="td cbi-value-field" data-title="<%:Config%>" id="prefer_custom_config">
|
<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>
|
<div>
|
||||||
<span class="cbi-checkbox">
|
<span class="cbi-checkbox">
|
||||||
<input id="prefer_config_3g" type="checkbox" class="cbi-input-checkbox" value="3g">
|
<input id="prefer_config_3g" type="checkbox" class="cbi-input-checkbox" value="3g">
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
}
|
}
|
||||||
else if (name=="unknown")
|
else if (name=="unknown")
|
||||||
{
|
{
|
||||||
language=="en" ? name=name.toUpperCase() : translation[name];
|
language=="en" ? name=name.toUpperCase() : name=translation[name];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -44,7 +44,7 @@
|
|||||||
}
|
}
|
||||||
else if (mode=="unknown")
|
else if (mode=="unknown")
|
||||||
{
|
{
|
||||||
language=="en" ? mode=mode.toUpperCase() : translation[mode];
|
language=="en" ? mode=mode.toUpperCase() : mode=translation[mode];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -145,7 +145,12 @@ setModemInfoConfig()
|
|||||||
uci set modem.modem$1.manufacturer="$manufacturer"
|
uci set modem.modem$1.manufacturer="$manufacturer"
|
||||||
|
|
||||||
#设置当前的拨号模式
|
#设置当前的拨号模式
|
||||||
local mode=$(source $current_dir/$manufacturer.sh && get_mode $2)
|
local mode
|
||||||
|
if [ "$manufacturer" = "unknown" ]; then
|
||||||
|
mode="unknown"
|
||||||
|
else
|
||||||
|
mode=$(source $current_dir/$manufacturer.sh && get_mode $2)
|
||||||
|
fi
|
||||||
uci set modem.modem$1.mode="$mode"
|
uci set modem.modem$1.mode="$mode"
|
||||||
|
|
||||||
#设置支持的拨号模式
|
#设置支持的拨号模式
|
||||||
|
Loading…
x
Reference in New Issue
Block a user