提交 ea1b4983 编写于 作者: S shawn_he

update doc

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 6aa2c5f6
......@@ -89,8 +89,3 @@ httpRequest.request(
}
);
```
## Samples
The following sample is provided to help you better understand how to develop the HTTP data request feature:
- [`HTTP`: Data Request (ArkTS) (API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Connectivity/Http)
- [HTTP Communication (ArkTS) (API9)](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/SmartChatEtsOH)
# IPC & RPC Development Guidelines
# IPC & RPC Development
## When to Use
......
......@@ -63,7 +63,7 @@ For the complete list of APIs and example code, see [Network Sharing](../referen
});
// Call startSharing to start network sharing of the specified type.
sharing.startSharing(SharingIfaceType.SHARING_WIFI, (error) => {
sharing.startSharing(sharing.SharingIfaceType.SHARING_WIFI, (error) => {
console.log(JSON.stringify(error));
});
```
......@@ -88,7 +88,7 @@ For the complete list of APIs and example code, see [Network Sharing](../referen
});
// Call stopSharing to stop network sharing of the specified type.
sharing.stopSharing(SharingIfaceType.SHARING_WIFI, (error) => {
sharing.stopSharing(sharing.SharingIfaceType.SHARING_WIFI, (error) => {
console.log(JSON.stringify(error));
});
```
......@@ -107,7 +107,7 @@ For the complete list of APIs and example code, see [Network Sharing](../referen
import sharing from '@ohos.net.sharing'
// Call startSharing to start network sharing of the specified type.
sharing.startSharing(SharingIfaceType.SHARING_WIFI, (error) => {
sharing.startSharing(sharing.SharingIfaceType.SHARING_WIFI, (error) => {
console.log(JSON.stringify(error));
});
......@@ -118,7 +118,7 @@ For the complete list of APIs and example code, see [Network Sharing](../referen
});
// Call stopSharing to stop network sharing of the specified type and clear the data volume of network sharing.
sharing.stopSharing(SharingIfaceType.SHARING_WIFI, (error) => {
sharing.stopSharing(sharing.SharingIfaceType.SHARING_WIFI, (error) => {
console.log(JSON.stringify(error));
});
......
......@@ -319,10 +319,3 @@ TLS Socket connection process on the client:
tlsTwoWay.off('close');
});
```
## Samples
The following samples are provided to help you better understand how to develop Socket connection features:
- [`Socket`: Socket Connection (ArkTS) (API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/Network/Socket)
- [UDP Socket (ArkTS) (API9)](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/UdpDemoOH)
- [TCP Socket (ArkTS) (API9)](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/TcpSocketDemo)
......@@ -2,7 +2,7 @@
The **intl** module provides basic i18n capabilities, such as time and date formatting, number formatting, and string sorting, through the standard i18n APIs defined in ECMA 402. For more details about APIs and their usage, see [intl](../reference/apis/js-apis-intl.md).
The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities through supplementary interfaces that are not defined in ECMA 402. It works with the Intl module to provide a complete suite of I18N capabilities.
The [i18n](../reference/apis/js-apis-i18n.md) module provides enhanced I18N capabilities through supplementary interfaces that are not defined in ECMA 402. It works with the Intl module to provide a complete suite of I18N capabilities.
## Setting Locale Information
......@@ -111,7 +111,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug
let dateTimeFormat = new Intl.DateTimeFormat();
```
Alternatively, use your own locale and formatting parameters to create a **DateTimeFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [DateTimeOptions](../reference/apis/js-apis-intl.md#datetimeoptions).
Alternatively, use your own locale and formatting parameters to create a **DateTimeFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [DateTimeOptions](../reference/apis/js-apis-intl.md#datetimeoptions9).
```js
let options = {dateStyle: "full", timeStyle: "full"};
......@@ -150,7 +150,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug
let resolvedOptions = dateTimeFormat.resolvedOptions(); // resolvedOptions = {"locale": "zh-CN", "calendar": "gregorian", "dateStyle":"full", "timeStyle":"full", "timeZone": "CST"}
```
## Number Formatting
## Formatting Numbers
[NumberFormat](../reference/apis/js-apis-intl.md#numberformat) provides APIs to implement the number formatting specific to a locale.
......@@ -181,7 +181,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug
let numberFormat = new Intl.NumberFormat();
```
Alternatively, use your own locale and formatting parameters to create a **NumberFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [NumberOptions](../reference/apis/js-apis-intl.md#numberoptions).
Alternatively, use your own locale and formatting parameters to create a **NumberFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [NumberOptions](../reference/apis/js-apis-intl.md#numberoptions9).
```js
let options = {compactDisplay: "short", notation: "compact"};
......@@ -209,7 +209,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug
let resolvedOptions = numberFormat.resolvedOptions(); // resolvedOptions = {"locale": "zh-CN", "compactDisplay": "short", "notation": "compact", "numberingSystem": "Latn"}
```
## String Sorting
## Sorting Strings
Users in different regions have different requirements for string sorting. [Collator](../reference/apis/js-apis-intl.md#collator8) provides APIs to sort character strings specific to a locale.
......@@ -317,7 +317,7 @@ According to grammars in certain languages, the singular or plural form of a nou
let categoryResult = pluralRules.select(number); // categoryResult = "other"
```
## Formatting Relative Time
## Formatting the Relative Time
[RelativeTimeFormat](../reference/apis/js-apis-intl.md#relativetimeformat8) provides APIs to format the relative time for a specific locale.
......@@ -385,9 +385,3 @@ According to grammars in certain languages, the singular or plural form of a nou
let relativeTimeFormat = new Intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"});
let options = relativeTimeFormat.resolvedOptions(); // options = {"locale": "zh-CN", "style": "long", "numeric": "always", "numberingSystem": "latn"}
```
## Samples
The following sample is provided to help you better understand how to develop internationalization capabilities:
-[`International`: Internationalization (ArkTS) (API9) (Full SDK)] (https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/Internationalnation/International)
# @ohos.net.http (Data Request)
This module provides the HTTP data request capability. An application can initiate a data request over HTTP. Common HTTP methods include **GET**, **POST**, **OPTIONS**, **HEAD**, **PUT**, **DELETE**, **TRACE**, and **CONNECT**.
The **http** module provides the HTTP data request capability. An application can initiate a data request over HTTP. Common HTTP methods include **GET**, **POST**, **OPTIONS**, **HEAD**, **PUT**, **DELETE**, **TRACE**, and **CONNECT**.
>**NOTE**
>
......@@ -13,7 +13,7 @@ This module provides the HTTP data request capability. An application can initia
import http from '@ohos.net.http';
```
## Example
## Examples
```js
// Import the http namespace.
......@@ -27,7 +27,7 @@ httpRequest.on('headersReceive', (header) => {
console.info('header: ' + JSON.stringify(header));
});
httpRequest.request(
// Customize EXAMPLE_URL on your own. It is up to you whether to add parameters to the URL.
// Customize EXAMPLE_URL in extraData on your own. It is up to you whether to add parameters to the URL.
"EXAMPLE_URL",
{
method: http.RequestMethod.POST, // Optional. The default value is http.RequestMethod.GET.
......@@ -69,7 +69,7 @@ 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.
**System capability**: SystemCapability.Communication.NetStack
......@@ -231,7 +231,7 @@ httpRequest.request("EXAMPLE_URL",
request(url: string, options? : HttpRequestOptions): Promise\<HttpResponse\>
Initiates an HTTP request to a given URL. This API uses a promise to return the result.
Initiates an HTTP request containing specified options to a given URL. This API uses a promise to return the result.
>**NOTE**
>This API supports only transfer of data not greater than 5 MB.
......@@ -332,7 +332,7 @@ httpRequest.destroy();
### request2<sup>10+</sup>
request2(url: string, callback: AsyncCallback\<void\>): void
request2(url: string, 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.
......@@ -345,7 +345,7 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------- | ---- | ----------------------------------------------- |
| url | string | Yes | URL for initiating an HTTP request. |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<[number](#responsecode)\> | Yes | Callback used to return the result. |
**Error codes**
......@@ -366,9 +366,9 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback
**Example**
```js
httpRequest.request2("EXAMPLE_URL", (err) => {
httpRequest.request2("EXAMPLE_URL", (err, data) => {
if (!err) {
console.info("request2 OK!");
console.info("request2 OK! ResponseCode is " + JSON.stringify(data));
} else {
console.info("request2 ERROR : err = " + JSON.stringify(err));
}
......@@ -377,7 +377,7 @@ httpRequest.request2("EXAMPLE_URL", (err) => {
### request2<sup>10+</sup>
request2(url: string, options: HttpRequestOptions, callback: AsyncCallback\<void\>): void
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.
......@@ -391,7 +391,7 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback
| -------- | ---------------------------------------------- | ---- | ----------------------------------------------- |
| url | string | Yes | URL for initiating an HTTP request. |
| options | HttpRequestOptions | Yes | Request options. For details, see [HttpRequestOptions](#httprequestoptions).|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<[number](#responsecode)\> | Yes | Callback used to return the result. |
**Error codes**
......@@ -444,9 +444,9 @@ httpRequest.request2("EXAMPLE_URL",
},
readTimeout: 60000,
connectTimeout: 60000
}, (err) => {
}, (err, data) => {
if (!err) {
console.info("request2 OK!");
console.info("request2 OK! ResponseCode is " + JSON.stringify(data));
} else {
console.info("request2 ERROR : err = " + JSON.stringify(err));
}
......@@ -454,7 +454,7 @@ httpRequest.request2("EXAMPLE_URL",
```
### request2<sup>10+</sup>
request2(url: string, options? : HttpRequestOptions): Promise\<void\>
request2(url: string, options? : HttpRequestOptions): Promise\<number\>
Initiates an HTTP request containing specified options to a given URL. This API uses a promise to return the result, which is a streaming response.
......@@ -473,7 +473,7 @@ Initiates an HTTP request containing specified options to a given URL. This API
| Type | Description |
| :------------------------------------- | :-------------------------------- |
| Promise\<void\> | Promise used to return the result.|
| Promise\<[number](#responsecode)\> | Promise used to return the result.|
**Error codes**
......@@ -526,8 +526,8 @@ let promise = httpRequest.request("EXAMPLE_URL", {
'Content-Type': 'application/json'
}
});
promise.then(() => {
console.info("request2 OK!");
promise.then((data) => {
console.info("request2 OK!" + JSON.stringify(data));
}).catch((err) => {
console.info("request2 ERROR : err = " + JSON.stringify(err));
});
......@@ -1007,7 +1007,7 @@ Disables the cache and deletes the data in it. This API uses a promise to return
| Type | Description |
| --------------------------------- | ------------------------------------- |
| Promise\<void\> | Promise used to return the result.|
| Promise\<void\> | Promise used to return the result.|
**Example**
......
# Socket Connection
# # @ohos.net.socket (Socket Connection)
The **socket** module implements data transfer over TCPSocket, UDPSocket, WebSocket, and TLSSocket connections.
......@@ -364,7 +364,7 @@ udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => {
setExtraOptions(options: UDPExtraOptions, callback: AsyncCallback\<void\>): void
Sets other properties of the UDPSocket connection. This API uses an asynchronous callback to return the result.
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** is successfully called.
......@@ -418,7 +418,7 @@ udp.bind({address:'192.168.xx.xxx', port:xxxx, family:1}, err=> {
setExtraOptions(options: UDPExtraOptions): Promise\<void\>
Sets other properties of the UDPSocket connection. This API uses a promise to return the result.
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** is successfully called.
......@@ -522,7 +522,7 @@ let callback = value =>{
console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo);
}
udp.on('message', callback);
// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks.
// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks.
udp.off('message', callback);
udp.off('message');
```
......@@ -582,14 +582,14 @@ let callback1 = () =>{
console.log("on listening, success");
}
udp.on('listening', callback1);
// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks.
// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks.
udp.off('listening', callback1);
udp.off('listening');
let callback2 = () =>{
console.log("on close, success");
}
udp.on('close', callback2);
// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks.
// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks.
udp.off('close', callback2);
udp.off('close');
```
......@@ -646,7 +646,7 @@ let callback = err =>{
console.log("on error, err:" + JSON.stringify(err));
}
udp.on('error', callback);
// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks.
// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks.
udp.off('error', callback);
udp.off('error');
```
......@@ -1426,7 +1426,7 @@ let callback = value =>{
console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo);
}
tcp.on('message', callback);
// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks.
// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks.
tcp.off('message', callback);
tcp.off('message');
```
......@@ -1486,14 +1486,14 @@ let callback1 = () =>{
console.log("on connect success");
}
tcp.on('connect', callback1);
// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks.
// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks.
tcp.off('connect', callback1);
tcp.off('connect');
let callback2 = () =>{
console.log("on close success");
}
tcp.on('close', callback2);
// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks.
// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks.
tcp.off('close', callback2);
tcp.off('close');
```
......@@ -1550,7 +1550,7 @@ let callback = err =>{
console.log("on error, err:" + JSON.stringify(err));
}
tcp.on('error', callback);
// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks.
// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks.
tcp.off('error', callback);
tcp.off('error');
```
......@@ -2674,4 +2674,4 @@ Defines the certificate raw data.
| Type | Description |
| --------------------------------------------------------------------- | --------------------- |
|[cryptoFramework.EncodingBlob](js-apis-cryptoFramework.md#datablob) | Data and encoding format of the certificate.|
|[cert.EncodingBlob](js-apis-cert.md#datablob) | Data and encoding format of the certificate.|
......@@ -108,9 +108,3 @@ This permission is of the **system\_basic** level. Before applying for the permi
console.log("call state change, data is:" + JSON.stringify(data));
});
```
## Samples
The following sample is provided to help you better understand how to develop the call service:
- [Call](https://gitee.com/openharmony/applications_app_samples/tree/master/Telephony/Call)
......@@ -110,9 +110,3 @@ The Short Messaging Service (SMS) module provides basic SMS management functions
}
}
```
## Samples
The following sample is provided to help you better understand how to develop the SMS service:
- [SMS](https://gitee.com/openharmony/applications_app_samples/tree/master/Telephony/Message)
......@@ -26,15 +26,15 @@ Your feedback matters. Submit issues and leave as detailed information as possib
1. On the Gitee page, click the **Issues** tab. On the displayed page, click **New issue**. Then enter the issue title and issue details.
2. Click **New** to submit the issue. The Docs team will confirm the issue.
>![](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**
>
> **How can I provide a high-quality issue?**
>
>**How can I provide a high-quality issue?**
>
>- Provide a clear description of the issue, including the missing, outdated, incorrect, or to-be-improved content.
>- Explain the impact of this issue on users.
>- Limit the scope of the given issue to a specific task. If multiple fields are involved, break the issue down into smaller ones. For example, "Documents need to be optimized" is a broad issue, whereas "XX development guide lacks introduction to step XXX" is specific and operable.
>- Search the list of existing issues to see if any related or similar issues have been submitted.
>- If an issue is associated with another issue or a pull request (PR), you can use its full URL or the combination of the number sign (#) and PR number to reference it.
> - Provide a clear description of the issue, including the missing, outdated, incorrect, or to-be-improved content.
> - Explain the impact of this issue on users.
> - Limit the scope of the given issue to a specific task. If multiple fields are involved, break the issue down into smaller ones. For example, "Documents need to be optimized" is a broad issue, whereas "XX development guide lacks introduction to step XXX" is specific and operable.
> - Search the list of existing issues to see if any related or similar issues have been submitted.
> - If an issue is associated with another issue or a pull request (PR), you can use its full URL or the combination of the number sign (#) and PR number to reference it.
### Editing Existing Documents
......
......@@ -60,8 +60,8 @@ Pictures used in **OpenHarmony\_DOCUMENTS/docs/quick-start/writing-instructions
Use relative paths to reference pictures in the document.
>![](public_sys-resources/icon-caution.gif) **CAUTION:**
>Use the original pictures to avoid intellectual property infringement risks.
> **CAUTION**
> Use the original pictures to avoid intellectual property infringement risks.
- Pictures are clear and complete. For example, a flowchart has a start and an end.
- The graphics has clear logic and are provided with text descriptions. Do not separate the graphics from the text.
......@@ -69,9 +69,9 @@ Use relative paths to reference pictures in the document.
- The text on pictures should be Chinese in Chinese documents and English in English documents.
- It is recommended that pictures be named based on the content. Using only a number is difficult for picture inheritance.
>![](public_sys-resources/icon-note.gif) **NOTE:**
>Reference:
>!\[\]\(./pic/pic-standard.png\)
> **NOTE:**
> Reference:
> !\[\]\(./pic/pic-standard.png\)
If a self-made picture is used, refer to the following figure to configure the color. The format can be **png**, **jpg**, **gif**, and so on.
......
......@@ -195,9 +195,9 @@ The HCTest framework is used to support test cases developed with the C language
Test suites are built along with version build. The ACTS is built together with the debug version.
>![](public_sys-resources/icon-note.gif) **NOTE**
>
>The ACTS build middleware is a static library, which will be linked to the image.
> **NOTE**
>
> The ACTS build middleware is a static library, which will be linked to the image.
### C-based Test Case Execution \(for the Mini System\)
......@@ -334,9 +334,9 @@ The HCPPTest framework is enhanced and adapted based on the open-source framewor
Test suites are built along with the version build. The ACTS is built together with the debug version.
>![](public_sys-resources/icon-note.gif) **NOTE**
>
>The ACTS for the small system is independently built to an executable file \(.bin\) and archived in the **suites\\acts** directory of the build result.
> **NOTE**
>
> The ACTS for the small system is independently built to an executable file \(.bin\) and archived in the **suites\\acts** directory of the build result.
### C++-based Test Case Execution \(for Standard and Small Systems\)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册