Merge #1323 into sdk602patch0911 from refs/changes/1323/head 1324/target/1
author罗正 <1732036298@qq.com>
Sat, 2 Nov 2024 11:19:46 +0000 (11:19 +0000)
committer袁清梦 <3449750381@qq.com>
Sat, 2 Nov 2024 11:19:46 +0000 (11:19 +0000)
Code review from 罗正

* refs/changes/1323/head: (9 commits squashed)

  - ScreenTurnOn与ScreenTurnOff配套使用优化

  - 解决蓝牙耳机按键退出有概率不取消常亮屏

  - Merge branch &#39;sdk602patch0911&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911

  - Merge branch &#39;sdk602patch0911&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911

  - Merge branch &#39;sdk602patch0911&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911

  - 时间同步算法采用海思原本代码

  - 喝水提醒,久坐提醒,运动识别弹窗时间保存采用队列方式

  - Merge branch &#39;sdk602patch0911&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911

  - 表盘:增加电量字符串数据类型

Signed-off-by: 罗正 <1732036298@qq.com>
Reviewed-by: Caisking <3449750381@qq.com>
Reviewed-by: 罗正 <1732036298@qq.com>
Reviewed-by: aliyun8003852482 <1224667075@qq.com>
Reviewed-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Reviewed-by: aliyun6865282430 <1624952103@qq.com>
Merged-by: Caisking <3449750381@qq.com>
link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/1323
15 files changed:
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialDataBase.h
code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelPowerStr.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelPowerStr.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/system/include/SystemLogModel.h
code/sdk/application/wearable/fd230app/nativeui/system/include/SystemLogModelC.h
code/sdk/application/wearable/fd230app/nativeui/system/src/SystemLogModel.cpp
code/sdk/application/wearable/service/msg_center/src/notify/drinkReminder_notification.cpp
code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp
code/sdk/application/wearable/service/msg_center/src/notify/sedentaryReminder_notification.cpp
code/sdk/drivers/chips/brandy/porting/liteos/riscv70/tick_timer.c
code/sdk/drivers/peripheral/utils/custom_fileoperate_service.c
code/sdk/drivers/peripheral/utils/custom_utils.h
tools/dial_converter_tool/dial_lzma/105/kitty.lzma
tools/dial_converter_tool/instance/105/kitty.xml

index 0fa4f00..aca3437 100644 (file)
@@ -182,6 +182,7 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/DialModelStepgoal.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/DialModelSecondMapper.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/DialModelPowerMapper.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/DialModelPowerStr.cpp
     #exception handling
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/heart_blood/CheckAbnormalView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/heart_blood/CheckAbnormalPresenter.cpp
index c15165f..3f16aba 100644 (file)
@@ -50,6 +50,7 @@ enum class DialDataType {
   DATA_TYPE_WEATHER_STR,        // 天气(string)
   DATA_TYPE_TIMESTR_STR,        // 时间(string)
   DATA_TYPE_DATE_WEEK_STR,      // 日期星期(string)
+  DATA_TYPE_POWER_STR,          // 电量(string)
 
   DATA_TYPE_MAX = 0x7fff, // 数据类型的最大值
 };
diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelPowerStr.h b/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelPowerStr.h
new file mode 100644 (file)
index 0000000..2babe9d
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-11-02 18:09:28
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-11-02 18:17:44
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelPowerStr.h
+ */
+
+
+#ifndef DIAL_MODEL_POWER_STR_H
+#define DIAL_MODEL_POWER_STR_H
+
+#include "DialBaseModel.h"
+#include <cstdint>
+#include <string>
+
+namespace OHOS
+{
+    class DialModelPowerStr : public DialBaseModel
+    {
+    public:
+        DialModelPowerStr() {}
+        virtual ~DialModelPowerStr() {}
+        static DialModelPowerStr *GetInstance()
+        {
+            static DialModelPowerStr instance;
+            return &instance;
+        }
+        bool GetDialTextData(DialDataType &type, std::string *&out, int16_t &strNum) override;
+        void UpdateTimeStr(const std::string dialPowerStr);
+
+    private:
+        std::string dialPowerStr_;
+    };
+} // namespace OHOS
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelPowerStr.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelPowerStr.cpp
new file mode 100644 (file)
index 0000000..82f44ba
--- /dev/null
@@ -0,0 +1,31 @@
+#include "main/include/dial/DialModelPowerStr.h"
+#include "main/include/dial/RegisterDialModel.h"
+#include "wearable_log.h"
+#include "battery_hal.h"
+extern uint8_t battery_get_voltage(float *voltage);
+
+namespace OHOS
+{
+    REGIST_DIAL_MODULE(DialDataType::DATA_TYPE_POWER_STR,OHOS::DialModelPowerStr::GetInstance());
+
+    bool DialModelPowerStr::GetDialTextData(DialDataType &type, std::string *&out, int16_t &strNum)
+    {
+        (void)type;
+        float voltage = 0.0F;
+        uint8_t power_ = battery_get_voltage(&voltage);
+        dialPowerStr_ = std::to_string(power_) + "%";
+        out = &dialPowerStr_;
+        strNum = 1;
+        return true;
+    }
+
+    void DialModelPowerStr::UpdateTimeStr(const std::string dialPowerStr)
+    {
+        dialPowerStr_.clear();
+        dialPowerStr_ = dialPowerStr; // 更新字符串
+        if (onChangeListener_ != nullptr)
+        {
+            onChangeListener_->OnDialTextDataUpdate(DialDataType::DATA_TYPE_POWER_STR, &dialPowerStr_, 1);
+        }
+    }
+}
\ No newline at end of file
index 1f86378..aa32dcb 100644 (file)
@@ -103,6 +103,7 @@ public:
     size_t get_nextday_log_size() const;//获取日志大小
     /* ------------------------------ popup_windows 日志记录----------------------------- */
     bool save_popup_windows_log(popup_windows_log_data data);                // 保存popup_windows日志
+    void save_popup_windows_log_type(int type);                              // 保存popup_windows日志
     bool load_popup_windows_log();                                           // 加载popup_windows日志
     const std::deque<popup_windows_log_data> &get_popup_windows_log() const; // 获取popup_windows日志记录(常量引用)
     size_t get_popup_windows_log_size() const;                               // 获取日志大小
index e4fd948..2eb82eb 100644 (file)
@@ -15,6 +15,7 @@ void update_version_report_log(void);
 void start_report_nextday_log_start(void);
 void start_report_nextday_log_end(void);
 void nextday_clear_popup_windows_log(void);
+void save_popup_windows_log_c(int type);
 
 
 #ifdef __cplusplus
index 11321a4..68a3a2c 100644 (file)
@@ -76,6 +76,10 @@ void start_report_nextday_log_end(void) {
 void nextday_clear_popup_windows_log(void) {
   OHOS::SystemLogModel::GetInstance()->clear_popup_windows_log();
 }
+void save_popup_windows_log_c(int type)
+{
+  OHOS::SystemLogModel::GetInstance()->save_popup_windows_log_type(type);
+}
 }
 
 namespace OHOS {
@@ -344,6 +348,26 @@ bool SystemLogModel::save_popup_windows_log(popup_windows_log_data data) {
   return true;
 }
 
+void SystemLogModel::save_popup_windows_log_type(int type)
+{
+    popup_windows_log_data data;
+    data.timestamp = GetCurrentTime();
+    switch(type)
+    {
+      case 0:
+        data.type = popup_windows_type::MOTION_RECOGNITION;
+        break;
+      case 1:
+        data.type = popup_windows_type::DRINK_WATER_REMINDER;
+        break;
+      case 2:
+        data.type = popup_windows_type::SEDENTARY_REMINDER;
+        break;
+      default:
+        break;
+    }
+    save_popup_windows_log(data);
+}
 bool SystemLogModel::load_popup_windows_log() {
   std::ifstream inFile(SYSTEM_LOG_FILE_PATH_POPUP_WINDOWS);
   if (!inFile) {
index b9b4a1f..9ad8731 100644 (file)
@@ -106,10 +106,12 @@ namespace OHOS
     //记录喝水提醒日志
     void DrinkReminderViewEventListener::record_drink_reminder_log(void)
     {
-        popup_windows_log_data systemlog;
-        systemlog.type = popup_windows_type::DRINK_WATER_REMINDER;
-        systemlog.timestamp = SystemLogModel::GetInstance()->GetCurrentTime();
-        SystemLogModel::GetInstance()->save_popup_windows_log(systemlog);
+        // popup_windows_log_data systemlog;
+        // systemlog.type = popup_windows_type::DRINK_WATER_REMINDER;
+        // systemlog.timestamp = SystemLogModel::GetInstance()->GetCurrentTime();
+        // SystemLogModel::GetInstance()->save_popup_windows_log(systemlog);
+        uint8_t type =  1;
+        do_custom_fileoperate_service_check_msg(CUSTOM_FILEOPERATE_MSG_TYPE_POPUP_WINDOWS_DATA_LIST, &type, sizeof(type));
     }
 
     /*创建喝水提醒视图*/
index c9f2fcd..4e8328f 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-08-17 16:44:20
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-10-18 20:25:43
+ * @LastEditTime: 2024-11-02 14:26:15
  * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp
  */
 #include "notification_manager.h"
@@ -23,6 +23,7 @@
 #include "vibrator_service.h"
 #include "custom_runtime.h"
 #include "system/include/SystemLogModel.h"
+#include <custom_utils.h>
 namespace OHOS
 {
 
@@ -162,10 +163,12 @@ namespace OHOS
     // 记录运动识别日志
     void MotionRecognitionViewEventListener::record_motion_recognition_log(void)
     {
-        popup_windows_log_data systemlog;
-        systemlog.timestamp = SystemLogModel::GetInstance()->GetCurrentTime();
-        systemlog.type = popup_windows_type::MOTION_RECOGNITION;
-        SystemLogModel::GetInstance()->save_popup_windows_log(systemlog);
+        // popup_windows_log_data systemlog;
+        // systemlog.timestamp = SystemLogModel::GetInstance()->GetCurrentTime();
+        // systemlog.type = popup_windows_type::MOTION_RECOGNITION;
+        // SystemLogModel::GetInstance()->save_popup_windows_log(systemlog);
+        uint8_t type =  0;
+        do_custom_fileoperate_service_check_msg(CUSTOM_FILEOPERATE_MSG_TYPE_POPUP_WINDOWS_DATA_LIST, &type, sizeof(type));
     }
 
     static std::string UpdateNoteLabelText(UILabelExt *&label, const std::string &newText, int id)
index e24b7ef..d38c12c 100644 (file)
@@ -17,6 +17,7 @@
 #include "vibrator_service.h"
 #include "custom_runtime.h"
 #include "system/include/SystemLogModel.h"
+#include <custom_utils.h>
 
 namespace OHOS
 {
@@ -93,10 +94,12 @@ namespace OHOS
     // 记录久坐提醒日志
     void SedentaryReminderViewEventListener::record_sedentary_reminder_log(void)
     {
-        popup_windows_log_data systemlog;
-        systemlog.timestamp = SystemLogModel::GetInstance()->GetCurrentTime();
-        systemlog.type = popup_windows_type::SEDENTARY_REMINDER;
-        SystemLogModel::GetInstance()->save_popup_windows_log(systemlog);
+        // popup_windows_log_data systemlog;
+        // systemlog.timestamp = SystemLogModel::GetInstance()->GetCurrentTime();
+        // systemlog.type = popup_windows_type::SEDENTARY_REMINDER;
+        // SystemLogModel::GetInstance()->save_popup_windows_log(systemlog);
+        uint8_t type =  2;
+        do_custom_fileoperate_service_check_msg(CUSTOM_FILEOPERATE_MSG_TYPE_POPUP_WINDOWS_DATA_LIST, &type, sizeof(type));
     }
 
     static std::string UpdateNoteLabelText(UILabelExt *&label, const std::string &newText, int id)
index da092c1..9e9712c 100755 (executable)
@@ -143,19 +143,18 @@ uint64_t HalClockGetCycles(void)
     lock_int_save = LOS_IntLock();
 
 #ifdef SUPPORT_RC_CALIBRATION
-    // if (g_pre_count == 0) {
-    //     tick_count = (uapi_systick_get_count() * OS_SYS_MS_PER_SECOND) / CLOCK_32K_CALI_FREQ;
-    //     g_pre_count = uapi_systick_get_count();
-    //     g_pre_msec = tick_count;
-    // } else {
-    //     now_count = uapi_systick_get_count();
-    //     msec = (double)((now_count - g_pre_count) * OS_SYS_MS_PER_SECOND) / CLOCK_32K_CALI_FREQ;
-    //     tick_count = g_pre_msec + msec;
-
-    //     g_pre_count = now_count;
-    //     g_pre_msec = tick_count;
-    // }
-    tick_count = uapi_systick_get_ms();
+    if (g_pre_count == 0) {
+        tick_count = (uapi_systick_get_count() * OS_SYS_MS_PER_SECOND) / CLOCK_32K_CALI_FREQ;
+        g_pre_count = uapi_systick_get_count();
+        g_pre_msec = tick_count;
+    } else {
+        now_count = uapi_systick_get_count();
+        msec = (double)((now_count - g_pre_count) * OS_SYS_MS_PER_SECOND) / CLOCK_32K_CALI_FREQ;
+        tick_count = g_pre_msec + msec;
+
+        g_pre_count = now_count;
+        g_pre_msec = tick_count;
+    }
 #else
     tick_count = uapi_systick_get_ms();
 #endif
index da6428f..5dc455d 100644 (file)
@@ -45,6 +45,7 @@
 
 #include "player/include/PlayersModelC.h"
 #include "record/include/RecordingModelC.h"
+#include "system/include/SystemLogModelC.h"
 
 #include "mmc5603_hal.h"
 
@@ -169,6 +170,10 @@ static void custom_fileoperate_service_check_task(void const *arg)
             factorytest_save_aging_data();
             break;
 
+        case CUSTOM_FILEOPERATE_MSG_TYPE_POPUP_WINDOWS_DATA_LIST:
+            // printf("[%d] %d\r\n",__LINE__,mail.data[0]);
+            save_popup_windows_log_c(mail.data[0]);
+            break;
         default:
             PRINT("Unknown CUSTOM_FILE_OPERATE_MSG cmd 0x%02X \r\n", mail.cmd);
             break;
index 1110753..9e4bb85 100644 (file)
@@ -271,6 +271,7 @@ errcode_t do_custom_cmd_service_check_msg_head(int cmd, void *params, int paraml
 
 #define CUSTOM_FILEOPERATE_MSG_TYPE_AGING_DATA_READ 0x0F //读取老化数据
 #define CUSTOM_FILEOPERATE_MSG_TYPE_AGING_DATA_SAVE 0x10 //存储老化数据
+#define CUSTOM_FILEOPERATE_MSG_TYPE_POPUP_WINDOWS_DATA_LIST 0x11 //存储弹窗数据
 
 errcode_t uapi_custom_fileoperate_service_init(void);
 errcode_t do_custom_fileoperate_service_check_msg(int cmd, void *params, int paramlen);
index 5d9e924..9ad880d 100644 (file)
Binary files a/tools/dial_converter_tool/dial_lzma/105/kitty.lzma and b/tools/dial_converter_tool/dial_lzma/105/kitty.lzma differ
index fa9264e..d4db162 100644 (file)
@@ -14,7 +14,7 @@
     <!-- 电池图像 -->
     <option_img position="173 52" img_names="./instance/105/Battery/Battery.png,./instance/105/Battery/BatteryCharge.png" bind_data="20" period="10"></option_img>
     <!-- 电池百分比标签 -->
-    <label id="battery_label" color="0xFFFFFFFF" font="HarmonyOS_Sans_SC_Regular.ttf" break_mode="adapt" rect="228 52 200 62" text="%2.0f%%" font_size="26" align="center" bind_data="8" period="10"></label>
+    <label id="battery_label" color="0xFFFFFFFF" font="HarmonyOS_Sans_SC_Regular.ttf" break_mode="adapt" rect="228 52 200 62" text="%s" font_size="26" align="center" bind_data="20485" period="10"></label>
 
 
     <!-- <label id="hour_label" color="0xFFFFFFFF" font="HarmonyOS_Sans_SC_Regular.ttf" break_mode="adapt" rect="101 295 200 60" text="%02.0f" font_size="90" align="center" bind_data="15" period="10"></label>