• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 struct OperatorConfig : public Parcelable {
96     std::map<std::u16string, std::u16string> configValue {};
97     std::map<std::string, std::string> stringValue {};
98     std::map<std::string, std::vector<std::string>> stringArrayValue {};
99     std::map<std::string, int32_t> intValue {};
100     std::map<std::string, std::vector<int32_t>> intArrayValue {};
101     std::map<std::string, int64_t> longValue {};
102     std::map<std::string, std::vector<int64_t>> longArrayValue {};
103     std::map<std::string, bool> boolValue {};
104     const int32_t MAX_CONFIG_SIZE = 10000;
105     bool Marshalling(Parcel &parcel) const;
106     bool MarshallingU16StringMap(Parcel &parcel) const;
107     bool MarshallingStringMap(Parcel &parcel) const;
108     bool MarshallingBoolMap(Parcel &parcel) const;
109     bool MarshallingIntMap(Parcel &parcel) const;
110     bool MarshallingLongMap(Parcel &parcel) const;
111     bool MarshallingStringArrayMap(Parcel &parcel) const;
112     bool MarshallingIntArrayMap(Parcel &parcel) const;
113     bool MarshallingLongArrayMap(Parcel &parcel) const;
114     std::shared_ptr<OperatorConfig> UnMarshalling(Parcel &parcel);
115     bool ReadFromParcel(Parcel &parcel);
116     bool ReadFromU16StringMap(Parcel &parcel);
117     bool ReadFromStringMap(Parcel &parcel);
118     bool ReadFromIntMap(Parcel &parcel);
119     bool ReadFromBoolMap(Parcel &parcel);
120     bool ReadFromLongMap(Parcel &parcel);
121     bool ReadFromStringArrayMap(Parcel &parcel);
122     bool ReadFromIntArrayMap(Parcel &parcel);
123     bool ReadFromLongArrayMap(Parcel &parcel);
124 };
125 } // namespace Telephony
126 } // namespace OHOS
127 #endif // TELEPHONY_OPERATOR_CONFIG_TYPES_H
128