提交 4d3d9721 编写于 作者: qq_41863798's avatar qq_41863798

api 文档修改

......@@ -33,7 +33,14 @@ OpenHarmony_v1.x_release:OpenHarmony 1.1.4 LTS稳定版本,[了解版本详
[了解更多版本详情](zh-cn/release-notes/)
## 第三方开源软件及许可说明
3rd-Party-License:[第三方开源软件及许可证说明](zh-cn/contribute/第三方开源软件及许可证说明.md)
## 贡献
非常欢迎您参与[贡献](zh-cn/contribute/参与贡献.md),我们鼓励开发者以各种方式参与文档反馈和贡献。
您可以对现有文档进行评价、简单更改、反馈文档质量问题、贡献您的原创内容,详细请参考[贡献文档](zh-cn/contribute/贡献文档.md)
卓越贡献者将会在开发者社区文档贡献专栏表彰公示。
\ No newline at end of file
......@@ -45,8 +45,13 @@
- [SMS](js-apis-sms.md)
- [SIM Management](js-apis-sim.md)
- [Radio](js-apis-radio.md)
- [observer](js-apis-observer.md)
- [Observer](js-apis-observer.md)
- [Cellular Data](js-apis-telephony-data.md)
- Network Management
- [Network Connection Management](js-apis-net-connection.md)
- [Socket Connection](js-apis-socket.md)
- [WebSocket Connection](js-apis-webSocket.md)
- [Data Request](js-apis-http.md)
- Network and Connectivity
- [WLAN](js-apis-wifi.md)
- [Bluetooth](js-apis-bluetooth.md)
......
......@@ -11,11 +11,11 @@
import call from '@ohos.telephony.call';
```
## call.dial<a name=call.dial-callback1></a>
## call.dial
dial\(phoneNumber: string, callback: AsyncCallback<boolean\>\): void
Initiates a call. This function uses an asynchronous callback to return the execution result.
Initiates a call. This API uses an asynchronous callback to return the execution result.
**Required permission**: ohos.permission.PLACE\_CALL (a system permission)
......@@ -37,11 +37,11 @@ call.dial("138xxxxxxxx", (err, data) => {
```
## call.dial<a name=call.dial-callback2></a>
## call.dial
dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback<boolean\>\): void
Initiates a call. You can set call options as needed. This function uses an asynchronous callback to return the execution result.
Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the execution result.
**Required permission**: ohos.permission.PLACE\_CALL (a system permission)
......@@ -52,7 +52,7 @@ Initiates a call. You can set call options as needed. This function uses an asyn
| Name | Type | Mandatory| Description |
| ----------- | ---------------------------- | ---- | ------------------------------------------------- |
| phoneNumber | string | Yes | Phone number. |
| options | DialOptions | Yes | Call options. For details, see [DialOptions](#DialOptions). |
| options | DialOptions | Yes | Call options defined in [DialOptions](#dialoptions). |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br>- **true**: success<br>- **false**: failure|
**Example**
......@@ -66,11 +66,11 @@ call.dial("138xxxxxxxx", {
```
## call.dial<a name=call.dial-promise></a>
## call.dial
dial\(phoneNumber: string, options?: DialOptions\): Promise<boolean\>
Initiates a call. You can set call options as needed. This function uses a promise to return the execution result.
Initiates a call. You can set call options as needed. This API uses a promise to return the execution result.
**Required permission**: ohos.permission.PLACE\_CALL (a system permission)
......@@ -81,7 +81,7 @@ Initiates a call. You can set call options as needed. This function uses a promi
| Name | Type | Mandatory| Description |
| ----------- | ----------- | ---- | ------------------------------------------- |
| phoneNumber | string | Yes | Phone number. |
| options | DialOptions | Yes | Call options. For details, see [DialOptions](#DialOptions).|
| options | DialOptions | Yes | Call options defined in [DialOptions](#dialoptions).|
**Return Value**
......@@ -102,13 +102,15 @@ promise.then(data => {
});
```
## call.makeCall<sup>7+</sup><a name=call.makeCall-callback></a>
## call.makeCall<sup>7+</sup>
makeCall(phoneNumber: string, callback: AsyncCallback<void>): void
makeCall(phoneNumber: string, callback: AsyncCallback\<void\>): void
Launches the call screen and displays the dialed number. This method uses an asynchronous callback to return the result.
Launches the call screen and displays the dialed number. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CallManager
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.
**System capability**: SystemCapability.Applications.Contacts
**Parameters**
......@@ -126,13 +128,15 @@ call.makeCall("138xxxxxxxx", err => {
```
## call.makeCall<sup>7+</sup><a name=call.makeCall-promise></a>
## call.makeCall<sup>7+</sup>
makeCall(phoneNumber: string): Promise<void>
makeCall(phoneNumber: string): Promise\<void\>
Launches the call screen and displays the dialed number. This method uses a promise to return the result.
Launches the call screen and displays the dialed number. This API uses a promise to return the result.
**System capability**: SystemCapability.Telephony.CallManager
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.
**System capability**: SystemCapability.Applications.Contacts
**Parameters**
......@@ -157,11 +161,11 @@ promise.then(() => {
});
```
## call.hasCall<a name=call.hasCall-callback></a>
## call.hasCall
hasCall\(callback: AsyncCallback<boolean\>\): void
Checks whether a call is in progress. This function uses an asynchronous callback to return the result.
Checks whether a call is in progress. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CallManager
......@@ -180,11 +184,11 @@ call.hasCall((err, data) => {
```
## call.hasCall<a name=call.hasCall-promise></a>
## call.hasCall
hasCall\(\): Promise<boolean\>
Checks whether a call is in progress. This function uses a promise to return the result.
Checks whether a call is in progress. This API uses a promise to return the result.
**System capability**: SystemCapability.Telephony.CallManager
......@@ -206,11 +210,11 @@ promise.then(data => {
```
## call.getCallState<a name=call.getCallState-callback></a>
## call.getCallState
getCallState\(callback: AsyncCallback<CallState\>\): void
Obtains the call status. This function uses an asynchronous callback to return the result.
Obtains the call status. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CallManager
......@@ -218,7 +222,7 @@ Obtains the call status. This function uses an asynchronous callback to return t
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------------- | ---- | ------------------------------------ |
| callback | AsyncCallback&lt;[CallState](#CallState)&gt; | Yes | Callback used to return the result.|
| callback | AsyncCallback&lt;[CallState](#callstate)&gt; | Yes | Callback used to return the result.|
**Example**
......@@ -229,11 +233,11 @@ call.getCallState((err, data) => {
```
## call.getCallState<a name="call.getCallState-promise"></a>
## call.getCallState
getCallState\(\): Promise<CallState\>
Obtains the call status. This function uses a promise to return the result.
Obtains the call status. This API uses a promise to return the result.
**System capability**: SystemCapability.Telephony.CallManager
......@@ -241,7 +245,7 @@ Obtains the call status. This function uses a promise to return the result.
| Type | Description |
| -------------------------------------- | ----------------------------------------- |
| Promise&lt;[CallState](#CallState)&gt; | Promise used to return the result.|
| Promise&lt;[CallState](#callstate)&gt; | Promise used to return the result.|
**Example**
......@@ -254,11 +258,11 @@ promise.then(data => {
});
```
## call.hasVoiceCapability<sup>7+</sup><a name=call.hasVoiceCapability></a>
## call.hasVoiceCapability<sup>7+</sup>
hasVoiceCapability(): boolean
Checks whether a device supports voice calls. This function works in synchronous mode.
Checks whether a device supports voice calls. This API works in synchronous mode.
**System capability**: SystemCapability.Telephony.CallManager
......@@ -273,11 +277,11 @@ let result = call.hasVoiceCapability();
console.log(`hasVoiceCapability: ${JSON.stringify(result)}`);
```
## call.isEmergencyPhoneNumber<sup>7+</sup><a name=call.isEmergencyPhoneNumber-callback1></a>
## call.isEmergencyPhoneNumber<sup>7+</sup>
isEmergencyPhoneNumber\(phoneNumber: string, callback: AsyncCallback<boolean\>\): void
Checks whether the call number of the SIM card in the specified slot is an emergency number. This function uses an asynchronous callback to return the result.
Checks whether the call number of the SIM card in the specified slot is an emergency number. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CallManager
......@@ -297,11 +301,11 @@ call.isEmergencyPhoneNumber("138xxxxxxxx", (err, data) => {
```
## call.isEmergencyPhoneNumber<sup>7+</sup><a name=call.isEmergencyPhoneNumber-callback2></a>
## call.isEmergencyPhoneNumber<sup>7+</sup>
isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback<boolean\>\): void
Checks whether the call number of the SIM card in the specified slot is an emergency number. This function uses an asynchronous callback to return the result.
Checks whether the call number of the SIM card in the specified slot is an emergency number. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CallManager
......@@ -310,7 +314,7 @@ Checks whether the call number of the SIM card in the specified slot is an emerg
| Name | Type | Mandatory| Description |
| ----------- | ---------------------------- | ---- | ------------------------------------------------------------ |
| phoneNumber | string | Yes | Phone number. |
| options | EmergencyNumberOptions | Yes | Emergency number options defined in [EmergencyNumberOptions](#EmergencyNumberOptions).|
| options | EmergencyNumberOptions | Yes | Emergency number options defined in [EmergencyNumberOptions](#emergencynumberoptions7).|
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br>- **true**: The called number is an emergency number.<br>- **false**: The called number is not an emergency number.|
**Example**
......@@ -322,11 +326,11 @@ call.isEmergencyPhoneNumber("112", {slotId: 1}, (err, value) => {
```
## call.isEmergencyPhoneNumber<sup>7+</sup><a name=call.isEmergencyPhoneNumber-promise></a>
## call.isEmergencyPhoneNumber<sup>7+</sup>
isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\): Promise<boolean\>
Checks whether the call number of the SIM card in the specified slot is an emergency number. This function uses a promise to return the result.
Checks whether the call number of the SIM card in the specified slot is an emergency number. This API uses a promise to return the result.
**System capability**: SystemCapability.Telephony.CallManager
......@@ -335,7 +339,7 @@ Checks whether the call number of the SIM card in the specified slot is an emerg
| Name | Type | Mandatory| Description |
| ----------- | ---------------------- | ---- | ------------------------------------------------------------ |
| phoneNumber | string | Yes | Phone number. |
| options | EmergencyNumberOptions | Yes | Emergency number options defined in [EmergencyNumberOptions](#EmergencyNumberOptions).|
| options | EmergencyNumberOptions | Yes | Emergency number options defined in [EmergencyNumberOptions](#emergencynumberoptions7).|
**Return Value**
......@@ -354,11 +358,11 @@ promise.then(data => {
});
```
## call.formatPhoneNumber<sup>7+</sup><a name=call.formatPhoneNumber-callback1></a>
## call.formatPhoneNumber<sup>7+</sup>
formatPhoneNumber\(phoneNumber: string, callback: AsyncCallback<string\>\): void
Formats a phone number based on the specified ISO country code. This function uses an asynchronous callback to return the result.
Formats a phone number based on the specified ISO country code. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CallManager
......@@ -378,11 +382,11 @@ call.formatPhoneNumber("138xxxxxxxx", (err, data) => {
```
## call.formatPhoneNumber<sup>7+</sup><a name=call.formatPhoneNumber-callback2></a>
## call.formatPhoneNumber<sup>7+</sup>
formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback<string\>\): void
Formats a phone number based on specified formatting options. This function uses an asynchronous callback to return the result.
Formats a phone number based on specified formatting options. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CallManager
......@@ -391,7 +395,7 @@ Formats a phone number based on specified formatting options. This function uses
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | ------------------------------------------------------------ |
| phoneNumber | string | Yes | Phone number. |
| options | NumberFormatOptions | Yes | Number formatting options defined in [NumberFormatOptions](#NumberFormatOptions).|
| options | NumberFormatOptions | Yes | Number formatting options defined in [NumberFormatOptions](#numberformatoptions7).|
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. |
**Example**
......@@ -405,11 +409,11 @@ call.formatPhoneNumber("138xxxxxxxx",{
```
## call.formatPhoneNumber<sup>7+</sup><a name=call.formatPhoneNumber-promise></a>
## call.formatPhoneNumber<sup>7+</sup>
formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise<string\>
Formats a phone number based on specified formatting options. This function uses a promise to return the result.
Formats a phone number based on specified formatting options. This API uses a promise to return the result.
**System capability**: SystemCapability.Telephony.CallManager
......@@ -418,7 +422,7 @@ Formats a phone number based on specified formatting options. This function uses
| Name | Type | Mandatory| Description |
| ----------- | ------------------- | ---- | ------------------------------------------------------------ |
| phoneNumber | string | Yes | Phone number. |
| options | NumberFormatOptions | Yes | Number formatting options defined in [NumberFormatOptions](#NumberFormatOptions).|
| options | NumberFormatOptions | Yes | Number formatting options defined in [NumberFormatOptions](#numberformatoptions7).|
**Return Value**
......@@ -439,11 +443,11 @@ promise.then(data => {
});
```
## call.formatPhoneNumberToE164<sup>7+</sup><a name=call.formatPhoneNumberToE164-callback></a>
## call.formatPhoneNumberToE164<sup>7+</sup>
formatPhoneNumberToE164\(phoneNumber: string, countryCode: string, callback: AsyncCallback<string\>\): void
Converts a phone number into the E.164 format. This function uses an asynchronous callback to return the result.
Converts a phone number into the E.164 format. This API uses an asynchronous callback to return the result.
The phone number must match the specified country code. For example, for a China phone number, the country code must be **CN**. Otherwise, **null** will be returned.
......@@ -470,11 +474,11 @@ call.formatPhoneNumberToE164("138xxxxxxxx",{
```
## call.formatPhoneNumberToE164<sup>7+</sup><a name=call.formatPhoneNumberToE164-promise></a>
## call.formatPhoneNumberToE164<sup>7+</sup>
formatPhoneNumberToE164\(phoneNumber: string, countryCode: string\): Promise<string\>
Converts a phone number into the E.164 format. This function uses a promise to return the result.
Converts a phone number into the E.164 format. This API uses a promise to return the result.
The phone number must match the specified country code. For example, for a China phone number, the country code must be **CN**. Otherwise, **null** will be returned.
......@@ -508,43 +512,45 @@ promise.then(data => {
});
```
## DialOptions<a name=DialOptions></a>
## DialOptions
Provides an option for determining whether a call is a video call.
**System capability**: SystemCapability.Telephony.CallManager
| Parameter | Type | Mandatory| Description |
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| extras | boolean | No | Indication of a video call. <br>- **true**: video call<br>- **false** (default): voice call|
## CallState<a name=CallState></a>
## CallState
Enumerates call states.
| Variable | Value | Description |
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| ------------------ | ---- | ------------------------------------------------------------ |
| CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown.<br>**System capability**: SystemCapability.Telephony.CallManager|
| CALL_STATE_IDLE | 0 | No call is in progress.<br>**System capability**: SystemCapability.Telephony.CallManager|
| CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state.<br>**System capability**: SystemCapability.Telephony.CallManager|
| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting.<br>**System capability**: SystemCapability.Telephony.CallManager|
| CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown. |
| CALL_STATE_IDLE | 0 | No call is in progress. |
| CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state. |
| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting.|
## EmergencyNumberOptions<sup>7+</sup><a name=EmergencyNumberOptions></a>
## EmergencyNumberOptions<sup>7+</sup>
Provides an option for determining whether a number is an emergency number for the SIM card in the specified slot.
**System capability**: SystemCapability.Telephony.CallManager
| Parameter | Type | Mandatory| Description |
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------ |
| slotId | number | No | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
## NumberFormatOptions<sup>7+</sup><a name=NumberFormatOptions></a>
## NumberFormatOptions<sup>7+</sup>
Provides an option for number formatting.
**System capability**: SystemCapability.Telephony.CallManager
| Parameter | Type | Mandatory| Description |
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ---------------------------------------------------------- |
| countryCode | string | No | Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**.|
# Camera<a name="EN-US_TOPIC_0000001149807881"></a>
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
......@@ -31,11 +31,6 @@ Gets a **CameraManager** instance. This method uses an asynchronous callback to
| context | Context | Yes | Application context |
| callback | AsyncCallback<CameraManager\> | Yes | Callback used to return the CameraManager instance |
**Return values**
none
**Example**
```
......@@ -82,59 +77,62 @@ camera.getCameraManager(context).then((cameraManger) => {
Enumerates camera status types.
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
| Name | Default Value | Description |
|---------------------------|---------------|--------------------|
| CAMERA_STATUS_APPEAR | 0 | Camera appear<br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| CAMERA_STATUS_DISAPPEAR | 1 | Camera disappear <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| CAMERA_STATUS_AVAILABLE | 2 | Camera available<br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| CAMERA_STATUS_UNAVAILABLE | 3 | Camera unavailable <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core|
| CAMERA_STATUS_APPEAR | 0 | Camera appear |
| CAMERA_STATUS_DISAPPEAR | 1 | Camera disappear |
| CAMERA_STATUS_AVAILABLE | 2 | Camera available |
| CAMERA_STATUS_UNAVAILABLE | 3 | Camera unavailable |
## CameraPosition<a name="section_camera_position"></a>
Enumerates the camera positions.
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
| Name | Default value | Description |
|-----------------------------|---------------|-----------------------|
| CAMERA_POSITION_UNSPECIFIED | 0 | Unspecified position <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| CAMERA_POSITION_BACK | 1 | Rear camera <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| CAMERA_POSITION_FRONT | 2 | Front camera <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| CAMERA_POSITION_UNSPECIFIED | 0 | Unspecified position |
| CAMERA_POSITION_BACK | 1 | Rear camera |
| CAMERA_POSITION_FRONT | 2 | Front camera |
## CameraType<a name="section_camera_type"></a>
Enumerates the camera types.
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
| Name | Default value | Description |
|-------------------------|---------------|-------------------------|
| CAMERA_TYPE_UNSPECIFIED | 0 | Unspecified camera type <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| CAMERA_TYPE_WIDE_ANGLE | 1 | Wide camera <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| CAMERA_TYPE_ULTRA_WIDE | 2 | Ultra wide camera <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| CAMERA_TYPE_TELEPHOTO | 3 | Telephoto camera <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| CAMERA_TYPE_TRUE_DEPTH | 4 | True depth camera <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| CAMERA_TYPE_UNSPECIFIED | 0 | Unspecified camera type |
| CAMERA_TYPE_WIDE_ANGLE | 1 | Wide camera |
| CAMERA_TYPE_ULTRA_WIDE | 2 | Ultra wide camera |
| CAMERA_TYPE_TELEPHOTO | 3 | Telephoto camera |
| CAMERA_TYPE_TRUE_DEPTH | 4 | True depth camera |
## ConnectionType<a name="section_ConnectionType"></a>
Enumerates camera connection types.
| Name | Default value | Description |
|------------------------------|---------------|----------------------------|
| CAMERA_CONNECTION_BUILT_IN | 0 | Built-in camera <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| CAMERA_CONNECTION_USB_PLUGIN | 1 | Camera connected using USB <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| CAMERA_CONNECTION_REMOTE | 2 | Remote camera <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
## CameraFormat<a name="section_CameraFormat"></a>
**System Capabilities:**
Enumerates the camera formats.
SystemCapability.Multimedia.Camera.Core
| Name | Default value | Description |
|----------------------------|---------------|---------------------|
| CAMERA_FORMAT_YCRCb_420_SP | 1003 | Camera YCRCb <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| CAMERA_FORMAT_JPEG | 2000 | Camera format jpeg <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| CAMERA_FORMAT_AVC | 3000 | Camera format avc <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| CAMERA_FORMAT_HEVC | 3001 | Camera format hevc <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
|------------------------------|---------------|----------------------------|
| CAMERA_CONNECTION_BUILT_IN | 0 | Built-in camera |
| CAMERA_CONNECTION_USB_PLUGIN | 1 | Camera connected using USB |
| CAMERA_CONNECTION_REMOTE | 2 | Remote camera |
## CameraManager<a name="section_CameraManager"></a>
......@@ -156,10 +154,6 @@ Gets all cameras supported by the device. This method uses an asynchronous callb
|----------|--------------------------------|-----------|---------------------------------------------------------|
| callback | AsyncCallback<Array<Camera\>\> | Yes | Callback used to return the array of supported cameras. |
**Return values**
none
**Example**
```
......@@ -182,10 +176,6 @@ SystemCapability.Multimedia.Camera.Core
Gets all cameras supported by the device. This method uses a promise to return the array of supported cameras.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -218,10 +208,6 @@ Creates a **CameraInput** instance with the specified camera ID. This method use
| cameraId | string | Yes | Camera ID used to create the instance |
| callback | AsyncCallback<CameraInput\> | Yes | Callback used to return the CameraInput instance |
**Return values**
none
**Example**
```
......@@ -282,10 +268,6 @@ Creates a **CameraInput** instance with the specified camera position and camera
| cameraType | CameraType | Yes | Camera type |
| callback | AsyncCallback<CameraInput\> | Yes | Callback used to return the CameraInput instance |
**Return values**
none
**Example**
```
......@@ -346,10 +328,6 @@ Listens for camera status changes. This method uses a callback to get camera sta
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<CameraStatusInfo\> | Yes | Callback used to get the camera status change. |
**Return value**
None
**Example**
```
......@@ -361,38 +339,48 @@ cameraManager.on('cameraStatus', (cameraStatusInfo) => {
## Camera<a name="section_Camera"></a>
Camera class.
when we call *cameraManager.getCameras()* API, then it will return the **Camera** class which will have all camera-related metadata such as *cameraId, cameraPosition, cameraType & connectionType*.
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
**Fields**
| Name | Type | Access | Description |
|----------------|----------------|----------|------------------------|
| cameraId | string | readonly | Camera ID <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| cameraPosition | cameraPosition | readonly | Camera position <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| cameraType | cameraType | readonly | Camera type <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| connectionType | connectionType | readonly | Camera connection type <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core|
| cameraId | string | readonly | Camera ID |
| cameraPosition | cameraPosition | readonly | Camera position |
| cameraType | cameraType | readonly | Camera type |
| connectionType | connectionType | readonly | Camera connection type |
```
var cameraManager = await camera.getCameraManager();
var cameras = await cameraManager.getCameras();
var cameraObj = cameras[0];
var cameraId = cameraObj.cameraId;
var cameraPosition = cameraObj.cameraPosition;
var cameraType = cameraObj.cameraType;
var cameraId = cameraObj.connectionType;
async function getCameraInfo() {
var cameraManager = await camera.getCameraManager();
var cameras = await cameraManager.getCameras();
var cameraObj = cameras[0];
var cameraId = cameraObj.cameraId;
var cameraPosition = cameraObj.cameraPosition;
var cameraType = cameraObj.cameraType;
var cameraId = cameraObj.connectionType;
}
```
## CameraStatusInfo<a name="section_Camera"></a>
CameraStatusInfo class.
This interface is a CameraManager callback API return. **CameraStatusInfo** will have *Camera* class & *CameraStatus* predefine constants.From *Camera* class, we can have all camera-related metadata & from *CameraStatus* constants, we will have information such as *APPEAR, DISAPPEAR, AVAILABLE & UNAVAILABLE*.
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
**Fields**
| Name | Type | Description |
|----------------|----------------|------------------|
| camera | Camera | Camera object <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| status | CameraStatus | Camera status <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| camera | Camera | Camera object |
| status | CameraStatus | Camera status |
## CameraInput<a name="section_CameraInput"></a>
......@@ -415,10 +403,6 @@ Gets the camera ID based on which this **CameraInput** instance is created. This
|----------|------------------------|-----------|---------------------------------------|
| callback | AsyncCallback<string\> | Yes | Callback used to return the camera ID |
**Return values**
none
```
cameraInput.getCameraId((err, cameraId) => {
if (err) {
......@@ -439,10 +423,6 @@ SystemCapability.Multimedia.Camera.Core
Gets the camera ID based on which this **CameraInput** instance is created. This method uses a promise to return the camera ID.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -457,251 +437,6 @@ cameraInput.getCameraId().then((cameraId) => {
})
```
### getSupportedSizes\(format: CameraFormat, callback: AsyncCallback<Array<Size\>\>\): void;
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
**Description**
Gets supported sizes for a given format. This method uses an asynchronous callback to return the supported sizes.
**Parameters**
| Name | Type | Mandatory | Description |
|----------|------------------------------|-----------|---------------------------------------------|
| format | CameraFormat | Yes | Camera format used to get supported sizes |
| callback | AsyncCallback<Array<Size\>\> | Yes | Callback used to return the supported sizes |
**Return values**
none
**Example**
```
cameraInput.getSupportedSizes(format, (err, sizes) => {
if (err) {
console.error('Failed to get the supported sizes. ${err.message}');
return;
}
console.log('Callback returned with the supported sizes:' + sizes);
})
```
### getSupportedSizes\(format: CameraFormat\): Promise<Array<Size\>\>;
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
**Description**
Gets supported sizes for a given format. This method uses a promise to return the supported sizes.
**Parameters**
| Name | Type | Mandatory | Description |
|----------|----------------------------|-----------|-----------------------------------------------|
| format | CameraFormat | Yes | Camera format used to get the supported sizes |
**Return values**
| Type | Description |
|------------------------|---------------------------------------------|
| Promise<Array<Size\>\> | Promise used to return the supported sizes. |
**Example**
```
cameraInput.getSupportedSizes(format).then((sizes) => {
console.log('Promise returned with supported sizes: ' + sizes);
})
```
### getSupportedPreviewFormats\(callback: AsyncCallback<Array<CameraFormat\>\>\): void;
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
**Description**
Gets supported formats for preview. This method uses an asynchronous callback to return the supported formats.
**Parameters**
| Name | Type | Mandatory | Description |
|----------|--------------------------------------|-----------|---------------------------------------------------|
| callback | AsyncCallback<Array<CameraFormat\>\> | Yes | Callback used to return the supported preview formats. |
**Return values**
none
**Example**
```
cameraInput.getSupportedPreviewFormats((err, previewFormats) => {
if (err) {
console.error('Failed to get the supported preview formats. ${err.message}');
return;
}
console.log('Callback returned with supported preview formats: ' + previewFormats.length);
})
```
### getSupportedPreviewFormats\(\): Promise<Array<CameraFormat\>\>;
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
**Description**
Gets supported formats for preview. This method uses a promise to return the supported formats.
**Parameters**
none
**Return values**
| Type | Description |
|--------------------------------|-------------------------------------------------------|
| Promise<Array<CameraFormat\>\> | Promise used to return the supported preview formats |
**Example**
```
cameraInput.getSupportedPreviewFormats().then((previewFormats) => {
console.log('Promise returned with supported preview formats.' + previewFormats.length);
})
```
### getSupportedPhotoFormats\(callback: AsyncCallback<Array<CameraFormat\>\>\): void;<a name="section189141826104616"></a>
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
**Description**
Gets supported formats for photographing. This method uses an asynchronous callback to return the supported formats.
**Parameters**
| Name | Type | Mandatory | Description |
|----------|--------------------------------------|-----------|-------------------------------------------------|
| callback | AsyncCallback<Array<CameraFormat\>\> | Yes | Callback used to return the supported photo formats. |
**Return values**
none
**Example**
```
cameraInput.getSupportedPhotoFormats((err, photoFormats) => {
if (err) {
console.error('Failed to get the supported photo formats. ${err.message}');
return;
}
console.log('Callback returned with supported photo formats');
})
```
### getSupportedPhotoFormats\(\): Promise<Array<CameraFormat\>\>;<a name="section189141826104616"></a>
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
**Description**
Gets supported formats for photographing. This method uses a promise to return the supported formats.
**Parameters**
none
**Return values**
| Type | Description |
|--------------------------------|---------------------------------------------------|
| Promise<Array<CameraFormat\>\> | Promise used to return supported photo formats. |
**Example**
```
cameraInput.getSupportedPhotoFormats().then((photoFormats) => {
console.log('Promise returned with supported photo formats.' + photoFormats.length);
})
```
### getSupportedVideoFormats\(callback: AsyncCallback<Array<CameraFormat\>\>\): void;
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
**Description**
Gets supported formats for video recording. This method uses an asynchronous callback to return the supported video formats.
**Parameters**
| Name | Type | Mandatory | Description |
|----------|--------------------------------------|-----------|-------------------------------------------------|
| callback | AsyncCallback<Array<CameraFormat\>\> | Yes | Callback used to return the supported video formats. |
**Return values**
none
**Example**
```
cameraInput.getSupportedVideoFormats((err, videoFormats) => {
if (err) {
console.error('Failed to get the supported video formats. ${err.message}');
return;
}
console.log('Callback returned with supported video formats : ' + videoFormats.length);
})
```
### getSupportedVideoFormats\(\): Promise<Array<CameraFormat\>\>;
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
**Description**
Gets supported formats for video recording. This method uses a promise to return the supported video format.
**Parameters**
none
**Return values**
| Type | Description |
|--------------------------------|---------------------------------------------------|
| Promise<Array<CameraFormat\>\> | Promise used to return supported video formats. |
**Example**
```
cameraInput.getSupportedVideoFormats().then((videoFormats) => {
console.log('Promise returned with supported video formats.' + videoFormats.length);
})
```
### hasFlash(callback: AsyncCallback<boolean\>): void; <a name="sec_hasFlash"></a>
**System Capabilities:**
......@@ -718,10 +453,6 @@ Checks whether the device has flash light. This method uses an asynchronous call
|----------|-------------------------|-----------|----------------------------------------------------|
| callback | AsyncCallback<boolean\> | Yes | Callback used to return the flash light support status |
**Return values**
none
**Example**
```
......@@ -744,10 +475,6 @@ SystemCapability.Multimedia.Camera.Core
Checks whether the device has flash light. This method uses a promise to return the result.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -779,10 +506,6 @@ Checks whether a specified flash mode is supported. This method uses an asynchro
| flashMode | <a href="#sec_FlashMode">FlashMode</a> | Yes | Flash mode |
| callback | AsyncCallback<boolean\> | Yes | Callback used to return the device flash support status |
**Return values**
none
**Example**
```
......@@ -844,10 +567,6 @@ Note: Before setting the flash mode, check the support for the flash light (<a h
| flashMode | <a href="#sec_FlashMode">FlashMode</a> | Yes | Flash mode |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -887,7 +606,7 @@ Note: Before setting the flash mode, check the support for the flash light (<a h
**Example**
```
cameraInput.setFlashMode(flashMode).then() => {
cameraInput.setFlashMode(flashMode).then(() => {
console.log('Promise returned with the successful execution of setFlashMode.');
})
```
......@@ -908,10 +627,6 @@ Gets current flash mode. This method uses an asynchronous callback to return the
|-----------|---------------------------|-----------|------------------------------------------------|
| callback | AsyncCallback<FlashMode\> | Yes | Callback used to return the current flash mode |
**Return values**
none
**Example**
```
......@@ -934,10 +649,6 @@ SystemCapability.Multimedia.Camera.Core
Gets current flash mode. This method uses a promise to return the result.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -947,7 +658,7 @@ none
**Example**
```
cameraInput.getFlashMode().then(flashMode) => {
cameraInput.getFlashMode().then((flashMode) => {
console.log('Promise returned with current flash mode : ' + flashMode);
})
```
......@@ -969,10 +680,6 @@ Checks whether a specified focus mode is supported. This method uses an asynchro
| afMode | <a href="#sec_FocusMode">FocusMode</a> | Yes | Focus mode |
| callback | AsyncCallback<boolean\> | Yes | Callback used to return the device focus support status |
**Return values**
none
**Example**
```
......@@ -1034,10 +741,6 @@ Note: Before setting the focus mode, check focus mode support (<a href="#sec_isF
| afMode | <a href="#sec_FocusMode">FocusMode</a> | Yes | Focus mode |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -1077,7 +780,7 @@ Note: Before setting the focus mode, check focus mode support (<a href="#sec_isF
**Example**
```
cameraInput.setFocusMode(afMode).then() => {
cameraInput.setFocusMode(afMode).then(() => {
console.log('Promise returned with the successful execution of setFocusMode.');
})
```
......@@ -1098,10 +801,6 @@ Gets the current focus mode. This method uses an asynchronous callback to return
|-----------|---------------------------|-----------|------------------------------------------------|
| callback | AsyncCallback<FocusMode\> | Yes | Callback used to return the current focus mode |
**Return values**
none
**Example**
```
......@@ -1124,10 +823,6 @@ SystemCapability.Multimedia.Camera.Core
Gets the current focus mode. This method uses a promise to return the result.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -1137,7 +832,7 @@ none
**Example**
```
cameraInput.getFocusMode().then(afMode) => {
cameraInput.getFocusMode().then((afMode) => {
console.log('Promise returned with current focus mode : ' + afMode);
})
```
......@@ -1158,15 +853,10 @@ Gets the zoom ratios of all zoom values. This method uses an asynchronous callba
|----------|--------------------------------|-----------|-------------------------------------------------|
| callback | AsyncCallback<Array<number\>\> | Yes | Callback used to return the zoom ratio range |
**Return values**
none
**Example**
```
cameraInput.getZoomRatioRange(err, zoomRatioRange) => {
cameraInput.getZoomRatioRange((err, zoomRatioRange) => {
if (err) {
console.error('Failed to get the zoom ratio range. ${err.message}');
return;
......@@ -1185,10 +875,6 @@ SystemCapability.Multimedia.Camera.Core
Gets the zoom ratios of all zoom values. This method uses a promise to return the result.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -1220,10 +906,6 @@ Sets a zoom ratio. This method uses an asynchronous callback to return the resul
| zoomRatio | number | Yes | Zoom ratio |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -1261,7 +943,7 @@ Sets a zoom ratio. This method uses a promise to return the result.
**Example**
```
cameraInput.setZoomRatio(zoomRatio).then() => {
cameraInput.setZoomRatio(zoomRatio).then(() => {
console.log('Promise returned with the successful execution of setZoomRatio.');
})
```
......@@ -1282,10 +964,6 @@ Gets current zoom ratio value. This method uses an asynchronous callback to retu
|-----------|---------------------------|-----------|------------------------------------------------------|
| callback | AsyncCallback<number\> | Yes | Callback used to return the current zoom ratio value |
**Return values**
none
**Example**
```
......@@ -1308,10 +986,6 @@ SystemCapability.Multimedia.Camera.Core
Gets current zoom ratio value. This method uses a promise to return the result.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -1321,7 +995,7 @@ none
**Example**
```
cameraInput.getZoomRatio().then(zoomRatio) => {
cameraInput.getZoomRatio().then((zoomRatio) => {
console.log('Promise returned with current zoom ratio : ' + zoomRatio);
})
```
......@@ -1342,10 +1016,6 @@ Releases this **CameraInput** instance. This method uses an asynchronous callbac
|----------|----------------------|-----------|------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -1368,10 +1038,6 @@ SystemCapability.Multimedia.Camera.Core
Releases this **CameraInput** instance. This method uses a promise to return the result.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -1403,10 +1069,6 @@ Listens for focus state changes. This method uses a callback to get focus state
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<FocusState\> | Yes | Callback used to get the focus state change. |
**Return value**
None
**Example**
```
......@@ -1432,10 +1094,6 @@ Listens for **CameraInput** errors. This method uses a callback to get errors.
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<CameraInputError\> | Yes | Callback used to get the camera input errors. |
**Return value**
None
**Example**
```
......@@ -1448,24 +1106,31 @@ cameraInput.on('error', (cameraInputError) => {
Enumerates the flash modes.
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
| Name | Default value | Description |
|------------------------|---------------|------------------------|
| FLASH_MODE_CLOSE | 0 | Flash mode close <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| FLASH_MODE_OPEN | 1 | Flash mode open <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| FLASH_MODE_AUTO | 2 | Flash mode auto <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| FLASH_MODE_ALWAYS_OPEN | 3 | Flash mode always open <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| FLASH_MODE_CLOSE | 0 | Flash mode close |
| FLASH_MODE_OPEN | 1 | Flash mode open |
| FLASH_MODE_AUTO | 2 | Flash mode auto |
| FLASH_MODE_ALWAYS_OPEN | 3 | Flash mode always open |
## FocusMode <a name="sec_FocusMode"></a>
Enumerates the focus modes.
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
| Name | Default value | Description |
|----------------------------|---------------|----------------------------|
| FOCUS_MODE_MANUAL | 0 | Focus mode manual <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| FOCUS_MODE_CONTINUOUS_AUTO | 1 | Focus mode continuous auto <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core|
| FOCUS_MODE_AUTO | 2 | Focus mode auto <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| FOCUS_MODE_LOCKED | 3 | Focus mode locked <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| FOCUS_MODE_MANUAL | 0 | Focus mode manual |
| FOCUS_MODE_CONTINUOUS_AUTO | 1 | Focus mode continuous auto |
| FOCUS_MODE_AUTO | 2 | Focus mode auto |
| FOCUS_MODE_LOCKED | 3 | Focus mode locked |
## createCaptureSession\(context: Context, callback: AsyncCallback<CaptureSession\>\): void;
......@@ -1484,14 +1149,10 @@ Creates a **CaptureSession** instance. This method uses an asynchronous callback
| context | Context | Yes | Application context |
| callback | AsyncCallback<CaptureSession\> | Yes | Callback used to return the CaptureSession instance |
**Return values**
none
**Example**
```
captureSession.createCaptureSession(context), (err, captureSession) => {
captureSession.createCaptureSession((context), (err, captureSession) => {
if (err) {
console.error('Failed to create the CaptureSession instance. ${err.message}');
return;
......@@ -1550,10 +1211,6 @@ Starts configuration for this CaptureSession instance. This method uses an async
|----------|----------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -1576,10 +1233,6 @@ SystemCapability.Multimedia.Camera.Core
Starts configuration for this CaptureSession instance. This method uses a promise to return the result.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -1611,10 +1264,6 @@ Commits the configuration for this CaptureSession instance. This method uses an
|----------|---------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -1637,10 +1286,6 @@ SystemCapability.Multimedia.Camera.Core
Commits the configuration for this CaptureSession instance. This method uses a promise to return the result.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -1672,10 +1317,6 @@ Add a CameraInput instance to this CaptureSession instance. This method uses an
| cameraInput | CameraInput | Yes | CameraInput instance to add |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -1735,10 +1376,6 @@ Add a PreviewOutput instance to this CaptureSession instance. This method uses a
| previewOutput | PreviewOutput | Yes | PreviewOutput instance to add |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -1798,10 +1435,6 @@ Add a PhotoOutput instance to this CaptureSession instance. This method uses an
| photoOutput | PhotoOutput | Yes | PhotoOutput instance to add |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -1861,10 +1494,6 @@ Add a VideoOutput instance to this CaptureSession instance. This method uses an
| videoOutput | VideoOutput | Yes | VideoOutput instance to add |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -1924,11 +1553,6 @@ Removes a **CameraInput** instance from this **CaptureSession** instance. This m
| cameraInput | CameraInput | Yes | CameraInput instance to remove |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -1988,10 +1612,6 @@ Removes a **PreviewOutput** instance from this **CaptureSession** instance. This
| previewOutput | PreviewOutput | Yes | PreviewOutput instance to remove |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -2053,10 +1673,6 @@ Removes a **PhotoOutput** instance from this **CaptureSession** instance. This m
| photoOutput | PhotoOutput | Yes | PhotoOutput instance to remove |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -2118,10 +1734,6 @@ Removes a **VideoOutput** instance from this **CaptureSession** instance. This m
| videoOutput | VideoOutput | Yes | VideoOutput instance to remove |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -2182,10 +1794,6 @@ Starts this **CaptureSession** instance. This method uses an asynchronous callba
|----------|----------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -2208,10 +1816,6 @@ SystemCapability.Multimedia.Camera.Core
Starts this **CaptureSession** instance. This method uses a promise to return the result.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -2243,10 +1847,6 @@ Stops this **CaptureSession** instance. This method uses an asynchronous callbac
|----------|----------------------|-----------|------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -2269,10 +1869,6 @@ SystemCapability.Multimedia.Camera.Core
Stops this **CaptureSession** instance. This method uses a promise to return the result.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -2303,10 +1899,6 @@ Releases this **CaptureSession** instance. This method uses an asynchronous call
|----------|----------------------|-----------|------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -2329,10 +1921,6 @@ SystemCapability.Multimedia.Camera.Core
Releases this **CaptureSession** instance. This method uses a promise to return the result.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -2364,10 +1952,6 @@ Listens for **CaptureSession** errors. This method uses a callback to get errors
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<CaptureSessionError\> | Yes | Callback used to get the capture session errors. |
**Return value**
None
**Example**
```
......@@ -2393,14 +1977,10 @@ Creates a **PreviewOutput** instance. This method uses an asynchronous callback
| surfaceId | string | Yes | Surface ID received from XComponent view |
| callback | AsyncCallback<PreviewOutput\> | Yes | Callback used to return the PreviewOutput instance |
**Return values**
none
**Example**
```
camera.createPreviewOutput(surfaceId), (err, previewOutput) => {
camera.createPreviewOutput((surfaceId), (err, previewOutput) => {
if (err) {
console.error('Failed to create the PreviewOutput instance. ${err.message}');
return;
......@@ -2459,10 +2039,6 @@ Releases this **PreviewOutput** instance. This method uses an asynchronous callb
|----------|----------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -2485,9 +2061,6 @@ SystemCapability.Multimedia.Camera.Core
Releases this **PreviewOutput** instance. This method uses a promise to return the result.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -2520,10 +2093,6 @@ Listens for preview frame start events. This method uses a callback to get the e
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<void\> | Yes | Callback used to return the result |
**Return value**
None
**Example**
```
......@@ -2549,10 +2118,6 @@ Listens for preview frame end event. This method uses a callback to get the even
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<void\> | Yes | Callback used to return the result |
**Return value**
None
**Example**
```
......@@ -2578,10 +2143,6 @@ Listens for **PreviewOutput** errors. This method uses a callback to get errors.
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<PreviewOutputError\> | Yes | Callback used to get the preview output errors. |
**Return value**
None
**Example**
```
......@@ -2607,14 +2168,10 @@ Creates a **PhotoOutput** instance. This method uses an asynchronous callback to
| surfaceId | string | Yes | Surface ID received from ImageReceiver |
| callback | AsyncCallback<PhotoOutput\> | Yes | Callback used to return the PhotoOutput instance |
**Return values**
none
**Example**
```
camera.createPhotoOutput(surfaceId), (err, photoOutput) => {
camera.createPhotoOutput((surfaceId), (err, photoOutput) => {
if (err) {
console.error('Failed to create the PhotoOutput instance. ${err.message}');
return;
......@@ -2656,42 +2213,58 @@ camera.createPhotoOutput(surfaceId).then((photoOutput) => {
Enumerates the image rotation angles.
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
| Name | Default Value | Description |
|--------------|---------------|----------------------------------------|
| ROTATION_0 | 0 | The capture image rotates 0 degrees <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| ROTATION_90 | 90 | The capture image rotates 90 degrees <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| ROTATION_180 | 180 | The capture image rotates 180 degrees <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| ROTATION_270 | 270 | The capture image rotates 270 degrees <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core|
| ROTATION_0 | 0 | The capture image rotates 0 degrees |
| ROTATION_90 | 90 | The capture image rotates 90 degrees |
| ROTATION_180 | 180 | The capture image rotates 180 degrees |
| ROTATION_270 | 270 | The capture image rotates 270 degrees |
## Location
Defines the location of a captured image.
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
| Name | Type | Access | Description |
|-----------|--------|--------------|-------------|
| latitude | number | read / write | Latitude <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| longitude | number | read / write | Longitude <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| latitude | number | read / write | Latitude |
| longitude | number | read / write | Longitude |
## QualityLevel
Enumerates the image quality levels.
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
| Name | Default value | Description |
|----------------------|---------------|----------------------|
| QUALITY_LEVEL_HIGH | 0 | High image quality <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| QUALITY_LEVEL_MEDIUM | 1 | Medium image quality <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| QUALITY_LEVEL_LOW | 2 | Low image quality <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| QUALITY_LEVEL_HIGH | 0 | High image quality |
| QUALITY_LEVEL_MEDIUM | 1 | Medium image quality |
| QUALITY_LEVEL_LOW | 2 | Low image quality |
## PhotoCaptureSetting
Defines the settings for image capture.
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
| Name | Type | Mandatory | Description |
|----------|---------------|-----------|---------------------|
| quality | QualityLevel | Optional | Photo image quality <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core|
| rotation | ImageRotation | Optional | Photo rotation <br/>System Capabilities: SystemCapability.Multimedia.Camera.Core |
| quality | QualityLevel | Optional | Photo image quality |
| rotation | ImageRotation | Optional | Photo rotation |
## PhotoOutput
......@@ -2714,10 +2287,6 @@ Captures a photo. This method uses an asynchronous callback to return the result
|----------|---------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -2747,10 +2316,6 @@ Captures a photo with the specified capture settings. This method uses an asynch
| setting | PhotoCaptureSetting | Yes | Photo capture settings |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -2810,10 +2375,6 @@ Releases this **PhotoOutput** instance. This method uses an asynchronous callbac
|----------|----------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -2836,9 +2397,6 @@ SystemCapability.Multimedia.Camera.Core
Releases this **PhotoOutput** instance. This method uses a promise to return the result.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -2871,10 +2429,6 @@ Listens for photo capture start events. This method uses a callback to get the e
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<number\> | Yes | Callback used to get the capture ID. |
**Return value**
None
**Example**
```
......@@ -2900,10 +2454,6 @@ Listens for frame shutter events. This method uses a callback to get the event i
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<FrameShutterInfo\> | Yes | Callback used to get the frame shutter information.|
**Return value**
None
**Example**
```
......@@ -2930,10 +2480,6 @@ Listens for photo capture end events. This method uses a callback to get the eve
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<CaptureEndInfo\> | Yes | Callback used to get the capture end information |
**Return value**
None
**Example**
```
......@@ -2960,10 +2506,6 @@ Listens for **PhotoOutput** errors. This method uses a callback to get errors.
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<PhotoOutputError\> | Yes | Callback used to get the photo output errors. |
**Return value**
None
**Example**
```
......@@ -2989,14 +2531,10 @@ Creates a **VideoOutput** instance. This method uses an asynchronous callback to
| surfaceId | string | Yes | Surface ID received from VideoRecorder |
| callback | AsyncCallback<VideoOutput\> | Yes | Callback used to return the VideoOutput instance |
**Return values**
none
**Example**
```
camera.createVideoOutput(surfaceId), (err, videoOutput) => {
camera.createVideoOutput((surfaceId), (err, videoOutput) => {
if (err) {
console.error('Failed to create the VideoOutput instance. ${err.message}');
return;
......@@ -3054,10 +2592,6 @@ Starts the video output. This method uses an asynchronous callback to return the
|----------|----------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -3080,9 +2614,6 @@ SystemCapability.Multimedia.Camera.Core
Starts the video output. This method uses a promise to return the result.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -3114,10 +2645,6 @@ Stops the video output. This method uses an asynchronous callback to return the
|----------|----------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -3140,9 +2667,6 @@ SystemCapability.Multimedia.Camera.Core
Stops the video output. This method uses a promise to return the result.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -3173,10 +2697,6 @@ Releases this VideoOutput instance. This method uses an asynchronous callback to
|----------|----------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
**Return values**
none
**Example**
```
......@@ -3199,10 +2719,6 @@ SystemCapability.Multimedia.Camera.Core
Releases this VideoOutput instance. This method uses a promise to return the result.
**Parameters**
none
**Return values**
| Type | Description |
......@@ -3235,10 +2751,6 @@ Listens for video frame start events. This method uses a callback to get the eve
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<void\> | Yes | Callback used to return the result |
**Return value**
None
**Example**
```
......@@ -3258,10 +2770,6 @@ Listens for video frame end events. This method uses a callback to get the event
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<void\> | Yes | Callback used to return the result |
**Return value**
None
**Example**
```
......@@ -3281,10 +2789,6 @@ Listens for **VideoOutput** errors. This method uses a callback to get errors.
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<VideoOutputError\> | Yes | Callback used to get the video output errors. |
**Return value**
None
**Example**
```
......
......@@ -9,57 +9,62 @@
import hiTraceChain from '@ohos.hiTraceChain';
```
## System Capabilities
SystemCapability.HiviewDFX.HiTrace
## HiTraceFlag
Enumerates trace flag types.
**System capability**: SystemCapability.HiviewDFX.HiTrace
| Name| Default Value| Description|
| -------- | -------- | -------- |
| DEFAULT | 0 | Default flag|
| INCLUDE_ASYNC | 1 | Asynchronous call flag|
| DONOT_CREATE_SPAN | 1 << 1 | No span flag|
| TP_INFO | 1 << 2 | Trace point flag|
| NO_BE_INFO | 1 << 3 | No begin/end flag|
| DISABLE_LOG | 1 << 4 | Log association flag|
| FAILURE_TRIGGER | 1 << 5 | Failure trigger flag|
| D2D_TP_INFO | 1 << 6 | Device-to-device trace point flag|
| DEFAULT | 0 | Default flag. |
| INCLUDE_ASYNC | 1 | Asynchronous call flag. By default, only synchronous calls are traced. If this flag is set, both synchronous and asynchronous calls will be traced. |
| DONOT_CREATE_SPAN | 1 << 1 | No span flag. By default, a span is automatically created during tracing of synchronous and asynchronous calls. If this flag is set, no span will be created. |
| TP_INFO | 1 << 2 | Trace point flag. By default, no trace point is added when tracing is enabled. This flag is used for debugging. If this flag is set, trace points will be automatically added on the TX and RX sides of synchronous and asynchronous calls to output trace point and timestamp information. Trace points are classified into four types: [CS, SR, SS, and CR](#hitracetracepointtype). For a synchronous call, the output trace points are CS, SR, SS, and CR; for an asynchronous call, the output trace points are CS, SR, and SS. |
| NO_BE_INFO | 1 << 3 | No begin/end flag. By default, information about the start and end of the trace task is printed. If this flag is set, information about the start and end of the trace task will not be printed.|
| DISABLE_LOG | 1 << 4 | Log association flag. If this flag is set, information about the trace task will not be printed. |
| FAILURE_TRIGGER | 1 << 5 | Failure trigger flag. This flag is reserved for future use. |
| D2D_TP_INFO | 1 << 6 | Device-to-device trace point flag. It is a subset of **TP_INFO**. If this flag is set, trace points are added only for call chain tracing between devices.|
## HiTraceTracepointType
Enumerates trace point types.
**System capability**: SystemCapability.HiviewDFX.HiTrace
| Name| Default Value| Description|
| -------- | -------- | -------- |
| CS | 0 | Client Send|
| CR | 1 | Client Receive|
| SS | 2 | Server Send|
| SR | 3 | Server Receive|
| GENERAL | 4 | General|
| CS | 0 | Client Send (CS) trace point. |
| CR | 1 | Client Receive (CS) trace point. |
| SS | 2 | Server Send (SS) trace point. |
| SR | 3 | Server Receive (SR) trace point. |
| GENERAL | 4 | General trace points except CS, CR, SS, and SR.|
## HiTraceCommunicationMode
Enumerates communication modes.
**System capability**: SystemCapability.HiviewDFX.HiTrace
| Name| Default Value| Description|
| -------- | -------- | -------- |
| DEFAULT | 0 | Default mode|
| THREAD | 1 | Inter-thread communication|
| PROCESS | 2 | Inter-process communication|
| DEVICE | 3 | Inter-device communication|
| DEFAULT | 0 | Default communication mode. |
| THREAD | 1 | Inter-thread communication. |
| PROCESS | 2 | Inter-process communication. |
| DEVICE | 3 | Inter-device communication. |
## HiTraceId
Defines a **HiTraceId** object.
**System capability**: SystemCapability.HiviewDFX.HiTrace
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| chainId | bigint | Yes| Call chain ID.|
| spanId | number | No| Span ID.|
| parentSpanId | number | No| Parent span ID.|
| chainId | bigint | Yes| Call chain ID. |
| spanId | number | No| Span ID. |
| parentSpanId | number | No| Parent span ID. |
| flags | number | No| Trace flag combination.|
## hiTraceChain.begin
......@@ -68,6 +73,8 @@ begin(name: string, flags: number = HiTraceFlag.DEFAULT): HiTraceId
Starts call chain tracing. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Parameters**
| Name| Type| Mandatory| Description|
......@@ -93,6 +100,8 @@ end(id: HiTraceId): void
Stops call chain tracing. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Parameters**
| Name| Type| Mandatory| Description|
......@@ -113,6 +122,8 @@ getId(): HiTraceId
Obtains the trace ID. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Return value**
| Type| Description|
......@@ -133,6 +144,8 @@ setId(id: HiTraceId): void
Sets a trace ID. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Parameters**
| Name| Type| Mandatory| Description|
......@@ -153,6 +166,8 @@ clearId(): void
Clears the trace ID. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Example**
```
......@@ -167,6 +182,8 @@ createSpan(): HiTraceId
Creates a trace span. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Return value**
| Type| Description|
......@@ -187,6 +204,8 @@ tracepoint(mode: HiTraceCommunicationMode, type: HiTraceTracepointType, id: HiTr
Triggers a trace point. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Parameters**
| Name| Type| Mandatory| Description|
......@@ -210,6 +229,8 @@ isValid(id: HiTraceId): boolean
Checks whether a **HiTraceId** instance is valid. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Parameters**
| Name| Type| Mandatory| Description|
......@@ -235,6 +256,8 @@ isFlagEnabled(id: HiTraceId, flag: HiTraceFlag): boolean
Checks whether the specified trace flag in the **HiTraceId** instance is enabled. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Parameters**
| Name| Type| Mandatory| Description|
......@@ -262,6 +285,8 @@ enableFlag(id: HiTraceId, flag: HiTraceFlag): void
Enables the specified trace flag in the **HiTraceId** instance. This API works in synchronous manner.
**System capability**: SystemCapability.HiviewDFX.HiTrace
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......
......@@ -37,8 +37,8 @@ httpRequest.request(
extraData: {
"data": "data to send",
},
connectTimeout: 60000, // Optional. The default value is **60000**, in ms.
readTimeout: 60000, // Optional. The default value is **60000**, in ms.
connectTimeout: 60000, // Optional. The default value is 60000, in ms.
readTimeout: 60000, // Optional. The default value is 60000, in ms.
},(err, data) => {
if (!err) {
// data.result contains the HTTP response. It is up to you whether to parse the content.
......@@ -60,7 +60,7 @@ httpRequest.request(
createHttp\(\): HttpRequest
Creates an HTTP request. You can use this API to initiate or destroy an HTTP request, or enable or disable listening for HTTP Response Header events. An HttpRequest object corresponds to an HTTP request. To initiate multiple HTTP requests, you must create an HttpRequest object for each HTTP request.
Creates an HTTP request. You can use this API to initiate or destroy an HTTP request, or enable or disable listening for HTTP Response Header events. An HttpRequest object corresponds to an HTTP request. To initiate multiple HTTP requests, you must create an **HttpRequest** object for each HTTP request.
**System capability**: SystemCapability.Communication.NetStack
......@@ -68,7 +68,7 @@ Creates an HTTP request. You can use this API to initiate or destroy an HTTP req
| Type | Description |
| :---------- | :----------------------------------------------------------- |
| HttpRequest | An **HttpRequest **object, which contains the **request**, **destroy**, **on**, or **off** method.|
| HttpRequest | An **HttpRequest** object, which contains the **request**, **destroy**, **on**, or **off** method.|
**Example**
......@@ -143,14 +143,14 @@ httpRequest.request("EXAMPLE_URL",
},
readTimeout: 60000,
connectTimeout: 60000
},(err, data) => {
}, (err, data) => {
if (!err) {
console.info('Result:' + data.result);
console.info('code:' + data.responseCode);
console.info('header:' + data.header);
console.info('cookies:' + data.cookies); // 8+
console.info('header['Content-Type']:' + data.header['Content-Type']);
console.info('header['Status-Line']:' + data.header['Status-Line']);
console.info('header.Content-Type:' + data.header['Content-Type']);
console.info('header.Status-Line:' + data.header['Status-Line']);
console.info('header.Date:' + data.header.Date);
console.info('header.Server:' + data.header.Server);
} else {
......@@ -200,8 +200,8 @@ promise.then((value) => {
console.info('code:' + value.responseCode);
console.info('header:' + value.header);
console.info('cookies:' + value.cookies); // 8+
console.info('header['Content-Type']:' + value.header['Content-Type']);
console.info('header['Status-Line']:' + value.header['Status-Line']);
console.info('header.Content-Type:' + value.header['Content-Type']);
console.info('header.Status-Line:' + value.header['Status-Line']);
console.info('header.Date:' + value.header.Date);
console.info('header.Server:' + value.header.Server);
}).catch((err) => {
......
......@@ -10,7 +10,7 @@ This subsystem offers various media services covering audio and video, which pro
- Audio playback ([AudioPlayer](#audioplayer))
- Video playback ([VideoPlayer](#videoplayer8))
- Audio recording ([AudioRecorder](#audiorecorder))
- Video recording ([VideoRecorder](#VideoRecorder<sup>8+</sup>))
- Video recording ([VideoRecorder](#videoRecorder9))
The following capabilities will be provided in later versions: data source audio/video playback, audio/video encoding and decoding, container encapsulation and decapsulation, and media capability query.
......@@ -125,9 +125,9 @@ Creates an **AudioRecorder** instance to control audio recording.
let audiorecorder = media.createAudioRecorder();
```
## media.createVideoRecorder<sup>8+</sup>
## media.createVideoRecorder<sup>9+</sup>
createVideoRecorder(callback: AsyncCallback\<[VideoRecorder](#videorecorder8)>): void
createVideoRecorder(callback: AsyncCallback\<[VideoRecorder](#videorecorder9)>): void
Creates a **VideoRecorder** instance in asynchronous mode. This API uses a callback to return the result.
......@@ -137,7 +137,7 @@ Creates a **VideoRecorder** instance in asynchronous mode. This API uses a callb
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------- | ---- | ------------------------------ |
| callback | AsyncCallback<[VideoRecorder](#videorecorder8)> | Yes | Callback used to return the **VideoRecorder** instance created.|
| callback | AsyncCallback<[VideoRecorder](#videorecorder9)> | Yes | Callback used to return the **VideoRecorder** instance created.|
**Example**
......@@ -154,9 +154,9 @@ media.createVideoRecorder((error, video) => {
});
```
## media.createVideoRecorder<sup>8+</sup>
## media.createVideoRecorder<sup>9+</sup>
createVideoRecorder(): Promise<[VideoRecorder](#videorecorder8)>
createVideoRecorder(): Promise<[VideoRecorder](#videorecorder9)>
Creates a **VideoRecorder** instance in asynchronous mode. This API uses a promise to return the result.
......@@ -166,7 +166,7 @@ Creates a **VideoRecorder** instance in asynchronous mode. This API uses a promi
| Type | Description |
| ----------------------------------------- | ----------------------------------- |
| Promise<[VideoRecorder](#videorecorder8)> | Promise used to return the **VideoRecorder** instance created.|
| Promise<[VideoRecorder](#videorecorder9)> | Promise used to return the **VideoRecorder** instance created.|
**Example**
......@@ -229,15 +229,15 @@ Enumerates the codec MIME types.
**System capability**: SystemCapability.Multimedia.Media.Core
| Name | Value | Description |
| ------------ | --------------------- | ------------------------------------------------------------ |
| VIDEO_H263 | 'video/h263' | Video in H.263 format.|
| VIDEO_AVC | 'video/avc' | Video in AVC format.|
| VIDEO_MPEG2 | 'video/mpeg2' | Video in MPEG-2 format.|
| VIDEO_MPEG4 | 'video/mp4v-es' | Video in MPEG-4 format.|
| VIDEO_VP8 | 'video/x-vnd.on2.vp8' | Video in VP8 format.|
| ------------ | --------------------- | ------------------------ |
| VIDEO_H263 | 'video/h263' | Video in H.263 format. |
| VIDEO_AVC | 'video/avc' | Video in AVC format. |
| VIDEO_MPEG2 | 'video/mpeg2' | Video in MPEG-2 format. |
| VIDEO_MPEG4 | 'video/mp4v-es' | Video in MPEG-4 format. |
| VIDEO_VP8 | 'video/x-vnd.on2.vp8' | Video in VP8 format. |
| AUDIO_AAC | "audio/mp4a-latm" | Audio in MP4A-LATM format.|
| AUDIO_VORBIS | 'audio/vorbis' | Audio in Vorbis format.|
| AUDIO_FLAC | 'audio/flac' | Audio in FLAC format.|
| AUDIO_VORBIS | 'audio/vorbis' | Audio in Vorbis format. |
| AUDIO_FLAC | 'audio/flac' | Audio in FLAC format. |
## MediaDescriptionKey<sup>8+</sup>
......@@ -273,7 +273,7 @@ Enumerates the buffering event types.
## AudioPlayer
Provides methods to manage and play audio. Before calling a method of **AudioPlayer**, you must use [createAudioPlayer()](#mediacreateaudioplayer) to create an **AudioPlayer** instance.
Provides APIs to manage and play audio. Before calling an API of **AudioPlayer**, you must use [createAudioPlayer()](#mediacreateaudioplayer) to create an **AudioPlayer** instance.
For details about the audio playback demo, see [Audio Playback Development](../../media/audio-playback.md).
......@@ -283,7 +283,7 @@ For details about the audio playback demo, see [Audio Playback Development](../.
| Name | Type | Readable| Writable| Description |
| ----------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ |
| src | string | Yes | Yes | Audio media URI. The mainstream audio formats (MPEG-4, AAC, MPEG-3, OGG, and WAV) are supported.<br>**Example of supported URIs**:<br>1. FD playback: fd://xx<br>![en-us_image_0000001164217678](figures/en-us_image_url.png)<br>2. HTTP network playback: http://xx<br>3. HLS network playback path (under development)<br>**Note**:<br>To use media materials, you must declare the read permission. Otherwise, the media materials cannot be played properly.|
| src | string | Yes | Yes | Audio media URI. The mainstream audio formats (MPEG-4, AAC, MPEG-3, OGG, and WAV) are supported.<br>**Example of supported URIs**:<br>1. FD playback: fd://xx<br>![](figures/en_image_url.png)<br>2. HTTP network playback: http://xx<br>3. HLS network playback path (under development)<br>**Note**:<br>To use media materials, you must declare the read permission. Otherwise, the media materials cannot be played properly.|
| loop | boolean | Yes | Yes | Whether to loop audio playback. The value **true** means to loop audio playback, and **false** means the opposite. |
| currentTime | number | Yes | No | Current audio playback position. |
| duration | number | Yes | No | Audio duration. |
......@@ -293,7 +293,7 @@ For details about the audio playback demo, see [Audio Playback Development](../.
play(): void
Starts to play audio resources. This method can be called only after the [dataLoad](#on('play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeChange')) event is triggered.
Starts to play audio resources. This API can be called only after the [dataLoad](#audioplayer_on) event is triggered.
**System capability**: SystemCapability.Multimedia.Media.AudioPlayer
......@@ -424,7 +424,7 @@ audioPlayer = undefined;
### getTrackDescription<sup>8+</sup><a name=audioplayer_gettrackdescription1></a>
getTrackDescription(callback: AsyncCallback<Array<[MediaDescription](#mediadescription8)>>): void
getTrackDescription(callback: AsyncCallback<Array\<MediaDescription>>): void
Obtains the audio track information. This API uses a callback to return the result.
......@@ -460,7 +460,7 @@ audioPlayer.getTrackDescription((error, arrlist) => {
### getTrackDescription<sup>8+</sup><a name=audioplayer_gettrackdescription2></a>
getTrackDescription(): Promise<Array<[MediaDescription](#mediadescription8)>>
getTrackDescription(): Promise<Array\<MediaDescription>>
Obtains the audio track information. This API uses a promise to return the result.
......@@ -512,9 +512,9 @@ Subscribes to the audio buffering update event.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| -------- | -------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of the event to subscribe to, which is 'bufferingUpdate' in this example. |
| callback | (infoType: [BufferingInfoType](#bufferinginfotype8), value: number) => void | Yes | Callback invoked when the event is triggered.<br>When [BufferingInfoType](#bufferinginfotype8) is set to **BUFFERING_PERCENT** or **CACHED_DURATION**, **value** is valid. Otherwise, **value** is fixed at **0**.|
| callback | function | Yes | Callback invoked when the event is triggered.<br>When [BufferingInfoType](#bufferinginfotype8) is set to **BUFFERING_PERCENT** or **CACHED_DURATION**, **value** is valid. Otherwise, **value** is fixed at **0**.|
**Example**
......@@ -525,7 +525,7 @@ audioPlayer.on('bufferingUpdate', (infoType, value) => {
});
```
### on('play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeChange')
### on('play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeChange')<a name = audioplayer_on></a>
on(type: 'play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeChange', callback: () => void): void
......@@ -537,7 +537,7 @@ Subscribes to the audio playback events.
| Name | Type | Mandatory| Description |
| -------- | ---------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of the event to subscribe to. The following events are supported: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange'<br>- The 'play' event is triggered when the [play()](#play) method is called and audio playback starts.<br>- The 'pause' event is triggered when the [pause()](#pause) method is called and audio playback is paused.<br>- The 'stop' event is triggered when the [stop()](#stop) method is called and audio playback stops.<br>- The 'reset' event is triggered when the [reset()](#reset7) method is called and audio playback is reset.<br>- The 'dataLoad' event is triggered when the audio data is loaded, that is, when the **src** attribute is configured.<br>- The 'finish' event is triggered when the audio playback is finished.<br>- The 'volumeChange' event is triggered when the [setVolume()](#setvolume) method is called and the playback volume is changed.|
| type | string | Yes | Type of the event to subscribe to. The following events are supported: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange'<br>- The 'play' event is triggered when the [play()](#audioplayer_play) API is called and audio playback starts.<br>- The 'pause' event is triggered when the [pause()](#audioplayer_pause) API is called and audio playback is paused.<br>- The 'stop' event is triggered when the [stop()](#audioplayer_stop) API is called and audio playback stops.<br>- The 'reset' event is triggered when the [reset()](#audioplayer_reset) API is called and audio playback is reset.<br>- The 'dataLoad' event is triggered when the audio data is loaded, that is, when the **src** attribute is configured.<br>- The 'finish' event is triggered when the audio playback is finished.<br>- The 'volumeChange' event is triggered when the [setVolume()](#audioplayer_setvolume) API is called and the playback volume is changed.|
| callback | () => void | Yes | Callback invoked when the event is triggered. |
**Example**
......@@ -550,7 +550,7 @@ audioPlayer.on('dataLoad', () => { // Set the 'dataLoad' event callba
});
audioPlayer.on('play', () => { // Set the 'play' event callback.
console.info('audio play success');
audioPlayer.seek(30000); // Call the seek() method and trigger the 'timeUpdate' event callback.
audioPlayer.seek(30000); // Call the seek() API and trigger the 'timeUpdate' event callback.
});
audioPlayer.on('pause', () => { // Set the 'pause' event callback.
console.info('audio pause success');
......@@ -609,7 +609,7 @@ Subscribes to the 'timeUpdate' event.
| Name | Type | Mandatory| Description |
| -------- | ----------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of the event to subscribe to, which is 'timeUpdate' in this method.<br>The 'timeUpdate' event is triggered when the [seek()](#seek) method is called.|
| type | string | Yes | Type of the event to subscribe to, which is 'timeUpdate' in this API.<br>The 'timeUpdate' event is triggered when the [seek()](#audioplayer_seek) API is called.|
| callback | Callback\<number> | Yes | Callback invoked when the event is triggered. The input parameter of the callback is the time when the seek operation is successful. |
**Example**
......@@ -637,7 +637,7 @@ Subscribes to the audio playback error event.
| Name | Type | Mandatory| Description |
| -------- | ------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of the event to subscribe to, which is 'error' in this method.<br>The 'error' event is triggered when an error occurs during audio playback.|
| type | string | Yes | Type of the event to subscribe to, which is 'error' in this API.<br>The 'error' event is triggered when an error occurs during audio playback.|
| callback | ErrorCallback | Yes | Callback invoked when the event is triggered. |
**Example**
......@@ -667,7 +667,7 @@ Enumerates the audio playback states. You can obtain the state through the **sta
## VideoPlayer<sup>8+</sup>
Provides methods to manage and play video. Before calling a method of the **VideoPlayer** class, you must call [createVideoPlayer()](#media.createvideoplayer8) to create a [VideoPlayer](#videoplayer8) instance.
Provides APIs to manage and play video. Before calling an API of the **VideoPlayer** class, you must call [createVideoPlayer()](#mediacreatevideoplayer8) to create a [VideoPlayer](#videoplayer8) instance.
For details about the video playback demo, see [Video Playback Development](../../media/video-playback.md).
......@@ -677,7 +677,7 @@ For details about the video playback demo, see [Video Playback Development](../.
| Name | Type | Readable| Writable| Description |
| ------------------------ | ---------------------------------- | ---- | ---- | ------------------------------------------------------------ |
| url<sup>8+</sup> | string | Yes | Yes | Video media URL. The mainstream video formats (MPEG-4, MPEG-TS, WebM, and MKV) are supported.<br>**Example of supported URIs**:<br>1. FD playback: fd://xx<br>![en-us_image_0000001164217678](figures/en-us_image_url.png)<br>2. HTTP network playback: http://xx<br>3. HLS network playback path (under development)<br>**Note**:<br>To use media materials, you must declare the read permission. Otherwise, the media materials cannot be played properly.|
| url<sup>8+</sup> | string | Yes | Yes | Video media URL. The mainstream video formats (MPEG-4, MPEG-TS, WebM, and MKV) are supported.<br>**Example of supported URIs**:<br>1. FD playback: fd://xx<br>![](figures/en_image_url.png)<br>2. HTTP network playback: http://xx<br>3. HLS network playback path (under development)<br>**Note**:<br>To use media materials, you must declare the read permission. Otherwise, the media materials cannot be played properly.|
| loop<sup>8+</sup> | boolean | Yes | Yes | Whether to loop video playback. The value **true** means to loop video playback, and **false** means the opposite. |
| currentTime<sup>8+</sup> | number | Yes | No | Current video playback position. |
| duration<sup>8+</sup> | number | Yes | No | Video duration. The value **-1** indicates the live streaming mode. |
......@@ -1054,10 +1054,10 @@ Seeks to the specified playback position. This API uses a callback to return the
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------- | ---- | ---------------------------------------- |
| timeMs | number | Yes | Position to seek to, in milliseconds. |
| mode | SeekMode | Yes | Seek mode. For details, see [SeekMode](#seekmode8).|
| callback | function | Yes | Callback used to return the result. |
| -------- | ---------------------- | ---- | ------------------------------ |
| timeMs | number | Yes | Position to seek to, in milliseconds.|
| mode | [SeekMode](#seekmode8) | Yes | Seek mode. |
| callback | function | Yes | Callback used to return the result.|
**Example**
......@@ -1082,9 +1082,9 @@ Seeks to the specified playback position. If **mode** is not specified, the next
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | -------- | ---- | -------------------------------------- |
| timeMs | number | Yes | Position to seek to, in milliseconds. |
| mode | SeekMode | No | Seek mode. For details, see [SeekMode](#seekmode8).|
| ------ | ---------------------- | ---- | ------------------------------ |
| timeMs | number | Yes | Position to seek to, in milliseconds.|
| mode | [SeekMode](#seekmode8) | No | Seek mode. |
**Return value**
......@@ -1227,7 +1227,7 @@ await videoPlayer.release().then() => {
### getTrackDescription<sup>8+</sup>
getTrackDescription(callback: AsyncCallback<Array<[MediaDescription](#mediadescription8)>>): void
getTrackDescription(callback: AsyncCallback<Array\<MediaDescription>>): void
Obtains the video track information. This API uses a callback to return the result.
......@@ -1236,8 +1236,8 @@ Obtains the video track information. This API uses a callback to return the resu
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------- | ---- | -------------------------- |
| callback | function | Yes | Callback used to return the video track information obtained.|
| -------- | ------------------------------------------------------------ | ---- | -------------------------- |
| callback | AsyncCallback<Array<[MediaDescription](#mediadescription8)>> | Yes | Callback used to return the video track information obtained.|
**Example**
......@@ -1263,7 +1263,7 @@ videoPlayer.getTrackDescription((error, arrlist) => {
### getTrackDescription<sup>8+</sup>
getTrackDescription(): Promise<Array<[MediaDescription](#mediadescription8)>>
getTrackDescription(): Promise<Array\<MediaDescription>>
Obtains the video track information. This API uses a promise to return the result.
......@@ -1346,6 +1346,12 @@ Sets the video playback speed. This API uses a promise to return the result.
| ------ | ------ | ---- | ---------------------------------------------------------- |
| speed | number | Yes | Video playback speed. For details, see [PlaybackSpeed](#playbackspeed8).|
**Return value**
| Type | Description |
| ---------------- | ------------------------- |
| Promise\<number> | Promise used to return the result.|
**Example**
```js
......@@ -1418,9 +1424,9 @@ Subscribes to the frame rendering start event.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------- | ---- | ------------------------------------------------------------ |
| -------- | --------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of the event to subscribe to, which is 'startRenderFrame' in this example.|
| callback | function | Yes | Callback invoked when the event is triggered. |
| callback | Callback\<void> | Yes | Callback invoked when the event is triggered. |
**Example**
......@@ -1465,9 +1471,9 @@ Subscribes to the video playback error event.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of the event to subscribe to, which is 'error' in this method.<br>The 'error' event is triggered when an error occurs during video playback.|
| callback | function | Yes | Callback invoked when the event is triggered. |
| -------- | ------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of the event to subscribe to, which is 'error' in this API.<br>The 'error' event is triggered when an error occurs during video playback.|
| callback | ErrorCallback | Yes | Callback invoked when the event is triggered. |
**Example**
......@@ -1497,7 +1503,7 @@ Enumerates the video playback states. You can obtain the state through the **sta
## SeekMode<sup>8+</sup>
Enumerates the video playback seek modes, which can be passed in the **seek** method.
Enumerates the video playback seek modes, which can be passed in the **seek** API.
**System capability**: SystemCapability.Multimedia.Media.Core
......@@ -1508,7 +1514,7 @@ Enumerates the video playback seek modes, which can be passed in the **seek** me
## PlaybackSpeed<sup>8+</sup>
Enumerates the video playback speeds, which can be passed in the **setSpeed** method.
Enumerates the video playback speeds, which can be passed in the **setSpeed** API.
**System capability**: SystemCapability.Multimedia.Media.VideoPlayer
......@@ -1555,7 +1561,7 @@ audioPlayer.getTrackDescription((error, arrlist) => {
## AudioRecorder
Implements audio recording. Before calling a method of the **AudioRecorder** class, you must call [createAudioRecorder()](#media.createaudiorecorder) to create an [AudioRecorder](#audiorecorder) instance.
Implements audio recording. Before calling an API of the **AudioRecorder** class, you must call [createAudioRecorder()](#mediacreateaudiorecorder) to create an [AudioRecorder](#audiorecorder) instance.
For details about the audio recording demo, see [Audio Recording Development](../../media/audio-recorder.md).
......@@ -1598,7 +1604,7 @@ audioRecorder.prepare(audioRecorderConfig);
start(): void
Starts audio recording. This method can be called only after the [prepare](#audiorecorder_on) event is triggered.
Starts audio recording. This API can be called only after the [prepare](#audiorecorder_on) event is triggered.
**System capability**: SystemCapability.Multimedia.Media.AudioRecorder
......@@ -1615,7 +1621,7 @@ audioRecorder.start();
pause():void
Pauses audio recording. This method can be called only after the [start](#audiorecorder_on) event is triggered.
Pauses audio recording. This API can be called only after the [start](#audiorecorder_on) event is triggered.
**System capability**: SystemCapability.Multimedia.Media.AudioRecorder
......@@ -1632,7 +1638,7 @@ audioRecorder.pause();
resume():void
Resumes audio recording. This method can be called only after the [pause](#audiorecorder_on) event is triggered.
Resumes audio recording. This API can be called only after the [pause](#audiorecorder_on) event is triggered.
**System capability**: SystemCapability.Multimedia.Media.AudioRecorder
......@@ -1711,7 +1717,7 @@ Subscribes to the audio recording events.
| Name | Type | Mandatory| Description |
| -------- | -------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of the event to subscribe to. The following events are supported: 'prepare'\|'start'\| 'pause' \| 'resume' \|'stop'\|'release'\|'reset'<br>- The 'prepare' event is triggered when the [prepare](#audiorecorder_prepare) method is called and the audio recording parameters are set.<br>- The 'start' event is triggered when the [start](#audiorecorder_start) method is called and audio recording starts.<br>- The 'pause' event is triggered when the [pause](#audiorecorder_pause) method is called and audio recording is paused.<br>- The 'resume' event is triggered when the [resume](#audiorecorder_resume) method is called and audio recording is resumed.<br>- The 'stop' event is triggered when the [stop](#audiorecorder_stop) method is called and audio recording stops.<br>- The 'release' event is triggered when the [release](#audiorecorder_release) method is called and the recording resource is released.<br>- The 'reset' event is triggered when the [reset](#audiorecorder_reset) method is called and audio recording is reset.|
| type | string | Yes | Type of the event to subscribe to. The following events are supported: 'prepare'\|'start'\| 'pause' \| 'resume' \|'stop'\|'release'\|'reset'<br>- The 'prepare' event is triggered when the [prepare](#audiorecorder_prepare) API is called and the audio recording parameters are set.<br>- The 'start' event is triggered when the [start](#audiorecorder_start) API is called and audio recording starts.<br>- The 'pause' event is triggered when the [pause](#audiorecorder_pause) API is called and audio recording is paused.<br>- The 'resume' event is triggered when the [resume](#audiorecorder_resume) API is called and audio recording is resumed.<br>- The 'stop' event is triggered when the [stop](#audiorecorder_stop) API is called and audio recording stops.<br>- The 'release' event is triggered when the [release](#audiorecorder_release) API is called and the recording resource is released.<br>- The 'reset' event is triggered when the [reset](#audiorecorder_reset) API is called and audio recording is reset.|
| callback | ()=>void | Yes | Callback invoked when the event is triggered. |
**Example**
......@@ -1769,7 +1775,7 @@ Subscribes to the audio recording error event.
| Name | Type | Mandatory| Description |
| -------- | ------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of the event to subscribe to, which is 'error' in this method.<br>The 'error' event is triggered when an error occurs during audio recording.|
| type | string | Yes | Type of the event to subscribe to, which is 'error' in this API.<br>The 'error' event is triggered when an error occurs during audio recording.|
| callback | ErrorCallback | Yes | Callback invoked when the event is triggered. |
**Example**
......@@ -1796,9 +1802,9 @@ Describes audio recording configurations.
| audioSampleRate | number | No | Audio sampling rate. The default value is **48000**. |
| numberOfChannels | number | No | Number of audio channels. The default value is **2**. |
| format | [AudioOutputFormat](#audiooutputformat) | No | Audio output format. The default value is **MPEG_4**. |
| location<sup>8+</sup> | [Location](#location8) | No | Geographical location of the recorded audio. |
| location | [Location](#location) | No | Geographical location of the recorded audio. |
| uri | string | Yes | Audio output URI. Supported: fd://xx&nbsp;(fd&nbsp;number)<br>![en-us_image_0000001164217678](figures/en-us_image_url.png)<br>The file must be created by the caller and granted with proper permissions.|
| audioEncoderMime | [CodecMimeType](#CodecMimeType8) | No | Audio encoding format.|
| audioEncoderMime | [CodecMimeType](#codecmimetype8) | No | Audio encoding format. |
## AudioEncoder
......@@ -1830,25 +1836,27 @@ Enumerates the audio output formats.
| AMR_WB | 4 | AMR_WB.<br>This API is merely defined in OpenHarmony 3.1 Release and cannot be used currently. It can be used in OpenHarmony 3.1 MR.|
| AAC_ADTS | 6 | Audio Data Transport Stream (ADTS), which is a transport stream format of AAC-based audio.|
## VideoRecorder<sup>8+</sup>
## VideoRecorder<sup>9+</sup>
Implements video recording. Before calling a method of the **VideoRecorder** class, you must call [createVideoRecorder()](#media.createvideorecorder8) to create a [VideoRecorder](#videorecorder8) instance.
Implements video recording. Before calling an API of the **VideoRecorder** class, you must call [createVideoRecorder()](#mediacreatevideorecorder9) to create a [VideoRecorder](#videorecorder9) instance.
For details about the video recording demo, see [Video Recording Development](../../media/video-recorder.md).
### Attributes
**System capability**: SystemCapability.Multimedia.Media.VideoRecorder
| Name | Type | Readable| Writable| Description |
| ------------------ | ------------------------------------- | ---- | ---- | ---------------- |
| state<sup>8+</sup> | [VideoRecordState](#videorecordstate) | Yes | No | Video recording state.|
| ------------------ | -------------------------------------- | ---- | ---- | ---------------- |
| state<sup>8+</sup> | [VideoRecordState](#videorecordstate9) | Yes | No | Video recording state.|
### prepare<sup>8+</sup><a name=videorecorder_prepare1></a>
### prepare<sup>9+</sup><a name=videorecorder_prepare1></a>
prepare(config: VideoRecorderConfig, callback: AsyncCallback\<void>): void;
Sets video recording parameters in asynchronous mode. This API uses a callback to return the result.
**Required permissions:** ohos.permission.MICROPHONE ohos.permission.CAMERA
**Required permissions:** ohos.permission.MICROPHONE and ohos.permission.CAMERA
**System capability**: SystemCapability.Multimedia.Media.VideoRecorder
......@@ -1856,7 +1864,7 @@ Sets video recording parameters in asynchronous mode. This API uses a callback t
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------------- | ---- | ----------------------------------- |
| config | [VideoRecorderConfig](#videorecorderconfig8) | Yes | Video recording parameters to set. |
| config | [VideoRecorderConfig](#videorecorderconfig9) | Yes | Video recording parameters to set. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example**
......@@ -1910,13 +1918,13 @@ media.createVideoRecorder((err, recorder) => {
});
```
### prepare<sup>8+</sup><a name=videorecorder_prepare2></a>
### prepare<sup>9+</sup><a name=videorecorder_prepare2></a>
prepare(config: VideoRecorderConfig): Promise\<void>;
Sets video recording parameters in asynchronous mode. This API uses a promise to return the result.
**Required permissions:** ohos.permission.MICROPHONE ohos.permission.CAMERA
**Required permissions:** ohos.permission.MICROPHONE and ohos.permission.CAMERA
**System capability**: SystemCapability.Multimedia.Media.VideoRecorder
......@@ -1924,7 +1932,7 @@ Sets video recording parameters in asynchronous mode. This API uses a promise to
| Name| Type | Mandatory| Description |
| ------ | -------------------------------------------- | ---- | ------------------------ |
| config | [VideoRecorderConfig](#videorecorderconfig8) | Yes | Video recording parameters to set.|
| config | [VideoRecorderConfig](#videorecorderconfig9) | Yes | Video recording parameters to set.|
**Return value**
......@@ -1981,7 +1989,7 @@ await videoRecorder.prepare(videoConfig).then(() => {
});
```
### getInputSurface<sup>8+</sup>
### getInputSurface<sup>9+</sup>
getInputSurface(callback: AsyncCallback\<string>): void;
......@@ -1989,7 +1997,7 @@ Obtains the surface required for recording in asynchronous mode. This surface is
Note that the video data must carry the timestamp (in ns) and buffer size, and the start time of the timestamp is based on the system startup time.
This method can be called only after [prepare()](#videorecorder_prepare1) is called.
This API can be called only after [prepare()](#videorecorder_prepare1) is called.
**System capability**: SystemCapability.Multimedia.Media.VideoRecorder
......@@ -2014,7 +2022,7 @@ videoRecorder.getInputSurface((err, surfaceId) => {
});
```
### getInputSurface<sup>8+</sup>
### getInputSurface<sup>9+</sup>
getInputSurface(): Promise\<string>;
......@@ -2022,7 +2030,7 @@ getInputSurface(): Promise\<string>;
Note that the video data must carry the timestamp (in ns) and buffer size, and the start time of the timestamp is based on the system startup time.
This method can be called only after [prepare()](#videorecorder_prepare1) is called.
This API can be called only after [prepare()](#videorecorder_prepare1) is called.
**System capability**: SystemCapability.Multimedia.Media.VideoRecorder
......@@ -2047,13 +2055,13 @@ await videoRecorder.getInputSurface().then((surfaceId) => {
});
```
### start<sup>8+</sup><a name=videorecorder_start1></a>
### start<sup>9+</sup><a name=videorecorder_start1></a>
start(callback: AsyncCallback\<void>): void;
Starts video recording in asynchronous mode. This API uses a callback to return the result.
This method can be called only after [prepare()](#videorecorder_prepare1) and [getInputSurface()](#getinputsurface8) are called, because the data source must pass data to the surface first.
This API can be called only after [prepare()](#videorecorder_prepare1) and [getInputSurface()](#getinputsurface8) are called, because the data source must pass data to the surface first.
**System capability**: SystemCapability.Multimedia.Media.VideoRecorder
......@@ -2076,13 +2084,13 @@ videoRecorder.start((err) => {
});
```
### start<sup>8+</sup><a name=videorecorder_start2></a>
### start<sup>9+</sup><a name=videorecorder_start2></a>
start(): Promise\<void>;
Starts video recording in asynchronous mode. This API uses a promise to return the result.
This method can be called only after [prepare()](#videorecorder_prepare1) and [getInputSurface()](#getinputsurface8) are called, because the data source must pass data to the surface first.
This API can be called only after [prepare()](#videorecorder_prepare1) and [getInputSurface()](#getinputsurface8) are called, because the data source must pass data to the surface first.
**System capability**: SystemCapability.Multimedia.Media.VideoRecorder
......@@ -2105,13 +2113,13 @@ await videoRecorder.start().then(() => {
});
```
### pause<sup>8+</sup><a name=videorecorder_pause1></a>
### pause<sup>9+</sup><a name=videorecorder_pause1></a>
pause(callback: AsyncCallback\<void>): void;
Pauses video recording in asynchronous mode. This API uses a callback to return the result.
This method can be called only after [start()](#videorecorder_start1) is called. You can resume recording by calling [resume()](#videorecorder_resume1).
This API can be called only after [start()](#videorecorder_start1) is called. You can resume recording by calling [resume()](#videorecorder_resume1).
**System capability**: SystemCapability.Multimedia.Media.VideoRecorder
......@@ -2134,13 +2142,13 @@ videoRecorder.pause((err) => {
});
```
### pause<sup>8+</sup><a name=videorecorder_pause2></a>
### pause<sup>9+</sup><a name=videorecorder_pause2></a>
pause(): Promise\<void>;
Pauses video recording in asynchronous mode. This API uses a promise to return the result.
This method can be called only after [start()](#videorecorder_start1) is called. You can resume recording by calling [resume()](#videorecorder_resume1).
This API can be called only after [start()](#videorecorder_start1) is called. You can resume recording by calling [resume()](#videorecorder_resume1).
**System capability**: SystemCapability.Multimedia.Media.VideoRecorder
......@@ -2163,7 +2171,7 @@ await videoRecorder.pause().then(() => {
});
```
### resume<sup>8+</sup><a name=videorecorder_resume1></a>
### resume<sup>9+</sup><a name=videorecorder_resume1></a>
resume(callback: AsyncCallback\<void>): void;
......@@ -2190,7 +2198,7 @@ videoRecorder.resume((err) => {
});
```
### resume<sup>8+</sup><a name=videorecorder_resume2></a>
### resume<sup>9+</sup><a name=videorecorder_resume2></a>
resume(): Promise\<void>;
......@@ -2217,7 +2225,7 @@ await videoRecorder.resume().then(() => {
});
```
### stop<sup>8+</sup><a name=videorecorder_stop1></a>
### stop<sup>9+</sup><a name=videorecorder_stop1></a>
stop(callback: AsyncCallback\<void>): void;
......@@ -2246,7 +2254,7 @@ videoRecorder.stop((err) => {
});
```
### stop<sup>8+</sup><a name=videorecorder_stop2></a>
### stop<sup>9+</sup><a name=videorecorder_stop2></a>
stop(): Promise\<void>;
......@@ -2275,7 +2283,7 @@ await videoRecorder.stop().then(() => {
});
```
### release<sup>8+</sup><a name=videorecorder_release1></a>
### release<sup>9+</sup><a name=videorecorder_release1></a>
release(callback: AsyncCallback\<void>): void;
......@@ -2302,7 +2310,7 @@ videoRecorder.release((err) => {
});
```
### release<sup>8+</sup><a name=videorecorder_release2></a>
### release<sup>9+</sup><a name=videorecorder_release2></a>
release(): Promise\<void>;
......@@ -2329,7 +2337,7 @@ await videoRecorder.release().then(() => {
});
```
### reset<sup>8+</sup><a name=videorecorder_reset1></a>
### reset<sup>9+</sup><a name=videorecorder_reset1></a>
reset(callback: AsyncCallback\<void>): void;
......@@ -2358,7 +2366,7 @@ videoRecorder.reset((err) => {
});
```
### reset<sup>8+</sup><a name=videorecorder_reset2></a>
### reset<sup>9+</sup><a name=videorecorder_reset2></a>
reset(): Promise\<void>;
......@@ -2387,7 +2395,7 @@ await videoRecorder.reset().then(() => {
});
```
### on('error')<sup>8+</sup>
### on('error')<sup>9+</sup>
on(type: 'error', callback: ErrorCallback): void
......@@ -2399,7 +2407,7 @@ Subscribes to the video recording error event.
| Name | Type | Mandatory| Description |
| -------- | ------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of the event to subscribe to, which is 'error' in this method.<br>The 'error' event is triggered when an error occurs during video recording.|
| type | string | Yes | Type of the event to subscribe to, which is 'error' in this API.<br>The 'error' event is triggered when an error occurs during video recording.|
| callback | ErrorCallback | Yes | Callback invoked when the event is triggered. |
**Example**
......@@ -2413,7 +2421,7 @@ videoRecorder.on('error', (error) => { // Set the 'error' event call
// This event is reported when an error occurs during the retrieval of videoRecordState.
```
## VideoRecordState<sup>8+</sup>
## VideoRecordState<sup>9+</sup>
Enumerates the video recording states. You can obtain the state through the **state** attribute.
......@@ -2426,24 +2434,24 @@ Enumerates the video recording states. You can obtain the state through the **st
| playing | string | Video recording is in progress. |
| paused | string | Video recording is paused. |
| stopped | string | Video recording is stopped. |
| error | string | Video recording is in the error state. |
| error | string | Audio playback is in the error state. |
## VideoRecorderConfig<sup>8+</sup>
## VideoRecorderConfig<sup>9+</sup>
Describes the video recording parameters.
**System capability**: SystemCapability.Multimedia.Media.VideoRecorder
| Name | Type | Mandatory| Description |
| --------------- | ---------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| audioSourceType | [AudioSourceType](#audiosourcetype<sup>8+</sup>) | Yes | Type of the audio source for video recording. |
| videoSourceType | [VideoSourceType](#videosourcetype<sup>8+</sup>) | Yes | Type of the video source for video recording. |
| profile | [VideoRecorderProfile](#videorecorderprofile8) | Yes | Video recording profile. |
| --------------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ |
| audioSourceType | [AudioSourceType](#audiosourcetype9) | Yes | Type of the audio source for video recording. |
| videoSourceType | [VideoSourceType](#videosourcetype9) | Yes | Type of the video source for video recording. |
| profile | [VideoRecorderProfile](#videorecorderprofile9) | Yes | Video recording profile. |
| rotation | number | No | Rotation angle of the recorded video. |
| location | [Location](#location8) | No | Geographical location of the recorded video. |
| url | string | Yes | Video output URL. Supported: fd://xx&nbsp;(fd&nbsp;number)<br>![en-us_image_0000001164217678](figures/en-us_image_url.png) <br>The file must be created by the caller and granted with proper permissions.|
| location | [Location](#location) | No | Geographical location of the recorded video. |
| url | string | Yes | Video output URL. Supported: fd://xx&nbsp;(fd&nbsp;number)<br>![](figures/en-us_image_url.png) <br>The file must be created by the caller and granted with proper permissions.|
## AudioSourceType<sup>8+</sup>
## AudioSourceType<sup>9+</sup>
Enumerates the audio source types for video recording.
......@@ -2454,7 +2462,7 @@ Enumerates the audio source types for video recording.
| AUDIO_SOURCE_TYPE_DEFAULT | 0 | Default audio input source.|
| AUDIO_SOURCE_TYPE_MIC | 1 | Mic audio input source. |
## VideoSourceType<sup>8+</sup>
## VideoSourceType<sup>9+</sup>
Enumerates the video source types for video recording.
......@@ -2465,7 +2473,7 @@ Enumerates the video source types for video recording.
| VIDEO_SOURCE_TYPE_SURFACE_YUV | 0 | The input surface carries raw data.|
| VIDEO_SOURCE_TYPE_SURFACE_ES | 1 | The input surface carries ES data. |
## VideoRecorderProfile<sup>8+</sup>
## VideoRecorderProfile<sup>9+</sup>
Describes the video recording profile.
......@@ -2475,12 +2483,14 @@ Describes the video recording profile.
| ---------------- | -------------------------------------------- | ---- | ---------------- |
| audioBitrate | number | Yes | Audio encoding bit rate.|
| audioChannels | number | Yes | Number of audio channels.|
| audioCodec | [CodecMimeType](#CodecMimeType8) | Yes | Audio encoding format. |
| audioCodec | [CodecMimeType](#codecmimetype8) | Yes | Audio encoding format. |
| audioSampleRate | number | Yes | Audio sampling rate. |
| fileFormat | [ContainerFormatType](#containerformattype8) | Yes | Container format of a file.|
| videoBitrate | number | Yes | Video encoding bit rate.|
| videoCodec | [CodecMimeType](#CodecMimeType8) | Yes | Video encoding format. |
| videoFrameWidth | number | Yes | Width of the recorded video frame.|
| videoFrameHeight | number | Yes | Height of the recorded video frame.|
| videoFrameRate | number | Yes | Video frame rate. |
## ContainerFormatType<sup>8+</sup>
......@@ -2493,7 +2503,7 @@ Enumerates the container format types (CFTs).
| CFT_MPEG_4 | "mp4" | Video container format MP4.|
| CFT_MPEG_4A | "m4a" | Audio container format M4A.|
## Location<sup>8+</sup>
## Location
Describes the geographical location of the recorded video.
......
# Network Connection Management
> **NOTE**<br/>
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -17,7 +17,7 @@ getDefaultNet(callback: AsyncCallback\<NetHandle>): void
Obtains the default active data network. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Communication.NetManager.Core
......@@ -42,11 +42,11 @@ getDefaultNet(): Promise\<NetHandle>
Obtains the default active data network. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Communication.NetManager.Core
**Return value**
**Return Value**
| Type | Description |
| --------------------------------- | ------------------------------------- |
......@@ -91,7 +91,7 @@ Checks whether the default data network is activated. This API uses a promise to
**System capability**: SystemCapability.Communication.NetManager.Core
**Return value**
**Return Value**
| Type | Description |
| ----------------- | ----------------------------------------------- |
......@@ -111,7 +111,7 @@ getAllNets(callback: AsyncCallback&lt;Array&lt;NetHandle&gt;&gt;): void
Obtains the list of all active data networks. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Communication.NetManager.Core
......@@ -136,11 +136,11 @@ getAllNets(): Promise&lt;Array&lt;NetHandle&gt;&gt;
Obtains the list of all active data networks. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Communication.NetManager.Core
**Return value**
**Return Value**
| Type| Description|
| -------- | -------- |
| Promise&lt;Array&lt;[NetHandle](#nethandle)&gt;&gt; | Promise used to return the result.|
......@@ -157,9 +157,9 @@ connection.getAllNets().then(function (nets) {
getConnectionProperties(netHandle: NetHandle, callback: AsyncCallback\<ConnectionProperties>): void
Obtains connection properties of the network corresponding to the **netHandle**. This API uses an asynchronous callback to return the result.
Obtains connection properties of the network corresponding to given network handle. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Communication.NetManager.Core
......@@ -185,9 +185,9 @@ connection.getDefaultNet().then(function (netHandle) {
getConnectionProperties(netHandle: NetHandle): Promise\<ConnectionProperties>
Obtains connection properties of the network corresponding to the **netHandle**. This API uses a promise to return the result.
Obtains connection properties of the network corresponding to **netHandle**. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Communication.NetManager.Core
......@@ -197,7 +197,7 @@ Obtains connection properties of the network corresponding to the **netHandle**.
| --------- | ----------------------- | ---- | ---------------- |
| netHandle | [NetHandle](#nethandle) | Yes | Network handle.|
**Return value**
**Return Value**
| Type | Description |
| ------------------------------------------------------- | --------------------------------- |
......@@ -217,9 +217,9 @@ connection.getDefaultNet().then(function (netHandle) {
getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback\<NetCapabilities>): void
Obtains capability information of the network corresponding to the **netHandle**. This API uses an asynchronous callback to return the result.
Obtains capability information of the network corresponding to **netHandle**. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Communication.NetManager.Core
......@@ -245,9 +245,9 @@ connection.getDefaultNet().then(function (netHandle) {
getNetCapabilities(netHandle: NetHandle): Promise\<NetCapabilities>
Obtains capability information of the network corresponding to the **netHandle**. This API uses a promise to return the result.
Obtains capability information of the network corresponding to **netHandle**. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Communication.NetManager.Core
......@@ -257,7 +257,7 @@ Obtains capability information of the network corresponding to the **netHandle**
| --------- | ----------------------- | ---- | ---------------- |
| netHandle | [NetHandle](#nethandle) | Yes | Network handle.|
**Return value**
**Return Value**
| Type | Description |
| --------------------------------------------- | --------------------------------- |
......@@ -279,7 +279,7 @@ reportNetConnected(netHandle: NetHandle, callback: AsyncCallback&lt;void&gt;): v
Reports connection of the data network. This API uses an asynchronous callback to return the result.
**Required permissions** : ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET
**Permission required**: ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET
**System capability**: SystemCapability.Communication.NetManager.Core
......@@ -306,7 +306,7 @@ reportNetConnected(netHandle: NetHandle): Promise&lt;void&gt;
Reports connection of the data network. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET
**Permission required**: ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET
**System capability**: SystemCapability.Communication.NetManager.Core
......@@ -315,7 +315,7 @@ Reports connection of the data network. This API uses a promise to return the re
| -------- | -------- | -------- | -------- |
| netHandle | [NetHandle](#nethandle) | Yes| Handle of the data network. For details, see [NetHandle](#nethandle).|
**Return value**
**Return Value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
......@@ -337,7 +337,7 @@ reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback&lt;void&gt;)
Reports disconnection of the data network. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET
**Permission required**: ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET
**System capability**: SystemCapability.Communication.NetManager.Core
......@@ -364,7 +364,7 @@ reportNetDisconnected(netHandle: NetHandle): Promise&lt;void&gt;
Reports disconnection of the data network. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET
**Permission required**: ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET
**System capability**: SystemCapability.Communication.NetManager.Core
......@@ -373,7 +373,7 @@ Reports disconnection of the data network. This API uses a promise to return the
| -------- | -------- | -------- | -------- |
| netHandle | [NetHandle](#nethandle) | Yes| Handle of the data network. For details, see [NetHandle](#nethandle).|
**Return value**
**Return Value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
......@@ -394,7 +394,7 @@ getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>):
Resolves the host name by using the default network to obtain all IP addresses. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Communication.NetManager.Core
......@@ -402,7 +402,7 @@ Resolves the host name by using the default network to obtain all IP addresses.
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------- | ---- | ------------------ |
| host | string | Yes | Host name to resolve.|
| host | string | Yes | Host name to be resolved.|
| callback | AsyncCallback\<Array\<[NetAddress](#netaddress)>> | Yes | Callback used to return the result. |
**Example**
......@@ -421,7 +421,7 @@ getAddressesByName(host: string): Promise\<Array\<NetAddress>>
Resolves the host name by using the default network to obtain all IP addresses. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Communication.NetManager.Core
......@@ -429,13 +429,13 @@ Resolves the host name by using the default network to obtain all IP addresses.
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------ |
| host | string | Yes | Host name to resolve.|
| host | string | Yes | Host name to be resolved.|
**Return value**
**Return Value**
| Type | Description |
| ------------------------------------------- | ----------------------------- |
| Promise\<Array\<[NetAddress](#netaddress)>> | Promise used to return the IP addresses obtained.|
| Promise\<Array\<[NetAddress](#netaddress)>> | Promise used to return the result.|
**Example**
......@@ -461,7 +461,7 @@ Obtains the handle of the network specified by **netSpecifier**.
| netSpecifier | [NetSpecifier](#netspecifier) | No | Network specifier. If this parameter is not set, the default network is used. |
| timeout | number | No | Timeout interval for obtaining the network specified by **netSpecifier**. This parameter is valid only when **netSpecifier** is set.|
**Return value**
**Return Value**
| Type | Description |
| ------------------------------- | -------------------- |
......@@ -520,7 +520,7 @@ Registers a listener for **netCapabilitiesChange** events.
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The value is fixed to **netCapabilitiesChange**.<br>**netCapabilitiesChange**: event indicating that the network capabilities have changed.|
| type | string | Yes | Event type. The value is fixed to **netCapabilitiesChange**.<br>**netCapabilitiesChange**: event indicating that he network capabilities have changed.|
| callback | Callback<{ netHandle: [NetHandle](#nethandle), netCap: [NetCapabilities](#netcapabilities) }> | Yes | Callback used to return the result. |
**Example**
......@@ -630,7 +630,7 @@ register(callback: AsyncCallback\<void>): void
Registers a listener for network status changes.
**Required permissions**: ohos.permission.GET_NETWORK_INFO
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Communication.NetManager.Core
......@@ -674,15 +674,15 @@ netConnection.unregister(function (error) {
Defines the handle of the data network.
Before invoking **NetHandle** APIs, call **getNetHandle** to obtain a **NetHandle** object.
Before invoking NetHandle APIs, call **getNetHandle** to obtain a **NetHandle** object.
**System capability**: SystemCapability.Communication.NetManager.Core
### Attributes
### Parameters
| Name| Type | Description |
| ------ | ------ | ------------------------- |
| netId | number | Network ID. The value must be greater than or equal to **100**.|
| netId | number | Network ID. The value must be greater than or equal to 100.|
### bindSocket
......@@ -731,7 +731,7 @@ Binds a **TCPSocket** or **UDPSocket** object to the data network. This API uses
| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| socketParam | TCPSocket \| UDPSocket | Yes | **TCPSocket** or **UDPSocket** object.|
**Return value**
**Return Value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.|
......@@ -767,7 +767,7 @@ Resolves the host name by using the corresponding network to obtain all IP addre
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------- | ---- | ------------------ |
| host | string | Yes | Host name to resolve.|
| host | string | Yes | Host name to be resolved.|
| callback | AsyncCallback\<Array\<[NetAddress](#netaddress)>> | Yes | Callback used to return the result. |
**Example**
......@@ -794,9 +794,9 @@ Resolves the host name by using the corresponding network to obtain all IP addre
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------ |
| host | string | Yes | Host name to resolve.|
| host | string | Yes | Host name to be resolved.|
**Return value**
**Return Value**
| Type | Description |
| ------------------------------------------- | ----------------------------- |
......@@ -825,7 +825,7 @@ Resolves the host name by using the corresponding network to obtain the first IP
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------- | ---- | ------------------ |
| host | string | Yes | Host name to resolve.|
| host | string | Yes | Host name to be resolved.|
| callback | AsyncCallback\<[NetAddress](#netaddress)> | Yes | Callback used to return the result. |
**Example**
......@@ -852,9 +852,9 @@ Resolves the host name by using the corresponding network to obtain the first IP
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------ |
| host | string | Yes | Host name to resolve.|
| host | string | Yes | Host name to be resolved.|
**Return value**
**Return Value**
| Type | Description |
| ----------------------------------- | ------------------------------- |
......@@ -901,7 +901,7 @@ Defines the network capability.
**System capability**: SystemCapability.Communication.NetManager.Core
| Name | Value α | Description |
| Name | Value | Description |
| ------------------------ | ---- | ---------------------- |
| NET_CAPABILITY_MMS | 0 | The network can connect to the carrier's Multimedia Messaging Service Center (MMSC) to send and receive multimedia messages.|
| NET_CAPABILITY_NOT_METERED | 11 | The network traffic is not metered.|
......@@ -915,7 +915,7 @@ Defines the network type.
**System capability**: SystemCapability.Communication.NetManager.Core
| Name | Value α | Description |
| Name | Value | Description |
| --------------- | ---- | ----------- |
| BEARER_CELLULAR | 0 | Cellular network |
| BEARER_WIFI | 1 | Wi-Fi network|
......@@ -938,7 +938,7 @@ Defines the network connection properties.
## LinkAddress
Defines network link information.
Network link information.
**System capability**: SystemCapability.Communication.NetManager.Core
......@@ -949,7 +949,7 @@ Defines network link information.
## RouteInfo
Defines network route information.
Network route information.
**System capability**: SystemCapability.Communication.NetManager.Core
......@@ -971,4 +971,4 @@ Defines the network address.
| ------- | ------ | ------------------------------ |
| address | string | Network address. |
| family | number | Address family identifier. The value is **1** for IPv4 and **2** for IPv6. The default value is **1**.|
| port | number | Port number. The value range is 0 to 65535. |
| port | number | Port number. The value ranges from **0** to **65535**. |
......@@ -600,13 +600,13 @@ Defines the network type.
| Name | Value | Description |
| -------------------- | ---- | ------------------------------------------------------------ |
| NETWORK_TYPE_UNKNOWN | 0 | Unknown network |
| NETWORK_TYPE_GSM | 1 | GSM network |
| NETWORK_TYPE_CDMA | 2 | CDMA network |
| NETWORK_TYPE_WCDMA | 3 | WCDMA network |
| NETWORK_TYPE_TDSCDMA | 4 | TD-SCDMA network|
| NETWORK_TYPE_LTE | 5 | LTE network |
| NETWORK_TYPE_NR | 6 | 5G NR network |
| NETWORK_TYPE_UNKNOWN | 0 | Unknown network. |
| NETWORK_TYPE_GSM | 1 | GSM network. |
| NETWORK_TYPE_CDMA | 2 | CDMA network. |
| NETWORK_TYPE_WCDMA | 3 | WCDMA network. |
| NETWORK_TYPE_TDSCDMA | 4 | TD-SCDMA network.|
| NETWORK_TYPE_LTE | 5 | LTE network. |
| NETWORK_TYPE_NR | 6 | 5G NR network. |
## NetworkState
......
......@@ -15,7 +15,7 @@ import sim from '@ohos.telephony.sim';
isSimActive\(slotId: number, callback: AsyncCallback<boolean\>\): void
Checks whether the SIM card in the specified slot is activated. This function uses an asynchronous callback to return the result.
Checks whether the SIM card in the specified slot is activated. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -23,7 +23,7 @@ Checks whether the SIM card in the specified slot is activated. This function us
| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| slotId | number | Yes | Card slot ID. The options are as follows:<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. |
**Example**
......@@ -39,7 +39,7 @@ sim.isSimActive(0, (err, data) => {
isSimActive\(slotId: number\): Promise<boolean\>
Checks whether the SIM card in the specified slot is activated. This function uses a promise to return the result.
Checks whether the SIM card in the specified slot is activated. This API uses a promise to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -47,9 +47,9 @@ Checks whether the SIM card in the specified slot is activated. This function us
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| slotId | number | Yes | Card slot ID. The options are as follows:<br>- **0**: card slot 1<br>- **1**: card slot 2|
**Return Value**
**Return value**
| Type | Description |
| --------------------- | ---------------------------------- |
......@@ -71,7 +71,7 @@ promise.then(data => {
getDefaultVoiceSlotId\(callback: AsyncCallback<number\>\): void
Obtains the default slot ID of the SIM card that provides voice services. This function uses an asynchronous callback to return the result.
Obtains the default slot ID of the SIM card that provides voice services. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -94,11 +94,11 @@ sim.getDefaultVoiceSlotId((err, data) => {
getDefaultVoiceSlotId\(\): Promise<number\>
Obtains the default slot ID of the SIM card that provides voice services. This function uses a promise to return the result.
Obtains the default slot ID of the SIM card that provides voice services. This API uses a promise to return the result.
**System capability**: SystemCapability.Communication.CoreService
**Return Value**
**Return value**
| Type | Description |
| ----------------- | --------------------------------------- |
......@@ -119,7 +119,7 @@ promise.then(data => {
hasOperatorPrivileges(slotId: number, callback: AsyncCallback\<boolean\>): void
Checks whether the application (caller) has been granted the operator permission. This function uses an asynchronous callback to return the result.
Checks whether the application (caller) has been granted the operator permission. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -127,7 +127,7 @@ Checks whether the application (caller) has been granted the operator permission
| Name | Type | Mandatory| Description |
| -------- | ------------------------ | ---- | ---------------------------------------- |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| slotId | number | Yes | Card slot ID. The options are as follows:<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result. |
**Example**
......@@ -140,9 +140,9 @@ sim.hasOperatorPrivileges(0, (err, data) => {
## sim.hasOperatorPrivileges<sup>7+</sup>
hasOperatorPrivileges(slotId: number): Promise<boolean>
hasOperatorPrivileges(slotId: number): Promise<boolean\>
Checks whether the application (caller) has been granted the operator permission. This function uses a promise to return the result.
Checks whether the application (caller) has been granted the operator permission. This API uses a promise to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -150,9 +150,9 @@ Checks whether the application (caller) has been granted the operator permission
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------------------------------- |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| slotId | number | Yes | Card slot ID. The options are as follows:<br>- **0**: card slot 1<br>- **1**: card slot 2|
**Return Value**
**Return value**
| Type | Description |
| :----------------- | :---------------------------------------------------------- |
......@@ -173,7 +173,7 @@ promise.then(data => {
getISOCountryCodeForSim\(slotId: number, callback: AsyncCallback<string\>\): void
Obtains the ISO country code of the SIM card in the specified slot. This function uses an asynchronous callback to return the result.
Obtains the ISO country code of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -181,7 +181,7 @@ Obtains the ISO country code of the SIM card in the specified slot. This functio
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | ---------------------------------------- |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2 |
| slotId | number | Yes | Card slot ID. The options are as follows:<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result, which is a country code, for example, **CN** (China).|
**Example**
......@@ -197,7 +197,7 @@ sim.getISOCountryCodeForSim(0, (err, data) => {
getISOCountryCodeForSim\(slotId: number\): Promise<string\>
Obtains the ISO country code of the SIM card in the specified slot. This function uses a promise to return the result.
Obtains the ISO country code of the SIM card in the specified slot. This API uses a promise to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -205,9 +205,9 @@ Obtains the ISO country code of the SIM card in the specified slot. This functio
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| slotId | number | Yes | Card slot ID. The options are as follows:<br>- **0**: card slot 1<br>- **1**: card slot 2|
**Return Value**
**Return value**
| Type | Description |
| ----------------- | ------------------------------------------------------------ |
......@@ -229,7 +229,7 @@ promise.then(data => {
getSimOperatorNumeric\(slotId: number, callback: AsyncCallback<string\>\): void
Obtains the public land mobile network (PLMN) ID of the SIM card in the specified slot. This function uses an asynchronous callback to return the result.
Obtains the public land mobile network (PLMN) ID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -237,7 +237,7 @@ Obtains the public land mobile network (PLMN) ID of the SIM card in the specifie
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| slotId | number | Yes | Card slot ID. The options are as follows:<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. |
**Example**
......@@ -253,7 +253,7 @@ sim.getSimOperatorNumeric(0, (err, data) => {
getSimOperatorNumeric\(slotId: number\): Promise<string\>
Obtains the PLMN ID of the SIM card in the specified slot. This function uses a promise to return the result.
Obtains the PLMN ID of the SIM card in the specified slot. This API uses a promise to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -261,9 +261,9 @@ Obtains the PLMN ID of the SIM card in the specified slot. This function uses a
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| slotId | number | Yes | Card slot ID. The options are as follows:<br>- **0**: card slot 1<br>- **1**: card slot 2|
**Return Value**
**Return value**
| Type | Description |
| ----------------- | ------------------------------------------------ |
......@@ -285,7 +285,7 @@ promise.then(data => {
getSimSpn\(slotId: number, callback: AsyncCallback<string\>\): void
Obtains the service provider name (SPN) of the SIM card in the specified slot. This function uses an asynchronous callback to return the result.
Obtains the service provider name (SPN) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -293,7 +293,7 @@ Obtains the service provider name (SPN) of the SIM card in the specified slot. T
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| slotId | number | Yes | Card slot ID. The options are as follows:<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. |
**Example**
......@@ -309,7 +309,7 @@ sim.getSimSpn(0, (err, data) => {
getSimSpn\(slotId: number\): Promise<string\>
Obtains the SPN of the SIM card in the specified slot. This function uses a promise to return the result.
Obtains the SPN of the SIM card in the specified slot. This API uses a promise to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -317,9 +317,9 @@ Obtains the SPN of the SIM card in the specified slot. This function uses a prom
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| slotId | number | Yes | Card slot ID. The options are as follows:<br>- **0**: card slot 1<br>- **1**: card slot 2|
**Return Value**
**Return value**
| Type | Description |
| ----------------- | ----------------------------------------- |
......@@ -341,7 +341,7 @@ promise.then(data => {
getSimState\(slotId: number, callback: AsyncCallback<SimState\>\): void
Obtains the status of the SIM card in the specified slot. This function uses an asynchronous callback to return the result.
Obtains the status of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -349,7 +349,7 @@ Obtains the status of the SIM card in the specified slot. This function uses an
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| slotId | number | Yes | Card slot ID. The options are as follows:<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<[SimState](#simState)\> | Yes | Callback used to return the result. For details, see [SimState](#simState). |
**Example**
......@@ -365,7 +365,7 @@ sim.getSimState(0, (err, data) => {
getSimState\(slotId: number\): Promise<SimState\>
Obtains the status of the SIM card in the specified slot. This function uses a promise to return the result.
Obtains the status of the SIM card in the specified slot. This API uses a promise to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -373,9 +373,9 @@ Obtains the status of the SIM card in the specified slot. This function uses a p
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| slotId | number | Yes | Card slot ID. The options are as follows:<br>- **0**: card slot 1<br>- **1**: card slot 2|
**Return Value**
**Return value**
| Type | Description |
| -------------------------------- | ------------------------------------------ |
......@@ -396,7 +396,7 @@ promise.then(data => {
getCardType\(slotId: number, callback: AsyncCallback<CardType\>\): void
Obtains the type of the SIM card in the specified slot. This function uses an asynchronous callback to return the result.
Obtains the type of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -404,7 +404,7 @@ Obtains the type of the SIM card in the specified slot. This function uses an as
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| slotId | number | Yes | Card slot ID. The options are as follows:<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<[CardType](#cardtype7)\> | Yes | Callback used to return the result. |
**Example**
......@@ -420,7 +420,7 @@ sim.getCardType(0, (err, data) => {
getCardType\(slotId: number\): Promise<CardType\>
Obtains the type of the SIM card in the specified slot. This function uses a promise to return the result.
Obtains the type of the SIM card in the specified slot. This API uses a promise to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -428,9 +428,9 @@ Obtains the type of the SIM card in the specified slot. This function uses a pro
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| slotId | number | Yes | Card slot ID. The options are as follows:<br>- **0**: card slot 1<br>- **1**: card slot 2|
**Return Value**
**Return value**
| Type | Description |
| ----------------- | ------------------------------------------------------------ |
......@@ -452,7 +452,7 @@ promise.then(data => {
hasSimCard\(slotId: number, callback: AsyncCallback<boolean\>\): void
Checks whether the SIM card in the specified slot is installed. This function uses an asynchronous callback to return the result.
Checks whether the SIM card in the specified slot is installed. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -460,7 +460,7 @@ Checks whether the SIM card in the specified slot is installed. This function us
| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| slotId | number | Yes | Card slot ID. The options are as follows:<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. |
**Example**
......@@ -476,7 +476,7 @@ sim.hasSimCard(0, (err, data) => {
hasSimCard\(slotId: number\): Promise<boolean\>
Checks whether the SIM card in the specified slot is installed. This function uses a promise to return the result.
Checks whether the SIM card in the specified slot is installed. This API uses a promise to return the result.
**System capability**: SystemCapability.Communication.CoreService
......@@ -484,9 +484,9 @@ Checks whether the SIM card in the specified slot is installed. This function us
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| slotId | number | Yes | Card slot ID. The options are as follows:<br>- **0**: card slot 1<br>- **1**: card slot 2|
**Return Value**
**Return value**
| Type | Description |
| --------------------- | ---------------------------------- |
......@@ -512,7 +512,7 @@ Obtains the number of card slots.
**System capability**: SystemCapability.Communication.CoreService
**Return Value**
**Return value**
| Type | Description |
| ----------------- | ------------------------------------------------------------ |
......@@ -557,4 +557,4 @@ Enumerates card types.
|CU_DUAL_MODE_CARD | 42 | China Unicom dual-mode card|
|DUAL_MODE_TELECOM_LTE_CARD | 43 | China Telecom dual-mode LTE card|
|DUAL_MODE_UG_CARD | 50 | Dual-mode card (UMTS+GSM)|
|SINGLE_MODE_ISIM_CARD | 60 | Single-card (ISIM)|
|SINGLE_MODE_ISIM_CARD<sup>8+</sup> | 60 | Single-card (ISIM)|
......@@ -10,11 +10,11 @@
import sms from '@ohos.telephony.sms';
```
## sms.createMessage<a name=sms.createMessage-callback></a>
## sms.createMessage
createMessage\(pdu: Array<number\>, specification: string, callback: AsyncCallback<ShortMessage\>\): void
Creates an SMS message instance based on the protocol data unit (PDU) and the specified SMS protocol. This function uses an asynchronous callback to return the result.
Creates an SMS message instance based on the protocol data unit (PDU) and the specified SMS protocol. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.SmsMms
......@@ -24,7 +24,7 @@ Creates an SMS message instance based on the protocol data unit (PDU) and the sp
| ------------- | -------------------------------------------------- | ---- | ------------------------------------------------------------ |
| pdu | Array&lt;number&gt; | Yes | PDU, which is obtained from the received SMS message. |
| specification | string | Yes | SMS protocol type. <br>- **3gpp**: GSM/UMTS/LTE SMS<br>- **3gpp2**: CDMA SMS|
| callback | AsyncCallback&lt;[ShortMessage](#ShortMessage)&gt; | Yes | Callback used to return the result. |
| callback | AsyncCallback&lt;[ShortMessage](#shortmessage)&gt; | Yes | Callback used to return the result. |
**Example**
......@@ -38,11 +38,11 @@ sms.createMessage(pdu, specification, (err, data) => {
```
## sms.createMessage<a name=sms.createMessage-promise></a>
## sms.createMessage
createMessage\(pdu: Array<number\>, specification: string\): Promise<ShortMessage\>
Creates an SMS message instance based on the PDU and the specified SMS protocol. This function uses a promise to return the result.
Creates an SMS message instance based on the PDU and the specified SMS protocol. This API uses a promise to return the result.
**System capability**: SystemCapability.Telephony.SmsMms
......@@ -57,7 +57,7 @@ Creates an SMS message instance based on the PDU and the specified SMS protocol.
| Type | Description |
| -------------------------------------------- | --------------------------------- |
| Promise&lt;[ShortMessage](#ShortMessage)&gt; | Promise used to return the result.|
| Promise&lt;[ShortMessage](#shortmessage)&gt; | Promise used to return the result.|
**Example**
......@@ -87,7 +87,7 @@ Sends an SMS message.
| Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ |
| options | [SendMessageOptions](#SendMessageOptions) | Yes | Options (including the callback) for sending an SMS message. For details, see [SendMessageOptions](#SendMessageOptions).|
| options | [SendMessageOptions](#sendmessageoptions) | Yes | Options (including the callback) for sending an SMS message. For details, see [SendMessageOptions](#sendmessageoptions).|
**Example**
......@@ -108,11 +108,11 @@ sms.sendMessage(options);
```
## sms.getDefaultSmsSlotId<sup>7+</sup><a name=sms.getDefaultSmsSlotId-callback></a>
## sms.getDefaultSmsSlotId<sup>7+</sup>
getDefaultSmsSlotId\(callback: AsyncCallback<number\>\): void
Obtains the default slot of the SIM card used to send SMS messages. This function uses an asynchronous callback to return the result.
Obtains the default slot of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.SmsMms
......@@ -131,11 +131,11 @@ sms.getDefaultSmsSlotId((err, data) => {
```
## sms.getDefaultSmsSlotId<sup>7+</sup><a name=sms.getDefaultSmsSlotId-promise></a>
## sms.getDefaultSmsSlotId<sup>7+</sup>
getDefaultSmsSlotId\(\): Promise<number\>
Obtains the default slot of the SIM card used to send SMS messages. This function uses a promise to return the result.
Obtains the default slot of the SIM card used to send SMS messages. This API uses a promise to return the result.
**System capability**: SystemCapability.Telephony.SmsMms
......@@ -157,16 +157,18 @@ promise.then(data => {
```
## sms.setSmscAddr<sup>7+</sup><a name=sms.setSmscAddr-callback></a>
## sms.setSmscAddr<sup>7+</sup>
setSmscAddr\(slotId: number, smscAddr: string, callback: AsyncCallback<void\>\): void
Sets the short message service center (SMSC) address. This function uses an asynchronous callback to return the result.
Sets the short message service center (SMSC) address. This API uses an asynchronous callback to return the result.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE (a system permission)
**System capability**: SystemCapability.Telephony.SmsMms
This is a system API and cannot be called by third-party applications.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -186,16 +188,18 @@ sms.setSmscAddr(slotId, smscAddr, (err,data) => {
```
## sms.setSmscAddr<sup>7+</sup><a name=sms.setSmscAddr-promise></a>
## sms.setSmscAddr<sup>7+</sup>
setSmscAddr\(slotId: number, smscAddr: string\): Promise<void\>
Sets the SMSC address. This function uses a promise to return the result.
Sets the SMSC address. This API uses a promise to return the result.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE (a system permission)
**System capability**: SystemCapability.Telephony.SmsMms
This is a system API and cannot be called by third-party applications.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -223,17 +227,17 @@ promise.then(data => {
```
## sms.getSmscAddr<sup>7+</sup><a name=sms.getSmscAddr-callback></a>
## sms.getSmscAddr<sup>7+</sup>
getSmscAddr\(slotId: number, callback: AsyncCallback<string\>\): void
Obtains the SMSC address. This function uses an asynchronous callback to return the result.
Obtains the SMSC address. This API uses an asynchronous callback to return the result.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE (a system permission)
**System capability**: SystemCapability.Telephony.SmsMms
**Note:** This is a system API and it is used only for system applications.
This is a system API and cannot be called by third-party applications.
**Parameters**
......@@ -252,17 +256,17 @@ sms.getSmscAddr(slotId, (err, data) => {
```
## sms.getSmscAddr<sup>7+</sup><a name=sms.getSmscAddr-promise></a>
## sms.getSmscAddr<sup>7+</sup>
getSmscAddr\(slotId: number\): Promise<string\>
Obtains the SMSC address. This function uses a promise to return the result.
Obtains the SMSC address. This API uses a promise to return the result.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE (a system permission)
**System capability**: SystemCapability.Telephony.SmsMms
**Note:** This is a system API and it is used only for system applications.
This is a system API and cannot be called by third-party applications.
**Parameters**
......@@ -288,11 +292,11 @@ promise.then(data => {
});
```
## sms.hasSmsCapability<sup>7+</sup><a name=sms.hasSmsCapability></a>
## sms.hasSmsCapability<sup>7+</sup>
hasSmsCapability(): boolean
Checks whether the current device can send and receive SMS messages. This function works in synchronous mode.
Checks whether the current device can send and receive SMS messages. This API works in synchronous mode.
**System capability**: SystemCapability.Telephony.SmsMms
......@@ -307,18 +311,18 @@ let result = sms.hasSmsCapability();
console.log(`hasSmsCapability: ${JSON.stringify(result)}`);
```
## ShortMessage<a name=ShortMessage></a>
## ShortMessage
Defines an SMS message instance.
**System capability**: SystemCapability.Telephony.SmsMms
| Variable | Type | Description |
| Name | Type | Description |
| ------------------------ | --------------------------------------- | ------------------------------------------------------------ |
| hasReplyPath | boolean | Whether the received SMS contains **TP-Reply-Path**. The default value is **false**.<br>**TP-Reply-Path**: the path in which the mobile phone can reply to the SMS message through the originating SMSC.|
| isReplaceMessage | boolean | Whether the received SMS message is a **replace short message**. The default value is **false**.<br>For details, see section 9.2.3.9 in **3GPP TS 23.040**.|
| isSmsStatusReportMessage | boolean | Whether the received SMS message is an SMS delivery status report. The default value is **false**.<br>**SMS-Status-Report**: a message sent from the SMSC to the mobile station to show the SMS message delivery status.|
| messageClass | [ShortMessageClass](#ShortMessageClass) | SMS message type. |
| messageClass | [ShortMessageClass](#shortmessageclass) | SMS message type. |
| pdu | Array&lt;number&gt; | PDU in the SMS message. |
| protocolId | number | ID of the protocol used for sending SMS messages. |
| scAddress | string | Address of the short message service center (SMSC). |
......@@ -328,69 +332,69 @@ Defines an SMS message instance.
| visibleRawAddress | string | Sender address. |
## ShortMessageClass<a name=ShortMessageClass></a>
## ShortMessageClass
Enumerates SMS message types.
SMS message type.
| Variable | Value | Description |
| ---------------- | ---- | ------------------------------------------------------------ |
| UNKNOWN | 0 | Unknown type.<br>**System capability**: SystemCapability.Telephony.SmsMms|
| INSTANT_MESSAGE | 1 | Instant message, which is displayed immediately after being received.<br>**System capability**: SystemCapability.Telephony.SmsMms|
| OPTIONAL_MESSAGE | 2 | Message stored in the device or SIM card.<br>**System capability**: SystemCapability.Telephony.SmsMms|
| SIM_MESSAGE | 3 | Message containing SIM card information, which is to be stored in the SIM card.<br>**System capability**: SystemCapability.Telephony.SmsMms|
| FORWARD_MESSAGE | 4 | Message to be forwarded to another device.<br>**System capability**: SystemCapability.Telephony.SmsMms|
**System capability**: SystemCapability.Telephony.SmsMms
| Name | Value | Description |
| ---------------- | ---- | ---------------------------------------- |
| UNKNOWN | 0 | Unknown type. |
| INSTANT_MESSAGE | 1 | Instant message, which is displayed immediately after being received. |
| OPTIONAL_MESSAGE | 2 | Message stored in the device or SIM card. |
| SIM_MESSAGE | 3 | Message containing SIM card information, which is to be stored in the SIM card.|
| FORWARD_MESSAGE | 4 | Message to be forwarded to another device. |
## SendMessageOptions<a name=SendMessageOptions></a>
Provides the options (including callbacks) for sending an SMS message.
## SendMessageOptions
For example, you can specify the SMS message type by the optional parameter **content**.
Provides the options (including callbacks) for sending an SMS message. For example, you can specify the SMS message type by the optional parameter **content**.
**System capability**: SystemCapability.Telephony.SmsMms
| Parameter | Type | Mandatory| Description |
| Name | Type | Mandatory| Description |
| ---------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| slotId | number | Yes | Slot ID of the SIM card used for sending SMS messages. <br>- **0**: card slot 1<br>- **1**: card slot 2 |
| destinationHost | string | Yes | Destination address of the SMS message. |
| content | string \| Array&lt;number&gt; | Yes | SMS message type. If the content is composed of character strings, the SMS message is a text message. If the content is composed of byte arrays, the SMS message is a data message.|
| serviceCenter | string | No | SMSC address. By default, the SMSC address in the SIM card is used. |
| destinationPort | number | No | Destination port of the SMS message. This field is mandatory only for a data message. Otherwise, it is optional. |
| sendCallback | AsyncCallback&lt;[ISendShortMessageCallback](#ISendShortMessageCallback)&gt; | No | Callback used to return the SMS message sending result. For details, see [ISendShortMessageCallback](#ISendShortMessageCallback).|
| deliveryCallback | AsyncCallback&lt;[IDeliveryShortMessageCallback](#IDeliveryShortMessageCallback)&gt; | No | Callback used to return the SMS message delivery report. For details, see [IDeliveryShortMessageCallback](#IDeliveryShortMessageCallback).|
| sendCallback | AsyncCallback&lt;[ISendShortMessageCallback](#isendshortmessagecallback)&gt; | No | Callback used to return the SMS message sending result. For details, see [ISendShortMessageCallback](#isendshortmessagecallback).|
| deliveryCallback | AsyncCallback&lt;[IDeliveryShortMessageCallback](#ideliveryshortmessagecallback)&gt; | No | Callback used to return the SMS message delivery report. For details, see [IDeliveryShortMessageCallback](#ideliveryshortmessagecallback).|
## ISendShortMessageCallback<a name=ISendShortMessageCallback></a>
## ISendShortMessageCallback
Provides the callback for the SMS message sending result. It consists of three parts: SMS message sending result, URI for storing the sent SMS message, and whether the SMS message is the last part of a long SMS message.
**System capability**: SystemCapability.Telephony.SmsMms
| Parameter | Type | Mandatory| Description |
| Name | Type | Mandatory| Description |
| ---------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| isLastPart | boolean | No | Whether this SMS message is the last part of a long SMS message. The value **true** indicates that this SMS message is the last part of a long SMS message, and value **false** indicates the opposite. The default value is **false**.|
| result | [SendSmsResult](#SendSmsResult) | Yes | SMS message sending result. |
| result | [SendSmsResult](#sendsmsresult) | Yes | SMS message sending result. |
| url | string | Yes | URI for storing sent SMS messages. |
## IDeliveryShortMessageCallback<a name=IDeliveryShortMessageCallback></a>
## IDeliveryShortMessageCallback
Provides the callback for the SMS message sending result. Return the SMS delivery report.
**System capability**: SystemCapability.Telephony.SmsMms
| Parameter| Type | Mandatory| Description |
| Name| Type | Mandatory| Description |
| ------ | ------------------- | ---- | -------------- |
| pdu | Array&lt;number&gt; | Yes | SMS message delivery report.|
## SendSmsResult<a name=SendSmsResult></a>
## SendSmsResult
Enumerates SMS message sending results.
SMS message sending result.
**System capability**: SystemCapability.Telephony.SmsMms
| Parameter | Value | Description |
| Name | Value | Description |
| ------------------------------------ | ---- | ------------------------------------------------------ |
| SEND_SMS_SUCCESS | 0 | SMS message sent successfully. |
| SEND_SMS_FAILURE_UNKNOWN | 1 | Failed to send the SMS message due to unknown reasons. |
......
# Socket
# Socket Connection
>![](public_sys-resources/icon-note.gif) **NOTE:**
>
......
......@@ -10,11 +10,11 @@
import data from '@ohos.telephony.data';
```
## data.getDefaultCellularDataSlotId<a name=data.getDefaultCellularDataSlotId-callback></a>
## data.getDefaultCellularDataSlotId
getDefaultCellularDataSlotId(callback: AsyncCallback\<number\>): void
Obtains the default SIM card used for mobile data. This function uses an asynchronous callback to return the result.
Obtains the default SIM card used for mobile data. This API uses an asynchronous callback to return the result.
**Required permission**: ohos.permission.GET_NETWORK_INFO
......@@ -22,9 +22,9 @@ Obtains the default SIM card used for mobile data. This function uses an asynchr
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | ------------------------------------------ |
| callback | AsyncCallback\<number\> | Yes| Callback used to return the result. <br /> **0**: slot 1 <br/>**1**: slot 2|
| callback | AsyncCallback\<number\> | Yes | Callback used to return the result.<br>**0**: card slot 1<br>**1**: card slot 2|
**Example**
......@@ -34,21 +34,21 @@ data.getDefaultCellularDataSlotId((err, data) => {
});
```
## data.getDefaultCellularDataSlotId<a name=data.getDefaultCellularDataSlotId-promise></a>
## data.getDefaultCellularDataSlotId
getDefaultCellularDataSlotId(): Promise\<number\>
Obtains the default SIM card used for mobile data. This function uses a promise to return the result.
Obtains the default SIM card used for mobile data. This API uses a promise to return the result.
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Telephony.CellularData
**Return value**
**Return Value**
| Type| Description|
| Type | Description |
| ----------------- | ------------------------------------------------------------ |
| Promise\<number\> | Promise used to return the result, wherein: <br />**0**: slot 1 <br/>**1**: slot 2|
| Promise\<number\> | Promise used to return the result.<br>**0**: card slot 1<br>**1**: card slot 2|
**Example**
......@@ -61,19 +61,19 @@ promise.then((data) => {
});
```
## data.getCellularDataFlowType<a name=data.getCellularDataFlowType-callback></a>
## data.getCellularDataFlowType
getCellularDataFlowType(callback: AsyncCallback\<DataFlowType\>): void
Obtains the cellular data flow type, which can be uplink or downlink. This function uses an asynchronous callback to return the result.
Obtains the cellular data flow type, which can be uplink or downlink. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CellularData
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------- | ---- | ---------- |
| callback | AsyncCallback\<[DataFlowType](#DataFlowType)\> | Yes| Callback used to return the result.|
| callback | AsyncCallback\<[DataFlowType](#dataflowtype)\> | Yes | Callback used to return the result.|
**Example**
......@@ -83,19 +83,19 @@ data.getCellularDataFlowType((err, data) => {
});
```
## data.getCellularDataFlowType<a name=data.getCellularDataFlowType-promise></a>
## data.getCellularDataFlowType
getCellularDataFlowType(): Promise\<DataFlowType\>
Obtains the cellular data flow type, which can be uplink or downlink. This function uses a promise to return the result.
Obtains the cellular data flow type, which can be uplink or downlink. This API uses a promise to return the result.
**System capability**: SystemCapability.Telephony.CellularData
**Return value**
**Return Value**
| Type| Description|
| Type | Description |
| ---------------------------------------- | ----------------------------------------------- |
| Promise\<[DataFlowType](#DataFlowType)\> | Promise used to return the result. |
| Promise\<[DataFlowType](#dataflowtype)\> | Promise used to return the result. |
**Example**
......@@ -108,19 +108,19 @@ promise.then((data) => {
});
```
## data.getCellularDataState<a name=data.getCellularDataState-callback></a>
## data.getCellularDataState
getCellularDataState(callback: AsyncCallback\<DataConnectState\>): void
Obtains the connection status of the packet switched (PS) domain. This function uses an asynchronous callback to return the result.
Obtains the connection status of the packet switched (PS) domain. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CellularData
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------ | ---- | ---------- |
| callback | AsyncCallback\<[DataConnectState](#DataConnectState)\> | Yes| Callback used to return the result.|
| callback | AsyncCallback\<[DataConnectState](#dataconnectstate)\> | Yes | Callback used to return the result.|
**Example**
......@@ -130,19 +130,19 @@ data.getCellularDataState((err, data) => {
});
```
## data.getCellularDataState<a name=data.getCellularDataState-promise></a>
## data.getCellularDataState
getCellularDataState(): Promise\<DataConnectState\>
Obtains the connection status of the PS domain. This function uses a promise to return the result.
Obtains the connection status of the PS domain. This API uses a promise to return the result.
**System capability**: SystemCapability.Telephony.CellularData
**Return value**
**Return Value**
| Type| Description|
| Type | Description |
| ------------------------------------------------ | ------------------------------------- |
| Promise\<[DataConnectState](#DataConnectState)\> | Promise used to return the result.|
| Promise\<[DataConnectState](#dataconnectstate)\> | Promise used to return the result.|
**Example**
......@@ -155,11 +155,11 @@ promise.then((data) => {
});
```
## data.isCellularDataEnabled<a name=data.isCellularDataEnabled-callback></a>
## data.isCellularDataEnabled
isCellularDataEnabled(callback: AsyncCallback\<boolean\>): void
Checks whether the cellular data service is enabled. This function uses an asynchronous callback to return the result.
Checks whether the cellular data service is enabled. This API uses an asynchronous callback to return the result.
**Required permission**: ohos.permission.GET_NETWORK_INFO
......@@ -167,9 +167,9 @@ Checks whether the cellular data service is enabled. This function uses an async
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| -------- | ------------------------ | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback\<boolean\> | Yes| Callback used to return the result. <br />**true**: The cellular data service is enabled. <br />**false**: The cellular data service is disabled.|
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>**true**: The cellular data service is enabled.<br>**false**: The cellular data service is disabled.|
**Example**
......@@ -179,21 +179,21 @@ data.isCellularDataEnabled((err, data) => {
});
```
## data.isCellularDataEnabled<a name=data.isCellularDataEnabled-promise></a>
## data.isCellularDataEnabled
isCellularDataEnabled(): Promise\<boolean\>
Checks whether the cellular data service is enabled. This function uses a promise to return the result.
Checks whether the cellular data service is enabled. This API uses a promise to return the result.
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Telephony.CellularData
**Return value**
**Return Value**
| Type| Description|
| Type | Description |
| ------------------ | ------------------------------------------------------------ |
| Promise\<boolean\> | Promise used to return the result, wherein: <br />**true**: The cellular data service is enabled. <br />**false**: The cellular data service is disabled.|
| Promise\<boolean\> | Promise used to return the result.<br>**true**: The cellular data service is enabled.<br>**false**: The cellular data service is disabled.|
**Example**
......@@ -206,11 +206,11 @@ promise.then((data) => {
});
```
## data.isCellularDataRoamingEnabled<a name=data.isCellularDataRoamingEnabled-callback></a>
## data.isCellularDataRoamingEnabled
isCellularDataRoamingEnabled(slotId: number, callback: AsyncCallback\<boolean\>): void
Checks whether roaming is enabled for the cellular data service. This function uses an asynchronous callback to return the result.
Checks whether roaming is enabled for the cellular data service. This API uses an asynchronous callback to return the result.
**Required permission**: ohos.permission.GET_NETWORK_INFO
......@@ -218,10 +218,10 @@ Checks whether roaming is enabled for the cellular data service. This function u
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| -------- | ------------------------ | ---- | ------------------------------------------------------------ |
| slotId | number | Yes| Card slot ID. The options are as follows: <br />**0**: slot 1 <br />**1**: slot 2|
| callback | AsyncCallback\<boolean\> | Yes| Callback used to return the result. <br />**true**: Roaming is enabled for the cellular data service. <br />**false**: Roaming is disabled for the cellular data service.|
| slotId | number | Yes | Card slot ID. <br>**0**: card slot 1<br>**1**: card slot 2 |
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.|
**Example**
......@@ -231,11 +231,11 @@ data.isCellularDataRoamingEnabled(0,(err, data) => {
});
```
## data.isCellularDataRoamingEnabled<a name=data.isCellularDataRoamingEnabled-promise></a>
## data.isCellularDataRoamingEnabled
isCellularDataRoamingEnabled(slotId: number): Promise\<boolean\>
Checks whether roaming is enabled for the cellular data service. This method uses a promise to return the result.
Checks whether roaming is enabled for the cellular data service. This API uses a promise to return the result.
**Required permission**: ohos.permission.GET_NETWORK_INFO
......@@ -243,15 +243,15 @@ Checks whether roaming is enabled for the cellular data service. This method use
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------------------------------- |
| slotId | number | Yes| Card slot ID. The options are as follows: <br />**0**: slot 1 <br/>**1**: slot 2|
| slotId | number | Yes | Card slot ID. <br>**0**: card slot 1<br>**1**: card slot 2|
**Return value**
**Return Value**
| Type| Description|
| Type | Description |
| ------------------ | ------------------------------------------------------------ |
| Promise\<boolean\> | Promise used to return the result, wherein: <br />**true**: Roaming is enabled for the cellular data service. <br />**false**: Roaming is disabled for the cellular data service.|
| Promise\<boolean\> | Promise used to return the result.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.|
**Example**
......@@ -264,26 +264,30 @@ promise.then((data) => {
});
```
## DataFlowType<a name=DataFlowType></a>
## DataFlowType
Defines the cellular data flow type.
Defines the cellular data flow type.
| Name| Value| Description|
| ------ | ---------------------- | ------------------------------------------------------------ |
| 0 | DATA_FLOW_TYPE_NONE | No uplink or downlink data is available. <br />**System capability**: SystemCapability.Telephony.CellularData|
| 1 | DATA_FLOW_TYPE_DOWN | Only the downlink data is available. <br />**System capability**: SystemCapability.Telephony.CellularData|
| 2 | DATA_FLOW_TYPE_UP | Only the uplink data is available. <br />**System capability**: SystemCapability.Telephony.CellularData|
| 3 | DATA_FLOW_TYPE_UP_DOWN | Both uplink data and downlink data are available. <br />**System capability**: SystemCapability.Telephony.CellularData|
| 4 | DATA_FLOW_TYPE_DORMANT | No uplink or downlink data is available because the lower-layer link is in the dormant state. <br />**System capability**: SystemCapability.Telephony.CellularData|
**System capability**: SystemCapability.Telephony.CellularData
| Name | Value | Description |
| ---------------------- | ---- | ------------------------------------------ |
| DATA_FLOW_TYPE_NONE | 0 | No uplink or downlink data is available. |
| DATA_FLOW_TYPE_DOWN | 1 | Only the downlink data is available. |
| DATA_FLOW_TYPE_UP | 2 | Only the uplink data is available. |
| DATA_FLOW_TYPE_UP_DOWN | 3 | Both uplink data and downlink data are available. |
| DATA_FLOW_TYPE_DORMANT | 4 | No uplink or downlink data is available because the lower-layer link is in the dormant state.|
## DataConnectState<a name=DataConnectState></a>
## DataConnectState
Describes the connection status of a cellular data link.
Describes the connection status of a cellular data link.
**System capability**: SystemCapability.Telephony.CellularData
| Name| Value| Description|
| ------ | ----------------------- | ------------------------------------------------------------ |
| -1 | DATA_STATE_UNKNOWN| The status of the cellular data link is unknown. <br />**System capability**: SystemCapability.Telephony.CellularData|
| 0 | DATA_STATE_DISCONNECTED | The cellular data link is disconnected. <br />**System capability**: SystemCapability.Telephony.CellularData|
| 1 | DATA_STATE_CONNECTING | The cellular data link is being connected. <br />**System capability**: SystemCapability.Telephony.CellularData|
| 2 | DATA_STATE_CONNECTED | The cellular data link is connected. <br />**System capability**: SystemCapability.Telephony.CellularData|
| 3 | DATA_STATE_SUSPENDED | The cellular data link is suspended. <br />**System capability**: SystemCapability.Telephony.CellularData|
| Name | Value | Description |
| ----------------------- | ---- | -------------------------- |
| DATA_STATE_UNKNOWN | -1 | The status of the cellular data link is unknown. |
| DATA_STATE_DISCONNECTED | 0 | The cellular data link is disconnected. |
| DATA_STATE_CONNECTING | 1 | The cellular data link is being connected.|
| DATA_STATE_CONNECTED | 2 | The cellular data link is connected. |
| DATA_STATE_SUSPENDED | 3 | The cellular data link is suspended. |
......@@ -3,7 +3,7 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
The Thermal Manager module provides APIs for listening to the device thermal status.
This module provides thermal level-related callback and query APIs to obtain the information required for thermal control.
## Modules to Import
......@@ -17,15 +17,17 @@ import thermal from '@ohos.thermal';
Represents the thermal level.
**System capability:** SystemCapability.PowerManager.ThermalManager
| Name | Default Value | Description |
| ---------- | ---- | ---------------------------------------- |
| COOL | 0 | The device is cool, and services are not restricted.<br>**System capability:** SystemCapability.PowerManager.ThermalManager|
| NORMAL | 1 | The device is operational but is not cool. You need to pay attention to its heating.<br>**System capability:** SystemCapability.PowerManager.ThermalManager|
| WARM | 2 | The device is warm. You need to stop or delay some imperceptible services.<br>**System capability:** SystemCapability.PowerManager.ThermalManager|
| HOT | 3 | The device is heating up. You need to stop all imperceptible services and downgrade or reduce the load of other services.<br>**System capability:** SystemCapability.PowerManager.ThermalManager|
| OVERHEATED | 4 | The device is overheated. You need to stop all imperceptible services and downgrade or reduce the load of major services.<br>**System capability:** SystemCapability.PowerManager.ThermalManager|
| WARNING | 5 | The device is overheated and is about to enter the emergency state. You need to stop all imperceptible services and downgrade major services to the maximum extent.<br>**System capability:** SystemCapability.PowerManager.ThermalManager|
| EMERGENCY | 6 | The device has entered the emergency state. You need to stop all services except those for the emergency help purposes.<br>**System capability:** SystemCapability.PowerManager.ThermalManager|
| COOL | 0 | The device is cool, and services are not restricted.|
| NORMAL | 1 | The device is operational but is not cool. You need to pay attention to its heating.|
| WARM | 2 | The device is warm. You need to stop or delay some imperceptible services.|
| HOT | 3 | The device is heating up. You need to stop all imperceptible services and downgrade or reduce the load of other services.|
| OVERHEATED | 4 | The device is overheated. You need to stop all imperceptible services and downgrade or reduce the load of major services.|
| WARNING | 5 | The device is overheated and is about to enter the emergency state. You need to stop all imperceptible services and downgrade major services to the maximum extent.|
| EMERGENCY | 6 | The device has entered the emergency state. You need to stop all services except those for the emergency help purposes.|
## thermal.subscribeThermalLevel
......
# WebSocket
# WebSocket Connection
>![](public_sys-resources/icon-note.gif) **NOTE:**
>The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......
......@@ -3,20 +3,18 @@
- [Application Development Overview](application-dev-guide.md)
- Quick Start
- [Getting Started with Application Development](quick-start/Readme-EN.md)
- [DevEco Studio \(OpenHarmony\) User Guide](quick-start/deveco-studio-user-guide-for-openharmony.md)
- DevEco Studio (OpenHarmony) User Guide
- [Overview](quick-start/deveco-studio-overview.md)
- [Version Change History](quick-start/deveco-studio-release-notes.md)
- [Configuring the OpenHarmony SDK](quick-start/configuring-openharmony-sdk.md)
- [Creating an OpenHarmony Project](quick-start/create-openharmony-project.md)
- [Using the Project Wizard to Create a Project](quick-start/use-wizard-to-create-project.md)
- [Importing a Sample to Create a Project](quick-start/import-sample-to-create-project.md)
- [Configuring the OpenHarmony App Signature](quick-start/configuring-openharmony-app-signature.md)
- [Installing and Running Your OpenHarmony App](quick-start/installing-openharmony-app.md)
- [Directory Structure](quick-start/package-structure.md)
- Development
- [UI](ui/Readme-EN.md)
- UI
- JavaScript-based Web-Like Development Paradigm
- [Overview](ui/ui-js-overview.md)
- Framework
......@@ -126,44 +124,35 @@
- [Building a Food Category Grid Layout](ui/ui-ts-building-category-grid-layout.md)
- [Implementing Page Redirection and Data Transmission](ui/ui-ts-page-redirection-data-transmission.md)
- Basic Functions
- [Agent-Powered Scheduled Reminders ](background-agent-scheduled-reminder/Readme-EN.md)
- Agent-Powered Scheduled Reminders
- [Overview](background-agent-scheduled-reminder/background-agent-scheduled-reminder-overview.md)
- [Development Guidelines](background-agent-scheduled-reminder/background-agent-scheduled-reminder-guide.md)
- [Background Task Management ](background-task-management/Readme-EN.md)
- Background Task Management
- [Background Task Management Overview](background-task-management/background-task-overview.md)
- [Background Task Management Development](background-task-management/background-task-dev-guide.md)
- [WebGL](webgl/Readme-EN.md)
- WebGL
- [WebGL Overview](webgl/webgl-overview.md)
- [WebGL Development](webgl/webgl-guidelines.md)
- [Media](media/Readme-EN.md)
- Media
- Audio
- [Audio Overview](media/audio-overview.md)
- [Audio Playback Development](media/audio-playback.md)
- [Audio Playback Development Using AudioRenderer](media/audio-renderer.md)
- [Audio Management Development](media/audio-management.md)
- [Audio Recording Development](media/audio-recorder.md)
- [Audio Recorder Development Using AudioCapturer](media/audio-capturer)
- Video
- [Video Playback Development](media/video-playback.md)
- [Video Recording Development](media/video-recorder.md)
- [Security](security/Readme-EN.md)
- Security
- User Authentication
- [User Authentication Overview](security/userauth-overview.md)
- [User Authentication Development](security/userauth-guidelines.md)
- [Connectivity](connectivity/Readme-EN.md)
- [IPC & RPC](connectivity/ipc-rpc.md)
- Connectivity
- IPC & RPC
- [IPC & RPC Overview](connectivity/ipc-rpc-overview.md)
- [IPC & RPC Development Guidelines](connectivity/ipc-rpc-development-guideline.md)
- [Subscribing to State Changes of a Remote Object](connectivity/subscribe-remote-state.md)
- [Data Management](database/Readme-EN.md)
- Data Management
- Distributed Data Service
- [Distributed Data Service Overview](database/database-mdds-overview.md)
- [Distributed Data Service Development](database/database-mdds-guidelines.md)
......@@ -173,7 +162,7 @@
- Lightweight Data Store
- [Lightweight Data Store Overview](database/database-preference-overview.md)
- [Lightweight Data Store Development](database/database-preference-guidelines.md)
- [Device](device/Readme-EN.md)
- Device
- USB Service
- [USB Service Overview](device/usb-overview.md)
- [USB Service Development](device/usb-guidelines.md)
......@@ -181,12 +170,12 @@
- [Location Overview](device/device-location-overview.md)
- [Obtaining Device Location Information](device/device-location-info.md)
- [Geocoding and Reverse Geocoding Capabilities](device/device-location-geocoding.md)
- [DFX](dfx/Readme-EN.md)
- DFX
- Application Event Logging
- [Overview of Application Event Logging](dfx/hiappevent-overview.md)
- [Development Guidelines on Application Event Logging](dfx/hiappevent-guidelines.md)
- Tools
- [DevEco Studio \(OpenHarmony\) User Guide](quick-start/deveco-studio-user-guide-for-openharmony.md)
- DevEco Studio (OpenHarmony) User Guide
- [Overview](quick-start/deveco-studio-overview.md)
- [Version Change History](quick-start/deveco-studio-release-notes.md)
- [Configuring the OpenHarmony SDK](quick-start/configuring-openharmony-sdk.md)
......@@ -196,7 +185,7 @@
- Hands-On Tutorials
- [Samples](https://gitee.com/openharmony/app_samples/blob/master/README.md)
- API References
- [Compent Reference (JavaScript-based Web-like Development Paradigm)](reference/arkui-js/Readme-EN.md)
- Compent Reference (JavaScript-based Web-like Development Paradigm)
- [Components](reference/arkui-js/js-components.md)
- [Common](reference/arkui-js/js-components-common.md)
- [Universal Attributes](reference/arkui-js/js-components-common-attributes.md)
......@@ -206,10 +195,8 @@
- [Animation Styles](reference/arkui-js/js-components-common-animation.md)
- [Gradient Styles](reference/arkui-js/js-components-common-gradient.md)
- [Transition Styles](reference/arkui-js/js-components-common-transition.md)
- [Media Query](reference/arkui-js/js-components-common-mediaquery.md)
- [Custom Font Styles](reference/arkui-js/js-components-common-customizing-font.md)
- [Atomic Layout](reference/arkui-js/js-components-common-atomic-layout.md)
- [Container Component](reference/arkui-js/js-components-container.md)
- [badge](reference/arkui-js/js-components-container-badge.md)
- [dialog](reference/arkui-js/js-components-container-dialog.md)
......@@ -228,7 +215,6 @@
- [tabs](reference/arkui-js/js-components-container-tabs.md)
- [tab-bar](reference/arkui-js/js-components-container-tab-bar.md)
- [tab-content](reference/arkui-js/js-components-container-tab-content.md)
- [Basic Components](reference/arkui-js/js-components-basic.md)
- [button](reference/arkui-js/js-components-basic-button.md)
- [chart](reference/arkui-js/js-components-basic-chart.md)
......@@ -257,10 +243,8 @@
- [toolbar](reference/arkui-js/js-components-basic-toolbar.md)
- [toolbar-item](reference/arkui-js/js-components-basic-toolbar-item.md)
- [toggle](reference/arkui-js/js-components-basic-toggle.md)
- [Media Components](reference/arkui-js/js-components-media.md)
- [video](reference/arkui-js/js-components-media-video.md)
- [Canvas Components](reference/arkui-js/js-components-canvas.md)
- [canvas](reference/arkui-js/js-components-canvas-canvas.md)
- [CanvasRenderingContext2D](reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md)
......@@ -271,13 +255,11 @@
- [ImageBitmap](reference/arkui-js/js-components-canvas-imagebitmap.md)
- [OffscreenCanvas](reference/arkui-js/js-components-canvas-offscreencanvas.md)
- [OffscreenCanvasRenderingContext2D](reference/arkui-js/js-offscreencanvasrenderingcontext2d.md)
- [Grid](reference/arkui-js/js-components-grid.md)
- [Basic Concepts](reference/arkui-js/js-components-grid-basic-concepts.md)
- [grid-container](reference/arkui-js/js-components-grid-container.md)
- [grid-row](reference/arkui-js/js-components-grid-row.md)
- [grid-col](reference/arkui-js/js-components-grid-col.md)
- [SVG Components](reference/arkui-js/js-svg.md)
- [Universal Attributes](reference/arkui-js/js-components-svg-common-attributes.md)
- [svg](reference/arkui-js/js-components-svg.md)
......@@ -294,7 +276,6 @@
- [animate](reference/arkui-js/js-components-svg-animate.md)
- [animateMotion](reference/arkui-js/js-components-svg-animatemotion.md)
- [animateTransform](reference/arkui-js/js-components-svg-animatetransform.md)
- [Custom Components](reference/arkui-js/js-components-custom.md)
- [Basic Usage](reference/arkui-js/js-components-custom-basic-usage.md)
- [Custom Events](reference/arkui-js/js-components-custom-events.md)
......@@ -302,10 +283,9 @@
- [Event Parameter](reference/arkui-js/js-components-custom-event-parameter.md)
- [slot](reference/arkui-js/js-components-custom-slot.md)
- [Lifecycle Definition](reference/arkui-js/js-components-custom-lifecycle.md)
- [Appendix](reference/arkui-js/js-appendix.md)
- [Type Attributes](reference/arkui-js/js-appendix-types.md)
- [Compent Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/Readme-EN.md)
- Compent Reference (TypeScript-based Declarative Development Paradigm)
- [Components](reference/arkui-ts/ts-components.md)
- [Universal Components](reference/arkui-ts/ts-universal-components.md)
- [Universal Events](reference/arkui-ts/ts-universal-events.md)
......@@ -314,7 +294,6 @@
- [Show/Hide Event](reference/arkui-ts/ts-universal-events-show-hide.md)
- [Key Event](reference/arkui-ts/ts-universal-events-key.md)
- [Component Area Change Event](reference/arkui-ts/ts-universal-events-component-area-change.md)
- [Universal Attributes](reference/arkui-ts/ts-universal-attributes.md)
- [Size](reference/arkui-ts/ts-universal-attributes-size.md)
- [Location](reference/arkui-ts/ts-universal-attributes-location.md)
......@@ -337,7 +316,6 @@
- [Menu Control](reference/arkui-ts/ts-universal-attributes-menu.md)
- [Click Control](reference/arkui-ts/ts-universal-attributes-touchable.md)
- [Touch Target](reference/arkui-ts/ts-universal-attributes-response-region.md)
- [Gesture Processing](reference/arkui-ts/ts-gesture-processing.md)
- [Gesture Binding Methods](reference/arkui-ts/ts-gesture-settings.md)
- [Basic Gestures](reference/arkui-ts/ts-basic-gestures.md)
......@@ -347,9 +325,7 @@
- [PinchGesture](reference/arkui-ts/ts-basic-gestures-pinchgesture.md)
- [RotationGesture](reference/arkui-ts/ts-basic-gestures-rotationgesture.md)
- [SwipeGesture](reference/arkui-ts/ts-basic-gestures-swipegesture.md)
- [Combined Gestures](reference/arkui-ts/ts-combined-gestures.md)
- [Basic Components](reference/arkui-ts/ts-basic-components.md)
- [Blank](reference/arkui-ts/ts-basic-components-blank.md)
- [Button](reference/arkui-ts/ts-basic-components-button.md)
......@@ -371,7 +347,6 @@
- [TextInput](reference/arkui-ts/ts-basic-components-textinput.md)
- [Toggle](reference/arkui-ts/ts-basic-components-toggle.md)
- [TextClock](reference/arkui-ts/ts-basic-components-textclock.md)
- [Container Components](reference/arkui-ts/ts-components-container.md)
- [AlphabetIndexer](reference/arkui-ts/ts-container-alphabet-indexer.md)
- [Badge](reference/arkui-ts/ts-container-badge.md)
......@@ -395,10 +370,8 @@
- [Swiper](reference/arkui-ts/ts-container-swiper.md)
- [Tabs](reference/arkui-ts/ts-container-tabs.md)
- [TabContent](reference/arkui-ts/ts-container-tabcontent.md)
- [Refresh](reference/arkui-ts/ts-container-refresh.md)
- [Drawing Components](reference/arkui-ts/ts-drawing-components.md)
- [Circle](reference/arkui-ts/ts-drawing-components-circle.md)
- [Ellipse](reference/arkui-ts/ts-drawing-components-ellipse.md)
- [Line](reference/arkui-ts/ts-drawing-components-line.md)
......@@ -407,7 +380,6 @@
- [Path](reference/arkui-ts/ts-drawing-components-path.md)
- [Rect](reference/arkui-ts/ts-drawing-components-rect.md)
- [Shape](reference/arkui-ts/ts-drawing-components-shape.md)
- [Canvas Components](reference/arkui-ts/ts-components-canvas.md)
- [Canvas](reference/arkui-ts/ts-components-canvas-canvas.md)
- [CanvasRenderingContext2D](reference/arkui-ts/ts-canvasrenderingcontext2d.md)
......@@ -424,22 +396,18 @@
- [Page Transition](reference/arkui-ts/ts-page-transition-animation.md)
- [Component Transition](reference/arkui-ts/ts-transition-animation-component.md)
- [Transition of Shared Elements](reference/arkui-ts/ts-transition-animation-shared-elements.md)
- [Motion Path Animation](reference/arkui-ts/ts-motion-path-animation.md)
- [Matrix Transformation](reference/arkui-ts/ts-matrix-transformation.md)
- [Interpolation Calculation](reference/arkui-ts/ts-interpolation-calculation.md)
- [Global UI Methods](reference/arkui-ts/ts-global-ui-methods.md)
- [Alert Dialog Box](reference/arkui-ts/ts-methods-alert-dialog-box.md)
- [Custom Dialog box](reference/arkui-ts/ts-methods-custom-dialog-box.md)
- [Image Cache](reference/arkui-ts/ts-methods-image-cache.md)
- [Media Query](reference/arkui-ts/ts-methods-media-query.md)
- [List Selection Dialog Box](reference/arkui-ts/ts-methods-action-sheet.md)
- [Appendix](reference/arkui-ts/ts-appendix.md)
- [Built-in Enums](reference/arkui-ts/ts-appendix-enums.md)
- [APIs](reference/apis/Readme-EN.md)
- APIs
- Ability Framework
- [FeatureAbility Module](reference/apis/js-apis-featureAbility.md)
- [ParticleAbility Module](reference/apis/js-apis-particleAbility.md)
......@@ -453,8 +421,8 @@
- [Reminder Agent](reference/apis/js-apis-reminderAgent.md)
- Resource Management
- [Resource Manager](reference/apis/js-apis-resource-manager.md)
- [Internationalization \(intl\) ](reference/apis/js-apis-intl.md)
- [Internationalization \(i18n\) ](reference/apis/js-apis-i18n.md)
- [Internationalization (intl)](reference/apis/js-apis-intl.md)
- [Internationalization (i18n)](reference/apis/js-apis-i18n.md)
- Media
- [Audio Management](reference/apis/js-apis-audio.md)
- [Media](reference/apis/js-apis-media.md)
......
# MIPI CSI<a name="title_MIPI_CSIDes"></a>
## Overview<a name="section1_MIPI_CSIDes"></a>
Defined by the Mobile Industry Processor Interface (MIPI) Alliance, the Camera Serial Interface (CSI) is a specification that allows data to be transmitted from the camera to the host processor on mobile platforms. As the second release, the MIPI CSI-2 consists of the application layer, protocol layer, and physical layer. It supports a maximum of four-lane data transmission and a single-lane transmission rate of 1 Gbit/s.
The physical layer supports the high speed (HS) and low power (LP) modes. Using low-voltage differential signaling (LVDS), the HS mode delivers 80 Mbit/s to 1 Gbit/s transmission speed but high power consumption. The unidirectional LP mode provides lower power consumption but lower transmission speed (< 10 Mbit/s). The blend of the two modes ensures high-speed transmission of massive data (such as images) and minimized power consumption when less data is transmitted.
The figure below shows a simplified CSI. The D-PHY transmits data by using one pair of source-synchronized differential clocks and one to four pairs of differential data lanes. Data is transmitted in Double Data Rate (DDR) mode, that is, data is transmitted on both the rising and falling edges of the clock.
**Figure 1** CSI TX and RX interfaces<a name="fig1_MIPI_CSIDes"></a>
![](figures/CSI_TX-RX_interface.png)
### ComboDevAttr Structure<a name="section1.1_MIPI_CSIDes"></a>
**Table 1** ComboDevAttr structure
<a name="table1_MIPI_CSIDes"></a>
| Name | Description |
| --------- | ----------------------------------------------------- |
| devno | Device number. |
| inputMode | Input mode, which can be MIPI, LVDS, sub-LVDS, HiSPI, or DC. |
| dataRate | Input rate of the MIPI RX scalable low voltage signaling (SLVS). |
| imgRect | Crop area of the MIPI RX device (same as the size of the input image of the sensor).|
| MIPIAttr | Attributes of the MIPI device. |
| lvdsAttr | Attributes of the LVDS, sub-LVDS, or HiSPi device. |
### ExtDataType Structure<a name="section1.2_MIPI_CSIDes"></a>
**Table 2** ExtDataType structure
<a name="table2_MIPI_CSIDes"></a>
| Name | Description |
| --------------- | ------------------------------- |
| devno | Device number. |
| num | Sensor number. |
| extDataBitWidth | Bit depth of an image. |
| extDataType | Pointer to the YUV, raw data format, and bit depth.|
### Available APIs<a name="section1.3_MIPI_CSIDes"></a>
**Table 3** MIPI CSI APIs
<a name="table3_MIPI_CSIDes"></a>
| Category| API|
| -------- | -------- |
| Opening or closing the MIPI CSI controller operation handle| **MipiCsiOpen**: opens the MIPI CSI controller operation handle.<br>**MipiCsiClose**: closes the MIPI CSI controller operation handle.|
| Setting MIPI CSI parameters| **MipiCsiSetComboDevAttr**: sets parameters of the MIPI, CMOS, or LVDS camera to the controller. The parameters include the working mode, image area, image depth, data rate, and physical channel.<br>**MipiCsiSetExtDataType** (optional): sets the YUV and RAW data formats and bit depths.<br>**MipiCsiSetHsMode**: sets the MIPI RX lane distribution. Set the mode based on the hardware connection.<br>**MipiCsiSetPhyCmvmode**: sets the common-mode voltage (CMV) mode.|
| Resetting a sensor or deasserting the reset of a sensor| **MipiCsiResetSensor**: resets a sensor.<br>**MipiCsiUnresetSensor**: deasserts the reset of a sensor.|
| Resetting the MIPI RX or deasserting the reset of the MIPI RX| **MipiCsiResetRx**: resets the MIPI&amp;nbsp;RX. The value of **enSnsType** varies depending on the value of **s32WorkingViNum**.<br>**MipiCsiUnresetRx**: deasserts the reset on the MIPI&amp;nbsp;RX.|
| Enabling or disabling the MIPI clock| **MipiCsiEnableClock**: enables the MIPI clock. The **enSnsType** passed by the upper-layer function during electrophoresis determines whether MIPI or LVDS is used.<br>**MipiCsiDisableClock**: disables the MIPI clock.|
| Enabling or disabling the MIPI sensor clock| **MipiCsiEnableSensorClock**: enables the MIPI sensor clock.<br>**MipiCsiDisableSensorClock**: disables the MIPI sensor clock.|
## Usage Guidelines<a name="section2_MIPI_CSIDes"></a>
### How to Use<a name="section2.1_MIPI_CSIDes"></a>
The figure below shows the process of using a MIPI CSI device.
**Figure 2** MIPI CSI usage process<a name="fig2_MIPI_CSIDes"></a>
![](figures/process-of-using-MIPI-CSI.png)
### Opening the MIPI CSI Controller Operation Handle<a name="section2.2_MIPI_CSIDes"></a>
Before starting MIPI CSI communication, call **MipiCsiOpen** to open the MIPI CSI device handle. This function returns the MIPI CSI device handle with the specified lane ID.
```c
DevHandle MipiCsiOpen(uint8_t id);
```
**Table 4** Description of MipiCsiOpen
<a name="table4_MIPI_CSIDes"></a>
| Parameter | Description |
| ---------- | ----------------------------------------------- |
| id | MIPI CSI lane ID. |
| **Return Value**| **Description** |
| NULL | The operation fails. |
| Device handle | MIPI CSI device handle with the specified lane ID. The data type is **DevHandle**.|
For example, open the controller operation handle for MIPI CSI lane 0:
```c
DevHandle mipiCsiHandle = NULL; /* Device handle */
id = 0; /* MIPI CSI lane ID */
/* Open the controller operation handle. */
MipiCsiHandle = MipiCsiOpen(id);
if (MipiCsiHandle == NULL) {
HDF_LOGE("MipiCsiOpen: failed\n");
return;
}
```
### Setting MIPI CSI Parameters<a name="section2.3_MIPI_CSIDes"></a>
- Set MIPI CSI parameters.
```c
int32_t MipiCsiSetComboDevAttr(DevHandle handle, ComboDevAttr *pAttr);
```
**Table 5** Description of MipiCsiSetComboDevAttr
<a name="table5_MIPI_CSIDes"></a>
| Parameter | Description |
| ---------- | -------------------------- |
| handle | Controller operation handle. |
| pAttr | Pointer to the MIPI CSI structure.|
| **Return Value**| **Description** |
| 0 | The operation is successful. |
| Negative value | The operation fails. |
```c
int32_t ret;
struct ComboDevAttr attr;
/* The current configuration is as follows: */
(void)memset_s(&attr, sizeof(ComboDevAttr), 0, sizeof(ComboDevAttr));
attr.devno = 0; /* Device 0 */
attr.inputMode = INPUT_MODE_MIPI; /* The input mode is MIPI. */
attr.dataRate = MIPI_DATA_RATE_X1; /* The data rate is 1 pixel per clock cycle. */
attr.imgRect.x = 0; /* The value 0 indicates the upper left position of the image sensor. */
attr.imgRect.y = 0; /* The value 0 indicates the upper right position of the image sensor. */
attr.imgRect.width = 2592; /* The width of the image sensor is 2592. */
attr.imgRect.height = 1944; /* The height of the image sensor is 1944. */
/* Write the MIPI CSI configuration. */
ret = MipiCsiSetComboDevAttr(MipiCsiHandle, &attr);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiSetComboDevAttr fail! ret=%d\n", __func__, ret);
return -1;
}
```
- Set the YUV, RAW data format, and bit depth.
```c
int32_t MipiCsiSetExtDataType(DevHandle handle, ExtDataType* dataType);
```
**Table 6** Description of MipiCsiSetExtDataType
<a name="table6_MIPI_CSIDes"></a>
| Parameter | Description |
| ---------- | ------------------------------- |
| handle | Controller operation handle. |
| dataType | Pointer to the YUV, raw data format, and bit depth.|
| **Return Value**| **Description** |
| 0 | The operation is successful. |
| Negative value | The operation fails. |
```c
int32_t ret;
struct ExtDataType dataType;
/* Set the YUV, raw data format, and bit depth. */
dataType.devno = 0; /* Device 0 */
dataType.num = 0; /* sensor 0 */
dataType.extDataBitWidth[0] = 12; /* Bit depth array element 0 */
dataType.extDataBitWidth[1] = 12; /* Bit depth array element 1 */
dataType.extDataBitWidth[2] = 12; /* Bit depth array element 2 */
dataType.extDataType[0] = 0x39; /* Define YUV, raw data format, and bit depth element 0. */
dataType.extDataType[1] = 0x39; /* Define YUV, raw data format, and bit depth element 1. */
dataType.extDataType[2] = 0x39; /* Define YUV, raw data format, and bit depth element 2. */
/* Set the YUV, raw data format, and bit depth. */
ret = MipiCsiSetExtDataType(MipiCsiHandle, &dataType);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiSetExtDataType fail! ret=%d\n", __func__, ret);
return -1;
}
```
- Set the MIPI RX lane distribution.
```c
int32_t MipiCsiSetHsMode(DevHandle handle, LaneDivideMode laneDivideMode);
```
**Table 7** Description of MipiCsiSetHsMode
<a name="table7_MIPI_CSIDes"></a>
| Parameter | Description |
| -------------- | -------------- |
| handle | Controller operation handle.|
| laneDivideMode | Lane mode. |
| **Return Value** | **Description**|
| 0 | The operation is successful. |
| Negative value | The operation fails. |
```c
int32_t ret;
enum LaneDivideMode mode;
/* Set the lane mode to 0. */
mode = LANE_DIVIDE_MODE_0;
/* Set the MIPI RX lane distribution. */
ret = MipiCsiSetHsMode(MipiCsiHandle, mode);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiSetHsMode fail! ret=%d\n", __func__, ret);
return -1;
}
```
- Set the CMV mode.
```c
int32_t MipiCsiSetPhyCmvmode(DevHandle handle, uint8_t devno, PhyCmvMode cmvMode);
```
**Table 8** Description of MipiCsiSetPhyCmvmode
<a name="table8_MIPI_CSIDes"></a>
| Parameter | Description |
| ---------- | ---------------- |
| handle | Controller operation handle. |
| cmvMode | CMV mode.|
| devno | Device number. |
| **Return Value**| **Description** |
| 0 | The operation is successful. |
| Negative value | The operation fails. |
```c
int32_t ret;
enum PhyCmvMode mode;
uint8_t devno;
/* Set the CMV mode to 0. */
mode = PHY_CMV_GE1200MV;
/* The device number is 0. */
devno = 0;
/* Set the CMV mode. */
ret = MipiCsiSetPhyCmvmode(MipiCsiHandle, devno, mode);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiSetPhyCmvmode fail! ret=%d\n", __func__, ret);
return -1;
}
```
### Resetting a Sensor or Deasserting the Reset of a Sensor<a name="section2.4_MIPI_CSIDes"></a>
- Reset a sensor.
```c
int32_t MipiCsiResetSensor(DevHandle handle, uint8_t snsResetSource);
```
**Table 9** Description of MipiCsiResetSensor
<a name="table9_MIPI_CSIDes"></a>
| Parameter | Description |
| -------------- | ------------------------------------------------ |
| handle | Controller operation handle. |
| snsResetSource | Sensor's reset signal cable number, which is called reset source of the sensor in software.|
| **Return Value** | **Description** |
| 0 | The operation is successful. |
| Negative value | The operation fails. |
```c
int32_t ret;
uint8_t snsResetSource;
/* The sensor's reset signal cable number is 0. */
snsResetSource = 0;
/* Reset the sensor. */
ret = MipiCsiResetSensor(MipiCsiHandle, snsResetSource);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiResetSensor fail! ret=%d\n", __func__, ret);
return -1;
}
```
- Deassert the reset of a sensor.
```c
int32_t MipiCsiUnresetSensor(DevHandle handle, uint8_t snsResetSource);
```
**Table 10** Description of MipiCsiUnresetSensor
<a name="table10_MIPI_CSIDes"></a>
| Parameter | Description |
| -------------- | ------------------------------------------------ |
| handle | Controller operation handle. |
| snsResetSource | Sensor's reset signal cable number, which is called reset source of the sensor in software.|
| **Return Value** | **Description** |
| 0 | The operation is successful. |
| Negative value | The operation fails. |
```c
int32_t ret;
uint8_t snsResetSource;
/* The sensor's reset signal cable number is 0. */
snsResetSource = 0;
/* Deassert the reset of the sensor. */
ret = MipiCsiUnresetSensor(MipiCsiHandle, snsResetSource);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiUnresetSensor fail! ret=%d\n", __func__, ret);
return -1;
}
```
### Resetting the MIPI RX or Deasserting the Reset of the MIPI RX<a name="section2.5_MIPI_CSIDes"></a>
- Reset the MIPI RX.
```c
int32_t MipiCsiResetRx(DevHandle handle, uint8_t comboDev);
```
**Table 11** Description of MipiCsiResetRx
<a name="table11_MIPI_CSIDes"></a>
| Parameter | Description |
| ---------- | --------------------- |
| handle | Controller operation handle. |
| comboDev | MIPI RX or LVDS channel number.|
| **Return Value**| **Description** |
| 0 | The operation is successful. |
| Negative value | The operation fails. |
```c
int32_t ret;
uint8_t comboDev;
/* The channel number is 0.*/
comboDev = 0;
/* Reset the MIPI RX. */
ret = MipiCsiResetRx(MipiCsiHandle, comboDev);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiResetRx fail! ret=%d\n", __func__, ret);
return -1;
}
```
- Deassert the reset of the MIPI RX.
```c
int32_t MipiCsiUnresetRx(DevHandle handle, uint8_t comboDev);
```
**Table 12** Description of MipiCsiUnresetRx
<a name="table12_MIPI_CSIDes"></a>
| Parameter | Description |
| ---------- | --------------------- |
| handle | Controller operation handle. |
| comboDev | MIPI RX or LVDS channel number.|
| **Return Value**| **Description** |
| 0 | The operation is successful. |
| Negative value | The operation fails. |
```c
int32_t ret;
uint8_t comboDev;
/* The channel number is 0.*/
comboDev = 0;
/* Deassert the reset of the MIPI RX. */
ret = MipiCsiUnresetRx(MipiCsiHandle, comboDev);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiUnresetRx fail! ret=%d\n", __func__, ret);
return -1;
}
```
### Enabling or Disabling the MIPI Clock<a name="section2.6_MIPI_CSIDes"></a>
- Enable the MIPI clock.
```c
int32_t MipiCsiEnableClock(DevHandle handle, uint8_t comboDev);
```
**Table 13** Description of MipiCsiEnableClock
<a name="table13_MIPI_CSIDes"></a>
| Parameter | Description |
| ---------- | -------------- |
| handle | Controller operation handle.|
| comboDev | Channel number. |
| **Return Value**| **Description**|
| 0 | The operation is successful. |
| Negative value | The operation fails. |
```c
int32_t ret;
uint8_t comboDev;
/* The channel number is 0.*/
comboDev = 0;
/* Enable the MIPI clock. */
ret = MipiCsiEnableClock(MipiCsiHandle, comboDev);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiEnableClock fail! ret=%d\n", __func__, ret);
return -1;
}
```
- Disable the MIPI clock.
```c
int32_t MipiCsiDisableClock(DevHandle handle, uint8_t comboDev);
```
**Table 14** Description of MipiCsiDisableClock
<a name="table14_MIPI_CSIDes"></a>
| Parameter | Description |
| ---------- | -------------- |
| handle | Controller operation handle.|
| comboDev | Channel number. |
| **Return Value**| **Description**|
| 0 | The operation is successful. |
| Negative value | The operation fails. |
```c
int32_t ret;
uint8_t comboDev;
/* The channel number is 0.*/
comboDev = 0;
/* Disable the MIPI clock. */
ret = MipiCsiDisableClock(MipiCsiHandle, comboDev);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiDisableClock fail! ret=%d\n", __func__, ret);
return -1;
}
```
### Enabling or Disabling the MIPI Sensor Clock<a name="section2.7_MIPI_CSIDes"></a>
- Enable the MIPI sensor clock.
```c
int32_t MipiCsiEnableSensorClock(DevHandle handle, uint8_t snsClkSource);
```
**Table 15** Description of MipiCsiEnableSensorClock
<a name="table15_MIPI_CSIDes"></a>
| Parameter | Description |
| ------------ | ------------------------------------------------ |
| handle | Controller operation handle. |
| snsClkSource | Sensor's clock signal cable number, which is called clock source of the sensor in software.|
| **Return Value** | **Description** |
| 0 | The operation is successful. |
| Negative value | The operation fails. |
```c
int32_t ret;
uint8_t snsClkSource;
/* The sensor's clock signal cable number is 0. */
snsClkSource = 0;
/* Enable the MIPI sensor clock. */
ret = MipiCsiEnableSensorClock(MipiCsiHandle, snsClkSource);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiEnableSensorClock fail! ret=%d\n", __func__, ret);
return -1;
}
```
- Disable the MIPI sensor clock.
```c
int32_t MipiCsiDisableSensorClock(DevHandle handle, uint8_t snsClkSource);
```
**Table 16** Description of MipiCsiDisableSensorClock
<a name="table16_MIPI_CSIDes"></a>
| Parameter | Description |
| ------------ | ------------------------------------------------ |
| handle | Controller operation handle. |
| snsClkSource | Sensor's clock signal cable number, which is called clock source of the sensor in software.|
| **Return Value** | **Description** |
| 0 | The operation is successful. |
| Negative value | The operation fails. |
```c
int32_t ret;
uint8_t snsClkSource;
/* The sensor's clock signal cable number is 0. */
snsClkSource = 0;
/* Disable the MIPI sensor clock. */
ret = MipiCsiDisableSensorClock(MipiCsiHandle, snsClkSource);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiDisableSensorClock fail! ret=%d\n", __func__, ret);
return -1;
}
```
### Closing a MIPI CSI Controller Operation Handle<a name="section2.8_MIPI_CSIDes"></a>
After the MIPI CSI communication, close the MIPI CSI controller handle by calling the following function:
```c
void MipiCsiClose(DevHandle handle);
```
This function releases the resources requested by **MipiCsiOpen**.
**Table 17** Description of MipiCsiClose
<a name="table17_MIPI_CSIDes"></a>
| Parameter | Description |
| ------------ | ------------------------------------------------ |
| handle | MIPI CSI controller operation handle. |
```c
MipiCsiClose(MIPIHandle); /* Close the operation handle of the MIPI CSI controller. */
```
## Development Example<a name="section3_MIPI_CSIDes"></a>
The sample code is as follows:
```c
#include "hdf.h"
#include "MIPI_csi_if.h"
void PalMipiCsiTestSample(void)
{
uint8_t id;
int32_t ret;
uint8_t comboDev;
uint8_t snsClkSource;
uint8_t devno;
enum LaneDivideMode mode;
enum PhyCmvMode mode;
struct ComboDevAttr attr;
struct ExtDataType dataType;
DevHandle MipiCsiHandle = NULL;
/* Controller ID */
id = 0;
/* Open the controller operation handle. */
MipiCsiHandle = MipiCsiOpen(id);
if (MipiCsiHandle == NULL) {
HDF_LOGE("MipiCsiOpen: failed!\n");
return;
}
/* Set the lane mode to 0. */
mode = LANE_DIVIDE_MODE_0;
/* Set the MIPI RX lane distribution. */
ret = MipiCsiSetHsMode(MipiCsiHandle, mode);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiSetHsMode fail! ret=%d\n", __func__, ret);
return;
}
/* The channel number is 0.*/
comboDev = 0;
/* Enable the MIPI clock. */
ret = MipiCsiEnableClock(MipiCsiHandle, comboDev);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiEnableClock fail! ret=%d\n", __func__, ret);
return;
}
/* Reset the MIPI RX. */
ret = MipiCsiResetRx(MipiCsiHandle, comboDev);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiResetRx fail! ret=%d\n", __func__, ret);
return;
}
/* The sensor's clock signal cable number is 0. */
snsClkSource = 0;
/* Enable the MIPI sensor clock. */
ret = MipiCsiEnableSensorClock(MipiCsiHandle, snsClkSource);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiEnableSensorClock fail! ret=%d\n", __func__, ret);
return;
}
/* Reset the sensor. */
ret = MipiCsiResetSensor(MipiCsiHandle, snsResetSource);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiResetSensor fail! ret=%d\n", __func__, ret);
return;
}
/* Set MIPI parameters. */
(void)memset_s(&attr, sizeof(ComboDevAttr), 0, sizeof(ComboDevAttr));
attr.devno = 0; /* Device 0 */
attr.inputMode = INPUT_MODE_MIPI; /* The input mode is MIPI. */
attr.dataRate = MIPI_DATA_RATE_X1; /* The data rate is 1 pixel per clock cycle. */
attr.imgRect.x = 0; /* The value 0 indicates the upper left position of the image sensor. */
attr.imgRect.y = 0; /* The value 0 indicates the upper right position of the image sensor. */
attr.imgRect.width = 2592; /* The width of the image sensor is 2592. */
attr.imgRect.height = 1944; /* The height of the image sensor is 1944. */
/* Write the MIPI CSI configuration. */
ret = MipiCsiSetComboDevAttr(MipiCsiHandle, &attr);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiSetComboDevAttr fail! ret=%d\n", __func__, ret);
return;
}
/* Set the CMV mode to 0. */
mode = PHY_CMV_GE1200MV;
/* The device number is 0. */
devno = 0;
/* Set the CMV mode. */
ret = MipiCsiSetPhyCmvmode(MipiCsiHandle, devno, mode);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiSetPhyCmvmode fail! ret=%d\n", __func__, ret);
return;
}
/* The channel number is 0.*/
comboDev = 0;
/* Deassert the reset of the MIPI RX. */
ret = MipiCsiUnresetRx(MipiCsiHandle, comboDev);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiUnresetRx fail! ret=%d\n", __func__, ret);
return;
}
/* Disable the MIPI clock. */
ret = MipiCsiDisableClock(MipiCsiHandle, comboDev);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiDisableClock fail! ret=%d\n", __func__, ret);
return;
}
/* The sensor's reset signal cable number is 0. */
snsResetSource = 0;
/* Deassert the reset of the sensor. */
ret = MipiCsiUnresetSensor(MipiCsiHandle, snsResetSource);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiUnresetSensor fail! ret=%d\n", __func__, ret);
return;
}
/* Disable the MIPI sensor clock. */
ret = MipiCsiDisableSensorClock(MipiCsiHandle, snsClkSource);
if (ret != 0) {
HDF_LOGE("%s: MipiCsiDisableSensorClock fail! ret=%d\n", __func__, ret);
return;
}
/* Close the MIPI CSI device handle. */
MipiCsiClose(MipiCsiHandle);
}
```
......@@ -308,7 +308,7 @@
- [Startup](subsystems/subsys-boot.md)
- [DFX](subsystems/subsys-dfx.md)
- Featured Topics
- [HPM Bundle](bundles/Readme-EN.md)
- HPM Bundle
- [Development Specifications](bundles/bundles-standard-rules.md)
- Development Guidelines
- [Bundle Development](bundles/bundles-guide-overview.md)
......@@ -333,7 +333,7 @@
- [Samples](https://gitee.com/openharmony/app_samples/blob/master/README.md)
- [Codelabs](https://gitee.com/openharmony/codelabs/blob/master/README.md)
- References
- [FAQs](faqs/Readme-EN.md)
- FAQs
- [Overview of FAQs](faqs/faqs-overview.md)
- [Environment Setup](faqs/faqs-environment-setup.md)
- [Compilation and Building Subsystem](faqs/faqs-building.md)
......
- [Application Development Overview](application-dev-guide.md)
- Quick Start
- [Getting Started with Application Development](quick-start/Readme-EN.md)
- DevEco Studio (OpenHarmony) User Guide
- [Overview](quick-start/deveco-studio-overview.md)
- [Version Change History](quick-start/deveco-studio-release-notes.md)
- [Configuring the OpenHarmony SDK](quick-start/configuring-openharmony-sdk.md)
- [Creating an OpenHarmony Project](quick-start/create-openharmony-project.md)
- [Using the Project Wizard to Create a Project](quick-start/use-wizard-to-create-project.md)
- [Importing a Sample to Create a Project](quick-start/import-sample-to-create-project.md)
- [Configuring the OpenHarmony App Signature](quick-start/configuring-openharmony-app-signature.md)
- [Installing and Running Your OpenHarmony App](quick-start/installing-openharmony-app.md)
- [Directory Structure](quick-start/package-structure.md)
- Development
- UI
- JavaScript-based Web-Like Development Paradigm
- [Overview](ui/ui-js-overview.md)
- Framework
- [File Organization](ui/js-framework-file.md)
- ["js" Tag](ui/js-framework-js-tag.md)
- [app.js](ui/js-framework-js-file.md)
- Syntax
- [HML](ui/js-framework-syntax-hml.md)
- [CSS](ui/js-framework-syntax-css.md)
- [JavaScript](ui/js-framework-syntax-js.md)
- [Lifecycle](ui/js-framework-lifecycle.md)
- [Resource Limitations and Access](ui/js-framework-resource-restriction.md)
- [Multi-Language Capability](ui/js-framework-multiple-languages.md)
- Building the UI
- [Component Overview](ui/ui-js-building-ui-component.md)
- Building the Layout
- [Layout Description](ui/ui-js-building-ui-layout-intro.md)
- [Adding Title and Paragraph Text](ui/ui-js-building-ui-layout-text.md)
- [Adding an Image](ui/ui-js-building-ui-layout-image.md)
- [Adding a Comment](ui/ui-js-building-ui-layout-comment.md)
- [Adding a Container](ui/ui-js-building-ui-layout-external-container.md)
- [Adding Interactions](ui/ui-js-building-ui-interactions.md)
- [Developing Animations](ui/ui-js-building-ui-animation.md)
- [Defining Events](ui/ui-js-building-ui-event.md)
- [Defining Page Routes](ui/ui-js-building-ui-routes.md)
- Common Component Development Guidelines
- [Text](ui/ui-js-components-text.md)
- [Input](ui/ui-js-components-input.md)
- [Button](ui/ui-js-components-button.md)
- [List](ui/ui-js-components-list.md)
- [Picker](ui/ui-js-components-picker.md)
- [Dialog](ui/ui-js-components-dialog.md)
- [Form](ui/ui-js-components-form.md)
- [Stepper](ui/ui-js-components-stepper.md)
- [Tabs](ui/ui-js-component-tabs.md)
- [Image](ui/ui-js-components-images.md)
- Animation Development Guidelines
- CSS Animation
- [Defining Attribute Style Animations](ui/ui-js-animate-attribute-style.md)
- [Defining Animations with the transform Attribute](ui/ui-js-animate-transform.md)
- [Defining Animations with the background-position Attribute](ui/ui-js-animate-background-position-style.md)
- JS Animation
- [Component Animation](ui/ui-js-animate-component.md)
- Interpolator Animation
- [Animation Effect](ui/ui-js-animate-dynamic-effects.md)
- [Animation Frame](ui/ui-js-animate-frame.md)
- [Custom Components](ui/ui-js-custom-components.md)
- TypeScript-based Declarative Development Paradigm
- [Overview](ui/ui-ts-overview.md)
- Framework Overview
- File Organization
- [Directory Structure](ui/ts-framework-directory.md)
- [Rules for Accessing Application Code Files](ui/ts-framework-file-access-rules.md)
- ["js" Tag](ui/ts-framework-js-tag.md)
- Resource Access
- [Media Resource Types](ui/ts-media-resource-type.md)
- [Pixel Units](ui/ts-pixel-units.md)
- [Types](ui/ts-types.md)
- Declarative Syntax
- [Overview](ui/ts-syntax-intro.md)
- General UI Description Specifications
- [Basic Concepts](ui/ts-general-ui-concepts.md)
- Declarative UI Description Specifications
- [Parameterless Configuration](ui/ts-parameterless-configuration.md)
- [Configuration with Mandatory Parameters](ui/ts-configuration-with-mandatory-parameters.md)
- [Attribution Configuration](ui/ts-attribution-configuration.md)
- [Event Configuration](ui/ts-event-configuration.md)
- [Child Component Configuration](ui/ts-child-component-configuration.md)
- Componentization
- [@Component](ui/ts-component-based-component.md)
- [@Entry](ui/ts-component-based-entry.md)
- [@Preview](ui/ts-component-based-preview.md)
- [@Builder](ui/ts-component-based-builder.md)
- [@Extend](ui/ts-component-based-extend.md)
- [@CustomDialog](ui/ts-component-based-customdialog.md)
- About UI State Management
- [Basic Concepts](ui/ts-ui-state-mgmt-concepts.md)
- Managing Component States
- [@State](ui/ts-component-states-state.md)
- [@Prop](ui/ts-component-states-prop.md)
- [@Link](ui/ts-component-states-link.md)
- Managing Application States
- [AppStorage](ui/ts-application-states-appstorage.md)
- [PersistentStorage](ui/ts-application-states-apis-persistentstorage.md)
- [Environment](ui/ts-application-states-apis-environment.md)
- Managing Other States
- [@observed and @objectLink](ui/ts-other-states-observed-objectlink.md)
- [@Consume and @Provide](ui/ts-other-states-consume-provide.md)
- [@Watch](ui/ts-other-states-watch.md)
- About Rendering Control Syntax
- [if/else](ui/ts-rending-control-syntax-if-else.md)
- [ForEach](ui/ts-rending-control-syntax-foreach.md)
- [LazyForEach](ui/ts-rending-control-syntax-lazyforeach.md)
- About @Component
- [build Function](ui/ts-function-build.md)
- [Custom Component Initialization](ui/ts-custom-component-initialization.md)
- [Custom Component Lifecycle Callbacks](ui/ts-custom-component-lifecycle-callbacks.md)
- [Example: Component Creation and Re-Initialization](ui/ts-component-creation-re-initialization.md)
- [Syntactic Sugar](ui/ts-syntactic-sugar.md)
- Experiencing the Declarative UI
- [Creating a Declarative UI Project](ui/ui-ts-creating-project.md)
- [Getting to Know Components](ui/ui-ts-components.md)
- [Creating a Simple Page](ui/ui-ts-creating-simple-page.md)
- Defining Page Layout and Connection
- [Building a Food Data Model](ui/ui-ts-building-data-model.md)
- [Building a Food Category List Layout](ui/ui-ts-building-category-list-layout.md)
- [Building a Food Category Grid Layout](ui/ui-ts-building-category-grid-layout.md)
- [Implementing Page Redirection and Data Transmission](ui/ui-ts-page-redirection-data-transmission.md)
- Basic Functions
- Agent-Powered Scheduled Reminders
- [Overview](background-agent-scheduled-reminder/background-agent-scheduled-reminder-overview.md)
- [Development Guidelines](background-agent-scheduled-reminder/background-agent-scheduled-reminder-guide.md)
- Background Task Management
- [Background Task Management Overview](background-task-management/background-task-overview.md)
- [Background Task Management Development](background-task-management/background-task-dev-guide.md)
- WebGL
- [WebGL Overview](webgl/webgl-overview.md)
- [WebGL Development](webgl/webgl-guidelines.md)
- Media
- Audio
- [Audio Overview](media/audio-overview.md)
- [Audio Playback Development](media/audio-playback.md)
- [Audio Playback Development Using AudioRenderer](media/audio-renderer.md)
- [Audio Recording Development](media/audio-recorder.md)
- [Audio Recorder Development Using AudioCapturer](media/audio-capturer)
- Video
- [Video Playback Development](media/video-playback.md)
- [Video Recording Development](media/video-recorder.md)
- Security
- User Authentication
- [User Authentication Overview](security/userauth-overview.md)
- [User Authentication Development](security/userauth-guidelines.md)
- Connectivity
- IPC & RPC
- [IPC & RPC Overview](connectivity/ipc-rpc-overview.md)
- [IPC & RPC Development Guidelines](connectivity/ipc-rpc-development-guideline.md)
- [Subscribing to State Changes of a Remote Object](connectivity/subscribe-remote-state.md)
- Data Management
- Distributed Data Service
- [Distributed Data Service Overview](database/database-mdds-overview.md)
- [Distributed Data Service Development](database/database-mdds-guidelines.md)
- Relational Database Overview
- [RDB Overview](database/database-relational-overview.md)
- [RDB Development](database/database-relational-guidelines.md)
- Lightweight Data Store
- [Lightweight Data Store Overview](database/database-preference-overview.md)
- [Lightweight Data Store Development](database/database-preference-guidelines.md)
- Device
- USB Service
- [USB Service Overview](device/usb-overview.md)
- [USB Service Development](device/usb-guidelines.md)
- Location
- [Location Overview](device/device-location-overview.md)
- [Obtaining Device Location Information](device/device-location-info.md)
- [Geocoding and Reverse Geocoding Capabilities](device/device-location-geocoding.md)
- DFX
- Application Event Logging
- [Overview of Application Event Logging](dfx/hiappevent-overview.md)
- [Development Guidelines on Application Event Logging](dfx/hiappevent-guidelines.md)
- Tools
- DevEco Studio (OpenHarmony) User Guide
- [Overview](quick-start/deveco-studio-overview.md)
- [Version Change History](quick-start/deveco-studio-release-notes.md)
- [Configuring the OpenHarmony SDK](quick-start/configuring-openharmony-sdk.md)
- [Creating an OpenHarmony Project](quick-start/create-openharmony-project.md)
- [Configuring the OpenHarmony App Signature](quick-start/configuring-openharmony-app-signature.md)
- [Installing and Running Your OpenHarmony App](quick-start/installing-openharmony-app.md)
- Hands-On Tutorials
- [Samples](https://gitee.com/openharmony/app_samples/blob/master/README.md)
- API References
- Compent Reference (JavaScript-based Web-like Development Paradigm)
- [Components](reference/arkui-js/js-components.md)
- [Common](reference/arkui-js/js-components-common.md)
- [Universal Attributes](reference/arkui-js/js-components-common-attributes.md)
- [Universal Styles](reference/arkui-js/js-components-common-styles.md)
- [Universal Events](reference/arkui-js/js-components-common-events.md)
- [Universal Methods](reference/arkui-js/js-components-common-methods.md)
- [Animation Styles](reference/arkui-js/js-components-common-animation.md)
- [Gradient Styles](reference/arkui-js/js-components-common-gradient.md)
- [Transition Styles](reference/arkui-js/js-components-common-transition.md)
- [Custom Font Styles](reference/arkui-js/js-components-common-customizing-font.md)
- [Atomic Layout](reference/arkui-js/js-components-common-atomic-layout.md)
- [Container Component](reference/arkui-js/js-components-container.md)
- [badge](reference/arkui-js/js-components-container-badge.md)
- [dialog](reference/arkui-js/js-components-container-dialog.md)
- [div](reference/arkui-js/js-components-container-div.md)
- [form](reference/arkui-js/js-components-container-form.md)
- [list](reference/arkui-js/js-components-container-list.md)
- [list-item](reference/arkui-js/js-components-container-list-item.md)
- [list-item-group](reference/arkui-js/js-components-container-list-item-group.md)
- [panel](reference/arkui-js/js-components-container-panel.md)
- [popup](reference/arkui-js/js-components-container-popup.md)
- [refresh](reference/arkui-js/js-components-container-refresh.md)
- [stack](reference/arkui-js/js-components-container-stack.md)
- [stepper](reference/arkui-js/js-components-container-stepper.md)
- [stepper-item](reference/arkui-js/js-components-container-stepper-item.md)
- [swiper](reference/arkui-js/js-components-container-swiper.md)
- [tabs](reference/arkui-js/js-components-container-tabs.md)
- [tab-bar](reference/arkui-js/js-components-container-tab-bar.md)
- [tab-content](reference/arkui-js/js-components-container-tab-content.md)
- [Basic Components](reference/arkui-js/js-components-basic.md)
- [button](reference/arkui-js/js-components-basic-button.md)
- [chart](reference/arkui-js/js-components-basic-chart.md)
- [divider](reference/arkui-js/js-components-basic-divider.md)
- [image](reference/arkui-js/js-components-basic-image.md)
- [image-animator](reference/arkui-js/js-components-basic-image-animator.md)
- [input](reference/arkui-js/js-components-basic-input.md)
- [label](reference/arkui-js/js-components-basic-label.md)
- [marquee](reference/arkui-js/js-components-basic-marquee.md)
- [menu](reference/arkui-js/js-components-basic-menu.md)
- [option](reference/arkui-js/js-components-basic-option.md)
- [picker](reference/arkui-js/js-components-basic-picker.md)
- [picker-view](reference/arkui-js/js-components-basic-picker-view.md)
- [piece](reference/arkui-js/js-components-basic-piece.md)
- [progress](reference/arkui-js/js-components-basic-progress.md)
- [qrcode](reference/arkui-js/js-components-basic-qrcode.md)
- [rating](reference/arkui-js/js-components-basic-rating.md)
- [richtext](reference/arkui-js/js-components-basic-richtext.md)
- [search](reference/arkui-js/js-components-basic-search.md)
- [select](reference/arkui-js/js-components-basic-select.md)
- [slider](reference/arkui-js/js-components-basic-slider.md)
- [span](reference/arkui-js/js-components-basic-span.md)
- [switch](reference/arkui-js/js-components-basic-switch.md)
- [text](reference/arkui-js/js-components-basic-text.md)
- [textarea](reference/arkui-js/js-components-basic-textarea.md)
- [toolbar](reference/arkui-js/js-components-basic-toolbar.md)
- [toolbar-item](reference/arkui-js/js-components-basic-toolbar-item.md)
- [toggle](reference/arkui-js/js-components-basic-toggle.md)
- [Media Components](reference/arkui-js/js-components-media.md)
- [video](reference/arkui-js/js-components-media-video.md)
- [Canvas Components](reference/arkui-js/js-components-canvas.md)
- [canvas](reference/arkui-js/js-components-canvas-canvas.md)
- [CanvasRenderingContext2D](reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md)
- [Image](reference/arkui-js/js-components-canvas-image.md)
- [CanvasGradient](reference/arkui-js/js-components-canvas-canvasgradient.md)
- [ImageData](reference/arkui-js/js-components-canvas-imagedata.md)
- [Path2D](reference/arkui-js/js-components-canvas-path2d.md)
- [ImageBitmap](reference/arkui-js/js-components-canvas-imagebitmap.md)
- [OffscreenCanvas](reference/arkui-js/js-components-canvas-offscreencanvas.md)
- [OffscreenCanvasRenderingContext2D](reference/arkui-js/js-offscreencanvasrenderingcontext2d.md)
- [Grid](reference/arkui-js/js-components-grid.md)
- [Basic Concepts](reference/arkui-js/js-components-grid-basic-concepts.md)
- [grid-container](reference/arkui-js/js-components-grid-container.md)
- [grid-row](reference/arkui-js/js-components-grid-row.md)
- [grid-col](reference/arkui-js/js-components-grid-col.md)
- [SVG Components](reference/arkui-js/js-svg.md)
- [Universal Attributes](reference/arkui-js/js-components-svg-common-attributes.md)
- [svg](reference/arkui-js/js-components-svg.md)
- [rect](reference/arkui-js/js-components-svg-rect.md)
- [circle](reference/arkui-js/js-components-svg-circle.md)
- [ellipse](reference/arkui-js/js-components-svg-ellipse.md)
- [path](reference/arkui-js/js-components-svg-path.md)
- [line](reference/arkui-js/js-components-svg-line.md)
- [polyline](reference/arkui-js/js-components-svg-polyline.md)
- [polygon](reference/arkui-js/js-components-svg-polygon.md)
- [text](reference/arkui-js/js-components-svg-text.md)
- [tspan](reference/arkui-js/js-components-svg-tspan.md)
- [textPath](reference/arkui-js/js-components-svg-textpath.md)
- [animate](reference/arkui-js/js-components-svg-animate.md)
- [animateMotion](reference/arkui-js/js-components-svg-animatemotion.md)
- [animateTransform](reference/arkui-js/js-components-svg-animatetransform.md)
- [Custom Components](reference/arkui-js/js-components-custom.md)
- [Basic Usage](reference/arkui-js/js-components-custom-basic-usage.md)
- [Custom Events](reference/arkui-js/js-components-custom-events.md)
- [props](reference/arkui-js/js-components-custom-props.md)
- [Event Parameter](reference/arkui-js/js-components-custom-event-parameter.md)
- [slot](reference/arkui-js/js-components-custom-slot.md)
- [Lifecycle Definition](reference/arkui-js/js-components-custom-lifecycle.md)
- [Appendix](reference/arkui-js/js-appendix.md)
- [Type Attributes](reference/arkui-js/js-appendix-types.md)
- Compent Reference (TypeScript-based Declarative Development Paradigm)
- [Components](reference/arkui-ts/ts-components.md)
- [Universal Components](reference/arkui-ts/ts-universal-components.md)
- [Universal Events](reference/arkui-ts/ts-universal-events.md)
- [Click Event](reference/arkui-ts/ts-universal-events-click.md)
- [Touch](reference/arkui-ts/ts-universal-events-touch.md)
- [Show/Hide Event](reference/arkui-ts/ts-universal-events-show-hide.md)
- [Key Event](reference/arkui-ts/ts-universal-events-key.md)
- [Component Area Change Event](reference/arkui-ts/ts-universal-events-component-area-change.md)
- [Universal Attributes](reference/arkui-ts/ts-universal-attributes.md)
- [Size](reference/arkui-ts/ts-universal-attributes-size.md)
- [Location](reference/arkui-ts/ts-universal-attributes-location.md)
- [Layout Constraints](reference/arkui-ts/ts-universal-attributes-layout-constraints.md)
- [Flex Layout](reference/arkui-ts/ts-universal-attributes-flex-layout.md)
- [Border Configuration](reference/arkui-ts/ts-universal-attributes-border.md)
- [Background](reference/arkui-ts/ts-universal-attributes-background.md)
- [Opacity](reference/arkui-ts/ts-universal-attributes-opacity.md)
- [Visibility](reference/arkui-ts/ts-universal-attributes-visibility.md)
- [Enable/Disable](reference/arkui-ts/ts-universal-attributes-enable.md)
- [Overlay](reference/arkui-ts/ts-universal-attributes-overlay.md)
- [Z-order Control](reference/arkui-ts/ts-universal-attributes-z-order.md)
- [Transformation](reference/arkui-ts/ts-universal-attributes-transformation.md)
- [Image Effect Configuration](reference/arkui-ts/ts-universal-attributes-image-effect.md)
- [Shape Clipping](reference/arkui-ts/ts-universal-attributes-sharp-clipping.md)
- [Text Style](reference/arkui-ts/ts-universal-attributes-text-style.md)
- [Grid](reference/arkui-ts/ts-universal-attributes-grid.md)
- [Gradient Color](reference/arkui-ts/ts-universal-attributes-gradient-color.md)
- [Popup Control](reference/arkui-ts/ts-universal-attributes-popup.md)
- [Menu Control](reference/arkui-ts/ts-universal-attributes-menu.md)
- [Click Control](reference/arkui-ts/ts-universal-attributes-touchable.md)
- [Touch Target](reference/arkui-ts/ts-universal-attributes-response-region.md)
- [Gesture Processing](reference/arkui-ts/ts-gesture-processing.md)
- [Gesture Binding Methods](reference/arkui-ts/ts-gesture-settings.md)
- [Basic Gestures](reference/arkui-ts/ts-basic-gestures.md)
- [TapGesture](reference/arkui-ts/ts-basic-gestures-tapgesture.md)
- [LongPressGesture](reference/arkui-ts/ts-basic-gestures-longpressgesture.md)
- [PanGesture](reference/arkui-ts/ts-basic-gestures-pangesture.md)
- [PinchGesture](reference/arkui-ts/ts-basic-gestures-pinchgesture.md)
- [RotationGesture](reference/arkui-ts/ts-basic-gestures-rotationgesture.md)
- [SwipeGesture](reference/arkui-ts/ts-basic-gestures-swipegesture.md)
- [Combined Gestures](reference/arkui-ts/ts-combined-gestures.md)
- [Basic Components](reference/arkui-ts/ts-basic-components.md)
- [Blank](reference/arkui-ts/ts-basic-components-blank.md)
- [Button](reference/arkui-ts/ts-basic-components-button.md)
- [DataPanel](reference/arkui-ts/ts-basic-components-datapanel.md)
- [Divider](reference/arkui-ts/ts-basic-components-divider.md)
- [Gauge](reference/arkui-ts/ts-basic-components-gauge.md)
- [Image](reference/arkui-ts/ts-basic-components-image.md)
- [ImageAnimator](reference/arkui-ts/ts-basic-components-imageanimator.md)
- [LoadingProgress](reference/arkui-ts/ts-basic-components-loadingprogress.md)
- [Marquee](reference/arkui-ts/ts-basic-components-marquee.md)
- [Progress](reference/arkui-ts/ts-basic-components-progress.md)
- [QRCode](reference/arkui-ts/ts-basic-components-qrcode.md)
- [Rating](reference/arkui-ts/ts-basic-components-rating.md)
- [Select](reference/arkui-ts/ts-basic-components-select.md)
- [Slider](reference/arkui-ts/ts-basic-components-slider.md)
- [Span](reference/arkui-ts/ts-basic-components-span.md)
- [Text](reference/arkui-ts/ts-basic-components-text.md)
- [TextArea](reference/arkui-ts/ts-basic-components-textarea.md)
- [TextInput](reference/arkui-ts/ts-basic-components-textinput.md)
- [Toggle](reference/arkui-ts/ts-basic-components-toggle.md)
- [TextClock](reference/arkui-ts/ts-basic-components-textclock.md)
- [Container Components](reference/arkui-ts/ts-components-container.md)
- [AlphabetIndexer](reference/arkui-ts/ts-container-alphabet-indexer.md)
- [Badge](reference/arkui-ts/ts-container-badge.md)
- [Column](reference/arkui-ts/ts-container-column.md)
- [ColumnSplit](reference/arkui-ts/ts-container-columnsplit.md)
- [Counter](reference/arkui-ts/ts-container-counter.md)
- [Flex](reference/arkui-ts/ts-container-flex.md)
- [GridContainer](reference/arkui-ts/ts-container-gridcontainer.md)
- [Grid](reference/arkui-ts/ts-container-grid.md)
- [GridItem](reference/arkui-ts/ts-container-griditem.md)
- [List](reference/arkui-ts/ts-container-list.md)
- [ListItem](reference/arkui-ts/ts-container-listitem.md)
- [Navigator](reference/arkui-ts/ts-container-navigator.md)
- [Navigation](reference/arkui-ts/ts-container-navigation.md)
- [Panel](reference/arkui-ts/ts-container-panel.md)
- [Row](reference/arkui-ts/ts-container-row.md)
- [RowSplit](reference/arkui-ts/ts-container-rowsplit.md)
- [Scroll](reference/arkui-ts/ts-container-scroll.md)
- [ScrollBar](reference/arkui-ts/ts-container-scrollbar.md)
- [Stack](reference/arkui-ts/ts-container-stack.md)
- [Swiper](reference/arkui-ts/ts-container-swiper.md)
- [Tabs](reference/arkui-ts/ts-container-tabs.md)
- [TabContent](reference/arkui-ts/ts-container-tabcontent.md)
- [Refresh](reference/arkui-ts/ts-container-refresh.md)
- [Drawing Components](reference/arkui-ts/ts-drawing-components.md)
- [Circle](reference/arkui-ts/ts-drawing-components-circle.md)
- [Ellipse](reference/arkui-ts/ts-drawing-components-ellipse.md)
- [Line](reference/arkui-ts/ts-drawing-components-line.md)
- [Polyline](reference/arkui-ts/ts-drawing-components-polyline.md)
- [Polygon](reference/arkui-ts/ts-drawing-components-polygon.md)
- [Path](reference/arkui-ts/ts-drawing-components-path.md)
- [Rect](reference/arkui-ts/ts-drawing-components-rect.md)
- [Shape](reference/arkui-ts/ts-drawing-components-shape.md)
- [Canvas Components](reference/arkui-ts/ts-components-canvas.md)
- [Canvas](reference/arkui-ts/ts-components-canvas-canvas.md)
- [CanvasRenderingContext2D](reference/arkui-ts/ts-canvasrenderingcontext2d.md)
- [OffscreenCanvasRenderingConxt2D](reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md)
- [Lottie](reference/arkui-ts/ts-components-canvas-lottie.md)
- [Path2D](reference/arkui-ts/ts-components-canvas-path2d.md)
- [CanvasGradient](reference/arkui-ts/ts-components-canvas-canvasgradient.md)
- [ImageBitmap](reference/arkui-ts/ts-components-canvas-imagebitmap.md)
- [ImageData](reference/arkui-ts/ts-components-canvas-imagedata.md)
- [Animation](reference/arkui-ts/ts-animation.md)
- [Attribute Animation](reference/arkui-ts/ts-animatorproperty.md)
- [Explicit Animation](reference/arkui-ts/ts-explicit-animation.md)
- [Transition Animation](reference/arkui-ts/ts-transition-animation.md)
- [Page Transition](reference/arkui-ts/ts-page-transition-animation.md)
- [Component Transition](reference/arkui-ts/ts-transition-animation-component.md)
- [Transition of Shared Elements](reference/arkui-ts/ts-transition-animation-shared-elements.md)
- [Motion Path Animation](reference/arkui-ts/ts-motion-path-animation.md)
- [Matrix Transformation](reference/arkui-ts/ts-matrix-transformation.md)
- [Interpolation Calculation](reference/arkui-ts/ts-interpolation-calculation.md)
- [Global UI Methods](reference/arkui-ts/ts-global-ui-methods.md)
- [Alert Dialog Box](reference/arkui-ts/ts-methods-alert-dialog-box.md)
- [Custom Dialog box](reference/arkui-ts/ts-methods-custom-dialog-box.md)
- [Image Cache](reference/arkui-ts/ts-methods-image-cache.md)
- [Media Query](reference/arkui-ts/ts-methods-media-query.md)
- [List Selection Dialog Box](reference/arkui-ts/ts-methods-action-sheet.md)
- [Appendix](reference/arkui-ts/ts-appendix.md)
- [Built-in Enums](reference/arkui-ts/ts-appendix-enums.md)
- APIs
- Ability Framework
- [FeatureAbility Module](reference/apis/js-apis-featureAbility.md)
- [ParticleAbility Module](reference/apis/js-apis-particleAbility.md)
- [DataAbilityHelper Module](reference/apis/js-apis-dataAbilityHelper.md)
- [DataUriUtils Module](reference/apis/js-apis-DataUriUtils.md)
- [Bundle Module](reference/apis/js-apis-Bundle.md)
- [Context Module](reference/apis/js-apis-Context.md)
- Event Notification
- [CommonEvent Module](reference/apis/js-apis-commonEvent.md)
- [Notification Module](reference/apis/js-apis-notification.md)
- [Reminder Agent](reference/apis/js-apis-reminderAgent.md)
- Resource Management
- [Resource Manager](reference/apis/js-apis-resource-manager.md)
- [Internationalization (intl)](reference/apis/js-apis-intl.md)
- [Internationalization (i18n)](reference/apis/js-apis-i18n.md)
- Media
- [Audio Management](reference/apis/js-apis-audio.md)
- [Media](reference/apis/js-apis-media.md)
- Security
- [User Authentication](reference/apis/js-apis-useriam-userauth.md)
- [Access Control](reference/apis/js-apis-abilityAccessCtrl.md)
- Data Management
- [Lightweight Storage (deprecated since 8)](reference/apis/js-apis-data-storage.md)
- [Distributed Data Management](reference/apis/js-apis-distributed-data.md)
- [Relational Database](reference/apis/js-apis-data-rdb.md)
- [Result Set](reference/apis/js-apis-data-resultset.md)
- [DataAbilityPredicates](reference/apis/js-apis-data-ability.md)
- [Settings](reference/apis/js-apis-settings.md)
- File Management
- [File Management](reference/apis/js-apis-fileio.md)
- [Statfs](reference/apis/js-apis-statfs.md)
- [Environment](reference/apis/js-apis-environment.md)
- [Public File Access and Management](reference/apis/js-apis-filemanager.md)
- [App Storage Statistics](reference/apis/js-apis-storage-statistics.md)
- [Volume Management](reference/apis/js-apis-volumemanager.md)
- Account Management
- [Distributed Account Management](reference/apis/js-apis-distributed-account.md)
- [App Account Management](reference/apis/js-apis-appAccount.md)
- Telephony Service
- [Call](reference/apis/js-apis-call.md)
- [SMS](reference/apis/js-apis-sms.md)
- [SIM Management](reference/apis/js-apis-sim.md)
- [Radio](reference/apis/js-apis-radio.md)
- [observer](reference/apis/js-apis-observer.md)
- [Cellular Data](reference/apis/js-apis-telephony-data.md)
- Network and Connectivity
- [WLAN](reference/apis/js-apis-wifi.md)
- [Bluetooth](reference/apis/js-apis-bluetooth.md)
- [RPC](reference/apis/js-apis-rpc.md)
- Device Management
- [Sensor](reference/apis/js-apis-sensor.md)
- [Vibrator](reference/apis/js-apis-vibrator.md)
- [Brightness](reference/apis/js-apis-brightness.md)
- [Battery Info](reference/apis/js-apis-battery-info.md)
- [Power Management](reference/apis/js-apis-power.md)
- [Thermal Management](reference/apis/js-apis-thermal.md)
- [Running Lock](reference/apis/js-apis-runninglock.md)
- [Device Info](reference/apis/js-apis-device-info.md)
- [systemParameter](reference/apis/js-apis-system-parameter.md)
- [Device Management](reference/apis/js-apis-device-manager.md)
- [Window](reference/apis/js-apis-window.md)
- [Display](reference/apis/js-apis-display.md)
- [Update](reference/apis/js-apis-update.md)
- [USB](reference/apis/js-apis-usb.md)
- [Location](reference/apis/js-apis-geolocation.md)
- Basic Features
- [Application Context](reference/apis/js-apis-basic-features-app-context.md)
- [Console Logs](reference/apis/js-apis-basic-features-logs.md)
- [Page Routing](reference/apis/js-apis-basic-features-routes.md)
- [Pop-up Window](reference/apis/js-apis-basic-features-pop-up.md)
- [Application Configuration](reference/apis/js-apis-basic-features-configuration.md)
- [Timer](reference/apis/js-apis-basic-features-timer.md)
- [Setting the System Time](reference/apis/js-apis-system-time.md)
- [Animation](reference/apis/js-apis-basic-features-animator.md)
- [WebGL](reference/apis/js-apis-webgl.md)
- [WebGL2](reference/apis/js-apis-webgl2.md)
- [Screenshot](reference/apis/js-apis-screenshot.md)
- DFX
- [HiAppEvent](reference/apis/js-apis-hiappevent.md)
- [Performance Tracing](reference/apis/js-apis-hitracemeter.md)
- [Fault Logger](reference/apis/js-apis-faultLogger.md)
- [Distributed Call Chain Tracing](reference/apis/js-apis-hitracechain.md)
- [HiLog](reference/apis/js-apis-hilog.md)
- [HiChecker](reference/apis/js-apis-hichecker.md)
- [HiDebug](reference/apis/js-apis-hidebug.md)
- Language Base Class Library
- [Obtaining Process Information](reference/apis/js-apis-process.md)
- [URL String Parsing](reference/apis/js-apis-url.md)
- [URI String Parsing](reference/apis/js-apis-uri.md)
- [Util](reference/apis/js-apis-util.md)
- [XML Parsing and Generation](reference/apis/js-apis-xml.md)
- [XML-to-JavaScript Conversion](reference/apis/js-apis-convertxml.md)
- [Worker Startup](reference/apis/js-apis-worker.md)
- [Linear Container ArrayList](reference/apis/js-apis-arraylist.md)
- [Linear Container Deque](reference/apis/js-apis-deque.md)
- [Linear Container List](reference/apis/js-apis-list.md)
- [Linear Container LinkedList](reference/apis/js-apis-linkedlist.md)
- [Linear Container Queue](reference/apis/js-apis-queue.md)
- [Linear Container Stack](reference/apis/js-apis-stack.md)
- [Linear Container Vector](reference/apis/js-apis-vector.md)
- [Nonlinear Container HashSet](reference/apis/js-apis-hashset.md)
- [Nonlinear Container HashMap](reference/apis/js-apis-hashmap.md)
- [Nonlinear Container PlainArray](reference/apis/js-apis-plainarray.md)
- [Nonlinear Container TreeMap](reference/apis/js-apis-treemap.md)
- [Nonlinear Container TreeSet](reference/apis/js-apis-treeset.md)
- [Nonlinear Container LightWeightMap](reference/apis/js-apis-lightweightmap.md)
- [Nonlinear Container LightWeightSet](reference/apis/js-apis-lightweightset.md)
\ No newline at end of file
# Learn About OpenHarmony
- [OpenHarmony Project](OpenHarmony-Overview.md)
- [Glossary](device-dev/glossary/glossary.md)
- OpenHarmony Release Notes
- OpenHarmony 3.x Releases
- [OpenHarmony v3.1 Beta (2021-12-31)](release-notes/OpenHarmony-v3.1-beta.md)
- [OpenHarmony v3.0.1 LTS (2022-01-12)](release-notes/OpenHarmony-v3.0.1-LTS.md)
- [OpenHarmony v3.0 LTS (2021-09-30)](release-notes/OpenHarmony-v3.0-LTS.md)
- OpenHarmony 2.x Releases
- [OpenHarmony v2.2 beta2 (2021-08-04)](release-notes/OpenHarmony-v2.2-beta2.md)
- [OpenHarmony 2.0 Canary (2021-06-01)](release-notes/OpenHarmony-2-0-Canary.md)
- OpenHarmony 1.x Releases
- [OpenHarmony v1.1.4 LTS (2022-02-11)](release-notes/OpenHarmony-v1-1-4-LTS.md)
- [OpenHarmony v1.1.3 LTS (2021-09-30)](release-notes/OpenHarmony-v1-1-3-LTS.md)
- [OpenHarmony v1.1.2 LTS (2021-08-04)](release-notes/OpenHarmony-v1.1.2-LTS.md)
- [OpenHarmony 1.1.1 LTS (2021-06-22)](release-notes/OpenHarmony-1-1-1-LTS.md)
- [OpenHarmony 1.1.0 LTS (2021-04-01)](release-notes/OpenHarmony-1-1-0-LTS.md)
- [OpenHarmony 1.0 (2020-09-10)](release-notes/OpenHarmony-1-0.md)
- Contribution
- [Contribution](contribute/contribution.md)
- [Code of Conduct](contribute/code-of-conduct.md)
- [Code Contribution](contribute/code-contribution.md)
- [Contribution Process](contribute/contribution-process.md)
- [Auto-Test](readme/test_subsystem.md)
- [Documentation Contribution](contribute/documentation-contribution.md)
- [Writing Instructions](contribute/writing-instructions.md)
- [Communication in Community](contribute/communication-in-community.md)
- [FAQs](contribute/FAQ.md)
\ No newline at end of file
# OpenHarmony开源项目<a name="ZH-CN_TOPIC_0000001158661243"></a>
# OpenHarmony开源项目
- [项目介绍](#section1270210396435)
- [技术架构](#section2502124574318)
......@@ -346,7 +346,10 @@ OpenHarmony支持如下几种系统类型:
## 快速入门<a name="section44681652104210"></a>
入口:[device-dev/quick-start/Readme-CN.md](device-dev/quick-start/Readme-CN.md)
- 设备开发快速入门:[device-dev/quick-start/Readme-CN.md](device-dev/quick-start/Readme-CN.md)
- 应用开发快速入门:[application-dev/quick-start/Readme-CN.md](application-dev/quick-start/Readme-CN.md)
## 代码仓地址<a name="section107651249181914"></a>
......
# Ability开发
- [Ability框架概述](ability-brief.md)
- FA模型
- [FA模型综述](fa-brief.md)
- [PageAbility开发指导](fa-pageability.md)
......@@ -7,12 +8,10 @@
- [DataAbility开发指导](fa-dataability.md)
- [FormAbility开发指导](fa-formability.md)
- Stage模型
- [Stage模型综述](stage-brief.md)
- [Ability开发指导](stage-ability.md)
- [ServiceExtensionAbility开发指导](stage-serviceextension.md)
- [FormExtensionAbility开发指导](stage-formextension.md)
- [应用迁移开发指导](stage-ability-continuation.md)
- [跨端迁移开发指导](stage-ability-continuation.md)
- [Call调用开发指导](stage-call.md)
- 其他
- [WantAgent使用指导](wantagent.md)
- [Ability助手使用指导](ability-assistant-guidelines.md)
- [测试框架使用指导](ability-delegator.md)
\ No newline at end of file
# 测试框架使用指导
Delegator测试框架是OpenHarmony提供的一套开发者应用自测试框架,旨在为开发者提供针对应用的自测试环境。开发者可以通过delegator类启动对应Ability,并通过Delegator类提供的能力对Ability进行生命周期切换和监听,同时支持shellCMD输入和测试结果打印显示等功能。
## 测试框架启动
测试框架启动有两种方式,方式一:通过aa test命令启动,方式二:通过IDE启动。
### aa test启动
开发者可通过 aa test 命令启动启动测试框架,开发者可以自行指定使用的runner以及runner所在hap包的package name/module name,具体命令示例如下:
**FA模型:**
```javascript
aa test -p com.example.myapplicationfaets -s unittest OpenHarmonyTestRunner -s class ActsAbilityTest -w 20
```
**Stage模型:**
```javascript
aa test -m com.example.myapplicationfaets -s unittest OpenHarmonyTestRunner -s class ActsAbilityTest -w 20
```
| 参数 | 是否必选 | 参数说明 |
| --------------- | -------- | ------------------------------------------------------------ |
| -p | 是 | TestRunner所在hap包的package name,FA模型使用。 |
| -m | 是 | TestRunner所在hap包的module name,stage模型使用。 |
| -s unittest | 是 | 启用的TestRunner名称,TestRunner名称和文件名需要保持一致。 |
| -w | 否 | 测试用例超时时间,如果未指定,测试框架会一直等待测试代码调用finishTest才退出。 |
| -s <key><value> | 否 | 支持以key-value的方式输入任何参数,输入的参数可通过AbilityDelegatorArgs.parameters以key-value的方式获取。 |
### IDE启动
IDE文档中介绍,待IDE文档上库补充链接。
## TestRunner介绍
TestRunner是测试框架测试流程入口类,当测试流程启动时,系统会调用TestRunner内相关接口,开发者需要派生该类,并重写onPrepare、onRun方法。IDE在创建应用模板时会初始化一个默认TestRunner,并在onRun方法启动默认的TestAbility。开发者也可以修改TestAbility测试代码内容,也可以修改默认的TestRunner内onPrepare、onRun方法,自行实现测试代码。具体详细内容请参考TestRunnerAPI接口说明[TestRunner](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-testRunner.md)
## AbilityMonitor介绍
AbilityMonitor是测试框架提供用来绑定并监听Ability类,开发者可以使用AbilityMonitor绑定Ability,并将AbilityMonitor添加到监听列表。绑定后Ability的创建、生命周期变化等会触发AbilityMonitor内相关回调函数,开发者可以在对应回调函数内进行测试验证。具体详细内容请参考AbilityMonitor API接口说明[AbilityMonitor](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-application-abilityMonitor.md)
**示例**
```javascript
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function onAbilityCreateCallback() {
console.info("onAbilityCreateCallback");
}
var monitor = {
abilityName: "abilityname",
onAbilityCreate: onAbilityCreateCallback
}
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.addAbilityMonitor(monitor).then((void) => {
console.info("addAbilityMonitor promise");
});
```
## AbilityDelegator介绍
AbilityDelegator是测试框架主要功能类,提供了启动Ability、获取Ability示例、调度Ability生命周期、对Ability生命周期进行监听、打印测试结果等功能。
**导入模块**
```javascript
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
```
```javascript
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
```
### 启动Ability并监听Ability状态变化
配合AbilityMonitor使用,可以实现对Ability启动、Ability实例获取、监听状态变化功能。
**示例:**
```javascript
var abilityDelegator;
var ability;
var timeout = 100;
function onAbilityCreateCallback() {
console.info("onAbilityCreateCallback");
}
var monitor = {
abilityName: "abilityname",
onAbilityCreate: onAbilityCreateCallback
}
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.waitAbilityMonitor(monitor, timeout, (err, data) => {
ability = data;
console.info("waitAbilityMonitor callback");
});
var want = {
bundleName: "bundleName",
abilityName: "abilityName"
};
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.startAbility(want, (err, data) => {
console.info("startAbility callback");
});
```
### 调度Ability生命周期
AbilityDelegator提供对Ability生命周期进行显示调度,支持Foreground、Background,配合AbilityMonitor中对Ability生命周期监听方法,可以完整的测试Ability生命周期变化。具体详细内容请参考AbilityDelegator API接口说明[AbilityDelegator](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegator.md#abilitydelegator)
### 执行shellCMD命令
AbilityDelegator提供执行shellCMD命令功能,开发者可以在测试代码中执行shell命令,该功能仅在测试环境中生效,非测试环境该接口调用无效果。
**示例:**
```javascript
var abilityDelegator;
var cmd = "cmd";
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.executeShellCommand(cmd, (err,data) => {
console.info("executeShellCommand callback");
});
```
\ No newline at end of file
# PageAbility开发指导
## PageAbility介绍
## 概述
### 功能简介
PageAbility是具备ArkUI的Ability,是用户具体可见并可以交互的Ability实例,开发者通过IDE创建Ability时,IDE会自动创建相关模板代码。PageAbility相关能力通过单例featureAbility暴露,生命周期相关回调通过app.js/app.ets中回调函数暴露。
Page模板(以下简称“Page”)是FA唯一支持的模板,用于提供与用户交互的能力。
## PageAbility的生命周期
### PageAbility的生命周期
**Ability生命周期介绍**(Ability Life Cycle)是Ability被调度到INACTIVE、ACTIVE、BACKGROUND等各个状态的统称(主要涉及PageAbility类型和ServiceAbility类型的Ability)。
- **PageAbility类型的Ability生命周期流转如下图所示**
**PageAbility生命周期流转如下图所示**
![PageAbility-Lifecycle](figures/page-ability-lifecycle.png)
......@@ -25,76 +25,32 @@ Page模板(以下简称“Page”)是FA唯一支持的模板,用于提供
- **BACKGROUND**: 后台状态,表示当前Ability退到后台,Ability在被销毁后由BACKGROUND状态进入INITIAL状态,或者重新被激活后由BACKGROUND状态进入ACTIVE状态。
**PageAbility类型Ability生命周期回调如下图所示:**
**PageAbility生命周期回调如下图所示:**
![fa-pageAbility-lifecycle](figures/fa-pageAbility-lifecycle.png)
PageAbility提供如下生命周期回调,开发者可以在 app.js/app.ets 中重写生相关命周期函数 。
* onShow()
Ability由后台不可见状态切换到前台可见状态调用onShow方法,此时用户在屏幕可以看到该Ability。
* onHide()
Ability由前台切换到后台不可见状态时调用onHide方法,此时用户在屏幕看不到该Ability。
* onDestroy()
应用退出,销毁Ability对象前调用onDestroy方法,开发者可以在该方法里做一些回收资源、清空缓存等应用退出前的准备工作。
* onCreate()
Ability第一次启动创建Ability时调用onCreate方法,开发者可以在该方法里做一些应用初始化工作。
PageAbility提供命周期回调,开发者可以在 app.js/app.ets 中重写生相关命周期函数 。
* onInactive()
## 开发指导
### featureAbility接口说明
Ability失去焦点时调用onInactive方法,Ability在进入后台状态时会先失去焦点,再进入后台。
**表1** featureAbility接口介绍
* onActive()
| 接口名 | 描述 |
| --------------------------------------------------- | --------------- |
| void startAbility(parameter: StartAbilityParameter) | 启动Ability |
| Context getContext(): | 获取应用Context |
| void terminateSelf() | 结束Ability |
| bool hasWindowFocus() | 是否获取焦点 |
Ability切换到前台,并且已经获取焦点时调用onActive方法。
* 示例
### 启动本地PageAbility
```javascript
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
onShow(){
console.info('Application onShow')
},
onHide(){
console.info('Application onHide')
},
onInactive(){
console.info('Application onInactive')
},
onActive(){
console.info('Application onActive')
},
}
```
## 启动本地PageAbility
* 导入模块
* 导入模块
```
import featureAbility from '@ohos.ability.featureAbility'
```
```
featureAbility.startAbility(parameter: StartAbilityParameter, callback: AsyncCallback<number>)
```
* 接口说明
启动新的ability(callback形式)
* 示例
```javascript
......@@ -158,7 +114,7 @@ featureAbility.startAbility({
},
);
```
## 启动远程PageAbility
### 启动远程PageAbility
* 导入模块
......@@ -166,14 +122,6 @@ featureAbility.startAbility({
import featureAbility from '@ohos.ability.featureAbility'
```
```
featureAbility.startAbility(parameter: StartAbilityParameter)
```
* 接口说明
启动远程的ability(promise形式)
前提:通过deviceManager获取远程deviceid
* 示例
```javascript
......@@ -187,3 +135,45 @@ var promise = await featureAbility.startAbility({
}
);
```
### 生命周期接口说明
**表2** 生命周期回调函数介绍
| 接口名 | 描述 |
| ------------ | ------------------------------------------------------------ |
| onShow() | Ability由后台不可见状态切换到前台可见状态调用onShow方法,此时用户在屏幕可以看到该Ability |
| onHide() | Ability由前台切换到后台不可见状态时调用onHide方法,此时用户在屏幕看不到该Ability。 |
| onDestroy() | 应用退出,销毁Ability对象前调用onDestroy方法,开发者可以在该方法里做一些回收资源、清空缓存等应用退出前的准备工作。 |
| onCreate() | Ability第一次启动创建Ability时调用onCreate方法,开发者可以在该方法里做一些应用初始化工作。 |
| onInactive() | Ability失去焦点时调用onInactive方法,Ability在进入后台状态时会先失去焦点,再进入后台。 |
| onActive() | Ability切换到前台,并且已经获取焦点时调用onActive方法。 |
* 示例
开发者需要重写app.js/app.ets 中相关生命周期回调函数,IDE模板默认生成onCreate()和onDestroy()方法,其他方法需要开发者自行实现。
```javascript
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
onShow(){
console.info('Application onShow')
},
onHide(){
console.info('Application onHide')
},
onInactive(){
console.info('Application onInactive')
},
onActive(){
console.info('Application onActive')
},
}
```
### 开发实例
针对pageAbility开发,有以下示例工程可供参考:
- [DMS](https://gitee.com/openharmony/app_samples/tree/master/ability/DMS)
在本示例中完整展示了启动本地Ability、启动远程Ability的使用方法。
\ No newline at end of file
# 应用迁移开发指导
# 跨端迁移开发指导
## 场景介绍
迁移的主要工作是实现将应用当前任务,包括页面部分数据、栈信息等,迁移到远端设备。迁移成功后,本端任务将被清除;若失败则不会,可允许再次迁移。
迁移的主要工作是实现将应用当前任务,包括页面控件状态变量、分布式对象等,迁移到远端设备。页面控件状态变量用于同步页面UI数据,分布式对象用于同步内存中的数据。
## 接口说明
迁移提供的能力如下,具体的API详见接口文档
迁移提供的能力如下,具体的API详见[接口文档](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-application-ability.md)
**表1** 应用迁移API接口功能介绍
|接口名 | 描述|
|:------ | :------|
| onContinue(wantParams : {[key: string]: any}) | 迁移发起端在该回调中保存迁移所需要的数据,同时返回是否同意迁移:true表示同意,false表示拒绝。 |
| onContinue(wantParams : {[key: string]: any}): OnContinueResult | 迁移**发起端**在该回调中保存迁移所需要的数据,同时返回是否同意迁移:0表示同意,拒绝返回相应错误码。 |
| onCreate(want: Want,param:LaunchParam): void | 迁移**目标端**在该回调中完成数据恢复,并触发页面恢复。 |
| **enum** OnContinueResult | onContinue的返回值类型:AGREE表示同意;REJECT表示拒绝;MISMATCH表示版本不匹配 |
## 开发步骤
**图1** 迁移开发示意图
### 迁移应用
![continuation_dev](figures/continuation-info.png)
## 开发步骤
### 迁移应用
1. 配置
- 配置应用支持迁移
​ 在config.json中配置continuable字段:true表示支持迁移,false表示不支持,默认为false.
在module.json5中配置continuable字段:true表示支持迁移,false表示不支持,默认为false。配置为false的应用将被系统识别为无法迁移。
```
```javascript
"continuable": true
```
​ 配置为false的应用将无法在任务中心进行迁移。
* 配置应用启动类型
​ 迁移当前只支持多实例应用,需要在在config.json中配置launchType字段为standard
迁移当前只支持多实例应用,需要在在module.json5中配置launchType字段为standard
```
```javascript
"launchType": "standard"
```
* 申请分布式权限
支持跨端迁移的应用需要在module.json5申请分布式权限 DISTRIBUTED_DATASYNC。
```javascript
"requestPermissions": [
{
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
},
```
这个权限需要在应用首次启动的时候弹窗让用户授予,可以通过在ability的onWindowStageCreate中添加如下代码实现
```javascript
requestPermissions = async () => {
let permissions: Array<string> = [
"ohos.permission.DISTRIBUTED_DATASYNC"
];
let needGrantPermission = false
let accessManger = accessControl.createAtManager()
Logger.info("app permission get bundle info")
let bundleInfo = await bundle.getApplicationInfo(BUNDLE_NAME, 0, 100)
Logger.info(`app permission query permission ${bundleInfo.accessTokenId.toString()}`)
for (const permission of permissions) {
Logger.info(`app permission query grant status ${permission}`)
try {
let grantStatus = await accessManger.verifyAccessToken(bundleInfo.accessTokenId, permission)
if (grantStatus === PERMISSION_REJECT) {
needGrantPermission = true
break;
}
} catch (err) {
Logger.error(`app permission query grant status error ${permission} ${JSON.stringify(err)}`)
needGrantPermission = true
break;
}
}
if (needGrantPermission) {
Logger.info("app permission needGrantPermission")
try {
await this.context.requestPermissionsFromUser(permissions)
} catch (err) {
Logger.error(`app permission ${JSON.stringify(err)}`)
}
} else {
Logger.info("app permission already granted")
}
}
```
2. 实现onContinue接口
onContinue接口在**发起端**被调用,主要用于在迁移发起时,通知开发者保存控件状态变量和内存中数据,准备迁移。当应用准备完成后,需要返回OnContinueResult.AGREE(0)表示同意迁移,否则返回相应的错误码拒绝迁移。如果不实现该接口,系统将默认为拒绝迁移。
导入模块
```
```javascript
import Ability from '@ohos.application.Ability';
import AbilityConstant from '@ohos.application.AbilityConstant';
```
- 要实现迁移,此接口必须实现并返回true,否则默认为拒绝迁移。
- 要实现迁移,此接口必须实现并返回AGREE,否则默认为拒绝迁移。
- 示例
```javascript
onContinue(wantParams : {[key: string]: any}) {
console.log("MainAbility onContinue")
return true;
onContinue(wantParam : {[key: string]: any}) {
Logger.info("onContinue using distributedObject")
// set user input data into want params
wantParam["input"] = AppStorage.Get<string>('ContinueInput');
Logger.info(`onContinue input = ${wantParam["input"]}`);
return AbilityConstant.OnContinueResult.AGREE
}
```
......@@ -70,7 +130,9 @@
3. 在onCreate接口中实现迁移逻辑
- 远端设备上,在onCreate中根据launchReason判断该次启动是否为迁移LaunchReason.CONTINUATION(3)
onCreate接口在迁移**目标端**被调用,在目标端ability被拉起时,通知开发者同步已保存的内存数据和控件状态,完成后触发页面的恢复。如果不实现该接口中迁移相关逻辑,ability将会作为普通的启动方式拉起,无法恢复页面。
- 远端设备上,在onCreate中根据launchReason判断该次启动是否为迁移LaunchReason.CONTINUATION
- 完成数据恢复后,开发者需要调用**restoreWindowStage**来触发页面恢复。
......@@ -79,60 +141,56 @@
* 示例
```javascript
onCreate(want , launchParam) {
// Ability is creating, initialize resources for this ability
console.log("MainAbility onCreate", launchParam.launchReason);
if (launchParam.launchReason == LaunchReason.CONTINUATION) {
this.contentStorage = new ContenStorage();
onCreate(want, launchParam) {
Logger.info(`MainAbility onCreate ${AbilityConstant.LaunchReason.CONTINUATION}`)
globalThis.abilityWant = want;
if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) {
let input = want.parameters.input // get user data from want params
AppStorage.SetOrCreate<string>('ContinueInput', input)
Logger.info(`onCreate for continuation sessionId: ${this.sessionId}`)
this.contentStorage = new ContentStorage();
this.context.restoreWindowStage(this.contentStorage);
}
}
```
### 迁移数据
1. 使用自定义数据
1. 使用分布式对象
- wantParams中可以填写key-value形式自定义数据,key类型string,填充的数据将随want被传输到远端,用于携带一些简单、轻量的数据
分布式数据对象提供了与本地变量类似的操作,实现两个设备的数据同步,当设备1的应用A的分布式数据对象增、删、改数据后,设备2的应用A也可以获取到对应的数据变化,同时还能监听数据变更以及对端数据对象的上下线。用法详见[分布式对象指导文档](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/database/database-distributedobject-guidelines.md)
迁移场景中,分布式对象(distributedDataObject)主要用于将本机内存数据同步到目标设备。
```javascript
onContinue(wantParams : {[key: string]: any}) {
console.log("Continue My Data")
wantParams["myData"] = "my1234567";
return true;
}
```
- 同时在远端判断如果是迁移,可以从want.parameters中取出在发起端保存的自定义数据。
- 发起端在onContinue中,将待迁移的数据存入分布式对象中,然后设置好session id,并通过wantParams将session id传到远端设备。
```javascript
onCreate(want , launchParam) {
if (launchParam.launchReason == LaunchReason.CONTINUATION) {
console.log("onCreate LaunchReason = CONTINUATION",want.parameters["myData"]); // my1234567
...
this.context.restoreWindowStage(this.contentStorage);
}
}
```
2. 使用分布式对象
使用分布式对象可以传输更多的数据到远端设备,更多用法详见分布式对象接口文档。
import Ability from '@ohos.application.Ability';
import distributedObject from '@ohos.data.distributedDataObject';
- 发起端在onContinue中,将待迁移的数据存入分布式对象中,然后设置好session id,并通过wantParams将session id传到远端设备。
var g_object = distributedObject.createDistributedObject({name:undefined});
export default class MainAbility extends Ability {
contentStorage : ContenStorage
sessionId : string;
- 远端设备在onCreate中,取出发起端传过来的session id,建立分布式对象并关联该session id,这样就能实现分布式对象的同步。需要注意的是,在调用restoreWindowStage之前,迁移需要的分布式对象必须全部关联完,保证能够获取到正确的数据。
onContinue(wantParam : {[key: string]: any}) {
Logger.info("onContinue using distributedObject")
this.sessionId = distributedObject.genSessionId();
//set distributed data object session id
g_object.setSessionId(this.sessionId);
g_object.name = "Amy";
// set session id into want params
wantParam["session"] = this.sessionId;
return AbilityConstant.OnContinueResult.AGREE
}
```
* 示例
- 目标设备在onCreate中,取出发起端传过来的session id,建立分布式对象并关联该session id,这样就能实现分布式对象的同步。需要注意的是,在调用restoreWindowStage之前,迁移需要的分布式对象必须全部关联完,保证能够获取到正确的数据。
```javascript
import Ability from '@ohos.application.Ability';
......@@ -141,38 +199,34 @@
var g_object = distributedObject.createDistributedObject({name:undefined});
export default class MainAbility extends Ability {
contentStorage : ContenStorage
contentStorage : ContentStorage
sessionId : string;
onCreate(want , launchParam) {
if (launchParam.launchReason == 3) {
this.sessionId = want.parameters["session"] // 取出session id
function statusCallback(sessionId, networkid, status) {
console.info("object status change sessionId: " + sessionId + " status: " + status +
"g_object.name: " + g_object.name); // 回调中可以取到同步过来的分布式对象内容 name = Amy
statusCallback(sessionId, networkid, status) {
Logger.info(`continuation object status change, sessionId: ${sessionId}, status: ${status}, g_object.name: ${g_object.name}`)
}
g_object.on("status", statusCallback); // 注册分布式对象同步结果的监听
g_object.setSessionId(this.sessionId); // 将本地分布式对象也关联发起端的session id
onCreate(want, launchParam) {
Logger.info(`MainAbility onCreate ${AbilityConstant.LaunchReason.CONTINUATION}`)
if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) {
// get distributed data object session id from want params
this.sessionId = want.parameters.session
Logger.info(`onCreate for continuation sessionId: ${this.sessionId}`)
this.contentStorage = new ContenStorage();
g_object.on("status", this.statusCallback);
// set session id, so it will sync data from remote device
g_object.setSessionId(this.sessionId);
this.contentStorage = new ContentStorage();
this.context.restoreWindowStage(this.contentStorage);
}
}
onContinue(wantParams : {[key: string]: any}) {
console.log("using distributedObject")
this.sessionId = "654321";
g_object.setSessionId(this.sessionId); //1 设置分布式对象的session id
g_object.name = "Amy"; // 填入数据
wantParams["session"] = this.sessionId; // 将session id 通过want传到远端
return true;
}
```
以上完整的示例见sample
......@@ -16,7 +16,7 @@ SystemCapability.BundleManager.BundleFramework
## 权限列表
| 权限 | 权限等级 | 描述 |
|-------| --------- | ---- |
| ---------------------------------------- | ------------ | --------- |
| ohos.permission.GET_BUNDLE_INFO | normal | 仅限查询本应用信息 |
| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | 可查询所有应用信息 |
| ohos.permission.INSTALL_BUNDLE | system_core | 可安装、卸载应用 |
......@@ -38,7 +38,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| ----------- | ------ | ---- | --------------------------------------- |
| bundleName | string | 是 | 要查询的应用程序包名称。 |
| bundleFlags | number | 是 | 用于指定返回的应用信息对象中包含信息的标记。默认值:0,取值范围:大于等于0。 |
| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
......@@ -46,7 +46,7 @@ SystemCapability.BundleManager.BundleFramework
**返回值:**
| 类型 | 说明 |
| ----------- | -------- |
| ------------------------- | ------------------ |
| Promise\<ApplicationInfo> | Promise形式返回应用程序信息。 |
**示例:**
......@@ -82,7 +82,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| ----------- | ------------------------------- | ---- | --------------------------------------- |
| bundleName | string | 是 | 要查询的应用程序包名称。 |
| bundleFlags | number | 是 | 用于指定返回的应用信息对象中包含信息的标记。默认值:0,取值范围:大于等于0。 |
| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
......@@ -121,7 +121,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| ----------- | ------------------------------- | ---- | --------------------------------------- |
| bundleName | string | 是 | 要查询的应用程序包名称。 |
| bundleFlags | number | 是 | 用于指定返回的应用信息对象中包含信息的标记。默认值:0,取值范围:大于等于0。 |
| callback | AsyncCallback\<ApplicationInfo> | 是 | 程序启动作为入参的回调函数,返回应用程序信息。 |
......@@ -158,14 +158,14 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ---------- | ---------- | ---- | ----------------------------------------------------------- |
| ---------- | ---------- | ---- | --------------------------------------- |
| bundleFlag | BundleFlag | 是 | 用于指定返回的应用信息对象中包含信息的标记。默认值:0,取值范围:大于等于0。 |
| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
**返回值:**
| 类型 | 说明 |
| --------------------------- | ----------------------------------- |
| --------------------------- | -------------------------- |
| Promise<Array\<BundleInfo>> | Promise形式返回所有可用的BundleInfo |
**示例:**
......@@ -200,8 +200,8 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ---------- | --------------------------------- | ---- | ------------------------------------------------------------ |
| bundleFlag | BundleFlag | 是 | 用于指定返回的应用信息对象中包含信息的标记。默认值:0,取值范围:大于等于0。|
| ---------- | --------------------------------- | ---- | --------------------------------------- |
| bundleFlag | BundleFlag | 是 | 用于指定返回的应用信息对象中包含信息的标记。默认值:0,取值范围:大于等于0。 |
| callback | AsyncCallback<Array\<BundleInfo>> | 是 | 程序启动作为入参的回调函数,返回所有可用的BundleInfo。 |
**示例:**
......@@ -235,8 +235,8 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ---------- | --------------------------------- | ---- | ------------------------------------------------------------ |
| bundleFlag | BundleFlag | 是 | 用于指定返回的应用信息对象中包含信息的标记。默认值:0,取值范围:大于等于0。|
| ---------- | --------------------------------- | ---- | --------------------------------------- |
| bundleFlag | BundleFlag | 是 | 用于指定返回的应用信息对象中包含信息的标记。默认值:0,取值范围:大于等于0。 |
| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
| callback | AsyncCallback<Array\<BundleInfo>> | 是 | 程序启动作为入参的回调函数,返回所有可用的BundleInfo。 |
......@@ -273,7 +273,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| ----------- | ------------- | ---- | --------------------------------------- |
| bundleName | string | 是 | 包名 |
| bundleFlags | number | 是 | 用于指定返回的应用信息对象中包含信息的标记。默认值:0,取值范围:大于等于0。 |
| options | BundleOptions | 否 | 包含userid。 |
......@@ -281,7 +281,7 @@ SystemCapability.BundleManager.BundleFramework
**返回值:**
| 类型 | 说明 |
| -------------------- | ------------------------------------------ |
| -------------------- | ---------------------------- |
| Promise\<BundleInfo> | 返回值为Promise对象,Promise中包含包信息。 |
**示例:**
......@@ -319,7 +319,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | -------------------------- | ---- | ------------------------------------------------------------ |
| ----------- | -------------------------- | ---- | --------------------------------------- |
| bundleName | string | 是 | 包名 |
| bundleFlags | number | 是 | 用于指定返回的应用信息对象中包含信息的标记。默认值:0,取值范围:大于等于0。 |
| callback | AsyncCallback\<BundleInfo> | 是 | 程序启动作为入参的回调函数,返回包信息。 |
......@@ -356,7 +356,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | -------------------------- | ---- | ------------------------------------------------------------ |
| ----------- | -------------------------- | ---- | --------------------------------------- |
| bundleName | string | 是 | 包名 |
| bundleFlags | number | 是 | 用于指定返回的应用信息对象中包含信息的标记。默认值:0,取值范围:大于等于0。 |
| options | BundleOptions | 是 | 包含userid。 |
......@@ -397,14 +397,14 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ------ | ---- | ------------------------------------------------------ |
| ----------- | ------ | ---- | --------------------------------------- |
| bundleFlags | number | 是 | 用于指定返回的应用信息对象中包含信息的标记。默认值:0,取值范围:大于等于0。 |
| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
**返回值:**
| 类型 | 说明 |
| -------------------------------- | ------------------------------------------------ |
| -------------------------------- | ------------------------------- |
| Promise<Array\<ApplicationInfo>> | 返回值为Promise对象,Promise中包含应用信息列表。 |
**示例:**
......@@ -439,8 +439,8 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | -------------------------------------- | ---- | ------------------------------------------------------ |
| bundleFlags | number | 是 | 用于指定返回的应用信息对象中包含信息的标记。默认值:0,取值范围:大于等于0。|
| ----------- | -------------------------------------- | ---- | --------------------------------------- |
| bundleFlags | number | 是 | 用于指定返回的应用信息对象中包含信息的标记。默认值:0,取值范围:大于等于0。 |
| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
| callback | AsyncCallback<Array\<ApplicationInfo>> | 是 | 程序启动作为入参的回调函数,返回应用信息列表。 |
......@@ -476,8 +476,8 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | -------------------------------------- | ---- | ------------------------------------------------------ |
| bundleFlags | number | 是 | 用于指定返回的应用信息对象中包含信息的标记。默认值:0,取值范围:大于等于0。|
| ----------- | -------------------------------------- | ---- | --------------------------------------- |
| bundleFlags | number | 是 | 用于指定返回的应用信息对象中包含信息的标记。默认值:0,取值范围:大于等于0。 |
| callback | AsyncCallback<Array\<ApplicationInfo>> | 是 | 程序启动作为入参的回调函数,返回应用信息列表。 |
**示例:**
......@@ -510,14 +510,14 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ------ | ---- | -------------------------------------------------------- |
| ----------- | ------ | ---- | ---------------- |
| bundleName | string | 是 | 要查询的应用程序包名称。 |
| abilityName | string | 是 | 表示待查询的Ability名称。 |
**返回值:**
| 类型 | 说明 |
| ---------------------------- | ---------------------------- |
| --------------------- | --------------------- |
| Promise\<AbilityInfo> | Promise形式返回Ability信息。 |
**示例:**
......@@ -550,10 +550,10 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ------ | ---- | --------------------------------------------------------- |
| ----------- | --------------------------- | ---- | -------------------------- |
| bundleName | string | 是 | 要查询的应用程序包名称。 |
| abilityName | string | 是 | 表示待查询的Ability名称。 |
| callback | AsyncCallback\<AbilityInfo> | 是 | 程序启动作为入参的回调函数,返回Ability信息。|
| callback | AsyncCallback\<AbilityInfo> | 是 | 程序启动作为入参的回调函数,返回Ability信息。 |
**示例:**
......@@ -586,14 +586,14 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ------ | ---- | -------------------------------------------------------- |
| ----------- | ------ | ---- | ---------------- |
| bundleName | string | 是 | 要查询的应用程序包名称。 |
| abilityName | string | 是 | 表示待查询的Ability名称。 |
**返回值:**
| 类型 | 说明 |
| ---------------------------- | ---------------------------- |
| ---------------- | ------------------ |
| Promise\<string> | Promise形式返回应用名称信息。 |
**示例:**
......@@ -626,10 +626,10 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ------ | ---- | --------------------------------------------------------- |
| ----------- | ---------------------- | ---- | ---------------- |
| bundleName | string | 是 | 要查询的应用程序包名称。 |
| abilityName | string | 是 | 表示待查询的Ability名称。 |
| callback | AsyncCallback\<string> | 是 | 返回应用名称信息。|
| callback | AsyncCallback\<string> | 是 | 返回应用名称信息。 |
**示例:**
......@@ -662,13 +662,13 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ------ | ---- | ------------ |
| ---- | ----------- | ---- | ------------ |
| info | AbilityInfo | 是 | Ability的配置信息 |
**返回值:**
| 类型 | 说明 |
| ---------------------------- | ------------------------|
| ----------------- | ------------------------- |
| Promise\<boolean> | Promise形式返回boolean代表是否启用。 |
**示例:**
......@@ -703,7 +703,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ------ | ---- | --------------------------------------------------------- |
| -------- | ----------------------- | ---- | --------------- |
| info | AbilityInfo | 是 | Ability的配置信息 |
| callback | AsyncCallback\<boolean> | 是 | 返回boolean代表是否启用 |
......@@ -740,13 +740,13 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ------ | ---- | -------------------------------------------------------- |
| ---------- | ------ | ---- | ------------ |
| bundleName | string | 是 | 要查询的应用程序包名称。 |
**返回值:**
| 类型 | 说明 |
| ---------------------------- | ------------------------|
| ----------------- | ------------------------- |
| Promise\<boolean> | Promise形式返回boolean代表是否启用。 |
**示例:**
......@@ -778,14 +778,14 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ------ | ---- | --------------------------------------------------------- |
| ---------- | ----------------------- | ---- | --------------- |
| bundleName | string | 是 | 要查询的应用程序包名称。 |
| callback | AsyncCallback\<boolean> | 是 | 返回boolean代表是否启用 |
**示例:**
```js
let bundleName : "com.example.myapplication";
let bundleName = "com.example.myapplication";
bundle.isApplicationEnabled(bundleName, (err, data) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
......@@ -812,7 +812,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| ----------- | ------ | ---- | ------------------------------------- |
| want | Want | 是 | 包含要查询的应用程序包名称的意图。 |
| bundleFlags | number | 是 | 用于指定返回abilityInfo信息。默认值:0,取值范围:大于等于0。 |
| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0 |
......@@ -820,7 +820,7 @@ SystemCapability.BundleManager.BundleFramework
**返回值:**
| 类型 | 说明 |
| ---------------------------- | ---------------------------- |
| ---------------------------- | --------------------- |
| Promise<Array\<AbilityInfo>> | Promise形式返回Ability信息。 |
**示例:**
......@@ -855,7 +855,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
| ----------- | ---------------------------------- | ---- | ------------------------------------- |
| want | Want | 是 | 指示包含要查询的应用程序包名称的意图。 |
| bundleFlags | number | 是 | 用于指定返回abilityInfo信息。默认值:0,取值范围:大于等于0。 |
| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0 |
......@@ -892,7 +892,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
| ----------- | ---------------------------------- | ---- | ------------------------------------- |
| want | Want | 是 | 指示包含要查询的应用程序包名称的意图。 |
| bundleFlags | number | 是 | 用于指定返回abilityInfo信息。默认值:0,取值范围:大于等于0。 |
| callback | AsyncCallback<Array\<AbilityInfo>> | 是 | 程序启动作为入参的回调函数,返回Ability信息。 |
......@@ -933,12 +933,12 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ---------- | ------ | ---- | -------- |
| ---------- | ------ | ---- | ------------ |
| bundleName | string | 是 | 要查询的应用程序包名称。 |
**返回值:**
| 类型 | 说明 |
| --------------------- | ------------------------------------------------------------ |
| -------------- | -------------------------------------- |
| Promise\<Want> | 返回值为Promise对象,Promise中包含拉起指定应用的Want对象。 |
**示例:**
......@@ -970,7 +970,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ---------- | ------ | ---- | -------- |
| ---------- | -------------------- | ---- | ------------------------------ |
| bundleName | string | 是 | 要查询的应用程序包名称。 |
| callback | AsyncCallback\<Want> | 是 | 程序启动作为入参的回调函数,返回拉起指定应用的want对象。 |
......@@ -1001,12 +1001,12 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ---------- | ------ | ---- | -------- |
| ---- | ------ | ---- | -------- |
| uid | number | 是 | 要查询的uid。 |
**返回值:**
| 类型 | 说明 |
| --------------------- | ------------------------------------------------------------ |
| ---------------- | --------------------------------- |
| Promise\<string> | 返回值为Promise对象,Promise中包含指定uid的包名。 |
**示例:**
......@@ -1034,7 +1034,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ---------- | ------ | ---- | -------- |
| -------- | ---------------------- | ---- | ------------------------- |
| uid | number | 是 | 要查询的uid。 |
| callback | AsyncCallback\<string> | 是 | 程序启动作为入参的回调函数,返回指定uid的包名。 |
......@@ -1145,7 +1145,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| -------------- | ------ | ---- | ---------------------------------------- |
| want | Want | 是 | 包含要查询的应用程序包名称的意图。 |
| extensionFlags | number | 是 | 用于指定返回ExtensionAbilityInfo信息。默认值:0,取值范围:大于等于0。 |
| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0 |
......@@ -1153,7 +1153,7 @@ SystemCapability.BundleManager.BundleFramework
**返回值:**
| 类型 | 说明 |
| ---------------------------- | ---------------------------- |
| ------------------------------------- | ------------------------------ |
| Promise<Array\<ExtensionAbilityInfo>> | Promise形式返回ExtensionAbility信息。 |
**示例:**
......@@ -1192,7 +1192,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
| -------------- | ---------------------------------------- | ---- | ---------------------------------------- |
| want | Want | 是 | 指示包含要查询的应用程序包名称的意图。 |
| extensionFlags | number | 是 | 用于指定返回ExtensionAbilityInfo信息。默认值:0,取值范围:枚举值,大于等于0。 |
| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0 |
......@@ -1233,7 +1233,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
| -------------- | ---------------------------------------- | ---- | ---------------------------------------- |
| want | Want | 是 | 指示包含要查询的应用程序包名称的意图。 |
| extensionFlags | number | 是 | 用于指定返回ExtensionAbilityInfo信息。默认值:0,取值范围:大于等于0。 |
| callback | AsyncCallback<Array\<ExtensionAbilityInfo>> | 是 | 程序启动作为入参的回调函数,返回ExtensionAbility信息。 |
......@@ -1260,7 +1260,7 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => {
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ----------- | -------- | ------ | ---- | ------------------------------------------------------------ |
| ----------- | ---- | ------ | ---- | ---------------------------------------- |
| deviceId | 只读 | string | 否 | 表示运行指定Ability的设备ID。 |
| bundleName | 只读 | string | 是 | 表示包描述。如果在Want中同时指定了BundleName和AbilityName,则Want可以直接匹配到指定的Ability。 |
| abilityName | 只读 | string | 是 | 表示待启动的Ability名称。如果在Want中同时指定了BundleName和AbilityName,则Want可以直接匹配到指定的Ability。 |
......@@ -1272,7 +1272,7 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => {
**系统能力:** SystemCapability.BundleManager.BundleFramework
| 名称 | 默认值 | 说明 |
| ------ | ------ | ------ |
| ---------------------------------------- | ---- | ------------------------- |
| SUCCESS | 0 | 安装成功 |
| STATUS_INSTALL_FAILURE | 1 | 安装失败(不存在安装的应用) |
| STATUS_INSTALL_FAILURE_ABORTED | 2 | 安装中止 |
......@@ -1301,7 +1301,7 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => {
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 默认值 | 说明 |
| ------ | ------ | ------ |
| ---------------------------------------- | ---------- | ------------------- |
| GET_BUNDLE_DEFAULT | 0x00000000 | 获取默认的应用信息 |
| GET_BUNDLE_WITH_ABILITIES | 0x00000001 | 获取包括Ability信息的包信息 |
| GET_ABILITY_INFO_WITH_PERMISSION | 0x00000002 | 获取包括权限的Ability信息 |
......@@ -1323,7 +1323,7 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => {
**系统能力:** SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ------ | ------ | ------ | ------ |
| ------ | ------ | ---- | ---- | ---------------------------- |
| userId | number | 是 | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
## BundleInfo
......@@ -1333,7 +1333,7 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => {
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ------ | ------ | ------ | ------ |
| --------------------------------- | ---------------------------- | ---- | ---- | --------------------- |
| name | string | 是 | 否 | 应用包的名称 |
| type | string | 是 | 否 | 应用包类型 |
| appId | string | 是 | 否 | 应用包里应用程序的id |
......@@ -1397,7 +1397,7 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => {
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ------ | ------ | ------ | ------ |
| --------------- | ------ | ---- | ---- | ---- |
| moduleName | string | 是 | 否 | 模块名称 |
| moduleSourceDir | string | 是 | 否 | 安装目录 |
......@@ -1408,7 +1408,7 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => {
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----- | ------ | ---- | ---- | ---------------- |
| ------------------ | ------ | ---- | ---- | -------- |
| name | string | 是 | 是 | 自定义元数据名称 |
| value | string | 是 | 是 | 自定义元数据值 |
| extra<sup>8+</sup> | string | 是 | 是 | 自定义资源 |
......@@ -1448,7 +1448,7 @@ Hap模块信息
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ------ | ------ | ------ | ------ |
| --------- | --------- | ---- | ---- | ---------- |
| name | string | 是 | 是 | 需要使用的权限名称 |
| reason | string | 是 | 是 | 描述申请权限的原因 |
| usedScene | UsedScene | 是 | 是 | 权限使用的场景和时机 |
......@@ -1460,7 +1460,7 @@ Hap模块信息
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ------ | ------ | ------ | ------ |
| --------- | -------------- | ---- | ---- | ---------------- |
| abilities | Array\<string> | 是 | 是 | 使用到该权限的Ability集合 |
| when | string | 是 | 是 | 使用该权限的时机 |
......@@ -1472,7 +1472,7 @@ Ability信息
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ------ | ------ | ------ | ------ |
| --------------------- | --------------------- | ---- | ---- | ------------------------ |
| bundleName | string | 是 | 否 | 应用包名 |
| name | string | 是 | 否 | Ability名称 |
| label | string | 是 | 否 | Ability对用户显示的名称 |
......@@ -1509,7 +1509,7 @@ Ability类型
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 说明 |
| ------- | ---- | --------------------------- |
| ------- | ---- | ----------------- |
| UNKNOWN | 无 | 未知Ability类型 |
| PAGE | 无 | Ability有一个UI界面 |
| SERVICE | 无 | Ability没有UI界面 |
......@@ -1522,7 +1522,7 @@ Ability类型
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 说明 |
| ------------- | ---- | ------------------------ |
| ------------- | ---- | ------------- |
| UNSPECIFIED | 无 | 屏幕方向--不指定 |
| LANDSCAPE | 无 | 屏幕方向--横屏 |
| PORTRAIT | 无 | 屏幕方向--竖屏 |
......@@ -1535,7 +1535,7 @@ Ability类型
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 说明 |
| ----------- | ---- | ------------------- |
| --------- | ---- | ------------- |
| SINGLETON | 0 | Ability只有一个示例 |
| STANDARD | 1 | Ability有多个示例 |
......@@ -1546,7 +1546,7 @@ Ability的子类型
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 说明 |
| ----------- | ---- | ----------------------------- |
| ----------- | ---- | -------------------- |
| UNSPECIFIED | 0 | 未定义Ability子类型 |
| CA | 1 | Ability子类型是带有 UI 的服务 |
......@@ -1558,7 +1558,7 @@ ExtensionAbility的类型
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 说明 |
| -------------------- | ---- | ----------------------------- |
| ------------------------------ | ---- | ------------------------- |
| FORM<sup>9+</sup> | 0 | ExtensionAbility的类型包括卡片 |
| WORK_SCHEDULER<sup>9+</sup> | 1 | ExtensionAbility的类型包括行程安排 |
| INPUT_METHOD<sup>9+</sup> | 2 | ExtensionAbility的类型包括输入法 |
......@@ -1577,7 +1577,7 @@ ExtensionAbility的类型
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 默认值 | 说明 |
| ------ | ------ | ------ |
| ---------------------------------------- | ---------- | ------------------------------ |
| GET_EXTENSION_INFO_DEFAULT<sup>9+</sup> | 0x00000000 | 获取默认的extensionAbilityInfo |
| GET_EXTENSION_INFO_WITH_PERMISSION<sup>9+</sup> | 0x00000002 | 获取携带权限信息的extensionAbilityInfo |
| GET_EXTENSION_INFO_WITH_APPLICATION<sup>9+</sup> | 0x00000004 | 获取携带应用信息的extensionAbilityInfo |
......@@ -1591,7 +1591,7 @@ ExtensionAbility的类型
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 说明 |
| ----------- | ---- | ------------------- |
| ---------- | ---- | ---- |
| AUTO_MODE | -1 | 自动模式 |
| DARK_MODE | 0 | 夜间模式 |
| LIGHT_MODE | 1 | 灯光模式 |
......@@ -1604,7 +1604,7 @@ ExtensionAbility的类型
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 说明 |
| ----------- | ---- | ------------------- |
| ------------------ | ---- | ---- |
| PERMISSION_DENIED | -1 | 拒绝许可 |
| PERMISSION_GRANTED | 0 | 批准 |
......@@ -1616,7 +1616,7 @@ ExtensionAbility信息
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ------ | ------ | ------ | ------ |
| --------------------------------- | --------------------------- | ---- | ---- | --------------------------------- |
| bundleName<sup>9+</sup> | string | 是 | 否 | 应用包名 |
| moduleName<sup>9+</sup> | string | 是 | 否 | ExtensionAbility所属的HAP包的名称 |
| name<sup>9+</sup> | string | 是 | 否 | ExtensionAbility名称 |
......@@ -1640,7 +1640,7 @@ ExtensionAbility信息
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----- | ------ | ---- | ---- | ---------------- |
| --------------------- | ------ | ---- | ---- | ----- |
| name<sup>9+</sup> | string | 是 | 是 | 元数据名称 |
| value<sup>9+</sup> | string | 是 | 是 | 元数据值 |
| resource<sup>9+</sup> | string | 是 | 是 | 元数据资源 |
\ No newline at end of file
......@@ -21,7 +21,7 @@ createAppAccountManager(): AppAccountManager
**返回值:**
| 类型 | 说明 |
| ----------------- | ------------------------ |
| ----------------- | ------------ |
| AppAccountManager | 获取应用帐号模块的实例。 |
**示例:**
......@@ -44,7 +44,7 @@ addAccount(name: string, callback: AsyncCallback&lt;void&gt;): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------------ |
| -------- | ------------------------- | ---- | --------------------- |
| name | string | 是 | 要添加的应用帐户的名称。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 将此应用的帐号名添加到帐号管理服务的回调。 |
......@@ -68,7 +68,7 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback&lt;void&gt;)
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------- | ---- | ------------------------------------------------------------ |
| --------- | ------------------------- | ---- | ---------------------------------------- |
| name | string | 是 | 要添加的应用帐户的名称。 |
| extraInfo | string | 是 | 要添加的应用帐户的额外信息(例如token等),额外的信息不能是应用帐号的敏感信息。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 将此应用程序的帐号名和额外信息添加到帐号管理服务中的回调。 |
......@@ -95,15 +95,15 @@ addAccount(name: string, extraInfo?: string): Promise&lt;void&gt;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ------------------------------------------------------------ |
| --------- | ------ | ---- | -------------------------------- |
| name | string | 是 | 要添加的应用帐户的名称。 |
| extraInfo | string | 是 | 要添加的应用帐户的额外信息,额外的信息不能是应用帐号的敏感信息。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | ---------------------------------- |
| Promise&lt;void&gt; | romise实例,用于获取异步返回结果。 |
| ------------------- | --------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -127,7 +127,7 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------------ |
| -------- | --------------------- | ---- | --------------- |
| owner | string | 是 | 要添加的应用帐户的所有者包名。 |
| authType | string | 是 | 要添加的应用帐户的鉴权类型。 |
| options | {[key: string]: any} | 是 | 鉴权所需要的可选项。 |
......@@ -168,7 +168,7 @@ deleteAccount(name: string, callback: AsyncCallback&lt;void&gt;): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------------------- |
| -------- | ------------------------- | ---- | ----------------- |
| name | string | 是 | 要删除的应用帐户的名称。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 帐号管理服务中删除应用帐号的回调。 |
......@@ -192,13 +192,13 @@ deleteAccount(name: string): Promise&lt;void&gt;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------ |
| ---- | ------ | ---- | ------------ |
| name | string | 是 | 要删除的应用帐户的名称。 |
**返回值:**
| 类型 | 说明 |
| :------------------ | :---------------------------------- |
| :------------------ | :-------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -223,7 +223,7 @@ disableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;vo
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ------------------------------------------------------------ |
| ---------- | ------------------------- | ---- | ------------------------------- |
| name | string | 是 | 要禁用访问的第三方应用帐户的名称。 |
| bundleName | string | 是 | 第三方应用的包名。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 禁止指定第三方应用帐户的名称访问指定包名称的第三方应用的回调。 |
......@@ -248,14 +248,14 @@ disableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | ---------------------------------- |
| ---------- | ------ | ---- | ----------------- |
| name | string | 是 | 要禁用访问的第三方应用帐户的名称。 |
| bundleName | string | 是 | 第三方应用的包名。 |
**返回值:**
| 类型 | 说明 |
| :------------------ | :---------------------------------- |
| :------------------ | :-------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -280,7 +280,7 @@ enableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;voi
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ------------------------------------------------------------ |
| ---------- | ------------------------- | ---- | ------------------------------- |
| name | string | 是 | 应用帐号名称。 |
| bundleName | string | 是 | 第三方应用的包名。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 允许指定第三方应用帐户的名称访问指定包名称的第三方应用的回调。 |
......@@ -305,14 +305,14 @@ enableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | ------------------ |
| ---------- | ------ | ---- | --------- |
| name | string | 是 | 应用帐号名称。 |
| bundleName | string | 是 | 第三方应用的包名。 |
**返回值:**
| 类型 | 说明 |
| :------------------ | :---------------------------------- |
| :------------------ | :-------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -338,7 +338,7 @@ checkAppAccountSyncEnable(name: string, callback: AsyncCallback&lt;boolean&gt;):
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | -------------------------------------------- |
| -------- | ---------------------------- | ---- | ---------------------- |
| name | string | 是 | 应用帐号名称。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 检查指定应用帐号是否允许应用数据同步的回调。 |
......@@ -365,13 +365,13 @@ checkAppAccountSyncEnable(name: string): Promise&lt;boolean&gt;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------- |
| ---- | ------ | ---- | ------- |
| name | string | 是 | 应用帐号名称。 |
**返回值:**
| 类型 | 说明 |
| :--------------------- | :---------------------------------- |
| :--------------------- | :-------------------- |
| Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -396,7 +396,7 @@ setAccountCredential(name: string, credentialType: string, credential: string,ca
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------------------------- | ---- | ---------------------------- |
| -------------- | ------------------------- | ---- | -------------- |
| name | string | 是 | 应用程序帐户的名称。 |
| credentialType | string | 是 | 要设置的凭据的类型。 |
| credential | string | 是 | 要设置的凭据。 |
......@@ -422,7 +422,7 @@ setAccountCredential(name: string, credentialType: string, credential: string):
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------ | ---- | -------------------- |
| -------------- | ------ | ---- | ---------- |
| name | string | 是 | 应用帐户的名称。 |
| credentialType | string | 是 | 要设置的凭据的类型。 |
| credential | string | 是 | 要设置的凭据。 |
......@@ -430,7 +430,7 @@ setAccountCredential(name: string, credentialType: string, credential: string):
**返回值:**
| 类型 | 说明 |
| :------------------ | :---------------------------------- |
| :------------------ | :-------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -455,7 +455,7 @@ setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback&lt;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------- | ---- | -------------------------------- |
| --------- | ------------------------- | ---- | ---------------- |
| name | string | 是 | 应用帐户的名称。 |
| extraInfo | string | 是 | 要设置的额外信息。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 设置此应用帐号的额外信息的回调。 |
......@@ -480,14 +480,14 @@ setAccountExtraInfo(name: string, extraInfo: string): Promise&lt;void&gt;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ------------------ |
| --------- | ------ | ---- | --------- |
| name | string | 是 | 应用帐户的名称。 |
| extraInfo | string | 是 | 要设置的额外信息。 |
**返回值:**
| 类型 | 说明 |
| :------------------ | :---------------------------------- |
| :------------------ | :-------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -514,7 +514,7 @@ setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | -------------------------------------------------- |
| -------- | ------------------------- | ---- | ------------------------- |
| name | string | 是 | 应用帐户的名称。 |
| isEnable | boolean | 是 | 是否允许应用数据同步。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 设置指定的应用帐号是否允许应用程序数据同步的回调。 |
......@@ -541,14 +541,14 @@ setAppAccountSyncEnable(name: string, isEnable: boolean): Promise&lt;void&gt;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------- | ---- | ---------------------- |
| -------- | ------- | ---- | ----------- |
| name | string | 是 | 应用帐户的名称。 |
| isEnable | boolean | 是 | 是否允许应用数据同步。 |
**返回值:**
| 类型 | 说明 |
| :------------------ | :---------------------------------- |
| :------------------ | :-------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -573,7 +573,7 @@ setAssociatedData(name: string, key: string, value: string, callback: AsyncCallb
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------------------- |
| -------- | ------------------------- | ---- | ----------------- |
| name | string | 是 | 应用帐户的名称。 |
| key | string | 是 | 要设置的数据的键,密钥可以自定义。 |
| value | string | 是 | 要设置的数据的值。 |
......@@ -598,7 +598,7 @@ setAssociatedData(name: string, key: string, value: string): Promise&lt;void&gt;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------------------- |
| ----- | ------ | ---- | ----------------- |
| name | string | 是 | 应用帐户的名称。 |
| key | string | 是 | 要设置的数据的键,密钥可以自定义。 |
| value | string | 是 | 要设置的数据的值。 |
......@@ -606,7 +606,7 @@ setAssociatedData(name: string, key: string, value: string): Promise&lt;void&gt;
**返回值:**
| 类型 | 说明 |
| :------------------ | :---------------------------------- |
| :------------------ | :-------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -631,7 +631,7 @@ getAccountCredential(name: string, credentialType: string, callback: AsyncCallba
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------------- | --------------------------- | ---- | ---------------------------- |
| -------------- | --------------------------- | ---- | -------------- |
| name | string | 是 | 应用帐号名称。 |
| credentialType | string | 是 | 要获取的凭据的类型。 |
| callback | AsyncCallback&lt;string&gt; | 是 | 获取此应用帐号的凭据的回调。 |
......@@ -657,14 +657,14 @@ getAccountCredential(name: string, credentialType: string): Promise&lt;string&gt
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------ | ---- | -------------------- |
| -------------- | ------ | ---- | ---------- |
| name | string | 是 | 应用帐号名称。 |
| credentialType | string | 是 | 要获取的凭据的类型。 |
**返回值:**
| 类型 | 说明 |
| :-------------------- | :---------------------------------- |
| :-------------------- | :-------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -689,7 +689,7 @@ getAccountExtraInfo(name: string, callback: AsyncCallback&lt;string&gt;): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------------------------- |
| -------- | --------------------------- | ---- | ---------------- |
| name | string | 是 | 应用帐号名称。 |
| callback | AsyncCallback&lt;string&gt; | 是 | 获取此应用帐号的额外信息的回调。 |
......@@ -714,13 +714,13 @@ getAccountExtraInfo(name: string): Promise&lt;string&gt;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------- |
| ---- | ------ | ---- | ------- |
| name | string | 是 | 应用帐号名称。 |
**返回值:**
| 类型 | 说明 |
| :-------------------- | :---------------------------------- |
| :-------------------- | :-------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -745,7 +745,7 @@ getAssociatedData(name: string, key: string, callback: AsyncCallback&lt;string&g
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ---------------------------------- |
| -------- | --------------------------- | ---- | ----------------- |
| name | string | 是 | 应用帐号名称。 |
| key | string | 是 | 要获取的数据的key。 |
| callback | AsyncCallback&lt;string&gt; | 是 | 获取与此应用帐号关联的数据的回调。 |
......@@ -771,14 +771,14 @@ getAssociatedData(name: string, key: string): Promise&lt;string&gt;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------- |
| ---- | ------ | ---- | ----------- |
| name | string | 是 | 应用帐号名称。 |
| key | string | 是 | 要获取的数据的key。 |
**返回值:**
| 类型 | 说明 |
| :-------------------- | :---------------------------------- |
| :-------------------- | :-------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -805,7 +805,7 @@ getAllAccessibleAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------ | ---- | ---------------- |
| -------- | ---------------------------------------- | ---- | -------- |
| callback | AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt; | 是 | 应用帐号信息列表 |
**示例:**
......@@ -831,7 +831,7 @@ getAllAccessibleAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
**参数:**
| 类型 | 说明 |
| ------------------------------------------ | ----------------------------------- |
| ---------------------------------------- | --------------------- |
| Promise&lt;Array&lt;AppAccountInfo&gt;&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -858,7 +858,7 @@ getAllAccounts(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccountInfo
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------ | ---- | ---------------- |
| -------- | ---------------------------------------- | ---- | -------- |
| owner | string | 是 | 应用包名称 |
| callback | AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt; | 是 | 应用帐号信息列表 |
......@@ -886,13 +886,13 @@ getAllAccounts(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------- |
| ----- | ------ | ---- | ----- |
| owner | string | 是 | 应用包名称 |
**参数:**
| 类型 | 说明 |
| ------------------------------------------ | ----------------------------------- |
| ---------------------------------------- | --------------------- |
| Promise&lt;Array&lt;AppAccountInfo&gt;&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -918,7 +918,7 @@ on(type: 'change', owners: Array&lt;string&gt;, callback: Callback&lt;Array&lt;A
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------- | ---- | ------------------------------------------------------------ |
| -------- | ---------------------------------------- | ---- | ------------------------------ |
| type | 'change' | 是 | 关于帐户更改事件,当帐户所有者更新帐户时,订阅者将收到通知。 |
| owners | Array&lt;string&gt; | 是 | 指示帐户的所有者。 |
| callback | Callback&lt;Array&lt;AppAccountInfo&gt;&gt; | 是 | 订阅指定帐号所有者的帐户变更事件的回调。 |
......@@ -949,7 +949,7 @@ off(type: 'change', callback?: Callback<Array\<AppAccountInfo>>): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------- | ---- | ------------------------ |
| -------- | -------------------------------- | ---- | ------------ |
| type | 'change' | 是 | 关于帐户更改事件。 |
| callback | Callback<Array\<AppAccountInfo>> | 否 | 取消订阅帐号事件的回调。 |
......@@ -982,7 +982,7 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------------ |
| -------- | --------------------- | ---- | --------------- |
| name | string | 是 | 要鉴权的应用帐户的名称。 |
| owner | string | 是 | 要鉴权的应用帐户的所有者包名。 |
| authType | string | 是 | 鉴权类型。 |
......@@ -1024,7 +1024,7 @@ getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCall
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ---------------------- |
| -------- | --------------------------- | ---- | ----------- |
| name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 |
| authType | string | 是 | 鉴权类型。 |
......@@ -1051,7 +1051,7 @@ getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string&
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---------------------- |
| -------- | ------ | ---- | ----------- |
| name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 |
| authType | string | 是 | 鉴权类型。 |
......@@ -1059,7 +1059,7 @@ getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string&
**参数:**
| 类型 | 说明 |
| --------------------- | ----------------------------------- |
| --------------------- | --------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -1084,7 +1084,7 @@ setOAuthToken(name: string, authType: string, token: string, callback: AsyncCall
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------- |
| -------- | ------------------------- | ---- | -------- |
| name | string | 是 | 应用帐户的名称。 |
| authType | string | 是 | 鉴权类型。 |
| token | string | 是 | OAuth令牌。 |
......@@ -1110,7 +1110,7 @@ setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---------------- |
| -------- | ------ | ---- | -------- |
| name | string | 是 | 应用帐户的名称。 |
| authType | string | 是 | 鉴权类型。 |
| token | string | 是 | OAuth令牌。 |
......@@ -1118,7 +1118,7 @@ setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt
**参数:**
| 类型 | 说明 |
| ------------------- | ----------------------------------- |
| ------------------- | --------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -1143,7 +1143,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string, c
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------- |
| -------- | ------------------------- | ---- | ------------ |
| name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 |
| authType | string | 是 | 鉴权类型。 |
......@@ -1170,7 +1170,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string):
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---------------------- |
| -------- | ------ | ---- | ------------ |
| name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 |
| authType | string | 是 | 鉴权类型。 |
......@@ -1179,7 +1179,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string):
**参数:**
| 类型 | 说明 |
| ------------------- | ----------------------------------- |
| ------------------- | --------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -1204,7 +1204,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ------------------------ |
| ---------- | ------------------------- | ---- | ------------ |
| name | string | 是 | 应用帐户的名称。 |
| authType | string | 是 | 鉴权类型。 |
| bundleName | string | 是 | 被设置可见性的应用包名。 |
......@@ -1231,7 +1231,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------- | ---- | ------------------------ |
| ---------- | ------- | ---- | ------------ |
| name | string | 是 | 应用帐户的名称。 |
| authType | string | 是 | 鉴权类型。 |
| bundleName | string | 是 | 被设置可见性的应用包名。 |
......@@ -1240,14 +1240,13 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**参数:**
| 类型 | 说明 |
| ------------------- | ----------------------------------- |
| ------------------- | --------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
```
const appAccountManager = account_appAccount.createAppAccountManager();
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true).then(() => {
console.log('setOAuthTokenVisibility successfully');
}).catch((err) => {
......@@ -1266,7 +1265,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, ca
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------------- | ---- | -------------------------- |
| ---------- | ---------------------------- | ---- | ------------- |
| name | string | 是 | 应用帐户的名称。 |
| authType | string | 是 | 鉴权类型。 |
| bundleName | string | 是 | 用于检查可见性的应用包名。 |
......@@ -1293,7 +1292,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | -------------------------- |
| ---------- | ------ | ---- | ------------- |
| name | string | 是 | 应用帐户的名称。 |
| authType | string | 是 | 鉴权类型。 |
| bundleName | string | 是 | 用于检查可见性的应用包名。 |
......@@ -1301,7 +1300,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P
**参数:**
| 类型 | 说明 |
| ---------------------- | ----------------------------------- |
| ---------------------- | --------------------- |
| Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -1326,7 +1325,7 @@ getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array&
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------ | ---- | ---------------------- |
| -------- | ---------------------------------------- | ---- | ----------- |
| name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 |
| callback | AsyncCallback&lt;Array&lt;OAuthTokenInfo&gt;&gt; | 是 | 查询结果的回调。 |
......@@ -1352,14 +1351,14 @@ getAllOAuthTokens(name: string, owner: string): Promise&lt;Array&lt;OAuthTokenIn
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------- |
| ----- | ------ | ---- | ----------- |
| name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 |
**参数:**
| 类型 | 说明 |
| ------------------------------------------ | ----------------------------------- |
| ---------------------------------------- | --------------------- |
| Promise&lt;Array&lt;OAuthTokenInfo&gt;&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -1384,7 +1383,7 @@ getOAuthList(name: string, authType: string, callback: AsyncCallback&lt;Array&lt
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ---------------------- |
| -------- | ---------------------------------------- | ---- | ----------- |
| name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | 是 | 查询结果的回调。 |
......@@ -1410,14 +1409,14 @@ getOAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------- |
| ----- | ------ | ---- | ----------- |
| name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 |
**参数:**
| 类型 | 说明 |
| ---------------------------------- | ----------------------------------- |
| ---------------------------------- | --------------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -1442,7 +1441,7 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback&lt;Authentic
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------------------------ | ---- | ---------------- |
| --------- | ---------------------------------------- | ---- | -------- |
| sessionId | string | 是 | 鉴权会话的标识。 |
| callback | AsyncCallback&lt;AuthenticatorCallback&gt; | 是 | 查询结果的回调。 |
......@@ -1477,13 +1476,13 @@ getAuthenticatorCallback(sessionId: string): Promise&lt;AuthenticatorCallback&gt
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ---------------- |
| --------- | ------ | ---- | -------- |
| sessionId | string | 是 | 鉴权会话的标识。 |
**参数:**
| 类型 | 说明 |
| ------------------------------------ | ----------------------------------- |
| ------------------------------------ | --------------------- |
| Promise&lt;AuthenticatorCallback&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -1517,7 +1516,7 @@ getAuthenticatorInfo(owner: string, callback: AsyncCallback&lt;AuthenticatorInfo
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------- | ---- | ---------------------- |
| -------- | -------------------------------------- | ---- | ----------- |
| owner | string | 是 | 应用帐户的所有者包名。 |
| callback | AsyncCallback&lt;AuthenticatorInfo&gt; | 是 | 查询结果的回调。 |
......@@ -1542,13 +1541,13 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------- |
| ----- | ------ | ---- | ----------- |
| owner | string | 是 | 应用帐户的所有者包名。 |
**参数:**
| 类型 | 说明 |
| -------------------------------- | ----------------------------------- |
| -------------------------------- | --------------------- |
| Promise&lt;AuthenticatorInfo&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
......@@ -1569,7 +1568,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------- |
| ----- | ------ | ---- | ----------- |
| owner | string | 是 | 应用帐户的所有者包名。 |
| name | string | 是 | 应用帐户的名称。 |
......@@ -1580,7 +1579,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---------------- |
| -------- | ------ | ---- | -------- |
| authType | string | 是 | 令牌的鉴权类型。 |
| token | string | 是 | 令牌的取值。 |
......@@ -1591,7 +1590,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | -------------------- |
| ------- | ------ | ---- | ---------- |
| owner | string | 是 | 认证器的所有者包名。 |
| iconId | string | 是 | 认证器的图标标识。 |
| labelId | string | 是 | 认证器的标签标识。 |
......@@ -1603,7 +1602,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。
| 名称 | 默认值 | 描述 |
| ----------------------------- | ---------------------- | ------------------------- |
| ----------------------------- | ---------------------- | ------------- |
| ACTION_ADD_ACCOUNT_IMPLICITLY | "addAccountImplicitly" | 表示操作_隐式添加帐号。 |
| ACTION_AUTHENTICATE | "authenticate" | 表示操作_鉴权。 |
| KEY_NAME | "name" | 表示键名_应用帐户名称。 |
......@@ -1623,7 +1622,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。
| 名称 | 默认值 | 描述 |
| ----------------------------------- | ------ | ------------------------ |
| ----------------------------------- | ----- | ------------ |
| SUCCESS | 0 | 表示操作成功。 |
| ERROR_ACCOUNT_NOT_EXIST | 10001 | 表示应用帐户不存在。 |
| ERROR_APP_ACCOUNT_SERVICE_EXCEPTION | 10002 | 表示应用帐户服务异常。 |
......@@ -1658,7 +1657,7 @@ onResult: (code: number, result: {[key: string]: any}) =&gt; void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | -------------------- | ---- | ------------ |
| ------ | -------------------- | ---- | ------ |
| code | number | 是 | 鉴权结果码。 |
| result | {[key: string]: any} | 是 | 鉴权结果。 |
......@@ -1688,7 +1687,7 @@ onRequestRedirected: (request: Want) =&gt; void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ---- | ---- | -------------------- |
| ------- | ---- | ---- | ---------- |
| request | Want | 是 | 用于跳转的请求信息。 |
**示例:**
......@@ -1725,7 +1724,7 @@ addAccountImplicitly(authType: string, callerBundleName: string, options: {[key:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------------- | --------------------- | ---- | ------------------------------ |
| ---------------- | --------------------- | ---- | --------------- |
| authType | string | 是 | 应用帐户的鉴权类型。 |
| callerBundleName | string | 是 | 鉴权请求方的包名。 |
| options | {[key: string]: any} | 是 | 鉴权所需要的可选项。 |
......@@ -1741,7 +1740,7 @@ authenticate(name: string, authType: string, callerBundleName: string, options:
**参数:**
| 接口名 | 类型 | 必填 | 说明 |
| ---------------- | --------------------- | ---- | ------------------------------ |
| ---------------- | --------------------- | ---- | --------------- |
| name | string | 是 | 应用帐户的名称。 |
| authType | string | 是 | 应用帐户的鉴权类型。 |
| callerBundleName | string | 是 | 鉴权请求方的包名。 |
......
# Want
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
Want是系统的基本通信组件。
## 导入模块
```
import Want from '@ohos.application.Want';
```
## 属性
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityBase
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
| deviceId | 只读 | string | 否 | 表示运行指定Ability的设备ID。 |
| bundleName | 只读 | string | 否 | 表示包描述。如果在Want中同时指定了BundleName和AbilityName,则Want可以直接匹配到指定的Ability。 |
| abilityName | 只读 | string | 否 | 表示待启动的Ability名称。如果在Want中同时指定了BundleName和AbilityName,则Want可以直接匹配到指定的Ability。 |
| uri | 只读 | string | 否 | 表示Uri描述。如果在Want中指定了Uri,则Want将匹配指定的Uri信息,包括scheme, schemeSpecificPart, authority和path信息。 |
| type | 只读 | string | 否 | 表示MIME type类型描述,比如:"text/plain" 、 "image/*"等。 |
| flags | 只读 | number | 否 | 表示处理Want的方式。默认传数字,具体参考:[flags说明](#flags说明)。 |
| action | 只读 | string | 否 | 表示action选项描述。 |
| parameters | 只读 | {[key: string]: any} | 否 | 表示WantParams描述。 |
| entities | 只读 | Array\<string> | 否 | 表示entities相关描述。 | |
\ No newline at end of file
......@@ -82,13 +82,11 @@ isRamConstrainedDevice(): Promise\<boolean>;
**示例:**
```js
IsRamConstrainedDevicePromise(){
app.isRamConstrainedDevicePromise().then((data) => {
console.log('success:' + JSON.stringify(data));
}).catch((error) => {
console.log('failed:' + JSON.stringify(error));
});
}
```
## appManager.isRamConstrainedDevice
......@@ -108,12 +106,10 @@ isRamConstrainedDevice(callback: AsyncCallback\<boolean>): void;
**示例:**
```js
IsRamConstrainedDeviceCallBack(){
app.isRamConstrainedDevicePromise((err, data) => {
console.log('startAbility result failed:' + JSON.stringify(err));
console.log('startAbility result success:' + JSON.stringify(data));
})
}
```
## appManager.getAppMemorySize
......@@ -133,13 +129,11 @@ getAppMemorySize(): Promise\<number>;
**示例:**
```js
GetAppMemorySize(){
app.getAppMemorySize().then((data) => {
console.log('success:' + JSON.stringify(data));
}).catch((error) => {
console.log('failed:' + JSON.stringify(error));
});
}
```
## appManager.getAppMemorySize
......@@ -159,12 +153,56 @@ getAppMemorySize(callback: AsyncCallback\<number>): void;
**示例:**
```js
GetAppMemorySizeCallBack(){
app.getAppMemorySize((err, data) => {
console.log('startAbility result failed :' + JSON.stringify(err));
console.log('startAbility result success:' + JSON.stringify(data));
})
}
```
## appManager.getProcessRunningInfos<sup>8+</sup>
getProcessRunningInfos(): Promise<Array<ProcessRunningInfo>>;
获取有关运行进程的信息。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise<Array\<ProcessRunningInfo>> | 获取有关运行进程的信息。 |
**示例:**
```js
app.GetProcessRunningInfos().then((data) => {
console.log('success:' + JSON.stringify(data));
}).catch((error) => {
console.log('failed:' + JSON.stringify(error));
});
```
## appManager.getProcessRunningInfos<sup>8+</sup>
getProcessRunningInfos(callback: AsyncCallback<Array<ProcessRunningInfo>>): void;
获取有关运行进程的信息。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<Array\<ProcessRunningInfo>> | 否 | 获取有关运行进程的信息。 |
**示例:**
```js
app.GetProcessRunningInfos((err, data) => {
console.log('startAbility result failed :' + JSON.stringify(err));
console.log('startAbility result success:' + JSON.stringify(data));
})
```
## ProcessRunningInfo
......
......@@ -6,191 +6,31 @@
## 导入模块
requestAnimationFrame:无需导入
cancelAnimationFrame:无需导入
createAnimator:
```
import animator from '@ohos.animator';
```
## 权限列表
## createAnimator
## requestAnimationFrame
createAnimator(options: AnimatorOptions): AnimatorResult
requestAnimationFrame(handler[, [ ...args]]): number
定义Animator类。
请求动画帧,逐帧回调JS函数。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
- 参数
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| handler | Function | 是 | 表示要逐帧回调的函数。requestAnimationFrame函数回调handler函数时会在第一个参数位置传入timestamp时间戳。它表示requestAnimationFrame开始去执行回调函数的时刻。 |
| ...args | Array&lt;any&gt; | 否 | 附加参数,函数回调时,他们会作为参数传递给handler。 |
| options | [AnimatorOptions](#animatoroptions) | 是 | 定义动画选项,详细请参考AnimatorOptions。|
- 返回值
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| number | requestID请求的ID。 |
- 示例
```
<!-- xxx.hml -->
<div class="container">
<button type="capsule" class="btn" onclick="beginAnimation">beginAnimation</button>
</div>
```
```
/* xxx.css */
.container {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.btn{
width: 300px;
margin-top: 40px;
}
```
```
/* xxx.js */
export default {
data: {
requestId: 0,
startTime: 0,
},
beginAnimation() {
cancelAnimationFrame(this.requestId);
this.requestId = requestAnimationFrame(this.runAnimation);
},
runAnimation(timestamp) {
if (this.startTime == 0) {
this.startTime = timestamp;
}
var elapsed = timestamp - this.startTime;
if (elapsed < 500) {
console.log('callback handler timestamp: ' + timestamp);
this.requestId = requestAnimationFrame(this.runAnimation);
}
}
}
```
## cancelAnimationFrame
cancelAnimationFrame(requestId: number): void
取消动画帧,取消逐帧回调请求。
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| requestId | number | 是 | 逐帧回调函数的标识id。 |
- 示例
```
<!-- xxx.hml -->
<div class="container">
<button type="capsule" class="btn" onclick="beginAnimation">beginAnimation</button>
<button type="capsule" class="btn" onclick="stopAnimation">stopAnimation</button>
</div>
```
```
/* xxx.css */
.container {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.btn{
width: 300px;
margin-top: 40px;
}
```
```
/* xxx.js */
export default {
data: {
requestId: 0,
startTime: 0,
},
beginAnimation() {
cancelAnimationFrame(this.requestId);
this.requestId = requestAnimationFrame(this.runAnimation);
},
runAnimation(timestamp) {
if (this.startTime == 0) {
this.startTime = timestamp;
}
var elapsed = timestamp - this.startTime;
if (elapsed < 500) {
console.log('callback handler timestamp: ' + timestamp);
this.requestId = requestAnimationFrame(this.runAnimation);
}
},
stopAnimation() {
cancelAnimationFrame(this.requestId);
}
}
```
| [AnimatorResult](#animatorresult) | Animator结果接口。 |
## createAnimator
createAnimator(options[...]): void
创建动画对象。
**示例:**
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options | Object | 是 | 表示待创建Animator对象的属性,详情见下表options说明。 |
- options说明
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| duration | number | 否 | 动画播放的时长,单位毫秒,默认为0。 |
| easing | string | 否 | 动画插值曲线,默认为'&nbsp;ease&nbsp;'。 |
| delay | number | 否 | 动画延时播放时长,单位毫秒,默认为0,即不延时。 |
| fill | string | 否 | 动画启停模式,默认值none,详情见:[animation-fill-mode](../arkui-js/js-components-common-animation.md) |
| direction | string | 否 | 动画播放模式,默认值normal,详情见:[animation-direction](../arkui-js/js-components-common-animation.md) |
| iterations | number | 否 | 动画播放次数,默认值1,设置为0时不播放,设置为-1时无限次播放。 |
| begin | number | 否 | 动画插值起点,不设置时默认为0。 |
| end | number | 否 | 动画插值终点,不设置时默认为1。 |
- animator支持的接口
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| update | options | 过程中可以使用这个接口更新动画参数,入参与createAnimator一致。 |
| play | - | 开始动画。 |
| finish | - | 结束动画。 |
| pause | - | 暂停动画。 |
| cancel | - | 取消动画。 |
| reverse | - | 倒播动画。 |
- animator支持的事件:
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| frame | number | 逐帧插值回调事件,入参为当前帧的插值 |
| cancel | - | 动画被强制取消 |
| finish | - | 动画播放完成 |
| repeat | - | 动画重新播放 |
- 示例
```
<!-- hml -->
<div class="container">
......@@ -237,3 +77,164 @@ createAnimator(options[...]): void
}
}
```
## AnimatorResult
定义Animator结果接口。
### update
update(options: AnimatorOptions): void
更新当前动画器。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options | [AnimatorOptions](#animatoroptions) | 是 | 定义动画选项。|
**示例:**
```
animator.update(options);
```
### play
play(): void
启动动画。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**示例:**
```
animator.play();
```
### finish
finish(): void
结束动画。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**示例:**
```
animator.finish();
```
### pause
pause(): void
暂停动画。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**示例:**
```
animator.pause();
```
### cancel
cancel(): void
删除动画。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**示例:**
```
animator.cancel();
```
### reverse
reverse(): void
以相反的顺序播放动画。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**示例:**
```
animator.reverse();
```
### onframe
onframe: (progress: number) => void
回调时触发。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| progress | number | 是 | 动画的当前进度。|
**示例:**
```
animator.onframe();
```
### onfinish
onfinish: () => void
动画完成。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**示例:**
```
animator.onfinish();
```
### oncancel
oncancel: () => void
动画被取消。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**示例:**
```
animator.oncancel();
```
### onrepeat
onrepeat: () => void
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**示例:**
```
animator.onrepeat();
```
动画将重复。
## AnimatorOptions
定义动画选项。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| duration | number | 是 | 动画播放的时长,单位毫秒,默认为0。 |
| easing | string | 是 | 动画插值曲线,默认为ease'。 |
| delay | number | 是 | 动画延时播放时长,单位毫秒,默认为0,即不延时。 |
| fill | "none" \| "forwards" \| "backwards" \| "both" | 是 | 动画执行后是否恢复到初始状态,默认值为"none"。动画执行后,动画结束时的状态(在最后一个关键帧中定义)将保留。 |
| direction | "normal" \| "reverse" \| "alternate" \| "alternate-reverse" | 是 | 动画播放模式,默认值"normal"。|
| iterations | number | 是 | 动画播放次数,默认值1。设置为0时不播放,设置为-1时无限次播放。 |
| begin | number | 是 | 动画插值起点,不设置时默认为0。 |
| end | number | 是 | 动画插值终点,不设置时默认为1。 |
# 弹窗
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明**
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块
```
import prompt from '@ohos.prompt'
```
## 权限列表
## prompt.showToast
showToast(options: ShowToastOptions): void
创建并显示文本提示框。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options | [ShowToastOptions](#ShowToastOptions) | 是 | 文本弹窗选项。 |
**示例:**
```
export default {
showToast() {
prompt.showToast({
message: 'Message Info',
duration: 2000,
});
}
}
```
## ShowToastOptions
文本提示框的选项。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| message | string | 是 | 显示的文本信息。 |
| duration | number | 否 | 默认值1500ms,建议区间:1500ms-10000ms。<br/>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**说明:**<br/>>&nbsp;若小于1500ms则取默认值,最大取值为10000ms。 |
| bottom | &lt;length&gt; | 否 | 设置弹窗边框距离屏幕底部的位置。<br/>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**说明:**<br/>>&nbsp;仅手机和平板设备支持。 |
## prompt.showDialog
showDialog(options: ShowDialogOptions): Promise&lt;ShowDialogSuccessResponse&gt;
创建并显示对话框,对话框响应后同步返回结果。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options | [ShowDialogOptions](#ShowDialogOptions) | 是 | 对话框选项。|
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;[ShowDialogSuccessResponse](#ShowDialogSuccessResponse)&gt; | 对话框响应结果。|
**示例:**
```
export default {
showDialog() {
prompt.showDialog({
title: 'Title Info',
message: 'Message Info',
buttons: [
{
text: 'button1',
color: '#000000',
},
{
text: 'button2',
color: '#000000',
}
],
})
.then(data => {
console.info('showDialog success, click button: ' + data.index);
})
.catch(err => {
console.info('showDialog error: ' + err);
})
}
}
```
## prompt.showDialog
showDialog(options: ShowDialogOptions, callback: AsyncCallback&lt;ShowDialogSuccessResponse&gt;):void
创建并显示对话框,对话框响应结果异步返回。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options | [ShowDialogOptions](#ShowDialogOptions) | 是 | 页面显示对话框信息描述。|
| callback | AsyncCallback&lt;[ShowDialogSuccessResponse](#ShowDialogSuccessResponse)&gt; | 是 | 对话框响应结果回调。 |
**示例:**
```
export default {
callback(err, data) {
if(err) {
console.info('showDialog err: ' + err);
return;
}
console.info('showDialog success callback, click button: ' + data.index);
},
showDialog() {
prompt.showDialog({
title: 'showDialog Title Info',
message: 'Message Info',
buttons: [
{
text: 'button1',
color: '#000000',
},
{
text: 'button2',
color: '#000000',
}
]
}, this.callback);
}
}
```
## ShowDialogOptions
对话框的选项。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| title | string | 否 | 标题文本。 |
| message | string | 否 | 内容文本。 |
| buttons | Array | 否 | 对话框中按钮的数组,结构为:{text:'button',&nbsp;color:&nbsp;'\#666666'},支持1-3个按钮。其中第一个为positiveButton;第二个为negativeButton;第三个为neutralButton。 |
## ShowDialogSuccessResponse
对话框的响应结果。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
| 名称 | 类型 | 说明 |
| -------- | -------- | -------- |
| index | number | 选中按钮在buttons数组中的索引。 |
## prompt.showActionMenu
showActionMenu(options: ActionMenuOptions, callback: AsyncCallback&lt;ActionMenuSuccessResponse&gt;):void
创建并显示操作菜单,菜单响应结果异步返回。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options | [ActionMenuOptions](#ActionMenuOptions) | 是 | 操作菜单选项。 |
| callback | AsyncCallback&lt;[ActionMenuSuccessResponse](#ActionMenuSuccessResponse)> | 是 | 菜单响应结果回调。 |
**示例:**
```
export default {
callback(err, data) {
if(err) {
console.info('showActionMenu err: ' + err);
return;
}
console.info('showActionMenu success callback, click button: ' + data.index);
},
showActionMenu() {
prompt.showActionMenu({
title: 'Title Info',
buttons: [
{
text: 'item1',
color: '#666666',
},
{
text: 'item2',
color: '#000000',
},
]
}, this.callback)
}
}
```
## prompt.showActionMenu
showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse>
创建并显示操作菜单,菜单响应后同步返回结果。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options | [ActionMenuOptions](#ActionMenuOptions) | 是 | 操作菜单选项。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;[ActionMenuSuccessResponse](#ActionMenuSuccessResponse)&gt; | 菜单响应结果。|
**示例:**
```
export default {
showActionMenu() {
prompt.showActionMenu({
title: 'showActionMenu Title Info',
buttons: [
{
text: 'item1',
color: '#666666',
},
{
text: 'item2',
color: '#000000',
},
]
})
.then(data => {
console.info('showActionMenu success, click button: ' + data.index);
})
.catch(err => {
console.info('showActionMenu error: ' + err);
})
}
}
```
## ActionMenuOptions
操作菜单的选项。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| title | string | 否 | 标题文本。 |
| buttons | Array | 是 | 菜单中菜单项按钮的数组,结构为:{text:'button',&nbsp;color:&nbsp;'\#666666'},支持1-6个按钮。大于6个按钮时弹窗不显示。 |
## ActionMenuSuccessResponse
操作菜单的响应结果。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| index | number | 否 | 选中按钮在buttons数组中的索引,从0开始。 |
# 页面路由
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明**
>
> - 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> - 页面路由需要在页面渲染完成之后才能调用,在onInit和onReady生命周期中页面还处于渲染阶段,禁止调用页面路由方法。
## 导入模块
```
import router from '@ohos.router'
```
## 权限列表
## router.push
push(options: RouterOptions): void
跳转到应用内的指定页面。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options | [RouterOptions](#RouterOptions) | 是 | 跳转页面描述信息。 |
**示例:**
```
// 在当前页面中
export default {
pushPage() {
router.push({
url: 'pages/routerpage2/routerpage2',
params: {
data1: 'message',
data2: {
data3: [123, 456, 789]
},
},
});
}
}
```
```
// 在routerpage2页面中
export default {
data: {
data1: 'default',
data2: {
data3: [1, 2, 3]
}
},
onInit() {
console.info('showData1:' + this.data1);
console.info('showData3:' + this.data2.data3);
}
}
```
## router.replace
replace(options: RouterOptions): void
用应用内的某个页面替换当前页面,并销毁被替换的页面。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options | [RouterOptions](#RouterOptions) | 是 | 替换页面描述信息。 |
**示例:**
```
// 在当前页面中
export default {
replacePage() {
router.replace({
url: 'pages/detail/detail',
params: {
data1: 'message',
},
});
}
}
```
```
// 在detail页面中
export default {
data: {
data1: 'default'
},
onInit() {
console.info('showData1:' + this.data1)
}
}
```
## router.back
back(options?: RouterOptions ): void
返回上一页面或指定的页面。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options | [RouterOptions](#RouterOptions) | 是 | 返回页面描述信息,其中参数url指路由跳转时会返回到指定url的界面,如果页面栈上没有url页面,则不响应该情况。如果url未设置,则返回上一页。 |
**示例:**
```
// index页面
export default {
indexPushPage() {
router.push({
url: 'pages/detail/detail',
});
}
}
```
```
// detail页面
export default {
detailPushPage() {
router.push({
url: 'pages/mall/mall',
});
}
}
```
```
// mall页面通过back,将返回detail页面
export default {
mallBackPage() {
router.back();
}
}
```
```
// detail页面通过back,将返回index页面
export default {
defaultBack() {
router.back();
}
}
```
```
// 通过back,返回到detail页面
export default {
backToDetail() {
router.back({uri:'pages/detail/detail'});
}
}
```
## router.clear
clear(): void
清空页面栈中的所有历史页面,仅保留当前页面作为栈顶页面。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**示例:**
```
export default {
clearPage() {
router.clear();
}
}
```
## router.getLength
getLength(): string
获取当前在页面栈内的页面数量。
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| string | 页面数量,页面栈支持最大数值是32。 |
**示例:**
```
export default {
getLength() {
var size = router.getLength();
console.log('pages stack size = ' + size);
}
}
```
## router.getState
getState(): RouterState
获取当前页面的状态信息。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**返回值:**
| 类型 | 说明 |
| --------------------------- | -------------- |
| [RouterState](#RouterState) | 页面状态信息。 |
## RouterState
页面状态信息。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
| 名称 | 类型 | 说明 |
| -------- | -------- | -------- |
| index | number | 表示当前页面在页面栈中的索引。<br/>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**说明:**<br/>>&nbsp;从栈底到栈顶,index从1开始递增。 |
| name | string | 表示当前页面的名称,即对应文件名。 |
| path | string | 表示当前页面的路径。 |
**示例:**
```
export default {
getState() {
var page = router.getState();
console.log('current index = ' + page.index);
console.log('current name = ' + page.name);
console.log('current path = ' + page.path);
}
}
```
## router.enableAlertBeforeBackPage
enableAlertBeforeBackPage(options: EnableAlertOptions): void
开启页面返回询问对话框。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options | [EnableAlertOptions](#EnableAlertOptions) | 是 | 文本弹窗信息描述。 |
**示例:**
```
export default {
enableAlertBeforeBackPage() {
router.enableAlertBeforeBackPage({
message: 'Message Info',
success: function() {
console.log('success');
},
fail: function() {
console.log('fail');
},
});
}
}
```
## EnableAlertOptions
页面返回询问对话框选项。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Lite。
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| message | string | 是 | 询问对话框内容。 |
## router.disableAlertBeforeBackPage
disableAlertBeforeBackPage(): void
禁用页面返回询问对话框。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**示例:**
```
export default {
disableAlertBeforeBackPage() {
router.disableAlertBeforeBackPage();
}
}
```
## router.getParams
getParams(): Object
获取发起跳转的页面往当前页传入的参数。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**返回值:**
| 类型 | 说明 |
| ------ | ---------------------------------- |
| Object | 发起跳转的页面往当前页传入的参数。 |
**示例:**
- 类Web范示例
```
// 在当前页面中
export default {
pushPage() {
router.push({
url: 'pages/detail/detail',
params: {
data1: 'message',
},
});
}
}
```
```
// 在detail页面中
export default {
onInit() {
console.info('showData1:' + router.getParams().data1);
}
}
```
- 声明式示例
```
//通过router.push跳转至目标页携带params参数
import router from '@ohos.router'
@Entry
@Component
struct Index {
async routePage() {
let options = {
url: 'pages/second',
params: {
text: '这是第一页的值',
data: {
array: [12, 45, 78]
},
}
}
try {
await router.push(options)
} catch (err) {
console.info(` fail callback, code: ${err.code}, msg: ${err.msg}`)
}
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('这是第一页')
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(25)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({ top: 20 })
.backgroundColor('#ccc')
.onClick(() => {
this.routePage()
})
}
.width('100%')
.height('100%')
}
}
```
```
//在second页面中接收传递过来的参数
import router from '@ohos.router'
@Entry
@Component
struct Second {
private content: string = "这是第二页"
@State text: string = router.getParams().text
@State data: any = router.getParams().data
@State secondData : string = ''
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text(this.text)
.fontSize(30)
.onClick(()=>{
this.secondData = (this.data.array[1]).toString()
})
.margin({top:20})
Text('第一页传来的数值' + ' ' + this.secondData)
.fontSize(20)
.margin({top:20})
.backgroundColor('red')
}
.width('100%')
.height('100%')
}
}
```
## RouterOptions
路由跳转选项。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Lite。
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| url | string | 是 | 表示目标页面的uri,可以用以下两种格式:<br/>-&nbsp;页面绝对路径,由配置文件中pages列表提供,例如:<br/>&nbsp;&nbsp;-&nbsp;pages/index/index<br/>&nbsp;&nbsp;-&nbsp;pages/detail/detail<br/>-&nbsp;特殊值,如果uri的值是"/",则跳转到首页。 |
| params | Object | 否 | 跳转时要同时传递到目标页面的数据,跳转到目标页面后,参数可以在页面中直接使用,如this.data1(data1为跳转时params参数中的key值)。如果目标页面中已有该字段,则其值会被传入的字段值覆盖。 |
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 页面路由栈支持的最大Page数量为32。
......@@ -24,8 +24,6 @@ ohos.permission.DISCOVER_BLUETOOTH
ohos.permission.LOCATION
## bluetooth.enableBluetooth<sup>8+</sup><a name="enableBluetooth"></a>
enableBluetooth(): boolean
......@@ -39,7 +37,7 @@ enableBluetooth(): boolean
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | ------------------------ |
| boolean | 打开蓝牙,成功返回true,否则返回false。 |
**示例:**
......@@ -62,7 +60,7 @@ disableBluetooth(): boolean
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | ------------------------ |
| boolean | 关闭蓝牙,成功返回true,否则返回false。 |
**示例:**
......@@ -85,7 +83,7 @@ getLocalName(): string
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------ | --------- |
| string | 蓝牙本地设备名称。 |
**示例:**
......@@ -108,7 +106,7 @@ getState(): BluetoothState
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| --------------------------------- | --------- |
| [BluetoothState](#bluetoothstate) | 表示蓝牙开关状态。 |
**示例:**
......@@ -131,7 +129,7 @@ getBtConnectionState(): ProfileConnectionState
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ---------------------------------------- | ------------------- |
| [ProfileConnectionState](#profileconnectionstate) | 表示蓝牙设备的Profile连接状态。 |
**示例:**
......@@ -154,13 +152,13 @@ setLocalName(name: string): boolean
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| name | string | 是 | 要设置的蓝牙名称,最大长度为248。 |
| ---- | ------ | ---- | --------------------- |
| name | string | 是 | 要设置的蓝牙名称,最大长度为248字节数。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | ------------------------------ |
| boolean | 设置蓝牙本地设备名称,成功返回true,否则返回false。 |
**示例:**
......@@ -183,13 +181,13 @@ pairDevice(deviceId: string): boolean
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ------ | ---- | ----------------------------------- |
| deviceId | string | 是 | 表示配对的远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | -------------------------- |
| boolean | 发起蓝牙配对,成功返回true,否则返回false。 |
**示例:**
......@@ -213,13 +211,13 @@ getProfileConnState(profileId: ProfileId): ProfileConnectionState
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| --------- | --------- | ---- | ------------------------------------- |
| ProfileId | profileId | 是 | 表示profile的枚举值,例如:PROFILE_A2DP_SOURCE。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ---------------------------------------- | ------------- |
| [ProfileConnectionState](#ProfileConnectionState) | profile的连接状态。 |
**示例:**
......@@ -242,13 +240,13 @@ cancelPairedDevice(deviceId: string): boolean
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ------ | ---- | ------------------------------------- |
| deviceId | string | 是 | 表示要删除的远程设备的地址,例如:"XX:XX:XX:XX:XX:XX"。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | -------------------------- |
| boolean | 启动取消配对,成功返回true,否则返回false。 |
**示例:**
......@@ -271,13 +269,13 @@ getRemoteDeviceName(deviceId: string): string
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ------ | ---- | --------------------------------- |
| deviceId | string | 是 | 表示远程设备的地址,例如:"XX:XX:XX:XX:XX:XX"。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------ | ------------- |
| string | 以字符串格式返回设备名称。 |
**示例:**
......@@ -300,13 +298,13 @@ getRemoteDeviceClass(deviceId: string): DeviceClass
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ------ | ---- | --------------------------------- |
| deviceId | string | 是 | 表示远程设备的地址,例如:"XX:XX:XX:XX:XX:XX"。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| --------------------------- | -------- |
| [DeviceClass](#deviceclass) | 远程设备的类别。 |
**示例:**
......@@ -329,7 +327,7 @@ getPairedDevices(): Array&lt;string&gt;
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------------------- | ------------- |
| Array&lt;string&gt; | 已配对蓝牙设备的地址列表。 |
**示例:**
......@@ -352,14 +350,14 @@ setBluetoothScanMode(mode: ScanMode, duration: number): boolean
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | --------------------- | ---- | ---------------------------- |
| mode | [ScanMode](#scanmode) | 是 | 蓝牙扫描模式。 |
| duration | number | 是 | 设备可被发现的持续时间,单位为秒;设置为0则持续可发现。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | -------------------------- |
| boolean | 设置蓝牙扫描,成功返回true,否则返回false。 |
**示例:**
......@@ -383,7 +381,7 @@ getBluetoothScanMode(): ScanMode
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| --------------------- | ------- |
| [ScanMode](#scanmode) | 蓝牙扫描模式。 |
**示例:**
......@@ -406,7 +404,7 @@ startBluetoothDiscovery(): boolean
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | -------------------------- |
| boolean | 开启蓝牙扫描,成功返回true,否则返回false。 |
**示例:**
......@@ -434,7 +432,7 @@ stopBluetoothDiscovery(): boolean
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | -------------------------- |
| boolean | 关闭蓝牙扫描,成功返回true,否则返回false。 |
**示例:**
......@@ -457,14 +455,14 @@ setDevicePairingConfirmation(device: string, accept: boolean): boolean
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ------- | ---- | -------------------------------- |
| device | string | 是 | 表示远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
| accept | boolean | 是 | 接受配对请求设置为true,否则设置为false。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | ---------------------------- |
| boolean | 设置设备配对确认,成功返回true,否则返回false。 |
**示例:**
......@@ -492,7 +490,7 @@ on(type: "bluetoothDeviceFind", callback: Callback&lt;Array&lt;string&gt;&gt;):
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ----------------------------------- | ---- | -------------------------------------- |
| type | string | 是 | 填写"bluetoothDeviceFind"字符串,表示蓝牙设备发现事件。 |
| callback | Callback&lt;Array&lt;string&gt;&gt; | 是 | 表示回调函数的入参,发现的设备集合。回调函数由用户创建通过该接口注册。 |
......@@ -523,7 +521,7 @@ off(type: "bluetoothDeviceFind", callback?: Callback&lt;Array&lt;string&gt;&gt;)
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ----------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"bluetoothDeviceFind"字符串,表示蓝牙设备发现事件。 |
| callback | Callback&lt;Array&lt;string&gt;&gt; | 否 | 表示取消订阅蓝牙设备发现事件上报。不填该参数则取消订阅该type对应的所有回调。 |
......@@ -555,7 +553,7 @@ on(type: "pinRequired", callback: Callback&lt;PinRequiredParam&gt;): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | -------------------------------- |
| type | string | 是 | 填写"pinRequired"字符串,表示配对请求事件。 |
| callback | Callback&lt;[PinRequiredParam](#pinrequiredparam)&gt; | 是 | 表示回调函数的入参,配对请求。回调函数由用户创建通过该接口注册。 |
......@@ -586,7 +584,7 @@ off(type: "pinRequired", callback?: Callback&lt;PinRequiredParam&gt;): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"pinRequired"字符串,表示配对请求事件。 |
| callback | Callback&lt;[PinRequiredParam](#pinrequiredparam)&gt; | 否 | 表示取消订阅蓝牙配对请求事件上报,入参为配对请求参数。不填该参数则取消订阅该type对应的所有回调。 |
......@@ -618,7 +616,7 @@ on(type: "bondStateChange", callback: Callback&lt;BondStateParam&gt;): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ------------------------------------ |
| type | string | 是 | 填写"bondStateChange"字符串,表示蓝牙配对状态改变事件。 |
| callback | Callback&lt;[BondStateParam](#bondstate)&gt; | 是 | 表示回调函数的入参,配对的状态。回调函数由用户创建通过该接口注册。 |
......@@ -649,7 +647,7 @@ off(type: "bondStateChange", callback?: Callback&lt;BondStateParam&gt;): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"bondStateChange"字符串,表示蓝牙配对状态改变事件。 |
| callback | Callback&lt;[BondStateParam](#bondstate)&gt; | 否 | 表示取消订阅蓝牙配对状态改变事件上报。不填该参数则取消订阅该type对应的所有回调。 |
......@@ -681,7 +679,7 @@ on(type: "stateChange", callback: Callback&lt;BluetoothState&gt;): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | -------------------------------- |
| type | string | 是 | 填写"stateChange"字符串,表示蓝牙状态改变事件。 |
| callback | Callback&lt;[BluetoothState](#bluetoothstate)&gt; | 是 | 表示回调函数的入参,蓝牙状态。回调函数由用户创建通过该接口注册。 |
......@@ -712,7 +710,7 @@ off(type: "stateChange", callback?: Callback&lt;BluetoothState&gt;): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"stateChange"字符串,表示蓝牙状态改变事件。 |
| callback | Callback&lt;[BluetoothState](#bluetoothstate)&gt; | 否 | 表示取消订阅蓝牙状态改变事件上报。不填该参数则取消订阅该type对应的所有回调。 |
......@@ -744,7 +742,7 @@ sppListen(name: string, option: SppOption, callback: AsyncCallback&lt;number&gt;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | --------------------------- | ---- | ----------------------- |
| name | string | 是 | 服务的名称。 |
| option | [SppOption](#sppoption) | 是 | spp监听配置参数。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 表示回调函数的入参,服务端Socket的id。 |
......@@ -777,7 +775,7 @@ sppAccept(serverSocket: number, callback: AsyncCallback&lt;number&gt;): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------------ | --------------------------- | ---- | ----------------------- |
| serverSocket | number | 是 | 服务端socket的id。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 表示回调函数的入参,客户端socket的id。 |
......@@ -810,7 +808,7 @@ sppConnect(device: string, option: SppOption, callback: AsyncCallback&lt;number&
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | --------------------------- | ---- | ------------------------------ |
| device | string | 是 | 对端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
| option | [SppOption](#sppoption) | 是 | spp客户端连接配置参数。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 表示回调函数的入参,客户端socket的id。 |
......@@ -843,7 +841,7 @@ sppCloseServerSocket(socket: number): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ------ | ---- | --------------- |
| socket | number | 是 | 服务端监听socket的id。 |
**示例:**
......@@ -864,7 +862,7 @@ sppCloseClientSocket(socket: number): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ------ | ---- | ------------- |
| 参数名 | 类型 | 必填 | 说明 |
| socket | number | 是 | 客户端socket的id。 |
......@@ -886,15 +884,14 @@ sppWrite(clientSocket: number, data: ArrayBuffer): boolean
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------------ | ----------- | ---- | ------------- |
| clientSocket | number | 是 | 客户端socket的id。 |
| data | ArrayBuffer | 是 | 写入的数据。 |
**返回值:**
| | |
| -------- | -------- |
| 类型 | 说明 |
| ------- | ------------------------- |
| boolean | 写数据操作,成功返回true,否则返回false。 |
**示例:**
......@@ -923,7 +920,7 @@ on(type: "sppRead", clientSocket: number, callback: Callback&lt;ArrayBuffer&gt;)
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------------ | --------------------------- | ---- | -------------------------- |
| type | string | 是 | 填写"sppRead"字符串,表示spp读请求事件。 |
| clientSocket | number | 是 | 客户端socket的id。 |
| callback | Callback&lt;ArrayBuffer&gt; | 是 | 表示回调函数的入参,读取到的数据。 |
......@@ -954,7 +951,7 @@ off(type: "sppRead", clientSocket: number, callback?: Callback&lt;ArrayBuffer&gt
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------------ | --------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"sppRead"字符串,表示spp读请求事件。 |
| clientSocket | number | 是 | 客户端Socket的id。 |
| callback | Callback&lt;ArrayBuffer&gt; | 否 | 表示取消订阅spp读请求事件上报。不填该参数则取消订阅该type对应的所有回调。 |
......@@ -981,20 +978,19 @@ getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfi
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| --------- | --------- | ---- | ------------------------------------- |
| ProfileId | profileId | 是 | 表示profile的枚举值,例如:PROFILE_A2DP_SOURCE。 |
**返回值:**
| | |
| -------- | -------- |
| 类型 | 说明 |
| ---------------------------------------- | ---------------------------------------- |
| A2dpSourceProfile 或者 HandsFreeAudioGatewayProfile | 对应的profile的对象实例,当前支持A2dpSourceProfile, HandsFreeAudioGatewayProfile。 |
**示例:**
```js
A2dpSourceProfile a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE);
let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE);
```
......@@ -1011,7 +1007,7 @@ createGattServer(): GattServer
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------------------------- | ------------------------------------ |
| [GattServer](#gattserver) | server端类,使用server端方法之前需要创建该类的实例进行操作。 |
**示例:**
......@@ -1032,13 +1028,13 @@ createGattClientDevice(deviceId: string): GattClientDevice
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ------ | ---- | ------------------------------------ |
| deviceId | string | 是 | 对端设备地址,&nbsp;例如:"XX:XX:XX:XX:XX:XX"。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------------------------------------- | ------------------------------------ |
| [GattClientDevice](#gattclientdevice) | client端类,使用client端方法之前需要创建该类的实例进行操作。 |
**示例:**
......@@ -1061,7 +1057,7 @@ getConnectedBLEDevices(): Array&lt;string&gt;
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------------------- | ------------------- |
| Array&lt;string&gt; | 返回和当前设备连接BLE设备地址集合。 |
**示例:**
......@@ -1084,7 +1080,7 @@ startBLEScan(filters: Array&lt;ScanFilter&gt;, options?: ScanOptions): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------- | -------------------------------------- | ---- | ----------------------------------- |
| filters | Array&lt;[ScanFilter](#scanfilter)&gt; | 是 | 表示扫描结果过滤策略集合,如果不使用过滤的方式,该参数设置为null。 |
| options | [ScanOptions](#scanoptions) | 否 | 表示扫描的参数配置,可选参数。 |
......@@ -1148,7 +1144,7 @@ on(type: "BLEDeviceFind", callback: Callback&lt;Array&lt;ScanResult&gt;&gt;): vo
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ----------------------------------- |
| type | string | 是 | 填写"BLEDeviceFind"字符串,表示BLE设备发现事件。 |
| callback | Callback&lt;Array&lt;[ScanResult](#scanresult)&gt;&gt; | 是 | 表示回调函数的入参,发现的设备集合。回调函数由用户创建通过该接口注册。 |
......@@ -1179,7 +1175,7 @@ off(type: "BLEDeviceFind", callback?: Callback&lt;Array&lt;ScanResult&gt;&gt;):
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"BLEDeviceFind"字符串,表示BLE设备发现事件。 |
| callback | Callback&lt;Array&lt;[ScanResult](#scanresult)&gt;&gt; | 否 | 表示取消订阅BLE设备发现事件上报。不填该参数则取消订阅该type对应的所有回调。 |
......@@ -1220,7 +1216,7 @@ getConnectionDevices(): Array&lt;string&gt;
**返回值:**
| | |
| -------- | -------- |
| ------------------- | ------------- |
| 类型 | 说明 |
| Array&lt;string&gt; | 返回已连接设备的地址列表。 |
......@@ -1238,14 +1234,14 @@ getDeviceState(device: string): ProfileConnectionState
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ------ | ---- | ------- |
| device | string | 是 | 远端设备地址。 |
|
**返回值:**
| | |
| -------- | -------- |
| ---------------------------------------- | --------------- |
| 类型 | 说明 |
| [ProfileConnectionState](#profileconnectionState) | 返回profile的连接状态。 |
......@@ -1268,22 +1264,22 @@ connect(device: string): boolean
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ------ | ---- | ------- |
| device | string | 是 | 远端设备地址。 |
|
**返回值:**
| | |
| -------- | -------- |
| ------- | ------------------- |
| 类型 | 说明 |
| boolean | 成功返回true,失败返回false。 |
**示例:**
```js
A2dpSourceProfile a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE);
boolean ret = a2dpSrc.connect('XX:XX:XX:XX:XX:XX');
let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE)
let ret = a2dpSrc.connect('XX:XX:XX:XX:XX:XX');
```
......@@ -1300,22 +1296,22 @@ disconnect(device: string): boolean
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ------ | ---- | ------- |
| device | string | 是 | 远端设备地址。 |
|
**返回值:**
| | |
| -------- | -------- |
| ------- | ------------------- |
| 类型 | 说明 |
| boolean | 成功返回true,失败返回false。 |
**示例:**
```js
A2dpSourceProfile a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE);
boolean ret = a2dpSrc.disconnect('XX:XX:XX:XX:XX:XX');
let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE);
let boolean ret = a2dpSrc.disconnect('XX:XX:XX:XX:XX:XX');
```
......@@ -1330,7 +1326,7 @@ on(type: "connectionStateChange", callback: Callback&lt;[StateChangeParam](#Stat
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 |
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | 是 | 表示回调函数的入参。 |
......@@ -1359,7 +1355,7 @@ off(type: "connectionStateChange", callback: Callback&lt;[StateChangeParam](#Sta
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 |
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | 是 | 表示回调函数的入参。 |
......@@ -1388,21 +1384,21 @@ getPlayingState(device: string): PlayingState
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ------ | ---- | ------- |
| device | string | 是 | 远端设备地址。 |
**返回值:**
| | |
| -------- | -------- |
| ----------------------------- | ---------- |
| 类型 | 说明 |
| [PlayingState](#PlayingState) | 远端设备的播放状态。 |
**示例:**
```js
A2dpSourceProfile a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE);
PlayingState state = a2dpSrc.getPlayingState('XX:XX:XX:XX:XX:XX');
let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE);
let state = a2dpSrc.getPlayingState('XX:XX:XX:XX:XX:XX');
```
......@@ -1424,22 +1420,22 @@ connect(device: string): boolean
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ------ | ---- | ------- |
| device | string | 是 | 远端设备地址。 |
|
**返回值:**
| | |
| -------- | -------- |
| ------- | ------------------- |
| 类型 | 说明 |
| boolean | 成功返回true,失败返回false。 |
**示例:**
```js
HandsFreeAudioGatewayProfile hfpAg = bluetooth.getProfile(PROFILE_HANDS_FREE_AUDIO_GATEWAY);
boolean ret = hfpAg.connect('XX:XX:XX:XX:XX:XX');
let hfpAg = bluetooth.getProfile(PROFILE_HANDS_FREE_AUDIO_GATEWAY);
let ret = hfpAg.connect('XX:XX:XX:XX:XX:XX');
```
......@@ -1447,7 +1443,7 @@ boolean ret = hfpAg.connect('XX:XX:XX:XX:XX:XX');
disconnect(device: string): boolean
连接设备的HFP服务。
断开连接设备的HFP服务。
**需要权限**:ohos.permission.DISCOVER_BLUETOOTH
......@@ -1456,22 +1452,21 @@ disconnect(device: string): boolean
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ------ | ---- | ------- |
| device | string | 是 | 远端设备地址。 |
|
**返回值:**
| | |
| -------- | -------- |
| 类型 | 说明 |
| ------- | ------------------- |
| boolean | 成功返回true,失败返回false。 |
**示例:**
```js
HandsFreeAudioGatewayProfile hfpAg = bluetooth.getProfile(PROFILE_HANDS_FREE_AUDIO_GATEWAY);
boolean ret = hfpAg.disconnect('XX:XX:XX:XX:XX:XX');
let hfpAg = bluetooth.getProfile(PROFILE_HANDS_FREE_AUDIO_GATEWAY);
let ret = hfpAg.disconnect('XX:XX:XX:XX:XX:XX');
```
......@@ -1486,7 +1481,7 @@ on(type: "connectionStateChange", callback: Callback&lt;[StateChangeParam](#Stat
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 |
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | 是 | 表示回调函数的入参。 |
......@@ -1515,7 +1510,7 @@ off(type: "connectionStateChange", callback: Callback&lt;[StateChangeParam](#Sta
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 |
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | 是 | 表示回调函数的入参。 |
......@@ -1551,7 +1546,7 @@ startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ----------- | ------------------------------------- | ---- | -------------- |
| setting | [AdvertiseSetting](#advertisesetting) | 是 | BLE广播的相关参数。 |
| advData | [AdvertiseData](#advertisedata) | 是 | BLE广播包内容。 |
| advResponse | [AdvertiseData](#advertisedata) | 否 | BLE回复扫描请求回复响应。 |
......@@ -1640,13 +1635,13 @@ server端添加服务。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------- | --------------------------- | ---- | ------------------------ |
| service | [GattService](#gattservice) | 是 | 服务端的service数据。BLE广播的相关参数 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | -------------------------- |
| boolean | 添加服务操作,成功返回true,否则返回false。 |
**示例:**
......@@ -1699,13 +1694,13 @@ removeService(serviceUuid: string): boolean
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ----------- | ------ | ---- | ---------------------------------------- |
| serviceUuid | string | 是 | service的UUID,例如“00001810-0000-1000-8000-00805F9B34FB”。 |
**返回值:**
| | |
| -------- | -------- |
| ------- | -------------------------- |
| 类型 | 说明 |
| boolean | 删除服务操作,成功返回true,否则返回false。 |
......@@ -1748,14 +1743,14 @@ server端特征值发生变化时,主动通知已连接的client设备。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------------------- | ---------------------------------------- | ---- | --------------------------------------- |
| deviceId | string | 是 | 接收通知的client端设备地址,例如“XX:XX:XX:XX:XX:XX”。 |
| notifyCharacteristic | [NotifyCharacteristic](#notifycharacteristic) | 是 | 通知的特征值数据。 |
**返回值:**
| | |
| -------- | -------- |
| ------- | ------------------------ |
| 类型 | 说明 |
| boolean | 通知操作,成功返回true,否则返回false。 |
......@@ -1782,13 +1777,13 @@ server端回复client端的读写请求。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------------- | --------------------------------- | ---- | --------------- |
| serverResponse | [ServerResponse](#serverresponse) | 是 | server端回复的响应数据。 |
**返回值:**
| | |
| -------- | -------- |
| ------- | -------------------------- |
| 类型 | 说明 |
| boolean | 回复响应操作,成功返回true,否则返回false。 |
......@@ -1830,7 +1825,7 @@ server端订阅特征值读请求事件。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ------------------------------------- |
| type | string | 是 | 填写"characteristicRead"字符串,表示特征值读请求事件。 |
| callback | Callback&lt;[CharacteristicReadReq](#characteristicreadreq)&gt; | 是 | 表示回调函数的入参,client端发送的读请求数据。 |
......@@ -1878,7 +1873,7 @@ server端取消订阅特征值读请求事件。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"characteristicRead"字符串,表示特征值读请求事件。 |
| callback | Callback&lt;[CharacteristicReadReq](#characteristicreadreq)&gt; | 否 | 表示取消订阅特征值读请求事件上报。不填该参数则取消订阅该type对应的所有回调。 |
......@@ -1907,7 +1902,7 @@ server端订阅特征值写请求事件。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | -------------------------------------- |
| type | string | 是 | 填写"characteristicWrite"字符串,表示特征值写请求事件。 |
| callback | Callback&lt;[DescriptorWriteReq](#descriptorwritereq)&gt; | 是 | 表示回调函数的入参,client端发送的写请求数据。 |
......@@ -1958,7 +1953,7 @@ server端取消订阅特征值写请求事件。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"characteristicWrite"字符串,表示特征值写请求事件。 |
| callback | Callback&lt;[CharacteristicWriteReq](#characteristicwritereq)&gt; | 否 | 表示取消订阅特征值写请求事件上报。不填该参数则取消订阅该type对应的所有回调。 |
......@@ -1987,7 +1982,7 @@ server端订阅描述符读请求事件。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | --------------------------------- |
| type | string | 是 | 填写"descriptorRead"字符串,表示描述符读请求事件。 |
| callback | Callback&lt;[DescriptorReadReq](#descriptorreadreq)&gt; | 是 | 表示回调函数的入参,client端发送的读请求数据。 |
......@@ -2035,7 +2030,7 @@ server端取消订阅描述符读请求事件。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"descriptorRead"字符串,表示描述符读请求事件。 |
| callback | Callback&lt;[DescriptorReadReq](#descriptorreadreq)&gt; | 否 | 表示取消订阅描述符读请求事件上报。不填该参数则取消订阅该type对应的所有回调。 |
......@@ -2064,7 +2059,7 @@ server端订阅描述符写请求事件。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------- |
| type | string | 是 | 填写"descriptorWrite"字符串,表示描述符写请求事件。 |
| callback | Callback&lt;[DescriptorWriteReq](#descriptorwritereq)&gt; | 是 | 表示回调函数的入参,client端发送的写请求数据。 |
......@@ -2115,9 +2110,9 @@ server端取消订阅描述符写请求事件。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"descriptorWrite"字符串,表示描述符写请求事件。 |
| callback | Callback&lt;[DescriptorWriteReq](#descriptorwritereq)&gt; | 否 | 表示取消订阅描述符读请求事件上报。不填该参数则取消订阅该type对应的所有回调。 |
| callback | Callback&lt;[DescriptorWriteReq](#descriptorwritereq)&gt; | 否 | 表示取消订阅描述符写请求事件上报。不填该参数则取消订阅该type对应的所有回调。 |
**返回值:**
......@@ -2144,7 +2139,7 @@ server端订阅BLE连接状态变化事件。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"connectStateChange"字符串,表示BLE连接状态变化事件。 |
| callback | Callback&lt;[BLEConnectChangedState](#bleconnectchangedstate)&gt; | 是 | 表示回调函数的入参,连接状态。 |
......@@ -2178,7 +2173,7 @@ server端取消订阅BLE连接状态变化事件。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"connectStateChange"字符串,表示BLE连接状态变化事件。 |
| callback | Callback&lt;[BLEConnectChangedState](#bleconnectchangedstate)&gt; | 否 | 表示取消订阅BLE连接状态变化事件。不填该参数则取消订阅该type对应的所有回调。 |
......@@ -2212,7 +2207,7 @@ client端发起连接远端蓝牙低功耗设备。
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | ------------------------- |
| boolean | 连接操作成功返回true,操作失败返回false。 |
**示例:**
......@@ -2236,8 +2231,8 @@ client端断开与远端蓝牙低功耗设备的连接。
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| boolean | 连接操作,成功返回true,操作失败返回false。 |
| ------- | ---------------------------- |
| boolean | 断开连接操作,成功返回true,操作失败返回false。 |
**示例:**
......@@ -2260,7 +2255,7 @@ close(): boolean
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | -------------------------- |
| boolean | 关闭操作,成功返回true,操作失败返回false。 |
**示例:**
......@@ -2286,7 +2281,7 @@ client端获取蓝牙低功耗设备的所有服务,即服务发现 。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ------------------------ |
| callback | AsyncCallback&lt;Array&lt;[GattService](#gattservice)&gt;&gt; | 是 | client进行服务发现,通过注册回调函数获取。 |
**返回值:**
......@@ -2330,7 +2325,7 @@ client端获取蓝牙低功耗设备的所有服务,即服务发现。
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ---------------------------------------- | --------------------------- |
| Promise&lt;Array&lt;[GattService](#gattservice)&gt;&gt; | client进行服务发现,通过promise形式获取。 |
**示例:**
......@@ -2361,7 +2356,7 @@ client端读取蓝牙低功耗设备特定服务的特征值。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------------- | ---------------------------------------- | ---- | ----------------------- |
| characteristic | [BLECharacteristic](#blecharacteristic) | 是 | 待读取的特征值。 |
| callback | AsyncCallback&lt;[BLECharacteristic](#blecharacteristic)&gt; | 是 | client读取特征值,通过注册回调函数获取。 |
......@@ -2415,13 +2410,13 @@ client端读取蓝牙低功耗设备特定服务的特征值。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------------- | --------------------------------------- | ---- | -------- |
| characteristic | [BLECharacteristic](#blecharacteristic) | 是 | 待读取的特征值。 |
**返回值:**
| | |
| -------- | -------- |
| ---------------------------------------- | -------------------------- |
| 类型 | 说明 |
| Promise&lt;[BLECharacteristic](#blecharacteristic)&gt; | client读取特征值,通过promise形式获取。 |
......@@ -2462,7 +2457,7 @@ client端读取蓝牙低功耗设备特定的特征包含的描述符。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ---------- | ---------------------------------------- | ---- | ----------------------- |
| descriptor | [BLEDescriptor](#bledescriptor) | 是 | 待读取的描述符。 |
| callback | AsyncCallback&lt;[BLECharacteristic](#blecharacteristic)&gt; | 是 | client读取描述符,通过注册回调函数获取。 |
......@@ -2506,13 +2501,13 @@ client端读取蓝牙低功耗设备特定的特征包含的描述符。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ---------- | ------------------------------- | ---- | -------- |
| descriptor | [BLEDescriptor](#bledescriptor) | 是 | 待读取的描述符。 |
**返回值:**
| | |
| -------- | -------- |
| ---------------------------------------- | -------------------------- |
| 类型 | 说明 |
| Promise&lt;[BLEDescriptor](#bledescriptor)&gt; | client读取描述符,通过promise形式获取。 |
......@@ -2543,13 +2538,13 @@ client端向低功耗蓝牙设备写入特定的特征值。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------------- | --------------------------------------- | ---- | ------------------- |
| characteristic | [BLECharacteristic](#blecharacteristic) | 是 | 蓝牙设备特征对应的二进制值及其它参数。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | --------------------------- |
| boolean | 写特征值操作成功返回true,操作失败返回false。 |
**示例:**
......@@ -2593,13 +2588,13 @@ client端向低功耗蓝牙设备特定的描述符写入二进制数据。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ---------- | ------------------------------- | ---- | ------------------ |
| descriptor | [BLEDescriptor](#bledescriptor) | 是 | 蓝牙设备描述符的二进制值及其它参数。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | --------------------------- |
| boolean | 写描述符操作成功返回true,操作失败返回false。 |
**示例:**
......@@ -2634,13 +2629,13 @@ client协商远端蓝牙低功耗设备的最大传输单元(Maximum Transmiss
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ---- | ------ | ---- | -------------- |
| mtu | number | 是 | 设置范围为22~512字节。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | ---------------------------- |
| boolean | MTU协商操作成功返回true,操作失败返回false。 |
**示例:**
......@@ -2664,14 +2659,14 @@ setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolea
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------------- | --------------------------------------- | ---- | ----------------------------- |
| characteristic | [BLECharacteristic](#blecharacteristic) | 是 | 蓝牙低功耗特征。 |
| enable | boolean | 是 | 启用接收notify设置为true,否则设置为false。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | ------------------------- |
| boolean | 设置操作成功返回true,操作失败返回false。 |
**示例:**
......@@ -2695,7 +2690,7 @@ on(type: "BLECharacteristicChange", callback: Callback&lt;BLECharacteristic&gt;)
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"BLECharacteristicChange"字符串,表示特征值变化事件。 |
| callback | Callback&lt;[BLECharacteristic](#blecharacteristic)&gt; | 是 | 表示蓝牙低功耗设备的特征值变化事件的回调函数。 |
......@@ -2729,7 +2724,7 @@ off(type: "BLECharacteristicChange", callback?: Callback&lt;BLECharacteristic&gt
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"BLECharacteristicChange"字符串,表示特征值变化事件。 |
| callback | Callback&lt;[BLECharacteristic](#blecharacteristic)&gt; | 否 | 表示取消订阅蓝牙低功耗设备的特征值变化事件。不填该参数则取消订阅该type对应的所有回调。 |
......@@ -2758,7 +2753,7 @@ client端订阅蓝牙低功耗设备的连接状态变化事件。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"BLEConnectionStateChange"字符串,表示连接状态变化事件。 |
| callback | Callback&lt;[BLEConnectChangedState](#bleconnectchangedstate)&gt; | 是 | 表示连接状态,已连接或断开。 |
......@@ -2791,7 +2786,7 @@ off(type: "BLEConnectionStateChange", callback?: Callback&lt;BLEConnectChangedSt
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | 是 | 填写"BLEConnectionStateChange"字符串,表示连接状态变化事件。 |
| callback | Callback&lt;[BLEConnectChangedState](#bleconnectchangedstate)&gt; | 否 | 表示取消订阅蓝牙低功耗设备的连接状态变化事件。不填该参数则取消订阅该type对应的所有回调。 |
......@@ -2820,7 +2815,7 @@ client获取远端蓝牙低功耗设备名。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | --------------------------- | ---- | ------------------------------- |
| callback | AsyncCallback&lt;string&gt; | 是 | client获取对端server设备名,通过注册回调函数获取。 |
**返回值:**
......@@ -2852,7 +2847,7 @@ client获取远端蓝牙低功耗设备名。
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| --------------------- | ---------------------------------- |
| Promise&lt;string&gt; | client获取对端server设备名,通过promise形式获取。 |
**示例:**
......@@ -2880,7 +2875,7 @@ client获取远端蓝牙低功耗设备的信号强度 (Received Signal Strength
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | --------------------------- | ---- | ------------------------------ |
| callback | AsyncCallback&lt;number&gt; | 是 | 返回信号强度,单位&nbsp;dBm,通过注册回调函数获取。 |
**返回值:**
......@@ -2913,7 +2908,7 @@ client获取远端蓝牙低功耗设备的信号强度 (Received Signal Strength
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| --------------------- | --------------------------------- |
| Promise&lt;number&gt; | 返回信号强度,单位&nbsp;dBm,通过promise形式获取。 |
**示例:**
......@@ -2933,7 +2928,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| ---------------------------------------- | ---- | --------------- |
| SCAN_MODE_NONE | 0 | 没有扫描模式。 |
| SCAN_MODE_CONNECTABLE | 1 | 可连接扫描模式。 |
| SCAN_MODE_GENERAL_DISCOVERABLE | 2 | general发现模式。 |
......@@ -2948,7 +2943,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| ------------------ | ---- | ------ |
| BOND_STATE_INVALID | 0 | 无效的配对。 |
| BOND_STATE_BONDING | 1 | 正在配对。 |
| BOND_STATE_BONDED | 2 | 已配对。 |
......@@ -2961,7 +2956,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| ------ | ------------------- | ---- | ---- | ----------- |
| uuid | string | 是 | 是 | spp单据的uuid。 |
| secure | boolean | 是 | 是 | 是否是安全通道。 |
| type | [SppType](#spptype) | 是 | 是 | Spp链路类型。 |
......@@ -2974,7 +2969,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| ---------- | ---- | ------------- |
| SPP_RFCOMM | 0 | 表示rfcomm链路类型。 |
......@@ -2985,7 +2980,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| --------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- |
| serviceUuid | string | 是 | 是 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 |
| isPrimary | boolean | 是 | 是 | 如果是主服务设置为true,否则设置为false。 |
| characteristics | Array&lt;[BLECharacteristic](#blecharacteristic)&gt; | 是 | 是 | 当前服务包含的特征列表。 |
......@@ -2999,7 +2994,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| ------------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- |
| serviceUuid | string | 是 | 是 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 |
| characteristicUuid | string | 是 | 是 | 特定特征(characteristic)的UUID,例如:00002a11-0000-1000-8000-00805f9b34fb。 |
| characteristicValue | ArrayBuffer | 是 | 是 | 特征对应的二进制值。 |
......@@ -3013,7 +3008,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| ------------------ | ----------- | ---- | ---- | ---------------------------------------- |
| serviceUuid | string | 是 | 是 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 |
| characteristicUuid | string | 是 | 是 | 特定特征(characteristic)的UUID,例如:00002a11-0000-1000-8000-00805f9b34fb。 |
| descriptorUuid | string | 是 | 是 | 描述符(descriptor)的UUID,例如:00002902-0000-1000-8000-00805f9b34fb。 |
......@@ -3027,7 +3022,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| ------------------- | ----------- | ---- | ---- | ---------------------------------------- |
| serviceUuid | string | 是 | 是 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 |
| characteristicUuid | string | 是 | 是 | 特定特征(characteristic)的UUID,例如:00002a11-0000-1000-8000-00805f9b34fb。 |
| characteristicValue | ArrayBuffer | 是 | 是 | 特征对应的二进制值。 |
......@@ -3041,7 +3036,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| ------------------ | ------ | ---- | ---- | ---------------------------------------- |
| deviceId | string | 是 | 否 | 表示发送特征值读请求的远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
| transId | number | 是 | 否 | 表示读请求的传输ID,server端回复响应时需填写相同的传输ID。 |
| offset | number | 是 | 否 | 表示读特征值数据的起始位置。例如:k表示从第k个字节开始读,server端回复响应时需填写相同的offset。 |
......@@ -3056,7 +3051,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| ------------------ | ------ | ---- | ---- | ---------------------------------------- |
| deviceId | string | 是 | 否 | 表示发送特征值写请求的远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
| transId | number | 是 | 否 | 表示写请求的传输ID,server端回复响应时需填写相同的传输ID。 |
| offset | number | 是 | 否 | 表示写特征值数据的起始位置。例如:k表示从第k个字节开始写,server端回复响应时需填写相同的offset。 |
......@@ -3072,7 +3067,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| ------------------ | ------ | ---- | ---- | ---------------------------------------- |
| deviceId | string | 是 | 否 | 表示发送描述符读请求的远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
| transId | number | 是 | 否 | 表示读请求的传输ID,server端回复响应时需填写相同的传输ID。 |
| offset | number | 是 | 否 | 表示读描述符数据的起始位置。例如:k表示从第k个字节开始读,server端回复响应时需填写相同的offset。 |
......@@ -3088,7 +3083,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| ------------------ | ----------- | ---- | ---- | ---------------------------------------- |
| deviceId | string | 是 | 否 | 表示发送描述符写请求的远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
| transId | number | 是 | 否 | 表示写请求的传输ID,server端回复响应时需填写相同的传输ID。 |
| offset | number | 是 | 否 | 表示写描述符数据的起始位置。例如:k表示从第k个字节开始写,server端回复响应时需填写相同的offset。 |
......@@ -3107,7 +3102,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| -------- | ----------- | ---- | ---- | -------------------------------------- |
| deviceId | string | 是 | 否 | 表示远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
| transId | number | 是 | 否 | 表示请求的传输ID,与订阅的读/写请求事件携带的ID保持一致。 |
| status | number | 是 | 否 | 表示响应的状态,设置为0即可,表示正常。 |
......@@ -3122,7 +3117,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---- | -------------------------------- |
| deviceId | string | 是 | 否 | 表示远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
| state | [ProfileConnectionState](#profileconnectionState) | 是 | 是 | 表示BLE连接状态的枚举。 |
......@@ -3134,7 +3129,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| ------------------- | ---- | -------------- |
| STATE_DISCONNECTED | 0 | 表示profile已断连。 |
| STATE_CONNECTING | 1 | 表示profile正在连接。 |
| STATE_CONNECTED | 2 | 表示profile已连接。 |
......@@ -3148,7 +3143,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| ----------- | ------ | ---- | ---- | ---------------------------------------- |
| deviceId | string | 是 | 是 | 表示过滤的BLE设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
| name | string | 是 | 是 | 表示过滤的BLE设备名。 |
| serviceUuid | string | 是 | 是 | 表示过滤包含该UUID服务的设备,例如:00001888-0000-1000-8000-00805f9b34fb。 |
......@@ -3161,7 +3156,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| --------- | ----------------------- | ---- | ---- | -------------------------------------- |
| interval | number | 是 | 是 | 表示扫描结果上报延迟时间,默认值为0。 |
| dutyMode | [ScanDuty](#scanduty) | 是 | 是 | 表示扫描模式,默认值为SCAN_MODE_LOW_POWER。 |
| matchMode | [MatchMode](#matchmode) | 是 | 是 | 表示硬件的过滤匹配模式,默认值为MATCH_MODE_AGGRESSIVE。 |
......@@ -3174,7 +3169,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| --------------------- | ---- | ------------ |
| SCAN_MODE_LOW_POWER | 0 | 表示低功耗模式,默认值。 |
| SCAN_MODE_BALANCED | 1 | 表示均衡模式。 |
| SCAN_MODE_LOW_LATENCY | 2 | 表示低延迟模式。 |
......@@ -3187,7 +3182,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| --------------------- | ---- | ---------------------------------------- |
| MATCH_MODE_AGGRESSIVE | 1 | 表示硬件上报扫描结果门限较低,比如扫描到的功率较低或者一段时间扫描到的次数较少也触发上报,默认值。 |
| MATCH_MODE_STICKY | 2 | 表示硬件上报扫描结果门限较高,更高的功率门限以及扫描到多次才会上报。 |
......@@ -3199,7 +3194,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| -------- | ----------- | ---- | ---- | ---------------------------------- |
| deviceId | string | 是 | 否 | 表示扫描到的设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
| rssi | number | 是 | 否 | 表示扫描到的设备的rssi值。 |
| data | ArrayBuffer | 是 | 否 | 表示扫描到的设备发送的广播包。 |
......@@ -3212,7 +3207,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| --------------------- | ---- | ------------------ |
| STATE_OFF | 0 | 表示蓝牙已关闭。 |
| STATE_TURNING_ON | 1 | 表示蓝牙正在打开。 |
| STATE_ON | 2 | 表示蓝牙已打开。 |
......@@ -3229,7 +3224,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| ----------- | ------- | ---- | ---- | ---------------------------------------- |
| interval | number | 是 | 是 | 表示广播间隔,最小值设置32个slot表示20ms,最大值设置16777215个slot,默认值设置为1600个slot表示1s。 |
| txPower | number | 是 | 是 | 表示发送功率,最小值设置-127,最大值设置1,默认值设置-7,单位dbm。 |
| connectable | boolean | 是 | 是 | 表示是否是可连接广播,默认值设置为true。 |
......@@ -3242,7 +3237,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| --------------- | ---------------------------------------- | ---- | ---- | --------------------------- |
| serviceUuids | Array&lt;string&gt; | 是 | 是 | 表示要广播的服务&nbsp;UUID&nbsp;列表。 |
| manufactureData | Array&lt;[ManufactureData](#manufacturedata)&gt; | 是 | 是 | 表示要广播的广播的制造商信息列表。 |
| serviceData | Array&lt;[ServiceData](#servicedata)&gt; | 是 | 是 | 表示要广播的服务数据列表。 |
......@@ -3255,7 +3250,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| ---------------- | ------------------- | ---- | ---- | ------------------ |
| manufactureId | Array&lt;string&gt; | 是 | 是 | 表示制造商的ID,由蓝牙SIG分配。 |
| manufactureValue | ArrayBuffer | 是 | 是 | 表示制造商发送的制造商数据。 |
......@@ -3267,7 +3262,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| ------------ | ----------- | ---- | ---- | ---------- |
| serviceUuid | string | 是 | 是 | 表示服务的UUID。 |
| serviceValue | ArrayBuffer | 是 | 是 | 表示服务数据。 |
......@@ -3279,7 +3274,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| -------- | ------ | ---- | ---- | ----------- |
| deviceId | string | 是 | 否 | 表示要配对的设备ID。 |
| pinCode | string | 是 | 否 | 表示要配对的密钥。 |
......@@ -3291,7 +3286,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ---- | ------------------- |
| deviceId | string | 是 | 否 | 表示蓝牙设备地址。 |
| state | [ProfileConnectionState](#ProfileConnectionState) | 是 | 否 | 表示蓝牙设备的profile连接状态。 |
......@@ -3303,7 +3298,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| --------------- | ----------------------------------- | ---- | ---- | ---------------- |
| majorClass | [MajorClass](#majorclass) | 是 | 否 | 表示蓝牙设备主要类别的枚举。 |
| majorMinorClass | [MajorMinorClass](#majorminorclass) | 是 | 否 | 表示主要次要蓝牙设备类别的枚举。 |
| classOfDevice | number | 是 | 否 | 表示设备类别。 |
......@@ -3317,7 +3312,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| ------------------- | ------ | ---------- |
| MAJOR_MISC | 0x0000 | 表示杂项设备。 |
| MAJOR_COMPUTER | 0x0100 | 表示计算机设备。 |
| MAJOR_PHONE | 0x0200 | 表示手机设备。 |
......@@ -3338,7 +3333,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| ---------------------------------------- | ------ | --------------- |
| COMPUTER_UNCATEGORIZED | 0x0100 | 表示未分类计算机设备。 |
| COMPUTER_DESKTOP | 0x0104 | 表示台式计算机设备。 |
| COMPUTER_SERVER | 0x0108 | 表示服务器设备。 |
......@@ -3360,7 +3355,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
| NETWORK_60_TO_67_UTILIZED | 0x0380 | 表示使用网络60到67设备。 |
| NETWORK_67_TO_83_UTILIZED | 0x03A0 | 表示使用网络67到83设备。 |
| NETWORK_83_TO_99_UTILIZED | 0x03C0 | 表示使用网络83到99设备。 |
| NETWORK_NO_SERVICE | 0x03E0 | 表示网络无服务设备。
| NETWORK_NO_SERVICE | 0x03E0 | 表示网络无服务设备。 |
| AUDIO_VIDEO_UNCATEGORIZED | 0x0400 | 表示未分类音频视频设备。 |
| AUDIO_VIDEO_WEARABLE_HEADSET | 0x0404 | 表示可穿戴式音频视频设备。 |
| AUDIO_VIDEO_HANDSFREE | 0x0408 | 表示免提音频视频设备。 |
......@@ -3371,7 +3366,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
| AUDIO_VIDEO_CAR_AUDIO | 0x0420 | 表示汽车音频视频设备。 |
| AUDIO_VIDEO_SET_TOP_BOX | 0x0424 | 表示机顶盒音频视频设备。 |
| AUDIO_VIDEO_HIFI_AUDIO | 0x0428 | 表示高保真音响设备。 |
| AUDIO_VIDEO_VCR| 0x042C | 表示录像机音频视频设备。 |
| AUDIO_VIDEO_VCR | 0x042C | 表示录像机音频视频设备。 |
| AUDIO_VIDEO_VIDEO_CAMERA | 0x0430 | 表示照相机音频视频设备。 |
| AUDIO_VIDEO_CAMCORDER | 0x0434 | 表示摄像机音频视频设备。 |
| AUDIO_VIDEO_VIDEO_MONITOR | 0x0438 | 表示监视器音频视频设备。 |
......@@ -3381,7 +3376,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
| PERIPHERAL_NON_KEYBOARD_NON_POINTING | 0x0500 | 表示非键盘非指向外围设备。 |
| PERIPHERAL_KEYBOARD | 0x0540 | 表示外设键盘设备。 |
| PERIPHERAL_POINTING_DEVICE | 0x0580 | 表示定点装置外围设备。 |
| PERIPHERAL_KEYBOARD_POINTING| 0x05C0 | 表示键盘指向外围设备。 |
| PERIPHERAL_KEYBOARD_POINTING | 0x05C0 | 表示键盘指向外围设备。 |
| PERIPHERAL_UNCATEGORIZED | 0x0500 | 表示未分类外围设备。 |
| PERIPHERAL_JOYSTICK | 0x0504 | 表示周边操纵杆设备。 |
| PERIPHERAL_GAMEPAD | 0x0508 | 表示周边游戏板设备。 |
......@@ -3404,7 +3399,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
| WEARABLE_HELMET | 0x0710 | 表示可穿戴头盔设备。 |
| WEARABLE_GLASSES | 0x0714 | 表示可穿戴眼镜设备。 |
| TOY_UNCATEGORIZED | 0x0800 | 表示未分类的玩具设备。 |
| TOY_ROBOT| 0x0804 | 表示玩具机器人设备。 |
| TOY_ROBOT | 0x0804 | 表示玩具机器人设备。 |
| TOY_VEHICLE | 0x0808 | 表示玩具车设备。 |
| TOY_DOLL_ACTION_FIGURE | 0x080C | 表示人形娃娃玩具设备。 |
| TOY_CONTROLLER | 0x0810 | 表示玩具控制器设备。 |
......@@ -3434,7 +3429,7 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| ----------------- | ------ | ------- |
| STATE_NOT_PLAYING | 0x0000 | 表示未播放。 |
| STATE_PLAYING | 0x0001 | 表示正在播放。 |
......@@ -3446,6 +3441,6 @@ let rssi = gattClient.getRssiValue().then((data) => {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| -------------------------------- | ------ | --------------- |
| PROFILE_A2DP_SOURCE | 0x0001 | 表示A2DP profile。 |
| PROFILE_HANDS_FREE_AUDIO_GATEWAY | 0x0004 | 表示HFP profile。 |
\ No newline at end of file
......@@ -5,12 +5,12 @@
## CommonEventData
**系统能力:**以下各项对应的系统能力均为SystemCapability.Notification.CommonEvent
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Notification.CommonEvent
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ---------- | -------- | -------------------- | ---- | ------------------------------------------------------- |
| event | 只读 | string | 是 | 表示当前接收的公共事件名称 |
| bundleName | 只读 | string | 否 | 表示包名称 |
| code | 只读 | number | 否 | 表示公共事件的结果代码,用于传递int类型的数据 |
| data | 只读 | string | 否 | 表示公共事件的自定义结果数据,用于传递string类型的数据< |
| parameters | 只读 | {[key: string]: any} | 否 | 表示公共事件的附加信息 |
\ No newline at end of file
| event | 只读 | string | 是 | 表示当前接收的公共事件名称。 |
| bundleName | 只读 | string | 否 | 表示包名称。 |
| code | 只读 | number | 否 | 表示公共事件的结果代码,用于传递int类型的数据。 |
| data | 只读 | string | 否 | 表示公共事件的自定义结果数据,用于传递string类型的数据。 |
| parameters | 只读 | {[key: string]: any} | 否 | 表示公共事件的附加信息。 |
\ No newline at end of file
......@@ -5,15 +5,15 @@
## CommonEventPublishData
**系统能力:**以下各项对应的系统能力均为SystemCapability.Notification.CommonEvent
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Notification.CommonEvent
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| --------------------- | -------- | -------------------- | ---- | ---------------------------- |
| bundleName | 只读 | string | 否 | 表示包名称 |
| code | 只读 | number | 否 | 表示公共事件的结果代码 |
| data | 只读 | string | 否 | 表示公共事件的自定义结果数据 |
| subscriberPermissions | 只读 | Array\<string> | 否 | 表示订阅者的权限 |
| isOrdered | 只读 | boolean | 否 | 表示是否是有序事件 |
| isSticky | 只读 | boolean | 否 | 表示是否是粘性事件 |
| parameters | 只读 | {[key: string]: any} | 否 | 表示公共事件的附加信息 |
| bundleName | 只读 | string | 否 | 表示包名称 |
| code | 只读 | number | 否 | 表示公共事件的结果代码 |
| data | 只读 | string | 否 | 表示公共事件的自定义结果数据 |
| subscriberPermissions | 只读 | Array\<string> | 否 | 表示订阅者的权限 |
| isOrdered | 只读 | boolean | 否 | 表示是否是有序事件 |
| isSticky | 只读 | boolean | 否 | 表示是否是粘性事件 |
| parameters | 只读 | {[key: string]: any} | 否 | 表示公共事件的附加信息 |
......@@ -5,12 +5,12 @@
## CommonEventSubscribeInfo
**系统能力:**以下各项对应的系统能力均为SystemCapability.Notification.CommonEvent
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Notification.CommonEvent
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ------------------- | -------- | -------------- | ---- | ------------------------------------------------------------ |
| events | 只读 | Array\<string> | 是 | 表示要发送的公共事件 |
| publisherPermission | 只读 | string | 否 | 表示发布者的权限 |
| publisherDeviceId | 只读 | string | 否 | 表示设备ID,该值必须是同一ohos网络上的现有设备ID |
| events | 只读 | Array\<string> | 是 | 表示要发送的公共事件 |
| publisherPermission | 只读 | string | 否 | 表示发布者的权限 |
| publisherDeviceId | 只读 | string | 否 | 表示设备ID,该值必须是同一ohos网络上的现有设备ID |
| userId | 只读 | number | 否 | 表示用户ID。此参数是可选的,默认值当前用户的ID。如果指定了此参数,则该值必须是系统中现有的用户ID。 |
| priority | 只读 | number | 否 | 表示订阅者的优先级。值的范围是-100到1000 |
\ No newline at end of file
| priority | 只读 | number | 否 | 表示订阅者的优先级。值的范围是-100到1000。 |
\ No newline at end of file
......@@ -17,7 +17,7 @@ getCode(callback: AsyncCallback\<number>): void
| 参数名 | 类型 | 必填 | 描述 |
| -------- | ---------------------- | ---- | ------------------ |
| callback | AsyncCallback\<number> | 是 | 公共事件的结果代码 |
| callback | AsyncCallback\<number> | 是 | 公共事件的结果代码 |
**示例:**
......@@ -104,7 +104,7 @@ setCode(code: number): Promise\<void>
| 参数名 | 类型 | 必填 | 描述 |
| ------ | ------ | ---- | ------------------ |
| code | number | 是 | 公共事件的结果代码 |
| code | number | 是 | 公共事件的结果代码 |
**示例:**
......@@ -160,7 +160,7 @@ getData(): Promise\<string>
| 类型 | 说明 |
| ---------------- | ------------------ |
| Promise\<string> | 公共事件的结果数据 |
| Promise\<string> | 公共事件的结果数据 |
**示例:**
......@@ -186,8 +186,8 @@ setData(data: string, callback: AsyncCallback\<void>): void
| 参数名 | 类型 | 必填 | 描述 |
| -------- | -------------------- | ---- | -------------------- |
| data | string | 是 | 公共事件的结果数据 |
| callback | AsyncCallback\<void> | 是 | 表示被指定的回调方法 |
| data | string | 是 | 公共事件的结果数据 |
| callback | AsyncCallback\<void> | 是 | 表示被指定的回调方法 |
**示例:**
......@@ -472,7 +472,7 @@ clearAbortCommonEvent(callback: AsyncCallback\<void>): void
| 参数名 | 类型 | 必填 | 描述 |
| -------- | -------------------- | ---- | -------------------- |
| callback | AsyncCallback\<void> | 是 | 表示被指定的回调方法 |
| callback | AsyncCallback\<void> | 是 | 表示被指定的回调方法 |
**示例:**
......@@ -522,7 +522,7 @@ getAbortCommonEvent(callback: AsyncCallback\<boolean>): void
| 参数名 | 类型 | 必填 | 描述 |
| -------- | ----------------------- | ---- | ---------------------------------- |
| callback | AsyncCallback\<boolean> | 是 | 表示当前有序公共事件是否取消的状态 |
| callback | AsyncCallback\<boolean> | 是 | 表示当前有序公共事件是否取消的状态 |
**示例:**
......@@ -552,7 +552,7 @@ getAbortCommonEvent(): Promise\<boolean>
| 类型 | 说明 |
| ----------------- | ---------------------------------- |
| Promise\<boolean> | 表示当前有序公共事件是否取消的状态 |
| Promise\<boolean> | 表示当前有序公共事件是否取消的状态 |
**示例:**
......
......@@ -49,7 +49,7 @@ insertFront(element: T): void
**示例:**
```
let deque = new Deque;
let deque = new Deque();
deque.insertFront("a");
deque.insertFront(1);
let b = [1, 2, 3];
......@@ -73,7 +73,7 @@ insertEnd(element: T): void
**示例:**
```
let deque = new Deque;
let deque = new Deque();
deque.insertEnd("a");
deque.insertEnd(1);
let b = [1, 2, 3];
......
......@@ -24,7 +24,7 @@ startAbility(parameter: StartAbilityParameter, callback: AsyncCallback\<number>)
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| --------- | --------------------- | ---- | ------------------- |
| --------- | ---------------------------------------- | ---- | -------------- |
| parameter | [StartAbilityParameter](#startabilityparameter) | 是 | 表示被启动的Ability。 |
| callback | AsyncCallback\<number> | 是 | 被指定的回调方法。 |
......@@ -63,7 +63,7 @@ startAbility(parameter: StartAbilityParameter): Promise\<number>
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| --------- | ----------------------------------------------- | ---- | --------------------- |
| --------- | ---------------------------------------- | ---- | -------------- |
| parameter | [StartAbilityParameter](#startabilityparameter) | 是 | 表示被启动的Ability。 |
**示例:**
......@@ -101,13 +101,13 @@ acquireDataAbilityHelper(uri: string): DataAbilityHelper
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ---- | ------ | ---- | ------------------------ |
| ---- | ------ | ---- | ------------ |
| uri | string | 是 | 指示要打开的文件的路径。 |
**返回值:**
| 类型 | 说明 |
| ----------------- | -------------------------------------------- |
| ----------------- | ------------------------------- |
| DataAbilityHelper | 用来协助其他Ability访问DataAbility的工具类。 |
**示例:**
......@@ -130,7 +130,7 @@ startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback\
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| --------- | ----------------------------------------------- | ---- | --------------------- |
| --------- | ---------------------------------------- | ---- | -------------- |
| parameter | [StartAbilityParameter](#startabilityparameter) | 是 | 表示被启动的Ability。 |
| callback | AsyncCallback\<[AbilityResult](#abilityresult)> | 是 | 被指定的回调方法。 |
......@@ -167,13 +167,13 @@ startAbilityForResult(parameter: StartAbilityParameter): Promise\<AbilityResult>
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| --------- | ----------------------------------------------- | ---- | ------------------- |
| --------- | ---------------------------------------- | ---- | ------------- |
| parameter | [StartAbilityParameter](#startabilityparameter) | 是 | 表示被启动的Ability |
**返回值:**
| 类型 | 说明 |
| ----------------------------------------- | -------------- |
| ---------------------------------------- | ------- |
| Promise\<[AbilityResult](#abilityresult)> | 返回执行结果。 |
**示例:**
......@@ -223,7 +223,7 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback\<void>
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| --------- | ------------- | ---- | ------------------- |
| --------- | ------------------------------- | ---- | -------------- |
| parameter | [AbilityResult](#abilityresult) | 是 | 表示被启动的Ability。 |
| callback | AsyncCallback\<void> | 是 | 被指定的回调方法。 |
......@@ -271,13 +271,13 @@ terminateSelfWithResult(parameter: AbilityResult): Promise\<void>
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| --------- | ------------------------------- | ---- | ------------------- |
| --------- | ------------------------------- | ---- | ------------- |
| parameter | [AbilityResult](#abilityresult) | 是 | 表示被启动的Ability |
**返回值:**
| 类型 | 说明 |
| -------------- | ----------------------- |
| -------------- | --------------- |
| Promise\<void> | 以Promise形式返回结果。 |
**示例:**
......@@ -328,7 +328,7 @@ hasWindowFocus(callback: AsyncCallback\<boolean>): void
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| -------- | ----------------------- | ---- | ------------------------------------------------------------ |
| -------- | ----------------------- | ---- | ---------------------------------------- |
| callback | AsyncCallback\<boolean> | 是 | 被指定的回调方法。<br>如果此Ability当前具有视窗焦点,则返回true;否则返回false。 |
**示例:**
......@@ -351,7 +351,7 @@ hasWindowFocus(): Promise\<boolean>
**返回值:**
| 类型 | 说明 |
| ----------------- | ---------------------------------------------------------- |
| ----------------- | ------------------------------------- |
| Promise\<boolean> | 如果此Ability当前具有视窗焦点,则返回true;否则返回false。 |
**示例:**
......@@ -376,7 +376,7 @@ getWant(callback: AsyncCallback\<Want>): void
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| -------- | ----------------------------- | ---- | ------------------ |
| -------- | ----------------------------- | ---- | --------- |
| callback | AsyncCallback\<[Want](#want)> | 是 | 被指定的回调方法。 |
**示例:**
......@@ -399,7 +399,7 @@ getWant(): Promise\<Want>
**返回值:**
| 类型 | 说明 |
| ----------------------- | ------------------------- |
| ----------------------- | ---------------- |
| Promise\<[Want](#want)> | 以Promise的形式返回结果。 |
**示例:**
......@@ -422,7 +422,7 @@ getContext(): Context
**返回值:**
| 类型 | 说明 |
| ------- | -------------------- |
| ------- | ---------- |
| Context | 返回应用程序上下文。 |
**示例:**
......@@ -446,7 +446,7 @@ terminateSelf(callback: AsyncCallback\<void>): void
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| -------- | -------------------- | ---- | ---------------- |
| -------- | -------------------- | ---- | -------- |
| callback | AsyncCallback\<void> | 是 | 被指定的回调方法 |
**示例:**
......@@ -469,7 +469,7 @@ terminateSelf(): Promise\<void>
**返回值:**
| 类型 | 说明 |
| -------------- | ------------------------- |
| -------------- | ---------------- |
| Promise\<void> | 以Promise的形式返回结果。 |
**示例:**
......@@ -491,7 +491,7 @@ connectAbility(request: Want, options:ConnectOptions): number
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ------- | -------------- | ---- | ---------------------------- |
| ------- | -------------- | ---- | --------------------- |
| request | [Want](#want) | 是 | 表示被连接的ServiceAbility。 |
| options | ConnectOptions | 是 | 被指定的回调方法。 |
......@@ -500,7 +500,7 @@ connectAbility(request: Want, options:ConnectOptions): number
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityBase
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ------------ | -------- | -------- | ---- | ---------------------------------- |
| ----------- | ---- | ------ | ---- | ---------------------------------------- |
| deviceId | 只读 | string | 否 | 表示被连接的ServiceAbility的设备id,缺省表示连接本地的ServiceAbility。 |
| bundleName | 只读 | string | 是 | 表示被连接的ServiceAbility的包名。 |
| abilityName | 只读 | string | 是 | 表示被连接的ServiceAbility的类名。 |
......@@ -510,7 +510,7 @@ connectAbility(request: Want, options:ConnectOptions): number
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ------------ | -------- | -------- | ---- | ---------------------------------- |
| ------------ | ---- | -------- | ---- | ------------------------- |
| onConnect | 只读 | function | 是 | 连接成功时的回调函数。 |
| onDisconnect | 只读 | function | 是 | 连接失败时的回调函数。 |
| onFailed | 只读 | function | 是 | ConnectAbility调用失败时的回调函数。 |
......@@ -518,7 +518,7 @@ connectAbility(request: Want, options:ConnectOptions): number
**返回值:**
| 类型 | 说明 |
| ------ | ------------------------ |
| ------ | -------------------- |
| number | 连接的ServiceAbilityID。 |
**示例:**
......@@ -560,7 +560,7 @@ disconnectAbility(connection: number, callback:AsyncCallback\<void>): void
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ---------- | ------------- | ---- | ------------------------------ |
| ---------- | -------------------- | ---- | ----------------------- |
| connection | number | 是 | 指定断开连接的ServiceAbilityID |
| callback | AsyncCallback\<void> | 是 | 被指定的回调方法 |
......@@ -607,13 +607,13 @@ disconnectAbility(connection: number): Promise\<void>
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| ---------- | ------ | ---- | ------------------------------ |
| ---------- | ------ | ---- | ----------------------- |
| connection | number | 是 | 指定断开连接的ServiceAbilityID |
**返回值:**
| 类型 | 说明 |
| -------------- | ----------------------- |
| -------------- | --------------- |
| Promise\<void> | 以Promise形式返回结果。 |
**示例:**
......@@ -659,15 +659,17 @@ getWindow(callback: AsyncCallback\<window.Window>): void
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| -------- | ----------------------- | ---- | ------------------------------------------------------------ |
| -------- | ----------------------------- | ---- | ------------- |
| callback | AsyncCallback\<window.Window> | 是 | 返回与当前能力对应的窗口。 |
**示例:**
```javascript
GetWindow(){
<<<<<<< HEAD
featureAbility.getWindow()
=======
featureAbility.getWindow()
}
>>>>>>> 45a0d5bbd5a373948e44b76b9e7eeb3239fe94e7
```
## featureAbility.getWindow<sup>7+</sup>
......@@ -681,17 +683,21 @@ getWindow(): Promise\<window.Window>;
**返回值:**
| 类型 | 说明 |
| ----------------- | ---------------------------------------------------------- |
| ----------------------- | ------------- |
| Promise\<window.Window> | 返回与当前能力对应的窗口。 |
**示例:**
```javascript
GetWindowPromise(){
<<<<<<< HEAD
featureAbility.getWindow().then((data) => {
console.info("=============getWindowPromise========== " + JSON.stringify(data));
});
=======
featureAbility.getWindow().then((data) => {
console.info("=============getWindowPromise========== " + JSON.stringify(data));
});
}
>>>>>>> 45a0d5bbd5a373948e44b76b9e7eeb3239fe94e7
```
## ConnectOptions.onConnect<sup>7+</sup>
......@@ -705,7 +711,7 @@ onConnect(elementName: ElementName, remote: rpc.IRemoteObject): void;
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| -------- | ----------------------- | ---- | ------------------------------------------------------------ |
| ----------- | ----------------- | ---- | -------- |
| elementName | ElementName | 是 | 元素名。 |
| remote | rpc.IRemoteObject | 是 | rpc远程对象。 |
......@@ -748,7 +754,7 @@ onDisconnect(elementName: ElementName): void;
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| -------- | ----------------------- | ---- | ------------------------------------------------------------ |
| ----------- | ----------- | ---- | ---- |
| elementName | ElementName | 是 | 元素名。 |
**示例:**
......@@ -790,7 +796,7 @@ ConnectAbility调用失败时的回调函数。
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| -------- | ----------------------- | ---- | ------------------------------------------------------------ |
| ---- | ------ | ---- | --------- |
| code | number | 是 | number类型。 |
**示例:**
......@@ -836,7 +842,7 @@ featureAbility.AbilityWindowConfiguration.WINDOW_MODE_UNDEFINED
```
| 名称 | 参数 | 描述 |
| --------------------------- | ---- | ---------- |
| ---------------------------------------- | ---- | ---------------------------------------- |
| WINDOW_MODE_UNDEFINED<sup>7+</sup> | 0 | 未定义。<br/>**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel |
| WINDOW_MODE_FULLSCREEN<sup>7+</sup> | 1 | 全屏。<br/>**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel |
| WINDOW_MODE_SPLIT_PRIMARY<sup>7+</sup> | 100 | 分屏主屏。<br/>**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel |
......@@ -857,7 +863,7 @@ featureAbility.AbilityStartSetting.BOUNDS_KEY
```
| 名称 | 参数 | 描述 |
| --------------- | --------------- | -------------------------- |
| ---------------------------- | --------------- | ---------------------------------------- |
| BOUNDS_KEY<sup>7+</sup> | "abilityBounds" | 窗口显示大小属性的名称。<br/>**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel |
| WINDOW_MODE_KEY<sup>7+</sup> | "windowMode" | 窗口显示模式属性的名称。<br/>**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel |
| DISPLAY_ID_KEY<sup>7+</sup> | "displayId" | 窗口显示设备ID属性的名称。<br/>**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel |
......@@ -867,7 +873,7 @@ featureAbility.AbilityStartSetting.BOUNDS_KEY
获取错误代码。
| 变量 | 值 | 说明 |
| ----------------------------- | ---- | ------------------------------------------------------------ |
| ------------------------------ | ---- | ---------------------------------------- |
| NO_ERROR<sup>7+</sup> | 0 | 没有错误。<br/>**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel |
| INVALID_PARAMETER<sup>7+</sup> | -1 | 无效的参数。<br/>**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel |
| ABILITY_NOT_FOUND<sup>7+</sup> | -2 | 找不到能力。<br/>**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel |
......@@ -879,7 +885,7 @@ featureAbility.AbilityStartSetting.BOUNDS_KEY
指示数据的操作类型。
| 变量 | 值 | 说明 |
| ----------------------------- | ---- | ------------------------------------------------------------ |
| ------------------------ | ---- | ---------------------------------------- |
| TYPE_INSERT<sup>7+</sup> | 1 | 插入类型。<br/>**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel |
| TYPE_UPDATE<sup>7+</sup> | 2 | 修改类型。<br/>**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel |
| TYPE_DELETE<sup>7+</sup> | 3 | 删除类型。<br/>**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel |
......@@ -892,7 +898,7 @@ featureAbility.AbilityStartSetting.BOUNDS_KEY
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityBase
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ---------- | -------- | --------------------- | ---- | ------------------------------------------------------------ |
| ----------------------- | ---- | ------------- | ---- | ------------------------------------- |
| resultCode<sup>7+</sup> | 只读 | number | 是 | 指示销毁该能力后返回的结果代码。您可以定义结果代码来识别错误(暂不支持)。 |
| want<sup>7+</sup> | 只读 | [Want](#want) | 否 | 指示销毁该能力后返回的数据。您可以定义返回的数据。此参数可以为null。 |
......@@ -901,7 +907,7 @@ featureAbility.AbilityStartSetting.BOUNDS_KEY
**系统能力**:以下各项对应的系统能力均为SystemCapability.AbilityRuntime.FAModel
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ------------------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
| ------------------- | ---- | -------------------- | ---- | -------------------------------------- |
| want | 只读 | [Want](#want) | 是 | 表示需要包含有关目标启动能力的信息。 |
| abilityStartSetting | 只读 | {[key: string]: any} | 否 | 表示能力的特殊属性,当开发者启动能力时,该属性可以作为调用中的输入参数传递。 |
......@@ -911,7 +917,7 @@ featureAbility.AbilityStartSetting.BOUNDS_KEY
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityBase
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
| -------------------------------- | ---- | -------------------- | ---- | ---------------------------------------- |
| deviceId | 只读 | string | 否 | 表示运行指定Ability的设备ID。 |
| bundleName | 只读 | string | 否 | 表示包描述。如果在Want中同时指定了BundleName和AbilityName,则Want可以直接匹配到指定的Ability。 |
| abilityName | 只读 | string | 否 | 表示待启动的Ability名称。如果在Want中同时指定了BundleName和AbilityName,则Want可以直接匹配到指定的Ability。 |
......@@ -929,7 +935,7 @@ featureAbility.AbilityStartSetting.BOUNDS_KEY
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityBase
| 名称 | 参数 | 描述 |
| ------------------------------------ | ---------- | ------------------------------------------------------------ |
| ------------------------------------ | ---------- | ---------------------------------------- |
| FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | 指示对URI执行读取操作的授权。 |
| FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | 指示对URI执行写入操作的授权。 |
| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | 将结果返回给元能力。 |
......
......@@ -42,16 +42,12 @@ createFormBindingData(obj?: Object | string): FormBindingData
let formBindingDataObj = formBindingData.createFormBindingData(obj);
```
## formBindingData.FormBindingData
data: Object
## 属性
FormBindingData相关描述。
**系统能力**:SystemCapability.Ability.Form
| 名称 | 可读 | 可写 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | -------- | -------- |
| data | 是 | 否 | Object | 是 | js卡片要展示的数据。可以是包含若干键值对的Object或者 json 格式的字符串。<br/>**系统能力**:SystemCapability.Ability.Form |
**参数:**
\ No newline at end of file
| 名称 | 类型 | 说明 |
| ---- | -------------- | ------------------------------------------------------------ |
| data | Object或string | js卡片要展示的数据。可以是包含若干键值对的Object或者 json 格式的字符串。 |
\ No newline at end of file
......@@ -27,23 +27,25 @@ getDeviceIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): void
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | ----- |
| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | 是 | 回调函数。 |
**示例:**
```
data: {
export default {
data: {
deviceIds: Array,
},
callback: function(ids) {
},
callback: function(ids) {
this.deviceIds = ids;
},
testGetDeviceIds: function () {
},
testGetDeviceIds: function () {
console.info("InputDeviceJsTest---start---testGetDeviceIds");
inputDevice.getDeviceIds(this.callback);
console.info("InputDeviceJsTest---end---testGetDeviceIds");
}
}
```
......@@ -58,13 +60,14 @@ function getDeviceIds(): Promise<Array<number>>
**返回值:**
| 参数 | 说明 |
| -------- | -------- |
| ---------------------- | ------------------ |
| Promise<Array<number>> | Promise实例,用于异步获取结果 |
**示例:**
```
testGetDeviceIds: function () {
export default {
testGetDeviceIds: function () {
console.info("InputDeviceJsTest---start---testGetDeviceIds");
let promise = inputDevice.getDeviceIds();
promise.then((data)=> {
......@@ -72,6 +75,7 @@ testGetDeviceIds: function () {
}).catch((err)=>{
console.error('Failed GetDeviceIds. Cause: ' + JSON.stringify(err));
});
}
}
```
......@@ -90,27 +94,29 @@ getDevice(deviceId: number, callback: AsyncCallback&lt;InputDeviceData&gt;): voi
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | ---------------------------------------- | ---- | --------------------------- |
| deviceId | number | 是 | 需要获取信息的设备id。 |
| callback | AsyncCallback&lt;[InputDeviceData](#inputdevicedata)&gt; | 是 | 回调函数,异步返回InputDeviceData对象。 |
**示例:**
```
InputDeviceData {
export default {
InputDeviceData {
deviceId : 0,
name : "NA",
sources : Array,
axisRanges : Array,
},
callback: function(deviceData) {
},
callback: function(deviceData) {
this.InputDeviceData = deviceData;
},
testGetDevice: function () {
},
testGetDevice: function () {
// 示例获取设备id为1的设备信息。
console.info("InputDeviceJsTest---start---testGetDevice");
inputDevice.getDevice(1, this.callback);
console.info("InputDeviceJsTest---end---testGetDevice");
}
}
```
......@@ -125,19 +131,20 @@ function getDevice(deviceId: number): Promise<InputDeviceData>
**返回值:**
| 参数 | 说明 |
| -------- | -------- |
| ------------------------ | ------------------ |
| Promise<InputDeviceData> | Promise实例,用于异步获取结果 |
**示例:**
```
InputDeviceData {
export default {
InputDeviceData {
deviceId : 0,
name : "NA",
sources : Array,
axisRanges : Array,
},
testGetDevice: function () {
},
testGetDevice: function () {
// 示例获取设备id为1的设备信息。
console.info("InputDeviceJsTest---start---testGetDevice");
let promise = inputDevice.getDevice(1);
......@@ -146,6 +153,7 @@ testGetDevice: function () {
}).catch((err)=>{
console.error('Failed GetDeviceId. Cause: ' + JSON.stringify(err));
});
}
}
```
......@@ -158,7 +166,7 @@ testGetDevice: function () {
**系统能力:** 以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| -------- | -------- | -------- |
| ------- | -------------------------------------- | ---------------------------------------- |
| id | number | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 |
| name | string | 输入设备的名字。 |
| sources | Array&lt;[SourceType](#sourcetype)&gt; | 输入设备支持的源类型。比如有的键盘上附带触摸板,则此设备有keyboard和touchpad两种输入源。 |
......@@ -174,7 +182,7 @@ testGetDevice: function () {
**系统能力:** 以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| ------ | ------------------------- | ---------------- |
| ------ | ------------------------- | -------- |
| source | [SourceType](#sourcetype) | 轴的输入源类型。 |
| axis | [AxisType](axistype) | 轴的类型 |
| max | number | 轴上报的最大值 |
......@@ -189,7 +197,7 @@ testGetDevice: function () {
**系统能力:** 以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| -------- | -------- | -------- |
| ----------- | ------ | ----------- |
| keyboard | string | 表示输入设备是键盘。 |
| touchscreen | string | 表示输入设备是触摸屏。 |
| mouse | string | 表示输入设备是鼠标。 |
......
......@@ -31,15 +31,16 @@ on(type: "touch", receiver: TouchEventReceiver): void
**系统能力:**SystemCapability.MultimodalInput.Input.InputMonitor
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| 参数 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | -------------------- |
| type | string | 是 | 监听输入事件类型,只支持“touch”。 |
| receiver | [TouchEventReceiver](#toucheventreceiver) | 是 | 触摸输入事件回调函数。 |
**示例:**
```
callback: function (value) {
export default {
callback: function (value) {
if (checkEvent(value)) {
//事件满足业务要求,事件被消费
return true;
......@@ -47,14 +48,15 @@ callback: function (value) {
//事件不满足业务要求,事件未被消费
return false;
}
},
testOn: function () {
},
testOn: function () {
console.info("InputMonitorJsTest---start---testOn");
inputMonitor.on(
"touch",
this.callback
);
console.info("InputMonitorJsTest---end---testOn");
}
}
```
......@@ -70,15 +72,16 @@ off(type: "touch", receiver: TouchEventReceiver): void
**系统能力:**SystemCapability.MultimodalInput.Input.InputMonitor
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| 参数 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | -------------------- |
| type | string | 是 | 监听输入事件类型,只支持“touch”。 |
| receiver | [TouchEventReceiver](#toucheventreceiver) | 否 | 触摸输入事件回调函数。 |
**示例:**
```
callback: function (value) {
export default {
callback: function (value) {
if (checkEvent(value)) {
//事件满足业务要求,事件被消费
return true;
......@@ -86,15 +89,16 @@ callback: function (value) {
//事件不满足业务要求,事件未被消费
return false;
}
},
testOff: function () {
},
testOff: function () {
console.info("InputMonitorJsTest---start---testOff");
inputMonitor.off(
"touch",
this.callback
);
console.info("InputMonitorJsTest---end---testOff");
}
}
}
```
......@@ -111,18 +115,19 @@ testOff: function () {
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ---------- | ---------------------------------------- | ---- | ---------------------------------------- |
| touchEvent | [TouchEvent](../arkui-js/js-components-common-events.md) | 是 | 触摸输入事件回调函数,返回true表示输触事件被监听器消费,false表示输触事件未被监听器消费。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| 类型 | 说明 |
| ------- | -------------------------------------- |
| Boolean | 返回true表示输触事件被监听器消费,false表示输触事件未被监听器消费。 |
**示例:**
```
callback: function (value) { //此处为(touchEvent:TouchEvent): Boolean 方法的实现
export default {
callback: function (value) { //此处为(touchEvent:TouchEvent): Boolean 方法的实现
if (checkEvent(value)) {
//事件满足业务要求,事件被消费
return true;
......@@ -130,13 +135,14 @@ callback: function (value) { //此处为(touchEvent:TouchEvent): Boolean 方法
//事件不满足业务要求,事件未被消费
return false;
}
},
testOff: function () {
},
testOff: function () {
console.info("InputMonitorJsTest---start---testOff");
inputMonitor.off(
"touch",
this.callback
);
console.info("InputMonitorJsTest---end---testOff");
}
}
```
......@@ -404,11 +404,10 @@ let result = linkedList.removeLastFound(4);
```
### clone
clone(): LinkedList&lt;T&gt;
克隆一个与LinkedList相同的实例,并返回克隆后的实例。
clone(): LinkedList&lt;T&gt;
修改克隆后的实例并不会影响原实例。
克隆一个与LinkedList相同的实例,并返回克隆后的实例。修改克隆后的实例并不会影响原实例。
**返回值:**
......@@ -428,6 +427,7 @@ let result = linkedList.clone();
```
### forEach
forEach(callbackfn: (value: T, index?: number, LinkedList?: LinkedList&lt;T&gt;) => void,
thisArg?: Object): void
......@@ -462,6 +462,7 @@ linkedList.forEach((value, index) => {
```
### clear
clear(): void
清除LinkedList中的所有元素,并把length置为0。
......@@ -478,6 +479,7 @@ linkedList.clear();
```
### set
set(index: number, element: T): T
将此LinkedList中指定位置的元素替换为指定元素。
......
......@@ -60,7 +60,7 @@ add(element: T): boolean
**示例:**
```
let list = new List;
let list = new List();
let result = list.add("a");
let result1 = list.add(1);
let b = [1, 2, 3];
......
......@@ -186,7 +186,7 @@ Notification.cancel(0, "label", cancelCallback)
## Notification.cancel
cancel(id:number, label? :string): Promise\<void\>
cancel(id:number, label?:string): Promise\<void\>
取消与指定id相匹配的已发布通知,label可以指定也可以不指定(Promise形式)。
......@@ -2562,7 +2562,7 @@ Notification.getDeviceRemindType()
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
| ----- | ---- | --- | ------ | ---- | -------- |
| id | 是 | 是 | number | 是 | 通知ID。 |
| label | 是 | 是 | string | 否 | 通知标签。< |
| label | 是 | 是 | string | 否 | 通知标签。 |
## SlotType
......
......@@ -13,7 +13,7 @@
| -------------- | --- | --------------------------------- |
| TYPE_NONE | 0 | 默认标志。 |
| TYPE_OPEN | 1 | 通知标志打开。 |
| TYPE_CLOSE | 2 | 通知标志打开。 |
| TYPE_CLOSE | 2 | 通知标志关闭。 |
## NotificationFlags
......
......@@ -101,7 +101,7 @@ onUpdate?:(data: [NotificationSortingMap](#notificationsortingmap))
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | ------------------------ | ---- | -------------------------- |
| data | [NotificationSortingMap](#notificationsortingmap) | 是 | |
| data | [NotificationSortingMap](#notificationsortingmap) | 是 | 回调返回接收到的通知信息。 |
**示例:**
......
......@@ -483,7 +483,7 @@ removeOsAccount(localId: number): Promise&lt;void&gt;
setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enable: boolean,callback: AsyncCallback&lt;void&gt;): void
为指定系统帐号设置/删除约束返回结果。
为指定系统帐号设置/删除约束,使用callback回调异步返回结果。
此接口为系统接口,三方应用不支持调用。
......@@ -514,7 +514,7 @@ setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enabl
setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enable: boolean): Promise&lt;void&gt;
为指定系统帐号设置/删除约束回结果。
为指定系统帐号设置/删除约束,使用Promise方式异步返回结果。
此接口为系统接口,三方应用不支持调用。
......
......@@ -58,7 +58,7 @@ particleAbility.startAbility(
## particleAbility.startAbility
startAbility(parameter: StartAbilityParameter): Promise<void>;
startAbility(parameter: StartAbilityParameter): Promise\<void>;
使用此方法启动指定的particleAbility(Promise形式)。
......
......@@ -1301,7 +1301,7 @@ sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback);
## sensor.off(SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED)
off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback?: Callback&lt;GyroscopeResponse&gt;): void
off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback?: Callback&lt;GyroscopeUncalibratedResponse&gt;): void
取消订阅传感器数据。
......@@ -1909,7 +1909,7 @@ getGeomagneticDip(inclinationMatrix: Array&lt;number&gt;): Promise&lt;number&gt;
## sensor. getAngleModify
getAngleModify(currentRotationMatrix: Array&lt;number&gt;, preRotationMatrix: Array&lt;number&gt;callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): void
getAngleModify(currentRotationMatrix: Array&lt;number&gt;, preRotationMatrix: Array&lt;number&gt;, callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): void
获取两个旋转矩阵之间的角度变化。
......
......@@ -16,21 +16,17 @@ import app from '@system.app';
## app.getInfo
getInfo(): &lt;AppResponse&gt;
getInfo(): AppResponse
获取当前应用配置文件中声明的信息。
**系统能力:** SystemCapability.ArkUI.ArkUI.Lite
**返回值:**
**表1** AppResponse
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| appID<sup>6+</sup> | string | 表示应用的包名,用于标识应用的唯一性。 |
| appName | string | 表示应用的名称。 |
| versionName | string | 表示应用的版本名称。 |
| versionCode | number | 表示应用的版本号。 |
| 参数类型 | 说明 |
| -------- | -------- |
| [AppResponse](#appresponse) | 定义AppResponse信息。 |
**示例:**
......@@ -43,41 +39,6 @@ getInfo(): &lt;AppResponse&gt;
}
```
## app.screenOnVisible
screenOnVisible(Object): void
应用申请息屏不返回主表盘,再次亮屏依旧显示应用界面。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| visible | boolean | 否 | 是否启动保活,默认值false。 |
| success | Function | 否 | 接口调用成功的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
**示例:**
```
export default {
screenOnVisible(){
app.screenOnVisible({
visible: true,
success() {
console.log('call app.keepVisible success');
},
fail(data, code) {
console.log('call app.keepVisible fail');
},
});
}
}
```
## app.terminate
terminate(): void
......@@ -94,10 +55,9 @@ terminate(): void
app.terminate();
}}
```
## app.requestFullWindow
requestFullWindow(duration: number): void
requestFullWindow(options?: RequestFullWindowOptions): void
请求应用以全窗口运行,FA在某些场景下(如半模态FA)会以非全窗口运行,调用该接口会从非全窗口切换为全窗口运行,如果已经以全窗口运行则该接口调用无效。
......@@ -108,7 +68,7 @@ requestFullWindow(duration: number): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| duration | number | 否 | 请求全屏时,设定非全屏到全屏的过渡时间,单位为毫秒,默认时间与非全屏到全屏的距离成正比。 |
| options | [RequestFullWindowOptions](#requestfullwindowoptions) | 否 | 请求全屏时,设定非全屏到全屏的过渡时间,单位为毫秒,默认时间与非全屏到全屏的距离成正比。 |
**示例:**
......@@ -120,3 +80,80 @@ requestFullWindow(duration: number): void
}
}
```
## app.setImageCacheCount
setImageCacheCount(value: number): void
设置解码图像计数的图像缓存容量。如果未设置,应用程序将不会缓存任何解码图像。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| value | number | 否 | 解码图像计数的值容量。 |
## app.setImageRawDataCacheSize
setImageRawDataCacheSize(value: number): void
在解码前设置原始图像数据大小的图像缓存容量(以字节为单位)。如果未设置,应用程序将不会缓存任何原始图像数据。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| value | number | 否 | 原始图像数据大小的值容量(以字节为单位)。 |
## app.setImageFileCacheSize
setImageFileCacheSize(value: number): void
在解码前设置磁盘上的图像文件缓存大小(以字节为单位)。如果未设置,应用程序将在磁盘上缓存100MB图像文件。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| value | number | 否 | 原始图像数据大小的值容量(以字节为单位)。 |
## AppResponse
定义AppResponse信息。
**系统能力:** 以下各项对应的系统能力有所不同,详见下表。
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- |-------- |
| appID<sup>6+</sup> | string | 是 | 表示应用的包名,用于标识应用的唯一性。 <br> **系统能力:** SystemCapability.ArkUI.ArkUI.Full|
| appName | string | 是 | 表示应用的名称。 <br> **系统能力:** SystemCapability.ArkUI.ArkUI.Lite|
| versionName | string | 是 | 表示应用的版本名称。 <br> **系统能力:** SystemCapability.ArkUI.ArkUI.Lite|
| versionCode | number | 是 | 表示应用的版本号。 <br> **系统能力:** SystemCapability.ArkUI.ArkUI.Lite|
## ScreenOnVisibleOptions
定义屏幕上可见接口的选项。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| visible | boolean | 否 | 是否启动保活,默认值false。 |
| success | () => void | 否 | 接口调用成功的回调函数。 |
| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数。 |
| complete | () => void | 否 | 接口调用结束的回调函数。 |
## RequestFullWindowOptions
定义RequestFullWindow接口的选项。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| duration | number | 是 | 定义动画选项的数量。 |
......@@ -15,7 +15,7 @@ import mediaquery from '@system.mediaquery';
## mediaquery.matchMedia
matchMedia(condition: string): &lt;MediaQueryList&gt;
matchMedia(condition: string): MediaQueryList
根据媒体查询条件,创建MediaQueryList对象。
......@@ -28,11 +28,10 @@ matchMedia(condition: string): &lt;MediaQueryList&gt;
| condition | string | 是 | 用于查询的条件。 |
**返回值:**
**表1** MediaQueryList
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| MediaQueryList | Object | 表示创建MediaQueryList对象的属性,详情见下表 MediaQueryList说明。 |
| 参数类型 | 说明 |
| -------- | -------- |
| MediaQueryList | 表示创建MediaQueryList对象的属性,详情见下表 MediaQueryList说明。 |
**示例:**
......@@ -44,18 +43,47 @@ export default {
}
```
**表2** MediaQueryList说明
## MediaQueryEvent
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| matches | boolean | 如果查询条件匹配成功则返回true,否则返回值为false。只读。 |
| media | string | 序列化的媒体查询条件,只读。 |
| onchange | Function | matches状态变化时的执行函数。 |
定义MediaQuery事件。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| matches | boolean | 是 | 匹配结果。 |
## MediaQueryList
定义MediaQuery列表信息。
### 属性
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| media | string | 否 | 序列化媒体查询条件,该参数为只读。 |
| matches | boolean | 是 | 匹配结果。 |
### onchange
onchange?: (matches: boolean) => void
matches状态变化时的执行函数。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
## MediaQueryList.addListener
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| matches | boolean | 是 | matches状态变化时值。 |
addListener(Object): void
### MediaQueryList.addListener
addListener(callback: (event: MediaQueryEvent) => void): void
给MediaQueryList添加回调函数,回调函数应在onShow生命周期之前添加,即需要在onInit或onReady生命周期里添加。
......@@ -65,28 +93,18 @@ addListener(Object): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| callback | Function | 是 | 匹配条件发生变化的响应函数。 |
| callback | (event: MediaQueryEvent) => void | 是 | 匹配条件发生变化的响应函数。 |
**示例:**
```
export default {
onReady() {
var mMediaQueryList = mediaquery.matchMedia('(max-width: 466)');
function maxWidthMatch(e) {
if (e.matches) {
// do something
}
}
mMediaQueryList.addListener(maxWidthMatch);
},
}
mMediaQueryList.addListener(maxWidthMatch);
```
## MediaQueryList.removeListener
### MediaQueryList.removeListener
removeListener(Object): void
removeListener(callback: (event: MediaQueryEvent) => void): void
移除MediaQueryList中的回调函数。
......@@ -96,10 +114,14 @@ removeListener(Object): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| callback | Function | 是 | 匹配条件发生变化的响应函数。 |
| callback | (event: MediaQueryEvent) => void) | 是 | 匹配条件发生变化的响应函数。 |
**示例:**
```
query.removeListener(minWidthMatch);
mMediaQueryList.removeListener(maxWidthMatch);
```
......@@ -13,10 +13,31 @@
import notification from '@system.notification';
```
## ActionResult
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
| ----------- | --- | ---- | ---------------------------------------------- | ---- | ------------------------- |
| bundleName | 是 | 是 | string | 是 | 单击通知后要重定向到的应用程序的Bundle名。 |
| abilityName | 是 | 是 | string | 是 | 单击通知后要重定向到的应用程序的Ability名称。 |
| uri | 是 | 是 | string | 否 | 要重定向到的页面的uri。 |
## ShowNotificationOptions
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
| ------------- | --- | ---- | ---------------------------------------------- | ---- | ------------------------- |
| contentTitle | 是 | 是 | string | 否 | 通知标题。 |
| contentText | 是 | 是 | string | 否 | 通知内容。 |
| clickAction | 是 | 是 | ActionResult | 否 | 通知被点击后触发的行为。 |
## notification.show
show(contentTitle: string, contentText: string, clickAction: ActionInfo): void
show(options?: ShowNotificationOptions): void
显示通知。
......@@ -26,21 +47,10 @@ show(contentTitle: string, contentText: string, clickAction: ActionInfo): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| contentTitle | string | 否 | 通知标题。 |
| contentText | string | 否 | 通知内容。 |
| clickAction | ActionInfo | 否 | 通知点击后触发的动作。 |
**表1** ActionInfo
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| bundleName | string | 是 | 点击通知后要跳转到的应用的bundleName |
| abilityName | string | 是 | 点击通知后要跳转到的应用的abilityName |
| uri | string | 是 | 要跳转到的uri,可以是下面的两种格式:<br/>-&nbsp;页面绝对路径,由配置文件中pages列表提供,例如:<br/>&nbsp;&nbsp;-&nbsp;pages/index/index<br/>&nbsp;&nbsp;-&nbsp;pages/detail/detail<br/>-&nbsp;特殊的,如果uri的值是"/",则跳转到首页。 |
| options | ShowNotificationOptions | 否 | 通知标题。 |
**示例:**
```
```javascript
export default {
show() {
notification.show({
......
......@@ -13,7 +13,7 @@ import router from '@system.router';
## router.push
push(Object): void
push(options: RouterOptions): void
跳转到应用内的指定页面。
......@@ -23,8 +23,7 @@ push(Object): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| uri | string | 是 | 表示目标页面的uri,可以用以下两种格式:<br/>-&nbsp;页面绝对路径,由配置文件中pages列表提供,例如:<br/>&nbsp;&nbsp;-&nbsp;pages/index/index<br/>&nbsp;&nbsp;-&nbsp;pages/detail/detail<br/>-&nbsp;特殊值,如果uri的值是"/",则跳转到首页。 |
| params | Object | 否 | 跳转时要同时传递到目标页面的数据,跳转到目标页面后,参数可以在页面中直接使用,如this.data1(data1为跳转时params参数中的key值)。如果目标页面中已有该字段,则其值会被传入的字段值覆盖。 |
| options | [RouterOptions](#routeroptions) | 是 | 页面路由参数,详细请参考RouterOptions。|
**示例:**
......@@ -68,7 +67,7 @@ export default {
## router.replace
replace(Object): void
replace(options: RouterOptions): void
用应用内的某个页面替换当前页面,并销毁被替换的页面。
......@@ -78,8 +77,7 @@ replace(Object): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| uri | string | 是 | 目标页面的uri,可以是以下的两种格式:<br/>-&nbsp;页面绝对路径,由配置文件中pages列表提供,例如:<br/>&nbsp;&nbsp;-&nbsp;pages/index/index<br/>&nbsp;&nbsp;-&nbsp;pages/detail/detail<br/>-&nbsp;特殊值,如果uri的值是"/",则跳转到首页。 |
| params | Object | 否 | 跳转时要同时传递到目标页面的数据,跳转到目标页面后,参数可以在页面中直接使用,如this.data1(data1为跳转时params参数中的key值)。如果目标页面中已有该字段,则其值会被传入的字段值覆盖。 |
| options | [RouterOptions](#routeroptions) | 是 | 页面路由参数,详细请参考RouterOptions。|
**示例:**
......@@ -112,7 +110,7 @@ export default {
## router.back
back(Object): void
back(options?: BackRouterOptions): void
返回上一页面或指定的页面。
......@@ -122,8 +120,7 @@ back(Object): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| uri | string | 否 | 返回到指定uri的界面,如果页面栈上没有uri页面,则不响应该情况。如果uri未设置,则返回上一页。 |
| params | Object | 否 | 跳转时要同时传递到目标页面的数据 |
| options | [BackRouterOptions](#backrouteroptions) | 是 | 详细请参考BackRouterOptions。|
**示例:**
......@@ -183,6 +180,20 @@ export default {
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 示例中的uri字段是页面路由,由配置文件中的pages列表指定。
## router.getParams
getParams(): ParamsInterface
获取当前页面的参数信息。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| [ParamsInterface](#paramsinterface) | 详细请参见ParamsInterface。|
## router.clear
clear(): void
......@@ -228,20 +239,17 @@ export default {
## router.getState
getState(): &lt;RouterState&gt;
getState(): RouterState
获取当前页面的状态信息。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**返回值:**
**表1** RouterState
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| index | number | 表示当前页面在页面栈中的索引。<br/>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**说明:**<br/>>&nbsp;从栈底到栈顶,index从1开始递增。 |
| name | string | 表示当前页面的名称,即对应文件名。 |
| path | string | 表示当前页面的路径。 |
| 参数类型 | 说明 |
| -------- | -------- |
| [RouterState](#routerstate) | 详细请参见RouterState。|
**示例:**
......@@ -258,7 +266,7 @@ export default {
## router.enableAlertBeforeBackPage<sup>6+</sup>
enableAlertBeforeBackPage(Object): void
enableAlertBeforeBackPage(options: EnableAlertBeforeBackPageOptions): void
开启页面返回询问对话框。
......@@ -268,10 +276,7 @@ enableAlertBeforeBackPage(Object): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| message | string | 是 | 询问对话框内容。 |
| success | ()&nbsp;=&gt;&nbsp;void | 否 | 接口调用成功的回调函数。 |
| fail | ()&nbsp;=&gt;&nbsp;void | 否 | 接口调用失败的回调函数。 |
| complete | ()&nbsp;=&gt;&nbsp;void | 否 | 接口调用结束的回调函数。 |
| options | [EnableAlertBeforeBackPageOptions](#EnableAlertbeforebackpageoptions) | 是 | 详细请参见EnableAlertBeforeBackPageOptions。 |
**示例:**
......@@ -293,7 +298,7 @@ export default {
## router.disableAlertBeforeBackPage<sup>6+</sup>
disableAlertBeforeBackPage(Object): void
disableAlertBeforeBackPage(options?: DisableAlertBeforeBackPageOptions): void
禁用页面返回询问对话框。
......@@ -303,9 +308,7 @@ disableAlertBeforeBackPage(Object): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| success | ()&nbsp;=&gt;&nbsp;void | 否 | 接口调用成功的回调函数。 |
| fail | ()&nbsp;=&gt;&nbsp;void | 否 | 接口调用失败的回调函数。 |
| complete | ()&nbsp;=&gt;&nbsp;void | 否 | 接口调用结束的回调函数。 |
| options | [DisableAlertBeforeBackPageOptions](#disablealertbeforebackpageoptions)| 否 | 详细请参见DisableAlertBeforeBackPageOptions。 |
**示例:**
......@@ -324,3 +327,68 @@ export default {
}
```
## RouterOptions
定义路由器的选项。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Lite
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| uri | string | 是 | 目标页面的uri,可以是以下的两种格式:<br/>1. 页面的绝对路径,由config.json文件中的页面列表提供。例如:<br/>- pages/index/index<br/> -pages/detail/detail<br/>2. 特定路径。如果URI为斜杠(/),则显示主页。 |
| params | Object | 否 | 跳转时要同时传递到目标页面的数据,跳转到目标页面后,参数可以在页面中直接使用,如this.data1(data1为跳转时params参数中的key值)。如果目标页面中已有该字段,则其值会被传入的字段值覆盖。 |
## BackRouterOptions
定义路由器返回的选项。
**系统能力:** 以下各项对应的系统能力有所不同,详见下表。
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| uri | string | 否 | 返回到指定uri的界面,如果页面栈上没有uri页面,则不响应该情况。如果uri未设置,则返回上一页。 <br>**系统能力:** SystemCapability.ArkUI.ArkUI.Full|
| params | Object | 否 | 跳转时要同时传递到目标页面的数据。 <br>**系统能力:** SystemCapability.ArkUI.ArkUI.Lite|
## RouterState
定义路由器的状态。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- |-------- |
| index | number | 是 | 表示当前页面在页面栈中的索引。从栈底到栈顶,index从1开始递增。 |
| name | string | 是 | 表示当前页面的名称,即对应文件名。 |
| path | string | 是 | 表示当前页面的路径。 |
## EnableAlertBeforeBackPageOptions<sup>6+</sup>
定义EnableAlertBe beforeBackPage选项。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| message | string | 是 | 询问对话框内容。 |
| success | (errMsg: string) => void | 否 | 弹出对话框时调用,errMsg表示返回信息。 |
| fail | (errMsg: string) => void | 否 | 接口调用失败的回调函数,errMsg表示返回信息。 |
| complete | () => void | 否 | 接口调用结束的回调函数。 |
## DisableAlertBeforeBackPageOptions<sup>6+</sup>
定义DisableAlertBeforeBackPage参数选项。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| success | (errMsg: string) => void | 否 | 弹出对话框时调用,errMsg表示返回信息。 |
| fail | (errMsg: string) => void | 否 | 接口调用失败的回调函数,errMsg表示返回信息。|
| complete | () => void | 否 | 接口调用结束的回调函数。 |
## ParamsInterface
| 名称 | 参数类型 | 说明 |
| -------- | -------- | -------- |
| [key: string] | Object| 路由参数列表。 |
# UriPermissionManager
# uriPermissionManager
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......@@ -11,11 +11,11 @@ Uri权限管理。
```
import UriPermissionManager from '@@ohos.application.UriPermissionManager';
import uriPermissionManager from '@ohos.application.uriPermissionManager';
```
## verifyUriPermission
## uriPermissionManager.verifyUriPermission
verifyUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number, callback: AsyncCallback&lt;number&gt;): void
......@@ -25,7 +25,8 @@ verifyUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number
SystemCapability.Ability.AbilityRuntime.Core
- 参数:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| uri | string | 是 | 指向文件的uri,例如fileshare:///com.samples.filesharetest.FileShare/person/10。 |
......@@ -33,7 +34,7 @@ SystemCapability.Ability.AbilityRuntime.Core
| accessTokenId | number | 是 | 每个应用的唯一标识ID,开发者通过包管理接口自行获取。 |
| callback | AsyncCallback&lt;number&gt; | 是 | callback形式返回检验结果,返回0表示有权限,返回-1表示无权限。 |
- 示例:
**示例:**
```
let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10"
......@@ -43,7 +44,7 @@ SystemCapability.Ability.AbilityRuntime.Core
```
## verifyUriPermission
## uriPermissionManager.verifyUriPermission
verifyUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number): Promise&lt;number&gt;
......@@ -53,19 +54,21 @@ verifyUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number
SystemCapability.Ability.AbilityRuntime.Core
- 参数:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| uri | string | 是 | 指向文件的uri,例如fileshare:///com.samples.filesharetest.FileShare/person/10。 |
| flag | wantConstant.Flags | 是 | uri的读权限或写权限。 |
| accessTokenId | number | 是 | 每个应用的唯一标识ID,开发者通过包管理接口自行获取。 |
- 返回值:
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;number&gt; | 返回0表示有权限,返回-1表示无权限。 |
- 示例:
**示例:**
```
let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10"
......
......@@ -539,6 +539,7 @@ vector.increaseCapacityTo(8);
```
### trimToCurrentLength
trimToCurrentLength(): void
把容量限制为当前的length大小。
......
......@@ -9,7 +9,7 @@
- [HUKS开发指导](huks-guidelines.md)
- Hap包签名工具
- [Hap包签名工具开发指导](hapsigntool-guidelines.md)
- [Hap包签名工具指导](hapsigntool-guidelines.md)
- 访问控制
- [访问控制开发概述](accesstoken-overview.md)
......
......@@ -18,7 +18,7 @@
- [应用开发包结构说明](quick-start/package-structure.md)
- [资源文件的分类](quick-start/basic-resource-file-categories.md)
- 开发
- [Ability开发](ability/Readme-CN.md)
- Ability开发
- [Ability框架概述](ability/ability-brief.md)
- FA模型
- [FA模型综述](ability/fa-brief.md)
......@@ -35,7 +35,7 @@
- 其他
- [WantAgent使用指导](ability/wantagent.md)
- [Ability助手使用指导](ability/ability-assistant-guidelines.md)
- [UI开发](ui/Readme-CN.md)
- UI开发
- [方舟开发框架(ArkUI)概述](ui/arkui-overview.md)
- 基于JS扩展的类Web开发范式
- [概述](ui/ui-js-overview.md)
......
......@@ -362,7 +362,7 @@
- [DFX](subsystems/subsys-dfx.md)
- 专题
- [HPM Part](hpm-part/Readme-CN.md)
- HPM Part
- [HPM Part介绍](hpm-part/hpm-part-about.md)
- [HPM Part开发指导](hpm-part/hpm-part-development.md)
- [HPM Part参考](hpm-part/hpm-part-reference.md)
......@@ -388,7 +388,7 @@
- 参考
- [常见问题-设备开发](faqs/Readme-CN.md)
- 常见问题-设备开发
- [常见问题概述](faqs/faqs-overview.md)
- [环境搭建常见问题](faqs/faqs-environment-setup.md)
- [编译构建子系统常见问题](faqs/faqs-building.md)
......
# 导读<a name="ZH-CN_TOPIC_0000001142413608"></a>
# OpenHarmony开发者文档
此工程存放OpenHarmony提供的快速入门、开发指南、API参考等开发者文档,欢迎参与OpenHarmony开发者文档开源项目,与我们一起完善开发者文档。
## **文档目录结构**<a name="section1976124516374"></a>
- [Openharmony概述](OpenHarmony-Overview_zh.md)
- 设备开发
- 轻量和小型系统开发指导(参考内存<128MB)
- overview:[设备开发导读](device-dev/Readme-CN.md)
- quick-start:[快速入门](device-dev/quick-start/Readme-CN.md)(搭建环境、获取源码、编译、烧录等)
- Basic Capability:开发基础能力
- Kernel:[轻量系统内核](device-dev/kernel/kernel-mini.md)
- Kernel:[小型系统内核](device-dev/kernel/kernel-small.md)
- Drivers:[驱动](device-dev/driver/Readme-CN.md)
- Subsystems:[子系统](device-dev/subsystems/Readme-CN.md)(编译构建、图形图像、DFX、XTS等子系统)
- Security:[隐私与安全](device-dev/security/Readme-CN.md)
- guide:开发示例
- [WLAN连接类产品](device-dev/guide/device-wlan.md)(LED外设控制、集成三方SDK)
- [无屏摄像头类产品](device-dev/guide/device-iotcamera-control.md)(摄像头控制)
- [带屏摄像头类产品](device-dev/guide/device-camera.md)(屏幕和摄像头控制、视觉应用开发)
- porting:移植适配
- [轻量和小型系统三方库移植指导](device-dev/porting/porting-thirdparty.md)
- [轻量系统芯片移植指导](device-dev/porting/porting-minichip.md)
- [轻量系统芯片移植案例](device-dev/porting/porting-minichip-cases.md)
- [小型系统芯片移植指导](device-dev/porting/porting-smallchip.md)
- bundles:HPM Bundle开发
- [HPM Bundle开发规范](device-dev/bundles/bundles-standard-rules.md)
- [HPM Bundle开发指南](device-dev/bundles/bundles-guide.md)
- [HPM Bundle开发示例](device-dev/bundles/bundles-demo.md)
- 标准系统开发指导(参考内存≥128MB)
- overview:[设备开发导读](device-dev/Readme-CN.md)
- quick-start:[快速入门](device-dev/quick-start/quickstart-standard.md)(搭建环境、获取源码、编译、烧录等)
- Basic Capability:开发基础能力
- Kernel:[标准系统内核](device-dev/kernel/kernel-standard.md)
- Drivers:[驱动](device-dev/driver/Readme-CN.md)
- Subsystems:[子系统](device-dev/subsystems/Readme-CN.md)(编译构建、图形图像、DFX、XTS等子系统)
- Security:[隐私与安全](device-dev/security/Readme-CN.md)
- guide:开发示例
- [时钟应用](device-dev/guide/device-clock-guide.md)
- [平台驱动](device-dev/guide/device-driver-demo.md)
- [外设驱动](device-dev/guide/device-outerdriver-demo.md)
- porting:移植适配
- [标准系统芯片移植指导](device-dev/porting/standard-system-porting-guide.md)
- [一种快速移植OpenHarmony Linux内核的方法](device-dev/porting/porting-linux-kernel.md)
- bundles:HPM Bundle开发
- [HPM Bundle开发规范](device-dev/bundles/bundles-standard-rules.md)
- [HPM Bundle开发指南](device-dev/bundles/bundles-guide.md)
- [HPM Bundle开发示例](device-dev/bundles/bundles-demo.md)
- [常见问题](device-dev/faqs/Readme-CN.md)
- 应用开发
- overview:[应用开发导读](application-dev/application-dev-guide.md)
- quick-start:[入门](application-dev/quick-start/Readme-CN.md)
- ability:[Ability框架](application-dev/ability/Readme-CN.md)
- ui:[UI](application-dev/ui/Readme-CN.md)
- media:[媒体](application-dev/media/Readme-CN.md)
- security:[安全](application-dev/security/Readme-CN.md)
- connectivity:[网络与连接](application-dev/connectivity/Readme-CN.md)
- database:[分布式数据服务](application-dev/database/Readme-CN.md)
- usb:[USB服务](application-dev//usb/Readme-CN.md)
- dfx:[DFX](application-dev/dfx/Readme-CN.md)
- reference:[开发参考](application-dev/reference/Readme-CN.md)
- 许可证及版权信息检查工具:[开源合规审查工具](https://gitee.com/openharmony-sig/tools_oat)
- glossary:[术语](device-dev/glossary/glossary.md)
## **版本更新**<a name="section945819377382"></a>
参考[Release Notes](release-notes/Readme.md)
## **第三方开源软件及许可说明**<a name="section840310516385"></a>
3rd-Party-License:[第三方开源软件及许可证说明](contribute/第三方开源软件及许可证说明.md)
## **贡献**<a name="section152287615392"></a>
非常欢迎您参与[贡献](contribute/参与贡献.md),我们鼓励开发者以各种方式参与文档反馈和贡献。
您可以对现有文档进行评价、简单更改、反馈文档质量问题、贡献您的原创内容,详细请参考[贡献文档](contribute/贡献文档.md)
卓越贡献者将会在开发者社区文档贡献专栏表彰公示。
本目录是OpenHarmony开发者文档的中文目录。目录内容包括:
- [设备开发文档](device-dev/Readme-CN.md)
- [应用开发文档](application-dev/Readme-CN.md)
- [版本说明](release-notes/Readme.md)
- [子系统介绍](./readme)
- [项目贡献指南](contribute/贡献指南.md)
\ No newline at end of file
# ChangeLog
**关键的接口/组件变更**
## XXX子系统
### cl.rpc.1 sendRequest返回值类型变更
#### 变更影响
……
#### 关键的接口/组件变更
**模块**
**接口**
**变更后接口**
……
#### 适配指导
……
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# JS API Diff
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本的JS API变更,参见各子系统的详细记录:
- [元能力](js-apidiff-ability.md)
- [程序访问控制](js-apidiff-access-control.md)
- [无障碍](js-apidiff-accessibility.md)
- [帐号](js-apidiff-account.md)
- [ArkUI开发框架](js-apidiff-ace.md)
- [电源服务](js-apidiff-battery.md)
- [包管理](js-apidiff-bundle.md)
- [基础通信](js-apidiff-communicate.md)
- [语言编译器运行时](js-apidiff-complier-and-runtime.md)
- [定制](js-apidiff-config-policy.md)
- [DFX](js-apidiff-dfx.md)
- [分布式数据管理](js-apidiff-distributed-data.md)
- [分布式硬件](js-apidiff-distributed-hardware.md)
- [事件通知](js-apidiff-event-and-notification.md)
- [文件管理](js-apidiff-file-management.md)
- [位置服务](js-apidiff-geolocation.md)
- [全球化](js-apidiff-global.md)
- [图形图像](js-apidiff-graphic.md)
- [Misc软件服务](js-apidiff-misc.md)
- [多模输入](js-apidiff-multi-modal-input.md)
- [OS媒体软件](js-apidiff-multimedia.md)
- [网络管理](js-apidiff-network.md)
- [启动恢复](js-apidiff-recovery.md)
- [资源调度](js-apidiff-resource-scheduler.md)
- [安全基础能力](js-apidiff-security.md)
- [泛Sensor服务](js-apidiff-sensor.md)
- [应用](js-apidiff-settings.md)
- [软总线](js-apidiff-soft-bus.md)
- [电话服务](js-apidiff-telephony.md)
- [升级服务](js-apidiff-update.md)
- [USB服务](js-apidiff-usb.md)
- [用户IAM](js-apidiff-user-authentication.md)
- [窗口管理](js-apidiff-window.md)
# xxx子系统JS API变更
OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,XXX子系统的API变更如下:
## 接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# Native API 差异报告
OpenHarmony 3.1 Release相较于OpenHarmony 3.0 LTS版本的API变更如下:
## 标准系统接口变更
| 模块名称 | 接口名称 | 变更类型 | 变更说明 |
| -------- | -------- | -------- | -------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
\ No newline at end of file
# Readme
本目录记录了OpenHarmony 3.1 Release版本相较OpenHarmony 3.0 LTS版本的API变化。
API详细变更记录如下:
- API差异报告
API差异报告记录了API的变更情况,包括新增、变更、废弃、删除。
- [JS API差异报告](js-apidiff-v3.1-release.md)
- [Native API差异报告](native-apidiff-v3.1-release.md)
- [变更说明](changelog-v3.1-release.md)
变更说明重点记录因API变更对开发者调用API的行为产生的影响,并针对变更影响提供适配指导。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册