1 /*
2  * Copyright (C) 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_OPERATOR_CONFIG_TYPES_H
17 #define TELEPHONY_OPERATOR_CONFIG_TYPES_H
18 
19 #include <map>
20 #include <string>
21 #include <vector>
22 #include "parcel.h"
23 
24 namespace OHOS {
25 namespace Telephony {
26 const std::string BROADCAST_ARG_SLOT_ID = "slotId";
27 const std::string KEY_EMERGENCY_CALL_STRING_ARRAY = "emergency_call_string_array";
28 const int32_t DEFAULT_CALL_WAITING_SERVICE_CLASS_CONFIG = 1;
29 const std::vector<std::string> IMS_CALL_DISCONNECT_REASONINFO_MAPPING_CONFIG = std::vector<std::string> {};
30 const int32_t CARRIER_NR_AVAILABILITY_NSA = 1;
31 const int32_t CARRIER_NR_AVAILABILITY_SA = 2;
32 constexpr const char *KEY_IMS_SWITCH_ON_BY_DEFAULT_BOOL = "ims_switch_on_by_default_bool";
33 constexpr const char *KEY_HIDE_IMS_SWITCH_BOOL = "hide_ims_switch_bool";
34 constexpr const char *KEY_VOLTE_SUPPORTED_BOOL = "volte_supported_bool";
35 constexpr const char *KEY_NR_MODE_SUPPORTED_LIST_INT_ARRAY = "nr_mode_supported_list_int_array";
36 constexpr const char *KEY_VOLTE_PROVISIONING_SUPPORTED_BOOL = "volte_provisioning_supported_bool";
37 constexpr const char *KEY_SS_OVER_UT_SUPPORTED_BOOL = "ss_over_ut_supported_bool";
38 constexpr const char *KEY_IMS_GBA_REQUIRED_BOOL = "ims_gba_required_bool";
39 constexpr const char *KEY_UT_PROVISIONING_SUPPORTED_BOOL = "ut_provisioning_supported_bool";
40 constexpr const char *KEY_IMS_PREFER_FOR_EMERGENCY_BOOL = "ims_prefer_for_emergency_bool";
41 constexpr const char *KEY_CALL_WAITING_SERVICE_CLASS_INT = "call_waiting_service_class_int";
42 constexpr const char *KEY_IMS_CALL_DISCONNECT_REASONINFO_MAPPING_STRING_ARRAY =
43     "ims_call_disconnect_reasoninfo_mapping_string_array";
44 constexpr const char *KEY_FORCE_VOLTE_SWITCH_ON_BOOL = "force_volte_switch_on_bool";
45 /**
46  * If true, customize the items related to operator name.
47  */
48 constexpr const char *KEY_ENABLE_OPERATOR_NAME_CUST_BOOL = "enable_operator_name_cust_bool";
49 /**
50  * Customize the operatoer name if #KEY_ENABLE_OPERATOR_NAME_CUST_BOOL is true.
51  */
52 constexpr const char *KEY_OPERATOR_NAME_CUST_STRING = "operator_name_cust_string";
53 /**
54  * Customize the SPN Display Condition bits if #KEY_ENABLE_OPERATOR_NAME_CUST_BOOL is true. The default value '-1' means
55  * this field is not set.
56  * b1 = 0: display of registered PLMN name not required when registered PLMN is either HPLMN or a PLMN in the service
57  * provider PLMN list (see EF_SPDI).
58  * b1 = 1: display of registered PLMN name required when registered PLMN is either HPLMN or a PLMN in the service
59  * provider PLMN list(see EF_SPDI).
60  * b2 = 0: display of the service provider name required when registered PLMN is neither HPLMN nor a PLMN in the
61  * service provider PLMN list(see EF_SPDI).
62  * b2 = 1: display of the service provider name not required when registered PLMN is neither HPLMN nor a PLMN in the
63  * service provider PLMN list(see EF_SPDI).
64  *
65  * See 3GPP TS 31.102 v15.2.0 Section 4.2.12 EF_SPN.
66  */
67 constexpr const char *KEY_SPN_DISPLAY_CONDITION_CUST_INT = "spn_display_condition_cust_int";
68 /**
69  * Customize the PNN - a string array of comma-separated long and short names:
70  * "long_name1,short_name1".
71  *
72  * See 3GPP TS 31.102 v15.2.0 Section 4.2.58 EF_PNN.
73  */
74 constexpr const char *KEY_PNN_CUST_STRING_ARRAY = "pnn_cust_string_array";
75 /**
76  * Customize the OPL - a string array of OPL records, each with comma-delimited data fields as follows:
77  * "plmn1,lac_start,lac_end,index".
78  *
79  * See 3GPP TS 31.102 v15.2.0 Section 4.2.59 EF_OPL.
80  */
81 constexpr const char *KEY_OPL_CUST_STRING_ARRAY = "opl_cust_string_array";
82 /**
83  * Indicates whether a modem is used as the bandwidth reporting source.
84  */
85 constexpr const char *KEY_BANDWIDTH_SOURCE_USE_MODEM_BOOL = "bandwidth_source_use_modem_bool";
86 /**
87  * Indicates whether to use uplink bandwidth value of LTE if it is NR NSA.
88  */
89 constexpr const char *KEY_UPLINK_BANDWIDTH_NR_NSA_USE_LTE_VALUE_BOOL = "uplink_bandwidth_nr_nsa_use_lte_value_bool";
90 /**
91  * Indicates the uplink and downlink bandwidth values for the network.
92  */
93 constexpr const char *KEY_BANDWIDTH_STRING_ARRAY = "bandwidth_string_array";
94 /**
95  * Indicates the MTU size.
96  */
97 constexpr const char *KEY_MTU_SIZE_STRING = "mtu_size_string";
98 /**
99  * Indicates the whether support single pdp mode.
100  */
101 constexpr const char *KEY_SINGLE_PDP_ENABLED_BOOL = "single_pdp_enabled_bool";
102 /**
103  * Indicates the whether carry ESM information to network.
104  */
105 constexpr const char *KEY_PLMN_ESM_FLAG_INT = "plmn_esm_flag_int";
106 /**
107  * Indicates the whether only support single pdp radio type array.
108  */
109 constexpr const char *KEY_SINGLE_PDP_RADIO_TYPE_INT_ARRAY = "single_pdp_radio_type_int_array";
110 /**
111  * Indicates default value of data roaming bool.
112  */
113 constexpr const char *KEY_DEFAULT_DATA_ROAMING_BOOL = "default_data_roaming_bool";
114 /**
115  * Indicates the voice mail number from cust.
116  */
117 constexpr const char *KEY_VOICE_MAIL_NUMBER_STRING = "voice_mail_number_string";
118 /**
119  * Indicates the voice mail carrier from cust.
120  */
121 constexpr const char *KEY_VOICE_MAIL_CARRIER_STRING = "voice_mail_carrier_string";
122 /**
123  * Indicates the voice mail tag from cust.
124  */
125 constexpr const char *KEY_VOICE_MAIL_TAG_STRING = "voice_mail_tag_string";
126 /**
127  * Indicates whether to edit voice mail information to sim card.
128  */
129 constexpr const char *KEY_VOICE_MAIL_EDIT_NOT_TO_SIM_BOOL = "voice_mail_edit_not_to_sim_bool";
130 
131 struct OperatorConfig : public Parcelable {
132     std::map<std::u16string, std::u16string> configValue {};
133     std::map<std::string, std::string> stringValue {};
134     std::map<std::string, std::vector<std::string>> stringArrayValue {};
135     std::map<std::string, int32_t> intValue {};
136     std::map<std::string, std::vector<int32_t>> intArrayValue {};
137     std::map<std::string, int64_t> longValue {};
138     std::map<std::string, std::vector<int64_t>> longArrayValue {};
139     std::map<std::string, bool> boolValue {};
140     const int32_t MAX_CONFIG_SIZE = 10000;
141     bool Marshalling(Parcel &parcel) const;
142     bool MarshallingU16StringMap(Parcel &parcel) const;
143     bool MarshallingStringMap(Parcel &parcel) const;
144     bool MarshallingBoolMap(Parcel &parcel) const;
145     bool MarshallingIntMap(Parcel &parcel) const;
146     bool MarshallingLongMap(Parcel &parcel) const;
147     bool MarshallingStringArrayMap(Parcel &parcel) const;
148     bool MarshallingIntArrayMap(Parcel &parcel) const;
149     bool MarshallingLongArrayMap(Parcel &parcel) const;
150     std::shared_ptr<OperatorConfig> UnMarshalling(Parcel &parcel);
151     bool ReadFromParcel(Parcel &parcel);
152     bool ReadFromU16StringMap(Parcel &parcel);
153     bool ReadFromStringMap(Parcel &parcel);
154     bool ReadFromIntMap(Parcel &parcel);
155     bool ReadFromBoolMap(Parcel &parcel);
156     bool ReadFromLongMap(Parcel &parcel);
157     bool ReadFromStringArrayMap(Parcel &parcel);
158     bool ReadFromIntArrayMap(Parcel &parcel);
159     bool ReadFromLongArrayMap(Parcel &parcel);
160 };
161 } // namespace Telephony
162 } // namespace OHOS
163 #endif // TELEPHONY_OPERATOR_CONFIG_TYPES_H
164