mcu_hi3321_watch/tjd/ui/app/phone/call_app/TjdUiAppCallPresenter.h
2025-05-26 20:15:20 +08:00

78 lines
2.5 KiB
C++

/*----------------------------------------------------------------------------
* Copyright (c) TJD Technologies Co., Ltd. 2025. All rights reserved.
*
* Description: TjdUiAppCallPresenter.h
*
* Author: luziquan@ss-tjd.com
*
* Create: 2025-08-16
*--------------------------------------------------------------------------*/
#ifndef TJD_UI_APP_CALL_PRESENTER_H
#define TJD_UI_APP_CALL_PRESENTER_H
#include "Presenter.h"
#include "components/root_view.h"
#include "components/ui_slider.h"
#include "components/ui_view.h"
#include "graphic_timer.h"
#include <list>
#include <string>
#define BTN_DIAL_CALL_END_VIEW_ID "btn_dial_call_end_view"
#define BTN_CALL_IN_STOP_VIEW_ID "btn_call_in_stop_view"
#define BTN_CALL_IN_ANSWER_VIEW_ID "btn_call_in_answer_view"
namespace TJD {
enum CallViewIndex
{
CALL_CALL_OUT, // 拨出界面
CALL_CALLING, // 通话中界面
CALL_END, // 通话结束界面
CALL_UNKNOWN
};
class TjdUiAppCallView;
class TjdUiAppCallPresenter : public OHOS::Presenter<TjdUiAppCallView>,
public OHOS::UIView::OnClickListener,
public OHOS::UIView::OnRotateListener,
public OHOS::RootView::OnKeyActListener
{
public:
TjdUiAppCallPresenter();
virtual ~TjdUiAppCallPresenter();
static TjdUiAppCallPresenter *GetInstance(void);
void OnStart() override;
void OnStop() override;
bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event) override;
bool OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event) override;
bool OnRotateStart(OHOS::UIView &view, const OHOS::RotateEvent &event) override;
bool OnRotate(OHOS::UIView &view, const OHOS::RotateEvent &event) override;
bool OnRotateEnd(OHOS::UIView &view, const OHOS::RotateEvent &event) override { return true; }
void PhoneServiceCallChangedCb(std::string name, int state);
std::string &GetCallingNumber(void);
void ClickCallEndEvent(void);
/* 设置退出时会直接进入的页面 */
static void SetQuickChangeSlice(int16_t slice) { quickChangeSlice = slice; }
static int16_t quickChangeSlice;
private:
void StartJumpTimer();
osTimerId_t jumpTimerId_{nullptr};
osTimerId_t CountingTimerId_{nullptr};
osTimerId_t volumeBarHideTimerId_{nullptr};
void StartHideVolumeBarTimer();
void ResetHideVolumeBarTimer();
void StopCallingTimer();
void CallTimerCallbackProc(int data);
void StartCallingTimer();
std::string &DisplayCallDuration();
std::string callDuration;
};
} // namespace TJD
#endif