added dedicated NR-CA NSA parser

This commit is contained in:
Russel Yasol
2024-03-25 08:52:54 +08:00
parent f58ccff0bf
commit 488486bcdc

View File

@@ -37,27 +37,33 @@ nr_bw() {
} }
# Function to get the secondary LTE & NR5G bands # Function to get the secondary LTE & NR5G bands
# Now conditionally calls the functions to get the secondary bands get_secondary_bands_lte() {
# Only apply | sed '1d' to NR_BAND when network mode is SA # Extract the LTE BANDs from SCC lines from /tmp/modemstatus.txt.
get_secondary_bands() { # If there are multiple bands, they will be concatenated with <br/> tags.
# Extract LTE BANDs from SCC lines SC_BANDS=$(grep -o '"LTE BAND [0-9]\+"' /tmp/modemstatus.txt | tr -d '"' | sed '1d' | sed ':a;N;$!ba;s/\n/<br\/>/g')
SCC_BANDS=$(echo "$OX" | grep '+QCAINFO: "SCC"' | grep -o '"LTE BAND [0-9]\+"' | tr -d '"' | sed '1d')
# If there are no LTE bands or NR5G bands, set SC_BANDS to empty
# Extract NR5G BANDs from SCC lines if [ -z "$SC_BANDS" ]; then
NR_BAND=$(echo "$OX" | grep '+QCAINFO: "SCC"' | grep -o '"NR5G BAND [0-9]\+"' | tr -d '"') SC_BANDS="-"
fi
# Check if both SCC and NR bands are non-empty
if [ -n "$SCC_BANDS" ] && [ -n "$NR_BAND" ]; then }
# Concatenate LTE BANDs with NR5G BANDs
SC_BANDS="$SCC_BANDS<br />$NR_BAND" # Function to get the secondary NR5G bands for NR5G NSA
else get_secondary_bands_nsa() {
# Set SC_BANDS to the non-empty variable or empty if both are empty # Extract the NR5G NSA BANDs from SCC lines from /tmp/modemstatus.txt.
SC_BANDS="${SCC_BANDS}${NR_BAND}" # If there are multiple bands, they will be concatenated with <br/> tags.
SC_BANDS_NSA=$(grep -o '"NR5G BAND [0-9]\+"' /tmp/modemstatus.txt | tr -d '"' | sed ':a;N;$!ba;s/\n/<br\/>/g')
echo $SC_BANDS_NSA > /tmp/scbands.txt
# If there are no NR5G NSA bands, set SC_BANDS_NSA to empty
if [ -z "$SC_BANDS_NSA" ]; then
SC_BANDS_NSA="-"
fi fi
} }
get_secondary_bands_sa() { get_secondary_bands_sa() {
# Extract the NR5G SA BANDs from SCC lines from /tmp/qa.txt. # Extract the NR5G SA BANDs from SCC lines from /tmp/modemstatus.txt.
# If there are multiple bands, they will be concatenated with <br/> tags. # If there are multiple bands, they will be concatenated with <br/> tags.
SC_BANDS=$(grep -o '"NR5G BAND [0-9]\+"' /tmp/modemstatus.txt | tr -d '"' | sed '1d' | sed ':a;N;$!ba;s/\n/<br\/>/g') SC_BANDS=$(grep -o '"NR5G BAND [0-9]\+"' /tmp/modemstatus.txt | tr -d '"' | sed '1d' | sed ':a;N;$!ba;s/\n/<br\/>/g')
@@ -181,7 +187,7 @@ case $RAT in
else else
MODE="$RAT" MODE="$RAT"
fi fi
get_secondary_bands get_secondary_bands_lte
PCI=$(echo $QENG | cut -d, -f9) PCI=$(echo $QENG | cut -d, -f9)
CHANNEL=$(echo $QENG | cut -d, -f10) CHANNEL=$(echo $QENG | cut -d, -f10)
LBAND=$(echo $QENG | cut -d, -f11 | grep -o "[0-9]\{1,3\}") LBAND=$(echo $QENG | cut -d, -f11 | grep -o "[0-9]\{1,3\}")
@@ -232,8 +238,9 @@ case $RAT in
echo "0" > /tmp/modnetwork echo "0" > /tmp/modnetwork
if [ -n "$QENG5" ]; then if [ -n "$QENG5" ]; then
QENG5=$QENG5",," QENG5=$QENG5",,"
# Append the initial PCI value rather than overwriting it get_secondary_bands_nsa
get_secondary_bands # Append the SC_BANDS_NSA to SC_BANDS with <br /> tags
SC_BANDS=$SC_BANDS"<br />"$SC_BANDS_NSA
PCI="$PCI, "$(echo $QENG5 | cut -d, -f4) PCI="$PCI, "$(echo $QENG5 | cut -d, -f4)
SCHV=$(echo $QENG5 | cut -d, -f8) SCHV=$(echo $QENG5 | cut -d, -f8)
SLBV=$(echo $QENG5 | cut -d, -f9) # Now correctly captures the NR band SLBV=$(echo $QENG5 | cut -d, -f9) # Now correctly captures the NR band