From b7ee0a08d7bcc3e5e22141972a8f2bffdfffe24b Mon Sep 17 00:00:00 2001 From: shawn_he Date: Tue, 14 Mar 2023 15:12:46 +0800 Subject: [PATCH] update doc Signed-off-by: shawn_he --- en/application-dev/dfx/Readme-EN.md | 14 +- .../dfx/errormanager-guidelines.md | 11 +- .../apis/js-apis-geoLocationManager.md | 4 +- .../reference/apis/js-apis-geolocation.md | 2 +- .../apis/js-apis-resource-manager.md | 43 ++-- .../reference/apis/js-apis-socket.md | 217 ++++++++--------- .../reference/apis/js-apis-system-location.md | 10 +- .../reference/errorcodes/Readme-EN.md | 4 + .../errorcodes/errorcode-net-connection.md | 114 +++++++++ .../errorcodes/errorcode-net-ethernet.md | 116 +++++++++ .../errorcodes/errorcode-net-policy.md | 59 +++++ .../errorcodes/errorcode-net-sharing.md | 159 +++++++++++++ .../changelog-telephony.md | 223 ++++++++++++++++++ 13 files changed, 827 insertions(+), 149 deletions(-) create mode 100644 en/application-dev/reference/errorcodes/errorcode-net-connection.md create mode 100644 en/application-dev/reference/errorcodes/errorcode-net-ethernet.md create mode 100644 en/application-dev/reference/errorcodes/errorcode-net-policy.md create mode 100644 en/application-dev/reference/errorcodes/errorcode-net-sharing.md create mode 100644 en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelog-telephony.md diff --git a/en/application-dev/dfx/Readme-EN.md b/en/application-dev/dfx/Readme-EN.md index 4ed700a49b..c6b449f197 100644 --- a/en/application-dev/dfx/Readme-EN.md +++ b/en/application-dev/dfx/Readme-EN.md @@ -1,13 +1,9 @@ # 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 diff --git a/en/application-dev/dfx/errormanager-guidelines.md b/en/application-dev/dfx/errormanager-guidelines.md index 193a5fcaf3..4679cfcfc7 100644 --- a/en/application-dev/dfx/errormanager-guidelines.md +++ b/en/application-dev/dfx/errormanager-guidelines.md @@ -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 | Unregisters an observer in callback mode. The number passed to this API is the SN of the registered observer. | -| unregisterErrorObserver(observerId: number): Promise\ | 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 | 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\ | 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); diff --git a/en/application-dev/reference/apis/js-apis-geoLocationManager.md b/en/application-dev/reference/apis/js-apis-geoLocationManager.md index f9d6d9087b..198d4dee89 100644 --- a/en/application-dev/reference/apis/js-apis-geoLocationManager.md +++ b/en/application-dev/reference/apis/js-apis-geoLocationManager.md @@ -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) => { diff --git a/en/application-dev/reference/apis/js-apis-geolocation.md b/en/application-dev/reference/apis/js-apis-geolocation.md index 3cd5b2408e..3bf1e990cd 100644 --- a/en/application-dev/reference/apis/js-apis-geolocation.md +++ b/en/application-dev/reference/apis/js-apis-geolocation.md @@ -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, diff --git a/en/application-dev/reference/apis/js-apis-resource-manager.md b/en/application-dev/reference/apis/js-apis-resource-manager.md index 7dc343709c..41d18e140d 100644 --- a/en/application-dev/reference/apis/js-apis-resource-manager.md +++ b/en/application-dev/reference/apis/js-apis-resource-manager.md @@ -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**
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<[ResourceManager](#resourcemanager)> | 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**
> 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<Uint8Array>): 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<string> | String corresponding to the resource name.| +| Promise<string> | 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<Uint8Array>): 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. diff --git a/en/application-dev/reference/apis/js-apis-socket.md b/en/application-dev/reference/apis/js-apis-socket.md index 271a662c7f..f099ece8f2 100644 --- a/en/application-dev/reference/apis/js-apis-socket.md +++ b/en/application-dev/reference/apis/js-apis-socket.md @@ -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 +bind(address: NetAddress, callback: AsyncCallback\): 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 +bind(address: NetAddress): Promise\ 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 +send(options: UDPSendOptions, callback: AsyncCallback\): 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 +send(options: UDPSendOptions): Promise\ 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 +close(callback: AsyncCallback\): 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 +close(): Promise\ Closes a UDPSocket connection. This API uses a promise to return the result. @@ -275,12 +275,12 @@ promise.then(() => { ### getState -getState\(callback: AsyncCallback\): void +getState(callback: AsyncCallback\): 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 +getState(): Promise\ 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 +setExtraOptions(options: UDPExtraOptions, callback: AsyncCallback\): 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 +setExtraOptions(options: UDPExtraOptions): Promise\ 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.
**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 +on(type: 'listening' | 'close', callback: Callback\): 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 +off(type: 'listening' | 'close', callback?: Callback\): 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 +bind(address: NetAddress, callback: AsyncCallback\): 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 +bind(address: NetAddress): Promise\ 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 +connect(options: TCPConnectOptions, callback: AsyncCallback\): 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 +connect(options: TCPConnectOptions): Promise\ 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 +send(options: TCPSendOptions, callback: AsyncCallback\): 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 +send(options: TCPSendOptions): Promise\ 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 +close(callback: AsyncCallback\): 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 +close(): Promise\ Closes a TCPSocket connection. This API uses a promise to return the result. @@ -1078,12 +1081,12 @@ promise.then(() => { ### getRemoteAddress -getRemoteAddress\(callback: AsyncCallback\): void +getRemoteAddress(callback: AsyncCallback\): 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 +getRemoteAddress(): Promise\ 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\): void +getState(callback: AsyncCallback\): 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 +getState(): Promise\ 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 +setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback\): 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 +setExtraOptions(options: TCPExtraOptions): Promise\ 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 +on(type: 'connect' | 'close', callback: Callback\): 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 +off(type: 'connect' | 'close', callback?: Callback\): 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 ### bind9+ -bind\(address: NetAddress, callback: AsyncCallback\): void +bind(address: NetAddress, callback: AsyncCallback\): 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 => { ### bind9+ -bind\(address: NetAddress\): Promise +bind(address: NetAddress): Promise\ Binds the IP address and port number. This API uses a promise to return the result. @@ -1702,7 +1705,7 @@ promise.then(() => { ### getState9+ -getState\(callback: AsyncCallback\): void +getState(callback: AsyncCallback\): 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) => { ### getState9+ -getState\(\): Promise +getState(): Promise\ Obtains the status of the TLSSocket connection. This API uses a promise to return the result. @@ -1781,7 +1784,7 @@ promise.then(() => { ### setExtraOptions9+ -setExtraOptions\(options: TCPExtraOptions, callback: AsyncCallback\): void +setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback\): 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({ ### setExtraOptions9+ -setExtraOptions\(options: TCPExtraOptions\): Promise +setExtraOptions(options: TCPExtraOptions): Promise\ 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(() => { ### connect9+ -connect(options: TLSConnectOptions, callback: AsyncCallback\): void +connect(options: TLSConnectOptions, callback: AsyncCallback\): 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) => { ### connect9+ -connect(options: TLSConnectOptions): Promise\ +connect(options: TLSConnectOptions): Promise\ 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\ | 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\ | 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 => { ### getRemoteAddress9+ -getRemoteAddress\(callback: AsyncCallback\): void +getRemoteAddress(callback: AsyncCallback\): 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) => { ### getRemoteAddress9+ -getRemoteAddress\(\): Promise\ +getRemoteAddress(): Promise\ Obtains the remote address of a TLSSocket connection. This API uses a promise to return the result. @@ -2148,7 +2151,7 @@ promise.then(() => { ### getCertificate9+ -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) => { ### getCertificate9+ -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 => { ### getRemoteCertificate9+ -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) => { ### getRemoteCertificate9+ -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 => { ### getProtocol9+ -getProtocol(callback: AsyncCallback\): void +getProtocol(callback: AsyncCallback\): 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\ | Yes | Callback used to return the result. If the operation fails, an error message is returned.| +| callback | AsyncCallback\ | 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) => { ### getProtocol9+ -getProtocol():Promise\ +getProtocol():Promise\ 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\ | Promise used to return the result. If the operation fails, an error message is returned.| +| Promise\ | 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 => { ### getCipherSuite9+ -getCipherSuite(callback: AsyncCallback\>): void +getCipherSuite(callback: AsyncCallback\\>): 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\> | Yes | Callback used to return the result. If the operation fails, an error message is returned.| +| callback | AsyncCallback\\> | 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) => { ### getCipherSuite9+ -getCipherSuite(): Promise\> +getCipherSuite(): Promise\\> 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\> | Promise used to return the result. If the operation fails, an error message is returned.| +| Promise\\> | 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 => { ### getSignatureAlgorithms9+ -getSignatureAlgorithms(callback: AsyncCallback\>): void +getSignatureAlgorithms(callback: AsyncCallback\\>): 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\> | Yes | Callback used to return the result. | +| callback | AsyncCallback\\> | Yes | Callback used to return the result. | **Error codes** @@ -2445,7 +2448,7 @@ tls.getSignatureAlgorithms((err, data) => { ### getSignatureAlgorithms9+ -getSignatureAlgorithms(): Promise\> +getSignatureAlgorithms(): Promise\\> 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\> | Promise used to return the result.| +| Promise\\> | Promise used to return the result.| **Error codes** @@ -2476,7 +2479,7 @@ tls.getSignatureAlgorithms().then(data => { ### send9+ -send(data: string, callback: AsyncCallback\): void +send(data: string, callback: AsyncCallback\): 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\ | Yes | Callback used to return the result. If the operation fails, an error message is returned.| +| callback | AsyncCallback\ | 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) => { ### send9+ -send(data: string): Promise\ +send(data: string): Promise\ 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\ | Promise used to return the result. If the operation fails, an error message is returned.| +| Promise\ | Promise used to return the result. If the operation fails, an error message is returned.| **Example** @@ -2555,7 +2558,7 @@ tls.send("xxxx").then(() =>{ ### close9+ -close(callback: AsyncCallback\): void +close(callback: AsyncCallback\): 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\ | Yes | Callback used to return the result. If the operation fails, an error message is returned.| +| callback | AsyncCallback\ | 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) => { ### close9+ -close(): Promise\ +close(): Promise\ 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\ | Promise used to return the result. If the operation fails, an error message is returned.| +| Promise\ | 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\ | No| Application Layer Protocol Negotiation (ALPN) protocols. | +| ALPNProtocols | Array\ | No| Application Layer Protocol Negotiation (ALPN) protocols. | ## TLSSecureOptions9+ @@ -2641,11 +2644,11 @@ Defines TLS security options. The CA certificate is mandatory, and other paramet | Name | Type | Mandatory| Description | | --------------------- | ------------------------------------------------------ | --- |----------------------------------- | -| ca | string \| Array\ | Yes| CA certificate of the server, which is used to authenticate the digital certificate of the server.| +| ca | string \| Array\ | 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. | diff --git a/en/application-dev/reference/apis/js-apis-system-location.md b/en/application-dev/reference/apis/js-apis-system-location.md index 140e3bd3d3..7d03495284 100644 --- a/en/application-dev/reference/apis/js-apis-system-location.md +++ b/en/application-dev/reference/apis/js-apis-system-location.md @@ -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(); + } } ``` diff --git a/en/application-dev/reference/errorcodes/Readme-EN.md b/en/application-dev/reference/errorcodes/Readme-EN.md index 0cd7bb1fba..96e4cfe4be 100644 --- a/en/application-dev/reference/errorcodes/Readme-EN.md +++ b/en/application-dev/reference/errorcodes/Readme-EN.md @@ -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) diff --git a/en/application-dev/reference/errorcodes/errorcode-net-connection.md b/en/application-dev/reference/errorcodes/errorcode-net-connection.md new file mode 100644 index 0000000000..00e1eaaf78 --- /dev/null +++ b/en/application-dev/reference/errorcodes/errorcode-net-connection.md @@ -0,0 +1,114 @@ +# 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. diff --git a/en/application-dev/reference/errorcodes/errorcode-net-ethernet.md b/en/application-dev/reference/errorcodes/errorcode-net-ethernet.md new file mode 100644 index 0000000000..b8a940de2a --- /dev/null +++ b/en/application-dev/reference/errorcodes/errorcode-net-ethernet.md @@ -0,0 +1,116 @@ +# 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. diff --git a/en/application-dev/reference/errorcodes/errorcode-net-policy.md b/en/application-dev/reference/errorcodes/errorcode-net-policy.md new file mode 100644 index 0000000000..87e1ad36f0 --- /dev/null +++ b/en/application-dev/reference/errorcodes/errorcode-net-policy.md @@ -0,0 +1,59 @@ +# 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. diff --git a/en/application-dev/reference/errorcodes/errorcode-net-sharing.md b/en/application-dev/reference/errorcodes/errorcode-net-sharing.md new file mode 100644 index 0000000000..5535d15e99 --- /dev/null +++ b/en/application-dev/reference/errorcodes/errorcode-net-sharing.md @@ -0,0 +1,159 @@ +# 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. diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelog-telephony.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelog-telephony.md new file mode 100644 index 0000000000..e2e631e1f4 --- /dev/null +++ b/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelog-telephony.md @@ -0,0 +1,223 @@ +# 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; + function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback): void; + function reject(callId?: number, options?: RejectMessageOptions): Promise; + function reject(callback: AsyncCallback): void; + function reject(options: RejectMessageOptions, callback: AsyncCallback): void; +``` + +- Before change: + +```js + function reject(callId: number, callback: AsyncCallback): void; + function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback): void; + function reject(callId?: number, options?: RejectMessageOptions): Promise; + function reject(callback: AsyncCallback): void; + function reject(options: RejectMessageOptions, callback: AsyncCallback): void; +``` + +- After change: + +```js + function rejectCall(callId: number, callback: AsyncCallback): void; + function rejectCall(callId: number, options: RejectMessageOptions, callback: AsyncCallback): void; + function rejectCall(callId?: number, options?: RejectMessageOptions): Promise; + function rejectCall(callback: AsyncCallback): void; + function rejectCall(options: RejectMessageOptions, callback: AsyncCallback): 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; + function answer(callId?: number): Promise; + function answer(callback: AsyncCallback): void; +``` + +- Before change: + +```js + function answer(callId: number, callback: AsyncCallback): void; + function answer(callId?: number): Promise; + function answer(callback: AsyncCallback): void; +``` + +- After change: + +```js + function answerCall(callId: number, callback: AsyncCallback): void; + function answerCall(callId?: number): Promise; + function answerCall(callback: AsyncCallback): 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; + function hangup(callId?: number): Promise; + function hangup(callback: AsyncCallback): void; +``` + +- Before change: + +```js + function hangup(callId: number, callback: AsyncCallback): void; + function hangup(callId?: number): Promise; + function hangup(callback: AsyncCallback): void; +``` + +- After change: + +```js + function hangUpCall(callId: number, callback: AsyncCallback): void; + function hangUpCall(callId?: number): Promise; + function hangUpCall(callback: AsyncCallback): 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)}`); +}); +``` -- GitLab