From: Caisking <3449750381@qq.com> Date: Tue, 23 Jan 2024 11:05:12 +0000 (+0800) Subject: 增加XTS监测 X-Git-Tag: release_V1.2.70_20241020_135402~1337 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=11c238833c54a20fbf4d62a1f89b8496d009bb9c;p=mirrors%2FFD230.git 增加XTS监测 --- diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp index ee1b0f6f0..2e60ae71d 100755 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp @@ -482,7 +482,7 @@ namespace OHOS } /* -------------------------------------------------------------------------- */ - void NativeLauncher::InitMessageSlice(void) // 系统:恢复出厂设置 + void NativeLauncher::InitMessageSlice(void) // 消息中心 { SliceProxy *messageview = new AbilitySliceProxy; if (messageview == nullptr) diff --git a/code/sdk/application/wearable/nativeapp/nativeui/dial/include/Digital_clockView.h b/code/sdk/application/wearable/nativeapp/nativeui/dial/include/Digital_clockView.h index d9beaf19a..2540a95a3 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/dial/include/Digital_clockView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/dial/include/Digital_clockView.h @@ -39,6 +39,25 @@ extern uint8_t battery_get_voltage(float *voltage); +#include "hal_tick.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" +{ +#endif +#endif + + extern uint8_t battery_get_voltage(float *voltage); +#ifdef XTS_SUPPORT + extern uint8_t is_xts_test_done(void); +#endif +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif + namespace OHOS { #define CHANGEBUTTON "changebutton" // 切换表盘按键 @@ -243,6 +262,43 @@ namespace OHOS } }; + class XTSCallback : public AnimatorCallback + { + public: + explicit XTSCallback(UILabel *XTSlabel) : XTSlabel(XTSlabel) {} + ~XTSCallback() {} + virtual void Callback(UIView *view) + { + uint8_t xts_testing = 1; +#ifdef XTS_SUPPORT + xts_testing = is_xts_test_done(); +#endif + if (!xts_testing) + { + // XTS测试进行 + xts_flag = 1; + XTSlabel->SetText("XTS测试进行中\n请勿操作表盘"); + XTSlabel->SetTextColor(Color::GetColorFromRGBA(0xe6, 0x04, 0x09, 0xff)); + } + else + { + // XTS测试结束 + if (xts_flag) + { + XTSlabel->SetText("XTS测试结束"); + XTSlabel->SetTextColor(Color::GetColorFromRGBA(0x4e, 0xe6, 0x04, 0xff)); + xts_flag = 0; // 复位 + } + } + } + + private: + uint8_t xts_flag = 0; // 标志位 + UILabel *XTSlabel{nullptr}; + // std::thread workerThread; + // std::atomic stopThread; + }; + class Digital_clockView : public UICardPage { @@ -277,6 +333,11 @@ namespace OHOS Digital_clockView &operator=(Digital_clockView &&) = delete; // UIViewGroup *container_ = nullptr; + /* --------------------------------- XTS监测标签 -------------------------------- */ + UILabel *XTSLabel = nullptr; + AnimatorCallback *xtsCallback_ = nullptr; + Animator *xtsanimator_ = nullptr; + /* -------------------------------------------------------------------------- */ UIImageView *background = nullptr; UIImageView *hour1 = nullptr; UIImageView *hour2 = nullptr; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp index 80a8d1167..b32341471 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp @@ -687,9 +687,6 @@ namespace OHOS if (loadJsonData(JosnfilePath)) { std::string Dialtype = cJSON_GetObjectItem(cjson_json, "Dialtype")->valuestring; - /* -------------------------------------------------------------------------- */ - - /* -------------------------------------------------------------------------- */ Initbackground(); if (Dialtype == "pointer") { @@ -702,6 +699,27 @@ namespace OHOS Initdata(); Initweek(); Initbattery(); + /* -------------------------------------------------------------------------- */ +#if XTS_SUPPORT + if (XTSLabel == nullptr) + { + XTSLabel = new UILabel(); + } + XTSLabel->SetPosition(130, 273); // widget's left position and top position + XTSLabel->Resize(200, 60); // widget's width and height + XTSLabel->SetViewId("label1"); // Set style + XTSLabel->SetStyle(STYLE_TEXT_FONT, 30); + + XTSLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + XTSLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + XTSLabel->SetRollSpeed(0); + XTSLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + Add(XTSLabel); + xtsCallback_ = new XTSCallback(XTSLabel); + xtsanimator_ = new Animator(xtsCallback_, XTSLabel, 1000, true); + xtsanimator_->Start(); +#endif + /* -------------------------------------------------------------------------- */ AddButton(); cJSON_Delete(cjson_json); } @@ -792,6 +810,21 @@ namespace OHOS delete backgroundAnimator; backgroundAnimator = nullptr; } + /* -------------------------------------------------------------------------- */ + delete XTSLabel; + XTSLabel = nullptr; + if (xtsCallback_ != nullptr) + { + delete xtsCallback_; + xtsCallback_ = nullptr; + } + if (xtsanimator_ != nullptr) + { + xtsanimator_->Stop(); + delete xtsanimator_; + xtsanimator_ = nullptr; + } + /* -------------------------------------------------------------------------- */ } /*** diff --git a/code/sdk/application/wearable/nativeapp/nativeui/message/include/MessageAdapter.h b/code/sdk/application/wearable/nativeapp/nativeui/message/include/MessageAdapter.h index 04ed8d4dd..bfbfa1a0f 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/message/include/MessageAdapter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/message/include/MessageAdapter.h @@ -24,10 +24,10 @@ namespace OHOS typedef struct { int index; - const char *label; // 标签 const char *icon; // 图标 + const char *label; // 标签 const char *labelbutton; // 未读 - + bool hasSecondMenu; } MessageListItem; class MessageListAdapter : public AbstractAdapter diff --git a/code/sdk/application/wearable/nativeapp/nativeui/message/include/MessageItemView.h b/code/sdk/application/wearable/nativeapp/nativeui/message/include/MessageItemView.h index e85c24a27..eedaa3c69 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/message/include/MessageItemView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/message/include/MessageItemView.h @@ -31,11 +31,11 @@ namespace OHOS private: MessageItemView(const MessageItemView &); - UIImageView sbackground; // 背景 - UILabel sLabel; // 标签 - UIImageView sIcon; // 图标 - UILabelButton sLabelButton; // 未读 - MessageListItem sItemInfo = {0, nullptr}; + UIImageView sbackground; // 背景 + UIImageView sIcon; // 图标 + UILabel sLabel; // 标签 + UILabelButton sLabelButton; // 未读 + MessageListItem sItemInfo = {0, nullptr, nullptr, nullptr, false}; }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/message/include/MessageModel.h b/code/sdk/application/wearable/nativeapp/nativeui/message/include/MessageModel.h index ecc4107cb..97c01b118 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/message/include/MessageModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/message/include/MessageModel.h @@ -2,7 +2,7 @@ * @Author: Caisking 3449750381@qq.com * @Date: 2024-01-23 16:03:34 * @LastEditors: Caisking 3449750381@qq.com - * @LastEditTime: 2024-01-23 17:22:49 + * @LastEditTime: 2024-01-23 18:05:43 * @FilePath: /FD230/code/sdk/application/wearable/nativeapp/nativeui/message/include/MessageModel.h * @Description: * @ @@ -34,7 +34,7 @@ namespace OHOS MessageModel(const MessageModel &); MessageModel &operator=(const MessageModel &); virtual ~MessageModel(); - static const uint16_t MessageListMaxNum = 6; + static const uint16_t MessageListMaxNum = 4; MessageListItem Messages[MessageListMaxNum] = {0, nullptr}; //std::map MessageIdToViewId; bool btConnectStatus{false}; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/message/src/MessageItemView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/message/src/MessageItemView.cpp index 98c9471ff..60fb8abc8 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/message/src/MessageItemView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/message/src/MessageItemView.cpp @@ -21,8 +21,8 @@ namespace OHOS SetTouchable(true); SetUpChild(); Add(&sbackground); - Add(&sLabel); Add(&sIcon); + Add(&sLabel); Add(&sLabelButton); } @@ -56,7 +56,7 @@ namespace OHOS sLabel.SetStyle(STYLE_TEXT_FONT, 30); sLabel.SetStyle(STYLE_LINE_HEIGHT, 36); sLabel.SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); - sLabel.SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff)); + sLabel.SetTextColor(Color::White()); sLabel.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); sLabelButton.SetPosition(215, 25, 140, 50); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/message/src/MessageModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/message/src/MessageModel.cpp index e81bc1b79..8efef7ae2 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/message/src/MessageModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/message/src/MessageModel.cpp @@ -25,10 +25,10 @@ namespace OHOS void MessageModel::InitMessageListItem() { - Messages[0] = {0, "/user/res/message/system-icon.bin", "系统", "暂无信息"}; - Messages[1] = {1, "/user/res/message/message-icon.bin", "信息", "暂无信息"}; - Messages[2] = {2, "/user/res/message/WeChat-icon.bin", "微信", "暂无信息"}; - Messages[3] = {3, "/user/res/message/QQ-icon.bin", "QQ", "暂无信息"}; + Messages[0] = {0, "/user/res/message/system-icon.bin", "系统", "暂无信息", false}; + Messages[1] = {1, "/user/res/message/message-icon.bin", "信息", "暂无信息", false}; + Messages[2] = {2, "/user/res/message/WeChat-icon.bin", "微信", "暂无信息", false}; + Messages[3] = {3, "/user/res/message/QQ-icon.bin", "QQ", "暂无信息", false}; } const MessageListItem *MessageModel::GetMessagelistItems() const diff --git a/code/sdk/application/wearable/nativeapp/nativeui/message/src/MessageView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/message/src/MessageView.cpp index c698b4d50..cec748b1e 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/message/src/MessageView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/message/src/MessageView.cpp @@ -2,7 +2,7 @@ * @Author: Caisking 3449750381@qq.com * @Date: 2024-01-22 16:20:34 * @LastEditors: Caisking 3449750381@qq.com - * @LastEditTime: 2024-01-23 17:12:40 + * @LastEditTime: 2024-01-23 18:11:40 * @FilePath: /FD230/code/sdk/application/wearable/nativeapp/nativeui/message/src/MessageView.cpp * @Description: * @ @@ -63,7 +63,7 @@ namespace OHOS title->SetStyle(STYLE_LINE_HEIGHT, 36); title->SetText("信息通知"); title->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); - title->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff)); + title->SetStyle(STYLE_TEXT_COLOR, Color::White().full); title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ //UIList 的适配器