Feature/neighbor cell (#37)

This commit is contained in:
x-shark 2025-04-27 12:11:33 +08:00 committed by GitHub
parent 3d9bca5f12
commit ce8cae0f69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 70 additions and 45 deletions

View File

@ -751,17 +751,22 @@
this.init_nc_table(); this.init_nc_table();
} }
pause(){ scan_neighborcell(){
if (this.task != null) { this.get_config();
clearInterval(this.task);
}
} }
update(){ // pause(){
this.task = setInterval(() => { // if (this.task != null) {
this.get_config(); // clearInterval(this.task);
},10000); // }
} // }
// update(){
// this.task = setInterval(() => {
// this.get_config();
// },10000);
// }
nr_options(){ nr_options(){
if (this.rat_input.selectedIndex == 0) { if (this.rat_input.selectedIndex == 0) {
@ -865,12 +870,19 @@
this.set_config(JSON.stringify(config)); this.set_config(JSON.stringify(config));
}); });
//add scan button
var scan_btn = this.createBTN("<%:Scan%>",() => {
this.scan_neighborcell();
});
this.setting_table.appendChild(header); this.setting_table.appendChild(header);
this.setting_table.appendChild(rat_tr); this.setting_table.appendChild(rat_tr);
this.setting_table.appendChild(pci_tr); this.setting_table.appendChild(pci_tr);
this.setting_table.appendChild(arfcn_tr); this.setting_table.appendChild(arfcn_tr);
this.setting_table.appendChild(band_tr); this.setting_table.appendChild(band_tr);
this.setting_table.appendChild(scs_tr); this.setting_table.appendChild(scs_tr);
this.setting_table.appendChild(scan_btn);
this.setting_table.appendChild(submit_btn); this.setting_table.appendChild(submit_btn);
} }
@ -925,17 +937,18 @@
} }
} }
let tr_left = this.createTD(text); let tr_left = this.createTD(text);
let tr_right = this.create_copy_btn_td(rat,cell_info.pci,cell_info.arfcn); let tr_right = this.create_copy_btn_td(rat,cell_info);
let tr = this.createTR(); let tr = this.createTR();
tr.appendChild(tr_left); tr.appendChild(tr_left);
tr.appendChild(tr_right); tr.appendChild(tr_right);
this.neighborcell_table.appendChild(tr); this.neighborcell_table.appendChild(tr);
} }
create_copy_btn_td(rat,pci,arfcn){ create_copy_btn_td(rat,cell_info){
var copy_btn = this.createBTN("<%:Copy%>",() => { var copy_btn = this.createBTN("<%:Copy%>",() => {
this.pci_input.value = pci; this.pci_input.value = cell_info.pci;
this.arfcn_input.value = arfcn; this.arfcn_input.value = cell_info.arfcn;
this.band_input.value = cell_info.band;
this.rat_input.selectedIndex = rat; this.rat_input.selectedIndex = rat;
this.nr_options() this.nr_options()
}); });

View File

@ -597,6 +597,12 @@
{ {
"关闭sim热插拔 > AT+UIMHOTSWAPON=0": "AT+UIMHOTSWAPON=0" "关闭sim热插拔 > AT+UIMHOTSWAPON=0": "AT+UIMHOTSWAPON=0"
}, },
{
"解除LTE小区锁定 > AT+CCELLCFG=0": "AT+CCELLCFG=0"
},
{
"解除5G小区锁定 > AT+C5GCELLCFG=\"unlock\"": "AT+C5GCELLCFG=\"unlock\""
},
{ {
"更改imei > AT+SIMEI=imei": "AT+SIMEI=imei" "更改imei > AT+SIMEI=imei": "AT+SIMEI=imei"
}, },

View File

@ -549,7 +549,7 @@ get_neighborcell_qualcomm(){
nr_lock_check="AT+C5GCELLCFG?" nr_lock_check="AT+C5GCELLCFG?"
lte_lock_check="AT+CCELLCFG?" lte_lock_check="AT+CCELLCFG?"
lte_status=$(at $at_port $lte_lock_check | grep "+CCELLCFG:") lte_status=$(at $at_port $lte_lock_check | grep "+CCELLCFG:")
if [ "$lte_status" != "+CCELLCFG: 0,0" ]; then if [ ! -z "$lte_status" ]; then
lte_lock_status="locked" lte_lock_status="locked"
else else
lte_lock_status="" lte_lock_status=""
@ -557,19 +557,28 @@ get_neighborcell_qualcomm(){
lte_lock_freq=$(echo $lte_status | awk -F',' '{print $2}' | sed 's/\r//g') lte_lock_freq=$(echo $lte_status | awk -F',' '{print $2}' | sed 's/\r//g')
lte_lock_pci=$(echo $lte_status | awk -F',' '{print $1}' | sed 's/+CCELLCFG: //g' | sed 's/\r//g') lte_lock_pci=$(echo $lte_status | awk -F',' '{print $1}' | sed 's/+CCELLCFG: //g' | sed 's/\r//g')
nr_status=$(at $at_port $nr_lock_check | grep "+C5GCELLCFG:") nr_status=$(at $at_port $nr_lock_check | grep "+C5GCELLCFG:")
nr_lock_status=$(echo $nr_status | awk -F': ' '{print $2}' | sed 's/\r//g') nr_lock_status=$(echo "$nr_status" | awk -F': ' '{print $2}' | xargs)
nr_lock_pci=$(echo $nr_status | awk -F',' '{print $2}' | sed 's/\r//g') nr_lock_pci=$(echo "$nr_status" | awk -F',' '{print $2}' | xargs)
nr_lock_freq=$(echo $nr_status | awk -F',' '{print $3}' | sed 's/\r//g') nr_lock_freq=$(echo "$nr_status" | awk -F',' '{print $3}' | xargs)
nr_lock_scs=$(echo $nr_status | awk -F',' '{print $4}' | sed 's/\r//g') nr_lock_scs=$(echo "$nr_status" | awk -F',' '{print $4}' | xargs)
nr_lock_band=$(echo $nr_status | awk -F',' '{print $5}' | sed 's/\r//g') nr_lock_band=$(echo "$nr_status" | awk -F',' '{print $5}' | xargs)
if [ "$nr_lock_status" != "0" ]; then if [ "$nr_lock_status" != "0" ]; then
nr_lock_status="locked" nr_lock_status="locked"
else else
nr_lock_status="" nr_lock_status=""
fi fi
modem_status=$(at $at_port $at_command)
at $at_port $at_command > /tmp/neighborcell modem_status_net=$(echo "$modem_status"|grep "+CPSI:"|awk -F',' '{print $1}'|awk -F':' '{print $2}'|xargs)
modem_status_band=$(echo "$modem_status"|grep "+CPSI:"|awk -F',' '{print $7}'|awk -F'_' '{print $2}'|sed 's/BAND//g'|xargs)
if [ $modem_status_net == "NR5G_SA" ];then
scans=$(at $at_port "AT+CNWSEARCH=\"nr5g\"")
sleep 10
at $at_port "AT+CNWSEARCH=\"nr5g\",3" > /tmp/neighborcell
elif [ $modem_status_net == "LTE" ];then
at $at_port "AT+CNWSEARCH=\"lte\",1" > /tmp/neighborcell
sleep 5
fi
json_add_object "Feature" json_add_object "Feature"
json_add_string "Unlock" "2" json_add_string "Unlock" "2"
json_add_string "Lock PCI" "1" json_add_string "Lock PCI" "1"
@ -599,9 +608,9 @@ get_neighborcell_qualcomm(){
fi fi
json_close_object json_close_object
while read line; do while read line; do
if [ -n "$(echo $line | grep "+CPSI:")" ]; then if [ -n "$(echo $line | grep "+NR_NGH_CELL:")" ] || [ -n "$(echo $line | grep "+LTE_CELL:")" ]; then
# CPSI: NR5G_SA,Online,460-01,0x6F4700,29869309958,95,NR5G_BAND78,627264,-800,-110,14 # CPSI: NR5G_SA,Online,460-01,0x6F4700,29869309958,95,NR5G_BAND78,627264,-800,-110,14
line=$(echo $line | sed 's/+CPSI: //g')
case $line in case $line in
*WCDMA*) *WCDMA*)
type="WCDMA" type="WCDMA"
@ -611,37 +620,34 @@ get_neighborcell_qualcomm(){
rscp=$(echo $line | awk -F',' '{print $11}') rscp=$(echo $line | awk -F',' '{print $11}')
ecno=$(echo $line | awk -F',' '{print $10}') ecno=$(echo $line | awk -F',' '{print $10}')
;; ;;
*LTE*) *LTE_CELL*)
type="LTE" type="LTE"
arfcn=$(echo $line | awk -F',' '{print $8}') arfcn=$(echo $line | awk -F',' '{print $6}')
pci=$(echo $line | awk -F',' '{print $6}') pci=$(echo $line | awk -F',' '{print $7}')
rsrp=$(echo $line | awk -F',' '{print $12}') rsrp=$(echo $line | awk -F',' '{print $8}')
rsrq=$(echo $line | awk -F',' '{print $11}') rsrq=$(echo $line | awk -F',' '{print $9}')
band=$(echo $line | awk -F',' '{print $5}')
mnc=$(echo $line | awk -F',' '{print $2}')
;; ;;
*NR5G_SA*) *NR_NGH_CELL*)
type="NR5G_SA" type="NR"
arfcn=$(echo $line | awk -F',' '{print $8}') arfcn=$(echo $line | awk -F',' '{print $1}'| awk -F':' '{print $2}'| xargs)
pci=$(echo $line | awk -F',' '{print $6}')
rsrp=$(echo $line | awk -F',' '{print $9}')
rsrq=$(echo $line | awk -F',' '{print $10}')
;;
*NR5G_NSA*)
type="NR5G_NSA"
arfcn=$(echo $line | awk -F',' '{print $4}')
pci=$(echo $line | awk -F',' '{print $2}') pci=$(echo $line | awk -F',' '{print $2}')
rsrp=$(echo $line | awk -F',' '{print $5}') rsrp=$(echo $line | awk -F',' '{print $3}')
rsrq=$(echo $line | awk -F',' '{print $6}') rsrq=$(echo $line | awk -F',' '{print $4}')
band=$modem_status_band
;; ;;
esac esac
json_select $type json_select $type
json_add_object "" json_add_object ""
json_add_string "neighbourcell" "neighbourcell" json_add_string "mnc" "$mnc"
json_add_string "arfcn" "$arfcn" json_add_string "arfcn" "$arfcn"
json_add_string "pci" "$pci" json_add_string "pci" "$pci"
json_add_string "rscp" "$rscp" json_add_string "rscp" "$rscp"
json_add_string "ecno" "$ecno" json_add_string "ecno" "$ecno"
json_add_string "rsrp" "$rsrp" json_add_string "rsrp" "$rsrp"
json_add_string "rsrq" "$rsrq" json_add_string "rsrq" "$rsrq"
json_add_string "band" "$band"
json_close_object json_close_object
json_select ".." json_select ".."
fi fi
@ -695,8 +701,8 @@ lockcell_qualcomm(){
res2=$(at $at_port $unlock4g) res2=$(at $at_port $unlock4g)
res=$res1,$res2 res=$res1,$res2
else else
lock4g="AT+CCELLCFG=1,$arfcn,$pci;+CNMP=38" lock4g="AT+CCELLCFG=1,$pci,$arfcn;+CNMP=38"
locknr="AT+C5GCELLCFG="pci",$pci,$arfcn,$(get_scs $scs),$band;+CNMP=71" locknr="AT+C5GCELLCFG=\"pci\",$pci,$arfcn,$scs,$band;+CNMP=71"
if [ $rat = "1" ]; then if [ $rat = "1" ]; then
res=$(at $at_port $locknr) res=$(at $at_port $locknr)
else else