更新
This commit is contained in:
parent
d72db8b222
commit
cc5bb96750
BIN
luci-app-modem/htdocs/luci-static/resources/icons/delsms.png
Normal file
BIN
luci-app-modem/htdocs/luci-static/resources/icons/delsms.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.0 KiB |
BIN
luci-app-modem/htdocs/luci-static/resources/icons/delsms2.png
Normal file
BIN
luci-app-modem/htdocs/luci-static/resources/icons/delsms2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
@ -29,8 +29,11 @@ function index()
|
||||
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", "get_modem_debug_info"}, call("getModemDebugInfo"), nil).leaf = true
|
||||
entry({"admin", "network", "modem", "get_mode_info"}, call("getModeInfo"), nil).leaf = true
|
||||
entry({"admin", "network", "modem", "set_mode"}, call("setMode"), nil).leaf = true
|
||||
entry({"admin", "network", "modem", "get_network_prefer_info"}, call("getNetworkPreferInfo"), nil).leaf = true
|
||||
entry({"admin", "network", "modem", "set_network_prefer"}, call("setNetworkPrefer"), nil).leaf = true
|
||||
entry({"admin", "network", "modem", "get_self_test_info"}, call("getSelfTestInfo"), nil).leaf = true
|
||||
entry({"admin", "network", "modem", "quick_commands_config"}, cbi("modem/quick_commands_config")).leaf = true
|
||||
|
||||
--AT命令旧界面
|
||||
@ -518,74 +521,59 @@ end
|
||||
|
||||
--[[
|
||||
@Description 获取拨号模式信息
|
||||
@Params
|
||||
at_port AT串口
|
||||
manufacturer 制造商
|
||||
]]
|
||||
function getModeInfo(at_port,manufacturer)
|
||||
function getModeInfo()
|
||||
local at_port = http.formvalue("port")
|
||||
|
||||
--获取支持的拨号模式
|
||||
local modes
|
||||
--获取制造商
|
||||
local manufacturer
|
||||
uci:foreach("modem", "modem-device", function (modem_device)
|
||||
--设置模组AT串口
|
||||
if at_port == modem_device["at_port"] then
|
||||
modes=modem_device["modes"]
|
||||
--获取制造商
|
||||
manufacturer=modem_device["manufacturer"]
|
||||
return true --跳出循环
|
||||
end
|
||||
end)
|
||||
|
||||
--获取模组拨号模式
|
||||
local odpall = io.popen("source "..script_path..manufacturer..".sh && "..manufacturer.."_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
|
||||
if manufacturer~="unknown" then
|
||||
|
||||
return mode_info
|
||||
--获取支持的拨号模式
|
||||
local modes
|
||||
uci:foreach("modem", "modem-device", function (modem_device)
|
||||
--设置模组AT串口
|
||||
if at_port == modem_device["at_port"] then
|
||||
modes=modem_device["modes"]
|
||||
return true --跳出循环
|
||||
end
|
||||
end)
|
||||
|
||||
--获取模组拨号模式
|
||||
local odpall = io.popen("source "..script_path..manufacturer..".sh && "..manufacturer.."_get_mode "..at_port)
|
||||
local opd = odpall:read("*a")
|
||||
odpall:close()
|
||||
local mode=string.gsub(opd, "\n", "")
|
||||
|
||||
--设置模式信息
|
||||
mode_info["mode"]=mode
|
||||
mode_info["modes"]=modes
|
||||
end
|
||||
|
||||
--设置值
|
||||
local modem_debug_info={}
|
||||
modem_debug_info["mode_info"]=mode_info
|
||||
|
||||
-- 写入Web界面
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(modem_debug_info)
|
||||
end
|
||||
|
||||
--[[
|
||||
@Description 获取网络偏好信息
|
||||
@Params
|
||||
at_port AT串口
|
||||
manufacturer 制造商
|
||||
]]
|
||||
function getNetworkPreferInfo(at_port,manufacturer)
|
||||
|
||||
--获取模组网络偏好
|
||||
local odpall = io.popen("source "..script_path..manufacturer..".sh && "..manufacturer.."_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 获取自检信息
|
||||
@Params
|
||||
at_port AT串口
|
||||
manufacturer 制造商
|
||||
]]
|
||||
function getSelfTestInfo(at_port,manufacturer)
|
||||
|
||||
--获取模组自检信息
|
||||
local odpall = io.popen("source "..script_path..manufacturer..".sh && "..manufacturer.."_get_self_test_info "..at_port)
|
||||
local opd = odpall:read("*a")
|
||||
odpall:close()
|
||||
local self_test_info=json.parse(opd)
|
||||
|
||||
return self_test_info
|
||||
end
|
||||
|
||||
--[[
|
||||
@Description 获取模组调试信息
|
||||
]]
|
||||
function getModemDebugInfo()
|
||||
function getNetworkPreferInfo()
|
||||
local at_port = http.formvalue("port")
|
||||
|
||||
--获取制造商
|
||||
@ -600,22 +588,100 @@ function getModemDebugInfo()
|
||||
end)
|
||||
|
||||
--获取值
|
||||
local mode_info={}
|
||||
local network_prefer_info={}
|
||||
local self_test_info={}
|
||||
local network_prefer_info
|
||||
if manufacturer~="unknown" then
|
||||
mode_info=getModeInfo(at_port,manufacturer)
|
||||
network_prefer_info=getNetworkPreferInfo(at_port,manufacturer)
|
||||
self_test_info=getSelfTestInfo(at_port,manufacturer)
|
||||
--获取模组网络偏好
|
||||
local odpall = io.popen("source "..script_path..manufacturer..".sh && "..manufacturer.."_get_network_prefer "..at_port)
|
||||
local opd = odpall:read("*a")
|
||||
odpall:close()
|
||||
network_prefer_info=json.parse(opd)
|
||||
end
|
||||
|
||||
--设置值
|
||||
local modem_debug_info={}
|
||||
modem_debug_info["mode_info"]=mode_info
|
||||
modem_debug_info["network_prefer_info"]=network_prefer_info
|
||||
modem_debug_info["self_test_info"]=self_test_info
|
||||
|
||||
-- 写入Web界面
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(modem_debug_info)
|
||||
end
|
||||
|
||||
--[[
|
||||
@Description 获取自检信息
|
||||
]]
|
||||
function getSelfTestInfo()
|
||||
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"]
|
||||
return true --跳出循环
|
||||
end
|
||||
end)
|
||||
|
||||
--获取值
|
||||
local self_test_info={}
|
||||
if manufacturer~="unknown" then
|
||||
--获取模组电压
|
||||
local odpall = io.popen("source "..script_path..manufacturer..".sh && "..manufacturer.."_get_voltage "..at_port)
|
||||
local opd = odpall:read("*a")
|
||||
odpall:close()
|
||||
self_test_info["voltage"]=json.parse(opd)
|
||||
|
||||
--获取模组温度
|
||||
local odpall = io.popen("source "..script_path..manufacturer..".sh && "..manufacturer.."_get_temperature "..at_port)
|
||||
local opd = odpall:read("*a")
|
||||
odpall:close()
|
||||
self_test_info["temperature"]=json.parse(opd)
|
||||
end
|
||||
|
||||
--设置值
|
||||
local modem_debug_info={}
|
||||
modem_debug_info["self_test_info"]=self_test_info
|
||||
|
||||
-- 写入Web界面
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(modem_debug_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"]
|
||||
-- return true --跳出循环
|
||||
-- end
|
||||
-- end)
|
||||
|
||||
-- --获取值
|
||||
-- local mode_info={}
|
||||
-- local network_prefer_info={}
|
||||
-- local self_test_info={}
|
||||
-- if manufacturer~="unknown" then
|
||||
-- mode_info=getModeInfo(at_port,manufacturer)
|
||||
-- network_prefer_info=getNetworkPreferInfo(at_port,manufacturer)
|
||||
-- self_test_info=getSelfTestInfo(at_port,manufacturer)
|
||||
-- end
|
||||
|
||||
-- --设置值
|
||||
-- local modem_debug_info={}
|
||||
-- modem_debug_info["mode_info"]=mode_info
|
||||
-- modem_debug_info["network_prefer_info"]=network_prefer_info
|
||||
-- modem_debug_info["self_test_info"]=self_test_info
|
||||
|
||||
-- -- 写入Web界面
|
||||
-- luci.http.prepare_content("application/json")
|
||||
-- luci.http.write_json(modem_debug_info)
|
||||
-- end
|
||||
|
@ -11,9 +11,14 @@
|
||||
//获取快捷命令
|
||||
get_quick_commands();
|
||||
//获取模组调试信息
|
||||
get_modem_debug_info();
|
||||
var debug_params={first_cache:true};
|
||||
get_modem_debug_info(debug_params);
|
||||
});
|
||||
|
||||
//获取tab菜单
|
||||
var tab_menu = document.getElementsByClassName('cbi-tabmenu')[0];
|
||||
set_tab_event(tab_menu);
|
||||
|
||||
//获取快捷选项父元素
|
||||
var quick_option_element = document.getElementById('quick_option_td');
|
||||
//更换快捷选项时触发
|
||||
@ -64,6 +69,46 @@
|
||||
});
|
||||
}
|
||||
|
||||
//设置tab菜单事件
|
||||
function set_tab_event(parent_element)
|
||||
{
|
||||
//获取子元素
|
||||
var childElements = parent_element.children;
|
||||
//获取需要禁用的元素
|
||||
for (var i = 0; i < childElements.length; i++)
|
||||
{
|
||||
// childElements[i].addEventListener('click', function(event) {
|
||||
// var debug_params={first_cache:true};
|
||||
// get_modem_debug_info(debug_params);
|
||||
// });
|
||||
|
||||
// 创建一个 MutationObserver 实例
|
||||
var observer = new MutationObserver(function(mutationsList) {
|
||||
for (var mutation of mutationsList) {
|
||||
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
|
||||
//只处理当前变为禁用的tab
|
||||
if (mutation.target.className=='cbi-tab') {
|
||||
//获取模组调试信息
|
||||
var debug_params={first_cache:true};
|
||||
get_modem_debug_info(debug_params);
|
||||
//只处理一次
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 配置观察器选项
|
||||
var observerOptions = {
|
||||
attributes: true, // 监听属性值变化
|
||||
attributeFilter: ['class'], // 要监听的属性名称
|
||||
};
|
||||
|
||||
// 开始观察目标元素
|
||||
observer.observe(childElements[i], observerOptions);
|
||||
}
|
||||
}
|
||||
|
||||
// 自动填写到快捷AT命令到输入框
|
||||
function copy_to_input()
|
||||
{
|
||||
@ -169,6 +214,59 @@
|
||||
}
|
||||
}
|
||||
|
||||
//获取当前启用的元素
|
||||
function get_tab_enable_element(parent_element)
|
||||
{
|
||||
var disenable_element;
|
||||
//获取子元素
|
||||
var childElements = parent_element.children;
|
||||
//获取需要禁用的元素
|
||||
for (var i = 0; i < childElements.length; i++)
|
||||
{
|
||||
// 检查当前子元素的class属性是否为cbi-tab
|
||||
if (childElements[i].classList.contains('cbi-tab'))
|
||||
{
|
||||
disenable_element=childElements[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return disenable_element;
|
||||
}
|
||||
|
||||
// 设置tab显示
|
||||
function set_tab_view(disenable_element,enable_element)
|
||||
{
|
||||
//获取tab内容父元素
|
||||
var tab_context = document.getElementById('tab_context');
|
||||
|
||||
//禁用tab
|
||||
disenable_element.classList.remove('cbi-tab');
|
||||
disenable_element.classList.add('cbi-tab-disabled');
|
||||
//禁用tab内容
|
||||
var data_tab_disenable = disenable_element.getAttribute('data-tab');
|
||||
var tab_context_disenable_element = tab_context.querySelector('div[data-tab="'+data_tab_disenable+'"]');
|
||||
tab_context_disenable_element.setAttribute('data-tab-active','false');
|
||||
|
||||
//启用tab
|
||||
enable_element.classList.remove('cbi-tab-disabled');
|
||||
enable_element.classList.add('cbi-tab');
|
||||
//启用tab内容
|
||||
var data_tab_enable = enable_element.getAttribute('data-tab');
|
||||
var tab_context_enable_element = tab_context.querySelector('div[data-tab="'+data_tab_enable+'"]');
|
||||
tab_context_enable_element.setAttribute('data-tab-active','true');
|
||||
}
|
||||
|
||||
// tab事件处理(更新选中的tab及tab内容)
|
||||
function tab_event(tab_element)
|
||||
{
|
||||
//获取需要禁用的tab元素
|
||||
var tab_menu = document.getElementsByClassName('cbi-tabmenu')[0];
|
||||
var disenable_element=get_tab_enable_element(tab_menu);
|
||||
if (tab_element != disenable_element) {
|
||||
set_tab_view(disenable_element,tab_element);
|
||||
}
|
||||
}
|
||||
|
||||
// 无模组界面
|
||||
function no_modems_view()
|
||||
{
|
||||
@ -178,14 +276,10 @@
|
||||
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";
|
||||
//隐藏模组自检界面
|
||||
document.getElementById("cbi-modem-self-test").style.display="none";
|
||||
//隐藏AT界面
|
||||
document.getElementById("cbi-at").style.display="none";
|
||||
//隐藏tab菜单界面
|
||||
document.getElementsByClassName("cbi-tabmenu")[0].style.display="none";
|
||||
//隐藏tab内容界面
|
||||
document.getElementById("tab_context").style.display="none";
|
||||
}
|
||||
|
||||
// 有模组界面
|
||||
@ -193,8 +287,8 @@
|
||||
{
|
||||
//显示模组选择界面
|
||||
document.getElementById("cbi-modem").style.display="block";
|
||||
//显示AT命令界面
|
||||
document.getElementById("cbi-at").style.display="block";
|
||||
//显示AT命令标题
|
||||
document.getElementById("at_command_title").style.display="block";
|
||||
//隐藏提示信息
|
||||
// document.getElementById("cbi-info").style.display="none";
|
||||
}
|
||||
@ -202,31 +296,36 @@
|
||||
// 未适配模组界面
|
||||
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";
|
||||
//隐藏模组自检界面
|
||||
document.getElementById("cbi-modem-self-test").style.display="none";
|
||||
//显示tab内容界面
|
||||
document.getElementById("tab_context").style.display="block";
|
||||
//显示AT命令标题
|
||||
document.getElementById("at_command_title").style.display="block";
|
||||
//隐藏tab菜单界面
|
||||
document.getElementsByClassName("cbi-tabmenu")[0].style.display="none";
|
||||
//在tab菜单选中AT命令
|
||||
var data_tab="at_command_tab"
|
||||
var at_command_tab_element = document.querySelector('li[data-tab="'+data_tab+'"]');
|
||||
tab_event(at_command_tab_element);
|
||||
//隐藏tab内容界面
|
||||
// document.getElementById("tab_context").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-modem-self-test").style.display="block";
|
||||
//显示tab菜单界面
|
||||
document.getElementsByClassName("cbi-tabmenu")[0].style.display="block";
|
||||
//显示tab内容界面
|
||||
document.getElementById("tab_context").style.display="block";
|
||||
//隐藏AT命令标题
|
||||
document.getElementById("at_command_title").style.display="none";
|
||||
//隐藏提示信息
|
||||
document.getElementById("cbi-info").style.display="none";
|
||||
}
|
||||
|
||||
|
||||
// 更新选项
|
||||
function update_option(select_element,data,order)
|
||||
@ -495,44 +594,75 @@
|
||||
// 设置模组自检信息
|
||||
function set_modem_self_test_info(self_test_info)
|
||||
{
|
||||
// console.log(self_test_info);
|
||||
|
||||
//获取模组自检
|
||||
// var self_test=self_test_info["self_test"];
|
||||
//获取电压
|
||||
var voltage=self_test_info["voltage"];
|
||||
//获取温度
|
||||
var temperature=self_test_info["temperature"];
|
||||
|
||||
// //获取自检视图
|
||||
// var self_test_view=set_current_self_test_view(self_test);
|
||||
// //获取
|
||||
// var self_test_view=set_current_self_test_view(self_test);
|
||||
|
||||
// //设置当前电压信息
|
||||
// document.getElementById('current_voltage').innerHTML=current_self_test_view;
|
||||
document.getElementById('current_voltage').innerHTML=self_test_info/1000;
|
||||
//设置当前电压
|
||||
document.getElementById('current_voltage').innerHTML=voltage/1000+" V";
|
||||
//设置当前温度
|
||||
document.getElementById('current_temperature').innerHTML=temperature+" °C";
|
||||
|
||||
// 设置电压状态
|
||||
//设置电压状态
|
||||
var state = '';
|
||||
var css = '';
|
||||
if (self_test_info<3135)
|
||||
if (voltage<3135)
|
||||
{
|
||||
state = "<%:Abnormal%>";
|
||||
color = "red";
|
||||
}
|
||||
else if (self_test_info>3135 && self_test_info<3300)
|
||||
else if (voltage>=3135 && voltage<3700)
|
||||
{
|
||||
state = "<%:Low%>";
|
||||
color = "goldenrod";
|
||||
}
|
||||
else //大于3300(3.3V)
|
||||
{
|
||||
else if (voltage>=3700 && voltage<4400) {
|
||||
state = "<%:Normal%>";
|
||||
color = "green";
|
||||
}
|
||||
else if (voltage>=4400) {
|
||||
state = "<%:Abnormal%>";
|
||||
color = "red";
|
||||
}
|
||||
else
|
||||
{
|
||||
state = "<%:Unknown%>";
|
||||
color = "goldenrod";
|
||||
}
|
||||
var voltage_status=document.getElementById('voltage_status');
|
||||
voltage_status.innerHTML=state;
|
||||
voltage_status.style.color=color
|
||||
|
||||
// //设置当前温度信息
|
||||
// document.getElementById('current_temperature').innerHTML=current_self_test_view;
|
||||
//设置温度状态
|
||||
state = '';
|
||||
css = '';
|
||||
if (temperature<45)
|
||||
{
|
||||
state = "<%:Normal%>";
|
||||
color = "green";
|
||||
}
|
||||
else if (temperature>=45 && temperature<75)
|
||||
{
|
||||
state = "<%:Somewhat High%>";
|
||||
color = "goldenrod";
|
||||
}
|
||||
else if (temperature>=75 && temperature<105) {
|
||||
state = "<%:Excessively High%>";
|
||||
color = "red";
|
||||
}
|
||||
else if (temperature>=105) {
|
||||
state = "<%:Abnormal%>";
|
||||
color = "red";
|
||||
}
|
||||
else
|
||||
{
|
||||
state = "<%:Unknown%>";
|
||||
color = "goldenrod";
|
||||
}
|
||||
var temperature_status=document.getElementById('temperature_status');
|
||||
temperature_status.innerHTML=state;
|
||||
temperature_status.style.color=color
|
||||
}
|
||||
|
||||
// 设置网络偏好
|
||||
@ -588,35 +718,116 @@
|
||||
//获取选中的模组
|
||||
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"];
|
||||
var self_test_info=data["self_test_info"];
|
||||
if (Object.keys(mode_info).length==0||Object.keys(network_prefer_info).length==0) {
|
||||
//显示未适配模组界面
|
||||
not_adapted_modems_view();
|
||||
return false
|
||||
//获取当前启用的tab元素
|
||||
var tab_menu = document.getElementsByClassName('cbi-tabmenu')[0];
|
||||
var tab_enable_element=get_tab_enable_element(tab_menu);
|
||||
|
||||
//获取当前选中的tab元素
|
||||
var data_tab=tab_enable_element.getAttribute("data-tab").replace("_tab","");
|
||||
|
||||
if (data_tab=="mode") {
|
||||
//获取拨号模式信息
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "get_mode_info")%>', {"port":at_port},
|
||||
function(x, data)
|
||||
{
|
||||
var mode_info=data["mode_info"];
|
||||
if (Object.keys(mode_info).length==0)
|
||||
{
|
||||
//显示未适配模组界面
|
||||
not_adapted_modems_view();
|
||||
return false
|
||||
}
|
||||
|
||||
//设置模式信息
|
||||
set_mode_info(mode_info,debug_params.first_cache);
|
||||
|
||||
//设置第一次获取数据标志
|
||||
debug_params.first_cache=false;
|
||||
|
||||
//显示全功能界面
|
||||
all_function_view();
|
||||
}
|
||||
);
|
||||
}
|
||||
else if (data_tab=="network_prefer") {
|
||||
//获取网络偏好信息
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "get_network_prefer_info")%>', {"port":at_port},
|
||||
function(x, data)
|
||||
{
|
||||
var network_prefer_info=data["network_prefer_info"];
|
||||
if (Object.keys(network_prefer_info).length==0)
|
||||
{
|
||||
//显示未适配模组界面
|
||||
not_adapted_modems_view();
|
||||
return false
|
||||
}
|
||||
|
||||
//设置模式信息
|
||||
set_mode_info(mode_info,debug_params.first_cache);
|
||||
//设置网络偏好信息
|
||||
set_network_prefer_info(network_prefer_info,debug_params.first_cache);
|
||||
|
||||
//设置网络偏好信息
|
||||
set_network_prefer_info(network_prefer_info,debug_params.first_cache);
|
||||
//设置第一次获取数据标志
|
||||
debug_params.first_cache=false;
|
||||
|
||||
//设置模组自检信息
|
||||
set_modem_self_test_info(self_test_info);
|
||||
//显示全功能界面
|
||||
all_function_view();
|
||||
}
|
||||
);
|
||||
}
|
||||
else if (data_tab=="self_test") {
|
||||
//获取自检信息
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "get_self_test_info")%>', {"port":at_port},
|
||||
function(x, data)
|
||||
{
|
||||
var self_test_info=data["self_test_info"];
|
||||
if (Object.keys(self_test_info).length==0)
|
||||
{
|
||||
//显示未适配模组界面
|
||||
not_adapted_modems_view();
|
||||
return false
|
||||
}
|
||||
|
||||
//设置第一次获取数据标志
|
||||
debug_params.first_cache=false;
|
||||
//设置模组自检信息
|
||||
set_modem_self_test_info(self_test_info);
|
||||
|
||||
//设置第一次获取数据标志
|
||||
// debug_params.first_cache=false;
|
||||
|
||||
//显示全功能界面
|
||||
all_function_view();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
//获取调试信息
|
||||
// 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"];
|
||||
// var self_test_info=data["self_test_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,debug_params.first_cache);
|
||||
|
||||
// //设置网络偏好信息
|
||||
// set_network_prefer_info(network_prefer_info,debug_params.first_cache);
|
||||
|
||||
// //设置模组自检信息
|
||||
// set_modem_self_test_info(self_test_info);
|
||||
|
||||
// //设置第一次获取数据标志
|
||||
// debug_params.first_cache=false;
|
||||
|
||||
// //显示全功能界面
|
||||
// all_function_view();
|
||||
// }
|
||||
// );
|
||||
|
||||
//显示全功能界面
|
||||
all_function_view();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// 定时触发更新AT串口
|
||||
@ -689,6 +900,19 @@
|
||||
font-size: 15px;
|
||||
} */
|
||||
|
||||
/* 隐藏tab菜单 */
|
||||
.cbi-tabmenu {
|
||||
display: none;
|
||||
}
|
||||
/* 隐藏tab内容 */
|
||||
#tab_context {
|
||||
display: none;
|
||||
}
|
||||
/* 隐藏AT命令标题 */
|
||||
#at_command_title {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* 终端 */
|
||||
textarea {
|
||||
background:#373737;
|
||||
@ -750,59 +974,19 @@
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<!-- <ul class="cbi-tabmenu" id="tab_menu">
|
||||
<li class="cbi-tab" data-tab="mode_tab"><a href="#"><%:Mode%></a></li>
|
||||
<li class="cbi-tab-disabled" data-tab="network_prefer_tab"><a href="#"><%:Network Preferences%></a></li>
|
||||
<li class="cbi-tab-disabled" data-tab="self_test_tab"><a href="#"><%:Self Test%></a></li>
|
||||
<li class="cbi-tab-disabled" data-tab="at_command_tab"><a href="#"><%:AT Command%></a></li>
|
||||
</ul> -->
|
||||
|
||||
<!-- <fieldset class="cbi-section" id="cbi-mode" style="display: none;">
|
||||
<div class="cbi-section">
|
||||
<ul class="cbi-tabmenu">
|
||||
<li class="cbi-tab" data-tab="traffic"><a href="#">流量分布</a></li>
|
||||
<li class="cbi-tab-disabled" data-tab="layer7"><a href="#">应用层协议</a></li>
|
||||
<li class="cbi-tab-disabled" data-tab="ipv6"><a href="#">IPv6</a></li>
|
||||
<li class="cbi-tab-disabled" data-tab="export"><a href="#">导出</a></li>
|
||||
</ul> -->
|
||||
<!-- <div class="cbi-section-node cbi-section-node-tabbed" id="cbi-modem-bcfdc2df58a1440a9bab98c7d37ce93c" data-tab-group="0" data-initialized="true">
|
||||
<div class="cbi-tabcontainer" id="container.modem.bcfdc2df58a1440a9bab98c7d37ce93c.general" data-tab="general" data-tab-title="常规设置" data-tab-active="true">
|
||||
<div class="cbi-value" id="cbi-modem-bcfdc2df58a1440a9bab98c7d37ce93c-enable" data-index="1" data-depends="[]"><label class="cbi-value-title" for="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.enable">启用</label>
|
||||
<div class="cbi-value-field">
|
||||
<div id="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.enable" class="cbi-checkbox" data-idref="e234c82a"><input type="hidden" name="cbi.cbe.modem.bcfdc2df58a1440a9bab98c7d37ce93c.enable" value="1"><input id="cbe81b0aab" name="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.enable" type="checkbox" value="1" checked="" data-widget-id="widget.cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.enable"><label for="cbe81b0aab"></label></div>
|
||||
</div></div>
|
||||
<div class="cbi-value" id="cbi-modem-bcfdc2df58a1440a9bab98c7d37ce93c-remarks" data-index="2" data-depends="[]"><label class="cbi-value-title" for="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.remarks">备注</label>
|
||||
<div class="cbi-value-field">
|
||||
<div id="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.remarks" data-idref="30622a74"><input id="widget.cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.remarks" name="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.remarks" type="text" class="cbi-input-text" value="5GUSB"></div>
|
||||
</div></div>
|
||||
<div class="cbi-value cbi-value-last" id="cbi-modem-bcfdc2df58a1440a9bab98c7d37ce93c-network" data-index="3" data-depends="[]"><label class="cbi-value-title" for="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.network">移动网络</label>
|
||||
<div class="cbi-value-field">
|
||||
<div id="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.network" data-idref="f8c7e254"><select id="widget.cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.network" name="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.network" size="1" class="cbi-input-select"><option value="wwan0" selected="">wwan0 (FM150-AE)</option></select></div>
|
||||
</div></div>
|
||||
</div>
|
||||
<div class="cbi-tabcontainer" id="container.modem.bcfdc2df58a1440a9bab98c7d37ce93c.advanced" data-tab="advanced" data-tab-title="高级设置" data-tab-active="false">
|
||||
<div class="cbi-value" id="cbi-modem-bcfdc2df58a1440a9bab98c7d37ce93c-dial_tool" data-index="1" data-depends="[]"><label class="cbi-value-title" for="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.dial_tool">拨号工具</label>
|
||||
<div class="cbi-value-field">
|
||||
<div id="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.dial_tool" data-idref="184707a1"><select id="widget.cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.dial_tool" name="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.dial_tool" size="1" class="cbi-input-select"><option value="">自动选择</option><option value="quectel-CM">移远模组拨号工具</option><option value="mmcli" selected="">mmcli</option></select></div>
|
||||
<div class="cbi-value-description">
|
||||
After switching the dialing tool, it may be necessary to restart the module or restart the router to recognize the module.
|
||||
</div></div></div>
|
||||
<div class="cbi-value" id="cbi-modem-bcfdc2df58a1440a9bab98c7d37ce93c-pdp_type" data-index="2" data-depends="[]"><label class="cbi-value-title" for="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.pdp_type">网络类型</label>
|
||||
<div class="cbi-value-field">
|
||||
<div id="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.pdp_type" data-idref="74f51b28"><select id="widget.cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.pdp_type" name="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.pdp_type" size="1" class="cbi-input-select"><option value="ipv4">IPv4</option><option value="ipv6">IPv6</option><option value="ipv4v6" selected="">IPv4/IPv6</option></select></div>
|
||||
</div></div>
|
||||
<div class="cbi-value" id="cbi-modem-bcfdc2df58a1440a9bab98c7d37ce93c-apn" data-index="3" data-depends="[]"><label class="cbi-value-title" for="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.apn">接入点</label>
|
||||
<div class="cbi-value-field">
|
||||
<div id="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.apn" class="cbi-dropdown" optional="" tabindex="0" data-idref="a314df9e"><ul tabindex="-1"><li data-value="" selected="" display="0">自动选择</li><li data-value="cmnet">中国移动</li><li data-value="3gnet">中国联通</li><li data-value="ctnet">中国电信</li><li data-value="cbnet">中国广电</li><li data-value="5gscuiot">天际通</li><li data-value="-" unselectable=""><input type="text" class="create-item-input" placeholder="-- 自定义 --"></li></ul><span class="more" tabindex="-1">···</span><span class="open" tabindex="-1">▾</span><div><input type="hidden" name="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.apn" value=""></div></div>
|
||||
</div></div>
|
||||
<div class="cbi-value cbi-value-last" id="cbi-modem-bcfdc2df58a1440a9bab98c7d37ce93c-auth" data-index="4" data-depends="[]"><label class="cbi-value-title" for="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.auth">认证类型</label>
|
||||
<div class="cbi-value-field">
|
||||
<div id="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.auth" data-idref="8b4f94b8"><select id="widget.cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.auth" name="cbid.modem.bcfdc2df58a1440a9bab98c7d37ce93c.auth" size="1" class="cbi-input-select"><option value="none" selected="">无</option><option value="both">PAP/CHAP(均使用)</option><option value="pap">PAP</option><option value="chap">CHAP</option></select></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- </div>
|
||||
</fieldset> -->
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-mode" style="display: none;">
|
||||
<div class="cbi-section cbi-tblsection">
|
||||
<div id="tab_context">
|
||||
<!-- <div class="cbi-section cbi-tblsection" data-tab-active="true"> -->
|
||||
<div class="cbi-section" data-tab="mode_tab" data-tab-title="<%:Mode%>" data-tab-active="true">
|
||||
<!-- <legend><%:Mode%></legend> -->
|
||||
<h3><%:Mode%></h3>
|
||||
<!-- <h3><%:Mode%></h3> -->
|
||||
<table class="table cbi-section-table">
|
||||
<tbody>
|
||||
<tr class="tr cbi-section-table-titles anonymous">
|
||||
@ -845,12 +1029,10 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-network-prefer" style="display: none;">
|
||||
<div class="cbi-section cbi-tblsection">
|
||||
<!-- <div class="cbi-section cbi-tblsection"> -->
|
||||
<div class="cbi-section" data-tab="network_prefer_tab" data-tab-title="<%:Network Preferences%>" data-tab-active="false">
|
||||
<!-- <legend><%:Network Preferences%></legend> -->
|
||||
<h3><%:Network Preferences%></h3>
|
||||
<!-- <h3><%:Network Preferences%></h3> -->
|
||||
<table class="table cbi-section-table">
|
||||
<tbody>
|
||||
<tr class="tr cbi-section-table-titles anonymous">
|
||||
@ -898,12 +1080,10 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-modem-self-test" style="display: none;">
|
||||
<div class="cbi-section fade-in">
|
||||
<!-- <div class="cbi-section fade-in"> -->
|
||||
<div class="cbi-section" data-tab="self_test_tab" data-tab-title="<%:Self Test%>" data-tab-active="false">
|
||||
<!-- <legend><%:Self Test%></legend> -->
|
||||
<h3><%:Self Test%></h3>
|
||||
<!-- <h3><%:Self Test%></h3> -->
|
||||
<table class="table cbi-section-table">
|
||||
<tbody>
|
||||
<tr class="tr cbi-section-table-titles anonymous">
|
||||
@ -912,24 +1092,22 @@
|
||||
<th class="th cbi-section-table-cell"><%:Status%></th>
|
||||
</tr>
|
||||
<tr class="tr cbi-section-table-row cbi-rowstyle-1">
|
||||
<td class="td cbi-value-field" data-title="<%:Item%>" id="voltage_label">电压</td>
|
||||
<td class="td cbi-value-field" data-title="<%:Item%>" id="voltage_label"><%:Voltage%></td>
|
||||
<td class="td cbi-value-field" data-title="<%:Current%>" id="current_voltage"></td>
|
||||
<td class="td cbi-value-field" data-title="<%:Status%>" id="voltage_status">-</td>
|
||||
</tr>
|
||||
<!-- <tr class="tr cbi-section-table-row cbi-rowstyle-2">
|
||||
<td class="td cbi-value-field" data-title="<%:Item%>" id="temperature_label">温度</td>
|
||||
<td class="td cbi-value-field" data-title="<%:Current%>" id="current_temperature">-</td>
|
||||
<td class="td cbi-value-field" data-title="<%:Status%>" id="temperature_status">正常</td>
|
||||
</tr> -->
|
||||
<tr class="tr cbi-section-table-row cbi-rowstyle-2">
|
||||
<td class="td cbi-value-field" data-title="<%:Item%>" id="temperature_label"><%:Temperature%></td>
|
||||
<td class="td cbi-value-field" data-title="<%:Current%>" id="current_temperature"></td>
|
||||
<td class="td cbi-value-field" data-title="<%:Status%>" id="temperature_status">-</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-at" style="display: none;">
|
||||
<div class="cbi-section fade-in">
|
||||
<!-- <div class="cbi-section fade-in"> -->
|
||||
<div class="cbi-section" data-tab="at_command_tab" data-tab-title="<%:AT Command%>" data-tab-active="false">
|
||||
<!-- <legend><%:AT Command%></legend> -->
|
||||
<h3><%:AT Command%></h3>
|
||||
<h3 id="at_command_title"><%:AT Command%></h3>
|
||||
<table class="table" id="at_command_info">
|
||||
<tbody>
|
||||
<!-- <tr class="tr">
|
||||
@ -981,8 +1159,8 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<%+footer%>
|
||||
|
@ -88,6 +88,9 @@ msgstr "配置"
|
||||
msgid "Item"
|
||||
msgstr "项目"
|
||||
|
||||
msgid "Voltage"
|
||||
msgstr "电压"
|
||||
|
||||
msgid "Status"
|
||||
msgstr "状态"
|
||||
|
||||
@ -100,6 +103,12 @@ msgstr "正常"
|
||||
msgid "Low"
|
||||
msgstr "偏低"
|
||||
|
||||
msgid "Somewhat High"
|
||||
msgstr "偏高"
|
||||
|
||||
msgid "Excessively High"
|
||||
msgstr "过高"
|
||||
|
||||
msgid "AT Command"
|
||||
msgstr "AT命令"
|
||||
|
||||
@ -178,6 +187,9 @@ msgstr "移动网络"
|
||||
msgid "UNKNOWN"
|
||||
msgstr "未知"
|
||||
|
||||
msgid "Unknown"
|
||||
msgstr "未知"
|
||||
|
||||
msgid "unknown"
|
||||
msgstr "未知"
|
||||
|
||||
|
@ -609,12 +609,17 @@ dial()
|
||||
|
||||
#获取模块序号
|
||||
get_modem_no "${network}"
|
||||
#获取模组的拨号模式
|
||||
[ -z "${modem_no}" ] && return 0
|
||||
local mode=$(get_mode ${modem_no})
|
||||
[ -z "$mode" ] && {
|
||||
mode="qmi";
|
||||
}
|
||||
|
||||
#获取模组的拨号模式
|
||||
local mode
|
||||
while true; do
|
||||
mode=$(get_mode ${modem_no})
|
||||
if [ -n "$mode" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 5s
|
||||
done
|
||||
|
||||
#查看移动网络是否已经有配置在运行
|
||||
mkdir -m 0755 -p "${MODEM_RUNDIR}"
|
||||
|
@ -252,9 +252,9 @@ fibocom_set_network_prefer()
|
||||
sh ${SCRIPT_DIR}/modem_at.sh $at_port "$at_command"
|
||||
}
|
||||
|
||||
#获取自检信息
|
||||
#获取电压
|
||||
# $1:AT串口
|
||||
fibocom_get_self_test_info()
|
||||
fibocom_get_voltage()
|
||||
{
|
||||
local at_port="$1"
|
||||
|
||||
@ -264,6 +264,31 @@ fibocom_get_self_test_info()
|
||||
echo "${voltage}"
|
||||
}
|
||||
|
||||
#获取温度
|
||||
# $1:AT串口
|
||||
fibocom_get_temperature()
|
||||
{
|
||||
local at_port="$1"
|
||||
|
||||
#Temperature(温度)
|
||||
at_command="AT+MTSM=1,6"
|
||||
response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "+MTSM: " | sed 's/+MTSM: //g' | sed 's/\r//g')
|
||||
|
||||
[ -z "$response" ] && {
|
||||
#联发科平台
|
||||
at_command="AT+GTSENRDTEMP=0"
|
||||
response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "+GTSENRDTEMP: " | awk -F',' '{print $2}' | sed 's/\r//g')
|
||||
response="${response:0:2}"
|
||||
}
|
||||
|
||||
local temperature
|
||||
[ -n "$response" ] && {
|
||||
temperature="${response}$(printf "\xc2\xb0")C"
|
||||
}
|
||||
|
||||
echo "${temperature}"
|
||||
}
|
||||
|
||||
#获取连接状态
|
||||
# $1:AT串口
|
||||
# $2:连接定义
|
||||
@ -311,19 +336,7 @@ fibocom_base_info()
|
||||
mode=$(fibocom_get_mode $at_port | tr 'a-z' 'A-Z')
|
||||
|
||||
#Temperature(温度)
|
||||
at_command="AT+MTSM=1,6"
|
||||
response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "+MTSM: " | sed 's/+MTSM: //g' | sed 's/\r//g')
|
||||
|
||||
[ -z "$response" ] && {
|
||||
#联发科平台
|
||||
at_command="AT+GTSENRDTEMP=0"
|
||||
response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "+GTSENRDTEMP: " | awk -F',' '{print $2}' | sed 's/\r//g')
|
||||
response="${response:0:2}"
|
||||
}
|
||||
|
||||
[ -n "$response" ] && {
|
||||
temperature="$response$(printf "\xc2\xb0")C"
|
||||
}
|
||||
temperature=$(fibocom_get_temperature $at_port)
|
||||
}
|
||||
|
||||
#获取SIM卡状态
|
||||
|
@ -83,23 +83,22 @@ ecm_dial()
|
||||
# $2:制造商
|
||||
# $3:平台
|
||||
# $4:连接定义
|
||||
# $5:接口名称
|
||||
# $5:模组序号
|
||||
rndis_dial()
|
||||
{
|
||||
local at_port="$1"
|
||||
local manufacturer="$2"
|
||||
local platform="$3"
|
||||
local define_connect="$4"
|
||||
local interface_name="$5"
|
||||
local modem_no="$5"
|
||||
|
||||
#手动设置IP(广和通FM350-GL)
|
||||
if [ "$manufacturer" = "fibocom" ] && [ "$platform" = "mediatek" ]; then
|
||||
|
||||
#激活并拨号
|
||||
at_command="AT+CGACT=1,${define_connect}"
|
||||
#打印日志
|
||||
dial_log "${at_command}" "${MODEM_RUNDIR}/modem${modem_no}_dial.cache"
|
||||
|
||||
#激活并拨号
|
||||
at "${at_port}" "${at_command}"
|
||||
|
||||
#获取IPv4地址
|
||||
@ -115,6 +114,10 @@ rndis_dial()
|
||||
uci set network.${interface_name}.gateway="${ipv4%.*}.1"
|
||||
uci commit network
|
||||
service network reload
|
||||
|
||||
#启动网络接口
|
||||
ifup "wwan_5g_${modem_no}"
|
||||
ifup "wwan6_5g_${modem_no}"
|
||||
fi
|
||||
else
|
||||
#拨号
|
||||
@ -170,7 +173,7 @@ modem_network_task()
|
||||
break
|
||||
fi
|
||||
#单个模组
|
||||
enable=$(uci -q get modem.$config_id.enable)
|
||||
enable=$(uci -q get modem.${config_id}.enable)
|
||||
if [ "$enable" != "1" ]; then
|
||||
break
|
||||
fi
|
||||
@ -199,7 +202,7 @@ modem_network_task()
|
||||
case "$mode" in
|
||||
"gobinet") gobinet_dial "${at_port}" "${manufacturer}" "${define_connect}" ;;
|
||||
"ecm") ecm_dial "${at_port}" "${manufacturer}" "${define_connect}" ;;
|
||||
"rndis") rndis_dial "${at_port}" "${manufacturer}" "${platform}" "${define_connect}" "${interface_name}" ;;
|
||||
"rndis") rndis_dial "${at_port}" "${manufacturer}" "${platform}" "${define_connect}" "${modem_no}" ;;
|
||||
"modemmanager") modemmanager_dial "${interface_name}" "${define_connect}" ;;
|
||||
*) ecm_dial "${at_port}" "${manufacturer}" "${define_connect}" ;;
|
||||
esac
|
||||
|
@ -12,7 +12,7 @@ modem_scan_task()
|
||||
sleep 8s #刚开机需要等待移动网络出来
|
||||
while true; do
|
||||
enable=$(uci -q get modem.@global[0].enable)
|
||||
if [ "$enable" = "1" ] ;then
|
||||
if [ "$enable" = "1" ]; then
|
||||
#扫描模块
|
||||
debug "开启模块扫描任务"
|
||||
modem_scan
|
||||
|
@ -203,9 +203,9 @@ quectel_set_network_prefer()
|
||||
sh ${SCRIPT_DIR}/modem_at.sh "${at_port}" "${at_command}"
|
||||
}
|
||||
|
||||
#获取自检信息
|
||||
#获取电压
|
||||
# $1:AT串口
|
||||
quectel_get_self_test_info()
|
||||
quectel_get_voltage()
|
||||
{
|
||||
local at_port="$1"
|
||||
|
||||
@ -215,6 +215,39 @@ quectel_get_self_test_info()
|
||||
echo "${voltage}"
|
||||
}
|
||||
|
||||
#获取温度
|
||||
# $1:AT串口
|
||||
quectel_get_temperature()
|
||||
{
|
||||
local at_port="$1"
|
||||
|
||||
#Temperature(温度)
|
||||
at_command="AT+QTEMP"
|
||||
response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'"' '{print $4}')
|
||||
|
||||
local temperature
|
||||
if [ -n "$response" ]; then
|
||||
temperature="$response$(printf "\xc2\xb0")C"
|
||||
fi
|
||||
|
||||
# response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "+QTEMP:")
|
||||
# QTEMP=$(echo $response | grep -o -i "+QTEMP: [0-9]\{1,3\}")
|
||||
# if [ -z "$QTEMP" ]; then
|
||||
# QTEMP=$(echo $response | grep -o -i "+QTEMP:[ ]\?\"XO[_-]THERM[_-][^,]\+,[\"]\?[0-9]\{1,3\}" | grep -o "[0-9]\{1,3\}")
|
||||
# fi
|
||||
# if [ -z "$QTEMP" ]; then
|
||||
# QTEMP=$(echo $response | grep -o -i "+QTEMP:[ ]\?\"MDM-CORE-USR.\+[0-9]\{1,3\}\"" | cut -d\" -f4)
|
||||
# fi
|
||||
# if [ -z "$QTEMP" ]; then
|
||||
# QTEMP=$(echo $response | grep -o -i "+QTEMP:[ ]\?\"MDMSS.\+[0-9]\{1,3\}\"" | cut -d\" -f4)
|
||||
# fi
|
||||
# if [ -n "$QTEMP" ]; then
|
||||
# CTEMP=$(echo $QTEMP | grep -o -i "[0-9]\{1,3\}")$(printf "\xc2\xb0")"C"
|
||||
# fi
|
||||
|
||||
echo "${temperature}"
|
||||
}
|
||||
|
||||
#获取连接状态
|
||||
# $1:AT串口
|
||||
# $2:连接定义
|
||||
@ -278,25 +311,7 @@ quectel_base_info()
|
||||
mode=$(quectel_get_mode $at_port | tr 'a-z' 'A-Z')
|
||||
|
||||
#Temperature(温度)
|
||||
at_command="AT+QTEMP"
|
||||
response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'"' '{print $4}')
|
||||
if [ -n "$response" ]; then
|
||||
temperature="$response$(printf "\xc2\xb0")C"
|
||||
fi
|
||||
# response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "+QTEMP:")
|
||||
# QTEMP=$(echo $response | grep -o -i "+QTEMP: [0-9]\{1,3\}")
|
||||
# if [ -z "$QTEMP" ]; then
|
||||
# QTEMP=$(echo $response | grep -o -i "+QTEMP:[ ]\?\"XO[_-]THERM[_-][^,]\+,[\"]\?[0-9]\{1,3\}" | grep -o "[0-9]\{1,3\}")
|
||||
# fi
|
||||
# if [ -z "$QTEMP" ]; then
|
||||
# QTEMP=$(echo $response | grep -o -i "+QTEMP:[ ]\?\"MDM-CORE-USR.\+[0-9]\{1,3\}\"" | cut -d\" -f4)
|
||||
# fi
|
||||
# if [ -z "$QTEMP" ]; then
|
||||
# QTEMP=$(echo $response | grep -o -i "+QTEMP:[ ]\?\"MDMSS.\+[0-9]\{1,3\}\"" | cut -d\" -f4)
|
||||
# fi
|
||||
# if [ -n "$QTEMP" ]; then
|
||||
# CTEMP=$(echo $QTEMP | grep -o -i "[0-9]\{1,3\}")$(printf "\xc2\xb0")"C"
|
||||
# fi
|
||||
temperature=$(quectel_get_temperature $at_port)
|
||||
}
|
||||
|
||||
#获取SIM卡状态
|
||||
|
Loading…
x
Reference in New Issue
Block a user