js-apis-telephony-data.md 20.5 KB
Newer Older
S
shawn_he 已提交
1
# @ohos.telephony.data (Cellular Data)
S
shawn_he 已提交
2

S
shawn_he 已提交
3
The **data** module provides basic mobile data management functions. You can obtain and set the default slot of the SIM card used for mobile data, and obtain the uplink and downlink connection status of cellular data services and connection status of the packet switched (PS) domain. Besides, you can check whether cellular data services and data roaming are enabled.
S
shawn_he 已提交
4

S
shawn_he 已提交
5 6 7 8 9 10
>**NOTE**
>
>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.

## Modules to Import

S
shawn_he 已提交
11
```js
S
shawn_he 已提交
12 13 14
import data from '@ohos.telephony.data';
```

S
shawn_he 已提交
15
## data.getDefaultCellularDataSlotId
S
shawn_he 已提交
16 17 18

getDefaultCellularDataSlotId(callback: AsyncCallback\<number\>): void 

S
shawn_he 已提交
19
Obtains the default slot of the SIM card used for mobile data. This API uses an asynchronous callback to return the result. 
S
shawn_he 已提交
20 21 22 23 24

**System capability**: SystemCapability.Telephony.CellularData

**Parameters**

S
shawn_he 已提交
25
| Name  | Type                   | Mandatory| Description                                      |
S
shawn_he 已提交
26
| -------- | ----------------------- | ---- | ------------------------------------------ |
S
shawn_he 已提交
27
| callback | AsyncCallback\<number\> | Yes  | Callback used to return the result.<br>**0**: card slot 1<br>**1**: card slot 2|
S
shawn_he 已提交
28 29 30

**Example**

S
shawn_he 已提交
31
```js
S
shawn_he 已提交
32 33 34 35 36
data.getDefaultCellularDataSlotId((err, data) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```

S
shawn_he 已提交
37
## data.getDefaultCellularDataSlotId
S
shawn_he 已提交
38 39 40

getDefaultCellularDataSlotId(): Promise\<number\> 

S
shawn_he 已提交
41
Obtains the default slot of the SIM card used for mobile data. This API uses a promise to return the result. 
S
shawn_he 已提交
42 43 44

**System capability**: SystemCapability.Telephony.CellularData

S
shawn_he 已提交
45
**Return value**
S
shawn_he 已提交
46

S
shawn_he 已提交
47
| Type             | Description                                                        |
S
shawn_he 已提交
48
| ----------------- | ------------------------------------------------------------ |
S
shawn_he 已提交
49
| Promise\<number\> | Promise used to return the result.<br>**0**: card slot 1<br>**1**: card slot 2|
S
shawn_he 已提交
50 51 52

**Example**

S
shawn_he 已提交
53
```js
S
shawn_he 已提交
54 55
let promise = data.getDefaultCellularDataSlotId();
promise.then((data) => {
S
shawn_he 已提交
56
    console.log(`getDefaultCellularDataSlotId success, promise: data->${JSON.stringify(data)}`);
S
shawn_he 已提交
57
}).catch((err) => {
S
shawn_he 已提交
58 59 60 61
    console.error(`getDefaultCellularDataSlotId fail, promise: err->${JSON.stringify(err)}`);
});
```

S
shawn_he 已提交
62
## data.getDefaultCellularDataSlotIdSync<sup>9+</sup>
S
shawn_he 已提交
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81

getDefaultCellularDataSlotIdSync(): number

Obtains the default SIM card used for mobile data synchronously.

**System capability**: SystemCapability.Telephony.CellularData

**Return value**

| Type             | Description                                                        |
| ------ | -------------------------------------------------- |
| number | Card slot ID.<br>**0**: card slot 1<br>**1**: card slot 2|

**Example**

```js
console.log("Result: "+ data.getDefaultCellularDataSlotIdSync())
```

S
shawn_he 已提交
82 83
## data.setDefaultCellularDataSlotId

S
shawn_he 已提交
84
setDefaultCellularDataSlotId(slotId: number, callback: AsyncCallback\<void\>): void 
S
shawn_he 已提交
85 86 87 88 89 90 91 92 93 94 95 96 97

Sets the default slot of the SIM card used for mobile data. This API uses an asynchronous callback to return the result. 

This is a system API.

**Required permission**: ohos.permission.SET_TELEPHONY_STATE

**System capability**: SystemCapability.Telephony.CellularData

**Parameters**

| Name  | Type                 | Mandatory| Description                                                        |
| -------- | --------------------- | ---- | ------------------------------------------------------------ |
S
shawn_he 已提交
98 99
| slotId   | number                | Yes  | SIM card slot ID. <br>**0**: card slot 1<br>**1**: card slot 2<br>**-1**: Clears the default configuration.|
| callback | AsyncCallback\<void\> | Yes  | Callback used to return the result.                                                  |
S
shawn_he 已提交
100 101 102 103

**Example**

```js
S
shawn_he 已提交
104
data.setDefaultCellularDataSlotId(0, (err, data) => {
S
shawn_he 已提交
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```

## data.setDefaultCellularDataSlotId

setDefaultCellularDataSlotId(slotId: number): Promise\<void\> 

Sets the default slot of the SIM card used for mobile data. This API uses a promise to return the result. 

This is a system API.

**Required permission**: ohos.permission.SET_TELEPHONY_STATE

**System capability**: SystemCapability.Telephony.CellularData

**Parameters**

| Name| Type  | Mandatory| Description                                                        |
| ------ | ------ | ---- | ------------------------------------------------------------ |
S
shawn_he 已提交
125
| slotId | number | Yes  | SIM card slot ID. <br>**0**: card slot 1<br>**1**: card slot 2<br>**-1**: Clears the default configuration.|
S
shawn_he 已提交
126 127 128

**Return value**

S
shawn_he 已提交
129 130 131
| Type           | Description                           |
| --------------- | ------------------------------- |
| Promise\<void\> | Promise used to return the result.|
S
shawn_he 已提交
132 133 134 135 136 137 138 139 140

**Example**

```js
let promise = data.setDefaultCellularDataSlotId(0);
promise.then((data) => {
    console.log(`setDefaultCellularDataSlotId success, promise: data->${JSON.stringify(data)}`);
}).catch((err) => {
    console.error(`setDefaultCellularDataSlotId fail, promise: err->${JSON.stringify(err)}`);
S
shawn_he 已提交
141 142 143
});
```

S
shawn_he 已提交
144
## data.getCellularDataFlowType
S
shawn_he 已提交
145 146 147

getCellularDataFlowType(callback: AsyncCallback\<DataFlowType\>): void

S
shawn_he 已提交
148
Obtains the cellular data flow type, which can be uplink or downlink. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
149 150 151 152 153

**System capability**: SystemCapability.Telephony.CellularData

**Parameters**

S
shawn_he 已提交
154
| Name  | Type                                          | Mandatory| Description      |
S
shawn_he 已提交
155
| -------- | ---------------------------------------------- | ---- | ---------- |
S
shawn_he 已提交
156
| callback | AsyncCallback\<[DataFlowType](#dataflowtype)\> | Yes  | Callback used to return the result.|
S
shawn_he 已提交
157 158 159

**Example**

S
shawn_he 已提交
160
```js
S
shawn_he 已提交
161 162 163 164 165
data.getCellularDataFlowType((err, data) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```

S
shawn_he 已提交
166
## data.getCellularDataFlowType
S
shawn_he 已提交
167 168 169

getCellularDataFlowType(): Promise\<DataFlowType\>

S
shawn_he 已提交
170
Obtains the cellular data flow type, which can be uplink or downlink. This API uses a promise to return the result.
S
shawn_he 已提交
171 172 173

**System capability**: SystemCapability.Telephony.CellularData

S
shawn_he 已提交
174
**Return value**
S
shawn_he 已提交
175

S
shawn_he 已提交
176
| Type                                    | Description                                           |
S
shawn_he 已提交
177
| ---------------------------------------- | ----------------------------------------------- |
S
shawn_he 已提交
178
| Promise\<[DataFlowType](#dataflowtype)\> | Promise used to return the result. |
S
shawn_he 已提交
179 180 181

**Example**

S
shawn_he 已提交
182
```js
S
shawn_he 已提交
183 184 185 186 187 188 189 190
let promise = data.getCellularDataFlowType();
promise.then((data) => {
    console.log(`test success, promise: data->${JSON.stringify(data)}`);
}).catch((err) => {
    console.error(`test fail, promise: err->${JSON.stringify(err)}`);
});
```

S
shawn_he 已提交
191
## data.getCellularDataState
S
shawn_he 已提交
192 193 194

getCellularDataState(callback: AsyncCallback\<DataConnectState\>): void

S
shawn_he 已提交
195
Obtains the connection status of the packet switched (PS) domain. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
196 197 198 199 200

**System capability**: SystemCapability.Telephony.CellularData

**Parameters**

S
shawn_he 已提交
201
| Name  | Type                                                  | Mandatory| Description      |
S
shawn_he 已提交
202
| -------- | ------------------------------------------------------ | ---- | ---------- |
S
shawn_he 已提交
203
| callback | AsyncCallback\<[DataConnectState](#dataconnectstate)\> | Yes  | Callback used to return the result.|
S
shawn_he 已提交
204 205 206

**Example**

S
shawn_he 已提交
207
```js
S
shawn_he 已提交
208 209 210 211 212
data.getCellularDataState((err, data) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```

S
shawn_he 已提交
213
## data.getCellularDataState
S
shawn_he 已提交
214 215 216

getCellularDataState(): Promise\<DataConnectState\>

S
shawn_he 已提交
217
Obtains the connection status of the PS domain. This API uses a promise to return the result.
S
shawn_he 已提交
218 219 220

**System capability**: SystemCapability.Telephony.CellularData

S
shawn_he 已提交
221
**Return value**
S
shawn_he 已提交
222

S
shawn_he 已提交
223
| Type                                            | Description                                 |
S
shawn_he 已提交
224
| ------------------------------------------------ | ------------------------------------- |
S
shawn_he 已提交
225
| Promise\<[DataConnectState](#dataconnectstate)\> | Promise used to return the result.|
S
shawn_he 已提交
226 227 228

**Example**

S
shawn_he 已提交
229
```js
S
shawn_he 已提交
230 231 232 233 234 235 236 237
let promise = data.getCellularDataState();
promise.then((data) => {
    console.log(`test success, promise: data->${JSON.stringify(data)}`);
}).catch((err) => {
    console.error(`test fail, promise: err->${JSON.stringify(err)}`);
});
```

S
shawn_he 已提交
238
## data.isCellularDataEnabled
S
shawn_he 已提交
239 240 241

isCellularDataEnabled(callback: AsyncCallback\<boolean\>): void

S
shawn_he 已提交
242
Checks whether the cellular data service is enabled. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
243 244 245 246 247 248 249

**Required permission**: ohos.permission.GET_NETWORK_INFO

**System capability**: SystemCapability.Telephony.CellularData

**Parameters**

S
shawn_he 已提交
250
| Name  | Type                    | Mandatory| Description                                                        |
S
shawn_he 已提交
251
| -------- | ------------------------ | ---- | ------------------------------------------------------------ |
S
shawn_he 已提交
252
| callback | AsyncCallback\<boolean\> | Yes  | Callback used to return the result.<br>**true**: The cellular data service is enabled.<br>**false**: The cellular data service is disabled.|
S
shawn_he 已提交
253 254 255

**Example**

S
shawn_he 已提交
256
```js
S
shawn_he 已提交
257 258 259 260 261
data.isCellularDataEnabled((err, data) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```

S
shawn_he 已提交
262
## data.isCellularDataEnabled
S
shawn_he 已提交
263 264 265

isCellularDataEnabled(): Promise\<boolean\>

S
shawn_he 已提交
266
Checks whether the cellular data service is enabled. This API uses a promise to return the result.
S
shawn_he 已提交
267 268 269 270 271

**Required permission**: ohos.permission.GET_NETWORK_INFO

**System capability**: SystemCapability.Telephony.CellularData

S
shawn_he 已提交
272
**Return value**
S
shawn_he 已提交
273

S
shawn_he 已提交
274
| Type              | Description                                                        |
S
shawn_he 已提交
275
| ------------------ | ------------------------------------------------------------ |
S
shawn_he 已提交
276
| Promise\<boolean\> | Promise used to return the result.<br>**true**: The cellular data service is enabled.<br>**false**: The cellular data service is disabled.|
S
shawn_he 已提交
277 278 279

**Example**

S
shawn_he 已提交
280
```js
S
shawn_he 已提交
281 282 283 284 285 286 287 288
let promise = data.isCellularDataEnabled();
promise.then((data) => {
    console.log(`test success, promise: data->${JSON.stringify(data)}`);
}).catch((err) => {
    console.error(`test fail, promise: err->${JSON.stringify(err)}`);
});
```

S
shawn_he 已提交
289
## data.isCellularDataRoamingEnabled
S
shawn_he 已提交
290 291 292

isCellularDataRoamingEnabled(slotId: number, callback: AsyncCallback\<boolean\>): void

S
shawn_he 已提交
293
Checks whether roaming is enabled for the cellular data service. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
294 295 296 297 298 299 300

**Required permission**: ohos.permission.GET_NETWORK_INFO

**System capability**: SystemCapability.Telephony.CellularData

**Parameters**

S
shawn_he 已提交
301
| Name  | Type                    | Mandatory| Description                                                        |
S
shawn_he 已提交
302
| -------- | ------------------------ | ---- | ------------------------------------------------------------ |
S
shawn_he 已提交
303
| slotId   | number                   | Yes  | Card slot ID.<br>**0**: card slot 1<br>**1**: card slot 2                    |
S
shawn_he 已提交
304
| callback | AsyncCallback\<boolean\> | Yes  | Callback used to return the result.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.|
S
shawn_he 已提交
305 306 307

**Example**

S
shawn_he 已提交
308
```js
S
shawn_he 已提交
309
data.isCellularDataRoamingEnabled(0, (err, data) => {
S
shawn_he 已提交
310 311 312 313
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```

S
shawn_he 已提交
314
## data.isCellularDataRoamingEnabled
S
shawn_he 已提交
315 316 317

isCellularDataRoamingEnabled(slotId: number): Promise\<boolean\>

S
shawn_he 已提交
318
Checks whether roaming is enabled for the cellular data service. This API uses a promise to return the result.
S
shawn_he 已提交
319 320 321 322 323 324 325

**Required permission**: ohos.permission.GET_NETWORK_INFO

**System capability**: SystemCapability.Telephony.CellularData

**Parameters**

S
shawn_he 已提交
326
| Name| Type  | Mandatory| Description                                    |
S
shawn_he 已提交
327
| ------ | ------ | ---- | ---------------------------------------- |
S
shawn_he 已提交
328
| slotId | number | Yes  | Card slot ID.<br>**0**: card slot 1<br>**1**: card slot 2|
S
shawn_he 已提交
329

S
shawn_he 已提交
330
**Return value**
S
shawn_he 已提交
331

S
shawn_he 已提交
332
| Type              | Description                                                        |
S
shawn_he 已提交
333
| ------------------ | ------------------------------------------------------------ |
S
shawn_he 已提交
334
| Promise\<boolean\> | Promise used to return the result.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.|
S
shawn_he 已提交
335 336 337

**Example**

S
shawn_he 已提交
338
```js
S
shawn_he 已提交
339 340 341 342 343 344 345 346
let promise = data.isCellularDataRoamingEnabled(0);
promise.then((data) => {
    console.log(`test success, promise: data->${JSON.stringify(data)}`);
}).catch((err) => {
    console.error(`test fail, promise: err->${JSON.stringify(err)}`);
});
```

S
shawn_he 已提交
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580
## data.enableCellularData

enableCellularData(callback: AsyncCallback<void\>): void

Enables the cellular data service. This API uses an asynchronous callback to return the result.

This is a system API.

**Required permission**: ohos.permission.SET_TELEPHONY_STATE

**System capability**: SystemCapability.Telephony.CellularData

**Parameters**

| Name  | Type                 | Mandatory| Description      |
| -------- | --------------------- | ---- | ---------- |
| callback | AsyncCallback\<void\> | Yes  | Callback used to return the result.|

**Example**

```js
data.enableCellularData((err, data) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```

## data.enableCellularData

enableCellularData(): Promise<void\>

Enables the cellular data service. This API uses a promise to return the result.

This is a system API.

**Required permission**: ohos.permission.SET_TELEPHONY_STATE

**System capability**: SystemCapability.Telephony.CellularData

**Return value**

| Type           | Description                   |
| --------------- | ----------------------- |
| Promise\<void\> | Promise used to return the result.|

**Example**

```js
let promise = data.enableCellularData();
promise.then((data) => {
    console.log(`enableCellularData success, promise: data->${JSON.stringify(data)}`);
}).catch((err) => {
    console.error(`enableCellularData fail, promise: err->${JSON.stringify(err)}`);
});
```

## data.disableCellularData

disableCellularData(callback: AsyncCallback<void\>): void

Disables the cellular data service. This API uses an asynchronous callback to return the result.

This is a system API.

**Required permission**: ohos.permission.SET_TELEPHONY_STATE

**System capability**: SystemCapability.Telephony.CellularData

**Parameters**

| Name  | Type                 | Mandatory| Description      |
| -------- | --------------------- | ---- | ---------- |
| callback | AsyncCallback\<void\> | Yes  | Callback used to return the result.|

**Example**

```js
data.disableCellularData((err, data) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```

## data.disableCellularData

disableCellularData(): Promise<void\>

Disables the cellular data service. This API uses a promise to return the result.

This is a system API.

**Required permission**: ohos.permission.SET_TELEPHONY_STATE

**System capability**: SystemCapability.Telephony.CellularData

**Return value**

| Type           | Description                       |
| --------------- | --------------------------- |
| Promise\<void\> | Promise used to return the result.|

**Example**

```js
let promise = data.disableCellularData();
promise.then((data) => {
    console.log(`disableCellularData success, promise: data->${JSON.stringify(data)}`);
}).catch((err) => {
    console.error(`disableCellularData fail, promise: err->${JSON.stringify(err)}`);
});
```

## data.enableCellularDataRoaming

enableCellularDataRoaming(slotId: number, callback: AsyncCallback<void\>): void

Enables the cellular data roaming service. This API uses an asynchronous callback to return the result.

This is a system API.

**Required permission**: ohos.permission.SET_TELEPHONY_STATE

**System capability**: SystemCapability.Telephony.CellularData

**Parameters**

| Name  | Type                 | Mandatory| Description                                    |
| -------- | --------------------- | ---- | ---------------------------------------- |
| slotId   | number                | Yes  | Card slot ID.<br>**0**: card slot 1<br>**1**: card slot 2|
| callback | AsyncCallback\<void\> | Yes  | Callback used to return the result.                              |

**Example**

```js
data.enableCellularDataRoaming(0, (err, data) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```

## data.enableCellularDataRoaming

enableCellularDataRoaming(slotId: number): Promise<void\>

Enables the cellular data roaming service. This API uses a promise to return the result.

This is a system API.

**Required permission**: ohos.permission.SET_TELEPHONY_STATE

**System capability**: SystemCapability.Telephony.CellularData

**Parameters**

| Name| Type  | Mandatory| Description                                    |
| ------ | ------ | ---- | ---------------------------------------- |
| slotId | number | Yes  | Card slot ID.<br>**0**: card slot 1<br>**1**: card slot 2|

**Return value**

| Type           | Description                     |
| --------------- | ------------------------- |
| Promise\<void\> | Promise used to return the result.|

**Example**

```js
let promise = data.enableCellularDataRoaming(0);
promise.then((data) => {
    console.log(`enableCellularDataRoaming success, promise: data->${JSON.stringify(data)}`);
}).catch((err) => {
    console.error(`enableCellularDataRoaming fail, promise: err->${JSON.stringify(err)}`);
});
```

## data.disableCellularDataRoaming

disableCellularDataRoaming(slotId: number, callback: AsyncCallback<void\>): void

Disables the cellular data roaming service. This API uses an asynchronous callback to return the result.

This is a system API.

**Required permission**: ohos.permission.SET_TELEPHONY_STATE

**System capability**: SystemCapability.Telephony.CellularData

**Parameters**

| Name  | Type                 | Mandatory| Description                                    |
| -------- | --------------------- | ---- | ---------------------------------------- |
| slotId   | number                | Yes  | Card slot ID.<br>**0**: card slot 1<br>**1**: card slot 2|
| callback | AsyncCallback\<void\> | Yes  | Callback used to return the result.                              |

**Example**

```js
data.disableCellularDataRoaming(0, (err, data) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```

## data.disableCellularDataRoaming

disableCellularDataRoaming(slotId: number): Promise<void\>

Disables the cellular data roaming service. This API uses a promise to return the result.

This is a system API.

**Required permission**: ohos.permission.SET_TELEPHONY_STATE

**System capability**: SystemCapability.Telephony.CellularData

**Parameters**

| Name| Type  | Mandatory| Description                                    |
| ------ | ------ | ---- | ---------------------------------------- |
| slotId | number | Yes  | Card slot ID.<br>**0**: card slot 1<br>**1**: card slot 2|

**Return value**

| Type           | Description                     |
| --------------- | ------------------------- |
| Promise\<void\> | Promise used to return the result.|

**Example**

```js
let promise = data.disableCellularDataRoaming(0);
promise.then((data) => {
    console.log(`disableCellularDataRoaming success, promise: data->${JSON.stringify(data)}`);
}).catch((err) => {
    console.error(`disableCellularDataRoaming fail, promise: err->${JSON.stringify(err)}`);
});
```

S
shawn_he 已提交
581
## DataFlowType
S
shawn_he 已提交
582

S
shawn_he 已提交
583
Defines the cellular data flow type.
S
shawn_he 已提交
584

S
shawn_he 已提交
585 586 587 588 589 590 591
**System capability**: SystemCapability.Telephony.CellularData

| Name                  | Value  | Description                                      |
| ---------------------- | ---- | ------------------------------------------ |
| DATA_FLOW_TYPE_NONE    | 0    | No uplink or downlink data is available.                  |
| DATA_FLOW_TYPE_DOWN    | 1    | Only the downlink data is available.                        |
| DATA_FLOW_TYPE_UP      | 2    | Only the uplink data is available.                        |
S
shawn_he 已提交
592
| DATA_FLOW_TYPE_UP_DOWN | 3    | Both the uplink data and downlink data are available.                        |
S
shawn_he 已提交
593
| DATA_FLOW_TYPE_DORMANT | 4    | No uplink or downlink data is available because the lower-layer link is in the dormant state.|
S
shawn_he 已提交
594

S
shawn_he 已提交
595
## DataConnectState
S
shawn_he 已提交
596

S
shawn_he 已提交
597
Describes the connection status of a cellular data link.
S
shawn_he 已提交
598 599

**System capability**: SystemCapability.Telephony.CellularData
S
shawn_he 已提交
600

S
shawn_he 已提交
601 602
| Name                   | Value  | Description                      |
| ----------------------- | ---- | -------------------------- |
S
shawn_he 已提交
603 604 605 606 607
| DATA_STATE_UNKNOWN      | -1   | The status of the cellular data link is unknown.    |
| DATA_STATE_DISCONNECTED | 0    | The cellular data link is disconnected.    |
| DATA_STATE_CONNECTING   | 1    | The cellular data link is being connected.|
| DATA_STATE_CONNECTED    | 2    | The cellular data link is connected.  |
| DATA_STATE_SUSPENDED    | 3    | The cellular data link is suspended.  |