• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 CALL_OBJECT_MANAGER_H
17 #define CALL_OBJECT_MANAGER_H
18 
19 #include <cstdio>
20 #include <cstdlib>
21 #include <list>
22 #include <memory>
23 #include <mutex>
24 
25 #include "refbase.h"
26 
27 #include "call_base.h"
28 #include "common_type.h"
29 #include "call_manager_inner_type.h"
30 
31 namespace OHOS {
32 namespace Telephony {
33 class CallObjectManager {
34 public:
35     CallObjectManager();
36     virtual ~CallObjectManager();
37 
38     static int32_t AddOneCallObject(sptr<CallBase> &call);
39     static int32_t DeleteOneCallObject(int32_t callId);
40     static void DeleteOneCallObject(sptr<CallBase> &call);
41     static sptr<CallBase> GetOneCallObject(int32_t callId);
42     static sptr<CallBase> GetOneCallObject(std::string &phoneNumber);
43     static int32_t HasNewCall();
44     static int32_t IsNewCallAllowedCreate(bool &enabled);
45     static int32_t GetCarrierCallList(std::list<int32_t> &list);
46     static bool HasRingingMaximum();
47     static bool HasDialingMaximum();
48     static int32_t HasEmergencyCall(bool &enabled);
49     static int32_t GetNewCallId();
50     static bool IsCallExist(int32_t callId);
51     static bool IsCallExist(std::string &phoneNumber);
52     static bool HasCallExist();
53     static int32_t HasRingingCall(bool &enabled);
54     static TelCallState GetCallState(int32_t callId);
55     static sptr<CallBase> GetOneCallObject(CallRunningState callState);
56     static bool IsCallExist(CallType type, TelCallState callState);
57     static bool IsCallExist(TelCallState callState);
58     static bool IsCallExist(TelCallState callState, int32_t &callId);
59     static bool IsConferenceCallExist(TelConferenceState state, int32_t &callId);
60     static int32_t GetCallNum(TelCallState callState);
61     static std::string GetCallNumber(TelCallState callState);
62     static std::vector<CallAttributeInfo> GetCallInfoList(int32_t slotId);
63 private:
64     static std::list<sptr<CallBase>> callObjectPtrList_;
65     static std::mutex listMutex_;
66     static int32_t callId_;
67 };
68 } // namespace Telephony
69 } // namespace OHOS
70 
71 #endif // CALL_OBJECT_MANAGER_H
72