更新插件
This commit is contained in:
parent
c2d5737801
commit
7924809511
@ -44,27 +44,18 @@ function at(at_port,at_command)
|
||||
end
|
||||
|
||||
-- 获取模组连接状态
|
||||
function getModemConnectStatus(at_port)
|
||||
local at_command="AT+CGDCONT?"
|
||||
local response=at(at_port,at_command)
|
||||
function getModemConnectStatus(at_port,manufacturer)
|
||||
|
||||
-- 第六个引号的索引
|
||||
local sixth_index=1
|
||||
for i = 1, 5 do
|
||||
sixth_index=string.find(response,'"',sixth_index)+1
|
||||
local connect_status="unknown"
|
||||
|
||||
if at_port and manufacturer then
|
||||
local odpall = io.popen("cd /usr/share/modem && source $(dirname \"$0\")/"..manufacturer..".sh && get_connect_status "..at_port)
|
||||
connect_status = odpall:read("*a")
|
||||
connect_status=string.gsub(connect_status, "\n", "")
|
||||
odpall:close()
|
||||
end
|
||||
-- 第七个引号的索引
|
||||
local seven_index=string.find(response,'"',sixth_index+1)
|
||||
|
||||
-- 获取IPv4和IPv6
|
||||
local ip=string.sub(response,sixth_index,seven_index-1)
|
||||
|
||||
local not_ip="0.0.0.0,0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0"
|
||||
if string.find(ip,not_ip) then
|
||||
return "disconnect"
|
||||
else
|
||||
return "connect"
|
||||
end
|
||||
return connect_status
|
||||
end
|
||||
|
||||
-- 获取模组基本信息
|
||||
@ -76,10 +67,7 @@ function getModemBaseInfo(at_port)
|
||||
--获取数据接口
|
||||
local data_interface=modem_device["data_interface"]:upper()
|
||||
--获取连接状态
|
||||
local connect_status="unknown"
|
||||
if modem_device["at_port"] then
|
||||
connect_status=getModemConnectStatus(modem_device["at_port"])
|
||||
end
|
||||
local connect_status=getModemConnectStatus(modem_device["at_port"],modem_device["manufacturer"])
|
||||
|
||||
--设置值
|
||||
modem_base_info=modem_device
|
||||
@ -166,10 +154,7 @@ function getModems()
|
||||
local translation={}
|
||||
uci:foreach("modem", "modem-device", function (modem_device)
|
||||
-- 获取连接状态
|
||||
local connect_status="unknown"
|
||||
if modem_device["at_port"] then
|
||||
connect_status=getModemConnectStatus(modem_device["at_port"])
|
||||
end
|
||||
local connect_status=getModemConnectStatus(modem_device["at_port"],modem_device["manufacturer"])
|
||||
|
||||
-- 获取翻译
|
||||
translation[connect_status]=luci.i18n.translate(connect_status)
|
||||
|
@ -11,7 +11,7 @@
|
||||
{
|
||||
var modems=data["modems"];
|
||||
var translation=data["translation"];
|
||||
|
||||
|
||||
var modems_div=document.getElementById('modem_status_view');
|
||||
if (Object.keys(modems).length!=0)
|
||||
{
|
||||
|
@ -27,6 +27,25 @@ get_fibocom_mode()
|
||||
echo "$mode"
|
||||
}
|
||||
|
||||
#获取连接状态
|
||||
# $1:AT串口
|
||||
get_connect_status()
|
||||
{
|
||||
local at_port="$1"
|
||||
local at_command="AT+CGDCONT?"
|
||||
|
||||
local response=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'"' '{print $6}')
|
||||
local not_ip="0.0.0.0,0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0"
|
||||
|
||||
if [ "$response" = "$not_ip" ]; then
|
||||
connect_status="disconnect"
|
||||
else
|
||||
connect_status="connect"
|
||||
fi
|
||||
|
||||
echo "$connect_status"
|
||||
}
|
||||
|
||||
#获取SIM卡状态
|
||||
get_fibocom_sim_status()
|
||||
{
|
||||
@ -148,7 +167,7 @@ get_band()
|
||||
case $1 in
|
||||
"WCDMA") band="B$2" ;;
|
||||
"LTE") band="B$(($2-100))" ;;
|
||||
"NR") band="N$(($2-500))" ;;
|
||||
"NR") band="$2" band="N${band#*50}" ;;
|
||||
esac
|
||||
echo "$band"
|
||||
}
|
||||
|
@ -197,6 +197,7 @@ get_cell_info()
|
||||
{\"Physical Cell ID\":\"$endc_lte_physical_cell_id\", \"full_name\":\"Physical Cell ID\"},
|
||||
{\"EARFCN\":\"$endc_lte_earfcn\", \"full_name\":\"E-UTRA Absolute Radio Frequency Channel Number\"},
|
||||
{\"Freq band indicator\":\"$endc_lte_freq_band_ind\", \"full_name\":\"Freq band indicator\"},
|
||||
{\"Band\":\"$endc_lte_band\", \"full_name\":\"Band\"},
|
||||
{\"UL Bandwidth\":\"$endc_lte_ul_bandwidth\", \"full_name\":\"UL Bandwidth\"},
|
||||
{\"DL Bandwidth\":\"$endc_lte_dl_bandwidth\", \"full_name\":\"DL Bandwidth\"},
|
||||
{\"TAC\":\"$endc_lte_tac\", \"full_name\":\"Tracking area code of cell servedby neighbor Enb\"},
|
||||
@ -236,6 +237,7 @@ get_cell_info()
|
||||
{\"Physical Cell ID\":\"$lte_physical_cell_id\", \"full_name\":\"Physical Cell ID\"},
|
||||
{\"EARFCN\":\"$lte_earfcn\", \"full_name\":\"E-UTRA Absolute Radio Frequency Channel Number\"},
|
||||
{\"Freq band indicator\":\"$lte_freq_band_ind\", \"full_name\":\"Freq band indicator\"},
|
||||
{\"Band\":\"$lte_band\", \"full_name\":\"Band\"},
|
||||
{\"UL Bandwidth\":\"$lte_ul_bandwidth\", \"full_name\":\"UL Bandwidth\"},
|
||||
{\"DL Bandwidth\":\"$lte_dl_bandwidth\", \"full_name\":\"DL Bandwidth\"},
|
||||
{\"TAC\":\"$lte_tac\", \"full_name\":\"Tracking area code of cell servedby neighbor Enb\"},
|
||||
@ -259,6 +261,7 @@ get_cell_info()
|
||||
{\"UARFCN\":\"$wcdma_uarfcn\", \"full_name\":\"UTRA Absolute Radio Frequency Channel Number\"},
|
||||
{\"PSC\":\"$wcdma_psc\", \"full_name\":\"Primary Scrambling Code\"},
|
||||
{\"RAC\":\"$wcdma_rac\", \"full_name\":\"Routing Area Code\"},
|
||||
{\"Band\":\"$wcdma_band\", \"full_name\":\"Band\"},
|
||||
{\"RSCP\":\"$wcdma_rscp\", \"full_name\":\"Received Signal Code Power\"},
|
||||
{\"Ec/Io\":\"$wcdma_ecio\", \"full_name\":\"Ec/Io\"},
|
||||
{\"Ec/No\":\"$wcdma_ecno\", \"full_name\":\"Ec/No\"},
|
||||
|
@ -22,6 +22,24 @@ get_quectel_mode()
|
||||
echo "$mode"
|
||||
}
|
||||
|
||||
#获取连接状态
|
||||
# $1:AT串口
|
||||
get_connect_status()
|
||||
{
|
||||
local at_port="$1"
|
||||
local at_command="AT+QNWINFO"
|
||||
|
||||
local response=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p')
|
||||
|
||||
if [[ "$response" = *"No Service"* ]]; then
|
||||
connect_status="disconnect"
|
||||
else
|
||||
connect_status="connect"
|
||||
fi
|
||||
|
||||
echo "$connect_status"
|
||||
}
|
||||
|
||||
#获取SIM卡状态
|
||||
get_quectel_sim_status()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user