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 IMS_CALL_H
17 #define IMS_CALL_H
18 
19 #include "carrier_call.h"
20 #include "net_call_base.h"
21 #include "video_call_state.h"
22 
23 namespace OHOS {
24 namespace Telephony {
25 class IMSCall : public CarrierCall, public NetCallBase {
26 public:
27     IMSCall(DialParaInfo &info);
28     IMSCall(DialParaInfo &info, AppExecFwk::PacMap &extras);
29     ~IMSCall();
30     int32_t InitVideoCall() override;
31     int32_t DialingProcess() override;
32     int32_t AnswerCall(int32_t videoState) override;
33     int32_t RejectCall() override;
34     int32_t HangUpCall() override;
35     int32_t HoldCall() override;
36     int32_t UnHoldCall() override;
37     int32_t SwitchCall() override;
38     void GetCallAttributeInfo(CallAttributeInfo &info) override;
39     int32_t CombineConference() override;
40     void HandleCombineConferenceFailEvent() override;
41     int32_t SeparateConference() override;
42     int32_t KickOutFromConference() override;
43     int32_t CanCombineConference() override;
44     int32_t CanSeparateConference() override;
45     int32_t CanKickOutFromConference() override;
46     int32_t LaunchConference() override;
47     int32_t ExitConference() override;
48     int32_t HoldConference() override;
49     int32_t GetMainCallId(int32_t &mainCallId) override;
50     int32_t GetSubCallIdList(std::vector<std::u16string> &callIdList) override;
51     int32_t GetCallIdListForConference(std::vector<std::u16string> &callIdList) override;
52     int32_t IsSupportConferenceable() override;
53     int32_t StartRtt(std::u16string &msg);
54     int32_t StopRtt();
55     int32_t SetMute(int32_t mute, int32_t slotId) override;
56     int32_t UpdateImsCallMode(ImsCallMode mode) override;
57     int32_t SendUpdateCallMediaModeRequest(ImsCallMode mode) override;
58     int32_t RecieveUpdateCallMediaModeRequest(CallModeReportInfo &response) override;
59     int32_t SendUpdateCallMediaModeResponse(ImsCallMode mode) override;
60     int32_t ReceiveUpdateCallMediaModeResponse(CallModeReportInfo &response) override;
61     int32_t ReportImsCallModeInfo(CallMediaModeInfo &imsCallModeInfo) override;
62     void SwitchVideoState(ImsCallMode mode);
63     bool IsSupportVideoCall();
64     sptr<VideoCallState> GetCallVideoState(ImsCallMode mode);
65     int32_t ControlCamera(std::string &cameraId, int32_t callingUid, int32_t callingPid) override;
66     int32_t SetPreviewWindow(std::string &surfaceId, sptr<Surface> surface) override;
67     int32_t SetDisplayWindow(std::string &surfaceId, sptr<Surface> surface) override;
68     int32_t SetPausePicture(std::string &path) override;
69     int32_t SetDeviceDirection(int32_t rotation) override;
70     int32_t CancelCallUpgrade() override;
71     int32_t RequestCameraCapabilities() override;
72     bool IsVoiceModifyToVideo();
73 
74 private:
75     void AssignVideoCallState(VideoStateType videoStateType);
76 
77 private:
78     std::mutex videoUpdateMutex_;
79     sptr<VideoCallState> videoCallState_;
80     bool isInitialized_;
81     std::map<ImsCallMode, sptr<VideoCallState>> videoStateMap_;
82 };
83 } // namespace Telephony
84 } // namespace OHOS
85 
86 #endif // IMS_CALL_H
87