diff --git a/simpleadmin/scripts/modemstatus_parse.sh b/simpleadmin/scripts/modemstatus_parse.sh index 5d3b6cc..cab2c34 100644 --- a/simpleadmin/scripts/modemstatus_parse.sh +++ b/simpleadmin/scripts/modemstatus_parse.sh @@ -56,6 +56,17 @@ get_secondary_bands() { fi } +get_secondary_bands_sa() { + # Extract the NR5G SA BANDs from SCC lines from /tmp/qa.txt. + # If there are multiple bands, they will be concatenated with
tags. + SC_BANDS=$(grep -o '"NR5G BAND [0-9]\+"' /tmp/modemstatus.txt | tr -d '"' | sed '1d' | sed ':a;N;$!ba;s/\n//g') + + # If there are no NR5G SA bands, set SC_BANDS to empty + if [ -z "$SC_BANDS" ]; then + SC_BANDS="-" + fi +} + # Get the modem model from /tmp/modemmodel.txt and parse it MODEM_MODEL=$( { - return res.text(); - }) + this.isLoading = true; + fetch("/cgi-bin/get_sms") + .then((response) => response.text()) .then((data) => { this.atCommandResponse = data; - // Split the response into individual messages - const messages = data.trim().split("\n\n"); - - // Parse each message and construct an array of objects - const parsedMessages = messages.map((message) => { - const lines = message.split("\n"); - const sender = decodeHexString( - lines[1].split(",")[2].slice(1, -1) - ); - const time = lines[2].split(',"')[1]; - const messageText = decodeHexString(lines[3]); - return { - "Người gửi": sender, - "Thời gian": time, - "Tin nhắn": messageText, - }; - }); - - // Log the parsed messages array as JSON to the console - console.log(JSON.stringify(parsedMessages, null, 2)); - }) - .catch((error) => { - console.error("Không thể tìm thấy dữ liệu:", error); - }) - .finally(() => { - this.isLoading = false; // Set loading state to false after fetching data + console.log(data); + this.isLoading = false; }); }, }; } - // Hàm giải mã chuỗi hex sang văn bản - function decodeHexString(hexString) { - let decodedString = ""; - for (let i = 0; i < hexString.length; i += 4) { - let hex = hexString.substr(i, 4); - let intValue = parseInt(hex, 16); - decodedString += String.fromCharCode(intValue); - } - return decodedString; - }