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 CORE_SERVICE_CLIENT_H 17 #define CORE_SERVICE_CLIENT_H 18 19 #include <cstdint> 20 #include <iremote_object.h> 21 #include <singleton.h> 22 #include <string_ex.h> 23 24 #include "i_core_service.h" 25 26 namespace OHOS { 27 namespace Telephony { 28 class CoreServiceClient : public DelayedRefSingleton<CoreServiceClient> { 29 DECLARE_DELAYED_REF_SINGLETON(CoreServiceClient); 30 31 public: 32 sptr<ICoreService> GetProxy(); 33 void OnRemoteDied(const wptr<IRemoteObject> &remote); 34 35 /** 36 * @brief Obtain the list of signal strength information of the registered network 37 * 38 * @param slotId[in], sim slot id 39 * @param signalslist[out], list of signal strength information of the registered network 40 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 41 */ 42 int32_t GetSignalInfoList(int32_t slotId, std::vector<sptr<SignalInformation>> &signals); 43 44 /** 45 * @brief Checks whether the device supports 5G New Radio (NR). 46 * 47 * @param slotId[in], sim slot id 48 * @return returns true if the device supports 5G NR; returns false otherwise. 49 */ 50 bool IsNrSupported(int32_t slotId); 51 52 /** 53 * @brief Obtain radio access technology (RAT) of the PS domain 54 * 55 * @param slotId[in], sim slot id 56 * @param psRadioTech[out], RAT of the PS domain on the registered network 57 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 58 */ 59 int32_t GetPsRadioTech(int32_t slotId, int32_t &psRadioTech); 60 61 /** 62 * @brief Obtain radio access technology (RAT) of the CS domain 63 * 64 * @param slotId[in], sim slot id 65 * @param csRadioTech[out], RAT of the CS domain on the registered network 66 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 67 */ 68 int32_t GetCsRadioTech(int32_t slotId, int32_t &csRadioTech); 69 70 /** 71 * @brief Obtain the selection mode of NR 72 * 73 * @param slotId[in], sim slot id 74 * @param mode[in], the selection mode of NR 75 * @param callback[out], Indicates the result of setting NR mode 76 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 77 */ 78 int32_t SetNrOptionMode(int32_t slotId, int32_t mode, const sptr<INetworkSearchCallback> &callback); 79 80 /** 81 * @brief Obtain the selection mode of NR 82 * 83 * @param slotId[in], sim slot id 84 * @param callback[out], the callback of NR mode 85 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 86 */ 87 int32_t GetNrOptionMode(int32_t slotId, const sptr<INetworkSearchCallback> &callback); 88 89 /** 90 * @brief Obtain the unique ID 91 * 92 * @param slotId[in], sim slot id 93 * @param deviceId[out], the unique ID of a device 94 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 95 */ 96 int32_t GetUniqueDeviceId(int32_t slotId, std::u16string &deviceId); 97 98 /** 99 * @brief Obtain the mobile equipment identifier 100 * 101 * @param slotId[in], sim slot id 102 * @param meid[out], the mobile equipment identifier of the SIM card 103 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 104 */ 105 int32_t GetMeid(int32_t slotId, std::u16string &meid); 106 107 /** 108 * @brief Obtain the operator numeric 109 * 110 * @param slotId[in], sim slot id 111 * @return std::u16string operator numeric of PLMN of the SIM card. 112 */ 113 std::u16string GetOperatorNumeric(int32_t slotId); 114 115 /** 116 * @brief Obtain the operator name 117 * 118 * @param slotId[in], sim slot id 119 * @param operatorName[out], the operator name of the SIM card 120 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 121 */ 122 int32_t GetOperatorName(int32_t slotId, std::u16string &operatorName); 123 124 /** 125 * @brief Obtain the network state 126 * 127 * @param slotId[in], sim slot id 128 * @param networkState[out], the callback of network registration state 129 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 130 */ 131 int32_t GetNetworkState(int32_t slotId, sptr<NetworkState> &networkState); 132 133 /** 134 * @brief Set the radio state 135 * 136 * @param slotId[in], sim slot id 137 * @param isOn[in], turn on or turn off the radio service 138 * @param callback[out], the callback of radio state 139 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 140 */ 141 int32_t SetRadioState(int32_t slotId, bool isOn, const sptr<INetworkSearchCallback> &callback); 142 143 /** 144 * @brief Obtain the radio state 145 * 146 * @param slotId[in], sim slot id 147 * @param callback[out], the callback of radio state 148 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 149 */ 150 int32_t GetRadioState(int32_t slotId, const sptr<INetworkSearchCallback> &callback); 151 152 /** 153 * @brief Obtain the International Mobile Equipment Identification 154 * 155 * @param slotId[in], sim slot id 156 * @param imei[out], the International Mobile Equipment Identification Number of the SIM card 157 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 158 */ 159 int32_t GetImei(int32_t slotId, std::u16string &imei); 160 161 /** 162 * @brief Checks whether a SIM card is inserted in a specified slot. 163 * 164 * @param slotId[in], sim slot id 165 * @param hasSimCard[out], returns true if a SIM card is inserted; return false otherwise 166 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 167 */ 168 int32_t HasSimCard(int32_t slotId, bool &hasSimCard); 169 170 /** 171 * @brief Obtain the state of the SIM card 172 * 173 * @param slotId[in], sim slot id 174 * @param simState[out], the state of the SIM card 175 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 176 */ 177 int32_t GetSimState(int32_t slotId, SimState &simState); 178 179 /** 180 * @brief Obtain the operator numeric of PLMN 181 * 182 * @param slotId[in], sim slot id 183 * @param operatorNumeric[out], the operator numeric of PLMN of the SIM card 184 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 185 */ 186 int32_t GetSimOperatorNumeric(int32_t slotId, std::u16string &operatorNumeric); 187 188 /** 189 * @brief Obtain the ISO country code 190 * 191 * @param slotId[in], sim slot id 192 * @param countryCode[out], the ISO country code of the SIM card 193 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 194 */ 195 int32_t GetISOCountryCodeForSim(int32_t slotId, std::u16string &countryCode); 196 197 /** 198 * @brief Obtain the service provider name 199 * 200 * @param slotId[in], sim slot id 201 * @param spn[out], the service provider name of the SIM card 202 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 203 */ 204 int32_t GetSimSpn(int32_t slotId, std::u16string &spn); 205 206 /** 207 * @brief Obtain the integrated circuit card identity 208 * 209 * @param slotId[in], sim slot id 210 * @param iccId[out], the integrated circuit card identity of the SIM card 211 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 212 */ 213 int32_t GetSimIccId(int32_t slotId, std::u16string &iccId); 214 215 /** 216 * @brief Obtain the international mobile subscriber identity 217 * 218 * @param slotId[in], sim slot id 219 * @param imsi[out], the international mobile subscriber identity of the SIM card 220 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 221 */ 222 int32_t GetIMSI(int32_t slotId, std::u16string &imsi); 223 224 /** 225 * @brief Checks whether the SIM card in a specified slot is activated 226 * 227 * @param slotId[in], sim slot id 228 * @return returns true if the SIM card activated; returns false otherwise. 229 */ 230 bool IsSimActive(int32_t slotId); 231 232 /** 233 * @brief Obtain the sim slot id of the simId 234 * 235 * @param simId[in], sim card id 236 * @return return the sim slot id of the simId. 237 */ 238 int32_t GetSlotId(int32_t simId); 239 240 /** 241 * @brief Obtain the sim card id 242 * 243 * @param slotId[in], sim slot id 244 * @return return the sim card id of the SIM card. 245 */ 246 int32_t GetSimId(int32_t slotId); 247 248 /** 249 * @brief Obtain the callback of network search information 250 * 251 * @param slotId[in], sim slot id 252 * @param callback[out], the callback of network search information 253 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 254 */ 255 int32_t GetNetworkSearchInformation(int32_t slotId, const sptr<INetworkSearchCallback> &callback); 256 257 /** 258 * @brief Obtain the callback of network selection mode 259 * 260 * @param slotId[in], sim slot id 261 * @param callback[out], the callback of network selection mode 262 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 263 */ 264 int32_t GetNetworkSelectionMode(int32_t slotId, const sptr<INetworkSearchCallback> &callback); 265 266 /** 267 * @brief Obtain the locale from the default sim 268 * 269 * @return std::u16string locale from default sim. 270 */ 271 std::u16string GetLocaleFromDefaultSim(); 272 273 /** 274 * @brief Obtain the group identifier level 1 275 * 276 * @param slotId[in], sim slot id 277 * @param gid1[out], the group identifier level 1 of the SIM card 278 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 279 */ 280 int32_t GetSimGid1(int32_t slotId, std::u16string &gid1); 281 282 /** 283 * @brief Obtain the group identifier level 2 284 * 285 * @param slotId[in], sim slot id 286 * @return std::u16string the group identifier level 2 of the SIM card. 287 */ 288 std::u16string GetSimGid2(int32_t slotId); 289 290 /** 291 * @brief Obtain the enhanced operator name string 292 * 293 * @param slotId[in], sim slot id 294 * @param plmn[in], public land mobile network 295 * @param lac[in], location area code 296 * @param longNameRequired[in], required long name or not 297 * @return std::u16string the enhanced operator name string of the SIM card. 298 */ 299 std::u16string GetSimEons(int32_t slotId, const std::string &plmn, int32_t lac, bool longNameRequired); 300 301 /** 302 * @brief Set the network search mode 303 * 304 * @param slotId[in], sim slot id 305 * @param selectMode[in], the network search mode of the SIM card 306 * @param networkInformation[in], the network information 307 * @param resumeSelection[in], whether to continue selecting the network selection mode 308 * @param callback[in], the callback of set network selection mode 309 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 310 */ 311 int32_t SetNetworkSelectionMode(int32_t slotId, int32_t selectMode, 312 const sptr<NetworkInformation> &networkInformation, bool resumeSelection, 313 const sptr<INetworkSearchCallback> &callback); 314 315 /** 316 * @brief Obtain the ISO-defined country code 317 * 318 * @param slotId[in], sim slot id 319 * @param countryCode[out], the ISO-defined country code of the country where the registered network is deployed 320 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 321 */ 322 int32_t GetIsoCountryCodeForNetwork(int32_t slotId, std::u16string &countryCode); 323 324 /** 325 * @brief Obtain the sim account information 326 * 327 * @param slotId[in], sim slot id 328 * @param info[out], account information of SIM card 329 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 330 */ 331 int32_t GetSimAccountInfo(int32_t slotId, IccAccountInfo &info); 332 333 /** 334 * @brief Set default voice slotId 335 * 336 * @param slotId[in], sim slot id 337 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 338 */ 339 int32_t SetDefaultVoiceSlotId(int32_t slotId); 340 341 /** 342 * @brief Obtain default voice slotId 343 * 344 * @return int32_t default voice slotId. 345 */ 346 int32_t GetDefaultVoiceSlotId(); 347 348 /** 349 * @brief Obtain default voice simId 350 * 351 * @param simId[out], default voice simId 352 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 353 */ 354 int32_t GetDefaultVoiceSimId(int32_t &simId); 355 356 /** 357 * @brief Set the SIM card show number 358 * 359 * @param slotId[in], sim slot id 360 * @param number[in], the SIM card show number 361 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 362 */ 363 int32_t SetShowNumber(int32_t slotId, const std::u16string &number); 364 365 /** 366 * @brief Obtain the SIM card show number 367 * 368 * @param slotId[in], sim slot id 369 * @param showNumber[out], the SIM card show number 370 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 371 */ 372 int32_t GetShowNumber(int32_t slotId, std::u16string &showNumber); 373 374 /** 375 * @brief Set the SIM card show name 376 * 377 * @param slotId[in], sim slot id 378 * @param name[in], the SIM card show name 379 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 380 */ 381 int32_t SetShowName(int32_t slotId, const std::u16string &name); 382 383 /** 384 * @brief Obtain the SIM card show name 385 * 386 * @param slotId[in], sim slot id 387 * @param showName[out], the SIM card show name 388 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 389 */ 390 int32_t GetShowName(int32_t slotId, std::u16string &showName); 391 392 /** 393 * @brief Obtain the list of active SIM card account information 394 * 395 * @param iccAccountInfoList[out], the list of active SIM card account information 396 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 397 */ 398 int32_t GetActiveSimAccountInfoList(std::vector<IccAccountInfo> &iccAccountInfoList); 399 400 /** 401 * @brief Obtain the operator configs 402 * 403 * @param slotId[in], sim slot id 404 * @param poc[out], the operator configs of SIM card 405 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 406 */ 407 int32_t GetOperatorConfigs(int32_t slotId, OperatorConfig &poc); 408 409 /** 410 * @brief Unlock Pin 411 * 412 * @param slotId[in], sim slot id 413 * @param pin[in], the password of the SIM card 414 * @param response[out], the response of unlock pin 415 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 416 */ 417 int32_t UnlockPin(int32_t slotId, const std::u16string &pin, LockStatusResponse &response); 418 419 /** 420 * @brief Unlock Puk 421 * 422 * @param slotId[in], sim slot id 423 * @param newPin[in], newPin to reset the SIM card password 424 * @param puk[in], the unlock password of the SIM card password 425 * @param response[out], the response of unlock puk 426 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 427 */ 428 int32_t UnlockPuk( 429 int32_t slotId, const std::u16string &newPin, const std::u16string &puk, LockStatusResponse &response); 430 431 /** 432 * @brief Alter Pin 433 * 434 * @param slotId[in], sim slot id 435 * @param newPin[in], newPin to change the SIM card password 436 * @param oldPin[in], old password 437 * @param response[out], the response of alter pin 438 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 439 */ 440 int32_t AlterPin( 441 int32_t slotId, const std::u16string &newPin, const std::u16string &oldPin, LockStatusResponse &response); 442 443 /** 444 * @brief Unlock Pin2 445 * 446 * @param slotId[in], sim slot id 447 * @param pin2[in], the password of the SIM card 448 * @param response[out], the response of unlock pin2 449 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 450 */ 451 int32_t UnlockPin2(int32_t slotId, const std::u16string &pin2, LockStatusResponse &response); 452 453 /** 454 * @brief Unlock Puk2 455 * 456 * @param slotId[in], sim slot id 457 * @param newPin2[in], newPin2 to reset the SIM card password 458 * @param puk2[in], the unlock password of the SIM card password 459 * @param response[out], the response of unlock puk2 460 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 461 */ 462 int32_t UnlockPuk2( 463 int32_t slotId, const std::u16string &newPin2, const std::u16string &puk2, LockStatusResponse &response); 464 465 /** 466 * @brief Alter Pin2 467 * 468 * @param slotId[in], sim slot id 469 * @param newPin2[in], newPin2 to change the SIM card password 470 * @param oldPin2[in], old password 471 * @param response[out], the response of alter pin2 472 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 473 */ 474 int32_t AlterPin2( 475 int32_t slotId, const std::u16string &newPin2, const std::u16string &oldPin2, LockStatusResponse &response); 476 477 /** 478 * @brief Set the SIM card lock state 479 * 480 * @param slotId[in], sim slot id 481 * @param options[in], lock information 482 * @param response[out], the response of set lock state 483 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 484 */ 485 int32_t SetLockState(int32_t slotId, const LockInfo &options, LockStatusResponse &response); 486 487 /** 488 * @brief Obtain the SIM card lock state 489 * 490 * @param slotId[in], sim slot id 491 * @param lockType[in], lock type 492 * @param lockState[out], the response of get lock state 493 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 494 */ 495 int32_t GetLockState(int32_t slotId, LockType lockType, LockState &lockState); 496 497 /** 498 * @brief Refresh the SIM card State 499 * 500 * @param slotId[in], sim slot id 501 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 502 */ 503 int32_t RefreshSimState(int32_t slotId); 504 505 /** 506 * @brief Set the active sim enable or not 507 * 508 * @param slotId[in], sim slot id 509 * @param enable[in], set active sim enable or not 510 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 511 */ 512 int32_t SetActiveSim(const int32_t slotId, int32_t enable); 513 514 /** 515 * @brief Obtain the preferred network 516 * 517 * @param slotId[in], sim slot id 518 * @param callback[out], the callback of get preferred network 519 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 520 */ 521 int32_t GetPreferredNetwork(int32_t slotId, const sptr<INetworkSearchCallback> &callback); 522 523 /** 524 * @brief Set the preferred network 525 * 526 * @param slotId[in], sim slot id 527 * @param networkMode[in], the preferred network mode 528 * @param callback[out], the callback of set preferred network 529 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 530 */ 531 int32_t SetPreferredNetwork(int32_t slotId, int32_t networkMode, const sptr<INetworkSearchCallback> &callback); 532 533 /** 534 * @brief Obtain the telephone number of the SIM card 535 * 536 * @param slotId[in], sim slot id 537 * @param telephoneNumber[out], telephone number of the SIM card 538 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 539 */ 540 int32_t GetSimTelephoneNumber(int32_t slotId, std::u16string &telephoneNumber); 541 542 /** 543 * @brief Get network capability 544 * 545 * @param slotId[in], sim slot id 546 * @param networkCapabilityType[in], network capability type 547 * @param networkCapabilityState[out], network capability state 548 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 549 */ 550 int32_t GetNetworkCapability(int32_t slotId, int32_t networkCapabilityType, int32_t &networkCapabilityState); 551 552 /** 553 * @brief Set network capability 554 * 555 * @param slotId[in], sim slot id 556 * @param networkCapabilityType[in], network capability type 557 * @param networkCapabilityState[in], network capability state 558 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 559 */ 560 int32_t SetNetworkCapability(int32_t slotId, int32_t networkCapabilityType, int32_t networkCapabilityState); 561 562 /** 563 * @brief Obtain the voiceMail identifier 564 * 565 * @param slotId[in], sim slot id 566 * @param voiceMailIdentifier[out], voiceMail identifier of the SIM card 567 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 568 */ 569 int32_t GetVoiceMailIdentifier(int32_t slotId, std::u16string &voiceMailIdentifier); 570 571 /** 572 * @brief Obtain the voiceMail number 573 * 574 * @param slotId[in], sim slot id 575 * @param voiceMailNumber[out], voiceMail number of the SIM card 576 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 577 */ 578 int32_t GetVoiceMailNumber(int32_t slotId, std::u16string &voiceMailNumber); 579 580 /** 581 * @brief Obtain the voiceMail count 582 * 583 * @param slotId[in], sim slot id 584 * @param voiceMailCount[out], voiceMail count of the SIM card 585 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 586 */ 587 int32_t GetVoiceMailCount(int32_t slotId, int32_t &voiceMailCount); 588 589 /** 590 * @brief Set the voiceMail count 591 * 592 * @param slotId[in], sim slot id 593 * @param voiceMailCount[in], voiceMail count of the SIM card 594 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 595 */ 596 int32_t SetVoiceMailCount(int32_t slotId, int32_t voiceMailCount); 597 598 /** 599 * @brief Set the voice call forwarding 600 * 601 * @param slotId[in], sim slot id 602 * @param enable[in], enable voice call forwarding or not 603 * @param number[in], voice call forwarding number 604 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 605 */ 606 int32_t SetVoiceCallForwarding(int32_t slotId, bool enable, const std::string &number); 607 608 /** 609 * @brief Query icc dialling numbers 610 * 611 * @param slotId[in], sim slot id 612 * @param type[in], icc dialling numbers type 613 * @param result[out], vector of icc dialling numbers 614 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 615 */ 616 int32_t QueryIccDiallingNumbers(int slotId, int type, std::vector<std::shared_ptr<DiallingNumbersInfo>> &result); 617 618 /** 619 * @brief Add icc dialling numbers 620 * 621 * @param slotId[in], sim slot id 622 * @param type[in], icc dialling number type 623 * @param diallingNumber[in], dialing number information 624 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 625 */ 626 int32_t AddIccDiallingNumbers(int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber); 627 628 /** 629 * @brief Delete icc dialling numbers 630 * 631 * @param slotId[in], sim slot id 632 * @param type[in], icc dialling number type 633 * @param diallingNumber[in], dialing number information 634 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 635 */ 636 int32_t DelIccDiallingNumbers(int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber); 637 638 /** 639 * @brief Update icc dialling numbers 640 * 641 * @param slotId[in], sim slot id 642 * @param type[in], icc dialling number type 643 * @param diallingNumber[in], dialing number information 644 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 645 */ 646 int32_t UpdateIccDiallingNumbers(int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber); 647 648 /** 649 * @brief Set the VoiceMail information 650 * 651 * @param slotId[in], sim slot id 652 * @param mailName[in], VoiceMail name 653 * @param mailNumber[in], VoiceMail number 654 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 655 */ 656 int32_t SetVoiceMailInfo(int32_t slotId, const std::u16string &mailName, const std::u16string &mailNumber); 657 658 /** 659 * @brief Obtain the IMS register status info 660 * 661 * @param slotId[in], sim slot id 662 * @param imsSrvType[in], ims service type 663 * @param info[out], ims register status info 664 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 665 */ 666 int32_t GetImsRegStatus(int32_t slotId, ImsServiceType imsSrvType, ImsRegInfo &info); 667 668 /** 669 * @brief Obtain the maximum number of SIM card slots 670 * 671 * @return int32_t the maximum number of SIM card slots. 672 */ 673 int32_t GetMaxSimCount(); 674 675 /** 676 * @brief Obtain the operator key 677 * 678 * @param slotId[in], sim slot id 679 * @param opkey[out], operator key of the SIM card 680 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 681 */ 682 int32_t GetOpKey(int32_t slotId, std::u16string &opkey); 683 684 /** 685 * @brief Obtain the operator nv identity 686 * 687 * @param slotId[in], sim slot id 688 * @param opkeyExt[out], operator nv identity of the SIM card 689 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 690 */ 691 int32_t GetOpKeyExt(int32_t slotId, std::u16string &opkeyExt); 692 693 /** 694 * @brief Obtain the operator name 695 * 696 * @param slotId[in], sim slot id 697 * @param opname[out], operator name of the SIM card 698 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 699 */ 700 int32_t GetOpName(int32_t slotId, std::u16string &opname); 701 702 /** 703 * @brief Obtain the card type 704 * 705 * @param slotId[in], sim slot id 706 * @param cardType[out], card type of the SIM card 707 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 708 */ 709 int32_t GetCardType(int32_t slotId, CardType &cardType); 710 711 /** 712 * @brief Send envelope command to SIM card 713 * 714 * @param slotId[in], sim slot id 715 * @param cmd[in], envelope command to SIM card 716 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 717 */ 718 int32_t SendEnvelopeCmd(int32_t slotId, const std::string &cmd); 719 720 /** 721 * @brief Send terminal response command to SIM card 722 * 723 * @param slotId[in], sim slot id 724 * @param cmd[in], terminal response command to SIM card 725 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 726 */ 727 int32_t SendTerminalResponseCmd(int32_t slotId, const std::string &cmd); 728 729 /** 730 * @brief Send call setup request result 731 * 732 * @param slotId[in], sim slot id 733 * @param accept[in], whether accept the call setup request 734 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 735 */ 736 int32_t SendCallSetupRequestResult(int32_t slotId, bool accept); 737 738 /** 739 * @brief Unlock sim lock 740 * 741 * @param slotId[in], sim slot id 742 * @param lockInfo[in], customized lock type information 743 * @param response[out], the response of unlock sim lock 744 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 745 */ 746 int32_t UnlockSimLock(int32_t slotId, const PersoLockInfo &lockInfo, LockStatusResponse &response); 747 748 /** 749 * @brief Check whether your the caller has been granted the operator permissions 750 * 751 * @param slotId[in], sim slot id 752 * @param hasOperatorPrivileges[out], whether your the caller has been granted the operator permissions 753 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 754 */ 755 int32_t HasOperatorPrivileges(const int32_t slotId, bool &hasOperatorPrivileges); 756 757 /** 758 * @brief Performs SIM card authentication 759 * 760 * @param slotId[in], sim slot id 761 * @param aid[in], app id 762 * @param authData[in], authentication data 763 * @param response[out], the response of sim card authentication 764 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 765 */ 766 int32_t SimAuthentication( 767 int32_t slotId, AuthType authType, const std::string &authData, SimAuthenticationResponse &response); 768 769 /** 770 * @brief Obtain the primary slotId 771 * 772 * @param slotId[out], primary slot id 773 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 774 */ 775 int32_t GetPrimarySlotId(int32_t &slotId); 776 777 /** 778 * @brief Set the primary slotId 779 * 780 * @param slotId[in], primary slot id 781 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 782 */ 783 int32_t SetPrimarySlotId(int32_t slotId); 784 785 /** 786 * @brief Obtain the cell information list 787 * 788 * @param slotId[in], primary slot id 789 * @param cellInfo[out], the current cell information of the SIM card 790 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 791 */ 792 int32_t GetCellInfoList(int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo); 793 794 /** 795 * @brief Requests for a cell location update 796 * 797 * @param slotId[in], primary slot id 798 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 799 */ 800 int32_t SendUpdateCellLocationRequest(int32_t slotId); 801 802 /** 803 * @brief Register IMS registry information callback 804 * 805 * @param slotId[in], sim slot id 806 * @param imsSrvType[in], ims service type 807 * @param callback[out], the callback of ims register status info 808 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 809 */ 810 int32_t RegisterImsRegInfoCallback( 811 int32_t slotId, ImsServiceType imsSrvType, const sptr<ImsRegInfoCallback> &callback); 812 813 /** 814 * @brief Unregister IMS registry information callback 815 * 816 * @param slotId[in], sim slot id 817 * @param imsSrvType[in], ims service type 818 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 819 */ 820 int32_t UnregisterImsRegInfoCallback(int32_t slotId, ImsServiceType imsSrvType); 821 822 /** 823 * @brief Obtain the base band version 824 * 825 * @param slotId[in], sim slot id 826 * @param version[out], the the baseband version of the SIM card 827 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 828 */ 829 int32_t GetBasebandVersion(int32_t slotId, std::string &version); 830 831 private: 832 void RemoveDeathRecipient(const wptr<IRemoteObject> &remote, bool isRemoteDied); 833 class CoreServiceDeathRecipient : public IRemoteObject::DeathRecipient { 834 public: CoreServiceDeathRecipient(CoreServiceClient & client)835 explicit CoreServiceDeathRecipient(CoreServiceClient &client) : client_(client) {} 836 ~CoreServiceDeathRecipient() override = default; OnRemoteDied(const wptr<IRemoteObject> & remote)837 void OnRemoteDied(const wptr<IRemoteObject> &remote) override 838 { 839 client_.OnRemoteDied(remote); 840 } 841 842 private: 843 CoreServiceClient &client_; 844 }; 845 846 private: 847 std::mutex mutexProxy_; 848 sptr<ICoreService> proxy_ { nullptr }; 849 sptr<IRemoteObject::DeathRecipient> deathRecipient_ { nullptr }; 850 }; 851 } // namespace Telephony 852 } // namespace OHOS 853 #endif // CORE_SERVICE_CLIENT_H 854