提交 8b53e742 编写于 作者: S shawn_he

update doc

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 5fdf4414
......@@ -36,7 +36,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod
| Code | Error Message |
|---------|---------|
| 4600101 | Operation failed. Cannot connect to service.|
| 4600101 | If connecting to the service failed. |
**Example**
......@@ -72,7 +72,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod
| Code | Error Message |
|---------|---------|
| 4600101 | Operation failed. Cannot connect to service.|
| 4600101 | If connecting to the service failed. |
**Example**
......@@ -114,7 +114,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod
| Code | Error Message |
|---------|---------|
| 4600101 | Operation failed. Cannot connect to service.|
| 4600101 | If connecting to the service failed. |
**Example**
......@@ -155,7 +155,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod
| Code | Error Message |
|---------|---------|
| 4600101 | Operation failed. Cannot connect to service.|
| 4600101 | If connecting to the service failed. |
**Example**
......@@ -196,13 +196,13 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod
| Code | Error Message |
|---------|---------|
| 4600101 | Operation failed. Cannot connect to service.|
| 4600101 | If connecting to the service failed. |
**Example**
```js
try {
var value = batteryStats.getHardwareUnitPowerValue(ConsumptionType.CONSUMPTION_TYPE_SCREEN);
var value = batteryStats.getHardwareUnitPowerValue(batteryStats.ConsumptionType.CONSUMPTION_TYPE_SCREEN);
console.info('battery statistics value of hardware is: ' + value);
} catch(err) {
console.error('get battery statistics percent of hardware failed, err: ' + err);
......@@ -237,13 +237,13 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod
| Code | Error Message |
|---------|---------|
| 4600101 | Operation failed. Cannot connect to service.|
| 4600101 | If connecting to the service failed. |
**Example**
```js
try {
var percent = batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_SCREEN);
var percent = batteryStats.getHardwareUnitPowerPercent(batteryStats.ConsumptionType.CONSUMPTION_TYPE_SCREEN);
console.info('battery statistics percent of hardware is: ' + percent);
} catch(err) {
console.error('get battery statistics percent of hardware failed, err: ' + err);
......
......@@ -22,7 +22,7 @@ Sets the screen brightness.
**System API**: This is a system API.
**System capability**: SystemCapability.PowerManager.DisplayPowerManager
**System capability:** SystemCapability.PowerManager.DisplayPowerManager
**Parameters**
......@@ -34,9 +34,9 @@ Sets the screen brightness.
For details about the error codes, see [Screen Brightness Error Codes](../errorcodes/errorcode-brightness.md).
| Code | Error Message |
| ID | Error Message |
|---------|---------|
| 4700101 | Operation failed. Cannot connect to service.|
| 4700101 | If connecting to the service failed. |
**Example**
......
......@@ -17,6 +17,8 @@ import charger from '@ohos.charger';
Enumerates charging types.
**System API**: This is a system API.
**System capability**: SystemCapability.PowerManager.BatteryManager.Core
| Name | Value | Description |
......
# @ohos.multimodalInput.inputDeviceCooperate (Screen Hopping)
The **inputDeviceCooperate** module enables two or more networked devices to share the keyboard and mouse for collaborative operations.
The **inputDeviceCooperate** module implements screen hopping for two or more networked devices to share the keyboard and mouse for collaborative operations.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - The APIs provided by this module are system APIs.
## Modules to Import
```js
......@@ -66,7 +66,7 @@ Specifies whether to enable screen hopping. This API uses a promise to return th
**Return value**
| Name | Description |
| Parameters | Description |
| ------------------- | ------------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. |
......@@ -287,7 +287,7 @@ Checks whether screen hopping is enabled. This API uses a promise to return the
**Return value**
| Name | Description |
| Parameters | Description |
| ------------------- | ------------------------------- |
| Promise<{ state: boolean }>| Promise used to return the result. |
......@@ -296,6 +296,7 @@ Checks whether screen hopping is enabled. This API uses a promise to return the
**Example**
```js
let deviceDescriptor = "descriptor";
try {
inputDeviceCooperate.getState(deviceDescriptor).then((data) => {
console.log(`Get the status success, data: ${JSON.stringify(data)}`);
......@@ -311,7 +312,7 @@ try {
on(type: 'cooperation', callback: AsyncCallback<{ deviceDescriptor: string, eventMsg: EventMsg }>): void
Enables listening for screen hopping events.
Enables listening for screen hopping status change events.
**System capability**: SystemCapability.MultimodalInput.Input.Cooperator
......@@ -340,7 +341,7 @@ try {
off(type: 'cooperation', callback?: AsyncCallback\<void>): void
Disables listening for screen hopping events.
Disables listening for screen hopping status change events.
**System capability**: SystemCapability.MultimodalInput.Input.Cooperator
......
# @ohos.cooperate (Screen Hopping)
The **cooperate** module implements screen hopping for two or more networked devices to share the keyboard and mouse for collaborative operations.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - The APIs provided by this module are system APIs.
## Modules to Import
```js
import cooperate from '@ohos.cooperate'
```
## cooperate.prepare
prepare(callback: AsyncCallback&lt;void&gt;): void;
Prepares for screen hopping. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | --------------------------- |
| callback | AsyncCallback&lt;void&gt; | Yes|Callback used to return the result. |
**Example**
```js
try {
cooperate.prepare((error) => {
if (error) {
console.log(`Keyboard mouse crossing prepare failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Keyboard mouse crossing prepare success.`);
});
} catch (error) {
console.log(`Keyboard mouse crossing prepare failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.prepare
prepare(): Promise&lt;void&gt;
Prepares for screen hopping. This API uses a promise to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Return value**
| Parameters | Description |
| ------------------- | ------------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
```js
try {
cooperate.prepare().then(() => {
console.log(`Keyboard mouse crossing prepare success.`);
}, (error) => {
console.log(`Keyboard mouse crossing prepare failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
});
} catch (error) {
console.log(`Keyboard mouse crossing prepare failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.unprepare
unprepare(callback: AsyncCallback&lt;void&gt;): void;
Cancels the preparation for screen hopping. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------------ |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Example**
```js
try {
cooperate.unprepare((error) => {
if (error) {
console.log(`Keyboard mouse crossing unprepare failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Keyboard mouse crossing unprepare success.`);
});
} catch (error) {
console.log(`Keyboard mouse crossing unprepare failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.unprepare
unprepare(): Promise&lt;void&gt;;
Cancels the preparation for screen hopping. This API uses a promise to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Return value**
| Parameters | Description |
| ------------------- | --------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.|
```js
try {
cooperate.unprepare().then(() => {
console.log(`Keyboard mouse crossing unprepare success.`);
}, (error) => {
console.log(`Keyboard mouse crossing unprepare failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
});
} catch (error) {
console.log(`Keyboard mouse crossing unprepare failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.activate
activate(targetNetworkId: string, inputDeviceId: number, callback: AsyncCallback&lt;void&gt;): void;
Starts screen hopping. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------- | ---- | ---------------------------- |
| targetNetworkId | string | Yes | Descriptor of the target device for screen hopping. |
| inputDeviceId | number | Yes | Identifier of the input device for screen hopping.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Screen Hopping Error Codes](../errorcodes/errorcode-devicestatus.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 20900001 | This error code is reported if the screen hopping status is abnormal when the screen hopping API is called. |
**Example**
```js
let targetNetworkId = "networkId";
let inputDeviceId = 0;
try {
cooperate.activate(targetNetworkId, inputDeviceId, (error) => {
if (error) {
console.log(`Start Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Start Keyboard mouse crossing success.`);
});
} catch (error) {
console.log(`Start Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.activate
activate(targetNetworkId: string, inputDeviceId: number): Promise&lt;void&gt;;
Starts screen hopping. This API uses a promise to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------- | ---- | ---------------------------- |
| targetNetworkId | string | Yes | Descriptor of the target device for screen hopping. |
| inputDeviceId | number | Yes | Identifier of the input device for screen hopping.|
**Return value**
| Name | Description |
| ---------------------- | ------------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. |
**Error codes**
For details about the error codes, see [Screen Hopping Error Codes](../errorcodes/errorcode-devicestatus.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 20900001 | This error code is reported if the screen hopping status is abnormal when the screen hopping API is called. |
**Example**
```js
let targetNetworkId = "networkId";
let inputDeviceId = 0;
try {
cooperate.activate(targetNetworkId, inputDeviceId).then(() => {
console.log(`Start Keyboard mouse crossing success.`);
}, (error) => {
console.log(`Start Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
});
} catch (error) {
console.log(`Start Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.deactivate
deactivate(isUnchained: boolean, callback: AsyncCallback&lt;void&gt;): void;
Stops screen hopping. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------- | ---- | ---------------------------- |
| isUnchained | boolean | Yes| Whether to disable the cross-device link.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example**
```js
try {
cooperate.deactivate(false, (error) => {
if (error) {
console.log(`Stop Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Stop Keyboard mouse crossing success.`);
});
} catch (error) {
console.log(`Stop Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.deactivate
deactivate(isUnchained: boolean): Promise&lt;void&gt;;
Stops screen hopping. This API uses a promise to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------- | ---- | ------------------ |
| isUnchained | boolean | Yes | Whether to disable the cross-device link.|
**Return value**
| Name | Description |
| -------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. |
**Example**
```js
try {
cooperate.deactivate(false).then(() => {
console.log(`Stop Keyboard mouse crossing success.`);
}, (error) => {
console.log(`Stop Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
});
} catch (error) {
console.log(`Stop Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.getCrossingSwitchState
getCrossingSwitchState(networkId: string, callback: AsyncCallback&lt;boolean&gt;): void;
Obtains the screen hopping status of the target device. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------- | ---- | ---------------------------- |
| networkId | string | Yes | Descriptor of the target device for screen hopping. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.|
**Example**
```js
let deviceDescriptor = "networkId";
try {
cooperate.getCrossingSwitchState(deviceDescriptor, (error, data) => {
if (error) {
console.log(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Get the status success, data: ${JSON.stringify(data)}`);
});
} catch (error) {
console.log(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.getCrossingSwitchState
getCrossingSwitchState(networkId: string): Promise&lt;boolean&gt;;
Obtains the screen hopping status of the target device. This API uses a promise to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------- | ---- | ---------------------------- |
| networkId | string | Yes | Descriptor of the target device for screen hopping. |
**Return value**
| Parameters | Description |
| ------------------- | ------------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.|
**Example**
```js
let deviceDescriptor = "networkId";
try {
cooperate.getCrossingSwitchState(deviceDescriptor).then((data) => {
console.log(`Get the status success, data: ${JSON.stringify(data)}`);
}, (error) => {
console.log(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
});
} catch (error) {
console.log(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## on('cooperate')
on(type: 'cooperate', callback: Callback&lt;{ networkId: string, msg: CooperateMsg }&gt;): void;
Enables listening for screen hopping status change events.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | ---------------------------- |
| type | string | Yes | Event type. The value is **cooperate**.|
| callback | Callback&lt;{ networkId: string, msg: [CooperateMsg](#cooperatemsg) }&gt; | Yes | Callback used to return the result.|
**Example**
```js
try {
cooperate.on('cooperate', (data) => {
console.log(`Keyboard mouse crossing event: ${JSON.stringify(data)}`);
});
} catch (error) {
console.log(`Register failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## off('cooperate')
off(type: 'cooperate', callback?: Callback&lt;void&gt;): void;
Disables listening for screen hopping status change events.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------- | ---- | ---------------------------- |
| type | string | Yes | Event type. The value is **cooperate**.|
| callback | AsyncCallback&lt;void&gt; | No | Callback to be unregistered. If this parameter is not specified, all callbacks registered by the current application will be unregistered.|
**Example**
```js
// Unregister a single callback.
function callback(event) {
console.log(`Keyboard mouse crossing event: ${JSON.stringify(event)}`);
return false;
}
try {
cooperate.on('cooperate', callback);
cooperate.off("cooperate", callback);
} catch (error) {
console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
```js
// Unregister all callbacks.
function callback(event) {
console.log(`Keyboard mouse crossing event: ${JSON.stringify(event)}`);
return false;
}
try {
cooperate.on('cooperate', callback);
cooperate.off("cooperate");
} catch (error) {
console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## CooperateMsg
Represents a screen hopping message notification.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
| Name | Value | Description |
| -------- | ----------------- | ----------------- |
| COOPERATE_PREPARE | 0 | The preparation for screen hopping is finished. |
| COOPERATE_UNPREPARE | 1 | The preparation for screen hopping is cancelled. |
| COOPERATE_ACTIVATE | 2 | Screen hopping starts. |
| COOPERATE_ACTIVATE_SUCCESS | 3 | Starting screen hopping succeeds.|
| COOPERATE_ACTIVATE_FAIL | 4 | Starting screen hopping fails.|
| COOPERATE_DEACTIVATE_SUCCESS | 5 | Stopping screen hopping succeeds.|
| COOPERATE_DEACTIVATE_FAIL | 6 | Stopping screen hopping fails.|
......@@ -45,7 +45,8 @@ httpRequest.request(
connectTimeout: 60000 // Optional. The default value is 60000, in ms.
readTimeout: 60000, // Optional. The default value is 60000, in ms.
usingProtocol: http.HttpProtocol.HTTP1_1, // Optional. The default protocol type is automatically specified by the system.
usingProxy: false, // Optional. By default, network proxy is not used. This field is supported since API 10.
usingProxy: false, // Optional. By default, network proxy is not used. This field is supported since API version 10.
caPath: "", // Optional. The preset CA certificate is used by default. This field is supported since API version 10.
}, (err, data) => {
if (!err) {
// data.result carries the HTTP response. Parse the response based on service requirements.
......@@ -68,7 +69,7 @@ httpRequest.request(
> **NOTE**
> If the data in **console.info()** contains a newline character, the data will be truncated.
## http.createHttp
## http.createHttp<sup>6+</sup>
createHttp(): HttpRequest
......@@ -94,7 +95,7 @@ let httpRequest = http.createHttp();
Defines an HTTP request task. Before invoking APIs provided by **HttpRequest**, you must call [createHttp()](#httpcreatehttp) to create an **HttpRequestTask** object.
### request
### request<sup>6+</sup>
request(url: string, callback: AsyncCallback\<HttpResponse\>):void
......@@ -116,14 +117,38 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback
**Error codes**
| Code | Error Message |
| ID | Error Message |
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 201 | Permission denied. |
| 2300001 | Unsupported protocol. |
| 2300003 | URL using bad/illegal format or missing URL. |
| 2300005 | Couldn't resolve proxy name. |
| 2300006 | Couldn't resolve host name. |
| 2300007 | Couldn't connect to server. |
| 2300008 | Weird server reply. |
| 2300009 | Access denied to remote resource. |
| 2300016 | Error in the HTTP2 framing layer. |
| 2300018 | Transferred a partial file. |
| 2300023 | Failed writing received data to disk/application. |
| 2300025 | Upload failed. |
| 2300026 | Failed to open/read local data from file/application. |
| 2300027 | Out of memory. |
| 2300028 | Timeout was reached. |
| 2300047 | Number of redirects hit maximum amount. |
| 2300052 | Server returned nothing (no headers, no data). |
| 2300055 | Failed sending data to the peer. |
| 2300056 | Failure when receiving data from the peer. |
| 2300058 | Problem with the local SSL certificate. |
| 2300059 | Couldn't use specified SSL cipher. |
| 2300060 | SSL peer certificate or SSH remote key was not OK. |
| 2300061 | Unrecognized or bad HTTP Content or Transfer-Encoding.|
| 2300063 | Maximum file size exceeded. |
| 2300070 | Disk full or allocation exceeded. |
| 2300073 | Remote file already exists. |
| 2300077 | Problem with the SSL CA cert (path? access rights?). |
| 2300078 | Remote file not found. |
| 2300094 | An authentication function returned an error. |
| 2300999 | Unknown Other Error. |
> **NOTE**
......@@ -145,7 +170,7 @@ httpRequest.request("EXAMPLE_URL", (err, data) => {
});
```
### request
### request<sup>6+</sup>
request(url: string, options: HttpRequestOptions, callback: AsyncCallback\<HttpResponse\>):void
......@@ -168,7 +193,7 @@ Initiates an HTTP request containing specified options to a given URL. This API
**Error codes**
| Code | Error Message |
| ID | Error Message |
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 201 | Permission denied. |
......@@ -231,7 +256,7 @@ httpRequest.request("EXAMPLE_URL",
});
```
### request
### request<sup>6+</sup>
request(url: string, options? : HttpRequestOptions): Promise\<HttpResponse\>
......@@ -259,7 +284,7 @@ Initiates an HTTP request containing specified options to a given URL. This API
**Error codes**
| Code | Error Message |
| ID | Error Message |
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 201 | Permission denied. |
......@@ -353,14 +378,38 @@ Initiates an HTTP request containing specified options to a given URL. This API
**Error codes**
| Code | Error Message |
| ID | Error Message |
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 201 | Permission denied. |
| 2300001 | Unsupported protocol. |
| 2300003 | URL using bad/illegal format or missing URL. |
| 2300005 | Couldn't resolve proxy name. |
| 2300006 | Couldn't resolve host name. |
| 2300007 | Couldn't connect to server. |
| 2300008 | Weird server reply. |
| 2300009 | Access denied to remote resource. |
| 2300016 | Error in the HTTP2 framing layer. |
| 2300018 | Transferred a partial file. |
| 2300023 | Failed writing received data to disk/application. |
| 2300025 | Upload failed. |
| 2300026 | Failed to open/read local data from file/application. |
| 2300027 | Out of memory. |
| 2300028 | Timeout was reached. |
| 2300047 | Number of redirects hit maximum amount. |
| 2300052 | Server returned nothing (no headers, no data). |
| 2300055 | Failed sending data to the peer. |
| 2300056 | Failure when receiving data from the peer. |
| 2300058 | Problem with the local SSL certificate. |
| 2300059 | Couldn't use specified SSL cipher. |
| 2300060 | SSL peer certificate or SSH remote key was not OK. |
| 2300061 | Unrecognized or bad HTTP Content or Transfer-Encoding.|
| 2300063 | Maximum file size exceeded. |
| 2300070 | Disk full or allocation exceeded. |
| 2300073 | Remote file already exists. |
| 2300077 | Problem with the SSL CA cert (path? access rights?). |
| 2300078 | Remote file not found. |
| 2300094 | An authentication function returned an error. |
| 2300999 | Unknown Other Error. |
> **NOTE**
......@@ -383,7 +432,7 @@ httpRequest.request2("EXAMPLE_URL", (err, data) => {
request2(url: string, options: HttpRequestOptions, callback: AsyncCallback\<number\>): void
Initiates an HTTP request to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response.
Initiates an HTTP request containing specified options to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response.
**Required permissions**: ohos.permission.INTERNET
......@@ -399,7 +448,7 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback
**Error codes**
| Code | Error Message |
| ID | Error Message |
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 201 | Permission denied. |
......@@ -482,7 +531,7 @@ Initiates an HTTP request containing specified options to a given URL. This API
**Error codes**
| Code | Error Message |
| ID | Error Message |
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 201 | Permission denied. |
......@@ -757,7 +806,7 @@ httpRequest.off('dataEnd');
### on('dataProgress')<sup>10+</sup>
on(type: 'dataProgress', callback: AsyncCallback\<{ receiveSize: number, totalSize: number }\>): void
on(type: 'dataProgress', callback: Callback\<{ receiveSize: number, totalSize: number }\>): void
Registers an observer for events indicating progress of receiving HTTP streaming responses.
......@@ -802,7 +851,7 @@ Unregisters the observer for events indicating progress of receiving HTTP stream
httpRequest.off('dataProgress');
```
## HttpRequestOptions
## HttpRequestOptions<sup>6+</sup>
Specifies the type and value range of the optional parameters in the HTTP request.
......@@ -819,9 +868,10 @@ Specifies the type and value range of the optional parameters in the HTTP reques
| readTimeout | number | No | Read timeout duration. The default value is **60000**, in ms.<br>The value **0** indicates no timeout.|
| connectTimeout | number | No | Connection timeout interval. The default value is **60000**, in ms. |
| usingProtocol<sup>9+</sup> | [HttpProtocol](#httpprotocol9) | No | Protocol. The default value is automatically specified by the system. |
| usingProxy<sup>10+</sup> | boolean \| Object | No | Whether to use HTTP proxy. The default value is **false**, which means not to use HTTP proxy.<br>- If **usingProxy** is of the **Boolean** type and the value is **true**, network proxy is used by default.<br>- If **usingProxy** is of the **object** type, the specified network proxy is used. |
| usingProxy<sup>10+</sup> | boolean \| Object | No | Whether to use HTTP proxy. The default value is **false**, which means not to use HTTP proxy.<br>- If **usingProxy** is of the **Boolean** type and the value is **true**, network proxy is used by default.<br>- If **usingProxy** is of the **object** type, the specified network proxy is used.
| caPath<sup>10+</sup> | string | No | Path of the CA certificate. If this parameter is set, the system uses the CA certificate in the specified path. Otherwise, the system uses the preset CA certificate. |
## RequestMethod
## RequestMethod<sup>6+</sup>
Defines an HTTP request method.
......@@ -838,7 +888,7 @@ Defines an HTTP request method.
| TRACE | "TRACE" | TRACE method. |
| CONNECT | "CONNECT" | CONNECT method.|
## ResponseCode
## ResponseCode<sup>6+</sup>
Enumerates the response codes for an HTTP request.
......@@ -882,7 +932,7 @@ Enumerates the response codes for an HTTP request.
| GATEWAY_TIMEOUT | 504 | "Gateway Timeout." The server acting as a gateway or proxy does not receive requests from the remote server within the timeout period. |
| VERSION | 505 | "HTTP Version Not Supported." The server does not support the HTTP protocol version used in the request. |
## HttpResponse
## HttpResponse<sup>6+</sup>
Defines the response to an HTTP request.
......
......@@ -11,7 +11,7 @@ The network connection management module provides basic network management capab
import connection from '@ohos.net.connection'
```
## connection.createNetConnection
## connection.createNetConnection<sup>8+</sup>
createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection
......@@ -46,7 +46,7 @@ let netConnectionCellular = connection.createNetConnection({
})
```
## connection.getDefaultNet
## connection.getDefaultNet<sup>8+</sup>
getDefaultNet(callback: AsyncCallback\<NetHandle>): void
......@@ -79,7 +79,7 @@ connection.getDefaultNet(function (error, data) {
})
```
## connection.getDefaultNet
## connection.getDefaultNet<sup>8+</sup>
getDefaultNet(): Promise\<NetHandle>
......@@ -444,7 +444,7 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
## connection.getAllNets
## connection.getAllNets<sup>8+</sup>
getAllNets(callback: AsyncCallback&lt;Array&lt;NetHandle&gt;&gt;): void
......@@ -477,7 +477,7 @@ connection.getAllNets(function (error, data) {
});
```
## connection.getAllNets
## connection.getAllNets<sup>8+</sup>
getAllNets(): Promise&lt;Array&lt;NetHandle&gt;&gt;
......@@ -509,7 +509,7 @@ connection.getAllNets().then(function (data) {
});
```
## connection.getConnectionProperties
## connection.getConnectionProperties<sup>8+</sup>
getConnectionProperties(netHandle: NetHandle, callback: AsyncCallback\<ConnectionProperties>): void
......@@ -547,7 +547,7 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
## connection.getConnectionProperties
## connection.getConnectionProperties<sup>8+</sup>
getConnectionProperties(netHandle: NetHandle): Promise\<ConnectionProperties>
......@@ -589,7 +589,7 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
## connection.getNetCapabilities
## connection.getNetCapabilities<sup>8+</sup>
getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback\<NetCapabilities>): void
......@@ -627,7 +627,7 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
## connection.getNetCapabilities
## connection.getNetCapabilities<sup>8+</sup>
getNetCapabilities(netHandle: NetHandle): Promise\<NetCapabilities>
......@@ -734,7 +734,7 @@ connection.isDefaultNetMetered().then(function (data) {
})
```
## connection.hasDefaultNet
## connection.hasDefaultNet<sup>8+</sup>
hasDefaultNet(callback: AsyncCallback\<boolean>): void
......@@ -767,7 +767,7 @@ connection.hasDefaultNet(function (error, data) {
})
```
## connection.hasDefaultNet
## connection.hasDefaultNet<sup>8+</sup>
hasDefaultNet(): Promise\<boolean>
......@@ -799,7 +799,7 @@ connection.hasDefaultNet().then(function (data) {
})
```
## connection.enableAirplaneMode
## connection.enableAirplaneMode<sup>8+</sup>
enableAirplaneMode(callback: AsyncCallback\<void>): void
......@@ -821,6 +821,7 @@ Enables the airplane mode. This API uses an asynchronous callback to return the
| ID| Error Message |
| ------- | ----------------------------- |
| 202 | Non-system applications use system APIs.|
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -832,7 +833,7 @@ connection.enableAirplaneMode(function (error) {
})
```
## connection.enableAirplaneMode
## connection.enableAirplaneMode<sup>8+</sup>
enableAirplaneMode(): Promise\<void>
......@@ -854,6 +855,7 @@ Enables the airplane mode. This API uses a promise to return the result.
| ID| Error Message |
| ------- | ----------------------------- |
| 202 | Non-system applications use system APIs.|
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -865,7 +867,7 @@ connection.enableAirplaneMode().then(function (error) {
})
```
## connection.disableAirplaneMode
## connection.disableAirplaneMode<sup>8+</sup>
disableAirplaneMode(callback: AsyncCallback\<void>): void
......@@ -887,6 +889,7 @@ Disables the airplane mode. This API uses an asynchronous callback to return the
| ID| Error Message |
| ------- | ----------------------------- |
| 202 | Non-system applications use system APIs.|
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -898,7 +901,7 @@ connection.disableAirplaneMode(function (error) {
})
```
## connection.disableAirplaneMode
## connection.disableAirplaneMode<sup>8+</sup>
disableAirplaneMode(): Promise\<void>
......@@ -920,6 +923,7 @@ Disables the airplane mode. This API uses a promise to return the result.
| ID| Error Message |
| ------- | ----------------------------- |
| 202 | Non-system applications use system APIs.|
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -931,7 +935,7 @@ connection.disableAirplaneMode().then(function (error) {
})
```
## connection.reportNetConnected
## connection.reportNetConnected<sup>8+</sup>
reportNetConnected(netHandle: NetHandle, callback: AsyncCallback&lt;void&gt;): void
......@@ -968,7 +972,7 @@ connection.getDefaultNet().then(function (netHandle) {
});
```
## connection.reportNetConnected
## connection.reportNetConnected<sup>8+</sup>
reportNetConnected(netHandle: NetHandle): Promise&lt;void&gt;
......@@ -1009,7 +1013,7 @@ connection.getDefaultNet().then(function (netHandle) {
});
```
## connection.reportNetDisconnected
## connection.reportNetDisconnected<sup>8+</sup>
reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback&lt;void&gt;): void
......@@ -1046,7 +1050,7 @@ connection.getDefaultNet().then(function (netHandle) {
});
```
## connection.reportNetDisconnected
## connection.reportNetDisconnected<sup>8+</sup>
reportNetDisconnected(netHandle: NetHandle): Promise&lt;void&gt;
......@@ -1087,7 +1091,7 @@ connection.getDefaultNet().then(function (netHandle) {
});
```
## connection.getAddressesByName
## connection.getAddressesByName<sup>8+</sup>
getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void
......@@ -1124,7 +1128,7 @@ connection.getAddressesByName(host, function (error, data) {
})
```
## connection.getAddressesByName
## connection.getAddressesByName<sup>8+</sup>
getAddressesByName(host: string): Promise\<Array\<NetAddress>>
......@@ -1174,7 +1178,7 @@ Represents the network connection handle.
> When a device changes to the network disconnected state, the **netLost** event will be triggered.
> When a device switches from a Wi-Fi network to a cellular network, the **netLost** event will be first triggered to indicate that the Wi-Fi network is lost and then the **netAvaliable** event will be triggered to indicate that the cellular network is available.
### register
### register<sup>8+</sup>
register(callback: AsyncCallback\<void>): void
......@@ -1195,9 +1199,10 @@ Registers a listener for network status changes.
| ID| Error Message |
| ------- | ----------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
| 2101008 | The callback is not exists. |
| 2101008 | The same callback exists. |
| 2101022 | The number of requests exceeded the maximum. |
**Example**
......@@ -1208,7 +1213,7 @@ netConnection.register(function (error) {
})
```
### unregister
### unregister<sup>8+</sup>
unregister(callback: AsyncCallback\<void>): void
......@@ -1226,9 +1231,11 @@ Unregisters the listener for network status changes.
| ID| Error Message |
| ------- | ----------------------------- |
| 201 | Permission denied.|
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
| 2101007 | The same callback exists. |
| 2101007 | The callback is not exists. |
**Example**
......@@ -1238,7 +1245,7 @@ netConnection.unregister(function (error) {
})
```
### on('netAvailable')
### on('netAvailable')<sup>8+</sup>
on(type: 'netAvailable', callback: Callback\<NetHandle>): void
......@@ -1277,7 +1284,7 @@ netCon.unregister(function (error) {
})
```
### on('netBlockStatusChange')
### on('netBlockStatusChange')<sup>8+</sup>
on(type: 'netBlockStatusChange', callback: Callback&lt;{ netHandle: NetHandle, blocked: boolean }&gt;): void
......@@ -1316,7 +1323,7 @@ netCon.unregister(function (error) {
})
```
### on('netCapabilitiesChange')
### on('netCapabilitiesChange')<sup>8+</sup>
on(type: 'netCapabilitiesChange', callback: Callback<{ netHandle: NetHandle, netCap: NetCapabilities }>): void
......@@ -1355,7 +1362,7 @@ netCon.unregister(function (error) {
})
```
### on('netConnectionPropertiesChange')
### on('netConnectionPropertiesChange')<sup>8+</sup>
on(type: 'netConnectionPropertiesChange', callback: Callback<{ netHandle: NetHandle, connectionProperties:
ConnectionProperties }>): void
......@@ -1395,7 +1402,7 @@ netCon.unregister(function (error) {
})
```
### on('netLost')
### on('netLost')<sup>8+</sup>
on(type: 'netLost', callback: Callback\<NetHandle>): void
......@@ -1434,7 +1441,7 @@ netCon.unregister(function (error) {
})
```
### on('netUnavailable')
### on('netUnavailable')<sup>8+</sup>
on(type: 'netUnavailable', callback: Callback\<void>): void
......@@ -1473,7 +1480,7 @@ netCon.unregister(function (error) {
})
```
## NetHandle
## NetHandle<sup>8+</sup>
Defines the handle of the data network.
......@@ -1640,7 +1647,7 @@ connection.getDefaultNet().then((netHandle) => {
})
```
### getAddressesByName
### getAddressesByName<sup>8+</sup>
getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void
......@@ -1679,7 +1686,7 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
### getAddressesByName
### getAddressesByName<sup>8+</sup>
getAddressesByName(host: string): Promise\<Array\<NetAddress>>
......@@ -1722,7 +1729,7 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
### getAddressByName
### getAddressByName<sup>8+</sup>
getAddressByName(host: string, callback: AsyncCallback\<NetAddress>): void
......@@ -1761,7 +1768,7 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
### getAddressByName
### getAddressByName<sup>8+</sup>
getAddressByName(host: string): Promise\<NetAddress>
......@@ -1804,7 +1811,7 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
## NetCap
## NetCap<sup>8+</sup>
Defines the network capability.
......@@ -1818,7 +1825,7 @@ Defines the network capability.
| NET_CAPABILITY_NOT_VPN | 15 | The network does not use a virtual private network (VPN).|
| NET_CAPABILITY_VALIDATED | 16 | The Internet access capability of the network is successfully verified by the connection management module.|
## NetBearType
## NetBearType<sup>8+</sup>
Enumerates network types.
......@@ -1842,7 +1849,7 @@ Defines the global HTTP proxy configuration of the network.
| port | number | No | Host port.|
| exclusionList | Array<string> | No | Exclusion list of hosts that do not use the proxy server. The length of the combined elements in the list cannot exceed 96 bytes.<br>For example, the length of **baidu.com,zhihu.com** is 20 bytes.|
## NetSpecifier
## NetSpecifier<sup>8+</sup>
Provides an instance that bears data network capabilities.
......@@ -1853,7 +1860,7 @@ Provides an instance that bears data network capabilities.
| netCapabilities | [NetCapabilities](#netcapabilities) | Yes | Network transmission capabilities and bearer types of the data network. |
| bearerPrivateIdentifier | string | No | Network identifier. The identifier of a Wi-Fi network is **wifi**, and that of a cellular network is **slot0** (corresponding to SIM card 1).|
## NetCapabilities
## NetCapabilities<sup>8+</sup>
Defines the network capability set.
......@@ -1866,7 +1873,7 @@ Defines the network capability set.
| networkCap | Array\<[NetCap](#netcap)> | No| Network capability. |
| bearerTypes | Array\<[NetBearType](#netbeartype)> | Yes| Network type. |
## ConnectionProperties
## ConnectionProperties<sup>8+</sup>
Defines the network connection properties.
......@@ -1881,7 +1888,7 @@ Defines the network connection properties.
| dnses | Array\<[NetAddress](#netaddress)> | Yes|Network address. For details, see [NetAddress](#netaddress).|
| mtu | number | Yes|Maximum transmission unit (MTU). |
## RouteInfo
## RouteInfo<sup>8+</sup>
Defines network route information.
......@@ -1895,7 +1902,7 @@ Defines network route information.
| hasGateway | boolean | Yes|Whether a gateway is present. |
| isDefaultRoute | boolean | Yes|Whether the route is the default route.|
## LinkAddress
## LinkAddress<sup>8+</sup>
Defines network link information.
......@@ -1906,7 +1913,7 @@ Defines network link information.
| address | [NetAddress](#netaddress) | Yes| Link address. |
| prefixLength | number | Yes|Length of the link address prefix.|
## NetAddress
## NetAddress<sup>8+</sup>
Defines a network address.
......
......@@ -11,7 +11,7 @@ The **ethernet** module provides wired network capabilities, which allow users t
import ethernet from '@ohos.net.ethernet'
```
## ethernet.setIfaceConfig
## ethernet.setIfaceConfig<sup>9+</sup>
setIfaceConfig(iface: string, ic: InterfaceConfiguration, callback: AsyncCallback\<void>): void
......@@ -36,13 +36,15 @@ Sets the network interface configuration. This API uses an asynchronous callback
| ID| Error Message |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 | The device information does not exist. |
| 2201006 | Device disconnected. |
| 2201007 | Failed to write the user configuration. |
| 2201004 | Invalid Ethernet profile. |
| 2201005 | Device information does not exist. |
| 2201006 | Ethernet device not connected. |
| 2201007 | Ethernet failed to write user configuration information. |
**Example**
......@@ -64,7 +66,7 @@ ethernet.setIfaceConfig("eth0", {
});
```
## ethernet.setIfaceConfig
## ethernet.setIfaceConfig<sup>9+</sup>
setIfaceConfig(iface: string, ic: InterfaceConfiguration): Promise\<void>
......@@ -94,13 +96,15 @@ Sets the network interface configuration. This API uses a promise to return the
| ID| Error Message |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 | The device information does not exist. |
| 2201006 | Device disconnected. |
| 2201007 | Failed to write the user configuration. |
| 2201004 | Invalid Ethernet profile. |
| 2201005 | Device information does not exist. |
| 2201006 | Ethernet device not connected. |
| 2201007 | Ethernet failed to write user configuration information. |
**Example**
......@@ -120,7 +124,7 @@ ethernet.setIfaceConfig("eth0", {
});
```
## ethernet.getIfaceConfig
## ethernet.getIfaceConfig<sup>9+</sup>
getIfaceConfig(iface: string, callback: AsyncCallback\<InterfaceConfiguration>): void
......@@ -144,11 +148,12 @@ Obtains the configuration of a network interface. This API uses an asynchronous
| ID| Error Message |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 | The device information does not exist. |
| 2201005 | Device information does not exist. |
**Example**
......@@ -168,7 +173,7 @@ ethernet.getIfaceConfig("eth0", (error, value) => {
});
```
## ethernet.getIfaceConfig
## ethernet.getIfaceConfig<sup>9+</sup>
getIfaceConfig(iface: string): Promise\<InterfaceConfiguration>
......@@ -197,11 +202,12 @@ Obtains the configuration of a network interface. This API uses a promise to ret
| ID| Error Message |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 | The device information does not exist. |
| 2201005 | Device information does not exist. |
**Example**
......@@ -219,7 +225,7 @@ ethernet.getIfaceConfig("eth0").then((data) => {
});
```
## ethernet.isIfaceActive
## ethernet.isIfaceActive<sup>9+</sup>
isIfaceActive(iface: string, callback: AsyncCallback\<number>): void
......@@ -243,11 +249,12 @@ Checks whether a network interface is active. This API uses an asynchronous call
| ID| Error Message |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 | The device information does not exist. |
| 2201005 | Device information does not exist. |
**Example**
......@@ -261,7 +268,7 @@ ethernet.isIfaceActive("eth0", (error, value) => {
});
```
## ethernet.isIfaceActive
## ethernet.isIfaceActive<sup>9+</sup>
isIfaceActive(iface: string): Promise\<number>
......@@ -290,11 +297,12 @@ Checks whether a network interface is active. This API uses a promise to return
| ID| Error Message |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 | The device information does not exist. |
| 2201005 | Device information does not exist. |
**Example**
......@@ -306,7 +314,7 @@ ethernet.isIfaceActive("eth0").then((data) => {
});
```
## ethernet.getAllActiveIfaces
## ethernet.getAllActiveIfaces<sup>9+</sup>
getAllActiveIfaces(callback: AsyncCallback\<Array\<string>>): void
......@@ -329,6 +337,7 @@ Obtains the list of all active network interfaces. This API uses an asynchronous
| ID| Error Message |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
......@@ -347,7 +356,7 @@ ethernet.getAllActiveIfaces((error, value) => {
});
```
## ethernet.getAllActiveIfaces
## ethernet.getAllActiveIfaces<sup>9+</sup>
getAllActiveIfaces(): Promise\<Array\<string>>
......@@ -370,6 +379,7 @@ Obtains the list of all active network interfaces. This API uses a promise to re
| ID| Error Message |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
......@@ -403,21 +413,19 @@ Registers an observer for NIC hot swap events. This API uses an asynchronous cal
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ---------- |
| type | string | Yes | Event type. The value is **interfaceStateChange**.|
| callback | Callback\<{ iface: string, active: boolean }\> | Yes | Callback used to return the result.<br>**iface**: NIC name.<br>**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.|
| callback | AsyncCallback\<{ iface: string, active: boolean }\> | Yes | Callback used to return the result.<br>**iface**: NIC name.<br>**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.|
**Error codes**
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Applicable only to system applications. |
| 401 | Parameter error. |
| 202 | Non-system applications use system APIs. |
**Example**
```js
ethernet.on('interfaceStateChange', (data) => {
console.log('on interfaceSharingStateChange: ' + JSON.stringify(data.iface) + JSON.stringify(data.active));
ethernet.on('interfaceStateChange', (data) => {
console.log('on interfaceSharingStateChange: ' + JSON.stringify(data));
});
```
......@@ -438,15 +446,13 @@ Unregisters the observer for NIC hot swap events. This API uses an asynchronous
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ---------- |
| type | string | Yes | Event type. The value is **interfaceStateChange**.|
| callback | Callback\<{ iface: string, active: boolean }> | No | Callback used to return the result.<br>**iface**: NIC name.<br>**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.|
| callback | AsyncCallback\<{ iface: string, active: boolean }> | No | Callback used to return the result.<br>**iface**: NIC name.<br>**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.|
**Error codes**
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Applicable only to system applications. |
| 401 | Parameter error. |
| 202 | Non-system applications use system APIs. |
**Example**
......@@ -454,7 +460,7 @@ Unregisters the observer for NIC hot swap events. This API uses an asynchronous
ethernet.off('interfaceStateChange');
```
## InterfaceConfiguration
## InterfaceConfiguration<sup>9+</sup>
Defines the network configuration for the Ethernet connection.
......@@ -471,7 +477,7 @@ Defines the network configuration for the Ethernet connection.
| netMask | string | Yes| Subnet mask of the Ethernet connection. The value must be an IPv4 address, which is a 32-bit number displayed in dotted decimal notation and each 8-bit field ranges from 0 to 255. This parameter does not need to be configured in DHCP mode.|
| dnsServers | string | Yes| DNS server addresses of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode. Multiple addresses are separated by commas (,).|
## IPSetMode
## IPSetMode<sup>9+</sup>
Defines the configuration mode of the Ethernet connection.
......
......@@ -11,7 +11,7 @@ Multicast DNS (mDNS) provides functions such as adding, removing, discovering, a
import mdns from '@ohos.net.mdns'
```
## mdns.addLocalService
## mdns.addLocalService<sup>10+</sup>
addLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\<LocalServiceInfo>): void
......@@ -100,7 +100,7 @@ mdns.addLocalService(context, localServiceInfo, function (error, data) {
});
```
## mdns.addLocalService
## mdns.addLocalService<sup>10+</sup>
addLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\<LocalServiceInfo>
......@@ -192,7 +192,7 @@ mdns.addLocalService(context, localServiceInfo).then(function (data) {
});
```
## mdns.removeLocalService
## mdns.removeLocalService<sup>10+</sup>
removeLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\<LocalServiceInfo>): void
......@@ -216,7 +216,7 @@ Removes an mDNS service. This API uses an asynchronous callback to return the re
| 2100002 | Operation failed. Cannot connect to service. |
| 2100003 | System internal error. |
| 2204002 | Callback not found. |
| 2204008 | Service instance duplicated. |
| 2204008 | Service instance not found. |
| 2204010 | Send packet failed. |
> **NOTE**
......@@ -281,7 +281,7 @@ mdns.removeLocalService(context, localServiceInfo, function (error, data) {
});
```
## mdns.removeLocalService
## mdns.removeLocalService<sup>10+</sup>
removeLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\<LocalServiceInfo>
......@@ -310,7 +310,7 @@ Removes an mDNS service. This API uses a promise to return the result.
| 2100002 | Operation failed. Cannot connect to service. |
| 2100003 | System internal error. |
| 2204002 | Callback not found. |
| 2204008 | Service instance duplicated. |
| 2204008 | Service instance not found. |
| 2204010 | Send packet failed. |
> **NOTE**
......@@ -373,7 +373,7 @@ mdns.removeLocalService(context, localServiceInfo).then(function (data) {
});
```
## mdns.createDiscoveryService
## mdns.createDiscoveryService<sup>10+</sup>
createDiscoveryService(context: Context, serviceType: string): DiscoveryService
......@@ -423,7 +423,7 @@ let serviceType = "_print._tcp";
let discoveryService = mdns.createDiscoveryService(context, serviceType);
```
## mdns.resolveLocalService
## mdns.resolveLocalService<sup>10+</sup>
resolveLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\<LocalServiceInfo>): void
......@@ -512,7 +512,7 @@ mdns.resolveLocalService(context, localServiceInfo, function (error, data) {
});
```
## mdns.resolveLocalService
## mdns.resolveLocalService<sup>10+</sup>
resolveLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\<LocalServiceInfo>
......@@ -603,11 +603,11 @@ mdns.resolveLocalService(context, localServiceInfo).then(function (data) {
console.log(JSON.stringify(data));
});
```
## DiscoveryService
## DiscoveryService<sup>10+</sup>
Defines a **DiscoveryService** object for discovering mDNS services of the specified type.
### startSearchingMDNS
### startSearchingMDNS<sup>10+</sup>
startSearchingMDNS(): void
......@@ -644,7 +644,7 @@ let discoveryService = mdns.createDiscoveryService(context, serviceType);
discoveryService.startSearchingMDNS();
```
### stopSearchingMDNS
### stopSearchingMDNS<sup>10+</sup>
stopSearchingMDNS(): void
......@@ -681,7 +681,7 @@ let discoveryService = mdns.createDiscoveryService(context, serviceType);
discoveryService.stopSearchingMDNS();
```
### on('discoveryStart')
### on('discoveryStart')<sup>10+</sup>
on(type: 'discoveryStart', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MdnsError}>): void
......@@ -710,7 +710,7 @@ discoveryService.on('discoveryStart', (data) => {
discoveryService.stopSearchingMDNS();
```
### on('discoveryStop')
### on('discoveryStop')<sup>10+</sup>
on(type: 'discoveryStop', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MdnsError}>): void
......@@ -739,7 +739,7 @@ discoveryService.on('discoveryStop', (data) => {
discoveryService.stopSearchingMDNS();
```
### on('serviceFound')
### on('serviceFound')<sup>10+</sup>
on(type: 'serviceFound', callback: Callback\<LocalServiceInfo>): void
......@@ -768,7 +768,7 @@ discoveryService.on('serviceFound', (data) => {
discoveryService.stopSearchingMDNS();
```
### on('serviceLost')
### on('serviceLost')<sup>10+</sup>
on(type: 'serviceLost', callback: Callback\<LocalServiceInfo>): void
......@@ -797,7 +797,7 @@ discoveryService.on('serviceLost', (data) => {
discoveryService.stopSearchingMDNS();
```
## LocalServiceInfo
## LocalServiceInfo<sup>10+</sup>
Defines the mDNS service information.
......@@ -811,7 +811,7 @@ Defines the mDNS service information.
| host | [NetAddress](js-apis-net-connection.md#netaddress) | No| IP address of the device that provides the mDNS service. The IP address is not effective when an mDNS service is added or removed. |
| serviceAttribute | serviceAttribute\<[ServiceAttribute](#serviceattribute)> | No| mDNS service attribute information. |
## ServiceAttribute
## ServiceAttribute<sup>10+</sup>
Defines the mDNS service attribute information.
......
......@@ -12,7 +12,7 @@ The **sharing** module allows you to share your device's Internet connection wit
import sharing from '@ohos.net.sharing'
```
## sharing.isSharingSupported
## sharing.isSharingSupported<sup>9+</sup>
isSharingSupported(callback: AsyncCallback\<boolean>): void
......@@ -48,7 +48,7 @@ sharing.isSharingSupported((error, data) => {
});
```
## sharing.isSharingSupported
## sharing.isSharingSupported<sup>9+</sup>
isSharingSupported(): Promise\<boolean>
......@@ -85,7 +85,7 @@ sharing.isSharingSupported().then(data => {
});
```
## sharing.isSharing
## sharing.isSharing<sup>9+</sup>
isSharing(callback: AsyncCallback\<boolean>): void
......@@ -108,8 +108,10 @@ Checks whether network sharing is in progress. This API uses an asynchronous cal
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
| 2202011 | Cannot get network sharing configuration. |
**Example**
......@@ -120,7 +122,7 @@ sharing.isSharing((error, data) => {
});
```
## sharing.isSharing
## sharing.isSharing<sup>9+</sup>
isSharing(): Promise\<boolean>
......@@ -143,8 +145,10 @@ Checks whether network sharing is in progress. This API uses a promise to return
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
| 2202011 | Cannot get network sharing configuration. |
**Example**
......@@ -156,7 +160,7 @@ sharing.isSharing().then(data => {
});
```
## sharing.startSharing
## sharing.startSharing<sup>9+</sup>
startSharing(type: SharingIfaceType, callback: AsyncCallback\<void>): void
......@@ -201,7 +205,7 @@ sharing.startSharing(SHARING_WIFI, (error) => {
});
```
## sharing.startSharing
## sharing.startSharing<sup>9+</sup>
startSharing(type: SharingIfaceType): Promise\<void>
......@@ -253,7 +257,7 @@ sharing.startSharing(SHARING_WIFI).then(() => {
});
```
## sharing.stopSharing
## sharing.stopSharing<sup>9+</sup>
stopSharing(type: SharingIfaceType, callback: AsyncCallback\<void>): void
......@@ -277,10 +281,12 @@ Stops network sharing of a specified type. This API uses an asynchronous callbac
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
| 2202004 | Try to share an unavailable iface. |
| 2202005 | WiFi sharing failed. |
| 2202006 | Bluetooth sharing failed. |
| 2202011 | Cannot get network sharing configuration. |
......@@ -296,7 +302,7 @@ sharing.stopSharing(SHARING_WIFI, (error) => {
});
```
## sharing.stopSharing
## sharing.stopSharing<sup>9+</sup>
stopSharing(type: SharingIfaceType): Promise\<void>
......@@ -325,10 +331,12 @@ Stops network sharing of a specified type. This API uses a promise to return the
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
| 2202004 | Try to share an unavailable iface. |
| 2202005 | WiFi sharing failed. |
| 2202006 | Bluetooth sharing failed. |
| 2202011 | Cannot get network sharing configuration. |
......@@ -346,7 +354,7 @@ sharing.stopSharing(SHARING_WIFI).then(() => {
});
```
## sharing.getStatsRxBytes
## sharing.getStatsRxBytes<sup>9+</sup>
getStatsRxBytes(callback: AsyncCallback\<number>): void
......@@ -381,7 +389,7 @@ sharing.getStatsRxBytes((error, data) => {
});
```
## sharing.getStatsRxBytes
## sharing.getStatsRxBytes<sup>9+</sup>
getStatsRxBytes(): Promise\<number>
......@@ -417,7 +425,7 @@ sharing.getStatsRxBytes().then(data => {
});
```
## sharing.getStatsTxBytes
## sharing.getStatsTxBytes<sup>9+</sup>
getStatsTxBytes(callback: AsyncCallback\<number>): void
......@@ -452,7 +460,7 @@ sharing.getStatsTxBytes((error, data) => {
});
```
## sharing.getStatsTxBytes
## sharing.getStatsTxBytes<sup>9+</sup>
getStatsTxBytes(): Promise\<number>
......@@ -488,7 +496,7 @@ sharing.getStatsTxBytes().then(data => {
});
```
## sharing.getStatsTotalBytes
## sharing.getStatsTotalBytes<sup>9+</sup>
getStatsTotalBytes(callback: AsyncCallback\<number>): void
......@@ -523,7 +531,7 @@ sharing.getStatsTotalBytes((error, data) => {
});
```
## sharing.getStatsTotalBytes
## sharing.getStatsTotalBytes<sup>9+</sup>
getStatsTotalBytes(): Promise\<number>
......@@ -559,7 +567,7 @@ sharing.getStatsTotalBytes().then(data => {
});
```
## sharing.getSharingIfaces
## sharing.getSharingIfaces<sup>9+</sup>
getSharingIfaces(state: SharingIfaceState, callback: AsyncCallback\<Array\<string>>): void
......@@ -600,7 +608,7 @@ sharing.getSharingIfaces(SHARING_BLUETOOTH, (error, data) => {
});
```
## sharing.getSharingIfaces
## sharing.getSharingIfaces<sup>9+</sup>
getSharingIfaces(state: SharingIfaceState): Promise\<Array\<string>>
......@@ -647,7 +655,7 @@ sharing.getSharingIfaces(SHARING_BLUETOOTH).then(data => {
});
```
## sharing.getSharingState
## sharing.getSharingState<sup>9+</sup>
getSharingState(type: SharingIfaceType, callback: AsyncCallback\<SharingIfaceState>): void
......@@ -688,7 +696,7 @@ sharing.getSharingState(SHARING_WIFI, (error, data) => {
});
```
## sharing.getSharingState
## sharing.getSharingState<sup>9+</sup>
getSharingState(type: SharingIfaceType): Promise\<SharingIfaceState>
......@@ -735,7 +743,7 @@ sharing.getSharingState(SHARING_WIFI).then(data => {
});
```
## sharing.getSharableRegexes
## sharing.getSharableRegexes<sup>9+</sup>
getSharableRegexes(type: SharingIfaceType, callback: AsyncCallback\<Array\<string>>): void
......@@ -776,7 +784,7 @@ sharing.getSharableRegexes(SHARING_WIFI, (error, data) => {
});
```
## sharing.getSharableRegexes
## sharing.getSharableRegexes<sup>9+</sup>
getSharableRegexes(type: SharingIfaceType): Promise\<Array\<string>>
......@@ -823,7 +831,7 @@ sharing.getSharableRegexes(SHARING_WIFI).then(data => {
});
```
## sharing.on('sharingStateChange')
## sharing.on('sharingStateChange')<sup>9+</sup>
on(type: 'sharingStateChange', callback: Callback\<boolean>): void
......@@ -846,8 +854,7 @@ Subscribes to network sharing state changes. This API uses an asynchronous callb
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 202 | Non-system applications use system APIs. |
**Example**
......@@ -857,7 +864,7 @@ sharing.on('sharingStateChange', (data) => {
});
```
## sharing.off('sharingStateChange')
## sharing.off('sharingStateChange')<sup>9+</sup>
off(type: 'sharingStateChange', callback?: Callback\<boolean>): void
......@@ -880,8 +887,7 @@ Unsubscribes from network sharing state changes. This API uses an asynchronous c
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 202 | Non-system applications use system APIs. |
**Example**
......@@ -891,7 +897,7 @@ sharing.off('sharingStateChange', (data) => {
});
```
## sharing.on('interfaceSharingStateChange')
## sharing.on('interfaceSharingStateChange')<sup>9+</sup>
on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIfaceType, iface: string, state:
SharingIfaceState }>): void
......@@ -915,8 +921,7 @@ Subscribes to network sharing state changes of a specified NIC. This API uses an
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 202 | Non-system applications use system APIs. |
**Example**
......@@ -926,7 +931,7 @@ sharing.on('interfaceSharingStateChange', (data) => {
});
```
## sharing.off('interfaceSharingStateChange')
## sharing.off('interfaceSharingStateChange')<sup>9+</sup>
off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfaceType, iface: string, state:
SharingIfaceState }>): void
......@@ -950,8 +955,7 @@ Unsubscribes from network sharing status changes of a specified NIC. This API us
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 202 | Non-system applications use system APIs. |
**Example**
......@@ -961,7 +965,7 @@ sharing.off('interfaceSharingStateChange', (data) => {
});
```
## sharing.on('sharingUpstreamChange')
## sharing.on('sharingUpstreamChange')<sup>9+</sup>
on(type: 'sharingUpstreamChange', callback: Callback\<NetHandle>): void
......@@ -984,8 +988,7 @@ Subscribes to upstream network changes. This API uses an asynchronous callback t
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 202 | Non-system applications use system APIs. |
**Example**
......@@ -995,7 +998,7 @@ sharing.on('sharingUpstreamChange', (data) => {
});
```
## sharing.off('sharingUpstreamChange')
## sharing.off('sharingUpstreamChange')<sup>9+</sup>
off(type: 'sharingUpstreamChange', callback?: Callback\<NetHandle>): void
......@@ -1018,8 +1021,7 @@ Unsubscribes from upstream network changes. This API uses an asynchronous callba
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 202 | Non-system applications use system APIs. |
**Example**
......@@ -1029,7 +1031,7 @@ sharing.off('sharingUpstreamChange', (data) => {
});
```
## SharingIfaceState
## SharingIfaceState<sup>9+</sup>
Enumerates the network sharing states of an NIC.
......@@ -1043,7 +1045,7 @@ Enumerates the network sharing states of an NIC.
| SHARING_NIC_CAN_SERVER | 2 | Network sharing is supported.|
| SHARING_NIC_ERROR | 3 | An error occurred during network sharing.|
## SharingIfaceType
## SharingIfaceType<sup>9+</sup>
Enumerates the network sharing types of an NIC.
......
......@@ -15,7 +15,7 @@ import observer from '@ohos.telephony.observer';
## observer.on('networkStateChange')
on\(type: \'networkStateChange\', callback: Callback<NetworkState\>\): void;
on\(type: \'networkStateChange\', callback: Callback\<NetworkState\>\): void;
Registers an observer for network status change events. This API uses an asynchronous callback to return the execution result.
......@@ -54,7 +54,7 @@ observer.on('networkStateChange', data => {
## observer.on('networkStateChange')
on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callback<NetworkState\>\): void;
on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callback\<NetworkState\>\): void;
Registers an observer for network status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
......@@ -94,7 +94,7 @@ observer.on('networkStateChange', {slotId: 0}, data => {
## observer.off('networkStateChange')
off\(type: \'networkStateChange\', callback?: Callback<NetworkState\>\): void;
off\(type: \'networkStateChange\', callback?: Callback\<NetworkState\>\): void;
Unregisters the observer for network status change events. This API uses an asynchronous callback to return the execution result.
......@@ -111,6 +111,10 @@ Unregisters the observer for network status change events. This API uses an asyn
| type | string | Yes | Network status change event. This field has a fixed value of **networkStateChange**. |
| callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | No | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
......@@ -133,7 +137,7 @@ observer.off('networkStateChange');
## observer.on('signalInfoChange')
on\(type: \'signalInfoChange\', callback: Callback<Array<SignalInformation\>\>): void;
on\(type: \'signalInfoChange\', callback: Callback\<Array\<SignalInformation\>\>): void;
Registers an observer for signal status change events. This API uses an asynchronous callback to return the execution result.
......@@ -144,7 +148,7 @@ Registers an observer for signal status change events. This API uses an asynchro
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- |
| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. |
| callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
| callback | Callback\<Array\<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
**Error codes**
......@@ -152,7 +156,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
......@@ -170,7 +173,7 @@ observer.on('signalInfoChange', data => {
## observer.on('signalInfoChange')
on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback<Array<SignalInformation\>\>): void;
on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback\<Array\<SignalInformation\>\>): void;
Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
......@@ -182,7 +185,7 @@ Registers an observer for signal status change events of the SIM card in the spe
| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- |
| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
| callback | Callback\<Array\<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
**Error codes**
......@@ -190,7 +193,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
......@@ -208,7 +210,7 @@ observer.on('signalInfoChange', {slotId: 0}, data => {
## observer.off('signalInfoChange')
off\(type: \'signalInfoChange\', callback?: Callback<Array<SignalInformation\>\>): void;
off\(type: \'signalInfoChange\', callback?: Callback\<Array\<SignalInformation\>\>): void;
Unregisters the observer for signal status change events. This API uses an asynchronous callback to return the execution result.
......@@ -223,7 +225,7 @@ Unregisters the observer for signal status change events. This API uses an async
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. |
| callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | No | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
| callback | Callback\<Array\<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | No | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
**Error codes**
......@@ -251,7 +253,7 @@ observer.off('signalInfoChange');
## observer.on('cellInfoChange')<sup>8+</sup>
on\(type: \'cellInfoChange\', callback: Callback<CellInformation\>\): void;
on\(type: \'cellInfoChange\', callback: Callback\<Array\<CellInformation\>\>\): void;
Registers an observer for cell information change events. This API uses an asynchronous callback to return the result.
......@@ -264,15 +266,18 @@ Registers an observer for cell information change events. This API uses an async
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------------- | ---- |------------------------------------------------------------|
| type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**. |
| callback | Callback\<[CellInformation](js-apis-radio.md#cellinformation8)\> | Yes | Callback used to return the result.|
| -------- | --------------------------------------------------------- | ---- |------------------------------------------|
| type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**.|
| callback | Callback\<Array\<[CellInformation](js-apis-radio.md#cellinformation8)\>\> | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
......@@ -290,7 +295,7 @@ observer.on('cellInfoChange', data => {
## observer.on('cellInfoChange')<sup>8+</sup>
on\(type: \'cellInfoChange\', options: { slotId: number }, callback: Callback<CellInformation\>\): void;
on\(type: \'cellInfoChange\', options: { slotId: number }, callback: Callback\<Array\<CellInformation\>\>\): void;
Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
......@@ -303,16 +308,19 @@ Registers an observer for signal status change events of the SIM card in the spe
**Parameters**
| Name| Type | Mandatory| Description |
| ------ |--------------------------------------------------| ---- |------------------------------------------------------------|
| type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**. |
| ------ |--------------------------------------------------| ---- |--------------------------------------------|
| type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**.|
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | Callback\<[CellInformation](js-apis-radio.md#cellinformation8)\> | Yes | Callback used to return the result.|
| callback | Callback\<Array\<[CellInformation](js-apis-radio.md#cellinformation8)\>\> | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
......@@ -330,7 +338,7 @@ observer.on('cellInfoChange', {slotId: 0}, data => {
## observer.off('cellInfoChange')<sup>8+</sup>
off\(type: \'cellInfoChange\', callback?: Callback<CellInformation\>\): void;
off\(type: \'cellInfoChange\', callback?: Callback\<Array\<CellInformation\>\>\): void;
Unregisters the observer for cell information change events. This API uses an asynchronous callback to return the result.
......@@ -347,10 +355,15 @@ Unregisters the observer for cell information change events. This API uses an as
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**. |
| callback | Callback\<[CellInformation](js-apis-radio.md#cellinformation8)\> | No | Callback used to return the result.|
| callback | Callback\<Array\<[CellInformation](js-apis-radio.md#cellinformation8)\>\> | No | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
......
# @ohos.power (Power Manager)
# @ohos.power (Power Management)
The **power** module provides APIs for rebooting and shutting down the system, as well as querying the screen status.
......@@ -36,7 +36,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes
| ID | Error Message |
|---------|---------|
| 4900101 | Operation failed. Cannot connect to service.|
| 4900101 | If connecting to the service failed. |
**Example**
......@@ -72,7 +72,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes
| ID | Error Message |
|---------|---------|
| 4900101 | Operation failed. Cannot connect to service.|
| 4900101 | If connecting to the service failed. |
**Example**
......@@ -98,7 +98,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes
| ID | Error Message |
|---------|---------|
| 4900101 | Operation failed. Cannot connect to service.|
| 4900101 | If connecting to the service failed. |
**Example**
......@@ -133,7 +133,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes
| ID | Error Message |
|---------|---------|
| 4900101 | Operation failed. Cannot connect to service.|
| 4900101 | If connecting to the service failed. |
**Example**
......@@ -161,7 +161,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes
| ID | Error Message |
|---------|---------|
| 4900101 | Operation failed. Cannot connect to service.|
| 4900101 | If connecting to the service failed. |
**Example**
......@@ -193,7 +193,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes
| ID | Error Message |
|---------|---------|
| 4900101 | Operation failed. Cannot connect to service.|
| 4900101 | If connecting to the service failed. |
**Example**
......@@ -231,7 +231,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes
| ID | Error Message |
|---------|---------|
| 4900101 | Operation failed. Cannot connect to service.|
| 4900101 | If connecting to the service failed. |
**Example**
......@@ -275,7 +275,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes
| ID | Error Message |
|---------|---------|
| 4900101 | Operation failed. Cannot connect to service.|
| 4900101 | If connecting to the service failed. |
**Example**
......
# @ohos.runningLock (Runninglock)
# @ohos.runningLock (Running Lock)
The **runningLock** module provides APIs for creating, querying, holding, and releasing running locks.
> **NOTE**<br>
> **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
......@@ -15,7 +16,7 @@ import runningLock from '@ohos.runningLock';
isSupported(type: RunningLockType): boolean;
Checks whether a specified type of **RunningLock** is supported.
Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result.
**System capability:** SystemCapability.PowerManager.PowerManager.Core
......@@ -25,7 +26,7 @@ Checks whether a specified type of **RunningLock** is supported.
| ------ | ----------------------------------- | ---- | -------------------- |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object.|
**Return value**
**Return Value**
| Type | Description |
| ------- | --------------------------------------- |
......@@ -35,9 +36,9 @@ Checks whether a specified type of **RunningLock** is supported.
For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md).
| Code | Error Message |
| ID | Error Message |
|---------|---------|
| 4900101 | Operation failed. Cannot connect to service.|
| 4900101 | If connecting to the service failed. |
**Example**
......@@ -72,9 +73,9 @@ Creates a **RunningLock** object.
For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md).
| Code | Error Message |
| ID | Error Message |
|---------|----------|
| 4900101 | Operation failed. Cannot connect to service.|
| 4900101 | If connecting to the service failed. |
**Example**
......@@ -105,7 +106,7 @@ Creates a **RunningLock** object.
| name | string | Yes | Name of the **RunningLock** object. |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created.|
**Return value**
**Return Value**
| Type | Description |
| ------------------------------------------ | ------------------------------------ |
......@@ -115,9 +116,9 @@ Creates a **RunningLock** object.
For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md).
| Code | Error Message |
| ID | Error Message |
|---------|----------|
| 4900101 | Operation failed. Cannot connect to service.|
| 4900101 | If connecting to the service failed. |
**Example**
......@@ -135,10 +136,9 @@ runningLock.create('running_lock_test', runningLock.RunningLockType.BACKGROUND)
isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback&lt;boolean&gt;): void
> NOTE<br>
> This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9) instead.
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9).
Checks whether a specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result.
Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result. This API uses an asynchronous callback to return the result.
**System capability:** SystemCapability.PowerManager.PowerManager.Core
......@@ -147,7 +147,7 @@ Checks whether a specified type of **RunningLock** is supported. This API uses a
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------- | ---- | ------------------------------------------------------------ |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the query result obtained, where the value **true** indicates that **RunningLock** is supported and **false** indicates the opposite. Otherwise, **err** is an error object.|
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the query result obtained, where the value **true** indicates that the specified type of **RunningLock** is supported and **false** indicates the opposite. Otherwise, **err** is an error object.|
**Example**
......@@ -165,10 +165,9 @@ runningLock.isRunningLockTypeSupported(runningLock.RunningLockType.BACKGROUND, (
isRunningLockTypeSupported(type: RunningLockType): Promise&lt;boolean>
> NOTE<br>
> This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9) instead.
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9).
Checks whether a specified type of **RunningLock** is supported. This API uses a promise to return the result.
Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result. This API uses a promise to return the result.
**System capability:** SystemCapability.PowerManager.PowerManager.Core
......@@ -178,7 +177,7 @@ Checks whether a specified type of **RunningLock** is supported. This API uses a
| ------ | ----------------------------------- | ---- | -------------------- |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object.|
**Return value**
**Return Value**
| Type | Description |
| ---------------------- | ---------------------------------------------------- |
......@@ -200,8 +199,7 @@ runningLock.isRunningLockTypeSupported(runningLock.RunningLockType.BACKGROUND)
createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback&lt;RunningLock&gt;): void
> NOTE<br>
> This API is deprecated since API version 9. You are advised to use [runningLock.create](#runninglockcreate9) instead.
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [runningLock.create](#runninglockcreate9).
Creates a **RunningLock** object.
......@@ -233,8 +231,7 @@ runningLock.createRunningLock('running_lock_test', runningLock.RunningLockType.B
createRunningLock(name: string, type: RunningLockType): Promise&lt;RunningLock&gt;
> NOTE<br>
> This API is deprecated since API version 9. You are advised to use [runningLock.create](#runninglockcreate9) instead.
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [runningLock.create](#runninglockcreate9).
Creates a **RunningLock** object.
......@@ -249,7 +246,7 @@ Creates a **RunningLock** object.
| name | string | Yes | Name of the **RunningLock** object. |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created.|
**Return value**
**Return Value**
| Type | Description |
| ------------------------------------------ | ------------------------------------ |
......@@ -269,7 +266,7 @@ runningLock.createRunningLock('running_lock_test', runningLock.RunningLockType.B
## RunningLock
Represents a **RunningLock** object.
Defines a **RunningLock** object.
### hold<sup>9+</sup>
......@@ -291,9 +288,9 @@ Locks and holds a **RunningLock** object.
For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md).
| Code | Error Message |
| ID | Error Message |
|---------|----------|
| 4900101 | Operation failed. Cannot connect to service.|
| 4900101 | If connecting to the service failed. |
**Example**
......@@ -327,9 +324,9 @@ Releases a **RunningLock** object.
For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md).
| Code | Error Message |
| ID | Error Message |
|---------|----------|
| 4900101 | Operation failed. Cannot connect to service.|
| 4900101 | If connecting to the service failed. |
**Example**
......@@ -357,7 +354,7 @@ Checks the hold status of the **Runninglock** object.
**System capability:** SystemCapability.PowerManager.PowerManager.Core
**Return value**
**Return Value**
| Type | Description |
| ------- | ------------------------------------------------------------ |
......@@ -367,9 +364,9 @@ Checks the hold status of the **Runninglock** object.
For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md).
| Code | Error Message |
| ID | Error Message |
|---------|---------|
| 4900101 | Operation failed. Cannot connect to service.|
| 4900101 | If connecting to the service failed. |
**Example**
......@@ -393,8 +390,7 @@ runningLock.create('running_lock_test', runningLock.RunningLockType.BACKGROUND)
lock(timeout: number): void
> NOTE<br>
> This API is deprecated since API version 9. You are advised to use [RunningLock.hold](#hold9) instead.
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [RunningLock.hold](#hold9).
Locks and holds a **RunningLock** object.
......@@ -425,8 +421,7 @@ runningLock.createRunningLock('running_lock_test', runningLock.RunningLockType.B
unlock(): void
> NOTE<br>
> This API is deprecated since API version 9. You are advised to use [RunningLock.unhold](#unhold9) instead.
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [RunningLock.unhold](#unhold9).
Releases a **RunningLock** object.
......@@ -451,14 +446,13 @@ runningLock.createRunningLock('running_lock_test', runningLock.RunningLockType.B
isUsed(): boolean
> NOTE<br>
> This API is deprecated since API version 9. You are advised to use [RunningLock.isHolding](#isholding9) instead.
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [RunningLock.isHolding](#isholding9).
Checks the hold status of the **Runninglock** object.
**System capability:** SystemCapability.PowerManager.PowerManager.Core
**Return value**
**Return Value**
| Type | Description |
| ------- | ------------------------------------------------------------ |
| boolean | The value **true** indicates that the **Runninglock** object is held; and the value **false** indicates that the **Runninglock** object is released.|
......
......@@ -16,7 +16,48 @@ import fetch from '@system.fetch';
## fetch.fetch<sup>3+</sup>
fetch(Object): void
fetch(options:{
/**
* Resource URL.
* @since 3
*/
url: string;
/**
* Request parameter, which can be of the string type or a JSON object.
* @since 3
*/
data?: string | object;
/**
* Request header, which accommodates all attributes of the request.
* @since 3
*/
header?: Object;
/**
* Request methods available: OPTIONS, GET, HEAD, POST, PUT, DELETE and TRACE. The default value is GET.
* @since 3
*/
method?: string;
/**
* The return type can be text, or JSON. By default, the return type is determined based on Content-Type in the header returned by the server.
* @since 3
*/
responseType?: string;
/**
* Called when the network data is obtained successfully.
* @since 3
*/
success?: (data: FetchResponse) => void;
/**
* Called when the network data fails to be obtained.
* @since 3
*/
fail?: (data: any, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
} ): void
Obtains data through a network.
......@@ -43,7 +84,9 @@ Obtains data through a network.
| Object | Not set| The default value of **Content-Type** is **application/x-www-form-urlencoded**. The **data** value is encoded based on the URL rule and appended in the request body.|
| Object | application/x-www-form-urlencoded | The value of data is encoded based on the URL rule and is used as the request body.|
## FetchResponse
## FetchResponse<sup>3+</sup>
**System capability**: SystemCapability.Communication.NetStack
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
......
......@@ -21,9 +21,25 @@ ohos.permission.GET_WIFI_INFO
ohos.permission.GET_NETWORK_INFO
## network.getType
getType(Object): void
## network.getType<sup>3+</sup>
getType(options?: {
/**
* Called when the network type is obtained.
* @since 3
*/
success?: (data: NetworkResponse) => void;
/**
* Called when the network type fails to be obtained.
* @since 3
*/
fail?: (data: any, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
}): void
Obtains the network type.
......@@ -61,9 +77,20 @@ export default {
```
## network.subscribe
## network.subscribe<sup>3+</sup>
subscribe(Object): void
subscribe(options?:{
/**
* Called when the network connection state changes.
* @since 3
*/
success?: (data: NetworkResponse) => void;
/**
* Called when the listening fails.
* @since 3
*/
fail?: (data: any, code: number) => void;
}): void
Listens to the network connection state. If this method is called multiple times, the last call takes effect.
......@@ -101,7 +128,7 @@ export default {
```
## network.unsubscribe
## network.unsubscribe<sup>3+</sup>
unsubscribe(): void
......@@ -120,7 +147,7 @@ export default {
```
## NetworkResponse
## NetworkResponse<sup>3+</sup>
**System capability**: SystemCapability.Communication.NetManager.Core
......
......@@ -2,7 +2,8 @@
The **thermal** module provides thermal level-related callback and query APIs to obtain the information required for thermal control.
> **NOTE**<br>
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
......@@ -29,9 +30,9 @@ Subscribes to thermal level changes.
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
| Code | Error Message |
| ID | Error Message |
|---------|---------|
| 4800101 | Operation failed. Cannot connect to service.|
| 4800101 | If connecting to the service failed. |
**Example**
......@@ -58,15 +59,15 @@ Unsubscribes from thermal level changes.
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ---------------------------------------------- |
| callback | Callback&lt;void&gt; | No | Callback used to return the result. No value is returned. If this parameter is not set, this API unsubscribes from all callbacks.|
| callback | Callback&lt;void&gt; | No | Callback that returns no value. If this parameter is not set, this API unsubscribes from all callbacks.|
**Error codes**
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
| Code | Error Message |
| ID | Error Message |
|---------|---------|
| 4800101 | Operation failed. Cannot connect to service.|
| 4800101 | If connecting to the service failed. |
**Example**
......@@ -93,15 +94,15 @@ Obtains the current thermal level.
| Type | Description |
| ------------ | ------------ |
| ThermalLevel | Thermal level obtained.|
| ThermalLevel | Thermal level.|
**Error codes**
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
| Code | Error Message |
| ID | Error Message |
|---------|---------|
| 4800101 | Operation failed. Cannot connect to service.|
| 4800101 | If connecting to the service failed. |
**Example**
......@@ -118,8 +119,7 @@ try {
subscribeThermalLevel(callback: AsyncCallback&lt;ThermalLevel&gt;): void
> NOTE<br>
> This API is deprecated since API version 9. You are advised to use [thermal.registerThermalLevelCallback](#thermalregisterthermallevelcallback9) instead.
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [thermal.registerThermalLevelCallback](#thermalregisterthermallevelcallback9).
Subscribes to thermal level changes.
......@@ -143,8 +143,7 @@ thermal.subscribeThermalLevel((level) => {
unsubscribeThermalLevel(callback?: AsyncCallback\<void>): void
> NOTE<br>
> This API is deprecated since API version 9. You are advised to use [thermal.unregisterThermalLevelCallback](#thermalunregisterthermallevelcallback9) instead.
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [thermal.unregisterThermalLevelCallback](#thermalunregisterthermallevelcallback9).
Unsubscribes from thermal level changes.
......@@ -154,7 +153,7 @@ Unsubscribes from thermal level changes.
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------------------------------------------- |
| callback | AsyncCallback&lt;void&gt; | No | Callback used to return the result. No value is returned. If this parameter is not set, this API unsubscribes from all callbacks.|
| callback | AsyncCallback&lt;void&gt; | No | Callback that returns no value. If this parameter is not set, this API unsubscribes from all callbacks.|
**Example**
......@@ -168,8 +167,7 @@ thermal.unsubscribeThermalLevel(() => {
getThermalLevel(): ThermalLevel
> NOTE<br>
> This API is deprecated since API version 9. You are advised to use [thermal.getLevel](#thermalgetlevel9) instead.
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [thermal.getLevel](#thermalgetlevel9).
Obtains the current thermal level.
......
# Screen Hopping Error Codes
> **NOTE**
>
> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md).
## 20900001 Input Device Operation Failed
**Error Message**
Failed to operate the input device.
**Description**
This error code is reported if the screen hopping status is abnormal when the screen hopping API is called.
**Possible Cause**
1. When screen hopping is initiated, the local device is in the hopped state.
2. When screen hopping is disabled, the local device is in the free state.
3. When screen hopping is disabled, the local device is in the hopping state.
**Procedure**
1. When initiating screen hopping, make sure that the local device is not in the hopped state.
2. When disabling screen hopping, make sure that the local device is not in the free state.
3. When disabling screen hopping, make sure that the local device is not in the hopping state.
......@@ -115,7 +115,7 @@ The procedure is as follows:
hidumper -s 3008
```
9. Run the **hidumper -e** command to obtain the crash information generated by the FaultLoger module.
9. Run the **hidumper -e** command to obtain the crash information generated by the FaultLogger module.
```
hidumper -e
......@@ -163,6 +163,22 @@ The procedure is as follows:
```
hidumper --mem [pid]
```
The following table describes the parameters in the first column of the command output when the PID of the process is specified.
| Name | Description|
|----------------|----|
| GL | GPU memory. |
| Graph | Graphics memory. |
| ark ts heap | Memory usage of the ArkTS heap. |
| guard | Memory occupied by the protection section. |
| native heap | Heap memory. |
| AnonPage other | Memory occupied by other pages that are not mapped to files. |
| stack | Stack memory. |
| .hap | Memory occupied by the application. |
| .db | Memory occupied by the **.db** files loaded by processes. |
| .so | Memory occupied by the **.so** dynamic library files loaded by processes. |
| .ttf | Memory occupied by the **.ttf** font files loaded by processes. |
| dev | Memory occupied by the files that are named with the **/dev** prefix and loaded by processes. |
| FilePage other | Memory occupied by other pages that are mapped to files. |
17. Run the **hidumper --zip** command to compress data to the **/data/dumper** directory.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册