From: hcj <1224667075@qq.com> Date: Sat, 28 Dec 2024 09:15:37 +0000 (+0800) Subject: 增加时间保存runtimelog X-Git-Tag: v1.3.113-repair_tp~56^2~1 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F1581%2F1;p=mirrors%2FFD230.git 增加时间保存runtimelog --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemLogModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemLogModel.cpp index 8de463f01..571815998 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemLogModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemLogModel.cpp @@ -39,6 +39,8 @@ void report_log(OHOS::SystemLogType type) { OHOS::SystemLogData systemlog; systemlog.timestamp = OHOS::SystemLogModel::GetInstance()->GetCurrentTime(); systemlog.type = type; + uapi_save_runtime_log_Time(); + // 存储日志 OHOS::SystemLogModel::GetInstance()->saveLog(systemlog); diff --git a/code/sdk/drivers/peripheral/utils/custom_save_runtime.c b/code/sdk/drivers/peripheral/utils/custom_save_runtime.c index fbc522e19..4785050e4 100644 --- a/code/sdk/drivers/peripheral/utils/custom_save_runtime.c +++ b/code/sdk/drivers/peripheral/utils/custom_save_runtime.c @@ -50,6 +50,9 @@ #include "unistd.h" +#include "custom_save_runtime.h" + + #define RUNTIME_LOG_SAVE_PATH EXC_TAR_PATH @@ -92,6 +95,35 @@ errcode_t uapi_save_runtime_log(uint16_t cmd) return ERRCODE_SUCC; } +errcode_t uapi_save_runtime_log_Time(void) +{ + int ret; + + custom_cmd_t mail = {0}; + time_t currtime; + time(&currtime); + mail.cmd = RUNTIME_LOG_RTC_TIME; + mail.time= (uint32_t)(currtime); + + PRINT("uapi_save_runtime_log_Time:%d\r\n",mail.time); + + if(custom_running_log_state_stat==0 || g_runtime_log_queue_created==0) + { + PRINT("Error task or queue no ready\r\n"); + return ERRCODE_FAIL; + } + ret = osal_msg_queue_write_copy(g_custom_runtime_log_cmd_queue, (void *)&mail, sizeof(custom_cmd_t), 0); + + if (ret != OSAL_SUCCESS) + { + // PRINT("Error custom_cmd Check MSG 0x%02X send failed! err=0x%x! \r\n", cmd, ret); + return ERRCODE_FAIL; + } + + return ERRCODE_SUCC; + +} + #define RUNTIME_FILE_PATH "%s/%s_runtime_%d.bin" void create_runtime_log_path(char *path,uint16_t max_len,uint8_t count) @@ -148,7 +180,7 @@ static void custom_save_runtime_log_service_task(void const *arg) uint32_t msgsize = (uint32_t)sizeof(custom_cmd_t); custom_running_log_state_stat = true; int code=0; - + while (1) { ret = osal_msg_queue_read_copy(g_custom_runtime_log_cmd_queue, (void *)&mail, &msgsize, diff --git a/code/sdk/drivers/peripheral/utils/custom_save_runtime.h b/code/sdk/drivers/peripheral/utils/custom_save_runtime.h index 6fe865f1d..7f917886e 100644 --- a/code/sdk/drivers/peripheral/utils/custom_save_runtime.h +++ b/code/sdk/drivers/peripheral/utils/custom_save_runtime.h @@ -238,15 +238,19 @@ extern "C" RUNTIME_LOG_BLE_CONNECT_UPDATE =0x1400,//ble连接参数 - + RUNTIME_LOG_RTC_TIME =0x1500, //时间记录 //电压变化 RUNTIME_LOG_BAT_VOL_LOW = 0xe000, //3V RUNTIME_LOG_BAT_VOL_HIGH =0xf000, //4V + + } runtime_log_cmd_Id; errcode_t uapi_save_runtime_log(uint16_t cmd); + errcode_t uapi_save_runtime_log_Time(void); + errcode_t uapi_runtime_log_service_init(void); #ifdef __cplusplus