更改函数名

This commit is contained in:
ling 2024-03-18 09:50:49 +08:00
parent c32de994b4
commit 98e9454eec
3 changed files with 87 additions and 86 deletions

View File

@ -72,7 +72,7 @@ function getModemConnectStatus(at_port,manufacturer)
local connect_status="unknown" local connect_status="unknown"
if at_port and manufacturer~="unknown" then if at_port and manufacturer~="unknown" then
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && get_connect_status "..at_port) local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && "..manufacturer.."_get_connect_status "..at_port)
opd = odpall:read("*a") opd = odpall:read("*a")
odpall:close() odpall:close()
connect_status = string.gsub(opd, "\n", "") connect_status = string.gsub(opd, "\n", "")
@ -419,13 +419,13 @@ function setNetworkPrefer()
end) end)
--设置模组网络偏好 --设置模组网络偏好
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && set_network_prefer "..at_port.." "..network_prefer_config) local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && "..manufacturer.."_set_network_prefer "..at_port.." "..network_prefer_config)
odpall:close() odpall:close()
--获取设置好后的模组网络偏好 --获取设置好后的模组网络偏好
local network_prefer={} local network_prefer={}
if at_port and manufacturer and manufacturer~="unknown" then if at_port and manufacturer and manufacturer~="unknown" then
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && get_network_prefer "..at_port) local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && "..manufacturer.."_get_network_prefer "..at_port)
local opd = odpall:read("*a") local opd = odpall:read("*a")
network_prefer=json.parse(opd) network_prefer=json.parse(opd)
odpall:close() odpall:close()
@ -455,13 +455,13 @@ function setMode()
end) end)
--设置模组拨号模式 --设置模组拨号模式
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && set_"..manufacturer.."_mode "..at_port.." "..mode_config) local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && "..manufacturer.."_set_mode "..at_port.." "..mode_config)
odpall:close() odpall:close()
--获取设置好后的模组拨号模式 --获取设置好后的模组拨号模式
local mode local mode
if at_port and manufacturer and manufacturer~="unknown" then if at_port and manufacturer and manufacturer~="unknown" then
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && get_"..manufacturer.."_mode "..at_port) local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && "..manufacturer.."_get_mode "..at_port)
mode = odpall:read("*a") mode = odpall:read("*a")
mode=string.gsub(mode, "\n", "") mode=string.gsub(mode, "\n", "")
odpall:close() odpall:close()
@ -491,7 +491,7 @@ function getModeInfo(at_port,manufacturer)
end) end)
--获取模组拨号模式 --获取模组拨号模式
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && get_"..manufacturer.."_mode "..at_port) local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && "..manufacturer.."_get_mode "..at_port)
local opd = odpall:read("*a") local opd = odpall:read("*a")
odpall:close() odpall:close()
local mode=string.gsub(opd, "\n", "") local mode=string.gsub(opd, "\n", "")
@ -513,7 +513,7 @@ end
function getNetworkPreferInfo(at_port,manufacturer) function getNetworkPreferInfo(at_port,manufacturer)
--获取模组网络偏好 --获取模组网络偏好
local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && get_network_prefer "..at_port) local odpall = io.popen("cd "..script_path.." && source "..script_path..manufacturer..".sh && "..manufacturer.."_get_network_prefer "..at_port)
local opd = odpall:read("*a") local opd = odpall:read("*a")
odpall:close() odpall:close()
local network_prefer_info=json.parse(opd) local network_prefer_info=json.parse(opd)

View File

@ -3,7 +3,7 @@ current_dir="$(dirname "$0")"
#获取拨号模式 #获取拨号模式
# $1:AT串口 # $1:AT串口
get_fibocom_mode() fibocom_get_mode()
{ {
local at_port="$1" local at_port="$1"
at_command="AT+GTUSBMODE?" at_command="AT+GTUSBMODE?"
@ -63,7 +63,7 @@ get_fibocom_mode()
#设置拨号模式 #设置拨号模式
# $1:AT串口 # $1:AT串口
# $2:拨号模式配置 # $2:拨号模式配置
set_fibocom_mode() fibocom_set_mode()
{ {
local at_port="$1" local at_port="$1"
@ -113,7 +113,7 @@ set_fibocom_mode()
#获取网络偏好 #获取网络偏好
# $1:AT串口 # $1:AT串口
get_network_prefer() fibocom_get_network_prefer()
{ {
local at_port="$1" local at_port="$1"
at_command="AT+GTACT?" at_command="AT+GTACT?"
@ -170,7 +170,7 @@ get_network_prefer()
#设置网络偏好 #设置网络偏好
# $1:AT串口 # $1:AT串口
# $2:网络偏好配置 # $2:网络偏好配置
set_network_prefer() fibocom_set_network_prefer()
{ {
local network_prefer="$2" local network_prefer="$2"
@ -215,7 +215,7 @@ set_network_prefer()
#获取连接状态 #获取连接状态
# $1:AT串口 # $1:AT串口
get_connect_status() fibocom_get_connect_status()
{ {
local at_port="$1" local at_port="$1"
at_command="AT+CGDCONT?" at_command="AT+CGDCONT?"
@ -249,7 +249,7 @@ fibocom_base_info()
revision=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | sed 's/\r//g') revision=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | sed 's/\r//g')
#Mode拨号模式 #Mode拨号模式
mode=$(get_fibocom_mode $at_port | tr 'a-z' 'A-Z') mode=$(fibocom_get_mode $at_port | tr 'a-z' 'A-Z')
#Temperature温度 #Temperature温度
at_command="AT+MTSM=1,6" at_command="AT+MTSM=1,6"
@ -261,10 +261,11 @@ fibocom_base_info()
#获取SIM卡状态 #获取SIM卡状态
# $1:SIM卡状态标志 # $1:SIM卡状态标志
get_sim_status() fibocom_get_sim_status()
{ {
local sim_status local sim_status
case $1 in case $1 in
"") sim_status="miss" ;;
*"ERROR"*) sim_status="miss" ;; *"ERROR"*) sim_status="miss" ;;
*"READY"*) sim_status="ready" ;; *"READY"*) sim_status="ready" ;;
*"SIM PIN"*) sim_status="MT is waiting SIM PIN to be given" ;; *"SIM PIN"*) sim_status="MT is waiting SIM PIN to be given" ;;
@ -303,7 +304,7 @@ fibocom_sim_info()
#SIM StatusSIM状态 #SIM StatusSIM状态
at_command="AT+CPIN?" at_command="AT+CPIN?"
sim_status_flag=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p') sim_status_flag=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p')
sim_status=$(get_sim_status "$sim_status_flag") sim_status=$(fibocom_get_sim_status "$sim_status_flag")
if [ "$sim_status" != "ready" ]; then if [ "$sim_status" != "ready" ]; then
return return
@ -335,7 +336,7 @@ fibocom_sim_info()
#获取信号强度指示 #获取信号强度指示
# $1:信号强度指示数字 # $1:信号强度指示数字
get_rssi() fibocom_get_rssi()
{ {
local rssi local rssi
case $1 in case $1 in
@ -351,7 +352,7 @@ fibocom_network_info()
debug "Fibocom network info" debug "Fibocom network info"
#Connect Status连接状态 #Connect Status连接状态
connect_status=$(get_connect_status $at_port) connect_status=$(fibocom_get_connect_status $at_port)
if [ "$connect_status" != "connect" ]; then if [ "$connect_status" != "connect" ]; then
return return
fi fi
@ -370,7 +371,7 @@ fibocom_network_info()
#RSSI信号强度指示 #RSSI信号强度指示
rssi_num=$(echo $response | awk -F',' '{print $1}') rssi_num=$(echo $response | awk -F',' '{print $1}')
rssi=$(get_rssi $rssi_num) rssi=$(fibocom_get_rssi $rssi_num)
#BER信道误码率 #BER信道误码率
ber=$(echo $response | awk -F',' '{print $2}') ber=$(echo $response | awk -F',' '{print $2}')
@ -393,7 +394,7 @@ fibocom_network_info()
#获取频段 #获取频段
# $1:网络类型 # $1:网络类型
# $2:频段数字 # $2:频段数字
get_band() fibocom_get_band()
{ {
local band local band
case $1 in case $1 in
@ -406,7 +407,7 @@ get_band()
#获取上行带宽 #获取上行带宽
# $1:上行带宽数字 # $1:上行带宽数字
get_ul_bandwidth() fibocom_get_ul_bandwidth()
{ {
local ul_bandwidth local ul_bandwidth
case $1 in case $1 in
@ -418,7 +419,7 @@ get_ul_bandwidth()
#获取下行带宽 #获取下行带宽
# $1:下行带宽数字 # $1:下行带宽数字
get_dl_bandwidth() fibocom_get_dl_bandwidth()
{ {
local dl_bandwidth local dl_bandwidth
case $1 in case $1 in
@ -430,7 +431,7 @@ get_dl_bandwidth()
#获取NR下行带宽 #获取NR下行带宽
# $1:下行带宽数字 # $1:下行带宽数字
get_nr_dl_bandwidth() fibocom_get_nr_dl_bandwidth()
{ {
local nr_dl_bandwidth local nr_dl_bandwidth
case $1 in case $1 in
@ -443,7 +444,7 @@ get_nr_dl_bandwidth()
#获取参考信号接收功率 #获取参考信号接收功率
# $1:网络类型 # $1:网络类型
# $2:参考信号接收功率数字 # $2:参考信号接收功率数字
get_rsrp() fibocom_get_rsrp()
{ {
local rsrp local rsrp
case $1 in case $1 in
@ -456,7 +457,7 @@ get_rsrp()
#获取参考信号接收质量 #获取参考信号接收质量
# $1:网络类型 # $1:网络类型
# $2:参考信号接收质量数字 # $2:参考信号接收质量数字
get_rsrq() fibocom_get_rsrq()
{ {
local rsrq local rsrq
case $1 in case $1 in
@ -468,7 +469,7 @@ get_rsrq()
#获取信号干扰比 #获取信号干扰比
# $1:信号干扰比数字 # $1:信号干扰比数字
get_rssnr() fibocom_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*$//')
@ -478,7 +479,7 @@ get_rssnr()
#获取接收信号功率 #获取接收信号功率
# $1:网络类型 # $1:网络类型
# $2:接收信号功率数字 # $2:接收信号功率数字
get_rxlev() fibocom_get_rxlev()
{ {
local rxlev local rxlev
case $1 in case $1 in
@ -491,7 +492,7 @@ get_rxlev()
#获取Ec/Io #获取Ec/Io
# $1:Ec/Io数字 # $1:Ec/Io数字
get_ecio() fibocom_get_ecio()
{ {
local ecio=$(awk "BEGIN{ printf \"%.2f\", $1 * 0.5 - 24.5 }" | sed 's/\.*0*$//') local ecio=$(awk "BEGIN{ printf \"%.2f\", $1 * 0.5 - 24.5 }" | sed 's/\.*0*$//')
echo "$ecio" echo "$ecio"
@ -518,16 +519,16 @@ fibocom_cell_info()
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_num=$(echo "$response" | awk -F',' '{print $9}') nr_band_num=$(echo "$response" | awk -F',' '{print $9}')
nr_band=$(get_band "NR" $nr_band_num) nr_band=$(fibocom_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=$(fibocom_get_nr_dl_bandwidth $nr_dl_bandwidth_num)
nr_sinr=$(echo "$response" | awk -F',' '{print $11}') nr_sinr=$(echo "$response" | awk -F',' '{print $11}')
nr_rxlev_num=$(echo "$response" | awk -F',' '{print $12}') nr_rxlev_num=$(echo "$response" | awk -F',' '{print $12}')
nr_rxlev=$(get_rxlev "NR" $nr_rxlev_num) nr_rxlev=$(fibocom_get_rxlev "NR" $nr_rxlev_num)
nr_rsrp_num=$(echo "$response" | awk -F',' '{print $13}') nr_rsrp_num=$(echo "$response" | awk -F',' '{print $13}')
nr_rsrp=$(get_rsrp "NR" $nr_rsrp_num) nr_rsrp=$(fibocom_get_rsrp "NR" $nr_rsrp_num)
nr_rsrq_num=$(echo "$response" | awk -F',' '{print $14}' | sed 's/\r//g') nr_rsrq_num=$(echo "$response" | awk -F',' '{print $14}' | sed 's/\r//g')
nr_rsrq=$(get_rsrq "NR" $nr_rsrq_num) nr_rsrq=$(fibocom_get_rsrq "NR" $nr_rsrq_num)
;; ;;
"LTE-NR") "LTE-NR")
network_mode="EN-DC Mode" network_mode="EN-DC Mode"
@ -539,18 +540,18 @@ fibocom_cell_info()
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_num=$(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) endc_lte_band=$(fibocom_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=$(fibocom_get_ul_bandwidth $ul_bandwidth_num)
endc_lte_dl_bandwidth="$endc_lte_ul_bandwidth" endc_lte_dl_bandwidth="$endc_lte_ul_bandwidth"
endc_lte_rssnr_num=$(echo "$response" | awk -F',' '{print $11}') endc_lte_rssnr_num=$(echo "$response" | awk -F',' '{print $11}')
endc_lte_rssnr=$(get_rssnr $endc_lte_rssnr_num) endc_lte_rssnr=$(fibocom_get_rssnr $endc_lte_rssnr_num)
endc_lte_rxlev_num=$(echo "$response" | awk -F',' '{print $12}') endc_lte_rxlev_num=$(echo "$response" | awk -F',' '{print $12}')
endc_lte_rxlev=$(get_rxlev "LTE" $endc_lte_rxlev_num) endc_lte_rxlev=$(fibocom_get_rxlev "LTE" $endc_lte_rxlev_num)
endc_lte_rsrp_num=$(echo "$response" | awk -F',' '{print $13}') endc_lte_rsrp_num=$(echo "$response" | awk -F',' '{print $13}')
endc_lte_rsrp=$(get_rsrp "LTE" $endc_lte_rsrp_num) endc_lte_rsrp=$(fibocom_get_rsrp "LTE" $endc_lte_rsrp_num)
endc_lte_rsrq_num=$(echo "$response" | awk -F',' '{print $14}' | sed 's/\r//g') endc_lte_rsrq_num=$(echo "$response" | awk -F',' '{print $14}' | sed 's/\r//g')
endc_lte_rsrq=$(get_rsrq "LTE" $endc_lte_rsrq_num) endc_lte_rsrq=$(fibocom_get_rsrq "LTE" $endc_lte_rsrq_num)
#NR5G-NSA #NR5G-NSA
endc_nr_mcc=$(echo "$response" | awk -F',' '{print $3}') endc_nr_mcc=$(echo "$response" | awk -F',' '{print $3}')
endc_nr_mnc=$(echo "$response" | awk -F',' '{print $4}') endc_nr_mnc=$(echo "$response" | awk -F',' '{print $4}')
@ -559,16 +560,16 @@ fibocom_cell_info()
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_num=$(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) endc_nr_band=$(fibocom_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=$(fibocom_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}')
endc_nr_rxlev_num=$(echo "$response" | awk -F',' '{print $12}') endc_nr_rxlev_num=$(echo "$response" | awk -F',' '{print $12}')
endc_nr_rxlev=$(get_rxlev "NR" $endc_nr_rxlev_num) endc_nr_rxlev=$(fibocom_get_rxlev "NR" $endc_nr_rxlev_num)
endc_nr_rsrp_num=$(echo "$response" | awk -F',' '{print $13}') endc_nr_rsrp_num=$(echo "$response" | awk -F',' '{print $13}')
endc_nr_rsrp=$(get_rsrp "NR" $endc_nr_rsrp_num) endc_nr_rsrp=$(fibocom_get_rsrp "NR" $endc_nr_rsrp_num)
endc_nr_rsrq_num=$(echo "$response" | awk -F',' '{print $14}' | sed 's/\r//g') endc_nr_rsrq_num=$(echo "$response" | awk -F',' '{print $14}' | sed 's/\r//g')
endc_nr_rsrq=$(get_rsrq "NR" $endc_nr_rsrq_num) endc_nr_rsrq=$(fibocom_get_rsrq "NR" $endc_nr_rsrq_num)
;; ;;
"LTE"|"eMTC"|"NB-IoT") "LTE"|"eMTC"|"NB-IoT")
network_mode="LTE Mode" network_mode="LTE Mode"
@ -579,17 +580,17 @@ fibocom_cell_info()
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_num=$(echo "$response" | awk -F',' '{print $9}') lte_band_num=$(echo "$response" | awk -F',' '{print $9}')
lte_band=$(get_band "LTE" $lte_band_num) lte_band=$(fibocom_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=$(fibocom_get_ul_bandwidth $ul_bandwidth_num)
lte_dl_bandwidth="$lte_ul_bandwidth" lte_dl_bandwidth="$lte_ul_bandwidth"
lte_rssnr=$(echo "$response" | awk -F',' '{print $11}') lte_rssnr=$(echo "$response" | awk -F',' '{print $11}')
lte_rxlev_num=$(echo "$response" | awk -F',' '{print $12}') lte_rxlev_num=$(echo "$response" | awk -F',' '{print $12}')
lte_rxlev=$(get_rxlev "LTE" $lte_rxlev_num) lte_rxlev=$(fibocom_get_rxlev "LTE" $lte_rxlev_num)
lte_rsrp_num=$(echo "$response" | awk -F',' '{print $13}') lte_rsrp_num=$(echo "$response" | awk -F',' '{print $13}')
lte_rsrp=$(get_rsrp "LTE" $lte_rsrp_num) lte_rsrp=$(fibocom_get_rsrp "LTE" $lte_rsrp_num)
lte_rsrq_num=$(echo "$response" | awk -F',' '{print $14}' | sed 's/\r//g') lte_rsrq_num=$(echo "$response" | awk -F',' '{print $14}' | sed 's/\r//g')
lte_rsrq=$(get_rsrq "LTE" $lte_rsrq_num) lte_rsrq=$(fibocom_get_rsrq "LTE" $lte_rsrq_num)
;; ;;
"WCDMA"|"UMTS") "WCDMA"|"UMTS")
network_mode="WCDMA Mode" network_mode="WCDMA Mode"
@ -600,15 +601,15 @@ fibocom_cell_info()
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_num=$(echo "$response" | awk -F',' '{print $9}') wcdma_band_num=$(echo "$response" | awk -F',' '{print $9}')
wcdma_band=$(get_band "WCDMA" $wcdma_band_num) wcdma_band=$(fibocom_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=$(fibocom_get_rxlev "WCDMA" $wcdma_rxlev_num)
wcdma_reserved=$(echo "$response" | awk -F',' '{print $14}') wcdma_reserved=$(echo "$response" | awk -F',' '{print $14}')
wcdma_ecio_num=$(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) wcdma_ecio=$(fibocom_get_ecio $wcdma_ecio_num)
;; ;;
esac esac
} }

View File

@ -3,7 +3,7 @@ current_dir="$(dirname "$0")"
#获取拨号模式 #获取拨号模式
# $1:AT串口 # $1:AT串口
get_quectel_mode() quectel_get_mode()
{ {
local at_port="$1" local at_port="$1"
at_command='AT+QCFG="usbnet"' at_command='AT+QCFG="usbnet"'
@ -52,7 +52,7 @@ get_quectel_mode()
#设置拨号模式 #设置拨号模式
# $1:AT串口 # $1:AT串口
# $2:拨号模式配置 # $2:拨号模式配置
set_quectel_mode() quectel_set_mode()
{ {
local at_port="$1" local at_port="$1"
@ -102,7 +102,7 @@ set_quectel_mode()
#获取网络偏好 #获取网络偏好
# $1:AT串口 # $1:AT串口
get_network_prefer() quectel_get_network_prefer()
{ {
local at_port="$1" local at_port="$1"
at_command='AT+QNWPREFCFG="mode_pref"' at_command='AT+QNWPREFCFG="mode_pref"'
@ -146,7 +146,7 @@ get_network_prefer()
#设置网络偏好 #设置网络偏好
# $1:AT串口 # $1:AT串口
# $2:网络偏好配置 # $2:网络偏好配置
set_network_prefer() quectel_set_network_prefer()
{ {
local network_prefer="$2" local network_prefer="$2"
@ -191,7 +191,7 @@ set_network_prefer()
#获取连接状态 #获取连接状态
# $1:AT串口 # $1:AT串口
get_connect_status() quectel_get_connect_status()
{ {
local at_port="$1" local at_port="$1"
at_command="AT+QNWINFO" at_command="AT+QNWINFO"
@ -228,7 +228,7 @@ quectel_base_info()
# revision=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | sed 's/\r//g') # revision=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | sed 's/\r//g')
#Mode拨号模式 #Mode拨号模式
mode=$(get_quectel_mode $at_port | tr 'a-z' 'A-Z') mode=$(quectel_get_mode $at_port | tr 'a-z' 'A-Z')
#Temperature温度 #Temperature温度
at_command="AT+QTEMP" at_command="AT+QTEMP"
@ -254,7 +254,7 @@ quectel_base_info()
#获取SIM卡状态 #获取SIM卡状态
# $1:SIM卡状态标志 # $1:SIM卡状态标志
get_sim_status() quectel_get_sim_status()
{ {
local sim_status local sim_status
case $1 in case $1 in
@ -296,7 +296,7 @@ quectel_sim_info()
#SIM StatusSIM状态 #SIM StatusSIM状态
at_command="AT+CPIN?" at_command="AT+CPIN?"
sim_status_flag=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p') sim_status_flag=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p')
sim_status=$(get_sim_status "$sim_status_flag") sim_status=$(quectel_get_sim_status "$sim_status_flag")
if [ "$sim_status" != "ready" ]; then if [ "$sim_status" != "ready" ]; then
return return
@ -330,7 +330,7 @@ quectel_sim_info()
#获取信号强度指示 #获取信号强度指示
# $1:信号强度指示数字 # $1:信号强度指示数字
get_rssi() quectel_get_rssi()
{ {
local rssi local rssi
case $1 in case $1 in
@ -346,7 +346,7 @@ quectel_network_info()
debug "Quectel network info" debug "Quectel network info"
#Connect Status连接状态 #Connect Status连接状态
connect_status=$(get_connect_status $at_port) connect_status=$(quectel_get_connect_status $at_port)
if [ "$connect_status" != "connect" ]; then if [ "$connect_status" != "connect" ]; then
return return
fi fi
@ -362,7 +362,7 @@ quectel_network_info()
#RSSI信号强度指示 #RSSI信号强度指示
rssi_num=$(echo $response | awk -F',' '{print $1}') rssi_num=$(echo $response | awk -F',' '{print $1}')
rssi=$(get_rssi $rssi_num) rssi=$(quectel_get_rssi $rssi_num)
#Ber信道误码率 #Ber信道误码率
ber=$(echo $response | awk -F',' '{print $2}') ber=$(echo $response | awk -F',' '{print $2}')
@ -385,7 +385,7 @@ quectel_network_info()
#获取频段 #获取频段
# $1:网络类型 # $1:网络类型
# $2:频段数字 # $2:频段数字
get_band() quectel_get_band()
{ {
local band local band
case $1 in case $1 in
@ -398,7 +398,7 @@ get_band()
#UL_bandwidth #UL_bandwidth
# $1:上行带宽数字 # $1:上行带宽数字
get_lte_ul_bandwidth() quectel_get_lte_ul_bandwidth()
{ {
local ul_bandwidth local ul_bandwidth
case $1 in case $1 in
@ -411,7 +411,7 @@ get_lte_ul_bandwidth()
#DL_bandwidth #DL_bandwidth
# $1:下行带宽数字 # $1:下行带宽数字
get_lte_dl_bandwidth() quectel_get_lte_dl_bandwidth()
{ {
local dl_bandwidth local dl_bandwidth
case $1 in case $1 in
@ -424,7 +424,7 @@ get_lte_dl_bandwidth()
#NR_DL_bandwidth #NR_DL_bandwidth
# $1:下行带宽数字 # $1:下行带宽数字
get_nr_dl_bandwidth() quectel_get_nr_dl_bandwidth()
{ {
local nr_dl_bandwidth local nr_dl_bandwidth
case $1 in case $1 in
@ -438,7 +438,7 @@ get_nr_dl_bandwidth()
#获取NR子载波间隔 #获取NR子载波间隔
# $1:NR子载波间隔数字 # $1:NR子载波间隔数字
get_scs() quectel_get_scs()
{ {
local scs local scs
case $1 in case $1 in
@ -454,7 +454,7 @@ get_scs()
#获取物理信道 #获取物理信道
# $1:物理信道数字 # $1:物理信道数字
get_phych() quectel_get_phych()
{ {
local phych local phych
case $1 in case $1 in
@ -466,7 +466,7 @@ get_phych()
#获取扩频因子 #获取扩频因子
# $1:扩频因子数字 # $1:扩频因子数字
get_sf() quectel_get_sf()
{ {
local sf local sf
case $1 in case $1 in
@ -478,7 +478,7 @@ get_sf()
#获取插槽格式 #获取插槽格式
# $1:插槽格式数字 # $1:插槽格式数字
get_slot() quectel_get_slot()
{ {
local slot=$1 local slot=$1
# case $1 in # case $1 in
@ -509,11 +509,11 @@ quectel_cell_info()
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_num=$(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) endc_lte_freq_band_ind=$(quectel_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=$(quectel_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}')
endc_lte_dl_bandwidth=$(get_lte_dl_bandwidth $dl_bandwidth_num) endc_lte_dl_bandwidth=$(quectel_get_lte_dl_bandwidth $dl_bandwidth_num)
endc_lte_tac=$(echo "$lte" | awk -F',' '{print $11}') endc_lte_tac=$(echo "$lte" | awk -F',' '{print $11}')
endc_lte_rsrp=$(echo "$lte" | awk -F',' '{print $12}') endc_lte_rsrp=$(echo "$lte" | awk -F',' '{print $12}')
endc_lte_rsrq=$(echo "$lte" | awk -F',' '{print $13}') endc_lte_rsrq=$(echo "$lte" | awk -F',' '{print $13}')
@ -531,11 +531,11 @@ quectel_cell_info()
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_num=$(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) endc_nr_band=$(quectel_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=$(quectel_get_nr_dl_bandwidth $nr_dl_bandwidth_num)
scs_num=$(echo "$nr5g_nsa" | awk -F',' '{print $16}' | sed 's/\r//g') scs_num=$(echo "$nr5g_nsa" | awk -F',' '{print $16}' | sed 's/\r//g')
endc_nr_scs=$(get_scs $scs_num) endc_nr_scs=$(quectel_get_scs $scs_num)
else else
#SALTEWCDMA模式 #SALTEWCDMA模式
response=$(echo "$response" | grep "+QENG:") response=$(echo "$response" | grep "+QENG:")
@ -551,14 +551,14 @@ quectel_cell_info()
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_num=$(echo "$response" | awk -F',' '{print $11}') nr_band_num=$(echo "$response" | awk -F',' '{print $11}')
nr_band=$(get_band "NR" $nr_band_num) nr_band=$(quectel_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=$(quectel_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_num=$(echo "$response" | awk -F',' '{print $16}') nr_scs_num=$(echo "$response" | awk -F',' '{print $16}')
nr_scs=$(get_scs $nr_scs_num) nr_scs=$(quectel_get_scs $nr_scs_num)
nr_rxlev=$(echo "$response" | awk -F',' '{print $17}' | sed 's/\r//g') nr_rxlev=$(echo "$response" | awk -F',' '{print $17}' | sed 's/\r//g')
;; ;;
"LTE"|"CAT-M"|"CAT-NB") "LTE"|"CAT-M"|"CAT-NB")
@ -570,11 +570,11 @@ quectel_cell_info()
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_num=$(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) lte_freq_band_ind=$(quectel_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=$(quectel_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}')
lte_dl_bandwidth=$(get_lte_dl_bandwidth $dl_bandwidth_num) lte_dl_bandwidth=$(quectel_get_lte_dl_bandwidth $dl_bandwidth_num)
lte_tac=$(echo "$response" | awk -F',' '{print $13}') lte_tac=$(echo "$response" | awk -F',' '{print $13}')
lte_rsrp=$(echo "$response" | awk -F',' '{print $14}') lte_rsrp=$(echo "$response" | awk -F',' '{print $14}')
lte_rsrq=$(echo "$response" | awk -F',' '{print $15}') lte_rsrq=$(echo "$response" | awk -F',' '{print $15}')
@ -596,11 +596,11 @@ quectel_cell_info()
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_num=$(echo "$response" | awk -F',' '{print $13}') wcdma_phych_num=$(echo "$response" | awk -F',' '{print $13}')
wcdma_phych=$(get_phych $wcdma_phych_num) wcdma_phych=$(quectel_get_phych $wcdma_phych_num)
wcdma_sf_num=$(echo "$response" | awk -F',' '{print $14}') wcdma_sf_num=$(echo "$response" | awk -F',' '{print $14}')
wcdma_sf=$(get_sf $wcdma_sf_num) wcdma_sf=$(quectel_get_sf $wcdma_sf_num)
wcdma_slot_num=$(echo "$response" | awk -F',' '{print $15}') wcdma_slot_num=$(echo "$response" | awk -F',' '{print $15}')
wcdma_slot=$(get_slot $wcdma_slot_num) wcdma_slot=$(quectel_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}' | sed 's/\r//g') wcdma_com_mod=$(echo "$response" | awk -F',' '{print $17}' | sed 's/\r//g')
;; ;;