提交 7c3c12ed 编写于 作者: B bird_j 提交者: Gitee

Merge branch 'master' of gitee.com:openharmony/docs into local_api_docs

Signed-off-by: Nbird_j <jianghongpeng@huawei.com>
...@@ -146,7 +146,13 @@ You use audio management APIs to set and obtain volume, and get information abou ...@@ -146,7 +146,13 @@ You use audio management APIs to set and obtain volume, and get information abou
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody><tr id="row188162012454"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p764215288462"><a name="p764215288462"></a><a name="p764215288462"></a>MEDIA = 1</p> <tbody>
<tr id="row188162012454"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p764215288462"><a name="p764215288462"></a><a name="p764215288462"></a>VOICE_CALL = 0</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p1596200459"><a name="p1596200459"></a><a name="p1596200459"></a>Audio streams for voice calls</p>
</td>
</tr>
<tr id="row188162012454"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p764215288462"><a name="p764215288462"></a><a name="p764215288462"></a>MEDIA = 1</p>
</td> </td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p1596200459"><a name="p1596200459"></a><a name="p1596200459"></a>Audio streams for media purpose</p> <td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p1596200459"><a name="p1596200459"></a><a name="p1596200459"></a>Audio streams for media purpose</p>
</td> </td>
...@@ -154,6 +160,11 @@ You use audio management APIs to set and obtain volume, and get information abou ...@@ -154,6 +160,11 @@ You use audio management APIs to set and obtain volume, and get information abou
<tr id="row1288915367468"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p51611346194614"><a name="p51611346194614"></a><a name="p51611346194614"></a>RINGTONE = 2</p> <tr id="row1288915367468"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p51611346194614"><a name="p51611346194614"></a><a name="p51611346194614"></a>RINGTONE = 2</p>
</td> </td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p9333131144712"><a name="p9333131144712"></a><a name="p9333131144712"></a>Audio streams for ring tones</p> <td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p9333131144712"><a name="p9333131144712"></a><a name="p9333131144712"></a>Audio streams for ring tones</p>
<tr id="row188162012454"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p764215288462"><a name="p764215288462"></a><a name="p764215288462"></a>VOICE_ASSISTANT = 9</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p1596200459"><a name="p1596200459"></a><a name="p1596200459"></a>Audio streams for voice assistant</p>
</td>
</tr>
</td> </td>
</tr> </tr>
</tbody> </tbody>
...@@ -222,27 +233,27 @@ You use audio management APIs to set and obtain volume, and get information abou ...@@ -222,27 +233,27 @@ You use audio management APIs to set and obtain volume, and get information abou
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p17389145016497"><a name="p17389145016497"></a><a name="p17389145016497"></a>Invalid device</p> <td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p17389145016497"><a name="p17389145016497"></a><a name="p17389145016497"></a>Invalid device</p>
</td> </td>
</tr> </tr>
<tr id="row938915016493"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p538925044916"><a name="p538925044916"></a><a name="p538925044916"></a>SPEAKER = 1</p> <tr id="row938915016493"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p538925044916"><a name="p538925044916"></a><a name="p538925044916"></a>SPEAKER = 2</p>
</td> </td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p16724165865017"><a name="p16724165865017"></a><a name="p16724165865017"></a>Speaker</p> <td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p16724165865017"><a name="p16724165865017"></a><a name="p16724165865017"></a>Speaker</p>
</td> </td>
</tr> </tr>
<tr id="row12389105084916"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p538914502497"><a name="p538914502497"></a><a name="p538914502497"></a>WIRED_HEADSET = 2</p> <tr id="row12389105084916"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p538914502497"><a name="p538914502497"></a><a name="p538914502497"></a>WIRED_HEADSET = 3</p>
</td> </td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p63891850144911"><a name="p63891850144911"></a><a name="p63891850144911"></a>Wired headset</p> <td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p63891850144911"><a name="p63891850144911"></a><a name="p63891850144911"></a>Wired headset</p>
</td> </td>
</tr> </tr>
<tr id="row2389205074915"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p10389175054919"><a name="p10389175054919"></a><a name="p10389175054919"></a>BLUETOOTH_SCO = 3</p> <tr id="row2389205074915"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p10389175054919"><a name="p10389175054919"></a><a name="p10389175054919"></a>BLUETOOTH_SCO = 7</p>
</td> </td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p538905016496"><a name="p538905016496"></a><a name="p538905016496"></a>Bluetooth device using the synchronous connection oriented link (SCO)</p> <td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p538905016496"><a name="p538905016496"></a><a name="p538905016496"></a>Bluetooth device using the synchronous connection oriented (SCO) link</p>
</td> </td>
</tr> </tr>
<tr id="row83891502499"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p1938975015494"><a name="p1938975015494"></a><a name="p1938975015494"></a>BLUETOOTH_A2DP = 4</p> <tr id="row83891502499"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p1938975015494"><a name="p1938975015494"></a><a name="p1938975015494"></a>BLUETOOTH_A2DP = 8</p>
</td> </td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p193891550134912"><a name="p193891550134912"></a><a name="p193891550134912"></a>Bluetooth device using advanced audio distribution profile (A2DP)</p> <td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p193891550134912"><a name="p193891550134912"></a><a name="p193891550134912"></a>Bluetooth device using advanced audio distribution profile (A2DP)</p>
</td> </td>
</tr> </tr>
<tr id="row11389175014916"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p1738955018497"><a name="p1738955018497"></a><a name="p1738955018497"></a>MIC = 5</p> <tr id="row11389175014916"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p1738955018497"><a name="p1738955018497"></a><a name="p1738955018497"></a>MIC = 15</p>
</td> </td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p73891250174914"><a name="p73891250174914"></a><a name="p73891250174914"></a>Microphone</p> <td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p73891250174914"><a name="p73891250174914"></a><a name="p73891250174914"></a>Microphone</p>
</td> </td>
...@@ -269,5 +280,3 @@ You use audio management APIs to set and obtain volume, and get information abou ...@@ -269,5 +280,3 @@ You use audio management APIs to set and obtain volume, and get information abou
console.log(`Media getVolume ${value}`); console.log(`Media getVolume ${value}`);
}); });
``` ```
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
--- ---
## ***Note***: ## ***Note***:
1. This document applies to JavaScript. 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** ## **Summary**
This guide will show you how to use AudioRenderer to create an audio player app. 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 ...@@ -24,11 +22,28 @@ Please see [**js-apis-audio.md**](https://gitee.com/openharmony/docs/blob/master
## **Usage** ## **Usage**
Here's an example of how to use AudioRenderer to play a raw audio file. 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. 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 var audioStreamInfo = {
const audioRenderer = audio.createAudioRenderer(volType); 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.\ 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. ...@@ -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.\ 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() { async function startRenderer() {
var state = audioRenderer.state; var state = audioRenderer.state;
...@@ -148,13 +144,14 @@ Here's an example of how to use AudioRenderer to play a raw audio file. ...@@ -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'); console.info('Renderer is not in a correct state to start');
return; return;
} }
var started = await audioRenderer.start();
if (started) { await audioRenderer.start();
isPlay = true;
state = audioRenderer.state;
if (state == audio.AudioState.STATE_RUNNING) {
console.info('Renderer started'); console.info('Renderer started');
} else { } else {
console.error('Renderer start failed'); 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. ...@@ -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'); console.info('Renderer is not running');
return; return;
} }
var paused = await audioRenderer.pause();
if (paused) { await audioRenderer.pause();
state = audioRenderer.state;
if (state == audio.AudioState.STATE_PAUSED) {
console.info('Renderer paused'); console.info('Renderer paused');
} else { } else {
console.error('Renderer pause failed'); console.error('Renderer pause failed');
...@@ -226,8 +226,11 @@ Here's an example of how to use AudioRenderer to play a raw audio file. ...@@ -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'); console.info('Renderer is not running or paused');
return; return;
} }
var stopped = await audioRenderer.stop();
if (stopped) { await audioRenderer.stop();
state = audioRenderer.state;
if (state == audio.AudioState.STATE_STOPPED) {
console.info('Renderer stopped'); console.info('Renderer stopped');
} else { } else {
console.error('Renderer stop failed'); console.error('Renderer stop failed');
...@@ -243,8 +246,11 @@ Here's an example of how to use AudioRenderer to play a raw audio file. ...@@ -243,8 +246,11 @@ Here's an example of how to use AudioRenderer to play a raw audio file.
console.info('Resourced already released'); console.info('Resourced already released');
return; return;
} }
var released = await audioRenderer.release();
if (released) { await audioRenderer.release();
state = audioRenderer.state;
if (state == STATE_RELEASED) {
console.info('Renderer released'); console.info('Renderer released');
} else { } else {
console.info('Renderer release failed'); console.info('Renderer release failed');
...@@ -257,7 +263,6 @@ Here's an example of how to use AudioRenderer to play a raw audio file. ...@@ -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. 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.\ 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.\ 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:** ## **Asynchronous Operations:**
Most of the AudioRenderer calls are asynchronous. As a result, the UI thread will not be blocked.\ 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. ...@@ -267,4 +272,3 @@ provides reference for both callback and promise.
## **Other APIs:** ## **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. 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.
...@@ -2,15 +2,6 @@ ...@@ -2,15 +2,6 @@
This module provides the following functions: audio management, audio rendering and system sound management. 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<a name="s56d19203690d4782bfc74069abb6bd71"></a> ## Modules to Import<a name="s56d19203690d4782bfc74069abb6bd71"></a>
``` ```
...@@ -71,8 +62,25 @@ Obtains an **AudioRenderer** instance. ...@@ -71,8 +62,25 @@ Obtains an **AudioRenderer** instance.
**Example** **Example**
``` ```
const volType = audio.AudioVolumeType.MEDIA; var audioStreamInfo = {
const audioRenderer = audio.createAudioRenderer(volType); 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. ...@@ -112,7 +120,15 @@ Enumerates audio stream types.
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody><tr id="row1389215612395"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p52851329122117"><a name="p52851329122117"></a><a name="p52851329122117"></a>RINGTONE</p> <tbody>
<tr id="row1389215612395"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p52851329122117"><a name="p52851329122117"></a><a name="p52851329122117"></a>VOICE_CALL</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p2282152962115"><a name="p2282152962115"></a><a name="p2282152962115"></a>0</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p328012293211"><a name="p328012293211"></a><a name="p328012293211"></a>Audio stream for voice calls.</p>
</td>
</tr>
<tr id="row1389215612395"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p52851329122117"><a name="p52851329122117"></a><a name="p52851329122117"></a>RINGTONE</p>
</td> </td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p2282152962115"><a name="p2282152962115"></a><a name="p2282152962115"></a>2</p> <td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p2282152962115"><a name="p2282152962115"></a><a name="p2282152962115"></a>2</p>
</td> </td>
...@@ -126,6 +142,13 @@ Enumerates audio stream types. ...@@ -126,6 +142,13 @@ Enumerates audio stream types.
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p182452299212"><a name="p182452299212"></a><a name="p182452299212"></a>Audio stream for media purpose.</p> <td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p182452299212"><a name="p182452299212"></a><a name="p182452299212"></a>Audio stream for media purpose.</p>
</td> </td>
</tr> </tr>
<tr id="row6892145616397"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p027662952110"><a name="p027662952110"></a><a name="p027662952110"></a>VOICE_ASSISTANT</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p17273229192113"><a name="p17273229192113"></a><a name="p17273229192113"></a>9</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p182452299212"><a name="p182452299212"></a><a name="p182452299212"></a>Audio stream for voice assistant.</p>
</td>
</tr>
</tbody> </tbody>
</table> </table>
...@@ -221,35 +244,35 @@ Enumerates audio device types. ...@@ -221,35 +244,35 @@ Enumerates audio device types.
</tr> </tr>
<tr id="row16728520192714"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p4753161132815"><a name="p4753161132815"></a><a name="p4753161132815"></a>SPEAKER</p> <tr id="row16728520192714"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p4753161132815"><a name="p4753161132815"></a><a name="p4753161132815"></a>SPEAKER</p>
</td> </td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p3728920162713"><a name="p3728920162713"></a><a name="p3728920162713"></a>1</p> <td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p3728920162713"><a name="p3728920162713"></a><a name="p3728920162713"></a>2</p>
</td> </td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p17728112062715"><a name="p17728112062715"></a><a name="p17728112062715"></a>Speaker.</p> <td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p17728112062715"><a name="p17728112062715"></a><a name="p17728112062715"></a>Speaker.</p>
</td> </td>
</tr> </tr>
<tr id="row1758117472814"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p74802011112815"><a name="p74802011112815"></a><a name="p74802011112815"></a>WIRED_HEADSET</p> <tr id="row1758117472814"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p74802011112815"><a name="p74802011112815"></a><a name="p74802011112815"></a>WIRED_HEADSET</p>
</td> </td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p35820462819"><a name="p35820462819"></a><a name="p35820462819"></a>2</p> <td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p35820462819"><a name="p35820462819"></a><a name="p35820462819"></a>3</p>
</td> </td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p155821548285"><a name="p155821548285"></a><a name="p155821548285"></a>Wired headset.</p> <td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p155821548285"><a name="p155821548285"></a><a name="p155821548285"></a>Wired headset.</p>
</td> </td>
</tr> </tr>
<tr id="row1335108192818"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p107521514142811"><a name="p107521514142811"></a><a name="p107521514142811"></a>BLUETOOTH_SCO</p> <tr id="row1335108192818"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p107521514142811"><a name="p107521514142811"></a><a name="p107521514142811"></a>BLUETOOTH_SCO</p>
</td> </td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p18335108112819"><a name="p18335108112819"></a><a name="p18335108112819"></a>3</p> <td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p18335108112819"><a name="p18335108112819"></a><a name="p18335108112819"></a>7</p>
</td> </td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p193351683289"><a name="p193351683289"></a><a name="p193351683289"></a>Bluetooth device using the synchronous connection oriented (SCO) link.</p> <td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p193351683289"><a name="p193351683289"></a><a name="p193351683289"></a>Bluetooth device using the synchronous connection oriented (SCO) link.</p>
</td> </td>
</tr> </tr>
<tr id="row1649111617286"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p10784017102818"><a name="p10784017102818"></a><a name="p10784017102818"></a>BLUETOOTH_A2DP</p> <tr id="row1649111617286"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p10784017102818"><a name="p10784017102818"></a><a name="p10784017102818"></a>BLUETOOTH_A2DP</p>
</td> </td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p849110610286"><a name="p849110610286"></a><a name="p849110610286"></a>4</p> <td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p849110610286"><a name="p849110610286"></a><a name="p849110610286"></a>8</p>
</td> </td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p549117620284"><a name="p549117620284"></a><a name="p549117620284"></a>Bluetooth device using the advanced audio distribution profile (A2DP).</p> <td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p549117620284"><a name="p549117620284"></a><a name="p549117620284"></a>Bluetooth device using the advanced audio distribution profile (A2DP).</p>
</td> </td>
</tr> </tr>
<tr id="row81701220112812"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p168642028152812"><a name="p168642028152812"></a><a name="p168642028152812"></a>MIC</p> <tr id="row81701220112812"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p168642028152812"><a name="p168642028152812"></a><a name="p168642028152812"></a>MIC</p>
</td> </td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p517062012812"><a name="p517062012812"></a><a name="p517062012812"></a>5</p> <td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p517062012812"><a name="p517062012812"></a><a name="p517062012812"></a>15</p>
</td> </td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p5170520112813"><a name="p5170520112813"></a><a name="p5170520112813"></a>Microphone.</p> <td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p5170520112813"><a name="p5170520112813"></a><a name="p5170520112813"></a>Microphone.</p>
</td> </td>
...@@ -302,19 +325,24 @@ Enumerates the audio sample formats. ...@@ -302,19 +325,24 @@ Enumerates the audio sample formats.
| Name | Default Value | Description | | Name | Default Value | Description |
| :------------ | :------------ | :------------------------------------ | | :------------ | :------------ | :------------------------------------ |
| INVALID_WIDTH | -1 | Invalid format. | | INVALID_WIDTH | -1 | Invalid format. |
| SAMPLE_U8 | 1 | Unsigned 8 bit integer. | | SAMPLE_U8 | 0 | Unsigned 8 bit integer. |
| SAMPLE_S16LE | 0 | Signed 16 bit integer, little endian. | | SAMPLE_S16LE | 1 | Signed 16 bit integer, little endian. |
| SAMPLE_S24LE | 1 | Signed 24 bit integer, little endian. | | SAMPLE_S24LE | 2 | Signed 24 bit integer, little endian. |
| SAMPLE_S32LE | 2 | Signed 32 bit integer, little endian. | | SAMPLE_S32LE | 3 | Signed 32 bit integer, little endian. |
## AudioChannel<sup>8+</sup><a name="audiochannel"></a> ## AudioChannel<sup>8+</sup><a name="audiochannel"></a>
Enumerates the audio channels. Enumerates the audio channels.
| Name | Default Value | Description | | Name | Default Value | Description |
| :----- | :------------ | :--------------- | | :----- | :------------ | :--------------- |
| MONO | 1 | Channel count 1. | | CHANNEL_1 | 0x1 << 0 | Channel count 1. |
| STEREO | 2 | Channel count 2. | | 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. |
## AudioSamplingRate<sup>8+</sup><a name="audiosamplingrate"></a> ## AudioSamplingRate<sup>8+</sup><a name="audiosamplingrate"></a>
...@@ -338,10 +366,10 @@ Enumerates the audio sampling rates. ...@@ -338,10 +366,10 @@ Enumerates the audio sampling rates.
## AudioEncodingType<sup>8+</sup><a name="audioencodingtype"></a> ## AudioEncodingType<sup>8+</sup><a name="audioencodingtype"></a>
Enumerates the audio encoding types. Enumerates the audio encoding types.
| Name | Default Value | Description | | Name | Default Value | Description |
| :--------------- | :------------ | :---------- | | :-------------------- | :------------ | :---------------- |
| ENCODING_PCM | 0 | PCM. | | ENCODING_TYPE_INVALID | -1 | Invalid. |
| ENCODING_INVALID | 1 | Invalid. | | ENCODING_TYPE_RAW | 0 | PCM encoding. |
## ContentType<sup>8+</sup><a name="contentype"></a> ## ContentType<sup>8+</sup><a name="contentype"></a>
...@@ -431,23 +459,17 @@ Enumerates the ringtone types. ...@@ -431,23 +459,17 @@ Enumerates the ringtone types.
| RINGTONE_TYPE_DEFAULT | 0 | Default type. | | RINGTONE_TYPE_DEFAULT | 0 | Default type. |
| RINGTONE_TYPE_MULTISIM | 1 | Multi-SIM type. | | RINGTONE_TYPE_MULTISIM | 1 | Multi-SIM type. |
## AudioStreamInfo<sup>8+</sup><a name="audiorstreaminfo"></a>
## AudioParameters<sup>8+</sup><a name="audioparameters"></a> Describes audio stream information.
Describes audio parameters of playback files.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| :----------- | :---------------- | :-------- | :-------------------------------------------- | | :------------ | :-------------------- | :-------- | :-------------------- |
| format | AudioSampleFormat | Yes | Sample format of the audio file to be played. | | samplingRate | AudioSamplingRate | Yes | Sampling rate. |
| channels | AudioChannel | Yes | Channel count of the audio file to be played. | | channels | AudioChannel | Yes | Audio channels. |
| samplingRate | AudioSamplingRate | Yes | Sample rate of the audio file to be played. | | sampleFormat | AudioSampleFormat | Yes | Audio sample format. |
| encoding | AudioEncodingType | Yes | Encoding type of the audio file to be played. | | encodingType | AudioEncodingType | Yes | Audio encoding type. |
| contentType | ContentType | Yes | Content type. |
| usage | StreamUsage | Yes | Stream usage. |
| deviceRole | DeviceRole | Yes | Device role. |
| deviceType | DeviceType | Yes | Device type. |
## AudioRendererInfo<sup>8+</sup><a name="audiorendererinfo"></a> ## AudioRendererInfo<sup>8+</sup><a name="audiorendererinfo"></a>
Describes audio renderer information. Describes audio renderer information.
...@@ -2461,20 +2483,18 @@ Defines the current render state. ...@@ -2461,20 +2483,18 @@ Defines the current render state.
var state = audioRenderer.state; var state = audioRenderer.state;
``` ```
## audioRenderer.getRendererInfo
## audioRenderer.setParams getRendererInfo(callback: AsyncCallback<AudioRendererInfo\>): void<sup>8+</sup><a name="getrendererinfo-asynccallback"></a>
setParams(params: AudioParameters, callback: AsyncCallback<void\>): void<sup>8+</sup><a name="setparams-asynccallback"></a>
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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| :------- | :------------------- | :-------- | :-------------------------------------- | | :------- | :--------------------------------- | :-------- | :------------------------------------------------ |
| params | AudioParameters | Yes | Audio parameters of the file to be set. | | callback | AsyncCallback<AudioRendererInfo\> | Yes | Callback used to return the renderer information. |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. | | | | | |
| | | | |
**Return value** **Return value**
...@@ -2483,67 +2503,53 @@ None ...@@ -2483,67 +2503,53 @@ None
**Example** **Example**
``` ```
var audioParams = { audioRenderer.getRendererInfo((err, rendererInfo)=>{
format: audio.AudioSampleFormat.SAMPLE_S16LE, console.log('Renderer GetRendererInfo:');
channels: audio.AudioChannel.STEREO, console.log('Renderer content:' + rendererInfo.content);
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000, console.log('Renderer usage:' + rendererInfo.usage);
encoding: audio.AudioEncodingType.ENCODING_PCM, console.log('Renderer flags:' + rendererInfo.rendererFlags);
};
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.setParams ## audioRenderer.getRendererInfo
setParams(params: AudioParameters): Promise<void\><sup>8+</sup><a name="setparams-promise"></a> getParams(): Promise<AudioRendererInfo\><sup>8+</sup><a name="getrendererinfo-promise"></a>
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** **Parameters**
| Name | Type | Mandatory | Description | None
| :----- | :-------------- | :-------- | :-------------------------------------- |
| params | AudioParameters | Yes | Audio parameters of the file to be set. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| :------------- | :--------------------------------- | | :---------------------------- | :----------------------------------------------- |
| Promise<void\> | Promise used to return the result. | | Promise<AudioRendererInfo\> | Promise used to return the renderer information. |
**Example** **Example**
``` ```
var audioParams = { let rendererInfo = await audioRenderer.getRendererInfo();
format: audio.AudioSampleFormat.SAMPLE_S16LE, console.log('Renderer GetRendererInfo:');
channels: audio.AudioChannel.STEREO, console.log('Renderer content:' + rendererInfo.content);
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000, console.log('Renderer usage:' + rendererInfo.usage);
encoding: audio.AudioEncodingType.ENCODING_PCM, console.log('Renderer flags:' + rendererInfo.rendererFlags);
};
await audioRenderer.setParams(audioParams);
``` ```
## audioRenderer.getStreamInfo
## audioRenderer.getParams getStreamInfo(callback: AsyncCallback<AudioStreamInfo\>): void<sup>8+</sup><a name="getstreaminfo-asynccallback"></a>
getParams(callback: AsyncCallback<AudioParameters\>): void<sup>8+</sup><a name="getparams-asynccallback"></a>
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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| :------- | :------------------------------ | :-------- | :-------------------------------------------- | | :------- | :--------------------------------- | :-------- | :---------------------------------------------- |
| callback | AsyncCallback<AudioParameters\> | Yes | Callback used to return the audio parameters. | | callback | AsyncCallback<AudioStreamInfo\> | Yes | Callback used to return the stream information. |
| | | | | | | | | |
**Return value** **Return value**
...@@ -2552,21 +2558,20 @@ None ...@@ -2552,21 +2558,20 @@ None
**Example** **Example**
``` ```
audioRenderer.getParams((err, audioParams)=>{ audioRenderer.getStreamInfo((err, streamInfo)=>{
console.log('Renderer GetParams:'); console.log('Renderer GetStreamInfo:');
console.log('Renderer format:' + audioParams.format); console.log('Renderer sampling rate:' + streamInfo.samplingRate);
console.log('Renderer samplingRate:' + audioParams.samplingRate); console.log('Renderer channel:' + streamInfo.AudioChannel);
console.log('Renderer channels:' + audioParams.channels); console.log('Renderer format:' + streamInfo.AudioSampleFormat);
console.log('Renderer encoding:' + audioParams.encoding); console.log('Renderer encoding type:' + streamInfo.AudioEncodingType);
}) })
``` ```
## audioRenderer.getStreamInfo
## audioRenderer.getParams getStreamInfo(): Promise<AudioStreamInfo\><sup>8+</sup><a name="getstreaminfo-promise"></a>
getParams(): Promise<AudioParameters\><sup>8+</sup><a name="getparams-promise"></a> Gets the renderer stream information. This method uses a promise to return the result.
Gets audio parameters of the renderer. This method uses a promise to return the result.
**Parameters** **Parameters**
...@@ -2574,34 +2579,33 @@ None ...@@ -2574,34 +2579,33 @@ None
**Return value** **Return value**
| Type | Description | | Type | Description |
| :------------------------ | :------------------------------------------- | | :---------------------------- | :----------------------------------------------- |
| Promise<AudioParameters\> | Promise used to return the audio parameters. | | Promise<AudioStreamInfo\> | Promise used to return the stream information. |
**Example** **Example**
``` ```
let audioParams = await audioRenderer.getParams(); let streamInfo = await audioRenderer.getStreamInfo();
console.log('Renderer GetParams:'); console.log('Renderer GetStreamInfo:');
console.log('Renderer format:' + audioParams.format); console.log('Renderer sampling rate:' + streamInfo.samplingRate);
console.log('Renderer samplingRate:' + audioParams.samplingRate); console.log('Renderer channel:' + streamInfo.AudioChannel);
console.log('Renderer channels:' + audioParams.channels); console.log('Renderer format:' + streamInfo.AudioSampleFormat);
console.log('Renderer encoding:' + audioParams.encoding); console.log('Renderer encoding type:' + streamInfo.AudioEncodingType);
``` ```
## audioRenderer.start ## audioRenderer.start
start(callback: AsyncCallback<boolean\>): void<sup>8+</sup><a name="start-asynccallback"></a> start(callback: AsyncCallback<void\>): void<sup>8+</sup><a name="start-asynccallback"></a>
Starts the renderer. This method uses an asynchronous callback to return the result. Starts the renderer. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| :------- | :---------------------- | :-------- | :----------------------------------------------------------------------------- | | :------- | :---------------------- | :-------- | :-------------------------------------- |
| callback | AsyncCallback<boolean\> | Yes | Returns true if the renderer is started successfully; returns false otherwise. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
| | | | | | | | | |
**Return value** **Return value**
...@@ -2610,11 +2614,11 @@ None ...@@ -2610,11 +2614,11 @@ None
**Example** **Example**
``` ```
audioRenderer.start((err, started)=>{ audioRenderer.start((err)=>{
if (started) { if (err) {
console.log('Renderer started.'); console.error('Renderer start failed.');
} else { } else {
console.error('Renderer start rejected.'); console.info('Renderer start success.');
} }
}) })
``` ```
...@@ -2622,7 +2626,7 @@ audioRenderer.start((err, started)=>{ ...@@ -2622,7 +2626,7 @@ audioRenderer.start((err, started)=>{
## audioRenderer.start ## audioRenderer.start
start(): Promise<boolean\><a name="start-promise"><sup>8+</sup></a> start(): Promise<void\><a name="start-promise"><sup>8+</sup></a>
Starts the renderer. This method uses a promise to return the result. Starts the renderer. This method uses a promise to return the result.
...@@ -2632,34 +2636,29 @@ None ...@@ -2632,34 +2636,29 @@ None
**Return value** **Return value**
| Type | Description | | Type | Description |
| :---------------- | :----------------------------------------------------------------------------- | | :------------- | :--------------------------------- |
| Promise<boolean\> | Returns true if the renderer is started successfully; returns false otherwise. | | Promise<void\> | Promise used to return the result. |
**Example** **Example**
``` ```
var started = await audioRenderer.start(); await audioRenderer.start();
if (started) {
console.log('Renderer started');
} else {
console.error('Renderer start rejected');
}
``` ```
## audioRenderer.pause ## audioRenderer.pause
pause(callback: AsyncCallback<boolean\>): void<sup>8+</sup><a name="pause-asynccallback"></a> pause(callback: AsyncCallback<void\>): void<sup>8+</sup><a name="pause-asynccallback"></a>
Pauses rendering. This method uses an asynchronous callback to return the result. Pauses rendering. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| :------- | :---------------------- | :-------- | :---------------------------------------------------------------------------- | | :------- | :---------------------- | :-------- | :------------------------------------ |
| callback | AsyncCallback<boolean\> | Yes | Returns true if the renderer is paused successfully; returns false otherwise. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
| | | | | | | | | |
**Return value** **Return value**
...@@ -2668,11 +2667,11 @@ None ...@@ -2668,11 +2667,11 @@ None
**Example** **Example**
``` ```
audioRenderer.pause((err, paused)=>{ audioRenderer.pause((err)=>{
if (paused) { if (err) {
console.log('Renderer paused.'); console.error('Renderer pause failed');
} else { } else {
console.error('Renderer pause failed'); console.log('Renderer paused.');
} }
}) })
``` ```
...@@ -2681,7 +2680,7 @@ audioRenderer.pause((err, paused)=>{ ...@@ -2681,7 +2680,7 @@ audioRenderer.pause((err, paused)=>{
## audioRenderer.pause ## audioRenderer.pause
pause(): Promise<boolean\><sup>8+</sup><a name="pause-promise"></a> pause(): Promise<void\><sup>8+</sup><a name="pause-promise"></a>
Pauses rendering. This method uses a promise to return the result. Pauses rendering. This method uses a promise to return the result.
...@@ -2691,35 +2690,30 @@ None ...@@ -2691,35 +2690,30 @@ None
**Return value** **Return value**
| Type | Description | | Type | Description |
| :---------------- | :---------------------------------------------------------------------------- | | :------------- | :--------------------------------- |
| Promise<boolean\> | Returns true if the renderer is paused successfully; returns false otherwise. | | Promise<void\> | Promise used to return the result. |
**Example** **Example**
``` ```
var paused = await audioRenderer.pause(); await audioRenderer.pause();
if (paused) {
console.log('Renderer paused');
} else {
console.error('Renderer pause failed');
}
``` ```
## audioRenderer.drain ## audioRenderer.drain
drain(callback: AsyncCallback<boolean\>): void<sup>8+</sup><a name="drain-asynccallback"></a> drain(callback: AsyncCallback<void\>): void<sup>8+</sup><a name="drain-asynccallback"></a>
Drains the playback buffer. This method uses an asynchronous callback to return the result. Drains the playback buffer. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| :------- | :---------------------- | :-------- | :--------------------------------------------------------------------------- | | :------- | :---------------------- | :-------- | :---------------------------------------|
| callback | AsyncCallback<boolean\> | Yes | Returns true if the buffer is drained successfully; returns false otherwise. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
| | | | | | | | | |
**Return value** **Return value**
...@@ -2728,11 +2722,11 @@ None ...@@ -2728,11 +2722,11 @@ None
**Example** **Example**
``` ```
audioRenderer.drain((err, drained)=>{ audioRenderer.drain((err)=>{
if (drained) { if (err) {
console.log('Renderer drained.'); console.error('Renderer drain failed');
} else { } else {
console.error('Renderer drain failed'); console.log('Renderer drained.');
} }
}) })
``` ```
...@@ -2740,7 +2734,7 @@ audioRenderer.drain((err, drained)=>{ ...@@ -2740,7 +2734,7 @@ audioRenderer.drain((err, drained)=>{
## audioRenderer.drain ## audioRenderer.drain
drain(): Promise<boolean\><sup>8+</sup><a name="drain-promise"></a> drain(): Promise<void\><sup>8+</sup><a name="drain-promise"></a>
Drains the playback buffer. This method uses a promise to return the result. Drains the playback buffer. This method uses a promise to return the result.
...@@ -2750,34 +2744,29 @@ None ...@@ -2750,34 +2744,29 @@ None
**Return value** **Return value**
| Type | Description | | Type | Description |
| :---------------- | :--------------------------------------------------------------------------- | | :------------- | :--------------------------------- |
| Promise<boolean\> | Returns true if the buffer is drained successfully; returns false otherwise. | | Promise<void\> | Promise used to return the result. |
**Example** **Example**
``` ```
var drained = await audioRenderer.drain(); await audioRenderer.drain();
if (drained) {
console.log('Renderer drained');
} else {
console.error('Renderer drain failed');
}
``` ```
## audioRenderer.stop ## audioRenderer.stop
stop(callback: AsyncCallback<boolean\>): void<sup>8+</sup><a name="stop-asynccallback"></a> stop(callback: AsyncCallback<void\>): void<sup>8+</sup><a name="stop-asynccallback"></a>
Stops rendering. This method uses an asynchronous callback to return the result. Stops rendering. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| :------- | :---------------------- | :-------- | :------------------------------------------------------------------------------ | | :------- | :---------------------- | :-------- | :------------------------------------- |
| callback | AsyncCallback<boolean\> | Yes | Returns true if the rendering is stopped successfully; returns false otherwise. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
| | | | | | | | | |
**Return value** **Return value**
...@@ -2786,11 +2775,11 @@ None ...@@ -2786,11 +2775,11 @@ None
**Example** **Example**
``` ```
audioRenderer.stop((err, stopped)=>{ audioRenderer.stop((err)=>{
if (stopped) { if (err) {
console.log('Renderer stopped.'); console.error('Renderer stop failed');
} else { } else {
console.error('Renderer stop failed'); console.log('Renderer stopped.');
} }
}) })
``` ```
...@@ -2798,7 +2787,7 @@ audioRenderer.stop((err, stopped)=>{ ...@@ -2798,7 +2787,7 @@ audioRenderer.stop((err, stopped)=>{
## audioRenderer.stop ## audioRenderer.stop
stop(): Promise<boolean\><sup>8+</sup><a name="stop-promise"></a> stop(): Promise<void\><sup>8+</sup><a name="stop-promise"></a>
Stops rendering. This method uses a promise to return the result. Stops rendering. This method uses a promise to return the result.
...@@ -2808,34 +2797,29 @@ None ...@@ -2808,34 +2797,29 @@ None
**Return value** **Return value**
| Type | Description | | Type | Description |
| :---------------- | :------------------------------------------------------------------------------ | | :------------- | :--------------------------------- |
| Promise<boolean\> | Returns true if the rendering is stopped successfully; returns false otherwise. | | Promise<void\> | Promise used to return the result. |
**Example** **Example**
``` ```
var stopped = await audioRenderer.stop(); await audioRenderer.stop();
if (stopped) {
console.log('Renderer stopped');
} else {
console.error('Renderer stop failed');
}
``` ```
## audioRenderer.release ## audioRenderer.release
release(callback: AsyncCallback<boolean\>): void<sup>8+</sup><a name="release-asynccallback"></a> release(callback: AsyncCallback<void\>): void<sup>8+</sup><a name="release-asynccallback"></a>
Releases the renderer. This method uses an asynchronous callback to return the result. Releases the renderer. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| :------- | :---------------------- | :-------- | :------------------------------------------------------------------------------ | | :------- | :---------------------- | :-------- | :------------------------------------- |
| callback | AsyncCallback<boolean\> | Yes | Returns true if the renderer is released successfully; returns false otherwise. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
| | | | | | | | | |
**Return value** **Return value**
...@@ -2844,11 +2828,11 @@ None ...@@ -2844,11 +2828,11 @@ None
**Example** **Example**
``` ```
audioRenderer.release((err, released)=>{ audioRenderer.release((err)=>{
if (released) { if (err) {
console.log('Renderer released.'); console.error('Renderer release failed');
} else { } else {
console.error('Renderer release failed'); console.log('Renderer released.');
} }
}) })
``` ```
...@@ -2857,7 +2841,7 @@ audioRenderer.release((err, released)=>{ ...@@ -2857,7 +2841,7 @@ audioRenderer.release((err, released)=>{
## audioRenderer.release ## audioRenderer.release
release(): Promise<boolean\><sup>8+</sup><a name="release-promise"></a> release(): Promise<void\><sup>8+</sup><a name="release-promise"></a>
Releases the renderer. This method uses a promise to return the result. Releases the renderer. This method uses a promise to return the result.
...@@ -2867,19 +2851,14 @@ None ...@@ -2867,19 +2851,14 @@ None
**Return value** **Return value**
| Type | Description | | Type | Description |
| :---------------- | :------------------------------------------------------------------------------ | | :------------- | :--------------------------------- |
| Promise<boolean\> | Returns true if the renderer is released successfully; returns false otherwise. | | Promise<void\> | Promise used to return the result. |
**Example** **Example**
``` ```
var released = await audioRenderer.release(); await audioRenderer.release();
if (released) {
console.log('Renderer released');
} else {
console.error('Renderer release failed');
}
``` ```
......
...@@ -11,7 +11,7 @@ ...@@ -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. 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<a name="fig17640124912440"></a> **Figure 1** Unified service mode<a name="fig17640124912440"></a>
![](figures/unified-service-mode-8.png "unified-service-mode-8") ![](figures/unified-service-mode.png "unified-service-mode-8")
## How to Develop<a name="section1085786591114257"></a> ## How to Develop<a name="section1085786591114257"></a>
......
...@@ -11,7 +11,7 @@ ...@@ -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. 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<a name="fig983655084219"></a> **Figure 1** Independent service mode<a name="fig983655084219"></a>
![](figures/independent-service-mode-10.png "independent-service-mode-10") ![](figures/independent-service-mode.png "independent-service-mode-10")
## How to Develop<a name="section967396342164144"></a> ## How to Develop<a name="section967396342164144"></a>
......
...@@ -11,7 +11,7 @@ ...@@ -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. 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<a name="fig6742142611299"></a> **Figure 1** Independent service mode<a name="fig6742142611299"></a>
![](figures/independent-service-mode-11.png "independent-service-mode-11") ![](figures/independent-service-mode.png "independent-service-mode-11")
## How to Develop<a name="section1784450860142407"></a> ## How to Develop<a name="section1784450860142407"></a>
......
...@@ -11,7 +11,7 @@ ...@@ -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. 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<a name="fig124181331222"></a> **Figure 1** Independent service mode<a name="fig124181331222"></a>
![](figures/independent-service-mode-12.png "independent-service-mode-12") ![](figures/independent-service-mode.png "independent-service-mode-12")
## How to Develop<a name="section581179475150053"></a> ## How to Develop<a name="section581179475150053"></a>
......
...@@ -11,7 +11,7 @@ ...@@ -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. 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<a name="fig1474518243468"></a> **Figure 1** Independent service mode<a name="fig1474518243468"></a>
![](figures/independent-service-mode-14.png "independent-service-mode-14") ![](figures/independent-service-mode.png "independent-service-mode-14")
## How to Develop<a name="section944397404154520"></a> ## How to Develop<a name="section944397404154520"></a>
......
...@@ -11,7 +11,7 @@ ...@@ -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. 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<a name="fig61584136211"></a> **Figure 1** Independent service mode<a name="fig61584136211"></a>
![](figures/independent-service-mode-15.png "independent-service-mode-15") ![](figures/independent-service-mode.png "independent-service-mode-15")
## How to Develop<a name="section477974542160117"></a> ## How to Develop<a name="section477974542160117"></a>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
- [Mini- and Small-System Devices](device-lite.md) - [Mini- and Small-System Devices](device-lite.md)
- [WLAN-connected Products](device-wlan.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) - [Third-Party SDK Integration](device-wlan-sdk.md)
- [Cameras Without a Screen](device-iotcamera.md) - [Cameras Without a Screen](device-iotcamera.md)
- [Camera Control](device-iotcamera-control.md) - [Camera Control](device-iotcamera-control.md)
......
# LED Peripheral Control<a name="EN-US_TOPIC_0000001157319393"></a> # LED Peripheral Control<a name="EN-US_TOPIC_0000001157319393"></a>
- **[LED Peripheral Control](device-wlan-led-outcontrol.md)** - **[LED Peripheral Control](device-wlan-led-control.md)**
...@@ -488,7 +488,7 @@ HDF_DEVICE_ROOT := $(HDF_DIR_PREFIX)/../device ...@@ -488,7 +488,7 @@ HDF_DEVICE_ROOT := $(HDF_DIR_PREFIX)/../device
obj-$(CONFIG_DRIVERS_WLAN_XXX) += $(HDF_DEVICE_ROOT)/MySoCVendor/peripheral/build/standard/ 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<a name="section11253153018415"></a> ### 4. Samples<a name="section11253153018415"></a>
......
# 配置OpenHarmony应用签名信息 # 配置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)。配置应用签名信息的流程如下图所示。 使用真机设备运行和调试OpenHarmony应用前,需要对应用进行签名才能正常运行。该指导用于OpenHarmony应用的签名配置。除此章节以外,DevEco Studio的其余操作指导无差别,具体请访问[HUAWEI DevEco Studio使用指南](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/tools_overview-0000001053582387)。配置应用签名信息的流程如下图所示。
......
# 配置OpenHarmony SDK # 配置OpenHarmony SDK
- [前提条件](#前提条件)
- [配置SDK信息](#配置SDK信息)
- [参考信息](#参考信息)
- [配置DevEco Studio代理](#配置DevEco-Studio代理)
- [配置NPM代理](#配置NPM代理)
- [设置Gradle代理](#设置Gradle代理)
在设置OpenHarmony应用开发环境时,需要开发者在DevEco Studio中配置对应的SDK信息。 在设置OpenHarmony应用开发环境时,需要开发者在DevEco Studio中配置对应的SDK信息。
......
# 概述 # 概述
- [总体说明](#总体说明)
- [使用约束](#使用约束)
- [DevEco Studio演进路标](#DevEco-Studio演进路标)
## 总体说明 ## 总体说明
......
# 版本变更说明 # 版本变更说明
- [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) ## V3.0 Beta2(2021-12-31)
......
...@@ -549,7 +549,7 @@ getRingerMode(): Promise&lt;AudioRingMode&gt; ...@@ -549,7 +549,7 @@ getRingerMode(): Promise&lt;AudioRingMode&gt;
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;[AudioRingMode](#audioringmode7-)&gt; | Promise回调返回系统的铃声模式。 | | Promise&lt;[AudioRingMode](#audioringmode)&gt; | Promise回调返回系统的铃声模式。 |
**示例:** **示例:**
...@@ -771,7 +771,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=> ...@@ -771,7 +771,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=>
isDeviceActive(deviceType: DeviceType, callback: AsyncCallback&lt;boolean&gt;): void isDeviceActive(deviceType: DeviceType, callback: AsyncCallback&lt;boolean&gt;): void
获取指定设备激活状态,使用callback方式返回异步结果。 获取指定设备激活状态,使用callback方式返回异步结果。
**参数:** **参数:**
...@@ -797,7 +797,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => { ...@@ -797,7 +797,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => {
isDeviceActive(deviceType: DeviceType): Promise&lt;boolean&gt; isDeviceActive(deviceType: DeviceType): Promise&lt;boolean&gt;
获取指定设备激活状态,使用promise方式返回异步结果。 获取指定设备激活状态,使用promise方式返回异步结果。
**参数:** **参数:**
......
...@@ -31,7 +31,7 @@ import faultLogger from '@ohos.faultLogger' ...@@ -31,7 +31,7 @@ import faultLogger from '@ohos.faultLogger'
| -------- | -------- | -------- | | -------- | -------- | -------- |
| pid | number | 故障进程的进程id | | pid | number | 故障进程的进程id |
| uid | number | 故障进程的用户id | | uid | number | 故障进程的用户id |
| type | [FaultType](#faultloggerfaulttype) | 故障类型 | | type | [FaultType](#faulttype) | 故障类型 |
| timestamp | number | 日志生成时的秒级时间戳 | | timestamp | number | 日志生成时的秒级时间戳 |
| reason | string | 发生故障的原因 | | reason | string | 发生故障的原因 |
| module | string | 发生故障的模块 | | module | string | 发生故障的模块 |
...@@ -47,8 +47,8 @@ querySelfFaultLog(faultType: FaultType, callback: AsyncCallback&lt;Array&lt;Faul ...@@ -47,8 +47,8 @@ querySelfFaultLog(faultType: FaultType, callback: AsyncCallback&lt;Array&lt;Faul
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| faultType | [FaultType](#faultloggerfaulttype) | 是 | 输入要查询的故障类型。 | | faultType | [FaultType](#faulttype) | 是 | 输入要查询的故障类型。 |
| callback | AsyncCallbackArray&lt;Array&lt;[FaultLogInfo](#faultloggerfaultloginfo)&gt;&gt; | 是 | 回调函数,在回调函数中获取故障信息数组。<br/>-&nbsp;value拿到故障信息数组;value为undefined表示获取过程中出现异常,error返回错误提示字符串 | callback | AsyncCallbackArray&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | 是 | 回调函数,在回调函数中获取故障信息数组。<br/>-&nbsp;value拿到故障信息数组;value为undefined表示获取过程中出现异常,error返回错误提示字符串
- 示例: - 示例:
``` ```
...@@ -83,12 +83,12 @@ querySelfFaultLog(faultType: FaultType) : Promise&lt;Array&lt;FaultLogInfo&gt;&g ...@@ -83,12 +83,12 @@ querySelfFaultLog(faultType: FaultType) : Promise&lt;Array&lt;FaultLogInfo&gt;&g
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| faultType | [FaultType](#faultloggerfaulttype) | 是 | 输入要查询的故障类型。 | | faultType | [FaultType](#faulttype) | 是 | 输入要查询的故障类型。 |
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;Array&lt;[FaultLogInfo](#faultloggerfaultloginfo)&gt;&gt; | Promise实例,可以在其then()方法中获取故障信息实例,也可以使用await。 <br/>-&nbsp;value拿到故障信息数组;value为undefined表示获取过程中出现异常 | | Promise&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Promise实例,可以在其then()方法中获取故障信息实例,也可以使用await。 <br/>-&nbsp;value拿到故障信息数组;value为undefined表示获取过程中出现异常 |
- 示例: - 示例:
``` ```
......
...@@ -449,7 +449,7 @@ connectAbility(request: Want, options:ConnectOptions): number ...@@ -449,7 +449,7 @@ connectAbility(request: Want, options:ConnectOptions): number
| 名称 | 类型 | 必填 | 描述 | | 名称 | 类型 | 必填 | 描述 |
| ------- | -------------- | ---- | ---------------------------- | | ------- | -------------- | ---- | ---------------------------- |
| request | Want | 是 | 表示被连接的ServiceAbility。 | | request | [Want](#want) | 是 | 表示被连接的ServiceAbility。 |
| options | ConnectOptions | 是 | 被指定的回调方法。 | | options | ConnectOptions | 是 | 被指定的回调方法。 |
**Want类型说明:** **Want类型说明:**
...@@ -633,7 +633,7 @@ this.StartContinueAbility(remoteDeviceId); //remoteDeviceId is acquired from Dev ...@@ -633,7 +633,7 @@ this.StartContinueAbility(remoteDeviceId); //remoteDeviceId is acquired from Dev
| 名称 | 读写属性 | 类型 | 必填 | 描述 | | 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ---------- | -------- | --------------------- | ---- | ------------------------------------------------------------ | | ---------- | -------- | --------------------- | ---- | ------------------------------------------------------------ |
| resultCode | 只读 | number | 是 | 指示销毁该能力后返回的结果代码。您可以定义结果代码来识别错误(暂不支持) | | resultCode | 只读 | number | 是 | 指示销毁该能力后返回的结果代码。您可以定义结果代码来识别错误(暂不支持) |
| want | 只读 | [Want](#Want类型说明) | 否 | 指示销毁该能力后返回的数据。您可以定义返回的数据。此参数可以为null。 | | want | 只读 | [Want](#want) | 否 | 指示销毁该能力后返回的数据。您可以定义返回的数据。此参数可以为null。 |
## StartAbilityParameter ## StartAbilityParameter
......
# 卡片数据绑定类
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从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
# FormExtension
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从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
# FormExtensionContext
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
FormExtension的上下文环境,提供FormExtension具有的能力和接口,继承自ExtensionContext。
## updateForm
updateForm(formId: string, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback\<void>): void
主动更新卡片。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
| formId | string | 是 | 请求更新的卡片ID。 |
| formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | 是 | 卡片新的数据。 |
| callback | AsyncCallback\<void> | 是 | 回调函数,返回接口调用是否成功的结果。 |
- 示例:
```
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\<void>
更新卡片。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | ------------------------------------------------------------ | ---- | ------------------ |
| formId | string | 是 | 请求更新的卡片ID。 |
| formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | 是 | 卡片新的数据。 |
- 返回值:
| 类型 | 说明 |
| -------------- | --------------------------------- |
| Promise\<void> | 返回一个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
...@@ -537,7 +537,7 @@ on(type: 'play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeCh ...@@ -537,7 +537,7 @@ on(type: 'play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeCh
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------- | ---- | ------------------------------------------------------------ | | -------- | ---------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 播放事件回调类型,支持的事件包括:'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange'。<br>- 'play':完成[play()](#audioplayer_play)调用,音频开始播放,触发该事件。<br>- 'pause':完成[pause()](#audioplayer_pause)调用,音频暂停播放,触发该事件。<br>- 'stop':完成[stop()](#audioplayer_stop)调用,音频停止播放,触发该事件。<br>- 'reset':完成[reset()](#audioplayer_reset)调用,播放器重置,触发该事件。<br>- 'dataLoad':完成音频数据加载后触发该事件,即src属性设置完成后触发该事件。<br>- 'finish':完成音频播放后触发该事件。<br>- 'volumeChange':完成[setVolume()](#audioplayer_setvolume)调用,播放音量改变后触发该事件。 | | type | string | 是 | 播放事件回调类型,支持的事件包括:'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange'。<br>- 'play':完成[play()](#play)调用,音频开始播放,触发该事件。<br>- 'pause':完成[pause()](#pause)调用,音频暂停播放,触发该事件。<br>- 'stop':完成[stop()](#stop)调用,音频停止播放,触发该事件。<br>- 'reset':完成[reset()](#reset7)调用,播放器重置,触发该事件。<br>- 'dataLoad':完成音频数据加载后触发该事件,即src属性设置完成后触发该事件。<br>- 'finish':完成音频播放后触发该事件。<br>- 'volumeChange':完成[setVolume()](#setvolume)调用,播放音量改变后触发该事件。 |
| callback | () => void | 是 | 播放事件回调方法。 | | callback | () => void | 是 | 播放事件回调方法。 |
**示例:** **示例:**
...@@ -589,13 +589,13 @@ audioPlayer.src = 'file:///data/data/ohos.xxx.xxx/files/test.mp4'; //设置src ...@@ -589,13 +589,13 @@ audioPlayer.src = 'file:///data/data/ohos.xxx.xxx/files/test.mp4'; //设置src
on(type: 'timeUpdate', callback: Callback\<number>): void on(type: 'timeUpdate', callback: Callback\<number>): void
开始订阅音频播放[seek()](#audioplayer_seek)时间更新事件。 开始订阅音频播放[seek()](#seek)时间更新事件。
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------- | ---- | ------------------------------------------------------------ | | -------- | ----------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 播放事件回调类型,支持的事件包括:'timeUpdate'。<br>- 'timeUpdate':[seek()](#audioplayer_seek)调用完成,触发该事件。 | | type | string | 是 | 播放事件回调类型,支持的事件包括:'timeUpdate'。<br>- 'timeUpdate':[seek()](#seek)调用完成,触发该事件。 |
| callback | Callback\<number> | 是 | 播放事件回调方法。回调方法入参为成功seek的时间。 | | callback | Callback\<number> | 是 | 播放事件回调方法。回调方法入参为成功seek的时间。 |
**示例:** **示例:**
......
...@@ -174,7 +174,7 @@ connectAbility(request: Want, options:ConnectOptions): number ...@@ -174,7 +174,7 @@ connectAbility(request: Want, options:ConnectOptions): number
| 名称 | 类型 | 必填 | 描述 | | 名称 | 类型 | 必填 | 描述 |
| ------- | -------------- | ---- | -------------------------- | | ------- | -------------- | ---- | -------------------------- |
| request | Want | 是 | 表示被连接的ServiceAbility | | request | [Want](#want) | 是 | 表示被连接的ServiceAbility |
| options | ConnectOptions | 是 | 被指定的回调方法 | | options | ConnectOptions | 是 | 被指定的回调方法 |
**ConnectOptions类型说明:** **ConnectOptions类型说明:**
...@@ -310,7 +310,7 @@ var result = particleAbility.disconnectAbility(connId).then((void) => { ...@@ -310,7 +310,7 @@ var result = particleAbility.disconnectAbility(connId).then((void) => {
| 名称 | 读写属性 | 类型 | 必填 | 描述 | | 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ------------------- | -------- | --------------------- | ---- | ------------------------------------------------------------ | | ------------------- | -------- | --------------------- | ---- | ------------------------------------------------------------ |
| want | 只读 | [Want](#Want类型说明) | 是 | 表示需要包含有关目标启动能力的信息。 | | want | 只读 | [Want](#want) | 是 | 表示需要包含有关目标启动能力的信息。 |
| abilityStartSetting | 只读 | {[key: string]: any} | 否 | 表示能力的特殊属性,当开发者启动能力时,该属性可以作为调用中的输入参数传递。 | | abilityStartSetting | 只读 | {[key: string]: any} | 否 | 表示能力的特殊属性,当开发者启动能力时,该属性可以作为调用中的输入参数传递。 |
## Want ## Want
......
...@@ -243,7 +243,7 @@ usb.setInterface(pipe: USBDevicePipe, iface: USBInterface): number ...@@ -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作为参数。
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
......
...@@ -451,7 +451,7 @@ setWindowType(type: WindowType, callback: AsyncCallback&lt;void&gt;): void ...@@ -451,7 +451,7 @@ setWindowType(type: WindowType, callback: AsyncCallback&lt;void&gt;): void
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | [WindowType](#windowType7) | 是 |窗口类型。 | | type | [WindowType](#windowtype7) | 是 |窗口类型。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
- 示例 - 示例
......
...@@ -582,7 +582,7 @@ getBoundingClientRect\(\): [ <Rect\>](#table1650917111414) ...@@ -582,7 +582,7 @@ getBoundingClientRect\(\): [ <Rect\>](#table1650917111414)
## createIntersectionObserver<a name="section7425195215615"></a> ## createIntersectionObserver<a name="section7425195215615"></a>
createIntersectionObserver\(param?:[ObserverParam](#table143341035121917)\):[Observer](#table4506633141711) createIntersectionObserver\(param?:ObserverParam\): Observer)
监听元素在当前页面的可见范围。 监听元素在当前页面的可见范围。
...@@ -600,7 +600,7 @@ createIntersectionObserver\(param?:[ObserverParam](#table143341035121917)\):[O ...@@ -600,7 +600,7 @@ createIntersectionObserver\(param?:[ObserverParam](#table143341035121917)\):[O
</thead> </thead>
<tbody><tr><td class="cellrowborder" valign="top" width="19.2%" headers="mcps1.1.5.1.1 "><p>param</p> <tbody><tr><td class="cellrowborder" valign="top" width="19.2%" headers="mcps1.1.5.1.1 "><p>param</p>
</td> </td>
<td class="cellrowborder" valign="top" width="17.1%" headers="mcps1.1.5.1.2 "><p><a href="#table1335524911817">ObserverParam</a></p> <td class="cellrowborder" valign="top" width="17.1%" headers="mcps1.1.5.1.2 "><p>ObserverParam</p>
</td> </td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p>-</p> <td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p>-</p>
</td> </td>
......
...@@ -155,7 +155,7 @@ Sensor驱动模型对驱动开发者开放的功能接口,驱动开发者无 ...@@ -155,7 +155,7 @@ Sensor驱动模型对驱动开发者开放的功能接口,驱动开发者无
</tr> </tr>
<tr id="row28712021112011"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p38722218200"><a name="p38722218200"></a><a name="p38722218200"></a>int32_t <strong id="b573774595514"><a name="b573774595514"></a><a name="b573774595514"></a>WriteSensor</strong>(struct SensorBusCfg *busCfg, uint8_t *writeData, uint16_t len)</p> <tr id="row28712021112011"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p38722218200"><a name="p38722218200"></a><a name="p38722218200"></a>int32_t <strong id="b573774595514"><a name="b573774595514"></a><a name="b573774595514"></a>WriteSensor</strong>(struct SensorBusCfg *busCfg, uint8_t *writeData, uint16_t len)</p>
</td> </td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p6872112112201"><a name="p6872112112201"></a><a name="p6872112112201"></a>按照配置的总线方式,传感器配置数据写入寄存器。</p> <td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p6872112112201"><a name="p6872112112201"></a><a name="p6872112112201"></a>按照配置的总线方式,传感器配置数据写入寄存器。</p>
</td> </td>
</tr> </tr>
<tr id="row19401042245"><td class="cellrowborder" valign="top" width="8.550855085508552%" headers="mcps1.2.4.1.1 "><p id="p694020492417"><a name="p694020492417"></a><a name="p694020492417"></a>通用配置操作接口</p> <tr id="row19401042245"><td class="cellrowborder" valign="top" width="8.550855085508552%" headers="mcps1.2.4.1.1 "><p id="p694020492417"><a name="p694020492417"></a><a name="p694020492417"></a>通用配置操作接口</p>
...@@ -214,17 +214,17 @@ Sensor驱动模型要求驱动开发者实现的接口功能,参考[表3](#tab ...@@ -214,17 +214,17 @@ Sensor驱动模型要求驱动开发者实现的接口功能,参考[表3](#tab
</td> </td>
<td class="cellrowborder" valign="top" width="45.77457745774577%" headers="mcps1.2.4.1.2 "><p id="p880485195711"><a name="p880485195711"></a><a name="p880485195711"></a>int32_t <strong id="b16497123107"><a name="b16497123107"></a><a name="b16497123107"></a>init</strong>(void)</p> <td class="cellrowborder" valign="top" width="45.77457745774577%" headers="mcps1.2.4.1.2 "><p id="p880485195711"><a name="p880485195711"></a><a name="p880485195711"></a>int32_t <strong id="b16497123107"><a name="b16497123107"></a><a name="b16497123107"></a>init</strong>(void)</p>
</td> </td>
<td class="cellrowborder" valign="top" width="45.81458145814582%" headers="mcps1.2.4.1.3 "><p id="p1480465165710"><a name="p1480465165710"></a><a name="p1480465165710"></a>传感器器设备探测成功后,需要对传感器器设备初始化配置。</p> <td class="cellrowborder" valign="top" width="45.81458145814582%" headers="mcps1.2.4.1.3 "><p id="p1480465165710"><a name="p1480465165710"></a><a name="p1480465165710"></a>传感器设备探测成功后,需要对传感器设备初始化配置。</p>
</td> </td>
</tr> </tr>
<tr id="row178311493339"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p208318963320"><a name="p208318963320"></a><a name="p208318963320"></a>int32_t <strong id="b189921571402"><a name="b189921571402"></a><a name="b189921571402"></a>Enable</strong>(void)</p> <tr id="row178311493339"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p208318963320"><a name="p208318963320"></a><a name="p208318963320"></a>int32_t <strong id="b189921571402"><a name="b189921571402"></a><a name="b189921571402"></a>Enable</strong>(void)</p>
</td> </td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p68310953312"><a name="p68310953312"></a><a name="p68310953312"></a>根据当前传感器设备的HCS配置,下发传感器设备使能操作组的寄存器配置。</p> <td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p68310953312"><a name="p68310953312"></a><a name="p68310953312"></a>根据当前传感器设备的HCS配置,下发传感器设备使能操作组的寄存器配置。</p>
</td> </td>
</tr> </tr>
<tr id="row0831129153318"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p0831169183314"><a name="p0831169183314"></a><a name="p0831169183314"></a>int32_t <strong id="b13541291106"><a name="b13541291106"></a><a name="b13541291106"></a>Disable</strong>(void)</p> <tr id="row0831129153318"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p0831169183314"><a name="p0831169183314"></a><a name="p0831169183314"></a>int32_t <strong id="b13541291106"><a name="b13541291106"></a><a name="b13541291106"></a>Disable</strong>(void)</p>
</td> </td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p138314912336"><a name="p138314912336"></a><a name="p138314912336"></a>根据当前传感器设备的HCS配置,下发传感器设备去使能操作组的寄存器配置。</p> <td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p138314912336"><a name="p138314912336"></a><a name="p138314912336"></a>根据当前传感器设备的HCS配置,下发传感器设备去使能操作组的寄存器配置。</p>
</td> </td>
</tr> </tr>
<tr id="row178311093334"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p583118920338"><a name="p583118920338"></a><a name="p583118920338"></a>int32_t <strong id="b111117118017"><a name="b111117118017"></a><a name="b111117118017"></a>SetBatch</strong>(int64_t samplingInterval, int64_t reportInterval)</p> <tr id="row178311093334"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p583118920338"><a name="p583118920338"></a><a name="p583118920338"></a>int32_t <strong id="b111117118017"><a name="b111117118017"></a><a name="b111117118017"></a>SetBatch</strong>(int64_t samplingInterval, int64_t reportInterval)</p>
...@@ -239,7 +239,7 @@ Sensor驱动模型要求驱动开发者实现的接口功能,参考[表3](#tab ...@@ -239,7 +239,7 @@ Sensor驱动模型要求驱动开发者实现的接口功能,参考[表3](#tab
</tr> </tr>
<tr id="row12565104264215"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p17565104210429"><a name="p17565104210429"></a><a name="p17565104210429"></a>int32_t <strong id="b96811512011"><a name="b96811512011"></a><a name="b96811512011"></a>SetOption</strong>(uint32_t option)</p> <tr id="row12565104264215"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p17565104210429"><a name="p17565104210429"></a><a name="p17565104210429"></a>int32_t <strong id="b96811512011"><a name="b96811512011"></a><a name="b96811512011"></a>SetOption</strong>(uint32_t option)</p>
</td> </td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p4565104214213"><a name="p4565104214213"></a><a name="p4565104214213"></a>根据可选配置,下发量程,精度等寄存器配置。</p> <td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p4565104214213"><a name="p4565104214213"></a><a name="p4565104214213"></a>根据可选配置、下发量程和精度等寄存器配置。</p>
</td> </td>
</tr> </tr>
<tr id="row380240111218"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1181184016120"><a name="p1181184016120"></a><a name="p1181184016120"></a>void <strong id="b1613451717016"><a name="b1613451717016"></a><a name="b1613451717016"></a>ReadSensorData</strong>(void)</p> <tr id="row380240111218"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1181184016120"><a name="p1181184016120"></a><a name="p1181184016120"></a>void <strong id="b1613451717016"><a name="b1613451717016"></a><a name="b1613451717016"></a>ReadSensorData</strong>(void)</p>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册