1 /* 2 * Copyright (C) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef CALL_MANAGER_SERVICE_PROXY_H 17 #define CALL_MANAGER_SERVICE_PROXY_H 18 19 #include <cfloat> 20 #include <cstdio> 21 #include <string> 22 #include <vector> 23 24 #include "iremote_broker.h" 25 #include "iremote_proxy.h" 26 #include "pac_map.h" 27 28 #include "call_ability_callback_ipc_interface_code.h" 29 #include "call_manager_inner_type.h" 30 #include "call_manager_service_ipc_interface_code.h" 31 #include "i_call_manager_service.h" 32 #include "telephony_log_wrapper.h" 33 34 namespace OHOS { 35 namespace Telephony { 36 class CallManagerServiceProxy : public IRemoteProxy<ICallManagerService> { 37 public: 38 /** 39 * CallManagerServiceProxy 40 * 41 * @param impl 42 */ 43 explicit CallManagerServiceProxy(const sptr<IRemoteObject> &impl); 44 virtual ~CallManagerServiceProxy() = default; 45 46 /** 47 * RegisterCallBack 48 * 49 * @brief Register callback 50 * @param callback[in], callback function pointer 51 * @return Returns 0 on success, others on failure. 52 */ 53 int32_t RegisterCallBack(const sptr<ICallAbilityCallback> &callback) override; 54 55 /** 56 * UnRegisterCallBack 57 * 58 * @brief unregister callback 59 * @return Returns 0 on success, others on failure. 60 */ 61 int32_t UnRegisterCallBack() override; 62 63 /** 64 * DialCall 65 * 66 * @brief Make a phone call 67 * @param number[in], dial param. 68 * @param extras[in], extras date. 69 * @return Returns callId when the value is greater than zero, others on failure. 70 */ 71 int32_t DialCall(std::u16string number, AppExecFwk::PacMap &extras) override; 72 73 /** 74 * AnswerCall 75 * 76 * @brief Answer a phone call 77 * @param callId[in], call id 78 * @param videoState[in], 0: audio, 1: video 79 * @return Returns 0 on success, others on failure. 80 */ 81 int32_t AnswerCall(int32_t callId, int32_t videoState) override; 82 83 /** 84 * RejectCall 85 * 86 * @brief Reject a phone call 87 * @param callId[in], call id 88 * @param rejectWithMessage[in], Whether to enter the reason for rejection,true:yes false:no 89 * @param textMessage[in], The reason you reject the call 90 * @return Returns 0 on success, others on failure. 91 */ 92 int32_t RejectCall(int32_t callId, bool rejectWithMessage, std::u16string textMessage) override; 93 94 /** 95 * HangUpCall 96 * 97 * @brief Hang up the phone 98 * @param callId[in], call id 99 * @return Returns 0 on success, others on failure. 100 */ 101 int32_t HangUpCall(int32_t callId) override; 102 103 /** 104 * GetCallState 105 * 106 * @brief Obtain the call status of the device 107 * @return Returns call state. 108 */ 109 int32_t GetCallState() override; 110 111 /** 112 * HoldCall 113 * 114 * @brief Park a phone call 115 * @param callId[in], call id 116 * @return Returns 0 on success, others on failure. 117 */ 118 int32_t HoldCall(int32_t callId) override; 119 120 /** 121 * UnHoldCall 122 * 123 * @brief Activate a phone call 124 * @param callId[in], call id 125 * @return Returns 0 on success, others on failure. 126 */ 127 int32_t UnHoldCall(int32_t callId) override; 128 129 /** 130 * SwitchCall 131 * 132 * @brief Switch the phone 133 * @param callId[in], call id 134 * @return Returns 0 on success, others on failure. 135 */ 136 int32_t SwitchCall(int32_t callId) override; 137 138 /** 139 * HasCall 140 * 141 * @brief Is there Call 142 * @return Returns true on has call, others on there is no call. 143 */ 144 bool HasCall() override; 145 146 /** 147 * IsNewCallAllowed 148 * 149 * @brief Can I initiate a call 150 * @param enabled[out], whether allow new calls 151 * @return Returns interface processing results. 152 */ 153 int32_t IsNewCallAllowed(bool &enabled) override; 154 155 /** 156 * SetMuted 157 * 158 * @brief Mute the Microphone 159 * @param isMute[in], mute state 160 * @return Returns 0 on success, others on failure. 161 */ 162 int32_t SetMuted(bool isMute) override; 163 164 /** 165 * MuteRinger 166 * 167 * @brief Call mute 168 * @return Returns 0 on success, others on failure. 169 */ 170 int32_t MuteRinger() override; 171 172 /** 173 * SetAudioDevice 174 * 175 * @brief Setting the Audio Channel 176 * @param audioDevice[in], contain audioDeviceType and address 177 * @return Returns 0 on success, others on failure. 178 */ 179 int32_t SetAudioDevice(const AudioDevice &audioDevice) override; 180 181 /** 182 * IsRinging 183 * 184 * @brief Whether the ringing 185 * @param enabled[out], true on ringing, false on there is no ringing 186 * @return Returns interface processing results. 187 */ 188 int32_t IsRinging(bool &enabled) override; 189 190 /** 191 * IsInEmergencyCall 192 * 193 * @brief Is there an emergency call 194 * @param enabled[out], true on emergency call, false on no emergency call 195 * @return Returns interface processing results. 196 */ 197 int32_t IsInEmergencyCall(bool &enabled) override; 198 199 /** 200 * StartDtmf 201 * 202 * @brief Enable and send DTMF 203 * @param callId[in], call id 204 * @param str[in], Characters sent 205 * @return Returns 0 on success, others on failure. 206 */ 207 int32_t StartDtmf(int32_t callId, char str) override; 208 209 /** 210 * StopDtmf 211 * 212 * @brief Stop the DTMF 213 * @param callId[in], call id 214 * @return Returns 0 on success, others on failure. 215 */ 216 int32_t StopDtmf(int32_t callId) override; 217 218 int32_t PostDialProceed(int32_t callId, bool proceed) override; 219 220 /** 221 * GetCallWaiting 222 * 223 * @brief Gets whether the call waiting service of the current account is enabled 224 * @param slotId[in], The slot id 225 * @return Returns 0 on success, others on failure. 226 */ 227 int32_t GetCallWaiting(int32_t slotId) override; 228 229 /** 230 * SetCallWaiting 231 * 232 * @brief Set the call waiting function for the current account 233 * @param slotId[in], The slot id 234 * @param activate[in], Activation of switch 235 * @return Returns 0 on success, others on failure. 236 */ 237 int32_t SetCallWaiting(int32_t slotId, bool activate) override; 238 239 /** 240 * GetCallRestriction 241 * 242 * @brief Gets the call restriction information of the specified account 243 * @param slotId[in], The slot id 244 * @param type[in], Call Restriction type 245 * @return Returns 0 on success, others on failure. 246 */ 247 int32_t GetCallRestriction(int32_t slotId, CallRestrictionType type) override; 248 249 /** 250 * SetCallRestriction 251 * 252 * @brief Set the call restriction function for the current account 253 * @param slotId[in], The slot id 254 * @param info[in], Call restriction information 255 * @return Returns 0 on success, others on failure. 256 */ 257 int32_t SetCallRestriction(int32_t slotId, CallRestrictionInfo &info) override; 258 259 /** 260 * SetCallRestrictionPassword 261 * 262 * @brief Set the call restriction password function for the current account 263 * @param slotId[in], The slot id 264 * @param fac[in], Call restriction type 265 * @param oldPassword[in], Old password of call restriction type 266 * @param newPassword[in], New password of call restriction type 267 * @return Returns 0 on success, others on failure. 268 */ 269 int32_t SetCallRestrictionPassword( 270 int32_t slotId, CallRestrictionType fac, const char *oldPassword, const char *newPassword) override; 271 272 /** 273 * GetCallTransferInfo 274 * 275 * @brief Gets the call transfer information of the current account 276 * @param slotId[in], The slot id 277 * @param type[in], Call Transfer Type 278 * @return Returns 0 on success, others on failure. 279 */ 280 int32_t GetCallTransferInfo(int32_t slotId, CallTransferType type) override; 281 282 /** 283 * SetCallTransferInfo 284 * 285 * @brief Set the call transfer function for the current account 286 * @param slotId[in], The slot id 287 * @param info[in], Call Transfer Information 288 * @return Returns 0 on success, others on failure. 289 */ 290 int32_t SetCallTransferInfo(int32_t slotId, CallTransferInfo &info) override; 291 292 /** 293 * CanSetCallTransferTime 294 * 295 * @brief confirm whether IMS can set call transfer time. 296 * @param slotId[in], The slot id 297 * @param result[out], The result of can set or not 298 * @return Returns true on can set, others on can not set. 299 */ 300 int32_t CanSetCallTransferTime(int32_t slotId, bool &result) override; 301 302 /** 303 * CombineConference 304 * 305 * @brief Merge calls to form a conference 306 * @param callId[in], call id 307 * @return Returns 0 on success, others on failure. 308 */ 309 int32_t CombineConference(int32_t mainCallId) override; 310 311 /** 312 * SeparateConference 313 * 314 * @brief Separates a specified call from a conference call 315 * @param callId[in], call id 316 * @return Returns 0 on success, others on failure. 317 */ 318 int32_t SeparateConference(int32_t callId) override; 319 320 /** 321 * KickOutFromConference 322 * 323 * @brief Hangup a specified call from a conference call 324 * @param callId[in], call id 325 * @return Returns 0 on success, others on failure. 326 */ 327 int32_t KickOutFromConference(int32_t callId) override; 328 329 /** 330 * JoinConference 331 * 332 * @brief Bring someone into a meeting 333 * @param callId[in], The call id 334 * @param numberList[in], List of calls to join the conference 335 * @return Returns 0 on success, others on failure. 336 */ 337 int32_t JoinConference(int32_t callId, std::vector<std::u16string> &numberList) override; 338 339 /** 340 * SetCallPreferenceMode 341 * 342 * @brief Setting the Call Type 343 * @param slotId[in], The slot id 344 * @param mode[in], Preference Mode 345 * @return Returns 0 on success, others on failure. 346 */ 347 int32_t SetCallPreferenceMode(int32_t slotId, int32_t mode) override; 348 349 /** 350 * ControlCamera 351 * 352 * @brief Open or close camera 353 * @param cameraId[in], The camera id 354 * @return Returns 0 on success, others on failure. 355 */ 356 int32_t ControlCamera(std::u16string cameraId) override; 357 358 /** 359 * SetPreviewWindow 360 * 361 * @brief Set the location and size of the preview window for videos captured by the local camera. 362 * @param window[in], Window information 363 * @return Returns 0 on success, others on failure. 364 */ 365 int32_t SetPreviewWindow(VideoWindow &window) override; 366 367 /** 368 * SetDisplayWindow 369 * 370 * @brief Sets the location and size of the remote video window. 371 * @param window[in], Window information 372 * @return Returns 0 on success, others on failure. 373 */ 374 int32_t SetDisplayWindow(VideoWindow &window) override; 375 376 /** 377 * SetCameraZoom 378 * 379 * @brief Sets the local camera zoom scale 380 * @param zoomRatio[in], Camera scale 381 * @return Returns 0 on success, others on failure. 382 */ 383 int32_t SetCameraZoom(float zoomRatio) override; 384 385 /** 386 * SetPausePicture 387 * 388 * @brief APP sets the screen of the remote video freeze immediately. 389 * If the APP does not call this interface when making a video call, 390 * the last frame before the remote video freeze is displayed by default 391 * @param path[in], Local Picture address 392 * @return Returns 0 on success, others on failure. 393 */ 394 int32_t SetPausePicture(std::u16string path) override; 395 396 /** 397 * SetDeviceDirection 398 * 399 * @brief Set the rotation Angle of the local device. The default value is 0 400 * @param rotation[in], Rotation Angle 401 * @return Returns 0 on success, others on failure. 402 */ 403 int32_t SetDeviceDirection(int32_t rotation) override; 404 405 /** 406 * IsEmergencyPhoneNumber 407 * 408 * @brief Is it an emergency call 409 * @param number[in], Phone number to be formatted 410 * @param slotId[in], The slot id 411 * @param enabled[out] result of is it an emergency call 412 * @return Returns 0 on success, others on failure. 413 */ 414 int32_t IsEmergencyPhoneNumber(std::u16string &number, int32_t slotId, bool &enabled) override; 415 416 /** 417 * FormatPhoneNumber 418 * 419 * @brief Formatting a phone number 420 * @param number[in], Phone number to be formatted 421 * @param countryCode[in], Country code of the phone number 422 * @param formatNumber[out] Formatting a phone number 423 * @return Returns 0 on success, others on failure. 424 */ 425 int32_t FormatPhoneNumber( 426 std::u16string &number, std::u16string &countryCode, std::u16string &formatNumber) override; 427 428 /** 429 * FormatPhoneNumberToE164 430 * 431 * @brief Formatting a phone number 432 * @param number[in]. Phone number to be formatted 433 * @param countryCode[in], Country code of the phone number 434 * @param formatNumber[out] Formatting a phone number 435 * @return Returns 0 on success, others on failure. 436 */ 437 int32_t FormatPhoneNumberToE164( 438 std::u16string &number, std::u16string &countryCode, std::u16string &formatNumber) override; 439 440 /** 441 * GetMainCallId 442 * 443 * @brief Obtain the ID of the primary call in a conference 444 * @param callId[in], Id of a call in a conference 445 * @return Returns main call id, -1 on not call id. 446 */ 447 int32_t GetMainCallId(int32_t callId, int32_t &mainCallId) override; 448 449 /** 450 * GetSubCallIdList 451 * 452 * @brief Obtain the list of neutron call ids 453 * @param callId[in], Id of a call in a conference 454 * @param callIdList[out], the list of neutron call ids 455 * @return Returns 0 on success, others on failure. 456 */ 457 int32_t GetSubCallIdList(int32_t callId, std::vector<std::u16string> &callIdList) override; 458 459 /** 460 * GetCallIdListForConference 461 * 462 * @brief Obtain the callId list of all calls in a conference 463 * @param callId[in], Id of a call in a conference 464 * @param callIdList[out], the callId list of all calls in a conference 465 * @return Returns 0 on success, others on failure. 466 */ 467 int32_t GetCallIdListForConference(int32_t callId, std::vector<std::u16string> &callIdList) override; 468 469 /** 470 * GetImsConfig 471 * 472 * @brief Obtain the IMS service configuration 473 * @param slotId[in], The slot id 474 * @param item[in] 475 * @return Returns 0 on success, others on failure. 476 */ 477 int32_t GetImsConfig(int32_t slotId, ImsConfigItem item) override; 478 479 /** 480 * SetImsConfig 481 * 482 * @brief Example Set the IMS service configuration 483 * @param slotId[in], The slot id 484 * @param item[in] 485 * @return Returns 0 on success, others on failure. 486 */ 487 int32_t SetImsConfig(int32_t slotId, ImsConfigItem item, std::u16string &value) override; 488 489 /** 490 * GetImsFeatureValue 491 * 492 * @brief Gets the value of the IMS function item of the specified network type 493 * @param slotId[in], The slot id 494 * @param info[in], FeatureType 495 * @return Returns 0 on success, others on failure. 496 */ 497 int32_t GetImsFeatureValue(int32_t slotId, FeatureType type) override; 498 499 /** 500 * SetImsFeatureValue 501 * 502 * @brief Set the value of the IMS function item of the specified network type 503 * @param slotId[in], The slot id 504 * @param info[in], FeatureType 505 * @param value[in] 506 * @return Returns 0 on success, others on failure. 507 */ 508 int32_t SetImsFeatureValue(int32_t slotId, FeatureType type, int32_t value) override; 509 510 /** 511 * UpdateImsCallMode 512 * 513 * @brief Setting the Call Mode 514 * @param callId[in], The call id 515 * @param mode[in], Calling patterns 516 * @return Returns 0 on success, others on failure. 517 */ 518 int32_t UpdateImsCallMode(int32_t callId, ImsCallMode mode) override; 519 520 /** 521 * EnableImsSwitch 522 * 523 * @brief Start VoLte 524 * @param slotId[in], The slot id 525 * @return Returns 0 on success, others on failure. 526 */ 527 int32_t EnableImsSwitch(int32_t slotId) override; 528 529 /** 530 * DisableImsSwitch 531 * 532 * @brief Stop VoLte 533 * @param slotId[in], The slot id 534 * @return Returns 0 on success, others on failure. 535 */ 536 int32_t DisableImsSwitch(int32_t slotId) override; 537 538 /** 539 * IsImsSwitchEnabled 540 * 541 * @brief Whether to enable VoLte 542 * @param slotId[in], The slot id 543 * @param enabled[out], The result of enable or not 544 * @return Returns 0 on success, others on failure. 545 */ 546 int32_t IsImsSwitchEnabled(int32_t slotId, bool &enabled) override; 547 548 /** 549 * SetVoNRState 550 * 551 * @brief Set VoNR State 552 * @param slotId[in], The slot id 553 * @param state[in], The state of VoNR 554 * @return Returns 0 on success, others on failure. 555 */ 556 int32_t SetVoNRState(int32_t slotId, int32_t state) override; 557 558 /** 559 * GetVoNRState 560 * 561 * @brief Get VoNR State 562 * @param slotId[in], The slot id 563 * @param state[out], The result of VoNR state ON or OFF 564 * @return Returns 0 on success, others on failure. 565 */ 566 int32_t GetVoNRState(int32_t slotId, int32_t &state) override; 567 568 /** 569 * StartRtt 570 * 571 * @brief Enable and send RTT information 572 * @param callId[in], The call id 573 * @param msg[in], RTT information 574 * @return Returns 0 on success, others on failure. 575 */ 576 int32_t StartRtt(int32_t callId, std::u16string &msg) override; 577 578 /** 579 * StopRtt 580 * 581 * @brief Close the RTT 582 * @param callId[in], The call id 583 * @return Returns 0 on success, others on failure. 584 */ 585 int32_t StopRtt(int32_t callId) override; 586 587 /** 588 * ReportOttCallDetailsInfo 589 * 590 * @brief report ott call details info 591 * @param ottVec[in], ott call status detail info list 592 * @return Returns 0 on success, others on failure. 593 */ 594 int32_t ReportOttCallDetailsInfo(std::vector<OttCallDetailsInfo> &ottVec) override; 595 596 /** 597 * ReportOttCallEventInfo 598 * 599 * @brief report ott call event info 600 * @param eventInfo[in], ott call event detail info 601 * @return Returns 0 on success, others on failure. 602 */ 603 int32_t ReportOttCallEventInfo(OttCallEventInfo &eventInfo) override; 604 605 /** 606 * CloseUnFinishedUssd 607 * 608 * @brief Close Unfinished ussd function for the current account 609 * @param slotId[in], The slot id 610 * @return Returns 0 on success, others on failure. 611 */ 612 int32_t CloseUnFinishedUssd(int32_t slotId) override; 613 614 /** 615 * Handle special code from dialer. 616 * 617 * @param specialCode[in], special code 618 * @return Returns 0 on success, others on failure. 619 */ 620 int32_t InputDialerSpecialCode(const std::string &specialCode) override; 621 622 /** 623 * Remove missed incoming call notification. 624 * 625 * @return Returns 0 on success, others on failure. 626 */ 627 int32_t RemoveMissedIncomingCallNotification() override; 628 629 /** 630 * GetProxyObjectPtr 631 * 632 * @brief get callManager proxy object ptr 633 * @param proxyType[in], proxy type 634 * @return Returns nullptr on failure, others on success. 635 */ 636 sptr<IRemoteObject> GetProxyObjectPtr(CallManagerProxyType proxyType) override; 637 638 /** 639 * ReportAudioDeviceInfo 640 * 641 * @brief report audio device info 642 * @return Returns 0 on success, others on failure. 643 */ 644 int32_t ReportAudioDeviceInfo() override; 645 646 private: 647 static inline BrokerDelegator<CallManagerServiceProxy> delegator_; 648 }; 649 } // namespace Telephony 650 } // namespace OHOS 651 652 #endif // CALL_MANAGER_SERVICE_PROXY_H 653