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