void DebugOutputViewEventListener::InitDebugOutputItem()
{
int index = 0;
- debugOutputItemInfo[index++] = {0, "exit"}; // 标题:设置()
- debugOutputItemInfo[index++] = {1, "bt_ble_connectstat"};
- debugOutputItemInfo[index++] = {2, "cat1_runtime_status_t"};
- debugOutputItemInfo[index++] = {3, "runtime_status_t"};
- //系统日志
- debugOutputItemInfo[index++] = {4, "system_log"};
- //电池服务
- debugOutputItemInfo[index++] = {5, "battery_service"};
- //死机文件列表
- debugOutputItemInfo[index++] = {6, "shutdown_file_list"};
- //睡眠数据
- debugOutputItemInfo[index++] = {7, "sleep_time"};
- //系统空闲内存
- debugOutputItemInfo[index++] = {8, "system_free_memory"};
+ debugOutputItemInfo[index++] = {index, "exit"}; // 标题:设置()
+ debugOutputItemInfo[index++] = {index, "bt_ble_connectstat"};
+ debugOutputItemInfo[index++] = {index, "cat1_runtime_status_t"};
+ debugOutputItemInfo[index++] = {index, "runtime_status_t"};
+ // 系统日志
+ debugOutputItemInfo[index++] = {index, "system_log"};
+ // 电池服务
+ debugOutputItemInfo[index++] = {index, "battery_service"};
+ // 死机文件列表
+ debugOutputItemInfo[index++] = {index, "shutdown_file_list"};
+ // 睡眠数据
+ debugOutputItemInfo[index++] = {index, "sleep_time"};
+ // 系统空闲内存
+ debugOutputItemInfo[index++] = {index, "system_free_memory"};
// nextday执行日志
- debugOutputItemInfo[index++] = {9, "nextday_log"};
- // 读取心率
- debugOutputItemInfo[index++] = {10, "heart_rate_data"};
+ debugOutputItemInfo[index++] = {index, "nextday_log"};
+ // 读取心率
- debugOutputItemInfo[index++] = {index, "heart_rate"};
++ debugOutputItemInfo[index++] = {index, "heart_rate_data"};
+ // 弹窗日志
+ debugOutputItemInfo[index++] = {index, "popup_windows_log"};
usedLen = index;
/* -------------------------------- Add data -------------------------------- */
for (uint8_t i = 0; i < usedLen; i++)
}
// 日志服务
- std::string DebugOutputViewEventListener::get_system_log()
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DebugOutputViewEventListener::get_system_log");
-
- // 获取系统日志实例
- auto logModel = SystemLogModel::GetInstance();
- uint8_t logSize = logModel->getLogSize();
- if (logSize == 0)
- {
- return "目前没有日志";
- }
+ std::string DebugOutputViewEventListener::get_system_log()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DebugOutputViewEventListener::get_system_log");
- std::deque<SystemLogData> systemlogs = logModel->getLogData();
- std::ostringstream str;
-
- for (int i = 0; i < logSize; i++)
- {
- // 处理日志类型
- switch (systemlogs[i].type)
- {
- case SystemLogType::POWER_ON:
- str << "开机:";
- break;
- case SystemLogType::POWER_OFF:
- str << "关机:";
- break;
- case SystemLogType::RESTART:
- str << "重启:";
- break;
- case SystemLogType::FACTORY_RESET:
- str << "恢复出厂设置:";
- break;
- case SystemLogType::SOFTWARE_UPDATE:
- str << "软件更新:";
- break;
- default:
- str << "UNKNOWN:";
- break;
- }
+ // 获取系统日志实例
+ auto logModel = SystemLogModel::GetInstance();
+ uint8_t logSize = logModel->getLogSize();
+ if (logSize == 0)
+ {
+ return "目前没有日志";
+ }
+
+ std::deque<SystemLogData> systemlogs = logModel->getLogData();
+ std::ostringstream str;
+
+ for (int i = 0; i < logSize; i++)
+ {
+ // 处理日志类型
+ switch (systemlogs[i].type)
+ {
+ case SystemLogType::POWER_ON:
+ str << "开机:";
+ break;
+ case SystemLogType::POWER_OFF:
+ str << "关机:";
+ break;
+ case SystemLogType::RESTART:
+ str << "重启:";
+ break;
+ case SystemLogType::FACTORY_RESET:
+ str << "恢复出厂设置:";
+ break;
+ case SystemLogType::SOFTWARE_UPDATE:
+ str << "软件更新:";
+ break;
+ default:
+ str << "UNKNOWN:";
+ break;
+ }
- // 格式化时间
- char labelTime[20];
- std::string timestr;
- if (uapi_get_TIME_STR(systemlogs[i].timestamp, labelTime, '.', ':', DATE_Y_M_D_H_M) != ERRCODE_SUCC)
- {
- timestr = "--";
+ // 格式化时间
+ std::string timestr;
+ if (systemlogs[i].timestamp == 0) {
+ timestr = "--"; // 默认值
+ } else {
+ timestr = formatTime(systemlogs[i].timestamp);
}
- else
- {
- timestr = labelTime;
- }
-
- str << "[" << timestr << "] " << "\n"; // 拼接日志内容
- }
+
+ str << "[" << timestr << "] "<< "\n"; // 拼接日志内容
+ }
return str.str(); // 返回拼接后的字符串
}
return result;
}
- //获取nextday执行日志
- std::string DebugOutputViewEventListener::get_nextday_log() {
- std::ostringstream result;
- result << "nextday_log:\n"; // 添加标题
+ std::string DebugOutputViewEventListener::get_nextday_log()
+ {
+ std::ostringstream result;
+ result << "nextday_log:\n"; // 添加标题
- auto logModel = SystemLogModel::GetInstance();
- const auto& nextday_logs = logModel->get_nextday_log();
+ auto logModel = SystemLogModel::GetInstance();
+ const auto &nextday_logs = logModel->get_nextday_log();
- // 遍历日志并拼接到结果字符串
- for (const auto &log : nextday_logs)
- {
- // 格式化时间
- char labelTime[20];
- std::string timestr;
-
- // 调用时间格式化函数
- if (uapi_get_TIME_STR(log, labelTime, '.', ':', DATE_Y_M_D_H_M) != ERRCODE_SUCC)
- {
- timestr = "--"; // 如果获取时间失败,使用默认值
- }
- else
- {
- timestr = labelTime; // 成功获取时间
- }
-
- result << "[" << timestr << "] "; // 使用格式化后的时间拼接日志记录
- }
+ // 遍历日志并拼接到结果字符串
+ for (const auto &log : nextday_logs) {
+ std::string timestr;
+ if (log == 0) {
+ timestr = "--"; // 默认值
+ } else {
+ timestr = formatTime(log);
+ }
+ result << "[" << timestr << "] "; // 使用格式化后的时间拼接日志记录
+ }
return result.str();
+ return result.str();
}
// 定义心率数据文件夹的路径