bool HasNetwork() const;
bool IsNetworkStatusChanged() const;
void SetNetworkStatusChanged(bool changed);
-
- // LTE信号质量获取函数 (基于AT+CESQ)
- int GetRsrq() const; // 获取RSRQ值 (0-34, 255=无效)
- int GetRsrp() const; // 获取RSRP值 (0-97, 255=无效)
-
- // 更新RSRQ和RSRP值(供回调函数使用)
- void UpdateRsrqRsrp(int rsrq, int rsrp);
int16_t GetCurrentView() const;
int16_t GetCurrentSubView() const;
int m_networkType; // 网络类型
bool m_hasNetwork; // 网络连接标志位
bool m_networkStatusChanged; // 网络状态变化标志位
- int m_rsrq; // LTE参考信号质量 (0-34, 255=无效)
- int m_rsrp; // LTE参考信号接收功率 (0-97, 255=无效)
bool is_all_services_ready = false;
bool bind_status = false;
ThunderBirdModel::GetInstance()->UpdateNetworkStatus();
// 从Model获取网络状态信息
- int sim = ThunderBirdModel::GetInstance()->GetSimStatus();
- int cat1_powerOn = ThunderBirdModel::GetInstance()->GetCat1PowerStatus();
- int signal = ThunderBirdModel::GetInstance()->GetSignalStrength();
- int network_on = ThunderBirdModel::GetInstance()->GetNetworkStatus();
- int cat1_network_type = ThunderBirdModel::GetInstance()->GetNetworkType();
- // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sim = %d", sim);
- // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cat1_powerOn = %d", cat1_powerOn);
- // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "signal = %d", signal);
- // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "network_on = %d", network_on);
- // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cat1_network_type = %d", cat1_network_type);
-
- const int SIGNAL_NO_SIGNAL = 99;
+ // int sim = ThunderBirdModel::GetInstance()->GetSimStatus(); // SIM卡状态: 1=有SIM卡, 0=无SIM卡
+ int cat1_powerOn = ThunderBirdModel::GetInstance()->GetCat1PowerStatus(); // CAT1电源状态: 1=开机, 0=关机
+ int signal = ThunderBirdModel::GetInstance()->GetSignalStrength();
+ int network_on = ThunderBirdModel::GetInstance()->GetNetworkStatus(); // 网络连接状态: 1=在线, 0=断网
+ // int cat1_network_type = ThunderBirdModel::GetInstance()->GetNetworkType(); // 网络类型: 0=无网络, 1=GSM, 2=3G, 4=4G/LTE
+
- if (sim == 0 || cat1_powerOn == 0)
+ const int SIGNAL_NO_SIGNAL = 0;
+ if (cat1_powerOn == 0)
{
if (NoSignal != nullptr)
{
NoSignal->SetVisible(true);
}
- UpdateSignalBarDisplay(CalculateSignalBars(signal), false);
+ UpdateSignalBarDisplay(signal, false);
// 处理网络标志位(无网络)
int8_t currentNet = 0;
if (lastNetworkOnline_ == -1)
}
lastNetworkOnline_ = currentNet;
}
- else if (cat1_powerOn == 1 && sim == 1)
+ else if (cat1_powerOn == 1)
{
if (signal == SIGNAL_NO_SIGNAL) // 计算信号强度
{
{
NoSignal->SetVisible(true);
}
- UpdateSignalBarDisplay(CalculateSignalBars(signal), false);
+ UpdateSignalBarDisplay(signal, false);
// 从有网络到无网络:提示一次
int8_t currentNet = 0;
if (lastNetworkOnline_ == -1)
{
NoSignal->SetVisible(false);
}
- UpdateSignalBarDisplay(CalculateSignalBars(signal), true);
+ UpdateSignalBarDisplay(signal, true);
lastNetworkOnline_ = 1;
}
}
}
}
/**
- * @brief 基于RSRQ和RSRP计算信号格数
- * @param signalStrength 旧的信号强度值(保留兼容性,但不再使用)
- * @return 信号格数 (0-4, 99=无效)
- * @note 基于AT+CESQ命令的RSRQ和RSRP值计算
- * RSRQ转换: 实际值(dB) = (rsrq - 94)/10
- * RSRP转换: 实际值(dBm) = rsrp - 140
- * 评估标准:
- * - RSRQ: >= -6.0 极佳, >= -9.0 良好, >= -12.0 一般, < -12.0 较差
- * - RSRP: >= -80 极佳, >= -90 良好, >= -100 一般, < -100 较差
+ * @brief 计算信号格数
+ * @param signalStrength 信号强度值 (0-99, 99=无信号)
+ * @return 信号格数 (0-4)
+ * @note 基于cat1Service提供的信号强度值计算
*/
int ThunderBirdMainView::CalculateSignalBars(int signalStrength)
{
- // 从Model获取RSRQ和RSRP值
- int rsrq = ThunderBirdModel::GetInstance()->GetRsrq();
- int rsrp = ThunderBirdModel::GetInstance()->GetRsrp();
- int signalBars = 0;
- // 如果RSRQ或RSRP无效,回退到旧的信号强度计算方法
- if (rsrq == 255 || rsrp == 255) {
- // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CalculateSignalBars: RSRQ/RSRP invalid, using legacy signal strength");
- // if (signalStrength >= 1 && signalStrength <= 8) // 0信号
- // {
- // return 0;
- // }
- // else if (signalStrength >= 9 && signalStrength <= 16) // 1格信号
- // {
- // return 1;
- // }
- // else if (signalStrength >= 17 && signalStrength <= 21) // 2格信号
- // {
- // return 2;
- // }
- // else if (signalStrength >= 22 && signalStrength <= 26) // 3格信号
- // {
- // return 3;
- // }
- // else if (signalStrength >= 27 && signalStrength <= 31) // 4格信号
- // {
- // return 4;
- // }
- // else
- // {
- // return 99; // Invalid signal strength
- // }
- signalBars = 0;
- }
-
- // 转换RSRQ和RSRP为实际值
- // RSRQ转换公式: 实际值(dB) = (rsrq - 94)/10
- // RSRP转换公式: 实际值(dBm) = rsrp - 140
- float rsrq_db = (rsrq - 94) / 10.0f;
- float rsrp_dbm = rsrp - 140.0f;
-
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CalculateSignalBars: RSRQ=%d (%.1f dB), RSRP=%d (%.0f dBm)",
- rsrq, rsrq_db, rsrp, rsrp_dbm);
-
- // 综合评估:优先考虑RSRP(信号强度),RSRQ(信号质量)作为辅助
- // 信号格数评估标准(基于RSRP和RSRQ的综合评估)
-
+ const int SIGNAL_NO_SIGNAL = 99;
- // æ\9e\81佳信å\8f·ï¼\9aRSRP >= -80 ä¸\94 RSRQ >= -6.0
- if (rsrp_dbm >= -80.0f && rsrq_db >= -6.0f) {
- signalBars = 4; // 4格信号
+ // æ\97 ä¿¡å\8f·
+ if (signalStrength == SIGNAL_NO_SIGNAL || signalStrength <= 0) {
+ return 0;
}
- // 良好信号:RSRP >= -90 且 RSRQ >= -9.0
- else if (rsrp_dbm >= -90.0f && rsrq_db >= -9.0f) {
- signalBars = 3; // 3格信号
+
+ // 根据信号强度值计算信号格数
+ // 信号强度范围: 0-99
+ // 1-16: 1格信号
+ // 17-26: 2格信号
+ // 27-36: 3格信号
+ // 37-98: 4格信号
+ if (signalStrength >= 1 && signalStrength <= 16) {
+ return 1; // 1格信号
}
- // 一般信号:RSRP >= -100 且 RSRQ >= -12.0
- else if (rsrp_dbm >= -100.0f && rsrq_db >= -12.0f) {
- signalBars = 2; // 2格信号
+ else if (signalStrength >= 17 && signalStrength <= 26) {
+ return 2; // 2格信号
}
- // 较弱信号:RSRP >= -110 或 RSRQ >= -15.0(至少有一个满足)
- else if (rsrp_dbm >= -110.0f || rsrq_db >= -15.0f) {
- signalBars = 1; // 1格信号
+ else if (signalStrength >= 27 && signalStrength <= 36) {
+ return 3; // 3格信号
}
- // 很差信号:其他情况
- else {
- signalBars = 0; // 0格信号
+ else if (signalStrength >= 37 && signalStrength < SIGNAL_NO_SIGNAL) {
+ return 4; // 4格信号
}
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CalculateSignalBars: Calculated signal bars = %d", signalBars);
- return signalBars;
+ return 0; // 默认0格
}
void ThunderBirdMainView::UpdateBatteryProcess() // 电量接收及其提醒函数
{
static bool g_isRecording = false;//是否正在录音
- /**
- * @brief CAT1消息回调函数,处理AT命令响应
- * @note 用于处理MESSAGE_4G_AT_RECEIVED消息,解析+CESQ响应
- */
- #if defined(SUPPORT_CAT1_SERVICE) || defined(SUPPORT_PPP_SERVICE)
- extern "C" {
- #endif
- static errcode_t ThunderBirdModel_Cat1MsgCallback(MESSAGE_4G_T msg, void *msg_buf, uint16_t msglen)
- {
- if (msg == MESSAGE_4G_AT_RECEIVED && msg_buf != nullptr && msglen > 0)
- {
- const char *response = (const char *)msg_buf;
-
- // 查找+CESQ响应: +CESQ: <rxlev>,<ber>,<rscp>,<ecno>,<rsrq>,<rsrp>
- const char *cesq_line = strstr(response, "+CESQ:");
- if (cesq_line != nullptr)
- {
- // 跳过"+CESQ:"
- cesq_line += 6;
- while (*cesq_line == ' ' || *cesq_line == '\t') cesq_line++;
-
- // 解析6个参数: rxlev, ber, rscp, ecno, rsrq, rsrp
- int rxlev = 99, ber = 99, rscp = 255, ecno = 255, rsrq = 255, rsrp = 255;
- int parsed = sscanf(cesq_line, "%d,%d,%d,%d,%d,%d", &rxlev, &ber, &rscp, &ecno, &rsrq, &rsrp);
-
- if (parsed == 6)
- {
- ThunderBirdModel *model = ThunderBirdModel::GetInstance();
- if (model != nullptr)
- {
- // 更新RSRQ和RSRP值
- model->UpdateRsrqRsrp(rsrq, rsrp);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel: CESQ response parsed - RSRQ=%d, RSRP=%d", rsrq, rsrp);
- }
- }
- else
- {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel: Failed to parse CESQ response, parsed: %d", parsed);
- }
- }
- }
- return ERRCODE_SUCC;
- }
- #if defined(SUPPORT_CAT1_SERVICE) || defined(SUPPORT_PPP_SERVICE)
- }
- #endif
-
- ThunderBirdModel::ThunderBirdModel() : m_nextReminderId(1), m_otaStatus(0),
+ ThunderBirdModel::ThunderBirdModel() : m_nextReminderId(1), m_otaStatus(0),
m_timeDisplayTimer(nullptr), m_statusTimer(nullptr),
m_currentStatus(DeviceStatus::IDLE),
m_statusChangeTime(0), m_lastStatusCheckTime(0),
m_countUpActive(false), m_countUpValue(0), m_countUpTarget(0),
m_currentFps(60), // 默认60FPS
m_simStatus(0), m_cat1PowerStatus(0), m_signalStrength(0),
- m_networkStatus(0), m_networkType(0),
- m_hasNetwork(false), m_networkStatusChanged(false),
- m_rsrq(255), m_rsrp(255),
- m_storyModeTimeoutTimer(nullptr)
+ m_networkStatus(0), m_networkType(0),
+ m_hasNetwork(false), m_networkStatusChanged(false),
+ m_storyModeTimeoutTimer(nullptr)
{
//设置屏幕亮度为20
// cm_set_brightness(20);
m_currentExpression = "CloseEyes";
m_currentStatusText = "发呆中...";
- // 注册CAT1消息回调函数,用于处理AT命令响应(如+CESQ)
- #ifdef SUPPORT_CAT1_SERVICE
- cat1_register_msg_callback(ThunderBirdModel_Cat1MsgCallback);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel: CAT1 message callback registered");
- #endif
RegisterAllKeyEvents();
}
return m_networkType;
}
- /**
- * @brief 获取RSRQ值 (LTE参考信号质量)
- * @return RSRQ值 (0-34有效, 255=无效)
- * @note 基于AT+CESQ命令获取
- */
- int ThunderBirdModel::GetRsrq() const
- {
- return m_rsrq;
- }
-
- /**
- * @brief 获取RSRP值 (LTE参考信号接收功率)
- * @return RSRP值 (0-97有效, 255=无效)
- * @note 基于AT+CESQ命令获取
- */
- int ThunderBirdModel::GetRsrp() const
- {
- return m_rsrp;
- }
-
- /**
- * @brief 更新RSRQ和RSRP值(供回调函数使用)
- * @param rsrq LTE参考信号质量 (0-34, 255=无效)
- * @param rsrp LTE参考信号接收功率 (0-97, 255=无效)
- */
- void ThunderBirdModel::UpdateRsrqRsrp(int rsrq, int rsrp)
- {
- m_rsrq = rsrq;
- m_rsrp = rsrp;
- }
/**
* @brief 更新网络状态信息
// 从底层API获取最新的网络状态信息
#if defined(SUPPORT_CAT1_SERVICE) || defined(SUPPORT_PPP_SERVICE)
- m_simStatus = uapi_dev_runtime_get_cat1_simstat(); // SIM卡状态
+ // m_simStatus = uapi_dev_runtime_get_cat1_simstat(); // SIM卡状态
m_cat1PowerStatus = uapi_dev_runtime_get_cat1_powerstat(); // CAT1电源状态
- m_signalStrength = uapi_dev_runtime_get_cat1_signal(); // 信号强度 (旧接口,保留兼容性)
+ m_signalStrength = cat1_api_runtime_get_cat1_signal(); // 信号强度 (旧接口,保留兼容性)
m_networkStatus = uapi_dev_runtime_get_cat1_networkstat(); // 网络连接状态
- m_networkType = uapi_dev_runtime_get_cat1_networtype(); // 网络类型
-
- // 使用AT+CESQ获取LTE信号质量信息 (RSRQ和RSRP)
- // 通过cat1_at_cmd发送AT+CESQ命令,响应通过ThunderBirdModel_Cat1MsgCallback回调处理
- #ifdef SUPPORT_CAT1_SERVICE
- // 发送AT+CESQ命令获取信号质量信息
- // 命令格式: AT+CESQ\r\n
- // 响应会通过MESSAGE_4G_AT_RECEIVED回调返回,在ThunderBirdModel_Cat1MsgCallback中解析
- static char cesq_cmd[] = "AT+CESQ\r\n";
- cat1_at_cmd(cesq_cmd);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel: AT+CESQ command sent via cat1_at_cmd");
- // 注意:m_rsrq和m_rsrp会在回调函数中更新,这里不设置默认值(保持上次的值)
- #elif defined(SUPPORT_PPP_SERVICE)
- // PPP模式下,使用ppp模块的指令获取信号强度
- ppp_network_signal_info_t signal_info = {0};
- ppp_error_t ret = ppp_at_get_network_signal_info(&signal_info);
- if (ret == PPP_ERR_OK && signal_info.valid) {
- // 更新RSRQ和RSRP值
- m_rsrq = signal_info.rsrq;
- m_rsrp = signal_info.rsrp;
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel: Network signal info updated via ppp_at_get_network_signal_info - RSRQ=%d, RSRP=%d", m_rsrq, m_rsrp);
- } else {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel: Failed to get network signal info via ppp_at_get_network_signal_info, ret=%d", ret);
- // 如果获取失败,设置为无效值
- m_rsrq = 255;
- m_rsrp = 255;
- }
- // 同时调用ppp_get_network_signal_info()来更新运行时状态(用于日志输出)
- ppp_get_network_signal_info();
- #else
- // 如果没有CAT1服务和PPP服务,设置为无效值
- m_rsrq = 255;
- m_rsrp = 255;
- #endif
+ // m_networkType = uapi_dev_runtime_get_cat1_networtype(); // 网络类型
// 更新网络连接标志位:m_networkStatus == 1表示有网络连接
m_hasNetwork = (m_networkStatus == 1);
#include "cmsis_os.h"
#include "ConfigModelC.h"
+#ifdef BOARD_LEINIAO
+#include "uart.h"
+#include <stdbool.h>
+// cat1_msleep 宏定义,用于延迟(osDelay 已在 cmsis_os.h 中声明)
+#define cat1_msleep(ms) osDelay(ms) /* osDelay(1) : 1ms */
+#endif
static uint8_t g_skip_cat1_service_udp_transfer = 0;
static f_cat1_msg_callback g_cat1_msg_callback_func=NULL;
#define PEER_IP "172.16.1.2"
f_cat1_msg_callback g_msg_callback_func=NULL;
+static f_cat1_msg_callback g_user_msg_callback_func=NULL; // 保存用户注册的回调函数
+
+#ifdef BOARD_LEINIAO
+// 前向声明(必须在所有使用该函数的地方之前)
+static int cat1_parse_cesq_response(const char *response);
+
+/**
+ * @brief 包装回调函数,用于处理AT+CESQ响应
+ */
+static errcode_t cat1_msg_callback_wrapper(MESSAGE_4G_T msg, void *msg_buf, uint16_t msglen)
+{
+ // 处理AT+CESQ响应
+ if (msg == MESSAGE_4G_AT_RECEIVED && msg_buf != NULL && msglen > 0) {
+ // 确保响应字符串以null结尾(msg_buf可能不是以null结尾的)
+ char *response = (char *)msg_buf;
+ // 检查是否是+CESQ:响应
+ // 注意:msg_buf可能包含多个响应行,需要查找+CESQ:行
+ if (msglen < 256) { // 限制大小,避免缓冲区溢出
+ // 创建一个临时缓冲区,确保以null结尾
+ char temp_buf[256] = {0};
+ uint16_t copy_len = (msglen < sizeof(temp_buf) - 1) ? msglen : (sizeof(temp_buf) - 1);
+ memcpy_s(temp_buf, sizeof(temp_buf), msg_buf, copy_len);
+ temp_buf[copy_len] = '\0';
+
+ // 检查是否是+CESQ:响应(不区分大小写,但通常是大写)
+ if (strstr(temp_buf, "+CESQ:") != NULL || strstr(temp_buf, "+cesq:") != NULL) {
+ // 解析响应并更新信号强度
+ cat1_parse_cesq_response(temp_buf);
+ }
+ }
+ }
+
+ // 调用用户注册的回调函数(如果存在)
+ if (g_user_msg_callback_func != NULL) {
+ return g_user_msg_callback_func(msg, msg_buf, msglen);
+ }
+
+ return ERRCODE_SUCC;
+}
+#endif
+
/**
* @brief 注册消息回调函数,需要用户自己实现回调函数处理逻辑
* @return 成功 ERRCODE_SUCC 或者其他失败ERRCODE .
* */
errcode_t cat1_register_msg_callback(f_cat1_msg_callback func)
{
- g_msg_callback_func=func;
+#ifdef BOARD_LEINIAO
+ // 保存用户注册的回调函数
+ g_user_msg_callback_func = func;
+ // 注册包装回调函数
+ g_msg_callback_func = cat1_msg_callback_wrapper;
+ cat1_print_dbg("cat1_getsignal: Registered wrapper callback, user callback=%p\n", func);
+#else
+ g_msg_callback_func = func;
+#endif
return ERRCODE_SUCC;
}
udp_send_msg_toCat1(UDP_CMD_MSG_ATCMD,cmd);
}
+#ifdef BOARD_LEINIAO
+/**
+ * @brief 解析AT+CESQ响应并更新信号强度
+ * @param response AT+CESQ命令的响应字符串
+ * @return 0-成功, -1-失败
+ */
+static int cat1_parse_cesq_response(const char *response)
+{
+ if (!response) {
+ return -1;
+ }
+
+ // 查找+CESQ:开头的行
+ const char *cesq_line = strstr(response, "+CESQ:");
+ if (!cesq_line) {
+ cat1_print_warning("cat1_getsignal: No +CESQ: found in response");
+ return -1;
+ }
+
+ // 跳过"+CESQ:"
+ cesq_line += 6;
+ while (*cesq_line == ' ' || *cesq_line == '\t') cesq_line++;
+
+ // +CESQ: <rxlev>,<ber>,<rscp>,<ecno>,<rsrq>,<rsrp>
+ int rxlev = 99, ber = 99, rscp = 255, ecno = 255, rsrq = 255, rsrp = 255;
+ int parsed = sscanf(cesq_line, "%d,%d,%d,%d,%d,%d", &rxlev, &ber, &rscp, &ecno, &rsrq, &rsrp);
+
+ if (parsed != 6) {
+ cat1_print_warning("cat1_getsignal: Failed to parse CESQ response, parsed: %d", parsed);
+ return -1;
+ }
+
+ int signal_strength = 0; // 默认无效值
+
+ if (rsrq != 255 && rsrp != 255 && rsrq >= 0 && rsrq <= 34 && rsrp >= 0 && rsrp <= 97) {
+ // 转换为dB和dBm
+ float rsrq_db = (float)rsrq - 20.0f;
+ float rsrp_dbm = (float)rsrp - 140.0f;
+ cat1_print_warning("cat1_getsignal: rsrq_db=%f, rsrp_dbm=%f\n", rsrq_db, rsrp_dbm);
+ // 根据RSRQ和RSRP评估信号质量
+ // RSRQ >= -6.0 且 RSRP >= -80: 信号极佳
+ // RSRQ >= -9.0 且 RSRP >= -90: 信号良好
+ // RSRQ >= -12.0 且 RSRP >= -100: 信号一般
+ // 其他: 信号较差
+ if (rsrq_db >= -6.0f && rsrp_dbm >= -80.0f) {
+ signal_strength = 4;
+ } else if (rsrq_db >= -9.0f && rsrp_dbm >= -90.0f) {
+ signal_strength = 3;
+ } else if (rsrq_db >= -12.0f && rsrp_dbm >= -100.0f) {
+ signal_strength = 2;
+ } else {
+ signal_strength = 1;
+ }
+ } else {
+ // RSRQ/RSRP无效(非4G网络或无效值)
+ cat1_print_warning("cat1_getsignal: RSRQ/RSRP invalid (rsrq=%d, rsrp=%d), signal_strength=0\n", rsrq, rsrp);
+ signal_strength = 0;
+ }
+
+ // 更新信号强度到运行时状态
+ int current_signal = cat1_api_runtime_get_cat1_signal();
+ bool signal_changed = (current_signal != signal_strength);
+ bool network_stat_changed = false;
+
+ if (signal_changed) {
+ cat1_api_runtime_set_cat1_signal(signal_strength);
+ cat1_print_warning("cat1_getsignal: Updated signal strength via AT+CESQ - signal=%d (was %d)\n",
+ signal_strength, current_signal);
+ }
+
+ // 如果信号强度有效(不是0),说明网络已连接,更新网络状态
+ if (signal_strength != 0) {
+ int current_network_stat = cat1_api_runtime_get_cat1_networkstat();
+ if (current_network_stat == 0) {
+ cat1_api_runtime_set_cat1_networkstat(1);
+ network_stat_changed = true;
+ cat1_print_dbg("cat1_getsignal: Network status updated to connected (signal=%d)\n", signal_strength);
+
+ // 通知UI网络已连接
+ if (g_msg_callback_func != NULL) {
+ g_msg_callback_func(MESSAGE_4G_NETWORK_CONNECTED, NULL, 0);
+ }
+ }
+ }
+
+ return 0;
+}
+
+/**
+ * @brief 通过UDP方式发送AT+CESQ命令获取信号强度
+ * 响应会通过MESSAGE_4G_AT_RECEIVED回调函数接收并解析
+ */
+static void cat1_getsignal_via_at_cesq(void)
+{
+ // 检查CAT1是否开机
+ if (!cat1_api_is_cat1_enabled()) {
+ cat1_print_dbg("cat1_getsignal: CAT1 is not enabled, skip AT+CESQ\n");
+ return;
+ }
+
+ // 通过UDP方式发送AT+CESQ命令
+ // 响应会通过MESSAGE_4G_AT_RECEIVED回调函数接收,在cat1_msg_callback_wrapper中解析
+ cat1_print_dbg("cat1_getsignal: Sending AT+CESQ via UDP\n");
+ cat1_at_cmd("AT+CESQ\r\n");
+}
+#endif
+
void cat1_getsignal(void)
{
+ #ifdef BOARD_LEINIAO
+ // LN平台直接使用AT+CESQ命令获取信号
+ cat1_getsignal_via_at_cesq();
+ #else
udp_send_msg_toCat1(UDP_CMD_GET_RECV_NETWORKSTAT,"0");
+ #endif
}
void cat1_gettime(void)
{
#endif
if (cat1_api_need_update_signal())
cat1_getsignal();
+ #ifdef BOARD_LEINIAO
+ cat1_gettime();
+ #endif
#ifdef SUPPORT_CHINA_MOBILE_AI_REGULATION
char device_id[128]={0};