1 /* 2 * Copyright (C) 2021-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 CELLULAR_CALL_PROXY_H 17 #define CELLULAR_CALL_PROXY_H 18 19 #include "cellular_call_interface.h" 20 #include "cellular_call_ipc_interface_code.h" 21 #include "iremote_proxy.h" 22 23 namespace OHOS { 24 namespace Telephony { 25 class CellularCallProxy : public IRemoteProxy<CellularCallInterface> { 26 public: 27 /** 28 * @brief Construct a new Cellular Call Proxy object 29 * 30 * @param impl 31 */ CellularCallProxy(const sptr<IRemoteObject> & impl)32 explicit CellularCallProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<CellularCallInterface>(impl) {} 33 34 /** 35 * @brief Destroy the Cellular Call Proxy object 36 */ 37 ~CellularCallProxy() = default; 38 39 /** 40 * @brief dial a call 41 * 42 * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc 43 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 44 */ 45 int32_t Dial(const CellularCallInfo &callInfo) override; 46 47 /** 48 * @brief hang up a call 49 * 50 * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc 51 * @param type[in] Indicates the +CHLD related supplementary services. 52 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 53 */ 54 int32_t HangUp(const CellularCallInfo &callInfo, CallSupplementType type) override; 55 56 /** 57 * @brief reject a call 58 * 59 * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc 60 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 61 */ 62 int32_t Reject(const CellularCallInfo &callInfo) override; 63 64 /** 65 * @brief answer a call 66 * 67 * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc 68 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 69 */ 70 int32_t Answer(const CellularCallInfo &callInfo) override; 71 72 /** 73 * @brief hold a call 74 * 75 * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc 76 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 77 */ 78 int32_t HoldCall(const CellularCallInfo &callInfo) override; 79 80 /** 81 * @brief unhold a call 82 * 83 * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc 84 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 85 */ 86 int32_t UnHoldCall(const CellularCallInfo &callInfo) override; 87 88 /** 89 * @brief switch the call 90 * 91 * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc 92 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 93 */ 94 int32_t SwitchCall(const CellularCallInfo &callInfo) override; 95 96 /** 97 * @brief Checks whether the called number is an emergency number 98 * 99 * @param slotId[in] the slot id 100 * @param phoneNum[in] the phone number 101 * @param enabled[out] if the phone number is ecc, true is yes, false is no 102 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 103 */ 104 int32_t IsEmergencyPhoneNumber(int32_t slotId, const std::string &phoneNum, bool &enabled) override; 105 106 /** 107 * @brief Merge into multiple calls 108 * 109 * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc 110 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 111 */ 112 int32_t CombineConference(const CellularCallInfo &callInfo) override; 113 114 /** 115 * @brief Separate the Conference call 116 * 117 * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc 118 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 119 */ 120 int32_t SeparateConference(const CellularCallInfo &callInfo) override; 121 122 /** 123 * @brief Invite someone to the conference call 124 * 125 * @param numberList[in] the number list to invite to conference 126 * @param slotId[in] the slot id 127 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 128 */ 129 int32_t InviteToConference(int32_t slotId, const std::vector<std::string> &numberList) override; 130 131 /** 132 * @brief Kick out someone from the conference call 133 * 134 * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc 135 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 136 */ 137 int32_t KickOutFromConference(const CellularCallInfo &callInfo) override; 138 139 /** 140 * @brief Hang Up All Connection 141 * 142 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 143 */ 144 int32_t HangUpAllConnection() override; 145 146 /** 147 * @brief Hang Up All Connection 148 * 149 * @param slotId[in] the slot id 150 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 151 */ 152 int32_t HangUpAllConnection(int32_t slotId) override; 153 154 /** 155 * @brief set whether the device can make calls 156 * 157 * @param slotId[in] the slot id 158 * @param callType[in] indicate the call type is cs or ims. 0 is cs, 1 is ims 159 * @param isReadyToCall[in] indicate whether the device can make calls 160 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 161 */ 162 int32_t SetReadyToCall(int32_t slotId, int32_t callType, bool isReadyToCall) override; 163 164 /** 165 * @brief IMS Send Call Media Mode Request 166 * 167 * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc 168 * @param mode[in] indicate the call mode just like audio only, receive only .etc 169 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 170 */ 171 int32_t SendUpdateCallMediaModeRequest(const CellularCallInfo &callInfo, ImsCallMode mode) override; 172 173 /** 174 * @brief IMS Send Call Media Mode Response 175 * 176 * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc 177 * @param mode[in] indicate the call mode just like audio only, receive only .etc 178 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 179 */ 180 int32_t SendUpdateCallMediaModeResponse(const CellularCallInfo &callInfo, ImsCallMode mode) override; 181 182 /** 183 * @brief start to paly a dtmf tone 184 * 185 * @param cDtmfCode[in] A character indicate the DTMF digit for which to play the tone. This 186 * value must be one of {0~9}, {*} or {#}. 187 * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc 188 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 189 */ 190 int32_t StartDtmf(char cDtmfCode, const CellularCallInfo &callInfo) override; 191 192 /** 193 * @brief stop the playing dtmf tone 194 * 195 * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc 196 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 197 */ 198 int32_t StopDtmf(const CellularCallInfo &callInfo) override; 199 200 int32_t PostDialProceed(const CellularCallInfo &callInfo, const bool proceed) override; 201 202 /** 203 * @brief play a dtmf tone 204 * 205 * @param cDtmfCode[in] A character indicate the DTMF digit for which to play the tone. This 206 * value must be one of {0~9}, {*} or {#}. 207 * @param callInfo[in] the call detail info which contains phone number, call type, slot id .etc 208 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 209 */ 210 int32_t SendDtmf(char cDtmfCode, const CellularCallInfo &callInfo) override; 211 212 /** 213 * @brief Start a Rtt session 214 * 215 * @param msg the rtt message 216 * @param slotId[in] the slot id 217 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 218 */ 219 int32_t StartRtt(int32_t slotId, const std::string &msg) override; 220 221 /** 222 * @brief Terminate the current RTT session 223 * 224 * @param slotId[in] the slot id 225 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 226 */ 227 int32_t StopRtt(int32_t slotId) override; 228 229 /** 230 * @brief set call transfer for the slot id 231 * 232 * @param ctInfo[in] contains the call transfer type, enable/disable, the transfered number, the start/end time 233 * @param slotId[in] the slot id 234 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 235 */ 236 int32_t SetCallTransferInfo(int32_t slotId, const CallTransferInfo &cfInfo) override; 237 238 /** 239 * @brief confirm whether IMS can set call transfer time 240 * 241 * @param slotId[in] the slot id 242 * @param result[out] whether IMS can set call transfer time. true mean yes, false mean no 243 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 244 */ 245 int32_t CanSetCallTransferTime(int32_t slotId, bool &result) override; 246 247 /** 248 * @brief Get Call Transfer information 249 * 250 * @param type[in] indicate the call transfer type, just like CFU, CFB, CFNRy, CFNRc 251 * @param slotId[in] the slot id 252 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 253 */ 254 int32_t GetCallTransferInfo(int32_t slotId, CallTransferType type) override; 255 256 /** 257 * @brief Set Call Waiting 258 * 259 * @param activate[in] true mean activate the call waiting, false mean inactivate 260 * @param slotId[in] the slot id 261 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 262 */ 263 int32_t SetCallWaiting(int32_t slotId, bool activate) override; 264 265 /** 266 * @brief Gets whether the call waiting service of the current account is enabled 267 * 268 * @param slotId[in] the slot id 269 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 270 */ 271 int32_t GetCallWaiting(int32_t slotId) override; 272 273 /** 274 * @brief Gets whether the call waiting service of the current account is enabled 275 * 276 * @param slotId[in] the slot id 277 * @param enabled 278 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 279 */ 280 int32_t GetVideoCallWaiting(int32_t slotId, bool &enabled) override; 281 282 /** 283 * @brief Set the call restriction function for the current account 284 * 285 * @param cRInfo[in] contains the password, call restriction type and call restriction mode 286 * @param slotId[in] the slot id 287 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 288 */ 289 int32_t SetCallRestriction(int32_t slotId, const CallRestrictionInfo &crInfo) override; 290 291 /** 292 * @brief Set the call restriction password of the specified account 293 * 294 * @param slotId[in] the slot id 295 * @param fac[in] indicate the call restriction type, just like all incoming, all outgoing .etc 296 * @param oldPassword[in] indicate the call restriction old password 297 * @param newPassword[in] indicate the call restriction new password 298 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 299 */ 300 int32_t SetCallRestrictionPassword( 301 int32_t slotId, CallRestrictionType fac, const char *oldPassword, const char *newPassword) override; 302 303 /** 304 * @brief Gets the call restriction information of the specified account 305 * 306 * @param facType[in] indicate the call restriction type, just like all incoming, all outgoing .etc 307 * @param slotId[in] the slot id 308 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 309 */ 310 int32_t GetCallRestriction(int32_t slotId, CallRestrictionType facType) override; 311 312 /** 313 * @brief Register CallManager CallBack ptr 314 * 315 * @param callback callback ptr 316 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 317 */ 318 int32_t RegisterCallManagerCallBack(const sptr<ICallStatusCallback> &callback) override; 319 320 /** 321 * @brief UnRegister CallManager CallBack ptr 322 * 323 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 324 */ 325 int32_t UnRegisterCallManagerCallBack() override; 326 327 /** 328 * @brief Set Domain Preference Mode 329 * 330 * @param mode[in] indicate the domain preference, 1: CS only, 2: CS prefer, 3: PS prefer, 4: PS only 331 * @param slotId[in] the slot id 332 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 333 */ 334 int32_t SetDomainPreferenceMode(int32_t slotId, int32_t mode) override; 335 336 /** 337 * @brief Get Domain Preference Mode 338 * 339 * @param slotId[in] the slot id 340 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 341 */ 342 int32_t GetDomainPreferenceMode(int32_t slotId) override; 343 344 /** 345 * @brief Set Ims Switch Status 346 * 347 * @param active[in] indicate the ims switch status, true is on, false is off 348 * @param slotId[in] the slot id 349 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 350 */ 351 int32_t SetImsSwitchStatus(int32_t slotId, bool active) override; 352 353 /** 354 * @brief Get Ims Switch Status 355 * 356 * @param slotId[in] the slot id 357 * @param enabled[out] indicate the ims switch status, true is on, false is off 358 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 359 */ 360 int32_t GetImsSwitchStatus(int32_t slotId, bool &enabled) override; 361 362 /** 363 * @brief Get Carrier Vt Config 364 * 365 * @param slotId[in] the slot id 366 * @param enabled[out] indicate the carrier vt config, true is support, false is not support 367 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 368 */ 369 int32_t GetCarrierVtConfig(int32_t slotId, bool &enabled) override; 370 371 /** 372 * @brief Set VoNR Switch Status 373 * 374 * @param state[in] Indicates the VoNR state, 0: off, 1: on 375 * @param slotId[in] the slot id 376 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 377 */ 378 int32_t SetVoNRState(int32_t slotId, int32_t state) override; 379 380 /** 381 * @brief Get VoNR Switch Status 382 * 383 * @param slotId[in] the slot id 384 * @param state[out] Indicates the VoNR state, 0: off, 1: on 385 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 386 */ 387 int32_t GetVoNRState(int32_t slotId, int32_t &state) override; 388 389 /** 390 * @brief Set Ims Config 391 * 392 * @param item[in] Identify specific item, like ITEM_VIDEO_QUALITY, ITEM_IMS_SWITCH_STATUS 393 * @param value[in] The specific value corresponding to the item 394 * @param slotId[in] the slot id 395 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 396 */ 397 int32_t SetImsConfig(int32_t slotId, ImsConfigItem item, const std::string &value) override; 398 399 /** 400 * @brief Set Ims Config 401 * 402 * @param item[in] Identify specific item, like ITEM_VIDEO_QUALITY, ITEM_IMS_SWITCH_STATUS 403 * @param value[in] The specific value corresponding to the item 404 * @param slotId[in] the slot id 405 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 406 */ 407 int32_t SetImsConfig(int32_t slotId, ImsConfigItem item, int32_t value) override; 408 409 /** 410 * @brief Get Ims Config 411 * 412 * @param item[in] Identify specific item, like ITEM_VIDEO_QUALITY, ITEM_IMS_SWITCH_STATUS 413 * @param slotId[in] the slot id 414 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 415 */ 416 int32_t GetImsConfig(int32_t slotId, ImsConfigItem item) override; 417 418 /** 419 * @brief Set Ims Feature Value 420 * 421 * @param type[in] the ims feature item, like VoLTE, ViLTE, SS over UT 422 * @param value[in] The specific value corresponding to the item 423 * @param slotId[in] the slot id 424 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 425 */ 426 int32_t SetImsFeatureValue(int32_t slotId, FeatureType type, int32_t value) override; 427 428 /** 429 * @brief Get Ims Feature Value 430 * 431 * @param type[in] the ims feature item, like VoLTE, ViLTE, SS over UT 432 * @param slotId[in] the slot id 433 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 434 */ 435 int32_t GetImsFeatureValue(int32_t slotId, FeatureType type) override; 436 437 /** 438 * @brief set camara to be enabled for video call 439 * 440 * @param slotId[in] the slot id 441 * @param index[in] the index of call 442 * @param cameraId[in] The id of the camera 443 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 444 */ 445 int32_t ControlCamera(int32_t slotId, int32_t index, const std::string &cameraId) override; 446 447 /** 448 * @brief set a window which used to display a preview of camera capturing 449 * 450 * @param slotId[in] the slot id 451 * @param index[in] the index of call 452 * @param surfaceId[in] the window information 453 * @param surface[in] the window information 454 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 455 */ 456 int32_t SetPreviewWindow( 457 int32_t slotId, int32_t index, const std::string &surfaceId, sptr<Surface> surface) override; 458 459 /** 460 * @brief set a window which used to display the viedo which is received from remote 461 * 462 * @param slotId[in] the slot id 463 * @param index[in] the index of call 464 * @param surfaceId[in] the window information 465 * @param surface[in] the window information 466 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 467 */ 468 int32_t SetDisplayWindow( 469 int32_t slotId, int32_t index, const std::string &surfaceId, sptr<Surface> surface) override; 470 471 /** 472 * @brief set camera zoom ratio 473 * 474 * @param zoomRatio[in] the camera zoom ratio 475 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 476 */ 477 int32_t SetCameraZoom(float zoomRatio) override; 478 479 /** 480 * @brief set a image which will be displayed when the video signal is paused 481 * 482 * @param slotId[in] the slot id 483 * @param index[in] the index of call 484 * @param path[in] the dispalyed image path 485 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 486 */ 487 int32_t SetPausePicture(int32_t slotId, int32_t index, const std::string &path) override; 488 489 /** 490 * @brief set the device orientation 491 * 492 * @param slotId[in] the slot id 493 * @param index[in] the index of call 494 * @param rotation[in] The device orientation, in degrees 495 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 496 */ 497 int32_t SetDeviceDirection(int32_t slotId, int32_t index, int32_t rotation) override; 498 499 /** 500 * @brief Set the mute state of the call 501 * 502 * @param mute[in] 1 means the call could be muted 503 * @param slotId[in] the slot id 504 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 505 */ 506 int32_t SetMute(int32_t mute, int32_t slotId) override; 507 508 /** 509 * @brief Get the mute state of the call 510 * 511 * @param slotId[in] the slot id 512 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 513 */ 514 int32_t GetMute(int32_t slotId) override; 515 516 /** 517 * @brief Set emergency phone number 518 * 519 * @param eccVecr[in] ecc number info list 520 * @param slotId[in] The slot id 521 * @return Returns TELEPHONY_SUCCESS on true, others on false. 522 */ 523 int32_t SetEmergencyCallList(int32_t slotId, std::vector<EmergencyCall> &eccVec) override; 524 525 /** 526 * @brief Close Unfinished ussd function for the current account 527 * 528 * @param slotId[in] the slot id 529 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 530 */ 531 int32_t CloseUnFinishedUssd(int32_t slotId) override; 532 533 /** 534 * @brief clear all call if cellular call service restart 535 * 536 * @param infos[in] the call detail info vector which contains phone number, call type, slot id .etc 537 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 538 */ 539 int32_t ClearAllCalls(const std::vector<CellularCallInfo> &infos) override; 540 541 /** 542 * @brief cancel call upgrade 543 * 544 * @param slotId[in] the slot id 545 * @param index[in] the index of call 546 * @return Returns 0 on success, others on failure. 547 */ 548 int32_t CancelCallUpgrade(int32_t slotId, int32_t index) override; 549 550 /** 551 * @brief request camera capabilities 552 * 553 * @param slotId[in] the slot id 554 * @param index[in] the index of call 555 * @return Returns 0 on success, others on failure. 556 */ 557 int32_t RequestCameraCapabilities(int32_t slotId, int32_t index) override; 558 559 /** 560 * @brief send ussd response to modem 561 * 562 * @param slotId[in] the slot id 563 * @param content[in] the content need send to modem 564 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 565 */ 566 int32_t SendUssdResponse(int32_t slotId, const std::string &content) override; 567 568 /** 569 * @brief is mmi code 570 * 571 * @param slotId[in] the slot id 572 * @param number[in] the phone number 573 * @return Returns true on phone number is mmi code, else return false. 574 */ 575 bool IsMmiCode(int32_t slotId, std::string &number) override; 576 577 private: 578 /** 579 * @brief SetCommonParamForMessageParcel, set common param for MessageParcel 580 * 581 * @param slotId[in] the slot id 582 * @param in[out] the MessageParcel which will contain some common parameters like slotid, token, 583 * max size while the return is success. 584 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 585 */ 586 int32_t SetCommonParamForMessageParcel(int32_t slotId, MessageParcel &in); 587 588 private: 589 static inline BrokerDelegator<CellularCallProxy> delegator_; 590 }; 591 } // namespace Telephony 592 } // namespace OHOS 593 #endif // CELLULAR_CALL_PROXY_H 594