• 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 TELEPHONY_TELEPHONY_TYPES_H
17 #define TELEPHONY_TELEPHONY_TYPES_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "network_search_types.h"
23 #include "operator_config_types.h"
24 #include "parameter.h"
25 #include "parameters.h"
26 
27 namespace OHOS {
28 namespace Telephony {
29 #define SIM_SLOT_COUNT GetMaxSlotCount<int32_t>()
30 #define SIM_SLOT_COUNT_REAL GetRealMaxSlotCount<int32_t>()
31 #define PREFERRED_NETWORK_TYPE GetPreferredNetworkType<int32_t>()
32 #define VSIM_MODEM_COUNT GetVSimModemCount<int32_t>()
33 #define IS_SUPPORT_VSIM (VSIM_MODEM_COUNT > 0)
34 #define DEFAULT_ESIM_ID GetDefaultEsimSlotId<int32_t>()
35 namespace {
36 const int32_t SYSPARA_SIZE = 128;
37 constexpr size_t ARRAY_SIZE = 1024;
38 const int32_t DEFAULT_SIM_SLOT_ID = 0;
39 const int32_t DEFAULT_OPERATOR_STATE = 0;
40 const int32_t DEFAULT_SIM_SLOT_ID_REMOVE = -1;
41 const int32_t INVALID_MAIN_CARD_SLOTID = -2;
42 const int32_t ERROR_SLOT_OPKEY = -2;
43 const int32_t DSDS_MODE_V2 = 0;
44 const int32_t DSDS_MODE_V3 = 1;
45 const size_t MAX_PARAMETER_LENGTH = 100;
46 const int32_t DUAL_SLOT_COUNT = 2;
47 const int32_t MAX_SLOT_COUNT = 3;
48 const int32_t VSIM_DEFAULT_VALUE = -1;
49 const int32_t ESIM_DEFAULT_SLOTID = -1;
50 std::atomic<int32_t> maxRealSlotCount_ = 0;
51 int32_t maxSlotCount_ = 0;
52 int32_t esimDefaultSlotId_ = ESIM_DEFAULT_SLOTID;
53 int32_t vSimModemCount_ = VSIM_DEFAULT_VALUE;
54 constexpr const char *SATELLITE_DEFAULT_VALUE = "0";
55 constexpr const char *DEFAULT_SLOT_COUNT = "1";
56 constexpr const char *DEFAULT_ESIM_SLOT_ID = "0";
57 constexpr const char *TEL_SIM_SLOT_COUNT = "const.telephony.slotCount";
58 constexpr const char *VIRTUAL_MODEM_SWITCH = "const.booster.virtual_modem_switch";
59 constexpr const char *VIRTUAL_MODEM_DEFAULT_SWITCH = "false";
60 constexpr const char *DEFAULT_PREFERRED_NETWORK_TYPE = "5"; // CORE_NETWORK_MODE_LTE_WCDMA_GSM
61 constexpr const char *TEL_PREFERRED_NETWORK_TYPE = "const.telephony.preferredNetworkType";
62 constexpr const char *DEFAULT_OPERATOR_KEY = "";
63 constexpr const char *INITIAL_OPKEY = "-1";
64 constexpr const char *DEFAULT_OPERATOR_CONFIG = "default_operator_config.json";
65 constexpr const char *OPKEY_PROP_PREFIX = "telephony.sim.opkey";
66 constexpr const char *COUNTRY_CODE_KEY = "telephony.sim.countryCode";
67 constexpr const char *TEL_SATELLITE_SUPPORTED = "const.telephony.satellite.supported";
68 constexpr const char *DEFAULT_VSIM_MODEM_COUNT = "0";
69 constexpr const char *VSIM_MODEM_COUNT_STR = "const.telephony.vsimModemCount";
70 constexpr const char *TEL_ESIM_SUPPORT = "persist.telephony.esim.supported";
71 constexpr const char *TEL_DEFAULT_ESIM_SLOT_ID = "const.telephony.esim.slotID";
72 constexpr const char *DYNAMIC_POWEROFF_MODEM = "telephony.dynamic_poweroff_modem";
73 constexpr const char *DYNAMIC_POWEROFF_MODEM_WITH_STR = "telephony.dynamic_poweroff_modem_with_str";
74 constexpr const char *ENTER_STR_TELEPHONY_NOTIFY = "usual.event.TELEPHONY_ENTER_STR"; // enter tele power mode broadcast
75 constexpr const char *EXIT_STR_TELEPHONY_NOTIFY = "usual.event.TELEPHONY_EXIT_STR"; // exit tele power mode broadcast
76 }
77 
78 template<typename T>
GetVirtualModemSwitch()79 inline T GetVirtualModemSwitch()
80 {
81     char virtualModemSwitch[SYSPARA_SIZE] = {0};
82     GetParameter(VIRTUAL_MODEM_SWITCH, VIRTUAL_MODEM_DEFAULT_SWITCH, virtualModemSwitch, SYSPARA_SIZE);
83     if (strcmp(virtualModemSwitch, "true") == 0) {
84         return true;
85     }
86     return false;
87 }
88 
89 template<typename T>
GetMaxSlotCount()90 inline T GetMaxSlotCount()
91 {
92     if (maxSlotCount_ == 0) {
93         char simSlotCount[SYSPARA_SIZE] = { 0 };
94         GetParameter(TEL_SIM_SLOT_COUNT, DEFAULT_SLOT_COUNT, simSlotCount, SYSPARA_SIZE);
95         maxSlotCount_ = std::atoi(simSlotCount);
96         if (GetVirtualModemSwitch<bool>() && maxSlotCount_ == 0) {
97             maxSlotCount_ = 1;
98         }
99     }
100     return maxSlotCount_;
101 }
102 
103 template<typename T>
GetRealMaxSlotCount()104 inline T GetRealMaxSlotCount()
105 {
106     if (maxRealSlotCount_ == 0) {
107         char realSimSlotCount[SYSPARA_SIZE] = { 0 };
108         GetParameter(TEL_SIM_SLOT_COUNT, DEFAULT_SLOT_COUNT, realSimSlotCount, SYSPARA_SIZE);
109         maxRealSlotCount_ = std::atoi(realSimSlotCount);
110     }
111     return maxRealSlotCount_;
112 }
113 
114 template<typename T>
GetDefaultEsimSlotId()115 inline T GetDefaultEsimSlotId()
116 {
117     if (esimDefaultSlotId_ == ESIM_DEFAULT_SLOTID) {
118         char esimDefaultSlotId[SYSPARA_SIZE] = { 0 };
119         GetParameter(TEL_DEFAULT_ESIM_SLOT_ID, DEFAULT_ESIM_SLOT_ID, esimDefaultSlotId, SYSPARA_SIZE);
120         esimDefaultSlotId_ = std::atoi(esimDefaultSlotId);
121     }
122     return esimDefaultSlotId_;
123 }
124 
125 template<typename T>
GetVSimModemCount()126 inline T GetVSimModemCount()
127 {
128     if (vSimModemCount_ == VSIM_DEFAULT_VALUE) {
129         char vSimModemCount[SYSPARA_SIZE] = { 0 };
130         GetParameter(VSIM_MODEM_COUNT_STR, DEFAULT_VSIM_MODEM_COUNT, vSimModemCount, SYSPARA_SIZE);
131         vSimModemCount_ = std::atoi(vSimModemCount);
132     }
133     return vSimModemCount_;
134 }
135 
136 template<typename T>
GetPreferredNetworkType()137 inline T GetPreferredNetworkType()
138 {
139     char preferredNetworkType[SYSPARA_SIZE] = { 0 };
140     GetParameter(TEL_PREFERRED_NETWORK_TYPE, DEFAULT_PREFERRED_NETWORK_TYPE, preferredNetworkType, SYSPARA_SIZE);
141     T networkType = std::atoi(preferredNetworkType);
142     return networkType;
143 }
144 
GetDynamicPowerOffModeSwitch()145 inline bool GetDynamicPowerOffModeSwitch()
146 {
147     return system::GetBoolParameter(DYNAMIC_POWEROFF_MODEM, false);
148 }
149 
GetDynamicPowerOffModeSwitchWithStr()150 inline bool GetDynamicPowerOffModeSwitchWithStr()
151 {
152     return system::GetBoolParameter(DYNAMIC_POWEROFF_MODEM_WITH_STR, false);
153 }
154 
155 enum SatelliteValue {
156     SATELLITE_NOT_SUPPORTED = 0,
157     SATELLITE_SUPPORTED = 1,
158 };
159 
160 enum SimSlotId {
161     SIM_SLOT_0 = 0,
162     SIM_SLOT_1,
163     SIM_SLOT_2,
164     SIM_SLOT_3,
165 };
166 
167 /**
168  * @brief The modem power status.
169  */
170 enum ModemPowerState {
171     /**
172      * Power Not Available
173      */
174     CORE_SERVICE_POWER_NOT_AVAILABLE = -1,
175     /**
176      * Power OFF
177      */
178     CORE_SERVICE_POWER_OFF = 0,
179     /**
180      * Power ON
181      */
182     CORE_SERVICE_POWER_ON = 1
183 };
184 
185 /**
186  * @brief The priority of ordered commnon event.
187  */
188 enum CommonEventPriority {
189     FIRST_PRIORITY = 600,
190     SECOND_PRIORITY = 500,
191     THIRD_PRIORITY = 400
192 };
193 
194 template<typename T>
195 struct TelRilResponseInfo {
196     int32_t slotId = DEFAULT_SIM_SLOT_ID;
197     int32_t flag = 0;
198     int32_t errorNo = 0;
199     T object;
200 };
201 
202 /**
203  * @brief Defines the network bandwidth reporting rule.
204  */
205 struct LinkBandwidthRule {
206     /**
207      * Radio access technology
208      */
209     int32_t rat = 0;
210     /**
211      * Delay time
212      */
213     int32_t delayMs = 0;
214     /**
215      * Uplink delay
216      */
217     int32_t delayUplinkKbps = 0;
218     /**
219      * Downlink delay
220      */
221     int32_t delayDownlinkKbps = 0;
222     /**
223      * Maximum uplink parameter list
224      */
225     std::vector<int32_t> maximumUplinkKbps {};
226     /**
227      * Maximum downlink parameter list
228      */
229     std::vector<int32_t> maximumDownlinkKbps {};
230 };
231 
232 /**
233  * @brief Defines PDP context information.
234  */
235 struct DataProfile {
236     /**
237      * Profile Id
238      */
239     int profileId = 0;
240     /**
241      * (Access Point Name) a string parameter which is a logical name that is used to select the
242      * GGSN or the external packet data network. from 3GPP TS 27.007 10.1 V4.3.0 (2001-12)
243      */
244     std::string apn = "";
245     /**
246      * (Packet Data Protocol type) a string parameter which specifies the type of packet
247      * data protocol from 3GPP TS 27.007 10.1 V4.3.0 (2001-12)
248      */
249     std::string protocol = "";
250     /**
251      * Authentication Type
252      */
253     int32_t verType = 0;
254     /**
255      * Username
256      */
257     std::string userName = "";
258     /**
259      * Password
260      */
261     std::string password = "";
262     /**
263      * Roaming protocol version
264      */
265     std::string roamingProtocol = "";
266     /**
267      * Supported apn types bitmap
268      */
269     int32_t supportedApnTypesBitmap = 0;
270 
271     std::string snssai = "";
272     uint8_t sscMode = 0;
273 };
274 
275 /**
276  * @brief Defines activate data information.
277  */
278 struct ActivateDataParam {
279     /**
280      * eg:AppExecFwk::InnerEvent::Get(eventId, activateData.param);
281      */
282     int32_t param = 0;
283     /**
284      * Radio access technology
285      */
286     int32_t radioTechnology = 0;
287     /**
288      * DataProfile
289      */
290     struct DataProfile dataProfile;
291     /**
292      * Whether the user is roaming. The value true indicates that the user is roaming,
293      * and the value false indicates the opposite.
294      */
295     bool isRoaming = false;
296     /**
297      * Whether allow roaming
298      */
299     bool allowRoaming = false;
300 };
301 
302 /**
303  * @brief Defines deactivate data information.
304  */
305 struct DeactivateDataParam {
306     /**
307      * eg:AppExecFwk::InnerEvent::Get(eventId, deactivateData.param);
308      */
309     int32_t param = 0;
310     /**
311      * Packet Data Protocol (PDP) context ID
312      */
313     int32_t cid = 0;
314     /**
315      * Reason code of the data service activation failure. For details, see 3GPP TS 24.008.
316      */
317     int32_t reason = 0;
318 };
319 
320 /**
321  * @brief Defines the call forwarding information.
322  */
323 struct CallTransferParam {
324     /**
325      * Call forwarding operation mode:
326      *- 0: deactivation
327      *- 1: activation
328      *- 2: status query
329      *- 3: registration
330      *- 4: deletion
331      */
332     int32_t mode = 0;
333     /**
334      * Call forwarding type:
335      *- 0: call forwarding unconditional
336      *- 1: call forwarding on busy
337      *- 2: call forwarding on no reply
338      *- 3: call forwarding not reachable (no network service, or power-off)
339      *- 4: any call forwarding
340      *- 5: any call forwarding conditional
341      */
342     int32_t reason = 0;
343     /**
344      * Service class. For details, see 3GPP TS 27.007.
345      */
346     int32_t classx = 0;
347     /**
348      * Phone number
349      */
350     std::string number = "";
351 };
352 
353 /**
354  * @brief Defines the call restriction information.
355  */
356 struct CallRestrictionParam {
357     /**
358      * Operation mode:
359      *- 0: deactivation
360      *- 1: activation
361      */
362     int32_t mode = 0;
363     /**
364      * Password
365      */
366     char password[MAX_PARAMETER_LENGTH + 1] = { 0 };
367     /**
368      * Operation object
369      */
370     std::string fac = "";
371 };
372 
373 /**
374  * @brief Defines the dual tone multi-frequency (DTMF) information.
375  */
376 struct DtmfParam {
377     /**
378      * Call ID
379      */
380     int32_t index = 0;
381     /**
382      * Duration for playing the DTMF tone
383      */
384     int32_t switchOn = 0;
385     /**
386      * Interval for sending DTMF signals
387      */
388     int32_t switchOff = 0;
389     /**
390      * DTMF keyword
391      */
392     std::string sDTMFCode = "";
393 };
394 
395 /**
396  * @brief Defines the GSM cell broadcast configuration information.
397  */
398 struct CBConfigParam {
399     /**
400      * Mode (activated or not)
401      */
402     int32_t mode = 0;
403     /**
404      * Message IDs
405      */
406     std::string idList = "";
407     /**
408      * Data coding schemes
409      */
410     std::string dcsList = "";
411 };
412 
413 /**
414  * @brief Defines the SMS message information in a SIM card.
415  */
416 struct CdmaSimMessageParam {
417     /**
418      * Message index.
419      */
420     int32_t cdmaIndex = 0;
421     /**
422      * Status
423      */
424     int32_t status = 0;
425     /**
426      * Protocol data unit
427      */
428     std::string pdu = "";
429 };
430 
431 /**
432  * @brief GSM SMS message parameter.
433  */
434 struct GsmSimMessageParam {
435     /**
436      * Reference Id
437      */
438     int64_t refId = 0;
439     /**
440      * Short message service center
441      */
442     std::string smscPdu = "";
443     /**
444      * Protocol data unit
445      */
446     std::string pdu = "";
447 };
448 
449 /**
450  * @brief Defines the SMS message information in a SIM card.
451  */
452 struct SimMessageParam {
453     /**
454      * Message index.
455      */
456     int32_t gsmIndex = 0;
457     /**
458      * Status
459      */
460     int32_t status = 0;
461     /**
462      * Short message service center
463      */
464     std::string smscPdu = "";
465     /**
466      * Protocol data unit
467      */
468     std::string pdu = "";
469 };
470 
471 /**
472  * @brief Defines the SIM card lock information.
473  */
474 struct SimLockParam {
475     /**
476      * SIM lock type:
477      *- AO: barring of all outgoing calls
478      *- OI: barring of all outgoing international calls
479      *- OX: barring of all outgoing international calls except those directed to the home country
480      *- AI: barring of all incoming calls
481      *- IR: barring of all incoming calls when roaming outside the home location
482      *- AB: barring of all services (applicable only when the mode is greater than or equal to 0)
483      *- AG: barring of the outgoing call service (applicable only when the mode is greater than or equal to 0)
484      *- AC: barring of the incoming call service (applicable only when the mode is greater than or equal to 0)
485      *- FD: fixed dialing number (FDN)
486      *- PN: network locking
487      *- PU: subnet locking
488      *- PP: SP locking
489      */
490     std::string fac = "";
491     /**
492      * Mode:
493      *- 0: deactivation (When fac is set to PN, PU, or PP, the operation is equivalent to unlocking.)
494      *- 1: activation (When fac is set to PN, PU, or PP, activation is not supported.)
495      *- 2: query
496      */
497     int32_t mode = 0;
498     /**
499      * Password text
500      */
501     std::string passwd = "";
502 };
503 
504 /**
505  * @brief Defines the SIM card password information.
506  */
507 struct SimPasswordParam {
508     /**
509      * Maximum password length
510      */
511     int32_t passwordLength = 0;
512     /**
513      * SIM lock type:
514      *- AO: barring of all outgoing calls
515      *- OI: barring of all outgoing international calls
516      *- OX: barring of all outgoing international calls except those directed to the home country
517      *- AI: barring of all incoming calls
518      *- IR: barring of all incoming calls when roaming outside the home location
519      *- AB: barring of all services (applicable only when the mode is greater than or equal to 0)
520      *- AG: barring of the outgoing call service (applicable only when the mode is greater than or equal to 0)
521      *- AC: barring of the incoming call service (applicable only when the mode is greater than or equal to 0)
522      *- FD: fixed dialing number (FDN)
523      *- PN: network locking
524      *- PU: subnet locking
525      *- PP: SP locking
526      */
527     std::string fac = "";
528     /**
529      * Old password text
530      */
531     std::string oldPassword = "";
532     /**
533      * New password text
534      */
535     std::string newPassword = "";
536 };
537 
538 /**
539  * @brief Enumerates emergency call types.
540  */
541 enum class EccType : int32_t {
542     /**
543      * Default
544      */
545     TYPE_CATEGORY = 0,
546     /**
547      * Police
548      */
549     TYPE_POLICE = 1,
550     /**
551      * Ambulance
552      */
553     TYPE_AMBULANCE = 2,
554     /**
555      * Fire alarm
556      */
557     TYPE_FIRE = 4,
558     /**
559      * Marine police
560      */
561     TYPE_SEA = 8,
562     /**
563      * Mountain rescue
564      */
565     TYPE_MOUNTAIN = 16,
566 };
567 
568 /**
569  * @brief Specifies whether a number is valid when there is a card or no card.
570  */
571 enum class SimpresentType : int32_t {
572     /**
573      * Valid when there is no card
574      */
575     TYPE_NO_CARD = 0,
576     /**
577      * Valid when there is a card
578      */
579     TYPE_HAS_CARD = 1,
580 };
581 
582 /**
583  * @brief Specifies whether a number is valid for all states or only for the abnormal service state of
584  * the circuit switched (CS) domain.
585  */
586 enum class AbnormalServiceType : int32_t {
587     /**
588      * Vaild for all states
589      */
590     TYPE_ALL = 0,
591     /**
592      * Valid only for the abnormal service state of the CS domain
593      */
594     TYPE_ONLY_CS = 1,
595 };
596 
597 /**
598  * @brief Defines the emergency call number.
599  */
600 struct EmergencyCall {
601     /**
602      * Emergency number
603      */
604     std::string eccNum = "";
605     /**
606      * Mobile country code
607      */
608     std::string mcc = "";
609     /**
610      * Enumerates emergency call types. For details, see EccType.
611      */
612     EccType eccType = EccType::TYPE_CATEGORY;
613     /**
614      * Whether a number is valid when there is a card or no card. For details, see SimpresentType.
615      */
616     SimpresentType simpresent = SimpresentType::TYPE_NO_CARD;
617     /**
618      * Whether a number is valid for all states or only for the abnormal service state of the CS domain.
619      * For details, see AbnormalService.
620      */
621     AbnormalServiceType abnormalService = AbnormalServiceType::TYPE_ALL;
622     bool operator==(const EmergencyCall &call)
623     {
624         return (eccNum == call.eccNum && mcc == call.mcc);
625     }
626 };
627 
628 /**
629  * @brief Defines the response info of SetEmergencyCallList.
630  */
631 struct SetEccListResponse {
632     /**
633      * Response result
634      */
635     int32_t result = 0;
636     /**
637      * Response value
638      */
639     int32_t value = 0;
640 };
641 
642 /**
643  * @brief Defines the Public Land Mobile Network name.
644  */
645 struct PlmnNetworkName {
646     /**
647      * Long name of the registered network
648      */
649     std::string longName = "";
650     /**
651      * Short name of the registered network
652      */
653     std::string shortName = "";
654 };
655 
656 /**
657  * @brief Defines the Operator PLMN information see 3GPP TS 31.102 Section 4.2.59.
658  */
659 struct OperatorPlmnInfo {
660     /**
661      * PLMN numeric
662      */
663     std::string plmnNumeric = "";
664     /**
665      * Start of the LAC range
666      */
667     int32_t lacStart = 0;
668     /**
669      * End of the LAC range
670      */
671     int32_t lacEnd = 0;
672     /**
673      * Identifier of operator name in PNN to be displayed
674      */
675     int32_t pnnRecordId = 0;
676 };
677 
678 /**
679  * @brief Enumerates radio protocol phases.
680  *
681  * @enum RadioProtocolPhase
682  */
683 enum class RadioProtocolPhase {
684     /**
685      * The value of Initial radio protocol phase
686      */
687     RADIO_PROTOCOL_PHASE_INITIAL,
688     /**
689      * The value of execute check communication phase
690      */
691     RADIO_PROTOCOL_PHASE_CHECK,
692     /**
693      * The value of execute update communication phase
694      */
695     RADIO_PROTOCOL_PHASE_UPDATE,
696     /**
697      * The value of unsol radio phase
698      */
699     RADIO_PROTOCOL_PHASE_NOTIFY,
700     /**
701      * The value of execute complete communication phase
702      */
703     RADIO_PROTOCOL_PHASE_COMPLETE,
704 };
705 
706 /**
707  * @brief Enumerates radio protocol states.
708  */
709 enum class RadioProtocolStatus {
710     /**
711      * Unknow radio protocol state
712      */
713     RADIO_PROTOCOL_STATUS_NONE,
714     /**
715      * Set radio protocol successed
716      */
717     RADIO_PROTOCOL_STATUS_SUCCESS,
718     /**
719      * Set radio protocol failed
720      */
721     RADIO_PROTOCOL_STATUS_FAIL,
722 };
723 
724 /**
725  * @brief Defines the protocol stack information of the primary and secondary SIM cards.
726  */
727 struct RadioProtocol {
728     /**
729      * Card slot ID
730      */
731     int32_t slotId = DEFAULT_SIM_SLOT_ID;
732     /**
733      * Session ID
734      */
735     int32_t sessionId = 0;
736     /**
737      * Radio protocol parameters. For details, see RadioProtocolPhase.
738      */
739     RadioProtocolPhase phase = RadioProtocolPhase::RADIO_PROTOCOL_PHASE_INITIAL;
740     /**
741      * Radio protocol technology:
742      *- 1: GSM
743      *- 2: 1XRTT
744      *- 4: WCDMA
745      *- 8: HSPA
746      *- 16: HSPAP
747      *- 32: TDSCDMA
748      *- 64: EV-DO
749      *- 128: EHRPD
750      *- 256: LTE
751      *- 512: LTE_CA
752      *- 1024: IWLAN
753      *- 2048: NR
754      */
755     int32_t technology = 0;
756     /**
757      * Modem ID, corresponding to slotId at the bottom layer
758      */
759     int32_t modemId = 0;
760     /**
761      * Radio protocol status. For details, see RadioProtocolStatus.
762      */
763     RadioProtocolStatus status = RadioProtocolStatus::RADIO_PROTOCOL_STATUS_NONE;
764 };
765 
766 /**
767  * @brief Defines the result info of ss command.
768  */
769 struct SsBaseResult {
770     /**
771      * Command index, use for find the ss command to retry
772      */
773     int32_t index = 0;
774     /**
775      * The result of execute command
776      */
777     int32_t result = 0;
778     /**
779      * This use for remaind message code
780      */
781     int32_t reason = 0;
782     /**
783      * This use for remaind message
784      */
785     std::string message = "";
786 };
787 
788 /**
789  * @brief Defines the result info of GetClip.
790  */
791 struct GetClipResult {
792     /**
793      * Query results
794      */
795     SsBaseResult result;
796     /**
797      * Parameter sets/shows the result code presentation status in the TA
798      */
799     int32_t action = 0;
800     /**
801      * Parameter shows the subscriber CLIP service status in the network, <0-4>
802      */
803     int32_t clipStat = 0;
804 };
805 
806 /**
807  * @brief Defines the result info of GetClir.
808  */
809 struct GetClirResult {
810     /**
811      * Query results
812      */
813     SsBaseResult result;
814     /**
815      * Parameter sets/shows the result code presentation status in the TA
816      */
817     int32_t action = 0;
818     /**
819      * Parameter shows the subscriber CLIP service status in the network, <0-4>
820      */
821     int32_t clirStat = 0;
822 };
823 
824 /**
825  * @brief Defines the result info of GetColr.
826  */
827 struct GetColrResult {
828     /**
829      * Query results
830      */
831     SsBaseResult result;
832     /**
833      * Parameter sets/shows the result code presentation status in the TA
834      */
835     int32_t action = 0;
836     /**
837      * Parameter shows the subscriber COLR service status in the network, <0-4>
838      */
839     int32_t colrStat = 0;
840 };
841 
842 /**
843  * @brief Defines the result info of GetColp.
844  */
845 struct GetColpResult {
846     /**
847      * Query results
848      */
849     SsBaseResult result;
850     /**
851      * Parameter sets/shows the result code presentation status in the TA
852      */
853     int32_t action = 0;
854     /**
855      * Parameter shows the subscriber COLP service status in the network, <0-4>
856      */
857     int32_t colpStat = 0;
858 };
859 
860 /**
861  * @brief Defines the result info of CallWait.
862  */
863 struct CallWaitResult {
864     /**
865      * Query results
866      */
867     SsBaseResult result;
868     /**
869      * Parameter sets/shows the result code presentation status in the TA
870      */
871     int32_t status = 0;
872     /**
873      * Parameter shows the subscriber CLIP service status in the network, <0-4>
874      */
875     int32_t classCw = 0;
876 };
877 
878 /**
879  * @brief Defines the result info of CallRestriction.
880  */
881 struct CallRestrictionResult {
882     /**
883      * Query results
884      */
885     SsBaseResult result;
886     /**
887      * Parameter sets/shows the result code presentation status in the TA
888      */
889     int32_t status = 0;
890     /**
891      * Parameter shows the subscriber CLIP service status in the network, <0-4>
892      */
893     int32_t classCw = 0;
894 };
895 
896 /**
897  * @brief Defines the call forwarding query result.
898  */
899 struct CallForwardQueryResult {
900     /**
901      * Request SN
902      */
903     int32_t serial = 0;
904     /**
905      * Query result
906      */
907     int32_t result = 0;
908     /**
909      * Status:
910      *- 0: not activated
911      *- 1: activated
912      */
913     int32_t status = 0;
914     /**
915      * Service class. For details, see 3GPP TS 27.007.
916      */
917     int32_t classx = 0;
918     /**
919      * Phone number
920      */
921     std::string number = "";
922     /**
923      * Number type:
924      *-129: common number
925      *- 145: international number
926      */
927     int32_t type = 0;
928     /**
929      * Call forwarding type:
930      *- 0: call forwarding unconditional
931      *- 1: call forwarding on busy
932      *- 2: call forwarding on no reply
933      *- 3: call forwarding not reachable (no network service or power-off)
934      *- 4: any call forwarding
935      *- 5: any call forwarding conditional
936      */
937     int32_t reason = 0;
938     /**
939      * Waiting time
940      */
941     int32_t time = 0;
942     /**
943      * Start hour
944      */
945     int32_t startHour = 0;
946     /**
947      * Start minute
948      */
949     int32_t startMinute = 0;
950     /**
951      * End hour
952      */
953     int32_t endHour = 0;
954     /**
955      * End minute
956      */
957     int32_t endMinute = 0;
958 };
959 
960 /**
961  * @brief Defines the list of call forwarding information.
962  */
963 struct CallForwardQueryInfoList {
964     /**
965      * Query results
966      */
967     SsBaseResult result;
968     /**
969      * Total number
970      */
971     int32_t callSize = 0;
972     /**
973      * ID of the call forwarding query result
974      */
975     int32_t flag = 0;
976     /**
977      * Call forwarding query result
978      */
979     std::vector<CallForwardQueryResult> calls {};
980 };
981 
982 /**
983  * @brief Defines the info of NitzData.
984  */
985 struct NitzData {
986     /**
987      * Parameter shows if DST exist
988      */
989     int32_t isDST;
990     /**
991      * Parameter shows the total offset of timezone
992      */
993     int32_t totalOffset;
994     /**
995      * Parameter shows the UTC time from 1970 0H:0M:0S in milliseconds
996      */
997     int64_t currentMillis;
998 };
999 
1000 } // namespace Telephony
1001 } // namespace OHOS
1002 #endif // TELEPHONY_TELEPHONY_TYPES_H
1003