1/*
2 * Copyright (C) 2022-2023 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_IMS_CALL_PROXY_H
17#define TELEPHONY_IMS_CALL_PROXY_H
18
19#include "ims_call_interface.h"
20#include "ims_call_ipc_interface_code.h"
21#include "ims_feature.h"
22#include "iremote_proxy.h"
23#include "telephony_log_wrapper.h"
24
25namespace OHOS {
26namespace Telephony {
27class ImsCallProxy : public IRemoteProxy<ImsCallInterface> {
28public:
29    explicit ImsCallProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<ImsCallInterface>(impl) {}
30    ~ImsCallProxy() = default;
31    int32_t Dial(const ImsCallInfo &callInfo, CLIRMode mode) override;
32    int32_t HangUp(const ImsCallInfo &callInfo) override;
33    int32_t RejectWithReason(const ImsCallInfo &callInfo, const ImsRejectReason &reason) override;
34    int32_t Answer(const ImsCallInfo &callInfo) override;
35    int32_t HoldCall(int32_t slotId, int32_t callType) override;
36    int32_t UnHoldCall(int32_t slotId, int32_t callType) override;
37    int32_t SwitchCall(int32_t slotId, int32_t callType) override;
38    int32_t CombineConference(int32_t slotId) override;
39    int32_t InviteToConference(int32_t slotId, const std::vector<std::string> &numberList) override;
40    int32_t KickOutFromConference(int32_t slotId, int32_t index) override;
41    int32_t SendUpdateCallMediaModeRequest(const ImsCallInfo &callInfo, ImsCallType callType) override;
42    int32_t SendUpdateCallMediaModeResponse(const ImsCallInfo &callInfo, ImsCallType callType) override;
43    int32_t CancelCallUpgrade(int32_t slotId, int32_t callIndex) override;
44    int32_t RequestCameraCapabilities(int32_t slotId, int32_t callIndex) override;
45    int32_t GetImsCallsDataRequest(int32_t slotId, int64_t lastCallsDataFlag) override;
46    int32_t GetLastCallFailReason(int32_t slotId) override;
47
48    int32_t StartDtmf(int32_t slotId, char cDtmfCode, int32_t index) override;
49    int32_t SendDtmf(int32_t slotId, char cDtmfCode, int32_t index) override;
50    int32_t StopDtmf(int32_t slotId, int32_t index) override;
51    int32_t StartRtt(int32_t slotId, const std::string &msg) override;
52    int32_t StopRtt(int32_t slotId) override;
53
54    int32_t SetDomainPreferenceMode(int32_t slotId, int32_t mode) override;
55    int32_t GetDomainPreferenceMode(int32_t slotId) override;
56    int32_t SetImsSwitchStatus(int32_t slotId, int32_t active) override;
57    int32_t GetImsSwitchStatus(int32_t slotId) override;
58    int32_t SetImsConfig(ImsConfigItem item, const std::string &value) override;
59    int32_t SetImsConfig(ImsConfigItem item, int32_t value) override;
60    int32_t GetImsConfig(ImsConfigItem item) override;
61    int32_t SetImsFeatureValue(FeatureType type, int32_t value) override;
62    int32_t GetImsFeatureValue(FeatureType type, int32_t &value) override;
63    int32_t SetMute(int32_t slotId, int32_t mute) override;
64    int32_t GetMute(int32_t slotId) override;
65
66    int32_t ControlCamera(int32_t slotId, int32_t callIndex, const std::string &cameraId) override;
67    int32_t SetPreviewWindow(
68        int32_t slotId, int32_t callIndex, const std::string &surfaceID, sptr<Surface> surface) override;
69    int32_t SetDisplayWindow(
70        int32_t slotId, int32_t callIndex, const std::string &surfaceID, sptr<Surface> surface) override;
71    int32_t SetCameraZoom(float zoomRatio) override;
72    int32_t SetPausePicture(int32_t slotId, int32_t callIndex, const std::string &path) override;
73    int32_t SetDeviceDirection(int32_t slotId, int32_t callIndex, int32_t rotation) override;
74
75    int32_t SetClip(int32_t slotId, int32_t action, int32_t index) override;
76    int32_t GetClip(int32_t slotId, int32_t index) override;
77    int32_t SetClir(int32_t slotId, int32_t action, int32_t index) override;
78    int32_t GetClir(int32_t slotId, int32_t index) override;
79    int32_t SetCallTransfer(int32_t slotId, const CallTransferInfo &cfInfo, int32_t classType, int32_t index) override;
80    int32_t CanSetCallTransferTime(int32_t slotId, bool &result) override;
81    int32_t GetCallTransfer(int32_t slotId, int32_t reason, int32_t index) override;
82    int32_t SetCallRestriction(
83        int32_t slotId, const std::string &fac, int32_t mode, const std::string &pw, int32_t index) override;
84    int32_t GetCallRestriction(int32_t slotId, const std::string &fac, int32_t index) override;
85    int32_t SetCallWaiting(int32_t slotId, bool activate, int32_t classType, int32_t index) override;
86    int32_t GetCallWaiting(int32_t slotId, int32_t index) override;
87    int32_t SetColr(int32_t slotId, int32_t presentation, int32_t index) override;
88    int32_t GetColr(int32_t slotId, int32_t index) override;
89    int32_t SetColp(int32_t slotId, int32_t action, int32_t index) override;
90    int32_t GetColp(int32_t slotId, int32_t index) override;
91
92    int32_t RegisterImsCallCallback(const sptr<ImsCallCallbackInterface> &callback) override;
93    int32_t UpdateImsCapabilities(int32_t slotId, const ImsCapabilityList &imsCapabilityList) override;
94    int32_t GetUtImpuFromNetwork(int32_t slotId, std::string &impu) override;
95
96private:
97    int32_t WriteCommonInfo(int32_t slotId, std::string funcName, MessageParcel &in);
98    int32_t WriteCommonInfo(int32_t slotId, std::string funcName, MessageParcel &in, int32_t callType);
99    int32_t SendRequest(MessageParcel &in, int32_t eventId);
100    int32_t SendRequest(int32_t slotId, MessageParcel &in, int32_t eventId);
101
102private:
103    static inline BrokerDelegator<ImsCallProxy> delegator_;
104};
105} // namespace Telephony
106} // namespace OHOS
107
108#endif // TELEPHONY_IMS_CALL_PROXY_H
109