/*---------------------------------------------------------------------------- * Copyright (c) TJD Technologies Co., Ltd. 2025. All rights reserved. * * Description: TjdUiAppCallModel.h * * Author: luziquan@ss-tjd.com * * Create: 2025-08-16 *--------------------------------------------------------------------------*/ #ifndef TJD_UI_APP_CALL_MODEL_H #define TJD_UI_APP_CALL_MODEL_H #include "cmsis_os2.h" #include #include #include namespace TJD { enum ShowCallViewType { CALL_OUT_VIEW = 0, CALLING_VIEW, }; typedef void (*CallOutCallBack)(void); class TjdUiAppCallModel { public: static TjdUiAppCallModel &GetInstance(void) { static TjdUiAppCallModel instance; return instance; }; static void InitCallService(void); // 设置打开View后显示的页面 void SetShowViewType(ShowCallViewType type) { showCallViewType_ = type; } ShowCallViewType GetShowViewType(void) { return showCallViewType_; } void SetCallingTest(const std::string str) { callingTest_ = str; } std::string &GetCallingNumber(void) { return callingTest_; } void SetCallTime(int time) { callTime_ = time; } int GetCallTime(void) { return callTime_; } void RegisterCallOutCallBack(CallOutCallBack callBack) { callOutCallBackList_.push_back(callBack); } void UngisterCallOutCallBack(CallOutCallBack callBack) { callOutCallBackList_.remove(callBack); } void CallOutCallBackList(void) { for (auto &callBack : callOutCallBackList_) { callBack(); } } private: std::list callOutCallBackList_; TjdUiAppCallModel(){}; ~TjdUiAppCallModel(){}; ShowCallViewType showCallViewType_{CALL_OUT_VIEW}; std::string callingTest_{"(NULL)"}; int callTime_{0}; }; } // namespace TJD #endif