feat: 新版本锁频,可以将3、4、5G频段分开显示
This commit is contained in:
parent
36329731e9
commit
e44cc4c317
@ -2,6 +2,7 @@
|
||||
<script type="text/javascript" src="<%=resource%>/xhr.js"></script>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
|
||||
|
||||
window.onload=function()
|
||||
{
|
||||
//获取模组选择框元素
|
||||
@ -780,7 +781,7 @@
|
||||
//获取网络偏好信息
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "get_lockband")%>', { "port": at_port },
|
||||
function (x, data) {
|
||||
set_lockband_info(data);
|
||||
set_lockband_tab(data);
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -1057,119 +1058,160 @@
|
||||
|
||||
}
|
||||
|
||||
//锁频
|
||||
function set_lockband() {
|
||||
console.log("set_lockband")
|
||||
//禁用功能
|
||||
disabled_function("lockband", true);
|
||||
//获取选中的模组
|
||||
var at_port = document.getElementById("modem_select").value;
|
||||
//锁频功能
|
||||
class Lockband {
|
||||
#lockband_config
|
||||
#available_band
|
||||
avalibale_bandid
|
||||
#checkboxs = {}
|
||||
|
||||
|
||||
set lock(band){
|
||||
if (!this.#lockband_config.includes(band)){
|
||||
this.#lockband_config.push(band)
|
||||
//set checkbox
|
||||
|
||||
//获取偏好配置
|
||||
lockband_config = ""
|
||||
var checkboxes = document.querySelectorAll('input[name="lockband_option"]:checked');
|
||||
for (checkbox of checkboxes) {
|
||||
lockband_config = checkbox.value + "," + lockband_config;
|
||||
}
|
||||
//去掉最后一个逗号
|
||||
lockband_config = lockband_config.substring(0, lockband_config.length - 1);
|
||||
//设置锁频
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "set_lockband")%>', { "port": at_port, "lock_band_config": lockband_config },
|
||||
function (x, data) {
|
||||
var current_lockband = data["lock_band"];
|
||||
var avalible_lockband = data["available_band"];
|
||||
var avalible_lockband_td = document.getElementById('lockband_custom_config');
|
||||
for (key in avalible_lockband) {
|
||||
id = "lockband_config_" + key;
|
||||
checkbox_get = document.getElementById(id);
|
||||
if (checkbox_get == null) {
|
||||
checkbox_span = document.createElement('span');
|
||||
checkbox_span.className = "cbi-checkbox";
|
||||
checkbox = document.createElement('input');
|
||||
checkbox.id = "lockband_config_" + key;
|
||||
checkbox.name = "lockband_option";
|
||||
this.#checkboxs[band].checked = true;
|
||||
}
|
||||
set unlock(band){
|
||||
this.#lockband_config = this.#lockband_config.filter(x => x != band)
|
||||
//set checkbox
|
||||
this.#checkboxs[band].checked = false;
|
||||
}
|
||||
|
||||
createCheckbox(value,band){
|
||||
let checkbox = document.createElement('input');
|
||||
checkbox.type = "checkbox";
|
||||
checkbox.className = "cbi-input-checkbox";
|
||||
checkbox.value = key;
|
||||
checkbox_span.appendChild(checkbox);
|
||||
span = document.createElement('span');
|
||||
span.innerHTML = avalible_lockband[key];
|
||||
checkbox_span.appendChild(span);
|
||||
if (current_lockband.includes(key)) {
|
||||
checkbox.checked = true;
|
||||
checkbox.value = band;
|
||||
checkbox.setAttribute("display-band",value);
|
||||
if (this.#lockband_config.includes(value)) {
|
||||
this.lock(band);
|
||||
}
|
||||
avalible_lockband_td.appendChild(checkbox_span);
|
||||
let self = this;
|
||||
checkbox.addEventListener("change",function(){
|
||||
if (checkbox.checked){
|
||||
self.lock = band;
|
||||
}
|
||||
else{
|
||||
checkbox_get.checked = current_lockband.includes(key);
|
||||
self.unlock = band;
|
||||
}
|
||||
});
|
||||
this.#checkboxs[band] = checkbox;
|
||||
}
|
||||
|
||||
createCheckboxs(){
|
||||
for (let key in this.#available_band) {
|
||||
let display_value = this.#available_band[key]
|
||||
this.createCheckbox(display_value,key);
|
||||
}
|
||||
//启用功能
|
||||
disabled_function("lockband", false);
|
||||
}
|
||||
|
||||
update(lockband_config){
|
||||
for (let band in this.#available_band) {
|
||||
if (lockband_config.includes(band)) {
|
||||
this.lock = band;
|
||||
}
|
||||
else{
|
||||
this.#checkboxs[band].checked = false;
|
||||
this.unlock = band;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
submit()
|
||||
{
|
||||
return this.#lockband_config;
|
||||
}
|
||||
|
||||
render(){
|
||||
let tr = document.createElement('tr');
|
||||
tr.className = "tr cbi-section-table-row";
|
||||
let td = document.createElement('td');
|
||||
td.className = "td";
|
||||
for (let checkbox in this.#checkboxs) {
|
||||
let display_value = this.#checkboxs[checkbox].getAttribute("display-band");
|
||||
let span = document.createElement('span');
|
||||
span.innerHTML = display_value;
|
||||
td.appendChild(this.#checkboxs[checkbox]);
|
||||
td.appendChild(span);
|
||||
}
|
||||
tr.appendChild(td);
|
||||
return tr;
|
||||
}
|
||||
|
||||
constructor(lockband_info){
|
||||
this.#lockband_config = lockband_info["lock_band"];
|
||||
this.#available_band = lockband_info["available_band"];
|
||||
this.avalibale_bandid = Object.keys(this.#available_band);
|
||||
this.#checkboxs = [];
|
||||
this.createCheckboxs();
|
||||
this.update(this.#lockband_config);
|
||||
}
|
||||
}
|
||||
|
||||
function set_lockband_tab(lockband_info) {
|
||||
if (typeof lb == "undefined") {
|
||||
lb = {}
|
||||
for (let RAT of Object.keys(lockband_info)) {
|
||||
tr_header = document.createElement('div');
|
||||
tr_header.className = "tr cbi-section-table-titles anonymous";
|
||||
th = document.createElement('div');
|
||||
th.className = "th cbi-section-table-cell";
|
||||
th.innerHTML = RAT;
|
||||
tr_header.appendChild(th);
|
||||
document.getElementById('lockband_custom_config').appendChild(tr_header);
|
||||
|
||||
lb[RAT] = new Lockband(lockband_info[RAT]);
|
||||
submit_btn = document.createElement('input');
|
||||
submit_btn.type = "button";
|
||||
submit_btn.value = "Submit";
|
||||
submit_btn.addEventListener('click',
|
||||
function () {
|
||||
var at_port = document.getElementById("modem_select").value;
|
||||
var config = lb[RAT].submit()
|
||||
submit_config = ''
|
||||
for (key of config) {
|
||||
submit_config = key + "," + submit_config
|
||||
}
|
||||
submit_config = submit_config.substring(0, submit_config.length - 1)
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "set_lockband")%>', { "port": at_port, "lock_band_config": submit_config, "rat": RAT },
|
||||
function (x, data) {
|
||||
lb[RAT].update(data[RAT]["lock_band"])
|
||||
}
|
||||
);
|
||||
})
|
||||
select_all_btn = document.createElement('input');
|
||||
select_all_btn.type = "button";
|
||||
select_all_btn.value = "Select All";
|
||||
select_all_btn.addEventListener('click', function () {
|
||||
if (lb[RAT].submit().length == lb[RAT].avalibale_bandid.length) {
|
||||
lb[RAT].update([])
|
||||
}
|
||||
else {
|
||||
lb[RAT].update(lb[RAT].avalibale_bandid)
|
||||
}
|
||||
}
|
||||
)
|
||||
lockband_custom_config = document.getElementById('lockband_custom_config');
|
||||
lockband_custom_config.appendChild(lb[RAT].render())
|
||||
lockband_custom_config.appendChild(submit_btn);
|
||||
lockband_custom_config.appendChild(select_all_btn);
|
||||
|
||||
function set_lockband_info(lockband_info) {
|
||||
//获取锁频
|
||||
var current_lockband = lockband_info["lock_band"];
|
||||
var avalible_lockband = lockband_info["available_band"];
|
||||
//可选锁频配置td
|
||||
var avalible_lockband_td = document.getElementById('lockband_custom_config');
|
||||
|
||||
//设置偏好选项和复选框
|
||||
//设置偏好选项和复选框
|
||||
}
|
||||
}
|
||||
var first_cache = document.getElementById("first_cache");
|
||||
if (first_cache.checked)
|
||||
{
|
||||
sortted_keys = Object.keys(avalible_lockband).sort();
|
||||
for (key of sortted_keys) {
|
||||
id = "lockband_config_" + key;
|
||||
checkbox_get = document.getElementById(id);
|
||||
if (checkbox_get == null) {
|
||||
checkbox_span = document.createElement('span');
|
||||
checkbox_span.className = "cbi-checkbox";
|
||||
|
||||
checkbox = document.createElement('input');
|
||||
checkbox.id = "lockband_config_" + key;
|
||||
checkbox.name = "lockband_option";
|
||||
checkbox.type = "checkbox";
|
||||
checkbox.className = "cbi-input-checkbox";
|
||||
checkbox.value = key;
|
||||
checkbox_span.appendChild(checkbox);
|
||||
span = document.createElement('span');
|
||||
span.innerHTML = avalible_lockband[key];
|
||||
checkbox_span.appendChild(span);
|
||||
if (current_lockband.includes(key)) {
|
||||
checkbox.checked = true;
|
||||
}
|
||||
avalible_lockband_td.appendChild(checkbox_span);
|
||||
if (first_cache.checked) {
|
||||
for (let RAT of Object.keys(lockband_info)) {
|
||||
lb[RAT].update(lockband_info[RAT])
|
||||
}
|
||||
first_cache.checked = false;
|
||||
}
|
||||
|
||||
//设置第一次获取数据标志
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 全选锁频复选框
|
||||
function all_choose_lockband_custom_config() {
|
||||
var checkboxes = document.getElementById('lockband_custom_config').querySelectorAll('input[type="checkbox"]');
|
||||
has_checked = false;
|
||||
for (checkbox of checkboxes) {
|
||||
//设置网络偏好复选框状态
|
||||
checkbox.checked = checkbox.checked ? false : true;
|
||||
if (checkbox.checked) {
|
||||
has_checked = true;
|
||||
}
|
||||
}
|
||||
for (checkbox of checkboxes) {
|
||||
//设置网络偏好复选框状态
|
||||
checkbox.checked = has_checked ? has_checked : false;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="cbi-map" id="cbi-modem-debug">
|
||||
@ -1496,24 +1538,15 @@
|
||||
<!-- <legend><%:Network Preferences%></legend> -->
|
||||
<!-- <h3><%:Network Preferences%></h3> -->
|
||||
<table class="table cbi-section-table" >
|
||||
<tbody>
|
||||
<tbody id="lockband_custom_config">
|
||||
<tr class="tr cbi-section-table-titles anonymous">
|
||||
<th class="th cbi-section-table-cell">
|
||||
<%:Config%>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="tr cbi-section-table-row">
|
||||
|
||||
<td class="td cbi-value-field" data-title="<%:Config%>" id="lockband_custom_config">
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="button" class="cbi-button-apply" onclick="all_choose_lockband_custom_config()"
|
||||
value="<%:Select All Band%>">
|
||||
<input type="button" class="cbi-button-apply" onclick="set_lockband()" value="<%:Apply%>">
|
||||
</div>
|
||||
|
||||
<!-- 锁小区、频点 -->
|
||||
|
@ -596,7 +596,25 @@ fibocom_get_lockband()
|
||||
get_lockband_config_res=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $get_lockband_config_command)
|
||||
get_available_band_res=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $get_available_band_command)
|
||||
json_init
|
||||
|
||||
json_add_object "UMTS"
|
||||
json_add_object "available_band"
|
||||
json_close_object
|
||||
json_add_array "lock_band"
|
||||
json_close_object
|
||||
json_close_object
|
||||
json_add_object "LTE"
|
||||
json_add_object "available_band"
|
||||
json_close_object
|
||||
json_add_array "lock_band"
|
||||
json_close_object
|
||||
json_close_object
|
||||
json_add_object "NR"
|
||||
json_add_object "available_band"
|
||||
json_close_object
|
||||
json_add_array "lock_band"
|
||||
json_close_object
|
||||
json_close_object
|
||||
index=0
|
||||
for i in $(echo "$get_available_band_res"| sed 's/\r//g' | awk -F"[()]" '{for(j=8; j<NF;j+=2) if ($j) print $j; else print 0;}' ); do
|
||||
case $index in
|
||||
@ -606,14 +624,22 @@ fibocom_get_lockband()
|
||||
1)
|
||||
#"umts_band"
|
||||
for j in $(echo "$i" | awk -F"," '{for(k=1; k<=NF; k++) print $k}'); do
|
||||
json_select "UMTS"
|
||||
json_select "available_band"
|
||||
json_add_string "$j" "UMTS_$j"
|
||||
json_select ".."
|
||||
json_select ".."
|
||||
done
|
||||
;;
|
||||
2)
|
||||
#"LTE" "$i"
|
||||
for j in $(echo "$i" | awk -F"," '{for(k=1; k<=NF; k++) print $k}'); do
|
||||
trim_first_letter=$(echo "$j" | sed 's/^.//')
|
||||
json_select "LTE"
|
||||
json_select "available_band"
|
||||
json_add_string "$j" "LTE_$trim_first_letter"
|
||||
json_select ".."
|
||||
json_select ".."
|
||||
done
|
||||
;;
|
||||
3)
|
||||
@ -626,16 +652,43 @@ fibocom_get_lockband()
|
||||
#"nr5g"
|
||||
for j in $(echo "$i" | awk -F"," '{for(k=1; k<=NF; k++) print $k}'); do
|
||||
trim_first_letter=$(echo "$j" | sed 's/^.//')
|
||||
json_select "NR"
|
||||
json_select "available_band"
|
||||
json_add_string "$j" "NR_$trim_first_letter"
|
||||
json_select ".."
|
||||
json_select ".."
|
||||
done
|
||||
;;
|
||||
esac
|
||||
index=$((index+1))
|
||||
done
|
||||
json_close_object
|
||||
json_add_array "lock_band"
|
||||
|
||||
for i in $(echo "$get_lockband_config_res" | sed 's/\r//g' | awk -F"," '{for(k=4; k<=NF; k++) print $k}' ); do
|
||||
# i 0,100 UMTS
|
||||
# i 100,5000 LTE
|
||||
# i 5000,10000 NR
|
||||
if [ -z "$i" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ $i -lt 100 ]; then
|
||||
json_select "UMTS"
|
||||
json_select "lock_band"
|
||||
json_add_string "" "$i"
|
||||
json_select ".."
|
||||
json_select ".."
|
||||
elif [ $i -lt 500 ]; then
|
||||
json_select "LTE"
|
||||
json_select "lock_band"
|
||||
json_add_string "" "$i"
|
||||
json_select ".."
|
||||
json_select ".."
|
||||
else
|
||||
json_select "NR"
|
||||
json_select "lock_band"
|
||||
json_add_string "" "$i"
|
||||
json_select ".."
|
||||
json_select ".."
|
||||
fi
|
||||
done
|
||||
json_close_array
|
||||
json_result=`json_dump`
|
||||
|
@ -85,7 +85,7 @@ quectel_get_mode()
|
||||
{
|
||||
local at_port="$1"
|
||||
local platform="$2"
|
||||
|
||||
modem_number=$(uci -q get modem.@global[0].modem_number)
|
||||
at_command='AT+QCFG="usbnet"'
|
||||
local mode_num=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+QCFG:" | sed 's/+QCFG: "usbnet",//g' | sed 's/\r//g')
|
||||
|
||||
@ -128,6 +128,17 @@ quectel_get_mode()
|
||||
*) mode="${mode_num}" ;;
|
||||
esac
|
||||
;;
|
||||
"lte")
|
||||
case "$mode_num" in
|
||||
"0") mode="qmi" ;;
|
||||
# "0") mode="gobinet" ;;
|
||||
"1") mode="ecm" ;;
|
||||
"2") mode="mbim" ;;
|
||||
"3") mode="rndis" ;;
|
||||
"5") mode="ncm" ;;
|
||||
*) mode="${mode_num}" ;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
mode="${mode_num}"
|
||||
;;
|
||||
@ -176,9 +187,21 @@ quectel_set_mode()
|
||||
*) mode_num="0" ;;
|
||||
esac
|
||||
;;
|
||||
"lte")
|
||||
case "$2" in
|
||||
"qmi") mode_num="0" ;;
|
||||
# "gobinet") mode_num="0" ;;
|
||||
"ecm") mode_num="1" ;;
|
||||
"mbim") mode_num="2" ;;
|
||||
"rndis") mode_num="3" ;;
|
||||
"ncm") mode_num="5" ;;
|
||||
*) mode_num="0" ;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
mode_num="0"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
#设置模组
|
||||
@ -190,6 +213,59 @@ quectel_set_mode()
|
||||
# $1:AT串口
|
||||
quectel_get_network_prefer()
|
||||
{
|
||||
local at_port="$1"
|
||||
local platform
|
||||
local modem_number=$(uci -q get modem.@global[0].modem_number)
|
||||
for i in $(seq 0 $((modem_number-1))); do
|
||||
local at_port_tmp=$(uci -q get modem.modem$i.at_port)
|
||||
if [ "$at_port" = "$at_port_tmp" ]; then
|
||||
platform=$(uci -q get modem.modem$i.platform)
|
||||
break
|
||||
fi
|
||||
done
|
||||
logger -t modem "quectel_get_network_prefer $platform"
|
||||
case "$platform" in
|
||||
"qualcomm")
|
||||
quectel_get_network_prefer_nr $at_port
|
||||
;;
|
||||
"unisoc")
|
||||
quectel_get_network_prefer_nr $at_port
|
||||
;;
|
||||
"lte")
|
||||
quectel_get_network_prefer_lte $at_port
|
||||
;;
|
||||
*)
|
||||
quectel_get_network_prefer_nr $at_port
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
quectel_get_network_prefer_lte()
|
||||
{
|
||||
local at_port="$1"
|
||||
at_command='AT+QCFG="nwscanmode"'
|
||||
logger -t modem "quectel_get_network_prefer_lte"
|
||||
local response=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+QCFG:" | awk -F'",' '{print $2}' | sed 's/\r//g' |grep -o "[0-9]")
|
||||
local network_prefer_3g="0";
|
||||
local network_prefer_4g="0";
|
||||
case "$response" in
|
||||
"0") network_prefer_3g="1"; network_prefer_4g="1" ;;
|
||||
"3") network_prefer_4g="1" ;;
|
||||
esac
|
||||
local network_prefer="{
|
||||
\"network_prefer\":{
|
||||
\"3G\":$network_prefer_3g,
|
||||
\"4G\":$network_prefer_4g,
|
||||
\"5G\":0
|
||||
}
|
||||
}"
|
||||
echo "$network_prefer"
|
||||
}
|
||||
|
||||
quectel_get_network_prefer_nr()
|
||||
{
|
||||
logger -t modem "quectel_get_network_prefer_nr"
|
||||
local at_port="$1"
|
||||
at_command='AT+QNWPREFCFG="mode_pref"'
|
||||
local response=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+QNWPREFCFG:" | awk -F',' '{print $2}' | sed 's/\r//g')
|
||||
@ -229,10 +305,78 @@ quectel_get_network_prefer()
|
||||
echo "$network_prefer"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#设置网络偏好
|
||||
# $1:AT串口
|
||||
# $2:网络偏好配置
|
||||
quectel_set_network_prefer()
|
||||
{
|
||||
local at_port="$1"
|
||||
local network_prefer="$2"
|
||||
local platform
|
||||
local modem_number=$(uci -q get modem.@global[0].modem_number)
|
||||
for i in $(seq 0 $((modem_number-1))); do
|
||||
local at_port_tmp=$(uci -q get modem.modem$i.at_port)
|
||||
if [ "$at_port" = "$at_port_tmp" ]; then
|
||||
platform=$(uci -q get modem.modem$i.platform)
|
||||
break
|
||||
fi
|
||||
done
|
||||
logger -t modem "quectel_set_network_prefer $platform $network_prefer"
|
||||
case "$platform" in
|
||||
"qualcomm")
|
||||
quectel_set_network_prefer_nr $at_port $network_prefer
|
||||
;;
|
||||
"unisoc")
|
||||
quectel_set_network_prefer_nr $at_port $network_prefer
|
||||
;;
|
||||
"lte")
|
||||
quectel_set_network_prefer_lte $at_port $network_prefer
|
||||
;;
|
||||
*)
|
||||
quectel_set_network_prefer_nr $at_port $network_prefer
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
quectel_set_network_prefer_lte()
|
||||
{
|
||||
local at_port="$1"
|
||||
local network_prefer="$2"
|
||||
|
||||
#获取网络偏好配置
|
||||
local network_prefer_config
|
||||
|
||||
#获取选中的数量
|
||||
local count=$(echo "$network_prefer" | grep -o "1" | wc -l)
|
||||
#获取每个偏好的值
|
||||
local network_prefer_3g=$(echo "$network_prefer" | jq -r '.["3G"]')
|
||||
local network_prefer_4g=$(echo "$network_prefer" | jq -r '.["4G"]')
|
||||
local network_prefer_5g=$(echo "$network_prefer" | jq -r '.["5G"]')
|
||||
|
||||
case "$count" in
|
||||
"1")
|
||||
if [ "$network_prefer_3g" = "1" ]; then
|
||||
network_prefer_config="0"
|
||||
elif [ "$network_prefer_4g" = "1" ]; then
|
||||
network_prefer_config="3"
|
||||
fi
|
||||
;;
|
||||
"2")
|
||||
network_prefer_config="0"
|
||||
esac
|
||||
|
||||
#设置模组
|
||||
at_command='AT+QCFG="nwscanmode",'${network_prefer_config}
|
||||
sh ${SCRIPT_DIR}/modem_at.sh "${at_port}" "${at_command}"
|
||||
|
||||
}
|
||||
|
||||
quectel_set_network_prefer_nr()
|
||||
{
|
||||
local at_port="$1"
|
||||
local network_prefer="$2"
|
||||
@ -575,7 +719,7 @@ quectel_get_band()
|
||||
echo "$band"
|
||||
}
|
||||
|
||||
quectel_get_lockband_qualcomm()
|
||||
quectel_get_lockband_nr()
|
||||
{
|
||||
local at_port="$1"
|
||||
debug "Quectel sdx55 get lockband info"
|
||||
@ -592,40 +736,93 @@ quectel_get_lockband_qualcomm()
|
||||
nsa_nr_band=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $get_nsa_nr_config_command|grep -e "+QNWPREFCFG: ")
|
||||
sa_nr_band=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $get_sa_nr_config_command|grep -e "+QNWPREFCFG: ")
|
||||
json_init
|
||||
json_add_object "UMTS"
|
||||
json_add_object "available_band"
|
||||
for i in $(echo "$wcdma_avalible_band" | awk -F"," '{for(j=1; j<=NF; j++) print $j}'); do
|
||||
json_add_string "UMTS_$i" "UMTS_$i"
|
||||
done
|
||||
for i in $(echo "$lte_avalible_band" | awk -F"," '{for(j=1; j<=NF; j++) print $j}'); do
|
||||
json_add_string "LTE_B$i" "LTE_B$i"
|
||||
done
|
||||
for i in $(echo "$nsa_nr_avalible_band" | awk -F"," '{for(j=1; j<=NF; j++) print $j}'); do
|
||||
json_add_string "NSA_NR_N$i" "NSA_NR_N$i"
|
||||
done
|
||||
for i in $(echo "$sa_nr_avalible_band" | awk -F"," '{for(j=1; j<=NF; j++) print $j}'); do
|
||||
json_add_string "SA_NR_N$i" "SA_NR_N$i"
|
||||
done
|
||||
json_close_object
|
||||
json_add_array "lock_band"
|
||||
json_close_object
|
||||
json_close_object
|
||||
json_add_object "LTE"
|
||||
json_add_object "available_band"
|
||||
json_close_object
|
||||
json_add_array "lock_band"
|
||||
json_close_object
|
||||
json_close_object
|
||||
json_add_object "NR"
|
||||
json_add_object "available_band"
|
||||
json_close_object
|
||||
json_add_array "lock_band"
|
||||
json_close_object
|
||||
json_close_object
|
||||
json_add_object "NR_NSA"
|
||||
json_add_object "available_band"
|
||||
json_close_object
|
||||
json_add_array "lock_band"
|
||||
json_close_object
|
||||
json_close_object
|
||||
for i in $(echo "$wcdma_avalible_band" | awk -F"," '{for(j=1; j<=NF; j++) print $j}'); do
|
||||
json_select "UMTS"
|
||||
json_select "available_band"
|
||||
json_add_string "$i" "UMTS_$i"
|
||||
json_select ..
|
||||
json_select ..
|
||||
done
|
||||
for i in $(echo "$lte_avalible_band" | awk -F"," '{for(j=1; j<=NF; j++) print $j}'); do
|
||||
json_select "LTE"
|
||||
json_select "available_band"
|
||||
json_add_string "$i" "LTE_B$i"
|
||||
json_select ..
|
||||
json_select ..
|
||||
done
|
||||
for i in $(echo "$nsa_nr_avalible_band" | awk -F"," '{for(j=1; j<=NF; j++) print $j}'); do
|
||||
json_select "NR_NSA"
|
||||
json_select "available_band"
|
||||
json_add_string "$i" "NSA_NR_N$i"
|
||||
json_select ..
|
||||
json_select ..
|
||||
done
|
||||
for i in $(echo "$sa_nr_avalible_band" | awk -F"," '{for(j=1; j<=NF; j++) print $j}'); do
|
||||
json_select "NR"
|
||||
json_select "available_band"
|
||||
json_add_string "$i" "SA_NR_N$i"
|
||||
json_select ..
|
||||
json_select ..
|
||||
done
|
||||
#+QNWPREFCFG: "nr5g_band",1:3:7:20:28:40:41:71:77:78:79
|
||||
for i in $(echo "$gw_band" | cut -d, -f2 |tr -d '\r' | awk -F":" '{for(j=1; j<=NF; j++) print $j}'); do
|
||||
if [ -n "$i" ]; then
|
||||
json_add_string "" "UMTS_$i"
|
||||
json_select "UMTS"
|
||||
json_select "lock_band"
|
||||
json_add_string "" "$i"
|
||||
json_select ..
|
||||
json_select ..
|
||||
fi
|
||||
done
|
||||
for i in $(echo "$lte_band" | cut -d, -f2|tr -d '\r' | awk -F":" '{for(j=1; j<=NF; j++) print $j}'); do
|
||||
if [ -n "$i" ]; then
|
||||
json_add_string "" "LTE_B$i"
|
||||
json_select "LTE"
|
||||
json_select "lock_band"
|
||||
json_add_string "" "$i"
|
||||
json_select ..
|
||||
json_select ..
|
||||
fi
|
||||
done
|
||||
for i in $(echo "$nsa_nr_band" | cut -d, -f2|tr -d '\r' | awk -F":" '{for(j=1; j<=NF; j++) print $j}'); do
|
||||
if [ -n "$i" ]; then
|
||||
json_add_string "" "NSA_NR_N$i"
|
||||
json_select "NR_NSA"
|
||||
json_select "lock_band"
|
||||
json_add_string "" "$i"
|
||||
json_select ..
|
||||
json_select ..
|
||||
fi
|
||||
done
|
||||
for i in $(echo "$sa_nr_band" | cut -d, -f2|tr -d '\r' | awk -F":" '{for(j=1; j<=NF; j++) print $j}'); do
|
||||
if [ -n "$i" ]; then
|
||||
json_add_string "" "SA_NR_N$i"
|
||||
json_select "NR"
|
||||
json_select "lock_band"
|
||||
json_add_string "" "$i"
|
||||
json_select ..
|
||||
json_select ..
|
||||
fi
|
||||
done
|
||||
json_close_array
|
||||
@ -668,8 +865,6 @@ convert2hex()
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
quectel_get_lockband_lte()
|
||||
{
|
||||
local at_port="$1"
|
||||
@ -680,6 +875,7 @@ quectel_get_lockband_lte()
|
||||
fi
|
||||
LOCK_BAND=$(convert2band $LTE_LOCK)
|
||||
json_init
|
||||
json_add_object "Lte"
|
||||
json_add_object available_band
|
||||
json_add_string "1" "B01"
|
||||
json_add_string "3" "B03"
|
||||
@ -699,24 +895,10 @@ quectel_get_lockband_lte()
|
||||
done
|
||||
json_close_array
|
||||
json_close_object
|
||||
json_close_object
|
||||
json_dump
|
||||
}
|
||||
|
||||
quectel_get_lockband_generic()
|
||||
{
|
||||
local at_port="$1"
|
||||
local lte_lockband_cmd="AT+QCFG=?"
|
||||
local nr_lockband_cmd="AT+QNWPREFCFG=?"
|
||||
lte_response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $lte_lockband_cmd | grep "+QCFG:")
|
||||
nr_response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $nr_lockband_cmd | grep "+QNWPREFCFG:")
|
||||
|
||||
if [ -n "$lte_response" ]; then
|
||||
quectel_get_lockband_lte $at_port
|
||||
else
|
||||
quectel_get_lockband_qualcomm $at_port
|
||||
fi
|
||||
}
|
||||
|
||||
quectel_get_lockband()
|
||||
{
|
||||
local at_port="$1"
|
||||
@ -731,29 +913,20 @@ quectel_get_lockband()
|
||||
done
|
||||
case "$platform" in
|
||||
"qualcomm")
|
||||
quectel_get_lockband_qualcomm $at_port
|
||||
quectel_get_lockband_nr $at_port
|
||||
;;
|
||||
"unisoc")
|
||||
quectel_get_lockband_unisoc $at_port
|
||||
quectel_get_lockband_nr $at_port
|
||||
;;
|
||||
'lte')
|
||||
quectel_get_lockband_lte $at_port
|
||||
;;
|
||||
*)
|
||||
quectel_get_lockband_generic $at_port
|
||||
quectel_get_lockband_lte $at_port
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
quectel_set_lockband_generic()
|
||||
{
|
||||
local lte_lockband_cmd="AT+QCFG=?"
|
||||
local nr_lockband_cmd="AT+QNWPREFCFG=?"
|
||||
lte_response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $lte_lockband_cmd | grep "+QCFG:")
|
||||
nr_response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $nr_lockband_cmd | grep "+QNWPREFCFG:")
|
||||
if [ -n "$lte_response" ]; then
|
||||
quectel_set_lockband_lte $1 $2
|
||||
else
|
||||
quectel_set_lockband_qualcomm $1 $2
|
||||
fi
|
||||
}
|
||||
|
||||
quectel_set_lockband_lte()
|
||||
{
|
||||
@ -766,67 +939,31 @@ quectel_set_lockband_lte()
|
||||
sh ${SCRIPT_DIR}/modem_at.sh $at_port 'AT+QCFG="band",0,'${hex}',0' 2>&1 > /dev/null
|
||||
}
|
||||
|
||||
quectel_set_lockband_qualcomm(){
|
||||
quectel_set_lockband_nr(){
|
||||
local at_port="$1"
|
||||
local lock_band="$2"
|
||||
gw_band=""
|
||||
lte_band=""
|
||||
nsa_nr_band=""
|
||||
sa_nr_band=""
|
||||
for i in $(echo $2 | awk -F"," '{for(j=1; j<=NF; j++) print $j}' );do
|
||||
num_match=$(echo $i | grep -o "[0-9]\+")
|
||||
case "$i" in
|
||||
UMTS_*)
|
||||
if [ -z "$gw_band" ]; then
|
||||
gw_band=$num_match
|
||||
else
|
||||
gw_band=$gw_band:$num_match
|
||||
fi
|
||||
local rat="$3"
|
||||
lock_band=$(echo $lock_band | tr ',' ':')
|
||||
case "$rat" in
|
||||
"UMTS")
|
||||
at_command="AT+QNWPREFCFG=\"gw_band\",$lock_band"
|
||||
res=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command)
|
||||
;;
|
||||
LTE_B*)
|
||||
if [ -z "$lte_band" ]; then
|
||||
lte_band=$num_match
|
||||
else
|
||||
lte_band=$lte_band:$num_match
|
||||
fi
|
||||
"LTE")
|
||||
at_command="AT+QNWPREFCFG=\"lte_band\",$lock_band"
|
||||
res=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command)
|
||||
;;
|
||||
NSA_NR_N*)
|
||||
if [ -z "$nsa_nr_band" ]; then
|
||||
nsa_nr_band=$num_match
|
||||
else
|
||||
nsa_nr_band=$nsa_nr_band:$num_match
|
||||
fi
|
||||
"NR_NSA")
|
||||
at_command="AT+QNWPREFCFG=\"nsa_nr5g_band\",$lock_band"
|
||||
res=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command)
|
||||
;;
|
||||
SA_NR_N*)
|
||||
if [ -z "$sa_nr_band" ]; then
|
||||
sa_nr_band=$num_match
|
||||
else
|
||||
sa_nr_band=$sa_nr_band:$num_match
|
||||
fi
|
||||
"NR")
|
||||
at_command="AT+QNWPREFCFG=\"nr5g_band\",$lock_band"
|
||||
res=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ -n "$gw_band" ]; then
|
||||
at_command="AT+QNWPREFCFG=\"gw_band\",$gw_band"
|
||||
res1=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command)
|
||||
fi
|
||||
if [ -n "$lte_band" ]; then
|
||||
at_command="AT+QNWPREFCFG=\"lte_band\",$lte_band"
|
||||
res2=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command)
|
||||
fi
|
||||
if [ -n "$nsa_nr_band" ]; then
|
||||
at_command="AT+QNWPREFCFG=\"nsa_nr5g_band\",$nsa_nr_band"
|
||||
res3=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command)
|
||||
fi
|
||||
if [ -n "$sa_nr_band" ]; then
|
||||
at_command="AT+QNWPREFCFG=\"nr5g_band\",$sa_nr_band"
|
||||
res4=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command)
|
||||
fi
|
||||
json_init
|
||||
json_add_string result1 "$res1"
|
||||
json_add_string result2 "$res2"
|
||||
json_add_string result3 "$res3"
|
||||
json_add_string result4 "$res4"
|
||||
json_add_string result "$res"
|
||||
json_result=`json_dump`
|
||||
echo "$json_result"
|
||||
}
|
||||
@ -836,24 +973,13 @@ quectel_set_lockband()
|
||||
{
|
||||
debug "quectel set lockband info"
|
||||
local at_port="$1"
|
||||
local platform
|
||||
local modem_number=$(uci -q get modem.@global[0].modem_number)
|
||||
for i in $(seq 0 $((modem_number-1))); do
|
||||
local at_port_tmp=$(uci -q get modem.modem$i.at_port)
|
||||
if [ "$at_port" = "$at_port_tmp" ]; then
|
||||
platform=$(uci -q get modem.modem$i.platform)
|
||||
break
|
||||
fi
|
||||
done
|
||||
case "$platform" in
|
||||
"qualcomm")
|
||||
quectel_set_lockband_qualcomm $at_port $2
|
||||
local rat="$3"
|
||||
case "$rat" in
|
||||
"Lte")
|
||||
quectel_set_lockband_lte $at_port $2
|
||||
;;
|
||||
"unisoc")
|
||||
quectel_set_lockband_unisoc $at_port $2
|
||||
;;
|
||||
"generic")
|
||||
quectel_set_lockband_generic $at_port $2
|
||||
*)
|
||||
quectel_set_lockband_nr $at_port $2 $3
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -983,8 +1109,8 @@ quectel_get_neighborcell_lte(){
|
||||
lte_lock_status=$(echo $lte_status | awk -F',' '{print $2}')
|
||||
lte_lock_freq=$(echo $lte_status | awk -F',' '{print $3}')
|
||||
lte_lock_pci=$(echo $lte_status | awk -F',' '{print $4}')
|
||||
lte_lock_finish=$(echo $lte_status | awk -F',' '{print $5}')
|
||||
if [ "$lte_lock_finish" == "1" ]; then
|
||||
lte_lock_finish=$(echo $lte_status | awk -F',' '{print $5}' | sed 's/\r//g')
|
||||
if [ "$lte_lock_finish" == "0" ]; then
|
||||
lte_lock_finish="finish"
|
||||
else
|
||||
lte_lock_finish="not finish"
|
||||
@ -1077,7 +1203,7 @@ quectel_get_neighborcell(){
|
||||
"unisoc")
|
||||
quectel_get_neighborcell_unisoc $at_port
|
||||
;;
|
||||
*)
|
||||
"lte")
|
||||
quectel_get_neighborcell_lte $at_port
|
||||
;;
|
||||
esac
|
||||
@ -1175,7 +1301,7 @@ quectel_lockarfn_lte(){
|
||||
local pci="$4"
|
||||
local scs="$5"
|
||||
local nrband="$6"
|
||||
locklte="AT+QNWLOCK=\"common/lte\",1,$arfcn"
|
||||
locklte="AT+QNWLOCK=\"common/lte\",1,$arfcn,0"
|
||||
res=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $locklte)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user