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