\r
#ifdef ENABLE_CUSTOM_I2C\r
#include "custom_utils.h"\r
+#include "custom_save_runtime.h"\r
+\r
#endif\r
\r
#ifdef SUPPORT_A5133_SERVICE\r
* \r
*/\r
ConfigModelInit();\r
-\r
+ \r
+ uapi_runtime_log_service_init();\r
\r
#if DSP_EXIST == YES\r
audio_init();\r
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "xxxxxxxxxxxxx");
PhoneServiceScreenCtr(false);
- if(NativeAbility::GetInstance().GetCurSliceId() == VIEW_INCOMING_CALL || NativeAbility::GetInstance().GetCurSliceId() == VIEW_BLUETOOTH_EARPHONE)
+ if(NativeAbility::GetInstance().GetCurSliceId() == VIEW_INCOMING_CALL)
{
NativeAbility::GetInstance().Back_CountSlice_make_phone();
}
- else if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_REBOOTANDSHUTDOWN )
+ else if (!uapi_dev_runtime_get_train_status())// || NativeAbility::GetInstance().GetCurSliceId() == VIEW_BLUETOOTH_EARPHONE )
{
NativeAbility::GetInstance().ClearSliceIdStack();
}
#include "soc_osal.h"
#include "stack"
#include "wearable_log.h"
-// #include "AppViewIDs.h"
+#include "AppViewIDs.h"
namespace OHOS {
const static uint16_t gSliceInvalid = 0;
const static uint16_t gSliceDefaultPriority = 4; // 页面默认是最低优先级
}
//仅用于打电话结束恢复时使用
bool Back_CountSlice_make_phone(const TransitionType transitionId = TransitionType::TRANSITION_INVALID,
- const uint16_t priority = gSliceDefaultPriority) {
- if(!backStack_.empty())
- {
- // 如果此时 backStack_ 栈不为空,取出栈顶的切片 ID ,并调用 ChangeSlice 切换到该切片,返回 true 。
- uint16_t preSlice = backStack_.top();
- backStack_.pop();
- ChangeSlice(preSlice,transitionId,priority);
- return true;
- }
- else
- {
- //如果 backStack_ 栈为空,切换到默认切片,返回 false 。
- ChangeSlice(defaultSliceId_, transitionId, priority);
- return false; // 返回false表示无前一个slice,退回到默认slice
- }
- }
+ const uint16_t priority = gSliceDefaultPriority);
+
bool make_phone_push(uint16_t preSlice) {
if(backStack_.empty())
curSlicePriority_ = gSliceDefaultPriority;
}
}
+
+ bool Ability::Back_CountSlice_make_phone(const TransitionType transitionId,
+ const uint16_t priority ) {
+ if(!backStack_.empty())
+ {
+ // 如果此时 backStack_ 栈不为空,取出栈顶的切片 ID ,并调用 ChangeSlice 切换到该切片,返回 true 。
+ uint16_t preSlice = backStack_.top();
+ backStack_.pop();
+
+ #ifdef FD230
+ if(preSlice!=VIEW_INCOMING_CALL)
+ ChangeSlice(preSlice,transitionId,priority);
+ else
+ ChangeSlice(defaultSliceId_, transitionId, priority);
+ #endif
+ return true;
+ }
+ else
+ {
+ //如果 backStack_ 栈为空,切换到默认切片,返回 false 。
+ ChangeSlice(defaultSliceId_, transitionId, priority);
+ return false; // 返回false表示无前一个slice,退回到默认slice
+ }
+ }
+
} // namespace OHOS
OTA_UPDATA_FAIL,
+ FILE_IS_DONE,
+
TRANS_FREE,
} transmitting_type;
BR_TRANSFER_timer = NULL;\r
}\r
ble_read_timer_p=NULL;\r
+\r
+ TRANSMIT_DATA=FILE_IS_DONE;\r
+ \r
+ CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1);\r
+\r
+\r
ble_reply_cmd(OTA_FILE_SUCC_CMD,1);//接收成功\r
}\r
\r
BR_TRANSFER_timer = NULL;\r
}\r
ble_read_timer_p=NULL;\r
+ TRANSMIT_DATA=FILE_IS_DONE;\r
+\r
+ CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1);\r
\r
ble_reply_cmd(FILE_RECV_REPLY_STAT_CMD,1);//接收成功\r
}\r
{
CallerLogModel::GetInstance()->tempSetoperateNumberCAT1(call_data,req->len);
- NotificationManager::GetInstance()->SetWatchCallStatus(true);
cat1_phone_state_change_cb(OPERATE_WAITING);
free(call_data);
}
CallerLogModel::GetInstance()->SetoperateNumber(call_data,strlen(call_data));
- CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
- NotificationManager::GetInstance()->SetWatchCallStatus(true);
+
// NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
cat1_phone_state_change_cb(OPERATE_INCOMING);
cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLCONNTED,NULL);
#endif
- CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
-
SetMicMutecat1(false);
cat1_phone_state_change_cb(OPERATE_WATCH_ACTIVE);
- NotificationManager::GetInstance()->SetWatchCallStatus(true);
+
}
#endif
CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
- CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
- NotificationManager::GetInstance()->SetWatchCallStatus(true);
-
-
cat1_phone_state_change_cb(OPERATE_DIALING);
#ifdef SUPPORT_CAT1_HFP_AG_SERV
if(headset_Is_connect())
if(transmittingISShow())
NotificationManager::GetInstance()->StopNotify();
}
+ else if (data[0]==FILE_IS_DONE)
+ {
+ set_transmittingShow_falg(data[0]);
+ }
else
{
set_transmittingShow_falg(data[0]);
#include "displaybrightness/include/DisplayBrightnessModel.h"
#include "ppg_service.h"
#include "diag_log.h"
+
+#include "ConfigModelC.h"
namespace OHOS
{
/**************************************************************************************************** */
//心率广播
debugOutputItemInfo[index++] = {index, "hrs_ble_swtich"};
+ debugOutputItemInfo[index++] = {index, "save_runtime_log_swtich"};
+
+
usedLen = index;
/* -------------------------------- Add data -------------------------------- */
for (uint8_t i = 0; i < usedLen; i++)
}
return true; //进行UI刷新
}
+ else if (viewId == "runtime_log_is_save")
+ {
+ if (toggleButtonOffline) {
+ if (toggleButtonOffline->GetState() == false) {
+ set_save_runtime_log_switch(1);
+ }
+ else {
+ set_save_runtime_log_switch(0);
+ }
+ } else {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"组件不存在");
+ }
+ return true; //进行UI刷新
+ }
+
else if (viewId == NEXTORPREPAGELABELBUTTON)
{
// std::string str;
}
}
break;
+ case 19:
+ // str = get_hrs_ble_status();
+ str = "runtime_log_is_save";
+ if(toggleButtonOffline)
+ {
+ if(toggleButtonOffline->IsVisible() == false)
+ {
+ toggleButtonOffline->SetState(get_save_runtime_log_switch());
+ toggleButtonOffline->SetViewId("runtime_log_is_save");
+ toggleButtonOffline->SetVisible(true);
+ }
+ }
+ break;
default:
str = "--";
break;
static void DialingHandle(void)
{
+
+ CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
+ NotificationManager::GetInstance()->SetWatchCallStatus(true);
+
CallerLogModel::GetInstance()->SetDialingStatus("正在拨号");
CallerLogModel::GetInstance()->SetMakePhoneStatus(true);
{
CallerLogModel::GetInstance()->SetMakePhoneStatus(false);
+ CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
+ NotificationManager::GetInstance()->SetWatchCallStatus(true);
+
InitCallingTimer();
static void WaitingOpreate()
{
{
+ // CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
+ NotificationManager::GetInstance()->SetWatchCallStatus(true);
+
cat1_call_hungup();
CustomEventPublish(TOPIC_EVENT_HFP_HINT,NULL,0);
CallerLogModel::GetInstance()->set_RejectIncomingCall_falg(1);
static void WatchActiveHandle()
{
+
+ CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
+ NotificationManager::GetInstance()->SetWatchCallStatus(true);
+
InitCallingTimer();
CallerLogModel::GetInstance()->SetCallStatus(true);
CallerLogModel::GetInstance()->SetWaitingStatus(false);
CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE_TIME, //运动目标距离
CONFIGMODEL_ITEM_URAT_AT_CONTROL_STATUS,//串口控制状态
+
+ CONFIGMODEL_ITEM_SAVE_RUNTIMR_LOG_STATUS,//运行日志保存
CONFIGMODEL_ITEM_MAX,
{ConfigDataType::DATATYPE_INT, "goal_duration_time", "1" },// CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION, //运动目标时长 30(分钟)
{ConfigDataType::DATATYPE_INT, "goal_distance_time", "1" },// CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE, //运动目标距离 8.0(km)
{ConfigDataType::DATATYPE_INT, "urat_at_status", "false" },//CONFIGMODEL_ITEM_URAT_AT_CONTROL_STATUS // 串口AT 默认 关闭
+ {ConfigDataType::DATATYPE_INT, "runtime_log_status", "0" },//CONFIGMODEL_ITEM_SAVE_RUNTIMR_LOG_STATUS,//运行日志保存
+
};
ConfigModel(); // 私有构造函数,确保无法在外部实例化
/*停止音乐播放*/
void mmi_stop_music_play(void);
+void set_save_runtime_log_switch(int value);
+
+int get_save_runtime_log_switch(void);
+
+
#ifdef __cplusplus
#if __cplusplus
}
stopPlayingMusic();
}
+
+void set_save_runtime_log_switch(int value)
+{
+ OHOS::ConfigModel::GetInstance()->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SAVE_RUNTIMR_LOG_STATUS,value);
+}
+
+int get_save_runtime_log_switch(void)
+{
+ return OHOS::ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SAVE_RUNTIMR_LOG_STATUS);
+}
#ifdef __cplusplus
#if __cplusplus
}
${CMAKE_CURRENT_SOURCE_DIR}/pdu.c
${CMAKE_CURRENT_SOURCE_DIR}/microtar.c
${CMAKE_CURRENT_SOURCE_DIR}/custom_resfile_check.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/custom_save_runtime.c
+
)
set(PUBLIC_HEADER
--- /dev/null
+/**
+ * Copyright (c) @CompanyNameMagicTag 2022-2022. All rights reserved. \n
+ *
+ * Description: Test adc source \n
+ * Author: @CompanyNameTag \n
+ * History: \n
+ * 2022-08-16, Create file. \n
+ */
+#include "pinctrl.h"
+#include "debug_print.h"
+#include "soc_osal.h"
+#include "tcxo.h"
+#include "irmalloc.h"
+#include "errcode.h"
+#include "common_def.h"
+
+#include "chip_core_irq.h"
+#include "chip_io.h"
+#include "gpio.h"
+#include "pm_veto.h"
+
+#include "rtc.h"
+#include "timer.h"
+#include "systick.h"
+
+#include "tcxo.h"
+
+#include "cmsis_os2.h"
+
+#include "los_printf.h"
+
+#include "custom_utils.h"
+
+#include "BluetoothModelC.h"
+
+#include "PhoneServiceC.h"
+
+#include "ui_serviceC.h"
+
+#include "bletest.h"
+
+#include "safemodemanager/include/SafeModeManagerModelC.h"
+#include "set_dial/include/SetDialModelC.h"
+
+#include "alarmclocktimerconfig/include/AlarmClockTimerConfig.h"
+
+#include <dirent.h>
+
+#define RUNTIME_LOG_SAVE_PATH EXC_TAR_PATH
+
+
+
+typedef struct
+{
+ uint16_t cmd;
+ uint32_t time;
+} custom_cmd_t;
+
+static unsigned long g_custom_runtime_log_cmd_queue= 0xFFFFFFFF;
+static uint8_t custom_running_log_state_stat=0;
+static bool g_runtime_log_queue_created = 0;
+
+static char save_path[128]={0};
+
+
+errcode_t uapi_save_runtime_log(uint16_t cmd)
+{
+ int ret;
+
+ custom_cmd_t mail = {0};
+ mail.cmd = (uint16_t)cmd;
+ mail.time= (uint32_t)get_local_timestamp();
+
+ if(custom_running_log_state_stat==0 || g_runtime_log_queue_created==0)
+ {
+ 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)
+{
+ char buildversion[64]={0};
+ uapi_get_buildversion((uint8_t*)&buildversion[0],sizeof(buildversion));
+
+ sprintf_s(path,max_len,RUNTIME_FILE_PATH,RUNTIME_LOG_SAVE_PATH,buildversion,count);
+}
+
+
+uint8_t uapi_runtime_file_count(char *folderpath)
+{
+ DIR *dir;
+ struct dirent *entry;
+ uint8_t count = 0;
+
+ dir = opendir(folderpath);
+ if (dir == NULL)
+ {
+ PRINT("open %s failed \n",folderpath);
+ return 0;
+ }
+
+ while ((entry = readdir(dir))!= NULL) //遍历tar文件找到时间戳最老的文件名
+ {
+ if (strstr(entry->d_name, "_runtime_")!= NULL)
+ {
+ count++;
+
+ }
+ }
+
+ closedir(dir);
+ return count;
+}
+
+
+static void custom_save_runtime_log_service_task(void const *arg)
+{
+
+ int32_t ret;
+ custom_cmd_t mail;
+ 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,
+ OSAL_MSGQ_WAIT_FOREVER);
+ if (ret != OSAL_SUCCESS)
+ {
+ continue;
+ }
+
+ FILE *fp=fopen(save_path,"ab+");
+ if(fp)
+ {
+ int ret= fwrite(&mail.cmd,sizeof(mail.cmd),1,fp);
+ if(ret!=1)
+ {
+ printf("[custom_save_runtime_log_service_task],save_fail%d \n",__LINE__);
+
+ uint8_t file_count= uapi_runtime_file_count(RUNTIME_LOG_SAVE_PATH);
+ create_runtime_log_path(save_path,128,file_count);
+
+ }
+ ret= fwrite(&mail.time,sizeof(mail.time),1,fp);
+ if(ret!=1)
+ {
+ printf("[custom_save_runtime_log_service_task],save_fail%d \n",__LINE__);
+
+ uint8_t file_count= uapi_runtime_file_count(RUNTIME_LOG_SAVE_PATH);
+ create_runtime_log_path(save_path,128,file_count);
+
+ }
+ }
+ else
+ {
+ printf("[custom_save_runtime_log_service_task],save_fail%d \n",__LINE__);
+ uint8_t file_count= uapi_runtime_file_count(RUNTIME_LOG_SAVE_PATH);
+ create_runtime_log_path(save_path,128,file_count);
+
+ }
+ fclose(fp);
+
+ }
+}
+#define CUSTOM_RUNTIME_LOG_COUNT 1000
+
+#define CUSTOM_RUNTIME_LOG_TASK_SIZE 0x1000
+#define CUSTOM_CMD_BOARD_TASK_PRIO 7
+
+void create_runtime_log_queue(void)
+{
+ if (osal_msg_queue_create("custom_runtime_log_queue", CUSTOM_RUNTIME_LOG_COUNT, &g_custom_runtime_log_cmd_queue,
+ 0, sizeof(custom_cmd_t)) != ERRCODE_SUCC)
+ {
+ printf("[custom_cmd][service] app create mail fail\n");
+ g_runtime_log_queue_created = 0;
+ }else{
+ g_runtime_log_queue_created = 1;
+ }
+}
+errcode_t uapi_runtime_log_service_init(void)
+{
+
+ PRINT("uapi_custom_cmd_service_init !\r\n");
+
+ if(get_save_runtime_log_switch()==0)
+ return ERRCODE_FAIL;
+
+
+ app_task_definition_t taskcfg = {0};
+ taskcfg.create_queue_handle = create_runtime_log_queue;
+ taskcfg.attr.name = "custom_runtime_log_service";
+ taskcfg.attr.priority = osPriorityNormal;
+ taskcfg.attr.stack_size = CUSTOM_RUNTIME_LOG_TASK_SIZE;
+ taskcfg.func = custom_save_runtime_log_service_task;
+ taskcfg.use_mem = USE_EXTEND_MEM;
+
+ errcode_t ret = uapi_create_osThread_custom(&taskcfg);
+ uint8_t file_count= uapi_runtime_file_count(RUNTIME_LOG_SAVE_PATH);
+ create_runtime_log_path(save_path,128,file_count);
+
+
+ if (ret != ERRCODE_SUCC)
+ {
+ PRINT("create custom_cmd_service failed %d!\r\n", ret);
+ return ERRCODE_FAIL;
+ }
+
+ return ERRCODE_SUCC;
+}
--- /dev/null
+/**
+ * Copyright (c) @CompanyNameMagicTag 2022-2022. All rights reserved. \n
+ *
+ * Description: Provides at cmd register func \n
+ * Author: @CompanyNameTag \n
+ * History: \n
+ * 2022-07-20, Create file. \n
+ */
+#ifndef CUSTOM_RUNTIME_LOG_H
+#define CUSTOM_RUNTIME_LOG_H
+
+#include <stdint.h>
+#include <stdio.h>
+#include "errcode.h"
+#ifdef __cplusplus
+#if __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+#endif /* __cplusplus */
+
+
+typedef enum {
+ //开机关机
+ RUNTIME_LOG_POWER_MIN =0x0000,
+ //蓝牙
+ RUNTIME_LOG_POWER_BLE_MIN=0x0100,
+ //cat1
+ RUNTIME_LOG_POWER_CAT1_MIN=0x0200,
+
+
+} runtime_log_cmd_Id;
+
+
+
+
+errcode_t uapi_save_runtime_log(uint16_t cmd);
+
+errcode_t uapi_runtime_log_service_init(void);
+
+#ifdef __cplusplus
+#if __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __cplusplus */
+
+#endif
#include "battery_service.h"
#include "cywee_hal.h"
#include "broadcast_feature.h"
+#include "custom_save_runtime.h"
static uint32_t BLE_TEST(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
{
case 19:
uapi_ble_connect_param_update(type_2);
break;
-
+ case 20:
+ uapi_save_runtime_log(0x0001);
+ break;
+
default:
break;
}