• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_INTERFACE_H
17 #define TELEPHONY_IMS_CALL_INTERFACE_H
18 
19 #include "cellular_call_data_struct.h"
20 #include "ims_call_callback_interface.h"
21 #include "ims_call_types.h"
22 #include "ims_feature.h"
23 #include "iremote_broker.h"
24 
25 namespace OHOS {
26 namespace Telephony {
27 class ImsCallInterface : public IRemoteBroker {
28 public:
29     /**
30      * @brief IMS dial the call interface
31      *
32      * @param ImsCallInfo Indicates the call detail information, contains phone number, slot id,
33      * video state, call index
34      * @param CLIRMode Indicates the CLIR mode, like default, transfer, inhibition
35      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
36      */
37     virtual int32_t Dial(const ImsCallInfo &callInfo, CLIRMode mode) = 0;
38 
39     /**
40      * @brief IMS HangUp the call interface
41      *
42      * @param ImsCallInfo Indicates the call detail information, contains phone number, slot id,
43      * video state, call index
44      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
45      */
46     virtual int32_t HangUp(const ImsCallInfo &callInfo) = 0;
47 
48     /**
49      * @brief IMS Reject the call with reason interface
50      *
51      * @param ImsCallInfo Indicates the call detail information, contains phone number, slot id,
52      * video state, call index
53      * @param ImsRejectReason Indicated the reject reason, like user is busy or user decline
54      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
55      */
56     virtual int32_t RejectWithReason(const ImsCallInfo &callInfo, const ImsRejectReason &reason) = 0;
57 
58     /**
59      * @brief IMS Answer the call interface
60      *
61      * @param ImsCallInfo Indicates the call detail information, contains phone number, slot id,
62      * video state, call index
63      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
64      */
65     virtual int32_t Answer(const ImsCallInfo &callInfo) = 0;
66 
67     /**
68      * @brief Hold the Call
69      *
70      * @param slotId Indicates the card slot index number,
71      * @param callType Indicates the call type,
72      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
73      */
74     virtual int32_t HoldCall(int32_t slotId, int32_t callType) = 0;
75 
76     /**
77      * @brief UnHold the Call
78      *
79      * @param slotId Indicates the card slot index number,
80      * @param callType Indicates the type of video state, 0: voice, 1: video
81      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
82      */
83     virtual int32_t UnHoldCall(int32_t slotId, int32_t callType) = 0;
84 
85     /**
86      * @brief Switch the phone call between hold and unhold
87      *
88      * @param slotId Indicates the card slot index number,
89      * @param callType Indicates the type of video state, 0: voice, 1: video
90      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
91      */
92     virtual int32_t SwitchCall(int32_t slotId, int32_t callType) = 0;
93 
94     /**
95      * @brief Merge calls to form a conference
96      *
97      * @param slotId Indicates the card slot index number,
98      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
99      */
100     virtual int32_t CombineConference(int32_t slotId) = 0;
101 
102     /**
103      * @brief Invite someone to conference
104      *
105      * @param slotId Indicates the card slot index number
106      * @param numberList phone number list which will be invited to the conference call
107      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
108      */
109     virtual int32_t InviteToConference(int32_t slotId, const std::vector<std::string> &numberList) = 0;
110 
111     /**
112      * @brief Kick out someone from conference
113      *
114      * @param slotId Indicates the card slot index number
115      * @param index Call index which will be kicked out from the conference call
116      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
117      */
118     virtual int32_t KickOutFromConference(int32_t slotId, int32_t index) = 0;
119 
120     /**
121      * @brief IMS UpdateImsCallMode interface
122      *
123      * @param ImsCallInfo Indicates the call detail information, contains phone number, slot id,
124      * video state, call index
125      * @param ImsCallMode Indicates the call media mode, like audio only, send only .etc.
126      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
127      */
128     virtual int32_t UpdateImsCallMode(const ImsCallInfo &callInfo, ImsCallMode mode) = 0;
129 
130     /**
131      * @brief Get Ims Calls Data Request
132      *
133      * @param slotId Indicates the card slot index number,
134      * @param lastCallsDataFlag The ims call data id, is a number in milliseconds
135      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
136      */
137     virtual int32_t GetImsCallsDataRequest(int32_t slotId, int64_t lastCallsDataFlag) = 0;
138 
139     /**
140      * @brief Get Last Call Fail Reason
141      *
142      * @param slotId Indicates the card slot index number,
143      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
144      */
145     virtual int32_t GetLastCallFailReason(int32_t slotId) = 0;
146 
147     /**
148      * @brief start to paly a dtmf tone
149      *
150      * @param slotId Indicates the card slot index number,
151      * @param cDTMFCode A character indicate the DTMF digit for which to play the tone. This
152      * value must be one of {0~9}, {*} or {#}.
153      * @param index Indicates the index of command.
154      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
155      */
156     virtual int32_t StartDtmf(int32_t slotId, char cDtmfCode, int32_t index) = 0;
157 
158     /**
159      * @brief play a dtmf tone
160      *
161      * @param slotId Indicates the card slot index number,
162      * @param cDtmfCode A character indicate the DTMF digit for which to play the tone. This
163      * value must be one of {0~9}, {*} or {#}.
164      * @param index Indicates the index of command.
165      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
166      */
167     virtual int32_t SendDtmf(int32_t slotId, char cDtmfCode, int32_t index) = 0;
168 
169     /**
170      * @brief stop the playing dtmf tone
171      *
172      * @param slotId Indicates the card slot index number,
173      * @param index Indicates the index of command.
174      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
175      */
176     virtual int32_t StopDtmf(int32_t slotId, int32_t index) = 0;
177 
178     /**
179      * @brief Start a RTT session
180      *
181      * @param slotId Indicates the card slot index number,
182      * @param msg the specific RTT msg
183      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
184      */
185     virtual int32_t StartRtt(int32_t slotId, const std::string &msg) = 0;
186 
187     /**
188      * @brief Terminate the current RTT session
189      *
190      * @param slotId Indicates the card slot index number,
191      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
192      */
193     virtual int32_t StopRtt(int32_t slotId) = 0;
194 
195     /**
196      * @brief Set Domain Preference Mode
197      *
198      * @param slotId Indicates the card slot index number,
199      * @param mode indicate the domain preference, 1: CS only, 2: CS prefer, 3: PS prefer, 4: PS only
200      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
201      */
202     virtual int32_t SetDomainPreferenceMode(int32_t slotId, int32_t mode) = 0;
203 
204     /**
205      * @brief Get Domain Preference Mode
206      *
207      * @param slotId Indicates the card slot index number,
208      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
209      */
210     virtual int32_t GetDomainPreferenceMode(int32_t slotId) = 0;
211 
212     /**
213      * @brief Set the ims switch status
214      *
215      * @param slotId Indicates the card slot index number,
216      * @param active 1: enable ims, 0: disable ims
217      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
218      */
219     virtual int32_t SetImsSwitchStatus(int32_t slotId, int32_t active) = 0;
220 
221     /**
222      * @brief IMS GetImsSwitchStatus interface
223      *
224      * @param slotId Indicates the card slot index number,
225      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
226      */
227     virtual int32_t GetImsSwitchStatus(int32_t slotId) = 0;
228 
229     /**
230      * @brief IMS SetImsConfig interface
231      *
232      * @param ImsConfigItem Identify specific item, like ITEM_VIDEO_QUALITY, ITEM_IMS_SWITCH_STATUS
233      * @param value The specific value corresponding to the item
234      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
235      */
236     virtual int32_t SetImsConfig(ImsConfigItem item, const std::string &value) = 0;
237 
238     /**
239      * @brief IMS SetImsConfig interface
240      *
241      * @param ImsConfigItem Identify specific item, like ITEM_VIDEO_QUALITY, ITEM_IMS_SWITCH_STATUS
242      * @param value The specific value corresponding to the item
243      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
244      */
245     virtual int32_t SetImsConfig(ImsConfigItem item, int32_t value) = 0;
246 
247     /**
248      * @brief IMS GetImsConfig interface
249      *
250      * @param ImsConfigItem Identify specific item, like ITEM_VIDEO_QUALITY, ITEM_IMS_SWITCH_STATUS
251      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
252      */
253     virtual int32_t GetImsConfig(ImsConfigItem item) = 0;
254 
255     /**
256      * @brief IMS SetImsFeatureValue interface
257      *
258      * @param FeatureType the ims feature item, like VoLTE, ViLTE, SS over UT
259      * @param value The specific value corresponding to the item
260      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
261      */
262     virtual int32_t SetImsFeatureValue(FeatureType type, int32_t value) = 0;
263 
264     /**
265      * @brief IMS GetImsFeatureValue interface
266      *
267      * @param FeatureType Indicate which feature type to query.
268      * @param value Indicate the return value of the query feature type.
269      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
270      */
271     virtual int32_t GetImsFeatureValue(FeatureType type, int32_t &value) = 0;
272 
273     /**
274      * @brief Set the mute state of the call
275      *
276      * @param mute 0: not mute, 1:mute
277      * @param slotId Indicates the card slot index number,
278      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
279      */
280     virtual int32_t SetMute(int32_t slotId, int32_t mute) = 0;
281 
282     /**
283      * @brief IMS GetMute interface
284      *
285      * @param slotId Indicates the card slot index number,
286      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
287      */
288     virtual int32_t GetMute(int32_t slotId) = 0;
289 
290     /**
291      * @brief IMS CtrlCamera interface
292      *
293      * @param cameraId The id of the camera
294      * @param callingUid the UID of call
295      * @param callingPid the PID if call
296      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
297      */
298     virtual int32_t CtrlCamera(const std::u16string &cameraId, int32_t callingUid, int32_t callingPid) = 0;
299 
300     /**
301      * @brief Set a window which used to display a preview of camera capturing
302      *
303      * @param x X coordinate of window
304      * @param y Y coordinate of window
305      * @param z Z coordinate of window
306      * @param width the width of window
307      * @param height the height of window
308      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
309      */
310     virtual int32_t SetPreviewWindow(int32_t x, int32_t y, int32_t z, int32_t width, int32_t height) = 0;
311 
312     /**
313      * @brief Set a window which used to display the viedo which is received from remote
314      *
315      * @param x X coordinate of window
316      * @param y Y coordinate of window
317      * @param z Z coordinate of window
318      * @param width the width of window
319      * @param height the height of window
320      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
321      */
322     virtual int32_t SetDisplayWindow(int32_t x, int32_t y, int32_t z, int32_t width, int32_t height) = 0;
323 
324     /**
325      * @brief Set camera zoom ratio
326      *
327      * @param zoomRatio the camera zoom ratio
328      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
329      */
330     virtual int32_t SetCameraZoom(float zoomRatio) = 0;
331 
332     /**
333      * @brief Set a image which will be displayed when the video signal is paused
334      *
335      * @param path the dispalyed image path
336      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
337      */
338     virtual int32_t SetPauseImage(const std::u16string &path) = 0;
339 
340     /**
341      * @brief Set the device orientation
342      *
343      * @param rotation The device orientation, in degrees
344      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
345      */
346     virtual int32_t SetDeviceDirection(int32_t rotation) = 0;
347 
348     /**
349      * @brief SetClip IMS SetClip interface
350      *
351      * @param slotId Indicates the card slot index number,
352      * ranging from 0 to the maximum card slot index number supported by the device.
353      * @param action Indicates the action for SetClip,
354      * 1, means turn on clip; 0, means turn off clip.
355      * @param index Indicates the index of command.
356      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
357      */
358     virtual int32_t SetClip(int32_t slotId, int32_t action, int32_t index) = 0;
359 
360     /**
361      * @brief GetClip IMS GetClip interface
362      *
363      * @param slotId Indicates the card slot index number,
364      * ranging from 0 to the maximum card slot index number supported by the device.
365      * @param index Indicates the index of command.
366      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
367      */
368     virtual int32_t GetClip(int32_t slotId, int32_t index) = 0;
369 
370     /**
371      * @brief SetClir IMS SetClir interface
372      *
373      * @param slotId Indicates the card slot index number,
374      * ranging from 0 to the maximum card slot index number supported by the device.
375      * @param action Indicates the action for SetClir,
376      * 1, means turn on clir; 0, means turn off clir.
377      * @param index Indicates the index of command.
378      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
379      */
380     virtual int32_t SetClir(int32_t slotId, int32_t action, int32_t index) = 0;
381 
382     /**
383      * @brief GetClir IMS GetClir interface
384      *
385      * @param slotId Indicates the card slot index number,
386      * ranging from 0 to the maximum card slot index number supported by the device.
387      * @param index Indicates the index of command.
388      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
389      */
390     virtual int32_t GetClir(int32_t slotId, int32_t index) = 0;
391 
392     /**
393      * @brief SetCallTransfer Set Call Transfer Request
394      *
395      * @param slotId Indicates the card slot index number,
396      * ranging from 0 to the maximum card slot index number supported by the device.
397      * @param cfInfo Indicates the reason/mode/transferNum/timer of the set call transfer.
398      * @param classType Indicates a sum of service class for setting call transfer.
399      * @param index Indicates the index of command.
400      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
401      */
402     virtual int32_t SetCallTransfer(
403         int32_t slotId, const CallTransferInfo &cfInfo, int32_t classType, int32_t index) = 0;
404 
405     /**
406      * @brief confirm whether IMS can set call transfer time.
407      *
408      * @param slotId Indicates the card slot index number,
409      * ranging from 0 to the maximum card slot index number supported by the device.
410      * @param result, The result of can set or not
411      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
412      */
413     virtual int32_t CanSetCallTransferTime(int32_t slotId, bool &result) = 0;
414 
415     /**
416      * @brief GetCallTransfer IMS GetCallTransfer interface
417      *
418      * @param slotId Indicates the card slot index number,
419      * ranging from 0 to the maximum card slot index number supported by the device.
420      * @param reason Indicates the reason of the get call transfer.
421      * @param index Indicates the index of command.
422      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
423      */
424     virtual int32_t GetCallTransfer(int32_t slotId, int32_t reason, int32_t index) = 0;
425 
426     /**
427      * @brief SetCallRestriction IMS SetCallRestriction interface
428      *
429      * @param slotId Indicates the card slot index number,
430      * ranging from 0 to the maximum card slot index number supported by the device.
431      * @param fac Indicates the facility of the set call restriction.
432      * @param mode Indicates the mode of the set call restriction.
433      * @param pw Indicates password or "" if not required.
434      * @param index Indicates the index of command.
435      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
436      */
437     virtual int32_t SetCallRestriction(
438         int32_t slotId, const std::string &fac, int32_t mode, const std::string &pw, int32_t index) = 0;
439 
440     /**
441      * @brief GetCallRestriction IMS GetCallRestriction interface
442      *
443      * @param slotId Indicates the card slot index number,
444      * ranging from 0 to the maximum card slot index number supported by the device.
445      * @param fac Indicates the facility of the get call restriction.
446      * @param index Indicates the index of command.
447      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
448      */
449     virtual int32_t GetCallRestriction(int32_t slotId, const std::string &fac, int32_t index) = 0;
450 
451     /**
452      * @brief SetCallWaiting IMS SetCallWaiting interface
453      *
454      * @param slotId Indicates the card slot index number,
455      * ranging from 0 to the maximum card slot index number supported by the device.
456      * @param activate Indicates the action for SetCallWaiting,
457      * true, means turn on CallWaiting; false, means turn off CallWaiting.
458      * @param classType Call waiting and conditions +CCWA,
459      * the value was {@code ServiceClassType}, See 3GPP TS 22.083.
460      * @param index Indicates the index of command.
461      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
462      */
463     virtual int32_t SetCallWaiting(int32_t slotId, bool activate, int32_t classType, int32_t index) = 0;
464 
465     /**
466      * @brief GetCallWaiting IMS GetCallWaiting interface
467      *
468      * @param slotId Indicates the card slot index number,
469      * ranging from 0 to the maximum card slot index number supported by the device.
470      * @param index Indicates the index of command.
471      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
472      */
473     virtual int32_t GetCallWaiting(int32_t slotId, int32_t index) = 0;
474 
475     /**
476      * @brief SetColr IMS SetColr interface
477      *
478      * @param slotId Indicates the card slot index number,
479      * ranging from 0 to the maximum card slot index number supported by the device.
480      * @param presentation Indicates the action for SetColr,
481      * 1, means turn on colr; 0, means turn off colr.
482      * @param index Indicates the index of command.
483      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
484      */
485     virtual int32_t SetColr(int32_t slotId, int32_t presentation, int32_t index) = 0;
486 
487     /**
488      * @brief GetColr IMS GetColr interface
489      *
490      * @param slotId Indicates the card slot index number,
491      * ranging from 0 to the maximum card slot index number supported by the device.
492      * @param index Indicates the index of command.
493      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
494      */
495     virtual int32_t GetColr(int32_t slotId, int32_t index) = 0;
496 
497     /**
498      * @brief SetColp IMS SetColp interface
499      *
500      * @param slotId Indicates the card slot index number,
501      * ranging from 0 to the maximum card slot index number supported by the device.
502      * @param action Indicates the action for SetColp,
503      * 1, means turn on colp; 0, means turn off colp.
504      * @param index Indicates the index of command.
505      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
506      */
507     virtual int32_t SetColp(int32_t slotId, int32_t action, int32_t index) = 0;
508 
509     /**
510      * @brief GetColp IMS GetColp interface
511      *
512      * @param slotId Indicates the card slot index number,
513      * ranging from 0 to the maximum card slot index number supported by the device.
514      * @param index Indicates the index of command.
515      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
516      */
517     virtual int32_t GetColp(int32_t slotId, int32_t index) = 0;
518 
519     /**
520      * @brief Register CallBack ptr
521      *
522      * @param sptr<ImsCallback>
523      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
524      */
525     virtual int32_t RegisterImsCallCallback(const sptr<ImsCallCallbackInterface> &callback) = 0;
526 
527     /**
528      * @brief Update Ims Capabilities
529      *
530      * @param slotId Indicates the card slot index number,
531      * ranging from 0 to the maximum card slot index number supported by the device.
532      * @param imsCapabilityList Indicates the related ims capability
533      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
534      */
535     virtual int32_t UpdateImsCapabilities(int32_t slotId, const ImsCapabilityList &imsCapabilityList) = 0;
536 
537     /**
538      * @brief Get impu which come form network
539      *
540      * @param slotId Indicates the card slot index number,
541      * ranging from 0 to the maximum card slot index number supported by the device.
542      * @param impu the result of impu
543      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
544      */
545     virtual int32_t GetUtImpuFromNetwork(int32_t slotId, std::string &impu) = 0;
546 
547 public:
548     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Telephony.ImsCallInterface");
549 };
550 } // namespace Telephony
551 } // namespace OHOS
552 
553 #endif // TELEPHONY_IMS_CALL_INTERFACE_H
554