添加开发调试专用窗口弹窗
authorluozheng <1732036298@qq.com>
Thu, 3 Oct 2024 03:33:29 +0000 (11:33 +0800)
committerSnickerSun <snickersun@163.com>
Thu, 10 Oct 2024 07:15:42 +0000 (15:15 +0800)
12 files changed:
code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h
code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c
code/sdk/application/wearable/service/msg_center/CMakeLists.txt
code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification.h [new file with mode: 0644]
code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification_adapter.h [new file with mode: 0644]
code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification_item.h [new file with mode: 0644]
code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification_itemview.h [new file with mode: 0644]
code/sdk/application/wearable/service/msg_center/include/notify/notification_manager.h
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp
code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp [new file with mode: 0644]
code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification_adapter.cpp [new file with mode: 0644]
code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification_itemview.cpp [new file with mode: 0644]

index 09e6ed1..e2e5e3d 100644 (file)
@@ -94,7 +94,7 @@ typedef enum {
     TOPIC_EVENT_MESSAGENOTE, //消息通知
     TOPIC_EVENT_MESSAGE_UPDATA, //消息更新通知
     TOPIC_EVENT_SLEEPNOTE, //睡眠通知
-    TOPIC_EVENT_ASSISTANT_NOTE,//语音助手结束
+    TOPIC_EVENT_DEBUGOUTPUT,//开发调试专用窗口
     TOPIC_END_NUM = 20000,
 } TopicNum;
 
index 9533787..252e133 100644 (file)
@@ -74,6 +74,7 @@ static const TopicToCore topicToCoreArray[] = {
     {TOPIC_EVENT_MESSAGENOTE,A_CORE_MASK, 1},
     {TOPIC_EVENT_MESSAGE_UPDATA,A_CORE_MASK, 1},
     {TOPIC_EVENT_SLEEPNOTE,A_CORE_MASK, 1},
+    {TOPIC_EVENT_DEBUGOUTPUT,A_CORE_MASK, 1},
 #ifdef SUPPORT_CAT1_MODEM
     {TOPIC_EVENT_CAT1_INCOMMING, A_CORE_MASK, 1},
     {TOPIC_EVENT_CAT1_CALLCONNTED, A_CORE_MASK, 1},
index a388cb1..e4573f4 100644 (file)
@@ -224,7 +224,9 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/message_notification.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/sleep_notification.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/motion_recognition_notification.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/src/common/msg_center_common.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/debug_output_notification/debug_output_notification_adapter.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/debug_output_notification/debug_output_notification_itemview.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/debug_output_notification/debug_output_notification.cpp
 )
 else()
 set(SOURCES
@@ -242,6 +244,9 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/message_notification.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/sleep_notification.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/motion_recognition_notification.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/debug_output_notification/debug_output_notification_adapter.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/debug_output_notification/debug_output_notification_itemview.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/debug_output_notification/debug_output_notification.cpp
 )
 endif()
 
diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification.h
new file mode 100644 (file)
index 0000000..8081923
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-10-02 14:12:12
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-10-03 11:08:44
+ * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification.h
+ */
+#ifndef DEBUG_OUTPUT_NOTIFICATION_H
+#define DEBUG_OUTPUT_NOTIFICATION_H
+#include "BaseView.h"
+#include "../notify/debug_output_notification/debug_output_notification_item.h"
+namespace OHOS
+{
+    UIViewGroup *CreateDebugOutputMainView(void);
+    void FreeDebugOutputMainView(void);
+
+    static const int ITEM_COUNT = 50;
+    class DebugOutputViewEventListener : public UIView::OnClickListener, public UIView::OnDragListener
+    {
+    public:
+        static DebugOutputViewEventListener &GetInstance();
+        bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event) override;
+        bool OnDrag(UIView &view, const DragEvent &event) override;
+        bool OnDragEnd(OHOS::UIView &view, const OHOS::DragEvent &event) override;
+        bool ChangeDebugOutputMainView(int16_t thisView);
+        bool ChangeDebugOutputView1(int16_t thisView);
+        bool ClickFunc(int16_t interface);
+        bool CheckViewParam(int16_t hideView, int16_t showView);
+        void ChangeView(int16_t hideView, int16_t showView);
+        void SetCurViewIndex(int16_t viewNum);
+        int GetCurViewIndex(void);
+        void InitDebugOutputItem();
+        std::string get_bt_runtime_status_t(void);
+        std::string get_cat1_runtime_status_t(void);
+        std::string get_runtime_status_t(void);
+        
+    private:
+        DebugOutputViewEventListener();
+        ~DebugOutputViewEventListener();
+        DebugOutputViewEventListener(const DebugOutputViewEventListener &) = delete;
+        const DebugOutputViewEventListener &operator=(const DebugOutputViewEventListener &) = delete;
+
+        DebugOutputItem debugOutputItemInfo[ITEM_COUNT] = {-1, nullptr};
+        int curView{0};
+        int usedLen{0};
+        bool X_DRAG_FLAG{false};
+    };
+
+}
+
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification_adapter.h b/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification_adapter.h
new file mode 100644 (file)
index 0000000..5d55bcf
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-10-02 14:52:19
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-10-02 15:14:18
+ * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification_adapter.h
+ */
+
+#ifndef DEBUG_OUTPUT_NOTIFICATION_ADAPTER_H
+#define DEBUG_OUTPUT_NOTIFICATION_ADAPTER_H
+
+#include <list>
+#include "components/ui_list.h"
+#include "components/abstract_adapter.h"
+#include "debug_output_notification_item.h"
+namespace OHOS
+{
+    class DebugOutputAdapter : public AbstractAdapter
+    {
+    public:
+        explicit DebugOutputAdapter();
+        ~DebugOutputAdapter() override;
+
+        void SetData(std::list<DebugOutputItem> &data);
+
+        uint16_t GetCount(void) override;
+
+        UIView *GetView(UIView *inView, int16_t index) override;
+
+        void AddListItem(const DebugOutputItem &item);
+
+        void SetItemClickListener(UIView::OnClickListener *itemclicklistener)
+        {
+            itemClickListener = itemclicklistener;
+        }
+
+    private:
+        std::list<DebugOutputItem> listData;
+        UIView::OnClickListener *itemClickListener{nullptr};
+    };
+}
+
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification_item.h b/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification_item.h
new file mode 100644 (file)
index 0000000..fe560ce
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-10-02 14:56:08
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-10-02 15:54:49
+ * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification_item.h
+ */
+#ifndef DEBUG_OUTPUT_NOTIFICATION_ITEM_H
+#define DEBUG_OUTPUT_NOTIFICATION_ITEM_H
+#include <cstdint>
+#include "iostream"
+#include "string"
+namespace OHOS
+{
+    typedef struct
+    {
+        int index;
+        const char *name;
+    } DebugOutputItem;
+}
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification_itemview.h b/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification_itemview.h
new file mode 100644 (file)
index 0000000..e20aff9
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-01-29 15:37:44
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-10-02 16:24:15
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/include/DebugOutputItem.h
+ */
+#ifndef DEBUG_OUTPUT_NOTIFICATION_ITEMVIEW_H
+#define DEBUG_OUTPUT_NOTIFICATION_ITEMVIEW_H
+
+#include "components/ui_view_group.h"
+#include "components/ui_label_button.h"
+#include "components/ui_label.h"
+#include "debug_output_notification_item.h"
+
+namespace OHOS
+{
+    class DebugOutputItemView : public UIViewGroup
+    {
+    public:
+        explicit DebugOutputItemView();
+        ~DebugOutputItemView() override;
+        void SetItemInfo(const DebugOutputItem itemInfo);
+        void SetUpChild();
+
+    private:
+        UILabel label;
+        UILabelButton labelButton;
+        DebugOutputItem sItemInfo = {-1, nullptr};
+    };
+}
+
+#endif
\ No newline at end of file
index e299778..c9da60c 100644 (file)
@@ -34,6 +34,7 @@
 #include "message_notification.h"
 #include "sleep_notification.h"
 #include "motion_recognition_notification.h"
+#include "debug_output_notification/debug_output_notification.h"
 
 constexpr uint16_t HALF_SCREEN = 2;
 constexpr int16_t NOTIFY_PRIORITY_DEFAULT = 4;
index b21ad86..dee2161 100644 (file)
@@ -128,6 +128,7 @@ const PriorityMapper PRI_MAPPER[] = {
     {TOPIC_EVENT_MESSAGENOTE,PRIORITY_THREE},//消息提醒 [3]
     {TOPIC_EVENT_MESSAGE_UPDATA,PRIORITY_TWO},//消息更新提醒 [3]
     {TOPIC_EVENT_SLEEPNOTE,PRIORITY_THREE},//睡眠弹窗 [3]
+    {TOPIC_EVENT_DEBUGOUTPUT,PRIORITY_ONE},//开发调试专用窗口
 };
 
 static bool CheckPriority(const Topic topic)
@@ -203,6 +204,7 @@ void MsgCenterSubscribe()
     MsgCenterSubscribeTopic(TOPIC_EVENT_DRINKREMINDER);
     MsgCenterSubscribeTopic(TOPIC_EVENT_MESSAGENOTE);
     MsgCenterSubscribeTopic(TOPIC_EVENT_SLEEPNOTE);
+    MsgCenterSubscribeTopic(TOPIC_EVENT_DEBUGOUTPUT);
 }
 
 static OHOS::UIViewGroup* ShowAlarmNotify(void)
@@ -312,6 +314,10 @@ static OHOS::UIViewGroup* showcallhintNotify(void)
     return OHOS::CALL_INCOMING_HINT();
 }
 
+static OHOS::UIViewGroup* showDebugOutputNotify(void)
+{
+    return OHOS::CreateDebugOutputMainView();
+}
 
 void MsgCenterNotifyAlarmProc(const Topic topic, Request* req)
 {
@@ -1151,6 +1157,12 @@ void MsgCenterNotifyDrinkReminderProc(const Topic topic, Request *req)
         NotificationManager::GetInstance()->ShowNotify(showDrinkReminderNotify, (uint16_t)topic, true);
     }
 }
+void MsgCenterNotifyDebugOutProc(const Topic topic, Request *req)
+{
+    unused(req);
+    WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyDebugOutProc !");
+    NotificationManager::GetInstance()->ShowNotify(showDebugOutputNotify, (uint16_t)topic, true);
+}
 //每日训练数据刷新
 void MsgCenterNotifyActivityProc(const Topic topic, Request* req)
 {
@@ -1545,6 +1557,7 @@ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = {
     {TOPIC_EVENT_DRINKREMINDER,MsgCenterNotifyDrinkReminderProc},
     {TOPIC_EVENT_MESSAGENOTE,MsgCenterNotifyMessageProc},
     {TOPIC_EVENT_SLEEPNOTE,MsgCenterNotifySleepProc},
+    {TOPIC_EVENT_DEBUGOUTPUT,MsgCenterNotifyDebugOutProc},
 };
 
 static MsgCenterNotifyTable *MsgCenterGetNotifyTblCb(uint8_t idx)
diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp
new file mode 100644 (file)
index 0000000..5456611
--- /dev/null
@@ -0,0 +1,477 @@
+#include "notification_manager.h"
+#include "wearable_log.h"
+#include "components/ui_label_button.h"
+#include "components/ui_image_view.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_scroll_view.h"
+#include "../notify/debug_output_notification/debug_output_notification_adapter.h"
+#include "../notify/debug_output_notification/debug_output_notification_itemview.h"
+#include <custom_runtime.h>
+namespace OHOS
+{
+
+    struct DebugOutputViewMapper
+    {
+        const int16_t viewId;
+        bool (DebugOutputViewEventListener::*func)(int16_t thisView);
+    };
+
+    static const DebugOutputViewMapper ViewMapper[] = {
+        {0, &DebugOutputViewEventListener::ChangeDebugOutputMainView},
+        {1, &DebugOutputViewEventListener::ChangeDebugOutputView1},
+    };
+
+    /* -------------------------------------------------------------------------- */
+    UIViewGroup *DebugGroupView{nullptr};
+    UIScrollView *DebugScrollView[sizeof(ViewMapper) / sizeof(ViewMapper[0])]{nullptr};
+    UIList *debugOutputList{nullptr};
+    DebugOutputAdapter *debugOutputAdapter{nullptr};
+    UILabel *debugOutputLabel{nullptr};
+    UILabelButton *debugOutputLabelButton{nullptr};
+    /* -------------------------------------------------------------------------- */
+
+    void DebugOutputViewEventListener::InitDebugOutputItem()
+    {
+        int index = 0;
+        debugOutputItemInfo[index++] = {0, "debugOutpt"}; // 标题:设置()
+        debugOutputItemInfo[index++] = {1, "bt_ble_connectstat"};
+        debugOutputItemInfo[index++] = {2, "cat1_runtime_status_t"};
+        debugOutputItemInfo[index++] = {3, "runtime_status_t"};
+        usedLen = index;
+        /* -------------------------------- Add data -------------------------------- */
+        for (uint8_t i = 0; i < usedLen; i++)
+        {
+            if (debugOutputAdapter)
+                debugOutputAdapter->AddListItem(debugOutputItemInfo[i]);
+        }
+        /* -------------------------------------------------------------------------- */
+    }
+
+    DebugOutputViewEventListener::DebugOutputViewEventListener()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DebugOutputViewEventListener::DebugOutputViewEventListener");
+    }
+
+    DebugOutputViewEventListener::~DebugOutputViewEventListener()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DebugOutputViewEventListener::DebugOutputViewEventListener");
+    }
+
+    DebugOutputViewEventListener &DebugOutputViewEventListener::GetInstance()
+    {
+        static DebugOutputViewEventListener instance;
+        return instance;
+    }
+
+    std::string DebugOutputViewEventListener::get_bt_runtime_status_t(void)
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DebugOutputViewEventListener::get_bt_runtime_status_t");
+        std::string result = "bt_powerOn:" + std::to_string(uapi_dev_runtime_get_bt_powerstat()) + " ";
+        result += "bt_ble_connectstat:" + std::to_string(uapi_dev_runtime_get_ble_connect_stat()) + " ";
+        result += "bt_br_connectstat:" + std::to_string(uapi_dev_runtime_get_br_connect_stat()) + " ";
+        result += "bt_earphone_connectstat:" + std::to_string(uapi_dev_runtime_get_earphone_connect_stat()) + " ";
+        result += "android_app_connected:" + std::to_string(uapi_dev_runtime_get_android_connection_status()) + " ";
+        result += "ble_kumi_service_handler: ";
+        result += "ble_factory_service_handler: ";
+        result += "ble_alipay_service_handler: ";
+        result += "ble_hrs_service_handler: ";
+        result += "ble_hid_service_handler: ";
+        result += "ble_ancs_client_id:" + std::to_string(uapi_dev_runtime_get_ancs_clientid()) + " ";
+        result += "ad2p_service_handler: ";
+        result += "spp_service_handler: ";
+        result += "hfp_service_handler: ";
+
+        return result;
+    }
+
+    std::string DebugOutputViewEventListener::get_cat1_runtime_status_t(void)
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DebugOutputViewEventListener::get_cat1_runtime_status_t");
+        std::string cat1_powerOn = std::to_string(uapi_dev_runtime_get_cat1_powerstat());
+        std::string volte;
+        std::string network_on = std::to_string(uapi_dev_runtime_get_cat1_networkstat());
+        std::string cat1_network_type = std::to_string(uapi_dev_runtime_get_cat1_networtype());
+        std::string sim = std::to_string(uapi_dev_runtime_get_cat1_simstat());
+        std::string signal = std::to_string(uapi_dev_runtime_get_cat1_signal());
+        std::string opera = uapi_dev_runtime_get_cat1_operator();
+        std::string pyVer = uapi_dev_runtime_get_cat1_pyver();
+        std::string modemVer = uapi_dev_runtime_get_cat1_modemver();
+        std::string result = "cat1_powerOn:" + cat1_powerOn + " " + "volte: " + "network_on:" + network_on + " " + "cat1_network_type:" + cat1_network_type + " " + "sim:" + sim + " " + "signal:" + signal + " " + "opera:" + opera + " " + "pyVer:" + pyVer + " " + "modemVer:" + modemVer + " ";
+
+        return result;
+    }
+
+    std::string DebugOutputViewEventListener::get_runtime_status_t(void)
+    {
+        std::string result;
+        return result;
+    }
+
+    bool DebugOutputViewEventListener::OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event)
+    {
+        int viewIndex;
+        if (&view == debugOutputLabelButton)
+        {
+            viewIndex = GetCurViewIndex();
+        }
+        else
+        {
+            DebugOutputItemView *debugOutputItemView = static_cast<DebugOutputItemView *>(&view);
+            int viewIndex = debugOutputItemView->GetViewIndex();
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "viewIndex:%d", viewIndex);
+            ChangeView(0, 1);
+            if (debugOutputLabel == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "debugOutputLabel is nullptr");
+                return false;
+            }
+            SetCurViewIndex(viewIndex);
+        }
+        std::string str;
+        switch (viewIndex)
+        {
+        case 1:
+            str = get_bt_runtime_status_t();
+            debugOutputLabel->SetText(str.c_str());
+            break;
+        case 2:
+            str = get_cat1_runtime_status_t();
+            debugOutputLabel->SetText(str.c_str());
+            break;
+        case 3:
+            str = get_runtime_status_t();
+            debugOutputLabel->SetText(str.c_str());
+            break;
+
+        default:
+            break;
+        }
+
+        if (debugOutputLabelButton)
+        {
+            debugOutputLabelButton->SetHeight(debugOutputLabel->GetY() + debugOutputLabel->GetHeight() + 20);
+            debugOutputLabelButton->Invalidate();
+        }
+        debugOutputLabel->Invalidate();
+
+        return true;
+    }
+
+    bool DebugOutputViewEventListener::OnDrag(UIView &view, const DragEvent &event)
+    {
+        UNUSED(view);
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DebugOutputViewEventListener::OnDrag");
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)
+        {
+            int16_t deltaX;
+            int16_t deltaY;
+            deltaX = event.GetDeltaX();
+            deltaY = event.GetDeltaY();
+            if (MATH_ABS(deltaX) >= MATH_ABS(deltaY) && MATH_ABS(deltaX) > 30)
+            {
+                X_DRAG_FLAG = true;
+            }
+        }
+        return true;
+    }
+
+    bool DebugOutputViewEventListener::OnDragEnd(OHOS::UIView &view, const OHOS::DragEvent &event)
+    {
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && X_DRAG_FLAG)
+        {
+            if (&view == DebugGroupView)
+            {
+                NotificationManager::GetInstance()->StopNotify();
+            }
+            else if (&view == DebugScrollView[1])
+            {
+                ChangeView(1, 0);
+            }
+            X_DRAG_FLAG = false;
+        }
+        return true;
+    }
+
+    bool DebugOutputViewEventListener::ClickFunc(int16_t interface)
+    {
+        int funcSize = sizeof(ViewMapper) / sizeof(ViewMapper[0]);
+        for (int i = 0; i < funcSize; i++)
+        {
+            if (interface == ViewMapper[i].viewId)
+            {
+                bool jug = (this->*(ViewMapper[i].func))(interface);
+                if (jug == false)
+                {
+                    return false;
+                }
+                return true;
+            }
+        }
+        return false;
+    }
+
+    bool DebugOutputViewEventListener::CheckViewParam(int16_t hideView, int16_t showView)
+    {
+        int funcSize = sizeof(ViewMapper) / sizeof(ViewMapper[0]);
+        if (showView < 0 || showView > funcSize)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showView err.");
+            return false;
+        }
+
+        if (hideView < 0 || hideView > funcSize)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hideView err.");
+            return false;
+        }
+
+        return true;
+    }
+
+    void DebugOutputViewEventListener::ChangeView(int16_t hideView, int16_t showView)
+    {
+        if (!CheckViewParam(hideView, showView))
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckViewParam failed.");
+            return;
+        }
+        DebugScrollView[hideView]->SetVisible(false);
+        ClickFunc(showView);
+        DebugScrollView[showView]->SetVisible(true);
+        RootView::GetInstance()->Invalidate();
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hideView:%d -> showView:%d success!!", hideView, showView);
+    }
+
+    UIScrollView *CreateDebugOutputView1(void)
+    {
+        if (DebugScrollView[1] == nullptr)
+        {
+            DebugScrollView[1] = new UIScrollView();
+            if (DebugScrollView[1] == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SettingView::OnStart::DebugScrollView[0] is new fail!!");
+                return nullptr;
+            }
+        }
+        DebugScrollView[1]->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+        DebugScrollView[1]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+        DebugScrollView[1]->SetStyle(STYLE_BACKGROUND_OPA, 255);
+        DebugScrollView[1]->SetHorizontalScrollState(false);
+        DebugScrollView[1]->SetTouchable(true);
+        DebugScrollView[1]->SetScrollBlankSize(70);
+        DebugScrollView[1]->SetReboundSize(35);
+        DebugScrollView[1]->SetThrowDrag(true);
+        UIView::OnDragListener *dragListener = static_cast<UIView::OnDragListener *>(&DebugOutputViewEventListener::GetInstance());
+        if (dragListener == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dragListener is new fail!!");
+            return nullptr;
+        }
+        DebugScrollView[1]->SetOnDragListener(dragListener);
+        /* -------------------------------------------------------------------------- */
+        debugOutputLabel = new UILabel();
+        if (debugOutputLabel == nullptr)
+        {
+            if (debugOutputLabel == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "debugOutputLabel is new fail!!");
+                return nullptr;
+            }
+        }
+        debugOutputLabel->SetPosition(53, 120, 360, 100);
+        debugOutputLabel->SetStyle(STYLE_TEXT_FONT, 30);
+        debugOutputLabel->SetText("123");
+        debugOutputLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+        debugOutputLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 30);
+        DebugScrollView[1]->Add(debugOutputLabel);
+        /* -------------------------------------------------------------------------- */
+        if (debugOutputLabelButton == nullptr)
+        {
+            debugOutputLabelButton = new UILabelButton();
+            if (debugOutputLabelButton == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "debugOutputLabelButton is new fail!!");
+                return nullptr;
+            }
+        }
+        debugOutputLabelButton->SetPosition(43, debugOutputLabel->GetY() + debugOutputLabel->GetHeight() + 20);
+        debugOutputLabelButton->Resize(380, 100);
+        debugOutputLabelButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+        debugOutputLabelButton->SetText("刷新");
+        debugOutputLabelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 30);
+        debugOutputLabelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
+        UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(&DebugOutputViewEventListener::GetInstance());
+        if (clickListener == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clickListener is new fail!!");
+            return nullptr;
+        }
+        debugOutputLabelButton->SetOnClickListener(clickListener);
+        DebugScrollView[1]->Add(debugOutputLabelButton);
+
+        return DebugScrollView[1];
+    }
+
+    bool DebugOutputViewEventListener::ChangeDebugOutputMainView(int16_t thisView)
+    {
+        if (DebugScrollView[thisView] == nullptr)
+        {
+            DebugGroupView->Add(DebugScrollView[thisView]);
+        }
+        return true;
+    }
+
+    bool DebugOutputViewEventListener::ChangeDebugOutputView1(int16_t thisView)
+    {
+        if (DebugScrollView[thisView] == nullptr)
+        {
+            DebugScrollView[thisView] = CreateDebugOutputView1();
+            if (DebugScrollView[thisView] == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new DebugScrollView[%d] fail", thisView);
+                return false;
+            }
+            DebugGroupView->Add(DebugScrollView[thisView]);
+        }
+        return true;
+    }
+
+    void DebugOutputViewEventListener::SetCurViewIndex(int16_t viewNum)
+    {
+        curView = viewNum;
+    }
+
+    int DebugOutputViewEventListener::GetCurViewIndex(void)
+    {
+        return curView;
+    }
+
+    /*创建调试专用主窗口视图*/
+    UIViewGroup *CreateDebugOutputMainView(void)
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateDebugOutputMainView");
+        if (DebugGroupView == nullptr)
+        {
+            if (DebugGroupView == nullptr)
+            {
+                DebugGroupView = new UIViewGroup();
+                if (DebugGroupView == nullptr)
+                {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SettingView::OnStart::DebugGroupView is new fail!!");
+                    return nullptr;
+                }
+            }
+            DebugGroupView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+            UIView::OnDragListener *dragListener = static_cast<UIView::OnDragListener *>(&DebugOutputViewEventListener::GetInstance());
+            if (dragListener == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dragListener is new fail!!");
+                return nullptr;
+            }
+            DebugGroupView->SetOnDragListener(dragListener);
+            /* -------------------------------------------------------------------------- */
+            if (DebugScrollView[0] == nullptr)
+            {
+                DebugScrollView[0] = new UIScrollView();
+                if (DebugScrollView[0] == nullptr)
+                {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SettingView::OnStart::DebugScrollView[0] is new fail!!");
+                    return nullptr;
+                }
+            }
+            DebugScrollView[0]->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+            DebugScrollView[0]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+            DebugScrollView[0]->SetStyle(STYLE_BACKGROUND_OPA, 255);
+            DebugScrollView[0]->SetHorizontalScrollState(false);
+            DebugScrollView[0]->SetTouchable(true);
+            DebugScrollView[0]->SetThrowDrag(true);
+            DebugGroupView->Add(DebugScrollView[0]);
+            /* -------------------------------------------------------------------------- */
+            if (debugOutputAdapter == nullptr)
+            {
+                debugOutputAdapter = new DebugOutputAdapter();
+                if (debugOutputAdapter == nullptr)
+                {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "debugOutputAdapter is new fail!!");
+                    return nullptr;
+                }
+            }
+            UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(&DebugOutputViewEventListener::GetInstance());
+            if (clickListener == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clickListener is new fail!!");
+                return nullptr;
+            }
+            debugOutputAdapter->SetItemClickListener(clickListener);
+            DebugOutputViewEventListener::GetInstance().InitDebugOutputItem();
+            /* -------------------------------------------------------------------------- */
+            if (debugOutputList == nullptr)
+            {
+                debugOutputList = new UIList(UIList::VERTICAL);
+                if (debugOutputList == nullptr)
+                {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "debugOutputList is new fail!!");
+                    return nullptr;
+                }
+            }
+            debugOutputList->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+            debugOutputList->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+            debugOutputList->EnableAutoAlign(true);      // 设置此列表的自动对齐状态。当滚动停止时,子视图被选中,其位置自动与预设位置对齐
+            debugOutputList->SetThrowDrag(true);         // 设置手指抬起屏幕后是否继续滚动。
+            debugOutputList->SetMaxScrollDistance(1000); // 设置手指抬起屏幕后的最大滚动距离。
+            debugOutputList->SetSwipeACCLevel(800);      /*设置手指抬起屏幕后的补偿距离。*/
+            debugOutputList->SetAdapter(debugOutputAdapter);
+            debugOutputList->RefreshList();
+            debugOutputList->SetReboundSize(30);
+            // debugOutputList->SetScrollBlankSize(30);
+            debugOutputList->SetRotateFactor(1.0);
+            DebugScrollView[0]->Add(debugOutputList);
+            /* -------------------------------------------------------------------------- */
+            NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeDebugOutputMainView);
+            /* -------------------------------------------------------------------------- */
+        }
+        return DebugGroupView;
+    }
+
+    /*释放调试专用主窗口视图*/
+    void FreeDebugOutputMainView(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FreeDebugOutputMainView");
+
+        if (DebugGroupView != nullptr)
+        {
+            DebugGroupView->RemoveAll();
+            if (DebugScrollView[0] != nullptr)
+            {
+                DebugScrollView[0]->RemoveAll();
+
+                delete debugOutputList;
+                debugOutputList = nullptr;
+
+                delete debugOutputAdapter;
+                debugOutputAdapter = nullptr;
+
+                delete DebugScrollView[0];
+                DebugScrollView[0] = nullptr;
+            }
+            if (DebugScrollView[1] != nullptr)
+            {
+                DebugScrollView[1]->RemoveAll();
+
+                delete debugOutputLabel;
+                debugOutputLabel = nullptr;
+
+                delete debugOutputLabelButton;
+                debugOutputLabelButton = nullptr;
+
+                delete DebugScrollView[1];
+                DebugScrollView[1] = nullptr;
+            }
+            RootView::GetInstance()->Remove(DebugGroupView);
+            delete DebugGroupView;
+            DebugGroupView = nullptr;
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FreeDebugOutputMainView success!!");
+        }
+        return;
+    }
+}
diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification_adapter.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification_adapter.cpp
new file mode 100644 (file)
index 0000000..6a5223b
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-10-02 14:54:23
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-10-02 17:38:58
+ * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification_adapter.cpp
+ */
+#include "../notify/debug_output_notification/debug_output_notification_adapter.h"
+#include "../notify/debug_output_notification/debug_output_notification_itemview.h"
+#include "wearable_log.h"
+namespace OHOS
+{
+    DebugOutputAdapter::DebugOutputAdapter() {}
+
+    DebugOutputAdapter::~DebugOutputAdapter()
+    {
+        listData.clear();
+    }
+
+    uint16_t DebugOutputAdapter::GetCount(void)
+    {
+        return listData.size();
+    }
+
+    void DebugOutputAdapter::SetData(std::list<DebugOutputItem> &data)
+    {
+        if (!listData.empty())
+        {
+            listData.clear();
+        }
+        std::list<DebugOutputItem>::iterator it;
+        for (it = data.begin(); it != data.end(); it++)
+        {
+            listData.push_back(*it);
+        }
+    }
+
+    UIView *DebugOutputAdapter::GetView(UIView *inView, int16_t index)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DebugOutputAdapter::GetView:%d", index);
+        if (listData.empty())
+        {
+            return nullptr;
+        }
+        if (index < 0)
+        {
+            return nullptr;
+        }
+        size_t uindex = index;
+        if (uindex >= listData.size())
+        {
+            return nullptr;
+        }
+
+        std::list<DebugOutputItem>::iterator it = listData.begin();
+        for (int i = 0; i < index; i++)
+        {
+            it++;
+        }
+        DebugOutputItem itemData = *it;
+        DebugOutputItemView *item = nullptr;
+        if (inView == nullptr)
+        {
+            item = new DebugOutputItemView();
+        }
+        else
+        {
+            item = static_cast<DebugOutputItemView *>(inView);
+        }
+        item->SetViewIndex(index);
+        item->SetItemInfo(itemData);
+        item->SetOnClickListener(itemClickListener);
+        return item;
+    }
+
+    void DebugOutputAdapter::AddListItem(const DebugOutputItem &item)
+    {
+        listData.push_back(item);
+    }
+} // namespace OHOS
diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification_itemview.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification_itemview.cpp
new file mode 100644 (file)
index 0000000..b511f79
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-03-27 19:48:49
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-10-03 09:48:15
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/src/DebugOutputItemView.cpp
+ */
+#include "../notify/debug_output_notification/debug_output_notification_itemview.h"
+#include "wearable_log.h"
+#include "UiConfig.h"
+namespace OHOS
+{
+    DebugOutputItemView::DebugOutputItemView()
+    {
+        SetPosition(43, 120, 466, 120);
+        SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+        SetStyle(STYLE_BACKGROUND_OPA, 255);
+        SetUpChild();
+        Add(&labelButton);
+    }
+
+    DebugOutputItemView::~DebugOutputItemView()
+    {
+        Remove(&labelButton);
+    }
+
+    void DebugOutputItemView::SetItemInfo(const DebugOutputItem itemInfo)
+    {
+        sItemInfo = itemInfo;
+        labelButton.SetText(itemInfo.name);
+        if (itemInfo.index != 0)
+        {
+            labelButton.SetAlign(TEXT_ALIGNMENT_LEFT);
+            labelButton.SetImagePosition(326, 37);
+            labelButton.SetLabelPosition(47, 0);
+            labelButton.SetStyle(STYLE_BACKGROUND_OPA, 255);
+            labelButton.SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
+            SetTouchable(true);
+        }
+        else
+        {
+            labelButton.SetAlign(TEXT_ALIGNMENT_CENTER);
+            labelButton.SetImagePosition(-100, 0);
+            labelButton.SetLabelPosition(0, 0);
+            labelButton.SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+            labelButton.SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);
+            SetTouchable(false);
+        }
+    }
+
+    void DebugOutputItemView::SetUpChild()
+    {
+        labelButton.SetPosition(43, 0, 380, 100);
+        labelButton.SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+        labelButton.SetStyle(STYLE_LINE_HEIGHT, 35);
+        labelButton.SetAlign(TEXT_ALIGNMENT_LEFT);
+        labelButton.SetLabelPosition(47, 0);
+        labelButton.SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 30);
+        labelButton.SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
+        labelButton.SetImagePosition(326, 37);
+        labelButton.SetImageSrc(PNG_SETTING_NEXT_IMAGE, PNG_SETTING_NEXT_IMAGE);
+    }
+}
\ No newline at end of file