${NativeApp}/nativelauncher/include
${NativeApp}/nativeui/include
${ROOT_DIR}/application/wearable/fd230/nativeapp/nativeui/
+ ${ROOT_DIR}/application/wearable/fd230/nativeapp/nativeui/include
)
set(PRIVATE_HEADER
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: AddCardAdapter.h
+ * Author:
+ * Create: 2021-09-18
+ */
+
+#ifndef ADD_CARD_ADAPTER_H
+#define ADD_CARD_ADAPTER_H
+
+#include <list>
+#include <string>
+#include "components/ui_list.h"
+#include "components/ui_label.h"
+#include "components/ui_view_group.h"
+#include "components/ui_image_view.h"
+#include "components/abstract_adapter.h"
+#include "UiConfig.h"
+#include "wearable_log.h"
+#include "add_card/AddCardItem.h"
+
+namespace OHOS {
+class AddCardAdapter : public AbstractAdapter {
+public:
+ explicit AddCardAdapter();
+ ~AddCardAdapter() override;
+
+ uint16 GetCount(void) override;
+
+ UIView *GetView(UIView *inView, int16 index) override;
+
+ void AddListItem(const AddCardInfo &item);
+
+ void SetItemClickListener(UIView::OnClickListener *itemClickListener)
+ {
+ itemClickListener_ = itemClickListener;
+ }
+
+ void ClearItem(void);
+
+private:
+ std::list<AddCardInfo> listData_;
+ UIView::OnClickListener *itemClickListener_;
+};
+}
+#endif
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
+ * Description: AddCardItem.h\r
+ * Author:\r
+ * Create: 2021-11-23\r
+ */\r
+\r
+#ifndef ADD_CARD_ITEM_H\r
+#define ADD_CARD_ITEM_H\r
+\r
+#include <cstdint>\r
+#include <map>\r
+#include "components/ui_view.h"\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_image_view.h"\r
+#include "components/ui_label_button.h"\r
+#include "UiConfig.h"\r
+\r
+namespace OHOS {\r
+typedef struct {\r
+ CardId id;\r
+ bool addFlag;\r
+ const char *cardImg;\r
+} AddCardInfo;\r
+\r
+class AddCardItem : public UIViewGroup {\r
+public:\r
+ AddCardItem();\r
+ ~AddCardItem() override;\r
+ void SetItemInfo(const AddCardInfo &cardInfo);\r
+ void SetOnClickListener(OnClickListener *onClickListener);\r
+ void UpdateItemInfo(bool addFlag);\r
+private:\r
+ void SetUpChild();\r
+ UIImageView cardImg_;\r
+ UILabelButton cardLabel_;\r
+ AddCardInfo cardInfo_;\r
+};\r
+\r
+}\r
+\r
+#endif // ADD_CARD_ITEM_H
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: AddCardModel.h
+ * Author:
+ * Create: 2021-11-23
+ */
+
+#ifndef ADD_CARD_MODEL_H
+#define ADD_CARD_MODEL_H
+
+#include <cstdint>
+#include <map>
+#include "AppViewIDs.h"
+#include "UiConfig.h"
+#include "add_card/AddCardPresenter.h"
+#include "main/MainModel.h"
+
+namespace OHOS {
+ class AddCardModel {
+ public:
+ static AddCardModel &GetInstance(void);
+ void SetSelectedCardIndex(uint8_t cardIndex);
+ uint8_t GetSelectedCardIndex(void) const;
+ void AddCardSetting(void);
+ private:
+ AddCardModel();
+ AddCardModel(const AddCardModel &);
+ AddCardModel &operator=(const AddCardModel &);
+ virtual ~AddCardModel();
+ uint8_t selectedCardIndex{0};
+ };
+}
+
+#endif // ADD_CARD_MODEL_H
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: AddCardPresenter.h
+ * Author:
+ * Create: 2021-11-23
+ */
+
+#ifndef ADD_CARD_PRESENTER_H
+#define ADD_CARD_PRESENTER_H
+
+#include "Presenter.h"
+#include "components/ui_list.h"
+#include "components/ui_view.h"
+#include "main/ModelListenerSample.h"
+
+#define TOAST_KEEP_TIME 1000
+
+namespace OHOS {
+static const char *ADD_CARD_ADD = "addcardadd";
+
+class AddCardView;
+class AddCardModel;
+class AddCardPresenter : public Presenter<AddCardView>, public ModelListenerSample,
+ public UIView::OnClickListener, public UIView::OnDragListener,
+ public ListScrollListener {
+public:
+ AddCardPresenter();
+ ~AddCardPresenter() override;
+
+ void OnTickEvent() override;
+ void Notify() override {}
+ bool OnClick(UIView &view, const ClickEvent &event) override;
+ void OnScrollStart(int16_t index, UIView *view) override;
+ void OnScrollEnd(int16_t index, UIView *view) override;
+ void OnItemSelected(int16_t index, UIView* view) override;
+ bool OnDrag(UIView& view, const DragEvent& event) override;
+private:
+ void ResetTickTimer(void);
+ AddCardModel *model{nullptr};
+ uint64_t startTime{0};
+ bool cardCountEvent{false};
+};
+}
+
+#endif // ADD_CARD_PRESENTER_H
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: AddCardView.h
+ * Author:
+ * Create: 2021-11-23
+ */
+
+#ifndef ADD_CARD_VIEW_H
+#define ADD_CARD_VIEW_H
+
+#include "View.h"
+#include "components/ui_view_group.h"
+#include "components/ui_label.h"
+#include "components/ui_image_view.h"
+#include "components/ui_toggle_button.h"
+#include "ChangeSliceListener.h"
+#include "UiConfig.h"
+#include "add_card/AddCardAdapter.h"
+#include "add_card/AddCardModel.h"
+
+namespace OHOS {
+class AddCardPresenter;
+
+class AddCardView : public View<AddCardPresenter> {
+public:
+ AddCardView();
+ ~AddCardView() override;
+
+ static AddCardView *GetInstance()
+ {
+ static AddCardView instance;
+ return &instance;
+ }
+
+ void OnStart() override;
+ void RefreshCardList(void);
+ void ExceedsCardCountEvent(bool isVisible);
+private:
+ void SetUpListInfo(void);
+ void SetUpListView(void);
+ void SetUpToast(void);
+ UIList contentList_;
+ UILabel toastLabel_;
+ AddCardAdapter *addCardAdapter_{nullptr};
+};
+}
+#endif // ADD_CARD_VIEW_H
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2024-2024. All rights reserved.
+ * Description: AmbientClockView
+ * Author:
+ * Create: 2024-10-30
+ */
+
+#ifndef AMBIENT_VIEW_GROUP_H
+#define AMBIENT_VIEW_GROUP_H
+
+#include <string>
+#include <ctime>
+#include "View.h"
+#include "components/ui_label.h"
+#include "components/root_view.h"
+#include "components/ui_view_group.h"
+#include "components/ui_image_view.h"
+#include "components/ui_label_button.h"
+#include "components/ui_sweep_clock.h"
+#include "ChangeSliceListener.h"
+#include "font/ui_font_bitmap.h"
+#include "font/ui_font.h"
+#include "graphic_config.h"
+#include "main/HealthModel.h"
+#include "activity/ActivityModel.h"
+#include "UiConfig.h"
+#include "components/ui_card_page.h"
+#include "animator/animator_manager.h"
+#include "sys/time.h"
+
+namespace OHOS {
+class AmbientClockView : public UICardPage {
+public:
+ AmbientClockView();
+ ~AmbientClockView() override;
+ AmbientClockView(const AmbientClockView &) = delete;
+ AmbientClockView &operator=(const AmbientClockView &) = delete;
+
+ bool InitView(void);
+ void PreLoad(void) override;
+ void UpdateTime(void);
+ uint32_t GetPeriod(void) const
+ {
+ return 1000; // 1000: ms
+ }
+
+private:
+ bool InitCenterCircleView(void);
+ bool InitHandView(void);
+ void InitDateTime(void);
+ bool InitSweepClock(void);
+ bool LoadClockImage(Image *view, uint32_t resId);
+ UISweepClock *mainSweepClock_{nullptr};
+ Image *secondHand_{nullptr};
+ Image *minuteHand_{nullptr};
+ Image *hourHand_{nullptr};
+ Image *hand24Hour_{nullptr};
+ Image *bigCircle_{nullptr};
+ Image *medCircle_{nullptr};
+ Image *smallCircle_{nullptr};
+ bool viewiInitStatus_{false};
+}; // class AmbientClockView
+} // namespace OHOS
+#endif // AMBIENT_VIEW_GROUP_H
+
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: MainClockView
+ * Author:
+ * Create: 2021-10-18
+ */
+
+#ifndef MAIN_CLOCK_VIEW_H
+#define MAIN_CLOCK_VIEW_H
+
+#include <string>
+#include <ctime>
+#include "View.h"
+#include "components/ui_label.h"
+#include "components/root_view.h"
+#include "components/ui_view_group.h"
+#include "components/ui_image_view.h"
+#include "components/ui_label_button.h"
+#include "components/ui_sweep_clock.h"
+#include "ChangeSliceListener.h"
+#include "font/ui_font_bitmap.h"
+#include "font/ui_font.h"
+#include "graphic_config.h"
+#include "main/HealthModel.h"
+#include "activity/ActivityModel.h"
+#include "UiConfig.h"
+#include "components/ui_card_page.h"
+#include "animator/animator_manager.h"
+#include <ctime>
+#include "sys/time.h"
+
+namespace OHOS {
+class MainClockView : public UICardPage {
+public:
+ MainClockView();
+ ~MainClockView() override;
+ static MainClockView *GetInstance(void);
+ bool InitView(void);
+ void PreLoad(void) override;
+ void UnLoad(void) override;
+ void RefreshStep(int step);
+ void RefreshHeartRate(int value);
+ void ClockAnimatorStart(void);
+ void ClockAnimatorStop(void);
+ void UpdateTime(void);
+
+private:
+ void InitStepValue();
+ bool InitLabelView(void);
+ bool InitCenterCircleView(void);
+ bool InitHandView(void);
+ void InitDateTime(void);
+ bool InitSweepClock(void);
+ bool LoadClockImage(Image *view, uint32_t resId);
+ bool LoadClockImage(UIImageView *view, uint32_t resId);
+ UIImageView *curFace{nullptr};
+ UILabelButton *stepLabel{nullptr};
+ UILabel *batteryLabel{nullptr};
+ UILabel *weekLabel{nullptr};
+ UILabel *heartRateLabel{nullptr};
+ UISweepClock *mainSweepClock{nullptr};
+ Image *secondHand{nullptr};
+ Image *minuteHand{nullptr};
+ Image *hourHand{nullptr};
+ UIImageView *heartRate{nullptr};
+ Image *hand24Hour{nullptr};
+ UIImageView *weekDay{nullptr};
+ UIImageView *progress{nullptr};
+ Image *bigCircle{nullptr};
+ Image *medCircle{nullptr};
+ Image *smallCircle{nullptr};
+ bool viewiInitStatus{false};
+};
+} // namespace OHOS
+#endif // MAIN_CLOCK_VIEW_H
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: APPVEIW
+ * Author:
+ * Create: 2021-10-15
+ */
+
+#ifndef APP_GROUP_VIEW_H
+#define APP_GROUP_VIEW_H
+
+#include <string>
+#include "View.h"
+#include "components/ui_card_page.h"
+#include "common/screen.h"
+
+namespace OHOS {
+class AppGroupView : public UICardPage {
+public:
+ AppGroupView()
+ {
+ SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+ }
+ ~AppGroupView() override {}
+ virtual bool InitView(void *caller)=0;
+ bool initViewStatus{false};
+};
+} // namespace OHOS
+#endif // APP_GROUP_VIEW_H
--- /dev/null
+/*\r
+ * Copyright (c) 2023 CompanyNameMagicTag.\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+#ifndef GRAPHIC_LITE_DIAL_BIN_PARSER_H\r
+#define GRAPHIC_LITE_DIAL_BIN_PARSER_H\r
+#include "main/DialBinParserManager.h"\r
+#include "main/DialBinTypesV2.h"\r
+#include "components/ui_abstract_progress.h"\r
+\r
+namespace OHOS {\r
+class DialBinParser : public DialBinParserInterface {\r
+public:\r
+ bool UpdateDial(const std::string& file, FILE* fp, DialViewGroup* group, DisplayState state) override;\r
+ bool GetDialPreviewInfo(const std::string& file, FILE* fp, DialPreviewInfo* info) override;\r
+ DialBinParser();\r
+ ~DialBinParser() override;\r
+\r
+protected:\r
+ int32_t ParseDialHeader(FILE* file);\r
+ int32_t ParserDialStaticImg(FILE* fp);\r
+ int32_t ParserDialSequenceImg(FILE* fp);\r
+ int32_t ParserDialRotateImg(FILE* fp);\r
+ int32_t ParserDialOptionImg(FILE* fp);\r
+ int32_t ParserDialDigitalImg(FILE* fp);\r
+ int32_t ParserDialLabel(FILE* fp);\r
+ int32_t ParserDialArcLabel(FILE* fp);\r
+ int32_t ParserDialBoxProgress(FILE* fp);\r
+ int32_t ParserDialArcProgress(FILE* fp);\r
+ int32_t ParserDialVideo(FILE* fp);\r
+ int32_t ParserDialClick(FILE* fp);\r
+ int32_t ParserDialKaleidoscope(FILE* fp);\r
+\r
+private:\r
+ void* MallocAndReadBuf(FILE* file, uint32_t readSize);\r
+ bool SetProgressType(FILE* fp, UIAbstractProgress* view, DialProgressType data);\r
+\r
+ static constexpr uint8_t DIAL_BIN_PARSER_FUNC_NUM = 12; // 12: func max value\r
+ int32_t (DialBinParser::*funcArray_[DIAL_BIN_PARSER_FUNC_NUM])(FILE*);\r
+\r
+ DialViewGroup* dialGroup_ = nullptr;\r
+ std::string file_;\r
+ uint32_t dirId_ = 0xfef << 20; // 20: offset\r
+ uint32_t imageOffset_ = 0;\r
+ bool v2Version_ = false;\r
+ DisplayState state_ = DisplayState::NORMAL;\r
+};\r
+}\r
+#endif\r
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2024. All rights reserved.
+ * Description: DialBinParserManager
+ * Author:
+ * Create: 2024-12-03
+ */
+
+#ifndef GRAPHIC_LITE_DIAL_BIN_PARSER_MANAGER_H
+#define GRAPHIC_LITE_DIAL_BIN_PARSER_MANAGER_H
+#include <iostream>
+#include <cstring>
+#include "graphic_types.h"
+#include "main/dial/DialViewGroup.h"
+#include "main/DialBinTypes.h"
+
+namespace OHOS {
+class DialBinParserInterface {
+public:
+ virtual bool UpdateDial(const std::string& file, FILE* fp, DialViewGroup* group, DisplayState state) = 0;
+ virtual bool GetDialPreviewInfo(const std::string& file, FILE* fp, DialPreviewInfo* info) = 0;
+ virtual void SetEncryptData(uint8_t *data, uint32_t len) {}
+ virtual ~DialBinParserInterface() {}
+}; // class DialBinParserInterface
+
+class DialBinParserManager {
+public:
+ static DialBinParserManager *GetInstance(void);
+ bool UpdateDial(const std::string &file, FILE *fp, DialViewGroup *group, DisplayState state);
+ bool GetDialPreviewInfo(const std::string& file, FILE *fp, DialPreviewInfo *info, bool isNeedVerify = false);
+ bool RegisterParser(const std::string &version, DialBinParserInterface *parser);
+
+ uint8_t GetSupportVersionCnt() const
+ {
+ return cnt_;
+ }
+
+ bool GetVersionByIndex(uint8_t index, std::string &version)
+ {
+ if (index >= cnt_) {
+ return false;
+ }
+ version = parsers_[index].version;
+ return true;
+ }
+
+private:
+ DialBinParserManager();
+ virtual ~DialBinParserManager();
+ DialBinParserInterface *GetParser(FILE* fp) const;
+ DialBinParserInterface *GetParser(const std::string &fileName, FILE *fp, bool isNeedVerify = false) const;
+ static constexpr uint8_t PARSER_MAX_NUM = 8;
+ struct Pair {
+ std::string version;
+ DialBinParserInterface *parser = nullptr;
+ };
+ Pair parsers_[PARSER_MAX_NUM];
+ uint8_t cnt_ = 0;
+}; // class DialBinParserManager
+
+class DialBinParserRegister {
+public:
+ DialBinParserRegister(const std::string &version, DialBinParserInterface *parser)
+ {
+ if (!DialBinParserManager::GetInstance()->RegisterParser(version, parser)) {
+ GRAPHIC_LOGE("failed to register %s.", version.c_str());
+ }
+ }
+}; // class DialBinParserRegister
+} // namespace OHOS
+
+#define REGIST_PARSER(version, func) \
+ const static OHOS::DialBinParserRegister STATIC_PARSER_VAR_NAME(version, new func)
+#endif // GRAPHIC_LITE_DIAL_BIN_PARSER_MANAGER_H
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2025. All rights reserved.
+ * Description: DialBinParserV3
+ * Author:
+ * Create: 2025-02-06
+ */
+
+#ifndef GRAPHIC_LITE_DIAL_BIN_PARSER_V3_H
+#define GRAPHIC_LITE_DIAL_BIN_PARSER_V3_H
+#include "main/DialBinParserManager.h"
+#include "main/dial/DialModelTime.h"
+#include "components/ui_abstract_progress.h"
+#include "main/dial/DialViewContainer.h"
+#include "main/dial/DialDataType.h"
+#include "main/dial/DialOHSliceId.h"
+
+namespace OHOS {
+class DialBinParserV3 : public DialBinParserInterface {
+public:
+ DialBinParserV3();
+ ~DialBinParserV3() override;
+ bool UpdateDial(const std::string& file, FILE* fp, DialViewGroup* group, DisplayState state) override;
+ bool GetDialPreviewInfo(const std::string& file, FILE* fp, DialPreviewInfo* info) override;
+ void SetEncryptData(uint8_t *data, uint32_t len) override final;
+
+protected:
+ bool ParseDialHeader(FILE* file);
+ bool ParserDialStaticImg(ContainerInterface &parent);
+ bool ParserDialSequenceImg(ContainerInterface &parent);
+ bool ParserDialRotateImg(ContainerInterface &parent);
+ bool ParserDialOptionImg(ContainerInterface &parent);
+ bool ParserDialDigitalImg(ContainerInterface &parent);
+ bool ParserDialLabel(ContainerInterface &parent);
+ bool ParserDialArcLabel(ContainerInterface &parent);
+ bool ParserDialBoxProgress(ContainerInterface &parent);
+ bool ParserDialArcProgress(ContainerInterface &parent);
+ bool ParserDialVideo(ContainerInterface &parent);
+ bool ParserDialClick(ContainerInterface &parent);
+ bool ParserDialKaleidoscope(ContainerInterface &parent);
+ bool ParserDialContainer(ContainerInterface &parent);
+ bool ParserDialOptions(ContainerInterface &parent);
+
+private:
+ void* MallocAndReadBuf(FILE* file, uint32_t readSize);
+ bool SetProgressType(FILE* fp, UIAbstractProgress* view, DialProgressType data);
+
+ static constexpr uint8_t DIAL_BIN_PARSER_FUNC_NUM = 14; // 14: func max value
+ bool (DialBinParserV3::*funcArray_[DIAL_BIN_PARSER_FUNC_NUM])(ContainerInterface&);
+ void AddToParentWithView(ContainerInterface &parent, uint8_t displayMode, UIView *view);
+ void AddToParentWithDialView(ContainerInterface &parent, uint8_t displayMode,
+ DialView *view, DialDataType bindData, bool isPeriodic);
+ struct {
+ uint8_t *viewType;
+ uint8_t dialViewCount;
+ FILE *file;
+ uint8_t curIndex;
+ } curViewType_;
+ bool ParseTimeIntervals(FILE* fp, uint8_t cnt, TimeChangeListener *listener);
+ bool ParseViewType(uint8_t *viewType, uint8_t dialViewCount, FILE *file);
+ bool ParseContainerSubviews(DialViewContainer *container, uint8_t num);
+ bool ParseOptionsSubviews(ContainerInterface &parent);
+ DialHeader *GetHeader(FILE *fp);
+ uint8_t *GetVeiwType(FILE *fp, DialHeader *dialHeader);
+
+ DialViewGroup* dialGroup_ = nullptr;
+ std::string file_;
+ const uint32_t dirId_ = 0xfef << 20; // 20: offset
+ uint32_t imageOffset_ = 0;
+ DisplayState state_ = DisplayState::NORMAL;
+ uint8_t *encryptedData_ = nullptr;
+ uint32_t encrpytedLen_ = 0;
+}; // class DialBinParserV3
+} // namespace OHOS
+
+#endif // GRAPHIC_LITE_DIAL_BIN_PARSER_V3_H
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) 2023 CompanyNameMagicTag.\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+#ifndef GRAPHIC_LITE_DIAL_BIN_TYPE_H\r
+#define GRAPHIC_LITE_DIAL_BIN_TYPE_H\r
+#include "color.h"\r
+#include "graphic_types.h"\r
+#include "components/ui_canvas_ext.h"\r
+\r
+namespace OHOS {\r
+static constexpr uint8_t DIAL_NAME_MAX_LEN = 16;\r
+static constexpr uint8_t DIAL_VERSION_MAX_LEN = 16;\r
+static constexpr uint8_t DIAL_DESCRIPTION_MAX_LEN = 128;\r
+static constexpr uint8_t DIAL_DIGITALIMG_IMG_MAX_NUM = 10;\r
+\r
+struct DialPreviewInfo {\r
+ char dialName[DIAL_NAME_MAX_LEN];\r
+ char description[DIAL_DESCRIPTION_MAX_LEN];\r
+ uint32_t imgId;\r
+ uint32_t offset;\r
+ uint8_t capability;\r
+ uint32_t uuid;\r
+ char protocolVersion[DIAL_VERSION_MAX_LEN];\r
+ char watchVersion[DIAL_VERSION_MAX_LEN];\r
+};\r
+\r
+struct DialRect {\r
+ int16_t x;\r
+ int16_t y;\r
+ int16_t w;\r
+ int16_t h;\r
+};\r
+\r
+struct DialHeader {\r
+ char dialName[DIAL_NAME_MAX_LEN];\r
+ int16_t width;\r
+ int16_t height;\r
+ char version[DIAL_VERSION_MAX_LEN];\r
+ uint16_t previewImgId;\r
+ char description[DIAL_DESCRIPTION_MAX_LEN];\r
+ uint32_t imageOffset;\r
+ uint8_t freq;\r
+ uint8_t dialViewCount;\r
+};\r
+\r
+struct DialStaticImg {\r
+ Point pos;\r
+ Point center;\r
+ float rotate;\r
+ uint16_t imgId;\r
+};\r
+\r
+struct DialSequenceImg {\r
+ Point pos;\r
+ uint16_t interval;\r
+ bool repeat;\r
+ uint8_t imgNum;\r
+};\r
+\r
+struct DialRotateImg {\r
+ Point pos;\r
+ Point center;\r
+ int16_t rotateStart;\r
+ int16_t rotateEnd;\r
+ uint16_t imgId;\r
+ int16_t bindData;\r
+ bool isPeriod;\r
+};\r
+\r
+struct DialOptionImg {\r
+ Point pos;\r
+ int16_t bindData;\r
+ bool isPeriod;\r
+ uint8_t count;\r
+};\r
+\r
+struct DialDigitalImg {\r
+ uint8_t alignType : 4;\r
+ uint8_t integerLength : 4;\r
+ uint8_t decimalPrecision;\r
+ uint16_t imgIds[DIAL_DIGITALIMG_IMG_MAX_NUM];\r
+ int16_t signImgId;\r
+ int16_t decimalPointImgId;\r
+ uint16_t space;\r
+ Point alignPosition;\r
+ int16_t bindData;\r
+ bool isPeriod;\r
+};\r
+\r
+struct DialLabel {\r
+ uint8_t breakMode;\r
+ uint8_t align;\r
+ uint8_t fontSize;\r
+ bool isPeriod;\r
+ DialRect rect;\r
+ uint32_t color;\r
+ char fontName[64];\r
+ char text[64];\r
+ int16_t bindData;\r
+};\r
+\r
+struct DialArcLabel {\r
+ uint8_t align;\r
+ uint8_t fontSize;\r
+ Point center;\r
+ int16_t radius;\r
+ int16_t rotateStart;\r
+ int16_t rotateEnd;\r
+ uint32_t color;\r
+ char fontName[64];\r
+ char text[64];\r
+ int16_t bindData;\r
+ bool isPeriod;\r
+};\r
+\r
+struct DialProgressType {\r
+ uint8_t type; // image | color | gradient_color\r
+ DialRect rect;\r
+ union {\r
+ uint8_t stopCount;\r
+ uint16_t imgId;\r
+ Color32 color;\r
+ };\r
+};\r
+\r
+struct DialBoxProgress {\r
+ uint8_t cap;\r
+ uint8_t direction;\r
+ bool isPeriod;\r
+ int16_t bindData;\r
+ uint32_t bgColor;\r
+ DialProgressType typeData;\r
+};\r
+\r
+struct DialArcProgress {\r
+ uint8_t cap;\r
+ bool isPeriod;\r
+ uint16_t radius;\r
+ uint16_t startAngle;\r
+ uint16_t endAngle;\r
+ uint16_t lineWidth;\r
+ int16_t bindData;\r
+ uint32_t bgColor;\r
+ DialProgressType typeData;\r
+};\r
+\r
+struct DialVideo {\r
+ DialRect rect;\r
+ uint32_t offset;\r
+ Color32 colorKey;\r
+ uint32_t imgId;\r
+};\r
+\r
+struct DialClick {\r
+ uint8_t type;\r
+ DialRect rect;\r
+ union {\r
+ uint32_t sliceId;\r
+ char bundleName[64];\r
+ };\r
+};\r
+\r
+struct DialKaleidoscope {\r
+ uint16_t imgId;\r
+ float crownRotateStep;\r
+ float animatorRotateStep;\r
+};\r
+}\r
+#endif // GRAPHIC_LITE_DIAL_BIN_TYPE_H
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2024-2024. All rights reserved.
+ * Description: DialBinTypesV2
+ * Author:
+ * Create: 2024-10-30
+ */
+
+#ifndef GRAPHIC_LITE_DIAL_BIN_TYPE_V2_H
+#define GRAPHIC_LITE_DIAL_BIN_TYPE_V2_H
+#include "main/DialBinTypes.h"
+
+namespace OHOS {
+enum class DisplayState {
+ NORMAL,
+ AOD,
+};
+static constexpr uint8_t DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY = 0;
+static constexpr uint8_t DIAL_DISPLAY_CAPABILITY_AMBITIENT_ONLY = 1;
+static constexpr uint8_t DIAL_DISPLAY_CAPABILITY_AMBITIENT_NORMAL = 2;
+
+struct DialHeader_V2 {
+ char dialName[DIAL_NAME_MAX_LEN];
+ int16_t width;
+ int16_t height;
+ char version[DIAL_VERSION_MAX_LEN];
+ uint16_t previewImgId;
+ char description[DIAL_DESCRIPTION_MAX_LEN];
+ uint32_t imageOffset;
+ uint8_t freq;
+ uint8_t dialViewCount;
+ uint8_t displayCapabiliy;
+ uint8_t ambientFreq;
+};
+
+struct DialStaticImg_V2 {
+ Point pos;
+ Point center;
+ float rotate;
+ uint16_t imgId;
+ uint8_t displayMode;
+};
+
+struct DialSequenceImg_V2 {
+ Point pos;
+ uint16_t interval;
+ bool repeat;
+ uint8_t imgNum;
+ uint8_t displayMode;
+};
+
+struct DialRotateImg_V2 {
+ Point pos;
+ Point center;
+ int16_t rotateStart;
+ int16_t rotateEnd;
+ uint16_t imgId;
+ int16_t bindData;
+ bool isPeriod;
+ uint8_t displayMode;
+ bool isAmbientPeriodic;
+};
+
+struct DialOptionImg_V2 {
+ Point pos;
+ int16_t bindData;
+ bool isPeriod;
+ uint8_t count;
+ uint8_t displayMode;
+ bool isAmbientPeriodic;
+};
+
+struct DialDigitalImg_V2 {
+ uint8_t alignType : 4;
+ uint8_t integerLength : 4;
+ uint8_t decimalPrecision;
+ uint16_t imgIds[DIAL_DIGITALIMG_IMG_MAX_NUM];
+ int16_t signImgId;
+ int16_t decimalPointImgId;
+ uint16_t space;
+ Point alignPosition;
+ int16_t bindData;
+ bool isPeriod;
+ uint8_t displayMode;
+ bool isAmbientPeriodic;
+};
+
+struct DialLabel_V2 {
+ uint8_t breakMode;
+ uint8_t align;
+ uint8_t fontSize;
+ bool isPeriod;
+ DialRect rect;
+ uint32_t color;
+ char fontName[64];
+ char text[64];
+ int16_t bindData;
+ uint8_t displayMode;
+ bool isAmbientPeriodic;
+};
+
+struct DialArcLabel_V2 {
+ uint8_t align;
+ uint8_t fontSize;
+ Point center;
+ int16_t radius;
+ int16_t rotateStart;
+ int16_t rotateEnd;
+ uint32_t color;
+ char fontName[64];
+ char text[64];
+ int16_t bindData;
+ bool isPeriod;
+ uint8_t displayMode;
+ bool isAmbientPeriodic;
+};
+
+struct DialBoxProgress_V2 {
+ uint8_t cap;
+ uint8_t direction;
+ bool isPeriod;
+ int16_t bindData;
+ uint32_t bgColor;
+ DialProgressType typeData;
+ uint8_t displayMode;
+ bool isAmbientPeriodic;
+};
+
+struct DialArcProgress_V2 {
+ uint8_t cap;
+ bool isPeriod;
+ uint16_t radius;
+ uint16_t startAngle;
+ uint16_t endAngle;
+ uint16_t lineWidth;
+ int16_t bindData;
+ uint32_t bgColor;
+ DialProgressType typeData;
+ uint8_t displayMode;
+ bool isAmbientPeriodic;
+};
+
+struct DialVideo_V2 {
+ DialRect rect;
+ uint32_t offset;
+ Color32 colorKey;
+ uint32_t imgId;
+ uint8_t displayMode;
+};
+
+struct DialClick_V2 {
+ uint8_t type;
+ DialRect rect;
+ union {
+ uint32_t sliceId;
+ char bundleName[64];
+ };
+ uint8_t displayMode;
+};
+
+struct DialKaleidoscope_V2 {
+ uint16_t imgId;
+ float crownRotateStep;
+ float animatorRotateStep;
+ uint8_t displayMode;
+};
+} // namespace OHOS
+#endif // GRAPHIC_LITE_DIAL_BIN_TYPE_V2_H
--- /dev/null
+/*\r
+ * Copyright (c) 2020-2021 CompanyNameMagicTag.\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#ifndef HEALTH_MODEL_H\r
+#define HEALTH_MODEL_H\r
+\r
+#include <cstdio>\r
+#include "gfx_utils/list.h"\r
+#include "main/UiServersMsg.h"\r
+\r
+namespace OHOS {\r
+#define NUM_1 1\r
+#define NUM_2 2\r
+#define NUM_3 3\r
+#define NUM_4 4\r
+#define NUM_5 5\r
+#define NUM_7 7\r
+#define NUM_16 16\r
+#define NUM_99 99\r
+\r
+typedef struct {\r
+ uint32 healthSleep;\r
+ uint32 heat;\r
+} HealthAllData;\r
+\r
+\r
+extern HealthAllData g_healthData;\r
+#define FILE_NAME_LENGTH 50\r
+#define LIST_HEALTH_MAX 20\r
+\r
+class HealthModel {\r
+public:\r
+ HealthModel();\r
+ virtual ~HealthModel();\r
+ static HealthModel *GetInstance(void);\r
+ int SaveGlobalHealthToFile(void);\r
+ int GetHealthGlobalData(DataDistribute type, uint32 *value);\r
+ bool InitHealthData(void);\r
+ bool GetHealthFrontData(HealthMsg *healthMsg);\r
+ void HealthPopFront(void);\r
+ bool FetchedHealthData(HealthMsg *healthMsg);\r
+ void PushHealthData(HealthMsg healthMsg);\r
+// drop down status\r
+ int GetBriScrStatus(void);\r
+ int GetDntDistStatus(void);\r
+ void UpdateBriScrStatus(uint16_t status);\r
+ void UpdateDntDistStatus(uint16_t status);\r
+private:\r
+ bool SetUpListCase(void);\r
+ List<HealthMsg> listHealth;\r
+ uint32 listHealthNum = 0;\r
+ int briScreenStatus{0};\r
+ int dntDisturbStatus{0};\r
+};\r
+}\r
+\r
+#endif // HEALTH_MODEL_H\r
--- /dev/null
+/*\r
+ * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.\r
+ * Description: LoadImg\r
+ * Create: 2025-06-05\r
+ */\r
+#ifndef LOAD_IMG_H\r
+#define LOAD_IMG_H\r
+\r
+#include <string>\r
+#include "wearable_log.h"\r
+#include "components/ui_button.h"\r
+#include "components/ui_image_view.h"\r
+#include "common/image_cache_manager.h"\r
+\r
+namespace OHOS {\r
+namespace LOADIMG {\r
+// 加载图片资源\r
+void LoadBtnImage(UIButton *btn, std::string file, uint32_t resId1, uint32_t resId2);\r
+\r
+void LoadImageViewImg(UIImageView *view, std::string file, uint32_t resId);\r
+}\r
+}\r
+#endif // LOAD_IMG_H
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
+ * Description: MainModel.h\r
+ * Author:\r
+ * Create: 2021-11-23\r
+ */\r
+\r
+#ifndef MAIN_MODEL_H\r
+#define MAIN_MODEL_H\r
+\r
+#include <string>\r
+#include "UiConfig.h"\r
+\r
+namespace OHOS {\r
+ typedef struct {\r
+ CardId id;\r
+ const char *cardImg;\r
+ } CardInfo;\r
+\r
+ typedef struct {\r
+ uint8_t id;\r
+ const char *dialName;\r
+ const char *dialImg;\r
+ uint8_t freq;\r
+ uint8_t capability;\r
+ } DialInfo;\r
+\r
+ typedef struct {\r
+ uint8_t dialFlag; // 0 在线表盘 1 离线表盘\r
+ uint8_t dialId;\r
+ std::string dialFullName;\r
+ } DialSetting;\r
+\r
+ class MainModel {\r
+ public:\r
+ static MainModel &GetInstance(void);\r
+ void InitCardSettings(void);\r
+ uint8_t GetCardSettingCount(void);\r
+ CardId *GetCardSettings(void);\r
+ void DeleteCardSetting(uint8_t index);\r
+ void AddCardSetting(uint8_t index);\r
+ const CardInfo *GetCardInfo(CardId card) const;\r
+ const DialInfo *GetDialInfo(uint8_t dial) const; // 获取在线表盘配置\r
+ uint8_t GetDialInfoNum() const; // 获取在线表盘的数量\r
+ void AddDialSetting(const DialSetting &setting);\r
+ void InitDialSettings(void);\r
+ DialSetting &GetDialSetting();\r
+ bool IsFromSetCardView(void) const;\r
+ void SetFromSetCardView(bool isFrom);\r
+ void SetFromCardId(uint8_t cardId);\r
+ uint8_t GetFromCardId(void);\r
+ bool IsAodEnabled();\r
+ void EnableAod(bool enable);\r
+\r
+ private:\r
+ void InitDialSettingDefault(void);\r
+ MainModel();\r
+ MainModel(const MainModel &);\r
+ MainModel &operator=(const MainModel &);\r
+ virtual ~MainModel();\r
+\r
+ CardId cardSettings[CARD_SETTING_COUNT_MAX] = { MAX_CARD };\r
+ uint8_t cardSettingCount{0};\r
+ DialSetting dialSetting;\r
+ bool isFromSetCardView{false};\r
+ uint8_t fromCardId{MAX_CARD};\r
+ bool isAodEnabled{false};\r
+ };\r
+}\r
+\r
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: MainPresenterSample
+ * Author:
+ * Create:
+ */
+
+#ifndef MAIN_PRESENTER_SAMPLE_H
+#define MAIN_PRESENTER_SAMPLE_H
+
+#include "Presenter.h"
+#include "main/ModelListenerSample.h"
+#include "components/root_view.h"
+#include "drag_event.h"
+#include "main/MainViewSample.h"
+#include "main/MainModel.h"
+#include "components/ui_swipe_view.h"
+#include "components/ui_view.h"
+#include "compass/MainCompassView.h"
+#include "compass/MainCompassPresenter.h"
+#include "player/PlayersView.h"
+#include "heartrate/HeartRateView.h"
+#include "swipe_effect/zoom_effect.h"
+
+namespace OHOS {
+static constexpr const char *MAIN_CLICK_WEATHER = "mainclickweather";
+static constexpr const char *MAIN_CLICK_ACTIVITY = "mainclickactivity";
+static constexpr const char *MAIN_CLICK_MESSAGE = "mainclickmessage";
+static constexpr const char *MAIN_CLICK_HEARTRATE = "mainclickheartrate";
+
+static constexpr const char *DROPDOWN_CLICK_DONOTDISTURB = "dropdownclickdonotdisturb";
+static constexpr const char *DROPDOWN_CLICK_BRIGHTENSCREEN = "dropdownclickbrightscreen";
+static constexpr const char *DROPDOWN_CLICK_FINDMYPHONE = "dropdownclickfindmyphone";
+static constexpr const char *DROPDOWN_CLICK_ALARM = "dropdownclickalarm";
+static constexpr const char *DROPDOWN_CLICK_SETTING = "dropdownclicksetting";
+constexpr uint16_t VERTICAL_STATUS = 1;
+constexpr uint16_t HORIZONTAL_STATUS = 0;
+enum class MainPresenterState {
+ START,
+ RESUME,
+ PAUSE,
+ STOP,
+};
+
+class MainViewSample;
+class MainPresenterSample : public Presenter<MainViewSample>, public ModelListenerSample,
+ public UIView::OnClickListener, public UISwipeView::OnSwipeListener,
+ public UIView::OnLongPressListener, public UISwipeView {
+public:
+ MainPresenterSample();
+ ~MainPresenterSample() override;
+ static MainPresenterSample *GetInstance(void);
+
+ void OnStart() override;
+ void OnPause() override;
+ void OnResume() override;
+ void OnStop() override;
+ void Notify() override;
+ bool OnClick(UIView& view, const ClickEvent& event) override;
+ bool OnLongPress(UIView& view, const LongPressEvent& event) override;
+ void OnSwipe(UISwipeView& view) override;
+ void SetPage(int8_t id, bool loadAdjacent = true);
+ void SetTaskPeroid(CardId cardId);
+
+ void InitCardSettings(void);
+ uint8_t GetCardSettingCount(void);
+ CardId *GetCardSettings(void);
+ void InitDialSettings(void);
+ DialSetting& GetDialSetting();
+ bool IsFromSetCardView(void) const;
+ void SetFromSetCardView(bool isFrom);
+ uint8_t GetFromCardId(void);
+ MainPresenterState GetMainPresenterState();
+
+private:
+ void ProcessDataNotify(void);
+ void SetCircleProgress(void);
+ uint8_t state_ = UICheckBox::UICheckBoxState::MAX_STATUS_NUM;
+ int64_t playerCurrentTime_{0};
+ int64_t playerMusicDuration_{0};
+ int64_t playerProgressValue_{0};
+ bool isCompassSensorOpened_{false};
+ MainPresenterState mainPresenterState_ = MainPresenterState::STOP;
+};
+}
+
+#endif // MAIN_PRESENTER_H
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: MainViewSample
+ * Author:
+ * Create:
+ */
+
+#ifndef MAIN_VIEW_SAMPLE_H
+#define MAIN_VIEW_SAMPLE_H
+
+#include <string>
+#include "View.h"
+#include "components/root_view.h"
+#include "swipe_effect/zoom_effect.h"
+#include "ChangeSliceListener.h"
+#include "font/ui_font.h"
+#include "graphic_config.h"
+#include "main/ModelListenerSample.h"
+// #include "screensetting/ScreenModels.h"
+#include "activity/ActivityWeekView.h"
+#include "compass/CompassControlView.h"
+#include "main/dial/DialViewGroup.h"
+#include "clock/MainClockView.h"
+#include "player/PlayersView.h"
+#include "main/MainPresenterSample.h"
+#include "heartrate/HeartRateView.h"
+#include "components/ui_card_page.h"
+#include "main/PullUpDownView.h"
+#include "components/ui_cross_view.h"
+#include "set_card/SetCardModel.h"
+#include "videocard/VideoCard.h"
+
+namespace OHOS {
+class MainPresenterSample;
+class MainViewSample : public View<MainPresenterSample> {
+public:
+ MainViewSample();
+ ~MainViewSample() override;
+ static MainViewSample *GetInstance(void);
+ void OnStart() override;
+ void OnStop() override;
+ UICardPage *InitWatchFacePage(void);
+ UICardPage *InitHeartRatePage(void);
+ UICardPage *InitActivityPage(void);
+ UICardPage *InitCompassPage(void);
+ UICardPage *InitMusicPlayerPage(void);
+ UICardPage *InitVideoCardPage1(void);
+ UICardPage *InitVideoCardPage2(void);
+ UICardPage *InitVideoCardPage3(void);
+ void AnimatorStart(int pageIndex);
+ void AnimatorStop(void);
+ CardId GetHorCurrentCard() const;
+ UIView* GetMainViewGroup(void) const
+ {
+ return mainSwipeGroup;
+ }
+
+ UICardPage* GetViewById(int16_t id) const
+ {
+ if (id >= MAX_CARD) {
+ return nullptr;
+ }
+ return recordCard[id];
+ }
+
+ void SwitchToClockPage(bool loadAdjacent = true)
+ {
+ if (mainClockView != nullptr) {
+ SetPage(mainClockView->GetViewIndex(), loadAdjacent);
+ }
+ }
+ void SwitchToCard(uint8_t cardId, bool loadAdjacent = true);
+ bool IsMainClockPage(void);
+ void SetPage(int16_t page, bool loadAdjacent = true);
+ void ReloadWatchFace();
+
+private:
+ PullUpDownView *dropDownView{nullptr};
+ UICardPage *messageView{nullptr};
+ UILabel *messageLable{nullptr};
+ UICardPage *mainClockView{nullptr};
+ ActivityWeekView *activityWeekView{nullptr};
+ PlayersView *playersView{nullptr};
+ CompassControlView *compassControlView{nullptr};
+ HeartRateView *heartRateView{nullptr};
+ UICardPage *recordCard[MAX_CARD]{nullptr};
+ bool pageStatus[MAX_CARD]{false};
+ UICrossView *mainSwipeGroup{nullptr};
+ ZoomEffect* callback{nullptr};
+ VideoCard *videoCard1{nullptr};
+ VideoCard *videoCard2{nullptr};
+ VideoCard *videoCard3{nullptr};
+
+ bool HorizontalViewInit(void);
+ void VerticalViewInit(void);
+ void VertViewLoad(void);
+ void HorViewLoad(void);
+ UICardPage *InitWatchOffDial(DialSetting &setting);
+ UICardPage *InitWatchDial(DialSetting &setting);
+ UICardPage *InitVideoCardPage(const std::string &video, const std::string &preview);
+};
+} // namespace OHOS
+#endif // MAIN_VIEW_SAMPLE_H
--- /dev/null
+/*\r
+ * Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved.\r
+ */\r
+/*\r
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
+ * Description: MessageAdapter.h\r
+ * Author:\r
+ * Create: 2021-11-23\r
+ */\r
+\r
+#ifndef MESSAGE_ADAPTER_H\r
+#define MESSAGE_ADAPTER_H\r
+\r
+#include <list>\r
+#include <string>\r
+#include "components/ui_list.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_image_view.h"\r
+#include "components/abstract_adapter.h"\r
+#include "wearable_log.h"\r
+#include "UiConfig.h"\r
+#include "main/MainModel.h"\r
+#include "main/MessageItemView.h"\r
+\r
+namespace OHOS {\r
+class MessageAdapter : public AbstractAdapter {\r
+public:\r
+ explicit MessageAdapter();\r
+ ~MessageAdapter() override;\r
+\r
+ /* *\r
+ * @brief Sets the UIView adapter data, which is a WeatherItem linked list.\r
+ *\r
+ * @param data Indicates the MessageItem linked list data.\r
+ * @since 1.0\r
+ * @version 1.0\r
+ */\r
+ void SetData(std::list<MessageItem> &data);\r
+\r
+ /* *\r
+ * @brief Obtains the <b>data</b> size of the UILabel adapter.\r
+ *\r
+ * @return Returns the <b>data</b> size of the UILabel adapter.\r
+ * @since 1.0\r
+ * @version 1.0\r
+ */\r
+ uint16_t GetCount(void) override;\r
+\r
+ UIView *GetView(UIView *inView, int16_t index) override;\r
+\r
+ void AddListItem(const MessageItem &item);\r
+\r
+ void ClearListItem();\r
+\r
+ void SetItemClickListener(UIView::OnClickListener *itemclicklistener)\r
+ {\r
+ itemClickListener = itemclicklistener;\r
+ }\r
+private:\r
+ std::list<MessageItem> listData;\r
+ UIView::OnClickListener *itemClickListener{nullptr};\r
+};\r
+}\r
+\r
+#endif
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved.\r
+ */\r
+/*\r
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
+ * Description: weather/WeatherItemView.h\r
+ * Author:\r
+ * Create: 2021-11-23\r
+ */\r
+\r
+#ifndef MESSAGE_ITEM_VIEW_H\r
+#define MESSAGE_ITEM_VIEW_H\r
+\r
+#include "components/ui_label.h"\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_image_view.h"\r
+#include "components/ui_canvas.h"\r
+\r
+#include "UiConfig.h"\r
+#include "main/MessageModel.h"\r
+\r
+namespace OHOS {\r
+class MessageItemView : public UIViewGroup {\r
+public:\r
+ explicit MessageItemView();\r
+ ~MessageItemView() override;\r
+ virtual void SetItemInfo(const MessageItem itemInfo);\r
+ virtual void SetUpChild();\r
+private:\r
+ UILabel sLabel_1;\r
+ UIImageView sIcon;\r
+ UILabel sLabel_2;\r
+ UILabel sLabel_3;\r
+ UIImageView sNextImage;\r
+ UILabel sback;\r
+ MessageItem sItemInfo = { nullptr, nullptr, nullptr, nullptr};\r
+};\r
+}\r
+\r
+#endif\r
--- /dev/null
+/*\r
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
+ * Description: WeekStep\r
+ * Author:\r
+ * Create: 2021-09-11\r
+ */\r
+\r
+#ifndef MESSAGE_MAIN_VIEW_H\r
+#define MESSAGE_MAIN_VIEW_H\r
+\r
+#include "graphic_types.h"\r
+#include "wearable_log.h"\r
+#include "components/ui_card_page.h"\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_image_view.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_label_button.h"\r
+#include "main/MessageModel.h"\r
+#include "main/MessageAdapter.h"\r
+\r
+namespace OHOS {\r
+class MessageMainView : public UICardPage {\r
+public:\r
+ MessageMainView();\r
+ ~MessageMainView() override;\r
+ static MessageMainView *GetInstance(void);\r
+ bool InitView();\r
+ void PreLoad(void) override;\r
+ void VerticalViewInits(void);\r
+ void ConfirmDeletion(void);\r
+ void CancelDeletion(void);\r
+ void ShowMessageList(void);\r
+ void DeletionView(void);\r
+ void NoNotify(void);\r
+ void NewNotify(void);\r
+ void RefreshMessageList(std::vector<MessageItem> item);\r
+ bool InitScrollData();\r
+ MessageAdapter *listAdapter{nullptr};\r
+ UIList *contentList{nullptr}; // 列表\r
+private:\r
+ UILabel *messageLables{nullptr}; // 无消息\r
+ UILabel *messageLable{nullptr}; // 通知\r
+ UILabel *deletereminder{nullptr}; // 是否删除通知?\r
+ UILabelButton *confirm{nullptr}; // 确认\r
+ UILabelButton *cancel{nullptr}; // 取消\r
+ UIImageView *notice{nullptr}; // 删除图标\r
+ UIView::OnClickListener *clickListener{nullptr};\r
+ UIView::OnClickListener *confirmListener{nullptr};\r
+ UIView::OnClickListener *cancelListener{nullptr};\r
+ UIView::OnClickListener *notifyListener{nullptr};\r
+ UIView::OnClickListener *newNotifyListener{nullptr};\r
+};\r
+}\r
+#endif\r
--- /dev/null
+/*\r
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
+ * Description: MainModel.h\r
+ * Author:\r
+ * Create: 2021-11-23\r
+ */\r
+\r
+#ifndef MESSAGE_MODEL_H\r
+#define MESSAGE_MODEL_H\r
+\r
+#include <string>\r
+#include <vector>\r
+#include "UiConfig.h"\r
+\r
+namespace OHOS {\r
+typedef struct {\r
+ std::string label_1;\r
+ std::string icon;\r
+ std::string label_2;\r
+ std::string label_3;\r
+} MessageItem;\r
+\r
+ // static const uint16_t WEATHER_ITEM_COUNT = 10;\r
+ class MessageModel {\r
+ public:\r
+ static MessageModel &GetInstance(void);\r
+ void InitMessageItem();\r
+ const std::vector<MessageItem> GetMessagelistItems() const;\r
+ void ClearListItem();\r
+ void GetMessageInfo(std::string app, std::string contact, std::string information);\r
+ void SetViewStatus(bool viewStatus);\r
+ bool GetViewStatus(void);\r
+ private:\r
+ MessageModel();\r
+ MessageModel(const MessageModel &);\r
+ MessageModel &operator=(const MessageModel &);\r
+ virtual ~MessageModel();\r
+ std::vector<MessageItem> vecMsg;\r
+ MessageItem mes;\r
+ bool viewInitStatus{false};\r
+ };\r
+}\r
+\r
+#endif
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) 2020-2021 CompanyNameMagicTag.\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#ifndef MODEL_LISTENER_SAMPLE_H\r
+#define MODEL_LISTENER_SAMPLE_H\r
+\r
+#include "common/task.h"\r
+\r
+namespace OHOS {\r
+class ModelListenerSample : public Task {\r
+public:\r
+ ModelListenerSample();\r
+ virtual ~ModelListenerSample();\r
+ virtual void Notify(void) = 0;\r
+ virtual void OnTickEvent(void) {};\r
+ void Callback() override;\r
+};\r
+}\r
+#endif\r
--- /dev/null
+/*\r
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
+ * Description: WeekStep\r
+ * Author:\r
+ * Create: 2021-09-11\r
+ */\r
+\r
+#ifndef PULL_UP_DOWN_VIEW_H\r
+#define PULL_UP_DOWN_VIEW_H\r
+\r
+#include "graphic_types.h"\r
+#include "wearable_log.h"\r
+#include "components/ui_card_page.h"\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_image_view.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_label_button.h"\r
+\r
+namespace OHOS {\r
+class PullUpDownView : public UICardPage {\r
+public:\r
+ PullUpDownView();\r
+ ~PullUpDownView() override;\r
+ static PullUpDownView *GetInstance(void);\r
+ bool InitView();\r
+ void PreLoad(void) override;\r
+ void UpdateBlueToothStatus(int status);\r
+private:\r
+ UIImageView *dnotDisturb{nullptr};\r
+ UIImageView *briScreen{nullptr};\r
+ UIImageView *finPhone{nullptr};\r
+ UIImageView *droAlarm{nullptr};\r
+ UIImageView *droSetting{nullptr};\r
+ UILabel *dnotDisturbLable{nullptr};\r
+ UILabel *briScreenLable{nullptr};\r
+ UILabel *finPhoneLable{nullptr};\r
+ UILabel *droAlarmLable{nullptr};\r
+ UILabel *droSettingLable{nullptr};\r
+ UIImageView *bluetooth{nullptr};\r
+ UIImageView *battery{nullptr};\r
+ UILabel *batteryLable{nullptr};\r
+ UILabel *dateLable{nullptr};\r
+ bool viewiInitStatus{false};\r
+\r
+ void InitSubViewImg(void);\r
+ void InitViewImg(void);\r
+ void InitViewLable(void);\r
+ void InitViewInfo(void);\r
+\r
+ UIView::OnClickListener *clickListener{nullptr};\r
+};\r
+}\r
+#endif\r
--- /dev/null
+/*\r
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
+ * Description: Msg of UIservers\r
+ * Author: CompanyName\r
+ * Create: 2021-8-8\r
+ */\r
+\r
+#ifndef UI_SERVERS_MSG_H\r
+#define UI_SERVERS_MSG_H\r
+\r
+#include <cstdint>\r
+#include "ohos_types.h"\r
+#include "message.h"\r
+\r
+#ifdef __cplusplus\r
+#if __cplusplus\r
+extern "C" {\r
+#endif\r
+#endif\r
+\r
+typedef enum {\r
+ HEART_RATE_PER_SEC,\r
+ HEART_RATE_AVE,\r
+ HEART_RATE_REST,\r
+ HEART_RATE_MAX,\r
+ HEART_RATE_MIN,\r
+ HEALTH_SLEEP,\r
+ BATTERY_LIFE,\r
+} DataDistribute;\r
+\r
+typedef struct {\r
+ uint16_t type;\r
+ uint32 value;\r
+} HealthMsg;\r
+\r
+int PushOHOSMsgToHealthModel(Request *request);\r
+\r
+#ifdef __cplusplus\r
+#if __cplusplus\r
+}\r
+#endif\r
+#endif\r
+\r
+#endif\r
--- /dev/null
+/*\r
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
+ * Description: UIVIEWID\r
+ * Author:\r
+ * Create: 2021-10-15\r
+ */\r
+\r
+#ifndef UI_VIEWID_H\r
+#define UI_VIEWID_H\r
+\r
+#include <cstdint>\r
+#include "ohos_types.h"\r
+\r
+namespace OHOS {\r
+ #define BLUETOOTH_NEWEQUIPMENT_BUTTON "newEquipmentButton" // 新设备\r
+ #define BLUETOOTH_UNPAIR_BUTTON "unpairButton" // 取消配对\r
+ #define BLUETOOTH_OPTIONONE_BUTTON "optionsOneButton" // 重新连接\r
+ #define BLUETOOTH_SETTING_BUTTON "settingButton"\r
+ #define BLUETOOTH_DELETE_BUTTON "deleteButton"\r
+ #define BLUETOOTH_SUCC_BACK_BUTTON "succBackButton" // 连接成功确认\r
+ #define BLUETOOTH_FAIL_BACK_BUTTON "failBackButton" // 重试按钮\r
+ #define BLUETOOTH_CONN_FAIL_BACK_BUTTON "connfailBackButton" // 连接失败确认\r
+}\r
+\r
+#endif // UI_VIEWID_H
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: VolumeSettingView view
+ * Create: 2021-09-5
+ */
+
+#ifndef VOLUME_SETTING_PRESENTER_H
+#define VOLUME_SETTING_PRESENTER_H
+
+#include "components/ui_image_view.h"
+#include "components/ui_label_button.h"
+#include "components/ui_view_group.h"
+#include "components/ui_slider.h"
+#include "main/VolumeSettingView.h"
+#include "player/PlayersView.h"
+
+namespace OHOS {
+#define INCREASE_BUTTON "increaseButton"
+#define DECREASE_BUTTON "decreaseButton"
+#define VOLUME_PROGRESS "progress"
+#define VOLUME_VIEW "volumeview"
+
+typedef enum : uint16_t {
+ VOLUMEPHONE = 1,
+ VOLUMEPLAYERS = 3,
+ VOLUMEPHONENOTIFY = 4,
+} VolumeFactor;
+
+typedef enum : uint8_t {
+ VOLUMEDOWN = 0,
+ VOLUMEUP = 1,
+ VOLUMEDRAG = 2,
+} VolumeChangeStatus;
+
+class VolumeSettingView;
+class VolumeSliderEventListener : public UISlider::UISliderEventListener,
+ public UIView::OnClickListener,
+ public UIView::OnDragListener {
+public:
+ VolumeSliderEventListener(VolumeSettingView *volumeSetting);
+ ~VolumeSliderEventListener();
+ static VolumeSliderEventListener *GetInstance();
+ void OnChange(int32_t progress) override;
+ void OnRelease(int32_t progress) override;
+ void ChangeVolume(VolumeChangeStatus status);
+ bool OnClick(UIView& view, const ClickEvent& event) override;
+ bool OnDrag(UIView& view, const DragEvent& event) override;
+ void SetPlayerCoefficients(int16_t value);
+ void BtAndLocalVolumeSet(int16_t sounding);
+private:
+ int16_t preSound{0};
+ int16_t playerCoefficients{0};
+ VolumeSettingView *volumeSettingView{nullptr};
+};
+} // namespace OHOS
+#endif
--- /dev/null
+/*\r
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
+ * Description: VolemeSettingView view\r
+ * Create: 2021-09-5\r
+ */\r
+\r
+#ifndef VOLUME_SETTING_VIEW_H\r
+#define VOLUME_SETTING_VIEW_H\r
+\r
+#include "components/ui_image_view.h"\r
+#include "components/ui_button.h"\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_slider.h"\r
+#include "player/PlayersView.h"\r
+#include "wearable_log.h"\r
+#include "main/VolumeSettingPresenter.h"\r
+\r
+namespace OHOS {\r
+#define VOLUME_MIN 0\r
+#define VOLUME_MAX 100\r
+\r
+class VolumeSettingView : public UIViewGroup {\r
+public:\r
+ VolumeSettingView();\r
+ ~VolumeSettingView();\r
+ int16_t sounding{0};\r
+\r
+ UISlider *GetProgress(void);\r
+ bool SetUpVolume(void);\r
+ UIButton *GetIncreaseButton(void);\r
+ UIButton *GetDecreaseButton(void);\r
+ VolumeSliderEventListener *GetVolumeEventListener(void);\r
+private:\r
+ VolumeSliderEventListener *listener{nullptr};\r
+ UISlider *progress{nullptr};\r
+ UIButton *increaseButton{nullptr};\r
+ UIButton *decreaseButton{nullptr};\r
+ int ShowVolume();\r
+};\r
+} // namespace OHOS\r
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) @CompanyNameMagicTag. 2023. All rights reserved.
+ */
+
+#ifndef DIAL_ARC_LABEL_VIEW_H
+#define DIAL_ARC_LABEL_VIEW_H
+
+#include <cstdint>
+#include "main/dial/DialView.h"
+#include "components/ui_arc_label.h"
+#include "font/font_global_manager.h"
+
+namespace OHOS {
+class DialArcLabelView : public UIArcLabel, public DialView, public FontGlobalManager::LangChangeListener {
+public:
+ DialArcLabelView();
+ ~DialArcLabelView() override;
+
+ bool SetText(const char* text);
+ bool SetTextWithWildcard(const char* text);
+ void HandleTextData(const std::string* data, uint16_t num) override;
+ void HandleFloatData(const float* data, uint16_t num) override;
+ void HandleFloatData(float data) override;
+ void SetLang(uint8_t lang);
+ void OnLangChange(uint8_t langId) override;
+
+private:
+ void SetTextWithWildcardInner(const char* text);
+ static const uint8_t MAX_BUF_SIZE = 255;
+ char* text_ = nullptr;
+ char dstBuf_[MAX_BUF_SIZE] = {0};
+ uint8_t language_ = FontGlobalManager::INVALID_LANG_ID;
+};
+}
+#endif
--- /dev/null
+/*
+ * Copyright (c) @CompanyNameMagicTag. 2023. All rights reserved.
+ */
+
+#ifndef DIAL_ARC_PROGRESS_VIEW_H
+#define DIAL_ARC_PROGRESS_VIEW_H
+
+#include "main/dial/DialView.h"
+#include "components/ui_circle_progress.h"
+
+namespace OHOS {
+class DialArcProgressView : public UICircleProgress, public DialView {
+public:
+ DialArcProgressView();
+ ~DialArcProgressView() override;
+ void HandleFloatData(float data) override;
+ void OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) override;
+private:
+ int32_t value_ = -1;
+};
+}
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialBaseModel
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_BASE_MODEL_H
+#define DIAL_BASE_MODEL_H
+
+#include <cstdint>
+#include "heap_base.h"
+#include "main/dial/OnDialDataUpdateListener.h"
+
+namespace OHOS {
+class DialBaseModel : public HeapBase {
+public:
+ DialBaseModel() {}
+ virtual ~DialBaseModel() {}
+
+ /* *
+ * @brief Regist on dial data change listener
+ */
+ void RegisterDialDataListener(OnDialDataUpdateListener* listener)
+ {
+ onChangeListener_ = listener;
+ }
+
+ /* *
+ * @brief Unregist on dial data change listener
+ */
+ void UnRegisterDialDataListener()
+ {
+ onChangeListener_ = nullptr;
+ }
+
+ /* *
+ * @brief Get dial data of text type
+ */
+ virtual bool GetDialTextData(DialDataType& type, std::string*& out, int16_t& strNum)
+ {
+ return false;
+ }
+
+ /* *
+ * @brief Get dial data of single float type
+ */
+ virtual bool GetDialFloatData(DialDataType& type, float& out)
+ {
+ return false;
+ }
+
+ /* *
+ * @brief Get dial data of multi float type
+ */
+ virtual bool GetDialFloatData(DialDataType& type, float*& out, int16_t len)
+ {
+ return false;
+ }
+
+protected:
+ OnDialDataUpdateListener* onChangeListener_ = nullptr;
+};
+}
+#endif
--- /dev/null
+#ifndef DIAL_BOX_PROGRESS_MODEL_H
+#define DIAL_BOX_PROGRESS_MODEL_H
+
+#include <cstdint>
+#include "View.h"
+
+enum DialBoxDataType {
+ // 剩余电量百分比
+ BATTERY_LEVEL = 1,
+ // 步数目标
+ STEP_TARGET = 2,
+ // 卡路里
+ CALORIE_TARGET = 3,
+};
+
+namespace OHOS {
+class DialBoxProgressModel {
+public:
+ DialBoxProgressModel();
+ ~DialBoxProgressModel();
+ static DialBoxProgressModel *GetInstance() {
+ static DialBoxProgressModel instance;
+ return &instance;
+ }
+
+ void UpdateBatteryColor( float value_);
+ void SetViewColor(int64_t color);
+ int64_t GetViewColor();
+
+
+ uint32_t DialBoxDataTypeToBitPattern(DialBoxDataType type);
+ uint32_t ConvertToRequiredFormat(DialBoxDataType type, float data);
+ DialBoxDataType ExtractDataType(uint32_t rawData);
+ uint32_t ExtractValue(uint32_t rawData);
+
+private:
+ int32_t value_ = -1;
+ int64_t color_ = Color::White().full;
+ DialBoxDataType datatype_ = BATTERY_LEVEL;
+};
+} // namespace OHOS
+#endif
--- /dev/null
+/*
+ * Copyright (c) @CompanyNameMagicTag. 2023. All rights reserved.
+ */
+
+#ifndef DIAL_BOX_PROGRESS_VIEW_H
+#define DIAL_BOX_PROGRESS_VIEW_H
+
+#include "main/dial/DialView.h"
+#include "components/ui_box_progress.h"
+
+namespace OHOS {
+class DialBoxProgressView : public UIBoxProgress, public DialView {
+public:
+ DialBoxProgressView();
+ ~DialBoxProgressView() override;
+ void HandleFloatData(float data) override;
+ void OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) override;
+private:
+ int32_t value_ = -1;
+};
+}
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialBaseModel
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_DATA_BASE_H
+#define DIAL_DATA_BASE_H
+#include "main/dial/DialDataType.h"
+
+enum class DialOldDataType {
+ DATA_TYPE_FLOAT_BASE = 0,
+ DATA_TYPE_STEPS, // Ô˶¯²½Êý
+ DATA_TYPE_HEART_RATE, // ÐÄÂÊ
+ DATA_TYPE_CALORIE, // Ô˶¯¿¨Â·Àï
+ DATA_TYPE_TEMPERATURE, // ζÈ
+ DATA_TYPE_PM25, // PM2.5 (ĿǰûÓÐÓ³Éä ÐèÒªÔö¼Ó)
+ DATA_TYPE_PRESSURE, // ѹÁ¦
+ DATA_TYPE_AILTITUDE, // º£°Î
+ DATA_TYPE_POWER, // µçÁ¿
+ DATA_TYPE_CLOCK_ANGLE_H, // ʱÕë½Ç¶È
+ DATA_TYPE_CLOCK_ANGLE_M, // ·ÖÕë½Ç¶È
+ DATA_TYPE_CLOCK_ANGLE_S, // ÃëÕë½Ç¶È
+ DATA_TYPE_CLOCK_ANGLE_MS, // ºÁÃëÕë½Ç¶È
+ DATA_TYPE_TIME_SECOND, // Ãë
+ DATA_TYPE_TIME_MINUTE, // ·ÖÖÓ
+ DATA_TYPE_TIME_HOUR, // Сʱ
+ DATA_TYPE_TIME_DATE, // ÈÕÆÚ
+ DATA_TYPE_TIME_WEEK, // ÐÇÆÚ
+ DATA_TYPE_TIME_MONTH, // Ô·Ý
+ DATA_TYPE_TIME_YEAR, // Äê·Ý
+ /* ------------------------------- ÔÚÏÂÃæÔö¼ÓÐÂÊý¾ÝÀàÐÍ
+ ------------------------------- */
+ DATA_TYPE_CHARGE, // ³äµç״̬
+ DATA_TYPE_DIALPATH, // ±íÅÌ·¾¶ (ĿǰûÓÐÓ³Éä ÐèÒªÔö¼Ó£¬µ«ÊǸÃÏî ûÓÐʹÓã¿)
+ DATA_TYPE_SPO2, // ѪÑõ
+ DATA_TYPE_DISTANCE, // Ô˶¯¾àÀë
+ DATA_TYPE_WEATHER, // ÌìÆø
+ DATA_TYPE_POWER_STANDBY, // ±¸ÓõçÁ¿Êý¾ÝÀàÐÍ
+ DATA_TYPE_HOUR_TENS, // Сʱ(ʮλ)
+ DATA_TYPE_HOUR_UNITS, // Сʱ(µ¥Î»)
+ DATA_TYPE_MINUTE_TENS, // ·ÖÖÓ(ʮλ)
+ DATA_TYPE_MINUTE_UNITS, // ·ÖÖÓ(µ¥Î»)
+ DATA_TYPE_WEEK_NUM, // ÐÇÆÚ(Êý×Ö)
+ DATA_TYPE_STEPS_GOAL, // Ô˶¯²½ÊýÄ¿±ê
+ DATA_TYPE_SECOND_MAPPER, // ÃëÓ³Éä
+ DATA_TYPE_POWER_MAPPER, // µçÁ¿Ó³Éä
+ DATA_TYPE_CALORIE_GOAL, // Ô˶¯¿¨Â·ÀïÄ¿±ê
+ DATA_TYPE_STEPS_GOAL_INT, // Ô˶¯²½Êý°Ù·Ö±È
+ DATA_TYPE_CALORIE_GOAL_INT, // Ô˶¯¿¨Â·ÀïÄ¿±ê°Ù·Ö±È
+
+
+ DATA_TYPE_MULTI_FLOAT_BASE = 0x2fff, // ¶à¸ö¸¡µãÊý¾ÝÀàÐÍ»ùÖµ
+
+
+ DATA_TYPE_TEXT_BASE = 0x4fff, // Îı¾Êý¾ÝÀàÐÍ»ùÖµ
+ DATA_TYPE_WEEK_STR, // ÐÇÆÚ(string)
+ DATA_TYPE_DATE_STR, // ÈÕÆÚ(string)
+ DATA_TYPE_WEATHER_STR, // ÌìÆø£¨string)
+ DATA_TYPE_TIMESTR_STR, // ʱ¼ä£¨string)
+ DATA_TYPE_DATE_WEEK_STR, // ÈÕÆÚ(ÄêÔÂÈÕ)ÐÇÆÚ£¨string)
+ DATA_TYPE_POWER_STR, // µçÁ¿£¨string)
+ DATA_TYPE_DATE_WEEK_MD_STR, // ÐÇÆÚ£¨ÔÂÈÕ£©ºÍÈÕÆÚ£¨string)
+ DATA_TYPE_DATE_EN_STR, // Ô·Ý+ÈÕÆÚ £¨Ó¢ÎÄ£©
+ DATA_TYPE_WEEK_EN_STR, // ÐÇÆÚ£¨Ó¢ÎÄ£©
+ DATA_TYPE_STEPS_GOAL_STR, // Ô˶¯²½ÊýÄ¿±ê(string)
+ DATA_TYPE_CALORIE_GOAL_STR, // ¿¨Â·ÀïÄ¿±ê(string)
+
+
+
+ DATA_TYPE_MAX = 0x6000, // Êý¾ÝÀàÐ͵Ä×î´óÖµ
+};
+
+OHOS::DialDataType Convert2DataType(DialOldDataType dialData);
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2025. All rights reserved.
+ * Description: DialDataType
+ * Author:
+ * Create: 2025-02-15
+ */
+
+#ifndef DIAL_DATA_TYPE_H
+#define DIAL_DATA_TYPE_H
+
+#include <unordered_map>
+
+namespace OHOS {
+enum class DialDataType : int16_t {
+ // 起始:单个浮点数据,OH标准协议部分,禁止改动,从0开始(包括0,二进制格式为:0000,xxxx,xxxx,xxxx)
+ DATA_TYPE_FLOAT_BASE = 0,
+ CLOCK = 1, //时钟
+ CLOCK_HIGH = 2, //时钟高位
+ CLOCK_LOW = 3, //时钟低位
+ CLOCK_RATIO_12H = 4,//12小时制
+ CLOCK_RATIO_24H = 5,//24小时制
+ MINUTE_TIME = 6,//分钟
+ MINUTE_HIGH = 7,//分钟高位
+ MINUTE_LOW = 8,//分钟低位
+ MINUTE_RATIO = 9,//分钟比例
+ SECOND_TIME = 10,//秒
+ SECOND_HIGH = 11,//秒高位
+ SECOND_LOW = 12,//秒低位
+ SECOND_RATIO = 13,//秒比例
+ AM_PM = 14,//AM/PM
+ HOUR_FORMAT = 16,//小时格式
+ PREV_HOUR = 17,//上一个小时
+ NEXT_HOUR = 18,//下一个小时
+ CLOCK_ANGLE = 19,//时钟角度
+ MINUTE_ANGLE = 20,//分钟角度
+ SECOND_ANGLE = 21,//秒角度
+ MILLISECOND_ANGLE = 22,//毫秒角度
+ PREV_SECOND = 25,//上一秒
+ NEXT_SECOND = 26,//下一秒
+ PREV_2_SECONDS = 27,//上2秒
+ PREV_MINUTE = 28,//上一分钟
+ NEXT_MINUTE = 29,//下一分钟
+ DUAL_TIMEZONE_CLOCK = 30,//双时区时钟
+ DUAL_TIMEZONE_CLOCK_HIGH = 31,//双时区时钟高位
+ DUAL_TIMEZONE_CLOCK_LOW = 32,//双时区时钟低位
+ DUAL_TIMEZONE_CLOCK_RATIO_12H = 33,//双时区12小时制
+ DUAL_TIMEZONE_CLOCK_RATIO_24H = 34,//双时区24小时制
+ DUAL_TIMEZONE_MINUTE = 35,//双时区分钟
+ DUAL_TIMEZONE_MINUTE_HIGH = 36,//双时区分钟高位
+ DUAL_TIMEZONE_MINUTE_LOW = 37,//双时区分钟低位
+ DUAL_TIMEZONE_MINUTE_RATIO = 38,//双时区分钟比例
+ DUAL_TIMEZONE_AMPM = 41,//双时区AM/PM
+ SUNRISE_SUNSET_IMAGE = 50,//日出日落图片
+ SUNRISE_SUNSET_CLOCK_HIGH = 51,//日出日落时钟高位
+ SUNRISE_SUNSET_CLOCK_LOW = 52,//日出日落时钟低位
+ SUNRISE_SUNSET_MINUTE_HIGH = 53,//日出日落分钟高位
+ SUNRISE_SUNSET_MINUTE_LOW = 54,//日出日落分钟低位
+ DATE = 70,//日期
+ DATE_HIGH = 71,//日期高位
+ DATE_LOW = 72,//日期低位
+ DATE_31_DAY_RATIO = 73,//日期31天比例
+ YESTERDAY = 74,//昨天
+ YESTERDAY_DATE_HIGH = 75,//昨天日期高位
+ YESTERDAY_DATE_LOW = 76,//昨天日期低位
+ TOMORROW = 77,//明天
+ TOMORROW_DATE_HIGH = 78,//明天日期高位
+ TOMORROW_DATE_LOW = 79,//明天日期低位
+ MONTH_DATA = 80,//月份数据
+ MONTH = 81,//月份
+ WEEKDAY_DATA = 83,
+ WEEKDAY_RATIO = 84,
+ CHINESE_HOUR = 86,
+ MOON_PHASE = 87,
+ PREV_MONTH = 88,
+ NEXT_MONTH = 89,
+ SOLAR_YEAR = 240,
+ YEAR_ONES = 241,
+ YEAR_TENS = 242,
+ YEAR_HUNDREDS = 243,
+ YEAR_THOUSANDS = 244,
+ LUNAR_MONTH = 90,
+ LUNAR_DATE_HIGH = 91,
+ LUNAR_DATE_LOW = 92,
+ BATTERY = 100,
+ BATTERY_ENUM = 102,
+ BATTERY_STATUS_ENUM = 103,
+ BATTERY_LEVEL = 104,
+ CHARGING_STATUS = 105,
+ STEP_COUNT = 110,
+ STEP_ONES = 111,
+ STEP_TENS = 112,
+ STEP_HUNDREDS = 113,
+ STEP_THOUSANDS = 114,
+ STEP_TENS_OF_THOUSANDS = 115,
+ STEP_GOAL_PROGRESS = 116,
+ STEP_GOAL_PROGRESS_ENUM = 117,
+ CALORIE = 120,
+ CALORIE_RATIO = 121,
+ CALORIE_GOAL_PROGRESS_ENUM = 122,
+ HEART_RATE = 130,
+ MAX_HEART_RATE = 131,
+ MIN_HEART_RATE = 132,
+ HEART_RATE_ZONE = 133,
+ HEART_RATE_RATIO = 134,
+ STRESS_LEVEL = 140,
+ STRESS_RATIO = 141,
+ STRESS_LEVEL_TYPE = 142,
+ MODERATE_HIGH_INTENSITY_TIME = 150,
+ MODERATE_HIGH_INTENSITY_TIME_RATIO = 151,
+ STAND_COUNT = 152,
+ STAND_COUNT_RATIO = 153,
+ MAX_VO2 = 160,
+ MAX_VO2_RATIO = 161,
+ SLEEP_RATIO = 166,
+ SLEEP_GOAL_PROGRESS_ENUM = 167,
+ TEMPERATURE = 170,
+ MAX_TEMPERATURE = 171,
+ MIN_TEMPERATURE = 172,
+ CURRENT_TEMPERATURE_MINUS_1 = 173,
+ CURRENT_TEMPERATURE_PLUS_1 = 174,
+ TEMPERATURE_TYPE = 175,
+ WEATHER_TYPE = 176,
+ TEMPERATURE_RATIO = 177,
+ PRESSURE = 180,
+ PRESSURE_RATIO = 181,
+ AQI = 182,
+ AQI_LEVEL = 183,
+ AQI_RATIO = 184,
+ ALTITUDE_DATA = 191,
+ ALTITUDE_UNIT = 192,
+ ALTITUDE_RATIO = 193,
+ DISTANCE_DATA = 195,
+ DISTANCE_UNIT = 196,
+ DISTANCE_GOAL_PROGRESS = 197,
+ BLE_CONNECTION_STATUS = 210,
+ BT_CONNECTION_STATUS = 211,
+ BLOOD_OXYGEN = 220,
+ SYSTOLIC_BLOOD_PRESSURE = 221,
+ DIASTOLIC_BLOOD_PRESSURE = 222,
+ DUAL_LANGUAGE_SYSTEM = 230,
+ UNREAD_SMS_MSG = 250,
+ UNREAD_WECHAT_MSG = 251,
+ // 结束:单个浮点数据,OH标准协议部分,禁止改动,到4095结束(包括4095)
+
+
+ // 起始:单个浮点数据,私有可定制部分,从4096开始(包括4096,二进制格式为:0001,xxxx,xxxx,xxxx)
+ DATA_TYPE_FLOAT_CUSTOM_BASE = 4096,
+ PM25 = 4097, // PM2.5
+ POWER_STANDBY, // 备用电量
+ WEEK_NUM, // 星期(数字)
+ STEPS_GOAL_BOXPROGRESS,//步数目标进度条映射?
+ CALORIE_GOAL_BOXPROGRESS,//卡路里目标进度条映射?
+
+ SWIVEL_GEAR_POSITIVE = 8190, // private data, clockwise
+ SWIVEL_GEAR_NEGATIVE = 8191, // counterclockwise
+ // 结束:单个浮点数据,私有可定制部分,到8191结束(包括8191)
+
+ // 起始:文本数据,OH标准协议部分,禁止改动,从8192开始(包括8192,二进制格式为:0010,xxxx,xxxx,xxxx)
+ DATA_TYPE_TEXT_BASE = 8192,
+ AM_PM_TEXT = 8193,
+ SUNRISE_TEXT = 8210,
+ SUNSET_TEXT = 8211,
+ MOONRISE_TEXT = 8221,
+ MOONSET_TEXT = 8222,
+ DUAL_TIMEZONE_ABBR_TEXT = 8200,
+ DUAL_TIMEZONE_TIME_TEXT = 8201,
+ DUAL_TIMEZONE_AM_PM_TEXT = 8202,
+ MONTH_TEXT = 8230,
+ DATE_TEXT = 8231,
+ WEEKDAY_TEXT = 8232,
+ LUNAR_YEAR = 8240,
+ SLEEP_TEXT = 8250,
+ DISTANCE_TEXT = 8260,
+ TIDE_RISE_TIME_TEXT = 8270,
+ TIDE_FALL_TIME_TEXT = 8271,
+ // 结束:文本数据,OH标准协议部分,禁止改动,到12287结束(包括12287)
+
+ // 文本数据,私有可定制部分,从12288开始(包括12288,二进制格式为:0011,xxxx,xxxx,xxxx)
+ DATA_TYPE_TEXT_CUSTOM_BASE = 12288,
+ WEEK_STR = 12289, // 星期(string)
+ DATE_STR = 12290, // 日期(string)
+ WEATHER_STR = 12291, // 天气(string)
+ TIMESTR_STR = 12292, // 时间(string)
+ DATE_WEEK_STR = 12293, // 日期(年月日)星期(string)
+ POWER_STR = 12294, // 电量(string)
+ DATE_WEEK_MD_STR = 12295, // 星期(月日)和日期(string)
+ DATE_EN_STR = 12296, // 月份+日期 (英文)
+ WEEK_EN_STR = 12297, // 星期(英文)
+ STEPS_GOAL_STR = 12298, // 运动步数目标(string)
+ CALORIE_GOAL_STR = 12299, // 卡路里目标(string)
+ // 文本数据,私有可定制部分,到16383结束(包括16383)
+
+ // 起始:多个浮点数据,OH标准协议部分,禁止改动,从16384开始(包括16384,二进制格式为:0100,xxxx,xxxx,xxxx)
+ DATA_TYPE_MULTI_FLOAT_BASE = 16384,
+ // 结束:多个浮点数据,OH标准协议部分,禁止改动,到20479结束(包括20479)
+
+ // 起始:多个浮点数据,私有可定制部分,从20480开始(包括20480,二进制格式为:0101,xxxx,xxxx,xxxx)
+ // 结束:多个浮点数据,私有可定制部分,到24575结束(包括24575)
+
+ DATA_TYPE_MAX = 0x6000,
+}; // enum class DialDataType
+} // namespace OHOS
+
+#endif // DIAL_DATA_TYPE_H
--- /dev/null
+/*
+ * Copyright (c) @CompanyNameMagicTag. 2023. All rights reserved.
+ */
+
+#ifndef DIAL_DIGITAL_IMG_VIEW_H
+#define DIAL_DIGITAL_IMG_VIEW_H
+
+#include <cstdint>
+#include "main/dial/DialView.h"
+#include "main/dial/DialModelTime.h"
+#include "components/ui_image_view.h"
+#include "gfx_utils/graphic_math.h"
+#include "components/ui_view_group.h"
+
+namespace OHOS {
+
+enum class ImgAlign {
+ LEFT,
+ CENTER,
+ RIGHT,
+};
+
+class DialDigitalImgView : public UIImageView, public DialView, public TimeChangeListener {
+public:
+ DialDigitalImgView();
+ ~DialDigitalImgView() override;
+
+ void HandleFloatData(float data) override;
+
+ bool SetNumRes(const ImageInfo** src, uint16_t num);
+ void SetSignRes(const ImageInfo* src);
+ void SetDecimalPointRes(const ImageInfo* src);
+ void SetIntegerLength(uint8_t length);
+ void SetSpace(uint16_t space);
+ void SetAlign(ImgAlign align);
+ void SetAlignPos(Point pos);
+ void SetDecimalPrecision(uint8_t precision);
+ void SetParent(UIViewGroup* parent);
+ void OnTimeUpdate(const struct tm &curTime) override;
+
+private:
+ void SetNumImg(UIImageView* img, const ImageInfo *info);
+ void FillIntegerPart(uint16_t intVal);
+ void FillDecimalPart(float data);
+ void HandlePosition();
+ bool CreateImageViews(float data);
+
+ static const uint8_t NUM_IMG_MAX_SIZE = 10;
+ ImageInfo* numInfo_[NUM_IMG_MAX_SIZE];
+ uint16_t numCnt_ = 0;
+ ImageInfo* signInfo_ = nullptr;
+ ImageInfo* decimalPointInfo_ = nullptr;
+ uint16_t space_ = 0;
+ ImgAlign align_ = ImgAlign::LEFT;
+ Point alignPos_ = {0, 0};
+ uint8_t integerLength_ = 0;
+ uint8_t allocIntegerLen_ = 0;
+ uint8_t decimalPrecision_ = 0;
+ uint8_t currentIndex_ = 0;
+
+ UIViewGroup* parent_ = nullptr;
+ UIImageView** imgs_ = nullptr;
+ uint8_t imgCnt_ = 0;
+ bool isValueSet_ = false;
+ float value_ = 0.0f;
+};
+}
+#endif
--- /dev/null
+/*\r
+ * Copyright (c) @CompanyNameMagicTag. 2024. All rights reserved.\r
+ */\r
+\r
+#ifndef DIAL_KALEIDOSCOPE_VIEW_H\r
+#define DIAL_KALEIDOSCOPE_VIEW_H\r
+#include "components/ui_kaleidoscope_view.h"\r
+namespace OHOS {\r
+using DialKaleidoscopeView = UIKaleidoscopeView;\r
+}\r
+#endif\r
--- /dev/null
+/*
+ * Copyright (c) @CompanyNameMagicTag. 2023. All rights reserved.
+ */
+
+#ifndef DIAL_LABEL_VIEW_H
+#define DIAL_LABEL_VIEW_H
+
+#include <cstdint>
+#include "main/dial/DialView.h"
+#include "components/ui_label.h"
+#include "font/font_global_manager.h"
+
+namespace OHOS {
+class DialLabelView : public UILabel, public DialView, public FontGlobalManager::LangChangeListener {
+public:
+ DialLabelView();
+ ~DialLabelView() override;
+
+ bool SetText(const char* text);
+ bool SetTextWithWildcard(const char* text);
+ void HandleTextData(const std::string* data, uint16_t num) override;
+ void HandleFloatData(const float* data, uint16_t num) override;
+ void HandleFloatData(float data) override;
+ void SetLang(uint8_t lang);
+ void OnLangChange(uint8_t langId) override;
+
+private:
+ void SetTextWithWildcardInner(const char* text);
+ static const uint8_t MAX_BUF_SIZE = 255;
+ char* text_ = nullptr;
+ char dstBuf_[MAX_BUF_SIZE] = {0};
+ uint8_t language_ = FontGlobalManager::INVALID_LANG_ID;
+};
+}
+#endif
--- /dev/null
+/***
+ * @Date: 2024-04-15 10:55:58
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-07-31 18:20:02
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelCalorie.h
+ */
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelCalorie
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_MODEL_Calorie_H
+#define DIAL_MODEL_Calorie_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS
+{
+ class DialModelCalorie : public DialBaseModel
+ {
+ public:
+ DialModelCalorie() {}
+ virtual ~DialModelCalorie() {}
+ static DialModelCalorie *GetInstance()
+ {
+ static DialModelCalorie instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdateCalorie(int16_t Calorie);
+ int GetCalorieData(void);
+
+ private:
+ float calorie_ = 0; // 67.0: default Calorie value as reference
+ };
+}
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelCharge
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_MODEL_Charge_H
+#define DIAL_MODEL_Charge_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS
+{
+ class DialModelCharge : public DialBaseModel
+ {
+ public:
+ DialModelCharge() {}
+ virtual ~DialModelCharge() {}
+ static DialModelCharge *GetInstance()
+ {
+ static DialModelCharge instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdatechargeStatus(int16_t chargeStatus);
+
+ private:
+ int16_t chargeStatus_ = 0; // 默认没有充电 测试为充电
+ };
+}
+#endif
\ No newline at end of file
--- /dev/null
+#ifndef DIAL_MODEL_CHARGEC_H
+#define DIAL_MODEL_CHARGEC_H
+
+#ifdef __cplusplus
+#if __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+#endif /* __cplusplus */
+
+void setChargeStatus(int status);
+
+#ifdef __cplusplus
+#if __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __cplusplus */
+
+#endif
\ No newline at end of file
--- /dev/null
+
+
+#ifndef DIAL_MODEL_DateEnStr_H
+#define DIAL_MODEL_DateEnStr_H
+
+#include "DialBaseModel.h"
+#include <cstdint>
+#include <string>
+#include <vector>
+
+namespace OHOS {
+class DialModelDateEnStr : public DialBaseModel {
+public:
+ DialModelDateEnStr() {}
+ virtual ~DialModelDateEnStr() {}
+ static DialModelDateEnStr *GetInstance() {
+ static DialModelDateEnStr instance;
+ return &instance;
+ }
+ bool GetDialTextData(DialDataType &type, std::string *&out,
+ int16_t &strNum) override;
+ void UpDateEnDateEnStr(const std::string *&dialDateEnStr);
+
+private:
+ std::string dialDateEnStr_;
+};
+} // namespace OHOS
+#endif
\ No newline at end of file
--- /dev/null
+
+
+#ifndef DIAL_MODEL_DateStr_H
+#define DIAL_MODEL_DateStr_H
+
+#include "DialBaseModel.h"
+#include <cstdint>
+#include <string>
+#include <vector>
+
+namespace OHOS
+{
+ class DialModelDateStr : public DialBaseModel
+ {
+ public:
+ DialModelDateStr() {}
+ virtual ~DialModelDateStr() {}
+ static DialModelDateStr *GetInstance()
+ {
+ static DialModelDateStr instance;
+ return &instance;
+ }
+ bool GetDialTextData(DialDataType &type, std::string *&out, int16_t &strNum) override;
+ void UpdateDateStr(const std::string *&dialDateStr);
+
+ private:
+ std::vector<std::string> datestr;
+ };
+}
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-11-03 16:53:17
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-11-03 17:11:53
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelDateWeekMDStr.h
+ */
+
+#ifndef DIAL_MODEL_DateWeekMDStr_H
+#define DIAL_MODEL_DateWeekMDStr_H
+
+#include "DialBaseModel.h"
+#include <cstdint>
+#include <string>
+#include <vector>
+
+namespace OHOS
+{
+ class DialModelDateWeekMDStr : public DialBaseModel
+ {
+ public:
+ DialModelDateWeekMDStr() {}
+ virtual ~DialModelDateWeekMDStr() {}
+ static DialModelDateWeekMDStr *GetInstance()
+ {
+ static DialModelDateWeekMDStr instance;
+ return &instance;
+ }
+ bool GetDialTextData(DialDataType &type, std::string *&out,int16_t &strNum) override;
+ void UpdateDateWeekStr(const std::string *&dialDateWeekMDStr);
+
+ private:
+ std::string dateweekmdstr;
+ };
+} // namespace OHOS
+#endif
\ No newline at end of file
--- /dev/null
+
+
+#ifndef DIAL_MODEL_DateWeekStr_H
+#define DIAL_MODEL_DateWeekStr_H
+
+#include "DialBaseModel.h"
+#include <cstdint>
+#include <string>
+#include <vector>
+
+namespace OHOS {
+class DialModelDateWeekStr : public DialBaseModel {
+public:
+ DialModelDateWeekStr() {}
+ virtual ~DialModelDateWeekStr() {}
+ static DialModelDateWeekStr *GetInstance() {
+ static DialModelDateWeekStr instance;
+ return &instance;
+ }
+ bool GetDialTextData(DialDataType &type, std::string *&out,
+ int16_t &strNum) override;
+ void UpdateDateWeekStr(const std::string *&dialDateWeekStr);
+
+private:
+ std::string dateweekstr;
+};
+} // namespace OHOS
+#endif
\ No newline at end of file
--- /dev/null
+/***
+ * @Date: 2024-04-15 10:55:58
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-07-31 18:20:02
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelDistance.h
+ */
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelDistance
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_MODEL_Distance_H
+#define DIAL_MODEL_Distance_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS
+{
+ class DialModelDistance : public DialBaseModel
+ {
+ public:
+ DialModelDistance() {}
+ virtual ~DialModelDistance() {}
+ static DialModelDistance *GetInstance()
+ {
+ static DialModelDistance instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdateDistance(float Distance);
+ int GetDistanceData(void);
+
+ private:
+ float distance_ = 0; // 67.0: default Distance value as reference
+ };
+}
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelHeartRate
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_MODEL_HEART_RATE_H
+#define DIAL_MODEL_HEART_RATE_H
+
+#include "main/dial/DialBaseModel.h"
+
+namespace OHOS {
+class DialModelHeartRate : public DialBaseModel {
+public:
+ DialModelHeartRate() {}
+ ~DialModelHeartRate() override {}
+ static DialModelHeartRate* GetInstance()
+ {
+ static DialModelHeartRate instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType& type, float& out) override;
+ void UpdateHeartRate(int16_t heartRate);
+ int GetHeartData();
+
+ private:
+ float heartRate_ = 0; // 67.0: default heart value as reference
+ };
+}
+#endif
--- /dev/null
+
+#ifndef DIAL_MODEL_HourTens_H
+#define DIAL_MODEL_HourTens_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS
+{
+ class DialModelHourTens : public DialBaseModel
+ {
+ public:
+ DialModelHourTens() {}
+ ~DialModelHourTens() override {}
+ static DialModelHourTens *GetInstance()
+ {
+ static DialModelHourTens instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdateHourTens();
+
+ private:
+ struct tm tblock_;
+ uint8_t hour_tens;
+ };
+}
+#endif
--- /dev/null
+
+
+#ifndef DIAL_MODEL_HourUnits_H
+#define DIAL_MODEL_HourUnits_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS
+{
+ class DialModelHourUnits : public DialBaseModel
+ {
+ public:
+ DialModelHourUnits() {}
+ ~DialModelHourUnits() override {}
+ static DialModelHourUnits *GetInstance()
+ {
+ static DialModelHourUnits instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdateHourUnits();
+
+ private:
+ struct tm tblock_;
+ uint8_t hour_units;
+
+ };
+}
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelKcalgoal
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_MODEL_Kcalgoal_H
+#define DIAL_MODEL_Kcalgoal_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS {
+class DialModelKcalgoal : public DialBaseModel {
+public:
+ DialModelKcalgoal() {}
+ ~DialModelKcalgoal() override {}
+ static DialModelKcalgoal *GetInstance() {
+ static DialModelKcalgoal instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdateKcalgoal(uint32_t Kcalgoal);
+
+private:
+ float Kcalgoal_ = 0; // 11520.0: default Kcal value as reference
+};
+} // namespace OHOS
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelKcalgoalStr
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_MODEL_KcalgoalStr_H
+#define DIAL_MODEL_KcalgoalStr_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS {
+class DialModelKcalgoalStr : public DialBaseModel {
+public:
+ DialModelKcalgoalStr() {}
+ ~DialModelKcalgoalStr() override {}
+ static DialModelKcalgoalStr *GetInstance() {
+ static DialModelKcalgoalStr instance;
+ return &instance;
+ }
+ bool GetDialTextData(DialDataType &type, std::string *&out,
+ int16_t &strNum) override;
+
+ void UpdateKcalgoalStr(uint32_t KcalgoalStr);
+
+private:
+ std::string KcalgoalStr_ = "0%";
+};
+} // namespace OHOS
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelKcalgoalValue
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_MODEL_KcalgoalValue_H
+#define DIAL_MODEL_KcalgoalValue_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS {
+class DialModelKcalgoalValue : public DialBaseModel {
+public:
+ DialModelKcalgoalValue() {}
+ ~DialModelKcalgoalValue() override {}
+ static DialModelKcalgoalValue *GetInstance() {
+ static DialModelKcalgoalValue instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdateKcalgoalValue(uint32_t KcalgoalValue);
+
+private:
+ float KcalgoalValue_ = 0; // 11520.0: default Kcal value as reference
+};
+} // namespace OHOS
+#endif
--- /dev/null
+
+#ifndef DIAL_MODEL_MinTens_H
+#define DIAL_MODEL_MinTens_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS
+{
+ class DialModelMinTens : public DialBaseModel
+ {
+ public:
+ DialModelMinTens() {}
+ ~DialModelMinTens() override {}
+ static DialModelMinTens *GetInstance()
+ {
+ static DialModelMinTens instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdateMinTens();
+
+ private:
+ struct tm tblock_;
+ uint8_t min_tens;
+ };
+}
+#endif
--- /dev/null
+
+
+#ifndef DIAL_MODEL_MinUnits_H
+#define DIAL_MODEL_MinUnits_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS
+{
+ class DialModelMinUnits : public DialBaseModel
+ {
+ public:
+ DialModelMinUnits() {}
+ ~DialModelMinUnits() override {}
+ static DialModelMinUnits *GetInstance()
+ {
+ static DialModelMinUnits instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdateMinUnits();
+
+ private:
+ struct tm tblock_;
+ uint8_t min_units;
+ };
+}
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelPower
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_MODEL_POWER_H
+#define DIAL_MODEL_POWER_H
+
+#include "main/dial/DialBaseModel.h"
+
+namespace OHOS {
+class DialModelPower : public DialBaseModel {
+public:
+ DialModelPower() {}
+ ~DialModelPower() override {}
+ static DialModelPower* GetInstance()
+ {
+ static DialModelPower instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType& type, float& out) override;
+ void UpdatePower();
+ void NotifyPowerUpdate();
+
+ private:
+ int16_t power_ = 0;
+ bool powerUpdated_{false};
+ };
+}
+#endif
--- /dev/null
+
+#ifndef DIAL_MODEL_PowerMapper_H
+#define DIAL_MODEL_PowerMapper_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS {
+class DialModelPowerMapper : public DialBaseModel {
+public:
+ DialModelPowerMapper() {}
+ ~DialModelPowerMapper() override {}
+ static DialModelPowerMapper *GetInstance() {
+ static DialModelPowerMapper instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdatePowerMapper();
+ void NotifyPowerMapperUpdate();
+
+private:
+ float powermapper_ = 0;
+ bool PowerMapperUpdated_{false};
+};
+} // namespace OHOS
+#endif
--- /dev/null
+
+
+#ifndef DIAL_MODEL_POWER_STANDBY_H
+#define DIAL_MODEL_POWER_STANDBY_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS
+{
+ class DialModelPowerStanby : public DialBaseModel
+ {
+ public:
+ DialModelPowerStanby() {}
+ virtual ~DialModelPowerStanby() {}
+ static DialModelPowerStanby *GetInstance()
+ {
+ static DialModelPowerStanby instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdatePowerStanby();
+ void NotifyPowerStanbyUpdate();
+ float SmoothPowerUpdate(float newPower);
+
+ private:
+ uint8_t PowerStanby_ = 0;
+ bool PowerStanbyUpdated_{false};
+ };
+}
+#endif
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-11-02 18:09:28
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-11-02 18:17:44
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelPowerStr.h
+ */
+
+
+#ifndef DIAL_MODEL_POWER_STR_H
+#define DIAL_MODEL_POWER_STR_H
+
+#include "DialBaseModel.h"
+#include <cstdint>
+#include <string>
+
+namespace OHOS
+{
+ class DialModelPowerStr : public DialBaseModel
+ {
+ public:
+ DialModelPowerStr() {}
+ virtual ~DialModelPowerStr() {}
+ static DialModelPowerStr *GetInstance()
+ {
+ static DialModelPowerStr instance;
+ return &instance;
+ }
+ bool GetDialTextData(DialDataType &type, std::string *&out, int16_t &strNum) override;
+ void UpdateTimeStr(const std::string dialPowerStr);
+
+ private:
+ std::string dialPowerStr_;
+ };
+} // namespace OHOS
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelSPO2
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_MODEL_SPO2_H
+#define DIAL_MODEL_SPO2_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS
+{
+ class DialModelSPO2 : public DialBaseModel
+ {
+ public:
+ DialModelSPO2() {}
+ virtual ~DialModelSPO2() {}
+ static DialModelSPO2 *GetInstance()
+ {
+ static DialModelSPO2 instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdateSPO2(uint8_t SPO2);
+ int GetSPO2Data();
+
+ private:
+ float SPO2_ = 0; // 97.0: default SPO2 value as reference
+ };
+}
+#endif
--- /dev/null
+
+#ifndef DIAL_MODEL_SecondMapper_H
+#define DIAL_MODEL_SecondMapper_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS {
+class DialModelSecondMapper : public DialBaseModel {
+public:
+ DialModelSecondMapper() {}
+ ~DialModelSecondMapper() override {}
+ static DialModelSecondMapper *GetInstance() {
+ static DialModelSecondMapper instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdateSecondMapper();
+ float CalculateMappedValue(int min, int sencond);
+
+private:
+ struct tm tblock_;
+ uint8_t secondmapper_;
+};
+} // namespace OHOS
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelStepgoal
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_MODEL_Stepgoal_H
+#define DIAL_MODEL_Stepgoal_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS {
+class DialModelStepgoal : public DialBaseModel {
+public:
+ DialModelStepgoal() {}
+ ~DialModelStepgoal() override {}
+ static DialModelStepgoal *GetInstance() {
+ static DialModelStepgoal instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdateStepgoal(uint32_t Stepgoal);
+
+private:
+ float stepgoal_ = 0; // 11520.0: default step value as reference
+};
+} // namespace OHOS
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelStepgoalStr
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_MODEL_StepgoalStr_H
+#define DIAL_MODEL_StepgoalStr_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS {
+class DialModelStepgoalStr : public DialBaseModel {
+public:
+ DialModelStepgoalStr() {}
+ ~DialModelStepgoalStr() override {}
+ static DialModelStepgoalStr *GetInstance() {
+ static DialModelStepgoalStr instance;
+ return &instance;
+ }
+ bool GetDialTextData(DialDataType &type, std::string *&out,
+ int16_t &strNum) override;
+
+ void UpdateStepgoalStr(uint32_t StepgoalStr);
+
+private:
+ std::string StepgoalStr_ = "0%";
+};
+} // namespace OHOS
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelStepgoalValue
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_MODEL_StepgoalValue_H
+#define DIAL_MODEL_StepgoalValue_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS {
+class DialModelStepgoalValue : public DialBaseModel {
+public:
+ DialModelStepgoalValue() {}
+ ~DialModelStepgoalValue() override {}
+ static DialModelStepgoalValue *GetInstance() {
+ static DialModelStepgoalValue instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdateStepgoalValue(uint32_t StepgoalValue);
+
+private:
+ float stepgoalValue_ = 0; // 11520.0: default Step value as reference
+};
+} // namespace OHOS
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelSteps
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_MODEL_STEPS_H
+#define DIAL_MODEL_STEPS_H
+
+#include "main/dial/DialBaseModel.h"
+
+namespace OHOS {
+class DialModelSteps : public DialBaseModel {
+public:
+ DialModelSteps() {}
+ ~DialModelSteps() override {}
+ static DialModelSteps* GetInstance()
+ {
+ static DialModelSteps instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType& type, float& out) override;
+ void UpdateSteps(uint32_t steps);
+
+ private:
+ float steps_ = 0; // 11520.0: default step value as reference
+};
+}
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelTime
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_MODEL_TIME_H
+#define DIAL_MODEL_TIME_H
+
+#include "main/dial/DialBaseModel.h"
+#include "gfx_utils/list.h"
+
+namespace OHOS {
+class TimeChangeListener;
+class DialModelTime : public DialBaseModel {
+public:
+ ~DialModelTime() override
+ {
+ listeners_.Clear();
+ }
+
+ static DialModelTime* GetInstance()
+ {
+ static DialModelTime instance;
+ return &instance;
+ }
+
+ bool GetDialFloatData(DialDataType& type, float& out) override;
+ void UpdateTime();
+ void Register(TimeChangeListener* listener);
+ void Unregister(TimeChangeListener* listener);
+
+private:
+ DialModelTime() = default;
+ struct tm *tblock_;
+ uint16_t angleH_ = 0;
+ uint16_t angleM_ = 0;
+ uint16_t angleS_ = 0;
+ float angleMS_ = 0;
+ List<TimeChangeListener*> listeners_;
+};
+
+class TimeChangeListener {
+public:
+ struct TimeInterval {
+ uint8_t start;
+ uint8_t end;
+ };
+ virtual void OnTimeUpdate(const struct tm &curTime) = 0;
+ void SetTimeInervals(TimeInterval *intervals, uint8_t num);
+ bool IsInTimeInterval(const struct tm &curTime);
+ TimeChangeListener(const TimeChangeListener&) = delete;
+ TimeChangeListener& operator=(const TimeChangeListener&) = delete;
+ TimeChangeListener();
+ virtual ~TimeChangeListener();
+private:
+ TimeInterval *intervals_ = nullptr;
+ uint8_t num_ = 0;
+};
+} // namespace OHOS
+#endif
--- /dev/null
+
+
+#ifndef DIAL_MODEL_TimeStr_H
+#define DIAL_MODEL_TimeStr_H
+
+#include "DialBaseModel.h"
+#include <cstdint>
+#include <string>
+
+namespace OHOS {
+class DialModelTimeStr : public DialBaseModel {
+public:
+ DialModelTimeStr() {}
+ virtual ~DialModelTimeStr() {}
+ static DialModelTimeStr *GetInstance() {
+ static DialModelTimeStr instance;
+ return &instance;
+ }
+ bool GetDialTextData(DialDataType &type, std::string *&out,
+ int16_t &strNum) override;
+ void UpdateTimeStr(const std::string dialTimeStr);
+
+private:
+ struct tm tblock_;
+ std::string dialTimeStr_ = "00:00";
+};
+} // namespace OHOS
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * @Author: penglei 1624952103@qq.com
+ * @Date: 2024-06-07 11:18:25
+ * @LastEditors: penglei 1624952103@qq.com
+ * @LastEditTime: 2024-08-29 17:52:26
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelWeather.h
+ * @Description:
+ *
+ * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
+ */
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: DialModelWeather
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef DIAL_MODEL_Weather_H
+#define DIAL_MODEL_Weather_H
+
+#include "DialBaseModel.h"
+
+namespace OHOS
+{
+ class DialModelWeather : public DialBaseModel
+ {
+ public:
+ DialModelWeather() {}
+ virtual ~DialModelWeather() {}
+ static DialModelWeather *GetInstance()
+ {
+ static DialModelWeather instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+ void UpdateWeather(int16_t Weather);
+ void UpdateWeatherStr(std::string text);
+ int GetWeatherData(void);
+
+ private:
+ float Weather_ = 11; // 默认unkown
+ std::string Weather_Str = "/°";
+ };
+}
+#endif
--- /dev/null
+/*
+ * @Author: penglei 1624952103@qq.com
+ * @Date: 2024-08-28 16:45:12
+ * @LastEditors: penglei 1624952103@qq.com
+ * @LastEditTime: 2024-08-28 16:55:58
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelWeatherStr.h
+ * @Description:
+ *
+ * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
+ */
+
+
+#ifndef DIAL_MODEL_WeatherStr_H
+#define DIAL_MODEL_WeatherStr_H
+
+#include "DialBaseModel.h"
+#include <cstdint>
+#include <string>
+
+namespace OHOS
+{
+ class DialModelWeatherStr : public DialBaseModel
+ {
+ public:
+ DialModelWeatherStr() {}
+ virtual ~DialModelWeatherStr() {}
+ static DialModelWeatherStr *GetInstance()
+ {
+ static DialModelWeatherStr instance;
+ return &instance;
+ }
+ bool GetDialTextData(DialDataType &type, std::string *&out, int16_t &strNum) override;
+ void UpdateWeatherStr(const std::string dialWeatherStr);
+
+ private:
+ std::string dialWeatherStr_ = "/°";
+ };
+}
+#endif
\ No newline at end of file
--- /dev/null
+/***
+ * @Date: 2024-08-03 17:35:36
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-08-07 11:50:10
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelWeekEnStr.h
+ */
+
+#ifndef DIAL_MODEL_WeekEnStr_H
+#define DIAL_MODEL_WeekEnStr_H
+
+#include "DialBaseModel.h"
+#include <cstdint>
+#include <string>
+
+namespace OHOS
+{
+ class DialModelWeekEnStr : public DialBaseModel
+ {
+ public:
+ DialModelWeekEnStr() {}
+ virtual ~DialModelWeekEnStr() {}
+ static DialModelWeekEnStr *GetInstance()
+ {
+ static DialModelWeekEnStr instance;
+ return &instance;
+ }
+ bool GetDialTextData(DialDataType &type, std::string *&out, int16_t &strNum) override;
+ void UpdateWeekEnStr(const std::string *&dialWeekEnStr);
+
+ private:
+ std::string dialWeekEnStr_;
+ };
+}
+#endif
\ No newline at end of file
--- /dev/null
+/***
+ * @Date: 2024-08-03 17:35:36
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-08-07 11:50:10
+ * @FilePath:
+ * /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelWeekNum.h
+ */
+
+#ifndef DIAL_MODEL_WeekNum_H
+#define DIAL_MODEL_WeekNum_H
+
+#include "DialBaseModel.h"
+#include <cstdint>
+#include <string>
+
+namespace OHOS {
+class DialModelWeekNum : public DialBaseModel {
+public:
+ DialModelWeekNum() {}
+ virtual ~DialModelWeekNum() {}
+ static DialModelWeekNum *GetInstance() {
+ static DialModelWeekNum instance;
+ return &instance;
+ }
+ bool GetDialFloatData(DialDataType &type, float &out) override;
+
+private:
+ float dialWeekNum_;
+};
+} // namespace OHOS
+#endif
\ No newline at end of file
--- /dev/null
+/***
+ * @Date: 2024-08-03 17:35:36
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-08-07 11:50:10
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelWeekStr.h
+ */
+
+#ifndef DIAL_MODEL_WeekStr_H
+#define DIAL_MODEL_WeekStr_H
+
+#include "DialBaseModel.h"
+#include <cstdint>
+#include <string>
+
+namespace OHOS
+{
+ class DialModelWeekStr : public DialBaseModel
+ {
+ public:
+ DialModelWeekStr() {}
+ virtual ~DialModelWeekStr() {}
+ static DialModelWeekStr *GetInstance()
+ {
+ static DialModelWeekStr instance;
+ return &instance;
+ }
+ bool GetDialTextData(DialDataType &type, std::string *&out, int16_t &strNum) override;
+ void UpdateWeekStr(const std::string *&dialWeekStr);
+
+ private:
+ std::string dialWeekStr_;
+ };
+}
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2025. All rights reserved.
+ * Description: DialOHSliceId
+ * Author:
+ * Create: 2025-02-15
+ */
+
+
+#ifndef DIALOHSLICEID_H
+#define DIALOHSLICEID_H
+
+#include <unordered_map>
+#include "AppViewIDs.h"
+
+namespace OHOS {
+enum class DialOHSliceId : uint16_t {
+ DUAL_TIME_ZONES = 0,
+ HEART_RATE = 1,
+ STANDING_TIMES = 2,
+ STRESS = 3,
+ MODERATE_TO_VIGOROUS_INTENSITY_TIME = 4,
+ WEATHER = 5,
+ AIR_QUALITY_ONLY_CHINA = 6,
+ ATMOSPHERIC_PRESSURE = 7,
+ ELEVATION_HEIGHT = 8,
+ SUNRISE_SUNSET_TIME = 9,
+ DISTANCE = 10,
+ SLEEP = 11,
+ EXERCISE = 12,
+ PAYMENT_ONLY_CHINA = 13,
+ ALARM_CLOCK = 14,
+ STOPWATCH = 15,
+ TIMER = 16,
+ EXERCISE_RECORD = 17,
+ TRAINING_STATUS = 18,
+ ACTIVITY_RECORD = 19,
+ AEROBIC_EXERCISE = 20,
+ CONTACTS = 21,
+ MUSIC = 22,
+ COMPASS = 23,
+ CALL_LOG = 24,
+ BLOOD_OXYGEN_SATURATION_ONLY_CHINA = 25,
+ ULTRAVIOLET_RAYS_ONLY_CHINA = 26,
+ PHASE_OF_THE_MOON = 27,
+ STAIR_CLIMBING = 28,
+ BLOOD_PRESSURE = 29,
+ MESSAGE_LIST = 30,
+ DIAL = 31,
+ AUDIO_SWITCH = 32,
+}; // enum class DialOHSliceId
+
+struct HashOhSliceId {
+ size_t operator()(DialOHSliceId id) const
+ {
+ return std::hash<uint16_t>()(static_cast<uint16_t>(id));
+ }
+};
+
+const std::unordered_map<DialOHSliceId, AppViewId, HashOhSliceId> g_sliceIdConverter = {
+ {DialOHSliceId::COMPASS, VIEW_COMPASS},
+ {DialOHSliceId::DIAL, VIEW_CALLER_SAMPLE},
+ {DialOHSliceId::ALARM_CLOCK, VIEW_MAIN_ALARM},
+ {DialOHSliceId::AUDIO_SWITCH, VIEW_VOLUME},
+};
+} // namespace OHOS
+#endif // DIALOHSLICEID_H
--- /dev/null
+/*
+ * Copyright (c) @CompanyNameMagicTag. 2023. All rights reserved.
+ */
+
+#ifndef DIAL_OPTION_IMG_VIEW_H
+#define DIAL_OPTION_IMG_VIEW_H
+
+#include <cstdint>
+#include "main/dial/DialView.h"
+#include "main/dial/DialModelTime.h"
+#include "components/ui_image_view.h"
+#include "font/font_global_manager.h"
+
+namespace OHOS {
+
+class DialOptionImgView : public UIImageView,
+ public DialView,
+ public FontGlobalManager::LangChangeListener,
+ public TimeChangeListener {
+public:
+ DialOptionImgView();
+ ~DialOptionImgView() override;
+
+ void HandleFloatData(float data) override;
+
+ bool SetOptionRes(const ImageInfo* src, uint16_t num);
+
+ void SetLang(uint8_t lang);
+
+ void OnLangChange(uint8_t langId) override;
+
+ void OnTimeUpdate(const struct tm &curTime) override;
+
+private:
+ ImageInfo* info_ = nullptr;
+ uint16_t infoNum_ = 0;
+ int16_t selected_ = -1;
+ uint8_t language_ = FontGlobalManager::INVALID_LANG_ID;
+ bool langVisible_ = true;
+ bool timeVisible_ = true;
+};
+}
+#endif
+/**
+ * @}
+ */
--- /dev/null
+/*
+ * Copyright (c) @CompanyNameMagicTag. 2023. All rights reserved.
+ */
+
+#ifndef DIAL_ROTATE_IMG_VIEW_H
+#define DIAL_ROTATE_IMG_VIEW_H
+
+#include <cstdint>
+#include "main/dial/DialView.h"
+#include "components/ui_image_view.h"
+#include "gfx_utils/graphic_math.h"
+
+namespace OHOS {
+
+class DialRotateImgView : public UIImageView, public DialView {
+public:
+ DialRotateImgView();
+ ~DialRotateImgView() override;
+
+ void HandleFloatData(float data) override;
+
+ void SetRotatePivot(const Vector2<float>& pivot);
+ void SetRotateStart(float rotateStart);
+ void SetRotateEnd(float rotateEnd);
+
+private:
+ Vector2<float> rotatePivot_ = {0.0f, 0.0f};
+ float rotateStart_ = 0.0f;
+ float rotateEnd_ = 360.0f;
+ bool isRotateSet_ = false;
+ float rotate_ = 0.0f;
+};
+}
+#endif
--- /dev/null
+/*
+ * Copyright (c) @CompanyNameMagicTag. 2023. All rights reserved.
+ */
+
+#ifndef DIAL_SEQUENCE_IMG_VIEW_H
+#define DIAL_SEQUENCE_IMG_VIEW_H
+
+#include "components/ui_image_animator.h"
+
+namespace OHOS {
+struct SequenceInfo : public HeapBase {
+ long imgOffset = 0;
+ long resPos = 0;
+ uint8_t imgNum = 0;
+ FILE *fp = nullptr;
+ std::string fileName;
+ uint16_t interval = 0;
+ bool repeat = false;
+};
+
+class DialSequenceImgView : public UIImageAnimatorView, public UIImageAnimatorView::AnimatorStopListener {
+public:
+ DialSequenceImgView();
+ ~DialSequenceImgView() override;
+
+ bool SetSequenceRes(const ImageAnimatorInfo *imgSrc, uint8_t imgNum);
+ bool SetPreviewImg();
+ bool LoadCurSeqImgs();
+ bool AddSequenceRes(const SequenceInfo ¶);
+ bool OnClickEvent(const ClickEvent &event) override;
+ void OnAnimatorStop(UIView &view) override;
+
+private:
+ ImageAnimatorInfo *LoadImgs(const SequenceInfo ¶, uint8_t num) const;
+ void UpdateCurrentSeq();
+ struct AnimatorInfo : public HeapBase {
+ SequenceInfo info;
+ ImageAnimatorInfo *imgs = nullptr;
+ uint8_t num = 0;
+ ~AnimatorInfo()
+ {
+ if (imgs != nullptr) {
+ UIFree(imgs);
+ imgs = nullptr;
+ num = 0;
+ }
+ }
+ };
+ void SetAnimatorInfo(AnimatorInfo *info, uint8_t num);
+ static constexpr uint8_t SEQ_IMG_NUM = 3;
+ AnimatorInfo *repeatSeq_ = nullptr;
+ AnimatorInfo *nonCycleSeq_[SEQ_IMG_NUM];
+ AnimatorInfo *curSeq_ = nullptr;
+ uint8_t nonCycleNum_ = 0;
+ uint8_t loop_ = 0;
+ bool isClick_ = false;
+ uint8_t viewNum_ = 0;
+ bool isAllImgLoaded_ = false;
+};
+} // namespace OHOS
+#endif
--- /dev/null
+/*
+ * Copyright (c) @CompanyNameMagicTag. 2023. All rights reserved.
+ */
+
+#ifndef DIAL_STATIC_IMG_VIEW_H
+#define DIAL_STATIC_IMG_VIEW_H
+
+#include "components/ui_image_view.h"
+#include "font/font_global_manager.h"
+#include "main/dial/DialModelTime.h"
+
+namespace OHOS {
+class DialStaticImgView : public UIImageView,
+ public FontGlobalManager::LangChangeListener,
+ public TimeChangeListener {
+public:
+ DialStaticImgView();
+ ~DialStaticImgView() override;
+ void SetLang(uint8_t lang);
+ void OnLangChange(uint8_t langId) override;
+ bool SetImgs(const ImageInfo* src, uint8_t num);
+ bool OnClickEvent(const ClickEvent& event) override;
+ void OnTimeUpdate(const struct tm &curTime) override;
+
+private:
+ uint8_t language_ = FontGlobalManager::INVALID_LANG_ID;
+ ImageInfo* info_ = nullptr;
+ uint8_t infoNum_ = 0;
+ int16_t selected_ = -1;
+ bool langVisible_ = true;
+ bool timeVisible_ = true;
+};
+}
+#endif
--- /dev/null
+/*
+ * Copyright (c) @CompanyNameMagicTag. 2023. All rights reserved.
+ */
+
+#ifndef DIAL_VIDEO_VIEW
+#define DIAL_VIDEO_VIEW
+
+#include <cstdint>
+#include "components/ui_lite_surface_view.h"
+#include "video_play_wrapper.h"
+
+namespace OHOS {
+class DialVideoView : public UILiteSurfaceView {
+public:
+ DialVideoView();
+ ~DialVideoView() override;
+ bool SetVideoRes(FILE* fp, uint32_t offset);
+ bool StartPlay();
+ bool ResumePlay();
+ bool PausePlay();
+ bool StopPlay();
+ bool IsPaused();
+ bool IsPlayed();
+ bool IsStopped();
+ MediaVideoPlay* GetVideoPlay();
+
+private:
+ FILE* fp_ = nullptr;
+ uint32_t offset_ = 0;
+ MediaVideoPlay* videoPlayer_ = nullptr;
+};
+}
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) @CompanyNameMagicTag. 2023. All rights reserved.
+ */
+
+#ifndef DIAL_VIEW_H
+#define DIAL_VIEW_H
+
+#include <cstdint>
+#include <string>
+#include "main/dial/DialDataType.h"
+
+namespace OHOS {
+
+class DialView {
+public:
+ DialView() {}
+ virtual ~DialView() {}
+
+ virtual void HandleFloatData(float data) {}
+ virtual void HandleFloatData(const float* data, uint16_t num) {}
+ virtual void HandleTextData(const std::string* data, uint16_t num) {}
+ virtual DialDataType GetDataType()
+ {
+ return type_;
+ }
+
+ virtual void SetDataType(DialDataType type)
+ {
+ type_ = type;
+ }
+
+private:
+ DialDataType type_ = DialDataType::DATA_TYPE_MAX;
+};
+}
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2025. All rights reserved.
+ * Description: DialViewContainer
+ * Author:
+ * Create: 2025-02-06
+ */
+
+#ifndef DIAL_VIEW_CONTAINER_H
+#define DIAL_VIEW_CONTAINER_H
+#include "components/ui_view_group.h"
+#include "gfx_utils/list.h"
+#include "main/dial/DialView.h"
+#include "main/dial/DialDataBase.h"
+
+namespace OHOS {
+class ContainerInterface {
+public:
+ virtual void AddView(UIView* view) = 0;
+
+ virtual void AddView(DialDataType type, DialView* view, bool isPeriodic) = 0;
+
+ virtual ~ContainerInterface() {}
+};
+
+class DialViewContainer : public UIViewGroup, public ContainerInterface {
+public:
+ struct SubView {
+ UIView *view;
+ DialView *dialView;
+ DialDataType type;
+ bool isPeriodic;
+ };
+ DialViewContainer(uint8_t dialviewNum, uint16_t dataSize) :
+ dialViewNum_(dialviewNum), dataSize_(dataSize)
+ {
+ SetTouchable(true);
+ }
+ DialViewContainer() {}
+ ~DialViewContainer() override;
+ DialViewContainer(const DialViewContainer&) = delete;
+ DialViewContainer& operator=(const DialViewContainer&) = delete;
+
+ uint8_t GetDialviewNum() const
+ {
+ return dialViewNum_;
+ }
+
+ uint16_t GetDataSize() const
+ {
+ return dataSize_;
+ }
+
+ void AddView(UIView* view) override;
+
+ void AddView(DialDataType type, DialView* view, bool isPeriodic) override;
+
+ ListNode<SubView>* Begin()
+ {
+ return dialViews_.Begin();
+ }
+
+ const ListNode<SubView>* End()
+ {
+ return dialViews_.End();
+ }
+
+ bool HasInvalidBindData() const
+ {
+ return hasInvalidBindData_;
+ }
+
+ bool RemoveSubView(uint8_t index, SubView &subView);
+
+ bool IsInvalidateBindData(uint8_t index);
+
+private:
+ uint8_t dialViewNum_;
+ uint16_t dataSize_;
+ List<SubView> dialViews_;
+ bool hasInvalidBindData_ = false;
+}; // class DialViewContainer
+} // namesapce OHOS
+#endif // DIAL_VIEW_CONTAINER_H
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ */
+
+#ifndef DIAL_VIEW_GROUP_H
+#define DIAL_VIEW_GROUP_H
+
+#include <unordered_map>
+#include <memory>
+#include "main/dial/DialDataBase.h"
+#include "components/ui_view_group.h"
+#include "components/ui_image_animator.h"
+#include "components/ui_label.h"
+#include "main/dial/OnDialDataUpdateListener.h"
+#include "components/ui_card_page.h"
+#include "components/ui_kaleidoscope_view.h"
+#include "gfx_utils/list.h"
+#include "gfx_utils/vector.h"
+#include "main/dial/DialView.h"
+#include "main/dial/DialVideoView.h"
+#include "main/DialBinTypesV2.h"
+#include "main/dial/DialViewContainer.h"
+
+namespace OHOS {
+class DialViewGroup : public UICardPage, public OnDialDataUpdateListener, public ContainerInterface {
+public:
+ DialViewGroup();
+ ~DialViewGroup() override;
+
+ /**
+ * @brief Set dial resource path.
+ */
+ void SetDial(std::string filePath, DisplayState state = DisplayState::NORMAL);
+
+ /**
+ * @brief Add a view which binds with data of a specific type and could be updated periodically.
+ */
+ void AddView(DialDataType type, DialView* view, bool isPeriodic) override;
+
+ /**
+ * @brief Add a view.
+ */
+ void AddView(UIView* view) override;
+
+ /**
+ * @brief Add a click rect. When the rect is clicked, it will start a js app with the given bundleName.
+ */
+ void AddDialClick(Rect& rect, const char* bundleName);
+
+ /**
+ * @brief Add a click rect. When the rect is clicked, it will change to a slice with the given sliceId.
+ */
+ void AddDialClick(Rect& rect, uint32_t sliceId);
+
+ /**
+ * @brief Set update period.
+ */
+ void SetPeriod(uint32_t period);
+
+ /**
+ * @brief Get update period.
+ */
+ uint32_t GetPeriod(void);
+
+ /**
+ * @brief Update views periodically.
+ */
+ void UpdateViewsByPeriodicUpdateData();
+
+ /**
+ * @brief Dial float data update callback.
+ */
+ void OnDialFloatDataUpdate(DialDataType type, float data) override;
+
+ /**
+ * @brief Dial multi-float data update callback.
+ */
+ void OnDialFloatDataUpdate(DialDataType type, const float* data, uint16_t num) override;
+
+ /**
+ * @brief Dial text data update callback.
+ */
+ void OnDialTextDataUpdate(DialDataType type, const std::string* data, uint16_t num) override;
+
+ /**
+ * @brief Click event callback.
+ */
+ bool OnClickEvent(const ClickEvent& event) override;
+
+ /**
+ * @brief Preload resource callback.
+ */
+ void PreLoad(void) override;
+
+ /**
+ * @brief Scroll begin callback. If a video is played, it will be paused.
+ */
+ void ScrollBegin(bool isActive) override;
+
+ /**
+ * @brief Scroll end callback. If a video is paused or stopped, it will be resumed or started.
+ */
+ void ScrollEnd(bool isActive) override;
+
+ /**
+ * @brief Cover begin callback. If a video is played, it will be paused.
+ */
+ void CoverBegin(bool isCovered) override;
+
+ /**
+ * @brief Cover end callback. If a video is paused or stopped, it will be resumed or started.
+ */
+ void CoverEnd(bool isCovered) override;
+
+ /**
+ * @brief This function is invoked when the function SetHorCurrentPage() is called.
+ */
+ void OnActive(void) override;
+
+ /**
+ * @brief This function is invoked when the function SetHorCurrentPage() is called.
+ */
+ void OnInactive(void) override;
+
+ /**
+ * @brief This function is invoked when SetVerCurrentPage is called and horizontal page is covered.
+ */
+ void OnCovered(void) override;
+
+ /**
+ * @brief This function is invoked when SetVerCurrentPage is called and horizontal page is not covered.
+ */
+ void OnUncovered(void) override;
+
+ void OnPause() override;
+
+ /* -------------------------------------------------------------------------- */
+ /*Íⲿ½Ó¿Ú¶Ô±íÅ̽øÐе÷ÓÃ*/
+ void StopDial();
+ void StartDial();
+
+ /*Íⲿ½Ó¿Ú¸üбíÅÌ״̬*/
+ void UpdateStateShow();
+ /* -------------------------------------------------------------------------- */
+
+ MediaVideoPlay* GetVideoPlay();
+
+private:
+ bool resLoadStatus{false};
+ bool videoPlaying_{false};
+
+
+
+private:
+ void ProcessData(DialDataType type, DialView* view);
+ void DoStop(void);
+ void DoStart(void);
+ void DoPause(void);
+ void RecordSpecial(UIView *view);
+ void RecordBindData(DialDataType type, DialView* view, bool isPeriodic);
+ void ClearViews();
+ using Views = Graphic::Vector<DialView*>;
+ std::unordered_map<int16_t, Views*> dataTypeMap_;
+ Graphic::Vector<Views*> viewsMemPool_;
+ List<DialDataType> periodicUpdateTypes_;
+ List<DialDataType> passiveUpdateTypes_;
+ List<UIView*> dialViews_;
+ uint32_t period_ = DEFAULT_TASK_PERIOD;
+ bool resPreloaded_ = false;
+ std::string filePath_;
+ FILE* fp_ = nullptr;
+ DialVideoView* video_ = nullptr;
+ UIKaleidoscopeView *kaleidoscope_ = nullptr;
+ UIImageView *dialstateicon_{nullptr}; // ÎðÈÅͼ±ê
+ UIImageView *messageicon_{nullptr}; // δ¶Áͼ±ê
+ DisplayState state_ = DisplayState::NORMAL;
+
+ typedef struct {
+ Rect area;
+ bool isSliceType;
+ union {
+ uint32_t sliceId;
+ char* bundleName;
+ };
+ } DialClick;
+ List<DialClick> dialClicks_;
+
+ void ClearDial();
+
+ void SetLableAnimatorState(uint8_t state);
+ void SetImgAnimatorState(uint8_t state);
+ List<UILabel*> rollingLabelList_;
+ List<UIImageAnimatorView*> imgAnimList_;
+ bool isSeqImgLoaded_ = false;
+ std::shared_ptr<bool> isExists_;
+};
+}
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: ModelDialDataFactory
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef MODE_DIAL_DATA_FACTORY
+#define MODE_DIAL_DATA_FACTORY
+
+#include <unordered_map>
+#include "main/dial/DialBaseModel.h"
+#include "main/dial/DialDataBase.h"
+#include "main/dial/ModelDialDataFactory.h"
+
+namespace OHOS {
+class ModelDialDataFactory : public HeapBase {
+public:
+ ModelDialDataFactory() {}
+ virtual ~ModelDialDataFactory() {}
+
+ static ModelDialDataFactory& GetInstance()
+ {
+ static ModelDialDataFactory instance;
+ return instance;
+ }
+
+ void RegisterModel(DialDataType type, DialBaseModel* model)
+ {
+ models_[static_cast<int16_t>(type)] = model;
+ }
+
+ bool RegisterDialDataListener(DialDataType type, OnDialDataUpdateListener* listener);
+ bool UnRegisterDialDataListener(DialDataType type);
+ bool GetDialTextData(DialDataType& type, std::string*& out, int16_t& strNum);
+ bool GetDialFloatData(DialDataType& type, float& out);
+ bool GetDialFloatData(DialDataType& type, float*& out, int16_t& len);
+ DialBaseModel* GetModuleByType(DialDataType& type);
+ void DumpModules();
+
+private:
+ std::unordered_map<int16_t, DialBaseModel*> models_;
+};
+}
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: OnDialDataUpdateListener
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef ON_DIAL_DATA_UPDATE_LISTENER_H
+#define ON_DIAL_DATA_UPDATE_LISTENER_H
+
+#include "main/dial/DialDataBase.h"
+
+namespace OHOS {
+class OnDialDataUpdateListener : public HeapBase {
+public:
+ OnDialDataUpdateListener() {}
+ virtual ~OnDialDataUpdateListener() {}
+ virtual void OnDialFloatDataUpdate(DialDataType type, float data) {}
+ virtual void OnDialFloatDataUpdate(DialDataType type, const float* data, uint16_t num) {}
+ virtual void OnDialTextDataUpdate(DialDataType type, const std::string* data, uint16_t num) {}
+};
+}
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2023. All rights reserved.
+ * Description: RegisterDialModel
+ * Author:
+ * Create: 2023-12
+ */
+
+#ifndef REGISTER_DIAL_MODEL_H
+#define REGISTER_DIAL_MODEL_H
+
+#include "main/dial/DialDataBase.h"
+#include "main/dial/ModelDialDataFactory.h"
+namespace OHOS {
+class RegisterDialModel {
+public:
+ RegisterDialModel(DialDataType type, DialBaseModel* func)
+ {
+ ModelDialDataFactory::GetInstance().RegisterModel(type, func);
+ }
+ virtual ~RegisterDialModel() {}
+};
+}
+
+#define REGIST_DIAL_MODULE(type, func) static OHOS::RegisterDialModel(REGIST_OCCURRENCES)(type, func)
+#endif
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2025. All rights reserved.
+ * Description: WatchInterface
+ * Author:
+ * Create: 2025-03-17
+ */
+
+#ifndef WATCH_INTERFACE_H
+#define WATCH_INTERFACE_H
+#include <cstdint>
+#include "format_type.h"
+#include "dial_market.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Get all watch face information
+ * @param [out] watch_dial_info **info
+ * A pointer to a pointer where the retrieved watch face information will be stored.
+ * @param [out] uint8_t *num
+ * A pointer to the number of watch face information entries retrieved.
+ * @return bool
+ * - true: Successfully retrieved watch face information.
+ * The pointer pointed to by `info` needs to be released
+ * externally.
+ * - false: Failed to retrieve watch face information.
+ * @remarks
+ * - If the function returns true,
+ * the memory pointed to by `info` must be freed by the caller to prevent
+ * memory leaks.
+ * - If the function returns false, the values of `info` and `num` remain unchanged.
+ */
+bool GetAllWatchFaceInfo(watch_dial_info **info, uint8_t *num);
+
+/**
+ * @brief Get information of a specific watch face by UUID
+ * @param[in] uuid Unique identifier of the watch face
+ * @param[out] watch Pointer to store the watch face information
+ * @return bool Returns true if successful, false otherwise
+ */
+bool GetWatchFaceInfo(uint32_t uuid, watch_dial_info *watch);
+
+/**
+ * @brief Get the capability set of the watch
+ * @param[out] capability Pointer to store the watch capability information
+ * @return bool Returns true if successful, false otherwise
+ */
+bool GetWatchCapability(watch_dev_cap_info *capability);
+
+/**
+ * @brief Get system information
+ * @param[out] sysInfo Pointer to store the system information
+ * @return bool Returns true if successful, false otherwise
+ */
+bool GetWatchSystemInfo(watch_sys_info *sysInfo);
+
+/**
+ * @brief Get information of the currently active watch face
+ * @param[out] watch Pointer to store the watch face information
+ * @return bool Returns true if successful, false otherwise
+ */
+bool GetCurrentWatchFaceInfo(watch_dial_info *watch);
+
+/**
+ * @brief Set the currently active watch face by UUID
+ * @param[in] uuid Unique identifier of the watch face to set as active
+ * @return bool Returns true if successful, false otherwise
+ */
+bool SetCurrentWatchFace(uint32_t uuid);
+
+/**
+ * @brief Uninstall a watch face by UUID
+ * @param[in] uuid Unique identifier of the watch face to uninstall
+ * @return bool Returns true if successful, false otherwise
+ * @note If the UUID corresponds to the currently active watch face, it will switch to the default watch face
+ */
+bool UninstallWatch(uint32_t uuid);
+
+/**
+ * @brief Retrieves the unique identifier (UUID) associated with a specified path.
+ *
+ * @param[in] path The path to look up.
+ * @param[out] uuid A pointer to a variable where the UUID will be stored if found.
+ *
+ * @return bool
+ * - true if the UUID is successfully retrieved.
+ * - false if the path is invalid or the UUID cannot be obtained.
+ *
+ * @remarks The caller is responsible for ensuring that the 'uuid' pointer is valid and properly aligned.
+ */
+bool GetUuidByPath(const char *path, uint32_t *uuid);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // WATCH_INTERFACE_H
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
+ * Description: SetDialInfo.h\r
+ * Author:\r
+ * Create: 2021-11-23\r
+ */\r
+\r
+#ifndef SET_DIAL_INFO_H\r
+#define SET_DIAL_INFO_H\r
+#include <cstdint>\r
+#include <vector>\r
+#include <string>\r
+#include "common/image_cache_manager.h"\r
+namespace OHOS {\r
+ typedef struct {\r
+ uint8_t dialFlag; /* 1:离线表盘 0:预制表盘 */\r
+ uint8_t id; /* 仅预制表盘使用 */\r
+ uint32_t resId; /* 仅离线表盘使用 */\r
+ std::string dialFullName; /* 仅离线表盘使用 */\r
+ std::string imageFullName; /* 仅预制表盘使用 */\r
+ std::string dialName;\r
+ std::string description; /* 仅离线表盘使用 */\r
+ ImageInfo *preImageInfo;\r
+ uint8_t capability;\r
+ } SetDialInfo;\r
+}\r
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: SetDialModel.h
+ * Author:
+ * Create: 2021-11-23
+ */
+
+#ifndef SET_DIAL_MODEL_H
+#define SET_DIAL_MODEL_H
+#include "AppViewIDs.h"
+#include "UiConfig.h"
+#include "set_dial/SetDialInfo.h"
+
+namespace OHOS {
+ class SetDialModel {
+ public:
+ static SetDialModel &GetInstance(void);
+ void LoadAllDial(void);
+ size_t GetDialCount(void);
+ std::vector<SetDialInfo>& GetDialInfo(void);
+ std::vector<SetDialInfo>& GetAmbientDialInfo(void);
+ void ClearDialInfo(void);
+ void SaveDialSetting(uint8_t pageIndex);
+ uint8_t GetPageIndex(void);
+ private:
+ void LoadAllDialFromRam(void);
+ void LoadAllDialFromFs(void);
+ SetDialModel();
+ SetDialModel(const SetDialModel &);
+ SetDialModel &operator=(const SetDialModel &);
+ virtual ~SetDialModel();
+ int32_t ParseDialHeader(const std::string &dialFileName, SetDialInfo &dialInfo);
+ std::vector<SetDialInfo> dialInfoList;
+ std::vector<SetDialInfo> aodDialInfoList;
+ };
+}
+
+#endif // SET_DIAL_MODEL_H
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: SetDialPresenter.h
+ * Author:
+ * Create: 2021-11-23
+ */
+
+#ifndef SET_DIAL_PRESENTER_H
+#define SET_DIAL_PRESENTER_H
+#include "set_dial/SetDialInfo.h"
+#include "set_dial/SetDialModel.h"
+#include "Presenter.h"
+#include "components/ui_view.h"
+#include "components/ui_roller_view.h"
+#include "key/include/KeyInputListener.h"
+#include "main/include/ModelListenerSample.h"
+#include "components/ui_coverflow_view.h"
+#include "main/MainModel.h"
+
+namespace OHOS {
+
+const uint16_t MISS_DIAL_OPERATION_TIME = 3000;
+
+class SetDialView;
+class SetDialModel;
+class SetDialPresenter : public Presenter<SetDialView>,
+ public UIView::OnClickListener, public ModelListenerSample,
+ public UICoverflowView::OnCoverflowScrollListener,
+ public UIRollerView::OnScrollListener {
+public:
+ SetDialPresenter();
+ ~SetDialPresenter() override;
+ static SetDialPresenter *GetCurrentInstance();
+ void SpecifyDialSetting(const DialSetting &setting);
+ size_t GetDialCount(void);
+ std::vector<SetDialInfo>& GetDialInfo(void);
+ uint8_t GetPageIndex(void);
+ void OnTickEvent() override;
+ void Notify() override {}
+ void OnStop() override;
+ bool OnScroll() override;
+ void OnScroll(UIRollerView* roller, std::string currentItemName, float currentItemAngle) override;
+ bool OnClick(UIView &view, const ClickEvent &event) override;
+ void ResetTickTimer(void);
+private:
+ void OnClickAction(void);
+ SetDialModel *model{nullptr};
+ uint64_t startTime{0};
+ bool isSpecific = false;
+ DialSetting specificSetting;
+};
+}
+
+#endif // SET_DIAL_PRESENTER_H
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: SetDialView.h
+ * Author:
+ * Create: 2021-11-23
+ */
+
+#ifndef SET_DIAL_VIEW_H
+#define SET_DIAL_VIEW_H
+
+#include "View.h"
+#include "components/ui_view_group.h"
+#include "components/ui_coverflow_view.h"
+#include "components/ui_roller_view.h"
+#include "ChangeSliceListener.h"
+#include "UiConfig.h"
+
+namespace OHOS {
+static constexpr uint8_t DIVISOR_TWO = 2;
+class SetDialPresenter;
+
+enum class DialStyle {
+ COVERFLOW = 0,
+ ROLLER,
+ STYLE_NUM
+};
+
+class SetDialView : public View<SetDialPresenter> {
+public:
+ SetDialView();
+ ~SetDialView() override;
+
+ static SetDialView *GetInstance()
+ {
+ static SetDialView instance;
+ return &instance;
+ }
+
+ void OnStart() override;
+ void CoverflowViewScroll(void);
+ void RollerViewScroll(std::string currentItemName, float currentItemAngle);
+ uint8_t GetCoverflowPage(void);
+private:
+ void SetUpCoverflowView(void);
+ void SetUpRollerView(void);
+ UICoverflowView coverflow_;
+ UIRollerView rollerView_;
+ int16_t rollerItemNum_ = 0;
+ UILabel label_;
+ uint8_t lastIndex_;
+};
+}
+#endif // SET_DIAL_VIEW_H
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2024. All rights reserved.
+ * Description: SetDialStyleModel.h
+ * Author:
+ * Create: 2024-06-06
+ */
+
+#ifndef SET_DIAL_STYLE_MODEL_H
+#define SET_DIAL_STYLE_MODEL_H
+#include "set_dial/SetDialView.h"
+#include "components/ui_view.h"
+
+namespace OHOS {
+class SetDialStyleModel {
+public:
+ static SetDialStyleModel& GetInstance()
+ {
+ static SetDialStyleModel model;
+ return model;
+ }
+
+ void SetStyle(DialStyle style);
+ DialStyle GetStyle();
+
+private:
+ constexpr static uint8_t MAX_LEN = 32;
+ const char key_[MAX_LEN] = "set_dial_style";
+ struct {
+ const DialStyle style;
+ const char value[MAX_LEN];
+ } values_[static_cast<int>(DialStyle::STYLE_NUM)] = {
+ {DialStyle::COVERFLOW, "DialStyle::COVERFLOW"},
+ {DialStyle::ROLLER, "DialStyle::ROLLER"},
+ };
+ SetDialStyleModel();
+ ~SetDialStyleModel();
+ SetDialStyleModel(const SetDialStyleModel&) = delete;
+ SetDialStyleModel& operator=(const SetDialStyleModel&) = delete;
+};
+} // OHOS
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2024. All rights reserved.
+ * Description: SetDialStylePresenter.h
+ * Author:
+ * Create: 2024-06-06
+ */
+
+#ifndef SET_DIAL_STYLE_PRESENTER_H
+#define SET_DIAL_STYLE_PRESENTER_H
+#include "set_dial/SetDialView.h"
+#include "components/ui_view.h"
+#include "Presenter.h"
+
+namespace OHOS {
+class SetDialStyleModel;
+class SetDialStyleView;
+class SetDialStylePresenter : public Presenter<SetDialStyleView, SetDialStyleModel>,
+ public UIView::OnClickListener,
+ public UIView::OnDragListener {
+public:
+ SetDialStylePresenter();
+ ~SetDialStylePresenter() override;
+ SetDialStylePresenter(const SetDialStylePresenter&) = delete;
+ SetDialStylePresenter& operator=(const SetDialStylePresenter&) = delete;
+ bool OnClick(UIView &view, const ClickEvent &event) override;
+ bool OnDrag(UIView& view, const DragEvent& event) override;
+ DialStyle GetCurrentStyle() const
+ {
+ return curStyle_;
+ }
+
+private:
+ DialStyle curStyle_ = DialStyle::COVERFLOW;
+};
+
+} // OHOS
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2024. All rights reserved.
+ * Description: SetDialStyleView.h
+ * Author:
+ * Create: 2024-06-06
+ */
+
+#ifndef SET_DIAL_STYLE_VIEW_H
+#define SET_DIAL_STYLE_VIEW_H
+#include "components/ui_view.h"
+#include "components/ui_label.h"
+#include "components/ui_view_group.h"
+#include "components/ui_toggle_button.h"
+#include "set_dial/SetDialView.h"
+#include "View.h"
+
+namespace OHOS {
+class SetDialStylePresenter;
+class SetDialStyleView : public View<SetDialStylePresenter> {
+public:
+ SetDialStyleView();
+ ~SetDialStyleView() override;
+ SetDialStyleView(const SetDialStyleView &) = delete;
+ SetDialStyleView& operator=(const SetDialStyleView &) = delete;
+
+ void OnStart() override;
+ void OnClick(UIView &view);
+
+private:
+ UILabel labelCover_;
+ UILabel labelRoller_;
+ UILabel labelEnableAod_;
+ UIToggleButton btnCover_;
+ UIToggleButton btnRoller_;
+ UIToggleButton btnEnableAod_;
+ struct {
+ UIToggleButton *btn;
+ DialStyle style;
+ } styleTable_[static_cast<int>(DialStyle::STYLE_NUM)] = {
+ {&btnCover_, DialStyle::COVERFLOW},
+ {&btnRoller_, DialStyle::ROLLER},
+ };
+};
+} // OHOS
+#endif
\ No newline at end of file
srv_ble_add_chart_decr_andriod(server_id,srv_handle);//对18e0这个服务进行添加andiod特征值和描述符\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "srv_ble_add_chart_decr_andriod \r\n");\r
\r
- srv_ble_add_chart_decr_battery(server_id,srv_handle);//电池电量特征值\r
+ // srv_ble_add_chart_decr_battery(server_id,srv_handle);//电池电量特征值\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "srv_ble_add_chart_decr_battery \r\n");\r
srv_ble_add_chart_decr_short_cmd(server_id,srv_handle);\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "srv_ble_add_chart_decr_short_cmd \r\n");\r