• 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 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      /** No error */
27      NONE = 0,
28  
29      /** An error that not included in bellow items */
30      HRIL_ERR_GENERIC_FAILURE,
31  
32      /** Invalid parameter */
33      HRIL_ERR_INVALID_PARAMETER,
34  
35      /** Full memory */
36      HRIL_ERR_MEMORY_FULL,
37  
38      /** Send command failed */
39      HRIL_ERR_CMD_SEND_FAILURE,
40  
41      /** NO CARRIER response returned */
42      HRIL_ERR_CMD_NO_CARRIER,
43  
44      /** The response is invalid */
45      HRIL_ERR_INVALID_RESPONSE,
46  
47      /** The new status of radio to set is same with previous */
48      HRIL_ERR_REPEAT_STATUS,
49  
50      /** Network search error */
51      HRIL_ERR_NETWORK_SEARCHING,
52  
53      /** Network search interrupted */
54      HRIL_ERR_NETWORK_SEARCHING_INTERRUPTED,
55  
56      /** The AT channel is closed */
57      HRIL_ERR_MODEM_DEVICE_CLOSE,
58  
59      /** No sim card error */
60      HRIL_ERR_NO_SIMCARD_INSERTED,
61  
62      /** Need pin code */
63      HRIL_ERR_NEED_PIN_CODE,
64  
65      /** Need puk code */
66      HRIL_ERR_NEED_PUK_CODE,
67  
68      /** Network search timeout */
69      HRIL_ERR_NETWORK_SEARCH_TIMEOUT,
70  
71      /** Pin or puk password is not correct */
72      HRIL_ERR_PINPUK_PASSWORD_NOCORRECT,
73  
74      /** Invalid modem parameter */
75      HRIL_ERR_INVALID_MODEM_PARAMETER = 50,
76  
77      /** IPC failure */
78      HRIL_ERR_HDF_IPC_FAILURE = 300,
79  
80      /** Null point error */
81      HRIL_ERR_NULL_POINT,
82  
83      /** Vendor not implement error. */
84      HRIL_ERR_VENDOR_NOT_IMPLEMENT
85  };
86  
87  enum class HRilNotiType { HRIL_NOTIFICATION, HRIL_NO_DEFINE };
88  
89  /**
90   * @brief Indicates the specific APN type.
91   */
92  enum class HRilApnTypes : int32_t {
93      /** None */
94      NONE = 0,
95  
96      /** APN type for default data traffic */
97      DEFAULT = 1,
98  
99      /** APN type for MMS traffic */
100      MMS = 2,
101  
102      /** APN type for SUPL assisted GPS */
103      SUPL = 4,
104  
105      /** APN type for DUN traffic */
106      DUN = 8,
107  
108      /** APN type for HiPri traffic */
109      HIPRI = 16,
110  
111      /** APN type for FOTA */
112      FOTA = 32,
113  
114      /** APN type for IMS */
115      IMS = 64,
116  
117      /** APN type for CBS */
118      CBS = 128,
119  
120      /** APN type for IA Initial Attach APN */
121      IA = 256,
122  
123      /** APN type for Emergency PDN */
124      EMERGENCY = 512,
125  
126      ALL = 1023,
127  };
128  
129  /**
130   * @brief Indicates whether the hril notification need lock.
131   */
132  enum HRilRunningLockTypes { UNNEED_LOCK, NEED_LOCK };
133  
134  /**
135   * @brief Indicates the hril response type.
136   */
137  enum HRilResponseTypes {
138      HRIL_RESPONSE_REQUEST,
139      HRIL_RESPONSE_NOTICE,
140      HRIL_RESPONSE_REQUEST_ACK,
141      HRIL_RESPONSE_REQUEST_MUST_ACK,
142      HRIL_RESPONSE_NOTICE_MUST_ACK,
143  };
144  
145  /**
146   * @brief From 3GPP TS 27.007 V4.3.0 (2001-12) 8.5, AT + CSQ.
147   */
148  struct GsmRssi {
149      /**
150       * Received Signal Strength Indication, value range 0 ~ 31, max is 99,
151       * if unknown then set to max
152       */
153      int32_t rxlev = 0;
154  
155      /**
156       * Bit error rate, value range 0 ~ 7, max is 99, if unknown then set to
157       * max as RXQUAL values in the table in TS 45.008 [20] subclauses 8.2.4.
158       */
159      int32_t ber = 0;
160  };
161  
162  /**
163   * @brief From 3GPP TS 27.007 V17.1.0 (2021-03) 8.69.
164   */
165  struct CdmaRssi {
166      /**
167       * Absolute value of signal strength. This value is the actual Rssi value
168       * multiplied by -1. e.g: Rssi is -75, then this response value will be 75.
169       */
170      int32_t absoluteRssi = 0;
171  
172      /**
173       * integer type, ratio of the received energy per PN chip to the total
174       * received power spectral density (see 3GPP TS 25.133 [95] subclauses)
175       */
176      int32_t ecno = 0;
177  };
178  
179  /**
180   * @brief Indicates some parameters which can reflect the strength of WCDMA signal.
181   */
182  struct WCdmaRssi {
183      /**
184       * integer type, received signal strength level (see 3GPP TS 45.008 [20]
185       * sub-clause 8.1.4) value 0~99.
186       */
187      int32_t rxlev = 0;
188  
189      /**
190       * integer type, ratio of the received energy per PN chip to the total
191       * received power spectral density (see 3GPP TS 25.133 [95] sub-clause).
192       */
193      int32_t ecio = 0;
194  
195      /**
196       * integer type, received signal code power (see 3GPP TS 25.133 [95]
197       * sub-clause 9.1.1.3 and 3GPP TS 25.123 [96] sub-clause 9.1.1.1.3).
198       * range value 0 ~ 96, 255 not known or not detectable.
199       */
200      int32_t rscp = 0;
201  
202      /**
203       * Bit error rate, value range 0 ~ 7, max is 99, if unknown then set to
204       * max
205       */
206      int32_t ber = 0;
207  };
208  
209  /**
210   * @brief Indicates some parameters which can reflect the strength of LTE signal.
211   */
212  struct LteRssi {
213      /**
214       * integer type, received signal strength level
215       * (see 3GPP TS 45.008 [20] sub-clause 8.1.4) value 0~99.
216       */
217      int32_t rxlev = 0;
218  
219      /**
220       * integer type, reference signal received quality (see 3GPP TS 36.133 [96] sub-clause 9.1.7)
221       * value range 0~33, 255 not known or not detectable.
222       */
223      int32_t rsrq = 0;
224  
225      /**
226       * integer type, reference signal received power (see 3GPP TS 36.133 [96] sub-clause 9.1.4)
227       * value range 0~97, 255 not known or not detectable.
228       */
229      int32_t rsrp = 0;
230  
231      /**
232       * integer type, representing the signal-to-interference plus noise ratio, suitable for LTE mode
233       * value range 0~251, 255 not known or not detectable.
234       */
235      int32_t snr = 0;
236  };
237  
238  /**
239   * @brief Indicates some parameters which can reflect the strength of TD-SCDMA signal.
240   */
241  struct TdScdmaRssi {
242      int32_t rscp = 0;
243  };
244  
245  /**
246   * @brief Indicates some parameters which can reflect the strength of NR signal.
247   */
248  struct NrRssi {
249      int32_t rsrp = 0;
250      int32_t rsrq = 0;
251      int32_t sinr = 0;
252  };
253  
254  /**
255   * @brief Indicates signal level of some RATs.
256   */
257  struct Rssi {
258      GsmRssi gw;
259      CdmaRssi cdma;
260      WCdmaRssi wcdma;
261      LteRssi lte;
262      TdScdmaRssi tdScdma;
263      NrRssi nr;
264  };
265  
266  /**
267   * @brief From 3GPP TS 27.007 V4.3.0 (2001-12).
268   */
269  struct GetCallWaitingInfo {
270      /** 0: not active, 1:active */
271      int32_t status = 0;
272  
273      /** <classx> default, SLM790 is 255 */
274      int32_t typeClass = 0;
275  };
276  
277  struct HRilResponseHeadInfo {
278      int32_t slotId = 0;
279      HRilResponseTypes type = HRilResponseTypes::HRIL_RESPONSE_REQUEST;
280  };
281  
282  /**
283   * @brief Indicates the response information, for example whether the
284   * request is success, serial number, response type etc.
285   */
286  struct HRilRadioResponseInfo {
287      int32_t flag = -1;
288      int32_t serial = -1;
289      HRilErrType error = HRilErrType::NONE;
290      HRilResponseTypes type = HRilResponseTypes::HRIL_RESPONSE_REQUEST;
291  };
292  
293  struct HRilRadioStateInfo {
294      int64_t flag = 0;
295      int32_t state = 0;
296  };
297  
298  enum HRilCommonNumber {
299      HRIL_DEC = 10,
300      HRIL_INVALID_HEX_CHAR = 16,
301      HRIL_UPPER_CASE_LETTERS_OFFSET = 32,
302      HRIL_ADAPTER_RADIO_INDICATION = 2001,
303      HRIL_ADAPTER_RADIO_RESPONSE = 2002,
304      HRIL_ADAPTER_RADIO_SEND_ACK,
305  };
306  
307  enum HRilOperatorInfoResult {
308      HRIL_LONE_NAME = 0,
309      HRIL_SHORT_NAME,
310      HRIL_NUMERIC,
311  };
312  
313  enum HRilCircuitModeRegState {
314      /** Not registered, MT is not searching an operator */
315      HRIL_STAT_NO_REG_MT_NO_SEARCHING_OP = 0,
316  
317      /** Registered, home network */
318      HRIL_STAT_REGISTERED_HOME_NETWORK = 1,
319  
320      /**
321       * Not registered, but MT is currently trying to attach or searching an
322       * operator
323       */
324      HRIL_STAT_NO_REGISTERED_MT_TRY_ATTACH = 2,
325  
326      /** Registration denied */
327      HRIL_STAT_REGISTERED_DENIED = 3,
328  
329      /** Unknown (e.g. out of GERAN/UTRAN coverage) */
330      HRIL_STAT_UNKNOWN = 4,
331  
332      /** Registered, roaming */
333      HRIL_STAT_REGISTERED_ROAMING = 5,
334  };
335  
336  enum HRilServiceSupportStat {
337      HRIL_SERVICE_NO_SUPPORT = 0,
338      HRIL_SERVICE_SUPPORT = 1,
339  };
340  
341  /**
342   * @brief Indicates the data denied reason, from 3GPP TS 27.007 V17.1.0 9.2.2.1.1.
343   */
344  enum HRilReasonDataDenied {
345      HREASON_GPRS_SERVICE_NOT_ALLOW = 0,
346      HREASON_GPRS_AND_NON_GPRS_SERVICE_NOT_ALLOW = 1,
347      HREASON_MS_IDENTITY_CANNOT_BE_DERIVED = 2,
348      HREASON_IMPLICITLY_DETACHED = 3,
349      HREASON_GPRS_SERVICE_NOT_ALLOW_IN_PLMN = 4,
350      HREASON_MSC_TEM_NOT_REACH = 5,
351      HREASON_NO_DPD_CONTEXT_ACTIVATED = 6,
352  };
353  
354  enum HRilNetworkMode {
355      HRIL_NETWORK_AUTOMATIC_MODE = 0,
356      HRIL_NETWORK_MANUAL_MODE,
357  };
358  
359  /**
360   * @brief Indicates the specific IMS type.
361   */
362  enum HRilIMSRegType {
363      /** VoLTE type */
364      NETWORK_IMS_REG_FEATURE_TYPE_VOLTE = 0x01,
365  
366      /** SMS over IP type */
367      NETWORK_IMS_REG_FEATURE_TYPE_SMS = 0x02,
368  
369      /** RCS type */
370      NETWORK_IMS_REG_FEATURE_TYPE_RCS = 0x04,
371  
372      /** VT type */
373      NETWORK_IMS_REG_FEATURE_TYPE_VT = 0x08,
374  };
375  
376  /** CS registration response */
377  static constexpr uint32_t HRIL_CS_REG_STATE = 1;
378  static constexpr uint32_t HRIL_CS_REG_RESP_ACT = 4;
379  static constexpr uint32_t HRIL_RSSNR = 7;
380  static constexpr uint32_t HRIL_CS_REG_RESP_ROAMING_INDICATOR = 10;
381  static constexpr uint32_t HRIL_CS_REG_RESP_SYSTEM_IS_IN_PRL = 11;
382  static constexpr uint32_t HRIL_CS_REG_RESP_DEFAULT_ROAMING_INDICATOR = 12;
383  static constexpr uint32_t HRIL_CS_REG_RESP_TIMING_ADVANCE = 13;
384  static constexpr uint32_t HRIL_CS_REG_STATUS_MAX_LEN = 5;
385  
386  /** PS registration response */
387  static constexpr uint32_t HRIL_PS_REG_STATUS_MAX_LEN = 5;
388  static constexpr uint32_t HRIL_PS_RADIO_TECHNOLOGY = 4;
389  static constexpr uint32_t HRIL_PS_DENIED_ERROR_CODE = 4;
390  static constexpr uint32_t HRIL_PS_MAX_DATA_CALLS = 5;
391  static constexpr uint32_t HRIL_PS_DEF_DATA_CALLS_VAL = 1;
392  
393  static constexpr uint32_t HRIL_LOCATION_REG_STATE = 1;
394  static constexpr uint32_t HRIL_LOCATION_LOC = 2;
395  static constexpr uint32_t HRIL_LOCATION_CI = 3;
396  
397  /** IMS registration response */
398  static constexpr uint32_t HRIL_IMS_REG_STATUS_MAX_LEN = 2;
399  static constexpr uint32_t HRIL_IMS_REG_STATUS = 0;
400  static constexpr uint32_t HRIL_IMS_REG_FLAG = 1;
401  
402  static constexpr uint32_t HRIL_NETWORKS_SELECT_MODE = 0;
403  
404  /** Get the number of SIM cards in the system configuration */
405  inline const int32_t HRIL_SYSPARA_SIZE = 128;
406  inline constexpr const char *HRIL_DEFAULT_SLOT_COUNT = "1";
407  inline constexpr const char *HRIL_TEL_SIM_SLOT_COUNT = "const.telephony.slotCount";
408  
409  /** Interface token */
410  inline const std::u16string HRIL_INTERFACE_TOKEN = u"ohos.telephony.hril";
411  } // namespace Telephony
412  } // namespace OHOS
413  #endif // TELEPHONY_N_TYPE_H
414