From 4f67d454ad214476f43b03327fa9db5599be3c35 Mon Sep 17 00:00:00 2001 From: ling <1042585959@qq.com> Date: Thu, 11 Jan 2024 22:29:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=A8=A1=E5=9D=97=E6=8F=92?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luci-app-modem/luasrc/controller/modem.lua | 2 + .../luasrc/model/cbi/modem/config.lua | 8 +- .../luasrc/model/cbi/modem/index.lua | 4 +- luci-app-modem/luasrc/view/modem/at.htm | 150 ++++++++++++++++++ .../luasrc/view/modem/modem_status.htm | 2 +- 5 files changed, 159 insertions(+), 7 deletions(-) create mode 100644 luci-app-modem/luasrc/view/modem/at.htm diff --git a/luci-app-modem/luasrc/controller/modem.lua b/luci-app-modem/luasrc/controller/modem.lua index aa9ef30..7a5bf85 100644 --- a/luci-app-modem/luasrc/controller/modem.lua +++ b/luci-app-modem/luasrc/controller/modem.lua @@ -29,6 +29,8 @@ function index() 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_at_port"}, call("getATPort"), nil).leaf = true + + entry({"admin", "network", "modem", "at"},template("modem/at"),translate("AT"),40).leaf = true end -- 判断字符串是否含有字母 diff --git a/luci-app-modem/luasrc/model/cbi/modem/config.lua b/luci-app-modem/luasrc/model/cbi/modem/config.lua index 5e6783d..d40cb70 100644 --- a/luci-app-modem/luasrc/model/cbi/modem/config.lua +++ b/luci-app-modem/luasrc/model/cbi/modem/config.lua @@ -26,13 +26,13 @@ remarks = s:taboption("general", Value, "remarks", translate("Remarks")) remarks.rmempty = true -- 移动网络 --- network = s:taboption("general", Value, "network", translate("Moblie Network")) -network = s:taboption("general", ListValue, "network", translate("Moblie Network")) +-- network = s:taboption("general", Value, "network", translate("Mobile Network")) +network = s:taboption("general", ListValue, "network", translate("Mobile Network")) -- network.default = "" network.rmempty = false -- 获取移动网络,并显示设备名 -function getMoblieNetwork() +function getMobileNetwork() local modem_number=uci:get('modem','global','modem_number') if modem_number == "0" then network:value("",translate("Mobile network not found")) @@ -52,7 +52,7 @@ function getMoblieNetwork() end end -getMoblieNetwork() +getMobileNetwork() -- 拨号模式 -- mode = s:taboption("general", ListValue, "mode", translate("Mode")) diff --git a/luci-app-modem/luasrc/model/cbi/modem/index.lua b/luci-app-modem/luasrc/model/cbi/modem/index.lua index d08fe88..249a9a3 100644 --- a/luci-app-modem/luasrc/model/cbi/modem/index.lua +++ b/luci-app-modem/luasrc/model/cbi/modem/index.lua @@ -45,7 +45,7 @@ o.rmempty = false o = s:option(DummyValue, "remarks", translate("Remarks")) -o = s:option(DummyValue, "network", translate("Moblie Network")) +o = s:option(DummyValue, "network", translate("Mobile Network")) o.cfgvalue = function(t, n) -- 检测移动网络是否存在 local network = (Value.cfgvalue(t, n) or "") @@ -76,7 +76,7 @@ end o = s:option(DummyValue, "apn", translate("APN")) o.cfgvalue = function(t, n) - local apn = (Value.cfgvalue(t, n) or ""):gsub("_","/"):upper():gsub("V","v") + local apn = (Value.cfgvalue(t, n) or "") if apn == "" then apn=translate("Auto Choose") end diff --git a/luci-app-modem/luasrc/view/modem/at.htm b/luci-app-modem/luasrc/view/modem/at.htm new file mode 100644 index 0000000..4ca2c2f --- /dev/null +++ b/luci-app-modem/luasrc/view/modem/at.htm @@ -0,0 +1,150 @@ +<%+header%> +<% +local sys = require "luci.sys" +local utl = require "luci.util" +local fs = require "nixio.fs" +local uci = require "luci.model.uci".cursor() +local s = uci:get("custom", "bandlock", "enabled") +local a = uci:get("custom", "atcmd", "enabled") + +local multilock = uci:get("custom", "multiuser", "multi") or "0" +local rootlock = uci:get("custom", "multiuser", "root") or "0" +nomulti=1 +if (multilock == "0") or (multilock == "1" and rootlock == "1") then + nosms = 1 + if a == "1" then + nosms = 0 + end +else + nosms = 1 + nomulti = 0 +end +block = 1 +if s == "1" then + block = 0 +end + +function showicon(lck) +end + +-%> + + + + +
+

<%:AT Commands%>

+
<%:Debugging Your Module with AT Command%>
+ + + + +
+ +

<%:AT Command Console%>

+ + + + + + + + + + + + + + + + + + + + +
<%:Quick Option%>:
+
+ 自动 + 自定义 +
+
<%:Quick Commands%>:
<%:Modem Select%>:
<%:AT Commands%>:
+ + +
+ +
+

<%=translate("TTYD Terminal")%>

+ +
+
+ +
+ +<%+footer%> diff --git a/luci-app-modem/luasrc/view/modem/modem_status.htm b/luci-app-modem/luasrc/view/modem/modem_status.htm index 9c54ed1..910ebd5 100644 --- a/luci-app-modem/luasrc/view/modem/modem_status.htm +++ b/luci-app-modem/luasrc/view/modem/modem_status.htm @@ -105,7 +105,7 @@ mode ); modem_view += String.format( - '
<%:Moblie Network%>: %s
', + '
<%:Mobile Network%>: %s
', modem.network ); modem_view += String.format(