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 CONFERENCE_BASE_H 17 #define CONFERENCE_BASE_H 18 19 #include <unistd.h> 20 #include <cstdio> 21 #include <cstdlib> 22 #include <set> 23 #include <memory> 24 #include <mutex> 25 26 #include "call_manager_inner_type.h" 27 28 namespace OHOS { 29 namespace Telephony { 30 constexpr uint16_t CS_CONFERENCE_MIN_CALLS_CNT = 2; 31 constexpr uint16_t CS_CONFERENCE_MAX_CALLS_CNT = 5; 32 33 enum ConferenceState { 34 CONFERENCE_STATE_IDLE = 0, 35 CONFERENCE_STATE_CREATING, 36 CONFERENCE_STATE_HOLDING, 37 CONFERENCE_STATE_ACTIVE, 38 CONFERENCE_STATE_LEAVING, 39 }; 40 41 class ConferenceBase { 42 public: 43 ConferenceBase(); 44 virtual ~ConferenceBase(); 45 int32_t GetMainCall(); // get host call id 46 int32_t SetMainCall(int32_t callId); 47 ConferenceState GetConferenceState(); 48 void SetConferenceState(ConferenceState state); 49 virtual int32_t JoinToConference(int32_t callId) = 0; 50 virtual int32_t LeaveFromConference(int32_t callId) = 0; 51 virtual int32_t HoldConference(int32_t callId) = 0; 52 virtual int32_t CanCombineConference() = 0; 53 virtual int32_t CanSeparateConference() = 0; 54 int32_t GetSubCallIdList( 55 int32_t callId, std::vector<std::u16string> &callIdList); // get participant list except host 56 int32_t GetCallIdListForConference( 57 int32_t callId, std::vector<std::u16string> &callIdList); // get participant list besides host 58 59 protected: 60 int32_t mainCallId_; 61 ConferenceState state_; 62 std::set<int32_t> subCallIdSet_; 63 std::mutex conferenceMutex_; 64 time_t beginTime_; 65 CallType conferenceType_; 66 }; 67 } // namespace Telephony 68 } // namespace OHOS 69 70 #endif 71