更新模块插件
This commit is contained in:
parent
923385bbf6
commit
4314a5f57d
@ -1,4 +1,4 @@
|
||||
-- Copyright 2020 Lienol <lawlienol@gmail.com>
|
||||
-- Copyright 2024 Siriling <siriling@qq.com>
|
||||
module("luci.controller.modem", package.seeall)
|
||||
local http = require "luci.http"
|
||||
local fs = require "nixio.fs"
|
||||
@ -23,30 +23,47 @@ function index()
|
||||
entry({"admin", "network", "modem", "get_modems"}, call("getModems"), nil).leaf = true
|
||||
entry({"admin", "network", "modem", "status"}, call("act_status")).leaf = true
|
||||
|
||||
--AT命令
|
||||
entry({"admin", "network", "modem", "at_commands"},template("modem/at_commands"),translate("AT Commands"),30).leaf = true
|
||||
entry({"admin", "network", "modem", "mode_info"}, call("modeInfo"), nil).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", "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", "mode_info"}, call("modeInfo"), nil).leaf = true
|
||||
|
||||
--AT命令旧界面
|
||||
entry({"admin", "network", "modem", "at_command_old"},template("modem/at_command_old")).leaf = true
|
||||
end
|
||||
|
||||
-- 判断字符串是否含有字母
|
||||
--[[
|
||||
@Description 判断字符串是否含有字母
|
||||
@Params
|
||||
str 字符串
|
||||
]]
|
||||
function hasLetters(str)
|
||||
local pattern = "%a" -- 匹配字母的正则表达式
|
||||
return string.find(str, pattern) ~= nil
|
||||
end
|
||||
|
||||
-- AT命令
|
||||
--[[
|
||||
@Description 执行AT命令
|
||||
@Params
|
||||
at_port AT串口
|
||||
at_command AT命令
|
||||
]]
|
||||
function at(at_port,at_command)
|
||||
-- local odpall = io.popen("sh modem_at.sh "..at_port.." '"..at_command.."'")
|
||||
local odpall = io.popen("sms_tool -d " .. at_port .. " at " ..at_command:gsub("[$]", "\\\$"):gsub("\"", "\\\"").." 2>&1")
|
||||
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()
|
||||
return odp
|
||||
end
|
||||
|
||||
-- 获取模组连接状态
|
||||
--[[
|
||||
@Description 获取模组连接状态
|
||||
@Params
|
||||
at_port AT串口
|
||||
manufacturer 制造商
|
||||
]]
|
||||
function getModemConnectStatus(at_port,manufacturer)
|
||||
|
||||
local connect_status="unknown"
|
||||
@ -61,7 +78,11 @@ function getModemConnectStatus(at_port,manufacturer)
|
||||
return connect_status
|
||||
end
|
||||
|
||||
-- 获取模组基本信息
|
||||
--[[
|
||||
@Description 获取模组基本信息
|
||||
@Params
|
||||
at_port AT串口
|
||||
]]
|
||||
function getModemDeviceInfo(at_port)
|
||||
local modem_device_info={}
|
||||
|
||||
@ -83,7 +104,12 @@ function getModemDeviceInfo(at_port)
|
||||
return modem_device_info
|
||||
end
|
||||
|
||||
-- 获取模组更多信息
|
||||
--[[
|
||||
@Description 获取模组更多信息
|
||||
@Params
|
||||
at_port AT串口
|
||||
manufacturer 制造商
|
||||
]]
|
||||
function getModemMoreInfo(at_port,manufacturer)
|
||||
|
||||
--获取模组信息
|
||||
@ -96,7 +122,9 @@ function getModemMoreInfo(at_port,manufacturer)
|
||||
return modem_more_info
|
||||
end
|
||||
|
||||
-- 模块状态获取
|
||||
--[[
|
||||
@Description 模块状态获取
|
||||
]]
|
||||
function getModemInfo()
|
||||
|
||||
--获取AT串口
|
||||
@ -166,7 +194,9 @@ function getModemInfo()
|
||||
luci.http.write_json(data)
|
||||
end
|
||||
|
||||
-- 获取模组信息
|
||||
--[[
|
||||
@Description 获取模组信息
|
||||
]]
|
||||
function getModems()
|
||||
|
||||
-- 获取所有模组
|
||||
@ -197,7 +227,9 @@ function getModems()
|
||||
luci.http.write_json(data)
|
||||
end
|
||||
|
||||
-- 模块列表状态函数
|
||||
--[[
|
||||
@Description 模块列表状态函数
|
||||
]]
|
||||
function act_status()
|
||||
local e = {}
|
||||
e.index = luci.http.formvalue("index")
|
||||
@ -206,7 +238,9 @@ function act_status()
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
||||
-- 模式信息
|
||||
--[[
|
||||
@Description 模式信息
|
||||
]]
|
||||
function modeInfo()
|
||||
-- 设置默认值
|
||||
local modes={"qmi","gobinet","ecm","mbim","rndis","ncm"}
|
||||
@ -231,21 +265,27 @@ function modeInfo()
|
||||
luci.http.write_json(modes)
|
||||
end
|
||||
|
||||
-- 发送AT命令
|
||||
--[[
|
||||
@Description 发送AT命令
|
||||
]]
|
||||
function sendATCommand()
|
||||
local at_port = http.formvalue("port")
|
||||
local at_command = http.formvalue("command")
|
||||
|
||||
local response
|
||||
local response={}
|
||||
if at_port and at_command then
|
||||
response=at(at_port,at_command)
|
||||
http.write(tostring(response))
|
||||
else
|
||||
http.write_json(http.formvalue())
|
||||
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
|
||||
|
||||
-- 用户AT命令
|
||||
--[[
|
||||
@Description 用户AT命令
|
||||
]]
|
||||
function userATCommand()
|
||||
local at_commands={}
|
||||
-- 获取模块AT命令
|
||||
@ -273,8 +313,11 @@ function userATCommand()
|
||||
luci.http.write_json(at_commands)
|
||||
end
|
||||
|
||||
-- 获取模组的备注
|
||||
-- @Param network 移动网络
|
||||
--[[
|
||||
@Description 获取模组的备注
|
||||
@Params
|
||||
network 移动网络
|
||||
]]
|
||||
function getModemRemarks(network)
|
||||
local remarks=""
|
||||
uci:foreach("modem", "config", function (config)
|
||||
@ -289,7 +332,9 @@ function getModemRemarks(network)
|
||||
return remarks
|
||||
end
|
||||
|
||||
-- 获取AT串口
|
||||
--[[
|
||||
@Description 获取AT串口
|
||||
]]
|
||||
function getATPort()
|
||||
local at_ports={}
|
||||
uci:foreach("modem", "modem-device", function (modem_device)
|
||||
@ -314,3 +359,37 @@ function getATPort()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(at_ports)
|
||||
end
|
||||
|
||||
--[[
|
||||
@Description 获取快捷命令
|
||||
]]
|
||||
function getQuickCommands()
|
||||
|
||||
--获取快捷命令选项
|
||||
local quick_option = http.formvalue("option")
|
||||
--获取AT串口
|
||||
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)
|
||||
|
||||
--获取模组AT命令
|
||||
local quick_commands={}
|
||||
if quick_option and manufacturer then
|
||||
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
|
||||
|
||||
-- 写入Web界面
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(quick_commands)
|
||||
end
|
@ -93,49 +93,63 @@
|
||||
// 根据所选的模组改变AT命令
|
||||
function afunction()
|
||||
{
|
||||
// var node = document.getElementById('odp');
|
||||
// var node = document.getElementById('response');
|
||||
// node.style.visibility = 'hidden';
|
||||
|
||||
// var x = document.getElementById("at_command").value;
|
||||
// document.getElementById("code").value = x;
|
||||
// document.getElementById("odp").innerHTML = "";
|
||||
// document.getElementById("response").innerHTML = "";
|
||||
}
|
||||
|
||||
//自动填写到命令输入框
|
||||
function copyToSend()
|
||||
{
|
||||
var node = document.getElementById('odp');
|
||||
var node = document.getElementById('response');
|
||||
node.style.visibility = 'hidden';
|
||||
|
||||
var command_choose = document.getElementById("command_choose").value;
|
||||
document.getElementById("at_command").value = command_choose;
|
||||
document.getElementById("odp").innerHTML = "";
|
||||
document.getElementById("response").innerHTML = "";
|
||||
}
|
||||
|
||||
function postCommand(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)
|
||||
// (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("odp").innerHTML = bStr;
|
||||
var el = document.getElementsByName("odp")[0];
|
||||
el.value.replace(/(\r\n|\n|\r)/gm, "");
|
||||
});
|
||||
// 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},
|
||||
function(x, data)
|
||||
{
|
||||
responseElement=document.getElementById("response");
|
||||
if ("response" in data) {
|
||||
//显示当前时间
|
||||
// responseElement.value+=data["time"];
|
||||
//显示返回值
|
||||
responseElement.innerHTML+=data["response"];
|
||||
}
|
||||
}
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function (ev) {var button = document.getElementById("sendcmd");
|
||||
document.addEventListener('DOMContentLoaded', function (ev) {
|
||||
var button = document.getElementById("sendcmd");
|
||||
button.addEventListener("click", function () {
|
||||
|
||||
//获取AT串口
|
||||
var at_port = document.getElementById("modem_select").value;
|
||||
if ( at_port.length == 0 )
|
||||
{
|
||||
document.getElementById("odp").innerHTML = "";
|
||||
document.getElementById("response").innerHTML = "";
|
||||
alert("<%:Please choose a Modem%>");
|
||||
return false;
|
||||
}
|
||||
@ -144,7 +158,7 @@
|
||||
var at_command = document.getElementById("at_command").value;
|
||||
if ( at_command.length == 0 )
|
||||
{
|
||||
document.getElementById("odp").innerHTML = "";
|
||||
document.getElementById("response").innerHTML = "";
|
||||
alert("<%:Please enter a AT Command%>");
|
||||
return false;
|
||||
}
|
||||
@ -153,7 +167,7 @@
|
||||
postCommand(at_port,at_command);
|
||||
at_command = "";
|
||||
|
||||
var node = document.getElementById('odp');
|
||||
var node = document.getElementById('response');
|
||||
if (node.style.visibility=='visible') {
|
||||
node.style.visibility = 'hidden';
|
||||
}
|
||||
@ -216,8 +230,9 @@
|
||||
</div>
|
||||
|
||||
<div class="table" width="100%">
|
||||
|
||||
<div class="td left" style="width:25%;"><%:Response%>:
|
||||
<pre id="odp" style="visibility: hidden; width:75%;"></pre>
|
||||
<pre id="response" style="visibility: hidden; width:100%;"></pre>
|
||||
</div>
|
||||
|
||||
<div class="tr cbi-rowstyle-2">
|
337
luci-app-modem/luasrc/view/modem/modem_debug.htm
Normal file
337
luci-app-modem/luasrc/view/modem/modem_debug.htm
Normal file
@ -0,0 +1,337 @@
|
||||
<%+header%>
|
||||
<script type="text/javascript" src="<%=resource%>/xhr.js"></script>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
|
||||
window.onload=function()
|
||||
{
|
||||
//获取模组选择框元素
|
||||
var modem_select = document.getElementById('modem_select');
|
||||
|
||||
//更换模组(AT串口)时触发
|
||||
modem_select.addEventListener('change', function() {
|
||||
//获取快捷命令
|
||||
get_quick_commands();
|
||||
});
|
||||
|
||||
|
||||
//获取快捷选项父元素
|
||||
var quick_option = document.getElementById('quick_option_td');
|
||||
quick_option.addEventListener('change', function(event) {
|
||||
var target = event.target;
|
||||
if (target.matches('input[type="radio"]')) {
|
||||
//获取快捷命令
|
||||
get_quick_commands();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 发送AT命令
|
||||
function send(at_port,at_command)
|
||||
{
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "send_at_command")%>', {"port":at_port,"command":at_command},
|
||||
function(x, data)
|
||||
{
|
||||
responseElement=document.getElementById("response");
|
||||
if ("response" in data) {
|
||||
//显示当前时间
|
||||
responseElement.value+=data["time"];
|
||||
//显示返回值
|
||||
responseElement.value+=data["response"];
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// 发送AT命令前处理
|
||||
function send_at_command(event)
|
||||
{
|
||||
//获取选中的模组(选中的AT串口)
|
||||
var at_port = document.getElementById("modem_select").value;
|
||||
if ( at_port.length == 0 )
|
||||
{
|
||||
// document.getElementById("odp").innerHTML = "";
|
||||
alert("<%:Please choose a Modem%>");
|
||||
return false;
|
||||
}
|
||||
|
||||
//获取AT命令
|
||||
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命令
|
||||
send(at_port,at_command);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 清除AT命令
|
||||
function clean_at_command(event)
|
||||
{
|
||||
document.getElementById("at_command").value='';
|
||||
}
|
||||
|
||||
// 清除AT响应
|
||||
function clean_response(event)
|
||||
{
|
||||
document.getElementById("response").value='';
|
||||
}
|
||||
|
||||
// 设置AT串口选项
|
||||
function set_at_port(port)
|
||||
{
|
||||
// 获取模组选择框元素
|
||||
var modem_select = document.getElementById('modem_select');
|
||||
// 记录所选
|
||||
var selected=modem_select.value;
|
||||
// 删除原来的选项
|
||||
modem_select.options.length=0;
|
||||
// 更新(key:AT串口,value:模组名称)
|
||||
for (var key in port)
|
||||
{
|
||||
var option = document.createElement('option');
|
||||
option.value = key;
|
||||
if (port[key].includes("unknown"))
|
||||
{
|
||||
option.text = port[key].replace("unknown", key);
|
||||
}
|
||||
else
|
||||
{
|
||||
option.text = port[key];
|
||||
}
|
||||
modem_select.appendChild(option);
|
||||
}
|
||||
// 恢复原来的选择
|
||||
for (let i = 0; i < modem_select.options.length; i++)
|
||||
{
|
||||
if(modem_select.options[i].value == selected)
|
||||
{
|
||||
modem_select.selectedIndex=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 自动填写到命令输入框
|
||||
function copyToSend()
|
||||
{
|
||||
var command_select = document.getElementById("command_select").value;
|
||||
document.getElementById("at_command").value = command_select;
|
||||
}
|
||||
|
||||
// 获取快捷命令
|
||||
function get_quick_commands()
|
||||
{
|
||||
//获取快捷选项
|
||||
var quick_option = document.querySelector('input[name="quick_option"]:checked').value;
|
||||
//获取选中的模组
|
||||
var at_port = document.getElementById("modem_select").value;
|
||||
|
||||
//获取AT命令
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "get_quick_commands")%>', {"option":quick_option,"port":at_port},
|
||||
function(x, json)
|
||||
{
|
||||
console.log(json);
|
||||
|
||||
//获取模组选择框元素
|
||||
var command_select = document.getElementById('command_select');
|
||||
//记录所选
|
||||
var selected=command_select.value;
|
||||
//删除原来的选项
|
||||
command_select.options.length=0;
|
||||
|
||||
//获取快捷命令
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
// 无模组界面
|
||||
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()
|
||||
{
|
||||
//显示AT命令界面
|
||||
document.getElementById("cbi-at").style.display="block";
|
||||
//隐藏提示信息
|
||||
document.getElementById("cbi-info").style.display="none";
|
||||
}
|
||||
|
||||
// 定时触发更新AT串口
|
||||
XHR.poll(5,'<%=luci.dispatcher.build_url("admin", "network", "modem", "get_at_port")%>', null,
|
||||
function(x, port)
|
||||
{
|
||||
//设置AT串口选项
|
||||
set_at_port(port);
|
||||
|
||||
//获取快捷命令
|
||||
if (Object.keys(port).length==0)
|
||||
{
|
||||
//显示无模组界面
|
||||
no_modems_view();
|
||||
}
|
||||
else
|
||||
{
|
||||
//获取快捷选项
|
||||
var quick_option = document.querySelector('input[name="quick_option"]:checked').value;
|
||||
if (quick_option=="auto") {
|
||||
get_quick_commands();
|
||||
}
|
||||
//显示有模组界面
|
||||
modems_view();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<div class="cbi-map" id="cbi-modem-debug">
|
||||
<h2 id="content" name="content"><%:Modem Debug%></h2>
|
||||
<div class="cbi-map-descr"><%:Debug Your Module%></div>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
table {
|
||||
width: 100%;
|
||||
border-spacing: 10px;
|
||||
border: 0px;
|
||||
}
|
||||
/* input {
|
||||
vertical-align: bottom;
|
||||
} */
|
||||
|
||||
#popup {
|
||||
width:560px;
|
||||
height:190px;
|
||||
padding:20px;
|
||||
background-color:gainsboro;
|
||||
border-style : solid;
|
||||
position:fixed;
|
||||
top : 40%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
left: 0;
|
||||
right: 0;
|
||||
text-align: center;
|
||||
display:none;
|
||||
}
|
||||
textarea {
|
||||
background:#373737;
|
||||
border:none;
|
||||
color:#FFF;
|
||||
width: 100%;
|
||||
}
|
||||
/* #command_select {
|
||||
width: 100%;
|
||||
} */
|
||||
/* td {
|
||||
width: 100%;
|
||||
} */
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-info" style="display: block;">
|
||||
<h3><%:Message%></h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td width="10%"></td>
|
||||
<td width="60%">
|
||||
<div align="left" id="info_message" style="font-size:1.875em">
|
||||
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle"/>
|
||||
<%:Loading modem information%>...
|
||||
</div>
|
||||
</td>
|
||||
<td width="30%"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-at" style="display: none;">
|
||||
<!-- <legend><%:AT Command%></legend> -->
|
||||
<h3><%:AT Command%></h3>
|
||||
|
||||
<table id="at_command_info">
|
||||
<tr>
|
||||
<td style="width: 20%;"><div align="right"><%:Modem Select%></div></td>
|
||||
<td><select name="modem_select" id="modem_select" class="cbi-input-select"></select></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 20%;"><div align="right"><%:Quick Option%></div></td>
|
||||
<td id="quick_option_td">
|
||||
<div align="left">
|
||||
<input type="radio" name="quick_option" value="auto" checked="checked"><%:Auto%>
|
||||
<input type="radio" name="quick_option" value="custom"><%:Custom%>
|
||||
</div>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 20%;"><div align="right"><%:Quick Commands%></div></td>
|
||||
<td><select name="command_select" id="command_select" class="cbi-input-select" onclick="copyToSend()"></select></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 20%;"><div align="right"><%:Enter Command%></div></td>
|
||||
<td>
|
||||
<input type="text" id="at_command" class="cbi-input-text"></input>
|
||||
</td>
|
||||
<td class="td cbi-section-table-cell nowrap cbi-section-actions" colspan="2">
|
||||
<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-reset" type="button" value="<%:Clean%>" onclick="clean_at_command()" alt="<%:Clean%>" title="<%:Clean%>">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<div><%:Response%></div>
|
||||
<div><textarea readonly="readonly" id="response" rows="20" maxlength="160"></textarea></div>
|
||||
<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="cbi-button cbi-button-reset" type="button" value="<%:Clean%>" onclick="clean_response()" alt="<%:Clean%>" title="<%:Clean%>">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
|
||||
<%+footer%>
|
@ -28,17 +28,17 @@ end
|
||||
border: 0px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="<%=resource%>/xhr.js?v=git-23.159.15540-7154b89"></script>
|
||||
<script type="text/javascript" src="<%=resource%>/xhr.js"></script>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
|
||||
window.onload=function()
|
||||
{
|
||||
//获取模块选择框元素
|
||||
//获取模组选择框元素
|
||||
var modem_select = document.getElementById('modem_select');
|
||||
|
||||
// 更换模组(AT串口)时触发
|
||||
//更换模组(AT串口)时触发
|
||||
modem_select.addEventListener('change', function() {
|
||||
// 更新数据
|
||||
//更新数据
|
||||
update();
|
||||
});
|
||||
}
|
||||
@ -329,7 +329,7 @@ end
|
||||
);
|
||||
}
|
||||
|
||||
//设置AT串口选项
|
||||
// 设置AT串口选项
|
||||
function set_at_port(port)
|
||||
{
|
||||
//获取模块选择框元素
|
||||
|
@ -13,6 +13,9 @@ msgstr "模组状态"
|
||||
msgid "Modem Name"
|
||||
msgstr "模组名称"
|
||||
|
||||
msgid "Modem Debug"
|
||||
msgstr "模组名称"
|
||||
|
||||
msgid "Modem Select"
|
||||
msgstr "选择模组"
|
||||
|
||||
@ -58,15 +61,39 @@ msgstr "连接状态"
|
||||
msgid "Config List"
|
||||
msgstr "配置列表"
|
||||
|
||||
msgid "AT Commands"
|
||||
msgid "Debug Your Module"
|
||||
msgstr "调试你的模组"
|
||||
|
||||
msgid "AT Command"
|
||||
msgstr "AT命令"
|
||||
|
||||
msgid "Debugging Your Module with AT Command"
|
||||
msgstr "使用AT命令调试你的模组"
|
||||
msgid "Quick Option"
|
||||
msgstr "快捷选项"
|
||||
|
||||
msgid "Auto"
|
||||
msgstr "自动"
|
||||
|
||||
msgid "Custom"
|
||||
msgstr "自定义"
|
||||
|
||||
msgid "Quick Commands"
|
||||
msgstr "快捷命令"
|
||||
|
||||
msgid "Enter Command"
|
||||
msgstr "输入命令"
|
||||
|
||||
msgid "Send"
|
||||
msgstr "发送"
|
||||
|
||||
msgid "Clean"
|
||||
msgstr "清空"
|
||||
|
||||
msgid "Response"
|
||||
msgstr "响应"
|
||||
|
||||
msgid "Return to old page"
|
||||
msgstr "返回旧界面"
|
||||
|
||||
msgid "Modem Information"
|
||||
msgstr "模组信息"
|
||||
|
||||
|
55
luci-app-modem/root/usr/share/modem/custom_at_commands.json
Normal file
55
luci-app-modem/root/usr/share/modem/custom_at_commands.json
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
"quick_commands":[
|
||||
{"****************通用****************":"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"}
|
||||
]
|
||||
}
|
@ -27,6 +27,43 @@ get_fibocom_mode()
|
||||
echo "$mode"
|
||||
}
|
||||
|
||||
#获取AT命令
|
||||
get_fibocom_at_commands()
|
||||
{
|
||||
local quick_commands="{\"quick_commands\":
|
||||
[
|
||||
{\"模组信息 > 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\"}
|
||||
]
|
||||
}"
|
||||
echo "$quick_commands"
|
||||
}
|
||||
|
||||
#获取连接状态
|
||||
# $1:AT串口
|
||||
get_connect_status()
|
||||
|
31
luci-app-modem/root/usr/share/modem/fibocom_at_commands.json
Normal file
31
luci-app-modem/root/usr/share/modem/fibocom_at_commands.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"quick_commands":[
|
||||
{"模组信息 > 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"}
|
||||
]
|
||||
}
|
@ -47,13 +47,27 @@ get_mode()
|
||||
{
|
||||
local mode
|
||||
case $1 in
|
||||
"quectel") mode=$(get_quectel_mode "$2") ;;
|
||||
"fibocom") mode=$(get_fibocom_mode "$2") ;;
|
||||
"simcom") mode=$(get_simcom_mode "$2") ;;
|
||||
"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:快捷选项
|
||||
# $2:制造商
|
||||
get_quick_commands()
|
||||
{
|
||||
local quick_commands
|
||||
case $1 in
|
||||
"auto") quick_commands=$(cat $current_dir/$2_at_commands.json) ;;
|
||||
"custom") quick_commands=$(cat $current_dir/custom_at_commands.json) ;;
|
||||
*) quick_commands=$(cat $current_dir/$2_at_commands.json) ;;
|
||||
esac
|
||||
echo "$quick_commands"
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
quectel;rg200u-cn;usb;ecm,mbim,rndis,ncm
|
||||
quectel;rm500u-cn;usb;ecm,mbim,rndis,ncm
|
||||
quectel;rm500q-gl;usb;qmi,gobinet,ecm,mbim,rndis,ncm
|
||||
quectel;rm500q-gl;pcie;qmi,gobinet,ecm,mbim,rndis,ncm
|
||||
quectel;rm500q-gl;pcie;qmi,gobinet,mbim
|
||||
quectel;rm502q-gl;usb;qmi,gobinet,ecm,mbim,rndis,ncm
|
||||
quectel;rm502q-gl;pcie;qmi,gobinet,mbim
|
||||
fibocom;fm650-cn;usb;ecm,mbim,rndis,ncm
|
||||
fibocom;fm150-ae;usb;qmi,gobinet,ecm,mbim,rndis,ncm
|
||||
fibocom;fm150-ae;pcie;qmi
|
||||
|
@ -22,6 +22,42 @@ get_quectel_mode()
|
||||
echo "$mode"
|
||||
}
|
||||
|
||||
#获取AT命令
|
||||
get_quectel_at_commands()
|
||||
{
|
||||
local quick_commands="\"quick_commands\":[
|
||||
{\"模组信息 > 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\"}
|
||||
]"
|
||||
echo "$quick_commands"
|
||||
}
|
||||
|
||||
#获取连接状态
|
||||
# $1:AT串口
|
||||
get_connect_status()
|
||||
@ -310,7 +346,7 @@ quectel_cell_info()
|
||||
endc_lte_sinr=$(echo "$lte" | awk -F',' '{print $15}')
|
||||
endc_lte_cql=$(echo "$lte" | awk -F',' '{print $16}')
|
||||
endc_lte_tx_power=$(echo "$lte" | awk -F',' '{print $17}')
|
||||
endc_lte_rxlev=$(echo "$lte" | awk -F',' '{print $18}')
|
||||
endc_lte_rxlev=$(echo "$lte" | awk -F',' '{print $18}' | sed 's/\r//g')
|
||||
#NR5G-NSA
|
||||
endc_nr_mcc=$(echo "$nr5g_nsa" | awk -F',' '{print $2}')
|
||||
endc_nr_mnc=$(echo "$nr5g_nsa" | awk -F',' '{print $3}')
|
||||
@ -323,7 +359,7 @@ quectel_cell_info()
|
||||
endc_nr_band=$(get_band "NR" $endc_nr_band_num)
|
||||
nr_dl_bandwidth_num=$(echo "$nr5g_nsa" | awk -F',' '{print $10}')
|
||||
endc_nr_dl_bandwidth=$(get_nr_dl_bandwidth $nr_dl_bandwidth_num)
|
||||
scs_num=$(echo "$nr5g_nsa" | awk -F',' '{print $16}')
|
||||
scs_num=$(echo "$nr5g_nsa" | awk -F',' '{print $16}' | sed 's/\r//g')
|
||||
endc_nr_scs=$(get_scs $scs_num)
|
||||
else
|
||||
#SA,LTE,WCDMA模式
|
||||
@ -348,7 +384,7 @@ quectel_cell_info()
|
||||
nr_sinr=$(echo "$response" | awk -F',' '{print $15}')
|
||||
nr_scs_num=$(echo "$response" | awk -F',' '{print $16}')
|
||||
nr_scs=$(get_scs $nr_scs_num)
|
||||
nr_rxlev=$(echo "$response" | awk -F',' '{print $17}')
|
||||
nr_rxlev=$(echo "$response" | awk -F',' '{print $17}' | sed 's/\r//g')
|
||||
;;
|
||||
"LTE"|"CAT-M"|"CAT-NB")
|
||||
network_mode="LTE Mode"
|
||||
@ -371,7 +407,7 @@ quectel_cell_info()
|
||||
lte_sinr=$(echo "$response" | awk -F',' '{print $17}')
|
||||
lte_cql=$(echo "$response" | awk -F',' '{print $18}')
|
||||
lte_tx_power=$(echo "$response" | awk -F',' '{print $19}')
|
||||
lte_rxlev=$(echo "$response" | awk -F',' '{print $20}')
|
||||
lte_rxlev=$(echo "$response" | awk -F',' '{print $20}' | sed 's/\r//g')
|
||||
;;
|
||||
"WCDMA")
|
||||
network_mode="WCDMA Mode"
|
||||
@ -391,7 +427,7 @@ quectel_cell_info()
|
||||
wcdma_slot_num=$(echo "$response" | awk -F',' '{print $15}')
|
||||
wcdma_slot=$(get_slot $wcdma_slot_num)
|
||||
wcdma_speech_code=$(echo "$response" | awk -F',' '{print $16}')
|
||||
wcdma_com_mod=$(echo "$response" | awk -F',' '{print $17}')
|
||||
wcdma_com_mod=$(echo "$response" | awk -F',' '{print $17}' | sed 's/\r//g')
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
32
luci-app-modem/root/usr/share/modem/quectel_at_commands.json
Normal file
32
luci-app-modem/root/usr/share/modem/quectel_at_commands.json
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"quick_commands":[
|
||||
{"模组信息 > 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