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

!2089 Done! 1898:【轻量级 PR】:update zh-cn/contribute/template/guide-template.md.

Merge pull request !2089 from wusongqing/TR1898
......@@ -26,7 +26,7 @@
- *A: answer. Describe the solution.*
*The table below describes the writing requirements. After finishing the writing, check your content against these requirements one by one.*
*The table below describes the writing requirements. After finishing the writing, check your content against these requirements one by one.*
| Requirement| Satisfied or Not|
| -------- | -------- |
......@@ -66,7 +66,8 @@ The **AudioRenderer** class provides open audio playback capabilities. For detai
***[Writing Requirements]***
*Mandatory. Describe the overall process to help developers quickly complete the task. The table below describes the writing requirements. After finishing the writing, check your content against these requirements one by one.*
*Mandatory. Describe the overall process to help developers quickly complete the task. The table below describes the writing requirements. After finishing the writing, check your content against these requirements one by one.*
| Requirement| Satisfied or Not|
| -------- | -------- |
| **Writing a Development Procedure**| |
......@@ -96,7 +97,7 @@ The **AudioRenderer** class provides open audio playback capabilities. For detai
AudioStreamInfo audioStreamInfo = new AudioStreamInfo.Builder().sampleRate(44100)// 44.1 kHz .audioStreamFlag(AudioStreamInfo.AudioStreamFlag.AUDIO_STREAM_FLAG_MAY_DUCK)// Set audio ducking. .encodingFormat(AudioStreamInfo.EncodingFormat.ENCODING_PCM_16BIT)//16-bit PCM .channelMask(AudioStreamInfo.ChannelMask.CHANNEL_OUT_STEREO)// Set the dual output channel. .streamUsage(AudioStreamInfo.StreamUsage.STREAM_USAGE_MEDIA)// Set the stream to be used for media. .build();
```
2. Build the playback parameter structure via **AudioRendererInfo** for the audio stream created in Step 1, and use **AudioRendererInfo.Builder** to create an #lt;ph class="- topic/ph " id="ph96666347177" status="new"/#gt;instance. The following example uses the default parameter values of the **AudioRendererInfo.Builder** instance. You need to set the playback parameters based on the audio playback specification.
2. Build the playback parameter structure via **AudioRendererInfo** for the audio stream created in Step 1, and use **AudioRendererInfo.Builder** to create an instance. The following example uses the default parameter values of the **AudioRendererInfo.Builder** instance. You need to set the playback parameters based on the audio playback specification.
```
AudioRendererInfo audioRendererInfo = new AudioRendererInfo.Builder().audioStreamInfo(audioStreamInfo) .audioStreamOutputFlag(AudioRendererInfo.AudioStreamOutputFlag.AUDIO_STREAM_OUTPUT_FLAG_NONE) .bufferSizeInBytes(0) .distributedDeviceId("") .isOffload(false) .sessionID(AudioRendererInfo.SESSION_ID_UNSPECIFIED) .build();
```
......@@ -106,7 +107,7 @@ The **AudioRenderer** class provides open audio playback capabilities. For detai
AudioRendererInfo audioRendererInfo = new AudioRendererInfo.Builder().audioStreamInfo(audioStreamInfo) .audioStreamOutputFlag(AudioRendererInfo.AudioStreamOutputFlag.AUDIO_STREAM_OUTPUT_FLAG_DIRECT_PCM)// Set direct PCM output .bufferSizeInBytes(100) .distributedDeviceId("E54***5E8")// Use distributed device E54***5E8 for playback. .isOffload(false)// Value false indicates that the audio stream is transmitted to the buffer on a segment-by-segment basis for several times and then played. Value true indicates that the audio stream is transmitted to the HAL layer at a time. .build();
```
3. Specify the playback mode based on the audio stream to be played. The playback modes differ only in the data writing process.
3. Specify the playback mode based on the audio stream to be played. The playback modes differ only in the data writing process. Create an **AudioRenderer** instance using a constructor that fits your need.
....
4. After the playback task is complete, call the **release()** method on the **AudioRenderer** instance to release resources.
......@@ -116,9 +117,20 @@ The **AudioRenderer** class provides open audio playback capabilities. For detai
***[Writing Requirements]***
*Optional. After the development is complete, perform commissioning and verification to ensure that the operation is successful. The operation procedure requirements are the same as those in **Development Guidelines**. Other specific writing requirements are as follows. After finishing the writing, check your content against these requirements one by one.*
*Optional. After the development is complete, perform commissioning and verification to ensure that the operation is successful. The operation procedure requirements are the same as those in **Development Guidelines**. Other specific writing requirements are as follows. After finishing the writing, check your content against these requirements one by one.*
| Requirement| Satisfied or Not|
| -------- | -------- |
| Describe the final service commissioning process. The operation result of each step should be verified after the corresponding development task is complete.| |
| Specify the criteria for development success.| |
## Development Example
***[Writing Requirements]***
*Provide a complete sample, briefly describe the principle and implementation of the sample, and provide a link to the source code repository.*
The following sample is provided to help you better understand how to xx:
- xxx (A link to the source code repository)
This sample xxx.
......@@ -16,6 +16,8 @@
>
> 0.6 - Use the document title as the level-1 heading. Use the attributes, functions, classes, interfaces, enums, and types under the namespace as level-2 headings. Use the attributes and functions under classes as level-3 headings.
>
> **Version Description**
>
> 0.7 - **When introducing an API to an existing module, use the \<sup> tag to mark its earliest version.**
> Example: For an existing module of API 6, if an attribute is added in API 7, suffix the \<sup> tag to the name of the new attribute, for example, **newAttribute<sup>7+</sup>**.
> If a method is added, suffix the \<sup> tag to the method name, for example, **sim.getSimIccId<sup>7+</sup>**. The processing of new interfaces, classes, and enums is similar.
......@@ -25,7 +27,24 @@
>
> > Discarded. This change is effective since API version 7. You are advised to use [newMethod](#newMethod) instead.
>
> 0.9 - **Required permissions and system capabilities**: Keep consistent with the code implementation. Provide them at the level of methods, enumerations, and attributes.
> 0.9 - For **empty APIs that will be implemented only in the MR version**, add the following information to the interface description:
> This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.
>
> **Required Permissions, System Capabilities, and System APIs**
>
> 0.10 - **Required permissions**: Maintain consistency with the code implementation. State the required permissions at the level of methods, enumerations, and attributes. Format:
> (Permissions that can be requested by all applications) **Required permissions**: ohos.permission.xxxx
> (Permissions that can be requested only by system applications) **Required permissions**: ohos.permission.xxxx (available only to system applications)
>
> 0.11 - **System capabilities**:
> Add the following information for each function: **System capability**: SystemCapability.xxx.xxx
> There are two cases for the information about system capabilities added to each table (attributes, enums, constants, and variables).
> Add the following description if all the items in a table require the same system capabilities:
> SystemCapability.xxx.xxx
> Add the following description if the items in a table require different system capabilities:
> The items in the table below require different system capabilities. For details, see the table.
>
> 0.12 - **System APIs**: Add the following description for system APIs: This is a system API and cannot be called by third-party applications.
> The following describes the instructions for writing a specific API.
***
......@@ -78,11 +97,15 @@ import call from '@ohos.telephony.call';
> 4.3 - For a readable attribute, if it has a limited number of values with special meanings, enumerate the values.
>
> 4.4 - For a writable attribute, if only fixed fields are supported, describe them.
>
> 4.5 - If the items in the table require different system capabilities, add the following description: The items in the table below require different system capabilities. For details, see the table. Then, describe the system capabilities for each item. See [Enumeration](#Enumeration).
**System capability**: SystemCapability.xxx.xxx (Mandatory)
| Name| Type| Readable| Writable| Description|
| ---------------- | ----------------------------------------- | ---- | ---- | ------------------------------------------------------------ |
| pluggedType | [BatteryPluggedType](#BatteryPluggedType) | Yes| No| Charger type of the current device. <br/>**System capabilities**: SystemCapability.xxx.xxx (mandatory)|
| isBatteryPresent | boolean | Yes| No| Whether the battery is supported or present. <br/>**System capabilities**: SystemCapability.xxx.xxx (mandatory)|
| Name | Type | Readable| Writable| Description |
| ---------------- | ----------------------------------------- | ---- | ---- | ------------------------------------------ |
| pluggedType | [BatteryPluggedType](#BatteryPluggedType) | Yes | No | Charger type of the current device. |
| isBatteryPresent | boolean | Yes | No | Whether the battery is supported or present.|
## Enums
......@@ -94,9 +117,11 @@ import call from '@ohos.telephony.call';
Provide a brief description of the enum type. Example: Enumerates charger types.
| Name| Value| Description|
**System capability**: The items in the table below require different system capabilities. For details, see the table. (Mandatory)
| Name| Value | Description |
| ---- | ---- | ------------------------------------------------------------ |
| NONE | 1 | Unknown type. <br>**System capabilities**: SystemCapability.xxx.xxx (mandatory)|
| NONE | 1 | Unknown type.<br>**System capability**: SystemCapability.xxx.xxx (mandatory)|
## Methods
......@@ -105,15 +130,11 @@ Provide a brief description of the enum type. Example: Enumerates charger types.
> 6.1 - Optional. Delete this heading if there is no method. If there are multiple methods, describe them in separate level-2 headings. To create a level-2 heading, use two number signs (#).
>
> 6.2 - Use the actual method name, in the format of ClassName.methodName, as the level-2 heading. For a subscription method, add the subscription event to the method name.
>
> Example of a common method: sim.getSimIccId
>
> Example of a subscription method: sim.on('exampleEvent')
>
> 6.3 - **Method calling mode**: The description must be the same as that in the .d.ts file. The description must include the parameter type, parameter name, and return value type.
>
> Example: getNetworkState(slotId: number, callback: AsyncCallback\<NetworkState>): void
>
> Note: The angle bracket (<>) may be identified as a label and not displayed. To ensure normal display, you can either add a backslash (\\) (in the format of "\\<>") or use escape characters \&lt; and \&gt;.
>
> 6.4.1 - **Method description**: Describe the features implemented by the method and include the prerequisites for using the method, the impact of the method, and the permissions and system capabilities required to use the method. (*Example of prerequisites: This method can be called only after the xx method is called; you must ensure that the connection to the Internet is normal. Example of impact: xx does not take effect after this method is called.*)
......@@ -126,25 +147,25 @@ Provide the method name in the following format: (**static** if it is a static m
Describe the method. For details, see 6.4.1 and 6.4.2.
**Required permission**: ohos.permission.xxx (Delete this part if no permission is involved. If a system permission is required, specify it.)
**Required permissions**: ohos.permission.xxx (Delete this part if no permission is involved. If a system permission is required, specify it.)
**System capabilities**: SystemCapability.xxx.xxx (mandatory)
**System capability**: SystemCapability.xxx.xxx (mandatory)
**Parameters: ** (Optional. Delete this heading if there is no parameter.)
**Parameters** (Optional. Delete this heading if there is no parameter.)
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| ------------ | --------------------------------------------- | ---- | ------------------------------------------------------------ |
| parameterOne | number \| string \| [CustomType](#CustomType) | Yes| Describe the parameter. Provide the value range and recommended value. If there is a fixed format, provide a format example, especially for the URI. <br>Provide a link for any custom parameter type.|
| callback | Callback\<Array<[CustomType](#CustomType)>> | No| Describe the parameter. For an optional parameter, describe the consequences if it is not specified. <br>Example: If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
| parameterOne | number \| string \| [CustomType](#CustomType) | Yes | Describe the parameter. Provide the value range and recommended value. If there is a fixed format, provide a format example, especially for the URI.<br>Provide a link for each custom parameter type.|
| callback | Callback\<Array<[CustomType](#CustomType)>> | No | Describe the parameter. For an optional parameter, describe the consequences if it is not specified.<br>Example: If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
**Return value**: (Optional. Delete this heading if there is no return value.)
**Return value** (Optional. Delete this heading if there is no return value.)
| Type| Description|
| Type | Description |
| ------------------------------------------ | -------------------------------------------- |
| string | Describe the return value, for example, what can be done after the return value is obtained.|
| Promise\<Array<[CustomType](#CustomType)>> | Describe the return value, for example, what is obtained through the **Promise** instance.|
| Promise\<Array<[CustomType](#CustomType)>> | Describe the return value, for example, what is obtained through the **Promise** instance. |
**Example:**
**Example**
```js
// This part is mandatory.
......@@ -165,7 +186,6 @@ Describe the method. For details, see 6.4.1 and 6.4.2.
> 7.2 - Use the actual class or interface name as the level-2 heading.
>
> 7.3 - If the class or interface contains both attributes and methods, write the attributes above the methods. Write their actual names in separate level-3 headings.
>
> If the class of interface contains only attributes, you do not need to create a level-3 heading. Instead, use a table to display the attributes. For details, see [CustomType](#CustomType).
Describe the class or interface. If there are usage restrictions, describe them as well, for example, whether there is a prerequisite and whether an instance needs to be created by using any method.
......@@ -181,36 +201,33 @@ Describe the class or interface. If there are usage restrictions, describe them
> *Writing Instructions*
>
> 7.4 - Use the actual method name as the level-3 heading. **Do not add a prefix**. For a subscription method, add the corresponding subscription event to the method name.
>
> Example of a common method: getSimIccId
>
> Example of a subscription method: on('exampleEvent')
>
> The other instructions are the same as those stipulated in [Methods](#Methods).
Describe the method calling mode. For details, see 6.3.
Describe the method. For details, see 6.4.1 and 6.4.2.
**Required permission**: ohos.permission.xxx (Delete this part if no permission is involved. If a system permission is required, specify it.)
**Required permissions**: ohos.permission.xxx (Delete this part if no permission is involved. If a system permission is required, specify it.)
**System capabilities**: SystemCapability.xxx.xxx (mandatory)
**System capability**: SystemCapability.xxx.xxx (mandatory)
**Parameters: ** (Optional. Delete this heading if there is no parameter.)
**Parameters** (Optional. Delete this heading if there is no parameter.)
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| ------------ | --------------------------------------------- | ---- | ------------------------------------------------------------ |
| parameterOne | number \| string \| [CustomType](#CustomType) | Yes| Describe the parameter. Provide the value range and recommended value. If there is a fixed format, provide a format example, especially for the URI. <br>Provide a link for any custom parameter type.|
| callback | Callback\<Array<[CustomType](#CustomType)>> | No| Describe the parameter. For an optional parameter, describe the consequences if it is not specified. <br>Example: If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
| parameterOne | number \| string \| [CustomType](#CustomType) | Yes | Describe the parameter. Provide the value range and recommended value. If there is a fixed format, provide a format example, especially for the URI.<br>Provide a link for each custom parameter type.|
| callback | Callback\<Array<[CustomType](#CustomType)>> | No | Describe the parameter. For an optional parameter, describe the consequences if it is not specified.<br>Example: If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
**Return value**: (Optional. Delete this heading if there is no return value.)
**Return value** (Optional. Delete this heading if there is no return value.)
| Type| Description|
| Type | Description |
| ------------------------------------------ | -------------------------------------------- |
| string | Describe the return value, for example, what can be done after the return value is obtained.|
| Promise\<Array<[CustomType](#CustomType)>> | Describe the return value, for example, what is obtained through the **Promise** instance.|
| Promise\<Array<[CustomType](#CustomType)>> | Describe the return value, for example, what is obtained through the **Promise** instance. |
**Example:**
**Example**
```js
// This part is mandatory.
......@@ -225,8 +242,9 @@ Describe the method. For details, see 6.4.1 and 6.4.2.
## CustomType
The following is an example of the custom type of a key-value pair.
**System capability**: SystemCapability.xxx.xxx (Mandatory)
| Name| Type| Readable| Writable| Description|
| Name | Type | Readable| Writable| Description |
| ------------ | ------------------- | ---- | ---- | ------------------------------------------------------------ |
| parameterUrl | string | Yes| Yes| Media output URI. The following types of URIs are supported: <br/> 1. Relative path whose protocol type is **internal**. Example: <br/>Temporary directory: internal://cache/test.mp4<br/><br/>2. Absolute path. Example:<br/>file:///data/data/ohos.xxx.xxx/files/test.mp4<br/>**System capabilities**: SystemCapability.xxx.xxx (mandatory)|
| parameterOne | [CustomEnum](#Enumeration)| Yes| Yes| Describe the attributes. The requirements are similar to those for the parameter description. <br/>**System capabilities**: SystemCapability.xxx.xxx (mandatory)|
| parameterUrl | string | Yes | Yes | Media output URI. The following types of URIs are supported:<br>1. Relative path whose protocol type is internal. Examples:<br>Temporary directory: internal://cache/test.mp4<br><br>2. Absolute path. Examples:<br>file:///data/data/ohos.xxx.xxx/files/test.mp4<br> |
| parameterOne | [CustomEnum](#Enumeration)| Yes | Yes | Describe the attributes. The requirements are similar to those for the parameter description. |
# 开发指导
** *【写作要求】***
***【写作要求】***
*必选。* *描述各个场景下,开发者如何完成开发任务。* *可根据多场景任务增加章节。写作要求见下,完成写作后,请逐项自检。*
......@@ -14,7 +14,7 @@
## 场景介绍
** *【写作要求】***
***【写作要求】***
*必选。* *描述在什么情景下解决什么问题,最终达到什么样的效果。*应用SCQA描述方法:
......@@ -39,7 +39,7 @@
## 接口说明
** *【写作要求】***
***【写作要求】***
*必选。* *描述本开发指导相关的接口有哪些,旨在要开发者在开发前有大体了解,提升开发效率。* *写作要求见下,完成写作后,请逐项自检。*
......@@ -64,9 +64,10 @@
## 开发步骤
** *【写作要求】***
***【写作要求】***
* 必选。描述* *开发的整体过程,便于开发者快速完成开发。* * 具体 写作要求见下,完成写作后,请逐项自检下。*
| 内容要求 | 是否满足 |
| -------- | -------- |
| **如何写好步骤** | |
......@@ -114,7 +115,7 @@
## 调测验证(可选)
** *【写作要求】***
***【写作要求】***
*可选。* *描述开发完成后,进行调测验证,确保最终操作成功。* *操作步骤要求同“开发指导”,其他具体写作要求见下,完成写作后,请逐项自检下。*
......@@ -124,7 +125,7 @@
| 明确开发成功标准。 | |
## 开发实例
** *【写作要求】***
***【写作要求】***
*提供完整的sample示例,同时简要描述示例原理和实现,并链接到源码仓。*
......@@ -132,4 +133,4 @@
- xxx(此处请提供源码超链接)
本示例xxxx。
本示例xxxx。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册