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 Set the call restriction function for the current account 263 * 264 * @param cRInfo[in] contains the password, call restriction type and call restriction mode 265 * @param slotId[in] the slot id 266 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 267 */ 268 virtual int32_t SetCallRestriction(int32_t slotId, const CallRestrictionInfo &cRInfo) = 0; 269 270 /** 271 * @brief Set the call restriction password of the specified account 272 * 273 * @param slotId[in] the slot id 274 * @param fac[in] indicate the call restriction type, just like all incoming, all outgoing .etc 275 * @param oldPassword[in] indicate the call restriction old password 276 * @param newPassword[in] indicate the call restriction new password 277 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 278 */ 279 virtual int32_t SetCallRestrictionPassword( 280 int32_t slotId, CallRestrictionType fac, const char *oldPassword, const char *newPassword) = 0; 281 282 /** 283 * @brief Gets the call restriction information of the specified account 284 * 285 * @param facType[in] indicate the call restriction type, just like all incoming, all outgoing .etc 286 * @param slotId[in] the slot id 287 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 288 */ 289 virtual int32_t GetCallRestriction(int32_t slotId, CallRestrictionType facType) = 0; 290 291 /** 292 * @brief Register CallMnager CallBack ptr 293 * 294 * @param callback callback ptr 295 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 296 */ 297 virtual int32_t RegisterCallManagerCallBack(const sptr<ICallStatusCallback> &callback) = 0; 298 299 /** 300 * @brief UnRegister CallMnager CallBack ptr 301 * 302 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 303 */ 304 virtual int32_t UnRegisterCallManagerCallBack() = 0; 305 306 /** 307 * @brief Set Domain Preference Mode 308 * 309 * @param mode[in] indicate the domain preference, 1: CS only, 2: CS prefer, 3: PS prefer, 4: PS only 310 * @param slotId[in] the slot id 311 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 312 */ 313 virtual int32_t SetDomainPreferenceMode(int32_t slotId, int32_t mode) = 0; 314 315 /** 316 * @brief Get Domain Preference Mode 317 * 318 * @param slotId[in] the slot id 319 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 320 */ 321 virtual int32_t GetDomainPreferenceMode(int32_t slotId) = 0; 322 323 /** 324 * @brief Set Ims Switch Status 325 * 326 * @param active[in] indicate the ims switch status, true is on, false is off 327 * @param slotId[in] the slot id 328 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 329 */ 330 virtual int32_t SetImsSwitchStatus(int32_t slotId, bool active) = 0; 331 332 /** 333 * @brief Get Ims Switch Status 334 * 335 * @param slotId[in] the slot id 336 * @param enabled[out] indicate the ims switch status, true is on, false is off 337 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 338 */ 339 virtual int32_t GetImsSwitchStatus(int32_t slotId, bool &enabled) = 0; 340 341 /** 342 * @brief Set VoNR Switch Status 343 * 344 * @param state[in] Indicates the VoNR state, 0: off, 1: on 345 * @param slotId[in] the slot id 346 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 347 */ 348 virtual int32_t SetVoNRState(int32_t slotId, int32_t state) = 0; 349 350 /** 351 * @brief Get VoNR Switch Status 352 * 353 * @param slotId[in] the slot id 354 * @param state[out] Indicates the VoNR state, 0: off, 1: on 355 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 356 */ 357 virtual int32_t GetVoNRState(int32_t slotId, int32_t &state) = 0; 358 359 /** 360 * @brief Set Ims Config 361 * 362 * @param item[in] Identify specific item, like ITEM_VIDEO_QUALITY, ITEM_IMS_SWITCH_STATUS 363 * @param value[in] The specific value corresponding to the item 364 * @param slotId[in] the slot id 365 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 366 */ 367 virtual int32_t SetImsConfig(int32_t slotId, ImsConfigItem item, const std::string &value) = 0; 368 369 /** 370 * @brief Set Ims Config 371 * 372 * @param item[in] Identify specific item, like ITEM_VIDEO_QUALITY, ITEM_IMS_SWITCH_STATUS 373 * @param value[in] The specific value corresponding to the item 374 * @param slotId[in] the slot id 375 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 376 */ 377 virtual int32_t SetImsConfig(int32_t slotId, ImsConfigItem item, int32_t value) = 0; 378 379 /** 380 * @brief Get Ims Config 381 * 382 * @param item[in] Identify specific item, like ITEM_VIDEO_QUALITY, ITEM_IMS_SWITCH_STATUS 383 * @param slotId[in] the slot id 384 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 385 */ 386 virtual int32_t GetImsConfig(int32_t slotId, ImsConfigItem item) = 0; 387 388 /** 389 * @brief Set Ims Feature Value 390 * 391 * @param type[in] the ims feature item, like VoLTE, ViLTE, SS over UT 392 * @param value[in] The specific value corresponding to the item 393 * @param slotId[in] the slot id 394 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 395 */ 396 virtual int32_t SetImsFeatureValue(int32_t slotId, FeatureType type, int32_t value) = 0; 397 398 /** 399 * @brief Get Ims Feature Value 400 * 401 * @param type[in] the ims feature item, like VoLTE, ViLTE, SS over UT 402 * @param slotId[in] the slot id 403 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 404 */ 405 virtual int32_t GetImsFeatureValue(int32_t slotId, FeatureType type) = 0; 406 407 /** 408 * @brief set camara to be enabled for video call 409 * 410 * @param slotId[in] the slot id 411 * @param index[in] the index of call 412 * @param cameraId[in] The id of the camera 413 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 414 */ 415 virtual int32_t ControlCamera( 416 int32_t slotId, int32_t index, const std::string &cameraId) = 0; 417 418 /** 419 * @brief set a window which used to display a preview of camera capturing 420 * 421 * @param slotId[in] the slot id 422 * @param index[in] the index of call 423 * @param surfaceId[in] the window information 424 * @param surface[in] the window information 425 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 426 */ 427 virtual int32_t SetPreviewWindow( 428 int32_t slotId, int32_t index, const std::string &surfaceId, sptr<Surface> surface) = 0; 429 430 /** 431 * @brief set a window which used to display the viedo which is received from remote 432 * 433 * @param slotId[in] the slot id 434 * @param index[in] the index of call 435 * @param surfaceId[in] the window information 436 * @param surface[in] the window information 437 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 438 */ 439 virtual int32_t SetDisplayWindow( 440 int32_t slotId, int32_t index, const std::string &surfaceId, sptr<Surface> surface) = 0; 441 442 /** 443 * @brief set camera zoom ratio 444 * 445 * @param zoomRatio[in] the camera zoom ratio 446 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 447 */ 448 virtual int32_t SetCameraZoom(float zoomRatio) = 0; 449 450 /** 451 * @brief set a image which will be displayed when the video signal is paused 452 * 453 * @param slotId[in] the slot id 454 * @param index[in] the index of call 455 * @param path[in] the dispalyed image path 456 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 457 */ 458 virtual int32_t SetPausePicture(int32_t slotId, int32_t index, const std::string &path) = 0; 459 460 /** 461 * @brief set the device orientation 462 * 463 * @param slotId[in] the slot id 464 * @param index[in] the index of call 465 * @param rotation[in] The device orientation, in degrees 466 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 467 */ 468 virtual int32_t SetDeviceDirection(int32_t slotId, int32_t index, int32_t rotation) = 0; 469 470 /** 471 * @brief Set the mute state of the call 472 * 473 * @param mute[in] 1 means the call could be muted 474 * @param slotId[in] the slot id 475 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 476 */ 477 virtual int32_t SetMute(int32_t slotId, int32_t mute) = 0; 478 479 /** 480 * @brief Get the mute state of the call 481 * 482 * @param slotId[in] the slot id 483 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 484 */ 485 virtual int32_t GetMute(int32_t slotId) = 0; 486 487 /** 488 * @brief Set emergency phone number 489 * 490 * @param eccVecr[in] ecc number info list 491 * @param slotId[in] The slot id 492 * @return Returns TELEPHONY_SUCCESS on true, others on false. 493 */ 494 virtual int32_t SetEmergencyCallList(int32_t slotId, std::vector<EmergencyCall> &eccVec) = 0; 495 496 /** 497 * @brief Close Unfinished ussd function for the current account 498 * 499 * @param slotId[in] the slot id 500 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 501 */ 502 virtual int32_t CloseUnFinishedUssd(int32_t slotId) = 0; 503 504 /** 505 * @brief clear all call if cellular call service restart 506 * 507 * @param infos[in] the call detail info vector which contains phone number, call type, slot id .etc 508 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 509 */ 510 virtual int32_t ClearAllCalls(const std::vector<CellularCallInfo> &infos) = 0; 511 512 /** 513 * @brief cancel call upgrade 514 * 515 * @param slotId[in] the slot id 516 * @param index[in] the index of call 517 * @return Returns 0 on success, others on failure. 518 */ 519 virtual int32_t CancelCallUpgrade(int32_t slotId, int32_t index) = 0; 520 521 /** 522 * @brief request camera capabilities 523 * 524 * @param slotId[in] the slot id 525 * @param index[in] the index of call 526 * @return Returns 0 on success, others on failure. 527 */ 528 virtual int32_t RequestCameraCapabilities(int32_t slotId, int32_t index) = 0; 529 530 public: 531 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Telephony.CellularCallInterface"); 532 }; 533 } // namespace Telephony 534 } // namespace OHOS 535 #endif // CELLULAR_CALL_INTERFACE_H 536