解决编译不过问题 3359/1 3359/head 3360/target/1 3361/target/1
authorluozheng <1732036298@qq.com>
Wed, 22 Apr 2026 02:36:35 +0000 (10:36 +0800)
committerluozheng <1732036298@qq.com>
Wed, 22 Apr 2026 02:36:35 +0000 (10:36 +0800)
68 files changed:
code/sdk/application/brandy/brandy_standard/CMakeLists.txt
code/sdk/application/brandy/brandy_standard/thread_pri_init.c
code/sdk/application/wearable/n9/nativeabilityfwk/include/Ability.h
code/sdk/application/wearable/n9/nativeabilityfwk/include/Presenter.h
code/sdk/application/wearable/n9/nativeabilityfwk/src/Ability.cpp
code/sdk/application/wearable/n9/nativeabilityfwk/src/transition/BackToCrossShapedTransition.cpp
code/sdk/application/wearable/n9/nativeabilityfwk/src/transition/BackToHexagonsTransition.cpp
code/sdk/application/wearable/n9/nativeabilityfwk/src/transition/BackToWaterfallTransition.cpp
code/sdk/application/wearable/n9/nativeabilityfwk/src/transition/CrossShapedTransition.cpp
code/sdk/application/wearable/n9/nativeabilityfwk/src/transition/ZoomOutTransition.cpp [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeabilityfwk/src/transition/ZoomOutTransition.h [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/CMakeLists.txt
code/sdk/application/wearable/n9/nativeapp/nativelauncher/include/UiConfig.h
code/sdk/application/wearable/n9/nativeapp/nativelauncher/src/UIWatchDialFactory.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/DesktopFactory.h [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/FootballDesktopFragment.h [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/HexagonsDesktopFragment.h [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/ListDesktopFragment.h [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/PlanetDesktopFragment.h [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/SphereDesktopFragment.h [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/UIDesktopFragment.h [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/WaterfallDesktopFragment.h [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/DesktopFactory.cpp [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/FootballDesktopFragment.cpp [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/HexagonsDesktopFragment.cpp [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/ListDesktopFragment.cpp [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/PlanetDesktopFragment.cpp [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/SphereDesktopFragment.cpp [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/UIDesktopFragment.cpp [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/WaterfallDesktopFragment.cpp [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/bluetooth/include/BluetoothWrapper.h
code/sdk/application/wearable/n9/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/bluetooth/src/BluetoothWrapper.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/heartrate/src/HeartModel.cpp [new file with mode: 0644]
code/sdk/application/wearable/n9/nativeapp/nativeui/languagecode/src/LanguageSwitchView.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/saveele/src/SaveBatPresenter.cpp
code/sdk/application/wearable/n9/service/device_msg/msg_center_device.cpp
code/sdk/application/wearable/n9/service/msg_center/CMakeLists.txt
code/sdk/application/wearable/n9/service/msg_center/brandy-native-js-fd230/libmsg_center.a [deleted file]
code/sdk/application/wearable/n9/service/msg_center/brandy-native-js-ln/libmsg_center.a [deleted file]
code/sdk/application/wearable/n9/service/msg_center/brandy-native-js-n9/libmsg_center.a
code/sdk/application/wearable/n9/service/msg_center/include/notify/notification_manager.h
code/sdk/application/wearable/n9/service/remote_msg/remote_msg.cpp
code/sdk/application/wstp/at_service/ohosfwk/ohosfwk_at_process.cpp
code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_recorder.a [new file with mode: 0644]
code/sdk/middleware/services/gpu/api/rm/brandy-native-js-n9/libgfx_rm.a
code/sdk/middleware/services/gui/uikit/brandy-native-js-n9/libuikit_ext.a
code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_cmd.cpp
code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cross/ui_test_cross.cpp
code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_transition/ui_test_transition_model.cpp
code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-n9/libams.a
code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace.a
code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace_ble.a [new file with mode: 0644]
code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace_ext.a [new file with mode: 0644]
code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace_http.a
code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace_websocket.a [new file with mode: 0644]
code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libnetstack_http.a
code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libwebsocket.a
code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/calendarManager/event_id_manager.cpp
code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/netstack/http/internal/http_opts.h
code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/network/connection_manage/connection_manage.cpp
code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/router_module.cpp
code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/watchface/watchface_module.h
code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-n9/libbms.a
code/sdk/open_source/openharmony/third_party/lwip/lwip_v2.1.3/src/core/init.c
code/sdk/zhihui/4g/cat1Service/Service/cat1_utils.c
code/sdk/zhihui/utils/custom_utils_at_cmd.c
code/sdk/zhihui/websocket/src/zhihui_websocket.c

index 1680093..92a47bd 100644 (file)
@@ -44,7 +44,6 @@ set(PRIVATE_HEADER
     ${ROOT_DIR}/zhihui/4g/cat1Service/include
     ${ROOT_DIR}/zhihui/4g/cat1Service/Service
     ${ROOT_DIR}/zhihui/4gTest
-    ${ROOT_DIR}/zhihui/leiniao/imsl_ln/
 )
 
 set(PUBLIC_HEADER
index ad4b871..b4d4bbe 100644 (file)
@@ -172,6 +172,7 @@ static void sample_gfx_init(void)
     cst92xx_host_init_sample();\r
 #else\r
     ztw523_host_init_sample();\r
+#endif\r
 #endif\r
     ext_errno ret = uapi_lcd_init();\r
     if (ret != EXT_ERR_SUCCESS) {\r
index 13a4f40..3a6612c 100644 (file)
@@ -262,7 +262,8 @@ public:
         }
     }
     //仅用于打电话结束恢复时使用
-    bool Back_CountSlice_make_phone(const TransitionType transitionId,const uint16_t priority ) 
+    bool Back_CountSlice_make_phone(const TransitionType transitionId = TransitionType::TRANSITION_INVALID,
+        const uint16_t priority = gSliceDefaultPriority)
     { 
         if(!backStack_.empty())
         {
index aebc7f9..b08e02f 100644 (file)
@@ -25,7 +25,7 @@ public:
     virtual ~PresenterBase() = default;
 
     /**
-     * @deprecated ÍƼöʹÓ÷½·¨OnStart(void* data)
+     * @deprecated 推荐使用方法OnStart(void* data)
      */
     virtual void OnStart() {}
 
index cb173b6..3cf948d 100644 (file)
@@ -25,7 +25,9 @@
 #include "PageTransitionMgr.h"
 #include "gfx_utils/list.h"
 #include "AbilitySlice.h"
+#if 0 // 1201patch 为编译过屏蔽
 #include "settings/model/SettingDesktopModel.h"
+#endif
 #include "NativeAbility.h"
 #include "power_display_service.h"
 
@@ -271,6 +273,7 @@ void Ability::ChangeSlice(uint16_t sliceId, TransitionType type,
 
 void Ability::ChangeSliceToApplist()
 {
+    #if 0 // 1201patch 为编译过屏蔽
     if (SettingDesktopModel::GetInstance().GetDesktopStyle() == HEXAGONS_STYLE) {
         NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_BACK_TO_HEXAGONS);
     } else if (SettingDesktopModel::GetInstance().GetDesktopStyle() == WATERFALL_STYLE) {
@@ -278,10 +281,12 @@ void Ability::ChangeSliceToApplist()
     } else {
         NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);
     }
+    #endif
 }
 
 void Ability::EnterAod()
 {
+#if 0 // 1201patch 为编译过屏蔽
 #ifdef JS_ENABLE
     ElementName *elementName = OHOS::AbilityMsClient::GetInstance().GetTopAbility();
     if (elementName != nullptr && strcmp(elementName->bundleName, "com.huawei.launcher") != 0) {
@@ -311,10 +316,12 @@ void Ability::EnterAod()
     StartSlice(VIEW_AOD);
     ResumeSlice();
     PageTransitionMgr::GetInstance().EndTransition(true);
+#endif
 }
 
 void Ability::ExitAod(uint32_t targetId)
 {
+#if 0 // 1201patch 为编译过屏蔽
     TransitionTarget target;
     target.sliceInfo.sliceAndPageId = targetId;
     target.sliceInfo.data = nullptr;
@@ -350,6 +357,7 @@ void Ability::ExitAod(uint32_t targetId)
     }
     ResumeSlice();
     PageTransitionMgr::GetInstance().EndTransition(true);
+#endif
 }
 
 void Ability::PostChangeSlice(uint32_t targetId, TransitionType type, void* data)
index 6eb9e3b..6cc07e3 100644 (file)
@@ -3,8 +3,9 @@
  * Description: BackToCrossShapedTransition\r
  * Create: 2025-04\r
  */\r
-\r
+#if 0 // 1201patch 为编译过屏蔽\r
 #include "applist/AppItemView.h"\r
+#endif\r
 #include "animator/easing_equation.h"\r
 #include "common/screen.h"\r
 #include "components/root_view.h"\r
index 3ccd66e..3b96ee4 100644 (file)
@@ -9,7 +9,9 @@
 #include "TransitionManager.h"
 #include "NativeAbility.h"
 #include "components/root_view.h"
+#if 0 // 1201patch 为编译过屏蔽
 #include "applist/HexagonsDesktopFragment.h"
+#endif
 #include "hal_tick.h"
 #include "wearable_log.h"
 #ifdef JS_ENABLE
@@ -24,6 +26,7 @@ static const float TARGET_SCALE_END = 1.0f;
 
 void BackToHexagonsTransition::OnTransitionStart(UIImageView* current, UIViewGroup* target)
 {
+#if 0 // 1201patch 为编译过屏蔽
     current_ = current;
     target_ = dynamic_cast<UICustomHexagonsList*>(TransitionUtils::GetViewAndTransparentizePath(target, UI_HEXAGONS_LIST));
     if ((target_ == nullptr) || (current_ == nullptr)) {
@@ -72,6 +75,7 @@ void BackToHexagonsTransition::OnTransitionStart(UIImageView* current, UIViewGro
     float yScale = current->GetHeight() * 1.0f / rect.GetHeight();
     tarScaleStart_ = FloatLessEqual(xScale, yScale) ? xScale : yScale;
     curScaleEnd_ = 1.0f / tarScaleStart_;
+#endif
 }
 
 void BackToHexagonsTransition::TransitionAlg(uint32_t time)
index f2167b1..c047df4 100644 (file)
@@ -9,7 +9,7 @@
 #include "TransitionManager.h"
 #include "NativeAbility.h"
 #include "components/root_view.h"
-#include "applist/WaterfallDesktopFragment.h"
+// #include "applist/WaterfallDesktopFragment.h"
 #include "hal_tick.h"
 #include "wearable_log.h"
 #ifdef JS_ENABLE
@@ -24,6 +24,7 @@ static const float TARGET_SCALE_END = 1.0f;
 
 void BackToWaterfallTransition::OnTransitionStart(UIImageView* current, UIViewGroup* target)
 {
+#if 0 // 1201patch 为编译过屏蔽
     current_ = current;
     target_ = dynamic_cast<UIWaterfallList*>(TransitionUtils::GetViewAndTransparentizePath(target, UI_WATERFALL_LIST));
     if ((target_ == nullptr) || (current_ == nullptr)) {
@@ -79,6 +80,7 @@ void BackToWaterfallTransition::OnTransitionStart(UIImageView* current, UIViewGr
     float yScale = current->GetHeight() * 1.0f / rect.GetHeight();
     tarScaleStart_ = FloatLessEqual(xScale, yScale) ? xScale : yScale;
     curScaleEnd_ = 1.0f / tarScaleStart_;
+#endif
 }
 
 void BackToWaterfallTransition::TransitionAlg(uint32_t time)
index 64a7f76..d824432 100644 (file)
@@ -4,7 +4,9 @@
  * Create: 2025-04\r
  */\r
 \r
+#if 0 // 1201patch 为编译过屏蔽\r
 #include "applist/AppItemView.h"\r
+#endif\r
 #include "animator/easing_equation.h"\r
 #include "common/screen.h"\r
 #include "components/root_view.h"\r
diff --git a/code/sdk/application/wearable/n9/nativeabilityfwk/src/transition/ZoomOutTransition.cpp b/code/sdk/application/wearable/n9/nativeabilityfwk/src/transition/ZoomOutTransition.cpp
new file mode 100644 (file)
index 0000000..d4c4c52
--- /dev/null
@@ -0,0 +1,43 @@
+/*\r
+ * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved.\r
+ * Description: ZoomOutTransition\r
+ * Create: 2025-04\r
+ */\r
+\r
+#include "animator/easing_equation.h"\r
+#include "common/screen.h"\r
+#include "components/root_view.h"\r
+#include "TransitionManager.h"\r
+#include "wearable_log.h"\r
+#include "ZoomOutTransition.h"\r
+\r
+namespace OHOS {\r
+static constexpr int16_t DURATION = 200;\r
+static constexpr float HALF = 0.5f;\r
+static constexpr float NUM2 = 2.0f;\r
+static constexpr int16_t SCALE_BASE = 1;\r
+REGIST_TRANSITION(TransitionType::TRANSITION_ZOOM_OUT, ZoomOutTransition, DURATION, true, true);\r
+\r
+void ZoomOutTransition::OnTransitionStart(UIImageView* current, UIImageView* target)\r
+{\r
+    if (current == nullptr || target == nullptr) {\r
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "ZoomOutTransition ImageView is empty!");\r
+        return;\r
+    }\r
+    target_ = target;\r
+    current_ = current;\r
+    RootView::GetInstance()->Remove(target);\r
+    RootView::GetInstance()->Insert(nullptr, target);\r
+    middleWidth_ = Screen::GetInstance().GetWidth() / NUM2;\r
+    middleHeight_ = Screen::GetInstance().GetHeight() / NUM2;\r
+}\r
+\r
+void ZoomOutTransition::TransitionAlg(uint32_t time)\r
+{\r
+    float zoom_scale = EasingEquation::LinearEaseNone(DURATION, 0, time, duration_) / static_cast<float>(DURATION);\r
+    float zoom_in_scale = zoom_scale;\r
+    current_->Scale(Vector2<float>{zoom_in_scale, zoom_in_scale}, Vector2<float>{middleWidth_, middleHeight_});\r
+    float zoom_out_scale = SCALE_BASE + zoom_scale;\r
+    target_->Scale(Vector2<float>{zoom_out_scale, zoom_out_scale}, Vector2<float>{middleWidth_, middleHeight_});\r
+}\r
+} // namespace OHOS\r
diff --git a/code/sdk/application/wearable/n9/nativeabilityfwk/src/transition/ZoomOutTransition.h b/code/sdk/application/wearable/n9/nativeabilityfwk/src/transition/ZoomOutTransition.h
new file mode 100644 (file)
index 0000000..1bbd02a
--- /dev/null
@@ -0,0 +1,26 @@
+/*\r
+ * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved.\r
+ * Description: ZoomOutTransition\r
+ * Create: 2025-04\r
+ */\r
+\r
+#ifndef ZOOM_OUT_TRANSITION_H\r
+#define ZOOM_OUT_TRANSITION_H\r
+#include "TransitionCallback.h"\r
+\r
+namespace OHOS {\r
+class ZoomOutTransition : public TransitionCallback {\r
+public:\r
+    ZoomOutTransition(uint32_t time, bool enableCurrentSnapshot, bool enableTargetSnapshot) :\r
+        TransitionCallback(time, enableCurrentSnapshot, enableTargetSnapshot) {}\r
+    ~ZoomOutTransition() override {}\r
+    void OnTransitionStart(UIImageView* current, UIImageView* target) override;\r
+    void TransitionAlg(uint32_t time) override;\r
+private:\r
+    UIImageView* current_ = nullptr;\r
+    UIImageView* target_ = nullptr;\r
+    float middleWidth_;\r
+    float middleHeight_;\r
+};\r
+} // namespace OHOS\r
+#endif // ZOOM_OUT_TRANSITION_H
\ No newline at end of file
index dcec9a0..297c1df 100644 (file)
@@ -69,6 +69,9 @@ set(PRIVATE_HEADER
     ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/modules/calendarManager
     ${ROOTDIR}/open_source/openharmony/third_party/lwip/lwip_adapter/liteos/src/include/public
 
+
+    ${ROOT_DIR}/open_source/openharmony/third_party/lwip/lwip_v2.1.3/src/include
+    ${ROOT_DIR}/open_source/openharmony/third_party/lwip/lwip_adapter/liteos/src/include
     ${ROOT_DIR}/zhihui/drivers/
     ${ROOT_DIR}/zhihui/UI/CustomUIComponentTool/
     ${ROOT_DIR}/zhihui/UI/producttest/include/
@@ -77,7 +80,6 @@ set(PRIVATE_HEADER
     ${ROOT_DIR}/zhihui/4g/cat1Service/include
     ${ROOT_DIR}/zhihui/4g/cat1Service/Service
     ${ROOT_DIR}/zhihui/ai/include/
-    ${ROOT_DIR}/zhihui/leiniao/imsl_ln
 
 )
 
@@ -101,7 +103,7 @@ if(NOT "CONFIG_NATIVEAPP_TEST" IN_LIST DEFINES)
     file(GLOB FILES_TO_REMOVE_MONKEY "${CMAKE_CURRENT_SOURCE_DIR}/nativeui/monkey/src/*.cpp")
     file(GLOB FILES_TO_REMOVE_EMPTY "${CMAKE_CURRENT_SOURCE_DIR}/nativeui/emptypage/src/*.cpp")
     list(APPEND FILES_TO_REMOVE ${FILES_TO_REMOVE_MONKEY} ${FILES_TO_REMOVE_EMPTY})
-    list(REMOVE_ITEM SOURCES ${FILES_TO_REMOVE})
+    # list(REMOVE_ITEM SOURCES ${FILES_TO_REMOVE})
 endif()
 
 set(SOURCES
index cda6089..d86bf66 100644 (file)
@@ -51,6 +51,13 @@ namespace OHOS
         DIAL_DISPLAY_MODE_MAX,
     } DialDispayMode;
 
+       typedef enum {
+        DIAL_DISPLAY_SUPPORT_NORMAL = 0,
+        DIAL_DISPLAY_SUPPORT_AOD,
+        DIAL_DISPLAY_SUPPORT_NORMAL_AOD,
+        DIAL_DISPLAY_SUPPORT_MAX,
+    } DialDisplayAbility;
+
     /*主界面上下拉界面*/
     typedef enum
     {
index 7f7aeae..546e86f 100644 (file)
@@ -13,6 +13,7 @@ namespace OHOS {
 void UIWatchDialFactory::RegisterWatchDial(const uint16_t ability, const uint16_t id,
     UIWatchDialProxyInterface* uiWatchDial, const DialInfo* dialInfo)
 {
+#if 0 // 1201patch 为编译过屏蔽
     if (ability >= DIAL_DISPLAY_SUPPORT_MAX || uiWatchDial == nullptr) {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Can't register watch dial using invalid ability or proxy %d-%p",
         ability, uiWatchDial);
@@ -38,6 +39,7 @@ void UIWatchDialFactory::RegisterWatchDial(const uint16_t ability, const uint16_
             watchDials_[DIAL_DISPLAY_MODE_AOD].insert({id, uiWatchDial});
         }
     }
+#endif
 }
 
 const DialInfo* UIWatchDialFactory::GetNormalDialInfo(uint16_t id)
@@ -58,6 +60,7 @@ uint8_t UIWatchDialFactory::GetNormalDialInfoNum()
 
 UICardPage* UIWatchDialFactory::CreateNormalDial(uint16_t id)
 {
+#if 0 // 1201patch 为编译过屏蔽
     auto it = watchDials_[DIAL_DISPLAY_MODE_NORMAL].find(id);
     if (it != watchDials_[DIAL_DISPLAY_MODE_NORMAL].end()) {
         return it->second->CreateWatchDialCardPage(id);
@@ -65,6 +68,8 @@ UICardPage* UIWatchDialFactory::CreateNormalDial(uint16_t id)
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "normal dial id:%d was not registered", id);
         return nullptr;
     }
+#endif
+    return nullptr;
 }
 
 UIFragment* UIWatchDialFactory::CreateAodDial(uint16_t id)
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/DesktopFactory.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/DesktopFactory.h
new file mode 100644 (file)
index 0000000..d50a69c
--- /dev/null
@@ -0,0 +1,71 @@
+// /*
+//  * Copyright (c) CompanyNameMagicTag 2025. All rights reserved.
+//  * Description: DesktopFactory
+//  * Author:
+//  * Create: 2025-07
+//  */
+
+// #ifndef DESKTOP_FACTORY_H
+// #define DESKTOP_FACTORY_H
+
+// #include <unordered_map>
+// #include "UIDesktopFragment.h"
+
+// namespace OHOS {
+// class DesktopInterface;
+// class DesktopFactory {
+// public:
+//     static DesktopFactory& GetInstance()
+//     {
+//         static DesktopFactory instance;
+//         return instance;
+//     }
+//     void RegisterDesktopStyle(const uint16_t style, DesktopInterface* desktop);
+//     UIDesktopFragment* CreateDesktopStyle(uint16_t style);
+
+// private:
+//     DesktopFactory() {};
+//     ~DesktopFactory() {};
+//     DesktopFactory(const DesktopFactory&) = delete;
+//     DesktopFactory &operator=(const DesktopFactory&) = delete;
+//     std::unordered_map<uint16_t, DesktopInterface*> desktops_;
+// };
+
+// class DesktopStyleRegister {
+// public:
+//     DesktopStyleRegister(const uint16_t style, DesktopInterface* uiCardPage)
+//     {
+//         DesktopFactory::GetInstance().RegisterDesktopStyle(style, uiCardPage);
+//     }
+// };
+
+// class DesktopInterface {
+// public:
+//     virtual UIDesktopFragment* CreateDesktop() = 0;
+//     DesktopInterface() = default;
+//     virtual ~DesktopInterface() = default;
+//     DesktopInterface(const DesktopInterface&) = delete;
+//     DesktopInterface& operator=(const DesktopInterface&) = delete;
+//     DesktopInterface(DesktopInterface&&) = delete;
+//     DesktopInterface& operator=(DesktopInterface&&) = delete;
+// };
+
+// template <class D>
+// class DesktopProxy : public DesktopInterface {
+// public:
+//     UIDesktopFragment* CreateDesktop() override
+//     {
+//         D* d = new D();
+//         UIDesktopFragment* fragment = dynamic_cast<UIDesktopFragment*>(d);
+//         if (fragment == nullptr) {
+//             delete d;
+//         }
+//         return fragment;
+//     }
+// };
+// } // namespace OHOS
+
+// #define REGIST_DESKTOP_STYLE(style, D) \
+//     const static OHOS::DesktopStyleRegister (STATIC_VAR)(static_cast<uint16_t>(style), new DesktopProxy<D>())
+
+// #endif // DESKTOP_FACTORY_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/FootballDesktopFragment.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/FootballDesktopFragment.h
new file mode 100644 (file)
index 0000000..a5851cd
--- /dev/null
@@ -0,0 +1,87 @@
+// /*
+//  * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
+//  * Description: FootballDesktopFragment.h
+//  * Author:
+//  * Create: 2025-07-04
+//  */
+
+// #ifndef FOOTBALL_DESKTOP_FRAGMENT_H
+// #define FOOTBALL_DESKTOP_FRAGMENT_H
+
+// #include "UIDesktopFragment.h"
+// #include "components/ui_icosahedron_view.h"
+
+// namespace OHOS {
+// class FootballAnimatorCallback;
+// class FootballItemView;
+// class FootballDesktopFragment : public UIDesktopFragment {
+// public:
+//     bool OnClick(UIView &view, const ClickEvent &event) override;
+//     void AddAppItemToList(const AppItem &item) override;
+//     void ClearAppItemToList() override;
+//     void RefreshAppList() override;
+
+// protected:
+//     void OnCreateView(void* data) override;
+//     void OnDestroyView() override;
+//     void OnResumeView() override;
+
+// private:
+//     UIIcosahedronView* footballList_ = nullptr;
+//     List<FootballItemView*> footballItemList_;
+//     ImageInfo* footballDefaultImg_ = nullptr;
+//     FootballAnimatorCallback* callback_ = nullptr;
+//     Animator* enterAnimator_ = nullptr;
+// };
+
+// class FootballAnimatorCallback : public AnimatorCallback {
+// public:
+//     explicit FootballAnimatorCallback(UIView* view, int16_t startPos, int16_t endPos)
+//         : startPos_(startPos),
+//           endPos_(endPos),
+//           startTime_(0),
+//           animator_(new Animator(this, view, 1000, false)) {}  // 1000:duration of animator_, in milliseconds.
+
+//     ~FootballAnimatorCallback() override
+//     {
+//         if (animator_ != nullptr) {
+//             delete animator_;
+//             animator_ = nullptr;
+//         }
+//     }
+
+//     void Callback(UIView* view) override;
+
+//     Animator* GetAnimator() const
+//     {
+//         return animator_;
+//     }
+
+//     void SetStartTime(uint32_t time)
+//     {
+//         isStartAnim_ = false;
+//         startTime_ = time;
+//     }
+// protected:
+//     int16_t startPos_;
+//     int16_t endPos_;
+//     uint32_t startTime_;
+//     bool isStartAnim_ = false;
+//     Animator* animator_;
+// };
+
+// class FootballItemView : public UIImageView {
+// public:
+//     explicit FootballItemView() {}
+//     ~FootballItemView() override;
+//     bool SetItemInfo(const AppItem &itemInfo);
+//     AppViewId GetViewId();
+//     const char *GetAppUid();
+// private:
+//     FootballItemView(const FootballItemView &);
+//     FootballItemView &operator = (const FootballItemView &);
+//     AppItem itemInfo_;
+// };
+// }
+
+// #endif // FOOTBALL_DESKTOP_FRAGMENT_H
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/HexagonsDesktopFragment.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/HexagonsDesktopFragment.h
new file mode 100644 (file)
index 0000000..fb24447
--- /dev/null
@@ -0,0 +1,47 @@
+// /*
+//  * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
+//  * Description: HexagonsDesktopFragment.h
+//  * Author:
+//  * Create: 2025-07-04
+//  */
+
+// #ifndef HEXAGONS_DESKTOP_FRAGMENT_H
+// #define HEXAGONS_DESKTOP_FRAGMENT_H
+
+// #include "UIDesktopFragment.h"
+// #include "components/ui_custom_hexagons_list.h"
+
+// namespace OHOS {
+// class HexagonsItemView;
+// class HexagonsDesktopFragment : public UIDesktopFragment {
+// public:
+//     bool OnClick(UIView &view, const ClickEvent &event) override;
+//     bool OnRotate(UIView& view, const RotateEvent& event) override;
+//     void AddAppItemToList(const AppItem &item) override;
+//     void ClearAppItemToList() override;
+//     void RefreshAppList() override;
+
+// protected:
+//     void OnCreateView(void* data) override;
+//     void OnDestroyView() override;
+
+// private:
+//     UICustomHexagonsList* hexagonsList_{nullptr};
+//     List<HexagonsItemView*> listHexagonsView_;
+// };
+
+// class HexagonsItemView : public UIImageView {
+// public:
+//     explicit HexagonsItemView() {};
+//     ~HexagonsItemView();
+//     bool SetItemInfo(const AppItem &itemInfo);
+//     AppViewId GetViewId();
+//     const char *GetAppUid();
+// private:
+//     HexagonsItemView(const HexagonsItemView &);
+//     HexagonsItemView &operator = (const HexagonsItemView &);
+//     AppItem itemInfo_;
+// };
+// }
+
+// #endif // HEXAGONS_DESKTOP_FRAGMENT_H
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/ListDesktopFragment.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/ListDesktopFragment.h
new file mode 100644 (file)
index 0000000..4892e8a
--- /dev/null
@@ -0,0 +1,81 @@
+// /*
+//  * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
+//  * Description: ListDesktopFragment.h
+//  * Author:
+//  * Create: 2025-07-04
+//  */
+
+// #ifndef LIST_DESKTOP_FRAGMENT_H
+// #define LIST_DESKTOP_FRAGMENT_H
+
+// #include "UIDesktopFragment.h"
+// #include "ApplistAdapter.h"
+// #include "ChangeSliceListener.h"
+// #include "components/ui_list.h"
+// #include "drag_event.h"
+
+// namespace OHOS {
+// class ListDesktopFragment : public UIDesktopFragment {
+// public:
+//     bool OnClick(UIView &view, const ClickEvent &event) override;
+//     void OnItemSelected(int16 index, UIView *view) override;
+//     void AddAppItemToList(const AppItem &item) override;
+//     void ClearAppItemToList() override;
+//     void RefreshAppList() override;
+
+// protected:
+//     void OnCreateView(void* data) override;
+//     void OnDestroyView() override;
+
+// private:
+//     ApplistAdapter *listAdapter_{nullptr};
+//     UIList *contentList_{nullptr};
+//     UIView::OnDragListener *dragListener_{nullptr};
+//     AppItemView *itemViewSele{nullptr};
+//     AppItemView *preItemViewSele{nullptr};
+// };
+
+// class AppListOnDragListener : public UIView::OnDragListener {
+// public:
+//     AppListOnDragListener()
+//     {
+//         continueDrag_ = false;
+//     }
+//     ~AppListOnDragListener() override {}
+//     bool OnDragStart(UIView& view, const DragEvent& event) override
+//     {
+//         UNUSED(view);
+//         UNUSED(event);
+//         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Applist Ondragstart!!");
+//         continueDrag_ = true;
+//         return false;
+//     }
+
+//     bool OnDrag(UIView& view, const DragEvent& event) override
+//     {
+//         UNUSED(view);
+//         if (!continueDrag_) {
+//             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AppList : Can not continue drag!!");
+//             return false;
+//         }
+//         if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) &&
+//             (event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) {
+//             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Applist Ondrag!!");
+//             NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE, TransitionType::TRANSITION_ZOOM);
+//         }
+
+//         return false;
+//     }
+
+//     bool OnDragEnd(UIView& view, const DragEvent& event) override
+//     {
+//         UNUSED(view);
+//         UNUSED(event);
+//         return false;
+//     }
+// private:
+//     bool continueDrag_{false};
+// };
+// }
+
+// #endif // LIST_DESKTOP_FRAGMENT_H
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/PlanetDesktopFragment.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/PlanetDesktopFragment.h
new file mode 100644 (file)
index 0000000..f7c4bd2
--- /dev/null
@@ -0,0 +1,48 @@
+// /*
+//  * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved.
+//  * Description: PlanetDesktop
+//  * Created: 2025-07-29
+//  */
+
+// #ifndef PLANET_DESKTOP_FRAGMENT_H
+// #define PLANET_DESKTOP_FRAGMENT_H
+
+// #include "UIDesktopFragment.h"
+// #include "components/ui_custom_planet_list.h"
+
+// namespace OHOS {
+// class PlanetItemView;
+// class PlanetDesktopFragment : public UIDesktopFragment {
+// public:
+//     bool OnClick(UIView &view, const ClickEvent &event) override;
+//     void AddAppItemToList(const AppItem &item) override;
+//     void ClearAppItemToList() override;
+//     void RefreshAppList() override;
+
+// protected:
+//     void OnCreateView(void* data) override;
+//     void OnDestroyView() override;
+
+// private:
+//     UICustomPlanetList* planetList_{nullptr};
+//     List<PlanetItemView*> pltItemList_;
+//     List<UILabel*> pltLabelList_;
+// };
+
+// class PlanetItemView : public UIImageView {
+// public:
+//     explicit PlanetItemView() {}
+//     ~PlanetItemView() {}
+//     void SetItemInfo(const AppItem &itemInfo);
+//     AppViewId GetViewId();
+//     const char *GetAppUid();
+//     const char *GetAppLabel();
+
+// private:
+//     PlanetItemView(const PlanetItemView &) = delete;
+//     PlanetItemView &operator = (const PlanetItemView &) = delete;
+//     AppItem itemInfo_ = { VIEW_INVALID, nullptr, nullptr, nullptr, nullptr };
+// };
+// }
+
+// #endif // PLANET_DESKTOP_FRAGMENT_H
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/SphereDesktopFragment.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/SphereDesktopFragment.h
new file mode 100644 (file)
index 0000000..cf9c510
--- /dev/null
@@ -0,0 +1,93 @@
+//   /*
+//  * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025. All rights reserved.
+//  * Description: SphereDesktopFragment
+//  * Author: Hisi Graphic Team
+//  * Created: 2025-09
+//  */
+
+// #ifndef SPHERE_DESKTOP_FRAGMENT_H
+// #define SPHERE_DESKTOP_FRAGMENT_H
+
+// #include "UIDesktopFragment.h"
+// #include "components/ui_sphere_view.h"
+// #include "components/ui_transform_group.h"
+
+// namespace OHOS {
+// class SphereAnimatorCallback;
+// class SphereItemView;
+// class SphereDesktopFragment : public UIDesktopFragment {
+// public:
+//     bool OnClick(UIView &view, const ClickEvent &event) override;
+//     bool OnRotate(UIView& view, const RotateEvent& event) override;
+//     void AddAppItemToList(const AppItem &item) override;
+//     void ClearAppItemToList() override;
+//     void RefreshAppList() override;
+
+// protected:
+//     void OnCreateView(void* data) override;
+//     void OnDestroyView() override;
+//     void OnResumeView() override;
+
+// private:
+//     UISphereView* sphereView_{nullptr};
+//     List<SphereItemView*> listSphereView_;
+//     SphereAnimatorCallback* callback_ = nullptr;
+//     Animator* enterAnimator_ = nullptr;
+// };
+
+// class SphereAnimatorCallback : public AnimatorCallback {
+// public:
+//     explicit SphereAnimatorCallback(UIView* view, int16_t width, int16_t height)
+//         : width_(width),
+//           height_(height),
+//           startTime_(0),
+//           passTime_(0),
+//           angle_(0),
+//           animator_(new Animator(this, view, 600, false)) {}  // 600 ms:duration of animator_
+
+//     ~SphereAnimatorCallback() override
+//     {
+//         if (animator_ != nullptr) {
+//             delete animator_;
+//             animator_ = nullptr;
+//         }
+//     }
+
+//     void Callback(UIView* view) override;
+
+//     Animator* GetAnimator() const
+//     {
+//         return animator_;
+//     }
+
+//     void SetStartTime(uint32_t time)
+//     {
+//         isStartAnim_ = false;
+//         startTime_ = time;
+//     }
+// protected:
+//     int16_t width_;
+//     int16_t height_;
+//     uint32_t startTime_;
+//     uint32_t passTime_;
+//     bool isStartAnim_ = false;
+//     int16_t angle_;
+//     Animator* animator_;
+// };
+
+// class SphereItemView : public UITransformGroup {
+// public:
+//     explicit SphereItemView() {};
+//     ~SphereItemView();
+//     bool SetItemInfo(const AppItem &itemInfo);
+//     AppViewId GetViewId();
+//     const char *GetAppUid();
+// private:
+//     SphereItemView(const SphereItemView &);
+//     SphereItemView &operator = (const SphereItemView &);
+//     UIImageView* imageView_{nullptr};
+//     AppItem itemInfo_;
+// };
+// }
+
+// #endif // SPHERE_DESKTOP_FRAGMENT_H
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/UIDesktopFragment.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/UIDesktopFragment.h
new file mode 100644 (file)
index 0000000..34758a8
--- /dev/null
@@ -0,0 +1,37 @@
+// /*
+//  * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
+//  * Description: UIDesktopFragment.h
+//  * Author:
+//  * Create: 2025-07-07
+//  */
+
+// #ifndef UI_DESKTOP_FRAGMENT_H
+// #define UI_DESKTOP_FRAGMENT_H
+
+// #include "applist/include/AppItemView.h"
+// #include "components/ui_fragment.h"
+// #include "components/ui_list.h"
+// #include "components/ui_view_group.h"
+// #include "components/ui_scroll_view.h"
+// #include "TransitionType.h"
+// #include "ohos_types.h"
+// #include "wearable_log.h"
+
+// namespace OHOS {
+// class UIDesktopFragment : public UIFragment, public UIView::OnClickListener,
+//                           public ListScrollListener, public UIView::OnRotateListener {
+// public:
+//     virtual void AddAppItemToList(const AppItem &item) = 0;
+//     virtual void ClearAppItemToList() = 0;
+//     virtual void RefreshAppList() = 0;
+//     void SetPosition(int16_t x, int16_t y, int16_t width, int16_t height);
+
+// protected:
+//     uint16_t imgSize_ = 0;
+//     uint16_t imgDistance_ = 0;
+//     void OnCreateView(void* data) override {};
+//     void OnDestroyView() override {};
+//     bool SwitchView(AppViewId viewId, char *uid, TransitionType type, DesktopStyle style);
+// };
+// }
+// #endif // UI_DESKTOP_FRAGMENT_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/WaterfallDesktopFragment.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/WaterfallDesktopFragment.h
new file mode 100644 (file)
index 0000000..96a73d2
--- /dev/null
@@ -0,0 +1,47 @@
+// /*
+//  * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
+//  * Description: WaterfallDesktopFragment.h
+//  * Author:
+//  * Create: 2025-07-04
+//  */
+
+// #ifndef WATERFALL_DESKTOP_FRAGMENT_H
+// #define WATERFALL_DESKTOP_FRAGMENT_H
+
+// #include "UIDesktopFragment.h"
+// #include "components/ui_waterfall_list.h"
+
+// namespace OHOS {
+// class WaterfallItemView;
+// class WaterfallDesktopFragment : public UIDesktopFragment {
+// public:
+//     bool OnClick(UIView &view, const ClickEvent &event) override;
+//     void AddAppItemToList(const AppItem &item) override;
+//     void ClearAppItemToList() override;
+//     void RefreshAppList() override;
+
+// protected:
+//     void OnCreateView(void* data) override;
+//     void OnDestroyView() override;
+//     void OnResumeView() override;
+
+// private:
+//     UIWaterfallList* waterfallList_{nullptr};
+//     List<WaterfallItemView*> waterfallItemList_;
+// };
+
+// class WaterfallItemView : public UIImageView {
+// public:
+//     explicit WaterfallItemView() {}
+//     ~WaterfallItemView();
+//     bool SetItemInfo(const AppItem &itemInfo);
+//     AppViewId GetViewId();
+//     const char *GetAppUid();
+// private:
+//     WaterfallItemView(const WaterfallItemView &);
+//     WaterfallItemView &operator = (const WaterfallItemView &);
+//     AppItem itemInfo_;
+// };
+// }
+
+// #endif // WATERFALL_DESKTOP_FRAGMENT_H
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/DesktopFactory.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/DesktopFactory.cpp
new file mode 100644 (file)
index 0000000..fa943b2
--- /dev/null
@@ -0,0 +1,37 @@
+// /*
+//  * Copyright (c) CompanyNameMagicTag 2025. All rights reserved.
+//  * Description: DesktopFactory
+//  * Author:
+//  * Create: 2025-07
+//  */
+
+// #include "applist/include/DesktopFactory.h"
+// #include "wearable_log.h"
+
+// namespace OHOS {
+
+// void DesktopFactory::RegisterDesktopStyle(const uint16_t style, DesktopInterface* desktop)
+// {
+//     if (desktop == nullptr) {
+//         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Can't register desktop using null proxy");
+//         return;
+//     }
+//     if (desktops_.find(style) != desktops_.end()) {
+//         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "desktop style %d has already been registered", style);
+//         return;
+//     } else {
+//         desktops_.insert({style, desktop});
+//     }
+// }
+
+// UIDesktopFragment* DesktopFactory::CreateDesktopStyle(uint16_t style)
+// {
+//     auto it = desktops_.find(style);
+//     if (it != desktops_.end()) {
+//         return it->second->CreateDesktop();
+//     } else {
+//         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Desktop style:%d was not registered", style);
+//         return nullptr;
+//     }
+// }
+// } // namespace OHOS
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/FootballDesktopFragment.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/FootballDesktopFragment.cpp
new file mode 100644 (file)
index 0000000..a57ea87
--- /dev/null
@@ -0,0 +1,174 @@
+// /*
+//  * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
+//  * Description: FootballDesktopFragment.cpp
+//  * Author:
+//  * Create: 2025-07-04
+//  */
+
+// #include "applist/include/FootballDesktopFragment.h"
+// #include "applist/include/DesktopFactory.h"
+// #include "common/image_cache_manager.h"
+// #include "common/screen.h"
+// #include "hal_tick.h"
+
+// namespace OHOS {
+// REGIST_DESKTOP_STYLE(FOOTBALL_STYLE, FootballDesktopFragment);
+
+// void FootballDesktopFragment::OnCreateView(void* data)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FootballDesktopFragment::OnCreateView ");
+//     if (footballList_ == nullptr) {
+//         footballList_ = new UIIcosahedronView();
+//     }
+//     footballList_->SetThrowDrag(true);
+//     if (footballDefaultImg_ == nullptr) {
+//         footballDefaultImg_ = ImageCacheManager::GetInstance().LoadSingleRes(PNG_APPLIST_NOTSETUSE_IMG);
+//         if (footballDefaultImg_ == nullptr) {
+//             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "load res faild");
+//             return;
+//         }
+//     }
+//     if (callback_ == nullptr) {
+//         callback_ = new FootballAnimatorCallback(footballList_, 30, 200); // 30: Initial Size 200: Final display size
+//     }
+//     footballList_->SetDefaultImage(footballDefaultImg_);
+//     footballList_->SetPosition(0, 0, fragmentView_.GetWidth(), fragmentView_.GetHeight());
+//     enterAnimator_ = callback_->GetAnimator();
+//     fragmentView_.Add(footballList_);
+//     if (callback_ != nullptr) {
+//         callback_->SetStartTime(HALTick::GetInstance().GetTime());
+//     }
+// }
+
+// void FootballDesktopFragment::OnDestroyView()
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FootballDesktopFragment::OnDestroyView");
+//     ClearAppItemToList();
+//     if (footballList_ != nullptr) {
+//         delete footballList_;
+//         footballList_ = nullptr;
+//     }
+//     if (footballDefaultImg_ != nullptr) {
+//         ImageCacheManager::GetInstance().UnloadSingleRes(PNG_APPLIST_NOTSETUSE_IMG);
+//         footballDefaultImg_ = nullptr;
+//     }
+//     if (callback_ != nullptr) {
+//         delete callback_;
+//         callback_ = nullptr;
+//     }
+//     enterAnimator_ = nullptr;
+// }
+
+// void FootballDesktopFragment::OnResumeView()
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FootballDesktopFragment::OnResumeView");
+//     if (enterAnimator_ != nullptr) {
+//         enterAnimator_->Start();
+//     }
+// }
+
+// bool FootballDesktopFragment::OnClick(UIView &view, const ClickEvent &event)
+// {
+//     UNUSED(event);
+//     FootballItemView *itemView = dynamic_cast<FootballItemView *>(&view);
+//     AppViewId viewId = itemView->GetViewId();
+//     char *uid = (char *)itemView->GetAppUid();
+
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FootballDesktopFragment::OnClick viewid = %d", viewId);
+//     return SwitchView(viewId, uid, TransitionType::TRANSITION_INVALID, FOOTBALL_STYLE);
+// }
+
+// void FootballDesktopFragment::AddAppItemToList(const AppItem &item)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FootballDesktopFragment::AddAppItemToList");
+//     FootballItemView *itemView = new FootballItemView();
+//     if (!itemView->SetItemInfo(item)) {
+//         delete itemView;
+//         return;
+//     }
+//     itemView->SetTouchable(true);
+//     itemView->SetOnClickListener(this);
+//     footballList_->Add(itemView);
+//     footballItemList_.PushBack(itemView);
+// }
+
+// void FootballDesktopFragment::ClearAppItemToList()
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FootballDesktopFragment::ClearAppItemToList");
+//     if (enterAnimator_ != nullptr) {
+//         enterAnimator_->Stop();
+//     }
+//     if (footballList_ != nullptr) {
+//         footballList_->RemoveAll();
+//     }
+//     ListNode<FootballItemView*>* viewNode = footballItemList_.Head();
+//     while (viewNode != footballItemList_.End()) {
+//         delete(viewNode->data_);
+//         viewNode = viewNode->next_;
+//     }
+//     footballItemList_.Clear();
+// }
+
+// void FootballDesktopFragment::RefreshAppList(void)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FootballDesktopFragment::RefreshAppList");
+//     footballList_->RefreshIcosahedron();
+// }
+
+// void FootballAnimatorCallback::Callback(UIView *view)
+// {
+//     if (HALTick::GetInstance().GetElapseTime(startTime_) < 300) { // 300, empirical coefficient
+//         return;
+//     }
+//     if (!isStartAnim_) {
+//         animator_->Stop();
+//         animator_->Start();
+//         isStartAnim_ = true;
+//     }
+//     UIIcosahedronView* footView = dynamic_cast<UIIcosahedronView*>(view);
+//     int16_t el = EasingEquation::LinearEaseNone(startPos_, endPos_, animator_->GetRunTime(), animator_->GetTime());
+//     footView->SetSideLength(el);
+//     footView->RefreshIcosahedron();
+//     const Vector3<float> rotateStart(Screen::GetInstance().GetWidth() / 2.0, // 2.0: divisor
+//         Screen::GetInstance().GetHeight() / 2.0, 0); // 2.0: divisor
+//     const Vector3<float> rotateEnd(0, 0, 0);
+//     // 270 : stop angle
+//     int16_t angle = EasingEquation::LinearEaseNone(0, 270, animator_->GetRunTime(), animator_->GetTime());
+//     footView->RotatePlanes(angle, rotateStart, rotateEnd);
+// }
+
+// FootballItemView::~FootballItemView()
+// {
+//     if (itemInfo_.iconHexagon == nullptr && itemInfo_.hexagonPath != nullptr) {
+//         ImageCacheManager::GetInstance().UnloadOneInMultiRes(itemInfo_.hexagonId, itemInfo_.hexagonPath);
+//     }
+// }
+
+// bool FootballItemView::SetItemInfo(const AppItem &itemInfo)
+// {
+//     itemInfo_ = itemInfo;
+//     if (itemInfo.iconHexagon == nullptr && itemInfo.hexagonPath != nullptr) {
+//         ImageInfo* image =
+//             ImageCacheManager::GetInstance().LoadOneInMultiRes(itemInfo.hexagonId, itemInfo.hexagonPath);
+//         if (image == nullptr) {
+//             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Load App Icon path %s Image %x fail",
+//                 itemInfo.hexagonId, itemInfo.hexagonPath);
+//             return false;
+//         }
+//         SetSrc(image);
+//     } else {
+//         SetSrc(itemInfo.iconHexagon);
+//     }
+//     return true;
+// }
+
+// AppViewId FootballItemView::GetViewId()
+// {
+//     return static_cast<AppViewId>(itemInfo_.id);
+// }
+
+// const char *FootballItemView::GetAppUid()
+// {
+//     return itemInfo_.uid;
+// }
+// }
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/HexagonsDesktopFragment.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/HexagonsDesktopFragment.cpp
new file mode 100644 (file)
index 0000000..516b5b9
--- /dev/null
@@ -0,0 +1,153 @@
+// /*
+//  * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
+//  * Description: HexagonsDesktopFragment.cpp
+//  * Author:
+//  * Create: 2025-07-04
+//  */
+
+// #include "applist/include/HexagonsDesktopFragment.h"
+// #include "applist/include/DesktopFactory.h"
+// #include "common/image_cache_manager.h"
+// #include "NativeAbility.h"
+
+// namespace OHOS {
+// REGIST_DESKTOP_STYLE(HEXAGONS_STYLE, HexagonsDesktopFragment);
+
+// void HexagonsDesktopFragment::OnCreateView(void* data)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HexagonsDesktopFragment::OnCreateView ");
+//     if (hexagonsList_ == nullptr) {
+//         hexagonsList_ = new UICustomHexagonsList();
+//     }
+//     hexagonsList_->SetPosition(0, 0, fragmentView_.GetWidth(), fragmentView_.GetHeight()); // 2, two
+//     imgDistance_ = hexagonsList_->GetWidth() * 0.25991; // 0.25991, empirical coefficient
+//     imgSize_ = hexagonsList_->GetWidth() * 0.23348; // 0.23348, empirical coefficient
+//     hexagonsList_->SetImageDistance(imgDistance_);
+//     hexagonsList_->SetImageSizeInCenter(imgSize_);
+//     int16_t blankSize = hexagonsList_->GetRelativeRect().GetWidth() > hexagonsList_->GetRelativeRect().GetHeight() ?
+//         hexagonsList_->GetRelativeRect().GetWidth() / 2 : hexagonsList_->GetRelativeRect().GetHeight() / 2; // 2, half
+//     hexagonsList_->SetScrollBlankSize(blankSize);
+//     hexagonsList_->SetReboundSize(blankSize);
+//     hexagonsList_->SetThrowDrag(true);
+//     hexagonsList_->SetOnRotateListener(this);
+//     hexagonsList_->RequestFocus();
+//     fragmentView_.Add(hexagonsList_);
+// }
+
+// void HexagonsDesktopFragment::OnDestroyView()
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HexagonsDesktopFragment::OnDestroyView");
+//     ClearAppItemToList();
+//     if (hexagonsList_ != nullptr) {
+//         delete hexagonsList_;
+//         hexagonsList_ = nullptr;
+//     }
+// }
+
+// bool HexagonsDesktopFragment::OnRotate(UIView& view, const RotateEvent& event)
+// {
+//     UICustomHexagonsList* hexagonsView = dynamic_cast<UICustomHexagonsList *>(&view);
+//     if (hexagonsView == nullptr) {
+//         return false;
+//     }
+//     int8_t index = hexagonsView->GetFocusedImgIndex();
+//     uint8_t focusIndex_ = 0;
+//     if (index >= 0) {
+//         focusIndex_ = static_cast<uint8_t>(index);
+//     }
+//     HexagonsItemView *itemView = dynamic_cast<HexagonsItemView *>(hexagonsView->GetViewByIndex(focusIndex_));
+//     AppViewId viewId = itemView->GetViewId();
+//     if (FloatMore(hexagonsView->GetGlobalScale(), 2.0f)) { // 2.0 threshold for beginning transition
+//         hexagonsView->StopRotateAnimator();
+//         NativeAbility::GetInstance().ChangeSlice(viewId, TransitionType::TRANSITION_HEXAGONS);
+//         hexagonsView->ClearFocus();
+//     }
+//     return true;
+// }
+
+// bool HexagonsDesktopFragment::OnClick(UIView &view, const ClickEvent &event)
+// {
+//     UNUSED(event);
+//     HexagonsItemView *itemView = dynamic_cast<HexagonsItemView *>(&view);
+//     UIHexagonsList *hexagonsView = dynamic_cast<UIHexagonsList *>(itemView->GetParent());
+//     if (hexagonsView == nullptr || itemView == nullptr) {
+//         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hexagonsView or itemView is nullptr");
+//         return false;
+//     }
+//     AppViewId viewId = itemView->GetViewId();
+//     char *uid = (char *)itemView->GetAppUid();
+//     hexagonsView->SetDraggable(false);
+//     hexagonsView->Scale(1.0f, itemView->GetViewIndex()); // switch focus to click view
+
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WaterfallDesktopFragment::OnClick viewid = %d", viewId);
+//     return SwitchView(viewId, uid, TransitionType::TRANSITION_HEXAGONS, HEXAGONS_STYLE);
+// }
+
+// void HexagonsDesktopFragment::AddAppItemToList(const AppItem &item)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WaterfallDesktopFragment::AddAppItemToList");
+//     HexagonsItemView *itemView = new HexagonsItemView();
+//     if (!itemView->SetItemInfo(item)) {
+//         delete itemView;
+//         return;
+//     }
+//     itemView->SetTouchable(true);
+//     itemView->SetOnClickListener(this);
+//     hexagonsList_->Add(itemView);
+//     listHexagonsView_.PushBack(itemView);
+// }
+
+// void HexagonsDesktopFragment::ClearAppItemToList()
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HexagonsDesktopFragment::ClearAppItemToList");
+//     if (hexagonsList_ != nullptr) {
+//         hexagonsList_->RemoveAll();
+//     }
+//     ListNode<HexagonsItemView*>* viewNode = listHexagonsView_.Head();
+//     while (viewNode != listHexagonsView_.End()) {
+//         delete(viewNode->data_);
+//         viewNode = viewNode->next_;
+//     }
+//     listHexagonsView_.Clear();
+// }
+
+// void HexagonsDesktopFragment::RefreshAppList(void)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WaterfallDesktopFragment::RefreshAppList");
+//     hexagonsList_->LayoutChildren(true);
+// }
+
+// HexagonsItemView::~HexagonsItemView()
+// {
+//     if (itemInfo_.iconSmall == nullptr && itemInfo_.resPath != nullptr) {
+//         ImageCacheManager::GetInstance().UnloadOneInMultiRes(itemInfo_.resId, itemInfo_.resPath);
+//     }
+// }
+
+// bool HexagonsItemView::SetItemInfo(const AppItem &itemInfo)
+// {
+//     itemInfo_ = itemInfo;
+//     if (itemInfo.iconSmall == nullptr && itemInfo.resPath != nullptr) {
+//         ImageInfo* image = ImageCacheManager::GetInstance().LoadOneInMultiRes(itemInfo.resId, itemInfo.resPath);
+//         if (image == nullptr) {
+//             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Load App Icon path %s Image %x fail",
+//                 itemInfo.resId, itemInfo.resPath);
+//             return false;
+//         }
+//         SetSrc(image);
+//     } else {
+//         SetSrc(itemInfo.iconSmall);
+//     }
+//     return true;
+// }
+
+// AppViewId HexagonsItemView::GetViewId()
+// {
+//     return static_cast<AppViewId>(itemInfo_.id);
+// }
+
+// const char *HexagonsItemView::GetAppUid()
+// {
+//     return itemInfo_.uid;
+// }
+// }
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/ListDesktopFragment.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/ListDesktopFragment.cpp
new file mode 100644 (file)
index 0000000..a7e5420
--- /dev/null
@@ -0,0 +1,138 @@
+// /*
+//  * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
+//  * Description: ListDesktopFragment.cpp
+//  * Author:
+//  * Create: 2025-07-04
+//  */
+
+// #include "applist/include/ListDesktopFragment.h"
+// #include "applist/include/DesktopFactory.h"
+// #include "applist/include/ApplistModel.h"
+
+// namespace OHOS {
+// REGIST_DESKTOP_STYLE(APPLIST_STYLE, ListDesktopFragment);
+
+// static constexpr int16 NUM_2 = 2;
+// static constexpr int16 MAX_SCROLL_DIS = 1000;
+
+// void ListDesktopFragment::OnCreateView(void* data)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::OnCreateView");
+//     listAdapter_ = new ApplistAdapter();
+//     if (listAdapter_ == nullptr) {
+//         return;
+//     }
+//     listAdapter_->SetItemClickListener(this);
+
+//     contentList_ = new UIList(UIList::VERTICAL);
+//     if (contentList_ == nullptr) {
+//         return;
+//     }
+//     contentList_->SetPosition(0, 0);
+//     contentList_->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+//     contentList_->SetScrollBlankSize(VERTICAL_RESOLUTION / NUM_2);
+//     contentList_->SetSelectPosition(VERTICAL_RESOLUTION / NUM_2); // middle position
+//     contentList_->SetDraggable(true);
+//     contentList_->SetThrowDrag(true);
+//     contentList_->EnableAutoAlign(true);
+//     contentList_->SetScrollStateListener(this);
+//     contentList_->SetMaxScrollDistance(MAX_SCROLL_DIS);
+//     contentList_->SetYScrollBarVisible(true);
+
+//     dragListener_ = new AppListOnDragListener();
+//     if (dragListener_ == nullptr) {
+//         return;
+//     }
+//     contentList_->SetOnDragListener(dragListener_);
+//     fragmentView_.Add(contentList_);
+// }
+
+
+// void ListDesktopFragment::OnDestroyView()
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::OnDestroyView");
+//     int16_t listHeadY = contentList_->GetChildrenHead()->GetY();
+//     int16_t listHeadIndex = contentList_->GetChildrenHead()->GetViewIndex();
+//     ApplistModel *model = &ApplistModel::GetInstance();
+//     model->SetHeadItemY(listHeadY);
+//     model->SetStartIndex(listHeadIndex);
+
+//     ClearAppItemToList();
+
+//     if (listAdapter_ != nullptr) {
+//         delete listAdapter_;
+//         listAdapter_ = nullptr;
+//     }
+//     if (contentList_ != nullptr) {
+//         delete contentList_;
+//         contentList_ = nullptr;
+//     }
+//     if (dragListener_ != nullptr) {
+//         delete dragListener_;
+//         dragListener_ = nullptr;
+//     }
+// }
+
+// bool ListDesktopFragment::OnClick(UIView &view, const ClickEvent &event)
+// {
+//     UNUSED(event);
+//     AppItemView *itemView = dynamic_cast<AppItemView *>(&view);
+//     if (itemView == nullptr) {
+//         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "itemView is nullptr");
+//         return false;
+//     }
+//     AppViewId viewId = itemView->GetViewId();
+//     char *uid = (char *)itemView->GetAppUid();
+
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::OnClick viewid = %d", viewId);
+//     return SwitchView(viewId, uid, TransitionType::TRANSITION_INVALID, APPLIST_STYLE);
+// }
+
+// void ListDesktopFragment::OnItemSelected(int16 index, UIView *view)
+// {
+//     UNUSED(index);
+//     if (view != nullptr) {
+//         itemViewSele = static_cast<AppItemView *>(view);
+//         itemViewSele->SelectedChange();
+
+//         if (preItemViewSele != nullptr && preItemViewSele != itemViewSele) {
+//             preItemViewSele->Reset();
+//         }
+//         preItemViewSele = itemViewSele;
+//     }
+// }
+
+// void ListDesktopFragment::AddAppItemToList(const AppItem &item)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::AddAppItemToList");
+//     listAdapter_->AddListItem(item);
+// }
+
+// void ListDesktopFragment::ClearAppItemToList()
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::ClearAppItemToList");
+//     listAdapter_->ClearItem();
+// }
+
+// void ListDesktopFragment::RefreshAppList(void)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::RefreshAppList");
+//     uint16_t startIndex = 0;
+//     int16_t headY = 0;
+//     ApplistModel *model = &ApplistModel::GetInstance();
+//     if (model->GetStartIndex() >= model->GetAppListNum()) {
+//         startIndex = model->GetAppListNum() - 1;
+//         headY = VERTICAL_RESOLUTION / NUM_2;
+//     } else {
+//         startIndex = model->GetStartIndex();
+//         headY = model->GetHeadItemY();
+//         if (headY == 0) {
+//             headY = VERTICAL_RESOLUTION / NUM_2;
+//         }
+//     }
+//     contentList_->SetAdapter(listAdapter_);
+//     contentList_->ScrollTo(startIndex);
+//     contentList_->ScrollBy(headY);
+//     contentList_->RefreshList();
+// }
+// }
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/PlanetDesktopFragment.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/PlanetDesktopFragment.cpp
new file mode 100644 (file)
index 0000000..a0afaa5
--- /dev/null
@@ -0,0 +1,134 @@
+// /*
+//  * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved.
+//  * Description: PlanetDesktop
+//  * Created: 2025-07-29
+//  */
+
+// #include "applist/include/PlanetDesktopFragment.h"
+// #include "applist/include/DesktopFactory.h"
+// #include "applist/include/ApplistModel.h"
+
+// namespace OHOS {
+// REGIST_DESKTOP_STYLE(PLANET_STYLE, PlanetDesktopFragment);
+
+// static constexpr int16 LABEL_FONT_SIZE = 15;
+
+// void PlanetDesktopFragment::OnCreateView(void* data)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlanetDesktopFragment::OnCreateView ");
+//     imgSize_ = 100; // 100, size of item
+//     int16_t imageDistance = 5; // 5, image distance
+//     if (planetList_ == nullptr) {
+//         planetList_ = new UICustomPlanetList(imgSize_, imageDistance);
+//     }
+//     planetList_->SetPosition(0, 0, fragmentView_.GetWidth(), fragmentView_.GetHeight());
+//     planetList_->SetDraggable(true);
+//     planetList_->SetThrowDrag(true);
+//     planetList_->SetItemClickListener(this);
+//     planetList_->RequestFocus();
+//     fragmentView_.Add(planetList_);
+// }
+
+// void PlanetDesktopFragment::OnDestroyView()
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlanetDesktopFragment::OnDestroyView");
+//     ClearAppItemToList();
+//     if (planetList_ != nullptr) {
+//         delete planetList_;
+//         planetList_ = nullptr;
+//     }
+// }
+
+// bool PlanetDesktopFragment::OnClick(UIView &view, const ClickEvent &event)
+// {
+//     UNUSED(event);
+//     PlanetItemView *itemView = dynamic_cast<PlanetItemView *>(&view);
+//     AppViewId viewId = itemView->GetViewId();
+//     char *uid = (char *)itemView->GetAppUid();
+
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlanetDesktopFragment::OnClick viewid = %d", viewId);
+//     return SwitchView(viewId, uid, TransitionType::TRANSITION_INVALID, PLANET_STYLE);
+// }
+
+// void PlanetDesktopFragment::AddAppItemToList(const AppItem &item)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlanetDesktopFragment::AddAppItemToList");
+//     PlanetItemView* itemView = new PlanetItemView();
+//     UILabel* label = new UILabel();
+//     itemView->SetItemInfo(item);
+//     itemView->SetSrc(item.iconSmall);
+//     itemView->SetTouchable(true);
+//     itemView->SetAutoEnable(false);
+//     itemView->SetResizeMode(UIImageView::ImageResizeMode::CONTAIN);
+//     itemView->SetOnClickListener(this);
+//     label->SetText(item.label);
+//     label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT_SIZE);
+//     label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+//     label->SetVisible(false);
+//     label->SetHeight(30); // 30, label height
+//     label->SetWidth(100); // 100, label width
+//     planetList_->AddItemVIew(itemView);
+//     planetList_->AddLabel(label);
+//     pltItemList_.PushBack(itemView);
+//     pltLabelList_.PushBack(label);
+// }
+
+// void PlanetDesktopFragment::ClearAppItemToList()
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlanetDesktopFragment::ClearAppItemToList");
+//     int16_t offsetX = 0;
+//     int16_t offsetY = 0;
+//     ApplistModel *model = &ApplistModel::GetInstance();
+
+//     planetList_->RestoreItemState();
+//     planetList_->GetLastOffset(offsetX, offsetY);
+//     model->SetLastOffset(offsetX, offsetY);
+//     if (planetList_ != nullptr) {
+//         planetList_->RemoveAll();
+//     }
+//     ListNode<PlanetItemView*>* viewNode = pltItemList_.Head();
+//     while (viewNode != pltItemList_.End()) {
+//         delete(viewNode->data_);
+//         viewNode = viewNode->next_;
+//     }
+//     pltItemList_.Clear();
+//     ListNode<UILabel*>* labelNode = pltLabelList_.Head();
+//     while (labelNode != pltLabelList_.End()) {
+//         delete(labelNode->data_);
+//         labelNode = labelNode->next_;
+//     }
+//     pltLabelList_.Clear();
+// }
+
+// void PlanetDesktopFragment::RefreshAppList(void)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlanetDesktopFragment::RefreshAppList");
+//     int16_t offsetX = 0;
+//     int16_t offsetY = 0;
+//     ApplistModel *model = &ApplistModel::GetInstance();
+//     model->GetLastOffset(offsetX, offsetY);
+//     planetList_->SetLastOffset(offsetX, offsetY);
+//     planetList_->LayoutChildren(true);
+//     planetList_->AddClickListenerToAppItems();
+// }
+
+// void PlanetItemView::SetItemInfo(const AppItem &itemInfo)
+// {
+//     itemInfo_ = itemInfo;
+// }
+
+// AppViewId PlanetItemView::GetViewId()
+// {
+//     return static_cast<AppViewId>(itemInfo_.id);
+// }
+
+// const char *PlanetItemView::GetAppUid()
+// {
+//     return itemInfo_.uid;
+// }
+
+// const char *PlanetItemView::GetAppLabel()
+// {
+//     return itemInfo_.label;
+// }
+// }
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/SphereDesktopFragment.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/SphereDesktopFragment.cpp
new file mode 100644 (file)
index 0000000..78426cd
--- /dev/null
@@ -0,0 +1,192 @@
+//   /*
+//  * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025. All rights reserved.
+//  * Description: SphereDesktopFragment
+//  * Author: Hisi Graphic Team
+//  * Created: 2025-09
+//  */
+
+// #include <cmath>
+// #include "applist/include/SphereDesktopFragment.h"
+// #include "applist/include/DesktopFactory.h"
+// #include "common/image_cache_manager.h"
+// #include "NativeAbility.h"
+// #include "hal_tick.h"
+
+// namespace OHOS {
+// REGIST_DESKTOP_STYLE(SPHERE_STYLE, SphereDesktopFragment);
+
+// void SphereDesktopFragment::OnCreateView(void* data)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::OnCreateView ");
+//     if (sphereView_ == nullptr) {
+//         sphereView_ = new UISphereView(1);
+//     }
+//     sphereView_->SetThrowDrag(true);
+
+//     if (callback_ == nullptr) {
+//         callback_ = new SphereAnimatorCallback(sphereView_, fragmentView_.GetWidth(), fragmentView_.GetHeight());
+//     }
+
+//     sphereView_->SetPosition(0, 0, fragmentView_.GetWidth(), fragmentView_.GetHeight());
+//     enterAnimator_ = callback_->GetAnimator();
+//     sphereView_->SetVisible(false);
+//     fragmentView_.Add(sphereView_);
+//     if (callback_ != nullptr) {
+//         callback_->SetStartTime(HALTick::GetInstance().GetTime());
+//     }
+// }
+
+// void SphereDesktopFragment::OnDestroyView()
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::OnDestroyView");
+//     ClearAppItemToList();
+//     if (sphereView_ != nullptr) {
+//         delete sphereView_;
+//         sphereView_ = nullptr;
+//     }
+//     if (callback_ != nullptr) {
+//         delete callback_;
+//         callback_ = nullptr;
+//     }
+//     enterAnimator_ = nullptr;
+// }
+
+// void SphereDesktopFragment::OnResumeView()
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::OnResumeView");
+//     if (enterAnimator_ != nullptr) {
+//         enterAnimator_->Start();
+//     }
+// }
+
+// bool SphereDesktopFragment::OnRotate(UIView& view, const RotateEvent& event)
+// {
+//     UISphereView *sphereView = dynamic_cast<UISphereView *>(&view);
+//     if (sphereView == nullptr) {
+//         return false;
+//     }
+//     sphereView->UpdateItemAngle(event.GetRotate());
+//     return true;
+// }
+
+// bool SphereDesktopFragment::OnClick(UIView &view, const ClickEvent &event)
+// {
+//     UNUSED(event);
+//     SphereItemView *itemView = dynamic_cast<SphereItemView *>(&view);
+//     UISphereView *sphereView = dynamic_cast<UISphereView *>(itemView->GetParent());
+//     if (sphereView == nullptr || itemView == nullptr) {
+//         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sphereView or itemView is nullptr");
+//         return false;
+//     }
+//     AppViewId viewId = itemView->GetViewId();
+//     char *uid = (char *)itemView->GetAppUid();
+//     sphereView->SetDraggable(false);
+
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::OnClick viewid = %d", viewId);
+//     return SwitchView(viewId, uid, TransitionType::TRANSITION_FADEINOUT, SPHERE_STYLE);
+// }
+
+// void SphereDesktopFragment::AddAppItemToList(const AppItem &item)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::AddAppItemToList");
+//     SphereItemView *itemView = new SphereItemView();
+//     if (!itemView->SetItemInfo(item)) {
+//         delete itemView;
+//         return;
+//     }
+//     itemView->SetTouchable(true);
+//     itemView->SetOnClickListener(this);
+//     sphereView_->Add(itemView);
+//     listSphereView_.PushBack(itemView);
+//     sphereView_->SetNumberOfRow((listSphereView_.Size() + 2) / 3); // 控制在3排显示
+// }
+
+// void SphereDesktopFragment::ClearAppItemToList()
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::ClearAppItemToList");
+//     if (enterAnimator_ != nullptr) {
+//         enterAnimator_->Stop();
+//     }
+//     if (sphereView_ != nullptr) {
+//         sphereView_->RemoveAll();
+//     }
+//     ListNode<SphereItemView*>* viewNode = listSphereView_.Head();
+//     while (viewNode != listSphereView_.End()) {
+//         delete(viewNode->data_);
+//         viewNode = viewNode->next_;
+//     }
+//     listSphereView_.Clear();
+// }
+
+// void SphereDesktopFragment::RefreshAppList(void)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::RefreshAppList");
+//     sphereView_->LayoutChildren(true);
+// }
+
+// void SphereAnimatorCallback::Callback(UIView *view)
+// {
+//     if (HALTick::GetInstance().GetElapseTime(startTime_) < 300) { // 300: 动画延迟显示时间,观感效果更好
+//         angle_=0;
+//         return;
+//     }
+//     if (!view->IsVisible()) {
+//         view->SetVisible(true);
+//     }
+//     if (!isStartAnim_) {
+//         animator_->Stop();
+//         animator_->Start();
+//         isStartAnim_ = true;
+//     }
+//     UISphereView* sphereView = dynamic_cast<UISphereView*>(view);
+//     const int16_t precision = 1000;// 1000: 精度
+//     int16_t el = EasingEquation::QuadEaseOut(0, precision, animator_->GetRunTime(), animator_->GetTime()); 
+//     int roateAngle = el * 360 / precision; // 360 : 一共旋转360度
+//     sphereView->UpdateItemAngle(roateAngle - angle_);
+//     angle_ = roateAngle;
+// }
+
+// SphereItemView::~SphereItemView()
+// {
+//     if (imageView_ != nullptr) {
+//         delete imageView_;
+//         imageView_ = nullptr;
+//     }
+//     if (itemInfo_.iconSmall == nullptr && itemInfo_.resPath != nullptr) {
+//         ImageCacheManager::GetInstance().UnloadOneInMultiRes(itemInfo_.resId, itemInfo_.resPath);
+//     }
+// }
+
+// bool SphereItemView::SetItemInfo(const AppItem &itemInfo)
+// {
+//     if (imageView_ == nullptr) {
+//         imageView_ = new UIImageView();
+//     }
+//     itemInfo_ = itemInfo;
+//     if (itemInfo.iconSmall == nullptr && itemInfo.resPath != nullptr) {
+//         ImageInfo* image = ImageCacheManager::GetInstance().LoadOneInMultiRes(itemInfo.resId, itemInfo.resPath);
+//         if (image == nullptr) {
+//             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Load App Icon path %s Image %x fail",
+//                 itemInfo.resId, itemInfo.resPath);
+//             return false;
+//         }
+//         imageView_->SetSrc(image);
+//     } else {
+//         imageView_->SetSrc(itemInfo.iconSmall);
+//     }
+//     Add(imageView_);
+//     SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);
+//     Resize(imageView_->GetWidth(), imageView_->GetHeight());
+//     return true;
+// }
+
+// AppViewId SphereItemView::GetViewId()
+// {
+//     return static_cast<AppViewId>(itemInfo_.id);
+// }
+
+// const char *SphereItemView::GetAppUid()
+// {
+//     return itemInfo_.uid;
+// }
+// }
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/UIDesktopFragment.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/UIDesktopFragment.cpp
new file mode 100644 (file)
index 0000000..40a5383
--- /dev/null
@@ -0,0 +1,50 @@
+// /*
+//  * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
+//  * Description: UIDesktopFragment.cpp
+//  * Author:
+//  * Create: 2025-07-07
+//  */
+
+// #include "applist/include/UIDesktopFragment.h"
+// #include "common/image_cache_manager.h"
+// #include "ability_manager.h"
+// #include "NativeAbility.h"
+
+// namespace OHOS {
+// void UIDesktopFragment::SetPosition(int16_t x, int16_t y, int16_t width, int16_t height)
+// {
+//     fragmentView_.SetPosition(x, y, width, height);
+// }
+
+// bool UIDesktopFragment::SwitchView(AppViewId viewId, char *uid, TransitionType type, DesktopStyle style)
+// {
+//     if (viewId < VIEW_MAX_INTER_APP) {
+//         if (viewId == VIEW_SETTING && style == DesktopStyle::APPLIST_STYLE) {
+//             NativeAbility::GetInstance().ChangeSlice(viewId, type, gSliceDefaultPriority, true);
+//         } else {
+//             NativeAbility::GetInstance().ChangeSlice(viewId, type);
+//         }
+//         return true;
+//     } else if (viewId == VIEW_EXTERN_APP) {
+// #ifdef JS_ENABLE
+//         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UIDesktopFragment::OnClick bundleName = %s", uid);
+//         Want *want = new Want();
+//         memset_s(want, sizeof(Want), 0, sizeof(Want));
+//         ElementName startElement = {};
+//         startElement.abilityName = (char *)"default";
+//         startElement.bundleName = uid;
+//         startElement.deviceId = nullptr;
+//         SetWantElement(want, startElement);
+//         if (viewId == VIEW_SETTING && style == DesktopStyle::APPLIST_STYLE) {
+//             StartAbilityWithAnimation(want, static_cast<uint8_t>(type), true);
+//         } else {
+//             StartAbilityWithAnimation(want, static_cast<uint8_t>(type), false);
+//         }
+//         ClearWant(want);
+//         delete want;
+//         return true;
+// #endif
+//     }
+//     return false;
+// }
+// }
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/WaterfallDesktopFragment.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/WaterfallDesktopFragment.cpp
new file mode 100644 (file)
index 0000000..6e73e2c
--- /dev/null
@@ -0,0 +1,146 @@
+// /*
+//  * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
+//  * Description: WaterfallDesktopFragment.cpp
+//  * Author:
+//  * Create: 2025-07-04
+//  */
+
+// #include "applist/include/WaterfallDesktopFragment.h"
+// #include "applist/include/DesktopFactory.h"
+// #include "common/image_cache_manager.h"
+// #include "common/screen.h"
+
+// namespace OHOS {
+// REGIST_DESKTOP_STYLE(WATERFALL_STYLE, WaterfallDesktopFragment);
+
+// void WaterfallDesktopFragment::OnCreateView(void* data)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WaterfallDesktopFragment::OnCreateView ");
+//     if (waterfallList_ == nullptr) {
+//         waterfallList_ = new UIWaterfallList();
+//     }
+//     waterfallList_->SetPosition(0, 0, fragmentView_.GetWidth(), fragmentView_.GetHeight());
+//     imgDistance_ = waterfallList_->GetWidth() * 0.25991; // 0.25991, empirical coefficient
+//     imgSize_ = waterfallList_->GetWidth() * 0.23348; // 0.23348, empirical coefficient
+//     waterfallList_->SetImageDistance(imgDistance_);
+//     waterfallList_->SetImageSizeInCenter(imgSize_);
+//     int16_t blankSize = waterfallList_->GetRelativeRect().GetWidth() > waterfallList_->GetRelativeRect().GetHeight() ?
+//         waterfallList_->GetRelativeRect().GetWidth() / 2 : waterfallList_->GetRelativeRect().GetHeight() / 2; // 2, half
+//     waterfallList_->SetThrowDrag(true);
+//     uint16_t layoutHeight = static_cast<uint16_t>(imgDistance_ * Sin(60));
+//     waterfallList_->SetReboundSize(layoutHeight); // 60: degree, row's layout height
+//     waterfallList_->SetScrollBlankSize(layoutHeight, UIAbstractScroll::Direction::TOP);
+//     waterfallList_->SetScrollBlankSize(Screen::GetInstance().GetHeight() / 2 - layoutHeight, // 2: half
+//         UIAbstractScroll::Direction::BOTTOM);
+//     waterfallList_->RequestFocus();
+//     waterfallList_->SetRotateFactor(10); // 10, empirical coefficient
+//     waterfallList_->SetOnRotateListener(this);
+//     waterfallList_->SetTouchable(false);
+//     waterfallList_->SetDraggable(false); // ensure that it can't be dragged during animation to avoid error display
+//     fragmentView_.Add(waterfallList_);
+// }
+
+// void WaterfallDesktopFragment::OnDestroyView()
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WaterfallDesktopFragment::OnDestroyView");
+//     ClearAppItemToList();
+//     if (waterfallList_ != nullptr) {
+//         delete waterfallList_;
+//         waterfallList_ = nullptr;
+//     }
+// }
+
+// void WaterfallDesktopFragment::OnResumeView()
+// {
+//     if (waterfallList_ != nullptr) {
+//         waterfallList_->SetTouchable(true);
+//         waterfallList_->SetDraggable(true); // resume touchable after transition animation
+//     }
+// }
+
+// bool WaterfallDesktopFragment::OnClick(UIView &view, const ClickEvent &event)
+// {
+//     UNUSED(event);
+//     WaterfallItemView *itemView = dynamic_cast<WaterfallItemView *>(&view);
+//     UIWaterfallList *waterfallView = dynamic_cast<UIWaterfallList *>(itemView->GetParent());
+//     if (waterfallView == nullptr || itemView == nullptr) {
+//         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "waterfallView or itemView is nullptr");
+//         return false;
+//     }
+//     AppViewId viewId = itemView->GetViewId();
+//     char *uid = (char *)itemView->GetAppUid();
+//     waterfallView->SetDraggable(false);
+//     waterfallView->Scale(1.0f, itemView->GetViewIndex());
+
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WaterfallDesktopFragment::OnClick viewid = %d", viewId);
+//     return SwitchView(viewId, uid, TransitionType::TRANSITION_WATERFALL, APPLIST_STYLE);
+// }
+
+// void WaterfallDesktopFragment::AddAppItemToList(const AppItem &item)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WaterfallDesktopFragment::AddAppItemToList");
+//     WaterfallItemView *itemView = new WaterfallItemView();
+//     if (!itemView->SetItemInfo(item)) {
+//         delete itemView;
+//         return;
+//     }
+//     itemView->SetTouchable(true);
+//     itemView->SetOnClickListener(this);
+//     waterfallList_->Add(itemView);
+//     waterfallItemList_.PushBack(itemView);
+// }
+
+// void WaterfallDesktopFragment::ClearAppItemToList()
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WaterfallDesktopFragment::ClearAppItemToList");
+//     if (waterfallList_ != nullptr) {
+//         waterfallList_->RemoveAll();
+//     }
+//     ListNode<WaterfallItemView*>* viewNode = waterfallItemList_.Head();
+//     while (viewNode != waterfallItemList_.End()) {
+//         delete(viewNode->data_);
+//         viewNode = viewNode->next_;
+//     }
+//     waterfallItemList_.Clear();
+// }
+
+// void WaterfallDesktopFragment::RefreshAppList(void)
+// {
+//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WaterfallDesktopFragment::RefreshAppList");
+//     waterfallList_->LayoutChildren(true);
+// }
+
+// WaterfallItemView::~WaterfallItemView()
+// {
+//     if (itemInfo_.iconSmall == nullptr && itemInfo_.resPath != nullptr) {
+//         ImageCacheManager::GetInstance().UnloadOneInMultiRes(itemInfo_.resId, itemInfo_.resPath);
+//     }
+// }
+
+// bool WaterfallItemView::SetItemInfo(const AppItem &itemInfo)
+// {
+//     itemInfo_ = itemInfo;
+//     if (itemInfo.iconSmall == nullptr && itemInfo.resPath != nullptr) {
+//         ImageInfo* image = ImageCacheManager::GetInstance().LoadOneInMultiRes(itemInfo.resId, itemInfo.resPath);
+//         if (image == nullptr) {
+//             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Load App Icon path %s Image %x fail",
+//                 itemInfo.resId, itemInfo.resPath);
+//             return false;
+//         }
+//         SetSrc(image);
+//     } else {
+//         SetSrc(itemInfo.iconSmall);
+//     }
+//     return true;
+// }
+
+// AppViewId WaterfallItemView::GetViewId()
+// {
+//     return static_cast<AppViewId>(itemInfo_.id);
+// }
+
+// const char *WaterfallItemView::GetAppUid()
+// {
+//     return itemInfo_.uid;
+// }
+// }
index 94c990a..3c56330 100644 (file)
@@ -12,6 +12,7 @@
 #include "bts_gatt_stru.h"\r
 #include "bts_gatt_server.h"\r
 #include "bts_le_gap.h"\r
+#include "bts_gatt_client.h"\r
 \r
 #ifdef __cplusplus\r
 extern "C" {\r
@@ -24,7 +25,8 @@ errcode_t wrapper_gatts_register_server(bt_uuid_t *app_uuid, uint8_t *server_id)
 errcode_t wrapper_gatts_add_service(uint8_t server_id, bt_uuid_t *service_uuid, bool is_primary);\r
 void wrapper_gatts_service_start(void);\r
 void wrapper_gatts_clear_service(void);\r
-\r
+errcode_t wrapper_gattc_register_callbacks(gattc_callbacks_t *func);\r
+errcode_t wrapper_gattc_register_client(bt_uuid_t *uuid, uint8_t *clientId);\r
 #ifdef __cplusplus\r
 }\r
 #endif\r
index af22c1a..91af34e 100644 (file)
@@ -9,7 +9,6 @@
 #include "bluetooth/include/BluetoothModelC.h"\r
 #include "bluetooth/include/BluetoothWrapper.h"\r
 #include "bluetooth/include/BluetoothPresenter.h"\r
-#include "connectnewphone/include/ConnectPhonePresenter.h"\r
 #include "player/include/MusicPlayerSourceView.h"\r
 #include "bluetooth/include/BluetoothItemView.h"\r
 #include "player/include/PlayersModel.h"\r
@@ -891,17 +890,6 @@ void BtGapPairStatusChangedCallback(const bd_addr_t *bdAddr, int status)
             set_br_pair(1);\r
         }\r
     }\r
-\r
-   \r
-\r
-    if (status == GAP_PAIR_PAIRED) {\r
-        \r
-        if (ConnectPhonePresenter::GetInstance() != nullptr) {\r
-            NativeAbility::GetInstance().ChangeSlice(VIEW_SETTING);\r
-        }\r
-       \r
-    }\r
-\r
     #endif\r
 }\r
 \r
index 2274cba..f0185f4 100644 (file)
@@ -336,4 +336,23 @@ void wrapper_gatts_clear_service(void)
 }\r
 #ifdef __cplusplus\r
 }\r
+\r
+errcode_t wrapper_gattc_register_callbacks(gattc_callbacks_t *func)\r
+{\r
+    // g_gattc_callback_list.push_back(*func);\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t wrapper_gattc_register_client(bt_uuid_t *uuid, uint8_t *clientId)\r
+{\r
+    errcode_t ret = ERRCODE_SUCC;\r
+    // if (gattc_register_flag) {\r
+    //     *clientId = gattc_client_id;\r
+    //     ret = ERRCODE_SUCC;\r
+    // } else {\r
+    //     gattc_register_flag = true;\r
+    //     ret = gattc_register_client(uuid, clientId);\r
+    //     gattc_client_id = *clientId;\r
+    // }\r
+    return ret;\r
+}\r
 #endif\r
diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/heartrate/src/HeartModel.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/heartrate/src/HeartModel.cpp
new file mode 100644 (file)
index 0000000..60f18f1
--- /dev/null
@@ -0,0 +1,1105 @@
+#include "heartrate/include/HeartModel.h"
+#include "indoorwalk/include/IndoorWalkPreparedView.h"
+#include "indoorwalk/include/IndoorWalkPresenter.h"
+#include "main/include/MainViewSample.h"
+#include "graphic_service.h"
+#include "wearable_log.h"
+
+#include "main/include/dial/DialModelHeartRate.h"
+#include "heartrate/include/HeartChartView.h"
+#include "heartrate/include/HeartDetectionPresenter.h"
+#include "heartrate/include/HeartRateView.h"
+#include "heartrate/include/HeartResultPresenter.h"
+
+#include "ConfigModel.h"
+#include "main/include/dial/DialModelHeartRate.h"
+#include "custom_runtime.h"
+#include "custom_utils.h"
+
+#include "health/health_service/health_service.h"
+#include <cstdint>
+
+#ifdef SUPPORT_PPG_SERVICE
+#include "ppg_hal.h"
+#include "ppg_service.h"
+#endif
+
+#include "settings/include/SettingModel.h"
+#include "uiservice/include/ui_service.h"
+#include "wearable_log.h"
+#include <algorithm>
+
+#include "clock/include/MainClockView.h"
+
+#ifdef SUPPORT_BLE_SERVICE
+#include "bleEvent.h"
+#include "bleInstruct.h"
+#include "bleService.h"
+#endif
+
+#include <cmsis_os.h>
+#include <cmsis_os2.h>
+#include <custom_utils.h>
+#include <iostream>
+#include <memory>
+#include <ohos_types.h>
+#include <random>
+#include <service/graphic_service.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#ifdef SUPPORT_BATTERY_SERVICE
+#include "battery_hal.h"
+#endif
+
+#include "languagecode/LanguageInit.h"
+#include "uiservice/include/ui_service.h"
+
+#include <custom_save_runtime.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAX_UNWEAR_COUNT 2
+#define MAX_VALID_HRS_COUNT 10    //最大有效数
+#define MAX_DISVALID_HRS_COUNT 15 //最大无效数
+#define MIN_DISPLAY_HEART 50      //最新心率
+#define DISPLAY_COUNT 0
+#define HEARTTEST 1 //[0 开启测试 1 关闭]
+#define KEEP_SCREEN_ON_HEART 1
+#define HEART_TIMER_DATA 1
+
+/*佩戴检测结果*/
+enum {
+  SENSOR_WEAR_ON = 0,
+  SENSOR_WEAR_OFF,
+  SENSOR_WEAR_UNKNOW,
+  SENSOR_WEAR_MAX
+};
+
+using namespace OHOS;
+#define LEN 32
+
+static void Notify(void *args, const Topic topic, Request *request);
+
+Subscriber heartSubscirber = {
+    .identity = nullptr,
+    .args = nullptr,
+    .Notify = Notify,
+};
+static void ProcessHeartRateUpdate(Request *request);
+static void RefreshHeartData();
+void save_heart_maxmin();
+void HeartDataSubscribeTopic(Topic topic) {
+  BroadcastApi *broadcastApi = nullptr;
+  IUnknown *api = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE_NAME,
+                                                     BROADCAST_FEATURE_NAME);
+  if (api == nullptr) {
+    return;
+  }
+  int result =
+      api->QueryInterface(api, DEFAULT_VERSION, (void **)&broadcastApi);
+  if (result != 0 || broadcastApi == nullptr) {
+    return;
+  }
+  int ret = broadcastApi->SubscribeTopic((IUnknown *)broadcastApi, topic,
+                                         &heartSubscirber);
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HeartSubscribeTopic ret=%d,topic=%u",
+                ret, topic);
+  broadcastApi->Release((IUnknown *)broadcastApi);
+}
+
+void HearDatatUnsubscribeTopic(Topic topic) {
+  BroadcastApi *broadcastApi = nullptr;
+  IUnknown *api = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE_NAME,
+                                                     BROADCAST_FEATURE_NAME);
+  if (api == nullptr) {
+    return;
+  }
+  int result =
+      api->QueryInterface(api, DEFAULT_VERSION, (void **)&broadcastApi);
+  if (result != 0 || broadcastApi == nullptr) {
+    return;
+  }
+  broadcastApi->UnsubscribeTopic((IUnknown *)broadcastApi, topic,
+                                 &heartSubscirber);
+  broadcastApi->Release((IUnknown *)broadcastApi);
+}
+
+static void Notify(void *args, const Topic topic, Request *request) {
+  UNUSED(args);
+  UNUSED(topic);
+
+  // 训练过程中不需要判断数据准确性,不需要存储心率数据
+  if (uapi_dev_runtime_get_train_status() == 1 ||
+      uapi_dev_runtime_get_respiratory_training_status() || request == NULL) {
+    return;
+  }
+  if (request->msgId == TOPIC_EVENT_HEARTRATE_UPDATA) {
+    GraphicService::GetInstance()->PostGraphicEvent(std::bind(
+        &HeartModel::RefreshHeartRateScreen, HeartModel::GetInstance()));
+  }
+}
+
+static void ProcessHeartRateUpdate(Request *request) {
+  uint16_t preheart = *reinterpret_cast<uint16_t *>(request->data);
+
+  // 直接处理心率数据,不进行筛选
+  uint16_t index_ = HeartModel::GetInstance()->GetIndex();
+  HeartDatas *heartInfo = (HeartDatas *)malloc(sizeof(HeartDatas));
+  if (heartInfo == NULL) {
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[Notify] malloc fail");
+    return;
+  }
+
+  heartInfo->index = index_;
+  heartInfo->maxX = index_;
+  heartInfo->minX = index_;
+  heartInfo->perSec = preheart;
+  heartInfo->rest = preheart;
+  /*最大最小值不为0*/
+  heartInfo->maxValue = preheart;
+  heartInfo->minValue = preheart;
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "heartRateData=%d%d", heartInfo->index,
+                preheart);
+  OHOS::HeartModel::GetInstance()->HeartRatePros(heartInfo);
+
+  free(heartInfo); // 释放内存
+  heartInfo = nullptr;
+}
+
+static void RefreshHeartData() {
+  OHOS::HeartModel::GetInstance()->ClearHeartData();
+  GraphicService::GetInstance()->PostGraphicEvent(std::bind(
+      &OHOS::HeartModel::Heart_Update_View, OHOS::HeartModel::GetInstance()));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+namespace OHOS {
+void HeartModel::ClearHeartData(void) {
+  pretime = 0;
+  entryTimes = 0;
+  aveCount = 0;
+  preMaxValue = 0;
+  preMaxX = NUM_1;
+  preMinValue = HEART_RATE_LIMIT_UPPER;
+  preMinX = NUM_1;
+  countMax = 0;
+  countMin = 0;
+  healthDatas.heartRateMax.x = (uint16_t)0XFFFF;
+  healthDatas.heartRateMax.y = 0;
+  healthDatas.heartRateMin.x = (uint16_t)0XFFFF;
+  healthDatas.heartRateMin.y = (uint16_t)0XFFFF;
+  for (int i = 0; i < HEART_AVE_NUM; i++) {
+    healthDatas.heartRateAvg[i].x = (uint16_t)0XFFFF;
+    healthDatas.heartRateAvg[i].y = (uint16_t)0XFFFF;
+  }
+  if (HeartRateView::GetInstance() != nullptr) {
+    HeartRateView::GetInstance()->ClearElectrocardiogram();
+  }
+  SetAveHeartRateCount(0);
+  // GraphicService::GetInstance()->PostGraphicEvent(
+  //     std::bind(&HeartModel::RefreshHeartRateScreen,
+  //     HeartModel::GetInstance(),
+  //               healthDatas.heartRatePerSec, healthDatas.heartRateRest,
+  //               healthDatas.heartRateMax.y, healthDatas.heartRateMin.y));
+}
+
+HeartModel::HeartModel() {
+  /*初始化读取文件*/
+  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartModel::HeartModel()");
+  /*初始化历史文件*/
+  HealthService::GetInstance()->LoadDailyHeartRate();
+  /*读取上一次心率数据*/
+  HeartRateData data;
+  HealthService::GetInstance()->ReadHeartRateData(data);
+  currentheart = data.Heart;
+  timestamp_ms = data.timestamp;
+  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "currentheart %d timestamp_ms %d",
+                currentheart, timestamp_ms);
+  // 更新表盘心率数据
+  DialModelHeartRate::GetInstance()->UpdateHeartRate(currentheart);
+
+  //读取最大最小值
+  HealthService::GetInstance()->LoadHeartMaxMin(displayheart_max,
+                                                displayheart_min);
+  // 配置动态数组
+  SetArrayData();
+}
+
+HeartModel::~HeartModel() {
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HeartModel::~HeartModel()");
+  HearDatatUnsubscribeTopic(TOPIC_EVENT_HEARTRATE_UPDATA);
+  HearDatatUnsubscribeTopic(TOPIC_EVENT_NEXTDAY_UPDATE);
+  HearDatatUnsubscribeTopic(TOPIC_EVENT_UTCTIME_UPDATE);
+  HearDatatUnsubscribeTopic(TOPIC_EVENT_WEARSTATE_UPDATE);
+}
+
+HeartModel *HeartModel::GetInstance(void) {
+  static HeartModel heartModel;
+  return &heartModel;
+}
+uint16_t HeartModel::GetIndex() { return index_; }
+void HeartModel::SetIndex(uint16_t index) { index_ = index; }
+
+void HeartModel::Init(void) {
+  HeartDataSubscribeTopic(TOPIC_EVENT_HEARTRATE_UPDATA);
+  HeartDataSubscribeTopic(TOPIC_EVENT_NEXTDAY_UPDATE);
+  HeartDataSubscribeTopic(TOPIC_EVENT_UTCTIME_UPDATE);
+  HeartDataSubscribeTopic(TOPIC_EVENT_WEARSTATE_UPDATE);
+}
+
+Point *HeartModel::GetAveHeartRate(void) { return healthDatas.heartRateAvg; }
+
+void HeartModel::HandleMaxHeart(uint16 coord, uint16 value) {
+  healthDatas.heartRateMax.x = coord;
+  healthDatas.heartRateMax.y = value;
+  // 插入最大心率 countMax 数据个数
+  if (preMaxValue != healthDatas.heartRateMax.y && aveCount < HEART_AVE_NUM) {
+    if (preMaxX == healthDatas.heartRateMax.x && countMax < HEART_AVE_NUM) {
+      healthDatas.heartRateAvg[countMax].y = healthDatas.heartRateMax.y;
+    } else if (aveCount > NUM_2 && (healthDatas.heartRateMax.x ==
+                                    healthDatas.heartRateAvg[aveCount - 1].x)) {
+      healthDatas.heartRateAvg[aveCount - 1].y = healthDatas.heartRateMax.y;
+    } else {
+      healthDatas.heartRateAvg[aveCount] = healthDatas.heartRateMax;
+      countMax = aveCount;
+      aveCount++;
+    }
+    if (healthDatas.heartRateMax.x != 0) {
+      if (healthDatas.heartRateAvg[0].x == 0 &&
+          healthDatas.heartRateAvg[1].x == 0) {
+        for (int i = 1; i < (aveCount - 1); i++) {
+          healthDatas.heartRateAvg[i] = healthDatas.heartRateAvg[i + 1];
+        }
+        aveCount--;
+        countMax--;
+      }
+    }
+  }
+  preMaxValue = healthDatas.heartRateMax.y;
+  preMaxX = healthDatas.heartRateMax.x;
+}
+
+void HeartModel::HandleMinHeart(uint16 coord, uint16 value) {
+  // 最小心率
+  healthDatas.heartRateMin.x = coord;
+  healthDatas.heartRateMin.y = value;
+  // 插入最小心率
+  // avecount 当下有效数据个数,在MaxHeart中也用到,看起来似乎有问题???
+  // preMinValue 上一个心率最小值
+  // preMinX 上一个最小值对应的坐标
+  // 当上一个值与当前值不等,且没有超过总数限制,则进行数据处理
+  if (preMinValue != healthDatas.heartRateMin.y && aveCount < HEART_AVE_NUM) {
+
+    if (preMinX == healthDatas.heartRateMin.x && countMin < HEART_AVE_NUM) {
+      // 上一个最小坐标和当前值一致,且数据没超过限制,则直接赋值给有效数据
+      // countMin 即可
+      healthDatas.heartRateAvg[countMin].y = healthDatas.heartRateMin.y;
+    } else if (aveCount > NUM_2 && (healthDatas.heartRateMin.x ==
+                                    healthDatas.heartRateAvg[aveCount - 1].x)) {
+      // 有效数据大于2,且当前x值与原始数据最后一个x一致,最后一个数据赋值
+      healthDatas.heartRateAvg[aveCount - 1].y = healthDatas.heartRateMin.y;
+    } else {
+      healthDatas.heartRateAvg[aveCount] = healthDatas.heartRateMin;
+      countMin = aveCount;
+      aveCount++;
+    }
+
+    // 最初的值一直是0 ,则只显示1个 ,不会在后面增加数据。
+    if (healthDatas.heartRateMin.x != 0) {
+      if (healthDatas.heartRateAvg[0].x == 0 &&
+          healthDatas.heartRateAvg[1].x == 0) {
+        for (int i = 0; i < (aveCount - 1); i++) {
+          healthDatas.heartRateAvg[i] = healthDatas.heartRateAvg[i + 1];
+        }
+        aveCount--;
+        countMin--;
+      }
+    }
+  }
+  preMinValue = healthDatas.heartRateMin.y;
+  preMinX = healthDatas.heartRateMin.x;
+}
+
+void HeartModel::HeartRatePros(HeartDatas *heartInfo) {
+  uint16_t perSecHeartRate = 0;
+  uint16_t restHeartRate = 0;
+
+  // 每秒心率
+  perSecHeartRate = heartInfo->perSec;
+  if (perSecHeartRate >= HEART_RATE_LIMIT_LOWER &&
+      perSecHeartRate <= HEART_RATE_LIMIT_UPPER) {
+    healthDatas.heartRatePerSec = perSecHeartRate;
+  }
+
+  // GraphicService::GetInstance()->PostGraphicEvent(
+  //     std::bind(&HeartModel::RefreshHeartRateScreen,
+  //     HeartModel::GetInstance(),
+  //               healthDatas.heartRatePerSec, healthDatas.heartRateRest,
+  //               healthDatas.heartRateMax.y, healthDatas.heartRateMin.y));
+}
+
+uint16_t HeartModel::GetAveHeartRateCount(void) { return aveCount; }
+
+uint16_t HeartModel::GetHeartRateMax(void) {
+  return healthDatas.heartRateMax.y;
+}
+
+uint16_t HeartModel::GetHeartRateMin(void) {
+  return healthDatas.heartRateMin.y;
+}
+
+void HeartModel::SetHeartRatePerSec(uint32 sec) {
+  healthDatas.heartRatePerSec = sec;
+  if (HeartRateView::GetInstance() == nullptr) {
+    return;
+  }
+  HeartRateView::GetInstance()->RefreshHeartRatePerSec(
+      healthDatas.heartRatePerSec);
+}
+
+void HeartModel::SetAveHeartRateCount(uint16_t value) { aveCount = value; }
+
+void HeartModel::RefreshHeartRateScreen() {
+  if (MainViewSample::GetInstance() != nullptr &&
+      HeartChartView::GetInstance() != nullptr) {
+    if (MainViewSample::GetInstance()->GetHorCurrentCard() == HEART_RATE) {
+      WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
+                    "HeartChartView::GetInstance() start");
+      HeartChartView::GetInstance()->UpdateShowHeart();
+      WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
+                    "HeartChartView::GetInstance() end");
+    }
+  }
+}
+/*----------------------------------状态检测
+ *----------------------------------*/
+
+// 重新初始化
+void HeartModel::ClearDisplayData() {
+  /*显示的心率数据清空*/
+  // currentheart = 0;
+  // timestamp_ms = 0;
+  displayheart = 0;
+  displayheart_max = 0; // 显示最大心率
+  displayheart_min = 0; // 显示最小心率
+}
+// 获取心率数据
+uint16_t HeartModel::GetHeartdata() { return currentheart; }
+
+uint16_t HeartModel::GetShowHeartdata() { return displayheart; }
+uint16_t HeartModel::GetShowMaxHeartdata() { return displayheart_max; }
+uint16_t HeartModel::GetShowMinHeartdata() { return displayheart_min; }
+uint32_t HeartModel::GetCheckTime() { return timestamp_ms; }
+
+void HeartModel::SetCheckTime(uint32_t time) { timestamp_ms = time; }
+void HeartModel::SetResult(HeartResult result) { heartresult_ = result; }
+HeartResult HeartModel::GetResult() { return heartresult_; }
+// 控制心率检测
+void HeartModel::Heart_Control(HeartState state, HeartCheck check) {
+
+  //优先级低不对高优先级处理
+  if (check < checkstate) {
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
+                  "Higher execution instruction exists");
+    return;
+  }
+
+  //被动
+  if (check == HeartCheck::PASSIVITY) {
+    uapi_dev_runtime_set_hrs_passivity(1);
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
+                  "uapi_dev_runtime_set_hrs_passivity(1)");
+  } else {
+    uapi_dev_runtime_set_hrs_passivity(0);
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+                  "uapi_dev_runtime_set_hrs_passivity(0)");
+  }
+
+  if (state == HeartState::End && heartstate == true) {
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartState End");
+    //状态数全部清空
+    valid_counter_ = 0;
+    disvalid_counter_ = 0;
+    unwear_counter_ = 0;
+    display_counter_ = 0;
+    displayheart = 0;
+#ifdef SUPPORT_PPG_SERVICE
+    ppg_hr_stop();
+#endif
+    heartstate = false;
+    if (checkstate == HeartCheck::CARDCHECK) {
+      //重置传感器状态
+      sensorstate = false;
+      uapi_dev_runtime_set_heartrate_detect_status(0);
+    }
+#ifdef SYSTEM_LOG_SERVICE
+    //记录日志
+    if (checkstate == HeartCheck::PASSIVITY) {
+      uapi_save_runtime_log(RUNTIME_LOG_OXYGEN_PASSIVE_MEASURE_END);
+    } else {
+      uapi_save_runtime_log(RUNTIME_LOG_HEART_MEASURE_END);
+    }
+#endif
+
+    // 复原检测状态
+    checkstate = HeartCheck::RESTSTSTE;
+    heart_stop_data_timer(); //关闭数据获取
+  } else if (state == HeartState::Start && heartstate == false) {
+    /*充电状态下不进行检测*/
+    bool isCharging = false;
+    #ifdef SUPPORT_BATTERY_SERVICE
+    isCharging = get_charge_stat(); // 获取充电状态
+    #endif
+    if (isCharging) {
+      WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "充电不能检测");
+      return;
+    }
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartState Start");
+#ifdef SUPPORT_PPG_SERVICE
+    ppg_hr_start();
+#endif
+    heartstate = true;
+    checkstate = check;
+#ifdef SYSTEM_LOG_SERVICE
+    //记录日志
+    if (checkstate == HeartCheck::PASSIVITY) {
+      uapi_save_runtime_log(RUNTIME_LOG_HEART_PASSIVE_MEASURE);
+    } else {
+      uapi_save_runtime_log(RUNTIME_LOG_HEART_MEASURE);
+    }
+#endif
+    heart_data_timer(); // 开始检测
+  }
+}
+// 开始检测
+void HeartModel::Heart_Start(HeartCheck check) {
+  if (!sensorstate) {
+    displayheart = 0;
+    SetResult(HeartResult::NOT_TESTED); // 重置检测
+    Heart_Control(HeartState::Start, check);
+    // ScreenTurnOn(60 * 1000); // 亮屏操作 600000ms 60秒关闭
+    sensorstate = true;
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "开始心率检测");
+    // 设置runtime
+    if (uapi_dev_runtime_get_heartrate_detect_status() == 0) {
+      uapi_dev_runtime_set_heartrate_detect_status(1);
+      ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON);
+      // 主动检测的亮屏60s
+      heart_start_screen60s_timer();
+    }
+  }
+}
+
+// 结束检测
+void HeartModel::Heart_Stop() {
+  valid_counter_ = 0;
+  disvalid_counter_ = 0;
+  unwear_counter_ = 0;
+
+  /*主界面卡片检测 或者 被动检测*/
+  if (checkstate == HeartCheck::PASSIVITY) {
+    if (heartresult_ == HeartResult::SUCCESS) {
+      Heart_Save();
+      /*更新曲线*/
+      GraphicService::GetInstance()->PostGraphicEvent(
+          std::bind(&HeartModel::Heart_Update_View, HeartModel::GetInstance()));
+    }
+    /*关闭被动检测*/
+    Heart_Control(HeartState::End, HeartCheck::PASSIVITY);
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "结束周期心率检测");
+    return;
+  }
+  //呼吸训练模式下不进行息屏与保存
+  if (sensorstate && uapi_dev_runtime_get_respiratory_training_status() != 1) {
+    // 恢复正常亮屏
+    HeartModel::GetInstance()->heart_stop_screen60s_timer();
+    // 取消常亮屏
+    ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON);
+    //设置runtime
+
+    Heart_Result(); // 处理结果
+
+    //为了防止主界面卡片一直重复开传感器
+    if (checkstate != HeartCheck::CARDCHECK) {
+      //重置传感器状态
+      sensorstate = false;
+      uapi_dev_runtime_set_heartrate_detect_status(0);
+    }
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "本次心率检测结束");
+  }
+}
+// 保存检测数据
+void HeartModel::Heart_Save() {
+
+  uint32_t timestamp = HeartResultPresenter::GetInstance()->GetCurrentTime();
+  SetCheckTime(timestamp);
+
+  HealthService::GetInstance()->send_heart_save();
+
+  // 更新最大和最小心率
+  displayheart_max =
+      (displayheart_max < currentheart ? currentheart : displayheart_max);
+
+  // 确保最小心率的第一次赋值大于50
+  if (displayheart_min == 0 && currentheart > MIN_DISPLAY_HEART) {
+    displayheart_min = currentheart; // 初始化最小心率
+  } else {
+    displayheart_min =
+        (displayheart_min > currentheart && currentheart > MIN_DISPLAY_HEART)
+            ? currentheart
+            : displayheart_min;
+  }
+
+  // 将更新曲线写到这里提前更新
+  HealthService::GetInstance()->UpdateHourlyHeartRate(timestamp_ms,
+                                                      currentheart);
+  // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存的心率数据:%d%ld",
+  // currentheart,data.timestamp);
+}
+
+void HeartModel::Heart_Result() {
+
+  if (heartresult_ == HeartResult::SUCCESS) {
+    // 获取心率提醒状态和阈值
+    heartRemindState = ConfigModel::GetInstance()->get_configData_int(
+        ConfigModel::CONFIGMODEL_ITEM_HEARTRATE_REMIND);
+    thresholdValue = ConfigModel::GetInstance()->get_configData_int(
+        ConfigModel::CONFIGMODEL_ITEM_HEARTRATE_THRESHOLD_VALUE);
+
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "心率提醒状态:%d,阈值:%d,當前值:%d",
+                  heartRemindState, thresholdValue, currentheart);
+
+    if (heartRemindState) {
+      // 获取当前心率状态
+      thresholdState = ConfigModel::GetInstance()->get_configData_int(
+          ConfigModel::CONFIGMODEL_ITEM_HEARTRATE_MAX_MIN);
+
+      if (currentheart != 0) {
+        if (thresholdState == 0 && currentheart < thresholdValue) {
+          // 当前心率低于阈值
+          heartresult_ = HeartResult::LOW_RESULT;
+          WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+                        "检测结果:低结果情况,currentheart=%d,ThresholdValue=%d",
+                        currentheart, thresholdValue);
+        } else if (thresholdState == 1 && currentheart > thresholdValue) {
+          // 当前心率高于阈值
+          heartresult_ = HeartResult::HIGH_RESULT;
+          WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+                        "检测结果:高结果情况,currentheart=%d,ThresholdValue=%d",
+                        currentheart, thresholdValue);
+        }
+      }
+    }
+  }
+  // 根据结果进行处理
+  handleHeartResult();
+}
+// 处理检测结果
+void HeartModel::handleHeartResult() {
+  switch (heartresult_) {
+  case HeartResult::SUCCESS:
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "检测结果:成功");
+    Heart_Save();
+    // 更新曲线
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "准备更新UI");
+    GraphicService::GetInstance()->PostGraphicEvent(
+        std::bind(&HeartModel::Heart_Update_View, HeartModel::GetInstance()));
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "更新UI完成");
+    break;
+
+  case HeartResult::NOT_WORN:
+  case HeartResult::TIMEOUT:
+  case HeartResult::INVALID_DATA:
+    logAndChangeSlice(heartresult_);
+    break;
+
+  case HeartResult::LOW_RESULT:
+    Heart_Save();
+    handleLowHeartRate();
+    break;
+
+  case HeartResult::HIGH_RESULT:
+    Heart_Save();
+    handleHighHeartRate();
+    break;
+
+  default:
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "检测结果:未知状态");
+    break;
+  }
+}
+//进行日志打印与界面切换
+void HeartModel::logAndChangeSlice(HeartResult result) {
+  const char *resultMsg = (result == HeartResult::NOT_WORN)  ? "未佩戴状态"
+                          : (result == HeartResult::TIMEOUT) ? "超时"
+                                                             : "无效数据";
+  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "检测结果:%s情况", resultMsg);
+  uapi_set_screen_on_api(); // 亮屏
+  //需要先判断界面 心率卡片界面
+  if (MainViewSample::GetInstance()) {
+    if (MainViewSample::GetInstance()->GetHorCurrentCard() == HEART_RATE)
+      NativeAbility::GetInstance().ChangeSlice(VIEW_CHECK_ABNORMAL);
+  } else
+    NativeAbility::GetInstance().ChangeSlice(VIEW_CHECK_ABNORMAL);
+}
+// 处理低心率情况
+void HeartModel::handleLowHeartRate() {
+  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "检测结果:低结果情况");
+  HealthState lowHealthState = {HEART_CHECK, LOW, thresholdValue};
+  HealthService::GetInstance()->SetHealthCurrent(lowHealthState);
+  uapi_set_screen_on_api(); // 亮屏
+  if (MainViewSample::GetInstance()) {
+    if (MainViewSample::GetInstance()->GetHorCurrentCard() == HEART_RATE)
+      NativeAbility::GetInstance().ChangeSlice(VIEW_CHECK_INVALID);
+  } else
+    NativeAbility::GetInstance().ChangeSlice(VIEW_CHECK_INVALID);
+}
+// 处理高心率情况
+void HeartModel::handleHighHeartRate() {
+  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "检测结果:高结果情况");
+  HealthState highHealthState = {HEART_CHECK, HIGH, thresholdValue};
+  HealthService::GetInstance()->SetHealthCurrent(highHealthState);
+  uapi_set_screen_on_api(); // 亮屏
+  if (MainViewSample::GetInstance()) {
+    if (MainViewSample::GetInstance()->GetHorCurrentCard() == HEART_RATE)
+      NativeAbility::GetInstance().ChangeSlice(VIEW_CHECK_INVALID);
+  } else
+    NativeAbility::GetInstance().ChangeSlice(VIEW_CHECK_INVALID);
+}
+// 设置佩戴状态
+void HeartModel::SetWearStatus() {
+
+  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "佩戴状态 %d %d",
+                uapi_dev_runtime_get_heartrate_detect_status(),
+                unwear_counter_);
+
+  // 如果处于训练模式,提前返回
+  if (uapi_dev_runtime_get_train_status() == 1 ||
+      // uapi_dev_runtime_get_heartrate_detect_status() == 0 ||
+      uapi_dev_runtime_get_respiratory_training_status())
+    return;
+
+  unwear_counter_++;
+#ifdef SYSTEM_LOG_SERVICE
+  uapi_save_runtime_log(RUNTIME_LOG_HEART_NOT_WEAR);
+#endif
+  // 设置佩戴状态
+  if (checkstate == HeartCheck::CARDCHECK) {
+    if (unwear_counter_ > MAX_UNWEAR_COUNT) {
+      if (MainViewSample::GetInstance()) {
+        //只有在心率卡片界面才触发
+        if (MainViewSample::GetInstance()->GetHorCurrentCard() == HEART_RATE) {
+          SetResult(HeartResult::NOT_WORN);
+#ifdef SYSTEM_LOG_SERVICE
+          uapi_save_runtime_log(RUNTIME_LOG_HEART_ERROR_NOT_WEAR);
+#endif
+          Heart_Stop();
+        }
+      }
+    }
+  } else {
+    SetResult(HeartResult::NOT_WORN);
+#ifdef SYSTEM_LOG_SERVICE
+    uapi_save_runtime_log(RUNTIME_LOG_HEART_ERROR_NOT_WEAR);
+#endif
+    Heart_Stop();
+  }
+}
+
+void HeartModel::UpHeartdata(uint16_t heart) {
+  // 如果处于训练模式,提前返回
+  if (uapi_dev_runtime_get_train_status() == 1)
+    return;
+
+  int max_valid_count = 0;
+
+  // if (heart != 0) {
+  //   if (display_counter_ >= DISPLAY_COUNT) {
+  //     displayheart = heart;
+  //   } else {
+  //     displayheart = 0;
+  //   }
+  //   display_counter_++;
+  // } else {
+  //   displayheart = 0;
+  // }
+
+  displayheart = heart;
+
+  // 更新心率和计数器
+  if (displayheart != 0) {
+    currentheart = displayheart; // 更新当前心率
+    valid_counter_++;            // 增加有效计数器
+    disvalid_counter_ = 0;       // 清空无效计数器
+#ifdef SYSTEM_LOG_SERVICE
+    uapi_save_runtime_log(RUNTIME_LOG_HEART_VALID_VALUE);
+#endif
+  } else {
+    disvalid_counter_++; // 增加无效计数器
+    valid_counter_ = 0;  // 清零有效计数器
+#ifdef SYSTEM_LOG_SERVICE
+    uapi_save_runtime_log(RUNTIME_LOG_HEART_INVALID_VALUE);
+#endif
+  }
+
+  // 检查无效计数器是否达标
+  if (uapi_dev_runtime_get_sleep_monitoring_status()) //睡眠监测模式下,增加未佩戴个数最大值,避免误判
+    max_valid_count = MAX_DISVALID_HRS_COUNT * 2;
+  else
+    max_valid_count = MAX_DISVALID_HRS_COUNT;
+
+  if (disvalid_counter_ >= max_valid_count) {
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+                  "检测结果:无效数达标 disvalid_counter:%d", disvalid_counter_);
+    SetResult(HeartResult::INVALID_DATA); // 标记为无效数据
+#ifdef SYSTEM_LOG_SERVICE
+    uapi_save_runtime_log(RUNTIME_LOG_HEAR_ERROR_INVALID_VALUE);
+#endif
+    Heart_Stop();
+    return;
+  }
+
+  // 检查有效计数器是否达标
+  if (valid_counter_ >= MAX_VALID_HRS_COUNT) {
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
+                  "检测结果:成功 valid_counter:%d currentheart:%d",
+                  valid_counter_, currentheart);
+#ifdef SYSTEM_LOG_SERVICE
+    uapi_save_runtime_log(RUNTIME_LOG_HEAR_SUCCESS);
+#endif
+    SetResult(HeartResult::SUCCESS); // 标记为成功检测
+    Heart_Stop();
+    return;
+  }
+
+  // 刷新心率显示
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
+                "[heart data update displayheart%d displayheart_max%d "
+                "displayheart_min%d]",
+                displayheart, displayheart_max, displayheart_min);
+
+  // GraphicService::GetInstance()->PostGraphicEvent(
+  //     std::bind(&HeartModel::RefreshHeartRateScreen,
+  //     HeartModel::GetInstance(),
+  //               displayheart));
+}
+
+void HeartModel::Heart_Update_View(void) {
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "更新心率界面");
+  int hour = HealthService::GetInstance()->GetCurrentHour();
+  if (HeartRateView::GetInstance() != nullptr) {
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "更新主界面卡片");
+    HeartRateView::GetInstance()->Update_data_Chart(hour);
+  }
+  if (HeartChartView::GetInstance() != nullptr) {
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "更新测量心率卡片");
+    HeartChartView::GetInstance()->Update_data_Chart(hour);
+  }
+}
+
+void HeartModel::CleanAllData(void) {
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Nextday!");
+  if (MainViewSample::GetInstance() != nullptr &&
+      HeartRateView::GetInstance() != nullptr) {
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "更新主界面心率卡片");
+    HeartRateView::GetInstance()->CleanAllDataView();
+  }
+  if (HeartChartView::GetInstance() != nullptr) {
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "更新测量心率卡片");
+    HeartChartView::GetInstance()->CleanAllDataView();
+  }
+}
+
+// 配置5个动态心率数据
+// 最大 最小
+void HeartModel::SetArrayData() {
+  // 如果没有进行心率检测,则默认为0-220
+  if (displayheart_max == 0 || displayheart_min == 0) {
+    dynamic_heartrate[0] = 0;
+    dynamic_heartrate[1] = 40;
+    dynamic_heartrate[2] = 100;
+    dynamic_heartrate[3] = 160;
+    dynamic_heartrate[4] = 220;
+    return; // 直接返回
+  }
+
+  // 计算心率范围并添加缓冲
+  uint16_t adjusted_min =
+      (displayheart_min > 10) ? (displayheart_min / 2) : displayheart_min;
+  uint16_t adjusted_max =
+      (displayheart_max < 210) ? (displayheart_max + 10) : displayheart_max;
+
+  uint16_t range = adjusted_max - adjusted_min;
+  uint16_t interval = range / 4; // 每个部分的宽度
+
+  // 设置动态心率数据
+  dynamic_heartrate[0] = adjusted_min;
+  dynamic_heartrate[1] = adjusted_min + interval;
+  dynamic_heartrate[2] = adjusted_min + 2 * interval;
+  dynamic_heartrate[3] = adjusted_min + 3 * interval;
+  dynamic_heartrate[4] = adjusted_max;
+
+  // 确保所有值为整数
+  for (int i = 0; i < 5; i++) {
+    dynamic_heartrate[i] = static_cast<uint16_t>(round(dynamic_heartrate[i]));
+  }
+
+  // 打印动态心率数据
+  for (int i = 0; i < 5; i++) {
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "dynamic_heartrate[%d]=%d", i,
+                  dynamic_heartrate[i]);
+  }
+}
+// 获取动态心率配置数组
+uint16_t *HeartModel::GetArrayData() { return dynamic_heartrate; }
+
+// 获取检测字符串
+// 获取检测字符串
+// TODO: 适配多国语言
+std::string HeartModel::GetCheckString() {
+  std::string check_string = "检测结果未知";
+
+  // 获取检测数据
+  if (currentheart == 0) {
+    if (ConfigModel::GetInstance()->GetLanguage() == ZH_CN) {
+      check_string = "暂无检测数据";
+    } else {
+      check_string = "No detection data is available";
+    }
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "检测数据:%s", check_string.c_str());
+    return check_string;
+  }
+
+  // 获取目前的时间戳
+  uint32_t currentTime;
+  if (uapi_get_timestampe_ss(&currentTime) != ERRCODE_SUCC) {
+    if (ConfigModel::GetInstance()->GetLanguage() == ZH_CN) {
+      check_string = "获取当前时间失败";
+    } else {
+      check_string = "Get time failed";
+    }
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "获取当前时间失败");
+    return check_string;
+  }
+
+  // 检查时间戳是否有效
+  if (timestamp_ms == 0) {
+    if (ConfigModel::GetInstance()->GetLanguage() == ZH_CN) {
+      check_string = std::to_string(currentheart) + " " + "时间无效,无法检测";
+    } else {
+      check_string =
+          std::to_string(currentheart) + " " + "Invalid time, cannot detect";
+    }
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "时间戳无效,无法检测:%s",
+                  check_string.c_str());
+    return check_string;
+  }
+
+  // 进行时间戳相减计算
+  uint32_t diff = currentTime - timestamp_ms;
+  uint32_t diff_min = diff / 60;
+  uint32_t diff_hour = diff_min / 60;
+
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "当前时间:%d, 上次检测时间:%d",
+                currentTime, timestamp_ms);
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
+                "时间差(秒):%d, 时间差(分钟):%d, 时间差(小时):%d", diff,
+                diff_min, diff_hour);
+
+  // 根据时间差生成检测字符串
+  if (diff_min < 1) {
+    if (ConfigModel::GetInstance()->GetLanguage() == ZH_CN) {
+      check_string = std::to_string(currentheart) + "次/分 " + "刚刚检测"; //
+    } else {
+      check_string = std::to_string(currentheart) + " bpm " + "Just detected";
+    }
+  } else if (diff_hour < 1) { // Within one hour
+    if (ConfigModel::GetInstance()->GetLanguage() == ZH_CN) {
+      check_string = std::to_string(currentheart) + "次/分 " +
+                     std::to_string(diff_min) + "分钟前";
+    } else {
+      check_string = std::to_string(currentheart) + " bpm " +
+                     std::to_string(diff_min) + " minutes ago";
+    }
+  } else {
+    if (ConfigModel::GetInstance()->GetLanguage() == ZH_CN) {
+      check_string = std::to_string(currentheart) + "次/分 " + "超过一个小时前";
+    } else {
+      check_string =
+          std::to_string(currentheart) + " bpm " + "More than an hour ago";
+    }
+  }
+
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "检测结果:%s", check_string.c_str());
+  return check_string; // Return the final string
+}
+
+#if KEEP_SCREEN_ON_HEART
+/////////////////////////////////////////亮屏定时器////////////////////////////////////////////
+// 声明定时器变量
+static osTimerId_t g_screen60s_timer = nullptr;
+static uint16_t SCREEN_60S_TIME = 60;
+static void heart_start_screen60s_timer_callbackProc(int data) {
+  WEARABLE_LOGD(
+      WEARABLE_LOG_MODULE_APP,
+      "HeartModel::heart_start_screen60s_timer_callbackProc,time = %d",
+      SCREEN_60S_TIME);
+  SCREEN_60S_TIME -= 30;
+  WEARABLE_LOGD(
+      WEARABLE_LOG_MODULE_APP,
+      "HeartModel::heart_start_screen60s_timer_callbackProc,time = %d",
+      SCREEN_60S_TIME);
+  if (SCREEN_60S_TIME <= 0) {
+    // 60s后息屏停止定时
+    HeartModel::GetInstance()->heart_stop_screen60s_timer();
+    // 取消常亮屏
+    ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON);
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "heart_stop_screen60s_timer");
+  }
+}
+static void heart_start_screen60s_timer_callback(int data) {
+  GraphicService::GetInstance()->PostGraphicEvent(
+      std::bind(heart_start_screen60s_timer_callbackProc, data));
+}
+void HeartModel::heart_start_screen60s_timer(uint32_t interval) {
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
+                "HeartModel::heart_start_screen60s_timer");
+  /* -------------------------- 1.检查定时器是否已经存在,如果存在则返回
+   * ------------------------- */
+  if (g_screen60s_timer != nullptr) {
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Timer already exists!!");
+    return;
+  }
+  /* --------------------------------- 2.创建定时器
+   * -------------------------------- */
+  g_screen60s_timer =
+      osTimerNew((osTimerFunc_t)heart_start_screen60s_timer_callback,
+                 osTimerPeriodic, nullptr, nullptr);
+  // 检查定时器创建是否成功
+  if (g_screen60s_timer == nullptr) {
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Timer create failed!!");
+    return;
+  }
+  /* ----------------------------- 3.将毫秒转换为系统时钟节拍数
+   * ---------------------------- */
+  int tick = osMs2Tick(interval);
+  /* --------------------------------- 4.启动定时器
+   * -------------------------------- */
+  osStatus_t ret = osTimerStart(g_screen60s_timer, tick);
+  /* -------------------- 5.检查定时器启动是否成功,如果启动失败,删除定时器并置为
+   * nullptr -------------------- */
+  if (ret != osOK) {
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "osTimerDelete failed, ret = %lx!!",
+                  ret);
+    if (g_screen60s_timer != nullptr) {
+      ret = osTimerDelete(g_screen60s_timer);
+    }
+    g_screen60s_timer = nullptr;
+    return;
+  }
+}
+void HeartModel::heart_stop_screen60s_timer(void) {
+  // 检查定时器是否存在
+  if (g_screen60s_timer != nullptr) {
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+                  "HeartModel::heart_stop_screen60s_timer");
+    osTimerStop(g_screen60s_timer);
+    // 删除定时器并置为 nullptr
+    osStatus_t ret = osTimerDelete(g_screen60s_timer);
+    if (ret != osOK) {
+      WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+                    "osTimerDelete failed, ret = %lx!!", ret);
+    }
+    g_screen60s_timer = nullptr;
+    SCREEN_60S_TIME = 60;
+  }
+}
+void HeartModel::reset_heart_screen60s_timer_time() {
+  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "reset_heart_screen60s_timer_time");
+  SCREEN_60S_TIME = 60;
+  if (nullptr == g_screen60s_timer) {
+    ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 重新常亮屏
+    heart_start_screen60s_timer();            // 开启定时器
+  }
+}
+#endif
+//////////////////////////////////////////////////////////////////////////////////
+#if HEART_TIMER_DATA
+// 声明定时器变量
+static osTimerId_t g_data_timer = nullptr;
+
+static void heart_data_callbackProc(int data) {
+  //更新佩戴
+  uint8_t wear = 1;
+#ifdef SUPPORT_PPG_SERVICE
+  wear = ppg_get_wear_status();
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"heart_data_callbackProc::hrs = %d\n", hrs);
+#endif
+  if (wear == 0) {
+    OHOS::HeartModel::GetInstance()->SetWearStatus();
+  }
+  //更新心率
+  uint8_t hrs = 0;
+#ifdef SUPPORT_PPG_SERVICE
+  hrs = ppg_get_hrs();
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"heart_data_callbackProc::hrs = %d\n", hrs);
+#endif
+  OHOS::HeartModel::GetInstance()->UpHeartdata(hrs);
+  //打印佩戴与心率
+  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "wear = %d, hrs = %d\n", wear, hrs);
+}
+static void heart_data_timer_callback(int data) {
+  GraphicService::GetInstance()->PostGraphicEvent(
+      std::bind(heart_data_callbackProc, data));
+}
+void HeartModel::heart_data_timer(uint32_t interval) {
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
+                "HeartModel::heart_data_timer");
+  if (g_data_timer != nullptr) {
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Timer already exists!!");
+    return;
+  }
+  g_data_timer = osTimerNew((osTimerFunc_t)heart_data_timer_callback,
+                            osTimerPeriodic, nullptr, nullptr);
+  if (g_data_timer == nullptr) {
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Timer create failed!!");
+    return;
+  }
+  int tick = osMs2Tick(interval);
+  osStatus_t ret = osTimerStart(g_data_timer, tick);
+  if (ret != osOK) {
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "osTimerDelete failed, ret = %lx!!",
+                  ret);
+    if (g_data_timer != nullptr) {
+      ret = osTimerDelete(g_data_timer);
+    }
+    g_data_timer = nullptr;
+    return;
+  }
+}
+void HeartModel::heart_stop_data_timer(void) {
+  // 检查定时器是否存在
+  if (g_data_timer != nullptr) {
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+                  "HeartModel::heart_stop_data_timer");
+    osTimerStop(g_data_timer);
+    // 删除定时器并置为 nullptr
+    osStatus_t ret = osTimerDelete(g_data_timer);
+    if (ret != osOK) {
+      WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+                    "osTimerDelete failed, ret = %lx!!", ret);
+    }
+    g_data_timer = nullptr;
+  }
+}
+#endif
+} // namespace OHOS
index 0897dc8..62381f6 100644 (file)
@@ -322,6 +322,7 @@ namespace OHOS
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::OnStart");
         LanguageSwitchViewInit();
         InithintView();
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::OnStart end");
         return;
     }
 }
\ No newline at end of file
index 80255a3..4f4bccf 100644 (file)
 #include "wearable_log.h"\r
 #include "AppViewIDs.h"\r
 #include "NativeAbility.h"\r
+#if 0 // 1201patch 为编译过屏蔽\r
 #include "sport/SportView.h"\r
 #include "sport/SportModel.h"\r
 #include "findphone/FindPhoneMainPage.h"\r
 #include "camera/CameraMainPage.h"\r
 #include "weather/WeatherMainPage.h"\r
 #include "date/DateMainPage.h"\r
+#endif\r
 \r
 #ifdef __cplusplus\r
 extern "C" {\r
@@ -27,6 +29,91 @@ uint8_t g_bloodoxygen = 0;
 uint8_t g_heartrate = 0;\r
 uint32_t g_stepdata = 0;\r
 uint32_t g_distance = 0;\r
+\r
+/* -------------------------------------------------------------------------- */\r
+#if 1// 1201patch 为编译过屏蔽\r
+errcode_t msg_center_get_battery_level(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_get_storage_info(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_get_product_info(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_get_language_id(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_set_language_id(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_ota_init(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_ota_update(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_device_heartrate(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_device_stepdata(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_device_bloodoxygen(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_sport_action(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_sport_get_record(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_camera_exit(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_camera_online(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_offline_log_switch(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_set_online_log_channel(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_set_online_log_level(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_device_findphone(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_device_sync_weather_rec(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+errcode_t msg_center_device_sync_date_rec(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
+{\r
+    return ERRCODE_SUCC;\r
+}\r
+#else\r
+/* -------------------------------------------------------------------------- */\r
 // 获取电量\r
 errcode_t msg_center_get_battery_level(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
 {\r
@@ -426,6 +513,7 @@ errcode_t msg_center_device_sync_date_rec(uint8_t cmd_id, uint8_t type, void *us
     }\r
     return ERRCODE_SUCC;\r
 }\r
+#endif\r
 \r
 #ifdef __cplusplus\r
 }\r
index 24f5bec..26a88bb 100644 (file)
@@ -166,7 +166,7 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/src/common/msg_center_utils.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/common/msg_center_self_cmd.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/ketinput/src/NotifyOnKeyListener.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/phone_msg_notification.cpp
+    # ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/phone_msg_notification.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/pairing_notification.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/transmitting.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/charge_notification.cpp
@@ -191,7 +191,7 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/alarm_notification.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/makephone_notification.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/ketinput/src/NotifyOnKeyListener.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/phone_msg_notification.cpp
+    # ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/phone_msg_notification.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/pairing_notification.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/transmitting.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/charge_notification.cpp
diff --git a/code/sdk/application/wearable/n9/service/msg_center/brandy-native-js-fd230/libmsg_center.a b/code/sdk/application/wearable/n9/service/msg_center/brandy-native-js-fd230/libmsg_center.a
deleted file mode 100644 (file)
index b1e105a..0000000
Binary files a/code/sdk/application/wearable/n9/service/msg_center/brandy-native-js-fd230/libmsg_center.a and /dev/null differ
diff --git a/code/sdk/application/wearable/n9/service/msg_center/brandy-native-js-ln/libmsg_center.a b/code/sdk/application/wearable/n9/service/msg_center/brandy-native-js-ln/libmsg_center.a
deleted file mode 100644 (file)
index b1e105a..0000000
Binary files a/code/sdk/application/wearable/n9/service/msg_center/brandy-native-js-ln/libmsg_center.a and /dev/null differ
index b1e105a..7e69f1c 100644 (file)
Binary files a/code/sdk/application/wearable/n9/service/msg_center/brandy-native-js-n9/libmsg_center.a and b/code/sdk/application/wearable/n9/service/msg_center/brandy-native-js-n9/libmsg_center.a differ
index 345828d..5ab45f5 100644 (file)
@@ -24,7 +24,7 @@
 #include "components/ui_view_group.h"
 #include "alarm_notification.h"
 #include "makephone_notification.h"
-#include "phone_msg_notification.h"
+// #include "phone_msg_notification.h"
 
 constexpr uint16_t HALF_SCREEN = 2;
 constexpr int16_t NOTIFY_PRIORITY_DEFAULT = 4;
index 5f8a450..7af818e 100644 (file)
@@ -52,6 +52,7 @@ errcode_t msg_center_phone_msg_rec(uint8_t cmd_id, uint8_t type, void *usr_data,
 \r
 errcode_t msg_center_update_contacts(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
 {\r
+    #if 0 // 1201patch 为编译过屏蔽\r
     uint8_t tl_len = msg_center_get_tlv_tl_len(usr_data);\r
     uint16_t payload_len = usr_len - tl_len;\r
     uint8_t *tlv_payload = (uint8_t *)msg_center_get_tlv_payload(usr_data);\r
@@ -69,10 +70,13 @@ errcode_t msg_center_update_contacts(uint8_t cmd_id, uint8_t type, void *usr_dat
         return ERRCODE_FAIL;\r
     }\r
     return ERRCODE_SUCC;\r
+    #endif\r
+    return ERRCODE_SUCC;\r
 }\r
 \r
 errcode_t msg_center_lookup_contacts(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len)\r
 {\r
+    #if 0 // 1201patch 为编译过屏蔽\r
     uint8_t tl_len = msg_center_get_tlv_tl_len(usr_data);\r
     uint16_t payload_len = usr_len - tl_len;\r
     uint8_t *tlv_payload = (uint8_t *)msg_center_get_tlv_payload(usr_data);\r
@@ -90,6 +94,7 @@ errcode_t msg_center_lookup_contacts(uint8_t cmd_id, uint8_t type, void *usr_dat
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "msg_center_lookup_contacts fail, ret = %d\r\n", ret);\r
         return ERRCODE_FAIL;\r
     }\r
+    #endif\r
     return ERRCODE_SUCC;\r
 }\r
 \r
index 7ccf448..9a2d789 100644 (file)
@@ -41,7 +41,7 @@
 #ifdef SUPPORT_AT_SENSOR
 #include "sensor_sample.h"
 #endif
-#include "monkey/MonkeyModel.h"
+// #include "monkey/MonkeyModel.h"
 
 #define ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0]))
 #define OHOSFWK_MAX_ARGC            8
@@ -162,6 +162,7 @@ static const char *StateInfoToString(int8_t pageInfo)
 
 static uint32_t OhosfwkATCmdAmDfx(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
 {
+    #if 0 // 1201patch 为编译过屏蔽
     unused(strCommonCmd);
 
     uint8_t argv[OHOSFWK_MAX_ARGC][OHOSFWK_MAX_ARGV_LEN] = {0};
@@ -205,6 +206,7 @@ static uint32_t OhosfwkATCmdAmDfx(uint8_t *para, uint32_t paraLen, char *strComm
         PRINTK("pageState: %s\n", pageInfoLog);
         PRINTK("-----------PageState End-----------\n");
     }
+    #endif
     return ERRCODE_SUCC;
 }
 
@@ -648,6 +650,7 @@ static uint32_t OhosfwkATSwitchSlicePage(uint8_t *para, uint32_t paraLen, char *
 
 static uint32_t OhosATMonkeyControl(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
 {
+    #if 0 // 1201patch 为编译过屏蔽
     unused(strCommonCmd);
     uint8_t argv[OHOSFWK_MAX_ARGC][OHOSFWK_MAX_ARGV_LEN] = {0};
     uint32_t argc = 0;
@@ -666,6 +669,7 @@ static uint32_t OhosATMonkeyControl(uint8_t *para, uint32_t paraLen, char *strCo
     uint32_t monkeyControl = atoi(monkeyStr);
     WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "OhosATMonkeyControl(),monkeyControl = %[d]", monkeyControl);
     OHOS::MonkeyModel::GetInstance().SetStart(monkeyControl);
+    #endif
     return ERRCODE_SUCC;
 }
 #endif
diff --git a/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_recorder.a b/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_recorder.a
new file mode 100644 (file)
index 0000000..65bfe53
Binary files /dev/null and b/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_recorder.a differ
index 7337ef0..1dc614b 100644 (file)
Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-n9/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-n9/libgfx_rm.a differ
index 9d278be..e1bb71d 100644 (file)
Binary files a/code/sdk/middleware/services/gui/uikit/brandy-native-js-n9/libuikit_ext.a and b/code/sdk/middleware/services/gui/uikit/brandy-native-js-n9/libuikit_ext.a differ
index 4b333bd..da46ace 100644 (file)
@@ -489,6 +489,7 @@ void PrintWatchDialInfo(const watch_dial_info &info)
 
 void DebugGetAllWatchFaceInfo(int argc, char *argv[])
 {
+    #if 0 // 1201patch 为编译过屏蔽
     GraphicService::GetInstance()->PostGraphicEvent([]() {
         watch_dial_info *info = nullptr;
         uint8_t num = 0;
@@ -502,6 +503,7 @@ void DebugGetAllWatchFaceInfo(int argc, char *argv[])
         }
         free(info);
     });
+    #endif
 }
 
 void DebugGetWatchFaceInfo(int argc, char *argv[])
@@ -590,6 +592,7 @@ void DebugUninstallWatch(int argc, char *argv[])
 
 void DebugGetUuidByPath(int argc, char *argv[])
 {
+    #if 0 // 1201patch 为编译过屏蔽
     if (argc != 1) {
         printf("fmt: AT^UIKIT_DFX=debug_get_uuid <num>\n");
         return;
@@ -610,6 +613,7 @@ void DebugGetUuidByPath(int argc, char *argv[])
         return;
     }
     printf("Succuss to get file %s, uuid %u\n", path.c_str(), uuid);
+    #endif
 }
 #endif // defined (SUPPORT_DIAL_DEBUG)
 
index 137756c..67b75a0 100644 (file)
@@ -15,7 +15,7 @@
 #include "engines/gfx/lite_m_gfx_engine.h"
 #include "ui_test_cross.h"
 #ifdef SUPPORT_OHOSFWK
-#include "screennotify/ui_screennotify.h"
+#include "screennotify/include/ui_screennotify.h"
 #endif
 
 namespace OHOS {
index 6a7a62b..2b7ebd9 100644 (file)
@@ -138,11 +138,13 @@ namespace OHOS {
 \r
     UITestTransitionModel::UITestTransitionModel()\r
     {\r
+        #if 0 // 1201patch 为编译过屏蔽\r
         for (const auto& entry: g_transitionsMap) {\r
             UITestTransitionSample info(static_cast<uint16_t>(entry.first), entry.second.second,\\r
                                     entry.second.first.c_str(), PNG_TRANSITION_SLICE_SAMPLE);\r
             transitionInfoList_.push_back(info);\r
         }\r
+        #endif\r
     }\r
     UITestTransitionModel::~UITestTransitionModel() {}\r
 \r
index b294a76..203d8c9 100644 (file)
Binary files a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-n9/libams.a and b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-n9/libams.a differ
index e807091..8d5a592 100644 (file)
Binary files a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace.a and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace.a differ
diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace_ble.a b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace_ble.a
new file mode 100644 (file)
index 0000000..77e74b0
Binary files /dev/null and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace_ble.a differ
diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace_ext.a b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace_ext.a
new file mode 100644 (file)
index 0000000..99a6acf
Binary files /dev/null and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace_ext.a differ
index cdfdb31..b93d220 100644 (file)
Binary files a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace_http.a and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace_http.a differ
diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace_websocket.a b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace_websocket.a
new file mode 100644 (file)
index 0000000..757832c
Binary files /dev/null and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libace_websocket.a differ
index b9c1bb0..fcaecba 100644 (file)
Binary files a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libnetstack_http.a and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libnetstack_http.a differ
index 8dfa5e2..c8de21d 100644 (file)
Binary files a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libwebsocket.a and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-n9/libwebsocket.a differ
index c960af1..6c0cff5 100644 (file)
@@ -14,7 +14,9 @@
 #include "cJSON.h"
 #include "calendar_utils.h"
 #include "msg_center_msg.h"
+#if 0 // 1201patch 为编译过屏蔽
 #include "msg_center_client.h"
+#endif
 #include "event_id_manager.h"
 
 namespace OHOS {
@@ -139,6 +141,7 @@ static int64_t GetCurrentTimestamp()
  */
 static void CalendarTimerCallback(void *arg)
 {
+    #if 0 // 1201patch 为编译过屏蔽
     struct timeval tv;
     gettimeofday(&tv, nullptr);
     uint64_t currentTimeMs = GetCurrentTimestamp();
@@ -177,6 +180,7 @@ static void CalendarTimerCallback(void *arg)
             ++it;  // Move to next element
         }
     }
+    #endif
 }
 
 // Check if it's a valid reminder event
index d0da474..27fb829 100644 (file)
@@ -7,7 +7,9 @@
 
 #include <list>
 #include <mutex>
+#if 0 // 1201patch 为编译过屏蔽
 #include "settings/model/SettingBluetoothModel.h"
+#endif
 #include "msg_center_protocol.h"
 #include "connection_manage.h"
 
@@ -117,6 +119,7 @@ void UnregisterConnectListener(uint8_t networkType, NetConnectionCallback callba
 
 uint8_t GetNetConnectState(uint8_t netType)
 {
+    #if 0 // 1201patch 为编译过屏蔽
     uint8_t state = CONNECTION_STATUS_UNKNOWN;
     switch (netType) {
         case NETWORK_TYPE_WIFI:
@@ -140,4 +143,6 @@ uint8_t GetNetConnectState(uint8_t netType)
             break;
     }
     return state;
+    #endif
+    return CONNECTION_STATUS_UNKNOWN;
 }
index 2a446dc..05a628b 100644 (file)
@@ -56,6 +56,7 @@ JSIValue RouterModule::Replace(const JSIValue thisVal, const JSIValue* args, uin
 
 JSIValue RouterModule::ReplaceToNative(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum)
 {
+#if 0 // 1201patch 为编译过屏蔽
     uint16_t sliceId = 0;
     // router.replaceToNative({sliceId: 1}}
     JSIValue jsId = JSI::GetNamedProperty(args[0], "sliceId");
@@ -89,6 +90,7 @@ JSIValue RouterModule::ReplaceToNative(const JSIValue thisVal, const JSIValue *a
 
     OHOS::NativeAbility::GetInstance().ChangeSlice(sliceId);
     return JSI::CreateUndefined();
+#endif
 }
 } // namespace ACELite
 } // namespace OHOS
index f262ad8..599f480 100644 (file)
Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-n9/libbms.a and b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-n9/libbms.a differ
index 8c7f3a9..067d51a 100644 (file)
@@ -377,7 +377,9 @@ lwip_init(void)
 #endif /* LWIP_DNS */
 
 #if LWIP_SLIP
+#if 0 // 1201patch 为编译过屏蔽
   slip_test_init();
+#endif
 #endif /* LWIP_SLIP */
 #if PPP_SUPPORT
   ppp_init();
index 74ef96d..0bc6dea 100644 (file)
@@ -384,10 +384,12 @@ errcode_t cat1_register_time_ctl_functions(time_ctl_funcs_t *funcs)
 
 void cat1_api_suspend_protocol(void)
 {
+    #if 0 // 1201patch 为编译过屏蔽
     #ifdef SUPPORT_LWIP
         tcpip_thread_suspend();
         slipif_loop_thread_suspend();
     #endif
+    #endif
 }
 
 /**
@@ -403,11 +405,12 @@ void cat1_api_suspend_protocol(void)
  */
 void cat1_api_resume_protocol(void)
 {
+    #if 0 // 1201patch 为编译过屏蔽
     #ifdef SUPPORT_LWIP
         tcpip_thread_resume();
         slipif_loop_thread_resume();
     #endif
-
+    #endif
 }
 
 /**
index bdfdcf0..400a734 100644 (file)
@@ -2264,7 +2264,9 @@ static uint32_t custom_sio_debug_enable(uint8_t *para, uint32_t paraLen, char *s
     UNUSED(strCommonCmd);
     UNUSED(para);
     UNUSED(paraLen);
+    #if 0 // 1201patch 为编译过屏蔽
     sio_set_debug_enabled(true);
+    #endif
     return ERRCODE_SUCC;
 }
 
index 8b2fdb9..a28e29c 100644 (file)
@@ -354,7 +354,8 @@ static void zhihui_ws_recv_thread_func(void *arg)
     
     // 调用关闭回调
     if (client->on_close) {
-        client->on_close(client->client_fd);
+        struct WebSocketErrorResult errorResult = { WEBSOCKET_OK, NULL };
+        client->on_close(client->client_fd, errorResult);
     }
 }