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 resident network numeric 117 * 118 * @param slotId[in], sim slot id 119 * @return std::string resident network numeric of PLMN of the SIM card. 120 */ 121 std::string GetResidentNetworkNumeric(int32_t slotId); 122 123 /** 124 * @brief Obtain the operator name 125 * 126 * @param slotId[in], sim slot id 127 * @param operatorName[out], the operator name of the SIM card 128 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 129 */ 130 int32_t GetOperatorName(int32_t slotId, std::u16string &operatorName); 131 132 /** 133 * @brief Obtain the network state 134 * 135 * @param slotId[in], sim slot id 136 * @param networkState[out], the callback of network registration state 137 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 138 */ 139 int32_t GetNetworkState(int32_t slotId, sptr<NetworkState> &networkState); 140 141 /** 142 * @brief Set the radio state 143 * 144 * @param slotId[in], sim slot id 145 * @param isOn[in], turn on or turn off the radio service 146 * @param callback[out], the callback of radio state 147 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 148 */ 149 int32_t SetRadioState(int32_t slotId, bool isOn, const sptr<INetworkSearchCallback> &callback); 150 151 /** 152 * @brief Obtain the radio state 153 * 154 * @param slotId[in], sim slot id 155 * @param callback[out], the callback of radio state 156 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 157 */ 158 int32_t GetRadioState(int32_t slotId, const sptr<INetworkSearchCallback> &callback); 159 160 /** 161 * @brief Obtain the International Mobile Equipment Identification 162 * 163 * @param slotId[in], sim slot id 164 * @param imei[out], the International Mobile Equipment Identification Number of the SIM card 165 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 166 */ 167 int32_t GetImei(int32_t slotId, std::u16string &imei); 168 169 /** 170 * @brief Obtains the software version number of a specified card slot of the device 171 * 172 * @param slotId[in], sim slot id 173 * @param imeiSv[out], the International Mobile Equipment Identification Number of the SIM card 174 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 175 */ 176 int32_t GetImeiSv(int32_t slotId, std::u16string &imeiSv); 177 178 /** 179 * @brief Checks whether a SIM card is inserted in a specified slot. 180 * 181 * @param slotId[in], sim slot id 182 * @param hasSimCard[out], returns true if a SIM card is inserted; return false otherwise 183 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 184 */ 185 int32_t HasSimCard(int32_t slotId, bool &hasSimCard); 186 187 /** 188 * @brief Obtain the state of the SIM card 189 * 190 * @param slotId[in], sim slot id 191 * @param simState[out], the state of the SIM card 192 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 193 */ 194 int32_t GetSimState(int32_t slotId, SimState &simState); 195 196 /** 197 * @brief Obtain the value of dsds mode 198 * 199 * @param dsdsMode[out], the value of dsds mode 200 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 201 */ 202 int32_t GetDsdsMode(int32_t &dsdsMode); 203 204 /** 205 * @brief Obtain the operator numeric of PLMN 206 * 207 * @param slotId[in], sim slot id 208 * @param operatorNumeric[out], the operator numeric of PLMN of the SIM card 209 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 210 */ 211 int32_t GetSimOperatorNumeric(int32_t slotId, std::u16string &operatorNumeric); 212 213 /** 214 * @brief Obtain the ISO country code 215 * 216 * @param slotId[in], sim slot id 217 * @param countryCode[out], the ISO country code of the SIM card 218 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 219 */ 220 int32_t GetISOCountryCodeForSim(int32_t slotId, std::u16string &countryCode); 221 222 /** 223 * @brief Obtain the service provider name 224 * 225 * @param slotId[in], sim slot id 226 * @param spn[out], the service provider name of the SIM card 227 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 228 */ 229 int32_t GetSimSpn(int32_t slotId, std::u16string &spn); 230 231 /** 232 * @brief Obtain the integrated circuit card identity 233 * 234 * @param slotId[in], sim slot id 235 * @param iccId[out], the integrated circuit card identity of the SIM card 236 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 237 */ 238 int32_t GetSimIccId(int32_t slotId, std::u16string &iccId); 239 240 /** 241 * @brief Obtain the international mobile subscriber identity 242 * 243 * @param slotId[in], sim slot id 244 * @param imsi[out], the international mobile subscriber identity of the SIM card 245 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 246 */ 247 int32_t GetIMSI(int32_t slotId, std::u16string &imsi); 248 249 /** 250 * @brief Check whther the SIM card in a specified slot is China Telecom SIM. 251 * 252 * @param slotId[in], sim slot id 253 * @param isCTSimCard[out], returns true if a SIM card is inserted; return false otherwise 254 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 255 */ 256 int32_t IsCTSimCard(int32_t slotId, bool &isCTSimCard); 257 258 /** 259 * @brief Checks whether the SIM card in a specified slot is activated 260 * 261 * @param slotId[in], sim slot id 262 * @return returns true if the SIM card activated; returns false otherwise. 263 */ 264 bool IsSimActive(int32_t slotId); 265 266 /** 267 * @brief Obtain the sim slot id of the simId 268 * 269 * @param simId[in], sim card id 270 * @return return the sim slot id of the simId. 271 */ 272 int32_t GetSlotId(int32_t simId); 273 274 /** 275 * @brief Obtain the sim card id 276 * 277 * @param slotId[in], sim slot id 278 * @return return the sim card id of the SIM card. 279 */ 280 int32_t GetSimId(int32_t slotId); 281 282 /** 283 * @brief Obtain the callback of network search information 284 * 285 * @param slotId[in], sim slot id 286 * @param callback[out], the callback of network search information 287 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 288 */ 289 int32_t GetNetworkSearchInformation(int32_t slotId, const sptr<INetworkSearchCallback> &callback); 290 291 /** 292 * @brief Obtain the callback of network selection mode 293 * 294 * @param slotId[in], sim slot id 295 * @param callback[out], the callback of network selection mode 296 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 297 */ 298 int32_t GetNetworkSelectionMode(int32_t slotId, const sptr<INetworkSearchCallback> &callback); 299 300 /** 301 * @brief Obtain the locale from the default sim 302 * 303 * @return std::u16string locale from default sim. 304 */ 305 std::u16string GetLocaleFromDefaultSim(); 306 307 /** 308 * @brief Obtain the group identifier level 1 309 * 310 * @param slotId[in], sim slot id 311 * @param gid1[out], the group identifier level 1 of the SIM card 312 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 313 */ 314 int32_t GetSimGid1(int32_t slotId, std::u16string &gid1); 315 316 /** 317 * @brief Obtain the group identifier level 2 318 * 319 * @param slotId[in], sim slot id 320 * @return std::u16string the group identifier level 2 of the SIM card. 321 */ 322 std::u16string GetSimGid2(int32_t slotId); 323 324 /** 325 * @brief Obtain the enhanced operator name string 326 * 327 * @param slotId[in], sim slot id 328 * @param plmn[in], public land mobile network 329 * @param lac[in], location area code 330 * @param longNameRequired[in], required long name or not 331 * @return std::u16string the enhanced operator name string of the SIM card. 332 */ 333 std::u16string GetSimEons(int32_t slotId, const std::string &plmn, int32_t lac, bool longNameRequired); 334 335 /** 336 * @brief Set the network search mode 337 * 338 * @param slotId[in], sim slot id 339 * @param selectMode[in], the network search mode of the SIM card 340 * @param networkInformation[in], the network information 341 * @param resumeSelection[in], whether to continue selecting the network selection mode 342 * @param callback[in], the callback of set network selection mode 343 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 344 */ 345 int32_t SetNetworkSelectionMode(int32_t slotId, int32_t selectMode, 346 const sptr<NetworkInformation> &networkInformation, bool resumeSelection, 347 const sptr<INetworkSearchCallback> &callback); 348 349 /** 350 * @brief Obtain the ISO-defined country code 351 * 352 * @param slotId[in], sim slot id 353 * @param countryCode[out], the ISO-defined country code of the country where the registered network is deployed 354 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 355 */ 356 int32_t GetIsoCountryCodeForNetwork(int32_t slotId, std::u16string &countryCode); 357 358 /** 359 * @brief Obtain the sim account information 360 * 361 * @param slotId[in], sim slot id 362 * @param info[out], account information of SIM card 363 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 364 */ 365 int32_t GetSimAccountInfo(int32_t slotId, IccAccountInfo &info); 366 367 /** 368 * @brief Set default voice slotId 369 * 370 * @param slotId[in], sim slot id 371 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 372 */ 373 int32_t SetDefaultVoiceSlotId(int32_t slotId); 374 375 /** 376 * @brief Obtain default voice slotId 377 * 378 * @return int32_t default voice slotId. 379 */ 380 int32_t GetDefaultVoiceSlotId(); 381 382 /** 383 * @brief Obtain default voice simId 384 * 385 * @param simId[out], default voice simId 386 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 387 */ 388 int32_t GetDefaultVoiceSimId(int32_t &simId); 389 390 /** 391 * @brief Set the SIM card show number 392 * 393 * @param slotId[in], sim slot id 394 * @param number[in], the SIM card show number 395 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 396 */ 397 int32_t SetShowNumber(int32_t slotId, const std::u16string &number); 398 399 /** 400 * @brief Obtain the SIM card show number 401 * 402 * @param slotId[in], sim slot id 403 * @param showNumber[out], the SIM card show number 404 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 405 */ 406 int32_t GetShowNumber(int32_t slotId, std::u16string &showNumber); 407 408 /** 409 * @brief Set the SIM card show name 410 * 411 * @param slotId[in], sim slot id 412 * @param name[in], the SIM card show name 413 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 414 */ 415 int32_t SetShowName(int32_t slotId, const std::u16string &name); 416 417 /** 418 * @brief Obtain the SIM card show name 419 * 420 * @param slotId[in], sim slot id 421 * @param showName[out], the SIM card show name 422 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 423 */ 424 int32_t GetShowName(int32_t slotId, std::u16string &showName); 425 426 /** 427 * @brief Obtain the list of active SIM card account information 428 * 429 * @param iccAccountInfoList[out], the list of active SIM card account information 430 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 431 */ 432 int32_t GetActiveSimAccountInfoList(std::vector<IccAccountInfo> &iccAccountInfoList); 433 434 /** 435 * @brief Obtain the operator configs 436 * 437 * @param slotId[in], sim slot id 438 * @param poc[out], the operator configs of SIM card 439 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 440 */ 441 int32_t GetOperatorConfigs(int32_t slotId, OperatorConfig &poc); 442 443 /** 444 * @brief Unlock Pin 445 * 446 * @param slotId[in], sim slot id 447 * @param pin[in], the password of the SIM card 448 * @param response[out], the response of unlock pin 449 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 450 */ 451 int32_t UnlockPin(int32_t slotId, const std::u16string &pin, LockStatusResponse &response); 452 453 /** 454 * @brief Unlock Puk 455 * 456 * @param slotId[in], sim slot id 457 * @param newPin[in], newPin to reset the SIM card password 458 * @param puk[in], the unlock password of the SIM card password 459 * @param response[out], the response of unlock puk 460 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 461 */ 462 int32_t UnlockPuk( 463 int32_t slotId, const std::u16string &newPin, const std::u16string &puk, LockStatusResponse &response); 464 465 /** 466 * @brief Alter Pin 467 * 468 * @param slotId[in], sim slot id 469 * @param newPin[in], newPin to change the SIM card password 470 * @param oldPin[in], old password 471 * @param response[out], the response of alter pin 472 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 473 */ 474 int32_t AlterPin( 475 int32_t slotId, const std::u16string &newPin, const std::u16string &oldPin, LockStatusResponse &response); 476 477 /** 478 * @brief Unlock Pin2 479 * 480 * @param slotId[in], sim slot id 481 * @param pin2[in], the password of the SIM card 482 * @param response[out], the response of unlock pin2 483 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 484 */ 485 int32_t UnlockPin2(int32_t slotId, const std::u16string &pin2, LockStatusResponse &response); 486 487 /** 488 * @brief Unlock Puk2 489 * 490 * @param slotId[in], sim slot id 491 * @param newPin2[in], newPin2 to reset the SIM card password 492 * @param puk2[in], the unlock password of the SIM card password 493 * @param response[out], the response of unlock puk2 494 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 495 */ 496 int32_t UnlockPuk2( 497 int32_t slotId, const std::u16string &newPin2, const std::u16string &puk2, LockStatusResponse &response); 498 499 /** 500 * @brief Alter Pin2 501 * 502 * @param slotId[in], sim slot id 503 * @param newPin2[in], newPin2 to change the SIM card password 504 * @param oldPin2[in], old password 505 * @param response[out], the response of alter pin2 506 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 507 */ 508 int32_t AlterPin2( 509 int32_t slotId, const std::u16string &newPin2, const std::u16string &oldPin2, LockStatusResponse &response); 510 511 /** 512 * @brief Set the SIM card lock state 513 * 514 * @param slotId[in], sim slot id 515 * @param options[in], lock information 516 * @param response[out], the response of set lock state 517 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 518 */ 519 int32_t SetLockState(int32_t slotId, const LockInfo &options, LockStatusResponse &response); 520 521 /** 522 * @brief Obtain the SIM card lock state 523 * 524 * @param slotId[in], sim slot id 525 * @param lockType[in], lock type 526 * @param lockState[out], the response of get lock state 527 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 528 */ 529 int32_t GetLockState(int32_t slotId, LockType lockType, LockState &lockState); 530 531 /** 532 * @brief Refresh the SIM card State 533 * 534 * @param slotId[in], sim slot id 535 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 536 */ 537 int32_t RefreshSimState(int32_t slotId); 538 539 /** 540 * @brief Set the active sim enable or not 541 * 542 * @param slotId[in], sim slot id 543 * @param enable[in], set active sim enable or not 544 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 545 */ 546 int32_t SetActiveSim(const int32_t slotId, int32_t enable); 547 548 /** 549 * @brief Obtain the preferred network 550 * 551 * @param slotId[in], sim slot id 552 * @param callback[out], the callback of get preferred network 553 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 554 */ 555 int32_t GetPreferredNetwork(int32_t slotId, const sptr<INetworkSearchCallback> &callback); 556 557 /** 558 * @brief Set the preferred network 559 * 560 * @param slotId[in], sim slot id 561 * @param networkMode[in], the preferred network mode 562 * @param callback[out], the callback of set preferred network 563 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 564 */ 565 int32_t SetPreferredNetwork(int32_t slotId, int32_t networkMode, const sptr<INetworkSearchCallback> &callback); 566 567 /** 568 * @brief Obtain the telephone number of the SIM card 569 * 570 * @param slotId[in], sim slot id 571 * @param telephoneNumber[out], telephone number of the SIM card 572 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 573 */ 574 int32_t GetSimTelephoneNumber(int32_t slotId, std::u16string &telephoneNumber); 575 576 /** 577 * @brief Get network capability 578 * 579 * @param slotId[in], sim slot id 580 * @param networkCapabilityType[in], network capability type 581 * @param networkCapabilityState[out], network capability state 582 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 583 */ 584 int32_t GetNetworkCapability(int32_t slotId, int32_t networkCapabilityType, int32_t &networkCapabilityState); 585 586 /** 587 * @brief Set network capability 588 * 589 * @param slotId[in], sim slot id 590 * @param networkCapabilityType[in], network capability type 591 * @param networkCapabilityState[in], network capability state 592 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 593 */ 594 int32_t SetNetworkCapability(int32_t slotId, int32_t networkCapabilityType, int32_t networkCapabilityState); 595 596 /** 597 * @brief Obtain the voiceMail identifier 598 * 599 * @param slotId[in], sim slot id 600 * @param voiceMailIdentifier[out], voiceMail identifier of the SIM card 601 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 602 */ 603 int32_t GetVoiceMailIdentifier(int32_t slotId, std::u16string &voiceMailIdentifier); 604 605 /** 606 * @brief Obtain the voiceMail number 607 * 608 * @param slotId[in], sim slot id 609 * @param voiceMailNumber[out], voiceMail number of the SIM card 610 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 611 */ 612 int32_t GetVoiceMailNumber(int32_t slotId, std::u16string &voiceMailNumber); 613 614 /** 615 * @brief Obtain the voiceMail count 616 * 617 * @param slotId[in], sim slot id 618 * @param voiceMailCount[out], voiceMail count of the SIM card 619 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 620 */ 621 int32_t GetVoiceMailCount(int32_t slotId, int32_t &voiceMailCount); 622 623 /** 624 * @brief Set the voiceMail count 625 * 626 * @param slotId[in], sim slot id 627 * @param voiceMailCount[in], voiceMail count of the SIM card 628 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 629 */ 630 int32_t SetVoiceMailCount(int32_t slotId, int32_t voiceMailCount); 631 632 /** 633 * @brief Set the voice call forwarding 634 * 635 * @param slotId[in], sim slot id 636 * @param enable[in], enable voice call forwarding or not 637 * @param number[in], voice call forwarding number 638 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 639 */ 640 int32_t SetVoiceCallForwarding(int32_t slotId, bool enable, const std::string &number); 641 642 /** 643 * @brief Query icc dialling numbers 644 * 645 * @param slotId[in], sim slot id 646 * @param type[in], icc dialling numbers type 647 * @param result[out], vector of icc dialling numbers 648 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 649 */ 650 int32_t QueryIccDiallingNumbers(int slotId, int type, std::vector<std::shared_ptr<DiallingNumbersInfo>> &result); 651 652 /** 653 * @brief Add icc dialling numbers 654 * 655 * @param slotId[in], sim slot id 656 * @param type[in], icc dialling number type 657 * @param diallingNumber[in], dialing number information 658 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 659 */ 660 int32_t AddIccDiallingNumbers(int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber); 661 662 /** 663 * @brief Delete icc dialling numbers 664 * 665 * @param slotId[in], sim slot id 666 * @param type[in], icc dialling number type 667 * @param diallingNumber[in], dialing number information 668 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 669 */ 670 int32_t DelIccDiallingNumbers(int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber); 671 672 /** 673 * @brief Update icc dialling numbers 674 * 675 * @param slotId[in], sim slot id 676 * @param type[in], icc dialling number type 677 * @param diallingNumber[in], dialing number information 678 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 679 */ 680 int32_t UpdateIccDiallingNumbers(int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber); 681 682 /** 683 * @brief Set the VoiceMail information 684 * 685 * @param slotId[in], sim slot id 686 * @param mailName[in], VoiceMail name 687 * @param mailNumber[in], VoiceMail number 688 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 689 */ 690 int32_t SetVoiceMailInfo(int32_t slotId, const std::u16string &mailName, const std::u16string &mailNumber); 691 692 /** 693 * @brief Obtain the IMS register status info 694 * 695 * @param slotId[in], sim slot id 696 * @param imsSrvType[in], ims service type 697 * @param info[out], ims register status info 698 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 699 */ 700 int32_t GetImsRegStatus(int32_t slotId, ImsServiceType imsSrvType, ImsRegInfo &info); 701 702 /** 703 * @brief Obtain the maximum number of SIM card slots 704 * 705 * @return int32_t the maximum number of SIM card slots. 706 */ 707 int32_t GetMaxSimCount(); 708 709 /** 710 * @brief Obtain the operator key 711 * 712 * @param slotId[in], sim slot id 713 * @param opkey[out], operator key of the SIM card 714 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 715 */ 716 int32_t GetOpKey(int32_t slotId, std::u16string &opkey); 717 718 /** 719 * @brief Obtain the operator nv identity 720 * 721 * @param slotId[in], sim slot id 722 * @param opkeyExt[out], operator nv identity of the SIM card 723 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 724 */ 725 int32_t GetOpKeyExt(int32_t slotId, std::u16string &opkeyExt); 726 727 /** 728 * @brief Obtain the operator name 729 * 730 * @param slotId[in], sim slot id 731 * @param opname[out], operator name of the SIM card 732 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 733 */ 734 int32_t GetOpName(int32_t slotId, std::u16string &opname); 735 736 /** 737 * @brief Obtain the card type 738 * 739 * @param slotId[in], sim slot id 740 * @param cardType[out], card type of the SIM card 741 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 742 */ 743 int32_t GetCardType(int32_t slotId, CardType &cardType); 744 745 /** 746 * @brief Send envelope command to SIM card 747 * 748 * @param slotId[in], sim slot id 749 * @param cmd[in], envelope command to SIM card 750 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 751 */ 752 int32_t SendEnvelopeCmd(int32_t slotId, const std::string &cmd); 753 754 /** 755 * @brief Send terminal response command to SIM card 756 * 757 * @param slotId[in], sim slot id 758 * @param cmd[in], terminal response command to SIM card 759 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 760 */ 761 int32_t SendTerminalResponseCmd(int32_t slotId, const std::string &cmd); 762 763 /** 764 * @brief Send call setup request result 765 * 766 * @param slotId[in], sim slot id 767 * @param accept[in], whether accept the call setup request 768 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 769 */ 770 int32_t SendCallSetupRequestResult(int32_t slotId, bool accept); 771 772 /** 773 * @brief Unlock sim lock 774 * 775 * @param slotId[in], sim slot id 776 * @param lockInfo[in], customized lock type information 777 * @param response[out], the response of unlock sim lock 778 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 779 */ 780 int32_t UnlockSimLock(int32_t slotId, const PersoLockInfo &lockInfo, LockStatusResponse &response); 781 782 /** 783 * @brief Check whether your the caller has been granted the operator permissions 784 * 785 * @param slotId[in], sim slot id 786 * @param hasOperatorPrivileges[out], whether your the caller has been granted the operator permissions 787 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 788 */ 789 int32_t HasOperatorPrivileges(const int32_t slotId, bool &hasOperatorPrivileges); 790 791 /** 792 * @brief Performs SIM card authentication 793 * 794 * @param slotId[in], sim slot id 795 * @param aid[in], app id 796 * @param authData[in], authentication data 797 * @param response[out], the response of sim card authentication 798 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 799 */ 800 int32_t SimAuthentication( 801 int32_t slotId, AuthType authType, const std::string &authData, SimAuthenticationResponse &response); 802 803 /** 804 * @brief Obtain the primary slotId 805 * 806 * @param slotId[out], primary slot id 807 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 808 */ 809 int32_t GetPrimarySlotId(int32_t &slotId); 810 811 /** 812 * @brief Set the primary slotId 813 * 814 * @param slotId[in], primary slot id 815 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 816 */ 817 int32_t SetPrimarySlotId(int32_t slotId); 818 819 /** 820 * @brief Obtain the cell information list 821 * 822 * @param slotId[in], primary slot id 823 * @param cellInfo[out], the current cell information of the SIM card 824 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 825 */ 826 int32_t GetCellInfoList(int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo); 827 828 /** 829 * @brief Requests for a cell location update 830 * 831 * @param slotId[in], primary slot id 832 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 833 */ 834 int32_t SendUpdateCellLocationRequest(int32_t slotId); 835 836 /** 837 * @brief Register IMS registry information callback 838 * 839 * @param slotId[in], sim slot id 840 * @param imsSrvType[in], ims service type 841 * @param callback[out], the callback of ims register status info 842 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 843 */ 844 int32_t RegisterImsRegInfoCallback( 845 int32_t slotId, ImsServiceType imsSrvType, const sptr<ImsRegInfoCallback> &callback); 846 847 /** 848 * @brief Unregister IMS registry information callback 849 * 850 * @param slotId[in], sim slot id 851 * @param imsSrvType[in], ims service type 852 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 853 */ 854 int32_t UnregisterImsRegInfoCallback(int32_t slotId, ImsServiceType imsSrvType); 855 856 /** 857 * @brief Obtain the base band version 858 * 859 * @param slotId[in], sim slot id 860 * @param version[out], the the baseband version of the SIM card 861 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 862 */ 863 int32_t GetBasebandVersion(int32_t slotId, std::string &version); 864 865 /** 866 * @brief Obtain the NR ssb id information 867 * 868 * @param slotId[in], sim slot id 869 * @param nrSsbInfomation[out], the nr ssb information of the SIM card 870 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 871 */ 872 int32_t GetNrSsbIdInfo(int32_t slotId, const std::shared_ptr<NrSsbInformation> &nrSsbInformation); 873 874 /** 875 * @brief Reset all network settings of telephony 876 * 877 * @param slotId[in], sim slot id 878 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 879 */ 880 int32_t FactoryReset(int32_t slotId); 881 882 /** 883 * @brief init extra module function, for extra slot. 884 * 885 * @param slotId[in], sim slot id 886 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 887 */ 888 int32_t InitExtraModule(int32_t slotId); 889 890 /** 891 * @brief Check whether insert apn in table. 892 * 893 * @param value[in], apn value 894 * @return return true if need insert, otherwise return false 895 */ 896 bool IsAllowedInsertApn(std::string &value); 897 898 /** 899 * @brief get cust opkey for sim card 900 * 901 * @param slotId[in], sim slot id 902 * @param opkey[out], cust opkey for sim card 903 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 904 */ 905 int32_t GetTargetOpkey(int32_t slotId, std::u16string &opkey); 906 907 /** 908 * @brief get opkey param version 909 * 910 * @param versionInfo[out], opkey param version info 911 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 912 */ 913 int32_t GetOpkeyVersion(std::string &versionInfo); 914 915 /** 916 * @brief Get data from sim io 917 * 918 * @param slotId[in], sim slot id 919 * @param command[in], command id 920 * @param fileId[in], file id 921 * @param dataStr[in], data to be sended 922 * @param path[in], file path 923 * @param response[out], the response of sim io command 924 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 925 */ 926 int32_t GetSimIO(int32_t slotId, int32_t command, int32_t fileId, 927 const std::string &dataStr, const std::string &path, SimAuthenticationResponse &response); 928 929 private: 930 void RemoveDeathRecipient(const wptr<IRemoteObject> &remote, bool isRemoteDied); 931 class CoreServiceDeathRecipient : public IRemoteObject::DeathRecipient { 932 public: CoreServiceDeathRecipient(CoreServiceClient & client)933 explicit CoreServiceDeathRecipient(CoreServiceClient &client) : client_(client) {} 934 ~CoreServiceDeathRecipient() override = default; OnRemoteDied(const wptr<IRemoteObject> & remote)935 void OnRemoteDied(const wptr<IRemoteObject> &remote) override 936 { 937 client_.OnRemoteDied(remote); 938 } 939 940 private: 941 CoreServiceClient &client_; 942 }; 943 944 private: 945 std::mutex mutexProxy_; 946 sptr<ICoreService> proxy_ { nullptr }; 947 sptr<IRemoteObject::DeathRecipient> deathRecipient_ { nullptr }; 948 }; 949 } // namespace Telephony 950 } // namespace OHOS 951 #endif // CORE_SERVICE_CLIENT_H 952