未验证 提交 1cffac11 编写于 作者: O openharmony_ci 提交者: Gitee

!19894 翻译已完成18949+19185+19184+19239+19331+19289+19367+19337

Merge pull request !19894 from shawn_he/18949-d
......@@ -179,18 +179,18 @@ import featureAbility from '@ohos.ability.featureAbility'
let context = featureAbility.getContext();
context.getFilesDir().then((data) => {
var path = data + "/serviceInfo.txt"
console.info("output path: " + path)
let fd = fs.openSync(path, 0o102, 0o666)
var serviceId = 10
var args = new Array("allInfo")
var path = data + "/serviceInfo.txt";
console.info("output path: " + path);
let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
var serviceId = 10;
var args = new Array("allInfo");
try {
hidebug.getServiceDump(serviceId, fd, args)
hidebug.getServiceDump(serviceId, file.fd, args);
} catch (error) {
console.info(error.code)
console.info(error.message)
console.info(error.code);
console.info(error.message);
}
fs.closeSync(fd);
fs.closeSync(file);
})
```
......
......@@ -16,7 +16,7 @@ import http from '@ohos.net.http';
## Examples
```js
// Import the HTTP namespace.
// Import the http namespace.
import http from '@ohos.net.http';
// Each httpRequest corresponds to an HTTP request task and cannot be reused.
......@@ -35,17 +35,17 @@ httpRequest.request(
header: {
'Content-Type': 'application/json'
},
// This field is used to transfer data when the POST request is used.
// This parameter is used to transfer data when the POST request is used.
extraData: {
"data": "data to send",
},
expectDataType: http.HttpDataType.STRING, // Optional. This field specifies the type of the return data.
expectDataType: http.HttpDataType.STRING, // Optional. This parameter specifies the type of the return data.
usingCache: true, // Optional. The default value is true.
priority: 1, // Optional. The default value is 1.
connectTimeout: 60000 // Optional. The default value is 60000, in ms.
readTimeout: 60000, // Optional. The default value is 60000, in ms.
usingProtocol: http.HttpProtocol.HTTP1_1, // Optional. The default protocol type is automatically specified by the system.
usingProxy: false, // Optional. By default, network proxy is not used. This field is supported since API 10.
usingProxy: false, // Optional. By default, network proxy is not used. This field is supported since API version 10.
caPath: "", // Optional. The preset CA certificate is used by default. This field is supported since API version 10.
}, (err, data) => {
if (!err) {
......@@ -55,13 +55,13 @@ httpRequest.request(
// data.header carries the HTTP response header. Parse the content based on service requirements.
console.info('header:' + JSON.stringify(data.header));
console.info('cookies:' + JSON.stringify(data.cookies)); // 8+
// Call the destroy() method to release resources after HttpRequest is complete.
// Call the destroy() method to release resources after the HttpRequest is complete.
httpRequest.destroy();
} else {
console.info('error:' + JSON.stringify(err));
// Unsubscribe from HTTP Response Header events.
httpRequest.off('headersReceive');
// Call the destroy() method to release resources after HttpRequest is complete.
// Call the destroy() method to release resources after the HttpRequest is complete.
httpRequest.destroy();
}
}
......@@ -75,7 +75,10 @@ httpRequest.request(
createHttp(): HttpRequest
Creates an HTTP request. You can use this API to initiate or destroy an HTTP request, or enable or disable listening for HTTP Response Header events. An HttpRequest object corresponds to an HTTP request. To initiate multiple HTTP requests, you must create an **HttpRequest** object for each HTTP request.
Creates an HTTP request. You can use this API to initiate or destroy an HTTP request, or enable or disable listening for HTTP Response Header events. An **HttpRequest** object corresponds to an HTTP request. To initiate multiple HTTP requests, you must create an **HttpRequest** object for each HTTP request.
> **NOTE**
> Call the **destroy()** method to release resources after the HttpRequest is complete.
**System capability**: SystemCapability.Communication.NetStack
......@@ -434,7 +437,7 @@ httpRequest.request2("EXAMPLE_URL", (err, data) => {
request2(url: string, options: HttpRequestOptions, callback: AsyncCallback\<number\>): void
Initiates an HTTP request to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response.
Initiates an HTTP request containing specified options to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response.
**Required permissions**: ohos.permission.INTERNET
......@@ -569,7 +572,7 @@ Initiates an HTTP request containing specified options to a given URL. This API
> **NOTE**
> For details about the error codes, see [HTTP Error Codes](../errorcodes/errorcode-net-http.md).
> The HTTP error code mapping is in the format of 2300000 + Curl error code. For more common error codes, see:
> The HTTP error code mapping is in the format of 2300000 + Curl error code. For more common error codes, see [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html).
**Example**
......@@ -596,7 +599,7 @@ on(type: 'headerReceive', callback: AsyncCallback\<Object\>): void
Registers an observer for HTTP Response Header events.
> **NOTE**
> This API has been deprecated. You are advised to use [on('headersReceive')<sup>8+</sup>](#onheadersreceive8) instead.
> This API has been deprecated. You are advised to use [on('headersReceive')<sup>8+</sup>](#onheadersreceive8).
**System capability**: SystemCapability.Communication.NetStack
......@@ -623,7 +626,7 @@ Unregisters the observer for HTTP Response Header events.
> **NOTE**
>
>1. This API has been deprecated. You are advised to use [off('headersReceive')<sup>8+</sup>](#offheadersreceive8) instead.
>1. This API has been deprecated. You are advised to use [off('headersReceive')<sup>8+</sup>](#offheadersreceive8).
>
>2. You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
......@@ -718,6 +721,9 @@ on(type: 'dataReceive', callback: Callback\<ArrayBuffer\>): void
Registers an observer for events indicating receiving of HTTP streaming responses.
> **NOTE**
> Currently, listening for events related to HTTP streaming data upload is not supported.
**System capability**: SystemCapability.Communication.NetStack
**Parameters**
......@@ -765,6 +771,9 @@ on(type: 'dataEnd', callback: Callback\<void\>): void
Registers an observer for events indicating completion of receiving HTTP streaming responses.
> **NOTE**
> Currently, listening for events related to HTTP streaming data upload is not supported.
**System capability**: SystemCapability.Communication.NetStack
**Parameters**
......@@ -812,6 +821,9 @@ on(type: 'dataProgress', callback: Callback\<{ receiveSize: number, totalSize: n
Registers an observer for events indicating progress of receiving HTTP streaming responses.
> **NOTE**
> Currently, listening for events related to HTTP streaming data upload is not supported.
**System capability**: SystemCapability.Communication.NetStack
**Parameters**
......@@ -819,7 +831,7 @@ Registers an observer for events indicating progress of receiving HTTP streaming
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | --------------------------------- |
| type | string | Yes | Event type. The value is **dataProgress**.|
| callback | AsyncCallback\<{ receiveSize: number, totalSize: number }\> | Yes | Callback used to return the result.<br>**receiveSize**: number of received bytes.<br>**totalSize**: total number of bytes to be received.|
| callback | AsyncCallback\<{ receiveSize: number, totalSize: number }\> | Yes | Callback used to return the result.<br>- **receiveSize**: number of received bytes.<br>- **totalSize**: total number of bytes to be received.|
**Example**
......@@ -862,7 +874,7 @@ Specifies the type and value range of the optional parameters in the HTTP reques
| Name | Type | Mandatory| Description |
| -------------- | --------------------------------------------- | ---- | ------------------------------------------------------------ |
| method | [RequestMethod](#requestmethod) | No | Request method. The default value is **GET**. |
| extraData | string<sup>6+</sup> \| Object<sup>6+</sup> \| ArrayBuffer<sup>8+</sup> | No | Additional data for sending a request. This parameter is not used by default.<br>- If the HTTP request uses a POST or PUT method, this parameter serves as the content of the HTTP request and is encoded in UTF-8 format. If **'Content-Type'** is **'application/x-www-form-urlencoded'**, the data in the request body must be encoded in the format of **key1=value1&key2=value2&key3=value3** after URL transcoding.<br>- If the HTTP request uses the GET, OPTIONS, DELETE, TRACE, or CONNECT method, this parameter serves as a supplement to HTTP request parameters. Parameters of the string type need to be encoded before being passed to the HTTP request. Parameters of the object type do not need to be precoded and will be directly concatenated to the URL. Parameters of the ArrayBuffer type will not be concatenated to the URL.|
| extraData | string<sup>6+</sup> \| Object<sup>6+</sup> \| ArrayBuffer<sup>8+</sup> | No | Additional data for sending a request. This parameter is not used by default.<br>- If the HTTP request uses a POST or PUT method, this parameter serves as the content of the HTTP request and is encoded in UTF-8 format. If **'Content-Type'** is **'application/x-www-form-urlencoded'**, the data in the request body must be encoded in the format of **key1=value1&key2=value2&key3=value3** after URL transcoding. - If the HTTP request uses the GET, OPTIONS, DELETE, TRACE, or CONNECT method, this parameter serves as a supplement to HTTP request parameters. Parameters of the string type need to be encoded before being passed to the HTTP request. Parameters of the object type do not need to be precoded and will be directly concatenated to the URL. Parameters of the ArrayBuffer type will not be concatenated to the URL.|
| expectDataType<sup>9+</sup> | [HttpDataType](#httpdatatype9) | No | Type of the returned data. This parameter is not used by default. If this parameter is set, the system returns the specified type of data preferentially.|
| usingCache<sup>9+</sup> | boolean | No | Whether to use the cache. The default value is **true**. |
| priority<sup>9+</sup> | number | No | Priority. The value range is [1,1000]. The default value is **1**. |
......@@ -898,7 +910,7 @@ Enumerates the response codes for an HTTP request.
| Name | Value | Description |
| ----------------- | ---- | ------------------------------------------------------------ |
| OK | 200 | "OK." The request has been processed successfully. This return code is generally used for GET and POST requests. |
| OK | 200 | The request is successful. The request has been processed successfully. This return code is generally used for GET and POST requests. |
| CREATED | 201 | "Created." The request has been successfully sent and a new resource is created. |
| ACCEPTED | 202 | "Accepted." The request has been accepted, but the processing has not been completed. |
| NOT_AUTHORITATIVE | 203 | "Non-Authoritative Information." The request is successful. |
......
# @ohos.multimodalInput.intentionCode (Intention Code)
The **intentionCode** module maps the original events of the keyboard to intention codes for normalized interaction. For example, if the mapped event of the space bar on the keyboard is **INTENTION_SELECT**, the intent is to select an item.
> **NOTE**
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```js
import IntentionCode from '@ohos.multimodalInput.intentionCode';
```
## IntentionCode
Enumerates intention codes.
**System capability**: SystemCapability.MultimodalInput.Input.Core
| Name | Value | Description |
| -------------------------------- | ------ | --------------------------- |
| INTENTION_UNKNOWN | -1 | Unknown intent |
| INTENTION_UP | 1 | Up |
| INTENTION_DOWN | 2 | Down |
| INTENTION_LEFT | 3 | Left |
| INTENTION_RIGHT | 4 | Right |
| INTENTION_SELECT | 5 | Select |
| INTENTION_ESCAPE | 6 | Escape |
| INTENTION_BACK | 7 | Back |
| INTENTION_FORWARD | 8 | Forward |
| INTENTION_MENU | 9 | Menu |
| INTENTION_PAGE_UP | 11 | Page up |
| INTENTION_PAGE_DOWN | 12 | Page down |
| INTENTION_ZOOM_OUT | 13 | Zoom out |
| INTENTION_ZOOM_IN | 14 | Zoom in |
......@@ -12,6 +12,8 @@ debug(message: string, ...arguments: any[]): void
Prints debugging information in formatted output mode.
Since API version 9, this API is supported in ArkTS widgets.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
......@@ -39,6 +41,8 @@ log(message: string, ...arguments: any[]): void
Prints log information in formatted output mode.
Since API version 9, this API is supported in ArkTS widgets.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
......@@ -66,6 +70,8 @@ info(message: string, ...arguments: any[]): void
Prints log information in formatted output mode. This API is the alias of **console.log ()**.
Since API version 9, this API is supported in ArkTS widgets.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
......@@ -93,6 +99,8 @@ warn(message: string, ...arguments: any[]): void
Prints warning information in formatted output mode.
Since API version 9, this API is supported in ArkTS widgets.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
......@@ -120,6 +128,8 @@ error(message: string, ...arguments: any[]): void
Prints error information in formatted output mode.
Since API version 9, this API is supported in ArkTS widgets.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
......
......@@ -67,6 +67,7 @@ Obtains the default active data network. This API uses an asynchronous callback
| ID| Error Message |
| ------- | ----------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -100,6 +101,7 @@ Obtains the default active data network. This API uses a promise to return the r
| ID| Error Message |
| ------- | ----------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -132,6 +134,7 @@ Obtains the default active data network in synchronous mode. You can use [getNet
| ID| Error Message |
| ------- | ----------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -161,6 +164,8 @@ Obtains the global HTTP proxy configuration of the network. This API uses an asy
| ID| Error Message |
| ------- | ----------------------------- |
| 401 | Parameter error. |
| 202 | Non-system applications use system APIs. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -193,6 +198,8 @@ Obtains the global HTTP proxy configuration of the network. This API uses a prom
| ID| Error Message |
| ------- | ----------------------------- |
| 401 | Parameter error. |
| 202 | Non-system applications use system APIs. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -231,6 +238,7 @@ Sets the global HTTP proxy configuration of the network. This API uses an asynch
| ------- | ----------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 202 | Non-system applications use system APIs. |
| 2100001 | Invalid parameter value. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -280,6 +288,7 @@ Sets the global HTTP proxy configuration of the network. This API uses a promise
| ------- | ----------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 202 | Non-system applications use system APIs. |
| 2100001 | Invalid parameter value. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -319,6 +328,7 @@ Obtains information about the network bound to an application. This API uses an
| ID| Error Message |
| ------- | ----------------------------- |
| 401 | Parameter error.|
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -349,6 +359,7 @@ Obtains information about the network bound to an application. This API uses a p
| ID| Error Message |
| ------- | ----------------------------- |
| 401 | Parameter error.|
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -465,6 +476,7 @@ Obtains the list of all connected networks. This API uses an asynchronous callba
| ID| Error Message |
| ------- | ----------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -498,6 +510,7 @@ Obtains the list of all connected networks. This API uses a promise to return th
| ID| Error Message |
| ------- | ----------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -690,6 +703,7 @@ Checks whether the data traffic usage on the current network is metered. This AP
| ID| Error Message |
| ------- | ----------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -723,6 +737,7 @@ Checks whether the data traffic usage on the current network is metered. This AP
| ID| Error Message |
| ------- | ----------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -755,6 +770,7 @@ Checks whether the default data network is activated. This API uses an asynchron
| ID| Error Message |
| ------- | ----------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -788,6 +804,7 @@ Checks whether the default data network is activated. This API uses a promise to
| ID| Error Message |
| ------- | ----------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -821,7 +838,9 @@ Enables the airplane mode. This API uses an asynchronous callback to return the
| ID| Error Message |
| ------- | ----------------------------- |
| 202 | Non-system applications use system APIs.|
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -855,7 +874,9 @@ Enables the airplane mode. This API uses a promise to return the result.
| ID| Error Message |
| ------- | ----------------------------- |
| 202 | Non-system applications use system APIs.|
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -889,7 +910,9 @@ Disables the airplane mode. This API uses an asynchronous callback to return the
| ID| Error Message |
| ------- | ----------------------------- |
| 202 | Non-system applications use system APIs.|
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -923,7 +946,9 @@ Disables the airplane mode. This API uses a promise to return the result.
| ID| Error Message |
| ------- | ----------------------------- |
| 202 | Non-system applications use system APIs.|
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
......@@ -1251,7 +1276,7 @@ on(type: 'netAvailable', callback: Callback\<NetHandle>): void
Registers a listener for **netAvailable** events.
**Model restriction**: Before you call this API, make sure that you have called **register** to add a listener and called **unregister** API to unsubscribe from status changes of the default network.
**Model restriction**: Before you call this API, make sure tat you have called **register** to add a listener and called **unregister** API to unsubscribe from status changes of the default network.
**System capability**: SystemCapability.Communication.NetManager.Core
......
......@@ -415,7 +415,9 @@ Registers an observer for NIC hot swap events. This API uses an asynchronous cal
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
**Example**
......@@ -448,7 +450,9 @@ Unregisters the observer for NIC hot swap events. This API uses an asynchronous
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
**Example**
......
......@@ -394,6 +394,12 @@ Creates a **DiscoveryService** object, which is used to discover mDNS services o
| ----------------------------- |---------------------------------|
| DiscoveryService | **DiscoveryService** object used to discover mDNS services based on the specified **serviceType** and **Context**.|
**Error codes**
| ID | Error Message|
|---------|---|
| 401 | Parameter error. |
**Example**
FA model:
......@@ -623,7 +629,7 @@ FA model:
// Obtain the context.
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
let serviceType = "_print._tcp";
let discoveryService = mdns.createDiscoveryService(context, serviceType);
discoveryService.startSearchingMDNS();
```
......@@ -639,7 +645,7 @@ class EntryAbility extends UIAbility {
}
}
let context = globalThis.context;
let serviceType = "_print._tcp";
let discoveryService = mdns.createDiscoveryService(context, serviceType);
discoveryService.startSearchingMDNS();
```
......@@ -660,7 +666,7 @@ FA model:
// Obtain the context.
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
let serviceType = "_print._tcp";
let discoveryService = mdns.createDiscoveryService(context, serviceType);
discoveryService.stopSearchingMDNS();
```
......@@ -676,7 +682,7 @@ class EntryAbility extends UIAbility {
}
}
let context = globalThis.context;
let serviceType = "_print._tcp";
let discoveryService = mdns.createDiscoveryService(context, serviceType);
discoveryService.stopSearchingMDNS();
```
......@@ -700,6 +706,8 @@ Enables listening for **discoveryStart** events.
```js
// See mdns.createDiscoveryService.
let context = globalThis.context;
let serviceType = "_print._tcp";
let discoveryService = mdns.createDiscoveryService(context, serviceType);
discoveryService.startSearchingMDNS();
......@@ -729,6 +737,8 @@ Enables listening for **discoveryStop** events.
```js
// See mdns.createDiscoveryService.
let context = globalThis.context;
let serviceType = "_print._tcp";
let discoveryService = mdns.createDiscoveryService(context, serviceType);
discoveryService.startSearchingMDNS();
......@@ -758,6 +768,8 @@ Enables listening for **serviceFound** events.
```js
// See mdns.createDiscoveryService.
let context = globalThis.context;
let serviceType = "_print._tcp";
let discoveryService = mdns.createDiscoveryService(context, serviceType);
discoveryService.startSearchingMDNS();
......@@ -787,6 +799,8 @@ Enables listening for **serviceLost** events.
```js
// See mdns.createDiscoveryService.
let context = globalThis.context;
let serviceType = "_print._tcp";
let discoveryService = mdns.createDiscoveryService(context, serviceType);
discoveryService.startSearchingMDNS();
......@@ -805,7 +819,7 @@ Defines the mDNS service information.
| Name | Type | Mandatory| Description |
| --------------------- | ---------------------------------- | --- | ------------------------ |
| serviceType | string | Yes| Type of the mDNS service. The value is in the format of **\_\<name>.\<tcp/udp>**, where **name** contains a maximum of 63 characters excluding periods (.). |
| serviceType | string | Yes| Type of the mDNS service. The value is in the format of **\_\<name>.<_tcp/_udp>**, where **name** contains a maximum of 63 characters excluding periods (.). |
| serviceName | string | Yes| Name of the mDNS service. |
| port | number | No| Port number of the mDNS server. |
| host | [NetAddress](js-apis-net-connection.md#netaddress) | No| IP address of the device that provides the mDNS service. The IP address is not effective when an mDNS service is added or removed. |
......
......@@ -35,6 +35,7 @@ Checks whether network sharing is supported. This API uses an asynchronous callb
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
| 2202011 | Cannot get network sharing configuration. |
......@@ -71,6 +72,7 @@ Checks whether network sharing is supported. This API uses a promise to return t
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
| 2202011 | Cannot get network sharing configuration. |
......@@ -184,6 +186,7 @@ Starts network sharing of a specified type. This API uses an asynchronous callba
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
......@@ -233,6 +236,7 @@ Starts network sharing of a specified type. This API uses a promise to return th
| ID| Error Message |
| ------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
......@@ -377,6 +381,8 @@ Obtains the volume of mobile data traffic received via network sharing. This API
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
......@@ -412,6 +418,8 @@ Obtains the volume of mobile data traffic received via network sharing. This API
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
......@@ -448,6 +456,8 @@ Obtains the volume of mobile data traffic sent via network sharing. This API use
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
......@@ -483,6 +493,8 @@ Obtains the volume of mobile data traffic sent via network sharing. This API use
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
......@@ -519,6 +531,8 @@ Obtains the volume of mobile data traffic sent and received via network sharing.
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
......@@ -554,6 +568,8 @@ Obtains the volume of mobile data traffic sent and received via network sharing.
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
......@@ -591,6 +607,7 @@ Obtains the names of NICs in the specified network sharing state. This API uses
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
......@@ -637,6 +654,7 @@ Obtains the names of NICs in the specified network sharing state. This API uses
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
......@@ -679,6 +697,7 @@ Obtains the network sharing state of the specified type. This API uses an asynch
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
......@@ -719,6 +738,7 @@ Obtains the network sharing state of the specified type. This API uses a promise
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
......@@ -767,6 +787,7 @@ Obtains regular expressions of NICs of a specified type. This API uses an asynch
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
......@@ -813,6 +834,7 @@ Obtains regular expressions of NICs of a specified type. This API uses a promise
| ID| Error Message |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
......@@ -854,7 +876,9 @@ Subscribes to network sharing state changes. This API uses an asynchronous callb
| ID| Error Message |
| ------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
**Example**
......@@ -887,7 +911,9 @@ Unsubscribes from network sharing state changes. This API uses an asynchronous c
| ID| Error Message |
| ------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
**Example**
......@@ -921,7 +947,9 @@ Subscribes to network sharing state changes of a specified NIC. This API uses an
| ID| Error Message |
| ------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
**Example**
......@@ -955,7 +983,9 @@ Unsubscribes from network sharing status changes of a specified NIC. This API us
| ID| Error Message |
| ------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
**Example**
......@@ -988,7 +1018,9 @@ Subscribes to upstream network changes. This API uses an asynchronous callback t
| ID| Error Message |
| ------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
**Example**
......@@ -1021,7 +1053,9 @@ Unsubscribes from upstream network changes. This API uses an asynchronous callba
| ID| Error Message |
| ------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
**Example**
......
......@@ -550,7 +550,7 @@ Checks whether the current device supports 5G \(NR\).
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [isNRSupported](#radioisnrsupported9) instead.
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [isNRSupported](#radioisnrsupported9).
**System capability**: SystemCapability.Telephony.CoreService
......@@ -575,7 +575,7 @@ Checks whether the current device supports 5G \(NR\).
> **NOTE**
>
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [isNRSupported](#radioisnrsupported9-1) instead.
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [isNRSupported](#radioisnrsupported9-1).
**System capability**: SystemCapability.Telephony.CoreService
......@@ -998,7 +998,7 @@ radio.getIMEI((err, data) => {
getIMEI\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the IMEI of the SIM card in a card slot. This API uses an asynchronous callback to return the result.
Obtains the IMEI of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
......@@ -1041,7 +1041,7 @@ radio.getIMEI(slotId, (err, data) => {
getIMEI\(slotId?: number\): Promise\<string\>
Obtains the IMEI of the SIM card in the specified card slot. This API uses a promise to return the result.
Obtains the IMEI of the SIM card in the specified slot. This API uses a promise to return the result.
**System API**: This is a system API.
......@@ -1132,7 +1132,7 @@ radio.getMEID((err, data) => {
getMEID\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the MEID of the SIM card in a card slot. This API uses an asynchronous callback to return the result.
Obtains the MEID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
......@@ -1175,7 +1175,7 @@ radio.getMEID(slotId, (err, data) => {
getMEID\(slotId?: number\): Promise\<string\>
Obtains the MEID of the SIM card in the specified card slot. This API uses a promise to return the result.
Obtains the MEID of the SIM card in the specified slot. This API uses a promise to return the result.
**System API**: This is a system API.
......@@ -1266,7 +1266,7 @@ radio.getUniqueDeviceId((err, data) => {
getUniqueDeviceId\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the unique device ID of the SIM card in a card slot. This API uses an asynchronous callback to return the result.
Obtains the unique device ID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
......@@ -1309,7 +1309,7 @@ radio.getUniqueDeviceId(slotId, (err, data) => {
getUniqueDeviceId\(slotId?: number\): Promise\<string\>
Obtains the unique device ID of the SIM card in the specified card slot. This API uses a promise to return the result.
Obtains the unique device ID of the SIM card in the specified slot. This API uses a promise to return the result.
**System API**: This is a system API.
......@@ -1824,12 +1824,16 @@ promise.then(data => {
});
```
## radio.getNrOptionMode<sup>8+</sup>
## radio.getNrOptionMode<sup>(deprecated)</sup>
getNrOptionMode\(callback: AsyncCallback\<NrOptionMode\>\): void
Obtains the NR option mode. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> This API is supported since API version 8 and deprecated since API version 10. You are advised to use [getNROptionMode](#radiogetnroptionmode10).
**System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService
......@@ -1838,7 +1842,7 @@ Obtains the NR option mode. This API uses an asynchronous callback to return the
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------- | ---- | ---------- |
| callback | AsyncCallback\<[NrOptionMode](#nroptionmode8)\> | Yes | Callback used to return the result.|
| callback | AsyncCallback\<[NrOptionMode](#nroptionmodedeprecated)\> | Yes | Callback used to return the result.|
**Error codes**
......@@ -1862,11 +1866,15 @@ radio.getNrOptionMode((err, data) => {
```
## radio.getNrOptionMode<sup>8+</sup>
## radio.getNrOptionMode<sup>(deprecated)</sup>
getNrOptionMode\(slotId: number, callback: AsyncCallback\<NrOptionMode\>\): void
Obtains the NR option mode for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
Obtains the NR option mode. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> This API is supported since API version 8 and deprecated since API version 10. You are advised to use [getNROptionMode](#radiogetnroptionmode10).
**System API**: This is a system API.
......@@ -1875,9 +1883,9 @@ Obtains the NR option mode for the SIM card in the specified slot. This API uses
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------- | ---- | -------------------------------------- |
| -------- | ----------------------------------------------- | ---- | ------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<[NrOptionMode](#nroptionmode8)\> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<[NrOptionMode](#nroptionmodedeprecated)\> | Yes | Callback used to return the result. |
**Error codes**
......@@ -1902,12 +1910,16 @@ radio.getNrOptionMode(slotId, (err, data) => {
```
## radio.getNrOptionMode<sup>8+</sup>
## radio.getNrOptionMode<sup>(deprecated)</sup>
getNrOptionMode\(slotId?: number\): Promise\<NrOptionMode\>
Obtains the NR option mode for the SIM card in the specified slot. This API uses a promise to return the result.
> **NOTE**
>
> This API is supported since API version 8 and deprecated since API version 10. You are advised to use [getNROptionMode](#radiogetnroptionmode10).
**System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService
......@@ -1920,9 +1932,9 @@ Obtains the NR option mode for the SIM card in the specified slot. This API uses
**Return value**
| Type | Description |
| ----------------------------------------- | ----------------------- |
| Promise\<[NrOptionMode](#nroptionmode8)\> | Promise used to return the result.|
| Type | Description |
| -------------------------------------------------- | ----------------------- |
| Promise\<[NrOptionMode](#nroptionmodedeprecated)\> | Promise used to return the result. |
**Error codes**
......@@ -2581,7 +2593,7 @@ radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => {
getBasebandVersion\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the baseband version of the device. This API uses an asynchronous callback to return the result.
Obtains the baseband version of the device for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
......@@ -2624,7 +2636,7 @@ radio.getBasebandVersion(slotId, (err, data) => {
getBasebandVersion\(slotId: number\): Promise\<string\>
Obtains the baseband version of the device. This API uses a promise to return the result.
Obtains the baseband version of the device for the SIM card in the specified slot. This API uses a promise to return the result.
**System API**: This is a system API.
......@@ -2671,9 +2683,193 @@ promise.then(data => {
```
## radio.setNROptionMode<sup>10+</sup>
setNROptionMode\(slotId: number, mode: NROptionMode, callback: AsyncCallback\<void\>\): void
Sets the NR mode for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CoreService
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| mode | [NROptionMode](#nroptionmode10) | Yes | Enumerates NR selection modes. |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example**
```js
let slotId = 0;
radio.setNROptionMode(slotId, 1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.setNROptionMode<sup>10+</sup>
setNROptionMode\(slotId: number, mode: NROptionMode\): Promise\<void\>
Sets the NR mode for the SIM card in the specified slot. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CoreService
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------------------------------- | ---- | ------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| mode | [NROptionMode](#nroptionmode10) | Yes | Enumerates NR selection modes. |
**Return value**
| Type | Description |
| ----------------- | ----------------------- |
| Promise\<void\> | Promise used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example**
```js
let slotId = 0;
let promise = radio.setNROptionMode(slotId, 1);
promise.then(data => {
console.log(`setNROptionMode success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`setNROptionMode failed, promise: err->${JSON.stringify(err)}`);
});
```
## radio.getNROptionMode<sup>10+</sup>
getNROptionMode\(slotId: number, callback: AsyncCallback\<NROptionMode\>\): void
Obtains the NR option mode for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | AsyncCallback\<[NROptionMode](#nroptionmode10)\> | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example**
```js
let slotId = 0;
radio.getNROptionMode(slotId, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.getNROptionMode<sup>10+</sup>
getNROptionMode\(slotId: number\): Promise\<NROptionMode\>
Obtains the NR option mode for the SIM card in the specified slot. This API uses a promise to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
**Return value**
| Type | Description |
| ----------------------------------------- | ----------------------- |
| Promise\<[NROptionMode](#nroptionmode10)\> | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example**
```js
let slotId = 0;
let promise = radio.getNROptionMode(slotId);
promise.then(data => {
console.log(`getNROptionMode success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getNROptionMode failed, promise: err->${JSON.stringify(err)}`);
});
```
## RadioTechnology
Enumerates radio access technologies.
Enumerates radio access technologies.
**System capability**: SystemCapability.Telephony.CoreService
......@@ -2947,10 +3143,14 @@ Defines the WCDMA cell information.
| mcc | string | Yes | Mobile country code.|
| mnc | string | Yes | Mobile network code. |
## NrOptionMode<sup>8+</sup>
## NrOptionMode<sup>(deprecated)</sup>
Enumerates NR selection modes.
> **NOTE**
>
> This API is supported since API version 8 and deprecated since API version 10. You are advised to use [NROptionMode](#nroptionmode10).
**System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService
......@@ -2962,6 +3162,21 @@ Enumerates NR selection modes.
| NR_OPTION_SA_ONLY | 2 | NR selection mode in 5G non-standalone networking. |
| NR_OPTION_NSA_AND_SA | 3 | NR selection mode in non-standalone and standalone networking.|
## NROptionMode<sup>10+</sup>
Enumerates NR selection modes.
**System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService
| Name | Value | Description |
| -------------------- | ---- | --------------------------------- |
| NR_OPTION_UNKNOWN | 0 | Unknown NR selection mode. |
| NR_OPTION_NSA_ONLY | 1 | NR selection mode in 5G non-standalone networking. |
| NR_OPTION_SA_ONLY | 2 | NR selection mode in 5G non-standalone networking. |
| NR_OPTION_NSA_AND_SA | 3 | NR selection mode in non-standalone and standalone networking. |
## NetworkSearchResult
Defines the network search result.
......
......@@ -479,12 +479,12 @@ Enables listening for message receiving events of the UDPSocket connection. This
```js
let udp = socket.constructUDPSocketInstance();
let messageView = '';
udp.on('message', value => {
for (var i = 0; i < value.message.length; i++) {
let messages = value.message[i]
let message = String.fromCharCode(messages);
let messageView = '';
messageView += item;
messageView += message;
}
console.log('on message message: ' + JSON.stringify(messageView));
console.log('remoteInfo: ' + JSON.stringify(value.remoteInfo));
......@@ -513,12 +513,12 @@ Disables listening for message receiving events of the UDPSocket connection. Thi
```js
let udp = socket.constructUDPSocketInstance();
let messageView = '';
let callback = value => {
for (var i = 0; i < value.message.length; i++) {
let messages = value.message[i]
let message = String.fromCharCode(messages);
let messageView = '';
messageView += item;
messageView += message;
}
console.log('on message message: ' + JSON.stringify(messageView));
console.log('remoteInfo: ' + JSON.stringify(value.remoteInfo));
......@@ -681,10 +681,10 @@ Defines other properties of the UDPSocket connection.
| Name | Type | Mandatory| Description |
| ----------------- | ------- | ---- | -------------------------------- |
| broadcast | boolean | No | Whether to send broadcast messages. The default value is **false**. |
| receiveBufferSize | number | No | Size of the receive buffer, in bytes. |
| sendBufferSize | number | No | Size of the send buffer, in bytes. |
| receiveBufferSize | number | No | Size of the receive buffer, in bytes. The default value is **0**. |
| sendBufferSize | number | No | Size of the send buffer, in bytes. The default value is **0**. |
| reuseAddress | boolean | No | Whether to reuse addresses. The default value is **false**. |
| socketTimeout | number | No | Timeout duration of the UDPSocket connection, in ms.|
| socketTimeout | number | No | Timeout duration of the UDPSocket connection, in ms. The default value is **0**.|
## SocketStateBase<sup>7+</sup>
......@@ -1365,12 +1365,12 @@ Enables listening for message receiving events of the TCPSocket connection. This
```js
let tcp = socket.constructTCPSocketInstance();
let messageView = '';
tcp.on('message', value => {
for (var i = 0; i < value.message.length; i++) {
let messages = value.message[i]
let message = String.fromCharCode(messages);
let messageView = '';
messageView += item;
messageView += message;
}
console.log('on message message: ' + JSON.stringify(messageView));
console.log('remoteInfo: ' + JSON.stringify(value.remoteInfo));
......@@ -1399,12 +1399,12 @@ Disables listening for message receiving events of the TCPSocket connection. Thi
```js
let tcp = socket.constructTCPSocketInstance();
let messageView = '';
let callback = value => {
for (var i = 0; i < value.message.length; i++) {
let messages = value.message[i]
let message = String.fromCharCode(messages);
let messageView = '';
messageView += item;
messageView += message;
}
console.log('on message message: ' + JSON.stringify(messageView));
console.log('remoteInfo: ' + JSON.stringify(value.remoteInfo));
......@@ -1569,10 +1569,10 @@ Defines other properties of the TCPSocket connection.
| OOBInline | boolean | No | Whether to enable OOBInline. The default value is **false**. |
| TCPNoDelay | boolean | No | Whether to enable no-delay on the TCPSocket connection. The default value is **false**. |
| socketLinger | Object | Yes | Socket linger.<br>- **on**: whether to enable socket linger. The value true means to enable socket linger and false means the opposite.<br>- **linger**: linger time, in ms. The value ranges from **0** to **65535**.<br>Specify this parameter only when **on** is set to **true**.|
| receiveBufferSize | number | No | Size of the receive buffer, in bytes. |
| sendBufferSize | number | No | Size of the send buffer, in bytes. |
| receiveBufferSize | number | No | Size of the receive buffer, in bytes. The default value is **0**. |
| sendBufferSize | number | No | Size of the send buffer, in bytes. The default value is **0**. |
| reuseAddress | boolean | No | Whether to reuse addresses. The default value is **false**. |
| socketTimeout | number | No | Timeout duration of the UDPSocket connection, in ms. |
| socketTimeout | number | No | Timeout duration of the TCPSocket connection, in ms. The default value is **0**. |
## Description of TCP Error Codes
......@@ -1888,12 +1888,12 @@ Subscribes to **message** events of the TLSSocket connection. This API uses an a
```js
let tls = socket.constructTLSSocketInstance();
let messageView = '';
tls.on('message', value => {
for (var i = 0; i < value.message.length; i++) {
let messages = value.message[i]
let message = String.fromCharCode(messages);
let messageView = '';
messageView += item;
messageView += message;
}
console.log('on message message: ' + JSON.stringify(messageView));
console.log('remoteInfo: ' + JSON.stringify(value.remoteInfo));
......@@ -1922,12 +1922,12 @@ Unsubscribes from **message** events of the TLSSocket connection. This API uses
```js
let tls = socket.constructTLSSocketInstance();
let messageView = '';
let callback = value => {
for (var i = 0; i < value.message.length; i++) {
let messages = value.message[i]
let message = String.fromCharCode(messages);
let messageView = '';
messageView += item;
messageView += message;
}
console.log('on message message: ' + JSON.stringify(messageView));
console.log('remoteInfo: ' + JSON.stringify(value.remoteInfo));
......@@ -2739,6 +2739,7 @@ Closes a TLSSocket connection. This API uses an asynchronous callback to return
| ID| Error Message |
| ------- | -------------------------------------------- |
| 401 | Parameter error. |
| 2303501 | SSL is null. |
| 2303505 | Error occurred in the tls system call. |
| 2303506 | Error clearing tls connection. |
......@@ -2774,6 +2775,7 @@ Closes a TLSSocket connection. This API uses a promise to return the result.
| ID| Error Message |
| ------- | -------------------------------------------- |
| 401 | Parameter error. |
| 2303501 | SSL is null. |
| 2303505 | Error occurred in the tls system call. |
| 2303506 | Error clearing tls connection. |
......@@ -2799,7 +2801,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| ALPN protocol. The value range is ["spdy/1", "http/1.1"]. The default value is **[]**. |
## TLSSecureOptions<sup>9+</sup>
......@@ -2813,10 +2815,10 @@ Defines TLS security options. The CA certificate is mandatory, and other paramet
| 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. |
| 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. |
| protocols | [Protocol](#protocol9) \|Array\<[Protocol](#protocol9)\> | No| TLS protocol version. The default value is **TLSv1.2**. |
| useRemoteCipherPrefer | boolean | No| Whether to use the remote cipher suite preferentially. |
| signatureAlgorithms | string | No| Signing algorithm used during communication. The default value is **""**. |
| cipherSuite | string | No| Cipher suite used during communication. The default value is **""**. |
## Protocol<sup>9+</sup>
......
......@@ -182,12 +182,12 @@ The table below provides only the sites for downloading the latest OpenHarmony L
| Hi3516 solution-Linux (binary)| 3.0 | [Download](https://repo.huaweicloud.com/openharmony/os/3.0/hispark_taurus_linux.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.0/hispark_taurus_linux.tar.gz.sha256) | 418.1 MB |
| RELEASE-NOTES | 3.0 | [Download](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.0-LTS/en/release-notes/OpenHarmony-v3.0-LTS.md)| - | - |
| **Source Code of the Latest Release**| **Version**| **Site**| **SHA-256 Checksum**| **Software Package Size**|
| Full code base (for mini, small, and standard systems)| 3.2 Release | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/code-v3.2-Release.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/code-v3.2-Release.tar.gz.sha256)| 21.8 GB |
| Hi3861 solution (binary) | 3.2 Release| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/hispark_pegasus.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/hispark_pegasus.tar.gz.sha256)| 22.9 MB |
| Hi3516 solution-LiteOS (binary)| 3.2 Release| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz.sha256)| 294.3 MB |
| Hi3516 solution-Linux (binary) | 3.2 Release| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz.sha256)| 174.3 MB |
| RK3568 standard system solution (binary) | 3.2 Release| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release//dayu200_standard_arm32.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release//dayu200_standard_arm32.tar.gz.sha256)| 3.9 GB |
| RELEASE-NOTES | 3.2 Release| [Download](../../release-notes/OpenHarmony-v3.2-release.md)| - | - |
| Full code base (for mini, small, and standard systems) | 4.0 Beta1 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/code-v4.0-Beta1.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/code-v4.0-Beta1.tar.gz.sha256)| 26.2 GB |
| Hi3861 solution (binary) | 4.0 Beta1 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/hispark_pegasus.tar.gz) | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/hispark_pegasus.tar.gz.sha256)| 25.1 MB |
| Hi3516 solution-LiteOS (binary)| 4.0 Beta1 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/hispark_taurus_LiteOS.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/hispark_taurus_LiteOS.tar.gz.sha256)| 287.6 MB |
| Hi3516 solution-Linux (binary) | 4.0 Beta1 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/hispark_taurus_Linux.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/hispark_taurus_Linux.tar.gz.sha256)| 186.4 MB |
| RK3568 standard system solution (binary) | 4.0 Beta1 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/dayu200_standard_arm32.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/dayu200_standard_arm32.tar.gz.sha256)| 4.5 GB |
| RELEASE-NOTES | 4.0 Beta1 | [Download](../../release-notes/OpenHarmony-v4.0-beta1.md)| - | - |
| **Compiler Toolchain**| **Version**| **Site**| **SHA-256 Checksum**| **Software Package Size**|
| Compiler toolchain| - | [Download](https://repo.huaweicloud.com/openharmony/os/2.0/tool_chain/)| - | - |
......
# Globalization Subsystem Changelog
## cl.resourceManager.1 Change in the Meaning of the Return Value for the API Used to Obtain the rawfile Descriptor
Changed the meaning of the return value for the API used to obtain the rawfile descriptor after the non-decompression feature is added in this version. The change in the meaning of the return value, namely, **descriptor: RawFileDescriptor {fd, offset, length}**, is described as follows:
**Before change:**
**fd**: file descriptor for accessing the rawfile.
**offset**: offset for accessing the rawfile. In this case, the value is **0**.
**length**: size of the rawfile to access.
**After change:**
**fd**: file descriptor for accessing the HAP where the rawfile is located.
**offset**: offset of the accessed rawfile relative to the HAP.
**length**: size of the rawfile to access.
**Change Impact**
In versions earlier than 4.0.2.2, the rawfile can be accessed only through **fd**. In version 4.0.2.2 or later, the rawfile can be accessed only through **{fd, offset, and length}**.
**Key API/Component Changes**
| **Original API** |
| ---------------- |
| getRawFd(path: string, callback: AsyncCallback\<RawFileDescriptor>): void |
| getRawFd(path: string): Promise\<RawFileDescriptor> |
| getRawFileDescriptor(path: string, callback: AsyncCallback\<RawFileDescriptor>): void|
| getRawFileDescriptor(path: string): Promise\<RawFileDescriptor>|
||
**Sample Code**
The following is an example of calling the **getRawFd** API:
```
try {
this.context.resourceManager.getRawFd("test.ogg", (error, value) => {
if (error != null) {
console.log(`callback getRawFd failed error code: ${error.code}, message: ${error.message}.`);
} else {
let fileDescriptor = {
fd = value.fd,
offset = value.offset,
length = value.length
}
this.avPlayer.fdSrc(fileDescriptor); // Take the audio player as an example. When calling fdSrc, pass fileDescriptor in addition to fd.
}
});
} catch (error) {
console.error(`callback getRawFd failed, error code: ${error.code}, message: ${error.message}.`)
};
```
## cl.resourceManager.2 Addition of getStringSync and getStringByNameSync APIs
Added the **getStringSync** and **getStringByNameSync** APIs and error codes to obtain and format strings.
| Bundle Name | API |
| --------------- | ---------------------------------------------------- |
| ohos.resourceManager.d.ts | getStringSync(resId: number, ...args: Array<string \| number>): string; |
| ohos.resourceManager.d.ts | getStringSync(resource: Resource, ...args: Array<string \| number>): string; |
| ohos.resourceManager.d.ts | getStringByNameSync(resName: string, ...args: Array<string \| number>): string; |
**Change Impact**
In versions earlier than 4.0.6.2, only the values of string resources can be directly obtained. In 4.0.6.2 or later, the values of string resources can be formatted based on the input arguments for enhanced query.
The following error codes are added:
9001007 If the resource obtained by resId formatting error.
9001008 If the resource obtained by resName formatting error.
**Sample Code**
The following uses **getStringSync** as an example. Before the change, only example 1 is supported. After the change, both example 1 and example 2 are supported.
```
Example 1:
try {
this.context.resourceManager.getStringSync($r('app.string.test').id);
} catch (error) {
console.error(`getStringSync failed, error code: ${error.code}, message: ${error.message}.`)
}
Example 2:
try {
this.context.resourceManager.getStringSync($r('app.string.test').id, "format string", 787, 98.78);
} catch (error) {
console.error(`getStringSync failed, error code: ${error.code}, message: ${error.message}.`)
}
```
**Adaptation Guide**
For details, see the API reference.
[API Reference](../../../application-dev/reference/apis/js-apis-resource-manager.md)
[Error Codes](../../../application-dev/reference/errorcodes/errorcode-resource-manager.md)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册