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_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 * @param enabled[out], whether allow new calls 149 * @return Returns interface processing results. 150 */ 151 int32_t IsNewCallAllowed(bool &enabled) override; 152 153 /** 154 * SetMuted 155 * 156 * @brief Mute the Microphone 157 * @param isMute[in], mute state 158 * @return Returns 0 on success, others on failure. 159 */ 160 int32_t SetMuted(bool isMute) override; 161 162 /** 163 * MuteRinger 164 * 165 * @brief Call mute 166 * @return Returns 0 on success, others on failure. 167 */ 168 int32_t MuteRinger() override; 169 170 /** 171 * SetAudioDevice 172 * 173 * @brief Setting the Audio Channel 174 * @param deviceType[in], audio device type 175 * @param bluetoothAddress[in], bluetooth device Address 176 * @return Returns 0 on success, others on failure. 177 */ 178 int32_t SetAudioDevice(AudioDevice deviceType, const std::string &bluetoothAddress) override; 179 180 /** 181 * IsRinging 182 * 183 * @brief Whether the ringing 184 * @param enabled[out], true on ringing, false on there is no ringing 185 * @return Returns interface processing results. 186 */ 187 int32_t IsRinging(bool &enabled) override; 188 189 /** 190 * IsInEmergencyCall 191 * 192 * @brief Is there an emergency call 193 * @param enabled[out], true on emergency call, false on no emergency call 194 * @return Returns interface processing results. 195 */ 196 int32_t IsInEmergencyCall(bool &enabled) override; 197 198 /** 199 * StartDtmf 200 * 201 * @brief Enable and send DTMF 202 * @param callId[in], call id 203 * @param str[in], Characters sent 204 * @return Returns 0 on success, others on failure. 205 */ 206 int32_t StartDtmf(int32_t callId, char str) override; 207 208 /** 209 * StopDtmf 210 * 211 * @brief Stop the DTMF 212 * @param callId[in], call id 213 * @return Returns 0 on success, others on failure. 214 */ 215 int32_t StopDtmf(int32_t callId) override; 216 217 /** 218 * GetCallWaiting 219 * 220 * @brief Gets whether the call waiting service of the current account is enabled 221 * @param slotId[in], The slot id 222 * @return Returns 0 on success, others on failure. 223 */ 224 int32_t GetCallWaiting(int32_t slotId) override; 225 226 /** 227 * SetCallWaiting 228 * 229 * @brief Set the call waiting function for the current account 230 * @param slotId[in], The slot id 231 * @param activate[in], Activation of switch 232 * @return Returns 0 on success, others on failure. 233 */ 234 int32_t SetCallWaiting(int32_t slotId, bool activate) override; 235 236 /** 237 * GetCallRestriction 238 * 239 * @brief Gets the call restriction information of the specified account 240 * @param slotId[in], The slot id 241 * @param type[in], Call Restriction type 242 * @return Returns 0 on success, others on failure. 243 */ 244 int32_t GetCallRestriction(int32_t slotId, CallRestrictionType type) override; 245 246 /** 247 * SetCallRestriction 248 * 249 * @brief Set the call restriction function for the current account 250 * @param slotId[in], The slot id 251 * @param info[in], Call restriction information 252 * @return Returns 0 on success, others on failure. 253 */ 254 int32_t SetCallRestriction(int32_t slotId, CallRestrictionInfo &info) override; 255 256 /** 257 * GetCallTransferInfo 258 * 259 * @brief Gets the call transfer information of the current account 260 * @param slotId[in], The slot id 261 * @param type[in], Call Transfer Type 262 * @return Returns 0 on success, others on failure. 263 */ 264 int32_t GetCallTransferInfo(int32_t slotId, CallTransferType type) override; 265 266 /** 267 * SetCallTransferInfo 268 * 269 * @brief Set the call transfer function for the current account 270 * @param slotId[in], The slot id 271 * @param info[in], Call Transfer Information 272 * @return Returns 0 on success, others on failure. 273 */ 274 int32_t SetCallTransferInfo(int32_t slotId, CallTransferInfo &info) override; 275 276 /** 277 * CombineConference 278 * 279 * @brief Merge calls to form a conference 280 * @param callId[in], call id 281 * @return Returns 0 on success, others on failure. 282 */ 283 int32_t CombineConference(int32_t mainCallId) override; 284 285 /** 286 * SeparateConference 287 * 288 * @brief Separates a specified call from a conference call 289 * @param callId[in], call id 290 * @return Returns 0 on success, others on failure. 291 */ 292 int32_t SeparateConference(int32_t callId) override; 293 294 /** 295 * JoinConference 296 * 297 * @brief Bring someone into a meeting 298 * @param callId[in], The call id 299 * @param numberList[in], List of calls to join the conference 300 * @return Returns 0 on success, others on failure. 301 */ 302 int32_t JoinConference(int32_t callId, std::vector<std::u16string> &numberList) override; 303 304 /** 305 * SetCallPreferenceMode 306 * 307 * @brief Setting the Call Type 308 * @param slotId[in], The slot id 309 * @param mode[in], Preference Mode 310 * @return Returns 0 on success, others on failure. 311 */ 312 int32_t SetCallPreferenceMode(int32_t slotId, int32_t mode) override; 313 314 /** 315 * ControlCamera 316 * 317 * @brief Open or close camera 318 * @param cameraId[in], The camera id 319 * @return Returns 0 on success, others on failure. 320 */ 321 int32_t ControlCamera(std::u16string cameraId) override; 322 323 /** 324 * SetPreviewWindow 325 * 326 * @brief Set the location and size of the preview window for videos captured by the local camera. 327 * @param window[in], Window information 328 * @return Returns 0 on success, others on failure. 329 */ 330 int32_t SetPreviewWindow(VideoWindow &window) override; 331 332 /** 333 * SetDisplayWindow 334 * 335 * @brief Sets the location and size of the remote video window. 336 * @param window[in], Window information 337 * @return Returns 0 on success, others on failure. 338 */ 339 int32_t SetDisplayWindow(VideoWindow &window) override; 340 341 /** 342 * SetCameraZoom 343 * 344 * @brief Sets the local camera zoom scale 345 * @param zoomRatio[in], Camera scale 346 * @return Returns 0 on success, others on failure. 347 */ 348 int32_t SetCameraZoom(float zoomRatio) override; 349 350 /** 351 * SetPausePicture 352 * 353 * @brief APP sets the screen of the remote video freeze immediately. 354 * If the APP does not call this interface when making a video call, 355 * the last frame before the remote video freeze is displayed by default 356 * @param path[in], Local Picture address 357 * @return Returns 0 on success, others on failure. 358 */ 359 int32_t SetPausePicture(std::u16string path) override; 360 361 /** 362 * SetDeviceDirection 363 * 364 * @brief Set the rotation Angle of the local device. The default value is 0 365 * @param rotation[in], Rotation Angle 366 * @return Returns 0 on success, others on failure. 367 */ 368 int32_t SetDeviceDirection(int32_t rotation) override; 369 370 /** 371 * IsEmergencyPhoneNumber 372 * 373 * @brief Is it an emergency call 374 * @param number[in], Phone number to be formatted 375 * @param slotId[in], The slot id 376 * @param enabled[out] result of is it an emergency call 377 * @return Returns 0 on success, others on failure. 378 */ 379 int32_t IsEmergencyPhoneNumber(std::u16string &number, int32_t slotId, bool &enabled) override; 380 381 /** 382 * FormatPhoneNumber 383 * 384 * @brief Formatting a phone number 385 * @param number[in], Phone number to be formatted 386 * @param countryCode[in], Country code of the phone number 387 * @param formatNumber[out] Formatting a phone number 388 * @return Returns 0 on success, others on failure. 389 */ 390 int32_t FormatPhoneNumber( 391 std::u16string &number, std::u16string &countryCode, std::u16string &formatNumber) override; 392 393 /** 394 * FormatPhoneNumberToE164 395 * 396 * @brief Formatting a phone number 397 * @param number[in]. Phone number to be formatted 398 * @param countryCode[in], Country code of the phone number 399 * @param formatNumber[out] Formatting a phone number 400 * @return Returns 0 on success, others on failure. 401 */ 402 int32_t FormatPhoneNumberToE164( 403 std::u16string &number, std::u16string &countryCode, std::u16string &formatNumber) override; 404 405 /** 406 * GetMainCallId 407 * 408 * @brief Obtain the ID of the primary call in a conference 409 * @param callId[in], Id of a call in a conference 410 * @return Returns main call id, -1 on not call id. 411 */ 412 int32_t GetMainCallId(int32_t callId, int32_t &mainCallId) override; 413 414 /** 415 * GetSubCallIdList 416 * 417 * @brief Obtain the list of neutron call ids 418 * @param callId[in], Id of a call in a conference 419 * @param callIdList[out], the list of neutron call ids 420 * @return Returns 0 on success, others on failure. 421 */ 422 int32_t GetSubCallIdList(int32_t callId, std::vector<std::u16string> &callIdList) override; 423 424 /** 425 * GetCallIdListForConference 426 * 427 * @brief Obtain the callId list of all calls in a conference 428 * @param callId[in], Id of a call in a conference 429 * @param callIdList[out], the callId list of all calls in a conference 430 * @return Returns 0 on success, others on failure. 431 */ 432 int32_t GetCallIdListForConference(int32_t callId, std::vector<std::u16string> &callIdList) override; 433 434 /** 435 * GetImsConfig 436 * 437 * @brief Obtain the IMS service configuration 438 * @param slotId[in], The slot id 439 * @param item[in] 440 * @return Returns 0 on success, others on failure. 441 */ 442 int32_t GetImsConfig(int32_t slotId, ImsConfigItem item) override; 443 444 /** 445 * SetImsConfig 446 * 447 * @brief Example Set the IMS service configuration 448 * @param slotId[in], The slot id 449 * @param item[in] 450 * @return Returns 0 on success, others on failure. 451 */ 452 int32_t SetImsConfig(int32_t slotId, ImsConfigItem item, std::u16string &value) override; 453 454 /** 455 * GetImsFeatureValue 456 * 457 * @brief Gets the value of the IMS function item of the specified network type 458 * @param slotId[in], The slot id 459 * @param info[in], FeatureType 460 * @return Returns 0 on success, others on failure. 461 */ 462 int32_t GetImsFeatureValue(int32_t slotId, FeatureType type) override; 463 464 /** 465 * SetImsFeatureValue 466 * 467 * @brief Set the value of the IMS function item of the specified network type 468 * @param slotId[in], The slot id 469 * @param info[in], FeatureType 470 * @param value[in] 471 * @return Returns 0 on success, others on failure. 472 */ 473 int32_t SetImsFeatureValue(int32_t slotId, FeatureType type, int32_t value) override; 474 475 /** 476 * UpdateImsCallMode 477 * 478 * @brief Setting the Call Mode 479 * @param callId[in], The call id 480 * @param mode[in], Calling patterns 481 * @return Returns 0 on success, others on failure. 482 */ 483 int32_t UpdateImsCallMode(int32_t callId, ImsCallMode mode) override; 484 485 /** 486 * EnableImsSwitch 487 * 488 * @brief Start VoLte 489 * @param slotId[in], The slot id 490 * @return Returns 0 on success, others on failure. 491 */ 492 int32_t EnableImsSwitch(int32_t slotId) override; 493 494 /** 495 * DisableImsSwitch 496 * 497 * @brief Stop VoLte 498 * @param slotId[in], The slot id 499 * @return Returns 0 on success, others on failure. 500 */ 501 int32_t DisableImsSwitch(int32_t slotId) override; 502 503 /** 504 * IsImsSwitchEnabled 505 * 506 * @brief Whether to enable VoLte 507 * @param slotId[in], The slot id 508 * @param enabled[out], The result of enable or not 509 * @return Returns 0 on success, others on failure. 510 */ 511 int32_t IsImsSwitchEnabled(int32_t slotId, bool &enabled) override; 512 513 /** 514 * StartRtt 515 * 516 * @brief Enable and send RTT information 517 * @param callId[in], The call id 518 * @param msg[in], RTT information 519 * @return Returns 0 on success, others on failure. 520 */ 521 int32_t StartRtt(int32_t callId, std::u16string &msg) override; 522 523 /** 524 * StopRtt 525 * 526 * @brief Close the RTT 527 * @param callId[in], The call id 528 * @return Returns 0 on success, others on failure. 529 */ 530 int32_t StopRtt(int32_t callId) override; 531 532 /** 533 * ReportOttCallDetailsInfo 534 * 535 * @brief report ott call details info 536 * @param ottVec[in], ott call status detail info list 537 * @return Returns 0 on success, others on failure. 538 */ 539 int32_t ReportOttCallDetailsInfo(std::vector<OttCallDetailsInfo> &ottVec) override; 540 541 /** 542 * ReportOttCallEventInfo 543 * 544 * @brief report ott call event info 545 * @param eventInfo[in], ott call event detail info 546 * @return Returns 0 on success, others on failure. 547 */ 548 int32_t ReportOttCallEventInfo(OttCallEventInfo &eventInfo) override; 549 550 /** 551 * GetProxyObjectPtr 552 * 553 * @brief get callManager proxy object ptr 554 * @param proxyType[in], proxy type 555 * @return Returns nullptr on failure, others on success. 556 */ 557 sptr<IRemoteObject> GetProxyObjectPtr(CallManagerProxyType proxyType) override; 558 559 private: 560 static inline BrokerDelegator<CallManagerServiceProxy> delegator_; 561 }; 562 } // namespace Telephony 563 } // namespace OHOS 564 565 #endif // CALL_MANAGER_SERVICE_PROXY_H 566