From: Caisking Date: Tue, 1 Jul 2025 09:35:33 +0000 (+0800) Subject: 增加debug界面显示gps状态 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=99542b86762ad7b456a4d8fc2776af56e5a885e3;p=mirrors%2FFD230.git 增加debug界面显示gps状态 --- diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification.h index 45744739c..c76323349 100644 --- a/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification.h @@ -50,6 +50,7 @@ namespace OHOS std::string get_uart_at_status(void); std::string get_current_vote_status(void); std::string get_offline_log_status(void); + std::string get_gps_status_log(void); private: diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp index 145184a83..0ed7073ec 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp @@ -179,6 +179,9 @@ namespace OHOS debugOutputItemInfo[index++] = {index, "CAT1_UPDATA"}; debugOutputItemInfo[index++] = {index, "cwm_runtime_log"}; + + //gps状态日志 + debugOutputItemInfo[index++] = {index, "gps_status_log"}; usedLen = index; @@ -617,6 +620,35 @@ namespace OHOS std::string result = logModel->get_system_mem_info(); return result; } + //获取gps状态日志 + std::string DebugOutputViewEventListener::get_gps_status_log() + { + std::ostringstream result; + result << "gps_status:\n"; // 添加标题 + + auto logModel = SystemLogModel::GetInstance(); + const auto &gps_logs = logModel->get_gps_status_log(); + + // 遍历日志并拼接到结果字符串 + for (const auto &log : gps_logs) { + if(log.type == gps_status_type::GPS_SUCCESS) + { + result << "成功\n"; + } + else if(log.type == gps_status_type::GPS_FAILED) + { + result << "失败\n"; + } + std::string timestr; + if (log.timestamp == 0) { + timestr = "--"; // 默认值 + } else { + timestr = formatTime(log.timestamp); + } + result << "[" << timestr << "] "<< "\n"; + } + return result.str(); + } std::string DebugOutputViewEventListener::get_nextday_log() { std::ostringstream result; @@ -1096,6 +1128,9 @@ namespace OHOS } } break; + case 22: + str = get_gps_status_log(); + break; default: str = "--"; break;