diff --git a/en/application-dev/media/audio-management.md b/en/application-dev/media/audio-management.md
index 65bfb215f206954de5baf1fc7edb9416812b1c6f..0f4dc93fa334eced5b30cf1d005f5e210223e271 100644
--- a/en/application-dev/media/audio-management.md
+++ b/en/application-dev/media/audio-management.md
@@ -146,7 +146,13 @@ You use audio management APIs to set and obtain volume, and get information abou
-
MEDIA = 1
+ |
+VOICE_CALL = 0
+ |
+Audio streams for voice calls
+ |
+
+MEDIA = 1
|
Audio streams for media purpose
|
@@ -154,6 +160,11 @@ You use audio management APIs to set and obtain volume, and get information abou
RINGTONE = 2
|
Audio streams for ring tones
+ |
VOICE_ASSISTANT = 9
+ |
+Audio streams for voice assistant
+ |
+
@@ -222,27 +233,27 @@ You use audio management APIs to set and obtain volume, and get information abou
Invalid device
|
-SPEAKER = 1
+ |
SPEAKER = 2
|
Speaker
|
-WIRED_HEADSET = 2
+ |
WIRED_HEADSET = 3
|
Wired headset
|
-BLUETOOTH_SCO = 3
+ |
BLUETOOTH_SCO = 7
|
-Bluetooth device using the synchronous connection oriented link (SCO)
+ | Bluetooth device using the synchronous connection oriented (SCO) link
|
-BLUETOOTH_A2DP = 4
+ |
BLUETOOTH_A2DP = 8
|
Bluetooth device using advanced audio distribution profile (A2DP)
|
-MIC = 5
+ |
MIC = 15
|
Microphone
|
@@ -269,5 +280,3 @@ You use audio management APIs to set and obtain volume, and get information abou
console.log(`Media getVolume ${value}`);
});
```
-
-
diff --git a/en/application-dev/media/audio-renderer.md b/en/application-dev/media/audio-renderer.md
index 2132f815703779ea03ab62f68caf7fae507db5c8..251b6bf822a67f305ab1c28d502ab5b35be20793 100644
--- a/en/application-dev/media/audio-renderer.md
+++ b/en/application-dev/media/audio-renderer.md
@@ -3,8 +3,6 @@
---
## ***Note***:
1. This document applies to JavaScript.
- 2. Changes to the AudioRenderer interface have been proposed.
- When the updated APIs have been integrated, the document will be revised, and apps must adapt to it.
---
## **Summary**
This guide will show you how to use AudioRenderer to create an audio player app.
@@ -24,11 +22,28 @@ Please see [**js-apis-audio.md**](https://gitee.com/openharmony/docs/blob/master
## **Usage**
Here's an example of how to use AudioRenderer to play a raw audio file.
-1. Use **createAudioRenderer** to create an AudioRenderer instance for the **AudioVolumeType**.\
+1. Use **createAudioRenderer** to create an AudioRenderer instance. Renderer parameters can be set in **audioRendererOptions**.\
This object can be used to play, control, and obtain the status of the playback, as well as receive callback notifications.
```
- const volType = audio.AudioVolumeType.MEDIA; // For music
- const audioRenderer = audio.createAudioRenderer(volType);
+ var audioStreamInfo = {
+ samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
+ channels: audio.AudioChannel.CHANNEL_1,
+ sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
+ encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
+ }
+
+ var audioRendererInfo = {
+ content: audio.ContentType.CONTENT_TYPE_SPEECH,
+ usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
+ rendererFlags: 1
+ }
+
+ var audioRendererOptions = {
+ streamInfo: audioStreamInfo,
+ rendererInfo: audioRendererInfo
+ }
+
+ let audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
```
2. Subscribe to audio interruption events using the **on** API.\
@@ -118,27 +133,8 @@ Here's an example of how to use AudioRenderer to play a raw audio file.
});
```
-3. Prepare the renderer. Call **SetParams** on the instance. You need to set the renderer parameters based on the audio playback specification.
- ```
- async function prepareRenderer() {
- // file_example_WAV_2MG.wav
- var audioParams = {
- format: audio.AudioSampleFormat.SAMPLE_S16LE,
- channels: audio.AudioChannel.STEREO,
- samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000,
- encoding: audio.AudioEncodingType.ENCODING_PCM,
- };
-
- let response = await audioRenderer.setParams(audioParams);
- var state = audioRenderer.state;
- if (state != audio.AudioState.STATE_PREPARED) {
- console.info('Prepare renderer failed');
- return;
- }
- }
- ```
4. Call the **start()** function on the AudioRenderer instance to start/resume the playback task.\
- The renderer state will be STATE _RUNNING once the start is complete. You can then begin writing buffers.
+ The renderer state will be STATE_RUNNING once the start is complete. You can then begin writing buffers.
```
async function startRenderer() {
var state = audioRenderer.state;
@@ -148,13 +144,14 @@ Here's an example of how to use AudioRenderer to play a raw audio file.
console.info('Renderer is not in a correct state to start');
return;
}
- var started = await audioRenderer.start();
- if (started) {
- isPlay = true;
+
+ await audioRenderer.start();
+
+ state = audioRenderer.state;
+ if (state == audio.AudioState.STATE_RUNNING) {
console.info('Renderer started');
} else {
console.error('Renderer start failed');
- return;
}
}
@@ -212,8 +209,11 @@ Here's an example of how to use AudioRenderer to play a raw audio file.
console.info('Renderer is not running');
return;
}
- var paused = await audioRenderer.pause();
- if (paused) {
+
+ await audioRenderer.pause();
+
+ state = audioRenderer.state;
+ if (state == audio.AudioState.STATE_PAUSED) {
console.info('Renderer paused');
} else {
console.error('Renderer pause failed');
@@ -226,8 +226,11 @@ Here's an example of how to use AudioRenderer to play a raw audio file.
console.info('Renderer is not running or paused');
return;
}
- var stopped = await audioRenderer.stop();
- if (stopped) {
+
+ await audioRenderer.stop();
+
+ state = audioRenderer.state;
+ if (state == audio.AudioState.STATE_STOPPED) {
console.info('Renderer stopped');
} else {
console.error('Renderer stop failed');
@@ -243,8 +246,11 @@ Here's an example of how to use AudioRenderer to play a raw audio file.
console.info('Resourced already released');
return;
}
- var released = await audioRenderer.release();
- if (released) {
+
+ await audioRenderer.release();
+
+ state = audioRenderer.state;
+ if (state == STATE_RELEASED) {
console.info('Renderer released');
} else {
console.info('Renderer release failed');
@@ -257,7 +263,6 @@ Here's an example of how to use AudioRenderer to play a raw audio file.
You should also keep in mind that an AudioRenderer is state-based.
That is, the AudioRenderer has an internal state that you must always check when calling playback control APIs, because some operations are only acceptable while the renderer is in a given state.\
The system may throw an error/exception or generate other undefined behaviour if you perform an operation while in the improper state.\
-Before each necessary operation, the example code performs a state check.
## **Asynchronous Operations:**
Most of the AudioRenderer calls are asynchronous. As a result, the UI thread will not be blocked.\
@@ -267,4 +272,3 @@ provides reference for both callback and promise.
## **Other APIs:**
See [**js-apis-audio.md**](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-audio.md) for more useful APIs like getAudioTime, drain, and getBufferSize.
-
diff --git a/en/application-dev/reference/apis/js-apis-audio.md b/en/application-dev/reference/apis/js-apis-audio.md
index 98d16f8591eed0dd77e1c68a39bdd1c937c4c6d2..de50ce278c4c0e8bae9541ddec417efceb2e0c94 100644
--- a/en/application-dev/reference/apis/js-apis-audio.md
+++ b/en/application-dev/reference/apis/js-apis-audio.md
@@ -2,15 +2,6 @@
This module provides the following functions: audio management, audio rendering and system sound management.
-
----
-## ***Note:***
-
- Changes to the AudioRenderer interface have been proposed.
- When the updated APIs have been integrated, the document will be revised, and apps must adapt to it.
-
----
-
## Modules to Import
```
@@ -71,8 +62,25 @@ Obtains an **AudioRenderer** instance.
**Example**
```
-const volType = audio.AudioVolumeType.MEDIA;
-const audioRenderer = audio.createAudioRenderer(volType);
+var audioStreamInfo = {
+ samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
+ channels: audio.AudioChannel.CHANNEL_1,
+ sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
+ encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
+}
+
+var audioRendererInfo = {
+ content: audio.ContentType.CONTENT_TYPE_SPEECH,
+ usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
+ rendererFlags: 1
+}
+
+var audioRendererOptions = {
+ streamInfo: audioStreamInfo,
+ rendererInfo: audioRendererInfo
+}
+
+let audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
```
@@ -112,7 +120,15 @@ Enumerates audio stream types.
-RINGTONE
+ |
+VOICE_CALL
+ |
+0
+ |
+Audio stream for voice calls.
+ |
+
+RINGTONE
|
2
|
@@ -126,6 +142,13 @@ Enumerates audio stream types.
Audio stream for media purpose.
|
+VOICE_ASSISTANT
+ |
+9
+ |
+Audio stream for voice assistant.
+ |
+
@@ -221,35 +244,35 @@ Enumerates audio device types.
SPEAKER
|
-1
+ | 2
|
Speaker.
|
WIRED_HEADSET
|
-2
+ | 3
|
Wired headset.
|
BLUETOOTH_SCO
|
-3
+ | 7
|
Bluetooth device using the synchronous connection oriented (SCO) link.
|
BLUETOOTH_A2DP
|
-4
+ | 8
|
Bluetooth device using the advanced audio distribution profile (A2DP).
|
MIC
|
-5
+ | 15
|
Microphone.
|
@@ -302,19 +325,24 @@ Enumerates the audio sample formats.
| Name | Default Value | Description |
| :------------ | :------------ | :------------------------------------ |
| INVALID_WIDTH | -1 | Invalid format. |
-| SAMPLE_U8 | 1 | Unsigned 8 bit integer. |
-| SAMPLE_S16LE | 0 | Signed 16 bit integer, little endian. |
-| SAMPLE_S24LE | 1 | Signed 24 bit integer, little endian. |
-| SAMPLE_S32LE | 2 | Signed 32 bit integer, little endian. |
-
+| SAMPLE_U8 | 0 | Unsigned 8 bit integer. |
+| SAMPLE_S16LE | 1 | Signed 16 bit integer, little endian. |
+| SAMPLE_S24LE | 2 | Signed 24 bit integer, little endian. |
+| SAMPLE_S32LE | 3 | Signed 32 bit integer, little endian. |
## AudioChannel8+
Enumerates the audio channels.
| Name | Default Value | Description |
| :----- | :------------ | :--------------- |
-| MONO | 1 | Channel count 1. |
-| STEREO | 2 | Channel count 2. |
+| CHANNEL_1 | 0x1 << 0 | Channel count 1. |
+| CHANNEL_2 | 0x1 << 1 | Channel count 2. |
+| CHANNEL_3 | 0x1 << 2 | Channel count 3. |
+| CHANNEL_4 | 0x1 << 3 | Channel count 4. |
+| CHANNEL_5 | 0x1 << 4 | Channel count 5. |
+| CHANNEL_6 | 0x1 << 5 | Channel count 6. |
+| CHANNEL_7 | 0x1 << 6 | Channel count 7. |
+| CHANNEL_8 | 0x1 << 7 | Channel count 8. |
## AudioSamplingRate8+
@@ -338,10 +366,10 @@ Enumerates the audio sampling rates.
## AudioEncodingType8+
Enumerates the audio encoding types.
-| Name | Default Value | Description |
-| :--------------- | :------------ | :---------- |
-| ENCODING_PCM | 0 | PCM. |
-| ENCODING_INVALID | 1 | Invalid. |
+| Name | Default Value | Description |
+| :-------------------- | :------------ | :---------------- |
+| ENCODING_TYPE_INVALID | -1 | Invalid. |
+| ENCODING_TYPE_RAW | 0 | PCM encoding. |
## ContentType8+
@@ -431,23 +459,17 @@ Enumerates the ringtone types.
| RINGTONE_TYPE_DEFAULT | 0 | Default type. |
| RINGTONE_TYPE_MULTISIM | 1 | Multi-SIM type. |
-
-## AudioParameters8+
-Describes audio parameters of playback files.
+## AudioStreamInfo8+
+Describes audio stream information.
**Parameters**
-| Name | Type | Mandatory | Description |
-| :----------- | :---------------- | :-------- | :-------------------------------------------- |
-| format | AudioSampleFormat | Yes | Sample format of the audio file to be played. |
-| channels | AudioChannel | Yes | Channel count of the audio file to be played. |
-| samplingRate | AudioSamplingRate | Yes | Sample rate of the audio file to be played. |
-| encoding | AudioEncodingType | Yes | Encoding type of the audio file to be played. |
-| contentType | ContentType | Yes | Content type. |
-| usage | StreamUsage | Yes | Stream usage. |
-| deviceRole | DeviceRole | Yes | Device role. |
-| deviceType | DeviceType | Yes | Device type. |
-
+| Name | Type | Mandatory | Description |
+| :------------ | :-------------------- | :-------- | :-------------------- |
+| samplingRate | AudioSamplingRate | Yes | Sampling rate. |
+| channels | AudioChannel | Yes | Audio channels. |
+| sampleFormat | AudioSampleFormat | Yes | Audio sample format. |
+| encodingType | AudioEncodingType | Yes | Audio encoding type. |
## AudioRendererInfo8+
Describes audio renderer information.
@@ -2461,20 +2483,18 @@ Defines the current render state.
var state = audioRenderer.state;
```
+## audioRenderer.getRendererInfo
-## audioRenderer.setParams
-
-setParams(params: AudioParameters, callback: AsyncCallback): void8+
+getRendererInfo(callback: AsyncCallback): void8+
-Sets audio parameters for rendering. This method uses an asynchronous callback to return the result.
+Gets the renderer information provided while creating a renderer instance. This method uses an asynchronous callback to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| :------- | :------------------- | :-------- | :-------------------------------------- |
-| params | AudioParameters | Yes | Audio parameters of the file to be set. |
-| callback | AsyncCallback | Yes | Callback used to return the result. |
-| | | | |
+| Name | Type | Mandatory | Description |
+| :------- | :--------------------------------- | :-------- | :------------------------------------------------ |
+| callback | AsyncCallback | Yes | Callback used to return the renderer information. |
+| | | | |
**Return value**
@@ -2483,67 +2503,53 @@ None
**Example**
```
-var audioParams = {
- format: audio.AudioSampleFormat.SAMPLE_S16LE,
- channels: audio.AudioChannel.STEREO,
- samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000,
- encoding: audio.AudioEncodingType.ENCODING_PCM,
- };
-
-audioRenderer.setParams(audioParams, (err)=>{
- if (err) {
- console.error('Failed to set params. ${err.message}');
- return;
- }
- console.log('Callback invoked to indicate a successful params setting.');
+audioRenderer.getRendererInfo((err, rendererInfo)=>{
+ console.log('Renderer GetRendererInfo:');
+ console.log('Renderer content:' + rendererInfo.content);
+ console.log('Renderer usage:' + rendererInfo.usage);
+ console.log('Renderer flags:' + rendererInfo.rendererFlags);
})
```
-## audioRenderer.setParams
+## audioRenderer.getRendererInfo
-setParams(params: AudioParameters): Promise8+
+getParams(): Promise8+
-Sets audio parameters for rendering. This method uses a promise to return the result.
+Gets the renderer information provided while creating a renderer instance. This method uses a promise to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| :----- | :-------------- | :-------- | :-------------------------------------- |
-| params | AudioParameters | Yes | Audio parameters of the file to be set. |
+None
**Return value**
-| Type | Description |
-| :------------- | :--------------------------------- |
-| Promise | Promise used to return the result. |
+| Type | Description |
+| :---------------------------- | :----------------------------------------------- |
+| Promise | Promise used to return the renderer information. |
**Example**
```
-var audioParams = {
- format: audio.AudioSampleFormat.SAMPLE_S16LE,
- channels: audio.AudioChannel.STEREO,
- samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000,
- encoding: audio.AudioEncodingType.ENCODING_PCM,
- };
-
-await audioRenderer.setParams(audioParams);
+let rendererInfo = await audioRenderer.getRendererInfo();
+console.log('Renderer GetRendererInfo:');
+console.log('Renderer content:' + rendererInfo.content);
+console.log('Renderer usage:' + rendererInfo.usage);
+console.log('Renderer flags:' + rendererInfo.rendererFlags);
```
+## audioRenderer.getStreamInfo
-## audioRenderer.getParams
-
-getParams(callback: AsyncCallback): void8+
+getStreamInfo(callback: AsyncCallback): void8+
-Gets audio parameters of the renderer. This method uses an asynchronous callback to return the result.
+Gets the renderer stream information. This method uses an asynchronous callback to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| :------- | :------------------------------ | :-------- | :-------------------------------------------- |
-| callback | AsyncCallback | Yes | Callback used to return the audio parameters. |
-| | | | |
+| Name | Type | Mandatory | Description |
+| :------- | :--------------------------------- | :-------- | :---------------------------------------------- |
+| callback | AsyncCallback | Yes | Callback used to return the stream information. |
+| | | | |
**Return value**
@@ -2552,21 +2558,20 @@ None
**Example**
```
-audioRenderer.getParams((err, audioParams)=>{
- console.log('Renderer GetParams:');
- console.log('Renderer format:' + audioParams.format);
- console.log('Renderer samplingRate:' + audioParams.samplingRate);
- console.log('Renderer channels:' + audioParams.channels);
- console.log('Renderer encoding:' + audioParams.encoding);
+audioRenderer.getStreamInfo((err, streamInfo)=>{
+ console.log('Renderer GetStreamInfo:');
+ console.log('Renderer sampling rate:' + streamInfo.samplingRate);
+ console.log('Renderer channel:' + streamInfo.AudioChannel);
+ console.log('Renderer format:' + streamInfo.AudioSampleFormat);
+ console.log('Renderer encoding type:' + streamInfo.AudioEncodingType);
})
```
+## audioRenderer.getStreamInfo
-## audioRenderer.getParams
+getStreamInfo(): Promise8+
-getParams(): Promise8+
-
-Gets audio parameters of the renderer. This method uses a promise to return the result.
+Gets the renderer stream information. This method uses a promise to return the result.
**Parameters**
@@ -2574,34 +2579,33 @@ None
**Return value**
-| Type | Description |
-| :------------------------ | :------------------------------------------- |
-| Promise | Promise used to return the audio parameters. |
+| Type | Description |
+| :---------------------------- | :----------------------------------------------- |
+| Promise | Promise used to return the stream information. |
**Example**
```
-let audioParams = await audioRenderer.getParams();
-console.log('Renderer GetParams:');
-console.log('Renderer format:' + audioParams.format);
-console.log('Renderer samplingRate:' + audioParams.samplingRate);
-console.log('Renderer channels:' + audioParams.channels);
-console.log('Renderer encoding:' + audioParams.encoding);
+let streamInfo = await audioRenderer.getStreamInfo();
+console.log('Renderer GetStreamInfo:');
+console.log('Renderer sampling rate:' + streamInfo.samplingRate);
+console.log('Renderer channel:' + streamInfo.AudioChannel);
+console.log('Renderer format:' + streamInfo.AudioSampleFormat);
+console.log('Renderer encoding type:' + streamInfo.AudioEncodingType);
```
-
## audioRenderer.start
-start(callback: AsyncCallback): void8+
+start(callback: AsyncCallback): void8+
Starts the renderer. This method uses an asynchronous callback to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| :------- | :---------------------- | :-------- | :----------------------------------------------------------------------------- |
-| callback | AsyncCallback | Yes | Returns true if the renderer is started successfully; returns false otherwise. |
-| | | | |
+| Name | Type | Mandatory | Description |
+| :------- | :---------------------- | :-------- | :-------------------------------------- |
+| callback | AsyncCallback | Yes | Callback used to return the result. |
+| | | | |
**Return value**
@@ -2610,11 +2614,11 @@ None
**Example**
```
-audioRenderer.start((err, started)=>{
- if (started) {
- console.log('Renderer started.');
+audioRenderer.start((err)=>{
+ if (err) {
+ console.error('Renderer start failed.');
} else {
- console.error('Renderer start rejected.');
+ console.info('Renderer start success.');
}
})
```
@@ -2622,7 +2626,7 @@ audioRenderer.start((err, started)=>{
## audioRenderer.start
-start(): Promise8+
+start(): Promise8+
Starts the renderer. This method uses a promise to return the result.
@@ -2632,34 +2636,29 @@ None
**Return value**
-| Type | Description |
-| :---------------- | :----------------------------------------------------------------------------- |
-| Promise | Returns true if the renderer is started successfully; returns false otherwise. |
+| Type | Description |
+| :------------- | :--------------------------------- |
+| Promise | Promise used to return the result. |
**Example**
```
-var started = await audioRenderer.start();
-if (started) {
- console.log('Renderer started');
-} else {
- console.error('Renderer start rejected');
-}
+await audioRenderer.start();
```
## audioRenderer.pause
-pause(callback: AsyncCallback): void8+
+pause(callback: AsyncCallback): void8+
Pauses rendering. This method uses an asynchronous callback to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| :------- | :---------------------- | :-------- | :---------------------------------------------------------------------------- |
-| callback | AsyncCallback | Yes | Returns true if the renderer is paused successfully; returns false otherwise. |
-| | | | |
+| Name | Type | Mandatory | Description |
+| :------- | :---------------------- | :-------- | :------------------------------------ |
+| callback | AsyncCallback | Yes | Callback used to return the result. |
+| | | | |
**Return value**
@@ -2668,11 +2667,11 @@ None
**Example**
```
-audioRenderer.pause((err, paused)=>{
- if (paused) {
- console.log('Renderer paused.');
+audioRenderer.pause((err)=>{
+ if (err) {
+ console.error('Renderer pause failed');
} else {
- console.error('Renderer pause failed');
+ console.log('Renderer paused.');
}
})
```
@@ -2681,7 +2680,7 @@ audioRenderer.pause((err, paused)=>{
## audioRenderer.pause
-pause(): Promise8+
+pause(): Promise8+
Pauses rendering. This method uses a promise to return the result.
@@ -2691,35 +2690,30 @@ None
**Return value**
-| Type | Description |
-| :---------------- | :---------------------------------------------------------------------------- |
-| Promise | Returns true if the renderer is paused successfully; returns false otherwise. |
+| Type | Description |
+| :------------- | :--------------------------------- |
+| Promise | Promise used to return the result. |
**Example**
```
-var paused = await audioRenderer.pause();
-if (paused) {
- console.log('Renderer paused');
-} else {
- console.error('Renderer pause failed');
-}
+await audioRenderer.pause();
```
## audioRenderer.drain
-drain(callback: AsyncCallback): void8+
+drain(callback: AsyncCallback): void8+
Drains the playback buffer. This method uses an asynchronous callback to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| :------- | :---------------------- | :-------- | :--------------------------------------------------------------------------- |
-| callback | AsyncCallback | Yes | Returns true if the buffer is drained successfully; returns false otherwise. |
-| | | | |
+| Name | Type | Mandatory | Description |
+| :------- | :---------------------- | :-------- | :---------------------------------------|
+| callback | AsyncCallback | Yes | Callback used to return the result. |
+| | | | |
**Return value**
@@ -2728,11 +2722,11 @@ None
**Example**
```
-audioRenderer.drain((err, drained)=>{
- if (drained) {
- console.log('Renderer drained.');
+audioRenderer.drain((err)=>{
+ if (err) {
+ console.error('Renderer drain failed');
} else {
- console.error('Renderer drain failed');
+ console.log('Renderer drained.');
}
})
```
@@ -2740,7 +2734,7 @@ audioRenderer.drain((err, drained)=>{
## audioRenderer.drain
-drain(): Promise8+
+drain(): Promise8+
Drains the playback buffer. This method uses a promise to return the result.
@@ -2750,34 +2744,29 @@ None
**Return value**
-| Type | Description |
-| :---------------- | :--------------------------------------------------------------------------- |
-| Promise | Returns true if the buffer is drained successfully; returns false otherwise. |
+| Type | Description |
+| :------------- | :--------------------------------- |
+| Promise | Promise used to return the result. |
**Example**
```
-var drained = await audioRenderer.drain();
-if (drained) {
- console.log('Renderer drained');
-} else {
- console.error('Renderer drain failed');
-}
+await audioRenderer.drain();
```
## audioRenderer.stop
-stop(callback: AsyncCallback): void8+
+stop(callback: AsyncCallback): void8+
Stops rendering. This method uses an asynchronous callback to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| :------- | :---------------------- | :-------- | :------------------------------------------------------------------------------ |
-| callback | AsyncCallback | Yes | Returns true if the rendering is stopped successfully; returns false otherwise. |
-| | | | |
+| Name | Type | Mandatory | Description |
+| :------- | :---------------------- | :-------- | :------------------------------------- |
+| callback | AsyncCallback | Yes | Callback used to return the result. |
+| | | | |
**Return value**
@@ -2786,11 +2775,11 @@ None
**Example**
```
-audioRenderer.stop((err, stopped)=>{
- if (stopped) {
- console.log('Renderer stopped.');
+audioRenderer.stop((err)=>{
+ if (err) {
+ console.error('Renderer stop failed');
} else {
- console.error('Renderer stop failed');
+ console.log('Renderer stopped.');
}
})
```
@@ -2798,7 +2787,7 @@ audioRenderer.stop((err, stopped)=>{
## audioRenderer.stop
-stop(): Promise8+
+stop(): Promise8+
Stops rendering. This method uses a promise to return the result.
@@ -2808,34 +2797,29 @@ None
**Return value**
-| Type | Description |
-| :---------------- | :------------------------------------------------------------------------------ |
-| Promise | Returns true if the rendering is stopped successfully; returns false otherwise. |
+| Type | Description |
+| :------------- | :--------------------------------- |
+| Promise | Promise used to return the result. |
**Example**
```
-var stopped = await audioRenderer.stop();
-if (stopped) {
- console.log('Renderer stopped');
-} else {
- console.error('Renderer stop failed');
-}
+await audioRenderer.stop();
```
## audioRenderer.release
-release(callback: AsyncCallback): void8+
+release(callback: AsyncCallback): void8+
Releases the renderer. This method uses an asynchronous callback to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| :------- | :---------------------- | :-------- | :------------------------------------------------------------------------------ |
-| callback | AsyncCallback | Yes | Returns true if the renderer is released successfully; returns false otherwise. |
-| | | | |
+| Name | Type | Mandatory | Description |
+| :------- | :---------------------- | :-------- | :------------------------------------- |
+| callback | AsyncCallback | Yes | Callback used to return the result. |
+| | | | |
**Return value**
@@ -2844,11 +2828,11 @@ None
**Example**
```
-audioRenderer.release((err, released)=>{
- if (released) {
- console.log('Renderer released.');
+audioRenderer.release((err)=>{
+ if (err) {
+ console.error('Renderer release failed');
} else {
- console.error('Renderer release failed');
+ console.log('Renderer released.');
}
})
```
@@ -2857,7 +2841,7 @@ audioRenderer.release((err, released)=>{
## audioRenderer.release
-release(): Promise8+
+release(): Promise8+
Releases the renderer. This method uses a promise to return the result.
@@ -2867,19 +2851,14 @@ None
**Return value**
-| Type | Description |
-| :---------------- | :------------------------------------------------------------------------------ |
-| Promise | Returns true if the renderer is released successfully; returns false otherwise. |
+| Type | Description |
+| :------------- | :--------------------------------- |
+| Promise | Promise used to return the result. |
**Example**
```
-var released = await audioRenderer.release();
-if (released) {
- console.log('Renderer released');
-} else {
- console.error('Renderer release failed');
-}
+await audioRenderer.release();
```
diff --git a/en/device-dev/driver/driver-platform-i2c-develop.md b/en/device-dev/driver/driver-platform-i2c-develop.md
index b60188cfdd6288c543567ce46cfda7e5ae8a9ce5..6d3bea6f18837b54ddb94dcf88cba576dd35d74e 100644
--- a/en/device-dev/driver/driver-platform-i2c-develop.md
+++ b/en/device-dev/driver/driver-platform-i2c-develop.md
@@ -11,7 +11,7 @@
The Inter-Integrated Circuit \(I2C\) bus is a simple and bidirectional two-wire synchronous serial bus developed by Philips. In the Hardware Driver Foundation (HDF) framework, the I2C module uses the unified service mode for API adaptation. In this mode, a device service is used as the I2C manager to handle external access requests in a unified manner, which is reflected in the configuration file. The unified service mode applies to the scenario where there are many device objects of the same type, for example, when the I2C module has more than 10 controllers. If the independent service mode is used, more device nodes need to be configured and memory resources will be consumed by services.
**Figure 1** Unified service mode
-
+
## How to Develop
diff --git a/en/device-dev/driver/driver-platform-pwm-develop.md b/en/device-dev/driver/driver-platform-pwm-develop.md
index 2420131c13ca485f253de5e2e0eb5d5f101f7711..3dee4faaf4d9ae03db430da4a6d8ac682bef7a45 100644
--- a/en/device-dev/driver/driver-platform-pwm-develop.md
+++ b/en/device-dev/driver/driver-platform-pwm-develop.md
@@ -11,7 +11,7 @@
In the Hardware Driver Foundation \(HDF\) framework, the Pulse Width Modulator \(PWM\) uses the independent service mode for API adaptation. In this mode, each device independently publishes a device service to handle external access requests. After receiving an access request from an API, the device manager extracts the parameters in the request to call the internal method of the target device. In the independent service mode, the service management capabilities of the HDF Device Manager can be directly used. However, you need to configure a device node for each device, which increases the memory usage.
**Figure 1** Independent service mode
-
+
## How to Develop
diff --git a/en/device-dev/driver/driver-platform-rtc-develop.md b/en/device-dev/driver/driver-platform-rtc-develop.md
index 7be78974d7afc3e3da9c48e7bfb9f3f299e9a6e9..7ad6888da8b4ce2724a8395f9d62fa717b33d5a3 100644
--- a/en/device-dev/driver/driver-platform-rtc-develop.md
+++ b/en/device-dev/driver/driver-platform-rtc-develop.md
@@ -11,7 +11,7 @@
In the Hardware Driver Foundation \(HDF\) framework, the real-time clock \(RTC\) uses the independent service mode for API adaptation. In this mode, each device independently publishes a device service to handle external access requests. After receiving an access request from an API, the device manager extracts the parameters in the request to call the internal method of the target device. In the independent service mode, the service management capabilities of the HDFDeviceManager can be directly used. However, you need to configure a device node for each device, which increases the memory usage.
**Figure 1** Independent service mode
-
+
## How to Develop
diff --git a/en/device-dev/driver/driver-platform-sdio-develop.md b/en/device-dev/driver/driver-platform-sdio-develop.md
index 107b4494ae24992acb058762139703268bb1559b..f954769c943e33c72d2286c98893a04cbd4890c5 100644
--- a/en/device-dev/driver/driver-platform-sdio-develop.md
+++ b/en/device-dev/driver/driver-platform-sdio-develop.md
@@ -11,7 +11,7 @@
A Secure Digital Input Output \(SDIO\) card is an extension of the SD specification to cover I/O functions. SD and SDIO are called multimedia card \(MMCs\). In the Hardware Driver Foundation \(HDF\) framework, the SDIO module uses the independent service mode for API adaptation. In this mode, each device independently publishes a device service to handle external access requests. After receiving an access request from an API, the device manager extracts the parameters in the request to call the internal method of the target device. In the independent service mode, the service management capabilities of the HDFDeviceManager can be directly used. However, you need to configure a device node for each device, which increases the memory usage.
**Figure 1** Independent service mode
-
+
## How to Develop
diff --git a/en/device-dev/driver/driver-platform-uart-develop.md b/en/device-dev/driver/driver-platform-uart-develop.md
index 234e03abfe105b8356208afd4b0c137f1b5d1628..3964b5ad1b43c7bba48491ea8b4f40eafafd80ff 100644
--- a/en/device-dev/driver/driver-platform-uart-develop.md
+++ b/en/device-dev/driver/driver-platform-uart-develop.md
@@ -11,7 +11,7 @@
In the Hardware Driver Foundation \(HDF\) framework, the Universal Asynchronous Receiver/Transmitter \(UART\) uses the independent service mode for API adaptation. In this mode, each device independently publishes a device service to handle external access requests. After receiving an access request from an API, the device manager extracts the parameters in the request to call the internal method of the target device. In the independent service mode, the service management capabilities of the HDF Device Manager can be directly used. However, you need to configure a device node for each device, which increases the memory usage.
**Figure 1** Independent service mode
-
+
## How to Develop
diff --git a/en/device-dev/driver/driver-platform-watchdog-develop.md b/en/device-dev/driver/driver-platform-watchdog-develop.md
index 9f511adacdd756f0c3cec8b6875ddfd7f32edcf7..2c01a9b2dc518efe665f7386f502b888a01af299 100644
--- a/en/device-dev/driver/driver-platform-watchdog-develop.md
+++ b/en/device-dev/driver/driver-platform-watchdog-develop.md
@@ -11,7 +11,7 @@
In the Hardware Driver Foundation \(HDF\) framework, the Watchdog \(also called Watchdog timer\) module uses the independent service mode for API adaptation. In this mode, each device independently publishes a device service to handle external access requests. After receiving an access request from an API, the device manager extracts the parameters in the request to call the internal method of the target device. In the independent service mode, the service management capabilities of the HDF Device Manager can be directly used. However, you need to configure a device node for each device, which increases the memory usage.
**Figure 1** Independent service mode
-
+
## How to Develop
diff --git a/en/device-dev/guide/Readme-EN.md b/en/device-dev/guide/Readme-EN.md
index 6b1407770583714f4d47dedb7276220ab2def364..281430305ce6af02b4cb1481e6100acc35c233af 100644
--- a/en/device-dev/guide/Readme-EN.md
+++ b/en/device-dev/guide/Readme-EN.md
@@ -2,7 +2,7 @@
- [Mini- and Small-System Devices](device-lite.md)
- [WLAN-connected Products](device-wlan.md)
- - [LED Peripheral Control](device-wlan-led-outcontrol.md)
+ - [LED Peripheral Control](device-wlan-led-control.md)
- [Third-Party SDK Integration](device-wlan-sdk.md)
- [Cameras Without a Screen](device-iotcamera.md)
- [Camera Control](device-iotcamera-control.md)
diff --git a/en/device-dev/guide/device-wlan-led-outcontrol.md b/en/device-dev/guide/device-wlan-led-control.md
similarity index 100%
rename from en/device-dev/guide/device-wlan-led-outcontrol.md
rename to en/device-dev/guide/device-wlan-led-control.md
diff --git a/en/device-dev/guide/device-wlan-led.md b/en/device-dev/guide/device-wlan-led.md
index 3e7c9e9ef49d53ee8f82557daacc18db4eb9d99e..55faec5993ec121fc8af870ab4250ca7f63ea120 100644
--- a/en/device-dev/guide/device-wlan-led.md
+++ b/en/device-dev/guide/device-wlan-led.md
@@ -1,5 +1,5 @@
# LED Peripheral Control
-- **[LED Peripheral Control](device-wlan-led-outcontrol.md)**
+- **[LED Peripheral Control](device-wlan-led-control.md)**
diff --git a/en/device-dev/porting/standard-system-porting-guide.md b/en/device-dev/porting/standard-system-porting-guide.md
index 7c1fd296c4ce5811686de27675b6fb03a5d81475..c5a8cf6d902f884d3d284ee6055c626fbe8234b1 100644
--- a/en/device-dev/porting/standard-system-porting-guide.md
+++ b/en/device-dev/porting/standard-system-porting-guide.md
@@ -488,7 +488,7 @@ HDF_DEVICE_ROOT := $(HDF_DIR_PREFIX)/../device
obj-$(CONFIG_DRIVERS_WLAN_XXX) += $(HDF_DEVICE_ROOT)/MySoCVendor/peripheral/build/standard/
```
-When **DRIVERS\_WLAN\_XXX** is enabled in the kernel, **makefile** in **//device/MySoCVendor/peripheral/build/standard/** is called. For more details, see [WLAN Development](../guide/device-wlan-led-outcontrol.md).
+When **DRIVERS\_WLAN\_XXX** is enabled in the kernel, **makefile** in **//device/MySoCVendor/peripheral/build/standard/** is called. For more details, see [WLAN Development](../guide/device-wlan-led-control.md).
### 4. Samples
diff --git a/zh-cn/application-dev/quick-start/configuring-openharmony-app-signature.md b/zh-cn/application-dev/quick-start/configuring-openharmony-app-signature.md
index c8e39831ac6dda33f867ab735c0819b68194e4c5..dd3b698de6e88b9ffe0da2977e055878e8166ada 100644
--- a/zh-cn/application-dev/quick-start/configuring-openharmony-app-signature.md
+++ b/zh-cn/application-dev/quick-start/configuring-openharmony-app-signature.md
@@ -1,11 +1,5 @@
# 配置OpenHarmony应用签名信息
-- [生成密钥和证书请求文件](#生成密钥和证书请求文件)
- - [使用DevEco Studio生成](#使用DevEco-Studio生成)
- - [使用命令行工具生成](#使用命令行工具生成)
-- [生成应用证书文件](#生成应用证书文件)
-- [生成应用Profile文件](#生成应用Profile文件)
-- [配置应用签名信息](#配置应用签名信息)
使用真机设备运行和调试OpenHarmony应用前,需要对应用进行签名才能正常运行。该指导用于OpenHarmony应用的签名配置。除此章节以外,DevEco Studio的其余操作指导无差别,具体请访问[HUAWEI DevEco Studio使用指南](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/tools_overview-0000001053582387)。配置应用签名信息的流程如下图所示。
diff --git a/zh-cn/application-dev/quick-start/configuring-openharmony-sdk.md b/zh-cn/application-dev/quick-start/configuring-openharmony-sdk.md
index 8fefc4869f4c506c2ebdce2bdbca8aa83f4cda34..435b9d34c56f93e4d2e80cf877f11ab3a2e760aa 100644
--- a/zh-cn/application-dev/quick-start/configuring-openharmony-sdk.md
+++ b/zh-cn/application-dev/quick-start/configuring-openharmony-sdk.md
@@ -1,11 +1,5 @@
# 配置OpenHarmony SDK
-- [前提条件](#前提条件)
-- [配置SDK信息](#配置SDK信息)
-- [参考信息](#参考信息)
- - [配置DevEco Studio代理](#配置DevEco-Studio代理)
- - [配置NPM代理](#配置NPM代理)
- - [设置Gradle代理](#设置Gradle代理)
在设置OpenHarmony应用开发环境时,需要开发者在DevEco Studio中配置对应的SDK信息。
diff --git a/zh-cn/application-dev/quick-start/deveco-studio-overview.md b/zh-cn/application-dev/quick-start/deveco-studio-overview.md
index 0bdc0b63d088579b3f6d7d81c8d7d40ce341127b..9c38b56badf16315a1bf1177577e1fb30f2ebef5 100644
--- a/zh-cn/application-dev/quick-start/deveco-studio-overview.md
+++ b/zh-cn/application-dev/quick-start/deveco-studio-overview.md
@@ -1,8 +1,5 @@
# 概述
-- [总体说明](#总体说明)
-- [使用约束](#使用约束)
-- [DevEco Studio演进路标](#DevEco-Studio演进路标)
## 总体说明
diff --git a/zh-cn/application-dev/quick-start/deveco-studio-release-notes.md b/zh-cn/application-dev/quick-start/deveco-studio-release-notes.md
index c8145d0caba2cab9a796f7019338359eedb81b26..98c7c6c0385ff76a8a2d53c625b3ea4ff3a46fa1 100644
--- a/zh-cn/application-dev/quick-start/deveco-studio-release-notes.md
+++ b/zh-cn/application-dev/quick-start/deveco-studio-release-notes.md
@@ -1,9 +1,5 @@
# 版本变更说明
-- [V3.0 Beta2(2021-12-31)](#V30-Beta22021-12-31)
- - [版本兼容性](#版本兼容性)
- - [版本变更说明](#版本变更说明)
-- [V3.0 Beta1(2021-09-29)](#V30-Beta12021-09-29)
## V3.0 Beta2(2021-12-31)
diff --git a/zh-cn/application-dev/reference/apis/js-apis-audio.md b/zh-cn/application-dev/reference/apis/js-apis-audio.md
index 28deb3a6a1b47efbe5a8c89d2f9985a28dfb7887..636afc455eb984765269155842edec14c2cfbda5 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-audio.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-audio.md
@@ -549,7 +549,7 @@ getRingerMode(): Promise<AudioRingMode>
| 类型 | 说明 |
| -------- | -------- |
-| Promise<[AudioRingMode](#audioringmode7-)> | Promise回调返回系统的铃声模式。 |
+| Promise<[AudioRingMode](#audioringmode)> | Promise回调返回系统的铃声模式。 |
**示例:**
@@ -771,7 +771,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=>
isDeviceActive(deviceType: DeviceType, callback: AsyncCallback<boolean>): void
-获取指定设备激活状态,使用callback方式返回异步结果。
+获取指定设备的激活状态,使用callback方式返回异步结果。
**参数:**
@@ -797,7 +797,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => {
isDeviceActive(deviceType: DeviceType): Promise<boolean>
-获取指定设备激活状态,使用promise方式返回异步结果。
+获取指定设备的激活状态,使用promise方式返回异步结果。
**参数:**
diff --git a/zh-cn/application-dev/reference/apis/js-apis-faultLogger.md b/zh-cn/application-dev/reference/apis/js-apis-faultLogger.md
index caf965763e5457caa33eeb19424a8a250d982fc5..b2de052c65cef709b1901aa38176a6a35bdad7d4 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-faultLogger.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-faultLogger.md
@@ -31,7 +31,7 @@ import faultLogger from '@ohos.faultLogger'
| -------- | -------- | -------- |
| pid | number | 故障进程的进程id |
| uid | number | 故障进程的用户id |
-| type | [FaultType](#faultloggerfaulttype) | 故障类型 |
+| type | [FaultType](#faulttype) | 故障类型 |
| timestamp | number | 日志生成时的秒级时间戳 |
| reason | string | 发生故障的原因 |
| module | string | 发生故障的模块 |
@@ -47,8 +47,8 @@ querySelfFaultLog(faultType: FaultType, callback: AsyncCallback<Array<Faul
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | faultType | [FaultType](#faultloggerfaulttype) | 是 | 输入要查询的故障类型。 |
- | callback | AsyncCallbackArray<Array<[FaultLogInfo](#faultloggerfaultloginfo)>> | 是 | 回调函数,在回调函数中获取故障信息数组。
- value拿到故障信息数组;value为undefined表示获取过程中出现异常,error返回错误提示字符串
+ | faultType | [FaultType](#faulttype) | 是 | 输入要查询的故障类型。 |
+ | callback | AsyncCallbackArray<Array<[FaultLogInfo](#faultloginfo)>> | 是 | 回调函数,在回调函数中获取故障信息数组。
- value拿到故障信息数组;value为undefined表示获取过程中出现异常,error返回错误提示字符串
- 示例:
```
@@ -83,12 +83,12 @@ querySelfFaultLog(faultType: FaultType) : Promise<Array<FaultLogInfo>&g
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | faultType | [FaultType](#faultloggerfaulttype) | 是 | 输入要查询的故障类型。 |
+ | faultType | [FaultType](#faulttype) | 是 | 输入要查询的故障类型。 |
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | Promise<Array<[FaultLogInfo](#faultloggerfaultloginfo)>> | Promise实例,可以在其then()方法中获取故障信息实例,也可以使用await。
- value拿到故障信息数组;value为undefined表示获取过程中出现异常 |
+ | Promise<Array<[FaultLogInfo](#faultloginfo)>> | Promise实例,可以在其then()方法中获取故障信息实例,也可以使用await。
- value拿到故障信息数组;value为undefined表示获取过程中出现异常 |
- 示例:
```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-featureAbility.md b/zh-cn/application-dev/reference/apis/js-apis-featureAbility.md
index 0813a708de4fbf9bb9b9df2f07d5371e5ecfcc18..a0d8e9a4151516e92c51a50721cff332c11d414a 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-featureAbility.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-featureAbility.md
@@ -449,7 +449,7 @@ connectAbility(request: Want, options:ConnectOptions): number
| 名称 | 类型 | 必填 | 描述 |
| ------- | -------------- | ---- | ---------------------------- |
-| request | Want | 是 | 表示被连接的ServiceAbility。 |
+| request | [Want](#want) | 是 | 表示被连接的ServiceAbility。 |
| options | ConnectOptions | 是 | 被指定的回调方法。 |
**Want类型说明:**
@@ -633,7 +633,7 @@ this.StartContinueAbility(remoteDeviceId); //remoteDeviceId is acquired from Dev
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ---------- | -------- | --------------------- | ---- | ------------------------------------------------------------ |
| resultCode | 只读 | number | 是 | 指示销毁该能力后返回的结果代码。您可以定义结果代码来识别错误(暂不支持) |
-| want | 只读 | [Want](#Want类型说明) | 否 | 指示销毁该能力后返回的数据。您可以定义返回的数据。此参数可以为null。 |
+| want | 只读 | [Want](#want) | 否 | 指示销毁该能力后返回的数据。您可以定义返回的数据。此参数可以为null。 |
## StartAbilityParameter
diff --git a/zh-cn/application-dev/reference/apis/js-apis-formbindingdata.md b/zh-cn/application-dev/reference/apis/js-apis-formbindingdata.md
new file mode 100644
index 0000000000000000000000000000000000000000..97263eedf6cfe4149ccfad0bdc46430ce52ab06b
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-formbindingdata.md
@@ -0,0 +1,51 @@
+# 卡片数据绑定类
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+## 导入模块
+
+```
+import formBindingData from '@ohos.application.formBindingData';
+```
+
+## 权限
+
+无
+
+## formBindingData.createFormBindingData
+
+createFormBindingData(obj?: Object | string): FormBindingData
+
+创建一个FormBindingData对象。
+
+- 参数:
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | ------ | -------------- | ---- | ------------------------------------------------------------ |
+ | obj | Object或string | 否 | js卡片要展示的数据。可以是包含若干键值对的Object或者 json 格式的字符串。 |
+
+
+
+- 返回值:
+
+ | 类型 | 说明 |
+ | ----------------------------------- | --------------------------------------- |
+ | [FormBindingData](#formbindingdata) | 根据传入数据创建的FormBindingData对象。 |
+
+
+
+- 示例:
+
+ ```
+ let obj = {"temperature": "21°"};
+ let formBindingDataObj = formBindingData.createFormBindingData(obj);
+ ```
+
+## FormBindingData
+
+FormBindingData相关描述。
+
+| 名称 | 类型 | 说明 |
+| ---- | -------------- | ------------------------------------------------------------ |
+| obj | Object或string | js卡片要展示的数据。可以是包含若干键值对的Object或者 json 格式的字符串。 |
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-formextension.md b/zh-cn/application-dev/reference/apis/js-apis-formextension.md
new file mode 100644
index 0000000000000000000000000000000000000000..83e27c049babb7e0a1cc420efac1a2efd80190bd
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-formextension.md
@@ -0,0 +1,171 @@
+# FormExtension
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+提供FormExtension卡片扩展相关接口。
+
+## 导入模块
+
+```
+import FormExtension from '@ohos.application.FormExtension';
+```
+
+## 权限
+
+无
+
+## 属性
+
+| 名称 | 参数类型 | 可读 | 可写 | 说明 |
+| ------- | ------------------------------------------------------- | ---- | ---- | --------------------------------------------------- |
+| context | [FormExtensionContext](js-apis-formextensioncontext.md) | 是 | 否 | FormExtension的上下文环境,继承自ExtensionContext。 |
+
+## onCreate
+
+onCreate(want: Want): formBindingData.FormBindingData
+
+卡片提供方接收创建卡片的通知接口。
+
+- 参数:
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | ------ | -------------------------------------- | ---- | ------------------------------------------------------------ |
+ | want | [Want](js-apis-featureAbility.md#want) | 是 | 当前Extension相关的Want类型信息,包括卡片ID、卡片名称、卡片样式等。这些卡片信息必须作为持久数据进行管理,以便后续更新和删除卡片。 |
+
+- 返回值:
+
+ | 类型 | 说明 |
+ | ------------------------------------------------------------ | ----------------------------------------------------------- |
+ | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | 一个formBindingData.FormBindingData对象,卡片要显示的数据。 |
+
+- 示例:
+
+ ```
+ onCreate(want) {
+ console.log('FormExtension onCreate, want:' + want.abilityName);
+ let dataObj1 = {
+ temperature:"11c",
+ "time":"11:00"
+ };
+ let obj1 = formBindingData.createFormBindingData(dataObj1);
+ return obj1;
+ }
+ ```
+
+## onCastToNormal
+
+onCastToNormal(formId: string): void
+
+卡片提供方接收临时卡片转常态卡片的通知接口。
+
+- 参数:
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | ------ | ------ | ---- | ------------------------ |
+ | formId | string | 是 | 请求转换为常态的卡片ID。 |
+
+- 示例:
+
+ ```
+ onCastToNormal(formId) {
+ console.log('FormExtension onCastToNormal, formId:' + formId);
+ }
+ ```
+
+## onUpdate
+
+onUpdate(formId: string): void
+
+卡片提供方接收更新卡片的通知接口。获取最新数据后调用[FormExtensionContext](js-apis-formextensioncontext.md)的updateForm接口刷新卡片数据。
+
+- 参数:
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | ------ | ------ | ---- | ------------------ |
+ | formId | string | 是 | 请求更新的卡片ID。 |
+
+- 示例:
+
+ ```
+ onUpdate(formId) {
+ console.log('FormExtension onUpdate, formId:' + formId);
+ let obj2 = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"});
+ this.context.updateForm(formId, obj2)
+ .then((data)=>{
+ console.log('FormExtension context updateForm, data:' + data);
+ }).catch((error) => {
+ console.error('Operation updateForm failed. Cause: ' + error);});
+ }
+ ```
+
+## onVisibilityChange
+
+onVisibilityChange(newStatus: { [key: string]: number }): void
+
+卡片提供方接收修改可见性的通知接口。
+
+- 参数:
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | --------- | ------------------------- | ---- | ---------------------------- |
+ | newStatus | { [key: string]: number } | 是 | 请求修改的卡片ID和可见状态。 |
+
+- 示例:
+
+ ```
+ onVisibilityChange(newStatus) {
+ console.log('FormExtension onVisibilityChange, newStatus:' + newStatus);
+ let obj2 = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"});
+
+ for (let key in newStatus) {
+ console.log('FormExtension onVisibilityChange, key:' + key + ", value=" + newStatus[key]);
+ this.context.updateForm(key, obj2)
+ .then((data)=>{
+ console.log('FormExtension context updateForm, data:' + data);
+ }).catch((error) => {
+ console.error('Operation updateForm failed. Cause: ' + error);});
+ }
+ }
+ ```
+
+## onEvent
+
+onEvent(formId: string, message: string): void
+
+卡片提供方接收处理卡片事件的通知接口。
+
+- 参数:
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | ------- | ------ | ---- | ---------------------- |
+ | formId | string | 是 | 请求触发事件的卡片ID。 |
+ | message | string | 是 | 事件消息。 |
+
+- 示例:
+
+ ```
+ onEvent(formId, message) {
+ console.log('FormExtension onEvent, formId:' + formId + ", message:" + message);
+ }
+ ```
+
+## onDestroy
+
+onDestroy(formId: string): void
+
+卡片提供方接收销毁卡片的通知接口。
+
+- 参数:
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | ------ | ------ | ---- | ------------------ |
+ | formId | string | 是 | 请求销毁的卡片ID。 |
+
+- 示例:
+
+ ```
+ onDestroy(formId) {
+ console.log('FormExtension onDestroy, formId:' + formId);
+ }
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-formextensioncontext.md b/zh-cn/application-dev/reference/apis/js-apis-formextensioncontext.md
new file mode 100644
index 0000000000000000000000000000000000000000..1a7cb0401ca4b63a600dc715858352f23182dcbc
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-formextensioncontext.md
@@ -0,0 +1,59 @@
+# FormExtensionContext
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+FormExtension的上下文环境,提供FormExtension具有的能力和接口,继承自ExtensionContext。
+
+## updateForm
+
+updateForm(formId: string, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback\): void
+
+主动更新卡片。
+
+- 参数:
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | --------------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
+ | formId | string | 是 | 请求更新的卡片ID。 |
+ | formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | 是 | 卡片新的数据。 |
+ | callback | AsyncCallback\ | 是 | 回调函数,返回接口调用是否成功的结果。 |
+
+- 示例:
+
+ ```
+ let obj2 = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"});
+ this.context.updateForm(formId, obj2, (data)=>{
+ console.log('FormExtension context updateForm, data:' + data);
+ });
+ ```
+
+## updateForm
+
+updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise\
+
+更新卡片。
+
+- 参数:
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | --------------- | ------------------------------------------------------------ | ---- | ------------------ |
+ | formId | string | 是 | 请求更新的卡片ID。 |
+ | formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | 是 | 卡片新的数据。 |
+
+- 返回值:
+
+ | 类型 | 说明 |
+ | -------------- | --------------------------------- |
+ | Promise\ | 返回一个Promise,包含接口的结果。 |
+
+- 示例:
+
+ ```
+ let obj2 = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"});
+ this.context.updateForm(formId, obj2)
+ .then((data)=>{
+ console.log('FormExtension context updateForm, data:' + data);
+ }).catch((error) => {
+ console.error('Operation updateForm failed. Cause: ' + error);});
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-media.md b/zh-cn/application-dev/reference/apis/js-apis-media.md
index 6d7e1cb887dfb05b7a587a3cf9130230236236e5..8954c48ed43283ae5a098420b2a91cfb47bf16e4 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-media.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-media.md
@@ -537,7 +537,7 @@ on(type: 'play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeCh
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------- | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 播放事件回调类型,支持的事件包括:'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange'。
- 'play':完成[play()](#audioplayer_play)调用,音频开始播放,触发该事件。
- 'pause':完成[pause()](#audioplayer_pause)调用,音频暂停播放,触发该事件。
- 'stop':完成[stop()](#audioplayer_stop)调用,音频停止播放,触发该事件。
- 'reset':完成[reset()](#audioplayer_reset)调用,播放器重置,触发该事件。
- 'dataLoad':完成音频数据加载后触发该事件,即src属性设置完成后触发该事件。
- 'finish':完成音频播放后触发该事件。
- 'volumeChange':完成[setVolume()](#audioplayer_setvolume)调用,播放音量改变后触发该事件。 |
+| type | string | 是 | 播放事件回调类型,支持的事件包括:'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange'。
- 'play':完成[play()](#play)调用,音频开始播放,触发该事件。
- 'pause':完成[pause()](#pause)调用,音频暂停播放,触发该事件。
- 'stop':完成[stop()](#stop)调用,音频停止播放,触发该事件。
- 'reset':完成[reset()](#reset7)调用,播放器重置,触发该事件。
- 'dataLoad':完成音频数据加载后触发该事件,即src属性设置完成后触发该事件。
- 'finish':完成音频播放后触发该事件。
- 'volumeChange':完成[setVolume()](#setvolume)调用,播放音量改变后触发该事件。 |
| callback | () => void | 是 | 播放事件回调方法。 |
**示例:**
@@ -589,13 +589,13 @@ audioPlayer.src = 'file:///data/data/ohos.xxx.xxx/files/test.mp4'; //设置src
on(type: 'timeUpdate', callback: Callback\): void
-开始订阅音频播放[seek()](#audioplayer_seek)时间更新事件。
+开始订阅音频播放[seek()](#seek)时间更新事件。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------- | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 播放事件回调类型,支持的事件包括:'timeUpdate'。
- 'timeUpdate':[seek()](#audioplayer_seek)调用完成,触发该事件。 |
+| type | string | 是 | 播放事件回调类型,支持的事件包括:'timeUpdate'。
- 'timeUpdate':[seek()](#seek)调用完成,触发该事件。 |
| callback | Callback\ | 是 | 播放事件回调方法。回调方法入参为成功seek的时间。 |
**示例:**
diff --git a/zh-cn/application-dev/reference/apis/js-apis-particleAbility.md b/zh-cn/application-dev/reference/apis/js-apis-particleAbility.md
index 0727eeb1c1b5a389013fd36dbf78920d4bbe005e..0e2cad1377516dab8e71878eea75c8938aaea29b 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-particleAbility.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-particleAbility.md
@@ -174,7 +174,7 @@ connectAbility(request: Want, options:ConnectOptions): number
| 名称 | 类型 | 必填 | 描述 |
| ------- | -------------- | ---- | -------------------------- |
-| request | Want | 是 | 表示被连接的ServiceAbility |
+| request | [Want](#want) | 是 | 表示被连接的ServiceAbility |
| options | ConnectOptions | 是 | 被指定的回调方法 |
**ConnectOptions类型说明:**
@@ -310,7 +310,7 @@ var result = particleAbility.disconnectAbility(connId).then((void) => {
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ------------------- | -------- | --------------------- | ---- | ------------------------------------------------------------ |
-| want | 只读 | [Want](#Want类型说明) | 是 | 表示需要包含有关目标启动能力的信息。 |
+| want | 只读 | [Want](#want) | 是 | 表示需要包含有关目标启动能力的信息。 |
| abilityStartSetting | 只读 | {[key: string]: any} | 否 | 表示能力的特殊属性,当开发者启动能力时,该属性可以作为调用中的输入参数传递。 |
## Want
diff --git a/zh-cn/application-dev/reference/apis/js-apis-usb.md b/zh-cn/application-dev/reference/apis/js-apis-usb.md
index 57ec4cdcf843c36971de312b614f0c0c64dfb4de..40b5288a86b3960aabd4bc05966ebc6605f7297d 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-usb.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-usb.md
@@ -243,7 +243,7 @@ usb.setInterface(pipe: USBDevicePipe, iface: USBInterface): number
设置设备接口。
-需要调用[usb.getDevices](#usb-getdevices)获取设备列表以及interfaces;调用[usb.requestRight](#usbrequestright)获取设备请求权限;调用[usb.connectDevice](#usbconnectdevice)得到devicepipe作为参数。
+需要调用[usb.getDevices](#usbgetdevices)获取设备列表以及interfaces;调用[usb.requestRight](#usbrequestright)获取设备请求权限;调用[usb.connectDevice](#usbconnectdevice)得到devicepipe作为参数。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-window.md b/zh-cn/application-dev/reference/apis/js-apis-window.md
index 2d98b3413517fc49350d302727b7645b589d19d8..ff45b896576008a906846753b579d928b04cbaf1 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-window.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-window.md
@@ -451,7 +451,7 @@ setWindowType(type: WindowType, callback: AsyncCallback<void>): void
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | type | [WindowType](#windowType7) | 是 |窗口类型。 |
+ | type | [WindowType](#windowtype7) | 是 |窗口类型。 |
| callback | AsyncCallback<void> | 是 | 回调函数。 |
- 示例
diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-common-methods.md b/zh-cn/application-dev/reference/arkui-js/js-components-common-methods.md
index 5f952ef01d0d64bcd74c069f53eeb800b9ce28dc..67a47db644489562f6f50e3aaab6b56425a29121 100644
--- a/zh-cn/application-dev/reference/arkui-js/js-components-common-methods.md
+++ b/zh-cn/application-dev/reference/arkui-js/js-components-common-methods.md
@@ -582,7 +582,7 @@ getBoundingClientRect\(\): [ ](#table1650917111414)
## createIntersectionObserver
-createIntersectionObserver\(param?:[ObserverParam](#table143341035121917)\):[Observer](#table4506633141711)
+createIntersectionObserver\(param?:ObserverParam\): Observer)
监听元素在当前页面的可见范围。
@@ -600,7 +600,7 @@ createIntersectionObserver\(param?:[ObserverParam](#table143341035121917)\):[O
param
|
- ObserverParam
+ | ObserverParam
|
-
|
diff --git a/zh-cn/device-dev/driver/driver-peripherals-sensor-des.md b/zh-cn/device-dev/driver/driver-peripherals-sensor-des.md
index 77b11bd427bc4075411a720c1aaf159bfb4bf5ee..90ddbe4e79575b84bbf50802b4b5b5a6bd9de6fa 100755
--- a/zh-cn/device-dev/driver/driver-peripherals-sensor-des.md
+++ b/zh-cn/device-dev/driver/driver-peripherals-sensor-des.md
@@ -155,7 +155,7 @@ Sensor驱动模型对驱动开发者开放的功能接口,驱动开发者无
int32_t WriteSensor(struct SensorBusCfg *busCfg, uint8_t *writeData, uint16_t len)
|
-按照配置的总线方式,传感器配置数据写入寄存器。
+ | 按照配置的总线方式,将传感器配置数据写入寄存器。
|
通用配置操作接口
@@ -214,17 +214,17 @@ Sensor驱动模型要求驱动开发者实现的接口功能,参考[表3](#tab
|
int32_t init(void)
|
-传感器器设备探测成功后,需要对传感器器设备初始化配置。
+ | 传感器设备探测成功后,需要对传感器设备初始化配置。
|
int32_t Enable(void)
|
-根据当前传感器器设备的HCS配置,下发传感器设备使能操作组的寄存器配置。
+ | 根据当前传感器设备的HCS配置,下发传感器设备使能操作组的寄存器配置。
|
int32_t Disable(void)
|
-根据当前传感器器设备的HCS配置,下发传感器设备去使能操作组的寄存器配置。
+ | 根据当前传感器设备的HCS配置,下发传感器设备去使能操作组的寄存器配置。
|
int32_t SetBatch(int64_t samplingInterval, int64_t reportInterval)
@@ -239,7 +239,7 @@ Sensor驱动模型要求驱动开发者实现的接口功能,参考[表3](#tab
|
int32_t SetOption(uint32_t option)
|
-根据可选配置,下发量程,精度等寄存器配置。
+ | 根据可选配置、下发量程和精度等寄存器配置。
|
void ReadSensorData(void)
|