/* * Copyright (C) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CALL_OBJECT_MANAGER_H #define CALL_OBJECT_MANAGER_H #include #include #include #include #include #include #include "refbase.h" #include "call_base.h" #include "common_type.h" #include "call_manager_inner_type.h" namespace OHOS { namespace Telephony { class CallObjectManager { public: CallObjectManager(); virtual ~CallObjectManager(); static int32_t AddOneCallObject(sptr &call); static void DelayedDisconnectCallConnectAbility(); static int32_t DeleteOneCallObject(int32_t callId); static void DeleteOneCallObject(sptr &call); static sptr GetOneCallObject(int32_t callId); static sptr GetOneCallObject(std::string &phoneNumber); static sptr GetOneCallObjectByIndex(int32_t index); static sptr GetOneCallObjectByIndexAndSlotId(int32_t index, int32_t slotId); static sptr GetOneCallObjectByVoipCallId(std::string voipCallId, std::string bundleName, int32_t uid); static void UpdateOneCallObjectByCallId(int32_t callId, TelCallState nextCallState); static int32_t HasNewCall(); static int32_t IsNewCallAllowedCreate(bool &enabled); static int32_t GetCurrentCallNum(); static int32_t GetCarrierCallList(std::list &list); static int32_t GetVoipCallNum(); static int32_t GetVoipCallList(std::list &list); static bool HasRingingMaximum(); static bool HasDialingMaximum(); static int32_t HasEmergencyCall(bool &enabled); static int32_t GetNewCallId(); static bool IsCallExist(int32_t callId); static bool IsCallExist(std::string &phoneNumber); static bool HasCallExist(); static int32_t HasRingingCall(bool &hasRingingCall); static int32_t HasHoldCall(bool &hasHoldCall); static TelCallState GetCallState(int32_t callId); static sptr GetOneCallObject(CallRunningState callState); static bool IsCallExist(CallType type, TelCallState callState); static bool IsCallExist(TelCallState callState); static bool IsCallExist(TelCallState callState, int32_t &callId); static bool IsConferenceCallExist(TelConferenceState state, int32_t &callId); static int32_t GetCallNum(TelCallState callState, bool isIncludeVoipCall = true); static std::string GetCallNumber(TelCallState callState, bool isIncludeVoipCall = true); static std::vector GetCallInfoList(int32_t slotId); static sptr GetForegroundCall(bool isIncludeVoipCall = true); static sptr GetForegroundLiveCall(); static std::vector GetAllCallInfoList(); int32_t DealFailDial(sptr call); static bool HasVideoCall(); static std::list> GetAllCallList(); static bool HasCellularCallExist(); static bool HasVoipCallExist(); static bool HasIncomingCallCrsType(); static CellularCallInfo GetDialCallInfo(); static bool HasSatelliteCallExist(); static int32_t GetSatelliteCallList(std::list &list); static int32_t GetCallNumByRunningState(CallRunningState callState); protected: static std::condition_variable cv_; static bool isFirstDialCallAdded_; static bool needWaitHold_; static CellularCallInfo dialCallInfo_; private: static std::list> callObjectPtrList_; static std::mutex listMutex_; static int32_t callId_; }; } // namespace Telephony } // namespace OHOS #endif // CALL_OBJECT_MANAGER_H