• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-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 CELLULAR_CALL_PROXY_H
17 #define CELLULAR_CALL_PROXY_H
18 
19 #include "cellular_call_interface.h"
20 #include "cellular_call_ipc_interface_code.h"
21 #include "iremote_proxy.h"
22 
23 namespace OHOS {
24 namespace Telephony {
25 class CellularCallProxy : public IRemoteProxy<CellularCallInterface> {
26 public:
27     /**
28      * @brief Construct a new Cellular Call Proxy object
29      *
30      * @param impl
31      */
CellularCallProxy(const sptr<IRemoteObject> & impl)32     explicit CellularCallProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<CellularCallInterface>(impl) {}
33 
34     /**
35      * @brief Destroy the Cellular Call Proxy object
36      */
37     ~CellularCallProxy() = default;
38 
39     /**
40      * @brief dial a call
41      *
42      * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc
43      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
44      */
45     int32_t Dial(const CellularCallInfo &callInfo) override;
46 
47     /**
48      * @brief hang up a call
49      *
50      * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc
51      * @param type[in] Indicates the +CHLD related supplementary services.
52      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
53      */
54     int32_t HangUp(const CellularCallInfo &callInfo, CallSupplementType type) override;
55 
56     /**
57      * @brief reject a call
58      *
59      * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc
60      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
61      */
62     int32_t Reject(const CellularCallInfo &callInfo) override;
63 
64     /**
65      * @brief answer a call
66      *
67      * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc
68      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
69      */
70     int32_t Answer(const CellularCallInfo &callInfo) override;
71 
72     /**
73      * @brief hold a call
74      *
75      * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc
76      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
77      */
78     int32_t HoldCall(const CellularCallInfo &callInfo) override;
79 
80     /**
81      * @brief unhold a call
82      *
83      * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc
84      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
85      */
86     int32_t UnHoldCall(const CellularCallInfo &callInfo) override;
87 
88     /**
89      * @brief switch the call
90      *
91      * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc
92      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
93      */
94     int32_t SwitchCall(const CellularCallInfo &callInfo) override;
95 
96     /**
97      * @brief Checks whether the called number is an emergency number
98      *
99      * @param slotId[in] the slot id
100      * @param phoneNum[in] the phone number
101      * @param enabled[out] if the phone number is ecc, true is yes, false is no
102      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
103      */
104     int32_t IsEmergencyPhoneNumber(int32_t slotId, const std::string &phoneNum, bool &enabled) override;
105 
106     /**
107      * @brief Merge into multiple calls
108      *
109      * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc
110      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
111      */
112     int32_t CombineConference(const CellularCallInfo &callInfo) override;
113 
114     /**
115      * @brief Separate the Conference call
116      *
117      * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc
118      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
119      */
120     int32_t SeparateConference(const CellularCallInfo &callInfo) override;
121 
122     /**
123      * @brief Invite someone to the conference call
124      *
125      * @param numberList[in] the number list to invite to conference
126      * @param slotId[in] the slot id
127      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
128      */
129     int32_t InviteToConference(int32_t slotId, const std::vector<std::string> &numberList) override;
130 
131     /**
132      * @brief Kick out someone from the conference call
133      *
134      * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc
135      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
136      */
137     int32_t KickOutFromConference(const CellularCallInfo &callInfo) override;
138 
139     /**
140      * @brief Hang Up All Connection
141      *
142      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
143      */
144     int32_t HangUpAllConnection() override;
145 
146     /**
147      * @brief Hang Up All Connection
148      *
149      * @param slotId[in] the slot id
150      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
151      */
152     int32_t HangUpAllConnection(int32_t slotId) override;
153 
154     /**
155      * @brief set whether the device can make calls
156      *
157      * @param slotId[in] the slot id
158      * @param callType[in] indicate the call type is cs or ims. 0 is cs, 1 is ims
159      * @param isReadyToCall[in] indicate whether the device can make calls
160      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
161      */
162     int32_t SetReadyToCall(int32_t slotId, int32_t callType, bool isReadyToCall) override;
163 
164     /**
165      * @brief IMS Update Call Media Mode
166      *
167      * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc
168      * @param mode[in] indicate the call mode just like audio only, receive only .etc
169      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
170      */
171     int32_t UpdateImsCallMode(const CellularCallInfo &callInfo, ImsCallMode mode) override;
172 
173     /**
174      * @brief start to paly a dtmf tone
175      *
176      * @param cDtmfCode[in] A character indicate the DTMF digit for which to play the tone. This
177      * value must be one of {0~9}, {*} or {#}.
178      * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc
179      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
180      */
181     int32_t StartDtmf(char cDtmfCode, const CellularCallInfo &callInfo) override;
182 
183     /**
184      * @brief stop the playing dtmf tone
185      *
186      * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc
187      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
188      */
189     int32_t StopDtmf(const CellularCallInfo &callInfo) override;
190 
191     int32_t PostDialProceed(const CellularCallInfo &callInfo, const bool proceed) override;
192 
193     /**
194      * @brief play a dtmf tone
195      *
196      * @param cDtmfCode[in] A character indicate the DTMF digit for which to play the tone. This
197      * value must be one of {0~9}, {*} or {#}.
198      * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc
199      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
200      */
201     int32_t SendDtmf(char cDtmfCode, const CellularCallInfo &callInfo) override;
202 
203     /**
204      * @brief Start a Rtt session
205      *
206      * @param msg the rtt message
207      * @param slotId[in] the slot id
208      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
209      */
210     int32_t StartRtt(int32_t slotId, const std::string &msg) override;
211 
212     /**
213      * @brief Terminate the current RTT session
214      *
215      * @param slotId[in] the slot id
216      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
217      */
218     int32_t StopRtt(int32_t slotId) override;
219 
220     /**
221      * @brief set call transfer for the slot id
222      *
223      * @param ctInfo[in] contains the call transfer type, enable/disable, the transfered number, the start/end time
224      * @param slotId[in] the slot id
225      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
226      */
227     int32_t SetCallTransferInfo(int32_t slotId, const CallTransferInfo &cfInfo) override;
228 
229     /**
230      * @brief confirm whether IMS can set call transfer time
231      *
232      * @param slotId[in] the slot id
233      * @param result[out] whether IMS can set call transfer time. true mean yes, false mean no
234      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
235      */
236     int32_t CanSetCallTransferTime(int32_t slotId, bool &result) override;
237 
238     /**
239      * @brief Get Call Transfer information
240      *
241      * @param type[in] indicate the call transfer type, just like CFU, CFB, CFNRy, CFNRc
242      * @param slotId[in] the slot id
243      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
244      */
245     int32_t GetCallTransferInfo(int32_t slotId, CallTransferType type) override;
246 
247     /**
248      * @brief Set Call Waiting
249      *
250      * @param activate[in] true mean activate the call waiting, false mean inactivate
251      * @param slotId[in] the slot id
252      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
253      */
254     int32_t SetCallWaiting(int32_t slotId, bool activate) override;
255 
256     /**
257      * @brief Gets whether the call waiting service of the current account is enabled
258      *
259      * @param slotId[in] the slot id
260      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
261      */
262     int32_t GetCallWaiting(int32_t slotId) override;
263 
264     /**
265      * @brief Set the call restriction function for the current account
266      *
267      * @param cRInfo[in] contains the password, call restriction type and call restriction mode
268      * @param slotId[in] the slot id
269      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
270      */
271     int32_t SetCallRestriction(int32_t slotId, const CallRestrictionInfo &crInfo) override;
272 
273     /**
274      * @brief Set the call restriction password of the specified account
275      *
276      * @param slotId[in] the slot id
277      * @param fac[in] indicate the call restriction type, just like all incoming, all outgoing .etc
278      * @param oldPassword[in] indicate the call restriction old password
279      * @param newPassword[in] indicate the call restriction new password
280      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
281      */
282     int32_t SetCallRestrictionPassword(
283         int32_t slotId, CallRestrictionType fac, const char *oldPassword, const char *newPassword) override;
284 
285     /**
286      * @brief Gets the call restriction information of the specified account
287      *
288      * @param facType[in] indicate the call restriction type, just like all incoming, all outgoing .etc
289      * @param slotId[in] the slot id
290      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
291      */
292     int32_t GetCallRestriction(int32_t slotId, CallRestrictionType facType) override;
293 
294     /**
295      * @brief Register CallManager CallBack ptr
296      *
297      * @param callback callback ptr
298      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
299      */
300     int32_t RegisterCallManagerCallBack(const sptr<ICallStatusCallback> &callback) override;
301 
302     /**
303      * @brief UnRegister CallManager CallBack ptr
304      *
305      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
306      */
307     int32_t UnRegisterCallManagerCallBack() override;
308 
309     /**
310      * @brief Set Domain Preference Mode
311      *
312      * @param mode[in] indicate the domain preference, 1: CS only, 2: CS prefer, 3: PS prefer, 4: PS only
313      * @param slotId[in] the slot id
314      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
315      */
316     int32_t SetDomainPreferenceMode(int32_t slotId, int32_t mode) override;
317 
318     /**
319      * @brief Get Domain Preference Mode
320      *
321      * @param slotId[in] the slot id
322      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
323      */
324     int32_t GetDomainPreferenceMode(int32_t slotId) override;
325 
326     /**
327      * @brief Set Ims Switch Status
328      *
329      * @param active[in] indicate the ims switch status, true is on, false is off
330      * @param slotId[in] the slot id
331      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
332      */
333     int32_t SetImsSwitchStatus(int32_t slotId, bool active) override;
334 
335     /**
336      * @brief Get Ims Switch Status
337      *
338      * @param slotId[in] the slot id
339      * @param enabled[out] indicate the ims switch status, true is on, false is off
340      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
341      */
342     int32_t GetImsSwitchStatus(int32_t slotId, bool &enabled) override;
343 
344     /**
345      * @brief Set VoNR Switch Status
346      *
347      * @param state[in] Indicates the VoNR state, 0: off, 1: on
348      * @param slotId[in] the slot id
349      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
350      */
351     int32_t SetVoNRState(int32_t slotId, int32_t state) override;
352 
353     /**
354      * @brief Get VoNR Switch Status
355      *
356      * @param slotId[in] the slot id
357      * @param state[out] Indicates the VoNR state, 0: off, 1: on
358      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
359      */
360     int32_t GetVoNRState(int32_t slotId, int32_t &state) override;
361 
362     /**
363      * @brief Set Ims Config
364      *
365      * @param item[in] Identify specific item, like ITEM_VIDEO_QUALITY, ITEM_IMS_SWITCH_STATUS
366      * @param value[in] The specific value corresponding to the item
367      * @param slotId[in] the slot id
368      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
369      */
370     int32_t SetImsConfig(int32_t slotId, ImsConfigItem item, const std::string &value) override;
371 
372     /**
373      * @brief Set Ims Config
374      *
375      * @param item[in] Identify specific item, like ITEM_VIDEO_QUALITY, ITEM_IMS_SWITCH_STATUS
376      * @param value[in] The specific value corresponding to the item
377      * @param slotId[in] the slot id
378      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
379      */
380     int32_t SetImsConfig(int32_t slotId, ImsConfigItem item, int32_t value) override;
381 
382     /**
383      * @brief Get Ims Config
384      *
385      * @param item[in] Identify specific item, like ITEM_VIDEO_QUALITY, ITEM_IMS_SWITCH_STATUS
386      * @param slotId[in] the slot id
387      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
388      */
389     int32_t GetImsConfig(int32_t slotId, ImsConfigItem item) override;
390 
391     /**
392      * @brief Set Ims Feature Value
393      *
394      * @param type[in] the ims feature item, like VoLTE, ViLTE, SS over UT
395      * @param value[in] The specific value corresponding to the item
396      * @param slotId[in] the slot id
397      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
398      */
399     int32_t SetImsFeatureValue(int32_t slotId, FeatureType type, int32_t value) override;
400 
401     /**
402      * @brief Get Ims Feature Value
403      *
404      * @param type[in] the ims feature item, like VoLTE, ViLTE, SS over UT
405      * @param slotId[in] the slot id
406      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
407      */
408     int32_t GetImsFeatureValue(int32_t slotId, FeatureType type) override;
409 
410     /**
411      * @brief set camara to be enabled for video call
412      *
413      * @param cameraId[in] The id of the camera
414      * @param callingUid[in] the UID of call
415      * @param callingPid[in] the PID if call
416      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
417      */
418     int32_t CtrlCamera(const std::u16string &cameraId, int32_t callingUid, int32_t callingPid) override;
419 
420     /**
421      * @brief set a window which used to display a preview of camera capturing
422      *
423      * @param x[in] X coordinate of window
424      * @param y[in] Y coordinate of window
425      * @param z[in] Z coordinate of window
426      * @param width[in] the width of window
427      * @param height[in] the height of window
428      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
429      */
430     int32_t SetPreviewWindow(int32_t x, int32_t y, int32_t z, int32_t width, int32_t height) override;
431 
432     /**
433      * @brief set a window which used to display the viedo which is received from remote
434      *
435      * @param x[in] X coordinate of window
436      * @param y[in] Y coordinate of window
437      * @param z[in] Z coordinate of window
438      * @param width[in] the width of window
439      * @param height[in] the height of window
440      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
441      */
442     int32_t SetDisplayWindow(int32_t x, int32_t y, int32_t z, int32_t width, int32_t height) override;
443 
444     /**
445      * @brief set camera zoom ratio
446      *
447      * @param zoomRatio[in] the camera zoom ratio
448      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
449      */
450     int32_t SetCameraZoom(float zoomRatio) override;
451 
452     /**
453      * @brief set a image which will be displayed when the video signal is paused
454      *
455      * @param path[in] the dispalyed image path
456      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
457      */
458     int32_t SetPauseImage(const std::u16string &path) override;
459 
460     /**
461      * @brief set the device orientation
462      *
463      * @param rotation[in] The device orientation, in degrees
464      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
465      */
466     int32_t SetDeviceDirection(int32_t rotation) override;
467 
468     /**
469      * @brief Set the mute state of the call
470      *
471      * @param mute[in] 1 means the call could be muted
472      * @param slotId[in] the slot id
473      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
474      */
475     int32_t SetMute(int32_t mute, int32_t slotId) override;
476 
477     /**
478      * @brief Get the mute state of the call
479      *
480      * @param slotId[in] the slot id
481      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
482      */
483     int32_t GetMute(int32_t slotId) override;
484 
485     /**
486      * @brief Set emergency phone number
487      *
488      * @param eccVecr[in] ecc number info list
489      * @param slotId[in] The slot id
490      * @return Returns TELEPHONY_SUCCESS on true, others on false.
491      */
492     int32_t SetEmergencyCallList(int32_t slotId, std::vector<EmergencyCall>  &eccVec) override;
493 
494     /**
495      * @brief Close Unfinished ussd function for the current account
496      *
497      * @param slotId[in] the slot id
498      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
499      */
500     int32_t CloseUnFinishedUssd(int32_t slotId) override;
501 
502     /**
503      * @brief clear all call if cellular call service restart
504      *
505      * @param infos[in] the call detail info vector which contains phone number, call type, slot id .etc
506      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
507      */
508     int32_t ClearAllCalls(const std::vector<CellularCallInfo> &infos) override;
509 
510 private:
511     /**
512      * @brief SetCommonParamForMessageParcel, set common param for MessageParcel
513      *
514      * @param slotId[in] the slot id
515      * @param in[out] the MessageParcel which will contain some common parameters like slotid, token,
516      * max size while the return is success.
517      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
518      */
519     int32_t SetCommonParamForMessageParcel(int32_t slotId, MessageParcel &in);
520 
521 private:
522     static inline BrokerDelegator<CellularCallProxy> delegator_;
523 };
524 } // namespace Telephony
525 } // namespace OHOS
526 #endif // CELLULAR_CALL_PROXY_H
527