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