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