1 /* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef TELEPHONY_CALL_STATE_PROCESSOR_H 17 #define TELEPHONY_CALL_STATE_PROCESSOR_H 18 19 #include <set> 20 #include <string> 21 22 #include "singleton.h" 23 24 #include "call_manager_inner_type.h" 25 26 namespace OHOS { 27 namespace Telephony { 28 constexpr uint16_t EMPTY_VALUE = 0; 29 constexpr uint16_t EXIST_ONLY_ONE_CALL = 1; 30 31 class CallStateProcessor : public std::enable_shared_from_this<CallStateProcessor> { 32 DECLARE_DELAYED_SINGLETON(CallStateProcessor) 33 public: 34 void AddCall(const std::string &phoneNum, TelCallState state); 35 void DeleteCall(const std::string &phoneNum, TelCallState state); 36 bool UpdateCurrentCallState(); 37 std::string GetCurrentActiveCall() const; 38 int32_t GetCallNumber(TelCallState state); 39 bool ShouldSwitchState(TelCallState callState); 40 41 private: 42 std::set<std::string> activeCalls_; 43 std::set<std::string> holdingCalls_; 44 std::set<std::string> alertingCalls_; 45 std::set<std::string> incomingCalls_; 46 std::set<std::string> dialingCalls_; 47 }; 48 } // namespace Telephony 49 } // namespace OHOS 50 #endif // TELEPHONY_CALL_STATE_PROCESSOR_H