1 /* 2 * Copyright (C) 2021-2024 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_REQUEST_HANDLER_H 17 #define CALL_REQUEST_HANDLER_H 18 19 #include <map> 20 #include <memory> 21 #include <mutex> 22 23 #include "call_request_process.h" 24 #include "common_type.h" 25 #include "event_handler.h" 26 #include "event_runner.h" 27 28 namespace OHOS { 29 namespace Telephony { 30 struct AnswerCallPara { 31 int32_t callId = 0; 32 int32_t videoState = 0; 33 }; 34 35 struct RejectCallPara { 36 int32_t callId = 0; 37 bool isSendSms = 0; 38 char content[REJECT_CALL_MSG_MAX_LEN + 1] = { 0 }; 39 }; 40 41 struct StartRttPara { 42 int32_t callId = 0; 43 std::u16string msg = u""; 44 }; 45 46 struct CallMediaUpdatePara { 47 int32_t callId = 0; 48 ImsCallMode mode = ImsCallMode::CALL_MODE_AUDIO_ONLY; 49 }; 50 51 struct JoinConferencePara { 52 int32_t callId = 0; 53 std::vector<std::string> numberList {}; 54 }; 55 56 /** 57 * @ClassName: CallRequestHandler 58 * @Description: inner event-handle mechanism on harmony platform, used by callcontrolmanager 59 * to handle downflowed telephone business, factually act as work thread. 60 */ 61 class CallRequestHandler { 62 public: 63 CallRequestHandler(); 64 ~CallRequestHandler(); 65 void Init(); 66 int32_t DialCall(); 67 int32_t AnswerCall(int32_t callId, int32_t videoState); 68 int32_t RejectCall(int32_t callId, bool isSendSms, std::string &content); 69 int32_t HangUpCall(int32_t callId); 70 int32_t HoldCall(int32_t callId); 71 int32_t UnHoldCall(int32_t callId); 72 int32_t SwitchCall(int32_t callId); 73 int32_t CombineConference(int32_t mainCallId); 74 int32_t SeparateConference(int32_t callId); 75 int32_t KickOutFromConference(int32_t callId); 76 int32_t StartRtt(int32_t callId, std::u16string &msg); 77 int32_t StopRtt(int32_t callId); 78 int32_t JoinConference(int32_t callId, std::vector<std::string> &numberList); 79 80 private: 81 std::shared_ptr<CallRequestProcess> callRequestProcessPtr_; 82 }; 83 } // namespace Telephony 84 } // namespace OHOS 85 #endif // CALL_REQUEST_HANDLER_H 86