更新插件

This commit is contained in:
ling 2024-01-05 20:24:06 +08:00
parent 74452a5d47
commit c2d5737801
5 changed files with 130 additions and 27 deletions

View File

@ -137,6 +137,7 @@ function getModemInfo()
if modem_more_info["cell_info"] then if modem_more_info["cell_info"] then
for key in pairs(modem_more_info["cell_info"]) do for key in pairs(modem_more_info["cell_info"]) do
translation[key]=luci.i18n.translate(key)
local network_mode=modem_more_info["cell_info"][key] local network_mode=modem_more_info["cell_info"][key]
for i = 1, #network_mode do for i = 1, #network_mode do
local value = network_mode[i] local value = network_mode[i]

View File

@ -51,12 +51,15 @@ end
if (key=="UL Bandwidth"||key=="DL Bandwidth") { if (key=="UL Bandwidth"||key=="DL Bandwidth") {
info[key]=info[key]+" MHz" info[key]=info[key]+" MHz"
} }
else if (key=="RSRP"||key=="RxLev") { else if (key=="RSRP"||key=="TX Power"||key=="RxLev") {
info[key]=info[key]+" dbm" info[key]=info[key]+" dBm"
} }
else if (key=="RSRQ"||key=="RSSNR") { else if (key=="RSRQ"||key=="SINR"||key=="RSSNR"||key=="Ec/Io") {
info[key]=info[key]+" dB" info[key]=info[key]+" dB"
} }
else if (key=="SCS") {
info[key]=info[key]+" KHz"
}
cell_info_view+='<tr><td width="20%" title="'+full_name+'">'+translation[key]+' :</td><td id="'+key+'">'+info[key]+'</td><td></td></tr>'; cell_info_view+='<tr><td width="20%" title="'+full_name+'">'+translation[key]+' :</td><td id="'+key+'">'+info[key]+'</td><td></td></tr>';
} }
} }
@ -74,7 +77,7 @@ end
var cell_info_Element=document.getElementById("cell_info"); var cell_info_Element=document.getElementById("cell_info");
//初始化视图 //初始化视图
var cell_info_view='<caption>'+<%:network_mode%>+'</caption>'; var cell_info_view='<caption>'+translation[network_mode]+'</caption>';
if (network_mode=="EN-DC Mode") if (network_mode=="EN-DC Mode")
{ {
var lte=network_mode_info[0]["LTE"]; var lte=network_mode_info[0]["LTE"];
@ -159,6 +162,10 @@ end
} }
else else
{ {
// 更新提示信息
document.getElementById("info_message").innerHTML="<strong><%:Not adapted to this modem%></strong>";
// 显示提示信息
document.getElementById("cbi-info").style.display="block";
// 隐藏SIM卡信息 // 隐藏SIM卡信息
document.getElementById("cbi-siminfo").style.display="none"; document.getElementById("cbi-siminfo").style.display="none";
return return

View File

@ -19,6 +19,9 @@ msgstr "选择模组"
msgid "Check information about adapted modem on this page" msgid "Check information about adapted modem on this page"
msgstr "在此页面查看已适配模组的信息" msgstr "在此页面查看已适配模组的信息"
msgid "Not adapted to this modem"
msgstr "未适配该模组"
msgid "Loading modem information" msgid "Loading modem information"
msgstr "正在加载模组信息" msgstr "正在加载模组信息"
@ -274,10 +277,16 @@ msgstr "路由区域码"
msgid "RSCP" msgid "RSCP"
msgstr "接收信号码功率" msgstr "接收信号码功率"
msgid "Ec/Io" msgid "每比特能量与干扰功率密度(干扰比)之比"
msgstr "Eb/Io"
msgid "每比特能量与噪声功率密度(噪声比)之比"
msgstr "Eb/No"
msgid "每码片能量与干扰功率密度(干扰比)之比"
msgstr "Ec/Io" msgstr "Ec/Io"
msgid "Ec/No" msgid "每码片能量与噪声功率密度(噪声比)之比"
msgstr "Ec/No" msgstr "Ec/No"
msgid "Physical Channel" msgid "Physical Channel"

View File

@ -139,6 +139,20 @@ fibocom_network_info()
# fi # fi
} }
#获取频段
# $1:网络类型
# $2:频段数字
get_band()
{
local band
case $1 in
"WCDMA") band="B$2" ;;
"LTE") band="B$(($2-100))" ;;
"NR") band="N$(($2-500))" ;;
esac
echo "$band"
}
#获取上行带宽 #获取上行带宽
# $1:上行带宽数字 # $1:上行带宽数字
get_ul_bandwidth() get_ul_bandwidth()
@ -195,8 +209,8 @@ get_rsrq()
{ {
local rsrq local rsrq
case $1 in case $1 in
"LTE") rsrq=$(awk 'BEGIN{ printf "%.2f", $2 * 0.5 - 20 }' | sed 's/\.*0*$//') ;; "LTE") rsrq=$(awk "BEGIN{ printf \"%.2f\", $2 * 0.5 - 20 }" | sed 's/\.*0*$//') ;;
"NR") rsrq=$(awk -v num="$2" 'BEGIN{ printf "%.2f", (num+1) * 0.5 - 44 }' | sed 's/\.*0*$//') ;; "NR") rsrq=$(awk -v num="$2" "BEGIN{ printf \"%.2f\", (num+1) * 0.5 - 44 }" | sed 's/\.*0*$//') ;;
esac esac
echo "$rsrq" echo "$rsrq"
} }
@ -206,7 +220,7 @@ get_rsrq()
get_rssnr() get_rssnr()
{ {
#去掉小数点后的0 #去掉小数点后的0
local rssnr=$(awk 'BEGIN{ printf "%.2f", $1 / 2 }' | sed 's/\.*0*$//') local rssnr=$(awk "BEGIN{ printf \"%.2f\", $1 / 2 }" | sed 's/\.*0*$//')
echo "$rssnr" echo "$rssnr"
} }
@ -224,6 +238,13 @@ get_rxlev()
echo "$rxlev" echo "$rxlev"
} }
#获取Ec/Io
# $1:Ec/Io数字
get_ecio()
{
local ecio=$(awk "BEGIN{ printf \"%.2f\", $1 * 0.5 - 24.5 }" | sed 's/\.*0*$//')
echo "$ecio"
}
#网络信息 #网络信息
fibocom_cell_info() fibocom_cell_info()
@ -244,7 +265,8 @@ fibocom_cell_info()
nr_cell_id=$(echo "$response" | awk -F',' '{print $6}') nr_cell_id=$(echo "$response" | awk -F',' '{print $6}')
nr_arfcn=$(echo "$response" | awk -F',' '{print $7}') nr_arfcn=$(echo "$response" | awk -F',' '{print $7}')
nr_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}') nr_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}')
nr_band=$(echo "$response" | awk -F',' '{print $9}') nr_band_num=$(echo "$response" | awk -F',' '{print $9}')
nr_band=$(get_band "NR" $nr_band_num)
nr_dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}') nr_dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}')
nr_dl_bandwidth=$(get_nr_dl_bandwidth $nr_dl_bandwidth_num) nr_dl_bandwidth=$(get_nr_dl_bandwidth $nr_dl_bandwidth_num)
nr_sinr=$(echo "$response" | awk -F',' '{print $11}') nr_sinr=$(echo "$response" | awk -F',' '{print $11}')
@ -264,7 +286,8 @@ fibocom_cell_info()
endc_lte_cell_id=$(echo "$response" | awk -F',' '{print $6}') endc_lte_cell_id=$(echo "$response" | awk -F',' '{print $6}')
endc_lte_earfcn=$(echo "$response" | awk -F',' '{print $7}') endc_lte_earfcn=$(echo "$response" | awk -F',' '{print $7}')
endc_lte_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}') endc_lte_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}')
endc_lte_band=$(echo "$response" | awk -F',' '{print $9}') endc_lte_band_num=$(echo "$response" | awk -F',' '{print $9}')
endc_lte_band=$(get_band "LTE" $endc_lte_band_num)
ul_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}') ul_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}')
endc_lte_ul_bandwidth=$(get_ul_bandwidth $ul_bandwidth_num) endc_lte_ul_bandwidth=$(get_ul_bandwidth $ul_bandwidth_num)
endc_lte_dl_bandwidth="$endc_lte_ul_bandwidth" endc_lte_dl_bandwidth="$endc_lte_ul_bandwidth"
@ -283,7 +306,8 @@ fibocom_cell_info()
endc_nr_cell_id=$(echo "$response" | awk -F',' '{print $6}') endc_nr_cell_id=$(echo "$response" | awk -F',' '{print $6}')
endc_nr_arfcn=$(echo "$response" | awk -F',' '{print $7}') endc_nr_arfcn=$(echo "$response" | awk -F',' '{print $7}')
endc_nr_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}') endc_nr_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}')
endc_nr_band=$(echo "$response" | awk -F',' '{print $9}') endc_nr_band_num=$(echo "$response" | awk -F',' '{print $9}')
endc_nr_band=$(get_band "NR" $endc_nr_band_num)
nr_dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}') nr_dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}')
endc_nr_dl_bandwidth=$(get_nr_dl_bandwidth $nr_dl_bandwidth_num) endc_nr_dl_bandwidth=$(get_nr_dl_bandwidth $nr_dl_bandwidth_num)
endc_nr_sinr=$(echo "$response" | awk -F',' '{print $11}') endc_nr_sinr=$(echo "$response" | awk -F',' '{print $11}')
@ -302,7 +326,8 @@ fibocom_cell_info()
lte_cell_id=$(echo "$response" | awk -F',' '{print $6}') lte_cell_id=$(echo "$response" | awk -F',' '{print $6}')
lte_earfcn=$(echo "$response" | awk -F',' '{print $7}') lte_earfcn=$(echo "$response" | awk -F',' '{print $7}')
lte_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}') lte_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}')
lte_band=$(echo "$response" | awk -F',' '{print $9}') lte_band_num=$(echo "$response" | awk -F',' '{print $9}')
lte_band=$(get_band "LTE" $lte_band_num)
ul_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}') ul_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}')
lte_ul_bandwidth=$(get_ul_bandwidth $ul_bandwidth_num) lte_ul_bandwidth=$(get_ul_bandwidth $ul_bandwidth_num)
lte_dl_bandwidth="$lte_ul_bandwidth" lte_dl_bandwidth="$lte_ul_bandwidth"
@ -322,14 +347,16 @@ fibocom_cell_info()
wcdma_cell_id=$(echo "$response" | awk -F',' '{print $6}') wcdma_cell_id=$(echo "$response" | awk -F',' '{print $6}')
wcdma_uarfcn=$(echo "$response" | awk -F',' '{print $7}') wcdma_uarfcn=$(echo "$response" | awk -F',' '{print $7}')
wcdma_psc=$(echo "$response" | awk -F',' '{print $8}') wcdma_psc=$(echo "$response" | awk -F',' '{print $8}')
wcdma_band=$(echo "$response" | awk -F',' '{print $9}') wcdma_band_num=$(echo "$response" | awk -F',' '{print $9}')
wcdma_band=$(get_band "WCDMA" $wcdma_band_num)
wcdma_ecno=$(echo "$response" | awk -F',' '{print $10}') wcdma_ecno=$(echo "$response" | awk -F',' '{print $10}')
wcdma_rscp=$(echo "$response" | awk -F',' '{print $11}') wcdma_rscp=$(echo "$response" | awk -F',' '{print $11}')
wcdma_rac=$(echo "$response" | awk -F',' '{print $12}') wcdma_rac=$(echo "$response" | awk -F',' '{print $12}')
wcdma_rxlev_num=$(echo "$response" | awk -F',' '{print $13}') wcdma_rxlev_num=$(echo "$response" | awk -F',' '{print $13}')
wcdma_rxlev=$(get_rxlev "WCDMA" $wcdma_rxlev_num) wcdma_rxlev=$(get_rxlev "WCDMA" $wcdma_rxlev_num)
wcdma_reserved=$(echo "$response" | awk -F',' '{print $14}') wcdma_reserved=$(echo "$response" | awk -F',' '{print $14}')
wcdma_ecio=$(echo "$response" | awk -F',' '{print $15}' | sed 's/\r//g') wcdma_ecio_num=$(echo "$response" | awk -F',' '{print $15}' | sed 's/\r//g')
wcdma_ecio=$(get_ecio $wcdma_ecio_num)
;; ;;
esac esac
} }

View File

@ -151,6 +151,20 @@ quectel_network_info()
fi fi
} }
#获取频段
# $1:网络类型
# $2:频段数字
get_band()
{
local band
case $1 in
"WCDMA") band="B$2" ;;
"LTE") band="B$2" ;;
"NR") band="N$2" ;;
esac
echo "$band"
}
#UL_bandwidth #UL_bandwidth
# $1:上行带宽数字 # $1:上行带宽数字
get_lte_ul_bandwidth() get_lte_ul_bandwidth()
@ -191,7 +205,7 @@ get_nr_dl_bandwidth()
echo "$nr_dl_bandwidth" echo "$nr_dl_bandwidth"
} }
#scs #获取NR子载波间隔
# $1:NR子载波间隔数字 # $1:NR子载波间隔数字
get_scs() get_scs()
{ {
@ -202,10 +216,47 @@ get_scs()
"2") scs="60" ;; "2") scs="60" ;;
"3") scs="120" ;; "3") scs="120" ;;
"4") scs="240" ;; "4") scs="240" ;;
*) scs=$(awk "BEGIN{ print 2^$1 * 15 }") ;;
esac esac
echo "$scs" echo "$scs"
} }
#获取物理信道
# $1:物理信道数字
get_phych()
{
local phych
case $1 in
"0") phych="DPCH" ;;
"1") phych="FDPCH" ;;
esac
echo "$phych"
}
#获取扩频因子
# $1:扩频因子数字
get_sf()
{
local sf
case $1 in
"0"|"1"|"2"|"3"|"4"|"5"|"6"|"7") sf=$(awk "BEGIN{ print 2^$(($1+2)) }") ;;
"8") sf="UNKNOWN" ;;
esac
echo "$sf"
}
#获取插槽格式
# $1:插槽格式数字
get_slot()
{
local slot=$1
# case $1 in
# "0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"|"10"|"11"|"12"|"13"|"14"|"15"|"16") slot=$1 ;;
# "0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9") slot=$1 ;;
# esac
echo "$slot"
}
#小区信息 #小区信息
quectel_cell_info() quectel_cell_info()
{ {
@ -226,7 +277,8 @@ quectel_cell_info()
endc_lte_cell_id=$(echo "$lte" | awk -F',' '{print $5}') endc_lte_cell_id=$(echo "$lte" | awk -F',' '{print $5}')
endc_lte_physical_cell_id=$(echo "$lte" | awk -F',' '{print $6}') endc_lte_physical_cell_id=$(echo "$lte" | awk -F',' '{print $6}')
endc_lte_earfcn=$(echo "$lte" | awk -F',' '{print $7}') endc_lte_earfcn=$(echo "$lte" | awk -F',' '{print $7}')
endc_lte_freq_band_ind=$(echo "$lte" | awk -F',' '{print $8}') endc_lte_freq_band_ind_num=$(echo "$lte" | awk -F',' '{print $8}')
endc_lte_freq_band_ind=$(get_band "LTE" $endc_lte_freq_band_ind_num)
ul_bandwidth_num=$(echo "$lte" | awk -F',' '{print $9}') ul_bandwidth_num=$(echo "$lte" | awk -F',' '{print $9}')
endc_lte_ul_bandwidth=$(get_lte_ul_bandwidth $ul_bandwidth_num) endc_lte_ul_bandwidth=$(get_lte_ul_bandwidth $ul_bandwidth_num)
dl_bandwidth_num=$(echo "$lte" | awk -F',' '{print $10}') dl_bandwidth_num=$(echo "$lte" | awk -F',' '{print $10}')
@ -247,7 +299,8 @@ quectel_cell_info()
endc_nr_sinr=$(echo "$nr5g_nsa" | awk -F',' '{print $6}') endc_nr_sinr=$(echo "$nr5g_nsa" | awk -F',' '{print $6}')
endc_nr_rsrq=$(echo "$nr5g_nsa" | awk -F',' '{print $7}') endc_nr_rsrq=$(echo "$nr5g_nsa" | awk -F',' '{print $7}')
endc_nr_arfcn=$(echo "$nr5g_nsa" | awk -F',' '{print $8}') endc_nr_arfcn=$(echo "$nr5g_nsa" | awk -F',' '{print $8}')
endc_nr_band=$(echo "$nr5g_nsa" | awk -F',' '{print $9}') endc_nr_band_num=$(echo "$nr5g_nsa" | awk -F',' '{print $9}')
endc_nr_band=$(get_band "NR" $endc_nr_band_num)
nr_dl_bandwidth_num=$(echo "$nr5g_nsa" | awk -F',' '{print $10}') nr_dl_bandwidth_num=$(echo "$nr5g_nsa" | awk -F',' '{print $10}')
endc_nr_dl_bandwidth=$(get_nr_dl_bandwidth $nr_dl_bandwidth_num) 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}')
@ -266,13 +319,15 @@ quectel_cell_info()
nr_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}') nr_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}')
nr_tac=$(echo "$response" | awk -F',' '{print $9}') nr_tac=$(echo "$response" | awk -F',' '{print $9}')
nr_arfcn=$(echo "$response" | awk -F',' '{print $10}') nr_arfcn=$(echo "$response" | awk -F',' '{print $10}')
nr_band=$(echo "$response" | awk -F',' '{print $11}') nr_band_num=$(echo "$response" | awk -F',' '{print $11}')
nr_band=$(get_band "NR" $nr_band_num)
nr_dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $12}') nr_dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $12}')
nr_dl_bandwidth=$(get_nr_dl_bandwidth $nr_dl_bandwidth_num) nr_dl_bandwidth=$(get_nr_dl_bandwidth $nr_dl_bandwidth_num)
nr_rsrp=$(echo "$response" | awk -F',' '{print $13}') nr_rsrp=$(echo "$response" | awk -F',' '{print $13}')
nr_rsrq=$(echo "$response" | awk -F',' '{print $14}') nr_rsrq=$(echo "$response" | awk -F',' '{print $14}')
nr_sinr=$(echo "$response" | awk -F',' '{print $15}') nr_sinr=$(echo "$response" | awk -F',' '{print $15}')
nr_scs=$(echo "$response" | awk -F',' '{print $16}') 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}')
;; ;;
"LTE"|"CAT-M"|"CAT-NB") "LTE"|"CAT-M"|"CAT-NB")
@ -283,7 +338,8 @@ quectel_cell_info()
lte_cell_id=$(echo "$response" | awk -F',' '{print $7}') lte_cell_id=$(echo "$response" | awk -F',' '{print $7}')
lte_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}') lte_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}')
lte_earfcn=$(echo "$response" | awk -F',' '{print $9}') lte_earfcn=$(echo "$response" | awk -F',' '{print $9}')
lte_freq_band_ind=$(echo "$response" | awk -F',' '{print $10}') lte_freq_band_ind_num=$(echo "$response" | awk -F',' '{print $10}')
lte_freq_band_ind=$(get_band "LTE" $lte_freq_band_ind_num)
ul_bandwidth_num=$(echo "$response" | awk -F',' '{print $11}') ul_bandwidth_num=$(echo "$response" | awk -F',' '{print $11}')
lte_ul_bandwidth=$(get_lte_ul_bandwidth $ul_bandwidth_num) lte_ul_bandwidth=$(get_lte_ul_bandwidth $ul_bandwidth_num)
dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $12}') dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $12}')
@ -308,9 +364,12 @@ quectel_cell_info()
wcdma_rac=$(echo "$response" | awk -F',' '{print $10}') wcdma_rac=$(echo "$response" | awk -F',' '{print $10}')
wcdma_rscp=$(echo "$response" | awk -F',' '{print $11}') wcdma_rscp=$(echo "$response" | awk -F',' '{print $11}')
wcdma_ecio=$(echo "$response" | awk -F',' '{print $12}') wcdma_ecio=$(echo "$response" | awk -F',' '{print $12}')
wcdma_phych=$(echo "$response" | awk -F',' '{print $13}') wcdma_phych_num=$(echo "$response" | awk -F',' '{print $13}')
wcdma_sf=$(echo "$response" | awk -F',' '{print $14}') wcdma_phych=$(get_phych $wcdma_phych_num)
wcdma_slot=$(echo "$response" | awk -F',' '{print $15}') wcdma_sf_num=$(echo "$response" | awk -F',' '{print $14}')
wcdma_sf=$(get_sf $wcdma_sf_num)
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_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}')
;; ;;