提交 4709a6c9 编写于 作者: Mr-YX's avatar Mr-YX 提交者: Gitee

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

Signed-off-by: Mr-YX's avatarmr-yx <496043997@qq.com>
...@@ -836,7 +836,7 @@ Obtains information of the current ability. This API uses an asynchronous callba ...@@ -836,7 +836,7 @@ Obtains information of the current ability. This API uses an asynchronous callba
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------- | | -------- | ---------------------- | ---- | ------------------------- |
| callback | AsyncCallback\<[AbilityInfo](#abilityInfo)> | Yes | Callback used to return the ability information.| | callback | AsyncCallback\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes | Callback used to return the ability information.|
**Example** **Example**
...@@ -864,7 +864,7 @@ Obtains information of the current ability. This API uses a promise to return th ...@@ -864,7 +864,7 @@ Obtains information of the current ability. This API uses a promise to return th
| Type | Description | | Type | Description |
| --------------- | ------------------------- | | --------------- | ------------------------- |
| Promise\<[AbilityInfo](#abilityInfo)> | Promise used to return the ability information.| | Promise\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Promise used to return the ability information.|
**Example** **Example**
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
> **NOTE**<br/> > **NOTE**
>
> The initial APIs of this module are supported since API version 7. 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 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -11,7 +12,7 @@ Provides the ability information. ...@@ -11,7 +12,7 @@ Provides the ability information.
**System capability**: SystemCapability.BundleManager.BundleFramework **System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| --------------------- | -------------------------------------------------------- | ---- | ---- | ----------------------------------------- | | --------------------- | -------------------------------------------------------- | ---- | ---- | ----------------------------------------- |
...@@ -43,3 +44,10 @@ Provides the ability information. ...@@ -43,3 +44,10 @@ Provides the ability information.
| metaData<sup>8+</sup> | Array\<[CustomizeData](js-apis-bundle-CustomizeData.md)> | Yes | No | Custom metadata of the ability. | | metaData<sup>8+</sup> | Array\<[CustomizeData](js-apis-bundle-CustomizeData.md)> | Yes | No | Custom metadata of the ability. |
| metaData<sup>9+</sup> | Array\<[Metadata](js-apis-bundle-Metadata.md)> | Yes | No | Metadata of the ability. | | metaData<sup>9+</sup> | Array\<[Metadata](js-apis-bundle-Metadata.md)> | Yes | No | Metadata of the ability. |
| enabled<sup>8+</sup> | boolean | Yes | No | Whether the ability is enabled. | | enabled<sup>8+</sup> | boolean | Yes | No | Whether the ability is enabled. |
| supportWindowMode<sup>9+</sup> | Array\<[SupportWindowMode](js-apis-Bundle.md)> | Yes | No | Window modes supported by the ability. |
| maxWindowRatio<sup>9+</sup> | number | Yes | No | Maximum window ratio supported by the ability. |
| minWindowRatio<sup>9+</sup> | number | Yes | No | Minimum window ratio supported by ability. |
| maxWindowWidth<sup>9+</sup> | number | Yes | No | Maximum window width supported by the ability. |
| minWindowWidth<sup>9+</sup> | number | Yes | No | Minimum window width supported by the ability. |
| maxWindowHeight<sup>9+</sup> | number | Yes | No | Maximum window height supported by the ability. |
| minWindowHeight<sup>9+</sup> | number | Yes | No | Minimum window height supported by the ability. |
# Zip Module (JavaScript SDK APIs) # Zip
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Constraints
None
## Modules to Import ## Modules to Import
```javascript ```javascript
...@@ -7,8 +14,7 @@ import zlib from '@ohos.zlib'; ...@@ -7,8 +14,7 @@ import zlib from '@ohos.zlib';
``` ```
## zlib.zipFile ## zlib.zipFile
zipFile(inFile:string, outFile:string, options: Options): Promise&lt;void&gt;
zipFile(inFile:string, outFile:string, options: Options): Promise\<void>
Zips a file. This API uses a promise to return the result. Zips a file. This API uses a promise to return the result.
...@@ -17,10 +23,10 @@ Zips a file. This API uses a promise to return the result. ...@@ -17,10 +23,10 @@ Zips a file. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------------------------- | ---- | ------------------------------------------- | | ------- | ------------------- | ---- | ------------------------------------------------------------ |
| inFile | string | Yes | Path of the folder or file to zip. | | inFile | string | Yes | Path of the folder or file to zip. For details about the path, see [FA Model](js-apis-Context.md) and [Stage Model](js-apis-application-context.md).|
| outFile | string | Yes | Path of the zipped file. The file name extension is .zip.| | outFile | string | Yes | Path of the zipped file. The file name extension is .zip. |
| options | [Options](#options)| No | Optional parameters for the zip operation. | | options | [Options](#options) | No | Optional parameters for the zip operation. |
**Return value** **Return value**
...@@ -72,7 +78,7 @@ zlib.zipFile(inFile , outFile, options).then((data) => { ...@@ -72,7 +78,7 @@ zlib.zipFile(inFile , outFile, options).then((data) => {
## zlib.unzipFile ## zlib.unzipFile
unzipFile(inFile:string, outFile:string, options: Options): Promise\<void> unzipFile(inFile:string, outFile:string, options: Options): Promise&lt;void&gt;
Unzips a file. This API uses a promise to return the result. Unzips a file. This API uses a promise to return the result.
...@@ -81,10 +87,10 @@ Unzips a file. This API uses a promise to return the result. ...@@ -81,10 +87,10 @@ Unzips a file. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------------------------- | ---- | ----------------------------------- | | ------- | ------------------- | ---- | ------------------------------------------------------------ |
| inFile | string | Yes | Path of the .zip file to unzip.| | inFile | string | Yes | Path of the folder or file to zip. For details about the path, see [FA Model](js-apis-Context.md) and [Stage Model](js-apis-application-context.md).|
| outFile | string | Yes | Path of the unzipped file. | | outFile | string | Yes | Path of the unzipped file. |
| options | [Options](#options)| No | Optional parameters for the unzip operation. | | options | [Options](#options) | No | Optional parameters for the unzip operation. |
**Return value** **Return value**
...@@ -115,42 +121,52 @@ zlib.unzipFile(inFile, outFile, options).then((data) => { ...@@ -115,42 +121,52 @@ zlib.unzipFile(inFile, outFile, options).then((data) => {
## Options ## Options
| Name | Description | **System capability**: SystemCapability.BundleManager.Zlib
| --------------------------- | ------------------------------------------------------------ |
| level?: CompressLeve | See [zip.CompressLevel](#zipcompresslevel).| | Name | Type | Mandatory| Description |
| memLevel?: MemLevel | See [zip.MemLevel](#zipmemlevel). | | -------- | ---------------- | ---- | --------------------------------------------------------- |
| strategy?: CompressStrategy | See [zip.CompressStrategy](#zipcompressstrategy).| | level | CompressLeve | No | See [zip.CompressLevel](#zipcompresslevel). |
| memLevel | MemLevel | No | See [zip.MemLevel](#zipmemlevel). |
| strategy | CompressStrategy | No | See [zip.CompressStrategy](#zipcompressstrategy).|
## zip.MemLevel ## zip.MemLevel
| Name | Description | **System capability**: SystemCapability.BundleManager.Zlib
| ----------------- | -------------------------------- |
| MEM_LEVEL_MIN | Minimum memory used by the **zip** API during compression.| | Name | Value | Description |
| MEM_LEVEL_MAX | Maximum memory used by the **zip** API during compression.| | ----------------- | ---- | -------------------------------- |
| MEM_LEVEL_DEFAULT | Default memory used by the **zip** API during compression.| | MEM_LEVEL_MIN | 1 | Minimum memory used by the **zip** API during compression.|
| MEM_LEVEL_MIN | 9 | Maximum memory used by the **zip** API during compression.|
| MEM_LEVEL_DEFAULT | 8 | Default memory used by the **zip** API during compression.|
## zip.CompressLevel
## Zip.CompressLevel **System capability**: SystemCapability.BundleManager.Zlib
| Name | Description | | Name | Value | Description |
| --------------------------------------- | ----------------- | | ---------------------------------- | ---- | ----------------- |
| COMPRESS_LEVEL_NO_COMPRESSION: 0 | Compress level 0 that indicates uncompressed.| | COMPRESS_LEVEL_NO_COMPRESSION | 0 | Compress level 0 that indicates uncompressed.|
| COMPRESS_LEVEL_BEST_SPEED: 1 | Compression level 1 that gives the best speed. | | COMPRESS_LEVEL_BEST_SPEED | 1 | Compression level 1 that gives the best speed. |
| COMPRESS_LEVEL_BEST_COMPRESSION: 9 | Compression level 9 that gives the best compression. | | COMPRESS_LEVEL_BEST_COMPRESSION | 9 | Compression level 9 that gives the best compression. |
| COMPRESS_LEVEL_DEFAULT_COMPRESSION: -1| Default compression level. | | COMPRESS_LEVEL_DEFAULT_COMPRESSION | -1 | Default compression level. |
## Zip.CompressStrategy ## zip.CompressStrategy
| Name | Description | **System capability**: SystemCapability.BundleManager.Zlib
| -------------------------------------- | ------------------------ |
| COMPRESS_STRATEGY_DEFAULT_STRATEGY: 0 | Default compression strategy. | | Name | Value | Description |
| COMPRESS_STRATEGY_FILTERED: 1 | Filtered compression strategy.| | ---------------------------------- | ---- | ------------------------ |
| COMPRESS_STRATEGY_HUFFMAN_ONLY: 2 | Huffman coding compression strategy. | | COMPRESS_STRATEGY_DEFAULT_STRATEGY | 0 | Default compression strategy. |
| COMPRESS_STRATEGY_RLE: 3 | RLE compression strategy. | | COMPRESS_STRATEGY_FILTERED | 1 | Filtered compression strategy.|
| COMPRESS_STRATEGY_FIXED: 4 | Fixed compression strategy. | | COMPRESS_STRATEGY_HUFFMAN_ONLY | 2 | Huffman coding compression strategy. |
| COMPRESS_STRATEGY_RLE | 3 | RLE compression strategy. |
| COMPRESS_STRATEGY_FIXED | 4 | Fixed compression strategy. |
## zip.ErrorCode ## zip.ErrorCode
| Name | Description | **System capability**: SystemCapability.BundleManager.Zlib
| -------------------- | ------------ |
| ERROR_CODE_OK: 0 | The API is successfully called.| | Name | Value | Description |
| ERROR_CODE_ERRNO: -1| Failed to call the API.| | ---------------- | ---- | ------------ |
| ERROR_CODE_OK | 0 | The API is successfully called.|
| ERROR_CODE_ERRNO | -1 | Failed to call the API.|
...@@ -54,7 +54,7 @@ ImageAnimator() ...@@ -54,7 +54,7 @@ ImageAnimator()
## Events ## Events
| Name | Description | | Name | Description |
| -------- | -------- | -------- | | -------- | -------- |
| onStart() =&gt; void | Triggered when the animation starts to play. | | onStart() =&gt; void | Triggered when the animation starts to play. |
| onPause() =&gt; void | Triggered when the animation playback is paused. | | onPause() =&gt; void | Triggered when the animation playback is paused. |
| onRepeat() =&gt; void | Triggered when the animation playback is repeated. | | onRepeat() =&gt; void | Triggered when the animation playback is repeated. |
......
...@@ -20,7 +20,7 @@ This component contains the child component [<ListItem>](ts-container-listitem.m ...@@ -20,7 +20,7 @@ This component contains the child component [<ListItem>](ts-container-listitem.m
## APIs ## APIs
List(value:{space?: number, initialIndex?: number}) List(value:{space?: number | string, initialIndex?: number, scroller?: Scroller})
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name | Type | Mandatory | Default Value | Description |
......
...@@ -15,7 +15,7 @@ This component supports only one child component. ...@@ -15,7 +15,7 @@ This component supports only one child component.
## APIs ## APIs
Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number\}\) Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number | string\}\)
- Parameters - Parameters
......
# Date Picker Dialog Box # Date Picker Dialog Box
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
You can display a date picker in a dialog box to allow users to select a date from the given range. You can display a date picker in a dialog box to allow users to select a date from the given range.
...@@ -13,18 +13,18 @@ None ...@@ -13,18 +13,18 @@ None
show(options?: DatePickerDialogOptions) show(options?: DatePickerDialogOptions)
Defines and displays a date picker dialog box. Displays a date picker dialog box.
- options parameters - options parameters
| Name| Type| Mandatory| Default Value| Description| | Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| start | Date | No| Date('1970-1-1') | Start date of the picker.| | start | Date | No | Date('1970-1-1') | Start date of the picker. |
| end | Date | No| Date('2100-12-31') | End date of the picker.| | end | Date | No | Date('2100-12-31') | End date of the picker. |
| selected | Date | No| Current system date| Date of the selected item.| | selected | Date | No | Current system date | Date of the selected item. |
| lunar | boolean | No| false | Whether to display the lunar calendar.| | lunar | boolean | No | false | Whether to display the lunar calendar. |
| onAccept | (value: [DatePickerResult](ts-basic-components-datepicker.md#DatePickerResult)) => void | No| - | Triggered when the OK button in the dialog box is clicked.| | onAccept | (value: [DatePickerResult](ts-basic-components-datepicker.md#DatePickerResult)) => void | No | - | Callback invoked when the OK button in the dialog box is clicked. |
| onCancel | () => void | No| - | Triggered when the Cancel button in the dialog box is clicked.| | onCancel | () => void | No | - | Triggered when the Cancel button in the dialog box is clicked. |
| onChange | (value: [DatePickerResult](ts-basic-components-datepicker.md#DatePickerResult)) => void | No| - | Triggered when the selected item in the picker changes.| | onChange | (value: [DatePickerResult](ts-basic-components-datepicker.md#DatePickerResult)) => void | No | - | Callback invoked when the selected item in the picker changes. |
## Example ## Example
......
# Menu # Menu
> **NOTE**<br>The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. > **NOTE**<br>
> The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
## ContextMenu.close ## ContextMenu.close
|Method|Description| | API | Description |
|----|---| | ---- | --- |
|close(): void|Closes the menu bound to this component through [bindContextMenu](./ts-universal-attributes-menu.md#Atrributes) on a page.| |close(): void| Closes the menu bound to this component through [bindContextMenu](./ts-universal-attributes-menu.md#Atrributes) on a page. |
- Example - Example
``` ```
......
# Text Picker Dialog Box # Text Picker Dialog Box
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
You can display a text picker in a dialog box to allow users to select text from the given range. You can display a text picker in a dialog box to allow users to select text from the given range.
...@@ -16,20 +16,20 @@ show(options: TextPickerDialogOptions) ...@@ -16,20 +16,20 @@ show(options: TextPickerDialogOptions)
Shows a text picker in the given settings. Shows a text picker in the given settings.
- TextPickerDialogOptions - TextPickerDialogOptions
| Name| Type| Mandatory| Default Value| Description| | Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| range | string[] | Yes| - | Data selection range of the picker.| | range | string[] | Yes | - | Data selection range of the picker. |
| selected | number | No| First element| Index value of the selected item in the range.| | selected | number | No | First element | Index value of the selected item in the range. |
| defaultPickerItemHeight | number | No| - | Height of the default selected item in the picker.| | defaultPickerItemHeight | number | No | - | Height of the default selected item in the picker. |
| onAccept | (value: TextPickerResult) => void | No| - | Triggered when the OK button in the dialog box is clicked.| | onAccept | (value: TextPickerResult) => void | No | - | Callback invoked when the OK button in the dialog box is clicked. |
| onCancel | () => void | No| - | Triggered when the Cancel button in the dialog box is clicked.| | onCancel | () => void | No | - | Triggered when the Cancel button in the dialog box is clicked. |
| onChange | (value: TextPickerResult) => void | No| - | Triggered when the selected item in the picker changes.| | onChange | (value: TextPickerResult) => void | No | - | Callback invoked when the selected item in the picker changes. |
- TextPickerResult - TextPickerResult
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| value | string | Text of the selected item.| | value | string | Text of the selected item. |
| index | number | Index value of the selected item in the range.| | index | number | Index value of the selected item in the range. |
## Example ## Example
......
# Time Picker Dialog Box # Time Picker Dialog Box
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
You can display a time picker in a dialog box to allow users to select a time from the given range, which is from 00:00 to 23:59 by default. You can display a time picker in a dialog box to allow users to select a time from the given range, which is from 00:00 to 23:59 by default.
...@@ -13,16 +13,16 @@ None ...@@ -13,16 +13,16 @@ None
show(options?: TimePickerDialogOptions) show(options?: TimePickerDialogOptions)
Defines and displays a time picker dialog box. Shows a time picker dialog box.
- options parameters - options parameters
| Name| Type| Mandatory| Default Value| Description| | Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| selected | Date | No| Current system time| Time of the selected item.| | selected | Date | No | Current system time | Time of the selected item. |
| useMilitaryTime | boolean | No| false | Whether to display time in 24-hour format.| | useMilitaryTime | boolean | No | false | Whether to display time in 24-hour format. |
| onAccept | (value: [TimePickerResult](ts-basic-components-timepicker.md#TimePickerResult)) => void | No| - | Triggered when the OK button in the dialog box is clicked.| | onAccept | (value: [TimePickerResult](ts-basic-components-timepicker.md#TimePickerResult)) => void | No | - | Callback invoked when the OK button in the dialog box is clicked. |
| onCancel | () => void | No| - | Triggered when the Cancel button in the dialog box is clicked.| | onCancel | () => void | No | - | Triggered when the Cancel button in the dialog box is clicked. |
| onChange | (value: [TimePickerResult](ts-basic-components-timepicker.md#TimePickerResult)) => void | No| - | Triggered when the selected item in the picker changes.| | onChange | (value: [TimePickerResult](ts-basic-components-timepicker.md#TimePickerResult)) => void | No | - | Callback invoked when the selected item in the picker changes. |
## Example ## Example
......
# Page Transition # Page Transition
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
Customize the page transition animations by configuring the page entrance and exit components in the global **pageTransition** method. Customize the page transition animations by configuring the page entrance and exit components in the global **pageTransition** method.
## APIs
| Name | Parameter | Description | | Name | Parameter | Description |
| -------- | -------- | -------- | | -------- | -------- | -------- |
...@@ -56,8 +57,8 @@ The PageTransitionEnter and PageTransitionExit components support the following ...@@ -56,8 +57,8 @@ The PageTransitionEnter and PageTransitionExit components support the following
| Event | Description | | Event | Description |
| -------- | -------- | | -------- | -------- |
| onEnter(type: RouteType, progress: number) =&gt; void | The callback input parameter is the normalized progress of the current entrance animation. The value range is 0–1. | | onEnter(type: RouteType, progress: number) =&gt; void | Callback invoked when page entrance occurs. The input parameter is the normalized progress of the current entrance animation. The value range is 0–1. |
| onExit(type: RouteType, progress: number) =&gt; void | The callback input parameter is the normalized progress of the current exit animation. The value range is 0–1. | | onExit(type: RouteType, progress: number) =&gt; void | Callback invoked when page exit occurs. The input parameter is the normalized progress of the current exit animation. The value range is 0–1. |
## Example ## Example
......
...@@ -23,11 +23,9 @@ Based on the unified user authentication framework, the system can be extended t ...@@ -23,11 +23,9 @@ Based on the unified user authentication framework, the system can be extended t
```undefined ```undefined
//base/user_iam //base/user_iam
├── auth_executor_mgr # Authentication executor management part, which supports unified authentication resource management and scheduling ├── user_auth_framework # User authentication framework, including user authentication, credential management and executor management
├── face_auth # Facial authentication module, which connects to the authentication executor management part and supports facial information recording, deletion, and verification ├── face_auth # Facial authentication module, which connects to the authentication executor management part and supports facial information recording, deletion, and verification
├── pin_auth # Password authentication module, which connects to the authentication executor management part and supports password recording, deletion, and verification ├── pin_auth # Password authentication module, which connects to the authentication executor management part and supports password recording, deletion, and verification
├── user_auth # Unified user authentication part
└── user_idm # User credential management part
``` ```
...@@ -45,12 +43,12 @@ Based on the unified user authentication framework, the system can be extended t ...@@ -45,12 +43,12 @@ Based on the unified user authentication framework, the system can be extended t
## Repositories Involved ## Repositories Involved
[useriam_auth_executor_mgr](https://gitee.com/openharmony/useriam_auth_executor_mgr) [useriam_user_auth_framework](https://gitee.com/openharmony/useriam_user_auth_framework)
[useriam_user_idm](https://gitee.com/openharmony/useriam_user_idm) [useriam_pin_auth](https://gitee.com/openharmony/useriam_pin_auth)
[useriam_user_auth](https://gitee.com/openharmony/useriam_user_auth) [useriam_face_auth](https://gitee.com/openharmony/useriam_face_auth)
[useriam_pin_auth](https://gitee.com/openharmony/useriam_pin_auth) [drivers_interface](https://gitee.com/openharmony/drivers_interface)
[useriam_faceauth](https://gitee.com/openharmony/useriam_faceauth) [drivers_peripheral](https://gitee.com/openharmony/drivers_peripheral)
\ No newline at end of file
...@@ -4,6 +4,28 @@ ...@@ -4,6 +4,28 @@
Data提供方可以自定义数据的增、删、改、查,以及文件打开等功能,并对外提供这些接口。 Data提供方可以自定义数据的增、删、改、查,以及文件打开等功能,并对外提供这些接口。
## URI介绍
Data的提供方和使用方都通过URI(Uniform Resource Identifier)来标识一个具体的数据,例如数据库中的某个表或磁盘上的某个文件。HarmonyOS的URI仍基于URI通用标准,格式如下:
![fa-dataability-uri](figures/fa-dataability-uri.png)
- scheme:协议方案名,固定为“dataability”,代表Data Ability所使用的协议类型。
- authority:设备ID。如果为跨设备场景,则为目标设备的ID;如果为本地设备场景,则不需要填写。
- path:资源的路径信息,代表特定资源的位置信息。
- query:查询参数。
- fragment:可以用于指示要访问的子资源。
URI示例:
- 跨设备场景:dataability://*device_id*/*com.domainname.dataability.persondata*/*person*/*10*
- 本地设备:dataability:///*com.domainname.dataability.persondata*/*person*/*10*
```
说明
本地设备的“device_id”字段为空,因此在“dataability:”后面有三个“/”。
```
## 接口说明 ## 接口说明
**表1** Data中相关生命周期API功能介绍 **表1** Data中相关生命周期API功能介绍
......
...@@ -8,13 +8,13 @@ Stage模型是区别于FA模型的一种应用开发模型,对此模型的介 ...@@ -8,13 +8,13 @@ Stage模型是区别于FA模型的一种应用开发模型,对此模型的介
- 应用迁移,详见[应用迁移开发指导](stage-ability-continuation.md) - 应用迁移,详见[应用迁移开发指导](stage-ability-continuation.md)
### 启动模式 ### 启动模式
ability支持单实例、多实例和指定实例3种启动模式,在module.json中通过launchType配置。启动模式对应Ability被启动时的行为,对启动模式的详细说明如下: Ability支持单实例、多实例和指定实例3种启动模式,在module.json中通过launchType配置。启动模式对应Ability被启动时的行为,对启动模式的详细说明如下:
| 启动模式 | 描述 |说明 | | 启动模式 | 描述 |说明 |
| ----------- | ------- |---------------- | | ----------- | ------- |---------------- |
| standard | 多实例 | 每次startAbility都会启动一个新的实例 | | standard | 多实例 | 每次startAbility都会启动一个新的实例 |
| singleton | 单实例 | 系统中只存在唯一一个实例,startAbility时,如果已存在,则复用系统中的唯一一个实例 | | singleton | 单实例 | 系统中只存在唯一一个实例,startAbility时,如果已存在,则复用系统中的唯一一个实例 |
| specified | 指定实例 | 运行时由ability内部业务决定是否创建多实例 | | specified | 指定实例 | 运行时由Ability内部业务决定是否创建多实例 |
缺省情况下是singleton模式,module.json示例如下: 缺省情况下是singleton模式,module.json示例如下:
```json ```json
...@@ -107,7 +107,7 @@ Ability功能如下(Ability类,具体的API详见[接口文档](../reference ...@@ -107,7 +107,7 @@ Ability功能如下(Ability类,具体的API详见[接口文档](../reference
} }
``` ```
### 获取AbilityStage及Ability的配置信息 ### 获取AbilityStage及Ability的配置信息
AbilityStage类及Ability类均拥有context属性,应用可以通过`this.context`获取Ability实例的上下文,进而获取详细的配置信息。如下示例展示了AbilityStage通过context属性获取包代码路径、hap包名、ability名以及系统语言的方法。具体示例代码如下: AbilityStage类及Ability类均拥有context属性,应用可以通过`this.context`获取Ability实例的上下文,进而获取详细的配置信息。如下示例展示了AbilityStage通过context属性获取包代码路径、hap包名、Ability名以及系统语言的方法。具体示例代码如下:
```ts ```ts
import AbilityStage from "@ohos.application.AbilityStage" import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage { export default class MyAbilityStage extends AbilityStage {
...@@ -126,7 +126,7 @@ export default class MyAbilityStage extends AbilityStage { ...@@ -126,7 +126,7 @@ export default class MyAbilityStage extends AbilityStage {
} }
``` ```
如下示例展示了Ability通过context属性获取包代码路径、hap包名、ability名以及系统语言的方法。具体示例代码如下: 如下示例展示了Ability通过context属性获取包代码路径、hap包名、Ability名以及系统语言的方法。具体示例代码如下:
```ts ```ts
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
......
...@@ -34,39 +34,51 @@ ...@@ -34,39 +34,51 @@
1. 获取设备上传感器的数据,需要在“config.json”里面进行配置请求权限。具体如下: 1. 获取设备上传感器的数据,需要在“config.json”里面进行配置请求权限。具体如下:
``` ```
”reqPermissions“:[ "reqPermissions": [
{ {
"name":"ohos.permission.ACCELEROMETER", "name": "ohos.permission.ACCELEROMETER",
"reason"":"", "reason": "",
"usedScene":{ "usedScene": {
"ability": ["sensor.index.MainAbility",".MainAbility"], "ability": [
"when":"inuse" "sensor.index.MainAbility",
".MainAbility"
],
"when": "inuse"
} }
}, },
{ {
"name":"ohos.permission.GYROSCOPE", "name": "ohos.permission.GYROSCOPE",
"reason"":"", "reason": "",
"usedScene":{ "usedScene": {
"ability": ["sensor.index.MainAbility",".MainAbility"], "ability": [
"when":"inuse" "sensor.index.MainAbility",
".MainAbility"
],
"when": "inuse"
} }
}, },
{ {
"name":"ohos.permission.ACTIVITY_MOTION", "name": "ohos.permission.ACTIVITY_MOTION",
"reason"":"ACTIVITY_MOTION_TEST", "reason": "ACTIVITY_MOTION_TEST",
"usedScene":{ "usedScene": {
"ability": ["sensor.index.MainAbility",".MainAbility"], "ability": [
"when":"inuse" "sensor.index.MainAbility",
".MainAbility"
],
"when": "inuse"
} }
}, },
{ {
"name":"ohos.permission.READ_HEALTH_DATA", "name": "ohos.permission.READ_HEALTH_DATA",
"reason"":"HEALTH_DATA_TEST", "reason": "HEALTH_DATA_TEST",
"usedScene":{ "usedScene": {
"ability": ["sensor.index.MainAbility",".MainAbility"], "ability": [
"when":"inuse" "sensor.index.MainAbility",
".MainAbility"
],
"when": "inuse"
}
} }
},
] ]
``` ```
......
# 传感器开发概述 # 传感器开发概述
OpenHarmony系统传感器是应用访问底层硬件传感器的一种设备抽象概念。开发者根据传感器提供的Sensor API,可以查询设备上的传感器,订阅传感器数据,并根据传感器数据定制相应的算法开发各类应用,比如指南针、运动健康、游戏等。 OpenHarmony系统传感器是应用访问底层硬件传感器的一种设备抽象概念。开发者根据传感器提供的[Sensor接口](../reference/apis/js-apis-sensor.md),可以查询设备上的传感器,订阅传感器数据,并根据传感器数据定制相应的算法开发各类应用,比如指南针、运动健康、游戏等。
传感器是指用于侦测环境中所发生事件或变化,并将此消息发送至其他电子设备(如中央处理器)的设备,通常由敏感组件和转换组件组成。传感器是实现物联网智能化的重要基石,为实现全场景智慧化战略,支撑“1+8+N”产品需求,需要构筑统一的传感器管理框架,达到为各产品/业务提供低时延、低功耗的感知数据的目的。下面为传感器列表: 传感器是指用于侦测环境中所发生事件或变化,并将此消息发送至其他电子设备(如中央处理器)的设备,通常由敏感组件和转换组件组成。传感器是实现物联网智能化的重要基石,为实现全场景智慧化战略,支撑“1+8+N”产品需求,需要构筑统一的传感器管理框架,达到为各产品/业务提供低时延、低功耗的感知数据的目的。下面为传感器列表:
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
当设备需要设置不同的振动效果时,可以调用Vibrator模块,例如:设备的按键可以设置不同强度和不同时长的振动,闹钟和来电可以设置不同强度和时长的单次或周期振动。 当设备需要设置不同的振动效果时,可以调用Vibrator模块,例如:设备的按键可以设置不同强度和不同时长的振动,闹钟和来电可以设置不同强度和时长的单次或周期振动。
详细的接口介绍请参考[Vibrator接口](../reference/apis/js-apis-vibrator.md)
## 接口说明 ## 接口说明
...@@ -61,12 +63,12 @@ ...@@ -61,12 +63,12 @@
``` ```
import vibrator from "@ohos.vibrator" import vibrator from "@ohos.vibrator"
vibrator.vibrate(1000).then((error)=>{ vibrator.vibrate(1000).then((error) => {
if(error){//调用失败,打印error.code和error.message if (error) { //调用失败,打印error.code和error.message
Console.log("Promise return failed.error.code"+error.code+"error.message"+error.message); Console.log("Promise return failed.error.code " + error.code + "error.message " + error.message);
}else{//调用成功,设备开始振动 } else { //调用成功,设备开始振动
Console.log("Promise returned to indicate a successful vibration.") Console.log("Promise returned to indicate a successful vibration.")
}; }
}) })
``` ```
...@@ -74,12 +76,12 @@ ...@@ -74,12 +76,12 @@
``` ```
import vibrator from "@ohos.vibrator" import vibrator from "@ohos.vibrator"
vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then((error)=>{ vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then((error) => {
if(error){//调用失败,打印error.code和error.message if (error) { //调用失败,打印error.code和error.message
Console.log("Promise return failed.error.code"+error.code+"error.message"+error.message); Console.log("Promise return failed.error.code " + error.code + "error.message " + error.message);
}else{//调用成功,设备停止振动 } else { //调用成功,设备停止振动
Console.log("Promise returned to indicate successful."); Console.log("Promise returned to indicate successful.");
}; }
}) })
``` ```
......
...@@ -292,8 +292,8 @@ ...@@ -292,8 +292,8 @@
另一种方法是使用开发者提供的Locale和格式化参数来创建相对时间格式化对象。其中,格式化参数是可选的,完整的参数列表参见[ RelativeTimeFormatInputOptions](../reference/apis/js-apis-intl.md)。 另一种方法是使用开发者提供的Locale和格式化参数来创建相对时间格式化对象。其中,格式化参数是可选的,完整的参数列表参见[ RelativeTimeFormatInputOptions](../reference/apis/js-apis-intl.md)。
```js ```
var relativeTimeFormat = new intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"}; var relativeTimeFormat = new intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"});
``` ```
2. 相对时间格式化。 2. 相对时间格式化。
......
...@@ -20,7 +20,7 @@ resources ...@@ -20,7 +20,7 @@ resources
| | |---string.json | | |---string.json
| |---media | |---media
| | |---icon.png | | |---icon.png
|---rawfile // 默认存在的目录 |---rawfile
``` ```
**表1** resources目录分类 **表1** resources目录分类
......
# full-SDK替换指南
**public-SDK**是提供给应用开发的工具包,跟随DevEco Studio下载,不包含系统应用所需要的高权限API
**full-SDK**是提供给OEM厂商开发应用的工具包,不能随DevEco Studio下载,包含了系统应用所需要的高权限API
三方开发者通过DevEco Studio自动下载的**API8版本**SDK均为**public版本**。public-SDK**不支持**开发者使用**所有的系统API**,包括animator组件、xcomponent组件、@ohos.application.abilityManager.d.ts、@ohos.application.formInfo.d.ts、@ohos.bluetooth.d.ts等,如工程必须依赖于系统API,请按照以下步骤替换**full-SDK**
## 下载full-SDK(这里以3.1.1 Release版本为例)
full-SDK需要手动下载。请参考[OpenHarmony 3.1.1 Release版本说明书](https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/OpenHarmony-v3.1.1-release.md)中的获取方式,获取所需的操作系统的full-SDK。
![image-20220613161049897](figures/zh-cn_image_0000001655128646.png)
## 查看本地SDK路径(此处以ets工程为例,1.0工程请以相同方式替换js-SDK)
打开DevEco Studio——>Tools——>OpenHarmony SDK Manager,查看本地SDK安装路径。
![](figures/zh-cn_image_0000001655128939.png)
![image-20220613160524053](figures/zh-cn_image_0000001655128998.png)
## 替换SDK
1. 确认下载的SDK版本是否为full-SDK
a.检查下载文件名是否包含full-SDK字样
![image-20220613220702504](figures/zh-cn_image_0000001655129232.png)
b.检查api中是否包含系统API(@ohos.application.abilityManager.d.ts、@ohos.application.formInfo.d.ts、@ohos.bluetooth.d.ts等)
注:系统api判定标准以发布api指导文档为主。
2. 替换SDK,以public-SDK-3.1.6.6版本为例。
以windows为例:
a.解压已下载的full-SDK文件:`ets-windows-3.1.6.5-Release.zip`
![image-20220613165018184](figures/zh-cn_image_0000001655129264.png)
b.替换SDK文件
**备份本地SDK**(复制并重命名ets目录下版本信息目录名,或者将ets目录拷贝至其他本地路径)
打开获取到的本地已安装SDK文件路径并进行备份。
![image-20220613161352157](figures/zh-cn_image_0000001655129041.png)
注:备份版本信息目录名称只要与其下`oh-uni-package.json`配置文件的version字段不一致即可,如下图所示,备份3.1.6.6版本sdk
![image-20220613165018184](figures/zh-cn_image_0000001655129398.png)
`oh-uni-package.json`文件配置信息如下:
```
{
"apiVersion": "8",
"displayName": "Ets",
"meta": {
"metaVersion": "3.0.0"
},
"path": "ets",
"releaseType": "Release",
"version": "3.1.6.6"
}
```
**删除原SDK(3.1.6.6)目录中的所有文件**(否则可能会导致文件无法全部覆盖)
**拷贝full-SDK至本地SDK路径**
将下载的full-SDK文件包中`ets`目录下的所有文件替换至本地SDK路径下`ets\3.1.6.6`目录中
修改`oh-uni-package.json`配置文件的version字段为当前SDK版本号
`3.1.6.6\build-tools\ets-loader`目录中打开cmd/powerShell窗口,输入命令`npm install`下载**node_modules**依赖包
![image-20220613171111405](figures/zh-cn_image_0000001655129333.png)
c.验证系统API接口
![image-20220613213038104](figures/zh-cn_image_0000001655129372.png)
\ No newline at end of file
...@@ -124,7 +124,7 @@ app实例: ...@@ -124,7 +124,7 @@ app实例:
"target": 5, "target": 5,
"releaseType": "Beta1" "releaseType": "Beta1"
} }
} }
``` ```
### deviceConfig对象的内部结构 ### deviceConfig对象的内部结构
...@@ -398,8 +398,7 @@ abilities示例: ...@@ -398,8 +398,7 @@ abilities示例:
"label": "$media:example", "label": "$media:example",
"launchType": "standard", "launchType": "standard",
"orientation": "unspecified", "orientation": "unspecified",
"permissions": [ "permissions": [],
],
"visible": true, "visible": true,
"skills": [ "skills": [
{ {
......
...@@ -620,18 +620,14 @@ form示例 : ...@@ -620,18 +620,14 @@ form示例 :
```json ```json
{ {
"extensionAbilities": [ "extensionAbilities": [{
{
"name": "MyForm", "name": "MyForm",
"type": "form", "type": "form",
"metadata": [ "metadata": [{
{
"name": "ohos.extability.form", "name": "ohos.extability.form",
"resource": "$profile:form_config", "resource": "$profile:form_config"
} }]
], }]
}
]
} }
``` ```
...@@ -656,19 +652,15 @@ metadata中指定shortcut信息,其中 : ...@@ -656,19 +652,15 @@ metadata中指定shortcut信息,其中 :
```json ```json
{ {
"shortcuts": [ "shortcuts": [{
{
"shortcutId": "id_test1", "shortcutId": "id_test1",
"label": "$string:shortcut", "label": "$string:shortcut",
"icon": "$media:aa_icon", "icon": "$media:aa_icon",
"wants": [ "wants": [{
{ "bundleName": "com.ohos.hello",
"bundleName": "com.ohos.hello"
"abilityName": "MainAbility" "abilityName": "MainAbility"
} }]
] }]
}
]
} }
``` ```
...@@ -678,23 +670,19 @@ metadata中指定shortcut信息,其中 : ...@@ -678,23 +670,19 @@ metadata中指定shortcut信息,其中 :
{ {
"module": { "module": {
"name": "MyAbilityStage", "name": "MyAbilityStage",
"abilities" : [ "abilities": [{
{ "name": "MyAbility",
"name" : "MyAbility",
"srcEntrance": "./abilities/MyAbility.ts", "srcEntrance": "./abilities/MyAbility.ts",
"skills": [{ "skills": [{
"actions": ["action.system.home"], "actions": ["action.system.home"],
"entities": ["entity.system.home"], "entities": ["entity.system.home"],
"uris": [] "uris": []
}], }],
"metadata": [ "metadata": [{
{
"name": "ohos.ability.shortcuts", "name": "ohos.ability.shortcuts",
"resource": "$profile:shortcuts_config", "resource": "$profile:shortcuts_config"
} }]
], }]
}
]
} }
} }
``` ```
...@@ -721,8 +709,7 @@ metadata中指定commonEvent信息,其中 : ...@@ -721,8 +709,7 @@ metadata中指定commonEvent信息,其中 :
```json ```json
{ {
"commonEvents": [ "commonEvents": [{
{
"name": "abilityName", "name": "abilityName",
"permission": "string", "permission": "string",
"types": [ "types": [
...@@ -733,8 +720,7 @@ metadata中指定commonEvent信息,其中 : ...@@ -733,8 +720,7 @@ metadata中指定commonEvent信息,其中 :
"string", "string",
"string" "string"
] ]
} }]
]
} }
``` ```
...@@ -746,12 +732,10 @@ metadata中指定commonEvent信息,其中 : ...@@ -746,12 +732,10 @@ metadata中指定commonEvent信息,其中 :
"name": "mySubscriber", "name": "mySubscriber",
"srcEntrance": "./extension/my_subscriber.js", "srcEntrance": "./extension/my_subscriber.js",
"type": "staticSubscriber", "type": "staticSubscriber",
"metadata": [ "metadata": [{
{
"name": "ohos.extability.staticSubscriber", "name": "ohos.extability.staticSubscriber",
"resource": "$profile:common_event_config", "resource": "$profile:common_event_config",
} }],
],
} }
] ]
``` ```
...@@ -816,15 +800,15 @@ distroFilter示例 : ...@@ -816,15 +800,15 @@ distroFilter示例 :
{ {
"apiVersion": { "apiVersion": {
"policy": "include", "policy": "include",
"value": [4,5] "value": [4, 5]
}, },
"screenShape": { "screenShape": {
"policy": "include", "policy": "include",
"value": ["circle","rect"] "value": ["circle", "rect"]
}, },
"screenWindow": { "screenWindow": {
"policy": "include", "policy": "include",
"value": ["454*454","466*466"] "value": ["454*454", "466*466"]
} }
} }
] ]
...@@ -838,15 +822,12 @@ distroFilter示例 : ...@@ -838,15 +822,12 @@ distroFilter示例 :
"name": "mySubscriber", "name": "mySubscriber",
"srcEntrance": "./extension/my_subscriber.js", "srcEntrance": "./extension/my_subscriber.js",
"type": "staticSubscriber", "type": "staticSubscriber",
"metadata": [ "metadata": [{
{
"name": "ohos.extability.staticSubscriber", "name": "ohos.extability.staticSubscriber",
"resource": "$profile:distroFilter_config", "resource": "$profile:distroFilter_config",
} }],
],
} }
] ]
``` ```
#### testRunner对象内部结构 #### testRunner对象内部结构
......
...@@ -81,6 +81,7 @@ ...@@ -81,6 +81,7 @@
- 图形图像 - 图形图像
- [@ohos.display (屏幕属性)](js-apis-display.md) - [@ohos.display (屏幕属性)](js-apis-display.md)
- [@ohos.effectKit (图像效果)](js-apis-effectKit.md)
- [@ohos.screenshot (屏幕截图)](js-apis-screenshot.md) - [@ohos.screenshot (屏幕截图)](js-apis-screenshot.md)
- [@ohos.window (窗口)](js-apis-window.md) - [@ohos.window (窗口)](js-apis-window.md)
- [webgl (WebGL)](js-apis-webgl.md) - [webgl (WebGL)](js-apis-webgl.md)
......
...@@ -832,7 +832,7 @@ getAbilityInfo(callback: AsyncCallback\<AbilityInfo>): void ...@@ -832,7 +832,7 @@ getAbilityInfo(callback: AsyncCallback\<AbilityInfo>): void
| 名称 | 类型 | 必填 | 描述 | | 名称 | 类型 | 必填 | 描述 |
| -------- | ---------------------- | ---- | ------------------------- | | -------- | ---------------------- | ---- | ------------------------- |
| callback | AsyncCallback\<[AbilityInfo](#abilityInfo)> | 是 | 回调函数,可以在回调函数中处理接口返回值,返回当前归属Ability详细信息。| | callback | AsyncCallback\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | 是 | 回调函数,可以在回调函数中处理接口返回值,返回当前归属Ability详细信息。|
**示例:** **示例:**
...@@ -860,7 +860,7 @@ getAbilityInfo(): Promise\<AbilityInfo> ...@@ -860,7 +860,7 @@ getAbilityInfo(): Promise\<AbilityInfo>
| 类型 | 说明 | | 类型 | 说明 |
| --------------- | ------------------------- | | --------------- | ------------------------- |
| Promise\<[AbilityInfo](#abilityInfo)> | 返回当前归属Ability详细信息。 | | Promise\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | 返回当前归属Ability详细信息。 |
**示例:** **示例:**
......
...@@ -20,11 +20,26 @@ import Want from '@ohos.application.Want'; ...@@ -20,11 +20,26 @@ import Want from '@ohos.application.Want';
| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | | ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
| deviceId | 只读 | string | 否 | 表示运行指定Ability的设备ID。 | | deviceId | 只读 | string | 否 | 表示运行指定Ability的设备ID。 |
| bundleName | 只读 | string | 否 | 表示包描述。如果在Want中同时指定了BundleName和AbilityName,则Want可以直接匹配到指定的Ability。 | | bundleName | 只读 | string | 否 | 表示包描述。如果在Want中同时指定了BundleName和AbilityName,则Want可以直接匹配到指定的Ability。 |
| abilityName | 只读 | string | 否 | 表示待启动的Ability名称。如果在Want中该字段同时指定了package和AbilityName,则Want可以直接匹配到指定的Ability。 | | abilityName | 只读 | string | 否 | 表示待启动的Ability名称。如果在Want中该字段同时指定了package和AbilityName,则Want可以直接匹配到指定的Ability。AbilityName需要在一个应用的范围内保证唯一。 |
| uri | 只读 | string | 否 | 表示Uri描述。如果在Want中指定了Uri,则Want将匹配指定的Uri信息,包括scheme, schemeSpecificPart, authority和path信息。 | | uri | 只读 | string | 否 | 表示Uri描述。如果在Want中指定了Uri,则Want将匹配指定的Uri信息,包括scheme, schemeSpecificPart, authority和path信息。 |
| type | 只读 | string | 否 | 表示MIME type类型描述,比如:"text/plain" 、 "image/*"等。 | | type | 只读 | string | 否 | 表示MIME type类型描述,比如:"text/plain" 、 "image/*"等。 |
| flags | 只读 | number | 否 | 表示处理Want的方式。默认传数字,具体参考:[flags说明](js-apis-featureAbility.md#flags说明)。 | | flags | 只读 | number | 否 | 表示处理Want的方式。默认传数字,具体参考:[flags说明](js-apis-featureAbility.md#flags说明)。 |
| action | 只读 | string | 否 | 表示action选项描述。 | | action | 只读 | string | 否 | 表示action选项描述。 |
| parameters | 只读 | {[key: string]: any} | 否 | 表示WantParams描述,由开发者自行决定传入的键值对。默认会携带以下key值:<br>ohos.aafwk.callerPid 表示拉起方的pid。<br>ohos.aafwk.param.callerToken 表示拉起方的token。<br>ohos.aafwk.param.callerUid 表示发起方的uid。[Bundle](js-apis-Bundle.js)模块中userId参数,可用于获取应用信息、包信息等,具体参考:[Bundle](js-apis-Bundle.js)。 | | parameters | 只读 | {[key: string]: any} | 否 | 表示WantParams描述,由开发者自行决定传入的键值对。默认会携带以下key值:<br>ohos.aafwk.callerPid 表示拉起方的pid。<br>ohos.aafwk.param.callerToken 表示拉起方的token。<br>ohos.aafwk.param.callerUid 表示发起方的uid。[Bundle](js-apis-Bundle.js)模块中userId参数,可用于获取应用信息、包信息等,具体参考:[Bundle](js-apis-Bundle.js)。 |
| entities | 只读 | Array\<string> | 否 | 表示entities相关描述。 | | entities | 只读 | Array\<string> | 否 | 表示entities相关描述。 |
| moduleName<sup>9+</sup> | 只读 | string | 否 | 表示待启动的Ability所属的模块(module)。同一应用的不同hap的组件可能重名,仅通过BundleName和AbilityName无法区分时,可以通过设置moduleName加以区分,以匹配到指定的Ability。 | | | moduleName<sup>9+</sup> | 只读 | string | 否 | 表示待启动的Ability所属的模块(module)。 |
**示例:**
``` js
var want = {
"deviceId": "", // deviceId为空表示本设备
"bundleName": "com.extreme.test",
"abilityName": "MainAbility",
"moduleName": "entry" // moduleName非必选
};
this.context.startAbility(want, (error) => {
// 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability
console.log("error.code = " + error.code)
})
```
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
该模块提供以下图像效果相关的常用功能: 该模块提供以下图像效果相关的常用功能:
- [Filter](#filter):效果链。 - [Filter](#filter):效果链。
- [Color](#color):颜色类,用于保存取色的结果。
- [ColorPicker](#colorpicker):智能取色器。 - [ColorPicker](#colorpicker):智能取色器。
> **说明:** > **说明:**
...@@ -52,7 +53,7 @@ image.createPixelMap(color, opts) ...@@ -52,7 +53,7 @@ image.createPixelMap(color, opts)
createColorPicker(source: image.PixelMap): Promise\<ColorPicker> createColorPicker(source: image.PixelMap): Promise\<ColorPicker>
通过属性创建PixelMap,使用Promise异步回调。 通过传入的PixelMap创建ColorPicker实例,使用Promise异步回调。
**系统能力:** SystemCapability.Multimedia.Image.Core **系统能力:** SystemCapability.Multimedia.Image.Core
...@@ -60,13 +61,13 @@ createColorPicker(source: image.PixelMap): Promise\<ColorPicker> ...@@ -60,13 +61,13 @@ createColorPicker(source: image.PixelMap): Promise\<ColorPicker>
| 名称 | 类型 | 必填 | 说明 | | 名称 | 类型 | 必填 | 说明 |
| -------- | ----------- | ---- | -------------------------- | | -------- | ----------- | ---- | -------------------------- |
| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例 | | source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ---------------------- | -------------- | | ---------------------- | -------------- |
| Promisse\<[ColorPicker](#colorpicker)> | Promise对象。返回当前创建的子窗口对象。 | | Promisse\<[ColorPicker](#colorpicker)> | Promise对象。返回创建的ColorPicker实例。 |
**示例:** **示例:**
...@@ -87,7 +88,7 @@ image.createPixelMap(color, opts, (pixelmap) => { ...@@ -87,7 +88,7 @@ image.createPixelMap(color, opts, (pixelmap) => {
createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>): void createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>): void
通过属性创建PixelMap,使用callback异步回调。 通过传入的PixelMap创建ColorPicker实例,使用callback异步回调。
**系统能力:** SystemCapability.Multimedia.Image.Core **系统能力:** SystemCapability.Multimedia.Image.Core
...@@ -95,8 +96,8 @@ createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>) ...@@ -95,8 +96,8 @@ createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>)
| 名称 | 类型 | 必填 | 说明 | | 名称 | 类型 | 必填 | 说明 |
| -------- | ------------------ | ---- | -------------------------- | | -------- | ------------------ | ---- | -------------------------- |
| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | BGRA_8888格式的颜色数组。 | | source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 |image模块创建的PixelMap实例。 |
| callback | AsyncCallback\<[ColorPicker](#colorpicker)> | 是 | 回调函数,返回ColorPicker。 | | callback | AsyncCallback\<[ColorPicker](#colorpicker)> | 是 | 回调函数。返回创建的ColorPicker实例。 |
**示例:** **示例:**
...@@ -107,9 +108,9 @@ let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } ...@@ -107,9 +108,9 @@ let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts, (pixelmap) => { image.createPixelMap(color, opts, (pixelmap) => {
effectKit.createColorPicker(pixelMap, (error, colorPicker) ) { effectKit.createColorPicker(pixelMap, (error, colorPicker) ) {
if(error) { if(error) {
console.log('create color picker failed.'); console.log('Failed to create color picker.');
} else { } else {
console.log('create color picker succeeded.'); console.log('Succeeded in creating color picker.');
} }
}) })
}) })
...@@ -144,16 +145,16 @@ getMainColor(): Promise\<Color> ...@@ -144,16 +145,16 @@ getMainColor(): Promise\<Color>
| 类型 | 说明 | | 类型 | 说明 |
| :------------- | :---------------------------------------------- | | :------------- | :---------------------------------------------- |
| Promise\<[Color](#color)> | Promise实例,用于获取结果,失败时返回错误信息。 | | Promise\<[Color](#color)> | Promise对象。返回图像主色对应的颜色值,失败时返回错误信息。 |
**示例:** **示例:**
```js ```js
colorPicker.getMainColor().then(color => { colorPicker.getMainColor().then(color => {
console.log('get main color succeeded.') console.log('Succeeded in getting main color.')
console.info("color[ARGB]=" + color.alpha "," + color.red + "," + color.green + "," + color.blue); console.info("color[ARGB]=" + color.alpha "," + color.red + "," + color.green + "," + color.blue);
}).catch(error => { }).catch(error => {
console.log('get main color failed.'); console.log('Failed to get main color.');
}) })
``` ```
...@@ -169,7 +170,7 @@ getMainColorSync(): Color ...@@ -169,7 +170,7 @@ getMainColorSync(): Color
| 类型 | 说明 | | 类型 | 说明 |
| :------- | :----------------------------------- | | :------- | :----------------------------------- |
| [Color](#color) | Color实例,用于获取结果,失败时返回null。 | | [Color](#color) | Color实例,即图像主色对应的颜色值,失败时返回null。 |
**示例:** **示例:**
...@@ -266,7 +267,7 @@ grayscale(): Filter ...@@ -266,7 +267,7 @@ grayscale(): Filter
| 类型 | 说明 | | 类型 | 说明 |
| :------------- | :---------------------------------------------- | | :------------- | :---------------------------------------------- |
| Filter | 返回效果链表头。 | | [Filter](#filter) | 返回效果链表头。 |
**示例:** **示例:**
......
...@@ -1333,7 +1333,7 @@ videoPlayer.setSpeed(speed).then() => { ...@@ -1333,7 +1333,7 @@ videoPlayer.setSpeed(speed).then() => {
selectBitrate(bitrate:number, callback: AsyncCallback\<number>): void selectBitrate(bitrate:number, callback: AsyncCallback\<number>): void
通过回调方式设置码率。 通过回调方式设置码率,通过[availableBitrateCollected](#on('availableBitrateCollected')<sup>9+</sup>)获取当前码流支持的Bitrate
**系统能力:** SystemCapability.Multimedia.Media.VideoPlayer **系统能力:** SystemCapability.Multimedia.Media.VideoPlayer
...@@ -1392,7 +1392,7 @@ videoPlayer.selectBitrate(bitrate).then() => { ...@@ -1392,7 +1392,7 @@ videoPlayer.selectBitrate(bitrate).then() => {
on(type: 'playbackCompleted', callback: Callback\<void>): void on(type: 'playbackCompleted', callback: Callback\<void>): void
开始监听视频播放完成事件,通过[availableBitrateCollected](#on('availableBitrateCollected')<sup>9+</sup>)获取当前码流支持的Bitrate 开始监听视频播放完成事件。
**系统能力:** SystemCapability.Multimedia.Media.VideoPlayer **系统能力:** SystemCapability.Multimedia.Media.VideoPlayer
...@@ -1521,7 +1521,7 @@ on(type: 'availableBitrateCollected', callback: (bitrates: Array<number>) => voi ...@@ -1521,7 +1521,7 @@ on(type: 'availableBitrateCollected', callback: (bitrates: Array<number>) => voi
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ------------------------------------------------------------ | | -------- | -------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 视频播放码率上报事件回调类型,支持的事件:'availableBitrateCollected',只在开始播放时候上报一次 | | type | string | 是 | 视频播放码率上报事件回调类型,支持的事件:'availableBitrateCollected',只在开始播放时候上报一次 |
| callback | function | 是 | 视频播放码率事件回调方法,使用Array数组存放支持的码率。 | | callback | function | 是 | 视频播放码率事件回调方法,使用数组存放支持的码率。 |
**示例:** **示例:**
...@@ -1875,7 +1875,7 @@ audioRecorder.prepare(); // pre ...@@ -1875,7 +1875,7 @@ audioRecorder.prepare(); // pre
## AudioOutputFormat<sup>(deprecated)</sup> ## AudioOutputFormat<sup>(deprecated)</sup>
> **说明:** > **说明:**
> 从 API Version 8 开始废弃,建议使用[ContainerFormatType ](#containerformattype8)替代。 > 从 API Version 8 开始废弃,建议使用[ContainerFormatType](#containerformattype8)替代。
表示音频封装格式的枚举。 表示音频封装格式的枚举。
......
# 上传下载 # 上传下载
request部件主要给应用提供上传下载文件、后台传输代理的基础能力。
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
...@@ -18,14 +19,16 @@ import request from '@ohos.request'; ...@@ -18,14 +19,16 @@ import request from '@ohos.request';
默认支持https,如果要支持http,需要在config.json里增加network标签,属性标识 "cleartextTraffic": true。即: 默认支持https,如果要支持http,需要在config.json里增加network标签,属性标识 "cleartextTraffic": true。即:
``` ```
var config = {
"deviceConfig": { "deviceConfig": {
"default": { "default": {
"network": { "network": {
"cleartextTraffic": true "cleartextTraffic": true
} }
... //...
} }
} }
}
``` ```
...@@ -470,7 +473,6 @@ on(type: 'progress', callback:(receivedSize: number, totalSize: number) =&gt; vo ...@@ -470,7 +473,6 @@ on(type: 'progress', callback:(receivedSize: number, totalSize: number) =&gt; vo
console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize); console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize);
} }
); );
});
``` ```
...@@ -505,7 +507,6 @@ off(type: 'progress', callback?: (receivedSize: number, totalSize: number) =&gt; ...@@ -505,7 +507,6 @@ off(type: 'progress', callback?: (receivedSize: number, totalSize: number) =&gt;
console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize); console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize);
} }
); );
});
``` ```
...@@ -533,7 +534,6 @@ on(type: 'complete'|'pause'|'remove', callback:() =&gt; void): void ...@@ -533,7 +534,6 @@ on(type: 'complete'|'pause'|'remove', callback:() =&gt; void): void
console.info('Download task completed.'); console.info('Download task completed.');
} }
); );
});
``` ```
...@@ -561,7 +561,6 @@ off(type: 'complete'|'pause'|'remove', callback?:() =&gt; void): void ...@@ -561,7 +561,6 @@ off(type: 'complete'|'pause'|'remove', callback?:() =&gt; void): void
console.info('Download task completed.'); console.info('Download task completed.');
} }
); );
});
``` ```
...@@ -595,7 +594,6 @@ on(type: 'fail', callback: (err: number) =&gt; void): void ...@@ -595,7 +594,6 @@ on(type: 'fail', callback: (err: number) =&gt; void): void
console.info('Download task failed. Cause:' + err); console.info('Download task failed. Cause:' + err);
} }
); );
});
``` ```
...@@ -629,7 +627,6 @@ off(type: 'fail', callback?: (err: number) =&gt; void): void ...@@ -629,7 +627,6 @@ off(type: 'fail', callback?: (err: number) =&gt; void): void
console.info('Download task failed. Cause:' + err); console.info('Download task failed. Cause:' + err);
} }
); );
});
``` ```
......
...@@ -27,6 +27,7 @@ push(options: RouterOptions): void ...@@ -27,6 +27,7 @@ push(options: RouterOptions): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| options | [RouterOptions](#routeroptions) | 是 | 跳转页面描述信息。 | | options | [RouterOptions](#routeroptions) | 是 | 跳转页面描述信息。 |
| mode<sup>9+</sup> | [RouterMode](#routermode9) | 否 | 跳转页面使用的模式。 |
**示例:** **示例:**
...@@ -75,6 +76,7 @@ replace(options: RouterOptions): void ...@@ -75,6 +76,7 @@ replace(options: RouterOptions): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| options | [RouterOptions](#routeroptions) | 是 | 替换页面描述信息。 | | options | [RouterOptions](#routeroptions) | 是 | 替换页面描述信息。 |
| mode<sup>9+</sup> | [RouterMode](#routermode9) | 否 | 跳转页面使用的模式。 |
**示例:** **示例:**
...@@ -87,7 +89,7 @@ replace(options: RouterOptions): void ...@@ -87,7 +89,7 @@ replace(options: RouterOptions): void
params: { params: {
data1: 'message', data1: 'message',
}, },
}); }, router.RouterMode.Standard);
} }
} }
``` ```
...@@ -436,3 +438,13 @@ getParams(): Object ...@@ -436,3 +438,13 @@ getParams(): Object
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 页面路由栈支持的最大Page数量为32。 > 页面路由栈支持的最大Page数量为32。
## RouterMode<sup>9+</sup>
路由跳转模式。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Lite。
| 名称 | 描述 |
| -------- | -------- |
| Standard | 标准模式。 |
| Single | 单实例模式。<br/>如果目标页面的url在页面栈中已经存在同url页面,离栈顶最近的页面会被移动到栈顶,移动后的页面为新建页。<br/>如目标页面的url在页面栈中不存在同url页面,按标准模式跳转。 |
...@@ -202,6 +202,8 @@ onReconnect(want: Want): void; ...@@ -202,6 +202,8 @@ onReconnect(want: Want): void;
onConfigurationUpdated(config: Configuration): void; onConfigurationUpdated(config: Configuration): void;
当Extension更新配置信息时调用。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core **系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**系统API**: 此接口为系统接口,三方应用不支持调用。 **系统API**: 此接口为系统接口,三方应用不支持调用。
......
...@@ -1001,6 +1001,54 @@ async function demo() { ...@@ -1001,6 +1001,54 @@ async function demo() {
} }
``` ```
### pinchOut<sup>9+</sup>
pinchOut(scale: number): Promise\<void>
将控件按指定的比例进行捏合放大。
**系统能力**:SystemCapability.Test.UiTest
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------- | ---- | ---------- |
| scale | number | 是 | 指定比例 |
**示例:**
```js
async function demo() {
let driver = UiDriver.create()
let image = await driver.findComponent(BY.type('image'))
await image.pinchOut(1.5)
}
```
### pinchIn<sup>9+</sup>
pinchIn(scale: number): Promise\<void>
将控件按指定的比例进行捏合缩小。
**系统能力**:SystemCapability.Test.UiTest
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------- | ---- | ---------- |
| scale | number | 是 | 指定比例 |
**示例:**
```js
async function demo() {
let driver = UiDriver.create()
let image = await driver.findComponent(BY.type('image'))
await image.pinchIn(0.5)
}
```
## UiDriver ## UiDriver
UiDriver类为uitest测试框架的总入口,提供控件匹配/查找,按键注入,坐标点击/滑动,截图等API。 UiDriver类为uitest测试框架的总入口,提供控件匹配/查找,按键注入,坐标点击/滑动,截图等API。
...@@ -1231,6 +1279,32 @@ async function demo() { ...@@ -1231,6 +1279,32 @@ async function demo() {
} }
``` ```
### triggerCombineKeys<sup>9+</sup>
triggerCombineKeys(key0: number, key1: number, key2: number): Promise\<void>
UiDriver对象通过给定的key值,找到对应组合键并点击。例如,Key值为(2072, 2019)时,UiDriver对象找到组合键并点击ctrl+c。
**系统能力**:SystemCapability.Test.UiTest
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ------------------- |
| key0 | number | 是 | 指定的第一个key值。 |
| key1 | number | 是 | 指定的第二个key值。 |
| key2 | number | 否 | 指定的第三个key值。 |
**示例:**
```js
async function demo() {
let driver = UiDriver.create()
await driver.triggerCombineKeys(2072, 2047, 2035)
}
```
### click ### click
click(x: number, y: number): Promise\<void> click(x: number, y: number): Promise\<void>
......
# USB管理 # USB管理
本模块主要提供管理USB设备的相关功能,包括查询USB设备列表、批量数据传输、控制命令传输、权限控制等。
> **说明:** > **说明:**
>
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块 ## 导入模块
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
| 名称 | 类型定义 | 描述 | | 名称 | 类型定义 | 描述 |
| ----- | --------------------- | ---------------------------------------- | | ----- | --------------------- | ---------------------------------------- |
| color | string&nbsp;\|颜色枚举字符串 | 用于描述颜色信息,JS脚本中不支持颜色枚举格式。<br/>字符串格式如下:<br/>-&nbsp;'rgb(255,&nbsp;255,&nbsp;255)'<br/>-&nbsp;'rgba(255,&nbsp;255,&nbsp;255,&nbsp;1.0)'<br/>-&nbsp;HEX格式:'\#rrggbb','\#aarrggbb'<br/>-&nbsp;枚举格式:'black','white'。 | | color | string&nbsp;\|&nbsp;颜色枚举字符串 | 用于描述颜色信息,JS脚本中不支持颜色枚举格式。<br/>字符串格式如下:<br/>-&nbsp;'rgb(255,&nbsp;255,&nbsp;255)'<br/>-&nbsp;'rgba(255,&nbsp;255,&nbsp;255,&nbsp;1.0)'<br/>-&nbsp;HEX格式:'\#rrggbb','\#aarrggbb'<br/>-&nbsp;枚举格式:'black','white'。 |
**表1** 当前支持的颜色枚举 **表1** 当前支持的颜色枚举
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
| 名称 | 类型 | 默认值 | 必填 | 描述 | | 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------------------------------- | -------------- | ---------- | ---- | ---------------------------------------- | | -------------------------------- | -------------- | ---------- | ---- | ---------------------------------------- |
| color | &lt;color&gt | \#ffffff | 否 | 候选项字体颜色。 | | color | &lt;color&gt; | \#ffffff | 否 | 候选项字体颜色。 |
| font-size | &lt;length&gt; | 16px | 否 | 候选项字体尺寸,类型length,单位px。 | | font-size | &lt;length&gt; | 16px | 否 | 候选项字体尺寸,类型length,单位px。 |
| selected-color | &lt;color&gt; | #ff0a69f7 | 否 | 选中项字体颜色。 | | selected-color | &lt;color&gt; | #ff0a69f7 | 否 | 选中项字体颜色。 |
| selected-font-size | &lt;length&gt; | 20px | 否 | 选中项字体尺寸,类型length,单位px。 | | selected-font-size | &lt;length&gt; | 20px | 否 | 选中项字体尺寸,类型length,单位px。 |
......
...@@ -30,7 +30,7 @@ Checkbox( name?: string, group?: string ) ...@@ -30,7 +30,7 @@ Checkbox( name?: string, group?: string )
| 名称 | 参数类型 | 默认值 | 描述 | | 名称 | 参数类型 | 默认值 | 描述 |
| ------------- | ------- | ------ | -------- | | ------------- | ------- | ------ | -------- |
| select | bool | false | 设置多选框是否选中。 | | select | boolean | false | 设置多选框是否选中。 |
| selectedColor | Color | - | 设置多选框选中状态颜色。 | | selectedColor | Color | - | 设置多选框选中状态颜色。 |
## 事件 ## 事件
......
...@@ -29,7 +29,7 @@ CheckboxGroup( group?: string ) ...@@ -29,7 +29,7 @@ CheckboxGroup( group?: string )
| 名称 | 参数类型 | 默认值 | 描述 | | 名称 | 参数类型 | 默认值 | 描述 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| selectAll | bool | false | 设置是否全选。 | | selectAll | boolean | false | 设置是否全选。 |
| selectedColor | Color | - | 设置被选中或部分选中状态的颜色。 | | selectedColor | Color | - | 设置被选中或部分选中状态的颜色。 |
## 事件 ## 事件
......
...@@ -166,8 +166,6 @@ struct ImageExample1 { ...@@ -166,8 +166,6 @@ struct ImageExample1 {
@Entry @Entry
@Component @Component
struct ImageExample2 { struct ImageExample2 {
@State width: number = 100
@State height: number = 100
build() { build() {
Column({ space: 10 }) { Column({ space: 10 }) {
......
...@@ -29,7 +29,7 @@ Navigation() ...@@ -29,7 +29,7 @@ Navigation()
| 名称 | 参数类型 | 默认值 | 描述 | | 名称 | 参数类型 | 默认值 | 描述 |
| -------------- | ---------------------------------------- | ------------------------ | ---------------------------------------- | | -------------- | ---------------------------------------- | ------------------------ | ---------------------------------------- |
| title | string&nbsp;\|&nbsp;[CustomBuilder](../../ui/ts-types.md) | - | 页面标题。 | | title | string&nbsp;\|&nbsp;[CustomBuilder](../../ui/ts-types.md) | - | 页面标题。 |
| subtitle | string | - | 页面副标题。 | | subTitle | string | - | 页面副标题。 |
| menus | Array<NavigationMenuItem&gt;&nbsp;\|&nbsp;[CustomBuilder](../../ui/ts-types.md) | - | 页面右上角菜单。 | | menus | Array<NavigationMenuItem&gt;&nbsp;\|&nbsp;[CustomBuilder](../../ui/ts-types.md) | - | 页面右上角菜单。 |
| titleMode | NavigationTitleMode | NavigationTitleMode.Free | 页面标题栏显示模式。 | | titleMode | NavigationTitleMode | NavigationTitleMode.Free | 页面标题栏显示模式。 |
| toolBar | {<br/>items:[<br/>Object<br/>]&nbsp;}<br/>\|&nbsp;[CustomBuilder](../../ui/ts-types.md) | - | 设置工具栏内容。<br/>items:&nbsp;工具栏所有项。 | | toolBar | {<br/>items:[<br/>Object<br/>]&nbsp;}<br/>\|&nbsp;[CustomBuilder](../../ui/ts-types.md) | - | 设置工具栏内容。<br/>items:&nbsp;工具栏所有项。 |
......
# PatternLock # PatternLock
> **说明:** 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
图案密码锁组件,以宫格图案的方式输入密码,用于密码验证。手指触碰图案密码锁时开始进入输入状态,手指离开屏幕时结束输入状态并向应用返回输入的密码。 图案密码锁组件,以宫格图案的方式输入密码,用于密码验证。手指触碰图案密码锁时开始进入输入状态,手指离开屏幕时结束输入状态并向应用返回输入的密码。
> **说明:**
>
> 该组件从API Version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
## 权限列表 ## 权限列表
......
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
> **说明:** > **说明:**
> - 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
> >
> - 本组件均为系统接口,三方应用不支持调用。 > - 该组件从API Version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
>
> - 本组件为系统接口。
提供外部应用组件嵌入式显示功能,即外部应用提供的UI可在本应用内显示。 提供外部应用组件嵌入式显示功能,即外部应用提供的UI可在本应用内显示。
......
...@@ -52,11 +52,11 @@ Search(options?: { value?: string; placeholder?: string; icon?: string; controll ...@@ -52,11 +52,11 @@ Search(options?: { value?: string; placeholder?: string; icon?: string; controll
Search组件的控制器,通过它操作Search组件。 Search组件的控制器,通过它操作Search组件。
#### 导入对象 ### 导入对象
``` ```
controller: SearchController = new SearchController() controller: SearchController = new SearchController()
``` ```
#### caretPosition ### caretPosition
caretPosition(value: number): void caretPosition(value: number): void
......
...@@ -32,7 +32,7 @@ Grid() ...@@ -32,7 +32,7 @@ Grid()
| columnsGap | Length | 0 | 用于设置列与列的间距。 | | columnsGap | Length | 0 | 用于设置列与列的间距。 |
| rowsGap | Length | 0 | 用于设置行与行的间距。 | | rowsGap | Length | 0 | 用于设置行与行的间距。 |
| editMode<font color=ff0000><sup>8+</sup></font> | boolean | flase | 是否进入编辑模式,进入编辑模式可以拖拽Gird组件内部[GridItem](ts-container-griditem.md)。 | | editMode<font color=ff0000><sup>8+</sup></font> | boolean | flase | 是否进入编辑模式,进入编辑模式可以拖拽Gird组件内部[GridItem](ts-container-griditem.md)。 |
| layoutDirection<font color=ff0000><sup>8+</sup></font> | [LayoutDirection](ts-appendix-enums.md) | LayoutDirection.Row |设置布局的主轴方向,目前支持的主轴布局方向如下:<br/>-&nbsp;LayoutDirection.Row:沿水平方向布局,即先填满一列,再去填下一列。 <br/>-&nbsp;LayoutDirection.Column:沿垂直方向布局,即先填满一行,再去填下一行。| | layoutDirection<font color=ff0000><sup>8+</sup></font> | number | 0 |设置布局的主轴方向,目前支持的主轴布局方向如下:<br/>-&nbsp;0:主轴布局方向沿水平方向布局,即先填满一列,再去填下一列。 <br/>-&nbsp;1:主轴布局方向沿垂直方向布局,即先填满一行,再去填下一行。|
| maxCount<font color=ff0000><sup>8+</sup></font> | number | 1 | 当layoutDirection是Row时,表示可显示的最大行数<br/>当layoutDirection是Column时,表示可显示的最大列数。 | | maxCount<font color=ff0000><sup>8+</sup></font> | number | 1 | 当layoutDirection是Row时,表示可显示的最大行数<br/>当layoutDirection是Column时,表示可显示的最大列数。 |
| minCount<font color=ff0000><sup>8+</sup></font> | number | 1 | 当layoutDirection是Row时,表示可显示的最小行数<br/>当layoutDirection是Column时,表示可显示的最小列数。 | | minCount<font color=ff0000><sup>8+</sup></font> | number | 1 | 当layoutDirection是Row时,表示可显示的最小行数<br/>当layoutDirection是Column时,表示可显示的最小列数。 |
| cellLength<font color=ff0000><sup>8+</sup></font> | number | 0 | 当layoutDirection是Row时,表示一行的高度<br/>当layoutDirection是Column时,表示一列的宽度。 | | cellLength<font color=ff0000><sup>8+</sup></font> | number | 0 | 当layoutDirection是Row时,表示一行的高度<br/>当layoutDirection是Column时,表示一列的宽度。 |
......
...@@ -19,13 +19,14 @@ ...@@ -19,13 +19,14 @@
## 接口 ## 接口
List(value:{space?: number, initialIndex?: number}) List(value:{space?: number | string, initialIndex?: number, scroller?: Scroller})
- 参数 - 参数
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| space | number | 否 | 0 | 列表项间距。 | | space | number&nbsp;\|&nbsp;string | 否 | 0 | 列表项间距。 |
| initialIndex | number | 否 | 0 | 设置当前List初次加载时视口起始位置显示的item,即显示第一个item,如设置的序号超过了最后一个item的序号,则设置不生效。 | | initialIndex | number | 否 | 0 | 设置当前List初次加载时视口起始位置显示的item,即显示第一个item,如设置的序号超过了最后一个item的序号,则设置不生效。 |
| scroller | [Scroller](ts-container-scroll.md#scroller) | 是 | - | 可滚动组件的控制器。用于与可滚动组件进行绑定。 |
## 属性 ## 属性
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
## 接口 ## 接口
Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number\}\) Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number | string\}\)
- 参数 - 参数
...@@ -23,7 +23,7 @@ Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number\}\) ...@@ -23,7 +23,7 @@ Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number\}\)
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| refreshing | boolean | 是 | - | 当前组件是否正在刷新。 | | refreshing | boolean | 是 | - | 当前组件是否正在刷新。 |
| offset | Length | 否 | 16 | 刷新组件静止时距离父组件顶部的距离。| | offset | Length | 否 | 16 | 刷新组件静止时距离父组件顶部的距离。|
| friction | number | 否 | 62 | 下拉摩擦系数,取值范围为0到100。<br/>-&nbsp;0表示下拉刷新容器不跟随手势下拉而下拉。<br/>-&nbsp;100表示下拉刷新容器紧紧跟随手势下拉而下拉。<br/>-&nbsp;数值越大,下拉刷新容器跟随手势下拉的反应越灵敏。 | | friction | number&nbsp;\|&nbsp;string | 否 | 62 | 下拉摩擦系数,取值范围为0到100。<br/>-&nbsp;0表示下拉刷新容器不跟随手势下拉而下拉。<br/>-&nbsp;100表示下拉刷新容器紧紧跟随手势下拉而下拉。<br/>-&nbsp;数值越大,下拉刷新容器跟随手势下拉的反应越灵敏。 |
......
...@@ -45,7 +45,7 @@ Tabs(value: {barPosition?: BarPosition, index?: number, controller?: [TabsContro ...@@ -45,7 +45,7 @@ Tabs(value: {barPosition?: BarPosition, index?: number, controller?: [TabsContro
| scrollable | boolean | 是否可以通过左右滑动进行页面切换,默认为true。 | 是否可以通过左右滑动进行页面切换,默认为true。 | | scrollable | boolean | 是否可以通过左右滑动进行页面切换,默认为true。 | 是否可以通过左右滑动进行页面切换,默认为true。 |
| barMode | BarMode | TabBar布局模式。 | TabBar布局模式。 | | barMode | BarMode | TabBar布局模式。 | TabBar布局模式。 |
| barWidth | number | TabBar的宽度值,不设置时使用系统主题中的默认值。 | TabBar的宽度值,不设置时使用系统主题中的默认值。 | | barWidth | number | TabBar的宽度值,不设置时使用系统主题中的默认值。 | TabBar的宽度值,不设置时使用系统主题中的默认值。 |
| barHeight | number | TabBar的高度值,不设置时使用系统主题中的默认值。 | TabBar的高度值,不设置时使用系统主题中的默认值**。** | | barHeight | number | TabBar的高度值,不设置时使用系统主题中的默认值。 | TabBar的高度值,不设置时使用系统主题中的默认值 |
| animationDuration | number | 200 | TabContent滑动动画时长。 | | animationDuration | number | 200 | TabContent滑动动画时长。 |
- BarMode枚举说明 - BarMode枚举说明
......
...@@ -166,7 +166,6 @@ struct VideoCreateComponent { ...@@ -166,7 +166,6 @@ struct VideoCreateComponent {
@State autoPlays: boolean = false; @State autoPlays: boolean = false;
@State controlsss: boolean = true; @State controlsss: boolean = true;
controller: VideoController = new VideoController(); controller: VideoController = new VideoController();
@State startStaus: boolean = true;
build() { build() {
Column() { Column() {
Video({ Video({
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
- paramObject2参数 - paramObject2参数
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| title | string&nbsp;\|&&nbsp;[Resource](../../ui/ts-types.md#resource类型) | 否 | - | 弹窗标题。 | | title | string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型) | 否 | - | 弹窗标题。 |
| message | string&nbsp;\|&&nbsp;[Resource](../../ui/ts-types.md#resource类型) | 是 | - | 弹窗内容。 | | message | string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型) | 是 | - | 弹窗内容。 |
| autoCancel | boolean | 否 | true | 点击遮障层时,是否关闭弹窗。 | | autoCancel | boolean | 否 | true | 点击遮障层时,是否关闭弹窗。 |
| primaryButton | {<br/>value:&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>fontColor?:&nbsp;Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>backgroundColor?:&nbsp;Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>action:&nbsp;()&nbsp;=&gt;&nbsp;void;<br/>} | 否 | - | 按钮的文本内容、文本色、按钮背景色和点击回调。 | | primaryButton | {<br/>value:&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>fontColor?:&nbsp;Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>backgroundColor?:&nbsp;Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>action:&nbsp;()&nbsp;=&gt;&nbsp;void;<br/>} | 否 | - | 按钮的文本内容、文本色、按钮背景色和点击回调。 |
| secondaryButton | {<br/>value:&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>fontColor?:&nbsp;Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>backgroundColor?:&nbsp;Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>action:&nbsp;()&nbsp;=&gt;&nbsp;void;<br/>} | 否 | - | 按钮的文本内容、文本色、按钮背景色和点击回调。 | | secondaryButton | {<br/>value:&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>fontColor?:&nbsp;Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>backgroundColor?:&nbsp;Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>action:&nbsp;()&nbsp;=&gt;&nbsp;void;<br/>} | 否 | - | 按钮的文本内容、文本色、按钮背景色和点击回调。 |
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
@Entry @Entry
@Component @Component
struct MotionPathExample { struct MotionPathExample {
@State offsetX: number = 0
@State offsetY: number = 0
@State toggle: boolean = true @State toggle: boolean = true
build() { build() {
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
@Entry @Entry
@Component @Component
struct SharedTransitionExample { struct SharedTransitionExample {
@State scale: number = 1
@State opacity: number = 1
@State active: boolean = false @State active: boolean = false
build() { build() {
......
# 边框设置 # 边框设置
> **说明:** > **说明:**
> 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。<br> >
> 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
>
> 从API Version 9开始,父节点的border显示在子节点内容之上。 > 从API Version 9开始,父节点的border显示在子节点内容之上。
...@@ -18,12 +20,20 @@ ...@@ -18,12 +20,20 @@
| 名称 | 参数类型 | 默认值 | 描述 | | 名称 | 参数类型 | 默认值 | 描述 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| border | {<br/>width?:&nbsp;Length,<br/>color?:&nbsp;Color,<br/>radius?:&nbsp;Length,<br/>style?:&nbsp;BorderStyle<br/>} | - | 统一边框样式设置接口。 | | border | BorderOptions | - | 统一边框样式设置接口。 |
| borderStyle | BorderStyle | &nbsp;BorderStyle.Solid | 设置元素的边框样式。 | | borderStyle | BorderStyle | &nbsp;BorderStyle.Solid | 设置元素的边框样式。 |
| borderWidth | Length | 0 | 设置元素的边框宽度。 | | borderWidth | Length | 0 | 设置元素的边框宽度。 |
| borderColor | Color | - | 设置元素的边框颜色。 | | borderColor | Color | - | 设置元素的边框颜色。 |
| borderRadius | Length | 0 | 设置元素的边框圆角半径。 | | borderRadius | Length | 0 | 设置元素的边框圆角半径。 |
- BorderOptions属性说明
| 参数名称 | 参数类型 | 默认值 | 必填 | 参数描述 |
| -------- | -------- | -------- | -------- | -------- |
| width | [Length](../../ui/ts-types.md#长度类型) | 0 | 否 | 边框宽度。 |
| color | [ResourceColor](../../ui/ts-types.md) | 'Black' | 否 | 边框颜色。 |
| radius | [Length](../../ui/ts-types.md#长度类型) | 0 | 否 | 边框角度。 |
| style | BorderStyle | BorderStyle.Solid | 否 | 边框样式。 |
- BorderStyle枚举说明 - BorderStyle枚举说明
| 名称 | 描述 | | 名称 | 描述 |
......
...@@ -171,17 +171,17 @@ struct IdExample { ...@@ -171,17 +171,17 @@ struct IdExample {
console.info(getInspectorTree()) console.info(getInspectorTree())
this.text = "Button 'click to start' is clicked" this.text = "Button 'click to start' is clicked"
setTimeout(() => { setTimeout(() => {
sendEventByKey("longclick", 11, "") sendEventByKey("longClick", 11, "")
}, 2000) }, 2000)
}).id('click') }).id('click')
Button() { Button() {
Text('longclick').fontSize(25).fontWeight(FontWeight.Bold) Text('longClick').fontSize(25).fontWeight(FontWeight.Bold)
}.margin({ top: 20 }).backgroundColor('#0D9FFB') }.margin({ top: 20 }).backgroundColor('#0D9FFB')
.gesture( .gesture(
LongPressGesture().onActionEnd(() => { LongPressGesture().onActionEnd(() => {
console.info('long clicked') console.info('long clicked')
this.text = "Button 'longclick' is longclicked" this.text = "Button 'longClick' is longclicked"
setTimeout(() => { setTimeout(() => {
let rect = Utils.getComponentRect('onTouch') let rect = Utils.getComponentRect('onTouch')
let touchPoint: TouchObject = { let touchPoint: TouchObject = {
...@@ -196,7 +196,7 @@ struct IdExample { ...@@ -196,7 +196,7 @@ struct IdExample {
touchPoint.type = TouchType.Up touchPoint.type = TouchType.Up
sendTouchEvent(touchPoint) sendTouchEvent(touchPoint)
}, 2000) }, 2000)
})).id('longclick') })).id('longClick')
Button() { Button() {
Text('onTouch').fontSize(25).fontWeight(FontWeight.Bold) Text('onTouch').fontSize(25).fontWeight(FontWeight.Bold)
......
...@@ -38,7 +38,6 @@ struct DragExample { ...@@ -38,7 +38,6 @@ struct DragExample {
@State text: string = '' @State text: string = ''
@State bool: boolean = false @State bool: boolean = false
@State bool1: boolean = false @State bool1: boolean = false
@State size: string = ''
@State appleVisible: Visibility = Visibility.Visible @State appleVisible: Visibility = Visibility.Visible
@State orangeVisible: Visibility = Visibility.Visible @State orangeVisible: Visibility = Visibility.Visible
@State bananaVisible: Visibility = Visibility.Visible @State bananaVisible: Visibility = Visibility.Visible
......
...@@ -23,7 +23,7 @@ struct CountDownTimerComponent { ...@@ -23,7 +23,7 @@ struct CountDownTimerComponent {
@State countDownFrom: number = 10 @State countDownFrom: number = 10
private timerId: number = -1 private timerId: number = -1
private aboutToAppear(): void { aboutToAppear(): void {
this.timerId = setInterval(() => { this.timerId = setInterval(() => {
if (this.countDownFrom <= 1) { if (this.countDownFrom <= 1) {
clearTimeout(this.timerId) clearTimeout(this.timerId)
...@@ -32,7 +32,7 @@ struct CountDownTimerComponent { ...@@ -32,7 +32,7 @@ struct CountDownTimerComponent {
}, 1000) // decr counter by 1 every second }, 1000) // decr counter by 1 every second
} }
private aboutToDisappear(): void { aboutToDisappear(): void {
if (this.timerId > 0) { if (this.timerId > 0) {
clearTimeout(this.timerId) clearTimeout(this.timerId)
this.timerId = -1 this.timerId = -1
......
# 概述
## 基本概念
*【 **写作要求**】*
*必选,描述本开发任务相关的基本概念,帮助开发者更好的理解开发任务。* *写作要求见下,完成写作后,请逐项自检*
| 内容要求 | 是否满足 |
| -------- | -------- |
| 业界通用的概念不用赘述。 | |
| 注意使用业界通用术语来表达,不用开发者无法理解的内部语言。 | |
【写作样例】
XX系统音频模块支持音频业务的开发,提供音频相关的功能,主要包括音频播放、音频采集、音量管理和短音播放等。
在进行应用的开发前,开发者应了解以下基本概念:
- 采样
采样就是把模拟信号数字化的过程,所有的模拟信号都需要通过采样转换为可以用0101来表示的数字信号。
- 采样率
采样率为每秒从连续信号中提取并组成离散信号的采样次数,单位用赫兹(Hz)来表示。通常人耳能听到频率范围大约在20Hz~20kHz之间的声音。常用的音频采样频率有:8kHz、11.025kHz、22.05kHz、16kHz、37.8kHz、44.1kHz、48kHz、96kHz、192kHz等。
- 声道
声道是指声音在录制或播放时在不同空间位置采集或回放的相互独立的音频信号,所以声道数也就是声音录制时的音源数量或回放时相应的扬声器数量。
- 音频帧
音频数据是流式的,本身没有明确的一帧帧的概念,在实际的应用中,为了音频算法处理/传输的方便,一般约定俗成取2.5ms~60ms为单位的数据量为一帧音频。这个时间被称之为“采样时间”,其长度没有特别的标准,它是根据编解码器和具体应用的需求来决定的。
## 运作机制
*【 **写作要求**】*
*可选。如果机制比较简单,通过前面基本概念就可以说清楚,此章节可以不用提供,删除标题即可*
*描述实现原理介绍机制,如关键步骤相关接口调用时机和触发时机,帮助开发者了解该功能的基本运作原理,以便更好的理解开发任务和定位问题*
*写作要求见下,完成写作后,请逐项自检*
| 内容要求 | 是否满足 |
| -------- | -------- |
| 仅描述开发任务相关的原理。 | |
| 尽量图文配合,一般使用时序图、流程图等形式。文字描述与图形描述匹配。 | |
【写作样例-1】
- 信号量初始化,为配置的N个信号量申请内存(N值可以由用户自行配置,受内存限制),并把所有的信号量初始化成未使用,并加入到未使用链表中供系统使用。
- 信号量创建,从未使用的信号量链表中获取一个信号量资源,并设定初值。
- 信号量申请,若其计数器值大于0,则直接减1返回成功。否则任务阻塞,等待其它任务释放该信号量,等待的超时时间可设定。当任务被一个信号量阻塞时,将该任务挂到信号量等待任务队列的队尾。
- 信号量释放,若没有任务等待该信号量,则直接将计数器加1返回。否则唤醒该信号量等待任务队列上的第一个任务。
- 信号量删除,将正在使用的信号量置为未使用信号量,并挂回到未使用链表。
- 信号量允许多个任务在同一时刻访问同一资源,但会限制同一时刻访问此资源的最大任务数目。访问同一资源的任务数达到该资源的最大数量时,会阻塞其他试图获取该资源的任务,直到有任务释放该信号量。
【写作样例-2】
**互斥锁运作原理**
多任务环境下会存在多个任务访问同一公共资源的场景,而有些公共资源是非共享的,需要任务进行独占式处理。互斥锁怎样来避免这种冲突呢?
用互斥锁处理非共享资源的同步访问时,如果有任务访问该资源,则互斥锁为加锁状态。此时其他任务如果想访问这个公共资源则会被阻塞,直到互斥锁被持有该锁的任务释放后,其他任务才能重新访问该公共资源,此时互斥锁再次上锁,如此确保同一时刻只有一个任务正在访问这个公共资源,保证了公共资源操作的完整性。
## 约束与限制
【写作要求】
*必选**描述本开发任务过程中* *的约束条件,以及此操作约束带来相应的负面影响,包括但不限于如下几方面*
- **功能限制**
- 功能使用范围(明确不支持的场景)。
- 规格限制。
* **操作限制**
* 已知问题的操作。
* 潜在风险的操作(如引起性能降低)。
* 引起性能降低的操作。
写作要求见下,完成写作后,请逐项自检。
| 内容要求 | 是否满足 |
| -------- | -------- |
| 明确功能限制或操作限制。 | |
| 约束对指导任务开发有影响或体验有感知,否则不用体现。 | |
| 容易出错的操作在步骤里描述,不在此体现。 | |
**写作样例**
**互斥锁的约束与限制**
- 两个任务不能对同一把互斥锁加锁。如果某任务对已被持有的互斥锁加锁,则该任务会被挂起,直到持有该锁的任务对互斥锁解锁,才能执行对这把互斥锁的加锁操作。
- 互斥锁不能在中断服务程序中使用。
- XXX作为实时操作系统需要保证任务调度的实时性,尽量避免任务的长时间阻塞,因此在获得互斥锁之后,应该尽快释放互斥锁。
- 持有互斥锁的过程中,不得再调用LOS_TaskPriSet等接口更改持有互斥锁任务的优先级。
...@@ -105,7 +105,7 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动 ...@@ -105,7 +105,7 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
permission = 0644; permission = 0644;
moduleName = "HDF_PLATFORM_SPI"; // 【必要】用于指定驱动名称,该字段的值必须和驱动入口结构的moduleName值一致 moduleName = "HDF_PLATFORM_SPI"; // 【必要】用于指定驱动名称,该字段的值必须和驱动入口结构的moduleName值一致
serviceName = "HDF_PLATFORM_SPI_1"; // 【必要且唯一】驱动对外发布服务的名称 serviceName = "HDF_PLATFORM_SPI_1"; // 【必要且唯一】驱动对外发布服务的名称
deviceMatchAttr = "hisilicon_hi35xx_spi_1";// 需要与设备hcs文件中的match_attr匹配 deviceMatchAttr = "hisilicon_hi35xx_spi_1"; // 需要与设备hcs文件中的match_attr匹配
} }
... ...
} }
...@@ -294,10 +294,10 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动 ...@@ -294,10 +294,10 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
int32_t ret; int32_t ret;
struct SpiCntlr *cntlr = NULL; struct SpiCntlr *cntlr = NULL;
... ...
cntlr = SpiCntlrFromDevice(device);// 这里有HdfDeviceObject到SpiCntlr的强制转化,通过service成员,赋值见Bind函数 cntlr = SpiCntlrFromDevice(device); // 这里有HdfDeviceObject到SpiCntlr的强制转化,通过service成员,赋值见Bind函数
// return (device == NULL) ? NULL : (struct SpiCntlr *)device->service; // return (device == NULL) ? NULL : (struct SpiCntlr *)device->service;
... ...
ret = Pl022Init(cntlr, device);// 【必要】实例化厂商自定义操作对象,示例见下 ret = Pl022Init(cntlr, device); // 【必要】实例化厂商自定义操作对象,示例见下
... ...
ret = Pl022Probe(cntlr->priv); ret = Pl022Probe(cntlr->priv);
... ...
...@@ -318,7 +318,7 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动 ...@@ -318,7 +318,7 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
// 计算最大,最小速度对应的频率 // 计算最大,最小速度对应的频率
pl022->maxSpeedHz = (pl022->clkRate) / ((SCR_MIN + 1) * CPSDVSR_MIN); pl022->maxSpeedHz = (pl022->clkRate) / ((SCR_MIN + 1) * CPSDVSR_MIN);
pl022->minSpeedHz = (pl022->clkRate) / ((SCR_MAX + 1) * CPSDVSR_MAX); pl022->minSpeedHz = (pl022->clkRate) / ((SCR_MAX + 1) * CPSDVSR_MAX);
DListHeadInit(&pl022->deviceList);// 初始化DList链表 DListHeadInit(&pl022->deviceList); // 初始化DList链表
pl022->cntlr = cntlr; // 使Pl022与SpiCntlr可以相互转化的前提 pl022->cntlr = cntlr; // 使Pl022与SpiCntlr可以相互转化的前提
cntlr->priv = pl022; // 使Pl022与SpiCntlr可以相互转化的前提 cntlr->priv = pl022; // 使Pl022与SpiCntlr可以相互转化的前提
cntlr->busNum = pl022->busNum; // 给SpiCntlr的busNum赋值 cntlr->busNum = pl022->busNum; // 给SpiCntlr的busNum赋值
...@@ -352,11 +352,11 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动 ...@@ -352,11 +352,11 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
{ {
struct SpiCntlr *cntlr = NULL; struct SpiCntlr *cntlr = NULL;
... ...
cntlr = SpiCntlrFromDevice(device);// 这里有HdfDeviceObject到SpiCntlr的强制转化,通过service成员,赋值见Bind函数 cntlr = SpiCntlrFromDevice(device); // 这里有HdfDeviceObject到SpiCntlr的强制转化,通过service成员,赋值见Bind函数
// return (device==NULL) ?NULL:(struct SpiCntlr *)device->service; // return (device==NULL) ?NULL:(struct SpiCntlr *)device->service;
... ...
if (cntlr->priv != NULL) { if (cntlr->priv != NULL) {
Pl022Remove((struct Pl022 *)cntlr->priv);// 这里有SpiCntlr到Pl022的强制转化 Pl022Remove((struct Pl022 *)cntlr->priv); // 这里有SpiCntlr到Pl022的强制转化
} }
SpiCntlrDestroy(cntlr); // 释放Pl022对象 SpiCntlrDestroy(cntlr); // 释放Pl022对象
} }
......
...@@ -174,8 +174,8 @@ LOSCFG_SOC_ASR5822S=y ...@@ -174,8 +174,8 @@ LOSCFG_SOC_ASR5822S=y
module_name = get_path_info(rebase_path("."), "name") module_name = get_path_info(rebase_path("."), "name")
module_group(module_name) { module_group(module_name) {
modules = [ modules = [
"dev_wifi_a", --- 单板模块 "dev_wifi_a", # 单板模块
"hcs", --- hcs文件的对应模块 "hcs", # hcs文件的对应模块
] ]
} }
} }
...@@ -203,17 +203,17 @@ LOSCFG_SOC_ASR5822S=y ...@@ -203,17 +203,17 @@ LOSCFG_SOC_ASR5822S=y
import("//kernel/liteos_m/liteos.gni") import("//kernel/liteos_m/liteos.gni")
config("public") { config("public") {
include_dirs = [ "." ] --- 公共头文件 include_dirs = [ "." ] # 公共头文件
} }
kernel_module("asr_startup") { --- 编译的模块 kernel_module("asr_startup") { # 编译的模块
sources = [ --- 编译的源文件 sources = [ # 编译的源文件
"startup.c", "startup.c",
"board.c", "board.c",
"startup_cm4.S", "startup_cm4.S",
] ]
include_dirs = [ --- 模块内使用到的头文件 include_dirs = [ # 模块内使用到的头文件
"...", "...",
] ]
} }
...@@ -223,10 +223,10 @@ LOSCFG_SOC_ASR5822S=y ...@@ -223,10 +223,10 @@ LOSCFG_SOC_ASR5822S=y
``` ```
config("public") { config("public") {
include_dirs = [] --- 公共头文件 include_dirs = [] # 公共头文件
ldflags = [] --- 链接参数,包括ld文件 ldflags = [] # 链接参数,包括ld文件
libs = [] --- 链接库 libs = [] # 链接库
defines = [] --- 定义 defines = [] # 定义
``` ```
![](../public_sys-resources/icon-note.gif) **说明:** ![](../public_sys-resources/icon-note.gif) **说明:**
...@@ -306,8 +306,8 @@ if (ret != LOS_OK) { ...@@ -306,8 +306,8 @@ if (ret != LOS_OK) {
在初始化之后,每个shell命令需要进行注册,例如:`vendor/asrmicro/wifi_demo/tests/wifi/wifi_app.c` 在初始化之后,每个shell命令需要进行注册,例如:`vendor/asrmicro/wifi_demo/tests/wifi/wifi_app.c`
``` ```
osCmdReg(CMD_TYPE_STD, "wifi_open", 0, (CMD_CBK_FUNC)ap_conn_func); --- 连接AP的指令,这里可以带参 osCmdReg(CMD_TYPE_STD, "wifi_open", 0, (CMD_CBK_FUNC)ap_conn_func); // 连接AP的指令,这里可以带参
osCmdReg(CMD_TYPE_EX, "wifi_close", 0, (CMD_CBK_FUNC)ap_close_func); --- 断开指令 osCmdReg(CMD_TYPE_EX, "wifi_close", 0, (CMD_CBK_FUNC)ap_close_func); // 断开指令
``` ```
### 内核启动适配 ### 内核启动适配
...@@ -316,21 +316,21 @@ osCmdReg(CMD_TYPE_EX, "wifi_close", 0, (CMD_CBK_FUNC)ap_close_func); --- 断 ...@@ -316,21 +316,21 @@ osCmdReg(CMD_TYPE_EX, "wifi_close", 0, (CMD_CBK_FUNC)ap_close_func); --- 断
注册中断,可参考`//device/soc/asrmicro/asr582x/liteos_m/sdk/startup/board.c`: 注册中断,可参考`//device/soc/asrmicro/asr582x/liteos_m/sdk/startup/board.c`:
``` ```
ArchHwiCreate(UART1_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY,0,UART1_IRQHandler,0); --- UART中断 ArchHwiCreate(UART1_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY,0,UART1_IRQHandler,0); // UART中断
ArchHwiCreate(GPIO_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY,0,GPIO_IRQHandler,0); --- GPIO中断 ArchHwiCreate(GPIO_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY,0,GPIO_IRQHandler,0); // GPIO中断
``` ```
内核初始化示例如下: 内核初始化示例如下:
``` ```
osStatus_t ret = osKernelInitialize(); --- 内核初始化 osStatus_t ret = osKernelInitialize(); // 内核初始化
if(ret == osOK) if(ret == osOK)
{ {
threadId = osThreadNew((osThreadFunc_t)sys_init,NULL,&g_main_task); --- 创建init线程 threadId = osThreadNew((osThreadFunc_t)sys_init,NULL,&g_main_task); // 创建init线程
if(threadId!=NULL) if(threadId!=NULL)
{ {
osKernelStart(); --- 线程调度 osKernelStart(); // 线程调度
} }
} }
``` ```
...@@ -339,9 +339,9 @@ if(ret == osOK) ...@@ -339,9 +339,9 @@ if(ret == osOK)
``` ```
... ...
DeviceManagerStart(); --- HDF初始化 DeviceManagerStart(); // HDF初始化
OHOS_SystemInit(); --- OpenHarmony系统组件初始化 OHOS_SystemInit(); // OpenHarmony系统组件初始化
.... ....
``` ```
...@@ -598,7 +598,7 @@ dsoftbus组件的选项配置如下: ...@@ -598,7 +598,7 @@ dsoftbus组件的选项配置如下:
``` ```
declare_args() { declare_args() {
asr_dsoftbus_test = true --- 打开dsoftbus demo编译 asr_dsoftbus_test = true # 打开dsoftbus demo编译
} }
``` ```
...@@ -610,7 +610,7 @@ declare_args() { ...@@ -610,7 +610,7 @@ declare_args() {
"enable": "true", "enable": "true",
"test_modules": [ "test_modules": [
"wifi_test", "wifi_test",
"dsoftbus_test" --- 打开dsoftbus_test模块 "dsoftbus_test" # 打开dsoftbus_test模块
] ]
} }
] ]
...@@ -626,7 +626,7 @@ dsoftbus组件的运行需至少预留80KB RAM。如资源不够,可对其它 ...@@ -626,7 +626,7 @@ dsoftbus组件的运行需至少预留80KB RAM。如资源不够,可对其它
`//kernel_liteos_m/blob/master/components/net/lwip-2.1/porting/include/lwip/lwipopts.h` `//kernel_liteos_m/blob/master/components/net/lwip-2.1/porting/include/lwip/lwipopts.h`
``` ```
#define TCPIP_THREAD_STACKSIZE 0x2000 --- 缩小TCPIP任务栈大小 #define TCPIP_THREAD_STACKSIZE 0x2000 // 缩小TCPIP任务栈大小
``` ```
在communication_dsoftbus仓中,加入了-fPIC编译选项,这样会让编译器产生与位置无关代码,并使用相对地址,但是在LiteOS-M核中使用的是静态库,不推荐使用。 在communication_dsoftbus仓中,加入了-fPIC编译选项,这样会让编译器产生与位置无关代码,并使用相对地址,但是在LiteOS-M核中使用的是静态库,不推荐使用。
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
设置Makefile的交叉编译工具链,修改并编译该库,生成OpenHarmony平台的可执行文件,步骤如下: 设置Makefile的交叉编译工具链,修改并编译该库,生成OpenHarmony平台的可执行文件,步骤如下:
1. 设置工具链 1. 设置工具链
将下列clang工具链配置替换掉yxml库根目录的MakeFile(即表1中的文件)中的原有配置。 将下列clang工具链配置替换掉yxml库根目录的Makefile(即表1中的文件)中的原有配置。
clang工具链配置: clang工具链配置:
......
...@@ -19,66 +19,6 @@ HiSysEvent提供OpenHarmony打点接口,通过在关键路径打点记录系 ...@@ -19,66 +19,6 @@ HiSysEvent提供OpenHarmony打点接口,通过在关键路径打点记录系
### 接口说明 ### 接口说明
JAVA打点接口如下:
HiSysEvent类,具体的API详见接口文档 。
**表1** HiSysEvent接口介绍
| 接口名 | 描述 |
| -------- | -------- |
| public&nbsp;static&nbsp;int&nbsp;write(String&nbsp;domain,&nbsp;String&nbsp;eventName,&nbsp;EventType&nbsp;type,&nbsp;Object...&nbsp;keyValues) | 接口功能:记录系统事件。<br/>输入参数:<br/>-&nbsp;domain:事件的相关领域,需要使用预置领域请参考Domain,可自定义领域。自定义领域长度在16个字符以内,有效的字符是0-9、A-Z,以字母开头。<br/>-&nbsp;eventName:事件名,长度在32个字符以内,有效的字符是0-9、a-z、A-Z、_,以字母开头,不能以_结尾。<br/>-&nbsp;type:事件类型,参考EventType。<br/>-&nbsp;keyValues:事件参数键值对,支持基本的数据类型、std::string,以及std::vector&lt;基本类型&gt;、std:vector&lt;std::string&gt;。参数名长度在48个字符以内,有效的字符是0-9、a-z、A-Z、_,以字母开头,不能以_结尾。参数名的个数在32个以内。<br/>返回值:成功返回0,错误返回小于0的值。 |
| public&nbsp;static&nbsp;int&nbsp;write(String&nbsp;domain,&nbsp;String&nbsp;eventName,&nbsp;EventType&nbsp;type,&nbsp;Map&lt;String,&nbsp;Object&gt;&nbsp;keyValues) | 接口功能:记录系统事件。<br/>输入参数:<br/>-&nbsp;domain:事件的相关领域,需要使用预置领域请参考Domain,可自定义领域。自定义领域长度在16个字符以内,有效的字符是0-9、A-Z,以字母开头。<br/>-&nbsp;eventName:事件名,长度在32个字符以内,有效的字符是0-9、a-z、A-Z、_,以字母开头,不能以_结尾。<br/>-&nbsp;type:事件类型,参考EventType。<br/>-&nbsp;keyValues:事件参数键值对,支持基本的数据类型、std::string,以及std::vector&lt;基本类型&gt;、std:vector&lt;std::string&gt;。参数名长度在48个字符以内,有效的字符是0-9、a-z、A-Z、_,以字母开头,不能以_结尾。参数名的个数在32个以内。<br/>返回值:成功返回0,错误返回小于0的值。 |
**表2** HiSysEvent.Domain接口介绍
| 成员 | 描述 |
| -------- | -------- |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;AAFWK&nbsp;=&nbsp;"AAFWK" | 元能力子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;APPEXECFWK&nbsp;=&nbsp;"APPEXECFWK" | 用户程序框架子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;ACCOUNT&nbsp;=&nbsp;"ACCOUNT" | 账号子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;AI&nbsp;=&nbsp;"AI" | AI子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;BARRIER_FREE&nbsp;=&nbsp;"BARRIERFREE" | 无障碍软件服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;BIOMETRICS&nbsp;=&nbsp;"BIOMETRICS" | 生物特征识别服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;CCRUNTIME&nbsp;=&nbsp;"CCRUNTIME" | C/C++运行环境子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;COMMUNICATION&nbsp;=&nbsp;"COMMUNICATION" | 公共通信子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;DEVELOPTOOLS&nbsp;=&nbsp;"DEVELOPTOOLS" | 研发工具链子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;DISTRIBUTED_DATAMGR&nbsp;=&nbsp;"DISTDATAMGR" | 分布式数据管理子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;DISTRIBUTED_SCHEDULE&nbsp;=&nbsp;"DISTSCHEDULE" | 分布式任务调度子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;GLOBAL&nbsp;=&nbsp;"GLOBAL" | 全球化子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;GRAPHIC&nbsp;=&nbsp;"GRAPHIC" | 图形子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;HIVIEWDFX&nbsp;=&nbsp;"HIVIEWDFX" | DFX子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;IAWARE&nbsp;=&nbsp;"IAWARE" | 本地资源调度管控子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;INTELLI_ACCESSORIES&nbsp;=&nbsp;"INTELLIACC" | 智能配件业务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;INTELLI_TV&nbsp;=&nbsp;"INTELLITV" | 智能电视业务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;IVI_HARDWARE&nbsp;=&nbsp;"IVIHARDWARE" | 车机专有硬件服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;LOCATION&nbsp;=&nbsp;"LOCATION" | 位置服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;MSDP&nbsp;=&nbsp;"MSDP" | 综合传感处理平台子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;MULTI_MEDIA&nbsp;=&nbsp;"MULTIMEDIA" | 媒体子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;MULTI_MODAL_INPUT&nbsp;=&nbsp;"MULTIMODALINPUT" | 多模输入子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;NOTIFICATION&nbsp;=&nbsp;"NOTIFICATION" | 事件通知子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;POWERMGR&nbsp;=&nbsp;"POWERMGR" | 电源服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;ROUTER&nbsp;=&nbsp;"ROUTER" | 路由器业务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;SECURITY&nbsp;=&nbsp;"SECURITY" | 安全子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;SENSORS&nbsp;=&nbsp;"SENSORS" | 泛Sensor服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;SOURCE_CODE_TRANSFORMER&nbsp;=&nbsp;"SRCTRANSFORMER" | 应用移植子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;STARTUP&nbsp;=&nbsp;"STARTUP" | 启动恢复子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;TELEPHONY&nbsp;=&nbsp;"TELEPHONY" | 电话服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;UPDATE&nbsp;=&nbsp;"UPDATE" | 升级服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;USB&nbsp;=&nbsp;"USB" | USB服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;WEARABLE_HARDWARE&nbsp;=&nbsp;"WEARABLEHW" | 穿戴专有硬件服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;WEARABLE&nbsp;=&nbsp;"WEARABLE" | 穿戴业务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;OTHERS&nbsp;=&nbsp;"OTHERS" | 其它 |
**表3** HiSysEvent.EventType接口介绍
| 接口名 | 描述 |
| -------- | -------- |
| FAULT | 故障类型事件 |
| STATISTIC | 统计类型事件 |
| SECURITY | 安全类型事件 |
| BEHAVIOR | 系统行为事件 |
C++打点接口如下: C++打点接口如下:
HiSysEvent类,具体的API详见接口文档 。 HiSysEvent类,具体的API详见接口文档 。
...@@ -87,7 +27,7 @@ HiSysEvent类,具体的API详见接口文档 。 ...@@ -87,7 +27,7 @@ HiSysEvent类,具体的API详见接口文档 。
| 接口名 | 描述 | | 接口名 | 描述 |
| -------- | -------- | | -------- | -------- |
| template&lt;typename...&nbsp;Types&gt;&nbsp;static&nbsp;int&nbsp;Write(const&nbsp;std::string&nbsp;&amp;domain,&nbsp;const&nbsp;std::string&nbsp;&amp;eventName,&nbsp;EventType&nbsp;type,&nbsp;Types...&nbsp;keyValues) | 接口功能:记录系统事件。<br/>输入参数:<br/>-&nbsp;domain:事件的相关领域,需要使用预置领域请参考Domain,可自定义领域。自定义领域长度在16个字符以内,有效的字符是0-9、A-Z,以字母开头。<br/>-&nbsp;eventName:事件名,长度在32个字符以内,有效的字符是0-9、A-Z、下划线,以字母开头,不能以下划线结尾。<br/>-&nbsp;type:事件类型,参考EventType。<br/>-&nbsp;keyValues:事件参数键值对,支持基本的数据类型、std::string,以及std::vector&lt;基本类型&gt;、std:vector&lt;std::string&gt;。参数名长度在48个字符以内,有效的字符是0-9、A-Z、下划线,以字母开头,不能以下划线结尾。参数名的个数在32个以内。<br/>返回值:<br/>-&nbsp;0:系统事件记录成功。<br/>-&nbsp;负值:系统事件记录失败。 | | template&lt;typename...&nbsp;Types&gt;&nbsp;static&nbsp;int&nbsp;Write(const&nbsp;std::string&nbsp;&amp;domain,<br/>&nbsp;const&nbsp;std::string&nbsp;&amp;eventName,<br/>&nbsp;EventType&nbsp;type,&nbsp;Types...&nbsp;keyValues) | 接口功能:记录系统事件。<br/>输入参数:<br/>-&nbsp;domain:事件的相关领域,需要使用预置领域请参考Domain,可自定义领域。自定义领域长度在16个字符以内,有效的字符是0-9、A-Z,以字母开头。<br/>-&nbsp;eventName:事件名,长度在32个字符以内,有效的字符是0-9、A-Z、下划线,以字母开头,不能以下划线结尾。<br/>-&nbsp;type:事件类型,参考EventType。<br/>-&nbsp;keyValues:事件参数键值对,支持基本的数据类型、std::string,以及std::vector&lt;基本类型&gt;、std:vector&lt;std::string&gt;。参数名长度在48个字符以内,有效的字符是0-9、A-Z、下划线,以字母开头,不能以下划线结尾。参数名的个数在32个以内。<br/>返回值:<br/>-&nbsp;0:系统事件记录成功。<br/>-&nbsp;负值:系统事件记录失败。 |
**表5** HiSysEvent::Domain接口介绍 **表5** HiSysEvent::Domain接口介绍
...@@ -142,29 +82,6 @@ HiSysEvent类,具体的API详见接口文档 。 ...@@ -142,29 +82,6 @@ HiSysEvent类,具体的API详见接口文档 。
### 开发实例 ### 开发实例
Java接口实例
1. 源代码开发
引入类名:
```
import ohos.hiviewdfx.HiSysEvent;
```
假设业务关注应用启动时间start_app,在相关代码中使用(调用接口打点):
```
HiSysEvent.write(HiSysEvent.Domain.AAFWK, "start_app", HiSysEvent.EventType.FAULT, "app_name", "com.demo");
```
2. 编译设置,在BUILD.gn里增加子系统SDK依赖:
```
external_deps = [ "hisysevent:hisysevent_java" ]
```
C++接口实例 C++接口实例
1. 源代码开发 1. 源代码开发
......
...@@ -179,15 +179,13 @@ subscribeInfos.emplace_back(info2); ...@@ -179,15 +179,13 @@ subscribeInfos.emplace_back(info2);
std::list<ProfileEvent> failedEvents; std::list<ProfileEvent> failedEvents;
// 执行订阅接口 // 执行订阅接口
DistributedDeviceProfileClient::GetInstance().SubscribeProfileEvents(subscribeInfos, DistributedDeviceProfileClient::GetInstance().SubscribeProfileEvents(subscribeInfos, callback, failedEvents);
callback, failedEvents);
sleep(SUBSCRIBE_SLEEP_TIME); sleep(SUBSCRIBE_SLEEP_TIME);
std::list<ProfileEvent> profileEvents; std::list<ProfileEvent> profileEvents;
profileEvents.emplace_back(ProfileEvent::EVENT_PROFILE_CHANGED); profileEvents.emplace_back(ProfileEvent::EVENT_PROFILE_CHANGED);
failedEvents.clear(); failedEvents.clear();
// 解除订阅 // 解除订阅
DistributedDeviceProfileClient::GetInstance().UnsubscribeProfileEvents(profileEvents, DistributedDeviceProfileClient::GetInstance().UnsubscribeProfileEvents(profileEvents, callback, failedEvents);
callback, failedEvents);
``` ```
## 相关仓<a name="section176111311166"></a> ## 相关仓<a name="section176111311166"></a>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
- **用户身份凭据管理:** 向上提供系统内统一的用户身份凭据信息管理接口,向下通过认证执行器管理模块,调用系统内的认证资源,完成用户身份凭据的生命周期管理和安全存储。 - **用户身份凭据管理:** 向上提供系统内统一的用户身份凭据信息管理接口,向下通过认证执行器管理模块,调用系统内的认证资源,完成用户身份凭据的生命周期管理和安全存储。
- **认证执行器管理:** 提供认证资源管理和认证会话管理功能,支持系统内身份认证相关**执行器**<sup></sup>统一管理和协同调度,支持不同类型的身份认证执行器灵活对接。 - **认证执行器管理:** 提供认证资源管理和认证会话管理功能,支持系统内身份认证相关**执行器**<sup></sup>统一管理和协同调度,支持不同类型的身份认证执行器灵活对接。
基于统一用户认证框架,系统可以扩展支持多种认证能力。OpenHarmony框架当前已经支持的**认证执行器**包含口令认证和人脸认证,开发者如果想实现新的认证执行器,只需要在新的部件内实现认证相关功能,并且按照执行器管理模块定义的接口与统一用户认证框架对接即可。 基于统一用户认证框架,系统可以扩展支持多种认证能力。OpenHarmony框架当前已经支持的**认证执行器**包含口令认证和人脸认证,开发者如果想实现新的认证执行器,只需要在新的部件内实现认证相关功能,并且按照执行器管理模块定义的接口与统一用户认证框架对接即可。
*注:在用户IAM子系统内,将一个用户身份认证操作的最小执行单元称为**执行器**,如一个口令认证模块,处理口令采集、口令处理和比对、口令安全存储的全过程,因此可以抽象为一个口令认证的全功能执行器。* *注:在用户IAM子系统内,将一个用户身份认证操作的最小执行单元称为**执行器**,如一个口令认证模块,处理口令采集、口令处理和比对、口令安全存储的全过程,因此可以抽象为一个口令认证的全功能执行器。*
...@@ -31,34 +31,32 @@ ...@@ -31,34 +31,32 @@
```undefined ```undefined
//base/user_iam //base/user_iam
├── auth_executor_mgr # 认证执行器管理部件,支持系统内统一的认证资源管理和调度 ├── user_auth_framework # 用户认证框架,包括用户认证、凭据管理和执行器管理
├── face_auth # 人脸认证部件,与认证执行器管理对接,支持人脸录入、删除和人脸认证功能 ├── face_auth # 人脸认证部件,与认证执行器管理对接,支持人脸录入、删除和人脸认证功能
├── pin_auth # 口令认证部件,与认证执行器管理对接,支持口令录入、删除和口令认证功能 ├── pin_auth # 口令认证部件,与认证执行器管理对接,支持口令录入、删除和口令认证功能
├── user_auth # 统一用户认证部件,提供统一用户身份认证功能
└── user_idm # 用户身份凭据管理部件,提供系统内统一的用户身份凭据信息管理功能
``` ```
## 约束 ## 约束
1. 用户身份凭据信息管理类操作,是系统内的关键操作,相关接口只支持系统基础应用调用。 1. 用户身份凭据信息管理类操作,是系统内的关键操作,相关接口只支持系统基础应用调用。
2. 用户身份认证执行器内真正完成用户身份认证凭据信息的处理,因此只支持系统服务实现执行器的功能,与认证执行器管理模块对接。 2. 执行器内部真正完成用户凭据信息的处理,因此只支持系统服务实现执行器的功能,与认证执行器管理模块对接。
## 说明 ## 说明
### 使用说明 ### 使用说明
1. 统一用户认证框架必须配合一个认证执行器才可以使用。 1. 统一用户认证框架必须配合一个认证执行器才可以使用。
2. 系统内默认存在的第一个认证执行器应该是口令认证 2. 系统内默认存在的第一个认证执行器应该是口令执行器
## 相关仓 ## 相关仓
[useriam_auth_executor_mgr](https://gitee.com/openharmony/useriam_auth_executor_mgr) [useriam_user_auth_framework](https://gitee.com/openharmony/useriam_user_auth_framework)
[useriam_user_idm](https://gitee.com/openharmony/useriam_user_idm) [useriam_pin_auth](https://gitee.com/openharmony/useriam_pin_auth)
[useriam_user_auth](https://gitee.com/openharmony/useriam_user_auth) [useriam_face_auth](https://gitee.com/openharmony/useriam_face_auth)
[useriam_pin_auth](https://gitee.com/openharmony/useriam_pin_auth) [drivers_interface](https://gitee.com/openharmony/drivers_interface)
[useriam_faceauth](https://gitee.com/openharmony/useriam_faceauth) [drivers_peripheral](https://gitee.com/openharmony/drivers_peripheral)
\ No newline at end of file
...@@ -35,9 +35,10 @@ ...@@ -35,9 +35,10 @@
| 软件 | 版本 | 备注 | | 软件 | 版本 | 备注 |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| OpenHarmony | 3.1.1&nbsp;Release | NA | | OpenHarmony | 3.1.1&nbsp;Release | NA |
| SDK | Ohos_sdk_full&nbsp;3.1.6.5 (API&nbsp;Version&nbsp;8&nbsp;Release) | NA | | Public SDK | Ohos_sdk_public&nbsp;3.1.6.6 (API&nbsp;Version&nbsp;8&nbsp;Release) | 面向应用开发者提供,不包含需要使用系统权限的系统接口。<br/>DevEco Studio 3.0 Beta4版本起,通过DevEco Studio获取的SDK默认为Public SDK。<br/>该版本Public SDK于7月6日单独更新发布。 |
| HUAWEI&nbsp;DevEco&nbsp;Studio(可选) | 3.0&nbsp;Beta3&nbsp;for&nbsp;OpenHarmony | OpenHarmony应用开发推荐使用 | | Full SDK | Ohos_sdk_full&nbsp;3.1.6.5 (API&nbsp;Version&nbsp;8&nbsp;Release) | 面向OEM厂商提供,包含了需要使用系统权限的系统接口。<br/>使用Full SDK时需要手动从镜像站点获取,并在DevEco Studio中替换,具体操作可参考[替换指南](../application-dev/quick-start/full-sdk-switch-guide.md)。 |
| HUAWEI&nbsp;DevEco&nbsp;Device&nbsp;Tool(可选) | 3.0&nbsp;Release | OpenHarmony智能设备集成开发环境推荐使用 | | HUAWEI&nbsp;DevEco&nbsp;Studio(可选) | 3.0&nbsp;Beta3&nbsp;for&nbsp;OpenHarmony | OpenHarmony应用开发推荐使用。 |
| HUAWEI&nbsp;DevEco&nbsp;Device&nbsp;Tool(可选) | 3.0&nbsp;Release | OpenHarmony智能设备集成开发环境推荐使用。 |
## 源码获取 ## 源码获取
...@@ -101,8 +102,10 @@ repo forall -c 'git lfs pull' ...@@ -101,8 +102,10 @@ repo forall -c 'git lfs pull'
| Hi3861轻量系统解决方案(二进制) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_pegasus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_pegasus.tar.gz.sha256) | | Hi3861轻量系统解决方案(二进制) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_pegasus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_pegasus.tar.gz.sha256) |
| Hi3516轻量系统解决方案-LiteOS(二进制) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus.tar.gz.sha256) | | Hi3516轻量系统解决方案-LiteOS(二进制) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus.tar.gz.sha256) |
| Hi3516轻量系统解决方案-Linux(二进制) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus_linux.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus_linux.tar.gz.sha256) | | Hi3516轻量系统解决方案-Linux(二进制) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus_linux.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus_linux.tar.gz.sha256) |
| 标准系统SDK包(Mac) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-full.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-full.tar.gz.sha256) | | 标准系统Full SDK包(Mac) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-full.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-full.tar.gz.sha256) |
| 标准系统SDK包(Windows\Linux) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-full.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-full.tar.gz.sha256) | | 标准系统Full SDK包(Windows\Linux) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-full.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-full.tar.gz.sha256) |
| 标准系统Public SDK包(Mac) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-public.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-public.tar.gz.sha256) |
| 标准系统Public SDK包(Windows\Linux) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-public.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-public.tar.gz.sha256) |
## 更新说明 ## 更新说明
...@@ -114,8 +117,9 @@ repo forall -c 'git lfs pull' ...@@ -114,8 +117,9 @@ repo forall -c 'git lfs pull'
**表3** 版本新增特性表 **表3** 版本新增特性表
| 子系统名称 | 标准系统 | 轻量、小型系统 | | 子系统名称 | 标准系统 | 轻量、小型系统 |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| SDK | SDK区分Full SDK和Public SDK进行发布。<br/>*说明:API Version 8的Public SDK首次于7月6日单独更新发布。* | NA |
| 系统服务管理 | 新增添加群组校验机制。<br/>主要涉及如下需求:<br/>I52G5Q&nbsp;添加群组校验机制 | NA | | 系统服务管理 | 新增添加群组校验机制。<br/>主要涉及如下需求:<br/>I52G5Q&nbsp;添加群组校验机制 | NA |
| 电源管理 | 实现兼容亮度调节和电池信息查询API接口能力。<br/>主要涉及如下需求:<br/>I526UP&nbsp;支持\@system.brightness亮度调节接口<br/>I526UP&nbsp;支持\@system.battery电池信息查询接口 | NA | | 电源管理 | 实现兼容亮度调节和电池信息查询API接口能力。<br/>主要涉及如下需求:<br/>I526UP&nbsp;支持\@system.brightness亮度调节接口<br/>I526UP&nbsp;支持\@system.battery电池信息查询接口 | NA |
| 包管理 | 实现查询指定应用是否安装接口能力。<br/>主要涉及如下需求:<br/>I56EWD&nbsp;支持对测试框架的配置<br/>I55RZJ&nbsp;查询指定应用是否安装 | NA | | 包管理 | 实现查询指定应用是否安装接口能力。<br/>主要涉及如下需求:<br/>I56EWD&nbsp;支持对测试框架的配置<br/>I55RZJ&nbsp;查询指定应用是否安装 | NA |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册