Skip to content

Commit ce8cae0

Browse files
authored
Feature/neighbor cell (#37)
1 parent 3d9bca5 commit ce8cae0

File tree

3 files changed

+70
-45
lines changed

3 files changed

+70
-45
lines changed

luci/luci-app-qmodem/luasrc/view/qmodem/modem_debug.htm

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -748,20 +748,25 @@
748748
this.get_action = "get_neighborcell";
749749
this.set_action = "set_neighborcell";
750750
this.task = null;
751-
this.init_nc_table();
751+
this.init_nc_table();
752752
}
753753

754-
pause(){
755-
if (this.task != null) {
756-
clearInterval(this.task);
757-
}
754+
scan_neighborcell(){
755+
this.get_config();
758756
}
759757

760-
update(){
761-
this.task = setInterval(() => {
762-
this.get_config();
763-
},10000);
764-
}
758+
// pause(){
759+
// if (this.task != null) {
760+
// clearInterval(this.task);
761+
// }
762+
// }
763+
764+
// update(){
765+
766+
// this.task = setInterval(() => {
767+
// this.get_config();
768+
// },10000);
769+
// }
765770

766771
nr_options(){
767772
if (this.rat_input.selectedIndex == 0) {
@@ -865,12 +870,19 @@
865870
this.set_config(JSON.stringify(config));
866871
});
867872

873+
//add scan button
874+
var scan_btn = this.createBTN("<%:Scan%>",() => {
875+
this.scan_neighborcell();
876+
});
877+
878+
868879
this.setting_table.appendChild(header);
869880
this.setting_table.appendChild(rat_tr);
870881
this.setting_table.appendChild(pci_tr);
871882
this.setting_table.appendChild(arfcn_tr);
872883
this.setting_table.appendChild(band_tr);
873884
this.setting_table.appendChild(scs_tr);
885+
this.setting_table.appendChild(scan_btn);
874886
this.setting_table.appendChild(submit_btn);
875887
}
876888

@@ -925,17 +937,18 @@
925937
}
926938
}
927939
let tr_left = this.createTD(text);
928-
let tr_right = this.create_copy_btn_td(rat,cell_info.pci,cell_info.arfcn);
940+
let tr_right = this.create_copy_btn_td(rat,cell_info);
929941
let tr = this.createTR();
930942
tr.appendChild(tr_left);
931943
tr.appendChild(tr_right);
932944
this.neighborcell_table.appendChild(tr);
933945
}
934946

935-
create_copy_btn_td(rat,pci,arfcn){
947+
create_copy_btn_td(rat,cell_info){
936948
var copy_btn = this.createBTN("<%:Copy%>",() => {
937-
this.pci_input.value = pci;
938-
this.arfcn_input.value = arfcn;
949+
this.pci_input.value = cell_info.pci;
950+
this.arfcn_input.value = cell_info.arfcn;
951+
this.band_input.value = cell_info.band;
939952
this.rat_input.selectedIndex = rat;
940953
this.nr_options()
941954
});

luci/luci-app-qmodem/root/usr/share/qmodem/at_commands.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,12 @@
597597
{
598598
"关闭sim热插拔 > AT+UIMHOTSWAPON=0": "AT+UIMHOTSWAPON=0"
599599
},
600+
{
601+
"解除LTE小区锁定 > AT+CCELLCFG=0": "AT+CCELLCFG=0"
602+
},
603+
{
604+
"解除5G小区锁定 > AT+C5GCELLCFG=\"unlock\"": "AT+C5GCELLCFG=\"unlock\""
605+
},
600606
{
601607
"更改imei > AT+SIMEI=imei": "AT+SIMEI=imei"
602608
},

luci/luci-app-qmodem/root/usr/share/qmodem/vendor/simcom.sh

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -548,28 +548,37 @@ get_neighborcell_qualcomm(){
548548
local at_command='AT+CPSI?'
549549
nr_lock_check="AT+C5GCELLCFG?"
550550
lte_lock_check="AT+CCELLCFG?"
551-
lte_status=$(at $at_port $lte_lock_check | grep "+CCELLCFG:")
552-
if [ "$lte_status" != "+CCELLCFG: 0,0" ]; then
551+
lte_status=$(at $at_port $lte_lock_check | grep "+CCELLCFG:")
552+
if [ ! -z "$lte_status" ]; then
553553
lte_lock_status="locked"
554554
else
555555
lte_lock_status=""
556556
fi
557557
lte_lock_freq=$(echo $lte_status | awk -F',' '{print $2}' | sed 's/\r//g')
558558
lte_lock_pci=$(echo $lte_status | awk -F',' '{print $1}' | sed 's/+CCELLCFG: //g' | sed 's/\r//g')
559559
nr_status=$(at $at_port $nr_lock_check | grep "+C5GCELLCFG:")
560-
nr_lock_status=$(echo $nr_status | awk -F': ' '{print $2}' | sed 's/\r//g')
561-
nr_lock_pci=$(echo $nr_status | awk -F',' '{print $2}' | sed 's/\r//g')
562-
nr_lock_freq=$(echo $nr_status | awk -F',' '{print $3}' | sed 's/\r//g')
563-
nr_lock_scs=$(echo $nr_status | awk -F',' '{print $4}' | sed 's/\r//g')
564-
nr_lock_band=$(echo $nr_status | awk -F',' '{print $5}' | sed 's/\r//g')
560+
nr_lock_status=$(echo "$nr_status" | awk -F': ' '{print $2}' | xargs)
561+
nr_lock_pci=$(echo "$nr_status" | awk -F',' '{print $2}' | xargs)
562+
nr_lock_freq=$(echo "$nr_status" | awk -F',' '{print $3}' | xargs)
563+
nr_lock_scs=$(echo "$nr_status" | awk -F',' '{print $4}' | xargs)
564+
nr_lock_band=$(echo "$nr_status" | awk -F',' '{print $5}' | xargs)
565565
if [ "$nr_lock_status" != "0" ]; then
566566
nr_lock_status="locked"
567567
else
568568
nr_lock_status=""
569569
fi
570570

571-
572-
at $at_port $at_command > /tmp/neighborcell
571+
modem_status=$(at $at_port $at_command)
572+
modem_status_net=$(echo "$modem_status"|grep "+CPSI:"|awk -F',' '{print $1}'|awk -F':' '{print $2}'|xargs)
573+
modem_status_band=$(echo "$modem_status"|grep "+CPSI:"|awk -F',' '{print $7}'|awk -F'_' '{print $2}'|sed 's/BAND//g'|xargs)
574+
if [ $modem_status_net == "NR5G_SA" ];then
575+
scans=$(at $at_port "AT+CNWSEARCH=\"nr5g\"")
576+
sleep 10
577+
at $at_port "AT+CNWSEARCH=\"nr5g\",3" > /tmp/neighborcell
578+
elif [ $modem_status_net == "LTE" ];then
579+
at $at_port "AT+CNWSEARCH=\"lte\",1" > /tmp/neighborcell
580+
sleep 5
581+
fi
573582
json_add_object "Feature"
574583
json_add_string "Unlock" "2"
575584
json_add_string "Lock PCI" "1"
@@ -599,9 +608,9 @@ get_neighborcell_qualcomm(){
599608
fi
600609
json_close_object
601610
while read line; do
602-
if [ -n "$(echo $line | grep "+CPSI:")" ]; then
611+
if [ -n "$(echo $line | grep "+NR_NGH_CELL:")" ] || [ -n "$(echo $line | grep "+LTE_CELL:")" ]; then
603612
# CPSI: NR5G_SA,Online,460-01,0x6F4700,29869309958,95,NR5G_BAND78,627264,-800,-110,14
604-
line=$(echo $line | sed 's/+CPSI: //g')
613+
605614
case $line in
606615
*WCDMA*)
607616
type="WCDMA"
@@ -611,37 +620,34 @@ get_neighborcell_qualcomm(){
611620
rscp=$(echo $line | awk -F',' '{print $11}')
612621
ecno=$(echo $line | awk -F',' '{print $10}')
613622
;;
614-
*LTE*)
623+
*LTE_CELL*)
615624
type="LTE"
616-
arfcn=$(echo $line | awk -F',' '{print $8}')
617-
pci=$(echo $line | awk -F',' '{print $6}')
618-
rsrp=$(echo $line | awk -F',' '{print $12}')
619-
rsrq=$(echo $line | awk -F',' '{print $11}')
620-
;;
621-
*NR5G_SA*)
622-
type="NR5G_SA"
623-
arfcn=$(echo $line | awk -F',' '{print $8}')
624-
pci=$(echo $line | awk -F',' '{print $6}')
625-
rsrp=$(echo $line | awk -F',' '{print $9}')
626-
rsrq=$(echo $line | awk -F',' '{print $10}')
625+
arfcn=$(echo $line | awk -F',' '{print $6}')
626+
pci=$(echo $line | awk -F',' '{print $7}')
627+
rsrp=$(echo $line | awk -F',' '{print $8}')
628+
rsrq=$(echo $line | awk -F',' '{print $9}')
629+
band=$(echo $line | awk -F',' '{print $5}')
630+
mnc=$(echo $line | awk -F',' '{print $2}')
627631
;;
628-
*NR5G_NSA*)
629-
type="NR5G_NSA"
630-
arfcn=$(echo $line | awk -F',' '{print $4}')
632+
*NR_NGH_CELL*)
633+
type="NR"
634+
arfcn=$(echo $line | awk -F',' '{print $1}'| awk -F':' '{print $2}'| xargs)
631635
pci=$(echo $line | awk -F',' '{print $2}')
632-
rsrp=$(echo $line | awk -F',' '{print $5}')
633-
rsrq=$(echo $line | awk -F',' '{print $6}')
636+
rsrp=$(echo $line | awk -F',' '{print $3}')
637+
rsrq=$(echo $line | awk -F',' '{print $4}')
638+
band=$modem_status_band
634639
;;
635640
esac
636641
json_select $type
637642
json_add_object ""
638-
json_add_string "neighbourcell" "neighbourcell"
643+
json_add_string "mnc" "$mnc"
639644
json_add_string "arfcn" "$arfcn"
640645
json_add_string "pci" "$pci"
641646
json_add_string "rscp" "$rscp"
642647
json_add_string "ecno" "$ecno"
643648
json_add_string "rsrp" "$rsrp"
644649
json_add_string "rsrq" "$rsrq"
650+
json_add_string "band" "$band"
645651
json_close_object
646652
json_select ".."
647653
fi
@@ -695,8 +701,8 @@ lockcell_qualcomm(){
695701
res2=$(at $at_port $unlock4g)
696702
res=$res1,$res2
697703
else
698-
lock4g="AT+CCELLCFG=1,$arfcn,$pci;+CNMP=38"
699-
locknr="AT+C5GCELLCFG="pci",$pci,$arfcn,$(get_scs $scs),$band;+CNMP=71"
704+
lock4g="AT+CCELLCFG=1,$pci,$arfcn;+CNMP=38"
705+
locknr="AT+C5GCELLCFG=\"pci\",$pci,$arfcn,$scs,$band;+CNMP=71"
700706
if [ $rat = "1" ]; then
701707
res=$(at $at_port $locknr)
702708
else

0 commit comments

Comments
 (0)