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