• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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 HRilErrType : int32_t {
26     NONE = 0,
27     HRIL_ERR_GENERIC_FAILURE,
28     HRIL_ERR_INVALID_PARAMETER,
29     HRIL_ERR_MEMORY_FULL,
30     HRIL_ERR_CMD_SEND_FAILURE,
31     HRIL_ERR_CMD_NO_CARRIER,
32     HRIL_ERR_INVALID_RESPONSE,
33     HRIL_ERR_REPEAT_STATUS,
34     HRIL_ERR_NETWORK_SEARCHING,
35     HRIL_ERR_NETWORK_SEARCHING_INTERRUPTED,
36     HRIL_ERR_MODEM_DEVICE_CLOSE,
37 
38     // network error
39     HRIL_ERR_NO_SIMCARD_INSERTED,
40     HRIL_ERR_NEED_PIN_CODE,
41     HRIL_ERR_NEED_PUK_CODE,
42     HRIL_ERR_NETWORK_SEARCH_TIMEOUT,
43     HRIL_ERR_PINPUK_PASSWORD_NOCORRECT,
44     HRIL_ERR_INVALID_MODEM_PARAMETER = 50,
45 
46     HRIL_ERR_HDF_IPC_FAILURE = 300,
47     HRIL_ERR_NULL_POINT,
48     HRIL_ERR_VENDOR_NOT_IMPLEMENT
49 };
50 
51 enum class HRilNotiType { HRIL_NOTIFICATION, HRIL_NO_DEFINE };
52 
53 enum class HRilApnTypes : int32_t {
54     NONE = 0,
55     DEFAULT = 1,
56     MMS = 2,
57     SUPL = 4,
58     DUN = 8,
59     HIPRI = 16,
60     FOTA = 32,
61     IMS = 64,
62     CBS = 128,
63     IA = 256,
64     EMERGENCY = 512,
65     ALL = 1023,
66 };
67 
68 enum HRilRunningLockTypes { UNNEED_LOCK, NEED_LOCK };
69 
70 enum HRilResponseTypes {
71     HRIL_RESPONSE_REQUEST,
72     HRIL_RESPONSE_NOTICE,
73     HRIL_RESPONSE_REQUEST_ACK,
74     HRIL_RESPONSE_REQUEST_MUST_ACK,
75     HRIL_RESPONSE_NOTICE_MUST_ACK,
76 };
77 
78 /* From 3GPP TS 27.007 V4.3.0 (2001-12) 8.5, AT + CSQ */
79 struct GsmRssi {
80     int32_t rxlev; /* Received Signal Strength Indication, value range 0 ~ 31, max is 99, if unknown then set to
81                        max */
82     int32_t ber; /* bit error rate, value range 0 ~ 7, max is 99, if unknown then set to max
83                    * as RXQUAL values in the table in TS 45.008 [20] subclauses 8.2.4. */
84 };
85 
86 /* From 3GPP TS 27.007 V17.1.0 (2021-03) 8.69 */
87 struct CdmaRssi {
88     int32_t absoluteRssi; /* Absolute value of signal strength. This value is the actual Rssi value
89                             * multiplied by -1.
90                             * e.g: Rssi is -75, then this response value will be 75 */
91     int32_t ecno; /* integer type, ratio of the received energy per PN chip to the total received power spectral
92                     * density (see 3GPP TS 25.133 [95] subclauses) */
93 };
94 
95 struct WCdmaRssi {
96     int32_t rxlev; /* integer type, received signal strength level
97                      * (see 3GPP TS 45.008 [20] sub-clause 8.1.4) value 0~99 */
98     int32_t ecio; /* integer type, ratio of the received energy per PN chip to the total received power
99                     * spectral density (see 3GPP TS 25.133 [95] sub-clause). */
100     int32_t rscp; /* integer type, received signal code power (see 3GPP TS 25.133 [95] sub-clause 9.1.1.3 and
101                     * 3GPP TS 25.123 [96] sub-clause 9.1.1.1.3).
102                     * range  value 0 ~ 96, 255 not known or not detectable */
103     int32_t ber; /* bit error rate, value range 0 ~ 7, max is 99, if unknown then set to max */
104 };
105 
106 struct LteRssi {
107     int32_t rxlev; /* integer type, received signal strength level
108                      * (see 3GPP TS 45.008 [20] sub-clause 8.1.4) value 0~99 */
109     int32_t rsrq; /* integer type, reference signal received quality (see 3GPP TS 36.133 [96] sub-clause 9.1.7)
110                     * value range 0~33, 255 not known or not detectable */
111     int32_t rsrp; /* integer type, reference signal received power (see 3GPP TS 36.133 [96] sub-clause 9.1.4)
112                     * value range 0~97, 255 not known or not detectable */
113     int32_t snr; /* integer type, representing the signal-to-interference plus noise ratio, suitable for LTE mode
114                    * value range 0~251, 255 not known or not detectable */
115 };
116 
117 struct TdScdmaRssi {
118     int32_t rscp;
119 };
120 
121 struct NrRssi {
122     int32_t rsrp;
123     int32_t rsrq;
124     int32_t sinr;
125 };
126 
127 struct Rssi {
128     GsmRssi gw;
129     CdmaRssi cdma;
130     WCdmaRssi wcdma;
131     LteRssi lte;
132     TdScdmaRssi tdScdma;
133     NrRssi nr;
134 };
135 
136 /* from 3GPP TS 27.007 V4.3.0 (2001-12) */
137 struct GetCallWaitingInfo {
138     int32_t status; /* 0 not active
139                      * 1 active */
140     int32_t typeClass; /* <classx> default, SLM790 is 255 */
141 };
142 
143 struct HRilResponseHeadInfo {
144     int32_t slotId;
145     HRilResponseTypes type;
146 };
147 
148 struct HRilRadioResponseInfo {
149     int32_t flag = -1;
150     int32_t serial = -1;
151     HRilErrType error;
152     HRilResponseTypes type;
153 };
154 
155 struct HRilRadioStateInfo {
156     int64_t flag;
157     int32_t state;
158 };
159 
160 enum HRilCommonNumber {
161     HRIL_DEC = 10,
162     HRIL_INVALID_HEX_CHAR = 16,
163     HRIL_UPPER_CASE_LETTERS_OFFSET = 32,
164     HRIL_ADAPTER_RADIO_INDICATION = 2001,
165     HRIL_ADAPTER_RADIO_RESPONSE = 2002,
166     HRIL_ADAPTER_RADIO_SEND_ACK,
167 };
168 
169 enum HRilOperatorInfoResult {
170     HRIL_LONE_NAME = 0,
171     HRIL_SHORT_NAME,
172     HRIL_NUMERIC,
173 };
174 
175 enum HRilCircuitModeRegState {
176     HRIL_STAT_NO_REG_MT_NO_SEARCHING_OP = 0, /* not registered, MT is not searching an operator */
177     HRIL_STAT_REGISTERED_HOME_NETWORK = 1, /* registered, home network */
178     HRIL_STAT_NO_REGISTERED_MT_TRY_ATTACH = 2, /* not registered, but MT is currently trying
179                                                 * to attach or searching an operator */
180     HRIL_STAT_REGISTERED_DENIED = 3, /* registration denied */
181     HRIL_STAT_UNKNOWN = 4, /* unknown (e.g. out of GERAN/UTRAN coverage) */
182     HRIL_STAT_REGISTERED_ROAMING = 5, /* registered, roaming */
183 };
184 
185 enum HRilServiceSupportStat {
186     HRIL_SERVICE_NO_SUPPORT = 0,
187     HRIL_SERVICE_SUPPORT = 1,
188 };
189 
190 /* from 3GPP TS 27.007 V17.1.0 9.2.2.1.1 */
191 enum HRilReasonDataDenied {
192     HREASON_GPRS_SERVICE_NOT_ALLOW = 0,
193     HREASON_GPRS_AND_NON_GPRS_SERVICE_NOT_ALLOW = 1,
194     HREASON_MS_IDENTITY_CANNOT_BE_DERIVED = 2,
195     HREASON_IMPLICITLY_DETACHED = 3,
196     HREASON_GPRS_SERVICE_NOT_ALLOW_IN_PLMN = 4,
197     HREASON_MSC_TEM_NOT_REACH = 5,
198     HREASON_NO_DPD_CONTEXT_ACTIVATED = 6,
199 };
200 
201 enum HRilNetworkMode {
202     HRIL_NETWORK_AUTOMATIC_MODE = 0,
203     HRIL_NETWORK_MANUAL_MODE,
204 };
205 
206 /* IMS specific */
207 enum HRilIMSRegType {
208     NETWORK_IMS_REG_FEATURE_TYPE_VOLTE = 0x01, /*  VoLTE type */
209     NETWORK_IMS_REG_FEATURE_TYPE_SMS = 0x02, /* SMS over IP type */
210     NETWORK_IMS_REG_FEATURE_TYPE_RCS = 0x04, /* RCS type */
211     NETWORK_IMS_REG_FEATURE_TYPE_VT = 0x08, /* VT type */
212 };
213 
214 // cs registration response
215 static constexpr uint32_t HRIL_CS_REG_STATE = 1;
216 static constexpr uint32_t HRIL_CS_REG_RESP_ACT = 4;
217 static constexpr uint32_t HRIL_RSSNR = 7;
218 static constexpr uint32_t HRIL_CS_REG_RESP_ROAMING_INDICATOR = 10;
219 static constexpr uint32_t HRIL_CS_REG_RESP_SYSTEM_IS_IN_PRL = 11;
220 static constexpr uint32_t HRIL_CS_REG_RESP_DEFAULT_ROAMING_INDICATOR = 12;
221 static constexpr uint32_t HRIL_CS_REG_RESP_TIMING_ADVANCE = 13;
222 static constexpr uint32_t HRIL_CS_REG_STATUS_MAX_LEN = 5;
223 // ps registration response
224 static constexpr uint32_t HRIL_PS_REG_STATUS_MAX_LEN = 5;
225 static constexpr uint32_t HRIL_PS_RADIO_TECHNOLOGY = 4;
226 static constexpr uint32_t HRIL_PS_DENIED_ERROR_CODE = 4;
227 static constexpr uint32_t HRIL_PS_MAX_DATA_CALLS = 5;
228 static constexpr uint32_t HRIL_PS_DEF_DATA_CALLS_VAL = 1;
229 
230 static constexpr uint32_t HRIL_LOCATION_REG_STATE = 1;
231 static constexpr uint32_t HRIL_LOCATION_LOC = 2;
232 static constexpr uint32_t HRIL_LOCATION_CI = 3;
233 // ims registration response
234 static constexpr uint32_t HRIL_IMS_REG_STATUS_MAX_LEN = 2;
235 static constexpr uint32_t HRIL_IMS_REG_STATUS = 0;
236 static constexpr uint32_t HRIL_IMS_REG_FLAG = 1;
237 
238 static constexpr uint32_t HRIL_NETWORKS_SELECT_MODE = 0;
239 // Get the number of SIM cards in the system configuration
240 inline const int32_t HRIL_SYSPARA_SIZE = 128;
241 inline constexpr const char *HRIL_DEFAULT_SLOT_COUNT = "1";
242 inline constexpr const char *HRIL_TEL_SIM_SLOT_COUNT = "const.telephony.slotCount";
243 // interface token
244 inline const std::u16string HRIL_INTERFACE_TOKEN = u"ohos.telephony.hril";
245 } // namespace Telephony
246 } // namespace OHOS
247 #endif // TELEPHONY_N_TYPE_H
248