mcu_hi3321_watch/tjd/ui/app/ota/TjdUiAppOtaView.h
2025-05-26 20:15:20 +08:00

80 lines
2.1 KiB
C++

#ifndef TJD_UI_APP_OTA_VIEW_H
#define TJD_UI_APP_OTA_VIEW_H
#include "View.h"
#include "TjdUiAppOtaPresenter.h"
#include "components/ui_label.h"
#include "components/ui_label_button_ext.h"
#include "components/ui_list.h"
#include "components/ui_scroll_view.h"
#include "components/ui_image_view.h"
#include "common/image.h"
#include "components/ui_view.h"
#include "gfx_utils/graphic_types.h"
#include "TjdUiMemManage.h"
#include "diag_service.h"
#include "upg.h"
namespace TJD {
enum OtaViewIndex
{
OTA_UPGRADE_VIEW,
OTA_INTERRUPT_VIEW,
OTA_FAIL_VIEW,
OTA_VIEW_COUNT
};
enum UpgradeStatus
{
NPGRADE_NORMAL,
NPGRADE_INTERRUPT,
NPGRADE_ERROR
};
class TjdUiAppOtaPresenter;
class TjdUiAppOtaView : public OHOS::View<TjdUiAppOtaPresenter>, public OHOS::UIViewGroup
{
public:
TjdUiAppOtaView();
~TjdUiAppOtaView();
static TjdUiAppOtaView *GetInstance(void);
void OnStart() override;
void OnStop() override;
void ShowView(OtaViewIndex hideView, OtaViewIndex showView);
void SetOtaVal(int val);
void SetUpgrate(void);
void SetOtaSchedule(uint32_t val){otaSchedul = val;}
uint32_t GetOtaSchedule(void){return otaSchedul;}
OHOS::GraphicTimer* GetOtaSchedultimer(){return timer_;}
private:
OtaViewIndex currentView_{OtaViewIndex::OTA_UPGRADE_VIEW};
void InitImage();
OHOS::UIViewGroup *containerAll_{nullptr};
OHOS::UIViewGroup *otaView[OTA_VIEW_COUNT]{nullptr};
OHOS::UIViewGroup *InitOtaUpgradeView();
OHOS::UIViewGroup *InitOtaInterruptView();
OHOS::UIViewGroup *InitOtaFailView();
OHOS::UIImageView *otaUpg_{nullptr};
OHOS::UIImageView *otaEnter_{nullptr};
OHOS::UIImageView *otaInterrupt_{nullptr};
OHOS::UIImageView *otaFail_{nullptr};
OHOS::UILabel *lblUpgrade_{nullptr};
OHOS::UILabel *lblUpgNum_{nullptr};
OHOS::UILabel *lblUpgPercent_{nullptr};
OHOS::UILabel *lblInterrupt_{nullptr};
OHOS::UILabel *lblFail_{nullptr};
OHOS::UILabel *lblFailMac_{nullptr};
OHOS::UILabel *lblFailNum_{nullptr};
OHOS::UISlider *sldotaupg_{nullptr};
OHOS::GraphicTimer* timer_{nullptr};
uint32_t otaSchedul;
};
}//TJD
#endif