修复睡眠数据重启丢失bug,增加产测录音测试音量,优化gsensor算法时间同步 1439/1 1439/head
authorpenglei <1624952103@qq.com>
Thu, 21 Nov 2024 10:14:07 +0000 (18:14 +0800)
committerpenglei <1624952103@qq.com>
Thu, 21 Nov 2024 10:14:07 +0000 (18:14 +0800)
code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmicrophone.cpp
code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h
code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp
code/sdk/drivers/peripheral/cywee/src/main_dml.c

index 66b9005..1f644de 100644 (file)
@@ -497,8 +497,8 @@ extern "C"
                     AlarmEventPublish(TOPIC_EVENT_SLEEPNOTE,  NULL, 0);  \r
                 }\r
             }\r
-            if ((curTime->tm_hour == wake_time_hour && curTime->tm_min == wake_time_min + 1 && curTime->tm_sec == 0) ||\r
-                (curTime->tm_hour == sleep_time_hour && curTime->tm_min == sleep_time_min + 1 && curTime->tm_sec == 0))\r
+            if ((curTime->tm_hour == wake_time_hour && curTime->tm_min == wake_time_min && curTime->tm_sec == 0) ||\r
+                (curTime->tm_hour == sleep_time_hour && curTime->tm_min == sleep_time_min && curTime->tm_sec == 0) && curTime->tm_min)\r
             {\r
                 uapi_cywee_time_sync();\r
             }\r
@@ -526,6 +526,7 @@ extern "C"
                     uapi_dev_runtime_set_absolute_static_status(0); // 清零绝对静止状态\r
                     set_keep_in_wear_det_mode(1);                 // 开启小睡佩戴监测\r
                     do_cywee_service_check_msg(CYWEE_SERVICE_CMD_NAP_SEDENTARY_MODE, NULL); // 算法底层切换小睡监测模式\r
+                    time_sync_flag = 0;\r
                 }\r
             }\r
             // 进入睡眠检测模式并退出小睡检测模式\r
@@ -557,6 +558,7 @@ extern "C"
                 }\r
 \r
                 do_cywee_service_check_msg(CYWEE_SERVICE_CMD_SLEEPING_MODE, NULL); // 算法底层切换睡眠监测模式\r
+                time_sync_flag = 0;\r
             }\r
         }\r
     }\r
index 346dd1c..58fd595 100644 (file)
@@ -192,6 +192,7 @@ namespace OHOS
             else if(makphone_falg==2)
             {
                 button->SetText("stop play");
+                FindWatchViewEventListener::GetInstance().setVolumeVal(100);
                 FindWatchViewEventListener::GetInstance().PopInterPlayMusic(Path);
                 makphone_falg = 3;
             }
@@ -373,6 +374,7 @@ extern "C"
         if(isopen)
         {
             // AlarmClockModel::GetInstance()->testPlayerStart("/user/userdata/microphone.mp3");
+            FindWatchViewEventListener::GetInstance().setVolumeVal(100);
             FindWatchViewEventListener::GetInstance().PopInterPlayMusic("/user/userdata/microphone.mp3");
             // AlarmClockModel::GetInstance()->AlarmPlayerStart();
         }
index ba29c7d..7bc6632 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-03-25 17:31:19
- * @LastEditors: SnickerSun snickersun@163.com
- * @LastEditTime: 2024-10-21 11:49:04
+ * @LastEditors: penglei 1624952103@qq.com
+ * @LastEditTime: 2024-11-20 20:50:00
  * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h
  */
 #ifndef FIND_WATCH_NOTIFICATION_H
@@ -88,6 +88,8 @@ namespace OHOS
         
         const char *GetPath();
 
+        void setVolumeVal(int val);
+
     private:
         FindWatchViewEventListener();
         ~FindWatchViewEventListener();
index 927b6d6..3baa2e1 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-03-25 17:33:47
- * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-11-18 19:32:15
+ * @LastEditors: penglei 1624952103@qq.com
+ * @LastEditTime: 2024-11-20 21:06:21
  * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp
  * @details:实现查找手表的功能一般需要手表和智能手机之间的配合,通常是通过手机上的应用(App)或其他设备发送指令给手表,触发手表的查找功能。
  * 以下是基本的实现步骤:
@@ -264,6 +264,13 @@ namespace OHOS
         playerCtr->EnableSingleLooping(true); // 设置是否循环播放
         return OHOS_SUCCESS;
     }
+
+    void FindWatchViewEventListener::setVolumeVal(int val)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "volume:%d", AudioManager::GetInstance().GetVolume(AUDIO_STREAM_NOTIFICATION_SYSTEM));
+        AudioManager::GetInstance().SetVolume(AUDIO_STREAM_NOTIFICATION_SYSTEM,val);
+    }
+
     /*
      * @brief 停止查找手表铃声
      */
index bea215a..4cba1a0 100644 (file)
@@ -112,7 +112,6 @@ static char time_file_path[64] = {0};
 static char status_file_path[64] = {0};
 static char nap_file_path[64] = {0};
 
-static char day[12] = {0};
 static char dir_path[64] = {0};
 
 static uint8_t ephemeral_flag = 0; //临时数据
@@ -150,7 +149,8 @@ void get_sleep_file_day(char *day)
 
         if (current_min >= sleep_min && current_min < 24 * 60)
             uapi_get_YYMMDD_Time_extend(day, '\0', -1);
-        else if (current_min >= 0 && current_min < wake_min)
+        // else if (current_min >= 0 && current_min < wake_min)
+        else if (current_min >= 0 && current_min < sleep_min)
             uapi_get_YYMMDD_Time_extend(day, '\0', 0);
     }
     else
@@ -185,7 +185,6 @@ void clean_sleep_data(void)
     memset(&sleep_stat,0,SLEEP_STATUS_LENGTH * sizeof(SLEEP_STAT_T));
     memset(time_file_path, 0, sizeof(time_file_path));
     memset(status_file_path, 0, sizeof(status_file_path));
-    memset(day, 0, sizeof(day));
     memset(dir_path, 0, sizeof(dir_path));
     memset(nap_file_path, 0, sizeof(nap_file_path));
 }
@@ -254,8 +253,8 @@ void cywee_save_sleep_time_data(cywee_inactivity_accumulate_time_t sleep_time)
 {
     // if (access(time_file_path, 0) == -1)
     {
+        char day[12] = {0};
         memset(time_file_path, 0, sizeof(time_file_path));
-        memset(day, 0, sizeof(day));
         get_sleep_file_day(day);
         sprintf_s(time_file_path, 64, SLEEP_TIME_PATH, day);
     }
@@ -339,7 +338,7 @@ void cywee_save_sleep_time_data(cywee_inactivity_accumulate_time_t sleep_time)
 void cywee_save_sleep_stat_data(void)
 {
     memset(status_file_path, 0, sizeof(status_file_path));
-    memset(day, 0, sizeof(day));
+    char day[12] = {0};
     get_sleep_file_day(day);
     sprintf_s(status_file_path, 64, SLEEP_STATUS_PATH, day);
     if (access(status_file_path, 0) == -1) // 文件不存在 直接写入
@@ -815,6 +814,7 @@ void cywee_time_sync(void)
     CWM_SettingControl(SCL_DATE_TIME, &scl);
 
     //时间同步以后创建文件夹
+    char day[12] = {0};
     get_sleep_file_day(day);
     sprintf_s(dir_path, 64, SLEEP_DIR_PATH, day);
     uapi_create_folder(dir_path);