1# Telephony Radio
2
3
4## Overview
5
6Provides C APIs for the radio module.
7
8**Since**: 13
9
10
11## Summary
12
13
14### File
15
16| Name| Description|
17| -------- | -------- |
18| [telephony_radio.h](telephony__radio_8h.md) | Defines C APIs for the SSL/TLS certificate chain verification module.<br>**File to include**: \<telephony\/core_service\/telephony_radio.h\>|
19| [telephony_radio_type.h](telephony__radio__type_8h.md) | Defines data structures for the C APIs of the SSL/TLS certificate chain verification module.<br>**File to include**: \<telephony\/core_service\/telephony_radio_type.h\>|
20
21
22### Structs
23
24| Name| Description|
25| -------- | -------- |
26| [Telephony_NetworkState](_telephony__network_state.md) | Network status structure.|
27
28### Macros
29
30| Name                              | Description|
31| ---------------------------------- | ---- |
32| **TELEPHONY_MAX_OPERATOR_LEN**     | 64   |
33| **TELEPHONY_MAX_PLMN_NUMERIC_LEN** | 6    |
34
35### Enums
36
37| Name| Description|
38| -------- | -------- |
39| [Telephony_RadioResult](#telephony_radioresult) { <br>TEL_RADIO_SUCCESS = 0,<br>TEL_RADIO_PERMISSION_DENIED = 201,<br>TEL_RADIO_ERR_INVALID_PARAM = 401,<br>TEL_RADIO_ERR_MARSHALLING_FAILED = 8300001,<br>TEL_RADIO_ERR_SERVICE_CONNECTION_FAILED = 8300002,<br>TEL_RADIO_ERR_OPERATION_FAILED = 8300003,<br>} | Result codes.|
40| [Telephony_RegState](#telephony_regstate) {<br>TEL_REG_STATE_NO_SERVICE = 0,<br>TEL_REG_STATE_IN_SERVICE = 1,<br>TEL_REG_STATE_EMERGENCY_CALL_ONLY = 2,<br>TEL_REG_STATE_POWER_OFF = 3,<br>} | Network registration status of the device. |
41| [Telephony_RadioTechnology](#telephony_radiotechnology) {<br>TEL_RADIO_TECHNOLOGY_UNKNOWN = 0,<br>TEL_RADIO_TECHNOLOGY_GSM = 1,<br>TEL_RADIO_TECHNOLOGY_1XRTT = 2,<br>TEL_RADIO_TECHNOLOGY_WCDMA = 3,<br>TEL_RADIO_TECHNOLOGY_HSPA = 4,<br>TEL_RADIO_TECHNOLOGY_HSPAP = 5,<br>TEL_RADIO_TECHNOLOGY_TD_SCDMA = 6,<br>TEL_RADIO_TECHNOLOGY_EVDO = 7,<br>TEL_RADIO_TECHNOLOGY_EHRPD = 8,<br>TEL_RADIO_TECHNOLOGY_LTE = 9,<br>TEL_RADIO_TECHNOLOGY_LTE_CA = 10,<br>TEL_RADIO_TECHNOLOGY_IWLAN = 11,<br>TEL_RADIO_TECHNOLOGY_NR = 12,<br>} | Radio access technology (RAT) type of the device.  |
42| [Telephony_NsaState](#telephony_nsastate) {<br>TEL_NSA_STATE_NOT_SUPPORTED = 1,<br>TEL_NSA_STATE_NO_DETECTED = 2,<br>TEL_NSA_STATE_CONNECTED_DETECTED = 3,<br>TEL_NSA_STATE_IDLE_DETECTED = 4,<br>TEL_NSA_STATE_DUAL_CONNECTED = 5,<br>TEL_NSA_STATE_SA_ATTACHED = 6,<br>} | NSA network registration status of the device.|
43
44### Functions
45
46| Name| Description|
47| -------- | -------- |
48| [OH_Telephony_GetNetworkState](#oh_telephony_getnetworkstate) | Obtains the network status.            |
49| [OH_Telephony_GetNetworkStateForSlot](#oh_telephony_getnetworkstateforslot) | Obtains the network status of the SIM card in the specified slot.|
50
51## Enum Description
52
53
54### Telephony_RadioResult
55
56```
57enum Telephony_RadioResult
58```
59
60**Description**
61
62Result codes.
63
64**Since**: 13
65
66| Value| Description|
67| -------- | -------- |
68| TEL_RADIO_SUCCESS | Success.|
69| TEL_RADIO_PERMISSION_DENIED | Invalid permission.|
70| TEL_RADIO_ERR_INVALID_PARAM | Invalid parameter.|
71| TEL_RADIO_ERR_MARSHALLING_FAILED | Marshalling failure.|
72| TEL_RADIO_ERR_SERVICE_CONNECTION_FAILED | Telephony service connection failure.|
73| TEL_RADIO_ERR_OPERATION_FAILED | Telephony service operation failure.|
74
75
76### Telephony_RegState
77
78```
79enum Telephony_RegState
80```
81**Description**
82 Network registration status of the device.
83
84**Since**: 13
85
86| Value| Description|
87| -------- | -------- |
88| TEL_REG_STATE_NO_SERVICE | The device cannot use any services, including data, SMS, and call services.|
89| TEL_REG_STATE_IN_SERVICE | The device can use services properly, including data, SMS, and call services.|
90| TEL_REG_STATE_EMERGENCY_CALL_ONLY | The device can use only the emergency call service.|
91| TEL_REG_STATE_POWER_OFF | The device cannot communicate with the network because the cellular radio service is disabled or the modem is powered off.|
92
93### Telephony_RadioTechnology
94
95```
96enum Telephony_RadioTechnology
97```
98
99**Description**
100
101  RAT type of the device.
102
103**Since**: 13
104
105| Value                       | Description                                                        |
106| ----------------------------- | ------------------------------------------------------------ |
107| TEL_RADIO_TECHNOLOGY_UNKNOWN  | Unknown RAT                                   |
108| TEL_RADIO_TECHNOLOGY_GSM      | Global System for Mobile Communication (GSM) |
109| TEL_RADIO_TECHNOLOGY_1XRTT    | Single-Carrier Radio Transmission Technology (1XRTT)|
110| TEL_RADIO_TECHNOLOGY_WCDMA    | Wideband Code Division Multiple Access (WCDMA)|
111| TEL_RADIO_TECHNOLOGY_HSPA     | High Speed Packet Access (HSPA)              |
112| TEL_RADIO_TECHNOLOGY_HSPAP    | Evolved High Speed Packet Access (HSPA+)    |
113| TEL_RADIO_TECHNOLOGY_TD_SCDMA | Time Division Synchronous Code Division Multiple Access (TD-SCDMA)|
114| TEL_RADIO_TECHNOLOGY_EVDO     | Evolution-Data Optimized (EVDO)                   |
115| TEL_RADIO_TECHNOLOGY_EHRPD    | Evolved High Rate Package Data (EHRPD)       |
116| TEL_RADIO_TECHNOLOGY_LTE      | Long Term Evolution (LTE)                    |
117| TEL_RADIO_TECHNOLOGY_LTE_CA   | Long Term Evolution_Carrier Aggregation (LTE_CA)|
118| TEL_RADIO_TECHNOLOGY_IWLAN    | Industrial Wireless LAN (IWLAN)              |
119| TEL_RADIO_TECHNOLOGY_NR       | New Radio (NR)                               |
120
121### Telephony_NsaState
122
123```
124enum Telephony_NsaState
125```
126
127**Description**
128
129NSA network registration status of the device.
130
131**Since**: 13
132
133| Value                          | Description                                                      |
134| -------------------------------- | ---------------------------------------------------------- |
135| TEL_NSA_STATE_NOT_SUPPORTED      | The device is in idle or connected state in an LTE cell that does not support NSA.        |
136| TEL_NSA_STATE_NO_DETECTED        | The device is in the idle state in an LTE cell that supports NSA but not NR coverage detection.|
137| TEL_NSA_STATE_CONNECTED_DETECTED | The device is connected to the LTE network in an LTE cell that supports NSA and NR coverage detection.         |
138| TEL_NSA_STATE_IDLE_DETECTED      | The device is in the idle state in an LTE cell that supports NSA and NR coverage detection.          |
139| TEL_NSA_STATE_DUAL_CONNECTED     | The device is connected to the LTE/NR network in an LTE cell that supports NSA.              |
140| TEL_NSA_STATE_SA_ATTACHED        | The device is idle or connected to the NG-RAN cell when being attached to the 5G Core.     |
141
142## Function Description
143
144
145### OH_Telephony_GetNetworkState()
146
147```
148Telephony_RadioResult OH_Telephony_GetNetworkState(Telephony_NetworkState * state)
149```
150
151**Description**
152
153Obtains the network status.
154
155**System capability**: SystemCapability.Telephony.CoreService
156
157**Since**: 13
158
159**Parameters**
160
161| Name| Description|
162| -------- | -------- |
163| state | Structure of the network status information received by the user.|
164
165**Returns**
166
167**0**: success.
168
169**201**: invalid permission.
170
171**401**: invalid parameter.
172
173**8300001**: marshalling failure.
174
175**8300002**: telephony service connection failure.
176
177**8300003**: telephony service operation failure.
178
179**Required Permissions**
180
181ohos.permission.GET_NETWORK_INFO
182
183### OH_Telephony_GetNetworkStateForSlot()
184
185```
186Telephony_RadioResult OH_Telephony_GetNetworkStateForSlot(int32_t slotId, Telephony_NetworkState *state)
187```
188
189**Description**
190
191Obtains the network status of the SIM card in the specified slot.
192
193**System capability**: SystemCapability.Telephony.CoreService
194
195**Since**: 13
196
197**Parameters**
198
199| Name  | Description                          |
200| ------ | ------------------------------ |
201| slotId | Card slot ID.                        |
202| state  | Structure of the network status information received by the user.|
203
204**Returns**
205
206**0**: success.
207
208**201**: invalid permission.
209
210**401**: invalid parameter.
211
212**8300001**: marshalling failure.
213
214**8300002**: telephony service connection failure.
215
216**8300003**: telephony service operation failure.
217
218**Required Permissions**
219
220ohos.permission.GET_NETWORK_INFO
221