diff --git a/luci-app-modem/luasrc/controller/modem.lua b/luci-app-modem/luasrc/controller/modem.lua
index a4bffb7..3956261 100644
--- a/luci-app-modem/luasrc/controller/modem.lua
+++ b/luci-app-modem/luasrc/controller/modem.lua
@@ -18,7 +18,7 @@ function index()
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", "get_modems"}, call("getModems"), nil).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_quick_commands"}, call("getQuickCommands"), 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", "mode_info"}, call("modeInfo"), nil).leaf = true
+ entry({"admin", "network", "modem", "get_network_prefer"}, call("getNetworkPrefer"), 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命令旧界面
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 odp = odpall:read("*a")
odpall:close()
+ odp=string.gsub(odp, "\r", "")
return odp
end
@@ -71,7 +74,7 @@ function getModemConnectStatus(at_port,manufacturer)
if at_port and manufacturer then
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && get_connect_status "..at_port)
connect_status = odpall:read("*a")
- connect_status=string.gsub(connect_status, "\n", "")
+ connect_status = string.gsub(connect_status, "\n", "")
odpall:close()
end
@@ -238,81 +241,6 @@ function act_status()
luci.http.write_json(e)
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 获取模组的备注
@Params
@@ -392,4 +320,159 @@ function getQuickCommands()
-- 写入Web界面
luci.http.prepare_content("application/json")
luci.http.write_json(quick_commands)
+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
\ No newline at end of file
diff --git a/luci-app-modem/luasrc/model/cbi/modem/index.lua b/luci-app-modem/luasrc/model/cbi/modem/index.lua
index 249a9a3..357e8cb 100644
--- a/luci-app-modem/luasrc/model/cbi/modem/index.lua
+++ b/luci-app-modem/luasrc/model/cbi/modem/index.lua
@@ -2,7 +2,7 @@ local d = require "luci.dispatcher"
local uci = luci.model.uci.cursor()
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")
--全局配置
diff --git a/luci-app-modem/luasrc/view/modem/at_command_old.htm b/luci-app-modem/luasrc/view/modem/at_command_old.htm
index 117ba52..afe4211 100644
--- a/luci-app-modem/luasrc/view/modem/at_command_old.htm
+++ b/luci-app-modem/luasrc/view/modem/at_command_old.htm
@@ -13,27 +13,40 @@
<%:AT Commands%>
- <%:Debugging Your Module with AT Command%>
+ <%:Debug Your Module%>
-
<%:Modem Select%>:
+
<%:Modem Select%>
-
+
-
<%:User AT Commands%>:
+
<%:Quick Commands%>
-
+
-
<%:Command to send%>:
+
<%:Enter Command%>
diff --git a/luci-app-modem/luasrc/view/modem/modem_debug.htm b/luci-app-modem/luasrc/view/modem/modem_debug.htm
index 2d53163..f45c98f 100644
--- a/luci-app-modem/luasrc/view/modem/modem_debug.htm
+++ b/luci-app-modem/luasrc/view/modem/modem_debug.htm
@@ -13,16 +13,38 @@
get_quick_commands();
});
-
//获取快捷选项父元素
- var quick_option = document.getElementById('quick_option_td');
- quick_option.addEventListener('change', function(event) {
+ var quick_option_element = document.getElementById('quick_option_td');
+ //更换快捷选项时触发
+ quick_option_element.addEventListener('change', function(event) {
var target = event.target;
if (target.matches('input[type="radio"]')) {
//获取快捷命令
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命令
@@ -37,6 +59,8 @@
responseElement.value+=data["time"];
//显示返回值
responseElement.value+=data["response"];
+ //滚动到底部
+ responseElement.scrollTop = responseElement.scrollHeight;
}
}
);
@@ -49,7 +73,6 @@
var at_port = document.getElementById("modem_select").value;
if ( at_port.length == 0 )
{
- // document.getElementById("odp").innerHTML = "";
alert("<%:Please choose a Modem%>");
return false;
}
@@ -58,11 +81,13 @@
var at_command = document.getElementById("at_command").value;
if ( at_command.length == 0 )
{
- // document.getElementById("odp").innerHTML = "";
alert("<%:Please enter a AT Command%>");
return false;
}
+ //对双引号进行特殊处理
+ at_command=at_command.replaceAll("\"","\\\"");
+
//发送AT命令
send(at_port,at_command);
return true;
@@ -116,12 +141,91 @@
}
// 自动填写到命令输入框
- function copyToSend()
+ function copy_to_input()
{
var command_select = document.getElementById("command_select").value;
document.getElementById("at_command").value = command_select;
}
+ // 无模组界面
+ function no_modems_view()
+ {
+ //更新提示信息
+ document.getElementById("info_message").innerHTML="
<%:No modems found%>";
+ //显示提示信息
+ 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()
{
@@ -132,62 +236,287 @@
//获取AT命令
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 selected=command_select.value;
- //删除原来的选项
- command_select.options.length=0;
+ //更新选项
+ update_option(command_select,data["quick_commands"],true);
- //获取快捷命令
- var quick_commands=json["quick_commands"];
- //遍历每一条信息
- 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;
- }
- }
+ //显示有模组界面
+ modems_view();
}
);
- };
-
- // 无模组界面
- function no_modems_view()
- {
- //更新提示信息
- document.getElementById("info_message").innerHTML="
<%:No modems found%>";
- //显示提示信息
- 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命令界面
- document.getElementById("cbi-at").style.display="block";
- //隐藏提示信息
- document.getElementById("cbi-info").style.display="none";
+ var checkboxes=document.getElementById('prefer_custom_config').querySelectorAll('input[type="checkbox"]');
+ for(checkbox of checkboxes)
+ {
+ //设置网络偏好复选框状态
+ 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+='
'+mode.toUpperCase()+' ';
+ }
+ }
+ 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串口
@@ -210,8 +539,11 @@
if (quick_option=="auto") {
get_quick_commands();
}
- //显示有模组界面
- modems_view();
+ //获取拨号模式
+ get_mode();
+
+ //获取网络偏好
+ get_network_prefer();
}
}
);
@@ -224,15 +556,34 @@
<%:Debug Your Module%>
+
+
+
+
+
+
+
+
<%:Mode%>
+
+
+
+ <%:Current%> |
+ <%:Config%> |
+ |
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
<%:Network Preferences%>
+
+
-
- <%:AT Command%>
-
-
+
diff --git a/luci-app-modem/luasrc/view/modem/modem_info.htm b/luci-app-modem/luasrc/view/modem/modem_info.htm
index 12db86c..f371f69 100644
--- a/luci-app-modem/luasrc/view/modem/modem_info.htm
+++ b/luci-app-modem/luasrc/view/modem/modem_info.htm
@@ -16,17 +16,26 @@ end
g {color:grey; font-size:75%; vertical-align: super;}
/*移动端显示优化*/
- @media (max-width: 768px) {
+ /* @media (max-width: 768px) {
tr td:first-child {
width: 30%;
}
- }
+ } */
table {
width: 100%;
border-spacing: 10px;
border: 0px;
}
+
+ tr td:first-child {
+ width: 33%;
+ }
+
+ /* 清除表格标题的样式 */
+ /* caption {
+ all: unset;
+ } */