提交 b7ee0a08 编写于 作者: S shawn_he

update doc

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 24bb8ec5
# DFX
- Application Event Logging
- [Development of Application Event Logging](hiappevent-guidelines.md)
- Distributed Call Chain Tracing
- [Development of Distributed Call Chain Tracing](hitracechain-guidelines.md)
- HiLog
- [HiLog Development](hilog-guidelines.md)
- Performance Tracing
- [Development of Performance Tracing](hitracemeter-guidelines.md)
- [Development of Application Event Logging](hiappevent-guidelines.md)
- [Development of Performance Tracing](hitracemeter-guidelines.md)
- [Development of Distributed Call Chain Tracing](hitracechain-guidelines.md)
- [HiLog Development (Native)](hilog-guidelines.md)
- Error Management
- [Development of Error Manager](errormanager-guidelines.md)
- [Development of Application Recovery](apprecovery-guidelines.md)
- [Development of Application Recovery](apprecovery-guidelines.md)
\ No newline at end of file
......@@ -12,11 +12,11 @@ Application error management APIs are provided by the **errorManager** module. F
| API | Description |
| ------------------------------------------------------------ | ---------------------------------------------------- |
| registerErrorObserver(observer: ErrorObserver): number | Registers an observer for application errors. A callback will be invoked when an application error is detected. This API works in a synchronous manner. The return value is the SN of the registered observer.|
| unregisterErrorObserver(observerId: number, callback: AsyncCallback\<void\>): void | Unregisters an observer in callback mode. The number passed to this API is the SN of the registered observer. |
| unregisterErrorObserver(observerId: number): Promise\<void\> | Unregisters an observer in promise mode. The number passed to this API is the SN of the registered observer. |
| on(type: "error", observer: ErrorObserver): number | Registers an observer for application errors. A callback will be invoked when an application error is detected. This API works in a synchronous manner. The return value is the SN of the registered observer.|
| off(type: "error", observerId: number, callback: AsyncCallback\<void\>): void | Unregisters an observer in callback mode. The number passed to this API is the SN of the registered observer. |
| off(type: "error", observerId: number): Promise\<void\> | Unregisters an observer in promise mode. The number passed to this API is the SN of the registered observer. |
When an asynchronous callback is used, the return value can be processed directly in the callback. If a promise is used, the return value can also be processed in the promise in a similar way. For details about the result codes, see [Result Codes for Unregistering an Observer](#result-codes-for-unregistering-an-observer).
When an asynchronous callback is used, the return value can be processed directly in the callback. If a promise is used, the return value can also be processed in the promise in a similar way. For details about the result codes, see [Result Codes for Unregistering an Observer](#result codes-for-unregistering-an-observer).
**Table 2** Description of the ErrorObserver API
......@@ -45,7 +45,8 @@ let callback = {
console.log(errMsg);
}
}
export default class EntryAbility extends Ability {
export default class EntryAbility extends UIAbility {
onCreate(want, launchParam) {
console.log("[Demo] EntryAbility onCreate")
registerId = errorManager.on("error", callback);
......
......@@ -782,12 +782,12 @@ For details about the following error codes, see [Location Error Codes](../error
{
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
action: "action1",
action: "action1"
}
],
operationType: wantAgent.OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG],
wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG]
};
wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
......
......@@ -411,7 +411,7 @@ Registers a listener for status change events of the specified geofence.
{
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
action: "action1",
action: "action1"
}
],
operationType: wantAgent.OperationType.START_ABILITY,
......
......@@ -13,14 +13,15 @@ The Resource Manager module provides APIs to obtain information about applicatio
import resourceManager from '@ohos.resourceManager';
```
## Instruction
## How to Use
Since API version 9, the stage model allows an application to obtain a **ResourceManager** object based on **context** and call its resource management APIs without first importing the required bundle. This approach, however, is not applicable to the FA model.
For details about how to reference **context** in the stage model, see [Context in the Stage Model](../../application-models/application-context-stage.md).
Since API version 9, the stage model allows an application to obtain a **ResourceManager** object based on **context** and call its resource management APIs without first importing the required bundle. This approach, however, is not applicable to the FA model. For the FA model, you need to import the required bundle and then call the [getResourceManager](#resourcemanagergetresourcemanager) API to obtain a **ResourceManager** object.
For details about how to reference context in the stage model, see [Context in the Stage Model](../../application-models/application-context-stage.md).
```ts
import Ability from '@ohos.application.Ability';
class MainAbility extends Ability {
import UIAbility from '@ohos.app.ability.UIAbility';
export default class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
let context = this.context;
let resourceManager = context.resourceManager;
......@@ -60,6 +61,7 @@ Obtains the **ResourceManager** object of this application. This API uses an asy
});
});
```
> **NOTE**<br>In the sample code, **0x1000000** indicates the resource ID, which can be found in the compiled **ResourceTable.txt** file.
## resourceManager.getResourceManager
......@@ -76,7 +78,7 @@ Obtains the **ResourceManager** object of an application based on the specified
| Name | Type | Mandatory | Description |
| ---------- | ---------------------------------------- | ---- | ----------------------------- |
| bundleName | string | Yes | Bundle name of the application. |
| bundleName | string | Yes | Bundle name of the target application. |
| callback | AsyncCallback&lt;[ResourceManager](#resourcemanager)&gt; | Yes | Callback used to return the result.|
**Example**
......@@ -116,6 +118,7 @@ Obtains the **ResourceManager** object of this application. This API uses a prom
console.log("error is " + error);
});
```
> **NOTE**<br>> In the sample code, **0x1000000** indicates the resource ID, which can be found in the compiled **ResourceTable.txt** file.
## resourceManager.getResourceManager
......@@ -132,7 +135,7 @@ Obtains the **ResourceManager** object of an application based on the specified
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------- |
| bundleName | string | Yes | Bundle name of the application.|
| bundleName | string | Yes | Bundle name of the target application.|
**Return value**
......@@ -168,12 +171,12 @@ Enumerates the device types.
| Name | Value | Description |
| -------------------- | ---- | ---- |
| DEVICE_TYPE_PHONE | 0x00 | Phone |
| DEVICE_TYPE_TABLET | 0x01 | Tablet |
| DEVICE_TYPE_CAR | 0x02 | Head unit |
| DEVICE_TYPE_PC | 0x03 | PC |
| DEVICE_TYPE_TV | 0x04 | TV |
| DEVICE_TYPE_WEARABLE | 0x06 | Wearable |
| DEVICE_TYPE_PHONE | 0x00 | Phone. |
| DEVICE_TYPE_TABLET | 0x01 | Tablet. |
| DEVICE_TYPE_CAR | 0x02 | Head unit. |
| DEVICE_TYPE_PC | 0x03 | PC. |
| DEVICE_TYPE_TV | 0x04 | TV. |
| DEVICE_TYPE_WEARABLE | 0x06 | Wearable. |
## ScreenDensity
......@@ -275,7 +278,7 @@ Defines the capability of accessing application resources.
> **NOTE**
>
> - The APIs involved in **ResourceManager** are applicable only to the TypeScript-based declarative development paradigm.
> - The methods involved in **ResourceManager** are applicable only to the TypeScript-based declarative development paradigm.
>
> - Resource files are defined in the **resources** directory of the project. You can obtain the resource ID using **$r(resource address).id**, for example, **$r('app.string.test').id**.
......@@ -642,7 +645,7 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco
getMediaContent(resId: number, callback: AsyncCallback&lt;Uint8Array&gt;): void
Obtains the content of the media file corresponding to the specified resource ID. This API uses an asynchronous callback to return the result.
Obtains the content of the media file corresponding to the specified resource name. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Global.ResourceManager
......@@ -1655,7 +1658,7 @@ Obtains the string corresponding to the specified resource name. This API uses a
| Type | Description |
| --------------------- | ---------- |
| Promise&lt;string&gt; | String corresponding to the resource name.|
| Promise&lt;string&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
......@@ -2033,7 +2036,7 @@ Obtains the string corresponding to the specified resource ID. This API returns
| Type | Description |
| ------ | ----------- |
| string | Promise used to return the result.|
| string | String corresponding to the specified resource ID.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
......@@ -2072,7 +2075,7 @@ Obtains the string corresponding to the specified resource object. This API retu
| Type | Description |
| ------ | ---------------- |
| string | Promise used to return the result.|
| string | String corresponding to the resource object.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
......@@ -2116,7 +2119,7 @@ Obtains the string corresponding to the specified resource name. This API return
| Type | Description |
| ------ | ---------- |
| string | String corresponding to the specified resource name.|
| string | String corresponding to the resource name.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
......@@ -2527,7 +2530,7 @@ This API is deprecated since API version 9. You are advised to use [getStringArr
getMedia(resId: number, callback: AsyncCallback&lt;Uint8Array&gt;): void
Obtains the content of the media file corresponding to the specified resource ID. This API uses an asynchronous callback to return the result.
Obtains the content of the media file corresponding to the specified resource name. This API uses an asynchronous callback to return the result.
This API is deprecated since API version 9. You are advised to use [getMediaContent](#getmediacontent9) instead.
......
......@@ -12,7 +12,7 @@ import socket from '@ohos.net.socket';
## socket.constructUDPSocketInstance
constructUDPSocketInstance\(\): UDPSocket
constructUDPSocketInstance(): UDPSocket
Creates a **UDPSocket** object.
......@@ -38,7 +38,7 @@ Defines a **UDPSocket** connection. Before invoking UDPSocket APIs, you need to
### bind
bind\(address: NetAddress, callback: AsyncCallback<void\>\): void
bind(address: NetAddress, callback: AsyncCallback\<void\>): void
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses an asynchronous callback to return the result.
......@@ -76,7 +76,7 @@ udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => {
### bind
bind\(address: NetAddress\): Promise<void\>
bind(address: NetAddress): Promise\<void\>
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses a promise to return the result.
......@@ -118,7 +118,7 @@ promise .then(() => {
### send
send\(options: UDPSendOptions, callback: AsyncCallback<void\>\): void
send(options: UDPSendOptions, callback: AsyncCallback\<void\>): void
Sends data over a UDPSocket connection. This API uses an asynchronous callback to return the result.
......@@ -165,7 +165,7 @@ udp.send({
### send
send\(options: UDPSendOptions\): Promise<void\>
send(options: UDPSendOptions): Promise\<void\>
Sends data over a UDPSocket connection. This API uses a promise to return the result.
......@@ -216,7 +216,7 @@ promise.then(() => {
### close
close\(callback: AsyncCallback<void\>\): void
close(callback: AsyncCallback\<void\>): void
Closes a UDPSocket connection. This API uses an asynchronous callback to return the result.
......@@ -246,7 +246,7 @@ udp.close(err => {
### close
close\(\): Promise<void\>
close(): Promise\<void\>
Closes a UDPSocket connection. This API uses a promise to return the result.
......@@ -275,12 +275,12 @@ promise.then(() => {
### getState
getState\(callback: AsyncCallback<SocketStateBase\>\): void
getState(callback: AsyncCallback\<SocketStateBase\>): void
Obtains the status of the UDPSocket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>This API can be called only after [bind](#bind) is successfully called.
>This API can be called only after **bind** is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -321,12 +321,12 @@ udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => {
### getState
getState\(\): Promise<SocketStateBase\>
getState(): Promise\<SocketStateBase\>
Obtains the status of the UDPSocket connection. This API uses a promise to return the result.
>**NOTE**
>This API can be called only after [bind](#bind) is successfully called.
>This API can be called only after **bind** is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -336,7 +336,7 @@ Obtains the status of the UDPSocket connection. This API uses a promise to retur
| Type | Description |
| :----------------------------------------------- | :----------------------------------------- |
| Promise<[SocketStateBase](#socketstatebase)> | Promise used to return the result.|
| Promise\<[SocketStateBase](#socketstatebase)\> | Promise used to return the result.|
**Example**
......@@ -360,12 +360,12 @@ udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => {
### setExtraOptions
setExtraOptions\(options: UDPExtraOptions, callback: AsyncCallback<void\>\): void
setExtraOptions(options: UDPExtraOptions, callback: AsyncCallback\<void\>): void
Sets other attributes of the UDPSocket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>This API can be called only after [bind](#bind) is successfully called.
>This API can be called only after **bind** is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -414,12 +414,12 @@ udp.bind({address:'192.168.xx.xxx', port:xxxx, family:1}, err=> {
### setExtraOptions
setExtraOptions\(options: UDPExtraOptions\): Promise<void\>
setExtraOptions(options: UDPExtraOptions): Promise\<void\>
Sets other attributes of the UDPSocket connection. This API uses a promise to return the result.
>**NOTE**
>This API can be called only after [bind](#bind) is successfully called.
>This API can be called only after **bind** is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -469,9 +469,9 @@ promise.then(() => {
```
### on\('message'\)
### on('message')
on\(type: 'message', callback: Callback<\{message: ArrayBuffer, remoteInfo: SocketRemoteInfo\}\>\): void
on(type: 'message', callback: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void
Enables listening for message receiving events of the UDPSocket connection. This API uses an asynchronous callback to return the result.
......@@ -482,7 +482,7 @@ Enables listening for message receiving events of the UDPSocket connection. This
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------- |
| type | string | Yes | Type of the event to subscribe to.<br /> **message**: message receiving event|
| callback | Callback<{message: ArrayBuffer, remoteInfo: [SocketRemoteInfo](#socketremoteinfo)}> | Yes | Callback used to return the result. |
| callback | Callback\<{message: ArrayBuffer, remoteInfo: [SocketRemoteInfo](#socketremoteinfo)}\> | Yes | Callback used to return the result. |
**Example**
......@@ -494,9 +494,9 @@ udp.on('message', value => {
```
### off\('message'\)
### off('message')
off\(type: 'message', callback?: Callback<\{message: ArrayBuffer, remoteInfo: SocketRemoteInfo\}\>\): void
off(type: 'message', callback?: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void
Disables listening for message receiving events of the UDPSocket connection. This API uses an asynchronous callback to return the result.
......@@ -526,9 +526,9 @@ udp.off('message');
```
### on\('listening' | 'close'\)
### on('listening' | 'close')
on\(type: 'listening' | 'close', callback: Callback<void\>\): void
on(type: 'listening' | 'close', callback: Callback\<void\>): void
Enables listening for data packet message events or close events of the UDPSocket connection. This API uses an asynchronous callback to return the result.
......@@ -554,9 +554,9 @@ udp.on('close', () => {
```
### off\('listening' | 'close'\)
### off('listening' | 'close')
off\(type: 'listening' | 'close', callback?: Callback<void\>\): void
off(type: 'listening' | 'close', callback?: Callback\<void\>): void
Disables listening for data packet message events or close events of the UDPSocket connection. This API uses an asynchronous callback to return the result.
......@@ -593,9 +593,9 @@ udp.off('close');
```
### on\('error'\)
### on('error')
on\(type: 'error', callback: ErrorCallback\): void
on(type: 'error', callback: ErrorCallback): void
Enables listening for error events of the UDPSocket connection. This API uses an asynchronous callback to return the result.
......@@ -618,9 +618,9 @@ udp.on('error', err => {
```
### off\('error'\)
### off('error')
off\(type: 'error', callback?: ErrorCallback\): void
off(type: 'error', callback?: ErrorCallback): void
Disables listening for error events of the UDPSocket connection. This API uses an asynchronous callback to return the result.
......@@ -720,7 +720,7 @@ For details about error codes, see [Socket Error Codes](../errorcodes/errorcode-
## socket.constructTCPSocketInstance
constructTCPSocketInstance\(\): TCPSocket
constructTCPSocketInstance(): TCPSocket
Creates a **TCPSocket** object.
......@@ -745,7 +745,7 @@ Defines a TCPSocket connection. Before invoking TCPSocket APIs, you need to call
### bind
bind\(address: NetAddress, callback: AsyncCallback<void\>\): void
bind(address: NetAddress, callback: AsyncCallback\<void\>): void
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses an asynchronous callback to return the result.
......@@ -783,7 +783,7 @@ tcp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => {
### bind
bind\(address: NetAddress\): Promise<void\>
bind(address: NetAddress): Promise\<void\>
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses a promise to return the result.
......@@ -825,10 +825,13 @@ promise.then(() => {
### connect
connect\(options: TCPConnectOptions, callback: AsyncCallback<void\>\): void
connect(options: TCPConnectOptions, callback: AsyncCallback\<void\>): void
Sets up a connection to the specified IP address and port number. This API uses an asynchronous callback to return the result.
>**NOTE**
>This API can be called only after **bind** is successfully called.
**Required permissions**: ohos.permission.INTERNET
**System capability**: SystemCapability.Communication.NetStack
......@@ -863,7 +866,7 @@ tcp.connect({ address: {address: '192.168.xx.xxx', port: xxxx, family: 1} , time
### connect
connect\(options: TCPConnectOptions\): Promise<void\>
connect(options: TCPConnectOptions): Promise\<void\>
Sets up a connection to the specified IP address and port number. This API uses a promise to return the result.
......@@ -905,12 +908,12 @@ promise.then(() => {
### send
send\(options: TCPSendOptions, callback: AsyncCallback<void\>\): void
send(options: TCPSendOptions, callback: AsyncCallback\<void\>): void
Sends data over a TCPSocket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>This API can be called only after [connect](#connect) is successfully called.
>This API can be called only after **connect** is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -954,12 +957,12 @@ promise.then(() => {
### send
send\(options: TCPSendOptions\): Promise<void\>
send(options: TCPSendOptions): Promise\<void\>
Sends data over a TCPSocket connection. This API uses a promise to return the result.
>**NOTE**
>This API can be called only after [connect](#connect) is successfully called.
>This API can be called only after **connect** is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -1007,7 +1010,7 @@ promise1.then(() => {
### close
close\(callback: AsyncCallback<void\>\): void
close(callback: AsyncCallback\<void\>): void
Closes a TCPSocket connection. This API uses an asynchronous callback to return the result.
......@@ -1043,7 +1046,7 @@ tcp.close(err => {
### close
close\(\): Promise<void\>
close(): Promise\<void\>
Closes a TCPSocket connection. This API uses a promise to return the result.
......@@ -1078,12 +1081,12 @@ promise.then(() => {
### getRemoteAddress
getRemoteAddress\(callback: AsyncCallback<NetAddress\>\): void
getRemoteAddress(callback: AsyncCallback\<NetAddress\>): void
Obtains the remote address of a socket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>This API can be called only after [connect](#connect) is successfully called.
>This API can be called only after **connect** is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -1123,12 +1126,12 @@ promise.then(() => {
### getRemoteAddress
getRemoteAddress\(\): Promise<NetAddress\>
getRemoteAddress(): Promise\<NetAddress\>
Obtains the remote address of a socket connection. This API uses a promise to return the result.
>**NOTE**
>This API can be called only after [connect](#connect) is successfully called.
>This API can be called only after **connect** is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -1167,12 +1170,12 @@ promise1.then(() => {
### getState
getState\(callback: AsyncCallback<SocketStateBase\>\): void
getState(callback: AsyncCallback\<SocketStateBase\>): void
Obtains the status of the TCPSocket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>This API can be called only after [bind](#bind) or [connect](#connect) is successfully called.
>This API can be called only after **bind** or **connect** is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -1212,12 +1215,12 @@ promise.then(() => {
### getState
getState\(\): Promise<SocketStateBase\>
getState(): Promise\<SocketStateBase\>
Obtains the status of the TCPSocket connection. This API uses a promise to return the result.
>**NOTE**
>This API can be called only after [bind](#bind) or [connect](#connect) is successfully called.
>This API can be called only after **bind** or **connect** is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -1256,12 +1259,12 @@ promise.then(() => {
### setExtraOptions
setExtraOptions\(options: TCPExtraOptions, callback: AsyncCallback<void\>\): void
setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback\<void\>): void
Sets other properties of the TCPSocket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>This API can be called only after [bind](#bind) or [connect](#connect) is successfully called.
>This API can be called only after **bind** or **connect** is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -1312,12 +1315,12 @@ promise.then(() => {
### setExtraOptions
setExtraOptions\(options: TCPExtraOptions\): Promise<void\>
setExtraOptions(options: TCPExtraOptions): Promise\<void\>
Sets other properties of the TCPSocket connection. This API uses a promise to return the result.
>**NOTE**
>This API can be called only after [bind](#bind) or [connect](#connect) is successfully called.
>This API can be called only after **bind** or **connect** is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -1370,9 +1373,9 @@ promise.then(() => {
```
### on\('message'\)
### on('message')
on\(type: 'message', callback: Callback<\{message: ArrayBuffer, remoteInfo: SocketRemoteInfo\}\>\): void
on(type: 'message', callback: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void
Enables listening for message receiving events of the TCPSocket connection. This API uses an asynchronous callback to return the result.
......@@ -1395,9 +1398,9 @@ tcp.on('message', value => {
```
### off\('message'\)
### off('message')
off\(type: 'message', callback?: Callback<\{message: ArrayBuffer, remoteInfo: SocketRemoteInfo\}\>\): void
off(type: 'message', callback?: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void
Disables listening for message receiving events of the TCPSocket connection. This API uses an asynchronous callback to return the result.
......@@ -1427,9 +1430,9 @@ tcp.off('message');
```
### on\('connect' | 'close'\)
### on('connect' | 'close')
on\(type: 'connect' | 'close', callback: Callback<void\>\): void
on(type: 'connect' | 'close', callback: Callback\<void\>): void
Enables listening for connection or close events of the TCPSocket connection. This API uses an asynchronous callback to return the result.
......@@ -1455,9 +1458,9 @@ tcp.on('close', data => {
```
### off\('connect' | 'close'\)
### off('connect' | 'close')
off\(type: 'connect' | 'close', callback?: Callback<void\>\): void
off(type: 'connect' | 'close', callback?: Callback\<void\>): void
Disables listening for connection or close events of the TCPSocket connection. This API uses an asynchronous callback to return the result.
......@@ -1494,9 +1497,9 @@ tcp.off('close');
```
### on\('error'\)
### on('error')
on\(type: 'error', callback: ErrorCallback\): void
on(type: 'error', callback: ErrorCallback): void
Enables listening for error events of the TCPSocket connection. This API uses an asynchronous callback to return the result.
......@@ -1519,9 +1522,9 @@ tcp.on('error', err => {
```
### off\('error'\)
### off('error')
off\(type: 'error', callback?: ErrorCallback\): void
off(type: 'error', callback?: ErrorCallback): void
Disables listening for error events of the TCPSocket connection. This API uses an asynchronous callback to return the result.
......@@ -1622,7 +1625,7 @@ Defines a TLSSocket connection. Before invoking TLSSocket APIs, you need to call
### bind<sup>9+</sup>
bind\(address: NetAddress, callback: AsyncCallback<void\>\): void
bind(address: NetAddress, callback: AsyncCallback\<void\>): void
Binds the IP address and port number. This API uses an asynchronous callback to return the result.
......@@ -1660,7 +1663,7 @@ tls.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => {
### bind<sup>9+</sup>
bind\(address: NetAddress\): Promise<void\>
bind(address: NetAddress): Promise\<void\>
Binds the IP address and port number. This API uses a promise to return the result.
......@@ -1702,7 +1705,7 @@ promise.then(() => {
### getState<sup>9+</sup>
getState\(callback: AsyncCallback<SocketStateBase\>\): void
getState(callback: AsyncCallback\<SocketStateBase\>): void
Obtains the status of the TLSSocket connection. This API uses an asynchronous callback to return the result.
......@@ -1742,7 +1745,7 @@ tls.getState((err, data) => {
### getState<sup>9+</sup>
getState\(\): Promise<SocketStateBase\>
getState(): Promise\<SocketStateBase\>
Obtains the status of the TLSSocket connection. This API uses a promise to return the result.
......@@ -1781,7 +1784,7 @@ promise.then(() => {
### setExtraOptions<sup>9+</sup>
setExtraOptions\(options: TCPExtraOptions, callback: AsyncCallback<void\>\): void
setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback\<void\>): void
Sets other properties of the TCPSocket connection after successful binding of the local IP address and port number of the TLSSocket connection. This API uses an asynchronous callback to return the result.
......@@ -1833,7 +1836,7 @@ tls.setExtraOptions({
### setExtraOptions<sup>9+</sup>
setExtraOptions\(options: TCPExtraOptions\): Promise<void\>
setExtraOptions(options: TCPExtraOptions): Promise\<void\>
Sets other properties of the TCPSocket connection after successful binding of the local IP address and port number of the TLSSocket connection. This API uses a promise to return the result.
......@@ -1888,7 +1891,7 @@ promise.then(() => {
### connect<sup>9+</sup>
connect(options: TLSConnectOptions, callback: AsyncCallback\<void>): void
connect(options: TLSConnectOptions, callback: AsyncCallback\<void\>): void
Sets up a TLSSocket connection, and creates and initializes a TLS session after successful binding of the local IP address and port number of the TLSSocket connection. During this process, a TLS/SSL handshake is performed between the application and the server to implement data transmission. This API uses an asynchronous callback to return the result.
......@@ -1982,7 +1985,7 @@ tlsOneWay.connect(oneWayOptions, (err, data) => {
### connect<sup>9+</sup>
connect(options: TLSConnectOptions): Promise\<void>
connect(options: TLSConnectOptions): Promise\<void\>
Sets up a TLSSocket connection, and creates and initializes a TLS session after successful binding of the local IP address and port number of the TLSSocket connection. During this process, a TLS/SSL handshake is performed between the application and the server to implement data transmission. Both two-way and one-way authentication modes are supported. This API uses a promise to return the result.
......@@ -1998,7 +2001,7 @@ Sets up a TLSSocket connection, and creates and initializes a TLS session after
| Type | Description |
| ------------------------------------------- | ----------------------------- |
| Promise\<void> | Promise used to return the result. If the operation is successful, no value is returned. If the operation fails, an error message is returned.|
| Promise\<void\> | Promise used to return the result. If the operation is successful, no value is returned. If the operation fails, an error message is returned.|
**Error codes**
......@@ -2083,7 +2086,7 @@ tlsOneWay.connect(oneWayOptions).then(data => {
### getRemoteAddress<sup>9+</sup>
getRemoteAddress\(callback: AsyncCallback<NetAddress\>\): void
getRemoteAddress(callback: AsyncCallback\<NetAddress\>): void
Obtains the remote address of a TLSSocket connection. This API uses an asynchronous callback to return the result.
......@@ -2093,7 +2096,7 @@ Obtains the remote address of a TLSSocket connection. This API uses an asynchron
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------- | ---- | ---------- |
| callback | AsyncCallback\<[NetAddress](#netaddress)> | Yes | Callback used to return the result. If the operation is successful, the remote address is returned. If the operation fails, an error message is returned.|
| callback | AsyncCallback\<[NetAddress](#netaddress)\> | Yes | Callback used to return the result. If the operation is successful, the remote address is returned. If the operation fails, an error message is returned.|
**Error codes**
......@@ -2116,7 +2119,7 @@ tls.getRemoteAddress((err, data) => {
### getRemoteAddress<sup>9+</sup>
getRemoteAddress\(\): Promise\<NetAddress>
getRemoteAddress(): Promise\<NetAddress\>
Obtains the remote address of a TLSSocket connection. This API uses a promise to return the result.
......@@ -2148,7 +2151,7 @@ promise.then(() => {
### getCertificate<sup>9+</sup>
getCertificate(callback: AsyncCallback\<[X509CertRawData](#x509certrawdata9)>): void
getCertificate(callback: AsyncCallback\<[X509CertRawData](#x509certrawdata9)\>): void
Obtains the local digital certificate after a TLSSocket connection is established. This API is applicable to two-way authentication. It uses an asynchronous callback to return the result.
......@@ -2158,7 +2161,7 @@ Obtains the local digital certificate after a TLSSocket connection is establishe
| Name | Type | Mandatory| Description|
| -------- | ----------------------------------------| ---- | ---------------|
| callback | AsyncCallback\<[X509CertRawData](#x509certrawdata9)> | Yes | Callback used to return the result. If the operation is successful, the local certificate is returned. If the operation fails, an error message is returned.|
| callback | AsyncCallback\<[X509CertRawData](#x509certrawdata9)\> | Yes | Callback used to return the result. If the operation is successful, the local certificate is returned. If the operation fails, an error message is returned.|
**Error codes**
......@@ -2182,7 +2185,7 @@ tls.getCertificate((err, data) => {
### getCertificate<sup>9+</sup>
getCertificate():Promise\<[X509CertRawData](#x509certrawdata9)>
getCertificate():Promise\<[X509CertRawData](#x509certrawdata9)\>
Obtains the local digital certificate after a TLSSocket connection is established. This API is applicable to two-way authentication. It uses a promise to return the result.
......@@ -2192,7 +2195,7 @@ Obtains the local digital certificate after a TLSSocket connection is establishe
| Type | Description |
| -------------- | -------------------- |
| Promise\<[X509CertRawData](#x509certrawdata9)> | Promise used to return the result. If the operation fails, an error message is returned.|
| Promise\<[X509CertRawData](#x509certrawdata9)\> | Promise used to return the result. If the operation fails, an error message is returned.|
**Error codes**
......@@ -2214,7 +2217,7 @@ tls.getCertificate().then(data => {
### getRemoteCertificate<sup>9+</sup>
getRemoteCertificate(callback: AsyncCallback\<[X509CertRawData](#x509certrawdata9)>): void
getRemoteCertificate(callback: AsyncCallback\<[X509CertRawData](#x509certrawdata9)\>): void
Obtains the digital certificate of the server after a TLSSocket connection is established. This API uses an asynchronous callback to return the result.
......@@ -2224,7 +2227,7 @@ Obtains the digital certificate of the server after a TLSSocket connection is es
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------------| ---- | ---------------|
| callback | AsyncCallback\<[X509CertRawData](#x509certrawdata9)> | Yes | Callback used to return the result. If the operation fails, an error message is returned.|
| callback | AsyncCallback\<[X509CertRawData](#x509certrawdata9)\> | Yes | Callback used to return the result. If the operation fails, an error message is returned.|
**Error codes**
......@@ -2247,7 +2250,7 @@ tls.getRemoteCertificate((err, data) => {
### getRemoteCertificate<sup>9+</sup>
getRemoteCertificate():Promise\<[X509CertRawData](#x509certrawdata9)>
getRemoteCertificate():Promise\<[X509CertRawData](#x509certrawdata9)\>
Obtains the digital certificate of the server after a TLSSocket connection is established. This API uses a promise to return the result.
......@@ -2257,7 +2260,7 @@ Obtains the digital certificate of the server after a TLSSocket connection is es
| Type | Description |
| -------------- | -------------------- |
| Promise\<[X509CertRawData](#x509certrawdata9)> | Promise used to return the result. If the operation fails, an error message is returned.|
| Promise\<[X509CertRawData](#x509certrawdata9)\> | Promise used to return the result. If the operation fails, an error message is returned.|
**Error codes**
......@@ -2278,7 +2281,7 @@ tls.getRemoteCertificate().then(data => {
### getProtocol<sup>9+</sup>
getProtocol(callback: AsyncCallback\<string>): void
getProtocol(callback: AsyncCallback\<string\>): void
Obtains the communication protocol version after a TLSSocket connection is established. This API uses an asynchronous callback to return the result.
......@@ -2288,7 +2291,7 @@ Obtains the communication protocol version after a TLSSocket connection is estab
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------| ---- | ---------------|
| callback | AsyncCallback\<string> | Yes | Callback used to return the result. If the operation fails, an error message is returned.|
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. If the operation fails, an error message is returned.|
**Error codes**
......@@ -2312,7 +2315,7 @@ tls.getProtocol((err, data) => {
### getProtocol<sup>9+</sup>
getProtocol():Promise\<string>
getProtocol():Promise\<string\>
Obtains the communication protocol version after a TLSSocket connection is established. This API uses a promise to return the result.
......@@ -2322,7 +2325,7 @@ Obtains the communication protocol version after a TLSSocket connection is estab
| Type | Description |
| -------------- | -------------------- |
| Promise\<string> | Promise used to return the result. If the operation fails, an error message is returned.|
| Promise\<string\> | Promise used to return the result. If the operation fails, an error message is returned.|
**Error codes**
......@@ -2344,7 +2347,7 @@ tls.getProtocol().then(data => {
### getCipherSuite<sup>9+</sup>
getCipherSuite(callback: AsyncCallback\<Array\<string>>): void
getCipherSuite(callback: AsyncCallback\<Array\<string\>\>): void
Obtains the cipher suite negotiated by both communication parties after a TLSSocket connection is established. This API uses an asynchronous callback to return the result.
......@@ -2354,7 +2357,7 @@ Obtains the cipher suite negotiated by both communication parties after a TLSSoc
| Name | Type | Mandatory| Description|
| -------- | ----------------------------------------| ---- | ---------------|
| callback | AsyncCallback\<Array\<string>> | Yes | Callback used to return the result. If the operation fails, an error message is returned.|
| callback | AsyncCallback\<Array\<string\>\> | Yes | Callback used to return the result. If the operation fails, an error message is returned.|
**Error codes**
......@@ -2379,7 +2382,7 @@ tls.getCipherSuite((err, data) => {
### getCipherSuite<sup>9+</sup>
getCipherSuite(): Promise\<Array\<string>>
getCipherSuite(): Promise\<Array\<string\>\>
Obtains the cipher suite negotiated by both communication parties after a TLSSocket connection is established. This API uses a promise to return the result.
......@@ -2389,7 +2392,7 @@ Obtains the cipher suite negotiated by both communication parties after a TLSSoc
| Type | Description |
| ---------------------- | --------------------- |
| Promise\<Array\<string>> | Promise used to return the result. If the operation fails, an error message is returned.|
| Promise\<Array\<string\>\> | Promise used to return the result. If the operation fails, an error message is returned.|
**Error codes**
......@@ -2412,7 +2415,7 @@ tls.getCipherSuite().then(data => {
### getSignatureAlgorithms<sup>9+</sup>
getSignatureAlgorithms(callback: AsyncCallback\<Array\<string>>): void
getSignatureAlgorithms(callback: AsyncCallback\<Array\<string\>\>): void
Obtains the signing algorithm negotiated by both communication parties after a TLSSocket connection is established. This API is applicable to two-way authentication. It uses an asynchronous callback to return the result.
......@@ -2422,7 +2425,7 @@ Obtains the signing algorithm negotiated by both communication parties after a T
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------| ---- | ---------------|
| callback | AsyncCallback\<Array\<string>> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<Array\<string\>\> | Yes | Callback used to return the result. |
**Error codes**
......@@ -2445,7 +2448,7 @@ tls.getSignatureAlgorithms((err, data) => {
### getSignatureAlgorithms<sup>9+</sup>
getSignatureAlgorithms(): Promise\<Array\<string>>
getSignatureAlgorithms(): Promise\<Array\<string\>\>
Obtains the signing algorithm negotiated by both communication parties after a TLSSocket connection is established. This API is applicable to two-way authentication. It uses a promise to return the result.
......@@ -2455,7 +2458,7 @@ Obtains the signing algorithm negotiated by both communication parties after a T
| Type | Description |
| ---------------------- | -------------------- |
| Promise\<Array\<string>> | Promise used to return the result.|
| Promise\<Array\<string\>\> | Promise used to return the result.|
**Error codes**
......@@ -2476,7 +2479,7 @@ tls.getSignatureAlgorithms().then(data => {
### send<sup>9+</sup>
send(data: string, callback: AsyncCallback\<void>): void
send(data: string, callback: AsyncCallback\<void\>): void
Sends a message to the server after a TLSSocket connection is established. This API uses an asynchronous callback to return the result.
......@@ -2487,7 +2490,7 @@ Sends a message to the server after a TLSSocket connection is established. This
| Name | Type | Mandatory| Description |
| -------- | -----------------------------| ---- | ---------------|
| data | string | Yes | Data content of the message to send. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation fails, an error message is returned.|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. If the operation fails, an error message is returned.|
**Error codes**
......@@ -2514,7 +2517,7 @@ tls.send("xxxx", (err) => {
### send<sup>9+</sup>
send(data: string): Promise\<void>
send(data: string): Promise\<void\>
Sends a message to the server after a TLSSocket connection is established. This API uses a promise to return the result.
......@@ -2541,7 +2544,7 @@ Sends a message to the server after a TLSSocket connection is established. This
| Type | Description |
| -------------- | -------------------- |
| Promise\<void> | Promise used to return the result. If the operation fails, an error message is returned.|
| Promise\<void\> | Promise used to return the result. If the operation fails, an error message is returned.|
**Example**
......@@ -2555,7 +2558,7 @@ tls.send("xxxx").then(() =>{
### close<sup>9+</sup>
close(callback: AsyncCallback\<void>): void
close(callback: AsyncCallback\<void\>): void
Closes a TLSSocket connection. This API uses an asynchronous callback to return the result.
......@@ -2565,7 +2568,7 @@ Closes a TLSSocket connection. This API uses an asynchronous callback to return
| Name | Type | Mandatory| Description |
| -------- | -----------------------------| ---- | ---------------|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation fails, an error message is returned.|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. If the operation fails, an error message is returned.|
**Error codes**
......@@ -2590,7 +2593,7 @@ tls.close((err) => {
### close<sup>9+</sup>
close(): Promise\<void>
close(): Promise\<void\>
Closes a TLSSocket connection. This API uses a promise to return the result.
......@@ -2600,7 +2603,7 @@ Closes a TLSSocket connection. This API uses a promise to return the result.
| Type | Description |
| -------------- | -------------------- |
| Promise\<void> | Promise used to return the result. If the operation fails, an error message is returned.|
| Promise\<void\> | Promise used to return the result. If the operation fails, an error message is returned.|
**Error codes**
......@@ -2631,7 +2634,7 @@ Defines TLS connection options.
| -------------- | ------------------------------------- | --- |-------------- |
| address | [NetAddress](#netaddress) | Yes | Gateway address. |
| secureOptions | [TLSSecureOptions](#tlssecureoptions9) | Yes| TLS security options.|
| ALPNProtocols | Array\<string> | No| Application Layer Protocol Negotiation (ALPN) protocols. |
| ALPNProtocols | Array\<string\> | No| Application Layer Protocol Negotiation (ALPN) protocols. |
## TLSSecureOptions<sup>9+</sup>
......@@ -2641,11 +2644,11 @@ Defines TLS security options. The CA certificate is mandatory, and other paramet
| Name | Type | Mandatory| Description |
| --------------------- | ------------------------------------------------------ | --- |----------------------------------- |
| ca | string \| Array\<string> | Yes| CA certificate of the server, which is used to authenticate the digital certificate of the server.|
| ca | string \| Array\<string\> | Yes| CA certificate of the server, which is used to authenticate the digital certificate of the server.|
| cert | string | No| Digital certificate of the local client. |
| key | string | No| Private key of the local digital certificate. |
| password | string | No| Password for reading the private key. |
| protocols | [Protocol](#protocol9) \|Array\<[Protocol](#protocol9)> | No| TLS protocol version. |
| protocols | [Protocol](#protocol9) \|Array\<[Protocol](#protocol9)\> | No| TLS protocol version. |
| useRemoteCipherPrefer | boolean | No| Whether to use the remote cipher suite preferentially. |
| signatureAlgorithms | string | No| Signing algorithm used during communication. |
| cipherSuite | string | No| Cipher suite used during communication. |
......
......@@ -70,10 +70,10 @@ export default {
console.log('success get location data. latitude:' + data.latitude);
},
fail: function(data, code) {
console.log('fail to get location. code:' + code + ', data:' + data);
},
console.log('fail to get location. code:' + code + ', data:' + data);
}
});
},
}
}
```
......@@ -192,8 +192,8 @@ Cancels listening to the geographic location.
```
export default {
unsubscribe() {
geolocation.unsubscribe();
},
geolocation.unsubscribe();
}
}
```
......
......@@ -49,6 +49,10 @@
- [Upload and Download Error Codes](errorcode-request.md)
- [HTTP Error Codes](errorcode-net-http.md)
- [Socket Error Codes](errorcode-net-socket.md)
- [Network Connection Management Error Codes](errorcode-net-connection.md)
- [Ethernet Connection Error Codes](errorcode-net-ethernet.md)
- [Network Sharing Error Codes](errorcode-net-sharing.md)
- [Policy Management Error Codes](errorcode-net-policy.md)
- Connectivity
- [NFC Error Codes](errorcode-nfc.md)
- [RPC Error Codes](errorcode-rpc.md)
......
# Network Connection Management Error Codes
## 2100001 Invalid Parameter Value
**Error Message**
Invalid parameter value.
**Description**
This error code is reported if the parameter value is invalid.
**Cause**
The input parameter value is not within the valid value range.
**Procedure**
Check whether the input parameter value is within the valid value range.
## 2100002 Service Connection Failure
**Error Message**
Operation failed. Cannot connect to service.
**Description**
This error code is reported if a service connection failure occurs.
**Cause**
The service is abnormal.
**Procedure**
Check whether system services are running properly.
## 2100003 System Internal Error
**Error Message**
System internal error.
**Description**
This error code is reported if a system internal error occurs.
**Cause**
1. The memory is abnormal.
2. A null pointer is present.
**Procedure**
1. Check whether the memory space is sufficient. If not, clear the memory and try again.
2. Check whether the system is normal. If not, try again later or restart the device.
## 2101007 Callback Already Exists
**Error Message**
The same callback exists.
**Description**
This error code is reported if the same callback already exists.
**Cause**
The **callback** object has been registered for activating a network or listening to network status changes.
**Procedure**
1. Check whether the **callback** object has been registered.
2. If the **callback** object has been registered, use the registered **callback** object.
## 2101008 Callback Not Exist
**Error Message**
The callback is not exists.
**Description**
This error code is reported if a **callback** object to be unregistered does not exist.
**Cause**
The **callback** object has not been registered for activating a network or listening to network status changes.
**Procedure**
Before unregistering a **callback** object, make sure that it has been registered for activating a network or listening to network status changes.
## 2101022 Number of Requests Exceeding the Maximum
**Error Message**
The number of requests exceeded the maximum.
**Description**
This error code is reported if the number of network requests exceeds the maximum.
**Cause**
The number of requests for activating a network or listening to network status changes has reached the maximum value.
**Procedure**
Locate the fault based on the "Over the max request number" log record.
# Ethernet Connection Error Codes
## 2200001 Invalid Parameter Value
**Error Message**
Invalid parameter value.
**Description**
This error code is reported if the parameter value is invalid.
**Cause**
The input parameter value is not within the valid value range.
**Procedure**
Check whether the input parameter value is within the valid value range.
## 2200002 Service Connection Failure
**Error Message**
Operation failed. Cannot connect to service.
**Description**
This error code is reported if a service connection failure occurs.
**Cause**
The service is abnormal.
**Procedure**
Check whether system services are running properly.
## 2200003 System Internal Error
**Error Message**
System internal error.
**Description**
This error code is reported if a system internal error occurs.
**Cause**
1. The memory is abnormal.
2. A null pointer is present.
**Procedure**
1. Check whether the memory space is sufficient. If not, clear the memory and try again.
2. Check whether the system is normal. If not, try again later or restart the device.
## 2201005 Device Information Not Exist
**Error Message**
The device information does not exist.
**Description**
This error code is reported if the device information does not exist.
**Cause**
The device to set or obtain does not exist.
**Procedure**
```bash
> hdc shell ifconfig
```
Check whether the device, for example, **eth0** or **eth1**, exists.
## 2201006 Device Not Connected
**Error Message**
Device disconnected.
**Description**
This error code is reported if the device is not connected.
**Cause**
The network interface card (NIC) is faulty.
**Procedure**
View the Ethernet service and netsys logs to check for the connection status information reported by the kernel.
## 2201007 Failed to Write the User Configuration
**Error Message**
Failed to write the user configuration.
**Description**
This error code is reported if an error occurs while writing data to the user configuration file.
**Cause**
The system reports an error.
**Procedure**
A system internal error occurs. You are advised to locate the fault based on logs.
# Policy Management Error Codes
## 2100001 Invalid Parameter Value
**Error Message**
Invalid parameter value.
**Description**
Invalid parameter value
**Cause**
The input parameter value is not within the valid value range.
**Procedure**
Check whether the input parameter value is within the valid value range.
## 2100002 Service Connection Failure
**Error Message**
Operation failed. Cannot connect to service.
**Description**
This error code is reported if a service connection failure occurs.
**Cause**
The service is abnormal.
**Procedure**
Check whether system services are running properly.
## 2100003 System Internal Error
**Error Message**
System internal error.
**Description**
This error code is reported if a system internal error occurs.
**Cause**
1. The memory is abnormal.
2. A null pointer is present.
**Procedure**
1. Check whether the memory space is sufficient. If not, clear the memory and try again.
2. Check whether the system is normal. If not, try again later or restart the device.
# Network Sharing Error Codes
## 2200001 Invalid Parameter Value
**Error Message**
Invalid parameter value.
**Description**
This error code is reported if the parameter value is invalid.
**Cause**
The input parameter value is not within the valid value range.
**Procedure**
Check whether the input parameter value is within the valid value range.
## 2200002 Service Connection Failure
**Error Message**
Operation failed. Cannot connect to service.
**Description**
This error code is reported if a service connection failure occurs.
**Cause**
The service is abnormal.
**Procedure**
Check whether system services are running properly.
## 2200003 System Internal Error
**Error Message**
System internal error.
**Description**
This error code is reported if a system internal error occurs.
**Cause**
1. The memory is abnormal.
2. A null pointer is present.
**Procedure**
1. Check whether the memory space is sufficient. If not, clear the memory and try again.
2. Check whether the system is normal. If not, try again later or restart the device.
## 2202004 Shared Iface Unavailable
**Error Message**
Try to share an unavailable iface.
**Description**
This error code is reported if an Iface is used.
**Cause**
The specified Iface does not exist or the Iface name is incorrect.
**Procedure**
1. Check whether the shared Iface is available.
```bash
> ifconfig -a
```
2. Check whether the Iface name is correct.
## 2202005 Wi-Fi Sharing Failure
**Error Message**
WiFi sharing failed.
**Description**
This error code is reported if Wi-Fi sharing fails.
**Cause**
No connected network is available and therefore the attempt to obtain the default network fails.
**Procedure**
Check whether the network connection is normal.
## 2202006 Bluetooth Sharing Failure
**Error Message**
Bluetooth sharing failed.
**Description**
This error code is reported if Bluetooth sharing fails.
**Cause**
1. Bluetooth is disabled.
2. No connected network is available and therefore the attempt to obtain the default network fails.
**Procedure**
1. Touch the Bluetooth icon to turn on Bluetooth mode.
2. Check whether the network connection is normal.
## 2202009 Failed to Enable Forwarding for Network Sharing
**Error Message**
Network share enable forwarding error.
**Description**
This error code is reported if an error occurs while enabling forwarding for network sharing.
**Cause**
The Iptables rule setting fails and therefore an error occurs while combining Iptables commands fails.
**Procedure**
Enable the debug log function, and check whether Iptables commands are correctly combined.
## 2202011 Failed to Obtain the Network Sharing Configuration
**Error Message**
Cannot get network sharing configuration.
**Description**
This error code is reported if an error occurs while obtaining the network sharing configuration.
**Cause**
The configuration file directory is incorrect.
**Procedure**
Specify a correct configuration file directory.
# Telephony Subsystem Changelog
## cl.telephony.1 Call Module reject API Change
Changed the `reject` API to the `rejectCall` API in the call module of the telephony subsystem since API version 9.
You need to adapt your application.
**Change Impact**
The `reject` API is deprecated and cannot be used any more. Use the `rejectCall` API instead. Otherwise, relevant functions will be affected.
- Involved APIs:
```js
function reject(callId: number, callback: AsyncCallback<void>): void;
function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback<void>): void;
function reject(callId?: number, options?: RejectMessageOptions): Promise<void>;
function reject(callback: AsyncCallback<void>): void;
function reject(options: RejectMessageOptions, callback: AsyncCallback<void>): void;
```
- Before change:
```js
function reject(callId: number, callback: AsyncCallback<void>): void;
function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback<void>): void;
function reject(callId?: number, options?: RejectMessageOptions): Promise<void>;
function reject(callback: AsyncCallback<void>): void;
function reject(options: RejectMessageOptions, callback: AsyncCallback<void>): void;
```
- After change:
```js
function rejectCall(callId: number, callback: AsyncCallback<void>): void;
function rejectCall(callId: number, options: RejectMessageOptions, callback: AsyncCallback<void>): void;
function rejectCall(callId?: number, options?: RejectMessageOptions): Promise<void>;
function rejectCall(callback: AsyncCallback<void>): void;
function rejectCall(options: RejectMessageOptions, callback: AsyncCallback<void>): void;
```
**Adaptation Guide**
The `reject` API is deprecated and cannot be used any more. Use the `rejectCall` API instead.
Use the new API. The sample code is as follows:
```js
call.rejectCall("138xxxxxxxx", (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
```js
let rejectMessageOptions={
messageContent: "Unknown number blocked"
}
let promise = call.rejectCall(1, rejectMessageOptions);
promise.then(data => {
console.log(`rejectCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`rejectCall fail, promise: err->${JSON.stringify(err)}`);
});
```
```js
let rejectMessageOptions={
messageContent: "Unknown number blocked"
}
let promise = call.rejectCall(1, rejectMessageOptions);
promise.then(data => {
console.log(`rejectCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`rejectCall fail, promise: err->${JSON.stringify(err)}`);
});
```
```js
call.rejectCall((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
```js
let rejectMessageOptions={
messageContent: "Unknown number blocked"
}
call.rejectCall(rejectMessageOptions, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## cl.telephony.2 Call Module answer API Change
Changed the `answer` API to the `answerCall` API in the call module of the telephony subsystem since API version 9.
You need to adapt your application.
**Change Impact**
The `answer` API is deprecated and cannot be used any more. Use the `answerCall` API instead. Otherwise, relevant functions will be affected.
- Involved APIs:
```js
function answer(callId: number, callback: AsyncCallback<void>): void;
function answer(callId?: number): Promise<void>;
function answer(callback: AsyncCallback<void>): void;
```
- Before change:
```js
function answer(callId: number, callback: AsyncCallback<void>): void;
function answer(callId?: number): Promise<void>;
function answer(callback: AsyncCallback<void>): void;
```
- After change:
```js
function answerCall(callId: number, callback: AsyncCallback<void>): void;
function answerCall(callId?: number): Promise<void>;
function answerCall(callback: AsyncCallback<void>): void;
```
**Adaptation Guide**
The `answer` API is deprecated and cannot be used any more. Use the `answerCall` API instead.
Use the new API. The sample code is as follows:
```js
call.answerCall(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
```js
let promise = call.answerCall(1);
promise.then(data => {
console.log(`answerCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`answerCall fail, promise: err->${JSON.stringify(err)}`);
});
```
```js
call.answerCall((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## cl.telephony.1 Call Module hangup API Change
Changed the `hangup` API to the `hangUpCall` API in the call module of the telephony subsystem since API version 9.
You need to adapt your application.
**Change Impact**
The `hangup` API is deprecated and cannot be used any more. Use the `hangUpCall` API instead. Otherwise, relevant functions will be affected.
- Involved APIs:
```js
function hangup(callId: number, callback: AsyncCallback<void>): void;
function hangup(callId?: number): Promise<void>;
function hangup(callback: AsyncCallback<void>): void;
```
- Before change:
```js
function hangup(callId: number, callback: AsyncCallback<void>): void;
function hangup(callId?: number): Promise<void>;
function hangup(callback: AsyncCallback<void>): void;
```
- After change:
```js
function hangUpCall(callId: number, callback: AsyncCallback<void>): void;
function hangUpCall(callId?: number): Promise<void>;
function hangUpCall(callback: AsyncCallback<void>): void;
```
**Adaptation Guide**
The `hangup` API is deprecated and cannot be used any more. Use the `hangUpCall` API instead.
Use the new API. The sample code is as follows:
```js
call.hangUpCall(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
```js
let promise = call.hangUpCall(1);
promise.then(data => {
console.log(`hangUpCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`hangUpCall fail, promise: err->${JSON.stringify(err)}`);
});
```
```js
call.hangUpCall((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册