From ea4ee869f94693daacad6376eabd77ab30dba568 Mon Sep 17 00:00:00 2001 From: cxh Date: Thu, 22 Jan 2026 17:02:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=83=A8=E5=88=86=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/serial_AT.hpp | 3 +++ src/serial_AT.cpp | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/include/serial_AT.hpp b/include/serial_AT.hpp index 112b189..a26ea9e 100644 --- a/include/serial_AT.hpp +++ b/include/serial_AT.hpp @@ -7,6 +7,9 @@ extern std::string IMEI; struct RadioInfo { + std::string state; // CONNECT / NOCONN + std::string rat; // NR5G-SA / NR5G-NSA / LTE / WCDMA ... + int pci = -1; // 物理小区 ID int band = -1; // LTE/NR Band(如果你要解析可以填) int arfcn = -1; // 频点号,NR/SA必有字段 diff --git a/src/serial_AT.cpp b/src/serial_AT.cpp index f892b5b..2fb4880 100644 --- a/src/serial_AT.cpp +++ b/src/serial_AT.cpp @@ -91,6 +91,9 @@ static void parse_qeng_servingcell(const std::string& line) std::string rat = t[2]; + std::string state = (t.size() > 1 ? t[1] : ""); + std::string rat = (t.size() > 2 ? t[2] : ""); + int pci = -1; int band = -1; int arfcn = -1; @@ -145,6 +148,10 @@ static void parse_qeng_servingcell(const std::string& line) { std::lock_guard lk(radio_mutex); + + g_radio_info.state = state; + g_radio_info.rat = rat; + g_radio_info.pci = pci; g_radio_info.rsrp = rsrp; g_radio_info.rsrq = rsrq; @@ -153,8 +160,17 @@ static void parse_qeng_servingcell(const std::string& line) g_radio_info.raw = line; } - LOG_INFO("[serial_at] QENG parsed: RAT=" + rat + " PCI=" + std::to_string(pci) + " ARFCN=" + std::to_string(arfcn) + - " RSRP=" + std::to_string(rsrp) + " RSRQ=" + std::to_string(rsrq) + " SINR=" + std::to_string(sinr)); + LOG_INFO("[serial_at][QENG] " + rat + " pci=" + std::to_string(pci) + " band=" + std::to_string(band) + + " arfcn=" + std::to_string(arfcn) + " | rsrp=" + std::to_string(rsrp) + + " dBm" + " rsrq=" + + std::to_string(rsrq) + + " dB" + " sinr=" + + std::to_string(sinr) + + " dB" + " (" + + state + ")"); } static bool is_imei_ready()