1 /*
2  * Copyright (C) 2021-2022 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 TEL_RIL_CALL_H
17 #define TEL_RIL_CALL_H
18 
19 #include "tel_ril_call_parcel.h"
20 #include "tel_ril_base.h"
21 
22 namespace OHOS {
23 namespace Telephony {
24 class TelRilCall : public TelRilBase {
25 public:
26     TelRilCall(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
27         std::shared_ptr<ObserverHandler> observerHandler, std::shared_ptr<TelRilHandler> handler);
28     ~TelRilCall() = default;
29 
30     int32_t GetCallList(const AppExecFwk::InnerEvent::Pointer &result);
31     int32_t Dial(const std::string address, int32_t clirMode, const AppExecFwk::InnerEvent::Pointer &result);
32     int32_t Reject(const AppExecFwk::InnerEvent::Pointer &result);
33     int32_t Hangup(int32_t gsmIndex, const AppExecFwk::InnerEvent::Pointer &result);
34     int32_t Answer(const AppExecFwk::InnerEvent::Pointer &result);
35     int32_t HoldCall(const AppExecFwk::InnerEvent::Pointer &result);
36     int32_t UnHoldCall(const AppExecFwk::InnerEvent::Pointer &result);
37     int32_t SwitchCall(const AppExecFwk::InnerEvent::Pointer &result);
38     int32_t SeparateConference(int32_t callIndex, int32_t callType, const AppExecFwk::InnerEvent::Pointer &result);
39     int32_t CombineConference(int32_t callType, const AppExecFwk::InnerEvent::Pointer &result);
40     int32_t CallSupplement(int32_t type, const AppExecFwk::InnerEvent::Pointer &result);
41     int32_t GetCallWaiting(const AppExecFwk::InnerEvent::Pointer &result);
42     int32_t SetCallWaiting(int32_t activate, const AppExecFwk::InnerEvent::Pointer &result);
43     int32_t GetCallTransferInfo(int32_t reason, const AppExecFwk::InnerEvent::Pointer &result);
44     int32_t SetCallTransferInfo(int32_t reason, int32_t mode, std::string number, int32_t classx,
45         const AppExecFwk::InnerEvent::Pointer &result);
46     int32_t GetClip(const AppExecFwk::InnerEvent::Pointer &result);
47     int32_t SetClip(const int32_t action, const AppExecFwk::InnerEvent::Pointer &result);
48     int32_t GetClir(const AppExecFwk::InnerEvent::Pointer &result);
49     int32_t SetClir(const int32_t action, const AppExecFwk::InnerEvent::Pointer &result);
50     int32_t GetCallRestriction(std::string fac, const AppExecFwk::InnerEvent::Pointer &result);
51     int32_t SetCallRestriction(std::string restrictionType,
52         int32_t mode, std::string password, const AppExecFwk::InnerEvent::Pointer &result);
53     int32_t SendDtmfString(const std::string &sDTMFCode, int32_t index, int32_t switchOn, int32_t switchOff,
54         const AppExecFwk::InnerEvent::Pointer &result);
55     int32_t SendDtmf(char cDTMFCode, int32_t index, const AppExecFwk::InnerEvent::Pointer &result);
56     int32_t StartDtmf(char cDTMFCode, int32_t index, const AppExecFwk::InnerEvent::Pointer &result);
57     int32_t StopDtmf(int32_t index, const AppExecFwk::InnerEvent::Pointer &result);
58     int32_t SetCallPreferenceMode(const int32_t mode, const AppExecFwk::InnerEvent::Pointer &result);
59     int32_t GetCallPreferenceMode(const AppExecFwk::InnerEvent::Pointer &result);
60     int32_t SetUssd(const std::string str, const AppExecFwk::InnerEvent::Pointer &result);
61     int32_t GetUssd(const AppExecFwk::InnerEvent::Pointer &result);
62     int32_t SetMute(const int32_t mute, const AppExecFwk::InnerEvent::Pointer &result);
63     int32_t GetMute(const AppExecFwk::InnerEvent::Pointer &result);
64     int32_t GetEmergencyCallList(const AppExecFwk::InnerEvent::Pointer &result);
65     int32_t SetEmergencyCallList(
66         const std::vector<EmergencyCall> &eccVec, const AppExecFwk::InnerEvent::Pointer &result);
67     int32_t GetCallFailReason(const AppExecFwk::InnerEvent::Pointer &result);
68     int32_t SetBarringPassword(std::string fac, const char *oldPassword,
69         const char *newPassword, const AppExecFwk::InnerEvent::Pointer &result);
70     int32_t CloseUnFinishedUssd(const AppExecFwk::InnerEvent::Pointer &result);
71     int32_t AnswerResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
72     int32_t GetCallListResponse(
73         const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const HDI::Ril::V1_1::CallInfoList &callList);
74     int32_t DialResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
75     int32_t HangupResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
76     int32_t RejectResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
77     int32_t HoldCallResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
78     int32_t UnHoldCallResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
79     int32_t SwitchCallResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
80     int32_t CombineConferenceResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
81     int32_t SeparateConferenceResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
82     int32_t CallSupplementResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
83     int32_t GetCallWaitingResponse(
84         const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const HDI::Ril::V1_1::CallWaitResult &callWaitResult);
85     int32_t SetCallTransferInfoResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
86     int32_t GetCallTransferInfoResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
87         const HDI::Ril::V1_1::CallForwardQueryInfoList &cFQueryList);
88     int32_t GetClipResponse(
89         const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const HDI::Ril::V1_1::GetClipResult &getClipResult);
90     int32_t SetClipResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
91     int32_t GetClirResponse(
92         const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const HDI::Ril::V1_1::GetClirResult &getClirResult);
93     int32_t SetClirResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
94     int32_t GetCallRestrictionResponse(
95         const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const HDI::Ril::V1_1::CallRestrictionResult &result);
96     int32_t SetCallRestrictionResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
97     int32_t SetCallWaitingResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
98     int32_t SendDtmfResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
99     int32_t StartDtmfResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
100     int32_t StopDtmfResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
101     int32_t SetCallPreferenceModeResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
102     int32_t GetCallPreferenceModeResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t mode);
103     int32_t SetUssdResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
104     int32_t GetUssdResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t cusd);
105     int32_t SetMuteResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
106     int32_t GetMuteResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t mute);
107     int32_t GetEmergencyCallListResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
108         const HDI::Ril::V1_1::EmergencyInfoList &emergencyInfoList);
109     int32_t SetEmergencyCallListResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
110     int32_t GetCallFailReasonResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t callFail);
111     int32_t SetBarringPasswordResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
112     int32_t CallStateUpdated();
113     int32_t CallUssdNotice(const HDI::Ril::V1_1::UssdNoticeInfo &ussdNoticeInfo);
114     int32_t CallSsNotice(const HDI::Ril::V1_1::SsNoticeInfo &ssNoticeInfo);
115     int32_t CallRingbackVoiceNotice(const HDI::Ril::V1_1::RingbackVoice &ringbackVoice);
116     int32_t CallSrvccStatusNotice(const HDI::Ril::V1_1::SrvccStatus &srvccStatus);
117     int32_t CallEmergencyNotice(const HDI::Ril::V1_1::EmergencyInfoList &emergencyInfoList);
118     int32_t CallRsrvccStatusNotify();
119     int32_t CloseUnFinishedUssdResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
120     int32_t SetVoNRSwitch(int32_t state, const AppExecFwk::InnerEvent::Pointer &result);
121     int32_t SetVoNRSwitchResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
122 
123 private:
124     void BuildEmergencyInfoList(std::shared_ptr<EmergencyInfoList> emergencyCallList,
125         const HDI::Ril::V1_1::EmergencyInfoList &emergencyInfoList);
126     void BuildCallInfoList(std::shared_ptr<CallInfoList> callInfoList,
127         const HDI::Ril::V1_1::CallInfoList &iCallInfoList);
128     void BuildCFQueryInfoList(std::shared_ptr<CallForwardQueryInfoList> cFQueryInfoList,
129         const HDI::Ril::V1_1::CallForwardQueryInfoList &cFQueryList);
130     int32_t ResponseSupplement(const char *funcName, const HDI::Ril::V1_1::RilRadioResponseInfo &iResponseInfo);
131 };
132 } // namespace Telephony
133 } // namespace OHOS
134 #endif // TEL_RIL_CALL_H
135