优化佩戴信息UI显示
authorpenglei <1624952103@qq.com>
Fri, 17 Oct 2025 06:58:20 +0000 (14:58 +0800)
committerpenglei <1624952103@qq.com>
Fri, 17 Oct 2025 06:58:20 +0000 (14:58 +0800)
code/sdk/application/wearable/fd230/nativeapp/nativeui/sleep/src/SleepModel.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/sleep/include/SleepModel.h
code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c
code/sdk/zhihui/utils/custom_fileoperate_service.c

index 22db1f5..9aa0e9c 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: penglei 1624952103@qq.com
  * @Date: SLEPPNOTIFY24-06-26 19:36:48
  * @LastEditors: penglei 1624952103@qq.com
- * @LastEditTime: 2025-08-06 10:42:09
+ * @LastEditTime: 2025-10-17 14:49:37
  * @FilePath:
  * /FD230/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp
  * @Description:
@@ -70,7 +70,7 @@ namespace OHOS
 {
 
 
-  OHOS::WEAR_STAT_T *wear_stat = NULL;
+  static OHOS::WEAR_STAT_T *wear_stat = NULL;
 
   void SleepModel::clean_sleep_data(void)
   {
@@ -320,7 +320,7 @@ namespace OHOS
           return;
 
         if(wear_stat == NULL)
-          wear_stat = (OHOS :: WEAR_STAT_T*)malloc(len);
+            wear_stat = (OHOS :: WEAR_STAT_T*)malloc(len);
 
         if(wear_stat == NULL)
         {
@@ -328,7 +328,7 @@ namespace OHOS
             return;
         }
 
-        FILE *fp = fopen("user/userdata/wear.bin", "rb");
+        FILE *fp = fopen("user/userdata/wear.bin", "r");
         if (fp == NULL)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "wear file open failed");
index 988742b..0c1427f 100644 (file)
@@ -76,6 +76,7 @@ namespace OHOS
         int totaltime;            // 睡眠总时间
     } SleepDataUI;
 
+#pragma pack(1)
     typedef struct
     {
         uint32_t timestamp; //时间戳
@@ -83,6 +84,8 @@ namespace OHOS
 
     } WEAR_STAT_T;
 
+#pragma pack()
+
     class SleepModel
     {
     public:
index f13061c..0e8d191 100644 (file)
@@ -1076,7 +1076,10 @@ void cywee_wearstatus_update(int wearstatus)
     wear_status = wearstatus;
     CWM_CustomSensorInput(&csd);
     // CWM_OS_dbgPrintf("111wearstatus : %d\r\n",wearstatus);
-
+#ifdef CUSTOM_UTILS
+    do_custom_fileoperate_service_check_msg(  
+            CUSTOM_FILEOPERATE_MSG_TYPE_WEAR_DATA_SAVE, NULL, 0);  
+#endif
 #endif
 }
 
index 73c4b94..fcff556 100644 (file)
@@ -238,7 +238,9 @@ static void custom_fileoperate_service_check_task(void const *arg)
             break;
 
         case CUSTOM_FILEOPERATE_MSG_TYPE_WEAR_DATA_SAVE:
-            // cywee_custom_save_wear_data();
+#ifdef SUPPORT_CYWEE_SERVICE
+            cywee_custom_save_wear_data();
+#endif
             break;
 
         case CUSTOM_FILEOPERATE_MSG_TYPE_BATTERY_DATA_READ: