• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 /**
17  * @addtogroup Telephony
18  * @{
19  *
20  * @brief Provides the data structures for the C APIs of the the telephony radio.
21  *
22  * @since 13
23  */
24 
25 /**
26  * @file telephony_radio_type.h
27  *
28  * @brief Provides the data structures for the C APIs of the the telephony radio.
29  *
30  * @kit TelephonyKit
31  * @syscap SystemCapability.Telephony.CoreService
32  * @library libtelephony_radio.so
33  * @since 13
34  */
35 
36 #ifndef NATIVE_TELEPHONY_RADIO_TYPE_H
37 #define NATIVE_TELEPHONY_RADIO_TYPE_H
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 #define TELEPHONY_MAX_OPERATOR_LEN 64
44 #define TELEPHONY_MAX_PLMN_NUMERIC_LEN 6
45 
46 /**
47  * @brief Result code.
48  *
49  * @since 13
50  */
51 typedef enum {
52     /* @error success */
53     TEL_RADIO_SUCCESS = 0,
54     /* @error permission denied */
55     TEL_RADIO_PERMISSION_DENIED = 201,
56     /* @error invalid parameter */
57     TEL_RADIO_ERR_INVALID_PARAM = 401,
58     /* @error marshalling failed, this is a low probability error, try again later when get this error */
59     TEL_RADIO_ERR_MARSHALLING_FAILED = 8300001,
60     /* @error unable to connect to telephony service, try again later when get this error */
61     TEL_RADIO_ERR_SERVICE_CONNECTION_FAILED = 8300002,
62     /* @error operation failed in telephony service, try again later when get this error */
63     TEL_RADIO_ERR_OPERATION_FAILED = 8300003,
64 } Telephony_RadioResult;
65 
66 /**
67  * @brief network registration status.
68  *
69  * @since 13
70  */
71 typedef enum {
72     /* can not use any services */
73     TEL_REG_STATE_NO_SERVICE = 0,
74     /* can use services properly */
75     TEL_REG_STATE_IN_SERVICE = 1,
76     /* can use emergency call only */
77     TEL_REG_STATE_EMERGENCY_CALL_ONLY = 2,
78     /* radio power off */
79     TEL_REG_STATE_POWER_OFF = 3,
80 } Telephony_RegState;
81 
82 /**
83  * @brief radio access technologies.
84  *
85  * @since 13
86  */
87 typedef enum {
88     /* Unknown radio technology */
89     TEL_RADIO_TECHNOLOGY_UNKNOWN = 0,
90     /* Global System for Mobile Communication (GSM) */
91     TEL_RADIO_TECHNOLOGY_GSM = 1,
92     /* Single-Carrier Radio Transmission Technology (1XRTT) */
93     TEL_RADIO_TECHNOLOGY_1XRTT = 2,
94     /* Wideband Code Division Multiple Access (WCDMA) */
95     TEL_RADIO_TECHNOLOGY_WCDMA = 3,
96     /* High Speed Packet Access (HSPA) */
97     TEL_RADIO_TECHNOLOGY_HSPA = 4,
98     /* Evolved High Speed Packet Access (HSPA+) */
99     TEL_RADIO_TECHNOLOGY_HSPAP = 5,
100     /* Time Division-Synchronous Code Division Multiple Access(TD-SCDMA) */
101     TEL_RADIO_TECHNOLOGY_TD_SCDMA = 6,
102     /* Evolution-Data Optimized (EVDO) */
103     TEL_RADIO_TECHNOLOGY_EVDO = 7,
104     /* Evolved High Rate Package Data (EHRPD) */
105     TEL_RADIO_TECHNOLOGY_EHRPD = 8,
106     /* Long Term Evolution (LTE) */
107     TEL_RADIO_TECHNOLOGY_LTE = 9,
108     /* Long Term Evolution_Carrier Aggregation (LTE_CA) */
109     TEL_RADIO_TECHNOLOGY_LTE_CA = 10,
110     /* Industrial Wireless LAN (IWLAN) */
111     TEL_RADIO_TECHNOLOGY_IWLAN = 11,
112     /* New Radio (NR) */
113     TEL_RADIO_TECHNOLOGY_NR = 12,
114 } Telephony_RadioTechnology;
115 
116 /**
117  * @brief NSA network state.
118  *
119  * @since 13
120  */
121 typedef enum {
122     /* The device is in idle or connected state in an LTE cell that does not support NSA */
123     TEL_NSA_STATE_NOT_SUPPORTED = 1,
124     /* The device is in the idle state in an LTE cell that supports NSA but not NR coverage detection */
125     TEL_NSA_STATE_NO_DETECTED = 2,
126     /* The device is connected to the LTE network in an LTE cell that supports NSA and NR coverage detection */
127     TEL_NSA_STATE_CONNECTED_DETECTED = 3,
128     /* The device is in the idle state in an LTE cell that supports NSA and NR coverage detection */
129     TEL_NSA_STATE_IDLE_DETECTED = 4,
130     /* The device is connected to the LTE/NR network in an LTE cell that supports NSA */
131     TEL_NSA_STATE_DUAL_CONNECTED = 5,
132     /* The device is idle or connected to the NG-RAN cell when being attached to the 5G Core */
133     TEL_NSA_STATE_SA_ATTACHED = 6,
134 } Telephony_NsaState;
135 
136 /**
137  * @brief Network status.
138  *
139  * @since 13
140  */
141 typedef struct {
142     /* Long carrier name of the registered network */
143     char longOperatorName_[TELEPHONY_MAX_OPERATOR_LEN];
144     /* Short carrier name of the registered network */
145     char shortOperatorName_[TELEPHONY_MAX_OPERATOR_LEN];
146     /* PLMN code of the registered network */
147     char plmnNumeric_[TELEPHONY_MAX_PLMN_NUMERIC_LEN];
148     /* Whether in roaming */
149     bool isRoaming_;
150     /* Network registration status */
151     Telephony_RegState regState_;
152     /* Radio technology. */
153     Telephony_RadioTechnology cfgTech_;
154     /* NSA state */
155     Telephony_NsaState nsaState_;
156     /* Whether Carrier Aggregation(CA) is active */
157     bool isCaActive_;
158     /* Whether in emergency call only */
159     bool isEmergency_;
160 } Telephony_NetworkState;
161 
162 #ifdef __cplusplus
163 }
164 #endif
165 
166 #endif // NATIVE_TELEPHONY_RADIO_TYPE_H
167 /** @} */
168