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 OHOS_RIL_TYPE_H
17 #define OHOS_RIL_TYPE_H
18 
19 #include <locale>
20 
21 #include "hril.h"
22 
23 namespace OHOS {
24 namespace Telephony {
25 enum class HRilNotiType { HRIL_NOTIFICATION, HRIL_NO_DEFINE };
26 
27 /**
28  * @brief Indicates the specific APN type.
29  */
30 enum class HRilApnTypes : int32_t {
31     /** None */
32     NONE = 0,
33 
34     /** APN type for default data traffic */
35     DEFAULT = 1,
36 
37     /** APN type for MMS traffic */
38     MMS = 2,
39 
40     /** APN type for SUPL assisted GPS */
41     SUPL = 4,
42 
43     /** APN type for DUN traffic */
44     DUN = 8,
45 
46     /** APN type for HiPri traffic */
47     HIPRI = 16,
48 
49     /** APN type for FOTA */
50     FOTA = 32,
51 
52     /** APN type for IMS */
53     IMS = 64,
54 
55     /** APN type for CBS */
56     CBS = 128,
57 
58     /** APN type for IA Initial Attach APN */
59     IA = 256,
60 
61     /** APN type for Emergency PDN */
62     EMERGENCY = 512,
63 
64     ALL = 1023,
65 };
66 
67 /**
68  * @brief Indicates whether the hril notification need lock.
69  */
70 enum HRilRunningLockTypes { UNNEED_LOCK, NEED_LOCK };
71 
72 /**
73  * @brief From 3GPP TS 27.007 V4.3.0 (2001-12).
74  */
75 struct GetCallWaitingInfo {
76     /** 0: not active, 1:active */
77     int32_t status = 0;
78 
79     /** <classx> default, SLM790 is 255 */
80     int32_t typeClass = 0;
81 };
82 
83 enum HRilCommonNumber {
84     HRIL_DEC = 10,
85     HRIL_INVALID_HEX_CHAR = 16,
86     HRIL_UPPER_CASE_LETTERS_OFFSET = 32,
87     HRIL_ADAPTER_RADIO_INDICATION = 2001,
88     HRIL_ADAPTER_RADIO_RESPONSE = 2002,
89     HRIL_ADAPTER_RADIO_SEND_ACK,
90 };
91 
92 enum HRilOperatorInfoResult {
93     HRIL_LONE_NAME = 0,
94     HRIL_SHORT_NAME,
95     HRIL_NUMERIC,
96 };
97 
98 enum HRilCircuitModeRegState {
99     /** Not registered, MT is not searching an operator */
100     HRIL_STAT_NO_REG_MT_NO_SEARCHING_OP = 0,
101 
102     /** Registered, home network */
103     HRIL_STAT_REGISTERED_HOME_NETWORK = 1,
104 
105     /**
106      * Not registered, but MT is currently trying to attach or searching an
107      * operator
108      */
109     HRIL_STAT_NO_REGISTERED_MT_TRY_ATTACH = 2,
110 
111     /** Registration denied */
112     HRIL_STAT_REGISTERED_DENIED = 3,
113 
114     /** Unknown (e.g. out of GERAN/UTRAN coverage) */
115     HRIL_STAT_UNKNOWN = 4,
116 
117     /** Registered, roaming */
118     HRIL_STAT_REGISTERED_ROAMING = 5,
119 };
120 
121 enum HRilServiceSupportStat {
122     HRIL_SERVICE_NO_SUPPORT = 0,
123     HRIL_SERVICE_SUPPORT = 1,
124 };
125 
126 /**
127  * @brief Indicates the data denied reason, from 3GPP TS 27.007 V17.1.0 9.2.2.1.1.
128  */
129 enum HRilReasonDataDenied {
130     HREASON_GPRS_SERVICE_NOT_ALLOW = 0,
131     HREASON_GPRS_AND_NON_GPRS_SERVICE_NOT_ALLOW = 1,
132     HREASON_MS_IDENTITY_CANNOT_BE_DERIVED = 2,
133     HREASON_IMPLICITLY_DETACHED = 3,
134     HREASON_GPRS_SERVICE_NOT_ALLOW_IN_PLMN = 4,
135     HREASON_MSC_TEM_NOT_REACH = 5,
136     HREASON_NO_DPD_CONTEXT_ACTIVATED = 6,
137 };
138 
139 enum HRilNetworkMode {
140     HRIL_NETWORK_AUTOMATIC_MODE = 0,
141     HRIL_NETWORK_MANUAL_MODE,
142 };
143 
144 /**
145  * @brief Indicates the specific IMS type.
146  */
147 enum HRilIMSRegType {
148     /** VoLTE type */
149     NETWORK_IMS_REG_FEATURE_TYPE_VOLTE = 0x01,
150 
151     /** SMS over IP type */
152     NETWORK_IMS_REG_FEATURE_TYPE_SMS = 0x02,
153 
154     /** RCS type */
155     NETWORK_IMS_REG_FEATURE_TYPE_RCS = 0x04,
156 
157     /** VT type */
158     NETWORK_IMS_REG_FEATURE_TYPE_VT = 0x08,
159 };
160 
161 /** CS registration response */
162 static constexpr uint32_t HRIL_CS_REG_STATE = 1;
163 static constexpr uint32_t HRIL_CS_REG_RESP_ACT = 4;
164 static constexpr uint32_t HRIL_RSSNR = 7;
165 static constexpr uint32_t HRIL_CS_REG_RESP_ROAMING_INDICATOR = 10;
166 static constexpr uint32_t HRIL_CS_REG_RESP_SYSTEM_IS_IN_PRL = 11;
167 static constexpr uint32_t HRIL_CS_REG_RESP_DEFAULT_ROAMING_INDICATOR = 12;
168 static constexpr uint32_t HRIL_CS_REG_RESP_TIMING_ADVANCE = 13;
169 static constexpr uint32_t HRIL_CS_REG_STATUS_MAX_LEN = 5;
170 
171 /** PS registration response */
172 static constexpr uint32_t HRIL_PS_REG_STATUS_MAX_LEN = 5;
173 static constexpr uint32_t HRIL_PS_RADIO_TECHNOLOGY = 4;
174 static constexpr uint32_t HRIL_PS_DENIED_ERROR_CODE = 4;
175 static constexpr uint32_t HRIL_PS_MAX_DATA_CALLS = 5;
176 static constexpr uint32_t HRIL_PS_DEF_DATA_CALLS_VAL = 1;
177 
178 static constexpr uint32_t HRIL_LOCATION_REG_STATE = 1;
179 static constexpr uint32_t HRIL_LOCATION_LOC = 2;
180 static constexpr uint32_t HRIL_LOCATION_CI = 3;
181 
182 /** IMS registration response */
183 static constexpr uint32_t HRIL_IMS_REG_STATUS_MAX_LEN = 2;
184 static constexpr uint32_t HRIL_IMS_REG_STATUS = 0;
185 static constexpr uint32_t HRIL_IMS_REG_FLAG = 1;
186 
187 static constexpr uint32_t HRIL_NETWORKS_SELECT_MODE = 0;
188 
189 /** Get the number of SIM cards in the system configuration */
190 inline const int32_t HRIL_SYSPARA_SIZE = 128;
191 inline constexpr const char *HRIL_DEFAULT_SLOT_COUNT = "1";
192 inline constexpr const char *HRIL_TEL_SIM_SLOT_COUNT = "const.telephony.slotCount";
193 inline constexpr const char *HRIL_DEFAULT_VSIM_MODEM_COUNT = "0";
194 inline constexpr const char *HRIL_VSIM_MODEM_COUNT_STR = "const.telephony.vsimModemCount";
195 
196 /** Interface token */
197 inline const std::u16string HRIL_INTERFACE_TOKEN = u"ohos.telephony.hril";
198 } // namespace Telephony
199 } // namespace OHOS
200 #endif // TELEPHONY_N_TYPE_H
201