diff --git a/CODEOWNERS b/CODEOWNERS index 0aff235ef178b06874f96feba8904316dcaa0454..5b847d685a149d302ba349ea93f6329c32d1cd12 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -198,8 +198,9 @@ zh-cn/application-dev/reference/apis/js-apis-router.md @HelloCrease zh-cn/application-dev/reference/apis/js-apis-display.md @ge-yafang zh-cn/application-dev/reference/apis/js-apis-screenshot.md @ge-yafang zh-cn/application-dev/reference/apis/js-apis-window.md @ge-yafang -zh-cn/application-dev/reference/apis/js-apis-screen.md @ge-yafang zh-cn/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md @ge-yafang +zh-cn/application-dev/reference/apis/js-apis-screen.md @ge-yafang +zh-cn/application-dev/reference/apis/js-apis-windowAnimationManager.md @ge-yafang zh-cn/application-dev/reference/apis/js-apis-webgl.md @ge-yafang zh-cn/application-dev/reference/apis/js-apis-webgl2.md @ge-yafang zh-cn/application-dev/reference/apis/js-apis-audio.md @zengyawen diff --git a/OAT.xml b/OAT.xml index 23f7ee1c6a4bbd0a0fc4e65dd810fc904ced5005..8cc884632d4a963fa921c5905cfbf96e7e22edb7 100644 --- a/OAT.xml +++ b/OAT.xml @@ -38,13 +38,13 @@ - + - + diff --git a/README_zh.md b/README_zh.md index c50955d1202d5ba0e2f6461841f9c551f2fc7c58..3c65434aac3acaee899db2e1eba85e61c03de5a5 100644 --- a/README_zh.md +++ b/README_zh.md @@ -26,7 +26,7 @@ - OpenHarmony 3.0 LTS版本:点击[此处](zh-cn/release-notes/OpenHarmony-v3.0-LTS.md)了解版本详情。 - 该版本已更新至OpenHarmony 3.0.3 LTS,点击[此处](zh-cn/release-notes/OpenHarmony-v3.0.3-LTS.md)了解版本详情。 + 该版本已更新至OpenHarmony 3.0.5 LTS,点击[此处](zh-cn/release-notes/OpenHarmony-v3.0.5-LTS.md)了解版本详情。 - OpenHarmony 2.2 Beta2版本:点击[此处](zh-cn/release-notes/OpenHarmony-v2.2-beta2.md)了解版本详情。 diff --git a/docker/build.sh b/docker/build.sh deleted file mode 100755 index e1a7618251929cd060b0e33c4763e4bb5e5f9057..0000000000000000000000000000000000000000 --- a/docker/build.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -docker build -t openharmony-docker:1.0.0 . diff --git a/en/application-dev/ability/ability-brief.md b/en/application-dev/ability/ability-brief.md index 283037aedc8c219bee48511898dd300a0c05dc3b..187064a1c67d7bd21c823a945cca79366428d3f8 100644 --- a/en/application-dev/ability/ability-brief.md +++ b/en/application-dev/ability/ability-brief.md @@ -29,6 +29,3 @@ In addition, the following differences exist in the development process: For details about the two models, see [FA Model Overview](fa-brief.md) and [Stage Model Overview](stage-brief.md). -## Samples -The following sample is provided to help you better understand how to develop abilities: -- [Intra- and Inter-page Navigation](https://gitee.com/openharmony/codelabs/tree/master/Ability/PageAbility) diff --git a/en/application-dev/ability/fa-brief.md b/en/application-dev/ability/fa-brief.md index e3374b85a5e16e76a4b13dc58b1950e442a1313b..b89c15504376f326629dd2b3dd537e1633d986d0 100644 --- a/en/application-dev/ability/fa-brief.md +++ b/en/application-dev/ability/fa-brief.md @@ -26,17 +26,3 @@ Currently, the **app.js** file provides only the **onCreate** and **onDestroy** An application exclusively uses an independent process, and an ability exclusively uses an independent thread. When an ability is started for the first time, an application process as well as a thread for this ability is created. After the application is started, other abilities in the application are started, and a thread is created for every of these started abilities. Each ability is bound to an independent JSRuntime instance. In this way, abilities are isolated from each other. ![fa-threading-model](figures/fa-threading-model.png) -## Samples -The following sample is provided to help you better understand how to develop abilities: - -- [`DistributeCalc`: Distributed Calculator (eTS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/Preset/DistributeCalc) -- [`DistributeGraffiti`: Distributed Graffiti (eTS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/ability/DistributedGraffiti) - -- [Remote FA Startup](https://gitee.com/openharmony/codelabs/tree/master/Distributed/RemoteStartFA) -- [Distributed News App](https://gitee.com/openharmony/codelabs/tree/master/Distributed/NewsDemo) -- [Synced Sketchpad (eTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/DistributeDatabaseDrawEts) -- [Distributed Authentication (JS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/GameAuthOpenH) -- [Distributed Game Controller (eTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/HandleGameApplication) -- [Distributed Mail System (eTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/OHMailETS) -- [Distributed Jigsaw Puzzle (eTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/OpenHarmonyPictureGame) -- [Distributed Control (eTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/RemoteControllerETS) diff --git a/en/application-dev/ability/fa-dataability.md b/en/application-dev/ability/fa-dataability.md index f7bcf858e15b2f7f16b0327b1b91097e2f28facd..d291124c123f0f8e30ef344179a8891c67972b81 100644 --- a/en/application-dev/ability/fa-dataability.md +++ b/en/application-dev/ability/fa-dataability.md @@ -1,9 +1,34 @@ # Data Ability Development + ## When to Use + A Data ability helps applications manage access to data stored by themselves and other applications. It also provides APIs for sharing data with other applications either on the same device or across devices. Data ability providers can customize data access-related APIs such as data inserting, deleting, updating, and querying, as well as file opening, and share data with other applications through these open APIs. +## URI Introduction + +A Uniform Resource Identifier (URI) is used to identify a specific data item, such as a table in the database or a file on the disk. URIs used in OpenHarmony comply with the commonly used URI standard. A URI consists of the components: + +![fa-dataability-uri](figures/fa-dataability-uri.png) + +- **scheme**: name of the scheme used by the Data ability. The value is fixed at **dataability**. +- **authority**: device ID. To access data on a remote device, set this component to the ID of the remote device. To access data on the local device, leave this component empty. +- **path**: location of the specific resource to access. +- **query**: query parameters. +- **fragment**: subordinate resources to access. + +Example URIs: + +- Cross-device communication: **dataability://***device_id***/***com.domainname.dataability.persondata***/***person***/***10* +- Local-device communication: **dataability:///***com.domainname.dataability.persondata***/***person***/***10* + + +> **NOTE** +> +> In the case of local-device communication, **device_id** is empty, and therefore, there are three slashes (/) after **dataability:**. + + ## Available APIs **Table 1** Data ability lifecycle APIs @@ -129,7 +154,7 @@ The basic dependency packages include: import featureAbility from '@ohos.ability.featureAbility' import ohos_data_ability from '@ohos.data.dataAbility' import ohos_data_rdb from '@ohos.data.rdb' - + var urivar = "dataability:///com.ix.DataAbility" var DAHelper = featureAbility.acquireDataAbilityHelper( urivar @@ -283,9 +308,3 @@ The basic dependency packages include: ] ); ``` - -## Samples - -The following sample is provided to help you better understand how to develop Data abilities: - -- [`DataAbility`: Creation and Access of Data Abilities (eTS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/ability/DataAbility) diff --git a/en/application-dev/ability/fa-formability.md b/en/application-dev/ability/fa-formability.md index 2cbf353e910af8ebb8dff02218331ae97f568e2c..354945ff4e6dcc79f71c8d16693ce660e4270868 100644 --- a/en/application-dev/ability/fa-formability.md +++ b/en/application-dev/ability/fa-formability.md @@ -349,8 +349,3 @@ Now you've got a widget shown below. ![fa-form-example](figures/fa-form-example.png) -## Samples - -The following samples are provided to help you better understand how to develop a widget on the FA model: -- [`FormAbility`: FA Model Widget (JS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/ability/FormAbility) -- [`FormLauncher`: Widget Host (eTS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/ability/FormLauncher) diff --git a/en/application-dev/ability/fa-pageability.md b/en/application-dev/ability/fa-pageability.md index 7aa76452a3a17c7fd831044b345ffc6a8844e47a..3a2629a79996660f48dfc247b9a560ea1abe09b4 100644 --- a/en/application-dev/ability/fa-pageability.md +++ b/en/application-dev/ability/fa-pageability.md @@ -217,7 +217,3 @@ export default { }, } ``` -## Samples -The following sample is provided to help you better understand how to develop a Page ability: - -- [`DMS`: Distributed Demo (eTS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/ability/DMS) diff --git a/en/application-dev/ability/fa-serviceability.md b/en/application-dev/ability/fa-serviceability.md index 72b4542e19a675d3531948e07375d491fb001c63..75a605c39be73f29e1db8cecf988535c5495ee4a 100644 --- a/en/application-dev/ability/fa-serviceability.md +++ b/en/application-dev/ability/fa-serviceability.md @@ -134,7 +134,7 @@ You can use either of the following methods to connect to a Service ability: ```javascript import prompt from '@system.prompt' - + let mRemote; function onConnectCallback(element, remote){ console.log('onConnectLocalService onConnectDone element: ' + element); @@ -161,13 +161,13 @@ You can use either of the following methods to connect to a Service ability: }).catch((e) => { console.log('sendRequest error:' + e); }); - + } - + function onDisconnectCallback(element){ console.log('ConnectAbility onDisconnect Callback') } - + function onFailedCallback(code){ console.log('ConnectAbility onFailed Callback') } @@ -196,7 +196,7 @@ You can use either of the following methods to connect to a Service ability: ```javascript import rpc from "@ohos.rpc"; - + let mMyStub; export default { onStart() { @@ -424,9 +424,3 @@ export default { } }; ``` - -## Samples - -The following samples are provided to help you better understand how to develop a Service ability: -- [`ServiceAbility`: Service Ability Creation and Use (eTS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/ability/ServiceAbility) -- [`DMS`: Distributed Demo (eTS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/ability/DMS) diff --git a/en/application-dev/ability/figures/fa-dataability-uri.png b/en/application-dev/ability/figures/fa-dataability-uri.png new file mode 100644 index 0000000000000000000000000000000000000000..d89ada0ee9b2f9f655a6c3d8b0df17d6b1ca9326 Binary files /dev/null and b/en/application-dev/ability/figures/fa-dataability-uri.png differ diff --git a/en/application-dev/ability/stage-ability.md b/en/application-dev/ability/stage-ability.md index 011951ac5073aaec023c7c27aad3fe13dd1a7392..5b61bcec4b25312f994ed94362339e601df5cd55 100644 --- a/en/application-dev/ability/stage-ability.md +++ b/en/application-dev/ability/stage-ability.md @@ -317,7 +317,3 @@ struct Index { } } ``` - -## Samples -The following sample is provided to help you better understand how to develop an ability on the stage model: -- [`StageCallAbility`: Stage Call Ability Creation and Usage (eTS, API version 9)](https://gitee.com/openharmony/app_samples/tree/master/ability/StageCallAbility) diff --git a/en/application-dev/ability/stage-call.md b/en/application-dev/ability/stage-call.md index e402454ddf6afd1b1aab71601e52b19d8010b425..aaa9a9918345c52015969245c3bbba3efbb81048 100644 --- a/en/application-dev/ability/stage-call.md +++ b/en/application-dev/ability/stage-call.md @@ -247,7 +247,3 @@ try { Logger.error(TAG, `caller release failed with ${error}`) } ``` - -## Samples -The following sample is provided to help you better understand how to develop an ability call in the stage model: -- [`StageCallAbility`: Stage Call Ability Creation and Usage (eTS, API version 9)](https://gitee.com/openharmony/app_samples/tree/master/ability/StageCallAbility) diff --git a/en/application-dev/ability/stage-formextension.md b/en/application-dev/ability/stage-formextension.md index 0a1b17b91cf2be48405e4e9681146f1017ffa93b..1037c88b76370d92a27153b25784327f78fe4ced 100644 --- a/en/application-dev/ability/stage-formextension.md +++ b/en/application-dev/ability/stage-formextension.md @@ -358,8 +358,3 @@ You can use HML, CSS, and JSON to develop the UI page for a JavaScript-programme Now you've got a widget shown below. ![fa-form-example](figures/fa-form-example.png) - -## Samples - -The following sample is provided to help you better understand how to develop a widget on the stage model: -- [`FormExtAbility`: Stage Model Widget (eTS, JS, API version 9)](https://gitee.com/openharmony/app_samples/tree/master/ability/FormExtAbility) diff --git a/en/application-dev/ability/stage-serviceextension.md b/en/application-dev/ability/stage-serviceextension.md index c6f6362a727855189a398b6b305312c45e6135b1..0bda2156cdaa3b79c694f399453208ed9a0d13cf 100644 --- a/en/application-dev/ability/stage-serviceextension.md +++ b/en/application-dev/ability/stage-serviceextension.md @@ -50,7 +50,7 @@ OpenHarmony does not support creation of a Service Extension ability for third-p onRemoteRequest(code, data, reply, option) { } } - + class ServiceExt extends ServiceExtensionAbility { console.log('onCreate, want:' + want.abilityName); } @@ -69,7 +69,3 @@ OpenHarmony does not support creation of a Service Extension ability for third-p } } ``` -## Samples - -The following sample is provided to help you better understand how to develop Service Extension abilities: -- [`ServiceExtAbility`: Stage Extension Ability Creation and Usage (eTS, API version 9)](https://gitee.com/openharmony/app_samples/tree/master/ability/StageCallAbility) diff --git a/en/application-dev/connectivity/http-request.md b/en/application-dev/connectivity/http-request.md index 0a69a2e0f79a874def98d2be58d26d6dec0c3874..b43d1961722f6e6265f0a8b649208c1737f05726 100644 --- a/en/application-dev/connectivity/http-request.md +++ b/en/application-dev/connectivity/http-request.md @@ -71,7 +71,3 @@ httpRequest.request( } ); ``` - -## Samples -The following sample is provided to help you better understand how to develop the HTTP data request feature: -- [`Http`: HTTP Data Request (eTS) (API 8)](https://gitee.com/openharmony/app_samples/tree/master/Network/Http) diff --git a/en/application-dev/connectivity/ipc-rpc-overview.md b/en/application-dev/connectivity/ipc-rpc-overview.md index 19bbe8dc26871bec8b2f6f48273d90dacc148d70..e75536863b1ae1b5c5371f51b0d7e26e4db97ed6 100755 --- a/en/application-dev/connectivity/ipc-rpc-overview.md +++ b/en/application-dev/connectivity/ipc-rpc-overview.md @@ -19,4 +19,4 @@ In OpenHarmony documents, proxy represents the service requester, and stub repre ## Related Modules -[Distributed Scheduler](https://gitee.com/openharmony/distributedschedule_dms_fwk) +[Distributed Scheduler](https://gitee.com/openharmony/ability_dmsfwk) diff --git a/en/application-dev/connectivity/socket-connection.md b/en/application-dev/connectivity/socket-connection.md index 9444946bda64eadb546cfd282e8d5e4e2f670256..15f38e97a75585520cf60534d03a4c1812001716 100644 --- a/en/application-dev/connectivity/socket-connection.md +++ b/en/application-dev/connectivity/socket-connection.md @@ -122,7 +122,3 @@ The implementation is similar for UDPSocket and TCPSocket. The following uses th tcp.off('close'); }, 30 * 1000); ``` - -## Samples -The following sample is provided to help you better understand how to develop the socket connection feature: -- [`Socket`: Socket Connection (eTS) (API 8)](https://gitee.com/openharmony/app_samples/tree/master/Network/Socket) diff --git a/en/application-dev/database/database-distributedobject-guidelines.md b/en/application-dev/database/database-distributedobject-guidelines.md index baf12a5741e2186ab57aeb5feb1acb534fa4651a..dde1feb495e9827ab1f0fd1fad903f71acb9cbb3 100644 --- a/en/application-dev/database/database-distributedobject-guidelines.md +++ b/en/application-dev/database/database-distributedobject-guidelines.md @@ -7,6 +7,8 @@ The distributed data objects allow data across devices to be processed like loca ## Available APIs +For details about the APIs related to the distributed data object, see [Distributed Data Object](../reference/apis/js-apis-data-distributedobject.md). + ### Creating a Distributed Data Object Instance Call **createDistributedObject()** to create a distributed data object instance. You can specify the attributes of the instance in **source**. @@ -15,7 +17,7 @@ Call **createDistributedObject()** to create a distributed data object instance. **Table 1** API for creating a distributed data object instance | Package| API| Description| | -------- | -------- | -------- | -| ohos.data.distributedDataObject| createDistributedObject(source: object): DistributedObject | Creates a distributed data object instance for data operations.
- **source**: attributes of the **distributedObject** set.
- **DistributedObject**: returns the distributed object created.| +| ohos.data.distributedDataObject| createDistributedObject(source: object): DistributedObject | Creates a distributed data object instance for data operations.
- **source**: attributes of the **distributedObject** set.
- **DistributedObject**: returns the distributed object created.| ### Generating a Session ID @@ -33,16 +35,16 @@ Call **setSessionId()** to set a session ID for a distributed data object. The s **Table 3** API for setting a session ID | Class| API| Description| | -------- | -------- | -------- | -| DistributedDataObject | setSessionId(sessionId?: string): boolean | Sets a session ID for distributed data objects.
 **sessionId**: session ID of a distributed object in a trusted network. To remove a distributed data object from the network, set this parameter to "" or leave it empty.| +| DistributedDataObject | setSessionId(sessionId?: string): boolean | Sets a session ID for distributed data objects.
**sessionId**: session ID of a distributed object in a trusted network. To remove a distributed data object from the network, set this parameter to "" or leave it empty.| ### Observing Data Changes Call **on()** to subscribe to data changes of a distributed data object. When the data changes, a callback will be invoked to return the data changes. You can use **off()** to unsubscribe from the data changes. **Table 4** APIs for observing data changes of a distributed data object -| Class| API| Description| +| Class| API| Description| | -------- | -------- | -------- | -| DistributedDataObject| on(type: 'change', callback: Callback<{ sessionId: string, fields: Array<string> }>): void | Subscribes to data changes.| +| DistributedDataObject| on(type: 'change', callback: Callback<{ sessionId: string, fields: Array<string> }>): void | Subscribes to data changes.| | DistributedDataObject| off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array<string> }>): void | Unsubscribes from data changes. **Callback**: specifies callback used to return changes of the distributed data object. If this parameter is not specified, all callbacks related to data changes will be unregistered.| ### Observing Online or Offline Status @@ -67,13 +69,13 @@ The saved data will be released in the following cases: - The application has been uninstalled. - Data is successfully restored. -**Table 6** APIs for saving a distributed data object and revoking the saving +**Table 6** APIs for saving a distributed data object and revoking the saving operation | Class| API| Description| | -------- | -------- | -------- | | DistributedDataObject | save(deviceId: string): Promise<SaveSuccessResponse> | Saves a distributed data object. This API uses a promise to return the result.| | DistributedDataObject| save(deviceId: string, callback: AsyncCallback<SaveSuccessResponse>): void | Saves a distributed data object. This API uses an asynchronous callback to return the result.| -| DistributedDataObject | revokeSave(callback: AsyncCallback<RevokeSaveSuccessResponse>): void | Revokes the data saving operation. This API uses an asynchronous callback to return the result. | -| DistributedDataObject| revokeSave(): Promise<RevokeSaveSuccessResponse> | Revokes the data saving operation. This API uses a promise to return the result. | +| DistributedDataObject | revokeSave(callback: AsyncCallback<RevokeSaveSuccessResponse>): void | Revokes the data saving operation. This API uses an asynchronous callback to return the result.| +| DistributedDataObject| revokeSave(): Promise<RevokeSaveSuccessResponse> | Revokes the data saving operation. This API uses a promise to return the result.| ## How to Develop @@ -157,7 +159,7 @@ The following example shows how to implement a distributed data object synchroni local_object.on("change", this.changeCallback.bind(this)); ``` -6. Modify object attributes.
The object attributes support basic data types (such as number, Boolean, and string) and complex data types (array and nested basic types). +6. Modify object attributes.
The object attributes support basic data types (such as number, Boolean, and string) and complex data types (array and nested basic types). The sample code is as follows: ```js @@ -205,41 +207,39 @@ The following example shows how to implement a distributed data object synchroni 10. Save a distributed data object and revoke the data saving operation. - Callback - - - ```js - // Save a distributed data object. - local_object.save("local", (result, data)=>{ - console.log("save callback"); - console.info("save sessionId " + data.sessionId); - console.info("save version " + data.version); - console.info("save deviceId " + data.deviceId); - }); - // Revoke the data saving operation. - local_object.revokeSave((result, data) =>{ - console.log("revokeSave callback"); - console.info("revokeSave sessionId " + data.sessionId); - }); - ``` - - Promise - - ```js - // Save a distributed data object. - g_object.save("local").then((result)=>{ - console.info("save sessionId " + result.sessionId); - console.info("save version " + result.version); - console.info("save deviceId " + result.deviceId); - }, (result)=>{ - console.info("save local failed."); - }); - // Revoke the data saving operation. - g_object.revokeSave().then((result)=>{ - console.info("revokeSave success."); - }, (result)=>{ - console.info("revokeSave failed."); - }); - ``` -11. Unsubscribe from the status changes of the distributed data object.
You can specify the callback to unregister. If you do not specify the callback, this API unregister all callbacks of this distributed data object. + + ```js + // Save a distributed data object. + local_object.save("local", (result, data)=>{ + console.log("save callback"); + console.info("save sessionId " + data.sessionId); + console.info("save version " + data.version); + console.info("save deviceId " + data.deviceId); + }); + // Revoke the data saving operation. + local_object.revokeSave((result, data) =>{ + console.log("revokeSave callback"); + console.info("revokeSave sessionId " + data.sessionId); + }); + ``` + - Promise + ```js + // Save a distributed data object. + g_object.save("local").then((result)=>{ + console.info("save sessionId " + result.sessionId); + console.info("save version " + result.version); + console.info("save deviceId " + result.deviceId); + }, (result)=>{ + console.info("save local failed."); + }); + // Revoke the data saving operation. + g_object.revokeSave().then((result)=>{ + console.info("revokeSave success."); + }, (result)=>{ + console.info("revokeSave failed."); + }); + ``` +11. Unsubscribe from the status changes of the distributed data object.
You can specify the callback to unregister. If you do not specify the callback, this API unregisters all callbacks of this distributed data object. The sample code is as follows: ```js diff --git a/en/application-dev/database/database-mdds-guidelines.md b/en/application-dev/database/database-mdds-guidelines.md index 309d2a38e4cbcab79a102b809bb9444cf9a8e1ee..c5608c6eabd526c38a87bd3907fba89fb1a11629 100644 --- a/en/application-dev/database/database-mdds-guidelines.md +++ b/en/application-dev/database/database-mdds-guidelines.md @@ -7,19 +7,21 @@ The Distributed Data Service (DDS) implements synchronization of application dat ## Available APIs +For details about the APIs related to distributed data, see [Distributed Data Management](../reference/apis/js-apis-distributed-data.md). + The table below describes the APIs provided by the OpenHarmony DDS module. **Table 1** APIs provided by the DDS -| Category | API | Description | -| -------- | --- | ----------- | -| Creating a distributed database | createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void
createKVManager(config: KVManagerConfig): Promise<KVManager> | Creates a **KVManager** object for database management.| -| Obtaining a distributed KV store | getKVStore<T extends KVStore>(storeId: string, options: Options, callback: AsyncCallback<T>): void
getKVStore<T extends KVStore>(storeId: string, options: Options): Promise<T> | Obtains the KV store with the specified **Options** and **storeId**. | -| Managing data in a distributed KV store | put(key: string, value: Uint8Array \| string \| number \| boolean, callback: AsyncCallback<void>): void
put(key: string, value: Uint8Array \| string \| number \| boolean): Promise<void> | Inserts and updates data. | +| Category | API | Description | +| ------------ | ------------- | ------------- | +| Creating a distributed database| createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void
createKVManager(config: KVManagerConfig): Promise<KVManager> | Creates a **KVManager** object for database management.| +| Obtaining a distributed KV store| getKVStore<T extends KVStore>(storeId: string, options: Options, callback: AsyncCallback<T>): void
getKVStore<T extends KVStore>(storeId: string, options: Options): Promise<T> | Obtains the KV store with the specified **Options** and **storeId**.| +| Managing data in a distributed KV store| put(key: string, value: Uint8Array \| string \| number \| boolean, callback: AsyncCallback<void>): void
put(key: string, value: Uint8Array \| string \| number \| boolean): Promise<void> | Inserts and updates data.| | Managing data in a distributed KV store| delete(key: string, callback: AsyncCallback<void>): void
delete(key: string): Promise<void> | Deletes data. | -| Managing data in a distributed KV store | get(key: string, callback: AsyncCallback<Uint8Array \| string \| boolean \| number>): void
get(key: string): Promise<Uint8Array \| string \| boolean \| number> | Queries data. | -| Subscribing to changes in the distributed data | on(event: 'dataChange', type: SubscribeType, observer: Callback<ChangeNotification>): void
on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]>>): void | Subscribes to data changes in the KV store. | -| Synchronizing data across devices | sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void | Triggers database synchronization in manual mode. | +| Managing data in a distributed KV store| get(key: string, callback: AsyncCallback<Uint8Array \| string \| boolean \| number>): void
get(key: string): Promise<Uint8Array \| string \| boolean \| number> | Queries data. | +| Subscribing to changes in the distributed data| on(event: 'dataChange', type: SubscribeType, observer: Callback<ChangeNotification>): void
on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]>>): void | Subscribes to data changes in the KV store.| +| Synchronizing data across devices| sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void | Triggers database synchronization in manual mode. | @@ -29,14 +31,13 @@ The table below describes the APIs provided by the OpenHarmony DDS module. The following uses a single KV store as an example to describe the development procedure. 1. Import the distributed data module. - ```js import distributedData from '@ohos.data.distributedData'; ``` 2. Create a **KvManager** instance based on the specified **KvManagerConfig** object. - 1. Create a **KvManagerConfig** object based on the application context. - 2. Create a **KvManager** instance. + (1) Create a **KvManagerConfig** object based on the application context. + (2) Create a **KvManager** instance. The sample code is as follows: ```js @@ -63,8 +64,8 @@ The following uses a single KV store as an example to describe the development p ``` 3. Create and obtain a single KV store. - 1. Declare the ID of the single KV store to create. - 2. Create a single KV store. You are advised to disable automatic synchronization (**autoSync:false**) and call **sync** when a synchronization is required. + (1) Declare the ID of the single KV store to create. + (2) Create a single KV store. You are advised to disable automatic synchronization (**autoSync:false**) and call **sync** when a synchronization is required. The sample code is as follows: ```js @@ -91,12 +92,11 @@ The following uses a single KV store as an example to describe the development p } ``` - > ![icon-note.gif](../public_sys-resources/icon-note.gif) **NOTE**
+ > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> For data synchronization between networked devices, you are advised to open the distributed KV store during application startup to obtain the database handle. With this database handle (**kvStore** in this example), you can perform operations, such as inserting data into the KV store, without creating the KV store repeatedly during the lifecycle of the handle. -4. Subscribe to changes in the distributed data.
+4. Subscribe to changes in the distributed data.
The following is the sample code for subscribing to the data changes of a single KV store: - ```js kvStore.on('dataChange', distributedData.SubscribeType.SUBSCRIBE_TYPE_ALL, function (data) { console.log("dataChange callback call data: " + JSON.stringify(data)); @@ -104,8 +104,8 @@ The following uses a single KV store as an example to describe the development p ``` 5. Write data to the single KV store. - 1. Construct the key and value to be written into the single KV store. - 2. Write key-value pairs into the single KV store. + (1) Construct the key and value to be written into the single KV store. + (2) Write key-value pairs into the single KV store. The following is the sample code for writing key-value pairs of the string type into the single KV store: @@ -126,11 +126,10 @@ The following uses a single KV store as an example to describe the development p ``` 6. Query data in the single KV store. - 1. Construct the key to be queried from the single KV store. - 2. Query data from the single KV store. + (1) Construct the key to be queried from the single KV store. + (2) Query data from the single KV store. The following is the sample code for querying data of the string type from the single KV store: - ```js const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; @@ -178,3 +177,7 @@ The following uses a single KV store as an example to describe the development p } }); ``` +## Samples +The following samples are provided to help you better understand the distributed data development: +- [`KvStore`: Distributed Database (eTS) (API8)](https://gitee.com/openharmony/app_samples/tree/master/data/Kvstore) +- [Distributed Database](https://gitee.com/openharmony/codelabs/tree/master/Data/JsDistributedData) diff --git a/en/application-dev/database/database-preference-guidelines.md b/en/application-dev/database/database-preference-guidelines.md index 36b6878057640f6cf706efec6d9abbbc1e5b2980..b65916cdd157419ef44b821c423a33ce272f9da0 100644 --- a/en/application-dev/database/database-preference-guidelines.md +++ b/en/application-dev/database/database-preference-guidelines.md @@ -1,12 +1,16 @@ # Preferences Development +> **NOTE** +> +> This feature is supported since API Version 9. For the versions earlier than API Version 9, use [Lightweight Storage](../reference/apis/js-apis-data-storage.md) APIs. + ## When to Use Preferences are ideal for storing data frequently used by applications, but not for storing a large amount of data or data with frequent changes. The application data is persistently stored on a device in the form of files. Note that the instance accessed by an application contains all data of the file. The data is always loaded to the memory of the device until the application removes it from the memory. The application can perform data operations using the **Preferences** APIs. ## Available APIs -Preferences provide capabilities for processing data in the form of key-value (KV) pairs and support data persistence, modification, and query. In KV pairs, keys are of the string type, and values can be of the number, string, or Boolean type. +Preferences provide capabilities for processing data in the form of key-value (KV) pairs and support data persistence, modification, and query. In KV pairs, keys are of the string type, and values can be of the number, string, or Boolean type. For more APIs related to preferences, see [Preferences](../reference/apis/js-apis-data-preferences.md). ### Creating a Preferences Instance @@ -26,7 +30,7 @@ Call the **put()** method to add or modify data in a **Preferences** instance. | Class | API | Description | | ------- | -------------------------------------------------- | ----------------------------------------------- | -| Preferences | put(key: string, value: ValueType): Promise\ | Writes data of the number, string, and Boolean types.| +| Preferences | put(key: string, value: ValueType): Promise\ | Writes data with the value type of number, string, boolean, Array\, Array\, or Array\.| ### Reading Data @@ -36,7 +40,7 @@ Call the **get()** method to read data from a **Preferences** instance. | Class | API | Description | | ------- | ---------------------------------------------------------- | ----------------------------------------------- | -| Preferences | get(key: string, defValue: ValueType): Promise\ | Reads data of the number, string, and Boolean types.| +| Preferences | get(key: string, defValue: ValueType): Promise\ | Obtains data with the value type of number, string, boolean, Array\, Array\, or Array\.| ### Storing Data Persistently @@ -67,7 +71,7 @@ Use the following APIs to delete a **Preferences** instance or data file. | Package | API | Description | | ----------------- | ---------------------------------------------------- | ------------------------------------------------------------ | -| ohos.data.preferences | deletePreferences(context: Context, name: string): Promise; | Deletes a **Preferences** instance from the cache and deletes its file from the device.| +| ohos.data.preferences | deletePreferences(context: Context, name: string): Promise\; | Deletes a **Preferences** instance from the cache and deletes its file from the device.| | ohos.data.preferences | removePreferencesFromCache(context: Context, name: string): Promise\; | Removes a **Preferences** instance from the memory to release memory. ## How to Develop @@ -91,8 +95,8 @@ Use the following APIs to delete a **Preferences** instance or data file. ```js promise.then((preferences) => { - let getPromise = preferences.put('startup', 'auto') - getPromise.then(() => { + let putPromise = preferences.put('startup', 'auto') + putPromise.then(() => { console.info("Put the value of startup successfully.") }).catch((err) => { console.info("Failed to put the value of startup with err: " + err) diff --git a/en/application-dev/database/database-relational-guidelines.md b/en/application-dev/database/database-relational-guidelines.md index fb5e1b12a5bd99385762706a006335985a65f22a..53bba062801ec1b8bcf1f65cdc4119fa53757f10 100644 --- a/en/application-dev/database/database-relational-guidelines.md +++ b/en/application-dev/database/database-relational-guidelines.md @@ -2,7 +2,7 @@ ## When to Use -On the basis of the SQLite database, the relational database (RDB) allows you to operate data with or without native SQL statements. In OpenHarmony, an RDB is also called RDB store. +A relational database (RDB) store allows you to operate local data with or without native SQL statements based on SQLite. ## Available APIs @@ -11,7 +11,7 @@ For details about RDB APIs, see [Relational Database](../reference/apis/js-apis- ### Creating or Deleting an RDB Store -The following table describes the APIs available for creating and deleting an RDB store. +The table below describes the APIs available for creating and deleting an RDB store. **Table 1** APIs for creating and deleting an RDB store @@ -34,7 +34,7 @@ The RDB provides APIs for inserting, deleting, updating, and querying data in th | Class| API| Description| | -------- | -------- | -------- | - | RdbStore | insert(table: string, values: ValuesBucket, callback: AsyncCallback<number>):void | Inserts a row of data into a table. This API uses a callback to return the result.
- **table**: name of the target table.
- **values**: data to be inserted into the table.
- **callback**: callback invoked to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.| + | RdbStore | insert(table: string, values: ValuesBucket, callback: AsyncCallback<number>):void | Inserts a row of data into a table. This API uses a callback to return the result.
- **table**: name of the target table.
- **values**: data to be inserted into the table.
- **callback**: callback invoked to return the result. If the operation is successful, the row ID will be returned; otherwise, **-1** will be returned.| | RdbStore | insert(table: string, values: ValuesBucket): Promise<number> | Inserts a row of data into a table. This API uses a promise to return the result.
- **table**: name of the target table.
- **values**: data to be inserted into the table.| - **Updating data** @@ -56,8 +56,8 @@ The RDB provides APIs for inserting, deleting, updating, and querying data in th | Class| API| Description| | -------- | -------- | -------- | - | RdbStore | delete(predicates: RdbPredicates, callback: AsyncCallback<number>):void | Deletes data from the database based on the specified **RdbPredicates** object. This API uses an asynchronous callback to return the result.
- **predicates**: conditions for deleting data.
- **callback**: callback invoked to return the number of rows updated.| - | RdbStore | delete(predicates: RdbPredicates): Promise<number> | Deletes data from the database based on the specified **RdbPredicates** object. This API uses a promise to return the result.
- **predicates**: conditions for deleting data.| + | RdbStore | delete(predicates: RdbPredicates, callback: AsyncCallback<number>):void | Deletes data from the RDB store based on the specified **RdbPredicates** object. This API uses an asynchronous callback to return the result.
- **predicates**: conditions for deleting data.
- **callback**: callback invoked to return the number of rows updated.| + | RdbStore | delete(predicates: RdbPredicates): Promise<number> | Deletes data from the RDB store based on the specified **RdbPredicates** object. This API uses a promise to return the result.
- **predicates**: conditions for deleting data.| - **Querying data** @@ -70,8 +70,8 @@ The RDB provides APIs for inserting, deleting, updating, and querying data in th | Class| API| Description| | -------- | -------- | -------- | - | RdbStore | query(predicates: RdbPredicates, columns: Array, callback: AsyncCallback<ResultSet>): void | Queries data in the RDB store based on the specified **RdbPredicates** object. This API uses a callback to return the result.
- **predicates**: conditions for querying data.
- **columns**: columns to query. If this parameter is not specified, the query applies to all columns.
- **callback**: callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.| - | RdbStore | query(predicates: RdbPredicates, columns: Array): Promise<ResultSet> | Queries data in the RDB store based on the specified **RdbPredicates** object. This API uses a promise to return the result.
- **predicates**: conditions for querying data.
- **columns**: columns to query. If this parameter is not specified, the query applies to all columns.| + | RdbStore | query(predicates: RdbPredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>): void | Queries data in the RDB store based on the specified **RdbPredicates** object. This API uses a callback to return the result.
- **predicates**: conditions for querying data.
- **columns**: columns to query. If this parameter is not specified, the query applies to all columns.
- **callback**: callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.| + | RdbStore | query(predicates: RdbPredicates, columns?: Array<string>): Promise<ResultSet> | Queries data in the RDB store based on the specified **RdbPredicates** object. This API uses a promise to return the result.
- **predicates**: conditions for querying data.
- **columns**: columns to query. If this parameter is not specified, the query applies to all columns.| | RdbStore | querySql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallback<ResultSet>):void | Queries data in the RDB store using the specified SQL statement. This API uses a callback to return the result.
- **sql**: SQL statement.
- **bindArgs**: arguments in the SQL statement.
- **callback**: callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.| | RdbStore | querySql(sql: string, bindArgs?: Array<ValueType>):Promise<ResultSet> | Queries data in the RDB store using the specified SQL statement. This API uses a promise to return the result.
- **sql**: SQL statement.
- **bindArgs**: arguments in the SQL statement.| @@ -167,7 +167,7 @@ You can obtain the distributed table name for a remote device based on the local **Synchronizing Data Between Devices** -**Table 10** APIs for cross-device data synchronization +**Table 10** APIs for synchronizing data between devices | Class| API| Description| | -------- | -------- | -------- | @@ -190,7 +190,7 @@ You can obtain the distributed table name for a remote device based on the local | -------- | -------- | -------- | | RdbStore |off(event:'dataChange', type: SubscribeType, observer: Callback\>): void;| Unregisters the observer of the specified type for the RDB store. This API uses a callback to return the result.
- **type**: subscription type. **SUBSCRIBE_TYPE_REMOTE** means to subscribe to remote data changes.
- **observer**: observer to unregister.| -### Backing Up and Restore an RDB Store +### Backing Up and Restoring an RDB Store **Backing Up an RDB Store** @@ -198,8 +198,8 @@ You can obtain the distributed table name for a remote device based on the local | Class| API| Description| | -------- | -------- | -------- | -| RdbStore |backup(destName:string, callback: AsyncCallback<void>):void| Backs up the RDB store with the specified name. This API uses an asynchronous callback to return the result.
- **destName**: name of the RDB backup file.
- **callback**: callback invoked to return the result.| -| RdbStore |backup(destName:string): Promise<void>| Backs up the RDB store with the specified name. This API uses a promise to return the result.
- **destName**: name of the RDB backup file.| +| RdbStore |backup(destName:string, callback: AsyncCallback<void>):void| Backs up an RDB store. This API uses an asynchronous callback to return the result.
- **destName**: name of the RDB backup file.
- **callback**: callback invoked to return the result.| +| RdbStore |backup(destName:string): Promise<void>| Backs up an RDB store. This API uses a promise to return the result.
- **destName**: name of the RDB backup file.| **Restoring an RDB Store** @@ -207,8 +207,8 @@ You can obtain the distributed table name for a remote device based on the local | Class| API| Description| | -------- | -------- | -------- | -| RdbStore |restore(srcName:string, callback: AsyncCallback<void>):void| Restores an RDB store using the specified backup file. This API uses an asynchronous callback to return the result.
- **srcName**: name of the RDB backup file.
- **callback**: callback invoked to return the result.| -| RdbStore |restore(srcName:string): Promise<void>| Restores an RDB store using the specified backup file. This API uses a promise to return the result.
- **srcName**: name of the RDB backup file.| +| RdbStore |restore(srcName:string, callback: AsyncCallback<void>):void| Restores an RDB store using a backup file. This API uses an asynchronous callback to return the result.
- **srcName**: name of the RDB backup file.
- **callback**: callback invoked to return the result.| +| RdbStore |restore(srcName:string): Promise<void>| Restores an RDB store using a backup file. This API uses a promise to return the result.
- **srcName**: name of the RDB backup file.| ## How to Develop @@ -251,9 +251,9 @@ You can obtain the distributed table name for a remote device based on the local (1) Create an **RdbPredicates** object to specify query conditions. - (2) Call the query() API to query data. + (2) Call the **query()** API to query data. - (3) Call the resultSet() API to obtain the result. + (3) Call the **resultSet()** API to obtain the result. The sample code is as follows: @@ -270,7 +270,7 @@ You can obtain the distributed table name for a remote device based on the local const blobType = resultSet.getBlob(resultSet.getColumnIndex("blobType")) resultSet.close() }) - ``` + ``` 4. Set the distributed tables to be synchronized. @@ -283,7 +283,7 @@ You can obtain the distributed table name for a remote device based on the local } ``` - (2) Obtain the application permissions. + (2) Obtain the required permissions. (3) Set the distributed tables. diff --git a/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md b/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md index c4e4fdf3850f4bd3b1b8f6902133835764414cb3..fb107049c515d0ff1961313a9f0bebb39c4e4c9d 100644 --- a/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md +++ b/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md @@ -3,7 +3,6 @@ ## When to Use With device usage statistics APIs, you can have a better understanding of the application, notification, and system usage. For example, in application usage statistics, you can query the application usage, event log, and bundle group. - The application records (usage history statistics and event records) cached by components are updated to the database for persistent storage within 30 minutes after an event is reported. ## Available APIs @@ -23,7 +22,7 @@ import stats from '@ohos.bundleState'; | function queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void | Queries the priority group of this application. This API uses an asynchronous callback to return the result.| | function queryAppUsagePriorityGroup(): Promise<number>; | Queries the priority group of this application. This API uses a promise to return the result.| | function isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void | Checks whether the application specified by **bundleName** is in the idle state. | -| function getRecentlyUsedModules(maxNum: number, callback: AsyncCallback<BundleActiveModuleInfo>): void | Obtains the number of FA usage records specified by **maxNum**.| +| function getRecentlyUsedModules(maxNum? : number, callback: AsyncCallback<BundleActiveModuleInfo>): void | Obtains the number of FA usage records specified by **maxNum**. If **maxNum** is not specified, the default value **1000** is used.| | function queryAppNotificationNumber(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveEventState>>): void | Queries the number of notifications from all applications based on the specified start time and end time.| | function queryBundleActiveEventStates(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveEventState>>): void | Queries statistics about system events (hibernation, wakeup, unlocking, and screen locking) that occur between the specified start time and end time.| | function queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback<number>): void | Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses an asynchronous callback to return the result.| @@ -45,7 +44,7 @@ import stats from '@ohos.bundleState'; ..., "reqPermissions": [ { - "name": "ohos.permission.BUNDLE_ACTIVE_INFO" + "name": "ohos.permission.BUNDLE_ACTIVE_INFO" } ] } @@ -57,13 +56,13 @@ import stats from '@ohos.bundleState'; import stats from '@ohos.bundleState' // Promise mode - stats.queryBundleActiveStates(0, 20000000000000).then( res => { + stats.queryBundleActiveStates(0, 20000000000000).then(res => { console.log('BUNDLE_ACTIVE queryBundleActiveStates promise success.'); for (let i = 0; i < res.length; i++) { console.log('BUNDLE_ACTIVE queryBundleActiveStates promise number : ' + (i + 1)); console.log('BUNDLE_ACTIVE queryBundleActiveStates promise result ' + JSON.stringify(res[i])); } - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE queryBundleActiveStates promise failed, because: ' + err.code); }); @@ -87,7 +86,7 @@ import stats from '@ohos.bundleState'; import stats from '@ohos.bundleState' // Promise mode - stats.queryBundleStateInfos(0, 20000000000000).then( res => { + stats.queryBundleStateInfos(0, 20000000000000).then(res => { console.log('BUNDLE_ACTIVE queryBundleStateInfos promise success.'); let i = 1; for (let key in res){ @@ -95,7 +94,7 @@ import stats from '@ohos.bundleState'; console.log('BUNDLE_ACTIVE queryBundleStateInfos promise result ' + JSON.stringify(res[key])); i++; } - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE queryBundleStateInfos promise failed, because: ' + err.code); }); @@ -121,13 +120,13 @@ import stats from '@ohos.bundleState'; import stats from '@ohos.bundleState' // Promise mode - stats.queryCurrentBundleActiveStates(0, 20000000000000).then( res => { + stats.queryCurrentBundleActiveStates(0, 20000000000000).then(res => { console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates promise success.'); for (let i = 0; i < res.length; i++) { console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates promise number : ' + (i + 1)); console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates promise result ' + JSON.stringify(res[i])); } - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates promise failed, because: ' + err.code); }); @@ -151,13 +150,13 @@ import stats from '@ohos.bundleState'; import stats from '@ohos.bundleState' // Promise mode - stats.queryBundleStateInfoByInterval(0, 0, 20000000000000).then( res => { + stats.queryBundleStateInfoByInterval(0, 0, 20000000000000).then(res => { console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval promise success.'); for (let i = 0; i < res.length; i++) { console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval promise number : ' + (i + 1)); console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval promise result ' + JSON.stringify(res[i])); } - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval promise failed, because: ' + err.code); }); @@ -179,14 +178,14 @@ import stats from '@ohos.bundleState'; ```js import stats from '@ohos.bundleState' - + // Promise mode - stats.queryAppUsagePriorityGroup().then( res => { + stats.queryAppUsagePriorityGroup().then(res => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise succeeded. result: ' + JSON.stringify(res)); - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise failed. because: ' + err.code); }); - + // Callback mode stats.queryAppUsagePriorityGroup((err, res) => { if (err) { @@ -196,16 +195,16 @@ import stats from '@ohos.bundleState'; } }); ``` - + 7. Check whether the application specified by **bundleName** is in the idle state. This requires no permission to be configured in the **config.json** file. A third-party application can only check the idle status of itself. ```js import stats from '@ohos.bundleState' // Promise mode - stats.isIdleState("com.ohos.camera").then( res => { + stats.isIdleState("com.ohos.camera").then(res => { console.log('BUNDLE_ACTIVE isIdleState promise succeeded, result: ' + JSON.stringify(res)); - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE isIdleState promise failed, because: ' + err.code); }); @@ -225,18 +224,18 @@ import stats from '@ohos.bundleState'; import stats from '@ohos.bundleState' // Promise mode - stats.getRecentlyUsedModules(1000).then( res => { + stats.getRecentlyUsedModules(1000).then(res => { console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise succeeded'); for (let i = 0; i < res.length; i++) { console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise number : ' + (i + 1)); console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise result ' + JSON.stringify(res[i])); } - }).catch( err=> { + }).catch(err=> { console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise failed, because: ' + err.code); }); // Promise mode when maxNum is not specified - stats.getRecentlyUsedModules().then( res => { + stats.getRecentlyUsedModules().then(res => { console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise succeeded'); for (let i = 0; i < res.length; i++) { console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise number : ' + (i + 1)); @@ -247,7 +246,7 @@ import stats from '@ohos.bundleState'; }); // Asynchronous callback mode - stats.getRecentlyUsedModules(1000,(err, res) => { + stats.getRecentlyUsedModules(1000, (err, res) => { if(err) { console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code); } else { @@ -261,7 +260,7 @@ import stats from '@ohos.bundleState'; // Asynchronous callback mode when maxNum is not specified stats.getRecentlyUsedModules((err, res) => { - if(err) { + if (err) { console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code); } else { console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback succeeded.'); @@ -279,10 +278,10 @@ import stats from '@ohos.bundleState'; import stats from '@ohos.bundleState' // Promise mode - stats.queryAppNotificationNumber(0, 20000000000000).then( res => { + stats.queryAppNotificationNumber(0, 20000000000000).then(res => { console.log('BUNDLE_ACTIVE queryAppNotificationNumber promise success.'); console.log('BUNDLE_ACTIVE queryAppNotificationNumber promise result ' + JSON.stringify(res)); - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE queryAppNotificationNumber promise failed, because: ' + err.code); }); @@ -301,15 +300,15 @@ import stats from '@ohos.bundleState'; ```js import stats from '@ohos.bundleState' - + // Promise mode - stats.queryBundleActiveEventStates(0, 20000000000000).then( res => { + stats.queryBundleActiveEventStates(0, 20000000000000).then(res => { console.log('BUNDLE_ACTIVE queryBundleActiveEventStates promise success.'); console.log('BUNDLE_ACTIVE queryBundleActiveEventStates promise result ' + JSON.stringify(res)); - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE queryBundleActiveEventStates promise failed, because: ' + err.code); }); - + // Asynchronous callback mode stats.queryBundleActiveEventStates(0, 20000000000000, (err, res) => { if (err) { @@ -325,14 +324,14 @@ import stats from '@ohos.bundleState'; ```js import stats from '@ohos.bundleState' - + // Promise mode without parameters - stats.queryAppUsagePriorityGroup().then( res => { + stats.queryAppUsagePriorityGroup().then(res => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise succeeded. result: ' + JSON.stringify(res)); - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise failed. because: ' + err.code); }); - + // Asynchronous callback mode without parameters stats.queryAppUsagePriorityGroup((err, res) => { if (err) { @@ -341,17 +340,17 @@ import stats from '@ohos.bundleState'; console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback succeeded. result: ' + JSON.stringify(res)); } }); - + // Promise mode with parameters - stats.queryAppUsagePriorityGroup(this.bundleName).then( res => { + stats.queryAppUsagePriorityGroup(this.bundleName).then(res => { console.log('BUNDLE_ACTIVE QueryPackageGroup promise succeeded. result: ' + JSON.stringify(res)); - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE QueryPackageGroup promise failed. because: ' + err.code); }); - + // Asynchronous callback mode with parameters stats.queryAppUsagePriorityGroup(this.bundleName, (err, res) => { - if(err) { + if (err) { console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code); } else { console.log('BUNDLE_ACTIVE QueryPackageGroup callback succeeded. result: ' + JSON.stringify(res)); @@ -363,16 +362,16 @@ import stats from '@ohos.bundleState'; ```javascript import stats from '@ohos.bundleState' - + // Promise mode - stats.setBundleGroup(this.bundleName, this.newGroup).then( () => { + stats.setBundleGroup(this.bundleName, this.newGroup).then(() => { console.log('BUNDLE_ACTIVE SetBundleGroup promise succeeded.'); }).catch( err => { console.log('BUNDLE_ACTIVE SetBundleGroup promise failed. because: ' + err.code); }); // Asynchronous callback mode stats.setBundleGroup(this.bundleName, this.newGroup, (err) => { - if(err) { + if (err) { console.log('BUNDLE_ACTIVE SetBundleGroup callback failed. because: ' + err.code); } else { console.log('BUNDLE_ACTIVE SetBundleGroup callback succeeded.'); @@ -384,9 +383,9 @@ import stats from '@ohos.bundleState'; ```javascript import stats from '@ohos.bundleState' - + // Promise mode - let onBundleGroupChanged = (err,res) =>{ + let onBundleGroupChanged = (err,res) => { console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.'); console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result oldGroup is : ' + res.oldGroup); console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result newGroup is : ' + res.newGroup); @@ -394,13 +393,13 @@ import stats from '@ohos.bundleState'; console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result userId is : ' + res.userId); console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result bundleName is : ' + res.bundleName); }; - stats.registerGroupCallBack(onBundleGroupChanged).then( () => { + stats.registerGroupCallBack(onBundleGroupChanged).then(() => { console.log('BUNDLE_ACTIVE RegisterGroupCallBack promise succeeded.'); - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE RegisterGroupCallBack promise failed. because: ' + err.code); }); // Asynchronous callback mode - let onBundleGroupChanged = (err,res) =>{ + let onBundleGroupChanged = (err,res) => { console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.'); console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's oldGroup is : ' + res.oldGroup); console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's newGroup is : ' + res.newGroup); @@ -408,29 +407,29 @@ import stats from '@ohos.bundleState'; console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's userId is : ' + res.userId); console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's bundleName is : ' + res.bundleName); }; - stats.registerGroupCallBack(onBundleGroupChanged, (err)=>{ - if(err) { + stats.registerGroupCallBack(onBundleGroupChanged, (err) => { + if (err) { console.log('BUNDLE_ACTIVE RegisterGroupCallBack callback failed, because: ' + err.code); } else { console.log('BUNDLE_ACTIVE RegisterGroupCallBack callback success.'); } }); ``` - + 13. Deregister the callback for application group changes. ```javascript import stats from '@ohos.bundleState' - + //promise - stats.unRegisterGroupCallBack().then( () => { + stats.unRegisterGroupCallBack().then(() => { console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack promise succeeded.'); - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack promise failed. because: ' + err.code); }); //callback - stats.unRegisterGroupCallBack((err)=>{ - if(err) { + stats.unRegisterGroupCallBack((err) => { + if (err) { console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack callback failed, because: ' + err.code); } else { console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack callback success.'); diff --git a/en/application-dev/device/device-location-geocoding.md b/en/application-dev/device/device-location-geocoding.md index cfb2504ff30266bdba5699b44f5f0577cc953ea9..f95df63eebe64eedb6063ae193f4b141bfd946c6 100644 --- a/en/application-dev/device/device-location-geocoding.md +++ b/en/application-dev/device/device-location-geocoding.md @@ -3,9 +3,9 @@ ## When to Use -Describing a location using coordinates is accurate, but neither intuitive nor user-friendly. +Describing a location using coordinates is accurate, but neither intuitive nor user-friendly. With the geocoding and reverse geocoding capabilities, you will be able to convert geographic description into specific coordinates and vice versa. -With the geocoding and reverse geocoding capabilities, you will be able to convert geographic description into specific coordinates and vice versa. The geocoding information describes a location using several attributes, including the country, administrative region, street, house number, and address, etc. +The geographic description helps users understand a location easily by providing several key attributes, for example, country, administrative region, street, house number, and address. ## Available APIs @@ -16,17 +16,18 @@ The following table describes APIs available for mutual conversion between coord | API | Description | | -------- | -------- | -| isGeoServiceAvailable(callback: AsyncCallback<boolean>) : void | Checks whether the (reverse) geocoding service is available. This function uses an asynchronous callback to return the result. | -| isGeoServiceAvailable() : Promise<boolean> | Checks whether the (reverse) geocoding service is available. This function uses a promise to return the result. | -| getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>) : void | Converts coordinates into geographic description through reverse geocoding. This function uses an asynchronous callback to return the result. | -| getAddressesFromLocation(request: ReverseGeoCodeRequest) : Promise<Array<GeoAddress>>; | Converts coordinates into geographic description through reverse geocoding. This function uses a promise to return the result. | -| getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>) : void | Converts geographic description into coordinates through geocoding. This function uses an asynchronous callback to return the result. | -| getAddressesFromLocationName(request: GeoCodeRequest) : Promise<Array<GeoAddress>> | Converts geographic description into coordinates through geocoding. This function uses a promise to return the result. | +| isGeoServiceAvailable(callback: AsyncCallback<boolean>) : void | Checks whether the (reverse) geocoding service is available. This function uses an asynchronous callback to return the result. | +| isGeoServiceAvailable() : Promise<boolean> | Checks whether the (reverse) geocoding service is available. This function uses a promise to return the result. | +| getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>) : void | Converts coordinates into geographic description through reverse geocoding. This function uses an asynchronous callback to return the result. | +| getAddressesFromLocation(request: ReverseGeoCodeRequest) : Promise<Array<GeoAddress>>; | Converts coordinates into geographic description through reverse geocoding. This function uses a promise to return the result. | +| getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>) : void | Converts geographic description into coordinates through geocoding. This function uses an asynchronous callback to return the result. | +| getAddressesFromLocationName(request: GeoCodeRequest) : Promise<Array<GeoAddress>> | Converts geographic description into coordinates through geocoding. This function uses a promise to return the result. | ## How to Develop -> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> > The **GeoConvert** instance needs to access backend services to obtain information. Therefore, before performing the following steps, ensure that your device is connected to the network. 1. Import the **geolocation** module by which you can implement all APIs related to the geocoding and reverse geocoding conversion capabilities. @@ -35,26 +36,46 @@ The following table describes APIs available for mutual conversion between coord import geolocation from '@ohos.geolocation'; ``` -2. Obtain the conversion result. +2. Query whether geocoder service is available. + - Call **isGeoServiceAvailable** to query whether the geocoder service is available. If the service is available, continue with step 3. + ``` + geolocation.isGeoServiceAvailable((err, data) => { + if (err) { + console.log('isGeoServiceAvailable err: ' + JSON.stringify(err)); + } else { + console.log('isGeoServiceAvailable data: ' + JSON.stringify(data)); + } + }); + ``` + +3. Obtain the conversion result. - Call **getAddressesFromLocation** to convert coordinates into geographical location information. ``` var reverseGeocodeRequest = {"latitude": 31.12, "longitude": 121.11, "maxItems": 1}; - geolocation.getAddressesFromLocation(reverseGeocodeRequest, (data) => { - console.log('getAddressesFromLocation: ' + JSON.stringify(data)); + geolocation.getAddressesFromLocation(reverseGeocodeRequest, (err, data) => { + if (err) { + console.log('getAddressesFromLocation err: ' + JSON.stringify(err)); + } else { + console.log('getAddressesFromLocation data: ' + JSON.stringify(data)); + } }); ``` - Your application can obtain the **GeoAddress** list that matches the specified coordinates and then read location information from it. For details, see the _API Reference_. + Your application can obtain the **GeoAddress** list that matches the specified coordinates and then read location information from it. For details, see [Geolocation](../reference/apis/js-apis-geolocation.md). - Call **getAddressesFromLocationName** to convert geographic description into coordinates. ``` var geocodeRequest = {"description": "No. xx, xx Road, Pudong District, Shanghai", "maxItems": 1}; - geolocation.getAddressesFromLocationName(geocodeRequest, (data) => { - console.log('getAddressesFromLocationName: ' + JSON.stringify(data)); + geolocation.getAddressesFromLocationName(geocodeRequest, (err, data) => { + if (err) { + console.log('getAddressesFromLocationName err: ' + JSON.stringify(err)); + } else { + console.log('getAddressesFromLocationName data: ' + JSON.stringify(data)); + } }); ``` - Your application can obtain the **GeoAddress** list that matches the specified location information and read coordinates from it. For details, see the _API Reference_. + Your application can obtain the **GeoAddress** list that matches the specified location information and read coordinates from it. For details, see [Geolocation](../reference/apis/js-apis-geolocation.md). To improve the accuracy of location results, you can set the longitude and latitude ranges in **GeoCodeRequest**. diff --git a/en/application-dev/device/device-location-info.md b/en/application-dev/device/device-location-info.md index 84f189d7f247bd9516204c7dd0d76aafb6438dbb..dce40ff38546fe1b86a60bf670cb18adf9e15968 100644 --- a/en/application-dev/device/device-location-info.md +++ b/en/application-dev/device/device-location-info.md @@ -123,7 +123,7 @@ To learn more about the APIs for obtaining device location information, see [Geo The following example instantiates the **RequestParam** object for navigation: ``` - var requestInfo = {'scenario': 0x301, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0}; + var requestInfo = {'scenario': geolocation.LocationRequestScenario.NAVIGATION, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0}; ``` **Method 2:** @@ -152,7 +152,7 @@ To learn more about the APIs for obtaining device location information, see [Geo The following example instantiates the **RequestParam** object for the location accuracy priority policy: ``` - var requestInfo = {'priority': 0x201, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0}; + var requestInfo = {'priority': geolocation.LocationRequestPriority.ACCURACY, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0}; ``` 4. Instantiate the **Callback** object for the system to report location results. @@ -179,8 +179,12 @@ To learn more about the APIs for obtaining device location information, see [Geo If your application does not need the real-time device location, it can use the last known device location cached in the system instead. ``` - geolocation.getLastLocation((data) => { - console.log('getLastLocation: data: ' + JSON.stringify(data)); + geolocation.getLastLocation((err, data) => { + if (err) { + console.log('getLastLocation: err: ' + JSON.stringify(err)); + } else { + console.log('getLastLocation: data: ' + JSON.stringify(data)); + } }); ``` diff --git a/en/application-dev/device/sensor-guidelines.md b/en/application-dev/device/sensor-guidelines.md index b2d3d9ce0f27cb9ec91849b8a178c57b608eec4a..99c6cc6c045a6f7d9a813372af163ab1eaa2efe1 100644 --- a/en/application-dev/device/sensor-guidelines.md +++ b/en/application-dev/device/sensor-guidelines.md @@ -135,8 +135,3 @@ console.error(error); } ``` -## Samples - -The following sample is provided to help you better understand how to develop sensors: - -- [`Sensor`: sensor (eTS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/device/Sensor) diff --git a/en/application-dev/device/vibrator-guidelines.md b/en/application-dev/device/vibrator-guidelines.md index 88b71376c0be5293980a70954cb9a918267ed829..ab4c8234ba4147008ea9515d20e23506eddd3f13 100644 --- a/en/application-dev/device/vibrator-guidelines.md +++ b/en/application-dev/device/vibrator-guidelines.md @@ -84,9 +84,3 @@ For details about the APIs, see [Vibrator](../reference/apis/js-apis-vibrator.md } }) ``` - -## Samples - -The following sample is provided to help you better understand how to develop vibrators: - -- [`Vibrator`: vibrator (eTS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/device/Vibrator) diff --git a/en/application-dev/dfx/Readme-EN.md b/en/application-dev/dfx/Readme-EN.md index 06b61fb2e8e733f0762e0f1f5ddae9ea81344396..b8c6422a63e1f3fb8bd012a3e4175de1da055d8f 100644 --- a/en/application-dev/dfx/Readme-EN.md +++ b/en/application-dev/dfx/Readme-EN.md @@ -9,3 +9,5 @@ - Distributed Call Chain Tracing - [Overview of Distributed Call Chain Tracing](hitracechain-overview.md) - [Development of Distributed Call Chain Tracing](hitracechain-guidelines.md) +- Error Management + - [Development of Error Manager](errormanager-guidelines.md) diff --git a/en/application-dev/dfx/errormanager-guidelines.md b/en/application-dev/dfx/errormanager-guidelines.md new file mode 100644 index 0000000000000000000000000000000000000000..835a6ab9ce3c0beacd19f7c76f5a1eec68bf36cd --- /dev/null +++ b/en/application-dev/dfx/errormanager-guidelines.md @@ -0,0 +1,90 @@ +# Development of Error Manager + +## When to Use + +If coding specification issues or errors exist in the code of an application, the application may encounter unexpected errors, for example, uncaught exceptions or application lifecycle timeouts, while it is running. In such a case, the application may exit unexpectedly. Error logs, however, are usually stored on users' local storage, making it inconvenient to locate faults. With the APIs provided by the **errorManager** module, your application will be able to report related errors and logs to your service platform for fault locating before it exits. + +## Available APIs + +Application error management APIs are provided by the **errorManager** module. For details about how to import the module to use related APIs, see [Development Example](#development-example). + +**Table 1** Description of application error management APIs + +| API | Description | +| ------------------------------------------------------------ | ---------------------------------------------------- | +| registerErrorObserver(observer: ErrorObserver): number | Registers an observer for application errors. A callback will be invoked when an application error is detected. This API works in a synchronous manner. The return value is the SN of the registered observer.| +| unregisterErrorObserver(observerId: number, callback: AsyncCallback\): void | Unregisters an observer in callback mode. The number passed to this API is the SN of the registered observer. | +| unregisterErrorObserver(observerId: number): Promise\ | Unregisters an observer in promise mode. The number passed to this API is the SN of the registered observer. | + +When an asynchronous callback is used, the return value can be processed directly in the callback. If a promise is used, the return value can also be processed in the promise in a similar way. For details about the result codes, see [Result Codes for Unregistering an Observer](#result-codes-for-unregistering-an-observer). + + +**Table 2** Description of the ErrorObserver API + +| API | Description | +| ------------------------------ | ------------------------------------------------------------ | +| onUnhandledException(errMsg: string): void | Called when an application generates an uncaught exception after being registered.| + + +### Result Codes for Unregistering an Observer + +| Result Code| Description | +| ------ | --------------------------- | +| 0 | Normal. | +| -1 | Input number not exist. | +| -2 | Invalid parameter. | + +## Development Example +```ts +import Ability from '@ohos.application.Ability' +import errorManager from '@ohos.application.errorManager' + +var registerId = -1; +var callback = { + onUnhandledException: function (errMsg) { + console.log(errMsg); + } +} +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created for this ability. + console.log("[Demo] MainAbility onWindowStageCreate") + + globalThis.registerObserver = (() => { + registerId = errorManager.registerErrorObserver(callback); + }) + + globalThis.unRegisterObserver = (() => { + errorManager.unregisterErrorObserver(registerId, (result) => { + console.log("[Demo] result " + result.code + ";" + result.message) + }); + }) + + windowStage.setUIContent(this.context, "pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed to release UI resources. + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability is brought to the foreground. + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability is brought back to the background. + console.log("[Demo] MainAbility onBackground") + } +}; +``` diff --git a/en/application-dev/dfx/hiappevent-guidelines.md b/en/application-dev/dfx/hiappevent-guidelines.md index ee553b735fb510d78ee6531e0a8a71fa99fc53bb..e1d4cddeb2ff96c8a07a6df84382ad0b8d22464c 100644 --- a/en/application-dev/dfx/hiappevent-guidelines.md +++ b/en/application-dev/dfx/hiappevent-guidelines.md @@ -88,9 +88,3 @@ In this example, an application event is logged after the application startup ex ``` 2. Tap the run button on the application UI to run the project. - -## Samples - -The following sample is provided to help you better understand how to develop the application event logging feature: - -- [`JsDotTest`: Event Logging Test (JavaScript) (API 8)](https://gitee.com/openharmony/app_samples/tree/master/DFX/JsDotTest) diff --git a/en/application-dev/internationalization/intl-guidelines.md b/en/application-dev/internationalization/intl-guidelines.md index 378ea532cde2618b55ecced01f05a697eb629805..09bc3b733346db921cd04b76aff04b41d60af0b9 100644 --- a/en/application-dev/internationalization/intl-guidelines.md +++ b/en/application-dev/internationalization/intl-guidelines.md @@ -50,21 +50,21 @@ Use [Locale](../reference/apis/js-apis-intl.md) APIs to maximize or minimize loc 2. Obtain the string representing a **Locale** object.
Call the **toString** method to obtain the string representing a **Locale** object, which includes the language, region, and other options. - + ``` var localeStr = localeObj.toString(); ``` 3. Maximize locale information.
Call the **maximize** method to maximize locale information; that is, supplement the missing script and region information. - + ``` var maximizedLocale = localeObj.maximize(); ``` 4. Minimize locale information.
Call the **minimize** method to minimize locale information; that is, delete the unnecessary script and region information. - + ``` var minimizedLocale = localeObj.minimize(); ``` @@ -105,7 +105,7 @@ Use [DateTimeFormat](../reference/apis/js-apis-intl.md) APIs to format the date 2. Format the date and time.
Call the **format** method to format the date and time in the **DateTimeFormat** object. This method returns a string representing the formatting result. - + ``` Date date = new Date(); var formatResult = dateTimeFormat.format(date); @@ -113,7 +113,7 @@ Use [DateTimeFormat](../reference/apis/js-apis-intl.md) APIs to format the date 3. Format a period.
Call the **formatRange** method to format the period in the **DateTimeFormat** object. This method requires input of two **Date** objects, which respectively indicate the start date and end date of a period. This method returns a string representing the formatting result. - + ``` Date startDate = new Date(); Date endDate = new Date(); @@ -122,7 +122,7 @@ Use [DateTimeFormat](../reference/apis/js-apis-intl.md) APIs to format the date 4. Obtain attributes of the **DateTimeFormat** object.
Call the **resolvedOptions** method to obtain attributes of the **DateTimeFormat** object. This method will return an array that contains all attributes and values of the object. - + ``` var options = dateTimeFormat.resolvedOptions(); ``` @@ -162,7 +162,7 @@ Use [NumberFormat](../reference/apis/js-apis-intl.md) APIs to format numbers for 2. Format a number.
Call the **format** method to format a number. A string is returned as the formatting result. - + ``` var number = 1234.5678 var formatResult = numberFormat.format(number); @@ -170,7 +170,7 @@ Use [NumberFormat](../reference/apis/js-apis-intl.md) APIs to format numbers for 3. Obtain attributes of the **NumberFormat** object.
Call the **resolvedOptions** method to obtain attributes of the **NumberFormat** object. This method will return an array that contains all attributes and values of the object. - + ``` var options = numberFormat.resolvedOptions(); ``` @@ -209,7 +209,7 @@ Use [Collator](../reference/apis/js-apis-intl.md) APIs to sort strings based on 2. Compare two strings.
Call the **compare** method to compare two input strings. This method returns a value as the comparison result. The return value **-1** indicates that the first string is shorter than the second string, the return value **1** indicates that the first string is longer than the second string, and the return value **0** indicates that the two strings are of equal lengths. - + ``` var str1 = "first string"; var str2 = "second string"; @@ -218,7 +218,7 @@ Use [Collator](../reference/apis/js-apis-intl.md) APIs to sort strings based on 3. Obtain attributes of the **Collator** object.
Call the **resolvedOptions** method to obtain attributes of the **Collator** object. This method will return an array that contains all attributes and values of the object. - + ``` var options = collator.resolvedOptions(); ``` @@ -256,7 +256,7 @@ Use [PluralRules](../reference/apis/js-apis-intl.md) APIs to determine the singu 2. Determine the singular-plural type.
Call the **select** method to determine the singular-plural type of an input number. This method will return a string representing the singular-plural type, which can be any of the following: **zero**, **one**, **two**, **few**, **many**, and **other**. - + ``` var number = 1234.5678 var categoryResult = plurals.select(number); @@ -297,7 +297,7 @@ Use [RelativeTimeFormat](../reference/apis/js-apis-intl.md) APIs to format the r 2. Format the relative time.
Call the **format** method to format the relative time. This method receives a numeric value representing the time length and a string-form unit, like **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, and **second**. This method returns a string representing the formatting result. - + ``` var number = 2; var unit = "year" @@ -306,7 +306,7 @@ Use [RelativeTimeFormat](../reference/apis/js-apis-intl.md) APIs to format the r 3. Obtain each part of the relative time format.
Upon obtaining each part of the relative time format, customize the relative time formatting result. - + ``` var number = 2; var unit = "year" @@ -315,13 +315,7 @@ Use [RelativeTimeFormat](../reference/apis/js-apis-intl.md) APIs to format the r 4. Obtain attributes of the **RelativeTimeFormat** object.
Call the **resolvedOptions** method to obtain attributes of the **RelativeTimeFormat** object. This method will return an array that contains all attributes and values of the object. For a full list of attributes, see [ RelativeTimeFormatResolvedOptions](../reference/apis/js-apis-intl.md). - + ``` var options = numberFormat.resolvedOptions(); ``` - -## Samples - -The following sample is provided to help you better understand how to develop internationalization capabilities: - --[`International`: Internationalization (JS) (API8)](https://gitee.com/openharmony/app_samples/tree/master/UI/International) diff --git a/en/application-dev/media/audio-playback.md b/en/application-dev/media/audio-playback.md index cabf6a85c3638656585ff7e315701408c12467bc..2b0f260908c9e2986269601e588659ce6ce119fc 100644 --- a/en/application-dev/media/audio-playback.md +++ b/en/application-dev/media/audio-playback.md @@ -39,36 +39,36 @@ function printfDescription(obj) { // Set the player callbacks. function setCallBack(audioPlayer) { - audioPlayer.on('dataLoad', () => { // Set the dataLoad event callback, which is triggered when the src attribute is set successfully. + audioPlayer.on('dataLoad', () => { // Set the 'dataLoad' event callback, which is triggered when the src attribute is set successfully. console.info('audio set source success'); - audioPlayer.play(); // The play() API can be invoked only after the dataLoad event callback is complete. The play event callback is then triggered. + audioPlayer.play(); // The play() API can be invoked only after the 'dataLoad' event callback is complete. The 'play' event callback is then triggered. }); - audioPlayer.on('play', () => { // Set the play event callback. + audioPlayer.on('play', () => { // Set the 'play' event callback. console.info('audio play success'); - audioPlayer.pause(); // Trigger the pause event callback and pause the playback. + audioPlayer.pause(); // Trigger the 'pause' event callback and pause the playback. }); - audioPlayer.on('pause', () => { // Set the pause event callback. + audioPlayer.on('pause', () => { // Set the 'pause' event callback. console.info('audio pause success'); - audioPlayer.seek(5000); // Trigger the timeUpdate event callback, and seek to 5000 ms for playback. + audioPlayer.seek(5000); // Trigger the 'timeUpdate' event callback, and seek to 5000 ms for playback. }); - audioPlayer.on('stop', () => { // Set the stop event callback. + audioPlayer.on('stop', () => { // Set the 'stop' event callback. console.info('audio stop success'); - audioPlayer.reset(); // Trigger the reset event callback, and reconfigure the src attribute to switch to the next song. + audioPlayer.reset(); // Trigger the 'reset' event callback, and reconfigure the src attribute to switch to the next song. }); - audioPlayer.on('reset', () => { // Set the reset event callback. + audioPlayer.on('reset', () => { // Set the 'reset' event callback. console.info('audio reset success'); - audioPlayer.release(); // Release the AudioPlayer resources. + audioPlayer.release(); // Release the AudioPlayer instance. audioPlayer = undefined; }); - audioPlayer.on('timeUpdate', (seekDoneTime) => {// Set the timeUpdate event callback. + audioPlayer.on('timeUpdate', (seekDoneTime) => {// Set the 'timeUpdate' event callback. if (typeof(seekDoneTime) == 'undefined') { console.info('audio seek fail'); return; } console.info('audio seek success, and seek time is ' + seekDoneTime); - audioPlayer.setVolume(0.5); // Trigger the volumeChange event callback. + audioPlayer.setVolume(0.5); // Trigger the 'volumeChange' event callback. }); - audioPlayer.on('volumeChange', () => { // Set the volumeChange event callback. + audioPlayer.on('volumeChange', () => { // Set the 'volumeChange' event callback. console.info('audio volumeChange success'); audioPlayer.getTrackDescription((error, arrlist) => { // Obtain the audio track information in callback mode. if (typeof (arrlist) != 'undefined') { @@ -78,13 +78,13 @@ function setCallBack(audioPlayer) { } else { console.log(`audio getTrackDescription fail, error:${error.message}`); } - audioPlayer.stop(); // Trigger the stop event callback to stop the playback. + audioPlayer.stop(); // Trigger the 'stop' event callback to stop the playback. }); }); - audioPlayer.on('finish', () => { // Set the finish event callback, which is triggered when the playback is complete. + audioPlayer.on('finish', () => { // Set the 'finish' event callback, which is triggered when the playback is complete. console.info('audio play finish'); }); - audioPlayer.on('error', (error) => { // Set the error event callback. + audioPlayer.on('error', (error) => { // Set the 'error' event callback. console.info(`audio error called, errName is ${error.name}`); console.info(`audio error called, errCode is ${error.code}`); console.info(`audio error called, errMessage is ${error.message}`); @@ -107,7 +107,7 @@ async function audioPlayerDemo() { }).catch((err) => { console.info('open fd failed err is' + err); }); - audioPlayer.src = fdPath; // Set the src attribute and trigger the dataLoad event callback. + audioPlayer.src = fdPath; // Set the src attribute and trigger the 'dataLoad' event callback. } ``` @@ -119,16 +119,16 @@ import fileIO from '@ohos.fileio' export class AudioDemo { // Set the player callbacks. setCallBack(audioPlayer) { - audioPlayer.on('dataLoad', () => { // Set the dataLoad event callback, which is triggered when the src attribute is set successfully. + audioPlayer.on('dataLoad', () => { // Set the 'dataLoad' event callback, which is triggered when the src attribute is set successfully. console.info('audio set source success'); - audioPlayer.play(); // Call the play() API to start the playback and trigger the play event callback. + audioPlayer.play(); // Call the play() API to start the playback and trigger the 'play' event callback. }); - audioPlayer.on('play', () => { // Set the play event callback. + audioPlayer.on('play', () => { // Set the 'play' event callback. console.info('audio play success'); }); - audioPlayer.on('finish', () => { // Set the finish event callback, which is triggered when the playback is complete. + audioPlayer.on('finish', () => { // Set the 'finish' event callback, which is triggered when the playback is complete. console.info('audio play finish'); - audioPlayer.release(); // Release the AudioPlayer resources. + audioPlayer.release(); // Release the AudioPlayer instance. audioPlayer = undefined; }); } @@ -147,7 +147,7 @@ export class AudioDemo { }).catch((err) => { console.info('open fd failed err is' + err); }); - audioPlayer.src = fdPath; // Set the src attribute and trigger the dataLoad event callback. + audioPlayer.src = fdPath; // Set the src attribute and trigger the 'dataLoad' event callback. } } ``` @@ -161,15 +161,15 @@ export class AudioDemo { // Set the player callbacks. private isNextMusic = false; setCallBack(audioPlayer) { - audioPlayer.on('dataLoad', () => { // Set the dataLoad event callback, which is triggered when the src attribute is set successfully. + audioPlayer.on('dataLoad', () => { // Set the 'dataLoad' event callback, which is triggered when the src attribute is set successfully. console.info('audio set source success'); - audioPlayer.play(); // Call the play() API to start the playback and trigger the play event callback. + audioPlayer.play(); // Call the play() API to start the playback and trigger the 'play' event callback. }); - audioPlayer.on('play', () => { // Set the play event callback. + audioPlayer.on('play', () => { // Set the 'play' event callback. console.info('audio play success'); - audioPlayer.reset(); // Call the reset() API and trigger the reset event callback. + audioPlayer.reset(); // Call the reset() API and trigger the 'reset' event callback. }); - audioPlayer.on('reset', () => { // Set the reset event callback. + audioPlayer.on('reset', () => { // Set the 'reset' event callback. console.info('audio play success'); if (!this.isNextMusic) { // When isNextMusic is false, changing songs is implemented. this.nextMusic(audioPlayer); // Changing songs is implemented. @@ -193,7 +193,7 @@ export class AudioDemo { }).catch((err) => { console.info('open fd failed err is' + err); }); - audioPlayer.src = nextFdPath; // Set the src attribute and trigger the dataLoad event callback. + audioPlayer.src = nextFdPath; // Set the src attribute and trigger the 'dataLoad' event callback. } async audioPlayerDemo() { @@ -210,7 +210,7 @@ export class AudioDemo { }).catch((err) => { console.info('open fd failed err is' + err); }); - audioPlayer.src = fdPath; // Set the src attribute and trigger the dataLoad event callback. + audioPlayer.src = fdPath; // Set the src attribute and trigger the 'dataLoad' event callback. } } ``` @@ -223,12 +223,12 @@ import fileIO from '@ohos.fileio' export class AudioDemo { // Set the player callbacks. setCallBack(audioPlayer) { - audioPlayer.on('dataLoad', () => { // Set the dataLoad event callback, which is triggered when the src attribute is set successfully. + audioPlayer.on('dataLoad', () => { // Set the 'dataLoad' event callback, which is triggered when the src attribute is set successfully. console.info('audio set source success'); audioPlayer.loop = true; // Set the loop playback attribute. - audioPlayer.play(); // Call the play() API to start the playback and trigger the play event callback. + audioPlayer.play(); // Call the play() API to start the playback and trigger the 'play' event callback. }); - audioPlayer.on('play', () => { // Sets the play event callback to start loop playback. + audioPlayer.on('play', () => { // Set the 'play' event callback to start loop playback. console.info('audio play success'); }); } @@ -247,17 +247,7 @@ export class AudioDemo { }).catch((err) => { console.info('open fd failed err is' + err); }); - audioPlayer.src = fdPath; // Set the src attribute and trigger the dataLoad event callback. + audioPlayer.src = fdPath; // Set the src attribute and trigger the 'dataLoad' event callback. } } ``` - -## Samples - -The following samples are provided to help you better understand how to develop audio playback: - -- [`JsDistributedMusicPlayer`: Distributed Music Player (JS, API version 7)](https://gitee.com/openharmony/app_samples/tree/master/ability/JsDistributedMusicPlayer) -- [`JsAudioPlayer`: Audio Playback and Management (JS, API version 7)](https://gitee.com/openharmony/app_samples/tree/master/media/JsAudioPlayer) -- [`eTsAudioPlayer`: Audio Player (eTS)](https://gitee.com/openharmony/app_samples/blob/master/media/Recorder/entry/src/main/ets/MainAbility/pages/Play.ets) -- [Audio Player](https://gitee.com/openharmony/codelabs/tree/master/Media/Audio_OH_ETS) - diff --git a/en/application-dev/media/audio-recorder.md b/en/application-dev/media/audio-recorder.md index fa43dff19c7488520dd459d53ae326739cdb0fef..6fb1c28efa8bd8bd69e16b09cd577ec4bdeff6e6 100644 --- a/en/application-dev/media/audio-recorder.md +++ b/en/application-dev/media/audio-recorder.md @@ -186,12 +186,3 @@ export class AudioRecorderDemo { } ``` -## Samples - -The following samples are provided to help you better understand how to develop audio recording: - -- [`Recorder`: Recorder (eTS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/media/Recorder) -- [`JsRecorder`: Recorder (JS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/media/JSRecorder) -- [`eTsAudioPlayer`: Audio Player (eTS)](https://gitee.com/openharmony/app_samples/blob/master/media/Recorder/entry/src/main/ets/MainAbility/pages/Play.ets) -- [Audio Player](https://gitee.com/openharmony/codelabs/tree/master/Media/Audio_OH_ETS) - diff --git a/en/application-dev/media/image.md b/en/application-dev/media/image.md index cabbd86899cc050a81ee5dba5d834593d6e7b9ee..a262b3e219970b107ee5debdbc1254907f9d3e22 100644 --- a/en/application-dev/media/image.md +++ b/en/application-dev/media/image.md @@ -15,19 +15,19 @@ For details about the APIs, see [Image Processing](../reference/apis/js-apis-ima The full process includes creating an instance, reading image information, reading and writing pixel maps, updating data, packaging pixels, and releasing resources. ```js -const Color = new ArrayBuffer(96); // Create a buffer to store image pixel data. +const color = new ArrayBuffer(96); // Create a buffer to store image pixel data. let opts = { alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: { height: 2, width: 3 } } // Image pixel data. // Create a PixelMap object. -const Color = new ArrayBuffer(96); +const color = new ArrayBuffer(96); let opts = { alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: { height: 2, width: 3 } } - image.createPixelMap(Color, opts, pixelmap => { + image.createPixelMap(color, opts, pixelmap => { expect(pixelmap !== null).assertTrue(); console.info('TC_001-1 success'); done(); }) // Read pixels. - pixelmap.readPixels(area,(data) => { +pixelmap.readPixels(area,(data) => { if(data !== null) { var bufferArr = new Uint8Array(area.pixels); var res = true; @@ -50,39 +50,39 @@ pixelmap.readPixelsToBuffer(readBuffer,() => { var bufferArr = new Uint8Array(readBuffer); var res = true; for (var i = 0; i < bufferArr.length; i++) { - if(res) { - if (bufferArr[i] !== 0) { - res = false; - console.info('TC_020-1 Success'); - expect(true).assertTrue(); - done(); - break; - } - } + if(res) { + if (bufferArr[i] !== 0) { + res = false; + console.info('TC_020-1 Success'); + expect(true).assertTrue(); + done(); + break; + } } +} // Write pixels. pixelmap.writePixels(area,() => { const readArea = { pixels: new ArrayBuffer(20), offset: 0, stride: 8, region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} - pixelmap.readPixels(readArea,() => { - var readArr = new Uint8Array(readArea.pixels); - var res = true; - for (var i = 0; i < readArr.length; i++) { - if(res) { - if (readArr[i] !== 0) { - res = false; - console.info('TC_022-1 Success'); - expect(true).assertTrue(); - done(); - break; - } - } + pixelmap.readPixels(readArea,() => { + var readArr = new Uint8Array(readArea.pixels); + var res = true; + for (var i = 0; i < readArr.length; i++) { + if(res) { + if (readArr[i] !== 0) { + res = false; + console.info('TC_022-1 Success'); + expect(true).assertTrue(); + done(); + break; + } } + } // Write pixels to the buffer. - pixelmap.writeBufferToPixels(writeColor).then(() => { - const readBuffer = new ArrayBuffer(96); - pixelmap.readPixelsToBuffer(readBuffer).then (() => { +pixelmap.writeBufferToPixels(writeColor).then(() => { + const readBuffer = new ArrayBuffer(96); + pixelmap.readPixelsToBuffer(readBuffer).then (() => { var bufferArr = new Uint8Array(readBuffer); var res = true; for (var i = 0; i < bufferArr.length; i++) { @@ -95,18 +95,18 @@ pixelmap.writePixels(area,() => { break; } } - } + } // Obtain image information. pixelmap.getImageInfo( imageInfo => { - if (imageInfo !== null) { - console.info('TC_024-1 imageInfo is ready'); - expect(imageInfo.size.height == 4).assertTrue(); - expect(imageInfo.size.width == 6).assertTrue(); - expect(imageInfo.pixelFormat == 4).assertTrue(); - done(); - } - }) + if (imageInfo !== null) { + console.info('TC_024-1 imageInfo is ready'); + expect(imageInfo.size.height == 4).assertTrue(); + expect(imageInfo.size.width == 6).assertTrue(); + expect(imageInfo.pixelFormat == 4).assertTrue(); + done(); + } +}) // Release the PixelMap object. pixelmap.release(()=>{ @@ -116,7 +116,7 @@ pixelmap.release(()=>{ }) // Create an image source (uri). -const imageSourceApi = image.createImageSource(path);//'/data/local/tmp/test.jpg' +const imageSourceApi = image.createImageSource(path); // '/data/local/tmp/test.jpg' // Create an image source (fd). const imageSourceApi = image.createImageSource(29); @@ -136,7 +136,7 @@ imagePackerApi.packing(imageSourceApi, packOpts, data => { console.info('TC_062-1 finished'); expect(data !== null).assertTrue(); done(); - }) +}) // Release the ImagePacker object. imagePackerApi.release(); @@ -148,7 +148,7 @@ imagePackerApi.release(); /data/local/tmp/test.jpg // Set the path for creating an image source. // Create an image source using a path. -const imageSourceApi = image.createImageSource(path);//'/data/local/tmp/test.jpg' +const imageSourceApi = image.createImageSource(path); // '/data/local/tmp/test.jpg' // Set parameters. let decodingOptions = { @@ -171,9 +171,9 @@ imageSourceApi.createPixelMap(decodingOptions, pixelmap => { // Create a pixel map in promise mode. imageSourceApi.createPixelMap().then(pixelmap => { - console.info('TC_050-11 createPixelMap '); - expect(pixelmap !== null ).assertTrue(); - done(); + console.info('TC_050-11 createPixelMap '); + expect(pixelmap !== null ).assertTrue(); + done(); }) // Capture error information when an exception occurs during function invoking. @@ -181,7 +181,7 @@ catch(error => { console.log('TC_050-11 error: ' + error); expect().assertFail(); done(); - }) +}) // Obtain the number of bytes in each line of pixels. pixelmap.getBytesNumberPerRow( num => { @@ -192,13 +192,13 @@ pixelmap.getBytesNumberPerRow( num => { // Obtain the total number of pixel bytes. pixelmap.getPixelBytesNumber(num => { - console.info('TC_026-1 num is ' + num); - expect(num == expectNum).assertTrue(); - done(); - }) + console.info('TC_026-1 num is ' + num); + expect(num == expectNum).assertTrue(); + done(); +}) // Obtain the pixel map information. - pixelmap.getImageInfo( imageInfo => {}) +pixelmap.getImageInfo( imageInfo => {}) // Print the failure information. console.info('TC_024-1 imageInfo is empty'); @@ -206,17 +206,17 @@ expect(false).assertTrue() // Release the PixelMap object. pixelmap.release(()=>{ - expect(true).assertTrue(); - console.log('TC_027-1 suc'); - done(); - }) + expect(true).assertTrue(); + console.log('TC_027-1 suc'); + done(); +}) // Capture release failure information. catch(error => { - console.log('TC_027-1 error: ' + error); - expect().assertFail(); - done(); - }) + console.log('TC_027-1 error: ' + error); + expect().assertFail(); + done(); +}) ``` ### Encoding Scenario @@ -225,14 +225,14 @@ catch(error => { /data/local/tmp/test.png // Set the path for creating an image source. // Set the image source. - const imageSourceApi = image.createImageSource(path);//'/data/local/tmp/test.png' +const imageSourceApi = image.createImageSource(path); // '/data/local/tmp/test.png' // Print the error message if the image source fails to be created. if (imageSourceApi == null) { - console.info('TC_062 create image source failed'); - expect(false).assertTrue(); - done(); - } + console.info('TC_062 create image source failed'); + expect(false).assertTrue(); + done(); +} // Create an image packer if the image source is successfully created. const imagePackerApi = image.createImagePacker(); @@ -242,31 +242,58 @@ if (imagePackerApi == null) { console.info('TC_062 create image packer failed'); expect(false).assertTrue(); done(); - } +} // Set encoding parameters if the image packer is successfully created. let packOpts = { format:["image/jpeg"], // The supported encoding format is jpg. - quality:98 }// Image quality, which ranges from 0 to 100. + quality:98 } // Image quality, which ranges from 0 to 100. // Encode the image. imagePackerApi.packing(imageSourceApi, packOpts) .then( data => { - console.info('TC_062 finished'); - expect(data !== null).assertTrue(); - done(); - }) + console.info('TC_062 finished'); + expect(data !== null).assertTrue(); + done(); +}) // Release the image packer after the encoding is complete. - imagePackerApi.release(); - +imagePackerApi.release(); + // Obtain the image source information. imageSourceApi.getImageInfo(imageInfo => { - console.info('TC_045 imageInfo'); - expect(imageInfo !== null).assertTrue(); - done(); - }) - + console.info('TC_045 imageInfo'); + expect(imageInfo !== null).assertTrue(); + done(); +}) + // Update incremental data. imageSourceIncrementalSApi.updateData(array, false, 0, 10,(error,data )=> {}) ``` + +### Using ImageReceiver + +Example scenario: The camera functions as the client to transmit image data to the server. + +```js +public async init(surfaceId: any) { + + // (Server code) Create an ImageReceiver object. + var receiver = image.createImageReceiver(8 * 1024, 8, image.ImageFormat.JPEG, 1); + + // Obtain the surface ID. + var surfaceId = await receiver.getReceivingSurfaceId(); + + // Register a surface listener, which is triggered after the buffer of the surface is ready. + receiver.on('imageArrival', () => { + // Obtain the latest buffer of the surface. + receiver.readNextImage((err, img) => { + img.getComponent(4, (err, component) => { + // Consume component.byteBuffer. For example, save the content in the buffer as an image. + }) + }) + }) + + // Call a Camera API to transfer the surface ID to the camera, which then obtains the surface based on the surface ID and generates a surface buffer. +} +``` diff --git a/en/application-dev/media/opensles-capture.md b/en/application-dev/media/opensles-capture.md index d7aab6606fc0ca49220892e077de2fa5db73ec98..0d0946ca87256f6409a62b81958a2ad784af8161 100644 --- a/en/application-dev/media/opensles-capture.md +++ b/en/application-dev/media/opensles-capture.md @@ -2,10 +2,7 @@ ## When to Use -You can use OpenSL ES to develop the audio recording function in OpenHarmony. Currently, only some -[OpenSL ES APIs](https://gitee.com/openharmony/third_party_opensles/blob/master/api/1.0.1/OpenSLES.h) are implemented. If an API that has not been implemented yet is called, **SL_RESULT_FEATURE_UNSUPPORTED** will be returned. - - +You can use OpenSL ES to develop the audio recording function in OpenHarmony. Currently, only some [OpenSL ES APIs](https://gitee.com/openharmony/third_party_opensles/blob/master/api/1.0.1/OpenSLES.h) are implemented. If an API that has not been implemented is called, **SL_RESULT_FEATURE_UNSUPPORTED** will be returned. ## How to Develop @@ -27,8 +24,6 @@ To use OpenSL ES to develop the audio recording function in OpenHarmony, perform (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); ``` - - 3. Obtain the **engineEngine** instance of the **SL_IID_ENGINE** interface. ```c++ @@ -36,8 +31,6 @@ To use OpenSL ES to develop the audio recording function in OpenHarmony, perform result = (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineItf); ``` - - 4. Configure the recorder information (including the input source **audiosource** and output source **audiosink**), and create a **pcmCapturerObject** instance. ```c++ @@ -81,21 +74,19 @@ To use OpenSL ES to develop the audio recording function in OpenHarmony, perform ``` 5. Obtain the **recordItf** instance of the **SL_IID_RECORD** interface. - - ``` + + ```c++ SLRecordItf recordItf; (*pcmCapturerObject)->GetInterface(pcmCapturerObject, SL_IID_RECORD, &recordItf); - ``` + ``` 6. Obtain the **bufferQueueItf** instance of the **SL_IID_OH_BUFFERQUEUE** interface. - ``` + ```c++ SLOHBufferQueueItf bufferQueueItf; (*pcmCapturerObject)->GetInterface(pcmCapturerObject, SL_IID_OH_BUFFERQUEUE, &bufferQueueItf); ``` - - 7. Register the **BufferQueueCallback** function. ```c++ @@ -120,7 +111,6 @@ To use OpenSL ES to develop the audio recording function in OpenHarmony, perform (*bufferQueueItf)->RegisterCallback(bufferQueueItf, BufferQueueCallback, wavFile_); ``` - 8. Start audio recording. ```c++ @@ -145,7 +135,6 @@ To use OpenSL ES to develop the audio recording function in OpenHarmony, perform } ``` - 9. Stop audio recording. ```c++ diff --git a/en/application-dev/media/opensles-playback.md b/en/application-dev/media/opensles-playback.md index f70dc251b831644cccdfdfb9fc6b1dc9ea738965..661bf70ca1551964b05b086d7ec0ab25f46c984d 100644 --- a/en/application-dev/media/opensles-playback.md +++ b/en/application-dev/media/opensles-playback.md @@ -1,13 +1,9 @@ # OpenSL ES Audio Playback Development - - ## When to Use You can use OpenSL ES to develop the audio playback function in OpenHarmony. Currently, only some [OpenSL ES APIs](https://gitee.com/openharmony/third_party_opensles/blob/master/api/1.0.1/OpenSLES.h) are implemented. If an API that has not been implemented is called, **SL_RESULT_FEATURE_UNSUPPORTED** will be returned. - - ## How to Develop To use OpenSL ES to develop the audio playback function in OpenHarmony, perform the following steps: @@ -20,8 +16,6 @@ To use OpenSL ES to develop the audio playback function in OpenHarmony, perform #include ``` - - 2. Use the **slCreateEngine** API to obtain an **engine** instance. ```c++ @@ -30,8 +24,6 @@ To use OpenSL ES to develop the audio playback function in OpenHarmony, perform (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); ``` - - 3. Obtain the **engineEngine** instance of the **SL_IID_ENGINE** interface. ```c++ @@ -39,8 +31,6 @@ To use OpenSL ES to develop the audio playback function in OpenHarmony, perform (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineEngine); ``` - - 4. Configure the player and create an **AudioPlayer** instance. ```c++ @@ -66,8 +56,6 @@ To use OpenSL ES to develop the audio playback function in OpenHarmony, perform (*pcmPlayerObject)->Realize(pcmPlayerObject, SL_BOOLEAN_FALSE); ``` - - 5. Obtain the **bufferQueueItf** instance of the **SL_IID_OH_BUFFERQUEUE** interface. ``` @@ -75,8 +63,6 @@ To use OpenSL ES to develop the audio playback function in OpenHarmony, perform (*pcmPlayerObject)->GetInterface(pcmPlayerObject, SL_IID_OH_BUFFERQUEUE, &bufferQueueItf); ``` - - 6. Open an audio file and register the **BufferQueueCallback** function. ```c++ @@ -101,8 +87,6 @@ To use OpenSL ES to develop the audio playback function in OpenHarmony, perform (*bufferQueueItf)->RegisterCallback(bufferQueueItf, BufferQueueCallback, wavFile_); ``` - - 7. Obtain the **playItf** instance of the **SL_PLAYSTATE_PLAYING** interface and start playback. ```c++ @@ -111,8 +95,6 @@ To use OpenSL ES to develop the audio playback function in OpenHarmony, perform (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_PLAYING); ``` - - 8. Stop audio playback. ```c++ diff --git a/en/application-dev/media/video-playback.md b/en/application-dev/media/video-playback.md index 4045cc12c9f198184dce1fd531caa0d783c60ff7..cfc09db79fc853066e03205010f43c2f63c27ce5 100644 --- a/en/application-dev/media/video-playback.md +++ b/en/application-dev/media/video-playback.md @@ -441,8 +441,3 @@ export class VideoPlayerDemo { } } ``` - -## Samples -The following samples are provided to help you better understand how to develop video playback: - -- [`VideoPlayer`: Video Playback (eTS, API version 9)](https://gitee.com/openharmony/app_samples/tree/master/media/VideoPlayer) diff --git a/en/application-dev/media/video-recorder.md b/en/application-dev/media/video-recorder.md index f77052fa5ea8e21d48f9a6f11c4636c88483d9c0..6d5b1f04dabf1427a95f24bbc9647221b3a817f5 100644 --- a/en/application-dev/media/video-recorder.md +++ b/en/application-dev/media/video-recorder.md @@ -8,8 +8,6 @@ During video recording, audio and video signals are captured, encoded, and saved ![en-us_image_video_recorder_state_machine](figures/en-us_image_video_recorder_state_machine.png) - - **Figure 2** Layer 0 diagram of video recording ![en-us_image_video_recorder_zero](figures/en-us_image_video_recorder_zero.png) diff --git a/en/application-dev/napi/drawing-guidelines.md b/en/application-dev/napi/drawing-guidelines.md index e813f84d92d4155e78c9ca651af6a3e3cd010232..7cbf0e3d9e10bb6d8d346e8f6a9910771c523434 100644 --- a/en/application-dev/napi/drawing-guidelines.md +++ b/en/application-dev/napi/drawing-guidelines.md @@ -200,9 +200,3 @@ The following steps describe how to use the text drawing and display feature of double position[2] = {10.0, 15.0}; OH_Drawing_TypographyPaint(typography, cCanvas, position[0], position[1]); ``` - -## Samples - -The following samples are provided to help you better understand how to use the Native Drawing module: -* [2D Graphics Drawing Using Native Drawing](https://gitee.com/openharmony/graphic_graphic_2d/blob/master/rosen/samples/2d_graphics/drawing_c_sample.cpp) -* [Text Drawing and Painting Using Native Drawing](https://gitee.com/openharmony/graphic_graphic_2d/blob/master/rosen/samples/text/renderservice/drawing_text_c_sample.cpp) diff --git a/en/application-dev/napi/napi-guidelines.md b/en/application-dev/napi/napi-guidelines.md index f2b6fe0e20564626d7a37d03832fae69f7f7866a..e58eed34cccb7dd820e1144a616dfb93a10f4d34 100644 --- a/en/application-dev/napi/napi-guidelines.md +++ b/en/application-dev/napi/napi-guidelines.md @@ -1,10 +1,10 @@ # Using Native APIs in Application Projects -OpenHarmony applications use JavaScript (JS) when calling native APIs. The native APIs (NAPIs) provided by the **arkui_napi** repository are used to implement the interaction with JS. Currently, the **arkui_napi** repository supports some third-party **Node.js** interfaces. The names of the NAPIs are the same as those in the third-party **Node.js**. For details about the interfaces supported, see `libnapi.ndk.json` in this repository. +OpenHarmony applications use JavaScript (JS) when calling native APIs. The native APIs (NAPIs) provided by the [ace_napi](https://gitee.com/openharmony/arkui_napi/tree/master) repository are used to implement interaction with JS. Currently, the **ace_napi** repository supports some third-party **Node.js** interfaces. The names of the NAPIs are the same as those in the third-party **Node.js**. For details about the interfaces supported, see `libnapi.ndk.json` in this repository. ## How to Develop -The IDE has a default project that uses NAPIs. You can choose `File` > `New` > `Create Project` to create a `Native C++` project. The **cpp** directory is generated in the **main** directory. You can use the NAPIs provided by the **arkui_napi** repository for development. +The IDE has a default project that uses NAPIs. You can choose `File` > `New` > `Create Project` to create a `Native C++` project. The **cpp** directory is generated in the **main** directory. You can use the NAPIs provided by the **ace_napi** repository for development. You can `import` the native .so that contains the JS processing logic. For example, `import hello from 'libhello.so'` to use the **libhello.so** capability. Then, the JS object created using the NAPI can be passed to the `hello` object of the application to call the native capability. @@ -74,7 +74,7 @@ export default storage; ### Implementation -You can obtain the complete code from `sample/native_module_storage/` in the **arkui_napi** repository. +You can obtain the complete code from `sample/native_module_storage/` in the [OpenHarmony/arkui_napi](https://gitee.com/openharmony/arkui_napi/tree/master) repository. #### Registering the Module @@ -212,7 +212,7 @@ static napi_value JSStorageGet(napi_env env, napi_callback_info info) napi_create_async_work( env, nullptr, resource, - // Callback 1: This callback contains the service logic to be asynchronously executed and is asynchronously executed by the NAPI. Do not operate JS objects using theNAPI because the execution is asynchronous. + // Callback 1: This callback contains the service logic to be asynchronously executed and is asynchronously executed by the NAPI. Do not operate JS objects using the NAPI because the execution is asynchronous. [](napi_env env, void* data) { StorageAsyncContext* asyncContext = (StorageAsyncContext*)data; auto itr = gKeyValueStorage.find(asyncContext->key); @@ -307,7 +307,7 @@ export class NetServer { ### Implementation -You can obtain the complete code from `sample/native_module_netserver/` in the **arkui_napi** repository. +You can obtain the complete code from `sample/native_module_netserver/` in the [OpenHarmony/arkui_napi](https://gitee.com/openharmony/arkui_napi/tree/master) repository. #### Registering the Module @@ -494,7 +494,7 @@ This example describes how to invoke a JS callback in a non-JS thread. For examp ### Implementation -You can obtain the complete code from `sample/native_module_callback/` in the **arkui_napi** repository. +You can obtain the complete code from `sample/native_module_callback/` in the [OpenHarmony/arkui_napi](https://gitee.com/openharmony/arkui_napi/tree/master) repository. #### Registering the Module @@ -562,7 +562,7 @@ void callbackTest(CallbackContext* context) uv_queue_work( loop, work, - // This callback is executed in another common thread to process tasks asynchronously. After the callback is complete, execute the next callback. In this scenario, the callback does not need to execute any task. + // This callback is executed in another common thread to process tasks asynchronously. After the callback is complete, execute the next callback. In this scenario, this callback does not need to execute any task. [](uv_work_t* work) {}, // This callback is executed in the JS thread bound to env. [](uv_work_t* work, int status) { diff --git a/en/application-dev/notification/common-event.md b/en/application-dev/notification/common-event.md index e48bcd802e2a1d16536c29193748b14193517e4c..8450f3d8c7f6d0ddfed16215bc8345c2b036c400 100644 --- a/en/application-dev/notification/common-event.md +++ b/en/application-dev/notification/common-event.md @@ -169,9 +169,3 @@ if (this.subscriber != null) { }) } ``` - -## Samples - -The following sample is provided to help you better understand how to use the common event functionality: - -- [`CommonEvent`: eTS Common Event (API 8)](https://gitee.com/openharmony/app_samples/tree/master/Notification/CommonEvent) diff --git a/en/application-dev/notification/notification-guidelines.md b/en/application-dev/notification/notification-guidelines.md index 1a24922a0f7ce6e17e6d65963f13622798348dad..5630462352d721cb3337bfbe302576dc175e29bd 100644 --- a/en/application-dev/notification/notification-guidelines.md +++ b/en/application-dev/notification/notification-guidelines.md @@ -256,10 +256,3 @@ function cancelCallback(err) { Notification.cancel(1, "label", cancelCallback) ``` - - -## Samples - -The following sample is provided to help you better understand how to develop notification functions: - -[`Notification`: EtsNotification (API 8)](https://gitee.com/openharmony/app_samples/tree/master/common/Notification) \ No newline at end of file diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md index 4646544abd6e22a632a35faeba6184819d601097..7a7288f485c659e1ec964584865d346b4c297064 100644 --- a/en/application-dev/reference/apis/Readme-EN.md +++ b/en/application-dev/reference/apis/Readme-EN.md @@ -1,5 +1,7 @@ # APIs +- [API Reference Document Description](development-intro.md) + - Ability Framework - [@ohos.ability.dataUriUtils](js-apis-DataUriUtils.md) @@ -13,6 +15,7 @@ - [@ohos.application.appManager](js-apis-appmanager.md) - [@ohos.application.Configuration](js-apis-configuration.md) - [@ohos.application.ConfigurationConstant](js-apis-configurationconstant.md) + - [@ohos.application.DataShareExtensionAbility](js-apis-application-DataShareExtensionAbility.md) - [@ohos.ability.featureAbility](js-apis-featureAbility.md) - [@ohos.application.formBindingData](js-apis-formbindingdata.md) - [@ohos.application.FormExtension](js-apis-formextension.md) @@ -47,7 +50,7 @@ - application/[ServiceExtensionContext](js-apis-service-extension-context.md) - application/[shellCmdResult](js-apis-application-shellCmdResult.md) - application/[MissionInfo](js-apis-application-missionInfo.md) - + - Common Event and Notification - [@ohos.commonEvent](js-apis-commonEvent.md) @@ -55,7 +58,7 @@ - [@ohos.notification](js-apis-notification.md) - [@ohos.reminderAgent](js-apis-reminderAgent.md) - application/[EventHub](js-apis-eventhub.md) - + - Bundle Management - [@ohos.bundle](js-apis-Bundle.md) @@ -70,14 +73,14 @@ - bundle/[HapModuleInfo](js-apis-bundle-HapModuleInfo.md) - bundle/[Metadata](js-apis-bundle-Metadata.md) - bundle/[ModuleInfo](js-apis-bundle-ModuleInfo.md) - + - UI Page - [@ohos.animator](js-apis-animator.md) - [@ohos.mediaquery](js-apis-mediaquery.md) - [@ohos.prompt](js-apis-prompt.md) - [@ohos.router](js-apis-router.md) - + - Graphics - [@ohos.display ](js-apis-display.md) @@ -85,7 +88,7 @@ - [@ohos.window](js-apis-window.md) - [webgl](js-apis-webgl.md) - [webgl2](js-apis-webgl2.md) - + - Media - [@ohos.multimedia.audio](js-apis-audio.md) @@ -93,41 +96,45 @@ - [@ohos.multimedia.image](js-apis-image.md) - [@ohos.multimedia.media](js-apis-media.md) - [@ohos.multimedia.medialibrary](js-apis-medialibrary.md) - + - Resource Management + - [@ohos.i18n](js-apis-i18n.md) - [@ohos.intl](js-apis-intl.md) - [@ohos.resourceManager](js-apis-resource-manager.md) - + - Resource Scheduling - [@ohos.backgroundTaskManager](js-apis-backgroundTaskManager.md) - [@ohos.workScheduler ](js-apis-workScheduler.md) - [@ohos.WorkSchedulerExtensionAbility](js-apis-WorkSchedulerExtensionAbility.md) - + - Custom Management - [@ohos.configPolicy](js-apis-config-policy.md) - [@ohos.enterpriseDeviceManager](js-apis-enterprise-device-manager.md) - [@ohos.EnterpriseAdminExtensionAbility](js-apis-EnterpriseAdminExtensionAbility.md) - + - Security - [@ohos.abilityAccessCtrl](js-apis-abilityAccessCtrl.md) - [@ohos.security.huks ](js-apis-huks.md) - [@ohos.userIAM.userAuth ](js-apis-useriam-userauth.md) - [@system.cipher](js-apis-system-cipher.md) - + - Data Management - [@ohos.data.dataAbility ](js-apis-data-ability.md) + - [@ohos.data.dataShare](js-apis-data-dataShare.md) + - [@ohos.data.dataSharePredicates](js-apis-data-dataSharePredicates.md) + - [@ohos.data.dataShareResultSet](js-apis-data-DataShareResultSet.md) - [@ohos.data.distributedData](js-apis-distributed-data.md) - [@ohos.data.distributedDataObject](js-apis-data-distributedobject.md) - [@ohos.data.preferences](js-apis-data-preferences.md) - [@ohos.data.rdb](js-apis-data-rdb.md) - - [@ohos.settings](js-apis-settings.md) + - [@ohos.data.ValuesBucket](js-apis-data-ValuesBucket.md) - data/rdb/[resultSet](js-apis-data-resultset.md) - + - File Management - [@ohos.document](js-apis-document.md) @@ -138,7 +145,7 @@ - [@ohos.storageStatistics](js-apis-storage-statistics.md) - [@ohos.volumeManager](js-apis-volumemanager.md) - [@ohos.securityLabel](js-apis-securityLabel.md) - + - Telephony Service - [@ohos.contact](js-apis-contact.md) @@ -148,14 +155,15 @@ - [@ohos.telephony.sim](js-apis-sim.md) - [@ohos.telephony.sms](js-apis-sms.md) - [@ohos.telephony.data](js-apis-telephony-data.md) - + - Network Management + - [@ohos.net.connection](js-apis-net-connection.md) - [@ohos.net.http](js-apis-http.md) - [@ohos.request](js-apis-request.md) - [@ohos.net.socket](js-apis-socket.md) - [@ohos.net.webSocket](js-apis-webSocket.md) - + - Connectivity - [@ohos.bluetooth](js-apis-bluetooth.md) @@ -166,7 +174,7 @@ - [@ohos.rpc](js-apis-rpc.md) - [@ohos.wifi](js-apis-wifi.md) - [@ohos.wifiext](js-apis-wifiext.md) - + - Basic Features - [@ohos.accessibility](js-apis-accessibility.md) @@ -185,7 +193,7 @@ - [@ohos.systemTime](js-apis-system-time.md) - [@ohos.wallpaper](js-apis-wallpaper.md) - [Timer](js-apis-timer.md) - + - Device Management - [@ohos.batteryInfo ](js-apis-battery-info.md) @@ -205,18 +213,19 @@ - [@ohos.power](js-apis-power.md) - [@ohos.runningLock](js-apis-runninglock.md) - [@ohos.sensor](js-apis-sensor.md) + - [@ohos.settings](js-apis-settings.md) - [@ohos.systemParameter](js-apis-system-parameter.md) - [@ohos.thermal](js-apis-thermal.md) - [@ohos.update](js-apis-update.md) - [@ohos.usb](js-apis-usb.md) - [@ohos.vibrator](js-apis-vibrator.md) - + - Account Management - [@ohos.account.appAccount](js-apis-appAccount.md) - [@ohos.account.distributedAccount](js-apis-distributed-account.md) - [@ohos.account.osAccount](js-apis-osAccount.md) - + - Language Base Class Library - [@ohos.convertxml](js-apis-convertxml.md) @@ -240,11 +249,12 @@ - [@ohos.util.Vector](js-apis-vector.md) - [@ohos.worker](js-apis-worker.md) - [@ohos.xml](js-apis-xml.md) - + - Test + - [@ohos.application.testRunner](js-apis-testRunner.md) - [@ohos.uitest](js-apis-uitest.md) - + - APIs No Longer Maintained - [@ohos.bytrace](js-apis-bytrace.md) diff --git a/en/application-dev/reference/apis/development-intro.md b/en/application-dev/reference/apis/development-intro.md new file mode 100644 index 0000000000000000000000000000000000000000..8528a10ab6f4ba3dd14186079357ce28e650ee6a --- /dev/null +++ b/en/application-dev/reference/apis/development-intro.md @@ -0,0 +1,51 @@ +# API Reference Document Description + +API references provide the description of APIs used for application development. This topic describes common fields in the API references to help you better use the reference document. + +## Version Description + +In API references, the earliest versions of APIs and components are specified in the following ways: + +- For a new API or component, the version information is provided at the beginning of the reference document. Example: "The initial APIs of this module are supported since API version 7." +- For a new feature of an existing API or component, a superscript is added following the feature. For example, "uid8+" indicates that the **uid** attribute is supported since API version 8. + +## Ability Framework Model Description + +Ability is the minimum unit for the system to schedule applications. An application can contain one or more `Ability` instances. Ability framework models are classified into the FA model and stage model. For details, see [Ability Framework Overview](../../ability/ability-brief.md). + +- If all the APIs of a module support only one model, the following description is provided at the beginning of the reference document: "The APIs of this module can be used only in the FA model." or "The APIs of this module can be used only in the stage model." +- If certain APIs of a module support only one model, the following description is provided individually for these APIs: "This API can be used only in the FA model." or "This API can be used only in the stage model." +- If both models are supported, no special description is provided. + +## Available APIs + +Certain APIs provided by OpenHarmony are system APIs, which can be used only by original equipment manufacturers (OEMs) and cannot be used by non-system applications. + +A description regarding system APIs will be provided in the document. + +- If all the APIs of a module are system APIs, the following description is provided at the beginning of the reference document: "All the APIs of this module are system APIs." +- If a specific API of a module is a system API, the following description is provided individually for the API: "This is a system API." + +## Permission Description + +By default, applications can access limited system resources. However, in some cases, an application needs to access excess data (including personal data) and functions of the system or another application to implement extended functions. For details, see [Access Control Overview](../../security/accesstoken-overview.md). + +To call APIs to access these resources, you must apply for the corresponding permissions by following the instructions provided in [Access Control Development](../../security/accesstoken-guidelines.md). + +- If an application can call an API only after it has obtained a specific permission, the following description is provided for the API: "**Required permissions**: ohos.permission.xxxx" +- If an application can call an API without any permission, no special description is provided. + +To determine whether an application can apply for a specific permission, see [Permission List](../../security/permission-list.md). + +## System Capability Description + +System capability refers to a relatively independent feature in the operating system. Different devices provide different system capabilities, and multiple APIs implement a system capability. You can determine whether an API can be used based on system capabilities. For details, see [SysCap](../../quick-start/syscap.md). + +The following description is provided for each API in the reference document to describe the system capability of the API: "**System capability**: SystemCapability.xxx.xxx" + +## Sample Code Language Description + +OpenHarmony supports two development languages: JS and TS. + +- When a code block is labeled with `js`, the sample code can be used in the JS and eTS projects. +- When a code block is labeled with `ts`, the sample code can be used only in the eTS project. diff --git a/en/application-dev/reference/apis/js-apis-abilityManager.md b/en/application-dev/reference/apis/js-apis-abilityManager.md deleted file mode 100644 index 28c5cd31b0350ca0e8b24c8bfbda21fb039adcd7..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/apis/js-apis-abilityManager.md +++ /dev/null @@ -1,268 +0,0 @@ -# AbilityManager - -The **AbilityManager** module provides APIs for obtaining, adding, and modifying ability running information and state information. - -> **NOTE** -> -> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. -> The APIs of this module are system APIs and cannot be called by third-party applications. - -# Modules to Import - -```js -import AbilityManager from '@ohos.application.abilityManager' -``` - -## AbilityState - -Enumerates the ability states. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -| Name| Value| Description| -| -------- | -------- | -------- | -| INITIAL | 0 | The ability is in the initial state.| -| FOREGROUND | 9 | The ability is in the foreground state. | -| BACKGROUND | 10 | The ability is in the background state. | -| FOREGROUNDING | 11 | The ability is in the foregrounding state. | -| BACKGROUNDING | 12 | The ability is in the backgrounding state. | - -## updateConfiguration - -updateConfiguration(config: Configuration, callback: AsyncCallback\): void - -Obtains the ability running information. This API uses an asynchronous callback to return the result. - -**Permission required**: ohos.permission.UPDATE_CONFIGURATION - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name | Type | Mandatory | Description | -| --------- | ---------------------------------------- | ---- | -------------- | -| config | Configuration | Yes | New configuration.| -| callback | AsyncCallback\ | Yes | Callback used to return the result. | - -**Example** - -```js -import abilitymanager from '@ohos.application.abilityManager'; - -var config = { - language: 'chinese' -} - -abilitymanager.updateConfiguration(config, () => { - console.log('------------ updateConfiguration -----------'); -}) -``` - -## updateConfiguration - -updateConfiguration(config: Configuration): Promise\ - -Updates the configuration. This API uses a promise to return the result. - -**Permission required**: ohos.permission.UPDATE_CONFIGURATION - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name | Type | Mandatory | Description | -| --------- | ---------------------------------------- | ---- | -------------- | -| config | Configuration | Yes | New configuration.| - -**Return value** - -| Type | Description | -| ---------------------------------------- | ------- | -| Promise\ | Promise used to return the result. | - -**Example** - -```js -import abilitymanager from '@ohos.application.abilityManager'; - -var config = { - language: 'chinese' -} - -abilitymanager.updateConfiguration(config).then(() => { - console.log('updateConfiguration success'); -}).catch((err) => { - console.log('updateConfiguration fail'); -}) -``` - -## getAbilityRunningInfos - -getAbilityRunningInfos(callback: AsyncCallback\>): void - -Obtains the ability running information. This API uses an asynchronous callback to return the result. - -**Required permissions**: ohos.permission.GET_RUNNING_INFO - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name | Type | Mandatory | Description | -| --------- | ---------------------------------------- | ---- | -------------- | -| callback | AsyncCallback\> | Yes | Callback used to return the result. | - -**Example** - -```js -import abilitymanager from '@ohos.application.abilityManager'; - -abilitymanager.getAbilityRunningInfos((err,data) => { - console.log("getAbilityRunningInfos err: " + err + " data: " + JSON.stringify(data)); -}); -``` - -## getAbilityRunningInfos - -getAbilityRunningInfos(): Promise\> - -Obtains the ability running information. This API uses a promise to return the result. - -**Required permissions**: ohos.permission.GET_RUNNING_INFO - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Return value** - -| Type | Description | -| ---------------------------------------- | ------- | -| Promise\> | Promise used to return the result. | - -**Example** - -```js -import abilitymanager from '@ohos.application.abilityManager'; - -abilitymanager.getAbilityRunningInfos().then((data) => { - console.log("getAbilityRunningInfos data: " + JSON.stringify(data)) -}).catch((err) => { - console.log("getAbilityRunningInfos err: " + err) -}); -``` - -## getExtensionRunningInfos9+ - -getExtensionRunningInfos(upperLimit: number, callback: AsyncCallback\>): void - -Obtains the extension running information. This API uses an asynchronous callback to return the result. - -**Required permissions**: ohos.permission.GET_RUNNING_INFO - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name | Type | Mandatory | Description | -| --------- | ---------------------------------------- | ---- | -------------- | -| upperLimit | number | Yes| Maximum number of messages that can be obtained.| -| callback | AsyncCallback\> | Yes | Callback used to return the result. | - -**Example** - -```js -import abilitymanager from '@ohos.application.abilityManager'; - -var upperLimit = 0; - -abilitymanager.getExtensionRunningInfos(upperLimit, (err,data) => { - console.log("getExtensionRunningInfos err: " + err + " data: " + JSON.stringify(data)); -}); -``` - -## getExtensionRunningInfos9+ - -getExtensionRunningInfos(upperLimit: number): Promise\> - -Obtains the extension running information. This API uses a promise to return the result. - -**Required permissions**: ohos.permission.GET_RUNNING_INFO - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name | Type | Mandatory | Description | -| --------- | ---------------------------------------- | ---- | -------------- | -| upperLimit | number | Yes| Maximum number of messages that can be obtained.| - -**Return value** - -| Type | Description | -| ---------------------------------------- | ------- | -| Promise\> | Promise used to return the result. | - -**Example** - -```js -import abilitymanager from '@ohos.application.abilityManager'; - -var upperLimit = 0; - -abilitymanager.getExtensionRunningInfos(upperLimit).then((data) => { - console.log("getAbilityRunningInfos data: " + JSON.stringify(data)); -}).catch((err) => { - console.log("getAbilityRunningInfos err: " + err); -}) -``` - -## getTopAbility9+ - -getTopAbility(callback: AsyncCallback\): void; - -Obtains the top ability, which is the ability that has the window focus. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name | Type | Mandatory | Description | -| --------- | ---------------------------------------- | ---- | -------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result. | - -**Example** - -```js -import abilitymanager from '@ohos.application.abilityManager'; - -abilitymanager.getTopAbility((err,data) => { - console.log("getTopAbility err: " + err + " data: " + JSON.stringify(data)); -}); -``` - -## getTopAbility9+ - -getTopAbility(): Promise\; - -Obtains the top ability, which is the ability that has the window focus. This API uses a promise to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Return value** - -| Type | Description | -| ---------------------------------------- | ------- | -| Promise\| Promise used to return the result. | - -**Example** - -```js -import abilitymanager from '@ohos.application.abilityManager'; - -abilitymanager.getTopAbility().then((data) => { - console.log("getTopAbility data: " + JSON.stringify(data)); -}).catch((err) => { - console.log("getTopAbility err: " + err); -}) -``` diff --git a/en/application-dev/reference/apis/js-apis-animator.md b/en/application-dev/reference/apis/js-apis-animator.md index 2a9c01095ebf3ccfac93d9d96774c103fa2f6e4f..9c1088af3a0fa0c7d15b56f51cdcfa49a9addde9 100644 --- a/en/application-dev/reference/apis/js-apis-animator.md +++ b/en/application-dev/reference/apis/js-apis-animator.md @@ -1,6 +1,7 @@ # Animator -> **NOTE**
+> **NOTE** +> > The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -22,7 +23,7 @@ Creates an **Animator** object. **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| options | [AnimatorOptions](#animatoroptions) | Yes| Animator options. For details, see **AnimatorOptions**.| +| options | [AnimatorOptions](#animatoroptions) | Yes| Animator options.| **Return value** | Type| Description| @@ -213,6 +214,8 @@ animator.oncancel(); onrepeat: () => void +Called when this animation repeats. + **System capability**: SystemCapability.ArkUI.ArkUI.Full **Example** @@ -220,8 +223,6 @@ onrepeat: () => void animator.onrepeat(); ``` -Called when this animation repeats. - ## AnimatorOptions Defines animator options. @@ -231,7 +232,7 @@ Defines animator options. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | duration | number | Yes| Duration for playing the animation, in milliseconds. The default value is **0**.| -| easing | string | Yes| Animation interpolation curve. The default value is **ease**.| +| easing | string | Yes| Animation interpolation curve. The default value is **'ease'**.| | delay | number | Yes| Animation delay duration, in milliseconds. The default value is **0**, indicating that there is no delay.| | fill | "none" \| "forwards" \| "backwards" \| "both" | Yes| State of the animated target after the animation is executed. The default value is **none**, which means that the target will retain its end state (defined by the last keyframe) after the animation is executed. | | direction | "normal" \| "reverse" \| "alternate" \| "alternate-reverse" | Yes| Animation playback mode. The default value is **normal**.| diff --git a/en/application-dev/reference/apis/js-apis-appAccount.md b/en/application-dev/reference/apis/js-apis-appAccount.md index 60f404c4b0510809a4c1d515c3cc99c184796ab9..2a3dc0d9e34fd7ba2dd3e37c018292bec6da8be9 100644 --- a/en/application-dev/reference/apis/js-apis-appAccount.md +++ b/en/application-dev/reference/apis/js-apis-appAccount.md @@ -21,7 +21,7 @@ Creates an **AppAccountManager** instance. **System capability**: SystemCapability.Account.AppAccount -**Return Value** +**Return value** | Type | Description | | ----------------- | ------------ | @@ -102,7 +102,7 @@ Adds an app account name and additional information (information that can be con | name | string | Yes | Name of the app account to add. | | extraInfo | string | Yes | Additional information to add. The additional information cannot contain sensitive information, such as the app account password.| -**Return Value** +**Return value** | Type | Description | | ------------------- | --------------------- | @@ -198,7 +198,7 @@ Deletes an app account from the **AppAccountManager** service. This API uses a p | ---- | ------ | ---- | ----------- | | name | string | Yes | Name of the app account to delete.| -**Return Value** +**Return value** | Type | Description | | :------------------ | :-------------------- | @@ -255,7 +255,7 @@ Disables an app account from accessing an app with the given bundle name. This A | name | string | Yes | Name of the target app account.| | bundleName | string | Yes | Bundle name of the app. | -**Return Value** +**Return value** | Type | Description | | :------------------ | :-------------------- | @@ -312,7 +312,7 @@ Enables an app account to access an app with the given bundle name. This API use | name | string | Yes | Name of the target app account. | | bundleName | string | Yes | Bundle name of the app.| -**Return Value** +**Return value** | Type | Description | | :------------------ | :-------------------- | @@ -371,7 +371,7 @@ Checks whether an app account allows app data synchronization. This API uses a p | ---- | ------ | ---- | ------- | | name | string | Yes | Name of the target app account.| -**Return Value** +**Return value** | Type | Description | | :--------------------- | :-------------------- | @@ -430,7 +430,7 @@ Sets a credential for an app account. This API uses a promise to return the resu | credentialType | string | Yes | Type of the credential to set.| | credential | string | Yes | Credential to set. | -**Return Value** +**Return value** | Type | Description | | :------------------ | :-------------------- | @@ -487,7 +487,7 @@ Sets additional information for an app account. This API uses a promise to retur | name | string | Yes | Name of the target app account. | | extraInfo | string | Yes | Additional information to set.| -**Return Value** +**Return value** | Type | Description | | :------------------ | :-------------------- | @@ -548,7 +548,7 @@ Sets whether to enable app data synchronization for an app account. This API use | name | string | Yes | Name of the target app account. | | isEnable | boolean | Yes | Whether to enable app data synchronization.| -**Return Value** +**Return value** | Type | Description | | :------------------ | :-------------------- | @@ -606,7 +606,7 @@ Sets data to be associated with an app account. This API uses a promise to retur | key | string | Yes | Key of the data to set. The private key can be customized.| | value | string | Yes | Value of the data to be set. | -**Return Value** +**Return value** | Type | Description | | :------------------ | :-------------------- | @@ -664,7 +664,7 @@ Obtains the credential of an app account. This API uses a promise to return the | name | string | Yes | Name of the target app account. | | credentialType | string | Yes | Type of the credential to obtain.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :-------------------- | @@ -720,7 +720,7 @@ Obtains additional information of an app account. This API uses a promise to ret | ---- | ------ | ---- | ------- | | name | string | Yes | Name of the target app account.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :-------------------- | @@ -778,7 +778,7 @@ Obtains data associated with an app account. This API uses a promise to return t | name | string | Yes | Name of the target app account. | | key | string | Yes | Key of the data to obtain.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :-------------------- | diff --git a/en/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md b/en/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md new file mode 100644 index 0000000000000000000000000000000000000000..c3dd60f0e942f6666ea4023bca50c0cef7e75fa5 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md @@ -0,0 +1,376 @@ +# Data Share Extension Ability + +**DataShareExtensionAbility** provides extension abilities for data share services based on the ExtensionAbility framework. + +>**NOTE** +> +>The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> +>The APIs provided by this module are system APIs. +> +>The APIs of this module can be used only in the stage model. + + +## Modules to Import + +```ts +import DataShareExtensionAbility from '@ohos.application.DataShareExtensionAbility' +``` + +## onCreate + +onCreate?(want: Want, callback: AsyncCallback<void>): void + +Called to initialize service logic of the server when the DataShare client connects to the DataShareExtensionAbility server. This API can be overridden as required. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider + +**Parameters** + +| Name| Type| Mandatory| Description| +| ----- | ------ | ------ | ------ | +| want | [Want](js-apis-application-Want.md#want) | Yes | **Want** information, including the ability name and bundle name.| +| callback | AsyncCallback<void> | Yes| Callback that returns no value.| + +**Example** + +```ts +import rdb from '@ohos.data.rdb'; + +let DB_NAME = "DB00.db"; +let TBL_NAME = "TBL00"; +let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS " ++ TBL_NAME ++ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)"; +let rdbStore; + +export default class DataShareExtAbility extends DataShareExtensionAbility { + onCreate(want: Want, callback: AsyncCallback) { + rdb.getRdbStore(this.context, { + name: DB_NAME + }, 1, function (err, data) { + console.log('getRdbStore done, data : ' + data); + rdbStore = data; + rdbStore.executeSql(DDL_TBL_CREATE, [], function (err) { + console.log('executeSql done, error message : ' + err); + }); + if (callback) { + callback(); + } + }); + } +}; +``` + +## getFileTypes + +getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback<Array<string>>): void + +Called by the server to obtain the Multipurpose Internet Mail Extensions (MIME) types supported by a file. This API can be overridden as required. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------------- | ---------------------------------------- | ---- | ---------------------------------- | +| uri | string | Yes | URI of the file. | +| mimeTypeFilter | string | Yes | MIME types to match. | +| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the MIME types obtained.| + +**Example** + +```ts +export default class DataShareExtAbility extends DataShareExtensionAbility { + getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback>) { + let err = {"code":0}; + let ret = new Array("type01", "type02", "type03"); + callback(err, ret); + } +}; +``` + +## openFile + +openFile?(uri: string, mode: string, callback: AsyncCallback<number>): void + +Called by the server to open a file. This method can be overridden as required. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------- | ---- | ------------------------------------------ | +| uri | string | Yes | URI of the file to open. | +| mode | string | Yes | File open mode, including read-only mode and read/write mode.| +| callback | AsyncCallback<number> | Yes | Callback invoked to return the file descriptor. | + +**Example** + +```ts +export default class DataShareExtAbility extends DataShareExtensionAbility { + openFile(uri: string, mode: string, callback: AsyncCallback) { + let err = {"code":0}; + let fd = 0; + callback(err,fd); + } +}; +``` + +## insert + +insert?(uri: string, valueBucket: ValuesBucket, callback: AsyncCallback<number>): void + +Called to insert data into the database. This API can be overridden as required. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider + +**Parameters** + +| Name| Type| Mandatory| Description| +| ----- | ------ | ------ | ------ | +| uri |string | Yes | URI of the data to insert.| +| valueBucket |[ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket) | Yes| Data to insert.| +| callback |AsyncCallback<number> | Yes| Callback invoked to return the index of the data inserted.| + +**Example** + +```ts +export default class DataShareExtAbility extends DataShareExtensionAbility { + insert(uri: string, valueBucket: ValuesBucket, callback: AsyncCallback) { + if (value == null) { + console.info('invalid valueBuckets'); + return; + } + rdbStore.insert(TBL_NAME, value, function (err, ret) { + console.info('callback ret:' + ret); + if (callback != undefined) { + callback(err, ret); + } + }); + } +}; +``` + +## update + +update?(uri: string, predicates: dataSharePredicates.DataSharePredicates, valueBucket: ValuesBucket, callback: AsyncCallback<number>): void + +Called by the server to update data in the database. This API can be overridden as required. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider + +**Parameters** + +| Name| Type| Mandatory| Description| +| ----- | ------ | ------ | ------ | +| uri | string | Yes | URI of the data to update.| +| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | Yes | Filter criteria for updating data.| +| valueBucket | [ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket) | Yes| New data.| +| callback | AsyncCallback<number> | Yes| Callback invoked to return the number of updated data records.| + +**Example** + +```ts +export default class DataShareExtAbility extends DataShareExtensionAbility { + update(uri: string, predicates: dataSharePredicates.DataSharePredicates, valueBucket: ValuesBucket, callback: AsyncCallback) { + if (predicates == null || predicates == undefined) { + return; + } + rdbStore.update(TBL_NAME, value, predicates, function (err, ret) { + if (callback != undefined) { + callback(err, ret); + } + }); + } +}; +``` + +## delete + +delete?(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>): void + +Called by the server to delete data from the database. This API can be overridden as required. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | ------------------------------------------------------------ | ---- | ---------------------------------- | +| uri | string | Yes | URI of the data to delete. | +| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | Yes | Filter criteria for deleting data. | +| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of data records deleted.| + +**Example** + +```ts +export default class DataShareExtAbility extends DataShareExtensionAbility { + delete(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback) { + if (predicates == null || predicates == undefined) { + return; + } + rdbStore.delete(TBL_NAME, predicates, function (err, ret) { + if (callback != undefined) { + callback(err, ret); + } + }); + } +}; +``` + +## query + +query?(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<Object>): void + +Called by the server to query data from the database. This API can be overridden as required. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider + +**Parameters** + +| Name| Type| Mandatory| Description| +| ----- | ------ | ------ | ------ | +| uri | string | Yes | URI of the data to query.| +| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | Yes | Filter criteria for querying data.| +| columns | Array<string> | Yes| Columns to query. If this parameter is empty, all columns will be queried.| +| callback | AsyncCallback<Object> | Yes| Callback invoked to return the result set.| + +**Example** + +```ts +export default class DataShareExtAbility extends DataShareExtensionAbility { + query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array, callback: AsyncCallback) { + if (predicates == null || predicates == undefined) { + return; + } + rdbStore.query(TBL_NAME, predicates, columns, function (err, resultSet) { + if (resultSet != undefined) { + console.info('resultSet.rowCount: ' + resultSet.rowCount); + } + if (callback != undefined) { + callback(err, resultSet); + } + }); + } +}; +``` + +## getType + +getType?(uri: string, callback: AsyncCallback<string>): void + +Called by the server to obtain the MIME type corresponding to the given URI. This API can be overridden as required. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider + +**Parameters** + +| Name| Type| Mandatory| Description| +| ----- | ------ | ------ | ------ | +| uri | string | Yes | URI of the target data.| +| callback | AsyncCallback<string> | Yes| Callback invoked to return the MIME type obtained.| + +**Example** + +```ts +export default class DataShareExtAbility extends DataShareExtensionAbility { + getType(uri: string, callback: AsyncCallback) { + let err = {"code":0}; + let ret = "image"; + callback(err, ret); + } +}; +``` + +## BatchInsert + +BatchInsert?(uri: string, valueBuckets: Array<ValuesBucket>, callback: AsyncCallback<number>): void + +Called by the server to insert batch data into the database. This API can be overridden as required. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------------ | ------------------------------------------------------------ | ---- | -------------------------------- | +| uri | string | Yes | URI of the data to insert. | +| valueBuckets | Array<[ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket)> | Yes | Data to insert. | +| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of inserted data records.| + +**Example** + +```ts +export default class DataShareExtAbility extends DataShareExtensionAbility { + batchInsert(uri: string, valueBuckets: Array, callback: AsyncCallback) { + if (valueBuckets == null || valueBuckets.length == undefined) { + console.info('invalid valueBuckets'); + return; + } + let resultNum = valueBuckets.length + valueBuckets.forEach(vb => { + rdbStore.insert(TBL_NAME, vb, function (err, ret) { + if (callback != undefined) { + callback(err, resultNum); + } + }); + }); + } +}; +``` + +## normalizeUri + +normalizeUri?(uri: string, callback: AsyncCallback<string>): void + +Called by the server to normalize the specified URI. This API can be overridden as required. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------- | ---- | ----------------------- | +| uri | string | Yes | [URI](js-apis-uri.md#uri) to normalize.| +| callback | AsyncCallback<string> | Yes | Callback used to return the result. If the operation is successful, the normalized URI is returned. Otherwise, **null** is returned.| + +**Example** + +```ts +export default class DataShareExtAbility extends DataShareExtensionAbility { + normalizeUri(uri: string, callback: AsyncCallback) { + let err = {"code":0}; + let ret = "normalize+" + uri; + callback(err, ret); + } +}; +``` + +## denormalizeUri + +denormalizeUri?(uri: string, callback: AsyncCallback<string>): void + +Called by the server to denormalize the specified URI. This method can be overridden as required. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------- | ---- | ----------------------- | +| uri | string | Yes | [URI](js-apis-uri.md#uri) to denormalize.| +| callback | AsyncCallback<string> | Yes | Callback used to return the result. If the operation is successful, the URI obtained is returned. If the URI passed in is returned, denormalization is not required. If denormalization is not supported, **null** is returned.| + +**Example** + +```ts +export default class DataShareExtAbility extends DataShareExtensionAbility { + denormalizeUri(uri: string, callback: AsyncCallback) { + let err = {"code":0}; + let ret = "denormalize+" + uri; + callback(err, ret); + } +}; +``` diff --git a/en/application-dev/reference/apis/js-apis-application-missionInfo.md b/en/application-dev/reference/apis/js-apis-application-missionInfo.md deleted file mode 100644 index 05938521e10970192409f856e68b816c18d3f3f0..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/apis/js-apis-application-missionInfo.md +++ /dev/null @@ -1,28 +0,0 @@ -# MissionInfo - -> **NOTE** -> -> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. - -## Modules to Import - -```js -import MissionInfo from '@ohos.application.missionInfo' -``` - -## MissionInfo - -Provides the mission information. - -**System capability**: SystemCapability.Ability.AbilityBase - -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| missionId | number | Yes| Yes| Mission ID.| -| runningState | number | Yes| Yes| Running state of the mission.| -| lockedState | boolean | Yes| Yes| Locked state of the mission.| -| timestamp | string | Yes| Yes| Latest time when the mission was created or updated.| -| want | [Want](js-apis-application-Want.md) | Yes| Yes| **Want** information of the mission.| -| label | string | Yes| Yes| Label of the mission.| -| iconPath | string | Yes| Yes| Path of the mission icon.| -| continuable | boolean | Yes| Yes| Whether the mission is continuable.| diff --git a/en/application-dev/reference/apis/js-apis-audio.md b/en/application-dev/reference/apis/js-apis-audio.md index 894370d603afe13fef35c965beb2adaec6f1ef8b..68d01ed3f45885cf6b53fb3de35fc9b3e6c45da5 100644 --- a/en/application-dev/reference/apis/js-apis-audio.md +++ b/en/application-dev/reference/apis/js-apis-audio.md @@ -2273,7 +2273,43 @@ Writes the buffer. This API uses an asynchronous callback to return the result. ``` import audio from '@ohos.multimedia.audio'; import fileio from '@ohos.fileio'; +import featureAbility from '@ohos.ability.featureAbility' +var audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW +} + +var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION + rendererFlags: 1 +} + +var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo +} +var audioRenderer; +audio.createAudioRenderer(audioRendererOptions).then((data)=> { + audioRenderer = data; + console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message); + }); +var bufferSize; +audioRenderer.getBufferSize().then((data)=> { + console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data); + bufferSize = data; + }).catch((err) => { + console.info.('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message); + }); +console.info('Buffer size:'+bufferSize); +var context = featureAbility.getContext(); +var path = await context.getCacheDir(); +var filePath = path+"/StarWars10s-2C-48000-4SW.wav" let ss = fileio.createStreamSync(filePath, 'r'); let buf = new ArrayBuffer(bufferSize); ss.readSync(buf); @@ -2305,7 +2341,42 @@ Writes the buffer. This API uses a promise to return the result. ``` import audio from '@ohos.multimedia.audio'; import fileio from '@ohos.fileio'; +import featureAbility from '@ohos.ability.featureAbility' + +var audioStreamInfo = { + samplingRate:audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels:audio.AudioChannel.CHANNEL_2, + sampleFormat.audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType.audio.AudioEncodingType.ENCODING_TYPE_RAW +} + +var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 +} +var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo +} +var audioRenderer; +audio.createAudioRenderer(audioRendererOptions).then((data) => { + audioRenderer = data; + console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message); + }); +var bufferSize; +audioRenderer.getBufferSize().then((data) => { + console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message); + }); +console.info('BufferSize: ' + bufferSize); +var context = featureAbility.getContext(); +var path = await context.getCacheDir(); var filePath = 'data/StarWars10s-2C-48000-4SW.wav'; let ss = fileio.createStreamSync(filePath, 'r'); let buf = new ArrayBuffer(bufferSize); @@ -2408,12 +2479,39 @@ Obtains a reasonable minimum buffer size in bytes for rendering. This API uses a **Example** ``` +import audio from '@ohos.multimedia.audio'; +import fileio from '@ohos.fileio'; + +var audioStreamInfo = { + samplingRate:audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels:audio.AudioChannel.CHANNEL_2, + sampleFormat.audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType.audio.AudioEncodingType.ENCODING_TYPE_RAW +} + +var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 +} + +var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo +} +var audioRenderer; +audio.createAudioRenderer(audioRendererOptions).then((data) => { + audioRenderer = data; + console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message); + }); var bufferSize; -await audioRenderer.getBufferSize().then(async function (data) => { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); +audioRenderer.getBufferSize().then((data) => { + console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data); bufferSize=data; }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); + console.info('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message); }); ``` @@ -2542,7 +2640,8 @@ Sets the audio interruption mode for the application. This API uses a promise to **Example** ``` -audioManager.setInterruptMode(audio.InterruptType.SHARE_MODE).then(() => { +const audioManager = audio.getAudioManager(); +audioManager.setInterruptMode(audio.InterruptMode.SHARE_MODE).then(() => { console.log('Promise returned to indicate a successful volume setting.'); }); ``` @@ -2564,7 +2663,8 @@ Sets the audio interruption mode for the application. This API uses a callback t **Example** ``` -audioManager.setInterruptMode(audio.InterruptType.SHARE_MODE,()=>{ +const audioManager = audio.getAudioManager(); +audioManager.setInterruptMode(audio.InterruptMode.SHARE_MODE,()=>{ console.log('Callback returned to indicate a successful volume setting.'); }); ``` @@ -2654,7 +2754,7 @@ Subscribes to mark reached events. When the number of frames rendered reaches th ``` audioRenderer.on('markReach', 1000, (position) => { - if (position == "1000") { + if (position == 1000) { console.log('ON Triggered successfully'); } }); @@ -2701,7 +2801,7 @@ Subscribes to period reached events. When the period of frame rendering reaches ``` audioRenderer.on('periodReach', 1000, (position) => { - if (position == "1000") { + if (position == 1000) { console.log('ON Triggered successfully'); } }); @@ -2935,13 +3035,35 @@ Starts capturing. This API uses a promise to return the result. **Example** ``` +import audio from '@ohos.multimedia.audio'; +import fileio from '@ohos.fileio'; + +var audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW +} + +var audioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags = 1 +} + +var audioCapturer; +audio.createAudioCapturer(audioCapturerOptions).then((data) => { + audioCapturer = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created: ERROR: '+err.message); + }); audioCapturer.start().then(() => { console.info('AudioFrameworkRecLog: ---------START---------'); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info('AudioFrameworkRecLog: Capturer started: SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer: STATE: '+audioCapturer.state); + console.info('AudioFrameworkRecLog: Capturer started: SUCCESS '); if ((audioCapturer.state == audio.AudioState.STATE_RUNNING)) { - stateFlag = true; + console.info('AudioFrameworkRecLog: AudioCapturer is in Running State'); } }).catch((err) => { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); @@ -2994,15 +3116,13 @@ Stops capturing. This API uses a promise to return the result. ``` audioCapturer.stop().then(() => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); + console.info('AudioFrameworkRecLog: Capturer stopped: SUCCESS'); if ((audioCapturer.state == audio.AudioState.STATE_STOPPED)){ - stateFlag=true; - console.info('AudioFrameworkRecLog: resultFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: State is Stopped': '); } }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message); }); ``` @@ -3054,11 +3174,9 @@ audioCapturer.release().then(() => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state); - stateFlag=true; console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false + console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message); }); ``` @@ -3082,6 +3200,13 @@ Reads the buffer. This API uses an asynchronous callback to return the result. **Example** ``` +var bufferSize; +audioCapturer.getBufferSize().then((data) => { + console.info('AudioFrameworkRecLog: getBufferSize: SUCCESS '+data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRecLog: getBufferSize: EROOR: '+err.message); + }); audioCapturer.read(bufferSize, true, async(err, buffer) => { if (!err) { console.log("Success in reading the buffer data"); @@ -3114,6 +3239,14 @@ Reads the buffer. This API uses a promise to return the result. **Example** ``` +var bufferSize; +audioCapturer.getBufferSize().then((data) => { + console.info('AudioFrameworkRecLog: getBufferSize: SUCCESS '+data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRecLog: getBufferSize: ERROR '+err.message); + }); +console.info('Buffer size: ' + bufferSize); audioCapturer.read(bufferSize, true).then((buffer) => { console.info('buffer read successfully'); }).catch((err) => { @@ -3217,12 +3350,12 @@ Obtains a reasonable minimum buffer size in bytes for capturing. This API uses a **Example** ``` -await audioCapturer.getBufferSize().then(async function (bufferSize) { - console.info('AudioFrameworkRecordLog: getBufferSize :SUCCESS '+ bufferSize); - var buffer = await audioCapturer.read(bufferSize, true); - console.info('Buffer read is ' + buffer ); - }).catch((err) => { - console.info('AudioFrameworkRecordLog: getBufferSize :ERROR : '+err.message); +var bufferSize; +audioCapturer.getBufferSize().then((data) => { + console.info('AudioFrameworkRecLog: getBufferSize :SUCCESS '+ data); + bufferSize = data; +}).catch((err) => { + console.info('AudioFrameworkRecLog: getBufferSize :ERROR : '+ err.message); }); ``` @@ -3247,7 +3380,7 @@ Subscribes to mark reached events. When the number of frames captured reaches th ``` audioCapturer.on('markReach', 1000, (position) => { - if (position == "1000") { + if (position == 1000) { console.log('ON Triggered successfully'); } }); @@ -3293,7 +3426,7 @@ Subscribes to mark reached events. When the period of frame capturing reaches th ``` audioCapturer.on('periodReach', 1000, (position) => { - if (position == "1000") { + if (position == 1000) { console.log('ON Triggered successfully'); } }); diff --git a/en/application-dev/reference/apis/js-apis-bluetooth.md b/en/application-dev/reference/apis/js-apis-bluetooth.md index 42be84f040bf62367601a1a39c640255b6f16b87..5eacfc8a69610d57abec3afdd0fba6f7addaa30b 100644 --- a/en/application-dev/reference/apis/js-apis-bluetooth.md +++ b/en/application-dev/reference/apis/js-apis-bluetooth.md @@ -201,7 +201,7 @@ Obtains the connection state of a profile. | Name | Type | Mandatory | Description | | --------- | --------- | ---- | ------------------------------------- | -| ProfileId | profileId | Yes | ID of the profile to obtain, for example, **PROFILE_A2DP_SOURCE**.| +| ProfileId | profileId | Yes | ID of the target profile, for example, **PROFILE_A2DP_SOURCE**.| **Return value** @@ -447,7 +447,7 @@ Sets the device pairing confirmation. | Name | Type | Mandatory | Description | | ------ | ------- | ---- | -------------------------------- | -| device | string | Yes | Address of the remote device, for example, XX:XX:XX:XX:XX:XX.| +| device | string | Yes | Address of the target remote device, for example, XX:XX:XX:XX:XX:XX.| | accept | boolean | Yes | Whether to accept the pairing request. The value **true** means to accept the pairing request, and the value **false** means the opposite. | **Return value** @@ -1039,9 +1039,9 @@ let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE); ## bluetooth.getProfile9+ -getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile +getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile | PanProfile -Obtains a profile instance. **HidHostProfile** is added in API version 9. +Obtains a profile instance. API version 9 is added with **HidHostProfile** and **PanProfile**. **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -1055,7 +1055,7 @@ Obtains a profile instance. **HidHostProfile** is added in API version 9. | Type | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| [A2dpSourceProfile](#A2dpSourceProfile), [HandsFreeAudioGatewayProfile](#HandsFreeAudioGatewayProfile), or [HidHostProfile](#HidHostProfile) | Profile object obtained. **A2dpSourceProfile**, **HandsFreeAudioGatewayProfile**, and **HidHostProfile** are supported.| +| [A2dpSourceProfile](#A2dpSourceProfile), [HandsFreeAudioGatewayProfile](#HandsFreeAudioGatewayProfile), [HidHostProfile](#HidHostProfile), or [PanProfile](#PanProfile)| Profile instance obtained, which can be **A2dpSourceProfile**, **HandsFreeAudioGatewayProfile**, **HidHostProfile**, or **PanProfile**.| **Example** @@ -1344,7 +1344,7 @@ Sets up an Advanced Audio Distribution Profile (A2DP) connection. | Name | Type | Mandatory | Description | | ------ | ------ | ---- | ------- | -| device | string | Yes | Address of the remote device to connect.| +| device | string | Yes | Address of the target device.| **Return value** @@ -1374,7 +1374,7 @@ Disconnects an A2DP connection. | Name | Type | Mandatory | Description | | ------ | ------ | ---- | ------- | -| device | string | Yes | Address of the remote device to disconnect.| +| device | string | Yes | Address of the target device.| **Return value** @@ -1737,6 +1737,162 @@ hidHost.off('connectionStateChange', onReceiveEvent); ``` +## PanProfile + +Before using a method of **PanProfile**, you need to create an instance of this class by using the **getProfile()** method. + + +### disconnect9+ + +disconnect(device: string): boolean + +Disconnects from the Personal Area Network (PAN) service of a device. + +This is a system API. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| device | string | Yes | Address of the target device.| + +**Return value** + +| Type | Description | +| --------------------- | --------------------------------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + +**Example** + +```js +let panProfile = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_PAN_NETWORK); +let ret = panProfile.disconnect('XX:XX:XX:XX:XX:XX'); +``` + + +### on('connectionStateChange')9+ + +on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void + +Subscribes to the PAN connection state change events. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **connectionStateChange** indicates a PAN connection state change event.| +| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback used to return the PAN connection state change event. | + +**Return value** + +No value is returned. + +**Example** + +```js +function onReceiveEvent(data) { + console.info('pan state = '+ JSON.stringify(data)); +} +let panProfile = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_PAN_NETWORK); +panProfile.on('connectionStateChange', onReceiveEvent); +``` + + +### off('connectionStateChange')9+ + +off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void + +Unsubscribes from the PAN connection state change events. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- | +| type | string | Yes | Event type. The value **connectionStateChange** indicates a PAN connection state change event.| +| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback used to return the PAN connection state change event. | + +**Return value** + +No value is returned. + +**Example** + +```js +function onReceiveEvent(data) { + console.info('pan state = '+ JSON.stringify(data)); +} +let panProfile = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_PAN_NETWORK); +panProfile.on('connectionStateChange', onReceiveEvent); +panProfile.off('connectionStateChange', onReceiveEvent); +``` + + +### setTethering9+ + +setTethering(value: boolean): boolean + +Sets tethering. + +This is a system API. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| value | boolean | Yes | Whether to set tethering over a Bluetooth PAN.| + +**Return value** + +| Type | Description | +| --------------------- | --------------------------------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + +**Example** + +```js +let panProfile = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_PAN_NETWORK); +let ret = panProfile.setTethering(true); +``` + + +### isTetheringOn9+ + +isTetheringOn(): boolean + +Obtains the tethering status. + +This is a system API. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Return value** + +| Type | Description | +| --------------------- | --------------------------------- | +| boolean | Returns **true** if tethering is available over a Bluetooth PAN; return **false** otherwise.| + +**Example** + +```js +let panProfile = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_PAN_NETWORK); +let ret = panProfile.isTetheringOn(); +``` + + ## GattServer Implements the Generic Attribute Profile (GATT) server. Before using a method of this class, you need to create a **GattServer** instance using the **createGattServer()** method. @@ -2346,6 +2502,7 @@ let gattServer = bluetooth.BLE.createGattServer(); gattServer.off("descriptorWrite"); ``` + ### on('connectStateChange') on(type: "connectStateChange", callback: Callback<BLEConnectChangedState>): void @@ -2562,7 +2719,7 @@ gattClientDevice.getServices().then(result => { readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback<BLECharacteristic>): void -Reads the characteristic value of the specific service of the remote BLE device. This API uses an asynchronous callback to return the result. +Reads the characteristic value of the specific service of the peer BLE device. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.USE_BLUETOOTH @@ -2616,7 +2773,7 @@ device.readCharacteristicValue(characteristic, readCcc); readCharacteristicValue(characteristic: BLECharacteristic): Promise<BLECharacteristic> -Reads the characteristic value of the specific service of the remote BLE device. This API uses a promise to return the result. +Reads the characteristic value of the specific service of the peer BLE device. This API uses a promise to return the result. **Required permissions**: ohos.permission.USE_BLUETOOTH @@ -2663,7 +2820,7 @@ device.readCharacteristicValue(characteristic); readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback<BLEDescriptor>): void -Reads the descriptor contained in the specific characteristic of the remote BLE device. This API uses an asynchronous callback to return the result. +Reads the descriptor contained in the specific characteristic of the peer BLE device. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.USE_BLUETOOTH @@ -2707,7 +2864,7 @@ device.readDescriptorValue(descriptor, readDesc); readDescriptorValue(descriptor: BLEDescriptor): Promise<BLEDescriptor> -Reads the descriptor contained in the specific characteristic of the remote BLE device. This API uses a promise to return the result. +Reads the descriptor contained in the specific characteristic of the peer BLE device. This API uses a promise to return the result. **Required permissions**: ohos.permission.USE_BLUETOOTH @@ -3154,7 +3311,7 @@ Enumerates the scan modes. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name | Default Value | Description | +| Name | Default Value | Description | | ---------------------------------------- | ---- | --------------- | | SCAN_MODE_NONE | 0 | No scan mode. | | SCAN_MODE_CONNECTABLE | 1 | Connectable mode. | @@ -3169,7 +3326,7 @@ Enumerates the pairing states. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name | Default Value | Description | +| Name | Default Value | Description | | ------------------ | ---- | ------ | | BOND_STATE_INVALID | 0 | Invalid pairing.| | BOND_STATE_BONDING | 1 | Pairing. | @@ -3195,7 +3352,7 @@ Enumerates the SPP link types. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name | Default Value | Description | +| Name | Default Value | Description | | ---------- | ---- | ------------- | | SPP_RFCOMM | 0 | Radio frequency communication (RFCOMM) link type.| diff --git a/en/application-dev/reference/apis/js-apis-bundle-defaultAppManager.md b/en/application-dev/reference/apis/js-apis-bundle-defaultAppManager.md new file mode 100644 index 0000000000000000000000000000000000000000..e80cf7f78b02192642a29794feaf794052bd4dc4 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-bundle-defaultAppManager.md @@ -0,0 +1,474 @@ +# DefaultAppManager + +The **DefaultAppManager** module provides APIs to query whether the current application is the default application of a specific type. + +> **NOTE** +> +> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Modules to Import + +``` +import defaultAppMgr from '@ohos.bundle.defaultAppManager' +``` +## defaultAppMgr.ApplicationType + +Enumerates the application types. + +**System capability**: SystemCapability.BundleManager.BundleFramework + +| Name | Type | Description | +| -------- | -------- | -------------------------------------- | +| BROWSER | string | Default browser. | +| IMAGE | string | Default image viewer. | +| AUDIO | string | Default audio player. | +| VIDEO | string | Default video player. | +| PDF | string | Default PDF reader. | +| WORD | string | Default Word viewer. | +| EXCEL | string | Default Excel viewer. | +| PPT | string | Default PowerPoint viewer. | + +## defaultAppMgr.isDefaultApplication + +isDefaultApplication(type: string): Promise\ + +Checks whether this application is the default application of a system-defined application type. This API uses a promise to return the result. + +**System capability**: SystemCapability.BundleManager.BundleFramework + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype). | + +**Return value** + +| Type | Description | +| ------------------------- | ------------------ | +| Promise\ | Promise used to return the result. If the application is the default application, `true` is returned; otherwise, `false` is returned.| + +**Example** + +```js +defaultAppMgr.isDefaultApplication(defaultAppMgr.ApplicationType.BROWSER) +.then((data) => { + console.info('Operation successful. IsDefaultApplication ? ' + JSON.stringify(data)); +}).catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); +}); +``` + +## defaultAppMgr.isDefaultApplication + +isDefaultApplication(type: string, callback: AsyncCallback\): void + +Checks whether this application is the default application of a system-defined application type. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.BundleManager.BundleFramework + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------------------------------- | ---- | --------------------------------------- | +| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype). | +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the application is the default application, `true` is returned; otherwise, `false` is returned.| + +**Example** + +```js +defaultAppMgr.isDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful. IsDefaultApplication ? ' + JSON.stringify(data)); + }); +``` + +## defaultAppMgr.getDefaultApplication + +getDefaultApplication(type: string, userId?: number): Promise\ + +Obtains the default application based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses a promise to return the result. + +**Required permissions**: ohos.permission.GET_DEFAULT_APPLICATION + +**System capability**: SystemCapability.BundleManager.BundleFramework + +**System API**: This is a system API and cannot be called by third-party applications. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. | +| userId | number | No | User ID. The default value is the user ID of the caller. | + +**Return value** + +| Type | Description | +| ------------------------- | ------------------ | +| Promise\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Promise used to return the default application.| + +**Example** + +```js +defaultAppMgr.getDefaultApplication(defaultAppMgr.ApplicationType.BROWSER) +.then((data) => { + console.info('Operation successful. bundleInfo: ' + JSON.stringify(data)); +}) +.catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); +}); + +defaultAppMgr.getDefaultApplication("image/png") +.then((data) => { + console.info('Operation successful. bundleInfo: ' + JSON.stringify(data)); +}) +.catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); +}); +``` + +## defaultAppMgr.getDefaultApplication + +getDefaultApplication(type: string, userId: number, callback: AsyncCallback\) : void + +Obtains the default application of a user based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.GET_DEFAULT_APPLICATION + +**System capability**: SystemCapability.BundleManager.BundleFramework + +**System API**: This is a system API and cannot be called by third-party applications. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. | +| userId | number | Yes | User ID. | +| callback | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Callback used to return the default application. | + +**Example** + +```js +defaultAppMgr.getDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, 100, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful. bundleInfo:' + JSON.stringify(data)); +}); + +defaultAppMgr.getDefaultApplication("image/png", 100, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful. bundleInfo:' + JSON.stringify(data)); +}); +``` + +## defaultAppMgr.getDefaultApplication + +getDefaultApplication(type: string, callback: AsyncCallback\) : void + +Obtains the default application based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.GET_DEFAULT_APPLICATION + +**System capability**: SystemCapability.BundleManager.BundleFramework + +**System API**: This is a system API and cannot be called by third-party applications. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. | +| callback | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Callback used to return the default application. | + +**Example** + +```js +defaultAppMgr.getDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful. bundleInfo:' + JSON.stringify(data)); +}); + +defaultAppMgr.getDefaultApplication("image/png", (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful. bundleInfo:' + JSON.stringify(data)); +}); +``` + +## defaultAppMgr.setDefaultApplication + +setDefaultApplication(type: string, elementName: ElementName, userId?: number): Promise\ + +Sets the default application based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses a promise to return the result. + +**Required permissions**: ohos.permission.SET_DEFAULT_APPLICATION + +**System capability**: SystemCapability.BundleManager.BundleFramework + +**System API**: This is a system API and cannot be called by third-party applications. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. | +| elementName | [ElementName](js-apis-bundle-ElementName.md) | Yes | Information about the element to be set as the default application. | +| userId | number | No | User ID. The default value is the user ID of the caller. | + +**Example** + +```js +defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, { + bundleName: "com.test.app", + moduleName: "module01", + abilityName: "MainAbility" +}) +.then((data) => { + console.info('Operation successful.'); +}) +.catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); +}); + +defaultAppMgr.setDefaultApplication("image/png", { + bundleName: "com.test.app", + moduleName: "module01", + abilityName: "MainAbility" +}) +.then((data) => { + console.info('Operation successful.'); +}) +.catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); +}); +``` + +## defaultAppMgr.setDefaultApplication + +setDefaultApplication(type: string, elementName: ElementName, userId: number, callback: AsyncCallback\) : void; + +Sets the default application for a user based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.SET_DEFAULT_APPLICATION + +**System capability**: SystemCapability.BundleManager.BundleFramework + +**System API**: This is a system API and cannot be called by third-party applications. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. | +| elementName | [ElementName](js-apis-bundle-ElementName.md) | Yes | Information about the element to be set as the default application. | +| userId | number | Yes | User ID. | +| callback | AsyncCallback\ | Yes | Callback used to return the result. | + +**Example** + +```js +defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, { + bundleName: "com.test.app", + moduleName: "module01", + abilityName: "MainAbility" +}, 100, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful.'); + }); + +defaultAppMgr.setDefaultApplication("image/png", { + bundleName: "com.test.app", + moduleName: "module01", + abilityName: "MainAbility" +}, 100, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful.'); + }); +``` + +## defaultAppMgr.setDefaultApplication + +setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCallback\) : void; + +Sets the default application based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.SET_DEFAULT_APPLICATION + +**System capability**: SystemCapability.BundleManager.BundleFramework + +**System API**: This is a system API and cannot be called by third-party applications. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. | +| elementName | [ElementName](js-apis-bundle-ElementName.md) | Yes | Information about the element to be set as the default application. | +| callback | AsyncCallback\ | Yes | Callback used to return the result. | + +**Example** + +```js +defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, { + bundleName: "com.test.app", + moduleName: "module01", + abilityName: "MainAbility" +}, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful.'); + }); + +defaultAppMgr.setDefaultApplication("image/png", { + bundleName: "com.test.app", + moduleName: "module01", + abilityName: "MainAbility" +}, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful.'); + }); +``` + +## defaultAppMgr.resetDefaultApplication + +resetDefaultApplication(type: string, userId?: number): Promise\ + +Resets the default application based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses a promise to return the result. + +**Required permissions**: ohos.permission.SET_DEFAULT_APPLICATION + +**System capability**: SystemCapability.BundleManager.BundleFramework + +**System API**: This is a system API and cannot be called by third-party applications. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. | +| userId | number | No | User ID. The default value is the user ID of the caller. | + +**Example** + +```js +defaultAppMgr.resetDefaultApplication(defaultAppMgr.ApplicationType.BROWSER) +.then((data) => { + console.info('Operation successful.'); +}) +.catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); +}); + +defaultAppMgr.resetDefaultApplication("image/png") +.then((data) => { + console.info('Operation successful.'); +}) +.catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); +}); +``` + +## defaultAppMgr.resetDefaultApplication + +resetDefaultApplication(type: string, userId: number, callback: AsyncCallback\) : void; + +Resets the default application for a user based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.SET_DEFAULT_APPLICATION + +**System capability**: SystemCapability.BundleManager.BundleFramework + +**System API**: This is a system API and cannot be called by third-party applications. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. | +| userId | number | Yes | User ID. | +| callback | AsyncCallback\ | Yes | Callback used to return the result. | + +**Example** + +```js +defaultAppMgr.resetDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, 100, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful.'); +}); + +defaultAppMgr.resetDefaultApplication("image/png", 100, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful.'); +}); +``` + +## defaultAppMgr.resetDefaultApplication + +resetDefaultApplication(type: string, callback: AsyncCallback\) : void; + +Resets the default application based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.SET_DEFAULT_APPLICATION + +**System capability**: SystemCapability.BundleManager.BundleFramework + +**System API**: This is a system API and cannot be called by third-party applications. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. | +| callback | AsyncCallback\ | Yes | Callback used to return the result. | + +**Example** + +```js +defaultAppMgr.resetDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful.'); +}); + +defaultAppMgr.resetDefaultApplication("image/png", (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful.'); +}); +``` diff --git a/en/application-dev/reference/apis/js-apis-bytrace.md b/en/application-dev/reference/apis/js-apis-bytrace.md index 40a50ebc4aa5ea496d19df951ff04d03240a1b93..3d532293b18ca1b262feabe80615dc1807ac30dc 100644 --- a/en/application-dev/reference/apis/js-apis-bytrace.md +++ b/en/application-dev/reference/apis/js-apis-bytrace.md @@ -1,6 +1,6 @@ # Performance Tracing -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** > - The APIs of this module are no longer maintained since API version 8. It is recommended that you use the APIs of [hiTraceMeter](js-apis-hitracemeter.md) instead. > - 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. @@ -17,7 +17,7 @@ import bytrace from '@ohos.bytrace'; startTrace(name: string, taskId: number, expectedTime?: number): void -Starts a trace task. **expectedTime** is an optional parameter, which specifies the expected duration of the trace. +Marks the start of a timeslice trace task. **System capability**: SystemCapability.Developtools.Bytrace @@ -25,11 +25,12 @@ Starts a trace task. **expectedTime** is an optional parameter, which specifies | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| name | string | Yes| Name of the trace task to start.| -| taskId | number | Yes| Task ID.| +| name | string | Yes| Name of a timeslice trace task.| +| taskId | number | Yes| ID of a timeslice trace task.| | expectedTime | number | No| Expected duration of the trace, in ms.| -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different task IDs must be specified in **startTrace**. If the trace tasks with the same name are not performed at the same time, the same taskId can be used. For details, see the bytrace.finishTrace example. **Example** @@ -44,7 +45,7 @@ bytrace.startTrace("myTestFunc", 1, 5); // The expected duration of the trace is finishTrace(name: string, taskId: number): void -Stops a trace task. +Marks the end of a timeslice trace task. **System capability**: SystemCapability.Developtools.Bytrace @@ -52,10 +53,11 @@ Stops a trace task. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| name | string | Yes| Name of the trace task to start.| -| taskId | number | Yes| Task ID.| +| name | string | Yes| Name of a timeslice trace task.| +| taskId | number | Yes| ID of a timeslice trace task.| -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > To stop a trace task, the values of name and task ID in **finishTrace** must be the same as those in **startTrace**. **Example** @@ -91,7 +93,7 @@ bytrace.finishTrace("myTestFunc", 1); traceByValue(name: string, count: number): void -Traces the value changes of a variable. +Defines the variable that indicates the number of timeslice trace tasks. **System capability**: SystemCapability.Developtools.Bytrace diff --git a/en/application-dev/reference/apis/js-apis-camera.md b/en/application-dev/reference/apis/js-apis-camera.md index 43f15f6c7b3666fc53f69deadb0043e6adacca46..1298f29856048924fd2a7e8397724aa9fc0df8ee 100644 --- a/en/application-dev/reference/apis/js-apis-camera.md +++ b/en/application-dev/reference/apis/js-apis-camera.md @@ -347,7 +347,7 @@ After **[camera.getCameraManager](#cameragetcameramanager)** is called, a camera ```js async function getCameraInfo("cameraId") { - var cameraManager = await camera.getCameraManager(); + var cameraManager = await camera.getCameraManager(context); var cameras = await cameraManager.getCameras(); var cameraObj = cameras[0]; var cameraId = cameraObj.cameraId; @@ -2231,6 +2231,10 @@ Captures a photo with the specified capture settings. This API uses an asynchron **Example** ```js +let settings:PhotoCaptureSetting = { + quality = 1, + rotation = 0 +} photoOutput.capture(settings, (err) => { if (err) { console.error('Failed to capture the photo ${err.message}'); @@ -2359,7 +2363,7 @@ Listens for frame shutter events. This API uses an asynchronous callback to retu **Example** ```js -photoOutput.on('frameShutter', (frameShutterInfo) => { +photoOutput.on('frameShutter', (err, frameShutterInfo) => { console.log('photo capture end, captureId : ' + frameShutterInfo.captureId); console.log('Timestamp for frame : ' + frameShutterInfo.timestamp); }) @@ -2383,7 +2387,7 @@ Listens for photo capture end events. This API uses an asynchronous callback to **Example** ```js -photoOutput.on('captureEnd', (captureEndInfo) => { +photoOutput.on('captureEnd', (err, captureEndInfo) => { console.log('photo capture end, captureId : ' + captureEndInfo.captureId); console.log('frameCount : ' + captureEndInfo.frameCount); }) @@ -2407,7 +2411,7 @@ Listens for **PhotoOutput** errors. This API uses a callback to return the error **Example** ```js -photoOutput.on('error', (photoOutputError) => { +photoOutput.on('error', (err, photoOutputError) => { console.log('Photo output error code: ' + photoOutputError.code); }) ``` diff --git a/en/application-dev/reference/apis/js-apis-cardEmulation.md b/en/application-dev/reference/apis/js-apis-cardEmulation.md index 3f0d063a7e435b2f777f79bb6934aaf8d233e13a..7c65ecbd616c0bd3ea8fb0c7f7b12a06b67533d4 100644 --- a/en/application-dev/reference/apis/js-apis-cardEmulation.md +++ b/en/application-dev/reference/apis/js-apis-cardEmulation.md @@ -1,12 +1,12 @@ # Standard NFC Card Emulation -Implements Near-Field Communication (NFC) card emulation. +The cardEmulation module implements Near-Field Communication (NFC) card emulation. > **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. -## **Modules to Import** +## Modules to Import ``` import cardEmulation from '@ohos.nfc.cardEmulation'; diff --git a/en/application-dev/reference/apis/js-apis-data-DataShareResultSet.md b/en/application-dev/reference/apis/js-apis-data-DataShareResultSet.md new file mode 100644 index 0000000000000000000000000000000000000000..6adaa00f48cfb7f2e685841e013e3d719bc58548 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-data-DataShareResultSet.md @@ -0,0 +1,424 @@ +# Data Share Result Set + +The **DataShareResultSet** module provides methods for accessing the result set obtained from the database. You can access the values in the specified rows or the value of the specified data type. + +>**NOTE** +> +>The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. + + +## Modules to Import + +```ts +import DataShareResultSet from '@ohos.data.DataShareResultSet'; +``` + +## How to Use + +You can call [query()](js-apis-data-dataShare.md#query) to obtain the **DataShareResultSet** object. + +```ts +import dataShare from '@ohos.data.dataShare'; +import dataSharePredicates from '@ohos.data.dataSharePredicates' + +let dataShareHelper; +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +await dataShare.createDataShareHelper(this.context, uri, (err, data) => { + if (err != undefined) { + console.info("createDataShareHelper fail, error message : " + err); + } else { + console.info("createDataShareHelper end, data : " + data); + dataShareHelper = data; + } +}); + +let columns = ["*"]; +let da = new dataSharePredicates.DataSharePredicates(); +let resultSet; +da.equalTo("name", "ZhangSan"); +dataShareHelper.query(uri, da, columns).then((data) => { + console.log("query end, data : " + data); + resultSet = data; +}).catch((err) => { + console.log("query fail, error message : " + err); +}); +``` + +## Attributes + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +| Name | Type | Mandatory| Description | +| ----------- | ------------- | ---- | ------------------------ | +| columnNames | Array<string> | Yes | Names of all columns in the result set. | +| columnCount | number | Yes | Number of columns in the result set. | +| rowCount | number | Yes | Number of rows in the result set. | +| isClosed | boolean | Yes | Whether the result set is closed.| + +## goToFirstRow + +goToFirstRow(): boolean + +Moves to the first row of the result set. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Return value** + +| Type | Description | +| :------ | --------------------------------------------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + +**Example** + +```ts +let isGoTOFirstRow = resultSet.goToFirstRow(); +console.info('resultSet.goToFirstRow: ' + isGoTOFirstRow); +``` + +## goToLastRow + +goToLastRow(): boolean + +Moves to the last row of the result set. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Return value** + +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + +**Example** + +```ts +let isGoToLastRow = resultSet.goToLastRow(); +console.info('resultSet.goToLastRow: ' + isGoToLastRow); +``` + +## goToNextRow + +goToNextRow(): boolean + +Moves to the next row in the result set. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Return value** + +| Type | Description | +| ------- | --------------------------------------------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + +**Example** + +```ts +let isGoToNextRow = resultSet.goToNextRow(); +console.info('resultSet.goToNextRow: ' + isGoToNextRow); +``` + +## goToPreviousRow + +goToPreviousRow(): boolean + +Moves to the previous row in the result set. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Return value** + +| Type | Description | +| ------- | --------------------------------------------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + +**Example** + +```ts +let isGoToPreviousRow = resultSet.goToPreviousRow(); +console.info('resultSet.goToPreviousRow: ' + isGoToPreviousRow); +``` + +## goTo + +goTo(offset:number): boolean + +Moves based on the specified offset. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| **Name**| **Type**| **Mandatory**| Description | +| ---------- | -------- | -------- | ------------------------------------------------------------ | +| offset | number | Yes | Offset relative to the current position. A negative value means to move backward, and a positive value means to move forward.| + +**Return value** + +| Type | Description | +| ------- | --------------------------------------------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + +**Example** + +```ts +let goToNum = 1; +let isGoTo = resultSet.goTo(goToNum); +console.info('resultSet.goTo: ' + isGoTo); +``` + +## goToRow + +goToRow(position: number): boolean + +Moves to the specified row in the result set. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| **Name**| **Type**| **Mandatory**| Description | +| ---------- | -------- | -------- | ------------------------ | +| position | number | Yes | Destination position to move.| + +**Return value** + +| Type | Description | +| ------- | --------------------------------------------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + +**Example** + +```ts +let goToRowNum = 2 +let isGoToRow = resultSet.goToRow(goToRowNum); +console.info('resultSet.goToRow: ' + isGoToRow); +``` + +## getBlob + +getBlob(columnIndex: number): Uint8Array + +Obtains the value in the specified column in the current row as a byte array. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| **Name** | **Type**| **Mandatory**| Description | +| ----------- | -------- | -------- | ----------------------- | +| columnIndex | number | Yes | Index of the target column, starting from 0.| + +**Return value** + +| Type | Description | +| ---------- | -------------------------------- | +| Uint8Array | Value obtained.| + +**Example** + +```ts +let columnIndex = 1 +let goToFirstRow = resultSet.goToFirstRow(); +let getBlob = resultSet.getBlob(columnIndex); +console.info('resultSet.getBlob: ' + getBlob); +``` + +## getString + +getString(columnIndex: number): *string* + +Obtains the value in the specified column in the current row as a string. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| **Name** | **Type**| **Mandatory**| Description | +| ----------- | -------- | -------- | ----------------------- | +| columnIndex | number | Yes | Index of the target column, starting from 0.| + +**Return value** + +| Type | Description | +| ------ | ---------------------------- | +| string | Value obtained.| + +**Example** + +```ts +let columnIndex = 1 +let goToFirstRow = resultSet.goToFirstRow(); +let getString = resultSet.getString(columnIndex); +console.info('resultSet.getString: ' + getString); +``` + +## getLong + +getLong(columnIndex: number): number + +Obtains the value in the specified column in the current row as a long integer. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| **Name** | **Type**| **Mandatory**| Description | +| ----------- | -------- | -------- | ----------------------- | +| columnIndex | number | Yes | Index of the target column, starting from 0.| + +**Return value** + +| Type | Description | +| ------ | -------------------------- | +| number | Value obtained.| + +**Example** + +```ts +let columnIndex = 1 +let goToFirstRow = resultSet.goToFirstRow(); +let getLong = resultSet.getLong(columnIndex); +console.info('resultSet.getLong: ' + getLong); +``` + +## getDouble + +getDouble(columnIndex: number): number + +Obtains the value in the specified column in the current row as a double-precision floating-point number. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| **Name** | **Type**| **Mandatory**| Description | +| ----------- | -------- | -------- | ----------------------- | +| columnIndex | number | Yes | Index of the target column, starting from 0.| + +**Return value** + +| Type | Description | +| ------ | ---------------------------- | +| number | Value obtained.| + +**Example** + +```ts +let columnIndex = 1 +let goToFirstRow = resultSet.goToFirstRow(); +let getDouble = resultSet.getDouble(columnIndex); +console.info('resultSet.getDouble: ' + getDouble); +``` + +## close + +close(): void + +Closes this result set. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Example** + +```ts +resultSet.close(); +``` + +## getColumnIndex + +getColumnIndex(columnName: string): number + +Obtains the column index based on the column name. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| **Name**| **Type**| **Mandatory**| Description | +| ---------- | -------- | -------- | -------------------------- | +| columnName | string | Yes | Column name.| + +**Return value** + +| Type | Description | +| ------ | ------------------ | +| number | Column index obtained.| + +**Example** + +```ts +let ColumnName = "name" +let getColumnIndex = resultSet.getColumnIndex(ColumnName) +console.info('resultSet.getColumnIndex: ' + getColumnIndex); +``` + +## getColumnName + +getColumnName(columnIndex: number): *string* + +Obtains the column name based on the column index. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| **Name** | **Type**| **Mandatory**| Description | +| ----------- | -------- | -------- | -------------------------- | +| columnIndex | number | Yes | Column index.| + +**Return value** + +| Type | Description | +| ------ | ------------------ | +| string | Column name obtained.| + +**Example** + +```ts +let columnIndex = 1 +let getColumnName = resultSet.getColumnName(columnIndex) +console.info('resultSet.getColumnName: ' + getColumnName); +``` + +## getDataType + +getDataType(columnIndex: number): DataType + +Obtains the data type based on the specified column index. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| **Name** | **Type**| **Mandatory**| Description | +| ----------- | -------- | -------- | -------------------------- | +| columnIndex | number | Yes | Column index.| + +**Return value** + +| Type | Description | +| --------------------- | ------------------ | +| [DataType](#datatype) | Data type obtained.| + +**Example** + +```ts +let columnIndex = 1; +let getDataType = resultSet.getDataType(columnIndex); +console.info('resultSet.getDataType: ' + getDataType); +``` + +## DataType + +Enumerates the data types. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +| Name | Value| Description | +| ----------- | ------ | -------------------- | +| TYPE_NULL | 0 | Null. | +| TYPE_LONG | 1 | Long integer. | +| TYPE_DOUBLE | 2 | Double-precision floating-point number.| +| TYPE_STRING | 3 | String.| +| TYPE_BLOB | 4 | Byte array.| diff --git a/en/application-dev/reference/apis/js-apis-data-ValuesBucket.md b/en/application-dev/reference/apis/js-apis-data-ValuesBucket.md new file mode 100644 index 0000000000000000000000000000000000000000..b0666612257857244fdffc8462cfd9719883412a --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-data-ValuesBucket.md @@ -0,0 +1,37 @@ +# Value Bucket + +The **ValueBucket** holds data in key-value (KV) pairs. You can use it to insert data into a database. + +>**Note** +> +>The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. + + +## Modules to Import + +```ts +import { ValueType } from '@ohos.data.ValuesBucket'; +import { ValuesBucket } from '@ohos.data.ValuesBucket'; +``` + +## ValueType + +Enumerates the value types allowed by the database. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +| Name | Description | +| ------- | -------------------- | +| number | The value is a number. | +| string | The value is a string.| +| boolean | The value is of Boolean type.| + +## ValuesBucket + +Holds a set of KV pairs. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +| Name | Type | Mandatory| Description | +| ------------- | --------------------------------------------- | ---- | ------------------------------------------------------------ | +| [key: string] | [ValueType](#valuetype)\| Uint8Array \| null | Yes | KV pairs in a **ValuesBucket**. The key is of the string type. The value can be a number, string, Boolean value, Unit8Array, or **null**.| diff --git a/en/application-dev/reference/apis/js-apis-data-dataShare.md b/en/application-dev/reference/apis/js-apis-data-dataShare.md new file mode 100644 index 0000000000000000000000000000000000000000..14465e3daf5fe8e25a53ae3987dbb889a1f4dc23 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-data-dataShare.md @@ -0,0 +1,907 @@ +# Data Sharing + +The **DataShare** module allows applications to manage their own data and supports data sharing between applications on the same device. + +>**NOTE** +> +>The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. + + +## Modules to Import + +```ts +import Ability from '@ohos.application.Ability' +import dataShare from '@ohos.data.dataShare' +``` + + +## dataShare.createDataShareHelper + +createDataShareHelper(context: Context, uri: string, callback: AsyncCallback<DataShareHelper>): void + +Creates a **DataShareHelper** instance. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------------------------------------------------- | ---- | ------------------------------------------------------------ | +| context | [Context](js-apis-application-context.md#context) | Yes | Context of an application. | +| uri | string | Yes | Uniform Resource Identifier (URI) of the server application to connect. | +| callback | AsyncCallback<[DataShareHelper](#datasharehelper)> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the **DataShareHelper** instance created. Otherwise, **err** is an error object.| + +**Example** + +```ts +import dataShare from '@ohos.data.dataShare' + +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +let dataShareHelper; +dataShare.createDataShareHelper(this.context, uri, (err, data) => { + if (err != undefined) { + console.info("createDataShareHelper failed, error message : " + err); + } else { + console.info("createDataShareHelper succeed, data : " + data); + dataShareHelper = data; + } +}); +``` + +## dataShare.createDataShareHelper + +createDataShareHelper(context: Context, uri: string): Promise<DataShareHelper> + +Creates a **DataShareHelper** instance. This API uses a promise to return the result. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------------- | ---- | ------------------------------ | +| context | [Context](js-apis-application-context.md#context) | Yes | Context of an application. | +| uri | string | Yes | URI of the server application to connect.| + +**Return value** + +| Type | Description | +| -------------------------------------------------- | -------------------------------------- | +| Promise<[DataShareHelper](#datasharehelper)> | Promise used to return the **DataShareHelper** instance created.| + +**Example** + +```ts +import dataShare from '@ohos.data.dataShare' + +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +let dataShareHelper; +dataShare.createDataShareHelper(this.context, uri).then((data) => { + console.info("createDataShareHelper succeed, data : " + data); + dataShareHelper = data; +}).catch((err) => { + console.info("createDataShareHelper failed, error message : " + err); +}) +``` + +## DataShareHelper + +Provides a **DataShareHelper** instance to access or manage data on the server. Before invoking any method provided by **DataShareHelper**, you must create a **DataShareHelper** instance using [createDataShareHelper](#datasharecreatedatasharehelper). + +### openFile + +openFile(uri: string, mode: string, callback: AsyncCallback<number>): void + +Opens a file. This API uses an asynchronous callback to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------- | ---- | ---------------------------------- | +| uri | string | Yes | URI of the file to open. | +| mode | string | Yes | File open mode.
**r** means to open a file for reading; **w** means to open a file for writing (erasing any data in the file); **wa** means to open a file in append mode for writing at the end of the file; **rw** means to open a file for both reading and writing.| +| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the file descriptor. Otherwise, **err** is an error object.| + +**Example** + +```ts +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +dataShareHelper.openFile(uri, "rwt", (err, data) => { + if (err != undefined) { + console.info("openFile failed, error message : " + err); + }else { + console.info("openFile succeed, data : " + data); + let fd = data; + } +}); +``` + +### openFile + +openFile(uri: string, mode: string): Promise<number> + +Opens a file. This API uses a promise to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name| Type | Mandatory| Description | +| ---- | ------ | ---- | ------------------------------------------------------------ | +| uri | string | Yes | URI of the file to open. | +| mode | string | Yes | File open mode.
**r** means to open a file for reading; **w** means to open a file for writing (erasing any data in the file); **wa** means to open a file in append mode for writing at the end of the file; **rw** means to open a file for both reading and writing.| + +**Return value** + +| Type | Description | +| --------------- | ---------------- | +| Promise<number> | Promise used to return the file descriptor.| + +**Example** + +```ts +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +dataShareHelper.openFile(uri, "rwt").then((data) => { + console.info("openFile succeed, data : " + data); + let fd = data; +}).catch((err) => { + console.info("openFile failed, error message : " + err); +}) +``` + +### on('dataChange') + +on(type: 'dataChange', uri: string, callback: AsyncCallback<void>): void + +Subscribes to changes of the specified data. After an observer is registered, the subscriber will receive a notification when the change notification is triggered (the **notifyChange()** method is called). This API uses an asynchronous callback to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ------------------------ | +| type | string | Yes | Event type to subscribe to. The value is **dataChange**, which indicates data change events.| +| uri | string | Yes | URI of the data.| +| callback | AsyncCallback<void> | Yes | Called when the change notification is triggered. In this case, **err** is **undefined**. Otherwise, it is not called or **err** is an error object.| + +**Example** + +```ts +function onCallback() { + console.info("**** Observer on callback ****"); +} +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +dataShareHelper.on("dataChange", uri, onCallback); +``` + +### off('dataChange') + +off(type: 'dataChange', uri: string, callback?: AsyncCallback<void>): void + +Unsubscribes from the changes of the specified data. This API uses an asynchronous callback to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ------------------------ | +| type | string | Yes | Event type to unsubscribe from. The value is **dataChange**, which indicates data change events.| +| uri | string | Yes | URI of the data.| +| callback | AsyncCallback<void> | No | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.| + +**Example** + +```ts +function offCallback() { + console.info("**** Observer off callback ****"); +} +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +dataShareHelper.off("dataChange", uri, offCallback); +``` + +### insert + +insert(uri: string, value: ValuesBucket, callback: AsyncCallback<number>): void + +Inserts a single data record into the database. This API uses an asynchronous callback to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | +| uri | string | Yes | URI of the data to insert. | +| value | [ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket) | Yes | Data to insert. If this parameter is empty, a blank row will be inserted. | +| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the index of the inserted data record. Otherwise, **err** is an error object.
The data index is not returned if the APIs of the database in use, for example, the key-value database (KVDB), do not support the return of indexes.| + +**Example** + +```ts +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +const valueBucket = { + "name": "rose", + "age": 22, + "salary": 200.5, +} +dataShareHelper.insert(uri, valueBucket, (err, data) => { + if (err != undefined) { + console.log("insert failed, error message : " + err); + }else{ + console.log("insert succeed, data : " + data); + } +}); +``` + +### insert + +insert(uri: string, value: ValuesBucket): Promise<number> + +Inserts a single data record into the database. This API uses a promise to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----- | --------------------------------------------------------- | ---- | -------------------------------------------------- | +| uri | string | Yes | URI of the data to insert. | +| value | [ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket) | Yes | Data to insert. If this parameter is empty, a blank row will be inserted.| + +**Return value** + +| Type | Description | +| ---------------- | ------------------------------------------------------------ | +| Promise<number> | Promise used to return the index of the inserted data record.
The data index is not returned if the APIs of the database (for example, KVDB) in use do not support the return of indexes.| + +**Example** + +```ts +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +const valueBucket = { + "name": "rose1", + "age": 221, + "salary": 20.5, +} +dataShareHelper.insert(uri, valueBucket).then((data) => { + console.log("insert succeed, data : " + data); +}).catch((err) => { + console.log("insert failed, error message : " + err); +}); +``` + +### delete + +delete(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>): void + +Deletes one or more data records from the database. This API uses an asynchronous callback to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| uri | string | Yes | URI of the data to delete. | +| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.
The predicate methods supported by **delete()** vary depending on the database used. For example, the KVDB supports only **inKeys**.| +| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the number of deleted data records. Otherwise, **err** is an error object.
The number of deleted data records is not returned if the APIs of the database (for example, KVDB) in use do not support it.| + +**Example** + +```ts +import dataSharePredicates from '@ohos.data.dataSharePredicates' + +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +let da = new dataSharePredicates.DataSharePredicates(); +da.equalTo("name", "ZhangSan"); +dataShareHelper.delete(uri, da, (err, data) => { + if (err != undefined) { + console.log("delete failed, error message : " + err); + }else{ + console.log("delete succeed, data : " + data); + } +}); +``` + +### delete + +delete(uri: string, predicates: dataSharePredicates.DataSharePredicates): Promise<number> + +Deletes one or more data records from the database. This API uses a promise to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| uri | string | Yes | URI of the data to delete. | +| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.
The predicate methods supported by **delete()** vary depending on the database used. For example, the KVDB supports only **inKeys**.| + +**Return value** + +| Type | Description | +| ---------------- | ------------------------------------------------------------ | +| Promise<number> | Promise used to return the number of deleted data records.
The number of deleted data records is not returned if the APIs of the database (for example, KVDB) in use do not support it.| + +**Example** + +```ts +import dataSharePredicates from '@ohos.data.dataSharePredicates' + +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +let da = new dataSharePredicates.DataSharePredicates(); +da.equalTo("name", "ZhangSan"); +dataShareHelper.delete(uri, da).then((data) => { + console.log("delete succeed, data : " + data); +}).catch((err) => { + console.log("delete failed, error message : " + err); +}); +``` + +### query + +query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<DataShareResultSet>): void + +Queries data in the database. This API uses an asynchronous callback to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| uri | string | Yes | URI of the data to query. | +| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.
The predicate methods supported by **query()** vary depending on the database used. For example, the KVDB supports only **inKeys** and **prefixKey**.| +| columns | Array<string> | Yes | Columns to query. If this parameter is empty, all columns will be queried. | +| callback | AsyncCallback<[DataShareResultSet](js-apis-data-DataShareResultSet.md#datashareresultset)> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the result set obtained. Otherwise, **err** is an error object.| + +**Example** + +```ts +import dataSharePredicates from '@ohos.data.dataSharePredicates' + +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +let columns = ["*"]; +let da = new dataSharePredicates.DataSharePredicates(); +da.equalTo("name", "ZhangSan"); +dataShareHelper.query(uri, da, columns, (err, data) => { + if (err != undefined) { + console.log("query failed, error message : " + err); + }else{ + console.log("query succeed, rowCount : " + data.rowCount); + } +}); +``` + +### query + +query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>): Promise<DataShareResultSet> + +Queries data in the database. This API uses a promise to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| uri | string | Yes | URI of the data to query. | +| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.
The predicate methods supported by **query()** vary depending on the database used. For example, the KVDB supports only **inKeys** and **prefixKey**.| +| columns | Array<string> | Yes | Columns to query. If this parameter is empty, all columns will be queried. | + +**Return value** + +| Type | Description | +| ------------------------------------------------------------ | --------------------------------- | +| Promise<[DataShareResultSet](js-apis-data-DataShareResultSet.md#datashareresultset)> | Promise used to return the result set obtained.| + +**Example** + +```ts +import dataSharePredicates from '@ohos.data.dataSharePredicates' + +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +let columns = ["*"]; +let da = new dataSharePredicates.DataSharePredicates(); +da.equalTo("name", "ZhangSan"); +dataShareHelper.query(uri, da, columns).then((data) => { + console.log("query succeed, rowCount : " + data.rowCount); +}).catch((err) => { + console.log("query failed, error message : " + err); +}); +``` + +### update + +update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket, callback: AsyncCallback<number>): void + +Updates data in the database. This API uses an asynchronous callback to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| uri | string | Yes | URI of the data to update. | +| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.
The predicate methods supported by **update()** vary depending on the database used. For example, only the relational database (RDB) supports predicates.| +| value | [ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket) | Yes | New data. | +| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the number of updated data records. Otherwise, **err** is an error object.
The number of updated data records is not returned if the APIs of the database (for example, KVDB) in use do not support it.| + +**Example** + +```ts +import dataSharePredicates from '@ohos.data.dataSharePredicates' + +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +let da = new dataSharePredicates.DataSharePredicates(); +da.equalTo("name", "ZhangSan"); +const va = { + "name": "roe1", + "age": 21, + "salary": 20.5, + +} +dataShareHelper.update(uri, da, va, (err, data) => { + if (err != undefined) { + console.log("update failed, error message : " + err); + }else{ + console.log("update succeed, data : " + data); + } +}); +``` + +### update + +update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket): Promise<number> + +Updates data in the database. This API uses a promise to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| uri | string | Yes | URI of the data to update. | +| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.
The predicate methods supported by **update()** vary depending on the database used. For example, only the RDB supports predicates.| +| value | [ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket) | Yes | New data. | + +**Return value** + +| Type | Description | +| ---------------- | ------------------------------------------------------------ | +| Promise<number> | Promise used to return the number of data records updated.
The number of updated data records is not returned if the APIs of the database (for example, KVDB) in use do not support it.| + +**Example** + +```ts +import dataSharePredicates from '@ohos.data.dataSharePredicates' + +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +let da = new dataSharePredicates.DataSharePredicates(); +da.equalTo("name", "ZhangSan"); +const va = { + "name": "roe1", + "age": 21, + "salary": 20.5, + +} +dataShareHelper.update(uri, da, va).then((data) => { + console.log("update succeed, data : " + data); +}).catch((err) => { + console.log("update failed, error message : " + err); +}); +``` + +### batchInsert + +batchInsert(uri: string, values: Array<ValuesBucket>, callback: AsyncCallback<number>): void + +Inserts batch data into the database. This API uses an asynchronous callback to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| uri | string | Yes | URI of the data to insert. | +| values | Array<[ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket)> | Yes | Data to insert. | +| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the number of data records inserted. Otherwise, **err** is an error object.
The number of inserted data records is not returned if the APIs of the database (for example, KVDB) in use do not support it.| + +**Example** + +```ts +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +let vbs = new Array({"name": "roe11", "age": 21, "salary": 20.5,}, + {"name": "roe12", "age": 21, "salary": 20.5,}, + {"name": "roe13", "age": 21, "salary": 20.5,}) +dataShareHelper.batchInsert(uri, vbs, (err, data) => { + if (err != undefined) { + console.log("batchInsert failed, error message : " + err); + }else{ + console.log("batchInsert succeed, data : " + data); + } +}); +``` + +### batchInsert + +batchInsert(uri: string, values: Array<ValuesBucket>): Promise<number> + +Inserts batch data into the database. This API uses a promise to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------ | ------------------------------------------------------------ | ---- | ------------------------ | +| uri | string | Yes | URI of the data to insert.| +| values | Array<[ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket)> | Yes | Data to insert. | + +**Return value** + +| Type | Description | +| ---------------- | ------------------------------------------------------------ | +| Promise<number> | Promise used to return the number of data records inserted.
The number of inserted data records is not returned if the APIs of the database (for example, KVDB) in use do not support it.| + +**Example** + +```ts +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +let vbs = new Array({"name": "roe11", "age": 21, "salary": 20.5,}, + {"name": "roe12", "age": 21, "salary": 20.5,}, + {"name": "roe13", "age": 21, "salary": 20.5,}) +dataShareHelper.batchInsert(uri, vbs).then((data) => { + console.log("batchInsert succeed, data : " + data); +}).catch((err) => { + console.log("batchInsert failed, error message : " + err); +}); +``` + +### getType + +getType(uri: string, callback: AsyncCallback<string>): void + +Obtains the Multipurpose Internet Mail Extensions (MIME) type of the specified data. This API uses an asynchronous callback to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | --------------------------------------------- | +| uri | string | Yes | URI of the data. | +| callback | AsyncCallback<string> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the MIME type obtained. Otherwise, **err** is an error object.| + +**Example** + +```ts +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +dataShareHelper.getType(uri, (err, data)=>{ + if (err != undefined) { + console.log("getType failed, error message : " + err); + }else{ + console.log("getType succeed, data : " + data); + let result = data; + } +}); +``` + +### getType + +getType(uri: string): Promise<string> + +Obtains the MIME type of the specified data. This API uses a promise to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name| Type | Mandatory| Description | +| ---- | ------ | ---- | -------------------- | +| uri | string | Yes | URI of the data.| + +**Return value** + +| Type | Description | +| ---------------- | ----------------------------------- | +| Promise<string> | Promise used to return the MIME type obtained.| + +**Example** + +```ts +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +dataShareHelper.getType(uri).then((data) => { + console.log("getType succeed, data : " + data); +}).catch((err) => { + console.log("getType failed, error message : " + err); +}); +``` + +### getFileTypes + +getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback<Array<string>>): void + +Obtains the supported MIME types. This API uses an asynchronous callback to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| uri | string | Yes | URI of the file. | +| mimeTypeFilter | string | Yes | MIME types to match. Example:
**\*/\***: obtain all supported types.
**image/\***: obtain the MIMEs with the main type of **image**.
**\*/jpg**: obtains the MIMEs with subtype of **jpg**.| +| callback | openFile(uri: string, mode: string, callback: AsyncCallback) { let err = {"code":0}; let fd = 0; callback(err,fd);}ts | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the MIME types obtained. Otherwise, **err** is an error object.| + +**Example** + +```ts +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +let mimeTypeFilter = "image/*"; +dataShareHelper.getFileTypes(uri, mimeTypeFilter, (err,data) => { + if (err != undefined) { + console.log("getFileTypes failed, error message : " + err); + }else{ + console.log("getFileTypes succeed, data : " + data); + } +}); +``` + +### getFileTypes + +getFileTypes(uri: string, mimeTypeFilter: string): Promise<Array<string>> + +Obtains the supported MIME types. This API uses a promise to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------------- | ------ | ---- | ------------------------------------------------------------ | +| uri | string | Yes | URI of the file. | +| mimeTypeFilter | string | Yes | MIME types to match. Example:
**\*/\***: obtain all supported types.
**image/\***: obtain the MIMEs with the main type of **image**.
**\*/jpg**: obtains the MIMEs with subtype of **jpg**.| + +**Return value** + +| Type | Description | +| ------------------------ | ------------------------ | +| Promise<Array<string>> | Promise used to return the MIME types obtained.| + +**Example** + +```ts +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +let mimeTypeFilter = "image/*"; +dataShareHelper.getFileTypes(uri, mimeTypeFilter).then((data) => { + console.log("getFileTypes succeed, data : " + data); +}).catch((err) => { + console.log("getFileTypes failed, error message : " + err); +}); +``` + +### normalizeUri + +normalizeUri(uri: string, callback: AsyncCallback<string>): void + +Normalizes a DataShare URI. The normalized URI can be used across devices, and the DataShare URI can be used only by the local device. This API uses an asynchronous callback to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | -------------------------------------------------------- | +| uri | string | Yes | [URI](js-apis-uri.md#uri) to normalize. | +| callback | AsyncCallback<string> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the normalized URI (if **null** is returned, URI normalization is not supported). Otherwise, **err** is an error object.| + +**Example** + +```ts +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +dataShareHelper.normalizeUri(uri, (err, data) => { + if (err != undefined) { + console.log("normalizeUri failed, error message : " + err); + }else{ + console.log("normalizeUri = " + data); + } +}); +``` + +### normalizeUri + +normalizeUri(uri: string): Promise<string> + +Normalizes a DataShare URI. The normalized URI can be used across devices, and the DataShare URI can be used only by the local device. This API uses a promise to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name| Type | Mandatory| Description | +| ---- | ------ | ---- | ----------------------------------------- | +| uri | string | Yes | [URI](js-apis-uri.md#uri) to normalize.| + +**Return value** + +| Type | Description | +| ---------------- | ---------------------------------------------- | +| Promise<string> | Promise used to return the result. If URI normalization is supported, the normalized URI is returned. Otherwise, **null** is returned.| + +**Example** + +```ts +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +dataShareHelper.normalizeUri(uri).then((data) => { + console.log("normalizeUri = " + data); +}).catch((err) => { + console.log("normalizeUri failed, error message : " + err); +}); +``` + +### denormalizeUri + +denormalizeUri(uri: string, callback: AsyncCallback<string>): void + +Denormalizes a URI. This API uses an asynchronous callback to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | --------------------------------------------------- | +| uri | string | Yes | [URI](js-apis-uri.md#uri) to denormalize.| +| callback | AsyncCallback<string> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the URI obtained. If the original URI is returned, denormalization is not required. If **null** is returned, denormalization is not supported. If the operation fails, **err** is an error object.| + +**Example** + +```ts +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +dataShareHelper.denormalizeUri(uri, (err, data) => { + if (err != undefined) { + console.log("denormalizeUri failed, error message : " + err); + }else{ + console.log("denormalizeUri = " + data); + } +}); +``` + +### denormalizeUri + +denormalizeUri(uri: string): Promise<string> + +Denormalizes a URI. This API uses a promise to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name| Type | Mandatory| Description | +| ---- | ------ | ---- | ------------------------------------------- | +| uri | string | Yes | [URI](js-apis-uri.md#uri) to denormalize.| + +**Return value** + +| Type | Description | +| ---------------- | ----------------------------------------- | +| Promise<string> | Promise used to return the result. If the denormalization is successful, the URI obtained is returned. If no operation is required, the original URI is returned. If denormalization is not supported, **null** is returned.| + +**Example** + +```ts +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +dataShareHelper.denormalizeUri(uri).then((data) => { + console.log("denormalizeUri = " + data); +}).catch((err) => { + console.log("denormalizeUri failed, error message : " + err); +}); +``` + +### notifyChange + +notifyChange(uri: string, callback: AsyncCallback<void>): void + +Notifies the registered observer of data changes. This API uses an asynchronous callback to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ------------------------ | +| uri | string | Yes | URI of the data.| +| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the observer is notified of the data changes, **err** is **undefined**. Otherwise, **err** is an error object.| + +**Example** + +```ts +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +dataShareHelper.notifyChange(uri, () => { + console.log("***** notifyChange *****"); +}); +``` + +### notifyChange + +notifyChange(uri: string): Promise<void> + +Notifies the registered observer of data changes. This API uses a promise to return the result. + +This API can be used only in the stage model. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer + +**Parameters** + +| Name| Type | Mandatory| Description | +| ---- | ------ | ---- | -------------------- | +| uri | string | Yes | URI of the data.| + +**Return value** + +| Type | Description | +| -------------- | --------------------- | +| Promise<void> | Promise that returns no value.| + +**Example** + +```ts +let uri = ("datashare:///com.samples.datasharetest.DataShare"); +dataShareHelper.notifyChange(uri); +``` diff --git a/en/application-dev/reference/apis/js-apis-data-dataSharePredicates.md b/en/application-dev/reference/apis/js-apis-data-dataSharePredicates.md new file mode 100644 index 0000000000000000000000000000000000000000..16c1c1c7b622782a577719bae992d10b1f4634a0 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-data-dataSharePredicates.md @@ -0,0 +1,861 @@ +# Data Share Predicates + +You can use **DataSharePredicates** to specify conditions for [updating](js-apis-data-dataShare.md#update), [deleting](js-apis-data-dataShare.md#delete), and [querying](js-apis-data-dataShare.md#query) data with **DataShare**. + +>**NOTE** +> +>The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. + + +## Modules to Import + +```ts +import dataSharePredicates from '@ohos.data.dataSharePredicates'; +``` + +## equalTo + +equalTo(field: string, value: ValueType): DataSharePredicates + +Sets a **DataSharePredicates** object to match the field with data type **ValueType** and value equal to the specified value. + +Currently, only the relational database (RDB) and key-value database (KVDB, schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | --------------------------------------------------- | ---- | ---------------------- | +| field | string | Yes | Column name in the database table. | +| value | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | Value to match.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.equalTo("NAME", "Rose") +``` + +## notEqualTo + +notEqualTo(field: string, value: ValueType): DataSharePredicates + +Sets a **DataSharePredicates** object to match the field with data type **ValueType** and value not equal to the specified value. + +Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | --------------------------------------------------- | ---- | ---------------------- | +| field | string | Yes | Column name in the database table. | +| value | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | Value to match.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.notEqualTo("NAME", "Rose") +``` + +## beginWrap + +beginWrap(): DataSharePredicates + +Adds a left parenthesis to this **DataSharePredicates**. Currently, only the RDB supports this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Return value** + +| Type | Description | +| ------------------------------------------- | ---------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object with a left parenthesis.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.equalTo("NAME", "lisi") + .beginWrap() + .equalTo("AGE", 18) + .or() + .equalTo("SALARY", 200.5) + .endWrap() +``` + +## endWrap + +endWrap(): DataSharePredicates + +Adds a right parenthesis to this **DataSharePredicates** object. Currently, only the RDB supports this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Return value** + +| Type | Description | +| ------------------------------------------- | ---------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object with a right parenthesis.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.equalTo("NAME", "lisi") + .beginWrap() + .equalTo("AGE", 18) + .or() + .equalTo("SALARY", 200.5) + .endWrap() +``` + +## or + +or(): DataSharePredicates + +Adds the OR condition to this **DataSharePredicates** object. + +Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Return value** + +| Type | Description | +| ------------------------------------------- | ---------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object with the OR condition.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.equalTo("NAME", "lisi") + .or() + .equalTo("NAME", "Rose") +``` + +## and + +and(): DataSharePredicates + +Adds the AND condition to this **DataSharePredicates** object. + +Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Return value** + +| Type | Description | +| ------------------------------------------- | ---------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object with the AND condition.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.equalTo("NAME", "lisi") + .and() + .equalTo("SALARY", 200.5) +``` + +## contains + +contains(field: string, value: string): DataSharePredicates + +Sets a **DataSharePredicates** object to match the string that contains the specified value. Currently, only the RDB supports this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | -------------------- | +| field | string | Yes | Column name in the database table. | +| value | string | Yes | Value contained in the string.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.contains("NAME", "os") +``` + +## beginsWith + +beginsWith(field: string, value: string): DataSharePredicates + +Sets a **DataSharePredicates** object to match a string that starts with the specified value. Currently, only the RDB supports this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ---------------------- | +| field | string | Yes | Column name in the database table. | +| value | string | Yes | Start value of the string.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.beginsWith("NAME", "os") +``` + +## endsWith + +endsWith(field: string, value: string): DataSharePredicates + +Sets a **DataSharePredicates** object to match a string that ends with the specified value. Currently, only the RDB supports this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ---------------------- | +| field | string | Yes | Column name in the database table. | +| value | string | Yes | End value of the string.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.endsWith("NAME", "os") +``` + +## isNull + +isNull(field: string): DataSharePredicates + +Sets a **DataSharePredicates** object to match the field whose value is null. + +Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------------------ | +| field | string | Yes | Column name in the database table.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.isNull("NAME") +``` + +## isNotNull + +isNotNull(field: string): DataSharePredicates + +Sets a **DataSharePredicates** object to match the field whose value is not null. + +Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------------------ | +| field | string | Yes | Column name in the database table.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.isNotNull("NAME") +``` + +## like + +like(field: string, value: string): DataSharePredicates + +Sets a **DataSharePredicates** object to match a string that is similar to the specified value. + +Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ---------------------- | +| field | string | Yes | Column name in the database table. | +| value | string | Yes | Value to match.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.like("NAME", "%os%") +``` + +## unlike + +unlike(field: string, value: string): DataSharePredicates + +Sets a **DataSharePredicates** object to match a string that is not similar to the specified value. + +Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ---------------------- | +| field | string | Yes | Column name in the database table. | +| value | string | Yes | Value to match.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.unlike("NAME", "%os%") +``` + +## glob + +glob(field: string, value: string): DataSharePredicates + +Sets a **DataSharePredicates** object to match the specified string. Currently, only the RDB supports this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ---------------------- | +| field | string | Yes | Column name in the database table. | +| value | string | Yes | Value to match.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified string.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.glob("NAME", "?h*g") +``` + +## between + +between(field: string, low: ValueType, high: ValueType): DataSharePredicates + +Sets a **DataSharePredicates** object to match the field with data type **ValueType** and value within the specified range. Currently, only the RDB supports this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | --------------------------------------------------- | ---- | ------------------------ | +| field | string | Yes | Column name in the database table. | +| low | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | The lowest value of the range.| +| high | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | The highest value of the range.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.between("AGE", 10, 50) +``` + +## notBetween + +notBetween(field: string, low: ValueType, high: ValueType): DataSharePredicates + +Sets a **DataSharePredicates** object to match the field with data type **ValueType** and value out of the specified range. Currently, only the RDB supports this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | --------------------------------------------------- | ---- | ------------------------ | +| field | string | Yes | Column name in the database table. | +| low | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | The lowest value of the range.| +| high | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | The highest value of the range.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.notBetween("AGE", 10, 50) +``` + +## greaterThan + +greaterThan(field: string, value: ValueType): DataSharePredicates + +Sets a **DataSharePredicates** object to match the field with data type **ValueType** and value greater than the specified value. + +Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | --------- | ---- | ---------------------- | +| field | string | Yes | Column name in the database table. | +| value | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | Value to match.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.greaterThan("AGE", 10) +``` + +## lessThan + +lessThan(field: string, value: ValueType): DataSharePredicates + +Sets a **DataSharePredicates** object to match the field with data type **ValueType** and value less than the specified value. + +Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | --------------------------------------------------- | ---- | ---------------------- | +| field | string | Yes | Column name in the database table. | +| value | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | Value to match.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.lessThan("AGE", 50) +``` + +## greaterThanOrEqualTo + +greaterThanOrEqualTo(field: string, value: ValueType): DataSharePredicates + +Sets a **DataSharePredicates** object to match the field with data type **ValueType** and value greater than or equal to the specified value. + +Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | --------- | ---- | ---------------------- | +| field | string | Yes | Column name in the database table. | +| value | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | Value to match.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.greaterThanOrEqualTo("AGE", 10) +``` + +## lessThanOrEqualTo + +lessThanOrEqualTo(field: string, value: ValueType): DataSharePredicates + +Sets a **DataSharePredicates** object to match the field with data type **ValueType** and value less than or equal to the specified value. + +Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | --------- | ---- | ---------------------- | +| field | string | Yes | Column name in the database table. | +| value | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | Value to match.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.lessThanOrEqualTo("AGE", 50) +``` + +## orderByAsc + +orderByAsc(field: string): DataSharePredicates + +Sets a **DataSharePredicates** object that sorts the values in a column in ascending order. + +Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------------------ | +| field | string | Yes | Column name in the database table.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.orderByAsc("AGE") +``` + +## orderByDesc + +orderByDesc(field: string): DataSharePredicates + +Sets a **DataSharePredicates** object that sorts the values in a column in descending order. + +Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------------------ | +| field | string | Yes | Column name in the database table.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.orderByDesc("AGE") +``` + +## distinct + +distinct(): DataSharePredicates + +Sets a **DataSharePredicates** object to filter out duplicate records. Currently, only the RDB supports this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.equalTo("NAME", "Rose").distinct() +``` + +## limit + +limit(total: number, offset: number): DataSharePredicates + +Sets a **DataSharePredicates** object to specify the number of results and the start position. + +Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------ | ---- | -------------- | +| total | number | Yes | Number of results. | +| offset | number | Yes | Start position.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.equalTo("NAME", "Rose").limit(10, 3) +``` + +## groupBy + +groupBy(fields: Array<string>): DataSharePredicates + +Sets a **DataSharePredicates** object to group the records according to the specified parameters. Currently, only the RDB supports this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------------- | ---- | -------------------- | +| fields | Array<string> | Yes | Names of the columns to group.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.groupBy(["AGE", "NAME"]) +``` + +## indexedBy + +indexedBy(field: string): DataSharePredicates + +Sets a **DataSharePredicates** object to specify the index column. Currently, only the RDB supports this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | -------------- | +| field | string | Yes | Name of the index column.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.indexedBy("SALARY_INDEX") +``` + +## in + +in(field: string, value: Array<ValueType>): DataSharePredicates + +Sets a **DataSharePredicates** object to match the field with data type **Array** and value within the specified range. + +Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ---------------- | ---- | --------------------------------------- | +| field | string | Yes| Column name in the database table. | +| value | Array<[ValueType](js-apis-data-ValuesBucket.md#valuetype)> | Yes | Array of **ValueType**s to match.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.in("AGE", [18, 20]) +``` + +## notIn + +notIn(field: string, value: Array<ValueType>): DataSharePredicates + +Sets a **DataSharePredicates** object to match the field with data type **Array** and value out of the specified range. + +Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ---------------- | ---- | --------------------------------------- | +| field | string | Yes | Column name in the database table. | +| value | Array<[ValueType](js-apis-data-ValuesBucket.md#valuetype)> | Yes | Array of **ValueType**s to match.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.notIn("NAME", ["Lisa", "Rose"]) +``` + +## prefixKey + +prefixKey(prefix: string): DataSharePredicates + +Sets a **DataSharePredicates** object to match a field with the specified key prefix. Currently, only the KVDB supports this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | -------------- | +| prefix | string | Yes | Key prefix to match.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.prefixKey("NAME") +``` + +## inKeys + +inKeys(keys: Array<string>): DataSharePredicates + +Sets a **DataSharePredicates** object to match the fields whose keys are within the given range. Currently, only the KVDB supports this **DataSharePredicates** object. + +**System capability**: SystemCapability.DistributedDataManager.DataShare.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------------- | ---- | ------------------ | +| inKeys | Array<string> | Yes | Array of the keys to match.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | -------------------------- | +| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.| + +**Example** + +```ts +let predicates = new dataSharePredicates.DataSharePredicates() +predicates.inKeys(["Lisa", "Rose"]) +``` diff --git a/en/application-dev/reference/apis/js-apis-data-distributedobject.md b/en/application-dev/reference/apis/js-apis-data-distributedobject.md index a58a4583a1db69548342f0c63b8a13aec0dfb623..83875a6edb8aa2395b8750e70fb86b7fa596b03d 100644 --- a/en/application-dev/reference/apis/js-apis-data-distributedobject.md +++ b/en/application-dev/reference/apis/js-apis-data-distributedobject.md @@ -1,6 +1,6 @@ # Distributed Data Object -Provides basic data object management, including creating, querying, deleting, modifying, and subscribing to data objects, and distributed data object collaboration for the same application among multiple devices. +The distributedDataObject module provides basic data object management, including creating, querying, deleting, modifying, and subscribing to data objects, and distributed data object collaboration for the same application among multiple devices. > **NOTE**
> @@ -23,9 +23,9 @@ Creates a distributed data object. **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| source | object | Yes| Attribute of the distributed data object to create.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | source | object | Yes| Attribute of the distributed data object to create.| **Return value** | Type| Description| @@ -33,12 +33,11 @@ Creates a distributed data object. | [DistributedObject](#distributedobject) | Distributed data object created.| **Example** - ```js - import distributedObject from '@ohos.data.distributedDataObject'; - // Create a distributed data object, which contains attributes of four types, namely, string, number, boolean, and object. - var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, - parent:{mother:"jack mom",father:"jack Dad"}}); - ``` +```js +import distributedObject from '@ohos.data.distributedDataObject'; +// Create a distributed data object, which contains attributes of four types, namely, string, number, boolean, and object. +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); +``` ## distributedObject.genSessionId @@ -50,15 +49,15 @@ Creates a random session ID. **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Return value** -| Type| Description| -| -------- | -------- | -| string | Session ID created.| + | Type| Description| + | -------- | -------- | + | string | Session ID created.| **Example** - ```js - import distributedObject from '@ohos.data.distributedDataObject'; - var sessionId = distributedObject.genSessionId(); - ``` +```js +import distributedObject from '@ohos.data.distributedDataObject'; +var sessionId = distributedObject.genSessionId(); +``` ## SaveSuccessResponse9+ @@ -98,27 +97,26 @@ Sets a session ID for synchronization. Automatic synchronization is performed fo **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| sessionId | string | No| ID of a distributed data object on a trusted network. To remove a distributed data object from the network, set this parameter to "" or leave it empty.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | sessionId | string | No| ID of a distributed data object on a trusted network. To remove a distributed data object from the network, set this parameter to "" or leave it empty.| **Return value** -| Type| Description| -| -------- | -------- | -| boolean | Returns **true** if the session ID is set successfully;
returns **false** otherwise. | + | Type| Description| + | -------- | -------- | + | boolean | Returns **true** if the session ID is set successfully;
returns **false** otherwise. | **Example** - ```js - import distributedObject from '@ohos.data.distributedDataObject'; - var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, - parent:{mother:"jack mom",father:"jack Dad"}}); - // Add g_object to the distributed network. - g_object.setSessionId(distributedObject.genSessionId()); - // Remove g_object from the distributed network. - g_object.setSessionId(""); - ``` +```js +import distributedObject from '@ohos.data.distributedDataObject'; +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}});; +// Add g_object to the distributed network. +g_object.setSessionId(distributedObject.genSessionId()); +// Remove g_object from the distributed network. +g_object.setSessionId(""); +``` ### on('change') @@ -130,15 +128,15 @@ Subscribes to the changes of this distributed data object. **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type to subscribe to. The value is **change**, which indicates data changes.| -| callback | Callback<{ sessionId: string, fields: Array<string> }> | Yes| Callback used to return the changes of the distributed data object.
**sessionId** indicates the session ID of the distributed data object.
**fields** indicates the changed attributes of the distributed data object.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Event type to subscribe to. The value is **change**, which indicates data changes.| + | callback | Callback<{ sessionId: string, fields: Array<string> }> | Yes| Callback used to return the changes of the distributed data object.
**sessionId** indicates the session ID of the distributed data object.
**fields** indicates the changed attributes of the distributed data object.| **Example** ```js import distributedObject from '@ohos.data.distributedDataObject'; -var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,parent:{mother:"jack mom",father:"jack Dad"}}); +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); globalThis.changeCallback = (sessionId, changeData) => { console.info("change" + sessionId); if (changeData != null && changeData != undefined) { @@ -159,16 +157,16 @@ Unsubscribes from the changes of this distributed data object. **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type to unsubscribe from. The value is **change**, which indicates data changes.| -| callback | Callback<{ sessionId: string, fields: Array<string> }> | No| Callback to be unregistered. If this parameter is not set, all data change callbacks of the object will be unregistered.
**sessionId** indicates the session ID of the distributed data object.
**fields** indicates the changed attributes of the distributed data object.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Event type to unsubscribe from. The value is **change**, which indicates data changes.| + | callback | Callback<{ sessionId: string, fields: Array<string> }> | No| Callback to be unregistered. If this parameter is not set, all data change callbacks of the object will be unregistered.
**sessionId** indicates the session ID of the distributed data object.
**fields** indicates the changed attributes of the distributed data object.| **Example** ```js import distributedObject from '@ohos.data.distributedDataObject'; -var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,parent:{mother:"jack mom",father:"jack Dad"}}); +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); // Unregister the specified data change callback. g_object.off("change", globalThis.changeCallback); // Unregister all data change callbacks. @@ -184,10 +182,10 @@ Subscribes to the status change (online or offline) of this distributed data obj **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type to subscribe to. The value is **status**, which indicates the status change (online or offline) of the distributed data object.| -| callback | Callback<{ sessionId: string, networkId: string, status: 'online' \| 'offline' }> | Yes| Callback used to return the status change.
**sessionId**: session ID of the distributed data object.
**networkId**: object device ID, that is, **deviceId**.
**status** indicates the object status, which can be online or offline. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Event type to subscribe to. The value is **status**, which indicates the status change (online or offline) of the distributed data object.| + | callback | Callback<{ sessionId: string, networkId: string, status: 'online' \| 'offline' }> | Yes| Callback used to return the status change.
**sessionId**: session ID of the distributed data object.
**networkId**: object device ID, that is, **deviceId**.
**status** indicates the object status, which can be online or offline.| **Example** ```js @@ -195,7 +193,7 @@ import distributedObject from '@ohos.data.distributedDataObject'; globalThis.statusCallback = (sessionId, networkId, status) => { globalThis.response += "status changed " + sessionId + " " + status + " " + networkId; } -var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,parent:{mother:"jack mom",father:"jack Dad"}}); +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); g_object.on("status", globalThis.statusCallback); ``` @@ -209,16 +207,16 @@ Unsubscribes from the status change (online or offline) of this distributed data **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type to unsubscribe from. The value is **status**, which indicates the status change (online or offline) of the distributed data object.| -| callback | Callback<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }> | No| Callback used to return the status change. If this parameter is not specified, this API unsubscribes from all callbacks of this distributed data object.
**sessionId**: session ID of the distributed data object.
**deviceId** indicates the device ID of the distributed data object.
**status** indicates the status, which can be online or offline.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Event type to unsubscribe from. The value is **status**, which indicates the status change (online or offline) of the distributed data object.| + | callback | Callback<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }> | No| Callback used to return the status change. If this parameter is not specified, this API unsubscribes from all callbacks of this distributed data object.
**sessionId**: session ID of the distributed data object.
**deviceId** indicates the device ID of the distributed data object.
**status** indicates the status, which can be online or offline.| **Example** ```js import distributedObject from '@ohos.data.distributedDataObject'; -var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,parent:{mother:"jack mom",father:"jack Dad"}}); +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); globalThis.statusCallback = (sessionId, networkId, status) => { globalThis.response += "status changed " + sessionId + " " + status + " " + networkId; } @@ -245,24 +243,24 @@ The saved data will be released in the following cases: **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| deviceId | string | Yes| ID of the device where data is stored. The value **local** indicates the local device.| -| callback | AsyncCallback<[SaveSuccessResponse](#savesuccessresponse)> | Yes| Callback used to return **SaveSuccessResponse**, which contains information such as session ID, version, and device ID.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | deviceId | string | Yes| ID of the device where data is stored. The value **local** indicates the local device.| + | callback | AsyncCallback<[SaveSuccessResponse](#savesuccessresponse9)> | Yes| Callback used to return **SaveSuccessResponse**, which contains information such as session ID, version, and device ID.| **Example** - - ```ts - import distributedObject from '@ohos.data.distributedDataObject'; - var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); - g_object.setSessionId("123456"); - g_object.save("local", (result)=>{ - console.log("save callback"); - console.info("save sessionId " + result.sessionId); - console.info("save version " + result.version); - console.info("save deviceId " + result.deviceId); - }); - ``` +```js +import distributedObject from '@ohos.data.distributedDataObject'; +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); +g_object.setSessionId("123456"); +g_object.save("local", (status, result)=>{ + console.log("save status = " + status); + console.log("save callback"); + console.info("save sessionId: " + result.sessionId); + console.info("save version: " + result.version); + console.info("save deviceId: " + result.deviceId); +}); +``` ### save9+ @@ -281,31 +279,31 @@ The saved data will be released in the following cases: **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| deviceId | string | Yes| ID of the device where the data is saved. The default value is **local**, which indicates the local device. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | deviceId | string | Yes| ID of the device where the data is saved. The default value is **local**, which indicates the local device. | - **Return value** +**Return value** -| Type| Description| -| -------- | -------- | -| Promise<[SaveSuccessResponse](#savesuccessresponse)> | Promise used to return **SaveSuccessResponse**, which contains information such as session ID, version, and device ID.| + | Type| Description| + | -------- | -------- | + | Promise<[SaveSuccessResponse](#savesuccessresponse9)> | Promise used to return **SaveSuccessResponse**, which contains information such as session ID, version, and device ID.| **Example** - ```ts - import distributedObject from '@ohos.data.distributedDataObject'; - var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); - g_object.setSessionId("123456"); - g_object.save("local").then((result)=>{ - console.log("save callback"); - console.info("save sessionId " + result.sessionId); - console.info("save version " + result.version); - console.info("save deviceId " + result.deviceId); - }, ()=>{ - console.error("save failed"); - }); - ``` +```js +import distributedObject from '@ohos.data.distributedDataObject'; +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); +g_object.setSessionId("123456"); +g_object.save("local").then((result)=>{ + console.log("save callback"); + console.info("save sessionId " + result.sessionId); + console.info("save version " + result.version); + console.info("save deviceId " + result.deviceId); +}, ()=>{ + console.error("save failed"); +}); +``` ### revokeSave9+ @@ -319,20 +317,20 @@ If the object is stored on another device, the data on the local device will be **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<[RevokeSaveSuccessResponse](#revokesavesuccessresponse)> | No| Callback used to return **RevokeSaveSuccessResponse**, which contains the session ID.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<[RevokeSaveSuccessResponse](#revokesavesuccessresponse9)> | No| Callback used to return **RevokeSaveSuccessResponse**, which contains the session ID.| **Example** - ```ts - import distributedObject from '@ohos.data.distributedDataObject'; - var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); - g_object.setSessionId("123456"); - g_object.revokeSave((result, data) =>{ - console.log("revokeSave callback"); - }); - ``` +```js +import distributedObject from '@ohos.data.distributedDataObject'; +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); +g_object.setSessionId("123456"); +g_object.revokeSave((result, data) =>{ + console.log("revokeSave callback"); +}); +``` ### revokeSave9+ @@ -345,22 +343,22 @@ If the object is stored on another device, the data on the local device will be **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject - **Return value** +**Return value** -| Type| Description| -| -------- | -------- | -| Promise<[RevokeSaveSuccessResponse](#revokesavesuccessresponse)> | Promise used to return **RevokeSaveSuccessResponse**, which contains the session ID.| + | Type| Description| + | -------- | -------- | + | Promise<[RevokeSaveSuccessResponse](#revokesavesuccessresponse9)> | Promise used to return **RevokeSaveSuccessResponse**, which contains the session ID.| **Example** - ```ts - import distributedObject from '@ohos.data.distributedDataObject'; - var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); - g_object.setSessionId("123456"); - g_object.revokeSave("local").then((result)=>{ - console.log("revokeSave callback"); - console.log("sessionId" + result.sessionId); - }, ()=>{ - console.error("revokeSave failed"); - }); - ``` +```js +import distributedObject from '@ohos.data.distributedDataObject'; +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); +g_object.setSessionId("123456"); +g_object.revokeSave().then((result)=>{ + console.log("revokeSave callback"); + console.log("sessionId" + result.sessionId); +}, ()=>{ + console.error("revokeSave failed"); +}); +``` diff --git a/en/application-dev/reference/apis/js-apis-data-preferences.md b/en/application-dev/reference/apis/js-apis-data-preferences.md index 73d27f9f20009d0674b4cf07e017139988d09fbe..63371ed42b8eb940caa8072ffda6aa17d78658c5 100644 --- a/en/application-dev/reference/apis/js-apis-data-preferences.md +++ b/en/application-dev/reference/apis/js-apis-data-preferences.md @@ -1,6 +1,6 @@ # Preferences -Preferences provide capabilities for processing data in the form of key-value (KV) pairs and support lightweight data persistence, modification, and query. In KV pairs, keys are of the string type, and values can be of the number, string, or Boolean type. +Preferences provide capabilities for processing data in the form of key-value (KV) pairs and support lightweight data persistence, modification, and query. In KV pairs, the keys are of the string type, and the values can be of the number, string, Boolean, Array\, Array\, or Array\ type. > **NOTE**
@@ -33,11 +33,11 @@ Reads a **Preferences** persistence file and loads data to the **Preferences** i **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| context | [Context](js-apis-ability-context.md) | Yes| Context of the application or functionality.| -| name | string | Yes| Name of the **Preferences** instance persistence file.| -| callback | AsyncCallback<[Preferences](#preferences)> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | context | [Context](js-apis-ability-context.md) | Yes| Context of the application or function.| + | name | string | Yes| Name of the **Preferences** instance persistence file.| + | callback | AsyncCallback<[Preferences](#preferences)> | Yes| Callback used to return the result.| **Example** ```ts @@ -60,15 +60,15 @@ Reads a **Preferences** persistence file and loads data to the **Preferences** i **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| context | [Context](js-apis-ability-context.md) | Yes| Context of the application or functionality.| -| name | string | Yes| Name of the **Preferences** instance persistence file.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | context | [Context](js-apis-ability-context.md) | Yes| Context of the application or function.| + | name | string | Yes| Name of the **Preferences** instance persistence file.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<[Preferences](#preferences)> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<[Preferences](#preferences)> | Promise used to return the result.| **Example** ```ts @@ -91,11 +91,11 @@ Once a **Preferences** persistence file is deleted, the **Preferences** instance **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| context | [Context](js-apis-ability-context.md) | Yes| Context of the application or functionality.| -| name | string | Yes| Name of the **Preferences** instance persistence file.| -| callback | AsyncCallback<void> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | context | [Context](js-apis-ability-context.md) | Yes| Context of the application or function.| + | name | string | Yes| Name of the **Preferences** instance persistence file.| + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```ts @@ -119,15 +119,15 @@ Once a **Preferences** persistence file is deleted, the **Preferences** instance **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| context | [Context](js-apis-ability-context.md) | Yes| Context of the application or functionality.| -| name | string | Yes| Name of the **Preferences** instance persistence file.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | context | [Context](js-apis-ability-context.md) | Yes| Context of the application or function.| + | name | string | Yes| Name of the **Preferences** instance persistence file.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise that returns no value.| **Example** ```ts @@ -151,11 +151,11 @@ When a **Preferences** singleton instance is removed, this instance cannot be us **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| context | [Context](js-apis-ability-context.md) | Yes| Context of the application or functionality.| -| name | string | Yes| Name of the **Preferences** instance persistence file.| -| callback | AsyncCallback<void> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | context | [Context](js-apis-ability-context.md) | Yes| Context of the application or function.| + | name | string | Yes| Name of the **Preferences** instance persistence file.| + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```ts @@ -180,15 +180,15 @@ When a **Preferences** singleton instance is removed, this instance cannot be us **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| context | [Context](js-apis-ability-context.md) | Yes| Context of the application or functionality.| -| name | string | Yes| Name of the **Preferences** instance persistence file.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | context | [Context](js-apis-ability-context.md) | Yes| Context of the application or function.| + | name | string | Yes| Name of the **Preferences** instance persistence file.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise that returns no value.| **Example** ```ts @@ -218,7 +218,7 @@ Obtains the value of a key. If the value is null or a non-default value, the def | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | key | string | Yes| Key of the data to obtain. It cannot be empty.| -| defValue | [ValueType](#valuetype) | Yes| Default value to be returned. It can be a number, string, or Boolean value.| +| defValue | [ValueType](#valuetype) | Yes| Default value to be returned. It can be a number, a string, a Boolean value, an array of numbers, an array of strings, or a Boolean array. | callback | AsyncCallback<ValueType> | Yes| Callback used to return the result.| **Example** @@ -241,16 +241,16 @@ Obtains the value of a key. If the value is null or a non-default value, the def **System capability**: SystemCapability.DistributedDataManager.Preferences.Core -**Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data to obtain. It cannot be empty.| -| defValue | [ValueType](#valuetype) | Yes| Default value to be returned. It can be a number, string, or Boolean value.| +- **Parameters** + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the data to obtain. It cannot be empty.| + | defValue | [ValueType](#valuetype) | Yes| Default value to be returned. It can be a number, a string, a Boolean value, an array of numbers, an array of strings, or a Boolean array. **Return value** -| Type| Description| -| -------- | -------- | -| Promise<ValueType> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<ValueType> | Promise used to return the result.| **Example** ```ts @@ -271,13 +271,13 @@ Obtains the **Object** instance that contains all KV pairs. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<Object> | Yes| Callback used to return the **Object** instance obtained.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<Object> | Yes| Callback used to return the **Object** instance obtained.| **Example** ```ts -preferences.get.getAll(function (err, value) { +preferences.getAll(function (err, value) { if (err) { console.info("getAll failed, err: " + err) return @@ -298,9 +298,9 @@ Obtains the **Object** instance that contains all KV pairs. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Return value** -| Type| Description| -| -------- | -------- | -| Promise<Object> | Promise used to return the **Object** instance obtained.| + | Type| Description| + | -------- | -------- | + | Promise<Object> | Promise used to return the **Object** instance obtained.| **Example** ```ts @@ -323,11 +323,11 @@ Puts a new value to this **Preferences** instance and its persistence file. This **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data. It cannot be empty.| -| value | [ValueType](#valuetype) | Yes| New value to store. It can be a number, string, or Boolean value.| -| callback | AsyncCallback<void> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the data. It cannot be empty.| + | value | [ValueType](#valuetype) | Yes| New value to store. It can be a number, a string, a Boolean value, an array of numbers, an array of strings, or a Boolean array.| + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```ts @@ -350,15 +350,15 @@ Puts a new value to this **Preferences** instance and its persistence file. This **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data. It cannot be empty.| -| value | [ValueType](#valuetype) | Yes| New value to store. It can be a number, string, or Boolean value.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the data. It cannot be empty.| + | value | [ValueType](#valuetype) | Yes| New value to store. It can be a number, a string, a Boolean value, an array of numbers, an array of strings, or a Boolean array.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise that returns no value.| **Example** ```ts @@ -380,10 +380,10 @@ Checks whether this **Preferences** instance contains data with a given key. Thi **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data to check. It cannot be empty.| -| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. It returns **true** if the **Preferences** instance contains data with the given key and returns **false** otherwise.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the data to check. It cannot be empty.| + | callback | AsyncCallback<boolean> | Yes| Callback used to return the result. It returns **true** if the **Preferences** instance contains data with the given key and returns **false** otherwise.| **Example** ```ts @@ -410,14 +410,14 @@ Checks whether this **Preferences** instance contains data with a given key. Thi **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data to check. It cannot be empty.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the data to check. It cannot be empty.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to return the result. It returns **true** if the **Preferences** instance contains data with the given key and returns **false** otherwise.| + | Type| Description| + | -------- | -------- | + | Promise<boolean> | Promise used to return the result. It returns **true** if the **Preferences** instance contains data with the given key and returns **false** otherwise.| **Example** ```ts @@ -443,10 +443,10 @@ Deletes a KV pair of the specified key from this **Preferences** instance. This **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the KV pair to delete. It cannot be empty.| -| callback | AsyncCallback<void> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the KV pair to delete. It cannot be empty.| + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```ts @@ -469,14 +469,14 @@ Deletes a KV pair of the specified key from this **Preferences** instance. This **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the KV pair to delete. It cannot be empty.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the KV pair to delete. It cannot be empty.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise that returns no value.| **Example** ```ts @@ -498,9 +498,9 @@ Saves the modification to this **Preferences** instance and synchronizes the mod **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<void> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```ts @@ -523,9 +523,9 @@ Saves the modification to this **Preferences** instance and synchronizes the mod **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise that returns no value.| **Example** ```ts @@ -547,9 +547,9 @@ Clears data of this **Preferences** instance. This API uses an asynchronous call **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<void> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```ts @@ -572,9 +572,9 @@ Clears data of this **Preferences** instance. This API uses a promise to return **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise that returns no value.| **Example** ```ts @@ -596,33 +596,36 @@ Subscribes to data changes. When the value of the subscribed key changes, a call **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **change** indicates data change events.| -| callback | Callback<{ key : string }> | Yes| Callback used to return data changes.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Event type. The value **change** indicates data change events.| + | callback | Callback<{ key : string }> | Yes| Callback used to return data changes.| **Example** ```ts -var observer = function (key) { - console.info("The key of " + key + " changed.") -} - -... - -preferences.on('change', observer) -preferences.put('startup', 'auto', function (err) { +data_preferences.getPreferences(this.context, 'mystore', function (err, preferences) { if (err) { - console.info("Failed to put the value of startup, err: " + err) - return + console.info("Failed to get preferences.") + return; } - console.info("Put the value of startup successfully.") - - preferences.flush(function (err) { + var observer = function (key) { + console.info("The key of " + key + " changed.") + } + preferences.on('change', observer) + preferences.put('startup', 'auto', function (err) { if (err) { - console.info("Failed to flush data to file, err: " + err) + console.info("Failed to put the value of startup, err: " + err) return } - console.info("Flushed data to file successfully.") // The observer will be called. + console.info("Put the value of startup successfully.") + + preferences.flush(function (err) { + if (err) { + console.info("Failed to flush data to file, err: " + err) + return + } + console.info("Flushed data to file successfully.") // The observer will be called. + }) }) }) ``` @@ -637,33 +640,36 @@ Unsubscribes from data changes. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **change** indicates data change events.| -| callback | Callback<{ key : string }> | No| Callback used to return data changes. If this parameter is left empty, all callbacks for data changes will be canceled.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Event type. The value **change** indicates data change events.| + | callback | Callback<{ key : string }> | No| Callback used to return data changes. If this parameter is left empty, all callbacks for data changes will be canceled.| **Example** ```ts -var observer = function (key) { - console.info("The key of " + key + " changed.") -} - -... - -preferences.on('change', observer) -preferences.put('startup', 'auto', function (err) { +data_preferences.getPreferences(this.context, 'mystore', function (err, preferences) { if (err) { - console.info("Failed to put the value of startup, err: " + err) - return + console.info("Failed to get preferences.") + return; } - console.info("Put the value of startup successfully.") - - preferences.flush(function (err) { + var observer = function (key) { + console.info("The key of " + key + " changed.") + } + preferences.on('change', observer) + preferences.put('startup', 'auto', function (err) { if (err) { - console.info("Failed to flush data to file, err: " + err) + console.info("Failed to put the value of startup, err: " + err) return } - console.info("Flushed data to file successfully.") // The observer will be called. + console.info("Put the value of startup successfully.") + + preferences.flush(function (err) { + if (err) { + console.info("Failed to flush data to file, err: " + err) + return + } + console.info("Flushed data to file successfully.") // The observer will be called. + }) preferences.off('change', observer) }) }) @@ -675,8 +681,11 @@ Enumerates the value types. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core -| Name | Description | -| ------- | -------------------- | -| number | The value is a number. | -| string | The value is a string. | -| boolean | The value is of Boolean type.| +| Name | Description | +| -------------- | ------------------------------ | +| number | The value is a number. | +| string | The value is a string. | +| boolean | The value is of Boolean type. | +| Array\ | The value is an array of numbers. | +| Array\ | The value is a Boolean array. | +| Array\ | The value is an array of the strings.| diff --git a/en/application-dev/reference/apis/js-apis-data-rdb.md b/en/application-dev/reference/apis/js-apis-data-rdb.md index ac26222e5da8c26216901b3de93bec9b4f22133b..71b5d2bec230d88f378b1fa122319e8ba983c6e7 100644 --- a/en/application-dev/reference/apis/js-apis-data-rdb.md +++ b/en/application-dev/reference/apis/js-apis-data-rdb.md @@ -29,7 +29,7 @@ Obtains an RDB store. This API uses an asynchronous callback to return the resul | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| context | Context | Yes| Context of the application or functionality.
See [Context](js-apis-Context.md) for versions earlier than API version 9.
See [Context](js-apis-ability-context.md) for API version 9 or later.| +| context | Context | Yes| Application context.
For the application context of the FA model, see [Context](js-apis-Context.md).
For the application context of the stage model, see [Context](js-apis-ability-context.md).| | config | [StoreConfig](#storeconfig) | Yes| Configuration of the RDB store.| | version | number | Yes| RDB store version.| | callback | AsyncCallback<[RdbStore](#rdbstore)> | Yes| Callback invoked to return the RDB store obtained.| @@ -59,7 +59,7 @@ Obtains an RDB store. This API uses a promise to return the result. You can set | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| context | Context | Yes| Context of the application or functionality.
See [Context](js-apis-Context.md) for versions earlier than API version 9.
See [Context](js-apis-ability-context.md) for API version 9 or later.| +| context | Context | Yes|Application context.
For the application context of the FA model, see [Context](js-apis-Context.md).
For the application context of the stage model, see [Context](js-apis-ability-context.md).| | config | [StoreConfig](#storeconfig) | Yes| Configuration of the RDB store.| | version | number | Yes| RDB store version.| @@ -92,7 +92,7 @@ Deletes an RDB store. This API uses an asynchronous callback to return the resul **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| context | Context | Yes| Context of the application or functionality.
See [Context](js-apis-Context.md) for versions earlier than API version 9.
See [Context](js-apis-ability-context.md) for API version 9 or later.| +| context | Context | Yes| Application context.
For the application context of the FA model, see [Context](js-apis-Context.md).
For the application context of the stage model, see [Context](js-apis-ability-context.md).| | name | string | Yes| Name of the RDB store to delete.| | callback | AsyncCallback<void> | Yes| Callback invoked to return the result.| @@ -118,7 +118,7 @@ Deletes an RDB store. This API uses a promise to return the result. **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| context | Context | Yes| Context of the application or functionality.
See [Context](js-apis-Context.md) for versions earlier than API version 9.
See [Context](js-apis-ability-context.md) for API version 9 or later.| +| context | Context | Yes| Application context.
For the application context of the FA model, see [Context](js-apis-Context.md).
For the application context of the stage model, see [Context](js-apis-ability-context.md).| | name | string | Yes| Name of the RDB store to delete.| **Return value** @@ -1018,7 +1018,7 @@ const valueBucket = { } let promise = rdbStore.insert("EMPLOYEE", valueBucket) promise.then(async (ret) => { - console.log("Insert first done: " + ret) + console.log("Inserted first row: " + ret) }).catch((err) => { console.log("Failed to insert data, err: " + err) }) @@ -1029,16 +1029,16 @@ promise.then(async (ret) => { update(values: ValuesBucket, predicates: RdbPredicates, callback: AsyncCallback<number>):void -Updates data in the database based on the specified RdbPredicates object. This API uses an asynchronous callback to return the result. +Updates data in the RDB store based on the specified **RdbPredicates** object. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| values | [ValuesBucket](#valuesbucket) | Yes| Rows of data to be updated in the database. The key-value pair is associated with the column name in the target table.| +| values | [ValuesBucket](#valuesbucket) | Yes| Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.| | predicates | [RdbPredicates](#rdbpredicates) | Yes| Update conditions specified by the **RdbPredicates** object.| -| callback | AsyncCallback<number> | Yes| Callback used to return the number of rows updated.| +| callback | AsyncCallback<number> | Yes| Callback invoked to return the number of rows updated.| **Example** ```js @@ -1064,14 +1064,14 @@ rdbStore.update(valueBucket, predicates, function (err, ret) { update(values: ValuesBucket, predicates: RdbPredicates):Promise<number> -Updates data in the database based on the specified RdbPredicates object. This API uses a promise to return the result. +Updates data in the RDB store based on the specified **RdbPredicates** object. This API uses a promise to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| values | [ValuesBucket](#valuesbucket) | Yes| Rows of data to be updated in the database. The key-value pair is associated with the column name in the target table.| +| values | [ValuesBucket](#valuesbucket) | Yes| Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.| | predicates | [RdbPredicates](#rdbpredicates) | Yes| Update conditions specified by the **RdbPredicates** object.| **Return value** @@ -1100,7 +1100,7 @@ promise.then(async (ret) => { ### update9+ update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>):void -Updates data in the database based on the specified **DataSharePredicates** object. This API uses an asynchronous callback to return the result. +Updates data in the RDB store based on the specified **DataSharePredicates** object. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core @@ -1108,9 +1108,9 @@ Updates data in the database based on the specified **DataSharePredicates** obje | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | table | string | Yes| Name of the target table.| -| values | [ValuesBucket](#valuesbucket) | Yes| Rows of data to be updated in the database. The key-value pair is associated with the column name in the target table.| +| values | [ValuesBucket](#valuesbucket) | Yes| Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.| | predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates)| Yes| Update conditions specified by the **DataSharePredicates** object.| -| callback | AsyncCallback<number> | Yes| Callback used to return the number of rows updated.| +| callback | AsyncCallback<number> | Yes| Callback invoked to return the number of rows updated.| **Example** ```js @@ -1135,7 +1135,7 @@ rdbStore.update("EMPLOYEE", valueBucket, predicates, function (err, ret) { update(table: string, values: ValuesBucket, predicates: DataSharePredicates):Promise<number> -Updates data in the database based on the specified **DataSharePredicates** object. This API uses a promise to return the result. +Updates data in the RDB store based on the specified **DataSharePredicates** object. This API uses a promise to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core @@ -1143,7 +1143,7 @@ Updates data in the database based on the specified **DataSharePredicates** obje | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | table | string | Yes| Name of the target table.| -| values | [ValuesBucket](#valuesbucket) | Yes| Rows of data to be updated in the database. The key-value pair is associated with the column name in the target table.| +| values | [ValuesBucket](#valuesbucket) | Yes| Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.| | predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | Yes| Update conditions specified by the **DataSharePredicates** object.| **Return value** @@ -1175,7 +1175,7 @@ promise.then(async (ret) => { delete(predicates: RdbPredicates, callback: AsyncCallback<number>):void -Deletes data from the database based on the specified **RdbPredicates** object. This API uses an asynchronous callback to return the result. +Deletes data from the RDB store based on the specified **RdbPredicates** object. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core @@ -1203,7 +1203,7 @@ rdbStore.delete(predicates, function (err, rows) { delete(predicates: RdbPredicates):Promise<number> -Deletes data from the database based on the specified **RdbPredicates** object. This API uses a promise to return the result. +Deletes data from the RDB store based on the specified **RdbPredicates** object. This API uses a promise to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core @@ -1215,7 +1215,7 @@ Deletes data from the database based on the specified **RdbPredicates** object. **Return value** | Type| Description| | -------- | -------- | -| Promise<number> | Promise used to return the number of rows updated.| +| Promise<number> | Promise used to return the number of rows updated.| **Example** ```js @@ -1234,7 +1234,7 @@ promise.then((rows) => { delete(table: string, predicates: DataSharePredicates, callback: AsyncCallback<number>):void -Deletes data from the database based on the specified **DataSharePredicates** object. This API uses an asynchronous callback to return the result. +Deletes data from the RDB store based on the specified **DataSharePredicates** object. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core @@ -1262,7 +1262,7 @@ rdbStore.delete("EMPLOYEE", predicates, function (err, rows) { delete(table: string, predicates: dataSharePredicates.DataSharePredicates):Promise<number> -Deletes data from the database based on the specified **DataSharePredicates** object. This API uses a promise to return the result. +Deletes data from the RDB store based on the specified **DataSharePredicates** object. This API uses a promise to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core @@ -1275,7 +1275,7 @@ Deletes data from the database based on the specified **DataSharePredicates** ob **Return value** | Type| Description| | -------- | -------- | -| Promise<number> | Promise used to return the number of rows updated.| +| Promise<number> | Promise used to return the number of rows updated.| **Example** ```js @@ -1294,7 +1294,7 @@ promise.then((rows) => { query(predicates: RdbPredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>):void -Queries data in the database based on specified conditions. This API uses an asynchronous callback to return the result. +Queries data in the RDB store based on specified conditions. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core @@ -1324,7 +1324,7 @@ rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], function (e query(predicates: RdbPredicates, columns?: Array<string>):Promise<ResultSet> -Queries data in the database based on specified conditions. This API uses a promise to return the result. +Queries data in the RDB store based on specified conditions. This API uses a promise to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core @@ -1356,7 +1356,7 @@ Queries data in the database based on specified conditions. This API uses a prom query(predicates: DataSharePredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>):void -Queries data in the database based on specified conditions. This API uses an asynchronous callback to return the result. +Queries data in the RDB store based on specified conditions. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core @@ -1386,7 +1386,7 @@ rdbStore.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], query(predicates: DataSharePredicates, columns?: Array<string>):Promise<ResultSet> -Queries data in the database based on specified conditions. This API uses a promise to return the result. +Queries data in the RDB store based on specified conditions. This API uses a promise to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core @@ -1625,14 +1625,14 @@ try { backup(destName:string, callback: AsyncCallback<void>):void -Backs up the database with the specified name. This API uses an asynchronous callback to return the result. +Backs up an RDB store. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| destName | string | Yes| Name of the database backup file.| +| destName | string | Yes| Name of the RDB store backup file.| | callback | AsyncCallback<void> | Yes| Callback invoked to return the result.| **Example** @@ -1650,14 +1650,14 @@ rdbStore.backup("dbBackup.db", function(err) { backup(destName:string): Promise<void> -Backs up the database with the specified name. This API uses a promise to return the result. +Backs up an RDB store. This API uses a promise to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| destName | string | Yes| Name of the database backup file.| +| destName | string | Yes| Name of the RDB store backup file.| **Return value** | Type| Description| @@ -1678,14 +1678,14 @@ promiseBackup.then(()=>{ restore(srcName:string, callback: AsyncCallback<void>):void -Restores a database from a specified database backup file. This API uses an asynchronous callback to return the result. +Restores an RDB store using a backup file. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| srcName | string | Yes| Name of the database backup file.| +| srcName | string | Yes| Name of the RDB store backup file.| | callback | AsyncCallback<void> | Yes| Callback invoked to return the result.| **Example** @@ -1703,14 +1703,14 @@ rdbStore.restore("dbBackup.db", function(err) { restore(srcName:string): Promise<void> -Restores a database from a specified database backup file. This API uses a promise to return the result. +Restores an RDB store using a backup file. This API uses a promise to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| srcName | string | Yes| Name of the database backup file.| +| srcName | string | Yes| Name of the RDB store backup file.| **Return value** | Type| Description| @@ -1809,7 +1809,7 @@ rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, console.info('Failed to obtain DistributedTableName, err: ' + err) return } - console.info('Obtained DistributedTableName successfully, tableName=.' + tableName) + console.info('Obtained distributed table name successfully, tableName=.' + tableName) }) ``` @@ -1839,7 +1839,7 @@ Obtains the distributed table name for a remote device based on the local table ```js let promise = rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE") promise.then((tableName) => { - console.info('Obtained DistributedTableName successfully, tableName= ' + tableName) + console.info('Obtained distributed table name successfully, tableName= ' + tableName) }).catch((err) => { console.info('Failed to obtain DistributedTableName, err: ' + err) }) diff --git a/en/application-dev/reference/apis/js-apis-data-storage.md b/en/application-dev/reference/apis/js-apis-data-storage.md index 6cdfcf94fdf36dd3f9d4adb4e44420394120fd10..47a961f7cceb3c20de583387d9ed54d5494e5ac4 100644 --- a/en/application-dev/reference/apis/js-apis-data-storage.md +++ b/en/application-dev/reference/apis/js-apis-data-storage.md @@ -13,7 +13,7 @@ Lightweight storage provides applications with data processing capability and al ## Modules to Import ```js -import dataStorage from '@ohos.data.storage'; +import data_storage from '@ohos.data.storage'; ``` ## Constants @@ -26,7 +26,7 @@ import dataStorage from '@ohos.data.storage'; | MAX_VALUE_LENGTH | string | Yes| No| Maximum length of a value. It must be less than 8192 bytes.| -## dataStorage.getStorageSync +## data_storage.getStorageSync getStorageSync(path: string): Storage @@ -46,24 +46,17 @@ Reads the specified file and loads its data to the **Storage** instance for data **Example** ```js - import dataStorage from '@ohos.data.storage' - import featureAbility from '@ohos.ability.featureAbility' + import data_storage from '@ohos.data.storage' + + let path = '/data/storage/el2/database' + let storage = data_storage.getStorageSync(path + '/mystore') + storage.putSync('startup', 'auto') + storage.flushSync() - var context = featureAbility.getContext() - context.getFilesDir((err, path) => { - if (err) { - console.error('getFilesDir failed. err: ' + JSON.stringify(err)); - return; - } - console.info('getFilesDir successful. path:' + JSON.stringify(path)); - let storage = dataStorage.getStorageSync(path + '/mystore') - storage.putSync('startup', 'auto') - storage.flushSync() - }); ``` -## dataStorage.getStorage +## data_storage.getStorage getStorage(path: string, callback: AsyncCallback<Storage>): void @@ -79,29 +72,21 @@ Reads the specified file and loads its data to the **Storage** instance for data **Example** ```js - import dataStorage from '@ohos.data.storage' - import featureAbility from '@ohos.ability.featureAbility' + import data_storage from '@ohos.data.storage' - var context = featureAbility.getContext() - context.getFilesDir((err, path) => { + let path = '/data/storage/el2/database' + data_storage.getStorage(path + '/mystore', function (err, storage) { if (err) { - console.error('getFilesDir failed. err: ' + JSON.stringify(err)); + console.info("Failed to get the storage. Path: " + path + '/mystore') return; } - console.info('getFilesDir successful. path:' + JSON.stringify(path)); - dataStorage.getStorage(path + '/mystore', function (err, storage) { - if (err) { - console.info("Get the storage failed, path: " + path + '/mystore') - return; - } - storage.putSync('startup', 'auto') - storage.flushSync() - }) - }); + storage.putSync('startup', 'auto') + storage.flushSync() + }) ``` -## dataStorage.getStorage +## data_storage.getStorage getStorage(path: string): Promise<Storage> @@ -121,28 +106,21 @@ Reads the specified file and loads its data to the **Storage** instance for data **Example** ```js - import dataStorage from '@ohos.data.storage' - import featureAbility from '@ohos.ability.featureAbility' + import data_storage from '@ohos.data.storage' - var context = featureAbility.getContext() - context.getFilesDir((err, path) => { - if (err) { - console.info("Get the storage failed, path: " + path + '/mystore') - return; - } - console.info('getFilesDir successful. path:' + JSON.stringify(path)); - let promisegetSt = dataStorage.getStorage(path + '/mystore') - promisegetSt.then((storage) => { - storage.putSync('startup', 'auto') - storage.flushSync() - }).catch((err) => { - console.info("Get the storage failed, path: " + path + '/mystore') - }) - }); + let path = '/data/storage/el2/database' + + let getPromise = data_storage.getStorage(path + '/mystore') + getPromise.then((storage) => { + storage.putSync('startup', 'auto') + storage.flushSync() + }).catch((err) => { + console.info("Failed to get the storage. Path: " + path + '/mystore') + }) ``` -## dataStorage.deleteStorageSync +## data_storage.deleteStorageSync deleteStorageSync(path: string): void @@ -157,11 +135,12 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete **Example** ```js - dataStorage.deleteStorageSync(path + '/mystore') + let path = '/data/storage/el2/database' + data_storage.deleteStorageSync(path + '/mystore') ``` -## dataStorage.deleteStorage +## data_storage.deleteStorage deleteStorage(path: string, callback: AsyncCallback<void>): void @@ -173,11 +152,12 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | path | string | Yes| Path of the target file.| - | callback | AsyncCallback<void> | Yes| Callback used to return the execution result.| + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```js - dataStorage.deleteStorage(path + '/mystore', function (err) { + let path = '/data/storage/el2/database' + data_storage.deleteStorage(path + '/mystore', function (err) { if (err) { console.info("Deleted failed with err: " + err) return @@ -187,7 +167,7 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete ``` -## dataStorage.deleteStorage +## data_storage.deleteStorage deleteStorage(path: string): Promise<void> @@ -203,11 +183,12 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete **Return value** | Type| Description| | -------- | -------- | - | Promise<void> | Promise used to return the result.| + | Promise<void> | Promise that returns no value.| **Example** ```js - let promisedelSt = dataStorage.deleteStorage(path + '/mystore') + let path = '/data/storage/el2/database' + let promisedelSt = data_storage.deleteStorage(path + '/mystore') promisedelSt.then(() => { console.info("Deleted successfully.") }).catch((err) => { @@ -216,7 +197,7 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete ``` -## dataStorage.removeStorageFromCacheSync +## data_storage.removeStorageFromCacheSync removeStorageFromCacheSync(path: string): void @@ -231,11 +212,12 @@ Removes the singleton **Storage** instance of a file from the cache. The removed **Example** ```js - dataStorage.removeStorageFromCacheSync(path + '/mystore') + let path = '/data/storage/el2/database' + data_storage.removeStorageFromCacheSync(path + '/mystore') ``` -## dataStorage.removeStorageFromCache +## data_storage.removeStorageFromCache removeStorageFromCache(path: string, callback: AsyncCallback<void>): void @@ -247,11 +229,12 @@ Removes the singleton **Storage** instance of a file from the cache. The removed | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | path | string | Yes| Path of the target file.| - | callback | AsyncCallback<void> | Yes| Callback used to return the execution result.| + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```js - dataStorage.removeStorageFromCache(path + '/mystore', function (err) { + let path = '/data/storage/el2/database' + data_storage.removeStorageFromCache(path + '/mystore', function (err) { if (err) { console.info("Removed storage from cache failed with err: " + err) return @@ -261,7 +244,7 @@ Removes the singleton **Storage** instance of a file from the cache. The removed ``` -## dataStorage.removeStorageFromCache +## data_storage.removeStorageFromCache removeStorageFromCache(path: string): Promise<void> @@ -277,11 +260,12 @@ Removes the singleton **Storage** instance of a file from the cache. The removed **Return value** | Type| Description| | -------- | -------- | - | Promise<void> | Promise used to return the result.| + | Promise<void> | Promise that returns no value.| **Example** ```js - let promiserevSt = dataStorage.removeStorageFromCache(path + '/mystore') + let path = '/data/storage/el2/database' + let promiserevSt = data_storage.removeStorageFromCache(path + '/mystore') promiserevSt.then(() => { console.info("Removed storage from cache successfully.") }).catch((err) => { @@ -412,7 +396,7 @@ Obtains the **Storage** instance corresponding to the specified file, writes dat | -------- | -------- | -------- | -------- | | key | string | Yes| Key of the data. It cannot be empty.| | value | [ValueType](#valuetype) | Yes| New value to store. It can be a number, string, or Boolean value.| - | callback | AsyncCallback<void> | Yes| Callback used to return the execution result.| + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```js @@ -443,7 +427,7 @@ Obtains the **Storage** instance corresponding to the specified file, writes dat **Return value** | Type| Description| | -------- | -------- | - | Promise<void> | Promise used to return the result.| + | Promise<void> | Promise that returns no value.| **Example** ```js @@ -578,7 +562,7 @@ Deletes data with the specified key from this storage object. This API uses an a | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | key | string | Yes| Key of the data. It cannot be empty.| - | callback | AsyncCallback<void> | Yes| Callback used to return the execution result.| + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```js @@ -608,7 +592,7 @@ Deletes data with the specified key from this storage object. This API uses a pr **Return value** | Type| Description| | -------- | -------- | - | Promise<void> | Promise used to return the result.| + | Promise<void> | Promise that returns no value.| **Example** ```js @@ -646,7 +630,7 @@ Saves the modification of this object to the **Storage** instance and synchroniz **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<void> | Yes| Callback used to return the execution result.| + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```js @@ -671,7 +655,7 @@ Saves the modification of this object to the **Storage** instance and synchroniz **Return value** | Type| Description| | -------- | -------- | - | Promise<void> | Promise used to return the result.| + | Promise<void> | Promise that returns no value.| **Example** ```js @@ -709,7 +693,7 @@ Clears this **Storage** object. This API uses an asynchronous callback to return **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<void> | Yes| Callback used to return the execution result.| + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```js @@ -734,7 +718,7 @@ Clears this **Storage** object. This API uses a promise to return the result. **Return value** | Type| Description| | -------- | -------- | - | Promise<void> | Promise used to return the result.| + | Promise<void> | Promise that returns no value.| **Example** ```js diff --git a/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md b/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md index 2ae6d7b5a18696850e13d8d088f9a1300561742c..8d18622ce2eb432210858545308e2a607891b1f0 100644 --- a/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md +++ b/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md @@ -1,6 +1,24 @@ # Device Usage Statistics -> **NOTE**
+This module provides APIs for collecting statistics on device usage. + +System applications can call these APIs to implement the following features: + +- Query the usage duration in different time segments, events (foreground, background, start and end of continuous tasks), and the number of notifications, on a per application basis. +- Query statistics about system events (sleep, wakeup, unlock, and screen lock). +- Query the bundle group information of applications, including the invoking application itself. +- Query the idle status of applications, including the invoking application itself. +- Set the bundle group for other applications. +- Register and deregister the callback for application group changes. + +Third-party applications can call these APIs to implement the following features: + +- Query the idle status of the invoking application itself. +- Query the bundle group information of the invoking application itself. +- Query the events of the invoking application itself. + +> **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. @@ -23,7 +41,7 @@ Checks whether the application specified by **bundleName** is in the idle state. | Name | Type | Mandatory | Description | | ---------- | ---------------------------- | ---- | ---------------------------------------- | | bundleName | string | Yes | Bundle name of an application. | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. If the value of **bundleName** is valid, **null** will be returned.| +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. If the value of bundleName is valid, null will be returned.| **Example** @@ -69,7 +87,7 @@ Checks whether the application specified by **bundleName** is in the idle state. ## bundleState.queryAppUsagePriorityGroup -queryAppUsagePriorityGroup(): Promise\ +queryAppUsagePriorityGroup(): Promise<number> Queries the priority group of this application. This API uses a promise to return the result. @@ -79,7 +97,7 @@ Queries the priority group of this application. This API uses a promise to retur | Type | Description | | --------------- | --------------------------- | -| Promise\ | Promise used to return the result.| +| Promise<number> | Promise used to return the result.| **Example** @@ -93,7 +111,7 @@ bundleState.queryAppUsagePriorityGroup().then( res => { ## bundleState.queryAppUsagePriorityGroup -queryAppUsagePriorityGroup(callback: AsyncCallback\): void +queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void Queries the priority group of this application. This API uses an asynchronous callback to return the result. @@ -103,20 +121,11 @@ Queries the priority group of this application. This API uses an asynchronous ca | Name | Type | Mandatory | Description | | -------- | --------------------- | ---- | -------------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| +| callback | AsyncCallback<number> | Yes | Callback used to return the result.| **Example** ```javascript -// Callback with bundleName -bundleState.queryAppUsagePriorityGroup(this.bundleName, (err, res) => { - if(err) { - console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code); - } else { - console.log('BUNDLE_ACTIVE QueryPackageGroup callback succeeded. result: ' + JSON.stringify(res)); - } -}); -// Callback without bundleName bundleState.queryAppUsagePriorityGroup((err, res) => { if(err) { console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code); @@ -523,7 +532,7 @@ Obtains the number of FA usage records specified by **maxNum**. This API uses an ## bundleState.queryAppUsagePriorityGroup9+ -queryAppUsagePriorityGroup(bundleName? : string): Promise +queryAppUsagePriorityGroup(bundleName? : string): Promise<number> Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses a promise to return the result. @@ -543,13 +552,14 @@ Queries the priority group of the application specified by **bundleName**. If ** | Type | Description | | --------------- | --------------------------- | -| Promise\ | Promise used to return the result.| +| Promise<number> | Promise used to return the result.| **Example** ```javascript // Promise with bundleName -bundleState.queryAppUsagePriorityGroup(this.bundleName).then( res => { +let bundleName = "com.ohos.camera"; +bundleState.queryAppUsagePriorityGroup(bundleName).then( res => { console.log('BUNDLE_ACTIVE QueryPackageGroup promise succeeded. result: ' + JSON.stringify(res)); }).catch( err => { console.log('BUNDLE_ACTIVE QueryPackageGroup promise failed. because: ' + err.code); @@ -564,7 +574,7 @@ bundleState.queryAppUsagePriorityGroup().then( res => { ## bundleState.queryAppUsagePriorityGroup9+ -queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback\): void +queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback<number>): void Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses an asynchronous callback to return the result. @@ -579,13 +589,14 @@ Queries the priority group of the application specified by **bundleName**. If ** | Name | Type | Mandatory | Description | | ---------- | --------------------- | ---- | ---------------------------------------- | | bundleName | string | No | Bundle name of the target application. If this parameter is not specified, the priority group of the current application is queried.| -| callback | AsyncCallback\ | Yes | Callback used to return the result. | +| callback | AsyncCallback<number> | Yes | Callback used to return the result. | **Example** ```javascript // Callback with bundleName -bundleState.queryAppUsagePriorityGroup(this.bundleName, (err, res) => { +let bundleName = "com.ohos.camera"; +bundleState.queryAppUsagePriorityGroup(bundleName, (err, res) => { if(err) { console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code); } else { @@ -604,7 +615,7 @@ bundleState.queryAppUsagePriorityGroup((err, res) => { ## bundleState.setBundleGroup9+ -setBundleGroup(bundleName: string, newGroup: GroupType): Promise\ +setBundleGroup(bundleName: string, newGroup: GroupType): Promise<void> Sets the group for the application specified by **bundleName**. This API uses a promise to return the result. @@ -618,22 +629,22 @@ Sets the group for the application specified by **bundleName**. This API uses a | Name | Type | Mandatory | Description | | ---------- | --------- | ---- | ---- | -| bundleName | string | Yes | Bundle name of the target application.| -| newGroup | GroupType | Yes | Application group.| +| bundleName | string | Yes | Bundle name of an application.| +| newGroup | [GroupType](#grouptype) | Yes | Application group.| **Return value** | Type | Description | | ------------- | ------------------------- | -| Promise\ | Promise used to return the result.| +| Promise<void> | Promise used to return the result.| **Example** ```javascript -this.bundleName = "com.example.deviceUsageStatistics"; -this.newGroup = stats.GroupType.ACTIVE_GROUP_DAILY; +let bundleName = "com.example.deviceUsageStatistics"; +let newGroup = bundleState.GroupType.ACTIVE_GROUP_DAILY; -bundleState.setBundleGroup(this.bundleName, this.newGroup).then( () => { +bundleState.setBundleGroup(bundleName, newGroup).then( () => { console.log('BUNDLE_ACTIVE SetBundleGroup promise succeeded.'); }).catch( err => { console.log('BUNDLE_ACTIVE SetBundleGroup promise failed. because: ' + err.code); @@ -642,7 +653,7 @@ bundleState.setBundleGroup(this.bundleName, this.newGroup).then( () => { ## bundleState.setBundleGroup9+ -setBundleGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback\): void +setBundleGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback<void>): void Sets the group for the application specified by **bundleName**. This API uses an asynchronous callback to return the result. @@ -656,17 +667,17 @@ Sets the group for the application specified by **bundleName**. This API uses an | Name | Type | Mandatory | Description | | ---------- | ------------------- | ---- | ------------------------- | -| bundleName | string | Yes | Bundle name of the target application. | -| newGroup | GroupType | Yes | Application group. | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| +| bundleName | string | Yes | Bundle name of an application. | +| newGroup | [GroupType](#grouptype) | Yes | Application group. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result.| **Example** ```javascript -this.bundleName = "com.example.deviceUsageStatistics"; -this.newGroup = stats.GroupType.ACTIVE_GROUP_DAILY; +let bundleName = "com.example.deviceUsageStatistics"; +let newGroup = bundleState.GroupType.ACTIVE_GROUP_DAILY; -bundleState.setBundleGroup(this.bundleName, this.newGroup, (err) => { +bundleState.setBundleGroup(bundleName, newGroup, (err) => { if(err) { console.log('BUNDLE_ACTIVE SetBundleGroup callback failed. because: ' + err.code); } else { @@ -677,9 +688,9 @@ bundleState.setBundleGroup(this.bundleName, this.newGroup, (err) => { ## bundleState.registerGroupCallBack9+ -registerGroupCallBack(callback: Callback\): Promise\ +registerGroupCallBack(callback: Callback<BundleActiveGroupCallbackInfo>): Promise<void> -Registers a callback for application group changes. When an application group of the user changes, **BundleActiveGroupCallbackInfo** is returned to all applications that have registered the callback. This API uses a promise to return the result. +Registers a callback for application group changes. When an application group of the user changes, a **[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)** instance is returned to all applications that have registered the callback. This API uses a promise to return the result. **Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO @@ -689,26 +700,26 @@ Registers a callback for application group changes. When an application group of **Parameters** -| Name | Type | Mandatory | Description | -| -------- | --------------------------------------- | ---- | ----------- | -| callback | Callback\ | Yes | Callback for application group changes.| +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------ | +| callback | Callback<[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)> | Yes | Callback used to return the application group changes.| **Return value** | Type | Description | | ------------- | ----------------------- | -| Promise\ | Promise used to return the result.| +| Promise<void> | Promise used to return the result.| **Example** ```javascript let onBundleGroupChanged = (err,res) =>{ console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.'); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result oldGroup is : ' + res.oldGroup); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result newGroup is : ' + res.newGroup); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result changeReason is : ' + res.newGroup); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result userId is : ' + res.userId); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result bundleName is : ' + res.bundleName); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result appUsageOldGroup is : ' + res.appUsageOldGroup); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result appUsageNewGroup is : ' + res.appUsageNewGroup); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result changeReason is : ' + res.changeReason); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result userId is : ' + res.userId); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result bundleName is : ' + res.bundleName); }; bundleState.registerGroupCallBack(onBundleGroupChanged).then( () => { console.log('BUNDLE_ACTIVE RegisterGroupCallBack promise succeeded.'); @@ -719,9 +730,9 @@ bundleState.registerGroupCallBack(onBundleGroupChanged).then( () => { ## bundleState.registerGroupCallBack9+ -registerGroupCallBack(callback: Callback\, callback: AsyncCallback\): void +registerGroupCallBack(callback: Callback<BundleActiveGroupCallbackInfo>, callback: AsyncCallback<void>): void -Registers a callback for application group changes. When an application group of the user changes, **BundleActiveGroupCallbackInfo** is returned to all applications that have registered the callback. This API uses an asynchronous callback to return the result. +Registers a callback for application group changes. When an application group of the user changes, a **[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)** instance is returned to all applications that have registered the callback. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO @@ -731,21 +742,21 @@ Registers a callback for application group changes. When an application group of **Parameters** -| Name | Type | Mandatory | Description | -| -------- | --------------------------------------- | ---- | ------------- | -| callback | Callback\ | Yes | Callback for application group changes. | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | -------------------------------------------- | +| callback | Callback<[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)> | Yes | Callback used to return the application group changes. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result.| **Example** ```javascript let onBundleGroupChanged = (err,res) =>{ console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.'); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's oldGroup is : ' + res.oldGroup); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's newGroup is : ' + res.newGroup); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's changeReason is : ' + res.newGroup); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's userId is : ' + res.userId); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's bundleName is : ' + res.bundleName); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result appUsageOldGroup is : ' + res.appUsageOldGroup); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result appUsageNewGroup is : ' + res.appUsageNewGroup); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result changeReason is : ' + res.changeReason); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result userId is : ' + res.userId); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result bundleName is : ' + res.bundleName); }; bundleState.registerGroupCallBack(onBundleGroupChanged, (err)=>{ if(err) { @@ -758,7 +769,7 @@ bundleState.registerGroupCallBack(onBundleGroupChanged, (err)=>{ ## bundleState.unRegisterGroupCallBack9+ -unRegisterGroupCallBack(): Promise\ +unRegisterGroupCallBack(): Promise<void> Deregisters the callback for application group changes. This API uses a promise to return the result. @@ -774,7 +785,7 @@ Deregisters the callback for application group changes. This API uses a promise | Type | Description | | ------------- | ------------------------ | -| Promise\ | Promise used to return the result.| +| Promise<void> | Promise used to return the result.| **Example** @@ -788,7 +799,7 @@ bundleState.unRegisterGroupCallBack().then( () => { ## bundleState.unRegisterGroupCallBack9+ -unRegisterGroupCallBack(callback: AsyncCallback\): void; +unRegisterGroupCallBack(callback: AsyncCallback<void>): void; Deregisters the callback for application group changes. This API uses an asynchronous callback to return the result. @@ -802,7 +813,7 @@ Deregisters the callback for application group changes. This API uses an asynchr | Name | Type | Mandatory | Description | | -------- | ------------------- | ---- | -------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| +| callback | AsyncCallback<void> | Yes | Callback used to return the result.| **Example** @@ -870,7 +881,7 @@ Queries statistics about system events (hibernation, wakeup, unlocking, and scre | -------- | ---------------------------------------- | ---- | ---------------------------------------- | | begin | number | Yes | Start time. | | end | number | Yes | End time. | -| callback | AsyncCallback<Array<[BundleActiveEventState](#bundleactiveeventstate9)>> | Yes | Promise used to return the result.| +| callback | AsyncCallback<Array<[BundleActiveEventState](#bundleactiveeventstate9)>> | Yes | Callback used to return the result.| **Example** @@ -982,7 +993,7 @@ Provides the FA widget usage information. | Name | Type | Mandatory | Description | | ---------------- | ------ | ---- | ----------- | -| formName | number | Yes | Widget name. | +| formName | string | Yes | Widget name. | | formDimension | number | Yes | Widget dimensions. | | formId | number | Yes | Widget ID. | | formLastUsedTime | number | Yes | Last time when the widget was clicked.| @@ -992,15 +1003,15 @@ Provides the FA widget usage information. Provides the application group changes returned through a callback. -**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App +**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup -| Name | Type | Mandatory | Description | -| ---------------- | ------ | ---- | -------- | -| appUsageOldGroup | number | Yes | Application group before the change.| -| appUsageNewGroup | number | Yes | Application group after the change.| -| useId | number | Yes | User ID. | -| changeReason | number | Yes | Reason for the group change. | -| bundleName | string | Yes | Bundle name of an application. | +| Name | Type | Mandatory| Description | +| ---------------- | ------ | ---- | ---------------- | +| appUsageOldGroup | number | Yes | Application group before the change.| +| appUsageNewGroup | number | Yes | Application group after the change.| +| userId | number | Yes | User ID. | +| changeReason | number | Yes | Reason for the group change. | +| bundleName | string | Yes | Bundle name of an application. | ## BundleStateInfo @@ -1008,11 +1019,11 @@ Provides the usage duration information of applications. ### Attributes -**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup +**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App | Name | Type | Mandatory | Description | | ------------------------ | ------ | ---- | ---------------------------------------- | -| bundleName | string | Yes | Bundle name of the application. | +| bundleName | string | Yes | Bundle name of an application. | | abilityPrevAccessTime | number | Yes | Last time when the application was used. | | abilityInFgTotalTime | number | Yes | Total time that the application runs in the foreground. | | id | number | No | User ID.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| @@ -1029,8 +1040,6 @@ merge(toMerge: BundleStateInfo): void Merges the application usage information that has the same bundle name. -This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. - **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App **Parameters** @@ -1047,7 +1056,7 @@ Provides information about an application event. | Name | Type | Mandatory | Description | | --------------------- | ------ | ---- | ---------------------------------------- | -| bundleName | string | Yes | Bundle name of the application. | +| bundleName | string | Yes | Bundle name of an application. | | stateType | number | Yes | Application event type. | | stateOccurredTime | number | Yes | Timestamp when the application event occurs. | | appUsagePriorityGroup | number | No | Usage priority group of the application.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| @@ -1092,7 +1101,7 @@ Enumerates the interval types for querying the application usage duration. | BY_MONTHLY | 3 | The system obtains the application usage duration statistics in the specified time frame on a monthly basis. | | BY_ANNUALLY | 4 | The system obtains the application usage duration statistics in the specified time frame on an annual basis. | -## GroupType +## GroupType9+ Enumerates the application group types. diff --git a/en/application-dev/reference/apis/js-apis-display.md b/en/application-dev/reference/apis/js-apis-display.md index ffbc73ff530a4d8f9ec39fd6e824760df9448644..25cf9ed242f66a0983303065dcea527989444223 100644 --- a/en/application-dev/reference/apis/js-apis-display.md +++ b/en/application-dev/reference/apis/js-apis-display.md @@ -1,5 +1,5 @@ # Display -Provides APIs for managing displays, such as obtaining information about the default display, obtaining information about all displays, and listening for the addition and removal of displays. +The **Display** module provides APIs for managing displays, such as obtaining information about the default display, obtaining information about all displays, and listening for the addition and removal of displays. > **NOTE** > @@ -14,11 +14,11 @@ import display from '@ohos.display'; ## DisplayState -Provides the state of a display. +Enumerates the display states. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name| Default Value| Description| +| Name| Value| Description| | -------- | -------- | -------- | | STATE_UNKNOWN | 0 | Unknown.| | STATE_OFF | 1 | The display is shut down.| @@ -56,7 +56,7 @@ Describes the attributes of a display. getDefaultDisplay(callback: AsyncCallback<Display>): void -Obtains the default display object. +Obtains the default display object. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.WindowManager.WindowManager.Core @@ -82,7 +82,7 @@ Obtains the default display object. getDefaultDisplay(): Promise<Display> -Obtains the default display object. +Obtains the default display object. This API uses a promise to return the result. **System capability**: SystemCapability.WindowManager.WindowManager.Core @@ -103,11 +103,31 @@ Obtains the default display object. }); ``` +## display.getDefaultDisplaySync9+ + +getDefaultDisplaySync(): Display + +Obtains the default display object. This API returns the result synchronously. + +**System capability**: SystemCapability.WindowManager.WindowManager.Core + +**Return value** + +| Type | Description | +| ------------------------------| ----------------------------------------------| +| [Display](#display) | Default display object.| + +**Example** + +```js +var displayClass = display.getDefaultDisplaySync(); +``` + ## display.getAllDisplay getAllDisplay(callback: AsyncCallback<Array<Display>>): void -Obtains all the display objects. +Obtains all display objects. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.WindowManager.WindowManager.Core @@ -133,7 +153,7 @@ Obtains all the display objects. getAllDisplay(): Promise<Array<Display>> -Obtains all the display objects. +Obtains all display objects. This API uses a promise to return the result. **System capability**: SystemCapability.WindowManager.WindowManager.Core @@ -158,15 +178,15 @@ Obtains all the display objects. on(type: 'add'|'remove'|'change', callback: Callback<number>): void -Enables listening. +Subscribes to display changes. **System capability**: SystemCapability.WindowManager.WindowManager.Core **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Listening type. The available values are as follows:
- **add**: listening for whether a display is added
- **remove**: listening for whether a display is removed
- **change**: listening for whether a display is changed| - | callback | Callback<number> | Yes| Callback used to return the ID of the display.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type.
- **add**, indicating the display addition event.
- **remove**, indicating the display removal event.
- **change**, indicating the display change event.| +| callback | Callback<number> | Yes| Callback used to return the ID of the display.| **Example** ```js @@ -181,14 +201,14 @@ Enables listening. off(type: 'add'|'remove'|'change', callback?: Callback<number>): void -Disables listening. +Unsubscribes from display changes. **System capability**: SystemCapability.WindowManager.WindowManager.Core **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes| Listening type. The available values are as follows:
- **add**: listening for whether a display is added
- **remove**: listening for whether a display is removed
- **change**: listening for whether a display is changed| + | type | string | Yes| Event type.
- **add**, indicating the display addition event.
- **remove**, indicating the display removal event.
- **change**, indicating the display change event.| | callback | Callback<number> | No| Callback used to return the ID of the display.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-distributed-account.md b/en/application-dev/reference/apis/js-apis-distributed-account.md index bc64da83d9a829da97b02be79a94804df498a670..dc674978d2c4b9491e860b13f1720787380cc53e 100644 --- a/en/application-dev/reference/apis/js-apis-distributed-account.md +++ b/en/application-dev/reference/apis/js-apis-distributed-account.md @@ -2,7 +2,7 @@ The distributedAccount module provides basic functions for managing distributed accounts, including querying and updating account login status. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> **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. diff --git a/en/application-dev/reference/apis/js-apis-distributed-data.md b/en/application-dev/reference/apis/js-apis-distributed-data.md index 623fecb4584f2cc7a61808d3af5c13f6d4e81520..bad85aee529e6f5b2bff68cd79fd4172c53e7969 100644 --- a/en/application-dev/reference/apis/js-apis-distributed-data.md +++ b/en/application-dev/reference/apis/js-apis-distributed-data.md @@ -489,7 +489,7 @@ Obtains the IDs of all KV stores that are created by [getKVStore()](#getkvstore) let kvManager; try { console.log('GetAllKVStoreId'); - kvManager.getAllKVStoreId('apppId').then((data) => { + kvManager.getAllKVStoreId('appId').then((data) => { console.log('getAllKVStoreId success'); console.log('size = ' + data.length); }).catch((err) => { @@ -569,17 +569,16 @@ try { Provides KV store configuration. -**System capability**: SystemCapability.DistributedDataManager.KVStore.Core | Name | Type| Mandatory | Description | | ----- | ------ | ---- | ----------------------- | -| createIfMissing | boolean | No| Whether to create a KV store if no database file exists. By default, a KV store is created. | -| encrypt | boolean | No|Whether to encrypt database files. By default, database files are not encrypted. | -| backup | boolean | No|Whether to back up database files. By default, database files are backed up. | -| autoSync | boolean | No|Whether database files are automatically synchronized. By default, database files are not automatically synchronized.
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC | -| kvStoreType | [KVStoreType](#kvstoretype) | No|Type of the KV store to create. By default, a device KV store is created. The device KV store stores data for multiple devices that collaborate with each other.| -| securityLevel | [SecurityLevel](#securitylevel) | No|Security level of the KV store. By default, the security level is not set. | -| schema8+ | [Schema](#schema8) | No| Schema used to define the values stored in a KV store.| +| createIfMissing | boolean | No| Whether to create a KV store if no database file exists. By default, a KV store is created.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core | +| encrypt | boolean | No|Whether to encrypt database files. By default, database files are not encrypted.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core | +| backup | boolean | No|Whether to back up database files. By default, database files are backed up.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core | +| autoSync | boolean | No|Whether database files are automatically synchronized. By default, database files are not automatically synchronized.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC | +| kvStoreType | [KVStoreType](#kvstoretype) | No|Type of the KV store to create. By default, a device KV store is created. The device KV store stores data for multiple devices that collaborate with each other.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core| +| securityLevel | [SecurityLevel](#securitylevel) | No|Security level of the KV store. By default, the security level is not set.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core | +| schema8+ | [Schema](#schema8) | No| Schema used to define the values stored in a KV store.
**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore| ## KVStoreType @@ -776,7 +775,7 @@ let kvStore; try { let resultSet; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('getResultSet succeeed.'); + console.log('getResultSet succeeded.'); resultSet = result; }).catch((err) => { console.log('getResultSet failed: ' + err); @@ -1829,10 +1828,12 @@ Creates a **Query** object to specify the number of results and where to start. **Example** ```js +let total = 10; +let offset = 1; try { let query = new distributedData.Query(); query.notEqualTo("field", "value"); - query.limit("total", "offset"); + query.limit(total, offset); console.log("query is " + query.getSqlLike()); query = null; } catch (e) { @@ -2452,10 +2453,10 @@ try { console.log('entries: ' + JSON.stringify(entries)); kvStore.putBatch(entries, async function (err,data) { console.log('putBatch success'); - kvStore.getEntries('batch_test_string_key', function (err,entrys) { + kvStore.getEntries('batch_test_string_key', function (err,entries) { console.log('getEntries success'); - console.log('entrys.length: ' + entrys.length); - console.log('entrys[0]: ' + JSON.stringify(entrys[0])); + console.log('entries.length: ' + entries.length); + console.log('entries[0]: ' + JSON.stringify(entries[0])); }); }); }catch(e) { @@ -2504,7 +2505,7 @@ try { console.log('entries: ' + JSON.stringify(entries)); kvStore.putBatch(entries).then(async (err) => { console.log('putBatch success'); - kvStore.getEntries('batch_test_string_key').then((entrys) => { + kvStore.getEntries('batch_test_string_key').then((entries) => { console.log('getEntries success'); console.log('PutBatch ' + JSON.stringify(entries)); }).catch((err) => { @@ -2521,7 +2522,7 @@ try { ### putBatch9+ putBatch(value: Array<ValuesBucket>, callback: AsyncCallback<void>): void - + Writes values to this KV store. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.DistributedDataManager.KVStore.Core @@ -3244,10 +3245,10 @@ try { } kvStore.putBatch(entries, async function (err,data) { console.log('putBatch success'); - kvStore.getEntries('batch_test_number_key', function (err,entrys) { + kvStore.getEntries('batch_test_number_key', function (err,entries) { console.log('getEntries success'); - console.log('entrys.length: ' + entrys.length); - console.log('entrys[0]: ' + JSON.stringify(entrys[0])); + console.log('entries.length: ' + entries.length); + console.log('entries[0]: ' + JSON.stringify(entries[0])); }); }); }catch(e) { @@ -3296,12 +3297,12 @@ try { console.log('entries: ' + entries); kvStore.putBatch(entries).then(async (err) => { console.log('putBatch success'); - kvStore.getEntries('batch_test_string_key').then((entrys) => { + kvStore.getEntries('batch_test_string_key').then((entries) => { console.log('getEntries success'); - console.log('entrys.length: ' + entrys.length); - console.log('entrys[0]: ' + JSON.stringify(entrys[0])); - console.log('entrys[0].value: ' + JSON.stringify(entrys[0].value)); - console.log('entrys[0].value.value: ' + entrys[0].value.value); + console.log('entries.length: ' + entries.length); + console.log('entries[0]: ' + JSON.stringify(entries[0])); + console.log('entries[0].value: ' + JSON.stringify(entries[0].value)); + console.log('entries[0].value.value: ' + entries[0].value.value); }).catch((err) => { console.log('getEntries fail ' + JSON.stringify(err)); }); @@ -3352,10 +3353,10 @@ try { console.log('putBatch success'); const query = new distributedData.Query(); query.prefixKey("batch_test"); - kvStore.getEntries(query, function (err,entrys) { + kvStore.getEntries(query, function (err,entries) { console.log('getEntries success'); - console.log('entrys.length: ' + entrys.length); - console.log('entrys[0]: ' + JSON.stringify(entrys[0])); + console.log('entries.length: ' + entries.length); + console.log('entries[0]: ' + JSON.stringify(entries[0])); }); }); console.log('GetEntries success'); @@ -3408,7 +3409,7 @@ try { console.log('putBatch success'); const query = new distributedData.Query(); query.prefixKey("batch_test"); - kvStore.getEntries(query).then((entrys) => { + kvStore.getEntries(query).then((entries) => { console.log('getEntries success'); }).catch((err) => { console.log('getEntries fail ' + JSON.stringify(err)); @@ -3649,7 +3650,7 @@ Obtains a **KvStoreResultSet** object that matches the specified **Predicates** | Name | Type| Mandatory | Description | | ----- | ------ | ---- | ----------------------- | | predicates | Predicates | Yes |**Predicates** object to match. If this parameter is **null**, define the processing logic. | -| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultsetsup8sup)> | Yes |Callback invoked to return the **KvStoreResultSet** object obtained.| +| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes |Callback invoked to return the **KvStoreResultSet** object obtained.| **Example** @@ -4133,7 +4134,7 @@ Synchronizes the KV store manually. This API uses a synchronous mode. For detail | ----- | ------ | ---- | ----------------------- | | deviceIds |string[] | Yes |List of IDs of the devices in the same networking environment to be synchronized. | | mode |[SyncMode](#syncmode) | Yes |Synchronization mode. | -| query |[Query](#querysup8sup) | Yes |**Query** object to match. | +| query |[Query](#query8) | Yes |**Query** object to match. | | delayMs |number | No |Allowed synchronization delay time, in ms. | **Example** @@ -4251,7 +4252,7 @@ try { console.log('getSecurityLevel success'); }); }catch(e) { - console.log('GetSecurityLeve e ' + e); + console.log('GetSecurityLevel e ' + e); } ``` @@ -4281,7 +4282,7 @@ try { console.log('getSecurityLevel fail ' + JSON.stringify(err)); }); }catch(e) { - console.log('GetSecurityLeve e ' + e); + console.log('GetSecurityLevel e ' + e); } ``` @@ -4411,10 +4412,10 @@ try { console.log('entries: ' + entries); kvStore.putBatch(entries, async function (err,data) { console.log('putBatch success'); - kvStore.getEntries('localDeviceId', 'batch_test_string_key', function (err,entrys) { + kvStore.getEntries('localDeviceId', 'batch_test_string_key', function (err,entries) { console.log('getEntries success'); - console.log('entrys.length: ' + entrys.length); - console.log('entrys[0]: ' + JSON.stringify(entrys[0])); + console.log('entries.length: ' + entries.length); + console.log('entries[0]: ' + JSON.stringify(entries[0])); }); }); }catch(e) { @@ -4464,12 +4465,12 @@ try { console.log('entries: ' + entries); kvStore.putBatch(entries).then(async (err) => { console.log('putBatch success'); - kvStore.getEntries('localDeviceId', 'batch_test_string_key').then((entrys) => { + kvStore.getEntries('localDeviceId', 'batch_test_string_key').then((entries) => { console.log('getEntries success'); - console.log('entrys.length: ' + entrys.length); - console.log('entrys[0]: ' + JSON.stringify(entrys[0])); - console.log('entrys[0].value: ' + JSON.stringify(entrys[0].value)); - console.log('entrys[0].value.value: ' + entrys[0].value.value); + console.log('entries.length: ' + entries.length); + console.log('entries[0]: ' + JSON.stringify(entries[0])); + console.log('entries[0].value: ' + JSON.stringify(entries[0].value)); + console.log('entries[0].value.value: ' + entries[0].value.value); }).catch((err) => { console.log('getEntries fail ' + JSON.stringify(err)); }); @@ -4521,10 +4522,10 @@ try { const query = new distributedData.Query(); query.prefixKey("batch_test"); query.deviceId('localDeviceId'); - kvStore.getEntries(query, function (err,entrys) { + kvStore.getEntries(query, function (err,entries) { console.log('getEntries success'); - console.log('entrys.length: ' + entrys.length); - console.log('entrys[0]: ' + JSON.stringify(entrys[0])); + console.log('entries.length: ' + entries.length); + console.log('entries[0]: ' + JSON.stringify(entries[0])); }); }); console.log('GetEntries success'); @@ -4577,7 +4578,7 @@ try { console.log('putBatch success'); const query = new distributedData.Query(); query.prefixKey("batch_test"); - kvStore.getEntries(query).then((entrys) => { + kvStore.getEntries(query).then((entries) => { console.log('getEntries success'); }).catch((err) => { console.log('getEntries fail ' + JSON.stringify(err)); @@ -4632,10 +4633,10 @@ try { var query = new distributedData.Query(); query.deviceId('localDeviceId'); query.prefixKey("batch_test"); - kvStore.getEntries('localDeviceId', query, function (err,entrys) { + kvStore.getEntries('localDeviceId', query, function (err,entries) { console.log('getEntries success'); - console.log('entrys.length: ' + entrys.length); - console.log('entrys[0]: ' + JSON.stringify(entrys[0])); + console.log('entries.length: ' + entries.length); + console.log('entries[0]: ' + JSON.stringify(entries[0])); }) }); console.log('GetEntries success'); @@ -4690,7 +4691,7 @@ try { var query = new distributedData.Query(); query.deviceId('localDeviceId'); query.prefixKey("batch_test"); - kvStore.getEntries('localDeviceId', query).then((entrys) => { + kvStore.getEntries('localDeviceId', query).then((entries) => { console.log('getEntries success'); }).catch((err) => { console.log('getEntries fail ' + JSON.stringify(err)); diff --git a/en/application-dev/reference/apis/js-apis-document.md b/en/application-dev/reference/apis/js-apis-document.md index 458685119e17635f1b5af60e27910808bf8f99d6..3fbdc4f46c5e28f74743575a12f23fc138350f58 100644 --- a/en/application-dev/reference/apis/js-apis-document.md +++ b/en/application-dev/reference/apis/js-apis-document.md @@ -14,21 +14,21 @@ import document from '@ohos.document'; choose(types? : string[]): Promise<string> -Chooses a file of the specified type using the file manager. This API uses a promise to return the result. +Chooses files of the specified types using the file manager. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.UserFileService **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ------ | ---- | ---------------------------- | - | types | string[] | No | Type of the file to choose.| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ---------------------------- | +| types | string[] | No | Types of the files to choose. | **Return value** - | Type | Description | - | --------------------- | -------------- | - | Promise<string> | Promise used to return the result. An error code is returned.| +| Type | Description | +| --------------------- | -------------- | +| Promise<string> | Promise used to return the result. An error code is returned.| **Example** @@ -46,9 +46,9 @@ Chooses a file using the file manager. This API uses an asynchronous callback to **Parameters** - | Name | Type | Mandatory| Description | - | -------- | --------------------------- | ---- | ---------------------------- | - | callback | AsyncCallback<string> | Yes | Callback used to return the result. An error code is returned.| +| Name | Type | Mandatory| Description | +| -------- | --------------------------- | ---- | ---------------------------- | +| callback | AsyncCallback<string> | Yes | Callback used to return the result. An error code is returned.| **Example** @@ -62,16 +62,16 @@ Chooses a file using the file manager. This API uses an asynchronous callback to choose(types:string[], callback:AsyncCallback<string>): void -Chooses a file using the file manager. This API uses an asynchronous callback to return the result. +Chooses files using the file manager. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.UserFileService **Parameters** - | Name | Type | Mandatory| Description | - | -------- | --------------------------- | ---- | ---------------------------- | - | types | string[] | No | Type of the file to choose.| - | callback | AsyncCallback<string> | Yes | Callback used to return the result. An error code is returned.| +| Name | Type | Mandatory| Description | +| -------- | --------------------------- | ---- | ---------------------------- | +| types | string[] | No | Types of the files to choose.| +| callback | AsyncCallback<string> | Yes | Callback used to return the result. An error code is returned.| **Example** @@ -93,16 +93,16 @@ Opens a file. This API uses a promise to return the result. **Parameters** - | Name| Type | Mandatory| Description | - | ---- | ------ | ---- | ---------------------------- | - | uri | string | Yes | URI of the file to open.| - | type | string | Yes | Type of the file to open.| +| Name| Type | Mandatory| Description | +| ---- | ------ | ---- | ---------------------------- | +| uri | string | Yes | URI of the file to open.| +| type | string | Yes | Type of the file to open.| **Return value** - | Type | Description | - | --------------------- | ------------ | - | Promise<void> | Promise used to return the result. An error code is returned.| +| Type | Description | +| --------------------- | ------------ | +| Promise<void> | Promise used to return the result. An error code is returned.| **Example** @@ -122,11 +122,11 @@ Opens a file. This API uses an asynchronous callback to return the result. **Parameters** - | Name | Type | Mandatory| Description | - | -------- | --------------------------- | ---- | ---------------------------- | - | uri | string | Yes | URI of the file to open.| - | type | string | Yes | Type of the file to open.| - | callback | AsyncCallback<void> | Yes | Callback used to return the result. An error code is returned. | +| Name | Type | Mandatory| Description | +| -------- | --------------------------- | ---- | ---------------------------- | +| uri | string | Yes | URI of the file to open.| +| type | string | Yes | Type of the file to open.| +| callback | AsyncCallback<void> | Yes | Callback used to return the result. An error code is returned. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-fileio.md b/en/application-dev/reference/apis/js-apis-fileio.md index 32d72d71a73a19ca876932c518b9d76097e8423c..6e970785345a27be2c2c4d1051f87c13c4d8533f 100644 --- a/en/application-dev/reference/apis/js-apis-fileio.md +++ b/en/application-dev/reference/apis/js-apis-fileio.md @@ -1,9 +1,10 @@ -File Management +# File Management + +The fileio module provides APIs for file storage and management, including basic file management, directory management, file information statistics, and stream read and write. > **NOTE**
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. -Provides file storage and management capabilities, including basic file management, file directory management, file information statistics, and stream read and write. ## Modules to Import @@ -15,6 +16,7 @@ import fileio from '@ohos.fileio'; ## Guidelines Before using the APIs provided by this module to perform operations on files or directories, obtain the path of the application sandbox as follows: + ```js import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); @@ -46,6 +48,7 @@ Obtains file information. This API uses a promise to return the result. | Promise<[Stat](#stat)> | Promise used to return the file information obtained.| **Example** + ```js fileio.stat(path).then(function(stat){ console.info("Got file info:"+ JSON.stringify(stat)); @@ -64,12 +67,14 @@ Obtains file information. This API uses an asynchronous callback to return the r **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | ---------------------------------- | ---- | ------------------------------ | | path | string | Yes | Application sandbox path of the file. | | callback | AsyncCallback<[Stat](#stat)> | Yes | Callback invoked to return the file information obtained.| **Example** + ```js fileio.stat(path, function (err, stat) { // Example code in Stat @@ -86,17 +91,20 @@ Synchronously obtains file information. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------- | | path | string | Yes | Application sandbox path of the file.| **Return value** + | Type | Description | | ------------- | ---------- | | [Stat](#stat) | File information obtained.| **Example** + ```js let stat = fileio.statSync(path); // Example code in Stat @@ -112,16 +120,19 @@ Opens a file directory. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------ | | path | string | Yes | Application sandbox path of the directory to open.| **Return value** + | Type | Description | | -------------------------- | -------- | | Promise<[Dir](#dir)> | Promise used to return the **Dir** object.| **Example** + ```js fileio.opendir(path).then(function(dir){ console.info("Directory opened:"+ JSON.stringify(dir)); @@ -147,6 +158,7 @@ Opens a file directory. This API uses an asynchronous callback to return the res | callback | AsyncCallback<[Dir](#dir)> | Yes | Callback invoked when the directory is open asynchronously. | **Example** + ```js fileio.opendir(path, function (err, dir) { // Example code in Dir struct @@ -171,11 +183,13 @@ Synchronously opens a directory. | path | string | Yes | Application sandbox path of the directory to open.| **Return value** + | Type | Description | | ----------- | -------- | | [Dir](#dir) | A **Dir** instance corresponding to the directory.| **Example** + ```js let dir = fileio.opendirSync(path); // Example code in Dir struct @@ -199,11 +213,13 @@ Checks whether the current process can access a file. This API uses a promise to | mode | number | No | Options for accessing the file. You can specify multiple options, separated with a bitwise OR operator (|). The default value is **0**.
The options are as follows:
- **0**: check whether the file exists.
- **1**: check whether the current process has the execute permission on the file.
- **2**: check whether the current process has the write permission on the file.
- **4**: check whether the current process has the read permission on the file.| **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js fileio.access(path).then(function() { console.info("Access successful"); @@ -222,6 +238,7 @@ Checks whether the current process can access a file. This API uses an asynchron **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the file. | @@ -229,6 +246,7 @@ Checks whether the current process can access a file. This API uses an asynchron | callback | AsyncCallback<void> | Yes | Callback invoked when the file is asynchronously checked. | **Example** + ```js fileio.access(path, function (err) { // Do something. @@ -245,12 +263,14 @@ Synchronously checks whether the current process can access the specified file. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the file. | | mode | number | No | Options for accessing the file. You can specify multiple options, separated with a bitwise OR operator (|). The default value is **0**.
The options are as follows:
- **0**: check whether the file exists.
- **1**: check whether the current process has the execute permission on the file.
- **2**: check whether the current process has the write permission on the file.
- **4**: check whether the current process has the read permission on the file.| **Example** + ```js try { fileio.accessSync(path); @@ -269,16 +289,19 @@ Closes a file. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ------------ | | fd | number | Yes | File descriptor of the file to close.| **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js let fd = fileio.openSync(path); fileio.close(fd).then(function(){ @@ -298,12 +321,14 @@ Closes a file. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | ------------ | | fd | number | Yes | File descriptor of the file to close.| | callback | AsyncCallback<void> | Yes | Callback invoked when the file is closed asynchronously.| **Example** + ```js let fd = fileio.openSync(path); fileio.close(fd, function (err) { @@ -321,57 +346,16 @@ Synchronously closes a file. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ------------ | | fd | number | Yes | File descriptor of the file to close.| **Example** - ```js - fileio.closeSync(fd); - ``` - - -## fileio.close7+ - -close(): Promise<void> - -Closes the stream. This API uses a promise to return the result. - -**System capability**: SystemCapability.FileManagement.File.FileIO -**Return value** - | Type | Description | - | ------------------- | ---------------------------- | - | Promise<void> | Promise that returns no value.| - -**Example** ```js - fileio.close().then(function(){ - console.info("File stream closed"); - }).catch(function(err){ - console.info("Failed to close the file stream. Error:"+ err); - }); - ``` - - -## fileio.close7+ - -close(callback: AsyncCallback<void>): void - -Closes the stream. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.FileManagement.File.FileIO - -**Parameters** - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | ---- | ------------- | - | callback | AsyncCallback<void> | Yes | Callback invoked when the stream is closed asynchronously.| - -**Example** - ```js - fileio.close(function(err){ - // Do something. - }); + let fd = fileio.openSync(path); + fileio.closeSync(fd); ``` @@ -384,6 +368,7 @@ Copies a file. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | -------------------------- | ---- | ---------------------------------------- | | src | string \| number | Yes | Path or file descriptor of the file to copy. | @@ -391,12 +376,16 @@ Copies a file. This API uses a promise to return the result. | mode | number | No | Option for overwriting the file of the same name in the destination path. The default value is **0**, which is the only value supported.
**0**: Completely overwrite the file with the same name and truncate the part that is not overwritten.| **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js + let src = path; + let dest = src + 'tgt'; fileio.copyFile(src, dest).then(function(){ console.info("File copied"); }).catch(function(err){ @@ -414,6 +403,7 @@ Copies a file. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | -------------------------- | ---- | ---------------------------------------- | | src | string \| number | Yes | Path or file descriptor of the file to copy. | @@ -422,7 +412,10 @@ Copies a file. This API uses an asynchronous callback to return the result. | callback | AsyncCallback<void> | Yes | Callback invoked when the file is copied asynchronously. | **Example** + ```js + let src = path; + let dest = src + 'tgt'; fileio.copyFile(src, dest, function (err) { // Do something. }); @@ -438,6 +431,7 @@ Synchronously copies a file. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | -------------------------- | ---- | ---------------------------------------- | | src | string \| number | Yes | Path or file descriptor of the file to copy. | @@ -445,7 +439,10 @@ Synchronously copies a file. | mode | number | No | Option for overwriting the file of the same name in the destination path. The default value is **0**, which is the only value supported.
**0**: Completely overwrite the file with the same name and truncate the part that is not overwritten.| **Example** + ```js + let src = path; + let dest = src + 'tgt'; fileio.copyFileSync(src, dest); ``` @@ -459,17 +456,20 @@ Creates a directory. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the directory. | | mode | number | No | Permission on the directory to create. You can specify multiple permissions, separated using a bitwise OR operator (|). The default value is **0o775**.
- **0o775**: The owner has the read, write, and execute permissions, and other users have the read and execute permissions.
- **0o700**: The owner has the read, write, and execute permissions.
-  **0o400**: The owner has the read permission.
- **0o200**: The owner has the write permission.
- **0o100**: The owner has the execute permission.
- **0o070**: The user group has the read, write, and execute permissions.
- **0o040**: The user group has the read permission.
- **0o020**: The user group has the write permission.
- **0o010**: The user group has the execute permission.
- **0o007**: Other users have the read, write, and execute permissions.
- **0o004**: Other users have the read permission.
- **0o002**: Other users have the write permission.
- **0o001**: Other users have the execute permission.| **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js fileio.mkdir(path).then(function() { console.info("Directory created"); @@ -488,6 +488,7 @@ Creates a directory. This API uses an asynchronous callback to return the result **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the directory. | @@ -495,6 +496,7 @@ Creates a directory. This API uses an asynchronous callback to return the result | callback | AsyncCallback<void> | Yes | Callback invoked when the directory is created asynchronously. | **Example** + ```js fileio.mkdir(path, function(err) { console.info("Directory created"); @@ -511,12 +513,14 @@ Synchronously creates a directory. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the directory. | | mode | number | No | Permission on the directory to create. You can specify multiple permissions, separated using a bitwise OR operator (|). The default value is **0o775**.
- **0o775**: The owner has the read, write, and execute permissions, and other users have the read and execute permissions.
- **0o700**: The owner has the read, write, and execute permissions.
-  **0o400**: The owner has the read permission.
- **0o200**: The owner has the write permission.
- **0o100**: The owner has the execute permission.
- **0o070**: The user group has the read, write, and execute permissions.
- **0o040**: The user group has the read permission.
- **0o020**: The user group has the write permission.
- **0o010**: The user group has the execute permission.
- **0o007**: Other users have the read, write, and execute permissions.
- **0o004**: Other users have the read permission.
- **0o002**: Other users have the write permission.
- **0o001**: Other users have the execute permission.| **Example** + ```js fileio.mkdirSync(path); ``` @@ -531,6 +535,7 @@ Opens a file. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the file. | @@ -538,11 +543,13 @@ Opens a file. This API uses a promise to return the result. | mode | number | No | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (|). The default value is **0o666**.
- **0o666**: The owner, user group, and other users have the read and write permissions on the file.
- **0o700**: The owner has the read, write, and execute permissions.
-  **0o400**: The owner has the read permission.
- **0o200**: The owner has the write permission.
- **0o100**: The owner has the execute permission.
- **0o070**: The user group has the read, write, and execute permissions.
- **0o040**: The user group has the read permission.
- **0o020**: The user group has the write permission.
- **0o010**: The user group has the execute permission.
- **0o007**: Other users have the read, write, and execute permissions.
- **0o004**: Other users have the read permission.
- **0o002**: Other users have the write permission.
- **0o001**: Other users have the execute permission.| **Return value** + | Type | Description | | --------------------- | ----------- | | Promise<number> | Promise used to return the file descriptor of the file opened.| **Example** + ```js fileio.open(path, 0o1, 0o0200).then(function(number){ console.info("File opened"); @@ -561,6 +568,7 @@ Opens a file. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the file. | @@ -569,6 +577,7 @@ Opens a file. This API uses an asynchronous callback to return the result. | callback | AsyncCallback <void> | Yes | Callback invoked when the file is open asynchronously. | **Example** + ```js fileio.open(path, 0, function(err, fd) { // Do something. @@ -585,6 +594,7 @@ Synchronously opens a file. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the file. | @@ -592,11 +602,13 @@ Synchronously opens a file. | mode | number | No | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (|). The default value is **0o666**.
- **0o666**: The owner, user group, and other users have the read and write permissions on the file.
- **0o640**: The owner has the read and write permissions, and the user group has the read permission.
- **0o700**: The owner has the read, write, and execute permissions.
-  **0o400**: The owner has the read permission.
- **0o200**: The owner has the write permission.
- **0o100**: The owner has the execute permission.
- **0o070**: The user group has the read, write, and execute permissions.
- **0o040**: The user group has the read permission.
- **0o020**: The user group has the write permission.
- **0o010**: The user group has the execute permission.
- **0o007**: Other users have the read, write, and execute permissions.
- **0o004**: Other users have the read permission.
- **0o002**: Other users have the write permission.
- **0o001**: Other users have the execute permission.
The file permissions on newly created files are affected by umask, which is set as the process starts. Currently, the modification of umask is not open.| **Return value** + | Type | Description | | ------ | ----------- | | number | File descriptor of the file opened.| **Example** + ```js let fd = fileio.openSync(path, 0o102, 0o640); ``` @@ -623,6 +635,7 @@ Reads data from a file. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | ------- | ----------- | ---- | ------------------------------------------------------------ | | fd | number | Yes | File descriptor of the file to read. | @@ -636,6 +649,7 @@ Reads data from a file. This API uses a promise to return the result. | Promise<[ReadOut](#readout)> | Promise used to return the data read.| **Example** + ```js let fd = fileio.openSync(path, 0o2); let buf = new ArrayBuffer(4096); @@ -661,6 +675,7 @@ Reads data from a file. This API uses an asynchronous callback to return the res **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | ---------------------------------------- | | fd | number | Yes | File descriptor of the file to read. | @@ -669,6 +684,7 @@ Reads data from a file. This API uses an asynchronous callback to return the res | callback | AsyncCallback<[ReadOut](#readout)> | Yes | Callback invoked when the data is read asynchronously. | **Example** + ```js let fd = fileio.openSync(path, 0o2); let buf = new ArrayBuffer(4096); @@ -694,6 +710,7 @@ Synchronously reads data from a file. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ------- | ----------- | ---- | ---------------------------------------- | | fd | number | Yes | File descriptor of the file to read. | @@ -701,11 +718,13 @@ Synchronously reads data from a file. | options | Object | No | The options are as follows:
- **offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.
- **length** (number): length of the data to read. The default value is the buffer length minus the offset.
- **position** (number): position of the data to read in the file. By default, data is read from the current position.
Constraints: offset + length <= Buffer size | **Return value** + | Type | Description | | ------ | -------- | | number | Length of the data read.| **Example** + ```js let fd = fileio.openSync(path, 0o2); let buf = new ArrayBuffer(4096); @@ -722,16 +741,19 @@ Deletes a directory. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------- | | path | string | Yes | Application sandbox path of the directory.| **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js fileio.rmdir(path).then(function() { console.info("Directory deleted"); @@ -750,12 +772,14 @@ Deletes a directory. This API uses an asynchronous callback to return the result **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | -------------------------- | | path | string | Yes | Application sandbox path of the directory.| | callback | AsyncCallback<void> | Yes | Callback invoked when the directory is deleted asynchronously. | **Example** + ```js fileio.rmdir(path, function(err){ // Do something. @@ -773,11 +797,13 @@ Synchronously deletes a directory. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------- | | path | string | Yes | Application sandbox path of the directory.| **Example** + ```js fileio.rmdirSync(path); ``` @@ -792,16 +818,19 @@ Deletes a file. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------- | | path | string | Yes | Application sandbox path of the file.| **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js fileio.unlink(path).then(function(){ console.info("File deleted"); @@ -820,12 +849,14 @@ Deletes a file. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | -------------------------- | | path | string | Yes | Application sandbox path of the file.| | callback | AsyncCallback<void> | Yes | Callback invoked when the file is deleted asynchronously. | **Example** + ```js fileio.unlink(path, function(err) { console.info("File deleted"); @@ -842,11 +873,13 @@ Synchronously deletes a file. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------- | | path | string | Yes | Application sandbox path of the file.| **Example** + ```js fileio.unlinkSync(path); ``` @@ -866,6 +899,7 @@ Writes data into a file. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ------- | ------------------------------- | ---- | ---------------------------------------- | | fd | number | Yes | File descriptor of the file to write. | @@ -873,15 +907,17 @@ Writes data into a file. This API uses a promise to return the result. | options | Object | No | The options are as follows:
- **offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.
- **length** (number): length of the data to write. The default value is the buffer length minus the offset.
- **position** (number): start position to write the data in the file. By default, data is written from the current position.
- **encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.
Constraints: offset + length <= Buffer size| **Return value** + | Type | Description | | --------------------- | -------- | | Promise<number> | Promise used to return the length of the data written.| **Example** + ```js let fd = fileio.openSync(path, 0o100 | 0o2, 0o666); fileio.write(fd, "hello, world").then(function(number){ - console.info("Data written to file and size is:"+ number); + console.info("Data written to the file. Size is:"+ number); }).catch(function(err){ console.info("Failed to write data to the file. Error:"+ err); }); @@ -902,6 +938,7 @@ Writes data into a file. This API uses an asynchronous callback to return the re **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | ------------------------------- | ---- | ---------------------------------------- | | fd | number | Yes | File descriptor of the file to write. | @@ -910,11 +947,12 @@ Writes data into a file. This API uses an asynchronous callback to return the re | callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | **Example** + ```js let fd = fileio.openSync(path, 0o100 | 0o2, 0o666); fileio.write(fd, "hello, world", function (err, bytesWritten) { if (bytesWritten) { - console.info("Data written to file and size is:"+ bytesWritten); + console.info("Data written to the file. Size is:"+ bytesWritten); } }); ``` @@ -934,6 +972,7 @@ Synchronously writes data into a file. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ------- | ------------------------------- | ---- | ---------------------------------------- | | fd | number | Yes | File descriptor of the file to write. | @@ -941,11 +980,13 @@ Synchronously writes data into a file. | options | Object | No | The options are as follows:
- **offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.
- **length** (number): length of the data to write. The default value is the buffer length minus the offset.
- **position** (number): start position to write the data in the file. By default, data is written from the current position.
- **encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.
Constraints: offset + length <= Buffer size| **Return value** + | Type | Description | | ------ | -------- | | number | Length of the data written in the file.| **Example** + ```js let fd = fileio.openSync(path, 0o100 | 0o2, 0o666); let num = fileio.writeSync(fd, "hello, world"); @@ -961,21 +1002,24 @@ Calculates the hash value of a file. This API uses a promise to return the resul **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | --------- | ------ | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the file. | | algorithm | string | Yes | Algorithm used to calculate the hash value. The value can be **md5**, **sha1**, or **sha256**. **sha256** is recommended for security purposes.| **Return value** + | Type | Description | | --------------------- | -------------------------- | | Promise<string> | Promise used to return the hash value obtained. The hash value is a hexadecimal string consisting of digits and uppercase letters.| **Example** + ```js fileio.hash(path, "sha256").then(function(str){ console.info("Calculated file hash:"+ str); - }).catch(function(error){ + }).catch(function(err){ console.info("Failed to calculate the file hash. Error:"+ err); }); ``` @@ -990,6 +1034,7 @@ Calculates the hash value of a file. This API uses an asynchronous callback to r **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | --------- | --------------------------- | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the file. | @@ -997,6 +1042,7 @@ Calculates the hash value of a file. This API uses an asynchronous callback to r | callback | AsyncCallback<string> | Yes | Callback used to return the hash value obtained. The hash value is a hexadecimal string consisting of digits and uppercase letters.| **Example** + ```js fileio.hash(path, "sha256", function(err, hashStr) { if (hashStr) { @@ -1015,19 +1061,22 @@ Changes file permissions. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the file. | | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (|).
- **0o700**: The owner has the read, write, and execute permissions.
-  **0o400**: The owner has the read permission.
- **0o200**: The owner has the write permission.
- **0o100**: The owner has the execute permission.
- **0o070**: The user group has the read, write, and execute permissions.
- **0o040**: The user group has the read permission.
- **0o020**: The user group has the write permission.
- **0o010**: The user group has the execute permission.
- **0o007**: Other users have the read, write, and execute permissions.
- **0o004**: Other users have the read permission.
- **0o002**: Other users have the write permission.
- **0o001**: Other users have the execute permission.| **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js - fileio.chmod(path, mode).then(function() { + fileio.chmod(path, 0o700).then(function() { console.info("File permissions changed"); }).catch(function(err){ console.info("Failed to change file permissions. Error:"+ err); @@ -1044,6 +1093,7 @@ Changes file permissions. This API uses an asynchronous callback to return the r **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the file. | @@ -1051,8 +1101,9 @@ Changes file permissions. This API uses an asynchronous callback to return the r | callback | AsyncCallback<void> | Yes | Callback invoked when the file permissions are changed asynchronously. | **Example** + ```js - fileio.chmod(path, mode, function (err) { + fileio.chmod(path, 0o700, function (err) { // Do something. }); ``` @@ -1067,14 +1118,16 @@ Synchronously changes file permissions. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the file. | | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (|).
- **0o700**: The owner has the read, write, and execute permissions.
-  **0o400**: The owner has the read permission.
- **0o200**: The owner has the write permission.
- **0o100**: The owner has the execute permission.
- **0o070**: The user group has the read, write, and execute permissions.
- **0o040**: The user group has the read permission.
- **0o020**: The user group has the write permission.
- **0o010**: The user group has the execute permission.
- **0o007**: Other users have the read, write, and execute permissions.
- **0o004**: Other users have the read permission.
- **0o002**: Other users have the write permission.
- **0o001**: Other users have the execute permission.| **Example** + ```js - fileio.chmodSync(path, mode); + fileio.chmodSync(path, 0o700); ``` @@ -1087,21 +1140,25 @@ Obtains file information based on the file descriptor. This API uses a promise t **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ------------ | | fd | number | Yes | File descriptor of the target file.| **Return value** + | Type | Description | | ---------------------------- | ---------- | | Promise<[Stat](#stat)> | Promise used to return the file information.| **Example** + ```js + let fd = fileio.openSync(path); fileio.fstat(fd).then(function(stat){ - console.info("File information obtained:"+ JSON.stringify(stat)); + console.info("Obtained file info:"+ JSON.stringify(stat)); }).catch(function(err){ - console.info("Failed to obtain file information. Error:"+ err); + console.info("Failed to obtain file info. Error:"+ err); }); ``` @@ -1115,12 +1172,14 @@ Obtains file information based on the file descriptor. This API uses an asynchro **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | ---------------------------------- | ---- | ---------------- | | fd | number | Yes | File descriptor of the target file. | | callback | AsyncCallback<[Stat](#stat)> | Yes | Callback invoked to return the file information obtained.| **Example** + ```js let fd = fileio.openSync(path); fileio.fstat(fd, function (err) { @@ -1138,16 +1197,19 @@ Synchronously obtains file information based on the file descriptor. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ------------ | | fd | number | Yes | File descriptor of the target file.| **Return value** + | Type | Description | | ------------- | ---------- | | [Stat](#stat) | File information obtained.| **Example** + ```js let fd = fileio.openSync(path); let stat = fileio.fstatSync(fd); @@ -1163,17 +1225,20 @@ Truncates a file based on the file descriptor. This API uses a promise to return **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ---------------- | | fd | number | Yes | File descriptor of the file to truncate. | | len | number | No | File length, in bytes, after truncation.| **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js let fd = fileio.openSync(path); fileio.ftruncate(fd, 5).then(function(err) { @@ -1193,6 +1258,7 @@ Truncates a file based on the file descriptor. This API uses an asynchronous cal **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | ---------------- | | fd | number | Yes | File descriptor of the file to truncate. | @@ -1200,8 +1266,11 @@ Truncates a file based on the file descriptor. This API uses an asynchronous cal | callback | AsyncCallback<void> | Yes | Callback that returns no value. | **Example** + ```js - fileio.ftruncate(fd, len, function(err){ + let fd = fileio.openSync(path); + let len = 5; + fileio.ftruncate(fd, 5, function(err){ // Do something. }); ``` @@ -1216,13 +1285,17 @@ Synchronously truncates a file based on the file descriptor. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ---------------- | | fd | number | Yes | File descriptor of the file to truncate. | | len | number | No | File length, in bytes, after truncation.| **Example** + ```js + let fd = fileio.openSync(path); + let len = 5; fileio.ftruncateSync(fd, len); ``` @@ -1236,18 +1309,22 @@ Truncates a file based on the file path. This API uses a promise to return the r **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------- | -| path | string | Yes | Application sandbox path of the file to truncate. | +| path | string | Yes | Application sandbox path of the file to truncate.| | len | number | No | File length, in bytes, after truncation.| **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js + let len = 5; fileio.truncate(path, len).then(function(){ console.info("File truncated"); }).catch(function(err){ @@ -1265,6 +1342,7 @@ Truncates a file based on the file path. This API uses an asynchronous callback **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | -------------------------------- | | path | string | Yes | Application sandbox path of the file to truncate.| @@ -1272,7 +1350,9 @@ Truncates a file based on the file path. This API uses an asynchronous callback | callback | AsyncCallback<void> | Yes | Callback that returns no value. | **Example** + ```js + let len = 5; fileio.truncate(path, len, function(err){ // Do something. }); @@ -1288,13 +1368,16 @@ Synchronously truncates a file based on the file path. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------- | | path | string | Yes | Application sandbox path of the file to truncate.| | len | number | No | File length, in bytes, after truncation.| **Example** + ```js + let len = 5; fileio.truncateSync(path, len); ``` @@ -1312,22 +1395,25 @@ Reads the text content of a file. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | ------ | ---- | ------------------------------------------------------------ | | filePath | string | Yes | Application sandbox path of the file to read. | | options | Object | No | The options are as follows:
- **position** (number): position of the data to read in the file. By default, data is read from the current position.
- **length** (number): length of the data to read. The default value is the buffer length minus the offset.
- **encoding** (string): format of the data (string) to be encoded. The default value is **utf-8**, which is the only value supported.| **Return value** + | Type | Description | | --------------------- | ---------- | | Promise<string> | Promise used to return the content read.| **Example** + ```js fileio.readText(path).then(function(str) { - console.info("Read file text:"+ str); + console.info("Read text:"+ str); }).catch(function(err){ - console.info("Failed to read text. Error:"+ err); + console.info("Failed to read the text. Error:"+ err); }); ``` @@ -1345,15 +1431,17 @@ Reads the text content of a file. This API uses an asynchronous callback to retu **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | --------------------------- | ---- | ------------------------------------------------------------ | | filePath | string | Yes | Application sandbox path of the file to read. | -| options | Object | No | The options are as follows:
- **position** (number): position of the data to read in the file. By default, data is read from the current position.
- **length** (number): length of the data to read. The default value is the buffer length minus the offset.
-  **encoding**: format of the string to be encoded. The default value is  **utf-8**, which is the only value supported.| +| options | Object | Yes | The options are as follows:
- **position** (number): position of the data to read in the file. By default, data is read from the current position.
- **length** (number): length of the data to read. The default value is the buffer length minus the offset.
-  **encoding**: format of the string to be encoded. The default value is  **utf-8**, which is the only value supported.| | callback | AsyncCallback<string> | Yes | Callback used to return the content read. | **Example** + ```js - fileio.readText(path, function(err, str){ + fileio.readText(path, { position: 1, encoding: 'UTF-8' }, function(err, str){ // Do something. }); ``` @@ -1372,17 +1460,20 @@ Synchronously reads the text of a file. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | ------ | ---- | ------------------------------------------------------------ | | filePath | string | Yes | Application sandbox path of the file to read. | | options | Object | No | The options are as follows:
- **position** (number): position of the data to read in the file. By default, data is read from the current position.
- **length** (number): length of the data to read. The default value is the buffer length minus the offset.
- **encoding** (string): format of the data (string) to be encoded. The default value is **utf-8**, which is the only value supported.| **Return value** + | Type | Description | | ------ | -------------------- | | string | Promise used to return the content of the file read.| **Example** + ```js let str = fileio.readTextSync(path, {position: 1, length: 3}); ``` @@ -1397,21 +1488,24 @@ Obtains link information. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------------- | | path | string | Yes | Application sandbox path of the target file.| **Return value** + | Type | Description | | ---------------------------- | ---------- | | Promise<[Stat](#stat)> | Promise used to return the link information obtained. For details, see [Stat](#stat).| **Example** + ```js fileio.lstat(path).then(function(stat){ console.info("Got link info:"+ JSON.stringify(stat)); }).catch(function(err){ - console.info("Failed to obtain the link status. Error:"+ err); + console.info("Failed to obtain link info. Error:"+ err); }); ``` @@ -1425,12 +1519,14 @@ Obtains link information. This API uses an asynchronous callback to return the r **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | ---------------------------------- | ---- | -------------------------------------- | | path | string | Yes | Application sandbox path of the target file.| | callback | AsyncCallback<[Stat](#stat)> | Yes | Callback used to return the link information obtained. | **Example** + ```js fileio.lstat(path, function (err, stat) { // Do something. @@ -1447,83 +1543,21 @@ Synchronously obtains the link information. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------------- | | path | string | Yes | Application sandbox path of the target file.| **Return value** + | Type | Description | | ------------- | ---------- | | [Stat](#stat) | Link information obtained.| **Example** - ```js - let stat = fileio.lstatSync(path); - ``` - - -## fileio.read7+ - -read(buffer: ArrayBuffer, options?: { - position?: number; - offset?: number; - length?: number; -}): Promise<ReadOut> - -Reads data from a file. This API uses a promise to return the result. - -**System capability**: SystemCapability.FileManagement.File.FileIO - -**Parameters** - | Name | Type | Mandatory| Description | - | ------- | ----------- | ---- | ------------------------------------------------------------ | - | buffer | ArrayBuffer | Yes | Buffer used to store the file data read. | - | options | Object | No | The options are as follows:
- **offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.
- **length** (number): length of the data to read. The default value is the buffer length minus the offset.
Constraints: offset + length <= Buffer size| - -**Return value** - | Type | Description | - | ---------------------------------- | ------ | - | Promise<[ReadOut](#readout)> | Promise used to return the data read.| - -**Example** - ```js - fileio.read(new ArrayBuffer(4096)).then(function(readout){ - console.info("Read file data"); - console.log(String.fromCharCode.apply(null, new Uint8Array(readOut.buffer))); - }).catch(function(err){ - console.info("Failed to read file data. Error:"+ err); - }); - ``` - - -## fileio.read7+ - -read(buffer: ArrayBuffer, options: { - position?: number; - offset?: number; - length?: number; -}, callback: AsyncCallback<ReadOut>): void - -Reads data from a file. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.FileManagement.File.FileIO - -**Parameters** - | Name | Type | Mandatory | Description | - | -------- | ---------------------------------------- | ---- | ---------------------------------------- | - | buffer | ArrayBuffer | Yes | Buffer used to store the file data read. | - | options | Object | No | The options are as follows:
- **offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.
- **length** (number): length of the data to read. The default value is the buffer length minus the offset.
Constraints: offset + length <= Buffer size| - | callback | AsyncCallback<[ReadOut](#readout)> | Yes | Callback invoked when the data is read asynchronously from the file. | -**Example** ```js - let buf = new ArrayBuffer(4096); - fileio.read(buf, function (err, readOut) { - if (readOut) { - console.info("Read file data"); - console.log(String.fromCharCode.apply(null, new Uint8Array(readOut.buffer))); - } - }); + let stat = fileio.lstatSync(path); ``` @@ -1536,18 +1570,23 @@ Renames a file. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | ------- | ------ | ---- | ---------------------------- | | oldPath | string | Yes | Application sandbox path of the file to rename.| | newPath | String | Yes | Application sandbox path of the file renamed. | **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js + let oldPath = path; + let newPath = oldPath + '123'; fileio.rename(oldPath, newPath).then(function() { console.info("File renamed"); }).catch(function(err){ @@ -1565,6 +1604,7 @@ Renames a file. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ---------------------------- | | oldPath | string | Yes | Application sandbox path of the file to rename.| @@ -1572,7 +1612,10 @@ Renames a file. This API uses an asynchronous callback to return the result. | Callback | AsyncCallback<void> | Yes | Callback invoked when the file is asynchronously renamed. | **Example** + ```js + let oldPath = path; + let newPath = oldPath + '123'; fileio.rename(oldPath, newPath, function(err){ }); ``` @@ -1587,13 +1630,17 @@ Synchronously renames a file. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | ------- | ------ | ---- | ---------------------------- | | oldPath | string | Yes | Application sandbox path of the file to rename.| | newPath | String | Yes | Application sandbox path of the file renamed. | **Example** + ```js + let oldPath = path; + let newPath = oldPath + '123'; fileio.renameSync(oldPath, newPath); ``` @@ -1607,17 +1654,21 @@ Flushes data of a file to disk. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ------------ | | fd | number | Yes | File descriptor of the file to flush.| **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js + let fd = fileio.openSync(path); fileio.fsync(fd).then(function(){ console.info("Data flushed"); }).catch(function(err){ @@ -1635,13 +1686,16 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | --------------- | | fd | number | Yes | File descriptor of the file to flush. | | Callback | AsyncCallback<void> | Yes | Callback invoked when the file is synchronized in asynchronous mode.| **Example** + ```js + let fd = fileio.openSync(path); fileio.fsync(fd, function(err){ // Do something. }); @@ -1657,12 +1711,15 @@ Flushes data of a file to disk in synchronous mode. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ------------ | | fd | number | Yes | File descriptor of the file to flush.| **Example** + ```js + let fd = fileio.openSync(path); fileio.fsyncSync(fd); ``` @@ -1676,17 +1733,21 @@ Flushes data of a file to disk. This API uses a promise to return the result. ** **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ------------ | | fd | number | Yes | File descriptor of the file to flush.| **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js + let fd = fileio.openSync(path); fileio.fdatasync(fd).then(function(err) { console.info("Data flushed"); }).catch(function(err){ @@ -1704,13 +1765,16 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | ------------------------------- | ---- | ----------------- | | fd | number | Yes | File descriptor of the file to synchronize. | | callback | AsyncCallback <void> | Yes | Callback invoked when the file data is synchronized in asynchronous mode.| **Example** + ```js + let fd = fileio.openSync(path); fileio.fdatasync (fd, function (err) { // Do something. }); @@ -1726,12 +1790,15 @@ Synchronizes data in a file in synchronous mode. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ------------ | | fd | number | Yes | File descriptor of the file to flush.| **Example** + ```js + let fd = fileio.openSync(path); let stat = fileio.fdatasyncSync(fd); ``` @@ -1745,18 +1812,23 @@ Creates a symbolic link based on the file path. This API uses a promise to retur **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | ------- | ------ | ---- | ---------------------------- | | target | string | Yes | Application sandbox path of the target file. | | srcPath | string | Yes | Application sandbox path of the symbolic link file.| **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js + let target = path; + let srcPath = target + 'aaa'; fileio.symlink(target, srcPath).then(function() { console.info("Symbolic link created"); }).catch(function(err){ @@ -1774,6 +1846,7 @@ Creates a symbolic link based on the file path. This API uses an asynchronous ca **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | -------------------------------- | | target | string | Yes | Application sandbox path of the target file. | @@ -1781,7 +1854,10 @@ Creates a symbolic link based on the file path. This API uses an asynchronous ca | callback | AsyncCallback<void> | Yes | Callback invoked when the symbolic link is created asynchronously.| **Example** + ```js + let target = path; + let srcPath = target + 'aaa'; fileio.symlink(target, srcPath, function (err) { // Do something. }); @@ -1797,13 +1873,17 @@ Synchronously creates a symbolic link based on a specified path. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | ------- | ------ | ---- | ---------------------------- | | target | string | Yes | Application sandbox path of the target file. | | srcPath | string | Yes | Application sandbox path of the symbolic link file.| **Example** + ```js + let target = path; + let srcPath = target + 'aaa'; fileio.symlinkSync(target, srcPath); ``` @@ -1817,6 +1897,7 @@ Changes the file owner based on the file path. This API uses a promise to return **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------- | | path | string | Yes | Application sandbox path of the file.| @@ -1824,11 +1905,13 @@ Changes the file owner based on the file path. This API uses a promise to return | gid | number | Yes | New group ID (GID). | **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js let stat = fileio.statSync(path); fileio.chown(path, stat.uid, stat.gid).then(function(){ @@ -1848,6 +1931,7 @@ Changes the file owner based on the file path. This API uses an asynchronous cal **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------ | | path | string | Yes | Application sandbox path of the file. | @@ -1856,6 +1940,7 @@ Changes the file owner based on the file path. This API uses an asynchronous cal | callback | AsyncCallback<void> | Yes | Callback invoked when the file owner is changed asynchronously.| **Example** + ```js let stat = fileio.statSync(path) fileio.chown(path, stat.uid, stat.gid, function (err){ @@ -1873,6 +1958,7 @@ Synchronously changes the file owner based on its path. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------- | | path | string | Yes | Application sandbox path of the file.| @@ -1880,6 +1966,7 @@ Synchronously changes the file owner based on its path. | gid | number | Yes | New GID. | **Example** + ```js let stat = fileio.statSync(path) fileio.chownSync(path, stat.uid, stat.gid); @@ -1895,21 +1982,24 @@ Creates a temporary directory. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ------ | ------ | ---- | --------------------------- | | prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| **Return value** + | Type | Description | | --------------------- | ---------- | | Promise<string> | Promise used to return the unique directory generated.| **Example** + ```js fileio.mkdtemp(path + "XXXX").then(function(path){ console.info("Temporary directory created:"+ path); }).catch(function(err){ - console.info("Failed to create a temporary directory. Error:"+ err); + console.info("Failed to create the temporary directory. Error:"+ err); }); ``` @@ -1923,12 +2013,14 @@ Creates a temporary directory. This API uses an asynchronous callback to return **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | --------------------------- | ---- | --------------------------- | | prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| | callback | AsyncCallback<string> | Yes | Callback invoked when a temporary directory is created asynchronously. | **Example** + ```js fileio.mkdtemp(path + "XXXX", function (err, res) { // Do something. @@ -1945,16 +2037,19 @@ Synchronously creates a temporary directory. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ------ | ------ | ---- | --------------------------- | | prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| **Return value** + | Type | Description | | ------ | ---------- | | string | Unique path generated.| **Example** + ```js let res = fileio.mkdtempSync(path + "XXXX"); ``` @@ -1969,18 +2064,23 @@ Changes file permissions based on the file descriptor. This API uses a promise t **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ---------------------------------------- | | fd | number | Yes | File descriptor of the target file. | | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (|).
- **0o700**: The owner has the read, write, and execute permissions.
-  **0o400**: The owner has the read permission.
- **0o200**: The owner has the write permission.
- **0o100**: The owner has the execute permission.
- **0o070**: The user group has the read, write, and execute permissions.
- **0o040**: The user group has the read permission.
- **0o020**: The user group has the write permission.
- **0o010**: The user group has the execute permission.
- **0o007**: Other users have the read, write, and execute permissions.
- **0o004**: Other users have the read permission.
- **0o002**: Other users have the write permission.
- **0o001**: Other users have the execute permission.| **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js + let fd = fileio.openSync(path); + let mode = 0o700; fileio.fchmod(fd, mode).then(function() { console.info("File permissions changed"); }).catch(function(err){ @@ -1998,6 +2098,7 @@ Changes file permissions based on the file descriptor. This API uses an asynchro **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | ------------------------------- | ---- | ---------------------------------------- | | fd | number | Yes | File descriptor of the target file. | @@ -2005,7 +2106,10 @@ Changes file permissions based on the file descriptor. This API uses an asynchro | callback | AsyncCallback <void> | Yes | Callback invoked when the file permissions are changed asynchronously. | **Example** + ```js + let fd = fileio.openSync(path); + let mode = 0o700; fileio.fchmod(fd, mode, function (err) { // Do something. }); @@ -2021,13 +2125,17 @@ Synchronously changes the file permissions based on the file descriptor. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ---------------------------------------- | | fd | number | Yes | File descriptor of the target file. | | mode | number | Yes | Permissions on the file. You can specify multiple permissions, separated using a bitwise OR operator (|).
- **0o700**: The owner has the read, write, and execute permissions.
-  **0o400**: The owner has the read permission.
- **0o200**: The owner has the write permission.
- **0o100**: The owner has the execute permission.
- **0o070**: The user group has the read, write, and execute permissions.
- **0o040**: The user group has the read permission.
- **0o020**: The user group has the write permission.
- **0o010**: The user group has the execute permission.
- **0o007**: Other users have the read, write, and execute permissions.
- **0o004**: Other users have the read permission.
- **0o002**: Other users have the write permission.
- **0o001**: Other users have the execute permission.| **Example** + ```js + let fd = fileio.openSync(path); + let mode = 0o700; fileio.fchmodSync(fd, mode); ``` @@ -2041,17 +2149,20 @@ Opens a file stream based on the file path. This API uses a promise to return th **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the file. | | mode | string | Yes | - **r**: Open a file for reading. The file must exist.
- **r+**: Open a file for both reading and writing. The file must exist.
- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.
- **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.
- **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).
- **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| **Return value** + | Type | Description | | --------------------------------- | --------- | | Promise<[Stream](#stream7)> | Promise used to return the result.| **Example** + ```js fileio.createStream(path, "r+").then(function(stream){ console.info("Stream opened"); @@ -2070,6 +2181,7 @@ Opens a file stream based on the file path. This API uses an asynchronous callba **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the file. | @@ -2077,6 +2189,7 @@ Opens a file stream based on the file path. This API uses an asynchronous callba | callback | AsyncCallback<[Stream](#stream7)> | Yes | Callback invoked when the stream is open asynchronously. | **Example** + ```js fileio.createStream(path, "r+", function(err, stream){ // Do something. @@ -2093,17 +2206,20 @@ Synchronously opens a stream based on the file path. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the file. | | mode | string | Yes | - **r**: Open a file for reading. The file must exist.
- **r+**: Open a file for both reading and writing. The file must exist.
- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.
- **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.
- **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).
- **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| **Return value** + | Type | Description | | ------------------ | --------- | | [Stream](#stream7) | Stream opened.| **Example** + ```js let ss = fileio.createStreamSync(path, "r+"); ``` @@ -2118,17 +2234,20 @@ Opens a file stream based on the file descriptor. This API uses a promise to ret **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ---------------------------------------- | | fd | number | Yes | File descriptor of the target file. | | mode | string | Yes | - **r**: Open a file for reading. The file must exist.
- **r+**: Open a file for both reading and writing. The file must exist.
- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.
- **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.
- **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).
- **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| **Return value** + | Type | Description | | --------------------------------- | --------- | | Promise<[Stream](#stream7)> | Promise used to return the result.| **Example** + ```js let fd = fileio.openSync(path); fileio.fdopenStream(fd, "r+").then(function(stream){ @@ -2148,6 +2267,7 @@ Opens a file stream based on the file descriptor. This API uses an asynchronous **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | ---------------------------------------- | | fd | number | Yes | File descriptor of the target file. | @@ -2155,6 +2275,7 @@ Opens a file stream based on the file descriptor. This API uses an asynchronous | callback | AsyncCallback <[Stream](#stream7)> | Yes | Callback invoked when the stream is open asynchronously. | **Example** + ```js let fd = fileio.openSync(path); fileio.fdopenStream(fd, "r+", function (err, stream) { @@ -2172,17 +2293,20 @@ Synchronously opens a stream based on the file descriptor. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ---------------------------------------- | | fd | number | Yes | File descriptor of the target file. | | mode | string | Yes | - **r**: Open a file for reading. The file must exist.
- **r+**: Open a file for both reading and writing. The file must exist.
- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.
- **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.
- **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).
- **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| **Return value** + | Type | Description | | ------------------ | --------- | | [Stream](#stream7) | Stream opened.| **Example** + ```js let fd = fileio.openSync(path); let ss = fileio.fdopenStreamSync(fd, "r+"); @@ -2198,6 +2322,7 @@ Changes the file owner based on the file descriptor. This API uses a promise to **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ------------ | | fd | number | Yes | File descriptor of the target file.| @@ -2205,12 +2330,15 @@ Changes the file owner based on the file descriptor. This API uses a promise to | gid | number | Yes | New GID. | **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js + let fd = fileio.openSync(path); let stat = fileio.statSync(path); fileio.fchown(fd, stat.uid, stat.gid).then(function() { console.info("File owner changed"); @@ -2229,6 +2357,7 @@ Changes the file owner based on the file descriptor. This API uses an asynchrono **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | --------------- | | fd | number | Yes | File descriptor of the target file. | @@ -2237,7 +2366,9 @@ Changes the file owner based on the file descriptor. This API uses an asynchrono | callback | AsyncCallback<void> | Yes | Callback invoked when the file owner is changed asynchronously.| **Example** + ```js + let fd = fileio.openSync(path); let stat = fileio.statSync(path); fileio.fchown(fd, stat.uid, stat.gid, function (err){ // Do something. @@ -2254,6 +2385,7 @@ Synchronously changes the file owner based on the file descriptor. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ------------ | | fd | number | Yes | File descriptor of the target file.| @@ -2261,7 +2393,9 @@ Synchronously changes the file owner based on the file descriptor. | gid | number | Yes | New GID. | **Example** + ```js + let fd = fileio.openSync(path); let stat = fileio.statSync(path); fileio.fchownSync(fd, stat.uid, stat.gid); ``` @@ -2276,6 +2410,7 @@ Changes the file owner (owner of the symbolic link, not the file referred to by **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------- | | path | string | Yes | Application sandbox path of the file.| @@ -2283,11 +2418,13 @@ Changes the file owner (owner of the symbolic link, not the file referred to by | gid | number | Yes | New GID. | **Return value** + | Type | Description | | ------------------- | ---------------------------- | | Promise<void> | Promise that returns no value.| **Example** + ```js let stat = fileio.statSync(path); fileio.lchown(path, stat.uid, stat.gid).then(function() { @@ -2307,6 +2444,7 @@ Changes the file owner (owner of the symbolic link, not the file referred to by **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------ | | path | string | Yes | Application sandbox path of the file. | @@ -2315,6 +2453,7 @@ Changes the file owner (owner of the symbolic link, not the file referred to by | callback | AsyncCallback<void> | Yes | Callback invoked when the file owner is changed asynchronously.| **Example** + ```js let stat = fileio.statSync(path); fileio.lchown(path, stat.uid, stat.gid, function (err){ @@ -2332,6 +2471,7 @@ Synchronously changes the file owner based on the file path and changes the owne **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------- | | path | string | Yes | Application sandbox path of the file.| @@ -2339,6 +2479,7 @@ Synchronously changes the file owner based on the file path and changes the owne | gid | number | Yes | New GID. | **Example** + ```js let stat = fileio.statSync(path); fileio.lchownSync(path, stat.uid, stat.gid); @@ -2354,6 +2495,7 @@ Listens for file or directory changes. This API uses an asynchronous callback to **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | --------------------------------- | ---- | ------------------------------------------------------------ | | filename | string | Yes | Application sandbox path of the file. | @@ -2361,11 +2503,13 @@ Listens for file or directory changes. This API uses an asynchronous callback to | callback | AsyncCallback<number > | Yes | Called each time a change is detected. | **Return value** + | Type | Description | | -------------------- | ---------- | | [Watcher](#watcher7) | Promise used to return the **Watcher** instance.| **Example** + ```js let filename = path +"/test.txt"; fileio.createWatcher(filename, 1, function(number){ @@ -2421,11 +2565,13 @@ Checks whether this file is a block special file. A block special file supports **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ------- | ---------------- | | boolean | Whether the file is a block special file.| **Example** + ```js let isBLockDevice = fileio.statSync(path).isBlockDevice(); ``` @@ -2440,11 +2586,13 @@ Checks whether this file is a character special file. A character special file s **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ------- | ----------------- | | boolean | Whether the file is a character special file.| **Example** + ```js let isCharacterDevice = fileio.statSync(path).isCharacterDevice(); ``` @@ -2459,11 +2607,13 @@ Checks whether this file is a directory. **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ------- | ------------- | | boolean | Whether the file is a directory.| **Example** + ```js let isDirectory = fileio.statSync(path).isDirectory(); ``` @@ -2478,11 +2628,13 @@ Checks whether this file is a named pipe (or FIFO). Named pipes are used for int **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ------- | --------------------- | | boolean | Whether the file is an FIFO.| **Example** + ```js let isFIFO = fileio.statSync(path).isFIFO(); ``` @@ -2497,11 +2649,13 @@ Checks whether this file is a regular file. **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ------- | --------------- | | boolean | Whether the file is a regular file.| **Example** + ```js let isFile = fileio.statSync(path).isFile(); ``` @@ -2516,11 +2670,13 @@ Checks whether this file is a socket. **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ------- | -------------- | | boolean | Whether the file is a socket.| **Example** + ```js let isSocket = fileio.statSync(path).isSocket(); ``` @@ -2535,11 +2691,13 @@ Checks whether this file is a symbolic link. **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ------- | --------------- | | boolean | Whether the file is a symbolic link.| **Example** + ```js let isSymbolicLink = fileio.statSync(path).isSymbolicLink(); ``` @@ -2559,6 +2717,7 @@ Stops the **watcher** instance. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Example** + ```js let filename = path +"/test.txt"; let watcher = await fileio.createWatcher(filename, 1, function(number){ @@ -2579,11 +2738,13 @@ Stops the **watcher** instance. This API uses an asynchronous callback to return **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | ---------------------- | | callback | AsyncCallback<void> | Yes | Callback invoked when **watcher** is stopped asynchronously.| **Example** + ```js let filename = path +"/test.txt"; let watcher = await fileio.createWatcher(filename, 1, function(number){ @@ -2608,15 +2769,17 @@ Closes the stream. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ------------------- | ------------- | | Promise<void> | Promise used to return the stream close result.| **Example** + ```js let ss= fileio.createStreamSync(path, "r+"); ss.close().then(function(){ - console.info("Stream closed"); + console.info("File stream closed"); }).catch(function(err){ console.info("Failed to close the file stream. Error:"+ err); }); @@ -2632,11 +2795,13 @@ Closes the stream. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | ------------- | | callback | AsyncCallback<void> | Yes | Callback invoked when the stream is closed asynchronously.| **Example** + ```js let ss= fileio.createStreamSync(path, "r+"); ss.close(function (err) { @@ -2654,6 +2819,7 @@ Synchronously closes the stream. **System capability**: SystemCapability.FileManagement.File.FileIO **Example** + ```js let ss= fileio.createStreamSync(path, "r+"); ss.closeSync(); @@ -2669,11 +2835,13 @@ Flushes the stream. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ------------------- | ------------- | | Promise<void> | Promise used to return the stream flushing result.| **Example** + ```js let ss= fileio.createStreamSync(path, "r+"); ss.flush().then(function (){ @@ -2693,11 +2861,13 @@ Flushes the stream. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | -------------- | | callback | AsyncCallback<void> | Yes | Callback invoked when the stream is asynchronously flushed.| **Example** + ```js let ss= fileio.createStreamSync(path, "r+"); ss.flush(function (err) { @@ -2715,6 +2885,7 @@ Synchronously flushes the stream. **System capability**: SystemCapability.FileManagement.File.FileIO **Example** + ```js let ss= fileio.createStreamSync(path, "r+"); ss.flushSync(); @@ -2735,23 +2906,26 @@ Writes data into the stream. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ------- | ------------------------------- | ---- | ---------------------------------------- | | buffer | ArrayBuffer \| string | Yes | Data to write. It can be a string or data from a buffer. | | options | Object | No | The options are as follows:
- **offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.
- **length** (number): length of the data to write. The default value is the buffer length minus the offset.
- **position** (number): start position to write the data in the file. By default, data is written from the current position.
- **encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.
Constraints: offset + length <= Buffer size | **Return value** + | Type | Description | | --------------------- | -------- | | Promise<number> | Promise used to return the length of the data written.| **Example** + ```js let ss= fileio.createStreamSync(path, "r+"); ss.write("hello, world",{offset: 1,length: 5,position: 5,encoding :'utf-8'}).then(function (number){ - console.info("Data written to the stream and size is:"+ number); + console.info("Data written to the stream. Size is:"+ number); }).catch(function(err){ - console.info("Failed to write data into the stream. Error:"+ err); + console.info("Failed to write data to the stream. Error:"+ err); }); ``` @@ -2770,6 +2944,7 @@ Writes data into the stream. This API uses an asynchronous callback to return th **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory| Description | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | buffer | ArrayBuffer \| string | Yes | Data to write. It can be a string or data from a buffer. | @@ -2777,12 +2952,13 @@ Writes data into the stream. This API uses an asynchronous callback to return th | callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | **Example** + ```js let ss= fileio.createStreamSync(path, "r+"); ss.write("hello, world", {offset: 1, length: 5, position: 5, encoding :'utf-8'}, function (err, bytesWritten) { if (bytesWritten) { // Do something - console.info("Data written to the stream and size is:"+ bytesWritten); + console.info("Data written to the stream. Size is:"+ bytesWritten); } }); ``` @@ -2802,17 +2978,20 @@ Synchronously writes data into the stream. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ------- | ------------------------------- | ---- | ---------------------------------------- | | buffer | ArrayBuffer \| string | Yes | Data to write. It can be a string or data from a buffer. | | options | Object | No | The options are as follows:
- **offset** (number): position of the data to write in reference to the start address of the data. The default value is **0**.
- **length** (number): length of the data to write. The default value is the buffer length minus the offset.
- **position** (number): start position to write the data in the file. By default, data is written from the current position.
- **encoding** (string): format of the string to be encoded. The default value is **utf-8**, which is the only value supported.
Constraints: offset + length <= Buffer size | **Return value** + | Type | Description | | ------ | -------- | | number | Length of the data written in the file.| **Example** + ```js let ss= fileio.createStreamSync(path,"r+"); let num = ss.writeSync("hello, world", {offset: 1, length: 5, position: 5, encoding :'utf-8'}); @@ -2832,20 +3011,23 @@ Reads data from the stream. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | ------- | ----------- | ---- | ---------------------------------------- | | buffer | ArrayBuffer | Yes | Buffer used to store the file read. | | options | Object | No | The options are as follows:
- **offset** (number): position to store the data read in the buffer in reference to the start address of the buffer. The default value is **0**.
- **length** (number): length of the data to read. The default value is the buffer length minus the offset.
- **position** (number): position of the data to read in the file. By default, data is read from the current position.
Constraints: offset + length <= Buffer size | **Return value** + | Type | Description | | ---------------------------------- | ------ | | Promise<[ReadOut](#readout)> | Promise used to return the data read.| **Example** + ```js let ss = fileio.createStreamSync(path, "r+"); - ss.read(new ArrayBuffer(4096), {offset: 1, length: 5, position: 5}).then(function (readout){ + ss.read(new ArrayBuffer(4096), {offset: 1, length: 5, position: 5}).then(function (readOut){ console.info("Read data successfully"); console.log(String.fromCharCode.apply(null, new Uint8Array(readOut.buffer))); }).catch(function(err){ @@ -2867,6 +3049,7 @@ Reads data from the stream. This API uses an asynchronous callback to return the **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | ---------------------------------------- | | buffer | ArrayBuffer | Yes | Buffer used to store the file read. | @@ -2874,6 +3057,7 @@ Reads data from the stream. This API uses an asynchronous callback to return the | callback | AsyncCallback<[ReadOut](#readout)> | Yes | Callback invoked when data is read asynchronously from the stream. | **Example** + ```js let ss = fileio.createStreamSync(path, "r+"); ss.read(new ArrayBuffer(4096),{offset: 1, length: 5, position: 5},function (err, readOut) { @@ -2911,6 +3095,7 @@ Synchronously reads data from the stream. | number | Length of the data read.| **Example** + ```js let ss = fileio.createStreamSync(path, "r+"); let num = ss.readSync(new ArrayBuffer(4096), {offset: 1, length: 5, position: 5}); @@ -2919,7 +3104,7 @@ Synchronously reads data from the stream. ## Dir -Manages directories. Before calling a method of the **Dir** class, use the [opendir()](#fileioopendir) method synchronously or asynchronously to create a **Dir** instance. +Manages directories. Before calling a method of the **Dir** class, use the **opendir()** method synchronously or asynchronously to create a **Dir** instance. ### read @@ -2931,17 +3116,19 @@ Reads the next directory entry. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | -------------------------------- | ------------- | | Promise<[Dirent](#dirent)> | Promise used to return the directory entry read.| **Example** + ```js let dir = fileio.opendirSync(path); dir.read().then(function (dirent){ console.log("Read the next directory entry:"+JSON.stringify(dirent)); }).catch(function(err){ - console.info("Failed to read data. Error:"+ err); + console.info("Failed to read the next directory entry. Error:"+ err); }); ``` @@ -2955,11 +3142,13 @@ Reads the next directory entry. This API uses an asynchronous callback to return **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** + | Name | Type | Mandatory | Description | | -------- | -------------------------------------- | ---- | ---------------- | | callback | AsyncCallback<[Dirent](#dirent)> | Yes | Callback invoked when the next directory entry is asynchronously read.| **Example** + ```js let dir = fileio.opendirSync(path); dir.read(function (err, dirent) { @@ -2980,11 +3169,13 @@ Synchronously reads the next directory entry. **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ----------------- | -------- | | [Dirent](#dirent) | Directory entry read.| **Example** + ```js let dir = fileio.opendirSync(path); let dirent = dir.readSync(); @@ -3000,6 +3191,7 @@ Closes a directory. This API uses a promise to return the result. After a direct **System capability**: SystemCapability.FileManagement.File.FileIO **Example** + ```js let dir = fileio.opendirSync(path); dir.close().then(function(err){ @@ -3017,6 +3209,7 @@ Closes a directory. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Example** + ```js let dir = fileio.opendirSync(path); dir.close(function(err){ @@ -3034,6 +3227,7 @@ Closes a directory. After a directory is closed, the file descriptor in Dir will **System capability**: SystemCapability.FileManagement.File.FileIO **Example** + ```js let dir = fileio.opendirSync(path); dir.closeSync(); @@ -3062,11 +3256,13 @@ Checks whether this directory entry is a block special file. A block special fil **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ------- | ---------------- | | boolean | Whether the directory entry is a block special file.| **Example** + ```js let dir = fileio.opendirSync(path); let isBLockDevice = dir.readSync().isBlockDevice(); @@ -3082,11 +3278,13 @@ Checks whether a directory entry is a character special file. A character specia **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ------- | ----------------- | | boolean | Whether the directory entry is a character special file.| **Example** + ```js let dir = fileio.opendirSync(path); let isCharacterDevice = dir.readSync().isCharacterDevice(); @@ -3102,11 +3300,13 @@ Checks whether a directory entry is a directory. **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ------- | ------------- | | boolean | Whether the directory entry is a directory.| **Example** + ```js let dir = fileio.opendirSync(path); let isDirectory = dir.readSync().isDirectory(); @@ -3122,11 +3322,13 @@ Checks whether this directory entry is a named pipe (or FIFO). Named pipes are u **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ------- | --------------- | | boolean | Whether the directory entry is a FIFO.| **Example** + ```js let dir = fileio.opendirSync(path); let isFIFO = dir.readSync().isFIFO(); @@ -3142,11 +3344,13 @@ Checks whether a directory entry is a regular file. **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ------- | --------------- | | boolean | Whether the directory entry is a regular file.| **Example** + ```js let dir = fileio.opendirSync(path); let isFile = dir.readSync().isFile(); @@ -3162,13 +3366,15 @@ Checks whether a directory entry is a socket. **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ------- | -------------- | | boolean | Whether the directory entry is a socket.| **Example** + ```js - let dir = fileio.opendirSync(dpath); + let dir = fileio.opendirSync(path); let isSocket = dir.readSync().isSocket(); ``` @@ -3182,11 +3388,13 @@ Checks whether a directory entry is a symbolic link. **System capability**: SystemCapability.FileManagement.File.FileIO **Return value** + | Type | Description | | ------- | --------------- | | boolean | Whether the directory entry is a symbolic link.| **Example** + ```js let dir = fileio.opendirSync(path); let isSymbolicLink = dir.readSync().isSymbolicLink(); diff --git a/en/application-dev/reference/apis/js-apis-filemanager.md b/en/application-dev/reference/apis/js-apis-filemanager.md index 1279cd5ad4f58cef2abb9a68b1bd9bf0e80c2a62..38d6d982683a111a7ef98acfbd0d6f8f8d61ba4d 100644 --- a/en/application-dev/reference/apis/js-apis-filemanager.md +++ b/en/application-dev/reference/apis/js-apis-filemanager.md @@ -1,11 +1,12 @@ # User File Access and Management + +The fileManager module provides APIs for accessing and managing user files. It interworks with the underlying file management services to implement media library and external card management, and provides capabilities for applications to query and create user files. + >**NOTE**
> >- The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. >- The APIs of this module are system APIs and cannot be called by third-party applications. Currently, these APIs can be called only by **filepicker**. -Provides service APIs for accessing and managing user files. It interworks with the underlying file management services to implement media library and external card management, and provides capabilities for applications to query and create user files. - ## Modules to Import ```js diff --git a/en/application-dev/reference/apis/js-apis-huks.md b/en/application-dev/reference/apis/js-apis-huks.md index 35a2a3e6a1067c9a9dd26bb8d2ae0e9d39ffcc2e..b66ae2d8b74dd4e1fe13cc917269e88b5d088030 100644 --- a/en/application-dev/reference/apis/js-apis-huks.md +++ b/en/application-dev/reference/apis/js-apis-huks.md @@ -99,13 +99,13 @@ Enumerates the key purposes. | Name | Value | Description | | ------------------------ | ---- | -------------------------------- | -| HUKS_KEY_PURPOSE_ENCRYPT | 1 | Used to encrypt plaintext. | -| HUKS_KEY_PURPOSE_DECRYPT | 2 | Used to decrypt cipher text. | +| HUKS_KEY_PURPOSE_ENCRYPT | 1 | Used to encrypt plaintext.| +| HUKS_KEY_PURPOSE_DECRYPT | 2 | Used to decrypt cipher text.| | HUKS_KEY_PURPOSE_SIGN | 4 | Used to sign data. | | HUKS_KEY_PURPOSE_VERIFY | 8 | Used to verify the signed data. | | HUKS_KEY_PURPOSE_DERIVE | 16 | Used to derive a key. | -| HUKS_KEY_PURPOSE_WRAP | 32 | Used to wrap data. | -| HUKS_KEY_PURPOSE_UNWRAP | 64 | Used for unwrap data. | +| HUKS_KEY_PURPOSE_WRAP | 32 | Used to wrap a key. | +| HUKS_KEY_PURPOSE_UNWRAP | 64 | Used to unwrap a key. | | HUKS_KEY_PURPOSE_MAC | 128 | Used to generate a message authentication code (MAC). | | HUKS_KEY_PURPOSE_AGREE | 256 | Used for key agreement. | @@ -117,14 +117,14 @@ Enumerates the digest algorithms. | Name | Value | Description | | ---------------------- | ---- | ---------------------------------------- | -| HUKS_DIGEST_NONE | 0 | No digest algorithm | -| HUKS_DIGEST_MD5 | 1 | MD5 | -| HUKS_DIGEST_SM39+ | 2 | SM3 | -| HUKS_DIGEST_SHA1 | 10 | SHA1 | -| HUKS_DIGEST_SHA224 | 11 | SHA-224 | -| HUKS_DIGEST_SHA256 | 12 | SHA-256 | -| HUKS_DIGEST_SHA384 | 13 | SHA-384 | -| HUKS_DIGEST_SHA512 | 14 | SHA-512 | +| HUKS_DIGEST_NONE | 0 | No digest algorithm| +| HUKS_DIGEST_MD5 | 1 | MD5| +| HUKS_DIGEST_SM39+ | 2 | SM3| +| HUKS_DIGEST_SHA1 | 10 | SHA1| +| HUKS_DIGEST_SHA224 | 11 | SHA-224| +| HUKS_DIGEST_SHA256 | 12 | SHA-256| +| HUKS_DIGEST_SHA384 | 13 | SHA-384| +| HUKS_DIGEST_SHA512 | 14 | SHA-512| ## HuksKeyPadding @@ -134,11 +134,11 @@ Enumerates the padding algorithms. | Name | Value | Description | | ---------------------- | ---- | ---------------------------------------- | -| HUKS_PADDING_NONE | 0 | No padding algorithm | -| HUKS_PADDING_OAEP | 1 | Optimal Asymmetric Encryption Padding (OAEP) | -| HUKS_PADDING_PSS | 2 | Probabilistic Signature Scheme (PSS) | -| HUKS_PADDING_PKCS1_V1_5 | 3 | PKCS1_V1_5 | -| HUKS_PADDING_PKCS5 | 4 | Public Key Cryptography Standards (PKCS) #5 | +| HUKS_PADDING_NONE | 0 | No padding algorithm| +| HUKS_PADDING_OAEP | 1 | Optimal Asymmetric Encryption Padding (OAEP)| +| HUKS_PADDING_PSS | 2 | Probabilistic Signature Scheme (PSS)| +| HUKS_PADDING_PKCS1_V1_5 | 3 | PKCS1_V1_5| +| HUKS_PADDING_PKCS5 | 4 | Public Key Cryptography Standards (PKCS) #5| | HUKS_PADDING_PKCS7 | 5 | PKCS #7| ## HuksCipherMode @@ -149,12 +149,12 @@ Enumerates the cipher modes. | Name | Value | Description | | ------------- | ---- | --------------------- | -| HUKS_MODE_ECB | 1 | Electronic Code Block (ECB) mode | -| HUKS_MODE_CBC | 2 | Cipher Block Chaining (CBC) mode | -| HUKS_MODE_CTR | 3 | Counter (CTR) mode | -| HUKS_MODE_OFB | 4 | Output Feedback (OFB) mode | -| HUKS_MODE_CCM | 31 | Counter with CBC-MAC (CCM) mode | -| HUKS_MODE_GCM | 32 | Galois/Counter (GCM) mode | +| HUKS_MODE_ECB | 1 | Electronic Code Block (ECB) mode| +| HUKS_MODE_CBC | 2 | Cipher Block Chaining (CBC) mode| +| HUKS_MODE_CTR | 3 | Counter (CTR) mode| +| HUKS_MODE_OFB | 4 | Output Feedback (OFB) mode| +| HUKS_MODE_CCM | 31 | Counter with CBC-MAC (CCM) mode| +| HUKS_MODE_GCM | 32 | Galois/Counter (GCM) mode| ## HuksKeySize @@ -178,7 +178,7 @@ Enumerates the key sizes. | HUKS_AES_KEY_SIZE_192 | 196 | AES key of 196 bits | | HUKS_AES_KEY_SIZE_256 | 256 | AES key of 256 bits | | HUKS_AES_KEY_SIZE_512 | 512 | AES key of 512 bits | -| HUKS_CURVE25519_KEY_SIZE_256 | 256 | Curve25519 key of 256 bits | +| HUKS_CURVE25519_KEY_SIZE_256 | 256 | Curve25519 key of 256 bits| | HUKS_DH_KEY_SIZE_2048 | 2048 | DH key of 2048 bits | | HUKS_DH_KEY_SIZE_3072 | 3072 | DH key of 3072 bits | | HUKS_DH_KEY_SIZE_4096 | 4096 | DH key of 4096 bits | @@ -201,8 +201,8 @@ Enumerates the key algorithms. | HUKS_ALG_HKDF | 51 | HKDF | | HUKS_ALG_PBKDF2 | 52 | PBKDF2 | | HUKS_ALG_ECDH | 100 | ECDH | -| HUKS_ALG_X25519 | 101 | X25519 | -| HUKS_ALG_ED25519 | 102 | ED25519 | +| HUKS_ALG_X25519 | 101 | X25519 | +| HUKS_ALG_ED25519 | 102 | ED25519| | HUKS_ALG_DH | 103 | DH | | HUKS_ALG_SM29+ | 150 | SM2 | | HUKS_ALG_SM39+ | 151 | SM3 | @@ -228,10 +228,10 @@ Enumerates the key generation modes. | Name | Value | Description | | -------------------------- | ---- | ------------------------------------ | -| HUKS_KEY_FLAG_IMPORT_KEY | 1 | The key is imported by using an API. | -| HUKS_KEY_FLAG_GENERATE_KEY | 2 | The key is generated by using an API. | -| HUKS_KEY_FLAG_AGREE_KEY | 3 | The key is generated by using a key agreement API. | -| HUKS_KEY_FLAG_DERIVE_KEY | 4 | The key is derived by using an API. | +| HUKS_KEY_FLAG_IMPORT_KEY | 1 | The key is imported by using an API. | +| HUKS_KEY_FLAG_GENERATE_KEY | 2 | The key is generated by using an API. | +| HUKS_KEY_FLAG_AGREE_KEY | 3 | The key is generated by using a key agreement API.| +| HUKS_KEY_FLAG_DERIVE_KEY | 4 | The key is derived by using an API.| ## HuksKeyStorageType @@ -268,7 +268,7 @@ Enumerates the algorithm suites used when a wrapped key is imported. ## HuksImportKeyType9+ -Enumerates the types of the key to import. By default, a public key is imported. This field is not required when a symmetric key is imported. +Enumerates the types of keys to import. By default, a public key is imported. This field is not required when a symmetric key is imported. **System capability**: SystemCapability.Security.Huks @@ -276,7 +276,7 @@ Enumerates the types of the key to import. By default, a public key is imported. | ------------------------- | ---- | ------------------------------ | | HUKS_KEY_TYPE_PUBLIC_KEY | 0 | Public key | | HUKS_KEY_TYPE_PRIVATE_KEY | 1 | Private key | -| HUKS_KEY_TYPE_KEY_PAIR | 2 | Public and private key pair | +| HUKS_KEY_TYPE_KEY_PAIR | 2 | Public and private key pair| ## HuksTagType @@ -289,8 +289,8 @@ Enumerates the tag data types. | --------------------- | ------- | --------------------------------------- | | HUKS_TAG_TYPE_INVALID | 0 << 28 | Invalid tag type | | HUKS_TAG_TYPE_INT | 1 << 28 | Number of the int type | -| HUKS_TAG_TYPE_UINT | 2 << 28 | Number of the uint type | -| HUKS_TAG_TYPE_ULONG | 3 << 28 | bigint | +| HUKS_TAG_TYPE_UINT | 2 << 28 | Number of the uint type| +| HUKS_TAG_TYPE_ULONG | 3 << 28 | BigInt | | HUKS_TAG_TYPE_BOOL | 4 << 28 | Boolean | | HUKS_TAG_TYPE_BYTES | 5 << 28 | Uint8Array | @@ -321,8 +321,8 @@ Enumerates the tags used to invoke parameters. | HUKS_TAG_DERIVE_MAIN_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 16 | Main key for key derivation. | | HUKS_TAG_DERIVE_FACTOR | HuksTagType.HUKS_TAG_TYPE_BYTES \| 17 | Factor for key derivation. | | HUKS_TAG_DERIVE_ALG | HuksTagType.HUKS_TAG_TYPE_UINT \| 18 | Type of the algorithm used for key derivation. | -| HUKS_TAG_AGREE_ALG | HuksTagType.HUKS_TAG_TYPE_UINT \| 19 | Type of the algorithm used in key agreement. | -| HUKS_TAG_AGREE_PUBLIC_KEY_IS_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 20 | Alias of the public key during key agreement. | +| HUKS_TAG_AGREE_ALG | HuksTagType.HUKS_TAG_TYPE_UINT \| 19 | Type of the algorithm used for key agreement. | +| HUKS_TAG_AGREE_PUBLIC_KEY_IS_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 20 | Public key alias used in key agreement. | | HUKS_TAG_AGREE_PRIVATE_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BYTES \| 21 | Private key alias used in key agreement. | | HUKS_TAG_AGREE_PUBLIC_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 22 | Public key used in key agreement. | | HUKS_TAG_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BYTES \| 23 | Key alias. | @@ -342,8 +342,8 @@ Enumerates the tags used to invoke parameters. | HUKS_TAG_ATTESTATION_CHALLENGE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 501 | Challenge value used in the attestation. | | HUKS_TAG_ATTESTATION_APPLICATION_ID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 502 | Application ID used in the attestation. | | HUKS_TAG_ATTESTATION_ID_BRAND | HuksTagType.HUKS_TAG_TYPE_BYTES \| 503 | Device brand. | -| HUKS_TAG_ATTESTATION_ID_DEVICE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 504 | Device. | -| HUKS_TAG_ATTESTATION_ID_PRODUCT | HuksTagType.HUKS_TAG_TYPE_BYTES \| 505 | Product. | +| HUKS_TAG_ATTESTATION_ID_DEVICE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 504 | Device ID. | +| HUKS_TAG_ATTESTATION_ID_PRODUCT | HuksTagType.HUKS_TAG_TYPE_BYTES \| 505 | Product name of the device. | | HUKS_TAG_ATTESTATION_ID_SERIAL | HuksTagType.HUKS_TAG_TYPE_BYTES \| 506 | Device SN. | | HUKS_TAG_ATTESTATION_ID_IMEI | HuksTagType.HUKS_TAG_TYPE_BYTES \| 507 | Device IMEI. | | HUKS_TAG_ATTESTATION_ID_MEID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 508 | Device MEID. | @@ -352,7 +352,7 @@ Enumerates the tags used to invoke parameters. | HUKS_TAG_ATTESTATION_ID_ALIAS | HuksTagType.HUKS_TAG_TYPE_BYTES \| 511 | Key alias used in the attestation. | | HUKS_TAG_ATTESTATION_ID_SOCID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 512 | Device SOCID. | | HUKS_TAG_ATTESTATION_ID_UDID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 513 | Device UDID. | -| HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 514 | Security credential used for the attestation. | +| HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 514 | Security credential used in the attestation. | | HUKS_TAG_ATTESTATION_ID_VERSION_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 515 | Version information used in the attestation. | | HUKS_TAG_IS_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1001 | Whether to use the alias passed in during key generation.| | HUKS_TAG_KEY_STORAGE_FLAG | HuksTagType.HUKS_TAG_TYPE_UINT \| 1002 | Key storage mode. | @@ -801,12 +801,12 @@ async function TestImportWrappedKeyFunc( await TestExportFunc(wrappingAlias, genOptions); /*The following operations do not invoke the HUKS APIs, and the specific implementation is not provided here. - * For example, import keyA. - * 1. Use ECC to generate a public and private key pair keyB. The public key is keyB_pub, and the private key is keyB_pri. - * 2. Use keyB_pri and the public key obtained from wrappingAlias to negotiate the shared key share_key. - * 3. Randomly generate a key kek for encrypting keyA using AES-GCM. During the encryption, record nonce1/aad1/ciphertext keyA_enc/encrypted tag1. - * 4. Use the share_key to encrypt kek using AES-GCM. During the encryption, record nonce2/aad2/ciphertext kek_enc/encrypted tag2. - * 5. Generate the importOptions.inData field in the following format: + * For example, import **keyA**. + * 1. Use ECC to generate a public and private key pair **keyB**. The public key is **keyB_pub**, and the private key is **keyB_pri**. + * 2. Use **keyB_pri** and the public key obtained from **wrappingAlias** to negotiate the shared key **share_key**. + * 3. Randomly generate a key **kek** and use it to encrypt **keyA** with AES-GCM. During the encryption, record **nonce1**, **aad1**, ciphertext **keyA_enc**, and encrypted **tag1**. + * 4. Use **share_key** to encrypt **kek** with AES-GCM. During the encryption, record **nonce2**, ** aad2**, ciphertext **kek_enc**, and encrypted **tag2**. + * 5. Generate the **importOptions.inData** field in the following format: * keyB_pub length (4 bytes) + keyB_pub + aad2 length (4 bytes) + aad2 + * nonce2 length (4 bytes) + nonce2 + tag2 length (4 bytes) + tag2 + * kek_enc length (4 bytes) + kek_enc + aad1 length (4 bytes) + aad1 + diff --git a/en/application-dev/reference/apis/js-apis-inputdevice.md b/en/application-dev/reference/apis/js-apis-inputdevice.md index c1ec2c787a6f9e47c1c87715b5ea52171dbac85f..178313a1ff1a83a905895656793ff5977a486d0d 100644 --- a/en/application-dev/reference/apis/js-apis-inputdevice.md +++ b/en/application-dev/reference/apis/js-apis-inputdevice.md @@ -287,7 +287,7 @@ Defines the information about an input device. | Name | Type | Description | | -------- | ------------------------- | --------------------------------- | -| type | [ChangeType](#changetype) | Device change type, which indicates whether an input device is inserted or removed. | +| type | [ChangedType](#changedtype) | Device change type, which indicates whether an input device is inserted or removed. | | deviceId | number | Unique ID of the input device. If the same physical device is repeatedly inserted and removed, its ID changes.| ## InputDeviceData diff --git a/en/application-dev/reference/apis/js-apis-media.md b/en/application-dev/reference/apis/js-apis-media.md index 49f6e8f5ab16a3f6f28980204181f54a4e22c992..77002020139fbdb2aada0cb1141a0f2840a9f250 100644 --- a/en/application-dev/reference/apis/js-apis-media.md +++ b/en/application-dev/reference/apis/js-apis-media.md @@ -274,7 +274,7 @@ For details about the audio playback demo, see [Audio Playback Development](../. | Name | Type | Readable| Writable| Description | | ----------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ | -| src | string | Yes | Yes | Audio media URI. The mainstream audio formats (MPEG-4, AAC, MPEG-3, OGG, and WAV) are supported.
**Example of supported URIs**:
1. FD playback: fd://xx
![](figures/en-us_image_url.png)
2. HTTP network playback: http://xx
3. HLS network playback path (under development)
**Note**:
To use media materials, you must declare the read permission. Otherwise, the media materials cannot be played properly.| +| src | string | Yes | Yes | Audio media URI. The mainstream audio formats (MPEG-4, AAC, MPEG-3, OGG, and WAV) are supported.
**Example of supported URIs**:
1. FD playback: fd://xx
![](figures/en-us_image_url.png)
2. HTTP network playback: http://xx
3. HTTPS network playback: https://xx
**Note**:
To use media materials, you must declare the read permission. Otherwise, the media materials cannot be played properly.| | loop | boolean | Yes | Yes | Whether to loop audio playback. The value **true** means to loop audio playback, and **false** means the opposite. | | currentTime | number | Yes | No | Current audio playback position. | | duration | number | Yes | No | Audio duration. | @@ -501,7 +501,7 @@ Subscribes to the audio buffering update event. | Name | Type | Mandatory| Description | | -------- | -------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Type of the event to subscribe to, which is 'bufferingUpdate' in this example. | +| type | string | Yes | Event type, which is 'bufferingUpdate' in this case. | | callback | function | Yes | Callback invoked when the event is triggered.
When [BufferingInfoType](#bufferinginfotype8) is set to **BUFFERING_PERCENT** or **CACHED_DURATION**, **value** is valid. Otherwise, **value** is fixed at **0**.| **Example** @@ -525,7 +525,7 @@ Subscribes to the audio playback events. | Name | Type | Mandatory| Description | | -------- | ---------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Type of the event to subscribe to. The following events are supported: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange'
- The 'play' event is triggered when the [play()](#audioplayer_play) API is called and audio playback starts.
- The 'pause' event is triggered when the [pause()](#audioplayer_pause) API is called and audio playback is paused.
- The 'stop' event is triggered when the [stop()](#audioplayer_stop) API is called and audio playback stops.
- The 'reset' event is triggered when the [reset()](#audioplayer_reset) API is called and audio playback is reset.
- The 'dataLoad' event is triggered when the audio data is loaded, that is, when the **src** attribute is configured.
- The 'finish' event is triggered when the audio playback is finished.
- The 'volumeChange' event is triggered when the [setVolume()](#audioplayer_setvolume) API is called and the playback volume is changed.| +| type | string | Yes | Event type. The following events are supported:
- 'play': triggered when the [play()](#audioplayer_play) API is called and audio playback starts.
- 'pause': triggered when the [pause()](#audioplayer_pause) API is called and audio playback is paused.
- 'stop': triggered when the [stop()](#audioplayer_stop) API is called and audio playback stops.
- 'reset': triggered when the [reset()](#audioplayer_reset) API is called and audio playback is reset.
- 'dataLoad': triggered when the audio data is loaded, that is, when the **src** attribute is configured.
- 'finish': triggered when the audio playback is finished.
- 'volumeChange': triggered when the [setVolume()](#audioplayer_setvolume) API is called and the playback volume is changed. | | callback | () => void | Yes | Callback invoked when the event is triggered. | **Example** @@ -598,7 +598,7 @@ Subscribes to the 'timeUpdate' event. | Name | Type | Mandatory| Description | | -------- | ----------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Type of the event to subscribe to, which is 'timeUpdate' in this API.
The 'timeUpdate' event is triggered when the [seek()](#audioplayer_seek) API is called.| +| type | string | Yes | Event type, which is 'timeUpdate' in this case.
The 'timeUpdate' event is triggered when the [seek()](#audioplayer_seek) API is called.| | callback | Callback\ | Yes | Callback invoked when the event is triggered. The input parameter of the callback is the time when the seek operation is successful. | **Example** @@ -626,7 +626,7 @@ Subscribes to the audio playback error event. | Name | Type | Mandatory| Description | | -------- | ------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Type of the event to subscribe to, which is 'error' in this API.
The 'error' event is triggered when an error occurs during audio playback.| +| type | string | Yes | Event type, which is 'error' in this case.
The 'error' event is triggered when an error occurs during audio playback.| | callback | ErrorCallback | Yes | Callback invoked when the event is triggered. | **Example** @@ -656,7 +656,7 @@ Enumerates the audio playback states. You can obtain the state through the **sta ## VideoPlayer8+ -Provides APIs to manage and play video. Before calling an API of the **VideoPlayer** class, you must call [createVideoPlayer()](#mediacreatevideoplayer8) to create a [VideoPlayer](#videoplayer8) instance. +Provides APIs to manage and play video. Before calling an API of **VideoPlayer**, you must call [createVideoPlayer()](#mediacreatevideoplayer8) to create a [VideoPlayer](#videoplayer8) instance. For details about the video playback demo, see [Video Playback Development](../../media/video-playback.md). @@ -666,7 +666,7 @@ For details about the video playback demo, see [Video Playback Development](../. | Name | Type | Readable| Writable| Description | | ------------------------ | ---------------------------------- | ---- | ---- | ------------------------------------------------------------ | -| url8+ | string | Yes | Yes | Video media URL. The mainstream video formats (MPEG-4, MPEG-TS, WebM, and MKV) are supported.
**Example of supported URIs**:
1. FD playback: fd://xx
![](figures/en-us_image_url.png)
2. HTTP network playback: http://xx
3. HLS network playback path (under development)
**Note**:
To use media materials, you must declare the read permission. Otherwise, the media materials cannot be played properly.| +| url8+ | string | Yes | Yes | Video media URL. The mainstream video formats (MPEG-4, MPEG-TS, WebM, and MKV) are supported.
**Example of supported URIs**:
1. FD playback: fd://xx
![](figures/en-us_image_url.png)
2. HTTP network playback: http://xx
3. HTTPS network playback: https://xx
3. HLS network playback: http://xx or https://xx
**Note**:
To use media materials, you must declare the read permission. Otherwise, the media materials cannot be played properly.| | loop8+ | boolean | Yes | Yes | Whether to loop video playback. The value **true** means to loop video playback, and **false** means the opposite. | | currentTime8+ | number | Yes | No | Current video playback position. | | duration8+ | number | Yes | No | Video duration. The value **-1** indicates the live streaming mode. | @@ -1003,7 +1003,8 @@ Seeks to the specified playback position. The next key frame at the specified po **Example** ```js -videoPlayer.seek((seekTime, err) => { +let seekTime = 5000; +videoPlayer.seek(seekTime, (err, result) => { if (typeof (err) == 'undefined') { console.info('seek success!'); } else { @@ -1031,7 +1032,10 @@ Seeks to the specified playback position. This API uses a callback to return the **Example** ```js -videoPlayer.seek((seekTime, seekMode, err) => { +import media from '@ohos.multimedia.media' +let seekTime = 5000; +let seekMode = media.SeekMode.SEEK_NEXT_SYNC; +videoPlayer.seek(seekTime, seekMode, (err, result) => { if (typeof (err) == 'undefined') { console.info('seek success!'); } else { @@ -1064,6 +1068,7 @@ Seeks to the specified playback position. If **mode** is not specified, the next **Example** ```js +let seekTime = 5000; videoPlayer.seek(seekTime).then((seekDoneTime) => { // seekDoneTime indicates the position after the seek operation is complete. console.info('seek success'); }).catch((error) => { @@ -1095,7 +1100,8 @@ Sets the volume. This API uses a callback to return the result. **Example** ```js -videoPlayer.setVolume((vol, err) => { +let vol = 0.5; +videoPlayer.setVolume(vol, (err, result) => { if (typeof (err) == 'undefined') { console.info('setVolume success!'); } else { @@ -1127,6 +1133,7 @@ Sets the volume. This API uses a promise to return the result. **Example** ```js +let vol = 0.5; videoPlayer.setVolume(vol).then() => { console.info('setVolume success'); }).catch((error) => { @@ -1278,7 +1285,10 @@ Sets the video playback speed. This API uses a callback to return the result. **Example** ```js -videoPlayer.setSpeed((speed:number, err) => { +import media from '@ohos.multimedia.media' +let speed = media.PlaybackSpeed.SPEED_FORWARD_2_00_X; + +videoPlayer.setSpeed(speed, (err, result) => { if (typeof (err) == 'undefined') { console.info('setSpeed success!'); } else { @@ -1310,6 +1320,9 @@ Sets the video playback speed. This API uses a promise to return the result. **Example** ```js +import media from '@ohos.multimedia.media' +let speed = media.PlaybackSpeed.SPEED_FORWARD_2_00_X; + videoPlayer.setSpeed(speed).then() => { console.info('setSpeed success'); }).catch((error) => { @@ -1317,6 +1330,65 @@ videoPlayer.setSpeed(speed).then() => { }); ``` +### selectBitrate9+ + +selectBitrate(bitrate:number, callback: AsyncCallback\): void + +Selects a bit rate from available bit rates. This API uses a callback to return the result. The available bit rates can be obtained by calling [availableBitrateCollected](#on('availableBitrateCollected')9+). + +**System capability**: SystemCapability.Multimedia.Media.VideoPlayer + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | ---------------------------------------------------------- | +| bitrate | number | Yes | Bit rate to select, which is used in the HLS multi-bit rate scenario. The unit is bit/s. | +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the set value is returned, the operation is successful; otherwise, the operation fails.| + +**Example** + +```js +let bitrate = 1024000; +videoPlayer.selectBitrate(bitrate, (err, result) => { + if (typeof (err) == 'undefined') { + console.info('selectBitrate success!'); + } else { + console.info('selectBitrate fail!'); + } +}); +``` + +### selectBitrate9+ + +selectBitrate(bitrate:number): Promise\ + +Selects a bit rate from available bit rates. This API uses a promise to return the result. The available bit rates can be obtained by calling [availableBitrateCollected](#on('availableBitrateCollected')9+). + +**System capability**: SystemCapability.Multimedia.Media.VideoPlayer + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------ | ---- | -------------------------------------------- | +| bitrate | number | Yes | Bit rate to select, which is used in the HLS multi-bit rate scenario. The unit is bit/s.| + +**Return value** + +| Type | Description | +| ---------------- | ------------------------- | +| Promise\ | Promise used to return the result.| + +**Example** + +```js +let bitrate = 1024000; +videoPlayer.selectBitrate(bitrate).then() => { + console.info('selectBitrate success'); +}).catch((error) => { + console.info(`video catchCallback, error:${error.message}`); +}); +``` + ### on('playbackCompleted')8+ on(type: 'playbackCompleted', callback: Callback\): void @@ -1329,7 +1401,7 @@ Subscribes to the video playback completion event. | Name | Type | Mandatory| Description | | -------- | -------- | ---- | ----------------------------------------------------------- | -| type | string | Yes | Type of the event to subscribe to, which is 'playbackCompleted' in this example.| +| type | string | Yes | Event type, which is 'playbackCompleted' in this case.| | callback | function | Yes | Callback invoked when the event is triggered. | **Example** @@ -1352,7 +1424,7 @@ Subscribes to the video buffering update event. | Name | Type | Mandatory| Description | | -------- | -------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Type of the event to subscribe to, which is 'bufferingUpdate' in this example. | +| type | string | Yes | Event type, which is 'bufferingUpdate' in this case. | | callback | function | Yes | Callback invoked when the event is triggered.
When [BufferingInfoType](#bufferinginfotype8) is set to **BUFFERING_PERCENT** or **CACHED_DURATION**, **value** is valid. Otherwise, **value** is fixed at **0**.| **Example** @@ -1376,7 +1448,7 @@ Subscribes to the frame rendering start event. | Name | Type | Mandatory| Description | | -------- | --------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Type of the event to subscribe to, which is 'startRenderFrame' in this example.| +| type | string | Yes | Event type, which is 'startRenderFrame' in this case.| | callback | Callback\ | Yes | Callback invoked when the event is triggered. | **Example** @@ -1399,7 +1471,7 @@ Subscribes to the video width and height change event. | Name | Type | Mandatory| Description | | -------- | -------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Type of the event to subscribe to, which is 'videoSizeChanged' in this example.| +| type | string | Yes | Event type, which is 'videoSizeChanged' in this case.| | callback | function | Yes | Callback invoked when the event is triggered. **width** indicates the video width, and **height** indicates the video height. | **Example** @@ -1423,7 +1495,7 @@ Subscribes to the video playback error event. | Name | Type | Mandatory| Description | | -------- | ------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Type of the event to subscribe to, which is 'error' in this API.
The 'error' event is triggered when an error occurs during video playback.| +| type | string | Yes | Event type, which is 'error' in this case.
The 'error' event is triggered when an error occurs during video playback.| | callback | ErrorCallback | Yes | Callback invoked when the event is triggered. | **Example** @@ -1437,6 +1509,31 @@ videoPlayer.on('error', (error) => { // Set the 'error' event callback. videoPlayer.setVolume(3); // Set volume to an invalid value to trigger the 'error' event. ``` +### on('availableBitrateCollected')9+ + +on(type: 'availableBitrateCollected', callback: (bitrates: Array) => void): void + +Subscribes to the video playback bit rate reporting event. + +**System capability**: SystemCapability.Multimedia.Media.VideoPlayer + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------- | ---- | ------------------------------------------------------------ | +| type | string | Yes | Event type, which is 'availableBitrateCollected' in this case. This event is reported only once when the playback starts.| +| callback | function | Yes | Callback used to return supported bit rates, in an array. | + +**Example** + +```js +videoPlayer.on('availableBitrateCollected', (bitrates) => { + for (let i = 0; i < bitrates.length; i++) { + console.info('case availableBitrateCollected bitrates: ' + bitrates[i]); // Print bit rates. + } +}); +``` + ## VideoPlayState8+ Enumerates the video playback states. You can obtain the state through the **state** attribute. @@ -1512,7 +1609,7 @@ audioPlayer.getTrackDescription((error, arrlist) => { ## AudioRecorder -Implements audio recording. Before calling an API of the **AudioRecorder** class, you must call [createAudioRecorder()](#mediacreateaudiorecorder) to create an [AudioRecorder](#audiorecorder) instance. +Implements audio recording. Before calling an API of **AudioRecorder**, you must call [createAudioRecorder()](#mediacreateaudiorecorder) to create an [AudioRecorder](#audiorecorder) instance. For details about the audio recording demo, see [Audio Recording Development](../../media/audio-recorder.md). @@ -1530,7 +1627,7 @@ Prepares for recording. | Name| Type | Mandatory| Description | | ------ | ------------------------------------------- | ---- | ------------------------------------------------------------ | -| config | [AudioRecorderConfig](#audiorecorderconfig) | Yes | Audio recording parameters, including the audio output URI, [encoding format](#audioencoder), sampling rate, number of audio channels, and [output format](#audiooutputformat).| +| config | [AudioRecorderConfig](#audiorecorderconfig) | Yes | Audio recording parameters, including the audio output URI, encoding format, sampling rate, number of audio channels, and output format.| **Example** @@ -1668,7 +1765,7 @@ Subscribes to the audio recording events. | Name | Type | Mandatory| Description | | -------- | -------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Type of the event to subscribe to. The following events are supported: 'prepare'\|'start'\| 'pause' \| 'resume' \|'stop'\|'release'\|'reset'
- The 'prepare' event is triggered when the [prepare](#audiorecorder_prepare) API is called and the audio recording parameters are set.
- The 'start' event is triggered when the [start](#audiorecorder_start) API is called and audio recording starts.
- The 'pause' event is triggered when the [pause](#audiorecorder_pause) API is called and audio recording is paused.
- The 'resume' event is triggered when the [resume](#audiorecorder_resume) API is called and audio recording is resumed.
- The 'stop' event is triggered when the [stop](#audiorecorder_stop) API is called and audio recording stops.
- The 'release' event is triggered when the [release](#audiorecorder_release) API is called and the recording resource is released.
- The 'reset' event is triggered when the [reset](#audiorecorder_reset) API is called and audio recording is reset.| +| type | string | Yes | Event type. The following events are supported: 'prepare'\|'start'\| 'pause' \| 'resume' \|'stop'\|'release'\|'reset'
- The 'prepare' event is triggered when the [prepare](#audiorecorder_prepare) API is called and the audio recording parameters are set.
- The 'start' event is triggered when the [start](#audiorecorder_start) API is called and audio recording starts.
- The 'pause' event is triggered when the [pause](#audiorecorder_pause) API is called and audio recording is paused.
- The 'resume' event is triggered when the [resume](#audiorecorder_resume) API is called and audio recording is resumed.
- The 'stop' event is triggered when the [stop](#audiorecorder_stop) API is called and audio recording stops.
- The 'release' event is triggered when the [release](#audiorecorder_release) API is called and the recording resource is released.
- The 'reset' event is triggered when the [reset](#audiorecorder_reset) API is called and audio recording is reset.| | callback | ()=>void | Yes | Callback invoked when the event is triggered. | **Example** @@ -1726,7 +1823,7 @@ Subscribes to the audio recording error event. | Name | Type | Mandatory| Description | | -------- | ------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Type of the event to subscribe to, which is 'error' in this API.
The 'error' event is triggered when an error occurs during audio recording.| +| type | string | Yes | Event type, which is 'error' in this case.
The 'error' event is triggered when an error occurs during audio recording.| | callback | ErrorCallback | Yes | Callback invoked when the event is triggered. | **Example** @@ -1748,15 +1845,15 @@ Describes audio recording configurations. | Name | Type | Mandatory| Description | | --------------------- | --------------------------------------- | ---- | ------------------------------------------------------------ | -| audioEncoder | [AudioEncoder](#audioencoder) | No | Audio encoding format. The default value is **AAC_LC**. | +| audioEncoder(deprecated) | [AudioEncoder](#audioencoder) | No | Audio encoding format. The default value is **AAC_LC**.
**Note**: This parameter is deprecated since API version 8. Use **audioEncoderMime** instead. | | audioEncodeBitRate | number | No | Audio encoding bit rate. The default value is **48000**. | | audioSampleRate | number | No | Audio sampling rate. The default value is **48000**. | | numberOfChannels | number | No | Number of audio channels. The default value is **2**. | -| format | [AudioOutputFormat](#audiooutputformat) | No | Audio output format. The default value is **MPEG_4**. | +| format(deprecated) | [AudioOutputFormat](#audiooutputformat) | No | Audio output format. The default value is **MPEG_4**.
**Note**: This parameter is deprecated since API version 8. Use **fileFormat** instead. | | location | [Location](#location) | No | Geographical location of the recorded audio. | -| uri | string | Yes | Audio output URI. Supported: fd://xx (fd number)
![en-us_image_0000001164217678](figures/en-us_image_url.png)
The file must be created by the caller and granted with proper permissions.| -| audioEncoderMime | [CodecMimeType](#codecmimetype8) | No | Audio encoding format. | - +| uri | string | Yes | Audio output URI. Supported: fd://xx (fd number)
![](figures/en-us_image_url.png)
The file must be created by the caller and granted with proper permissions.| +| audioEncoderMime8+ | [CodecMimeType](#codecmimetype8) | No | Audio encoding format. | +| fileFormat8+ | [ContainerFormatType](#containerformattype8) | No | Audio encoding format. | ## AudioEncoder(deprecated) @@ -1773,13 +1870,13 @@ Enumerates the audio encoding formats. | AMR_NB | 1 | AMR-NB.
This API is defined but not implemented yet.| | AMR_WB | 2 | Adaptive Multi Rate-Wide Band Speech Codec (AMR-WB).
This API is defined but not implemented yet.| | AAC_LC | 3 | Advanced Audio Coding Low Complexity (AAC-LC).| -| HE_AAC | 4 | High-Efficiency Advanced Audio Coding (HE_AAC).
This API is defined but not implemented yet.| +| HE_AAC | 4 | High-Efficiency Advanced Audio Coding (HE_AAC).
This API is defined but not implemented yet.| ## AudioOutputFormat(deprecated) > **NOTE** -> This API is deprecated since API version 8. You are advised to use [ContainerFormatType ](#containerformattype8) instead. +> This API is deprecated since API version 8. You are advised to use [ContainerFormatType](#containerformattype8) instead. Enumerates the audio output formats. @@ -1805,7 +1902,7 @@ For details about the video recording demo, see [Video Recording Development](.. | Name | Type | Readable| Writable| Description | | ------------------ | -------------------------------------- | ---- | ---- | ---------------- | -| state8+ | [VideoRecordState](#videorecordstate9) | Yes | No | Video recording state.| +| state9+ | [VideoRecordState](#videorecordstate9) | Yes | No | Video recording state.| ### prepare9+ @@ -2346,7 +2443,7 @@ Subscribes to the video recording error event. | Name | Type | Mandatory| Description | | -------- | ------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Type of the event to subscribe to, which is 'error' in this API.
The 'error' event is triggered when an error occurs during video recording.| +| type | string | Yes | Event type, which is 'error' in this case.
The 'error' event is triggered when an error occurs during video recording.| | callback | ErrorCallback | Yes | Callback invoked when the event is triggered. | **Example** @@ -2388,7 +2485,7 @@ Describes the video recording parameters. | profile | [VideoRecorderProfile](#videorecorderprofile9) | Yes | Video recording profile. | | rotation | number | No | Rotation angle of the recorded video. | | location | [Location](#location) | No | Geographical location of the recorded video. | -| url | string | Yes | Video output URL. Supported: fd://xx (fd number)
![](figures/en-us_image_url.png)
The file must be created by the caller and granted with proper permissions.| +| url | string | Yes | Video output URL. Supported: fd://xx (fd number)
![](figures/en-us_image_url.png)
The file must be created by the caller and granted with proper permissions.| ## AudioSourceType9+ diff --git a/en/application-dev/reference/apis/js-apis-net-connection.md b/en/application-dev/reference/apis/js-apis-net-connection.md index 6e1eab82dbbd426d7e1facd48a0516d981658f28..ec63d11121dcd5138d11d7a2e1898833deaaf9c7 100644 --- a/en/application-dev/reference/apis/js-apis-net-connection.md +++ b/en/application-dev/reference/apis/js-apis-net-connection.md @@ -1,5 +1,6 @@ # Network Connection Management +The network connection management module provides basic network management capabilities. You can obtain the default active data network or the list of all active data networks, enable or disable the airplane mode, and obtain network capability information. > **NOTE** > @@ -79,7 +80,7 @@ Checks whether the default data network is activated. This API uses an asynchron ```js connection.hasDefaultNet(function (error, has) { console.log(JSON.stringify(error)) - console.log(has) + console.log('has: ' + has) }) ``` @@ -101,7 +102,7 @@ Checks whether the default data network is activated. This API uses a promise to ```js connection.hasDefaultNet().then(function (has) { - console.log(has) + console.log('has: ' + has) }) ``` @@ -167,7 +168,7 @@ Obtains connection properties of the network corresponding to given network hand | Name | Type | Mandatory| Description | | --------- | ------------------------------------------------------------ | ---- | ---------------- | -| netHandle | [NetHandle](#nethandle) | Yes | Network handle.| +| netHandle | [NetHandle](#nethandle) | Yes | Handle of the data network.| | callback | AsyncCallback\<[ConnectionProperties](#connectionproperties)> | Yes | Callback used to return the result. | **Example** @@ -195,7 +196,7 @@ Obtains connection properties of the network corresponding to **netHandle**. Thi | Name | Type | Mandatory| Description | | --------- | ----------------------- | ---- | ---------------- | -| netHandle | [NetHandle](#nethandle) | Yes | Network handle.| +| netHandle | [NetHandle](#nethandle) | Yes | Handle of the data network.| **Return Value** @@ -227,7 +228,7 @@ Obtains capability information of the network corresponding to **netHandle**. Th | Name | Type | Mandatory| Description | | --------- | --------------------------------------------------- | ---- | ---------------- | -| netHandle | [NetHandle](#nethandle) | Yes | Network handle.| +| netHandle | [NetHandle](#nethandle) | Yes | Handle of the data network.| | callback | AsyncCallback\<[NetCapabilities](#netcapabilities)> | Yes | Callback used to return the result. | **Example** @@ -255,7 +256,7 @@ Obtains capability information of the network corresponding to **netHandle**. Th | Name | Type | Mandatory| Description | | --------- | ----------------------- | ---- | ---------------- | -| netHandle | [NetHandle](#nethandle) | Yes | Network handle.| +| netHandle | [NetHandle](#nethandle) | Yes | Handle of the data network.| **Return Value** @@ -446,6 +447,105 @@ connection.getAddressesByName(host).then(function (addresses) { }) ``` + +## connection.enableAirplaneMode + +enableAirplaneMode(callback: AsyncCallback\): void + +Enables the airplane mode. This API uses an asynchronous callback to return the result. + +This is a system API. + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------- | ---- | ------------------ | +| callback | AsyncCallback\ | Yes | Callback used to return the result. | + +**Example** + +```js +connection.enableAirplaneMode(function (error) { + console.log(JSON.stringify(error)) +}) +``` + +## connection.enableAirplaneMode + +enableAirplaneMode(): Promise\ + +Enables the airplane mode. This API uses a promise to return the result. + +This is a system API. + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Return value** + +| Type | Description | +| ------------------------------------------- | ----------------------------- | +| Promise\ | Promise used to return the result.| + +**Example** + +```js +connection.enableAirplaneMode().then(function (error) { + console.log(JSON.stringify(error)) +}) +``` + + +## connection.disableAirplaneMode + +disableAirplaneMode(callback: AsyncCallback\): void + +Disables the airplane mode. This API uses an asynchronous callback to return the result. + +This is a system API. + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------- | ---- | ------------------ | +| callback | AsyncCallback\ | Yes | Callback used to return the result. | + +**Example** + +```js +connection.disableAirplaneMode(function (error) { + console.log(JSON.stringify(error)) +}) +``` + +## connection.disableAirplaneMode + +disableAirplaneMode(): Promise\ + +Disables the airplane mode. This API uses a promise to return the result. + +This is a system API. + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Return value** + +| Type | Description | +| ------------------------------------------- | ----------------------------- | +| Promise\ | Promise used to return the result.| + +**Example** + +```js +connection.disableAirplaneMode().then(function (error) { + console.log(JSON.stringify(error)) +}) +``` + + ## connection.createNetConnection createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection @@ -476,7 +576,7 @@ let netConnection = connection.createNetConnection() // Cellular network let netConnectionCellular = connection.createNetConnection({ netCapabilities: { - bearerTypes: [NetBearType.BEARER_CELLULAR] + bearerTypes: [connection.NetBearType.BEARER_CELLULAR] } }) ``` @@ -497,7 +597,7 @@ Registers a listener for **netAvailable** events. | Name | Type | Mandatory| Description | | -------- | ---------------------------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Event type. The value is fixed to **netAvailable**.
**netAvailable**: event indicating that the data network is available.| +| type | string | Yes | Event type. The value is fixed at **netAvailable**.
**netAvailable**: event indicating that the data network is available.| | callback | Callback\<[NetHandle](#nethandle)> | Yes | Callback used to return the result. | **Example** @@ -520,7 +620,7 @@ Registers a listener for **netCapabilitiesChange** events. | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Event type. The value is fixed to **netCapabilitiesChange**.
**netCapabilitiesChange**: event indicating that he network capabilities have changed.| +| type | string | Yes | Event type. The value is fixed at **netCapabilitiesChange**.
**netCapabilitiesChange**: event indicating that network capabilities have changed.| | callback | Callback<{ netHandle: [NetHandle](#nethandle), netCap: [NetCapabilities](#netcapabilities) }> | Yes | Callback used to return the result. | **Example** @@ -543,7 +643,7 @@ Registers a listener for **netConnectionPropertiesChange** events. | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Event type. The value is fixed to **netConnectionPropertiesChange**.
**netConnectionPropertiesChange**: event indicating that network connection properties have changed.| +| type | string | Yes | Event type. The value is fixed at **netConnectionPropertiesChange**.
**netConnectionPropertiesChange**: event indicating that network connection properties have changed.| | callback | Callback<{ netHandle: [NetHandle](#nethandle), connectionProperties: [ConnectionProperties](#connectionproperties) }> | Yes | Callback used to return the result. | **Example** @@ -566,7 +666,7 @@ Registers a listener for **netBlockStatusChange** events. | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Event type. The value is fixed to **netBlockStatusChange**.
**netBlockStatusChange**: event indicating a change in the network blocking status.| +| type | string | Yes | Event type. The value is fixed at **netBlockStatusChange**.
**netBlockStatusChange**: event indicating a change in the network blocking status.| | callback | Callback<{ netHandle: [NetHandle](#nethandle), blocked: boolean }> | Yes | Callback used to return the result. | **Example** @@ -589,7 +689,7 @@ Registers a listener for **netLost** events. | Name | Type | Mandatory| Description | | -------- | ---------------------------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Event type. The value is fixed to **netLost**.
netLost: event indicating that the network is interrupted or normally disconnected.| +| type | string | Yes | Event type. The value is fixed at **netLost**.
netLost: event indicating that the network is interrupted or normally disconnected.| | callback | Callback\<[NetHandle](#nethandle)> | Yes | Callback used to return the result. | **Example** @@ -613,7 +713,7 @@ Registers a listener for **netUnavailable** events. | Name | Type | Mandatory| Description | | -------- | --------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Event type. The value is fixed to **netUnavailable**.
**netUnavailable**: event indicating that the network is unavailable.| +| type | string | Yes | Event type. The value is fixed at **netUnavailable**.
**netUnavailable**: event indicating that the network is unavailable.| | callback | Callback\ | Yes | Callback used to return the result. | **Example** @@ -908,4 +1008,4 @@ Defines the network address. | ------- | ------ | ------------------------------ | | address | string | Network address. | | family | number | Address family identifier. The value is **1** for IPv4 and **2** for IPv6. The default value is **1**.| -| port | number | Port number. The value ranges from **0** to **65535**. | \ No newline at end of file +| port | number | Port number. The value ranges from **0** to **65535**. | diff --git a/en/application-dev/reference/apis/js-apis-observer.md b/en/application-dev/reference/apis/js-apis-observer.md index b68d1dc35be314220feb88ba2d67a3429ce75c58..a6fcacc4333ab0aa48dae7cd8b629e1e77bb399f 100644 --- a/en/application-dev/reference/apis/js-apis-observer.md +++ b/en/application-dev/reference/apis/js-apis-observer.md @@ -1,5 +1,7 @@ # Observer +The observer module provides event subscription management functions. You can register or unregister an observer that listens for the following events: network status change, signal status change, call status change, cellular data connection status, uplink and downlink data flow status of cellular data services, and SIM status change. + >**NOTE** > >The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -15,7 +17,7 @@ import observer from '@ohos.telephony.observer' on\(type: \'networkStateChange\', callback: Callback\): void; -Registers an observer for network status change events. This API uses an asynchronous callback to return the execution result. +Registers an observer for network status change events. This API uses an asynchronous callback to return the result. **Required permission**: ohos.permission.GET_NETWORK_INFO @@ -41,7 +43,7 @@ observer.on('networkStateChange', data =>{ on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callback\): void; -Registers an observer for network status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result. +Registers an observer for network status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **Required permission**: ohos.permission.GET_NETWORK_INFO @@ -68,9 +70,7 @@ observer.on('networkStateChange', {slotId: 0}, data =>{ off\(type: \'networkStateChange\', callback?: Callback\): void; -Unregisters the observer for network status change events. This API uses an asynchronous callback to return the execution result. - -**Required permission**: ohos.permission.GET_NETWORK_INFO +Unregisters the observer for network status change events. This API uses an asynchronous callback to return the result. >**NOTE** > @@ -101,7 +101,7 @@ observer.off('networkStateChange'); on\(type: \'signalInfoChange\', callback: Callback\>): void; -Registers an observer for signal status change events. This API uses an asynchronous callback to return the execution result. +Registers an observer for signal status change events. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -125,7 +125,7 @@ observer.on('signalInfoChange', data =>{ on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback\>): void; -Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result. +Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -150,7 +150,7 @@ observer.on('signalInfoChange', {slotId: 0}, data =>{ off\(type: \'signalInfoChange\', callback?: Callback\>): void; -Unregisters the observer for signal status change events. This API uses an asynchronous callback to return the execution result. +Unregisters the observer for signal status change events. This API uses an asynchronous callback to return the result. >**NOTE** > @@ -182,9 +182,7 @@ observer.off('signalInfoChange'); on(type: 'callStateChange', callback: Callback\<{ state: CallState, number: string }\>): void; -Registers an observer for call status change events. This API uses an asynchronous callback to return the execution result. - -**Required permission**: ohos.permission.READ_CALL_LOG +Registers an observer for call status change events. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -208,9 +206,7 @@ observer.on('callStateChange', value =>{ on(type: 'callStateChange', options: { slotId: number }, callback: Callback<{ state:CallState, number: string }>): void; -Registers an observer for call status change events. This API uses an asynchronous callback to return the execution result. - -**Required permission**: ohos.permission.READ_CALL_LOG +Registers an observer for call status change events. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -235,9 +231,7 @@ observer.on('callStateChange', {slotId: 0}, value =>{ off(type: 'callStateChange', callback?: Callback<{ state: CallState, number: string }>): void; -Unregisters the observer for call status change events. This API uses an asynchronous callback to return the execution result. - -**Required permission**: ohos.permission.READ_CALL_LOG +Unregisters the observer for call status change events. This API uses an asynchronous callback to return the result. >**NOTE** > @@ -269,7 +263,7 @@ observer.off('callStateChange'); on\(type: 'cellularDataConnectionStateChange', callback: Callback\<{ state: DataConnectState, network: RatType}\>\): void; -Registers an observer for connection status change events of the cellular data link. This API uses an asynchronous callback to return the result. +Registers an observer for connection status change events of the cellular data connection.This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -277,7 +271,7 @@ Registers an observer for connection status change events of the cellular data l | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Connection status change event of the cellular data link. | +| type | string | Yes | Connection status change event of the cellular data connection. | | callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | Yes | Callback used to return the result. For details, see [DataConnectState](js-apis-telephony-data.md#dataconnectstate) and [RadioTechnology](js-apis-radio.md#radiotechnology).| **Example** @@ -293,7 +287,7 @@ observer.on('cellularDataConnectionStateChange', value =>{ on\(type: 'cellularDataConnectionStateChange', options: { slotId: number }, callback: Callback\<{ state: DataConnectState, network: RatType }\>\): void; -Registers an observer for connection status change events of the cellular data link over the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Registers an observer for connection status change events of the cellular data connection over the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -301,7 +295,7 @@ Registers an observer for connection status change events of the cellular data l | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Connection status change event of the cellular data link. | +| type | string | Yes | Connection status change event of the cellular data connection. | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | Yes | Callback used to return the result. For details, see [DataConnectState](js-apis-telephony-data.md#dataconnectstate) and [RadioTechnology](js-apis-radio.md#radiotechnology).| @@ -318,7 +312,7 @@ observer.on('cellularDataConnectionStateChange', {slotId: 0}, value =>{ off\(type: 'cellularDataConnectionStateChange', callback?: Callback\<{ state: DataConnectState, network: RatType}\>\): void; -Unregisters the observer for connection status change events of the cellular data link. This API uses an asynchronous callback to return the result. +Unregisters the observer for connection status change events of the cellular data connection.This API uses an asynchronous callback to return the result. >**NOTE** > @@ -330,7 +324,7 @@ Unregisters the observer for connection status change events of the cellular dat | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Connection status change event of the cellular data link. | +| type | string | Yes | Connection status change event of the cellular data connection. | | callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | No | Callback used to return the result. For details, see [DataConnectState](js-apis-telephony-data.md#dataconnectstate) and [RadioTechnology](js-apis-radio.md#radiotechnology).| **Example** diff --git a/en/application-dev/reference/apis/js-apis-osAccount.md b/en/application-dev/reference/apis/js-apis-osAccount.md index 7135d5666d3884667c0d7dee8ac98d832bf410ab..e1dbb5f4a54b3936dc4b52e76ab5ad0fc0a39265 100644 --- a/en/application-dev/reference/apis/js-apis-osAccount.md +++ b/en/application-dev/reference/apis/js-apis-osAccount.md @@ -20,7 +20,7 @@ Obtains an **AccountManager** instance. **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | --------------------------------- | ------------------------ | | [AccountManager](#accountmanager) | Obtains an **AccountManager** instance.| @@ -92,7 +92,7 @@ This is a system API and cannot be called by third-party applications. | ------- | ------ | ---- | -------------------- | | localId | number | Yes | ID of the OS account to activate.| -**Return Value** +**Return value** | Type | Description | | :------------------ | :---------------------------------- | @@ -141,7 +141,7 @@ Checks whether multiple OS accounts are supported. This API uses a promise to re **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :--------------------- | :----------------------------------------------------------- | @@ -202,7 +202,7 @@ Checks whether an OS account is activated. This API uses a promise to return the | ------- | ------ | ---- | ------------ | | localId | number | Yes | ID of the target OS account.| -**Return Value** +**Return value** | Type | Description | | :--------------------- | :----------------------------------------------------------- | @@ -266,7 +266,7 @@ Checks whether the specified constraint is enabled for an OS account. This API u | localId | number | Yes | ID of the target OS account. | | constraint | string | Yes | [Constraint](#constraints) specified.| -**Return Value** +**Return value** | Type | Description | | :--------------------- | :----------------------------------------------------------- | @@ -316,7 +316,7 @@ Checks whether this OS account is a test account. This API uses a promise to ret **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :--------------------- | :----------------------------------------------------------- | @@ -400,7 +400,7 @@ Checks whether an OS account has been verified. This API uses a promise to retur | ------- | ------ | ---- | ------------------ | | localId | number | No | ID of the target OS account.| -**Return Value** +**Return value** | Type | Description | | :--------------------- | :----------------------------------------------------------- | @@ -467,7 +467,7 @@ This is a system API and cannot be called by third-party applications. | ------- | ------ | ---- | -------------------- | | localId | number | Yes | ID of the OS account to remove.| -**Return Value** +**Return value** | Type | Description | | :------------------ | :---------------------------------- | @@ -540,7 +540,7 @@ This is a system API and cannot be called by third-party applications. | constraints | Array<string> | Yes | List of [constraints](#constraints) to set or remove.| | enable | boolean | Yes | Set or remove constraints. The value **true** means to set constraints, and **false** means to remove constraints. | -**Return Value** +**Return value** | Type | Description | | :------------------ | :---------------------------------- | @@ -608,7 +608,7 @@ This is a system API and cannot be called by third-party applications. | localId | number | Yes | ID of the target OS account.| | localName | string | Yes | Account name to set. | -**Return Value** +**Return value** | Type | Description | | :------------------ | :---------------------------------- | @@ -663,7 +663,7 @@ Obtains the number of OS accounts created. This API uses a promise to return the **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -712,7 +712,7 @@ Obtains the ID of the OS account to which the current process belongs. This API **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -769,7 +769,7 @@ Obtains the OS account ID based on the process UID. This API uses a promise to r | ------ | ------ | ---- | --------- | | uid | number | Yes | Process UID.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -831,7 +831,7 @@ Obtains the OS account ID based on domain account information. This API uses a p | ---------- | --------------------------------------- | ---- | ------------ | | domainInfo | [DomainAccountInfo](#domainaccountinfo) | Yes | Domain account information.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -885,7 +885,7 @@ This is a system API and cannot be called by third-party applications. **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -946,7 +946,7 @@ Obtains all constraints enabled for an OS account. This API uses a promise to re | ------- | ------ | ---- | ------------ | | localId | number | Yes | ID of the target OS account.| -**Return Value** +**Return value** | Type | Description | | :--------------------------------- | :----------------------------------------------------------- | @@ -1004,7 +1004,7 @@ This is a system API and cannot be called by third-party applications. **Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS -**Return Value** +**Return value** | Type | Description | | :---------------------------------------------------------- | :----------------------------------------------------------- | @@ -1056,7 +1056,7 @@ Obtains information about all activated OS accounts. This API uses a promise to **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :--------------------------------- | :----------------------------------------------------------- | @@ -1122,7 +1122,7 @@ This is a system API and cannot be called by third-party applications. | localName | string | Yes | Name of the OS account to create.| | type | [OsAccountType](#osaccounttype) | Yes | Type of the OS account to create.| -**Return Value** +**Return value** | Type | Description | | :--------------------------------------------- | :----------------------------------------------------------- | @@ -1189,7 +1189,7 @@ This is a system API and cannot be called by third-party applications. | type | [OsAccountType](#osaccounttype) | Yes | Type of the OS account to create.| | domainInfo | [DomainAccountInfo](#domainaccountinfo) | Yes | Domain account information. | -**Return Value** +**Return value** | Type | Description | | :--------------------------------------------- | :----------------------------------------------------------- | @@ -1243,7 +1243,7 @@ Obtains information about the OS account to which the current process belongs. T **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :--------------------------------------------- | :----------------------------------------------------------- | @@ -1308,7 +1308,7 @@ This is a system API and cannot be called by third-party applications. | ------- | ------ | ---- | -------------------- | | localId | number | Yes | ID of the target OS account.| -**Return Value** +**Return value** | Type | Description | | :--------------------------------------------- | :----------------------------------------------------------- | @@ -1358,7 +1358,7 @@ Obtains the type of the OS account to which the current process belongs. This AP **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :--------------------------------------------- | :----------------------------------------------------------- | @@ -1411,7 +1411,7 @@ Obtains the ID of this distributed virtual device. This API uses a promise to re **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -1476,7 +1476,7 @@ This is a system API and cannot be called by third-party applications. | ------- | ------ | ---- | ------------ | | localId | number | Yes | ID of the target OS account.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -1547,7 +1547,7 @@ This is a system API and cannot be called by third-party applications. | localId | number | Yes | ID of the target OS account.| | photo | string | Yes | Profile photo information. | -**Return Value** +**Return value** | Type | Description | | :------------------ | :---------------------------------- | @@ -1609,7 +1609,7 @@ Obtains the OS account ID based on the SN. This API uses a promise to return the | ------------ | ------ | ---- | ---------- | | serialNumber | number | Yes | Account SN.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -1667,7 +1667,7 @@ Obtains the SN of an OS account based on the account ID. This API uses a promise | ------- | ------ | ---- | ------------ | | localId | number | Yes | ID of the target OS account.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -1787,7 +1787,7 @@ This is a system API and cannot be called by third-party applications. | ------- | ------ | ---- | ------------ | | uid | number | Yes | Process UID.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -1836,7 +1836,7 @@ This is a system API and cannot be called by third-party applications. **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -1898,7 +1898,7 @@ This is a system API and cannot be called by third-party applications. | localId | number | Yes | ID of the target OS account.| | constraint | string | Yes | Name of the [constraint](#constraints) to query.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | diff --git a/en/application-dev/reference/apis/js-apis-privacyManager.md b/en/application-dev/reference/apis/js-apis-privacyManager.md index e06a5536a8754922e0e82d14162296124f498665..42cf66fea697004eafe45bc775146e0aa77ce8ad 100644 --- a/en/application-dev/reference/apis/js-apis-privacyManager.md +++ b/en/application-dev/reference/apis/js-apis-privacyManager.md @@ -1,11 +1,11 @@ # Privacy Management -Provides APIs for privacy management, such as management of permission usage records. +The **PrivacyManager** module provides APIs for privacy management, such as management of permission usage records. > **NOTE** -> -> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. -> - The APIs of this module are system APIs and cannot be called by third-party applications. +> +> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module are system APIs and cannot be called by third-party applications. ## Modules to Import @@ -19,7 +19,6 @@ import privacyManager from '@ohos.privacyManager'; addPermissionUsedRecord(tokenID: number, permissionName: string, successCount: number, failCount: number): Promise<number> Adds a permission usage record when an application protected by the permission is called by another service or application. This API uses a promise to return the result. - The permission usage record includes the application identity of the invoker, name of the permission used, and number of successful and failed accesses to the application. **Required permissions**: ohos.permission.PERMISSION_USED_STATS (available only to system applications) @@ -41,10 +40,6 @@ The permission usage record includes the application identity of the invoker, na | :------------ | :---------------------------------- | | Promise<number> | Promise used to return the result. If **0** is returned, the record is added successfully. If **-1** is returned, the record fails to be added.| -``` - -``` - **Example** ```js @@ -59,7 +54,6 @@ privacyManager.addPermissionUsedRecord(tokenID, "ohos.permission.PERMISSION_USED addPermissionUsedRecord(tokenID: number, permissionName: string, successCount: number, failCount: number, callback: AsyncCallback<number>): void Adds a permission usage record when an application protected by the permission is called by another service or application. This API uses an asynchronous callback to return the result. - The permission usage record includes the application identity of the invoker, name of the permission used, and number of successful and failed accesses to the application. **Required permissions**: ohos.permission.PERMISSION_USED_STATS (available only to system applications) @@ -202,7 +196,7 @@ Represents the permission usage records of all applications. ## BundleUsedRecord -Represents the application access records of an application. +Represents the permission access records of an application. **System capability**: SystemCapability.Security.AccessToken @@ -212,11 +206,11 @@ Represents the application access records of an application. | isRemote | boolean | No | Whether the token ID belongs to a remote device. The default value is **false**.| | deviceId | string | No | ID of the device hosting the target application. | | bundleName | string | No | Bundle name of the target application.| -| permissionRecords | Array<[PermissionUsedRecord](#PermissionUsedRecord)> | No | Permission usage records of the specified application obtained. | +| permissionRecords | Array<[PermissionUsedRecord](#PermissionUsedRecord)> | No | Permission usage records of the target application. | ## PermissionUsedRecord -Represents the access records of a permission. +Represents the usage records of a permission. **System capability**: SystemCapability.Security.AccessToken @@ -225,8 +219,8 @@ Represents the access records of a permission. | permissionName | string | No | Name of the permission. | | accessCount | number | No | Total number of times that the permission is accessed.| | rejectCount | number | No | Total number of times that the access to the permission is rejected.| -| lastAccessTime | number | No | Last time when the permission was accessed, in ms.| -| lastRejectTime | number | No | Last time when the access to the permission was rejected, in ms.| +| lastAccessTime | number | No | Last time when the permission was accessed, accurate to ms.| +| lastRejectTime | number | No | Last time when the access to the permission was rejected, accurate to ms.| | lastAccessDuration | number | No | Last access duration, in ms.| | accessRecords | Array<[UsedRecordDetail](#usedrecorddetail)> | No | Access records. This parameter is valid only when **flag** is **FLAG_PERMISSION_USAGE_SUMMARY**. By default, 10 records are provided. | | rejectRecords | Array<[UsedRecordDetail](#usedrecorddetail)> | No | Rejected records. This parameter is valid only when **flag** is **FLAG_PERMISSION_USAGE_SUMMARY**. By default, 10 records are provided. | diff --git a/en/application-dev/reference/apis/js-apis-process.md b/en/application-dev/reference/apis/js-apis-process.md index e73c4fe303ebeaac19274d5214085fb8646fa651..e6f796d1a08c0bce209a84e2999dcbf4f3b6a78c 100755 --- a/en/application-dev/reference/apis/js-apis-process.md +++ b/en/application-dev/reference/apis/js-apis-process.md @@ -92,7 +92,7 @@ This is a system API and cannot be called by third-party applications. ```js var child = process.runCmd('ls'); var result = child.wait(); -child.getOutput.then(val=>{ +child.getOutput().then(val=>{ console.log("child.getOutput = " + val); }) ``` @@ -119,7 +119,7 @@ This is a system API and cannot be called by third-party applications. ```js var child = process.runCmd('madir test.text'); var result = child.wait(); -child.getErrorOutput.then(val=>{ +child.getErrorOutput().then(val=>{ console.log("child.getErrorOutput= " + val); }) ``` @@ -286,7 +286,7 @@ Obtains the thread priority based on the specified TID. **Example** ```js -var tid = process.getTid(); +var tid = process.tid; var pres = process.getThreadPriority(tid); ``` @@ -617,5 +617,5 @@ Sends a signal to the specified process to terminate it. ```js var pres = process.pid -var result = that.kill(28, pres) +var result = process.kill(28, pres) ``` diff --git a/en/application-dev/reference/apis/js-apis-radio.md b/en/application-dev/reference/apis/js-apis-radio.md index b8cbdcc23c001aa24aebe7dfaae2ca06a0fae706..5b371ea07267732eb69de7676cab7f6057954275 100644 --- a/en/application-dev/reference/apis/js-apis-radio.md +++ b/en/application-dev/reference/apis/js-apis-radio.md @@ -1,5 +1,7 @@ # Radio +The radio module provides basic network search management functions. You can obtain the radio access technology (RAT) used in the CS and PS domains, network status, current network selection mode, ISO country code of the registered network, ID of the slot in which the primary card is located, list of signal strengths of the registered network, carrier name, and IMEI, MEID, and unique device ID of the SIM card in the specified slot. Besides, you can check whether the current device supports 5G\(NR\) and whether the radio service is enabled on the primary SIM card. + >**NOTE** > >The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -15,7 +17,7 @@ import radio from '@ohos.telephony.radio' getRadioTech\(slotId: number, callback: AsyncCallback<\{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology\}\>\): void -Obtains the radio access technology (RAT) used by the CS and PS domains for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains the RAT used in the CS and PS domains for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **Required permission**: ohos.permission.GET_NETWORK_INFO @@ -42,7 +44,7 @@ radio.getRadioTech(slotId, (err, data) =>{ getRadioTech\(slotId: number\): Promise<\{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology\}\> -Obtains the RAT used by the CS and PS domains for the SIM card in the specified slot. This API uses a promise to return the result. +Obtains the RAT used in the CS and PS domains for the SIM card in the specified slot. This API uses a promise to return the result. **Required permission**: ohos.permission.GET_NETWORK_INFO @@ -573,7 +575,7 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | --------------------- | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| -| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. | **Example** @@ -607,7 +609,7 @@ This is a system API. | Type | Description | | --------------- | ------------------------------- | -| Promise\ | Promise that returns no value. | +| Promise\ | Promise used to return the result.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-request.md b/en/application-dev/reference/apis/js-apis-request.md index 98ff862ea6932d76bed8ba8a8de4a9b452e54a11..50c50f574bbcad706077725e3b4c6f69f3334b1c 100644 --- a/en/application-dev/reference/apis/js-apis-request.md +++ b/en/application-dev/reference/apis/js-apis-request.md @@ -1,7 +1,10 @@ # Upload and Download +The **request** module provides applications with basic upload, download, and background transmission agent capabilities. -> **NOTE**
The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> **NOTE** +> +> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import @@ -17,14 +20,16 @@ import request from '@ohos.request'; HTTPS is supported by default. To support HTTP, you need to add **network** to the **config.json** file and set the **cleartextTraffic** attribute to **true**. ``` +var config = { "deviceConfig": { "default": { "network": { "cleartextTraffic": true } - ... + //... } } +} ``` @@ -37,9 +42,9 @@ HTTPS is supported by default. To support HTTP, you need to add **network** to t | Name | Type | Readable | Writable | Description | | -------- | -------- | -------- | -------- | -------- | | NETWORK_MOBILE | number | Yes | No | Whether download is allowed when the cellular network is used. | -| NETWORK_WIFI | number | Yes | No | Whether download is allowed when the WLAN is used. | +| NETWORK_WIFI | number | Yes | No | Whether download is allowed on a WLAN. | | ERROR_CANNOT_RESUME7+ | number | Yes | No | Failure to resume the download due to an error. | -| ERROR_DEVICE_NOT_FOUND7+ | number | Yes | No | Failure to find a storage device such as an SD card. | +| ERROR_DEVICE_NOT_FOUND7+ | number | Yes | No | Failure to find a storage device such as a memory card. | | ERROR_FILE_ALREADY_EXISTS7+ | number | Yes | No | Failure to download the file because it already exists. | | ERROR_FILE_ERROR7+ | number | Yes | No | File operation failure. | | ERROR_HTTP_DATA_ERROR7+ | number | Yes | No | HTTP transmission failure. | @@ -47,7 +52,7 @@ HTTPS is supported by default. To support HTTP, you need to add **network** to t | ERROR_TOO_MANY_REDIRECTS7+ | number | Yes | No | Error caused by too many network redirections. | | ERROR_UNHANDLED_HTTP_CODE7+ | number | Yes | No | Unidentified HTTP code. | | ERROR_UNKNOWN7+ | number | Yes | No | Unknown error. | -| PAUSED_QUEUED_FOR_WIFI7+ | number | Yes | No | Download paused and queuing for WLAN connection, because the file size exceeds the maximum value allowed by a cellular network session. | +| PAUSED_QUEUED_FOR_WIFI7+ | number | Yes | No | Download paused and queuing for a WLAN connection, because the file size exceeds the maximum value allowed by a cellular network session. | | PAUSED_UNKNOWN7+ | number | Yes | No | Download paused due to unknown reasons. | | PAUSED_WAITING_FOR_NETWORK7+ | number | Yes | No | Download paused due to a network connection problem, for example, network disconnection. | | PAUSED_WAITING_TO_RETRY7+ | number | Yes | No | Download paused and then retried. | @@ -151,7 +156,7 @@ Subscribes to the upload progress event. This API uses an asynchronous callback | type | string | Yes | Type of the event to subscribe to. The value is **progress** (upload progress). | | callback | function | Yes | Callback for the upload progress event. | -Parameters of the callback function +**callback** parameters | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | @@ -182,10 +187,10 @@ Subscribes to the **headerReceive** event, which is triggered when an HTTP respo | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | -| type | string | Yes | Type of the event to subscribe to. The value is **headerReceive** (response header). | +| type | string | Yes | Type of the event to subscribe to. The value is **'headerReceive'** (response header). | | callback | function | Yes | Callback for the HTTP Response Header event. | -Parameters of the callback function +**callback** parameters | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | @@ -215,10 +220,10 @@ Unsubscribes from the upload progress event. This API uses an asynchronous callb | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | -| type | string | Yes | Type of the event to unsubscribe from. The value is **progress** (upload progress). | +| type | string | Yes | Type of the event to unsubscribe from. The value is **'progress'** (upload progress). | | callback | function | No | Callback for the upload progress event. | -Parameters of the callback function +**callback** parameters | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | @@ -249,10 +254,10 @@ Unsubscribes from the **headerReceive** event. This API uses an asynchronous cal | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | -| type | string | Yes | Type of the event to unsubscribe from. The value is **headerReceive** (response header). | +| type | string | Yes | Type of the event to unsubscribe from. The value is **'headerReceive'** (response header). | | callback | function | No | Callback for the HTTP Response Header event. | -Parameters of the callback function +**callback** parameters | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | @@ -340,7 +345,7 @@ Removes this upload task. This API uses an asynchronous callback to return the r | -------- | -------- | -------- | -------- | | url | string | Yes | Resource URL. | | header | object | Yes | HTTP or HTTPS header added to an upload request. | -| method | string | Yes | Request methods available: **POST** and **PUT**. The default value is **POST**. | +| method | string | Yes | Request method, which can be **POST** or **PUT**. The default value is **POST**. | | files | Array<[File](#file)> | Yes | List of files to upload, which is submitted through **multipart/form-data**. | | data | Array<[RequestData](#requestdata)> | Yes | Form data in the request body. | @@ -452,10 +457,10 @@ Subscribes to the download progress event. This API uses an asynchronous callbac | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | -| type | string | Yes | Type of the event to subscribe to. The value is **progress** (download progress). | +| type | string | Yes | Type of the event to subscribe to. The value is **'progress'** (download progress). | | callback | function | Yes | Callback for the download progress event. | -Parameters of the callback function +**callback** parameters | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | @@ -465,11 +470,10 @@ Parameters of the callback function **Example** ```js - downloadTask.on('progress', function download_callback(receivedSize, totalSize) { + downloadTask.on('progress', function download_callback(receivedSize, totalSize) { console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize); } ); - }); ``` @@ -487,10 +491,10 @@ Unsubscribes from the download progress event. This API uses an asynchronous cal | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | -| type | string | Yes | Type of the event to unsubscribe from. The value is **progress** (download progress). | +| type | string | Yes | Type of the event to unsubscribe from. The value is **'progress'** (download progress). | | callback | function | No | Callback for the download progress event. | -Parameters of the callback function +**callback** parameters | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | @@ -500,11 +504,10 @@ Parameters of the callback function **Example** ```js - downloadTask .off('progress', function download_callback(receivedSize, totalSize) { - console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize); - } + downloadTask .off('progress', function download_callback(receivedSize, totalSize) { + console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize); + } ); - }); ``` @@ -522,17 +525,16 @@ Subscribes to a download event. This API uses an asynchronous callback to return | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | -| type | string | Yes | Event type.
- **complete**: download task completion event.
- **pause**: download task pause event.
- **remove**: download task removal event. | +| type | string | Yes | Event type.
- **'complete'**: download task completion event.
- **'pause'**: download task pause event.
- **'remove'**: download task removal event. | | callback | function | Yes | Callback used to return the result. | **Example** ```js - downloadTask.on('complete', function callback() { - console.info('Download task completed.'); - } + downloadTask.on('complete', function callback() { + console.info('Download task completed.'); + } ); - }); ``` @@ -550,17 +552,16 @@ Unsubscribes from the download event. This API uses an asynchronous callback to | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | -| type | string | Yes | Event type.
- **complete**: download task completion event.
- **pause**: download task pause event.
- **remove**: download task removal event. | +| type | string | Yes | Event type.
- **'complete'**: download task completion event.
- **'pause'**: download task pause event.
- **'remove'**: download task removal event. | | callback | function | No | Callback used to return the result. | **Example** ```js - downloadTask.off('complete', function callback() { - console.info('Download task completed.'); - } + downloadTask.off('complete', function callback() { + console.info('Download task completed.'); + } ); - }); ``` @@ -578,10 +579,10 @@ Subscribes to the download task failure event. This API uses an asynchronous cal | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | -| type | string | Yes | Type of the subscribed event. The value is **fail** (download failure). | +| type | string | Yes | Type of the subscribed event. The value is **'fail'** (download failure). | | callback | function | Yes | Callback for the download task failure event. | -Parameters of the callback function +**callback** parameters | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | @@ -590,11 +591,10 @@ Parameters of the callback function **Example** ```js - downloadTask.on('fail', function callBack(err) { - console.info('Download task failed. Cause:' + err); - } + downloadTask.on('fail', function callBack(err) { + console.info('Download task failed. Cause:' + err); + } ); - }); ``` @@ -612,10 +612,10 @@ Unsubscribes from the download task failure event. This API uses an asynchronous | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | -| type | string | Yes | Type of the event to unsubscribe from. The value is **fail** (download failure). | +| type | string | Yes | Type of the event to unsubscribe from. The value is **'fail'** (download failure). | | callback | function | No | Callback for the download task failure event. | -Parameters of the callback function +**callback** parameters | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | @@ -624,11 +624,10 @@ Parameters of the callback function **Example** ```js - downloadTask.off('fail', function callBack(err) { - console.info('Download task failed. Cause:' + err); - } + downloadTask.off('fail', function callBack(err) { + console.info('Download task failed. Cause:' + err); + } ); - }); ``` @@ -948,7 +947,7 @@ Resumes this download task. This API uses an asynchronous callback to return the | enableMetered | boolean | No | Download allowed in metered connections. | | enableRoaming | boolean | No | Download allowed on a roaming network. | | description | string | No | Description of the download session. | -| filePath7+ | string | No | Download path. (The default path is [ERROR:Invalid link:en-us_topic_0000001135742582.xml#xref8132147102215,link:en-us_topic_0000001127125012.xml#section1856519365229](en-us_topic_0000001127125012.xml#section1856519365229)).
- filePath:'workspace/test.txt': The **workspace** directory is created in the default path to store files.
- filePath:'test.txt': Files are stored in the default path.
- filePath:'workspace/': The **workspace** directory is created in the default path to store files. | +| filePath7+ | string | No | Download path. (The default path is **'internal://cache/'**.
- filePath:'workspace/test.txt': The **workspace** directory is created in the default path to store files.
- filePath:'test.txt': Files are stored in the default path.
- filePath:'workspace/': The **workspace** directory is created in the default path to store files. | | networkType | number | No | Network type allowed for download. | | title | string | No | Title of the download session. | diff --git a/en/application-dev/reference/apis/js-apis-resource-manager.md b/en/application-dev/reference/apis/js-apis-resource-manager.md index 335e31cdb21bacd975db26b726f503c0a44e431d..b863c6189f1c4d89bf5b7ccb7fd3dc887992ec03 100644 --- a/en/application-dev/reference/apis/js-apis-resource-manager.md +++ b/en/application-dev/reference/apis/js-apis-resource-manager.md @@ -1141,7 +1141,7 @@ Obtains the string corresponding to the specified resource name. This API return resourceManager.getStringByNameSync("test"); ``` - ### getBoolean9+ +### getBoolean9+ getBoolean(resId: number): boolean @@ -1187,7 +1187,7 @@ Obtains the Boolean result corresponding to the specified resource name. This AP resourceManager.getBooleanByName("boolean_test"); ``` - ### getNumber9+ +### getNumber9+ getNumber(resId: number): number diff --git a/en/application-dev/reference/apis/js-apis-screenshot.md b/en/application-dev/reference/apis/js-apis-screenshot.md index 5e2d47e03ba31ab4bae9118e3dc373359d56da11..7f83f0250c209dbd6b5d57970fe7beb8d9b9a494 100644 --- a/en/application-dev/reference/apis/js-apis-screenshot.md +++ b/en/application-dev/reference/apis/js-apis-screenshot.md @@ -1,5 +1,5 @@ # Screenshot -Provides APIs for you to set information such as the region to capture and the size of the screen region when capturing a screen. +The **Screenshot** module provides APIs for you to set information such as the region to capture and the size of the screen region when capturing a screen. > **NOTE** > @@ -57,7 +57,7 @@ Describes the size of the screen region to capture. save(options?: ScreenshotOptions, callback: AsyncCallback<image.PixelMap>): void -Takes a screenshot and saves it as a **PixelMap** object. This method uses a callback to return the result. +Takes a screenshot and saves it as a **PixelMap** object. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.WindowManager.WindowManager.Core @@ -67,7 +67,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a cal | Name | Type | Mandatory| Description | | -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | -| options | [ScreenshotOptions](#screenshotoptions) | No | Consists of **screenRect**, **imageSize**, **rotation**, and **displayId**. You can set them separately.| +| options | [ScreenshotOptions](#screenshotoptions) | No | Screenshot settings consist of **screenRect**, **imageSize**, **rotation**, and **displayId**. You can set the parameters separately.| | callback | AsyncCallback<image.PixelMap> | Yes | Callback used to return a **PixelMap** object. | **Example** @@ -98,7 +98,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a cal save(options?: ScreenshotOptions): Promise<image.PixelMap> -Takes a screenshot and saves it as a **PixelMap** object. This method uses a promise to return the result. +Takes a screenshot and saves it as a **PixelMap** object. This API uses a promise to return the result. **System capability**: SystemCapability.WindowManager.WindowManager.Core @@ -108,7 +108,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a pro | Name | Type | Mandatory| Description | | ------- | --------------------------------------- | ---- | ------------------------------------------------------------ | -| options | [ScreenshotOptions](#screenshotoptions) | No | Consists of **screenRect**, **imageSize**, **rotation**, and **displayId**. You can set them separately.| +| options | [ScreenshotOptions](#screenshotoptions) | No | Screenshot settings consist of **screenRect**, **imageSize**, **rotation**, and **displayId**. You can set the parameters separately.| **Return value** diff --git a/en/application-dev/reference/apis/js-apis-securityLabel.md b/en/application-dev/reference/apis/js-apis-securityLabel.md index af95f639fb37abde380aff285b7cbea7417935c8..86ae51122132f39ce30fe8df4bebc626c8e07d3f 100644 --- a/en/application-dev/reference/apis/js-apis-securityLabel.md +++ b/en/application-dev/reference/apis/js-apis-securityLabel.md @@ -3,7 +3,7 @@ > **NOTE**
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. -Manages file data security levels, including obtaining and setting file data security levels. +The **secuityLabel** module provides APIs to manage file data security levels, including obtaining and setting file data security levels. ## Modules to Import @@ -13,12 +13,15 @@ import securityLabel from '@ohos.securityLabel'; ## Usage -Before using the APIs provided by this module to perform operations on a file or directory, obtain the path of the application sandbox. For details, see [getOrCreateLocalDir of the Context module](js-apis-Context.md). +Before using the APIs provided by this module to perform operations on a file or directory, obtain the path of the application sandbox as follows: ```js import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -let path = context.getFilesDir(); +let path = ''; +context.getFilesDir().then((data) => { + path = data; +}) ``` ## securityLabel.setSecurityLabel diff --git a/en/application-dev/reference/apis/js-apis-settings.md b/en/application-dev/reference/apis/js-apis-settings.md index 73be3dd9605235802e6bcd78992ff47d6cd1c469..a546ee0cc3fc95d286b1f2a835998426372c874a 100644 --- a/en/application-dev/reference/apis/js-apis-settings.md +++ b/en/application-dev/reference/apis/js-apis-settings.md @@ -1,16 +1,15 @@ # Settings +This module provides APIs for setting data items. + > **NOTE** > > The initial APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. -This module provides APIs for setting data items. - - ## Modules to Import -```typescript +```ts import settings from '@ohos.settings'; ``` @@ -28,7 +27,8 @@ Obtains the URI of a data item. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| name | string | Yes| Name of the target data item. Data items can be classified as follows:
  • Existing data items in the database, for example:
    • Brightness: settings.display.SCREEN_BRIGHTNESS_STATUS
    • Time format: settings.date.TIME_FORMAT
  • Custom data items
| +| settings.display.SCREEN_BRIGHTNESS_STATUS | string | Yes| Brightness of the target data item.| +| settings.date.TIME_FORMAT | string | Yes| Time format of the target data item. Data | **Return value** @@ -38,7 +38,7 @@ Obtains the URI of a data item. **Example** -```typescript +```ts // Obtain the URI of a data item. let urivar = settings.getUriSync(settings.display.SCREEN_BRIGHTNESS_STATUS); ``` @@ -67,7 +67,7 @@ Obtains the value of a data item. **Example** -```typescript +```ts import featureAbility from '@ohos.ability.featureAbility'; // Obtain the value of settings.display.SCREEN_BRIGHTNESS_STATUS (this data item already exists in the database). @@ -95,7 +95,7 @@ If the specified data item exists in the database, the **setValueSync** method u | -------- | -------- | -------- | -------- | | dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | Yes| **DataAbilityHelper** class.| | name | string | Yes| Name of the target data item. Data items can be classified as follows:
  • Existing data items in the database, for example:
    • Brightness: **settings.display.SCREEN_BRIGHTNESS_STATUS**
    • Time format: **settings.date.TIME_FORMAT**
  • Custom data items
| -| value | string | Yes| Value of the data item.| +| value | string | Yes| Value of the data item.The value of range with the service.| **Return value** @@ -105,7 +105,7 @@ If the specified data item exists in the database, the **setValueSync** method u **Example** -```typescript +```ts import featureAbility from '@ohos.ability.featureAbility'; // Update the value of settings.display.SCREEN_BRIGHTNESS_STATUS. (As this data item exists in the database, the setValueSync diff --git a/en/application-dev/reference/apis/js-apis-sim.md b/en/application-dev/reference/apis/js-apis-sim.md index acad2c7f0223074ef134389ddeac17b8f8d47455..41a4cfc71c77ff92c77b4b16ed19de9af6395bd3 100644 --- a/en/application-dev/reference/apis/js-apis-sim.md +++ b/en/application-dev/reference/apis/js-apis-sim.md @@ -1,5 +1,7 @@ # SIM Management +The SIM management module provides basic SIM card management functions. You can obtain the name, number, ISO country code, home PLMN number, service provider name, SIM card status, type, installation status, activation status, and lock status of the SIM card in the specified slot. Besides, you can set the name, number, and lock status of the SIM card, activate or deactivate the SIM card, and change the PIN or unlock the PIN or PUK of the SIM card. + >**NOTE** > >The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -520,7 +522,7 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | --------------------------------------------------- | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| -| callback | AsyncCallback\<[IccAccountInfo](#IccAccountInfo7)\> | Yes | Callback used to return the result. For details, see [IccAccountInfo](#IccAccountInfo7).| +| callback | AsyncCallback\<[IccAccountInfo](#IccAccountInfo7)\> | Yes | Callback used to return the result. | **Example** @@ -672,7 +674,7 @@ This is a system API. | Type | Description | | -------------- | ------------------------------- | -| Promise\ | Promise that returns no value. | +| Promise\ | Promise used to return the result. | **Example** @@ -737,7 +739,7 @@ This is a system API. | Type | Description | | -------------- | ------------------------------- | -| Promise\ | Promise that returns no value. | +| Promise\ | Promise used to return the result. | **Example** @@ -867,7 +869,7 @@ This is a system API. | Type | Description | | -------------- | ------------------------------- | -| Promise\ | Promise that returns no value. | +| Promise\ | Promise used to return the result. | **Example** @@ -994,7 +996,7 @@ This is a system API. | Type | Description | | -------------- | ------------------------------- | -| Promise\ | Promise that returns no value. | +| Promise\ | Promise used to return the result. | **Example** @@ -1057,7 +1059,7 @@ This is a system API. | Type | Description | | -------------- | ------------------------------- | -| Promise\ | Promise that returns no value. | +| Promise\ | Promise used to return the result.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-sms.md b/en/application-dev/reference/apis/js-apis-sms.md index 11fdf806794469274ea30ee3b4797b42f9041965..25069b318add375d68d97084e45b08c1f69f3804 100644 --- a/en/application-dev/reference/apis/js-apis-sms.md +++ b/en/application-dev/reference/apis/js-apis-sms.md @@ -1,5 +1,7 @@ # SMS +The SMS module provides basic SMS management functions. You can create and send SMS messages, and obtain and set the default SIM card for sending and receiving SMS messages. Besides, you can obtain and set the SMSC address, and check whether the current device can send and receive SMS messages. + >**NOTE** > >The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -206,7 +208,7 @@ This is a system API. | Type | Description | | -------------- | ------------------------------- | -| Promise\ | Promise that returns no value. | +| Promise\ | Promise used to return the result. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-statfs.md b/en/application-dev/reference/apis/js-apis-statfs.md index b2416b370967439456aa3d221dde5da992e6a49d..fc9109b25611afe452ea32255267b036e71a45b0 100644 --- a/en/application-dev/reference/apis/js-apis-statfs.md +++ b/en/application-dev/reference/apis/js-apis-statfs.md @@ -1,28 +1,15 @@ # statfs -> **NOTE:**
-> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. +The statfs module provides APIs for obtaining file system information, including the total number of bytes and the number of idle bytes of the file system. -This module provides information related to the file system. It provides JS APIs to obtain the total number of bytes and the number of idle bytes of the file system. +> **NOTE**
+> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import ```js import statfs from '@ohos.statfs'; ``` - -## Guidelines - -Before using the APIs provided by this module to perform operations on a file or directory, obtain the path of the application sandbox. For details, see [getOrCreateLocalDir of the Context module](js-apis-Context.md). - -Application sandbox path of a file or directory = Application directory + File name or directory name - -For example, if the application directory obtained by using **getOrCreateLocalDir** is **dir** and the file name is **xxx.txt**, the application sandbox path of the file is as follows: - -```js -let path = dir + "xxx.txt"; -``` - ## statfs.getFreeBytes getFreeBytes(path:string):Promise<number> @@ -72,8 +59,12 @@ Obtains the number of free bytes of the specified file system in asynchronous mo - Example ```js - statfs.getFreeBytes(path, function(err, number){ - console.info("getFreeBytes callback successfully:"+ number); + import featureAbility from '@ohos.ability.featureAbility'; + let context = featureAbility.getContext(); + context.getFilesDir().then(function (path) { + statfs.getFreeBytes(path, function(err, number){ + console.info("Got free bytes successfully:"+ number); + }); }); ``` @@ -126,7 +117,11 @@ Obtains the total number of bytes of the specified file system in asynchronous m - Example ```js - statfs.getTotalBytes(path, function(err, number){ - console.info("getTotalBytes callback successfully:"+ number); + import featureAbility from '@ohos.ability.featureAbility'; + let context = featureAbility.getContext(); + context.getFilesDir().then(function (path) { + statfs.getTotalBytes(path, function(err, number){ + console.info("Got total bytes successfully:"+ number); + }); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-storage-statistics.md b/en/application-dev/reference/apis/js-apis-storage-statistics.md index e99f0a560b739a208303f348dffd6c6beb7119f4..5606a2e64372c3e002815d535f59851718e535e9 100644 --- a/en/application-dev/reference/apis/js-apis-storage-statistics.md +++ b/en/application-dev/reference/apis/js-apis-storage-statistics.md @@ -5,7 +5,7 @@ > - The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - API version 9 is a canary version for trial use. The APIs of this version may be unstable. -Obtains storage space information, including the space of built-in and plug-in memory cards, space occupied by different types of data, and space of application data. +The **storageStatistics** module provides APIs for obtaining storage space information, including the space of built-in and plug-in memory cards, space occupied by different types of data, and space of application data. ## Modules to Import @@ -470,7 +470,7 @@ This is a system API and cannot be called by third-party applications. | Name | Type | Mandatory| Description| | ---------- | ------ | ---- | ---- | - | userId | string | No | User ID.
Value:
-  Set this parameter to the ID of the user to be queried.
-  If no value is specified, information about the current user is queried.| + | userId | number | No | User ID.
Value:
-  Set this parameter to the ID of the user to be queried.
-  If no value is specified, information about the current user is queried.| **Return value** @@ -481,7 +481,7 @@ This is a system API and cannot be called by third-party applications. **Example** ```js - let userId = ""; + let userId = 1; storageStatistics.getUserStorageStats(userId).then(function(StorageStats){ console.info("getUserStorageStats successfully:"+ JSON.stringify(StorageStats)); }).catch(function(err){ @@ -507,13 +507,13 @@ This is a system API and cannot be called by third-party applications. | Name | Type | Mandatory| Description | | ---------- | ------------------------------------ | ---- | -------------------------- | - | userId | string | No | User ID.
Value:
-  Set this parameter to the ID of the user to be queried.
-  If no value is specified, information about the current user is queried. | + | userId | number | No | User ID.
Value:
-  Set this parameter to the ID of the user to be queried.
-  If no value is specified, information about the current user is queried. | | callback | callback:AsyncCallback<[StorageStats](#StorageStats)> | Yes | Callback invoked to return the information obtained.| **Example** ```js - let userId = ""; + let userId = 1; storageStatistics.getUserStorageStats(userId, function(error, StorageStats){ // Do something. console.info("getUserStorageStats successfully:"+ JSON.stringify(StorageStats)); diff --git a/en/application-dev/reference/apis/js-apis-system-file.md b/en/application-dev/reference/apis/js-apis-system-file.md index f05357dbe766366e8653c51b85544d12317385ce..841f0b90056e377710f20336a3a5bf07ba58dde8 100644 --- a/en/application-dev/reference/apis/js-apis-system-file.md +++ b/en/application-dev/reference/apis/js-apis-system-file.md @@ -1,9 +1,7 @@ # File Storage - - -> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** -> - The APIs of this module are no longer maintained since API version 6. It is recommended that you use [`@ohos.fileio`](js-apis-fileio.md) instead. +> **NOTE**
+> - The APIs of this module are no longer maintained since API version 6. You are advised to use [`@ohos.fileio`](js-apis-fileio.md). > > - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -26,21 +24,21 @@ Moves a specified file to a given location. **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| srcUri | string | Yes | URI of the file to move. | -| dstUri | string | Yes | URI of the location to which the file is to move. | -| success | Function | No | Called when the source file is moved to the specified location successfully. This function returns the URI of the destination location. | -| fail | Function | No | Called when the operation fails. | -| complete | Function | No | Called when the execution is complete. | +| srcUri | string | Yes| Uniform resource identifier (URI) of the file to move.
The URI can contain a maximum of 128 characters, excluding the following characters: "\*+,:;<=>?[]\|\x7F | +| dstUri | string | Yes| URI of the location to which the file is to move.
The URI can contain a maximum of 128 characters, excluding the following characters: "\*+,:;<=>?[]\|\x7F | +| success | Function | No| Called when the file is moved to the specified location. This API returns the URI of the destination location.| +| fail | Function | No| Called when the file fails to be moved.| +| complete | Function | No| Called when the execution is complete.| -One of the following error codes will be returned if the operation fails. +**Return value of fail()** -| Error Code | Description | +| Error Code| Description| | -------- | -------- | -| 202 | Invalid parameter. | -| 300 | I/O error. | -| 301 | File or directory not exist. | +| 202 | Incorrect parameters are detected.| +| 300 | An I/O error occurs.| +| 301 | The file or directory does not exist.| **Example** @@ -66,27 +64,27 @@ export default { copy(Object): void -Copies a file and saves the copy to a specified location. +Copies a file to the given URI. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| srcUri | string | Yes | URI of the file to copy. | -| dstUri | string | Yes | URI of the location to which the copy is to save.
The directory of application resources and URI of the **tmp** type are not supported. | -| success | Function | No | Called when the source file is copied and saved to the specified location successfully. This function returns the URI of the destination location. | -| fail | Function | No | Called when the operation fails. | -| complete | Function | No | Called when the execution is complete. | +| srcUri | string | Yes| URI of the file to copy.| +| dstUri | string | Yes| URI of the location to which the copy is to be saved.
The directory of application resources and URI of the **tmp** type are not supported.| +| success | Function | No| Called when the file is copied and saved to the specified location. This API returns the URI of the destination location.| +| fail | Function | No| Called when the file fails to be copied.| +| complete | Function | No| Called when the execution is complete.| -One of the following error codes will be returned if the operation fails. +**Return value of fail()** -| Error Code | Description | +| Error Code| Description| | -------- | -------- | -| 202 | Invalid parameter. | -| 300 | I/O error. | -| 301 | File or directory not exist. | +| 202 | Incorrect parameters are detected.| +| 300 | An I/O error occurs.| +| 301 | The file or directory does not exist.| **Example** @@ -112,41 +110,41 @@ export default { list(Object): void -Obtains the list of all files in a specified directory. +Obtains all files in the specified directory. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| uri | string | Yes | URI of the directory. | -| success | Function | No | Called when the operation is successful. | -| fail | Function | No | Called when the operation fails. | -| complete | Function | No | Called when the execution is complete. | +| uri | string | Yes| URI of the directory.
The URI can contain a maximum of 128 characters, excluding the following characters: "\*+,:;<=>?[]\|\x7F | +| success | Function | No| Called when the file list is obtained.| +| fail | Function | No| Called when the file list fails to be obtained.| +| complete | Function | No| Called when the execution is complete.| -Return values of the **success** callback +**Return value of success()** -| Name | Type | Description | +| Name| Type| Description| | -------- | -------- | -------- | -| fileList | Array<FileInfo> | File list. The format of each file is as follows:
{
uri:'file1',
lastModifiedTime:1589965924479,
length:10240,
type: 'file'
} | +| fileList | Array<FileInfo> | File list. The format of each file is as follows:
{
uri:'file1',
lastModifiedTime:1589965924479,
length:10240,
type: 'file'
} | -**Table1** FileInfo +**Table 1** FileInfo -| Name | Type | Description | +| Name| Type| Description| | -------- | -------- | -------- | -| uri | string | File URI. | -| lastModifiedTime | number | Timestamp when the file is stored the last time, which is the number of milliseconds elapsed since 1970/01/01 00:00:00 GMT. | -| length | number | File size, in bytes. | -| type | string | File type. Available values are as follows:
- **dir**: directory
- **file**: file | +| uri | string | URI of the file.| +| lastModifiedTime | number | Timestamp when the file is saved the last time, which is the number of milliseconds elapsed since 1970/01/01 00:00:00 GMT.| +| length | number | File size, in bytes.| +| type | string | File type. Available values are as follows:
- **dir**: directory
- **file**: file | -One of the following error codes will be returned if the operation fails. +**Return value of fail()** -| Error Code | Description | +| Error Code| Description| | -------- | -------- | -| 202 | Invalid parameter. | -| 300 | I/O error. | -| 301 | File or directory not exist. | +| 202 | Incorrect parameters are detected.| +| 300 | An I/O error occurs.| +| 301 | The file or directory does not exist.| **Example** @@ -156,7 +154,7 @@ export default { file.list({ uri: 'internal://app/pic', success: function(data) { - console.log(data.fileList); + console.log(JSON.stringify(data.fileList)); }, fail: function(data, code) { console.error('call fail callback fail, code: ' + code + ', data: ' + data); @@ -171,37 +169,37 @@ export default { get(Object): void -Obtains information about a specified local file. +Obtains information about a local file. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| uri | string | Yes | File URI. | -| recursive | boolean | No | Whether to recursively obtain the file list under a subdirectory. The default value is **false**. | -| success | Function | No | Called when the operation is successful. | -| fail | Function | No | Called when the operation fails. | -| complete | Function | No | Called when the execution is complete. | +| uri | string | Yes| URI of the file.| +| recursive | boolean | No| Whether to recursively obtain the file list under a subdirectory. The default value is **false**.| +| success | Function | No| Called when the file information is obtained.| +| fail | Function | No| Called when the file information fails to be obtained.| +| complete | Function | No| Called when the execution is complete.| -Return values of the **success** callback +**Return value of success()** -| Name | Type | Description | +| Name| Type| Description| | -------- | -------- | -------- | -| uri | string | File URI. | -| length | number | File size, in bytes. | -| lastModifiedTime | number | Timestamp when the file is stored the last time, which is the number of milliseconds elapsed since 1970/01/01 00:00:00 GMT. | -| type | string | File type. The values are as follows:
- **dir**: directory
- **file**: file | -| subFiles | Array | File list. | +| uri | string | URI of the file.| +| length | number | File size, in bytes.| +| lastModifiedTime | number | Timestamp when the file is saved the last time, which is the number of milliseconds elapsed since 1970/01/01 00:00:00 GMT.| +| type | string | File type. Available values are as follows:
- **dir**: directory
- **file**: file | +| subFiles | Array | List of files.| -One of the following error codes will be returned if the operation fails. +**Return value of fail()** -| Error Code | Description | +| Error Code| Description| | -------- | -------- | -| 202 | Invalid parameter. | -| 300 | I/O error. | -| 301 | File or directory not exist. | +| 202 | Incorrect parameters are detected.| +| 300 | An I/O error occurs.| +| 301 | The file or directory does not exist.| **Example** @@ -226,26 +224,26 @@ export default { delete(Object): void -Deletes local files. +Deletes a local file. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| uri | string | Yes | URI of the file to delete, which cannot be an application resource path. | -| success | Function | No | Called when the operation is successful. | -| fail | Function | No | Called when the operation fails. | -| complete | Function | No | Called when the execution is complete. | +| uri | string | Yes| URI of the file to delete. It cannot be an application resource path.| +| success | Function | No| Called when the file is deleted.| +| fail | Function | No| Called when the file fails to be deleted.| +| complete | Function | No| Called when the execution is complete.| -One of the following error codes will be returned if the operation fails. +**Return value of fail()** -| Error Code | Description | +| Error Code| Description| | -------- | -------- | -| 202 | Incorrect parameter. | -| 300 | I/O error. | -| 301 | File or directory not exist. | +| 202 | Incorrect parameters are detected.| +| 300 | An I/O error occurs.| +| 301 | The file or directory does not exist.| **Example** @@ -270,28 +268,28 @@ export default { writeText(Object): void -Writes text into a specified file. +Writes text into a file. Only text files can be read and written. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| uri | string | Yes | URI of a local file. If it does not exist, a file will be created. | -| text | string | Yes | Character string to write into the local file. | -| encoding | string | No | Encoding format. The default format is UTF-8. | -| append | boolean | No | Whether to enable the append mode. The default value is **false**. | -| success | Function | No | Called when the operation is successful. | -| fail | Function | No | Called when the operation fails. | -| complete | Function | No | Called when the execution is complete. | +| uri | string | Yes| URI of a local file. If it does not exist, a file will be created.| +| text | string | Yes| Text to write into the file. | +| encoding | string | No| Encoding format. The default format is **UTF-8**.| +| append | boolean | No| Whether to enable the append mode. The default value is **false**.| +| success | Function | No| Called when the text is written into the specified file.| +| fail | Function | No| Called when the text fails to be written into the file.| +| complete | Function | No| Called when the execution is complete.| -One of the following error codes will be returned if the operation fails. +**Return value of fail()** -| Error Code | Description | +| Error Code| Description| | -------- | -------- | -| 202 | Incorrect parameter. | -| 300 | I/O error. | +| 202 | Incorrect parameters are detected.| +| 300 | An I/O error occurs.| **Example** @@ -317,28 +315,28 @@ export default { writeArrayBuffer(Object): void -Writes buffer data into a specified file. +Writes buffer data into a file. Only text files can be read and written. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| uri | string | Yes | URI of a local file. If it does not exist, a file will be created. | -| buffer | Uint8Array | Yes | Buffer from which the data is derived. | -| position | number | No | Offset to the position where the writing starts. The default value is **0**. | -| append | boolean | No | Whether to enable the append mode. The default value is **false**. If the value is **true**, the **position** parameter will become invalid. | -| success | Function | No | Called when the operation is successful. | -| fail | Function | No | Called when the operation fails. | -| complete | Function | No | Called when the execution is complete. | +| uri | string | Yes| URI of a local file. If it does not exist, a file will be created.| +| buffer | Uint8Array | Yes| Buffer from which the data is derived.| +| position | number | No| Offset to the position where the writing starts. The default value is **0**.| +| append | boolean | No| Whether to enable the append mode. The default value is **false**. If the value is **true**, the **position** parameter will become invalid.| +| success | Function | No| Called when buffer data is written into the file. | +| fail | Function | No| Called when buffer data fails to be written into the file.| +| complete | Function | No| Called when the execution is complete.| -One of the following error codes will be returned if the operation fails. +**Return value of fail()** -| Error Code | Description | +| Error Code| Description| | -------- | -------- | -| 202 | Invalid parameter. | -| 300 | I/O error. | +| 202 | Incorrect parameters are detected.| +| 300 | An I/O error occurs.| **Example** @@ -347,7 +345,7 @@ export default { writeArrayBuffer() { file.writeArrayBuffer({ uri: 'internal://app/test', - buffer: new Uint8Array(8), // The buffer is of the Uint8Array type. + buffer: new Uint8Array(8), // The buffer is of the Uint8Array type. success: function() { console.log('call writeArrayBuffer success.'); }, @@ -364,36 +362,36 @@ export default { readText(Object): void -Reads text from a specified file. +Reads text from a file. Only text files can be read and written. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| uri | string | Yes | URI of a local file. | -| encoding | string | No | Encoding format. The default format is UTF-8. | -| position | number | No | Position where the reading starts. The default value is the start position of the file. | -| length | number | No | Length of the text to be read (in bytes). The default value is **4096**. | -| success | Function | No | Called when the operation is successful. | -| fail | Function | No | Called when the operation fails. | -| complete | Function | No | Called when the execution is complete. | +| uri | string | Yes| URI of a local file.| +| encoding | string | No| Encoding format. The default format is **UTF-8**.| +| position | number | No| Position where the reading starts. The default value is the start position of the file.| +| length | number | No| Length of the text to read, in bytes. The default value is **4096**.| +| success | Function | No| Called when the text is read successfully.| +| fail | Function | No| Called when the text failed to be read.| +| complete | Function | No| Called when the execution is complete.| -Return values of the **success** callback +**Return value of success()** -| Name | Type | Description | +| Name| Type| Description| | -------- | -------- | -------- | -| text | string | Text read from the specified file. | +| text | string | Text read from the specified file.| -One of the following error codes will be returned if the operation fails. +**Return value of fail()** -| Error Code | Description | +| Error Code| Description| | -------- | -------- | -| 202 | Invalid parameter. | -| 300 | I/O error. | -| 301 | The file or directory does not exist. | -| 302 | The size of text to read exceeds 4096 bytes. | +| 202 | Incorrect parameters are detected.| +| 300 | An I/O error occurs.| +| 301 | The file or directory does not exist.| +| 302 | The text to read exceeds 4 KB.| **Example** @@ -418,34 +416,34 @@ export default { readArrayBuffer(Object): void -Reads buffer data from a specified file. +Reads buffer data from a file. Only text files can be read and written. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| uri | string | Yes | URI of a local file. | -| position | number | No | Position where the reading starts. The default value is the start position of the file. | -| length | number | No | Length of data to read. If this parameter is not set, the reading proceeds until the end of the file. | -| success | Function | No | Called when the operation is successful. | -| fail | Function | No | Called when the operation fails. | -| complete | Function | No | Called when the execution is complete. | +| uri | string | Yes| URI of a local file.| +| position | number | No| Position where the reading starts. The default value is the start position of the file.| +| length | number | No| Length of data to read. If this parameter is not set, the reading proceeds until the end of the file.| +| success | Function | No| Called when the buffer data is read successfully.| +| fail | Function | No| Called when the buffer data fails to be read.| +| complete | Function | No| Called when the execution is complete.| -Return values of the **success** callback +**Return value of success()** -| Name | Type | Description | +| Name| Type| Description| | -------- | -------- | -------- | -| buffer | Uint8Array | File content that is read | +| buffer | Uint8Array | Data read.| -One of the following error codes will be returned if the operation fails. +**Return value of fail()** -| Error Code | Description | +| Error Code| Description| | -------- | -------- | -| 202 | Invalid parameter. | -| 300 | I/O error. | -| 301 | File or directory not exist. | +| 202 | Incorrect parameters are detected.| +| 300 | An I/O error occurs.| +| 301 | The file or directory does not exist.| **Example** @@ -472,26 +470,26 @@ export default { access(Object): void -Checks whether a specified file or directory exists. +Checks whether a file or directory exists. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| uri | string | Yes | URI of the directory or file. | -| success | Function | No | Called when the operation is successful. | -| fail | Function | No | Called when the operation fails. | -| complete | Function | No | Called when the execution is complete. | +| uri | string | Yes| URI of the directory or file to check.| +| success | Function | No| Called when the operation is successful.| +| fail | Function | No| Called when the operation fails.| +| complete | Function | No| Called when the execution is complete.| -One of the following error codes will be returned if the operation fails. +**Return value of fail()** -| Error Code | Description | +| Error Code| Description| | -------- | -------- | -| 202 | Invalid parameter. | -| 300 | I/O error. | -| 301 | File or directory not exist. | +| 202 | Incorrect parameters are detected.| +| 300 | An I/O error occurs.| +| 301 | The file or directory does not exist.| **Example** @@ -516,26 +514,26 @@ export default { mkdir(Object): void -Creates a specified directory. +Creates a directory. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| uri | string | Yes | URI of the directory. | -| recursive | boolean | No | Whether to recursively create upper-level directories of the specified directory. The default value is **false**. | -| success | Function | No | Called when the operation is successful. | -| fail | Function | No | Called when the operation fails. | -| complete | Function | No | Called when the execution is complete. | +| uri | string | Yes| URI of the directory to create.| +| recursive | boolean | No| Whether to recursively create upper-level directories of the specified directory. The default value is **false**.| +| success | Function | No| Called when the directory is created.| +| fail | Function | No| Called when the directory fails to be created.| +| complete | Function | No| Called when the execution is complete.| -One of the following error codes will be returned if the operation fails. +**Return value of fail()** -| Error Code | Description | +| Error Code| Description| | -------- | -------- | -| 202 | Invalid parameter. | -| 300 | I/O error. | +| 202 | Incorrect parameters are detected.| +| 300 | An I/O error occurs.| **Example** @@ -560,27 +558,27 @@ export default { rmdir(Object): void -Deletes a specified directory. +Deletes a directory. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| uri | string | Yes | URI of the directory. | -| recursive | boolean | No | Whether to recursively delete subfiles and subdirectories of the specified directory. The default value is **false**. | -| success | Function | No | Called when the operation is successful. | -| fail | Function | No | Called when the operation fails. | -| complete | Function | No | Called when the execution is complete. | +| uri | string | Yes| URI of the directory to delete.| +| recursive | boolean | No| Whether to recursively delete files and subdirectories of the specified directory. The default value is **false**.| +| success | Function | No| Called when the directory is deleted.| +| fail | Function | No| Called when the directory fails to be deleted.| +| complete | Function | No| Called when the execution is complete.| -One of the following error codes will be returned if the operation fails. +**Return value of fail()** -| Error Code | Description | +| Error Code| Description| | -------- | -------- | -| 202 | Invalid parameter. | -| 300 | I/O error. | -| 301 | File or directory not exist. | +| 202 | Incorrect parameters are detected.| +| 300 | An I/O error occurs.| +| 301 | The file or directory does not exist.| **Example** @@ -598,4 +596,4 @@ export default { }); } } -``` \ No newline at end of file +``` diff --git a/en/application-dev/reference/apis/js-apis-telephony-data.md b/en/application-dev/reference/apis/js-apis-telephony-data.md index 309e32bdae7af66c7ca14802f734ccca0ccdbb99..4a711c1f7cbf0defdbcd9ea0c28a08e981c594a9 100644 --- a/en/application-dev/reference/apis/js-apis-telephony-data.md +++ b/en/application-dev/reference/apis/js-apis-telephony-data.md @@ -1,5 +1,7 @@ # Cellular Data +The cellular data module provides basic mobile data management functions. You can obtain and set the default slot of the SIM card used for mobile data, and obtain the uplink and downlink connection status of cellular data services and connection status of the packet switched (PS) domain. Besides, you can check whether cellular data services and data roaming are enabled. + >**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. @@ -78,7 +80,7 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | --------------------- | ---- | ------------------------------------------------------------ | | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2
- **-1**: Clears the default configuration.| -| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object. | +| callback | AsyncCallback\ | Yes | Callback used to return the result. | **Example** @@ -110,7 +112,7 @@ This is a system API. | Type | Description | | -------------- | ------------------------------- | -| Promise<\void\> | Promise that returns no value. | +| Promise<\void\> | Promise used to return the result. | **Example** @@ -174,7 +176,7 @@ promise.then((data) => { getCellularDataState(callback: AsyncCallback\): void -Obtains the connection status of the packet switched (PS) domain. This API uses an asynchronous callback to return the result. +Obtains the connection status of the PS domain. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.CellularData @@ -342,14 +344,14 @@ Defines the cellular data flow type. ## DataConnectState -Describes the connection status of a cellular data link. +Describes the connection status of a cellular data connection. **System capability**: SystemCapability.Telephony.CellularData | Name | Value | Description | | ----------------------- | ---- | -------------------------- | -| DATA_STATE_UNKNOWN | -1 | The status of the cellular data link is unknown. | -| DATA_STATE_DISCONNECTED | 0 | The cellular data link is disconnected. | -| DATA_STATE_CONNECTING | 1 | The cellular data link is being connected.| -| DATA_STATE_CONNECTED | 2 | The cellular data link is connected. | -| DATA_STATE_SUSPENDED | 3 | The cellular data link is suspended. | +| DATA_STATE_UNKNOWN | -1 | The status of the cellular data connection is unknown. | +| DATA_STATE_DISCONNECTED | 0 | The cellular data connection is disconnected. | +| DATA_STATE_CONNECTING | 1 | The cellular data connection is being established.| +| DATA_STATE_CONNECTED | 2 | The cellular data connection is established. | +| DATA_STATE_SUSPENDED | 3 | The cellular data connection is suspended. | diff --git a/en/application-dev/reference/apis/js-apis-timer.md b/en/application-dev/reference/apis/js-apis-timer.md index d144a95db8f59ca0605fd228b351380afe6feac8..f9e174b5147370f465e140d03aeba6b3802380a0 100644 --- a/en/application-dev/reference/apis/js-apis-timer.md +++ b/en/application-dev/reference/apis/js-apis-timer.md @@ -3,13 +3,6 @@ ## setTimeout -## Modules to Import - - -``` -import Time from '@ohos.Time'; -``` - setTimeout(handler[,delay[,…args]]): number Sets a timer for the system to call a function after the timer goes off. diff --git a/en/application-dev/reference/apis/js-apis-uri.md b/en/application-dev/reference/apis/js-apis-uri.md index a6c8823599cfee6dba5288e6555d6c618fd414c8..60fd45f98209c718374e4a2633b074a531aa719c 100644 --- a/en/application-dev/reference/apis/js-apis-uri.md +++ b/en/application-dev/reference/apis/js-apis-uri.md @@ -72,8 +72,8 @@ Obtains the query string applicable to this URI. **Example** ```js -const uri = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); -uri.toString() +const result = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); +result.toString() ``` diff --git a/en/application-dev/reference/apis/js-apis-uripermissionmanager.md b/en/application-dev/reference/apis/js-apis-uripermissionmanager.md deleted file mode 100644 index 6bbf0f941909786361f651546a3fab9fe129c69c..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/apis/js-apis-uripermissionmanager.md +++ /dev/null @@ -1,86 +0,0 @@ -# uriPermissionManager - -> **NOTE** -> -> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. - - -Implements URI permission management. - - -## Modules to Import - - -``` -import UriPermissionManager from '@ohos.application.uriPermissionManager'; -``` - - -## uriPermissionManager.verifyUriPermission - -verifyUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number, callback: AsyncCallback<number>): void - -Checks whether an application has the permission specified by **flag** for an URI. This API uses a callback to return the result. - -**System capability**: - -SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | uri | string | Yes| URI of a file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.| - | flag | wantConstant.Flags | Yes| Read or write permission on the file specified by the URI.| - | accessTokenId | number | Yes| Unique ID of an application, which is obtained through the **BundleManager** API.| - | callback | AsyncCallback<number> | Yes| Callback used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite.| - -**Example** - - ```js - import WantConstant from '@ohos.ability.wantConstant'; - let accessTokenId =1 - let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10" - UriPermissionManager.verifyUriPermission(uri, WantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, accessTokenId, (result) => { - console.log("result.code = " + result.code) - }) // accessTokenId is obtained through the **BundleManager** API. - ``` - - -## uriPermissionManager.verifyUriPermission - -verifyUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number): Promise<number> - -Checks whether an application has the permission specified by **flag** for an URI. This API uses a callback to return the result. - -**System capability**: - -SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | uri | string | Yes| URI of a file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.| - | flag | wantConstant.Flags | Yes| Read or write permission on the file specified by the URI.| - | accessTokenId | number | Yes| Unique ID of an application, which is obtained through the **BundleManager** API.| - -**Return value** - - | Type| Description| - | -------- | -------- | - | Promise<number> | Promise used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite.| - -**Example** - - ```js - import WantConstant from '@ohos.ability.wantConstant'; - let accessTokenId =1 - let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10" - UriPermissionManager.verifyUriPermission(uri, wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, accessTokenId) - .then((data) => { - console.log('Verification succeeded.' + data) - }).catch((error) => { - console.log('Verification failed.'); - }) - ``` diff --git a/en/application-dev/reference/apis/js-apis-url.md b/en/application-dev/reference/apis/js-apis-url.md index fd826706700190a3d2f042a155cca1a2e1c96b81..2871e53f5e753bf52109e2d9c2e95b2c1d4c8808 100755 --- a/en/application-dev/reference/apis/js-apis-url.md +++ b/en/application-dev/reference/apis/js-apis-url.md @@ -31,7 +31,7 @@ Creates a **URLSearchParams** instance. ```js var objectParams = new Url.URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]); -var objectParams1 = new Url.URLSearchParams({"fod" : 1 , "bard" : 2}); +var objectParams1 = new Url.URLSearchParams({"fod" : '1' , "bard" : '2'}); var objectParams2 = new Url.URLSearchParams('?fod=1&bard=2'); var urlObject = new Url.URL('https://developer.mozilla.org/?fod=1&bard=2'); var params = new Url.URLSearchParams(urlObject.search); @@ -58,7 +58,7 @@ Appends a key-value pair into the query string. ```js let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); -paramsObject.append('fod', 3); +paramsObject.append('fod', '3'); ``` @@ -108,10 +108,10 @@ Obtains all the key-value pairs based on the specified key. **Example** ```js -let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); -let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); -paramsObject.append('fod', 3); // Add a second value for the fod parameter. -console.log(params.getAll('fod')) // Output ["1","3"]. +let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let params = new Url.URLSearchParams(urlObject.search.slice(1)); +params.append('fod', '3'); // Add a second value for the fod parameter. +console.log(params.getAll('fod').toString()) // Output ["1","3"]. ``` @@ -196,10 +196,9 @@ Obtains the value of the first key-value pair based on the specified key. **Example** ```js -var paramsOject = new Url.URLSearchParams(document.location.search.substring(1)); +var paramsOject = new Url.URLSearchParams('name=Jonathan&age=18'); var name = paramsOject.get("name"); // is the string "Jonathan" var age = parseInt(paramsOject.get("age"), 10); // is the number 18 -var address = paramsOject.get("address"); // null ``` @@ -252,7 +251,7 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t ```js let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); -paramsObject.set('baz', 3); // Add a third parameter. +paramsObject.set('baz', '3'); // Add a third parameter. ``` @@ -364,7 +363,7 @@ Obtains search parameters that are serialized as a string and, if necessary, per ```js let url = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); let params = new Url.URLSearchParams(url.search.slice(1)); -params.append('fod', 3); +params.append('fod', '3'); console.log(params.toString()); ``` diff --git a/en/application-dev/reference/apis/js-apis-usb.md b/en/application-dev/reference/apis/js-apis-usb.md index 63beaae8031c42ad274d2e151dad4c029f799761..83ed07f3f720da23ff5c006938d15bd2ea660751 100644 --- a/en/application-dev/reference/apis/js-apis-usb.md +++ b/en/application-dev/reference/apis/js-apis-usb.md @@ -126,8 +126,8 @@ Checks whether the application has the permission to access the device. - **Example** ```js - let divicesName="1-1"; - let bool = usb.hasRight(divicesName); + let devicesName="1-1"; + let bool = usb.hasRight(devicesName); console.log(bool); ``` @@ -152,8 +152,8 @@ Requests the temporary permission for the application to access the USB device. - **Example** ```js - let divicesName="1-1"; - usb.requestRight(divicesName).then((ret) => { + let devicesName="1-1"; + usb.requestRight(devicesName).then((ret) => { console.log(`requestRight = ${JSON.stringify(ret)}`); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-util.md b/en/application-dev/reference/apis/js-apis-util.md index 2ac8daeb3799908d57a5b7a2c5fd456dcfee8f59..e0fcbc5689c1b0f90f4aec8713d4cd2c4a679daf 100755 --- a/en/application-dev/reference/apis/js-apis-util.md +++ b/en/application-dev/reference/apis/js-apis-util.md @@ -91,18 +91,22 @@ Calls back an asynchronous function. In the callback, the first parameter indica async function promiseFn() { return Promise.reject('value'); } + var err = "type err"; var cb = util.callbackWrapper(promiseFn); cb((err, ret) => { console.log(err); console.log(ret); - }) + }, err) ``` -## util.promiseWrapper +## util.promiseWrapper(deprecated) promiseWrapper(original: (err: Object, value: Object) => void): Object +> **Introduce**
+> Deprecated starting from API version 9, it is recommended to use [util.promisify9 +] (\utilpromisify9) instead. + Processes an asynchronous function and returns a promise version. **System capability**: SystemCapability.Utils.Lang @@ -119,16 +123,45 @@ Processes an asynchronous function and returns a promise version. **Example** ```js - function aysnFun(str1, str2, callback) { - if (typeof str1 === 'string' && typeof str2 === 'string') { - callback(null, str1 + str2); - } else { - callback('type err'); - } + function aysnFun() { + return 0; } - let newPromiseObj = util.promiseWrapper(aysnFun)("Hello", 'World'); - newPromiseObj.then(res => { - console.log(res); + let newPromiseObj = util.promiseWrapper(aysnFun); + newPromiseObj().then(res => { + console.log(res); + }) + ``` + +## util.promisify9+ + +promisify(original: (err: Object, value: Object) => void): Function + +Processes an asynchronous function and returns a promise function. + +**System capability**: SystemCapability.Utils.Lang + +**Parameters** +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| original | Function | Yes| Asynchronous function.| + +**Return value** +| Type| Description| +| -------- | -------- | +| Function | Function in the error-first style (that is, **(err, value) =>...** is called as the last parameter) and the promise version.| + +**Example** + ```js + function aysnFun(str1, str2) { + if (typeof str1 === 'object' && typeof str2 === 'object') { + return str2 + } else { + return str1 + } + } + let newPromiseObj = util.promisify(aysnFun); + newPromiseObj({ err: "type error" }, {value:'HelloWorld'}).then(res => { + console.log(res); }) ``` @@ -287,10 +320,11 @@ Stores the UTF-8 encoded text. **Example** ```js - var that = new util.TextEncoder(); - var buffer = new ArrayBuffer(4); - this.dest = new Uint8Array(buffer); - var result = that.encodeInto("abcd", this.dest); + var that = new util.TextEncoder() + var buffer = new ArrayBuffer(4) + var dest = new Uint8Array(buffer) + var result = new Object() + result = that.encodeInto('abcd', dest) ``` ## RationalNumber8+ @@ -337,7 +371,7 @@ Creates a **RationalNumber** object based on the given string. **Example** ```js var rationalNumber = new util.RationalNumber(1,2); - var rational = rationalNumer.creatRationalFromString("3/4"); + var rational = util.RationalNumber.createRationalFromString("3/4"); ``` @@ -362,7 +396,7 @@ Compares this **RationalNumber** object with a given object. **Example** ```js var rationalNumber = new util.RationalNumber(1,2); - var rational = rationalNumer.creatRationalFromString("3/4"); + var rational = util.RationalNumber.createRationalFromString("3/4"); var result = rationalNumber.compareTo(rational); ``` @@ -408,7 +442,7 @@ Checks whether this **RationalNumber** object equals the given object. **Example** ```js var rationalNumber = new util.RationalNumber(1,2); - var rational = rationalNumer.creatRationalFromString("3/4"); + var rational = util.RationalNumber.createRationalFromString("3/4"); var result = rationalNumber.equals(rational); ``` @@ -435,7 +469,7 @@ Obtains the greatest common divisor of two specified integers. **Example** ```js var rationalNumber = new util.RationalNumber(1,2); - var result = rationalNumber.getCommonDivisor(4,6); + var result = util.RationalNumber.getCommonDivisor(4,6); ``` @@ -672,7 +706,7 @@ Clears key-value pairs from this buffer. The **afterRemoval()** method will be c ```js var pro = new util.LruBuffer(); pro.put(2,10); - var result = pro.size(); + var result = pro.length; pro.clear(); ``` @@ -948,20 +982,13 @@ Performs subsequent operations after a value is removed. **Example** ```js var arr = []; + var arr = []; class ChildLruBuffer extends util.LruBuffer { constructor() { super(); } - static getInstance() - { - if(this.instance == null) - { - this.instance = new ChildLruBuffer(); - } - return this.instance; - } afterRemoval(isEvict, key, value, newValue) { if (isEvict === false) @@ -970,7 +997,8 @@ Performs subsequent operations after a value is removed. } } } - ChildLruBuffer.getInstance().afterRemoval(false,10,30,null); + var lru = new ChildLruBuffer(); + lru.afterRemoval(false,10,30,null); ``` @@ -1063,7 +1091,7 @@ Obtains a two-dimensional array in key-value pairs. ```js var pro = new util.LruBuffer(); pro.put(2,10); - var result = pro[symbol.iterator](); + var result = pro[Symbol.iterator](); ``` @@ -1551,7 +1579,7 @@ Encodes the input content asynchronously. var rarray = new Uint8Array([99,122,69,122]); that.encode(array).then(val=>{ for (var i = 0; i < rarray.length; i++) { - console.log(val[i]) + console.log(val[i].toString()) } }) ``` @@ -1610,7 +1638,7 @@ Decodes the input content asynchronously. var rarray = new Uint8Array([115,49,51]); that.decode(array).then(val=>{ for (var i = 0; i < rarray.length; i++) { - console.log(val[i]) + console.log(val[i].toString()) } }) ``` @@ -1654,7 +1682,7 @@ Checks whether the input value is of the **ArrayBuffer** type. **Example** ```js var that = new util.types(); - var result = that.isAnyArrayBuffer(new ArrayBuffer([])); + var result = that.isAnyArrayBuffer(new ArrayBuffer(0)); ``` @@ -1734,7 +1762,7 @@ Checks whether the input value is of the **ArrayBuffer** type. **Example** ```js var that = new util.types(); - var result = that.isArrayBuffer(new ArrayBuffer([])); + var result = that.isArrayBuffer(new ArrayBuffer(0)); ``` diff --git a/en/application-dev/reference/apis/js-apis-volumemanager.md b/en/application-dev/reference/apis/js-apis-volumemanager.md index 39333510193d27d613ba48896e58f2d1dd3434f5..a91577d272d67835ba1d7194200be508ed44a6ea 100644 --- a/en/application-dev/reference/apis/js-apis-volumemanager.md +++ b/en/application-dev/reference/apis/js-apis-volumemanager.md @@ -1,13 +1,13 @@ # Volume Management +The volumeManager module provides APIs for volume and disk management, including obtaining volume information, mounting or unmounting volumes, partitioning disks, and formatting volumes. + > **NOTE**
> > - The initial APIs of this module are supported since API version 9. > - API version 9 is a canary version for trial use. The APIs of this version may be unstable. > - The APIs of this module are system APIs and cannot be called by third-party applications. -The APIs of this module can be used to perform volume and disk management, including obtaining volume information, mounting and unmounting volumes, partitioning disks, and formatting volumes. - ## Modules to Import ```js @@ -20,19 +20,21 @@ getAllVolumes(): Promise<Array<Volume>> Asynchronously obtains information about all available volumes. This API uses a promise to return the result. +**Required permissions**: ohos.permission.STORAGE_MANAGER + **System capability**: SystemCapability.FileManagement.StorageService.Volume -- Return value +**Return value** | Type | Description | | ---------------------------------- | -------------------------- | | Promise<[Volume](#volume)[]> | Promise used to return the execution result.| -- Example +**Example** ```js volumemanager.getAllVolumes().then(function(volumes){ - // do something + // Do something. }); ``` @@ -42,20 +44,22 @@ getAllVolumes(callback: AsyncCallback<Array<Volume>>): void Asynchronously obtains information about all available volumes. This API uses a callback to return the result. +**Required permissions**: ohos.permission.STORAGE_MANAGER + **System capability**: SystemCapability.FileManagement.StorageService.Volume -- Parameters +**Parameters** | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------- | ---- | ------------------------------------ | | callback | callback:AsyncCallback<[Volume](#volume)[]> | Yes | Callback invoked to return the volume information obtained.| - -- Example + +**Example** ```js let uuid = ""; - volumemanager.getAllVolumes(uuid, function(error, volumes){ - // do something + volumemanager.getAllVolumes(function(error, volumes){ + // Do something }); ``` @@ -66,26 +70,28 @@ mount(volumeId: string): Promise<boolean> Asynchronously mounts a volume. This API uses a promise to return the result. +**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER + **System capability**: SystemCapability.FileManagement.StorageService.Volume -- Parameters +**Parameters** | Name | Type | Mandatory| Description| | -------- | ------ | ---- | ---- | | volumeId | string | Yes | Volume ID.| -- Return value +**Return value** | Type | Description | | ---------------------- | ---------- | | Promise<boolean> | Promise used to return the execution result.| -- Example +**Example** ```js let volumeId = ""; volumemanager.mount(volumeId).then(function(flag){ - // do something + // Do something }); ``` @@ -95,21 +101,23 @@ mount(volumeId: string, callback:AsyncCallback<boolean>):void Asynchronously obtains the available space of the specified volume. This API uses a callback to return the result. +**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER + **System capability**: SystemCapability.FileManagement.StorageService.Volume -- Parameters +**Parameters** | Name | Type | Mandatory| Description | | -------- | ------------------------------------- | ---- | -------------------- | | volumeId | string | Yes | Volume ID. | | callback | callback:AsyncCallback<boolean> | Yes | Callback invoked to return the execution result.| -- Example +**Example** ```js let volumeId = ""; volumemanager.mount(volumeId, function(error, flag){ - // do something + // Do something }); ``` @@ -119,26 +127,28 @@ unmount(volumeId: string): Promise<boolean> Asynchronously unmounts a volume. This API uses a promise to return the result. +**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER + **System capability**: SystemCapability.FileManagement.StorageService.Volume -- Parameters +**Parameters** | Name | Type | Mandatory| Description| | -------- | ------ | ---- | ---- | | volumeId | string | Yes | Volume ID.| -- Return value +**Return value** | Type | Description | | ---------------------- | ---------- | | Promise<boolean> | Promise used to return the execution result.| -- Example +**Example** ```js let volumeId = ""; volumemanager.unmount(volumeId).then(function(flag){ - // do something + // Do something }); ``` @@ -148,21 +158,306 @@ unmount(volumeId: string, callback:AsyncCallback<boolean>):void Asynchronously unmounts a volume. This API uses a callback to return the result. +**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER + **System capability**: SystemCapability.FileManagement.StorageService.Volume -- Parameters +**Parameters** | Name | Type | Mandatory| Description | | -------- | ------------------------------------- | ---- | -------------------- | | volumeId | string | Yes | Volume ID. | | callback | callback:AsyncCallback<boolean> | Yes | Callback invoked to return the execution result.| -- Example +**Example** ```js let volumeId = ""; volumemanager.unmount(volumeId, function(error, flag){ - // do something + // Do something + }); + ``` + +## volumemanager.getVolumeByUuid + +getVolumeByUuid(uuid: string): Promise<Volume> + +Asynchronously obtains volume information based on the universally unique identifier (UUID). This API uses a promise to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description| + | -------- | ------ | ---- | ---- | + | uuid | string | Yes | UUID of the volume.| + +**Return value** + + | Type | Description | + | ---------------------------------- | -------------------------- | + | Promise<[Volume](#volume)> | Promise used to return the volume information obtained.| + +**Example** + + ```js + let uuid = ""; + let volume = await volumemanager.getVolumeByUuid(uuid); + ``` + +## volumemanager.getVolumeByUuid + +getVolumeByUuid(uuid: string, callback: AsyncCallback<Volume>): void + +Asynchronously obtains volume information based on the UUID. This API uses a callback to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description | + | -------- | ------------------------------------------------ | ---- | -------------------- | + | uuid | string | Yes | UUID of the volume. | + | callback | callback:AsyncCallback<[Volume](#volume)> | Yes | Callback invoked to return the volume information obtained.| + +**Example** + + ```js + let uuid = ""; + volumemanager.getVolumeByUuid(uuid, (error, volume) => { + // Do something. + }); + ``` + +## volumemanager.getVolumeById + +getVolumeById(id: string): Promise<Volume> + +Asynchronously obtains volume information based on the volume ID. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory | Description| + | -------- | ------ | ---- | ---- | + | id | string | Yes | Volume ID.| + +**Return value** + + | Type | Description | + | ---------------------------------- | -------------------------- | + | Promise<[Volume](#volume)> | Promise used to return the volume information obtained.| + +**Example** + + ```js + let id = ""; + let volume = await volumemanager.getVolumeById(id); + ``` + +## volumemanager.getVolumeById + +getVolumeById(id: string, callback: AsyncCallback<Volume>): void + +Asynchronously obtains volume information based on the volume ID. This API uses a callback to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description | + | -------- | ------------------------------------------------ | ---- | -------------------- | + | id | string | Yes | Volume ID. | + | callback | callback:AsyncCallback<[Volume](#volume)> | Yes | Callback invoked to return the volume information obtained.| + +**Example** + + ```js + let id = ""; + volumemanager.getVolumeById(id, (error, volume) => { + // Do something. + }); + ``` + +## volumemanager.setVolumeDescription + +setVolumeDescription(uuid: string, description: string): Promise<void> + +Asynchronously sets the volume description based on the UUID. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description| + | --------- | ------ | ---- | ---- | + | uuid | string | Yes | UUID of the volume.| + | description | string | Yes | Volume description.| + +**Return value** + + | Type | Description | + | ---------------------- | -------------------------- | + | Promise<void> | Promise used to return the result. | + +**Example** + + ```js + let uuid = ""; + let description = ""; + let bool = await volumemanager.setVolumeDescription(uuid, description); + ``` + +## volumemanager.setVolumeDescription + +setVolumeDescription(uuid: string, description: string, callback: AsyncCallback<void>): void + +Asynchronously sets the volume description based on the UUID. This API uses a callback to return the result. + +**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description | + | ---------- | --------------------------------------- | ---- | ---------------- | + | uuid | string | Yes | UUID of the volume. | + | description | string | Yes | Volume description. | + | callback | callback:AsyncCallback<void> | Yes | Callback invoked to return the result.| + +**Example** + + ```js + let uuid = ""; + let description = ""; + volumemanager.setVolumeDescription(uuid, description, (error, bool) => { + // Do something. + }); + ``` + +## volumemanager.format + +format(volId: string): Promise<void> + +Asynchronously formats a volume. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description| + | ----------- | ------ | ---- | ---- | + | volId | string | Yes | Volume ID.| + +**Return value** + + | Type | Description | + | --------------------- | ----------------------- | + | Promise<void> | Promise used to return the result. | + +**Example** + + ```js + let volId = ""; + let bool = await volumemanager.format(volId); + ``` + +## volumemanager.format + +format(volId: string, callback: AsyncCallback<void>): void + +Asynchronously formats a volume. This API uses a callback to return the result. + +**Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description | + | -------- | --------------------------------------- | ---- | ---------------- | + | volId | string | Yes | Volume ID. | + | callback | callback:AsyncCallback<void> | Yes | Callback invoked to return the result. | + +**Example** + + ```js + let volId = ""; + volumemanager.format(volId, (error, bool) => { + // Do something. + }); + ``` + +## volumemanager.partition + +partition(volId: string, fstype: string): Promise<void> + +Asynchronously partitions a disk. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description| + | ----------- | ------ | ---- | ---- | + | volId | string | Yes | ID of the disk to which the volume belongs.| + | fstype | string | Yes | Partition type. | + +**Return value** + + | Type | Description | + | --------------------- | ----------------------- | + | Promise<void> | Promise used to return the result. | + +**Example** + + ```js + let volId = ""; + let fstype = ""; + let bool = await volumemanager.partition(volId, fstype); + ``` + +## volumemanager.partition + +partition(volId: string, fstype : string, callback: AsyncCallback<void>): void + +Asynchronously partitions a disk. This API uses a callback to return the result. + +**Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description | + | -------- | --------------------------------------- | ---- | ---------------- | + | volId | string | Yes | ID of the disk to which the volume belongs. | + | fstype | string | Yes | Partition type. | + | callback | callback:AsyncCallback<void> | Yes | Callback invoked to return the result. | + +**Example** + + ```js + let volId = ""; + let fstype = ""; + volumemanager.format(volId, fstype, (error, bool) => { + // Do something. }); ``` @@ -172,11 +467,11 @@ Asynchronously unmounts a volume. This API uses a callback to return the result. ### Attributes -| Name | Type | Description | +| Name | Type | Description | | ----------- | ------- | -------------------- | -| id | number | Volume ID. | -| uuid | string | Universally unique identifier (UUID) of the volume. | +| id | string | Volume ID. | +| uuid | string | UUID of the volume. | | description | string | Description of the volume. | -| removable | boolean | Whether the volume is a removable storage device.| -| state | int | Current volume status. | +| removable | boolean | Whether the volume is a removable storage device.| +| state | number | Volume state. | | path | string | Mount address of the volume. | diff --git a/en/application-dev/reference/apis/js-apis-webgl.md b/en/application-dev/reference/apis/js-apis-webgl.md index bf13c3d9188fe48996c9f56342af8436bb398b9e..e71562765f7b0a4330cfce26a8c57f835f8ed055 100644 --- a/en/application-dev/reference/apis/js-apis-webgl.md +++ b/en/application-dev/reference/apis/js-apis-webgl.md @@ -426,7 +426,7 @@ WebGLRenderingContextBase | CONTEXT_LOST_WEBGL | GLenum | Yes| | UNPACK_COLORSPACE_CONVERSION_WEBGL | GLenum | Yes| | BROWSER_DEFAULT_WEBGL | GLenum | Yes| -| canvas | HTMLCanvasElement \| OffscreenCanvas | Yes| +| canvas | HTMLCanvasElement \| OffscreenCanvas | Yes| | drawingBufferWidth | GLsizei | Yes| | drawingBufferHeight | GLsizei | Yes| @@ -435,124 +435,124 @@ WebGLRenderingContextBase | Method| Return Value Type| | -------- | -------- | -| getContextAttributes() | WebGLContextAttributes \| null | +| getContextAttributes() | WebGLContextAttributes \| null | | isContextLost() | boolean | -| getSupportedExtensions() | string[] \| null | -| getExtension(name: string) | any | -| activeTexture(texture: GLenum) | void | -| attachShader(program: WebGLProgram, shader: WebGLShader) | void | -| bindAttribLocation(program: WebGLProgram, index: GLuint, name: string) | void | -| bindBuffer(target: GLenum, buffer: WebGLBuffer \| null) | void | -| bindFramebuffer(target: GLenum, framebuffer: WebGLFramebuffer \| null) | void | -| bindRenderbuffer(target: GLenum, renderbuffer: WebGLRenderbuffer \| null) | void | -| bindTexture(target: GLenum, texture: WebGLTexture \| null) | void | -| blendColor(red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf) | void | -| blendEquation(mode: GLenum) | void | -| blendEquationSeparate(modeRGB: GLenum, modeAlpha: GLenum) | void | -| blendFunc(sfactor: GLenum, dfactor: GLenum) | void | -| blendFuncSeparate(srcRGB: GLenum, dstRGB: GLenum, srcAlpha: GLenum, dstAlpha: GLenum) | void | -| checkFramebufferStatus(target: GLenum) | GLenum | -| clear(mask: GLbitfield) | void | -| clearColor(red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf) | void | -| clearDepth(depth: GLclampf) | void | -| clearStencil(s: GLint) | void | -| colorMask(red: GLboolean, green: GLboolean, blue: GLboolean, alpha: GLboolean) | void | -| compileShader(shader: WebGLShader) | void | -| copyTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, x: GLint, y: GLint, width: GLsizei, height: GLsizei, border: GLint) | void | -| copyTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | -| createBuffer() | WebGLBuffer \| null | -| createFramebuffer() | WebGLFramebuffer \| null | -| createProgram() | WebGLProgram \| null | -| createRenderbuffer() | WebGLRenderbuffer \| null | -| createShader(type: GLenum) | WebGLShader \| null | -| createTexture() | WebGLTexture \| null | -| cullFace(mode: GLenum) | void | -| deleteBuffer(buffer: WebGLBuffer \| null) | void | -| deleteFramebuffer(framebuffer: WebGLFramebuffer \| null) | void | -| deleteProgram(program: WebGLProgram \| null) | void | -| deleteRenderbuffer(renderbuffer: WebGLRenderbuffer \| null) | void | -| deleteShader(shader: WebGLShader \| null) | void | -| deleteTexture(texture: WebGLTexture \| null) | void | -| depthFunc(func: GLenum) | void | -| depthMask(flag: GLboolean) | void | -| depthRange(zNear: GLclampf, zFar: GLclampf) | void | -| detachShader(program: WebGLProgram, shader: WebGLShader) | void | -| disable(cap: GLenum) | void | -| disableVertexAttribArray(index: GLuint) | void | -| drawArrays(mode: GLenum, first: GLint, count: GLsizei) | void | -| drawElements(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr) | void | -| enable(cap: GLenum) | void | -| enableVertexAttribArray(index: GLuint) | void | +| getSupportedExtensions() | string[] \| null | +| getExtension(name: string) | any | +| activeTexture(texture: GLenum) | void | +| attachShader(program: WebGLProgram, shader: WebGLShader) | void | +| bindAttribLocation(program: WebGLProgram, index: GLuint, name: string) | void | +| bindBuffer(target: GLenum, buffer: WebGLBuffer \| null) | void | +| bindFramebuffer(target: GLenum, framebuffer: WebGLFramebuffer \| null) | void | +| bindRenderbuffer(target: GLenum, renderbuffer: WebGLRenderbuffer \| null) | void | +| bindTexture(target: GLenum, texture: WebGLTexture \| null) | void | +| blendColor(red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf) | void | +| blendEquation(mode: GLenum) | void | +| blendEquationSeparate(modeRGB: GLenum, modeAlpha: GLenum) | void | +| blendFunc(sfactor: GLenum, dfactor: GLenum) | void | +| blendFuncSeparate(srcRGB: GLenum, dstRGB: GLenum, srcAlpha: GLenum, dstAlpha: GLenum) | void | +| checkFramebufferStatus(target: GLenum) | GLenum | +| clear(mask: GLbitfield) | void | +| clearColor(red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf) | void | +| clearDepth(depth: GLclampf) | void | +| clearStencil(s: GLint) | void | +| colorMask(red: GLboolean, green: GLboolean, blue: GLboolean, alpha: GLboolean) | void | +| compileShader(shader: WebGLShader) | void | +| copyTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, x: GLint, y: GLint, width: GLsizei, height: GLsizei, border: GLint) | void | +| copyTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | +| createBuffer() | WebGLBuffer \| null | +| createFramebuffer() | WebGLFramebuffer \| null | +| createProgram() | WebGLProgram \| null | +| createRenderbuffer() | WebGLRenderbuffer \| null | +| createShader(type: GLenum) | WebGLShader \| null | +| createTexture() | WebGLTexture \| null | +| cullFace(mode: GLenum) | void | +| deleteBuffer(buffer: WebGLBuffer \| null) | void | +| deleteFramebuffer(framebuffer: WebGLFramebuffer \| null) | void | +| deleteProgram(program: WebGLProgram \| null) | void | +| deleteRenderbuffer(renderbuffer: WebGLRenderbuffer \| null) | void | +| deleteShader(shader: WebGLShader \| null) | void | +| deleteTexture(texture: WebGLTexture \| null) | void | +| depthFunc(func: GLenum) | void | +| depthMask(flag: GLboolean) | void | +| depthRange(zNear: GLclampf, zFar: GLclampf) | void | +| detachShader(program: WebGLProgram, shader: WebGLShader) | void | +| disable(cap: GLenum) | void | +| disableVertexAttribArray(index: GLuint) | void | +| drawArrays(mode: GLenum, first: GLint, count: GLsizei) | void | +| drawElements(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr) | void | +| enable(cap: GLenum) | void | +| enableVertexAttribArray(index: GLuint) | void | | finish() | void | | flush() | void | -| framebufferRenderbuffer(target: GLenum, attachment: GLenum, renderbuffertarget: GLenum, renderbuffer: WebGLRenderbuffer \| null) | void | -| framebufferTexture2D(target: GLenum, attachment: GLenum, textarget: GLenum, texture: WebGLTexture \| null, level: GLint) | void | -| frontFace(mode: GLenum) | void | -| generateMipmap(target: GLenum) | void | -| getActiveAttrib(program: WebGLProgram, index: GLuint) | WebGLActiveInfo \| null | -| getActiveUniform(program: WebGLProgram, index: GLuint) | WebGLActiveInfo \| null | -| getAttachedShaders(program: WebGLProgram) | WebGLShader[] \| null | -| getAttribLocation(program: WebGLProgram, name: string) | GLint | -| getBufferParameter(target: GLenum, pname: GLenum) | any | -| getParameter(pname: GLenum) | any | +| framebufferRenderbuffer(target: GLenum, attachment: GLenum, renderbuffertarget: GLenum, renderbuffer: WebGLRenderbuffer \| null) | void | +| framebufferTexture2D(target: GLenum, attachment: GLenum, textarget: GLenum, texture: WebGLTexture \| null, level: GLint) | void | +| frontFace(mode: GLenum) | void | +| generateMipmap(target: GLenum) | void | +| getActiveAttrib(program: WebGLProgram, index: GLuint) | WebGLActiveInfo \| null | +| getActiveUniform(program: WebGLProgram, index: GLuint) | WebGLActiveInfo \| null | +| getAttachedShaders(program: WebGLProgram) | WebGLShader[] \| null | +| getAttribLocation(program: WebGLProgram, name: string) | GLint | +| getBufferParameter(target: GLenum, pname: GLenum) | any | +| getParameter(pname: GLenum) | any | | getError() | GLenum | -| getFramebufferAttachmentParameter(target: GLenum, attachment: GLenum, pname: GLenum) | any | -| getProgramParameter(program: WebGLProgram, pname: GLenum) | any | -| getProgramInfoLog(program: WebGLProgram) | string \| null | -| getRenderbufferParameter(target: GLenum, pname: GLenum) | any | -| getShaderParameter(shader: WebGLShader, pname: GLenum) | any | -| getShaderPrecisionFormat(shadertype: GLenum, precisiontype: GLenum) | WebGLShaderPrecisionFormat \| null | -| getShaderInfoLog(shader: WebGLShader) | string \| null | -| getShaderSource(shader: WebGLShader) | string \| null | -| getTexParameter(target: GLenum, pname: GLenum) | any | -| getUniform(program: WebGLProgram, location: WebGLUniformLocation) | any | -| getUniformLocation(program: WebGLProgram, name: string) | WebGLUniformLocation \| null | -| getVertexAttrib(index: GLuint, pname: GLenum) | any | -| getVertexAttribOffset(index: GLuint, pname: GLenum) | GLintptr | -| hint(target: GLenum, mode: GLenum) | void | -| isBuffer(buffer: WebGLBuffer \| null) | GLboolean | -| isEnabled(cap: GLenum) | GLboolean | -| isFramebuffer(framebuffer: WebGLFramebuffer \| null) | GLboolean | -| isProgram(program: WebGLProgram \| null) | GLboolean | -| isRenderbuffer(renderbuffer: WebGLRenderbuffer \| null) | GLboolean | -| isShader(shader: WebGLShader \| null) | GLboolean | -| isTexture(texture: WebGLTexture \| null) | GLboolean | -| lineWidth(width: GLfloat) | void | -| linkProgram(program: WebGLProgram) | void | -| pixelStorei(pname: GLenum, param: GLint \| GLboolean) | void | -| polygonOffset(factor: GLfloat, units: GLfloat) | void | -| renderbufferStorage(target: GLenum, internalformat: GLenum, width: GLsizei, height: GLsizei) | void | -| sampleCoverage(value: GLclampf, invert: GLboolean) | void | -| scissor(x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | -| shaderSource(shader: WebGLShader, source: string) | void | -| stencilFunc(func: GLenum, ref: GLint, mask: GLuint) | void | -| stencilFuncSeparate(face: GLenum, func: GLenum, ref: GLint, mask: GLuint) | void | -| stencilMask(mask: GLuint) | void | -| stencilMaskSeparate(face: GLenum, mask: GLuint) | void | -| stencilOp(fail: GLenum, zfail: GLenum, zpass: GLenum) | void | -| stencilOpSeparate(face: GLenum, fail: GLenum, zfail: GLenum, zpass: GLenum) | void | -| texParameterf(target: GLenum, pname: GLenum, param: GLfloat) | void | -| texParameteri(target: GLenum, pname: GLenum, param: GLint) | void | -| uniform1f(location: WebGLUniformLocation \| null, x: GLfloat) | void | -| uniform2f(location: WebGLUniformLocation \| null, x: GLfloat, y: GLfloat) | void | -| uniform3f(location: WebGLUniformLocation \| null, x: GLfloat, y: GLfloat, z: GLfloat) | void | -| uniform4f(location: WebGLUniformLocation \| null, x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat) | void | -| uniform1i(location: WebGLUniformLocation \| null, x: GLint) | void | -| uniform2i(location: WebGLUniformLocation \| null, x: GLint, y: GLint) | void | -| uniform3i(location: WebGLUniformLocation \| null, x: GLint, y: GLint, z: GLint) | void | -| uniform4i(location: WebGLUniformLocation \| null, x: GLint, y: GLint, z: GLint, w: GLint) | void | -| useProgram(program: WebGLProgram \| null) | void | -| validateProgram(program: WebGLProgram) | void | -| vertexAttrib1f(index: GLuint, x: GLfloat) | void | -| vertexAttrib2f(index: GLuint, x: GLfloat, y: GLfloat) | void | -| vertexAttrib3f(index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat) | void | -| vertexAttrib4f(index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat) | void | -| vertexAttrib1fv(index: GLuint, values: Float32List) | void | -| vertexAttrib2fv(index: GLuint, values: Float32List) | void | -| vertexAttrib3fv(index: GLuint, values: Float32List) | void | -| vertexAttrib4fv(index: GLuint, values: Float32List) | void | -| vertexAttribPointer(index: GLuint, size: GLint, type: GLenum, normalized: GLboolean, stride: GLsizei, offset: GLintptr) | void | -| viewport(x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | +| getFramebufferAttachmentParameter(target: GLenum, attachment: GLenum, pname: GLenum) | any | +| getProgramParameter(program: WebGLProgram, pname: GLenum) | any | +| getProgramInfoLog(program: WebGLProgram) | string \| null | +| getRenderbufferParameter(target: GLenum, pname: GLenum) | any | +| getShaderParameter(shader: WebGLShader, pname: GLenum) | any | +| getShaderPrecisionFormat(shadertype: GLenum, precisiontype: GLenum) | WebGLShaderPrecisionFormat \| null | +| getShaderInfoLog(shader: WebGLShader) | string \| null | +| getShaderSource(shader: WebGLShader) | string \| null | +| getTexParameter(target: GLenum, pname: GLenum) | any | +| getUniform(program: WebGLProgram, location: WebGLUniformLocation) | any | +| getUniformLocation(program: WebGLProgram, name: string) | WebGLUniformLocation \| null | +| getVertexAttrib(index: GLuint, pname: GLenum) | any | +| getVertexAttribOffset(index: GLuint, pname: GLenum) | GLintptr | +| hint(target: GLenum, mode: GLenum) | void | +| isBuffer(buffer: WebGLBuffer \| null) | GLboolean | +| isEnabled(cap: GLenum) | GLboolean | +| isFramebuffer(framebuffer: WebGLFramebuffer \| null) | GLboolean | +| isProgram(program: WebGLProgram \| null) | GLboolean | +| isRenderbuffer(renderbuffer: WebGLRenderbuffer \| null) | GLboolean | +| isShader(shader: WebGLShader \| null) | GLboolean | +| isTexture(texture: WebGLTexture \| null) | GLboolean | +| lineWidth(width: GLfloat) | void | +| linkProgram(program: WebGLProgram) | void | +| pixelStorei(pname: GLenum, param: GLint \| GLboolean) | void | +| polygonOffset(factor: GLfloat, units: GLfloat) | void | +| renderbufferStorage(target: GLenum, internalformat: GLenum, width: GLsizei, height: GLsizei) | void | +| sampleCoverage(value: GLclampf, invert: GLboolean) | void | +| scissor(x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | +| shaderSource(shader: WebGLShader, source: string) | void | +| stencilFunc(func: GLenum, ref: GLint, mask: GLuint) | void | +| stencilFuncSeparate(face: GLenum, func: GLenum, ref: GLint, mask: GLuint) | void | +| stencilMask(mask: GLuint) | void | +| stencilMaskSeparate(face: GLenum, mask: GLuint) | void | +| stencilOp(fail: GLenum, zfail: GLenum, zpass: GLenum) | void | +| stencilOpSeparate(face: GLenum, fail: GLenum, zfail: GLenum, zpass: GLenum) | void | +| texParameterf(target: GLenum, pname: GLenum, param: GLfloat) | void | +| texParameteri(target: GLenum, pname: GLenum, param: GLint) | void | +| uniform1f(location: WebGLUniformLocation \| null, x: GLfloat) | void | +| uniform2f(location: WebGLUniformLocation \| null, x: GLfloat, y: GLfloat) | void | +| uniform3f(location: WebGLUniformLocation \| null, x: GLfloat, y: GLfloat, z: GLfloat) | void | +| uniform4f(location: WebGLUniformLocation \| null, x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat) | void | +| uniform1i(location: WebGLUniformLocation \| null, x: GLint) | void | +| uniform2i(location: WebGLUniformLocation \| null, x: GLint, y: GLint) | void | +| uniform3i(location: WebGLUniformLocation \| null, x: GLint, y: GLint, z: GLint) | void | +| uniform4i(location: WebGLUniformLocation \| null, x: GLint, y: GLint, z: GLint, w: GLint) | void | +| useProgram(program: WebGLProgram \| null) | void | +| validateProgram(program: WebGLProgram) | void | +| vertexAttrib1f(index: GLuint, x: GLfloat) | void | +| vertexAttrib2f(index: GLuint, x: GLfloat, y: GLfloat) | void | +| vertexAttrib3f(index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat) | void | +| vertexAttrib4f(index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat) | void | +| vertexAttrib1fv(index: GLuint, values: Float32List) | void | +| vertexAttrib2fv(index: GLuint, values: Float32List) | void | +| vertexAttrib3fv(index: GLuint, values: Float32List) | void | +| vertexAttrib4fv(index: GLuint, values: Float32List) | void | +| vertexAttribPointer(index: GLuint, size: GLint, type: GLenum, normalized: GLboolean, stride: GLsizei, offset: GLintptr) | void | +| viewport(x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | ## WebGLRenderingContextOverloads @@ -561,24 +561,24 @@ WebGLRenderingContextOverloads | Method| Return Value Type| | -------- | -------- | -| bufferData(target: GLenum, size: GLsizeiptr, usage: GLenum) | void | -| bufferData(target: GLenum, data: BufferSource \| null, usage: GLenum) | void | -| bufferSubData(target: GLenum, offset: GLintptr, data: BufferSource) | void | -| compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, data: ArrayBufferView) | void | -| compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, data: ArrayBufferView) | void | -| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void; | -| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | -| texImage2D(target: GLenum, level: GLint, internalformat: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | -| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | -| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | -| uniform1fv(location: WebGLUniformLocation \| null, v: Float32List) | void | -| uniform2fv(location: WebGLUniformLocation \| null, v: Float32List) | void | -| uniform3fv(location: WebGLUniformLocation \| null, v: Float32List) | void | -| uniform4fv(location: WebGLUniformLocation \| null, v: Float32List) | void | -| uniform1iv(location: WebGLUniformLocation \| null, v: Int32List) | void | -| uniform2iv(location: WebGLUniformLocation \| null, v: Int32List) | void | -| uniform3iv(location: WebGLUniformLocation \| null, v: Int32List) | void | -| uniform4iv(location: WebGLUniformLocation \| null, v: Int32List) | void | -| uniformMatrix2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, value: Float32List) | void | -| uniformMatrix3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, value: Float32List) | void | -| uniformMatrix4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, value: Float32List) | void | +| bufferData(target: GLenum, size: GLsizeiptr, usage: GLenum) | void | +| bufferData(target: GLenum, data: BufferSource \| null, usage: GLenum) | void | +| bufferSubData(target: GLenum, offset: GLintptr, data: BufferSource) | void | +| compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, data: ArrayBufferView) | void | +| compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, data: ArrayBufferView) | void | +| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | +| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | +| texImage2D(target: GLenum, level: GLint, internalformat: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | +| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | +| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | +| uniform1fv(location: WebGLUniformLocation \| null, v: Float32List) | void | +| uniform2fv(location: WebGLUniformLocation \| null, v: Float32List) | void | +| uniform3fv(location: WebGLUniformLocation \| null, v: Float32List) | void | +| uniform4fv(location: WebGLUniformLocation \| null, v: Float32List) | void | +| uniform1iv(location: WebGLUniformLocation \| null, v: Int32List) | void | +| uniform2iv(location: WebGLUniformLocation \| null, v: Int32List) | void | +| uniform3iv(location: WebGLUniformLocation \| null, v: Int32List) | void | +| uniform4iv(location: WebGLUniformLocation \| null, v: Int32List) | void | +| uniformMatrix2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, value: Float32List) | void | +| uniformMatrix3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, value: Float32List) | void | +| uniformMatrix4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, value: Float32List) | void | diff --git a/en/application-dev/reference/apis/js-apis-webgl2.md b/en/application-dev/reference/apis/js-apis-webgl2.md index 12cc9789b84cd85960154cd1de1994c8a9f12331..386d1c53dad0df97a9fd0fbbeac33aec45492d5c 100644 --- a/en/application-dev/reference/apis/js-apis-webgl2.md +++ b/en/application-dev/reference/apis/js-apis-webgl2.md @@ -341,101 +341,101 @@ WebGL2RenderingContextBase | Method| Return Value Type| | -------- | -------- | -| copyBufferSubData(readTarget: GLenum, writeTarget: GLenum, readOffset: GLintptr, writeOffset: GLintptr, size: GLsizeiptr) | void | -| getBufferSubData(target: GLenum, srcByteOffset: GLintptr, dstBuffer: ArrayBufferView, dstOffset?: GLuint, length?: GLuint) | void | -| blitFramebuffer(srcX0: GLint, srcY0: GLint, srcX1: GLint, srcY1: GLint, dstX0: GLint, dstY0: GLint, dstX1: GLint, dstY1: GLint, mask: GLbitfield, filter: GLenum) | void | -| framebufferTextureLayer(target: GLenum, attachment: GLenum, texture: WebGLTexture \| null, level: GLint, layer: GLint) | void | -| invalidateFramebuffer(target: GLenum, attachments: GLenum[]) | void | -| invalidateSubFramebuffer(target: GLenum, attachments: GLenum[], x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | -| readBuffer(src: GLenum) | void | -| getInternalformatParameter(target: GLenum, internalformat: GLenum, pname: GLenum) | any | -| renderbufferStorageMultisample(target: GLenum, samples: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei) | void | -| texStorage2D(target: GLenum, levels: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei) | void | -| texStorage3D(target: GLenum, levels: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei) | void | -| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | -| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | -| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView \| null) | void | -| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) | void | -| texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | -| texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, source: TexImageSource) | void | -| texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, srcData: ArrayBufferView \| null, srcOffset?: GLuint) | void | -| copyTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | -| compressedTexImage3D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, imageSize: GLsizei, offset: GLintptr) | void | -| compressedTexImage3D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | -| compressedTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, imageSize: GLsizei, offset: GLintptr) | void | -| compressedTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | -| getFragDataLocation(program: WebGLProgram, name: string) | GLint | -| uniform1ui(location: WebGLUniformLocation \| null, v0: GLuint) | void | -| uniform2ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint) | void | -| uniform3ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint, v2: GLuint) | void | -| uniform4ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint, v2: GLuint, v3: GLuint) | void | -| uniform1uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform2uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform3uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform4uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix3x2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix4x2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix2x3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix4x3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix2x4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix3x4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| vertexAttribI4i(index: GLuint, x: GLint, y: GLint, z: GLint, w: GLint) | void | -| vertexAttribI4iv(index: GLuint, values: Int32List) | void | -| vertexAttribI4ui(index: GLuint, x: GLuint, y: GLuint, z: GLuint, w: GLuint) | void | -| vertexAttribI4uiv(index: GLuint, values: Uint32List) | void | -| vertexAttribIPointer(index: GLuint, size: GLint, type: GLenum, stride: GLsizei, offset: GLintptr) | void | -| vertexAttribDivisor(index: GLuint, divisor: GLuint) | void | -| drawArraysInstanced(mode: GLenum, first: GLint, count: GLsizei, instanceCount: GLsizei) | void | -| drawElementsInstanced(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, instanceCount: GLsizei) | void | -| drawRangeElements(mode: GLenum, start: GLuint, end: GLuint, count: GLsizei, type: GLenum, offset: GLintptr) | void | -| drawBuffers(buffers: GLenum[]) | void | -| clearBufferfv(buffer: GLenum, drawbuffer: GLint, values: Float32List, srcOffset?: GLuint) | void | -| clearBufferiv(buffer: GLenum, drawbuffer: GLint, values: Int32List, srcOffset?: GLuint) | void | -| clearBufferuiv(buffer: GLenum, drawbuffer: GLint, values: Uint32List, srcOffset?: GLuint) | void | -| clearBufferfi(buffer: GLenum, drawbuffer: GLint, depth: GLfloat, stencil: GLint) | void | -| createQuery() | WebGLQuery \| null | -| deleteQuery(query: WebGLQuery \| null) | void | -| isQuery(query: WebGLQuery \| null) | GLboolean | -| beginQuery(target: GLenum, query: WebGLQuery) | void | -| endQuery(target: GLenum) | void | -| getQuery(target: GLenum, pname: GLenum) | WebGLQuery \| null | -| getQueryParameter(query: WebGLQuery, pname: GLenum) | any | -| createSampler() | WebGLSampler \| null | -| deleteSampler(sampler: WebGLSampler \| null) | void | -| isSampler(sampler: WebGLSampler \| null) | GLboolean | -| bindSampler(unit: GLuint, sampler: WebGLSampler \| null) | void | -| samplerParameteri(sampler: WebGLSampler, pname: GLenum, param: GLint) | void | -| samplerParameterf(sampler: WebGLSampler, pname: GLenum, param: GLfloat) | void; | -| getSamplerParameter(sampler: WebGLSampler, pname: GLenum) | any | -| fenceSync(condition: GLenum, flags: GLbitfield) | WebGLSync \| null | -| isSync(sync: WebGLSync \| null) | GLboolean | -| deleteSync(sync: WebGLSync \| null) | void | -| clientWaitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLuint64) | GLenum | -| waitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLint64) | void | -| getSyncParameter(sync: WebGLSync, pname: GLenum) | any | -| createTransformFeedback() | WebGLTransformFeedback \| null | -| deleteTransformFeedback(tf: WebGLTransformFeedback \| null) | void | -| isTransformFeedback(tf: WebGLTransformFeedback \| null) | GLboolean | -| bindTransformFeedback(target: GLenum, tf: WebGLTransformFeedback \| null) | void | -| beginTransformFeedback(primitiveMode: GLenum) | void | +| copyBufferSubData(readTarget: GLenum, writeTarget: GLenum, readOffset: GLintptr, writeOffset: GLintptr, size: GLsizeiptr) | void | +| getBufferSubData(target: GLenum, srcByteOffset: GLintptr, dstBuffer: ArrayBufferView, dstOffset?: GLuint, length?: GLuint) | void | +| blitFramebuffer(srcX0: GLint, srcY0: GLint, srcX1: GLint, srcY1: GLint, dstX0: GLint, dstY0: GLint, dstX1: GLint, dstY1: GLint, mask: GLbitfield, filter: GLenum) | void | +| framebufferTextureLayer(target: GLenum, attachment: GLenum, texture: WebGLTexture \| null, level: GLint, layer: GLint) | void | +| invalidateFramebuffer(target: GLenum, attachments: GLenum[]) | void | +| invalidateSubFramebuffer(target: GLenum, attachments: GLenum[], x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | +| readBuffer(src: GLenum) | void | +| getInternalformatParameter(target: GLenum, internalformat: GLenum, pname: GLenum) | any | +| renderbufferStorageMultisample(target: GLenum, samples: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei) | void | +| texStorage2D(target: GLenum, levels: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei) | void | +| texStorage3D(target: GLenum, levels: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei) | void | +| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | +| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | +| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView \| null) | void | +| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) | void | +| texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | +| texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, source: TexImageSource) | void | +| texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, srcData: ArrayBufferView \| null, srcOffset?: GLuint) | void | +| copyTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | +| compressedTexImage3D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, imageSize: GLsizei, offset: GLintptr) | void | +| compressedTexImage3D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | +| compressedTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, imageSize: GLsizei, offset: GLintptr) | void | +| compressedTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | +| getFragDataLocation(program: WebGLProgram, name: string) | GLint | +| uniform1ui(location: WebGLUniformLocation \| null, v0: GLuint) | void | +| uniform2ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint) | void | +| uniform3ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint, v2: GLuint) | void | +| uniform4ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint, v2: GLuint, v3: GLuint) | void | +| uniform1uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform2uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform3uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform4uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix3x2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix4x2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix2x3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix4x3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix2x4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix3x4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| vertexAttribI4i(index: GLuint, x: GLint, y: GLint, z: GLint, w: GLint) | void | +| vertexAttribI4iv(index: GLuint, values: Int32List) | void | +| vertexAttribI4ui(index: GLuint, x: GLuint, y: GLuint, z: GLuint, w: GLuint) | void | +| vertexAttribI4uiv(index: GLuint, values: Uint32List) | void | +| vertexAttribIPointer(index: GLuint, size: GLint, type: GLenum, stride: GLsizei, offset: GLintptr) | void | +| vertexAttribDivisor(index: GLuint, divisor: GLuint) | void | +| drawArraysInstanced(mode: GLenum, first: GLint, count: GLsizei, instanceCount: GLsizei) | void | +| drawElementsInstanced(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, instanceCount: GLsizei) | void | +| drawRangeElements(mode: GLenum, start: GLuint, end: GLuint, count: GLsizei, type: GLenum, offset: GLintptr) | void | +| drawBuffers(buffers: GLenum[]) | void | +| clearBufferfv(buffer: GLenum, drawbuffer: GLint, values: Float32List, srcOffset?: GLuint) | void | +| clearBufferiv(buffer: GLenum, drawbuffer: GLint, values: Int32List, srcOffset?: GLuint) | void | +| clearBufferuiv(buffer: GLenum, drawbuffer: GLint, values: Uint32List, srcOffset?: GLuint) | void | +| clearBufferfi(buffer: GLenum, drawbuffer: GLint, depth: GLfloat, stencil: GLint) | void | +| createQuery() | WebGLQuery \| null | +| deleteQuery(query: WebGLQuery \| null) | void | +| isQuery(query: WebGLQuery \| null) | GLboolean | +| beginQuery(target: GLenum, query: WebGLQuery) | void | +| endQuery(target: GLenum) | void | +| getQuery(target: GLenum, pname: GLenum) | WebGLQuery \| null | +| getQueryParameter(query: WebGLQuery, pname: GLenum) | any | +| createSampler() | WebGLSampler \| null | +| deleteSampler(sampler: WebGLSampler \| null) | void | +| isSampler(sampler: WebGLSampler \| null) | GLboolean | +| bindSampler(unit: GLuint, sampler: WebGLSampler \| null) | void | +| samplerParameteri(sampler: WebGLSampler, pname: GLenum, param: GLint) | void | +| samplerParameterf(sampler: WebGLSampler, pname: GLenum, param: GLfloat) | void; | +| getSamplerParameter(sampler: WebGLSampler, pname: GLenum) | any | +| fenceSync(condition: GLenum, flags: GLbitfield) | WebGLSync \| null | +| isSync(sync: WebGLSync \| null) | GLboolean | +| deleteSync(sync: WebGLSync \| null) | void | +| clientWaitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLuint64) | GLenum | +| waitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLint64) | void | +| getSyncParameter(sync: WebGLSync, pname: GLenum) | any | +| createTransformFeedback() | WebGLTransformFeedback \| null | +| deleteTransformFeedback(tf: WebGLTransformFeedback \| null) | void | +| isTransformFeedback(tf: WebGLTransformFeedback \| null) | GLboolean | +| bindTransformFeedback(target: GLenum, tf: WebGLTransformFeedback \| null) | void | +| beginTransformFeedback(primitiveMode: GLenum) | void | | endTransformFeedback() | void | -| transformFeedbackVaryings(program: WebGLProgram, varyings: string[], bufferMode: GLenum) | void | -| getTransformFeedbackVarying(program: WebGLProgram, index: GLuint) | WebGLActiveInfo \| null | +| transformFeedbackVaryings(program: WebGLProgram, varyings: string[], bufferMode: GLenum) | void | +| getTransformFeedbackVarying(program: WebGLProgram, index: GLuint) | WebGLActiveInfo \| null | | pauseTransformFeedback() | void | | resumeTransformFeedback() | void | -| bindBufferBase(target: GLenum, index: GLuint, buffer: WebGLBuffer \| null) | void | -| bindBufferRange(target: GLenum, index: GLuint, buffer: WebGLBuffer \| null, offset: GLintptr, size: GLsizeiptr) | void | -| getIndexedParameter(target: GLenum, index: GLuint) | any | -| getUniformIndices(program: WebGLProgram, uniformNames: string[]) | GLuint[] \| null | -| getActiveUniforms(program: WebGLProgram, uniformIndices: GLuint[], pname: GLenum) | any | -| getUniformBlockIndex(program: WebGLProgram, uniformBlockName: string) | GLuint | -| getActiveUniformBlockParameter(program: WebGLProgram, uniformBlockIndex: GLuint, pname: GLenum) | any | -| getActiveUniformBlockName(program: WebGLProgram, uniformBlockIndex: GLuint) | string \| null | -| uniformBlockBinding(program: WebGLProgram, uniformBlockIndex: GLuint, uniformBlockBinding: GLuint) | void | -| createVertexArray() | WebGLVertexArrayObject \| null | -| deleteVertexArray(vertexArray: WebGLVertexArrayObject \| null) | void | -| isVertexArray(vertexArray: WebGLVertexArrayObject \| null) | GLboolean | -| bindVertexArray(array: WebGLVertexArrayObject \| null) | void | +| bindBufferBase(target: GLenum, index: GLuint, buffer: WebGLBuffer \| null) | void | +| bindBufferRange(target: GLenum, index: GLuint, buffer: WebGLBuffer \| null, offset: GLintptr, size: GLsizeiptr) | void | +| getIndexedParameter(target: GLenum, index: GLuint) | any | +| getUniformIndices(program: WebGLProgram, uniformNames: string[]) | GLuint[] \| null | +| getActiveUniforms(program: WebGLProgram, uniformIndices: GLuint[], pname: GLenum) | any | +| getUniformBlockIndex(program: WebGLProgram, uniformBlockName: string) | GLuint | +| getActiveUniformBlockParameter(program: WebGLProgram, uniformBlockIndex: GLuint, pname: GLenum) | any | +| getActiveUniformBlockName(program: WebGLProgram, uniformBlockIndex: GLuint) | string \| null | +| uniformBlockBinding(program: WebGLProgram, uniformBlockIndex: GLuint, uniformBlockBinding: GLuint) | void | +| createVertexArray() | WebGLVertexArrayObject \| null | +| deleteVertexArray(vertexArray: WebGLVertexArrayObject \| null) | void | +| isVertexArray(vertexArray: WebGLVertexArrayObject \| null) | GLboolean | +| bindVertexArray(array: WebGLVertexArrayObject \| null) | void | ## WebGL2RenderingContextOverloads @@ -444,36 +444,36 @@ WebGL2RenderingContextOverloads | Method| Return Value Type| | -------- | -------- | -| bufferData(target: GLenum, size: GLsizeiptr, usage: GLenum) | void | -| bufferData(target: GLenum, srcData: BufferSource \| null, usage: GLenum) | void | -| bufferSubData(target: GLenum, dstByteOffset: GLintptr, srcData: BufferSource) | void | -| bufferData(target: GLenum, srcData: ArrayBufferView, usage: GLenum, srcOffset: GLuint, length?: GLuint) | void | -| bufferSubData(target: GLenum, dstByteOffset: GLintptr, srcData: ArrayBufferView, srcOffset: GLuint, length?: GLuint) | void | -| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | -| texImage2D(target: GLenum, level: GLint, internalformat: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | -| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | -| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | -| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | -| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | -| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) | void | -| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | -| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, source: TexImageSource) | void | -| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) | void | -| compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, imageSize: GLsizei, offset: GLintptr) | void | -| compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | -| compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, imageSize: GLsizei, offset: GLintptr) | void | -| compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | -| uniform1fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform2fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform3fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform4fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform1iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform2iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform3iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform4iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, dstData: ArrayBufferView \| null) | void | -| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, offset: GLintptr) | void | -| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, dstData: ArrayBufferView, dstOffset: GLuint) | void | +| bufferData(target: GLenum, size: GLsizeiptr, usage: GLenum) | void | +| bufferData(target: GLenum, srcData: BufferSource \| null, usage: GLenum) | void | +| bufferSubData(target: GLenum, dstByteOffset: GLintptr, srcData: BufferSource) | void | +| bufferData(target: GLenum, srcData: ArrayBufferView, usage: GLenum, srcOffset: GLuint, length?: GLuint) | void | +| bufferSubData(target: GLenum, dstByteOffset: GLintptr, srcData: ArrayBufferView, srcOffset: GLuint, length?: GLuint) | void | +| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | +| texImage2D(target: GLenum, level: GLint, internalformat: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | +| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | +| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | +| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | +| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | +| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) | void | +| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | +| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, source: TexImageSource) | void | +| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) | void | +| compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, imageSize: GLsizei, offset: GLintptr) | void | +| compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | +| compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, imageSize: GLsizei, offset: GLintptr) | void | +| compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | +| uniform1fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform2fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform3fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform4fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform1iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform2iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform3iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform4iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, dstData: ArrayBufferView \| null) | void | +| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, offset: GLintptr) | void | +| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, dstData: ArrayBufferView, dstOffset: GLuint) | void | diff --git a/en/application-dev/reference/apis/js-apis-wifi.md b/en/application-dev/reference/apis/js-apis-wifi.md index 875607d4fd022e5a9e91359bde83ee4d1d70a69b..602a3b7e2a318119b1e8dbfa80a59fdc65a6bede 100644 --- a/en/application-dev/reference/apis/js-apis-wifi.md +++ b/en/application-dev/reference/apis/js-apis-wifi.md @@ -21,9 +21,9 @@ Checks whether the WLAN is activated. **System capability**: SystemCapability.Communication.WiFi.STA **Return value** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the WLAN is activated; returns **false** otherwise.| +| **Type**| **Description**| +| -------- | -------- | +| boolean | Returns **true** if the WLAN is activated; returns **false** otherwise.| ## wifi.scan @@ -37,41 +37,41 @@ Starts a scan for WLAN. **System capability**: SystemCapability.Communication.WiFi.STA **Return value** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the scan is successful; returns **false** otherwise.| +| **Type**| **Description**| +| -------- | -------- | +| boolean | Returns **true** if the scan is successful; returns **false** otherwise.| ## wifi.getScanInfos getScanInfos(): Promise<Array<WifiScanInfo>> -Obtains the scan result. This method uses a promise to return the result. +Obtains the scan result. This API uses a promise to return the result. -**Required permissions**: ohos.permission.GET_WIFI_INFO, ohos.permission.GET_WIFI_PEERS_MAC, or ohos.permission.LOCATION +**Required permissions**: at least one of ohos.permission.GET_WIFI_INFO, ohos.permission.GET_WIFI_PEERS_MAC, and ohos.permission.LOCATION **System capability**: SystemCapability.Communication.WiFi.STA **Return value** - | **Type**| **Description**| - | -------- | -------- | - | Promise< Array<[WifiScanInfo](#wifiscaninfo)> > | Promise used to return the scan result, which is a list of hotspots detected.| +| **Type**| **Description**| +| -------- | -------- | +| Promise< Array<[WifiScanInfo](#wifiscaninfo)> > | Promise used to return the hotspots detected.| ## wifi.getScanInfos getScanInfos(callback: AsyncCallback<Array<WifiScanInfo>>): void -Obtains the scan result. This method uses an asynchronous callback to return the result. +Obtains the scan result. This API uses an asynchronous callback to return the result. **Required permissions**: at least one of ohos.permission.GET_WIFI_INFO, ohos.permission.GET_WIFI_PEERS_MAC, and ohos.permission.LOCATION **System capability**: SystemCapability.Communication.WiFi.STA **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback< Array<[WifiScanInfo](#wifiscaninfo)>> | Yes| Callback invoked to return the result, which is a list of hotspots detected.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback< Array<[WifiScanInfo](#wifiscaninfo)>> | Yes| Callback invoked to return the hotspots detected.| **Example** ```js @@ -126,10 +126,12 @@ Represents WLAN hotspot information. | bssid | string | Read only| Basic service set identifier (BSSID) of the hotspot.| | capabilities | string | Read only| Hotspot capabilities.| | securityType | [WifiSecurityType](#WifiSecurityType) | Read only| WLAN security type.| -| rssi | number | Read only| Signal strength of the hotspot, in dBm.| +| rssi | number | Read only| Received signal strength indicator (RSSI) of the hotspot, in dBm.| | band | number | Read only| Frequency band of the WLAN access point (AP).| | frequency | number | Read only| Frequency of the WLAN AP.| | channelWidth | number | Read only| Bandwidth of the WLAN AP.| +| centerFrequency0 | number | Read only| Center frequency.| +| centerFrequency1 | number | Read only| Center frequency.| | timestamp | number | Read only| Timestamp.| @@ -150,7 +152,7 @@ Enumerates the WLAN security types. addUntrustedConfig(config: WifiDeviceConfig): Promise<boolean> -Adds untrusted WLAN configuration. This method uses a promise to return the result. +Adds untrusted WLAN configuration. This API uses a promise to return the result. **Required permissions**: ohos.permission.SET_WIFI_INFO @@ -159,14 +161,14 @@ Adds untrusted WLAN configuration. This method uses a promise to return the resu SystemCapability.Communication.WiFi.STA **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to add.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to add.| **Return value** - | **Type**| **Description**| - | -------- | -------- | - | Promise<boolean> | Promise used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.| +| **Type**| **Description**| +| -------- | -------- | +| Promise<boolean> | Promise used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.| ## WifiDeviceConfig @@ -174,120 +176,120 @@ Represents the WLAN configuration. | **Name**| **Type**| **Readable/Writable**| **Description**| | -------- | -------- | -------- | -------- | -| ssid | string | Read only| Hotspot SSID, in UTF-8 format.| +| ssid | string | Read only| Hotspot service set identifier (SSID), in UTF-8 format.| | bssid | string | Read only| BSSID of the hotspot.| | preSharedKey | string | Read only| Private key of the hotspot.| | isHiddenSsid | boolean | Read only| Whether to hide the network.| -| securityType | [WifiSecurityType](#WifiSecurityType) | Read only| Security type| +| securityType | [WifiSecurityType](#WifiSecurityType) | Read only| Security type.| ## wifi.addUntrustedConfig7+ addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): void -Adds untrusted WLAN configuration. This method uses an asynchronous callback to return the result. +Adds untrusted WLAN configuration. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.SET_WIFI_INFO **System capability**: SystemCapability.Communication.WiFi.STA **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to add.| - | callback | AsyncCallback<boolean> | Yes| Promise used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to add.| +| callback | AsyncCallback<boolean> | Yes| Callback used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.| ## wifi.removeUntrustedConfig7+ removeUntrustedConfig(config: WifiDeviceConfig): Promise<boolean> -Removes untrusted WLAN configuration. This method uses a promise to return the result. +Removes untrusted WLAN configuration. This API uses a promise to return the result. **Required permissions**: ohos.permission.SET_WIFI_INFO **System capability**: SystemCapability.Communication.WiFi.STA **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to remove.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to remove. | **Return value** - | **Type**| **Description**| - | -------- | -------- | - | Promise<boolean> | Promise used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.| +| **Type**| **Description**| +| -------- | -------- | +| Promise<boolean> | Promise used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.| ## wifi.removeUntrustedConfig7+ removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): void -Removes untrusted WLAN configuration. This method uses an asynchronous callback to return the result. +Removes untrusted WLAN configuration. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.SET_WIFI_INFO **System capability**: SystemCapability.Communication.WiFi.STA **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to remove.| - | callback | AsyncCallback<boolean> | Yes| Promise used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to remove. | +| callback | AsyncCallback<boolean> | Yes| Callback used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.| ## wifi.getSignalLevel getSignalLevel(rssi: number, band: number): number -Obtains the WLAN signal strength. +Obtains the WLAN signal level. **Required permissions**: ohos.permission.GET_WIFI_INFO **System capability**: SystemCapability.Communication.WiFi.STA **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | rssi | number | Yes| Signal strength of the hotspot, in dBm.| - | band | number | Yes| Frequency band of the WLAN AP.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| rssi | number | Yes| RSSI of the hotspot, in dBm. | +| band | number | Yes| Frequency band of the WLAN AP.| **Return value** - | **Type**| **Description**| - | -------- | -------- | - | number | Signal strength obtained. The value range is [0, 4].| +| **Type**| **Description**| +| -------- | -------- | +| number | Signal level obtained. The value range is [0, 4].| ## wifi.getLinkedInfo getLinkedInfo(): Promise<WifiLinkedInfo> -Obtains WLAN connection information. This method uses a promise to return the result. +Obtains WLAN connection information. This API uses a promise to return the result. **Required permissions**: ohos.permission.GET_WIFI_INFO **System capability**: SystemCapability.Communication.WiFi.STA **Return value** - | Type| Description| - | -------- | -------- | - | Promise<[WifiLinkedInfo](#WifiLinkedInfo)> | Promise used to return the WLAN connection information obtained.| +| Type| Description| +| -------- | -------- | +| Promise<[WifiLinkedInfo](#WifiLinkedInfo)> | Promise used to return the WLAN connection information obtained.| ## wifi.getLinkedInfo getLinkedInfo(callback: AsyncCallback<WifiLinkedInfo>): void -Obtains WLAN connection information. This method uses a callback to return the result. +Obtains WLAN connection information. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.GET_WIFI_INFO **System capability**: SystemCapability.Communication.WiFi.STA **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<[WifiLinkedInfo](#WifiLinkedInfo)> | Yes| Callback invoked to return the WLAN connection information obtained.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<[WifiLinkedInfo](#WifiLinkedInfo)> | Yes| Callback invoked to return the WLAN connection information obtained.| **Example** ```js @@ -317,11 +319,11 @@ Represents the WLAN connection information. | -------- | -------- | -------- | -------- | | ssid | string | Read only| Hotspot SSID, in UTF-8 format.| | bssid | string | Read only| BSSID of the hotspot.| -| rssi | number | Read only| Signal strength of the hotspot, in dBm.| +| rssi | number | Read only| RSSI of the hotspot, in dBm. | | band | number | Read only| Frequency band of the WLAN AP.| | linkSpeed | number | Read only| Speed of the WLAN AP.| | frequency | number | Read only| Frequency of the WLAN AP.| -| isHidden | boolean | Read only| Whether the WLAN AP is hidden.| +| isHidden | boolean | Read only| Whether to hide the WLAN AP.| | isRestricted | boolean | Read only| Whether to restrict data volume at the WLAN AP.| | macAddress | string | Read only| MAC address of the device.| | ipAddress | number | Read only| IP address of the device that sets up the WLAN connection.| @@ -355,9 +357,9 @@ Checks whether the WLAN is connected. **System capability**: SystemCapability.Communication.WiFi.STA **Return value** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the WLAN is connected; returns **false** otherwise.| +| **Type**| **Description**| +| -------- | -------- | +| boolean | Returns **true** if the WLAN is connected; returns **false** otherwise.| ## wifi.isFeatureSupported7+ @@ -372,14 +374,14 @@ Checks whether the device supports the specified WLAN feature. **Parameters** - | **Name**| **Type**| Mandatory| **Description**| - | -------- | -------- | -------- | -------- | - | featureId | number | Yes| Feature ID.| +| **Name**| **Type**| Mandatory| **Description**| +| -------- | -------- | -------- | -------- | +| featureId | number | Yes| Feature ID.| **Return value** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the feature is supported; returns **false** otherwise.| +| **Type**| **Description**| +| -------- | -------- | +| boolean | Returns **true** if the feature is supported; returns **false** otherwise.| **Feature IDs** @@ -408,9 +410,9 @@ Obtains IP information. **System capability**: SystemCapability.Communication.WiFi.STA **Return value** - | **Type**| **Description**| - | -------- | -------- | - | [IpInfo](#IpInfo) | IP information obtained.| +| **Type**| **Description**| +| -------- | -------- | +| [IpInfo](#IpInfo) | IP information obtained.| ## IpInfo7+ @@ -439,41 +441,41 @@ Obtains the country code. **System capability**: SystemCapability.Communication.WiFi.Core **Return value** - | **Type**| **Description**| - | -------- | -------- | - | string | Country code obtained.| +| **Type**| **Description**| +| -------- | -------- | +| string | Country code obtained.| ## wifi.getP2pLinkedInfo8+ getP2pLinkedInfo(): Promise<WifiP2pLinkedInfo> -Obtains peer-to-peer (P2P) connection information. This method uses a promise to return the result. +Obtains peer-to-peer (P2P) connection information. This API uses a promise to return the result. **Required permissions**: ohos.permission.GET_WIFI_INFO **System capability**: SystemCapability.Communication.WiFi.P2P **Return value** - | Type| Description| - | -------- | -------- | - | Promise<[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)> | Promise used to return the P2P connection information obtained.| +| Type| Description| +| -------- | -------- | +| Promise<[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)> | Promise used to return the P2P connection information obtained.| ## wifi.getP2pLinkedInfo8+ getP2pLinkedInfo(callback: AsyncCallback<WifiP2pLinkedInfo>): void -Obtains P2P connection information. This method uses a callback to return the result. +Obtains P2P connection information. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.GET_WIFI_INFO **System capability**: SystemCapability.Communication.WiFi.P2P **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)> | Yes| Callback used to return the P2P connection information obtained.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)> | Yes| Callback used to return the P2P connection information obtained.| ## WifiP2pLinkedInfo8+ @@ -483,8 +485,8 @@ Represents the WLAN connection information. | Name| Type| Readable/Writable| Description| | -------- | -------- | -------- | -------- | | connectState | [P2pConnectState](#P2pConnectState) | Read only| P2P connection state.| -| isGroupOwner | boolean | Read only| Whether it is a group.| -| groupOwnerAddr | string | Read only| MAC address of the group.| +| isGroupOwner | boolean | Read only| Whether it is a group owner.| +| groupOwnerAddr | string | Read only| MAC address of the group owner.| ## P2pConnectState8+ @@ -501,33 +503,62 @@ Enumerates the P2P connection states. getCurrentGroup(): Promise<WifiP2pGroupInfo> -Obtains the current P2P group information. This method uses a promise to return the result. +Obtains the current P2P group information. This API uses a promise to return the result. **Required permissions**: ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION **System capability**: SystemCapability.Communication.WiFi.P2P **Return value** - | Type| Description| - | -------- | -------- | - | Promise<[WifiP2pGroupInfo](#WifiP2pGroupInfo)> | Promise used to return the P2P group information obtained.| +| Type| Description| +| -------- | -------- | +| Promise<[WifiP2pGroupInfo](#WifiP2pGroupInfo)> | Promise used to return the P2P group information obtained.| ## wifi.getCurrentGroup8+ getCurrentGroup(callback: AsyncCallback<WifiP2pGroupInfo>): void -Obtains the P2P group information. This method uses an asynchronous callback to return the result. +Obtains the P2P group information. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION **System capability**: SystemCapability.Communication.WiFi.P2P **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<[WifiP2pGroupInfo](#WifiP2pGroupInfo)> | Yes| Callback used to return the P2P group information obtained.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<[WifiP2pGroupInfo](#WifiP2pGroupInfo)> | Yes| Callback used to return the P2P group information obtained.| + +## wifi.getP2pGroups9+ + +getP2pGroups(): Promise<Array<WifiP2pGroupInfo> + +Obtains information about all P2P groups. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION + +**System capability**: SystemCapability.Communication.WiFi.P2P + +**Return value** +| Type| Description| +| -------- | -------- | +| Promise< Array<[WifiP2pGroupInfo](#WifiP2pGroupInfo)> > | Information about all created P2P groups obtained.| + +## wifi.getP2pGroups9+ + +getP2pGroups(callback: AsyncCallback<Array<WifiP2pGroupInfo>): void + +Obtains information about all P2P groups. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION + +**System capability**: SystemCapability.Communication.WiFi.P2P +**Parameters** +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback< Array<[WifiP2pGroupInfo](#WifiP2pGroupInfo)>> | Yes| Callback invoked to return the P2P group information obtained.| ## WifiP2pGroupInfo8+ @@ -574,33 +605,63 @@ Enumerates the device states. getP2pPeerDevices(): Promise<WifiP2pDevice[]> -Obtains the list of peer devices in a P2P connection. This method uses a promise to return the result. +Obtains the list of peer devices in a P2P connection. This API uses a promise to return the result. **Required permissions**: ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION **System capability**: SystemCapability.Communication.WiFi.P2P **Return value** - | Type| Description| - | -------- | -------- | - | Promise<[WifiP2pDevice[]](#WifiP2pDevice)> | Promise used to return the peer device list obtained.| +| Type| Description| +| -------- | -------- | +| Promise<[WifiP2pDevice[]](#WifiP2pDevice)> | Promise used to return the peer device list obtained.| ## wifi.getP2pPeerDevices8+ getP2pPeerDevices(callback: AsyncCallback<WifiP2pDevice[]>): void -Obtains the list of peer devices in a P2P connection. This method uses an asynchronous callback to return the result. +Obtains the list of peer devices in a P2P connection. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION **System capability**: SystemCapability.Communication.WiFi.P2P **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<[WifiP2pDevice[]](#WifiP2pDevice)> | Yes| Callback used to return the peer device list obtained.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<[WifiP2pDevice[]](#WifiP2pDevice)> | Yes| Callback used to return the peer device list obtained.| + +## wifi.getP2pLocalDevice9+ + +getP2pLocalDevice(): Promise<WifiP2pDevice> + +Obtains local device information. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG + +**System capability**: SystemCapability.Communication.WiFi.P2P + +**Return value** +| Type| Description| +| -------- | -------- | +| Promise<[WifiP2pDevice](#WifiP2pDevice)> | Promise used to return the local device information obtained.| + + +## wifi.getP2pLocalDevice8+ + +getP2pLocalDevice(callback: AsyncCallback<WifiP2pDevice>): void + +Obtains local device information. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG + +**System capability**: SystemCapability.Communication.WiFi.P2P +**Parameters** +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<[WifiP2pDevice](#WifiP2pDevice)> | Yes| Callback invoked to returnthe local device information obtained.| ## wifi.createGroup8+ @@ -614,14 +675,14 @@ Creates a P2P group. **Parameters** - | **Name**| **Type**| Mandatory| **Description**| - | -------- | -------- | -------- | -------- | - | config | [WifiP2PConfig](#WifiP2PConfig) | Yes| Group configuration.| +| **Name**| **Type**| Mandatory| **Description**| +| -------- | -------- | -------- | -------- | +| config | [WifiP2PConfig](#WifiP2PConfig) | Yes| Group configuration.| **Return value** - | Type| Description| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| ## WifiP2PConfig8+ @@ -650,16 +711,16 @@ Enumerates the P2P group bandwidths. removeGroup(): boolean; -Removes a P2P group. +Removes this P2P group. **Required permissions**: ohos.permission.GET_WIFI_INFO **System capability**: SystemCapability.Communication.WiFi.P2P **Return value** - | Type| Description| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| ## wifi.p2pConnect8+ @@ -674,14 +735,14 @@ Sets up a P2P connection. **Parameters** - | **Name**| **Type**| Mandatory| **Description**| - | -------- | -------- | -------- | -------- | - | config | [WifiP2PConfig](#WifiP2PConfig) | Yes| Connection configuration.| +| **Name**| **Type**| Mandatory| **Description**| +| -------- | -------- | -------- | -------- | +| config | [WifiP2PConfig](#WifiP2PConfig) | Yes| Connection configuration.| **Return value** - | Type| Description| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -762,9 +823,9 @@ Cancels this P2P connection. **System capability**: SystemCapability.Communication.WiFi.P2P **Return value** - | Type| Description| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| ## wifi.startDiscoverDevices8+ @@ -778,9 +839,9 @@ Starts to discover devices. **System capability**: SystemCapability.Communication.WiFi.P2P **Return value** - | Type| Description| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| ## wifi.stopDiscoverDevices8+ @@ -794,9 +855,9 @@ Stops discovering devices. **System capability**: SystemCapability.Communication.WiFi.P2P **Return value** - | Type| Description| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| ## wifi.on('wifiStateChange')7+ @@ -810,10 +871,10 @@ Registers the WLAN state change events. **System capability**: SystemCapability.Communication.WiFi.STA **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **wifiStateChange**.| - | callback | Callback<number> | Yes| Callback invoked to return the WLAN state.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **wifiStateChange**.| +| callback | Callback<number> | Yes| Callback invoked to return the WLAN state.| **WLAN states** @@ -836,10 +897,10 @@ Unregisters the WLAN state change events. **System capability**: SystemCapability.Communication.WiFi.STA **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **wifiStateChange**.| - | callback | Callback<number> | No| Callback used to return the WLAN state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **wifiStateChange**.| +| callback | Callback<number> | No| Callback used to return the WLAN state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| **Example** ```js @@ -850,10 +911,10 @@ Unregisters the WLAN state change events. console.info("Receive power state change event: " + result); } - // Register event + // Register an event. wifi.on(WIFI_POWER_STATE, recvPowerNotifyFunc); - // Unregister event + // Unregister an event. wifi.off(WIFI_POWER_STATE, recvPowerNotifyFunc); ``` @@ -869,10 +930,10 @@ Registers the WLAN connection state change events. **System capability**: SystemCapability.Communication.WiFi.STA **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **wifiConnectionChange**.| - | callback | Callback<number> | Yes| Callback invoked to return the WLAN connection state.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **wifiConnectionChange**.| +| callback | Callback<number> | Yes| Callback invoked to return the WLAN connection state.| **WLAN connection states** @@ -893,10 +954,10 @@ Unregisters the WLAN connection state change events. **System capability**: SystemCapability.Communication.WiFi.STA **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **wifiConnectionChange**.| - | callback | Callback<number> | No| Callback used to return the WLAN connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **wifiConnectionChange**.| +| callback | Callback<number> | No| Callback used to return the WLAN connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| ## wifi.on('wifiScanStateChange')7+ @@ -910,10 +971,10 @@ Registers the WLAN scan state change events. **System capability**: SystemCapability.Communication.WiFi.STA **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **wifiScanStateChange**.| - | callback | Callback<number> | Yes| Callback invoked to return the WLAN scan state.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **wifiScanStateChange**.| +| callback | Callback<number> | Yes| Callback invoked to return the WLAN scan state.| **WLAN scan states** @@ -952,10 +1013,10 @@ Registers the RSSI change events. **System capability**: SystemCapability.Communication.WiFi.STA **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **wifiRssiChange**.| - | callback | Callback<number> | Yes| Callback invoked to return the RSSI, in dBm.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **wifiRssiChange**.| +| callback | Callback<number> | Yes| Callback invoked to return the RSSI, in dBm.| ## wifi.off('wifiRssiChange')7+ @@ -969,10 +1030,10 @@ Unregisters the RSSI change events. **System capability**: SystemCapability.Communication.WiFi.STA **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **wifiRssiChange**.| - | callback | Callback<number> | No| Callback used to return the RSSI, in dBm. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **wifiRssiChange**.| +| callback | Callback<number> | No| Callback used to return the RSSI, in dBm. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| ## wifi.on('hotspotStateChange')7+ @@ -986,10 +1047,10 @@ Registers the hotspot state change events. **System capability**: SystemCapability.Communication.WiFi.AP.Core **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **hotspotStateChange**.| - | callback | Callback<number> | Yes| Callback invoked to return the hotspot state.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **hotspotStateChange**.| +| callback | Callback<number> | Yes| Callback invoked to return the hotspot state.| **Hotspot states** @@ -1012,10 +1073,10 @@ Unregisters the hotspot state change events. **System capability**: SystemCapability.Communication.WiFi.AP.Core **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **hotspotStateChange**.| - | callback | Callback<number> | No| Callback used to return the hotspot state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **hotspotStateChange**.| +| callback | Callback<number> | No| Callback used to return the hotspot state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| ## wifi.on('p2pStateChange')8+ @@ -1029,10 +1090,10 @@ Registers the P2P state change events. **System capability**: SystemCapability.Communication.WiFi.P2P **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **p2pStateChange**.| - | callback | Callback<number> | Yes| Callback invoked to return the P2P state.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **p2pStateChange**.| +| callback | Callback<number> | Yes| Callback invoked to return the P2P state.| **P2P states** @@ -1055,10 +1116,10 @@ Unregisters the P2P state change events. **System capability**: SystemCapability.Communication.WiFi.P2P **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **p2pStateChange**.| - | callback | Callback<number> | No| Callback used to return the P2P state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **p2pStateChange**.| +| callback | Callback<number> | No| Callback used to return the P2P state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| ## wifi.on('p2pConnectionChange')8+ @@ -1072,10 +1133,10 @@ Registers the P2P connection state change events. **System capability**: SystemCapability.Communication.WiFi.P2P **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **p2pConnectionChange**.| - | callback | Callback<[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)> | Yes| Callback invoked to return the P2P connection state.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **p2pConnectionChange**.| +| callback | Callback<[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)> | Yes| Callback invoked to return the P2P connection state.| ## wifi.off('p2pConnectionChange')8+ @@ -1089,10 +1150,10 @@ Unregisters the P2P connection state change events. **System capability**: SystemCapability.Communication.WiFi.P2P **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **p2pConnectionChange**.| - | callback | Callback<[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)> | No| Callback used to return the P2P connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **p2pConnectionChange**.| +| callback | Callback<[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)> | No| Callback used to return the P2P connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| ## wifi.on('p2pDeviceChange')8+ @@ -1106,10 +1167,10 @@ Registers the P2P device state change events. **System capability**: SystemCapability.Communication.WiFi.P2P **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **p2pDeviceChange**.| - | callback | Callback<[WifiP2pDevice](#WifiP2pDevice)> | Yes| Callback invoked to return the P2P device state.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **p2pDeviceChange**.| +| callback | Callback<[WifiP2pDevice](#WifiP2pDevice)> | Yes| Callback invoked to return the P2P device state.| ## wifi.off('p2pDeviceChange')8+ @@ -1123,10 +1184,10 @@ Unregisters the P2P device state change events. **System capability**: SystemCapability.Communication.WiFi.P2P **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **p2pDeviceChange**.| - | callback | Callback<[WifiP2pDevice](#WifiP2pDevice)> | No| Callback used to return the P2P device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **p2pDeviceChange**.| +| callback | Callback<[WifiP2pDevice](#WifiP2pDevice)> | No| Callback used to return the P2P device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| ## wifi.on('p2pPeerDeviceChange')8+ @@ -1140,10 +1201,10 @@ Registers the P2P peer device state change events. **System capability**: SystemCapability.Communication.WiFi.P2P **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.| - | callback | Callback<[WifiP2pDevice[]](#WifiP2pDevice)> | Yes| Callback invoked to return the P2P peer device state.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.| +| callback | Callback<[WifiP2pDevice[]](#WifiP2pDevice)> | Yes| Callback invoked to return the P2P peer device state.| ## wifi.off('p2pPeerDeviceChange')8+ @@ -1157,10 +1218,10 @@ Unregisters the P2P peer device state change events. **System capability**: SystemCapability.Communication.WiFi.P2P **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.| - | callback | Callback<[WifiP2pDevice[]](#WifiP2pDevice)> | No| Callback used to return the P2P peer device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.| +| callback | Callback<[WifiP2pDevice[]](#WifiP2pDevice)> | No| Callback used to return the P2P peer device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| ## wifi.on('p2pPersistentGroupChange')8+ @@ -1174,10 +1235,10 @@ Registers the P2P persistent group state change events. **System capability**: SystemCapability.Communication.WiFi.P2P **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.| - | callback | Callback<void> | Yes| Callback invoked to return the P2P persistent group state.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.| +| callback | Callback<void> | Yes| Callback invoked to return the P2P persistent group state.| ## wifi.off('p2pPersistentGroupChange')8+ @@ -1191,27 +1252,27 @@ Unregisters the P2P persistent group state change events. **System capability**: SystemCapability.Communication.WiFi.P2P **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.| - | callback | Callback<void> | No| Callback used to return the P2P persistent group state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.| +| callback | Callback<void> | No| Callback used to return the P2P persistent group state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| ## wifi.on('p2pDiscoveryChange')8+ on(type: "p2pDiscoveryChange", callback: Callback<number>): void -Registers the P2P discovered device state change events. +Registers the P2P device discovery state change events. **Required permissions**: ohos.permission.GET_WIFI_INFO **System capability**: SystemCapability.Communication.WiFi.P2P **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **p2pDiscoveryChange**.| - | callback | Callback<number> | Yes| Callback invoked to return the state of the P2P discovered device.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **p2pDiscoveryChange**.| +| callback | Callback<number> | Yes| Callback invoked to return the P2P device discovery state.| **P2P discovered device states** @@ -1225,14 +1286,14 @@ Registers the P2P discovered device state change events. off(type: "p2pDiscoveryChange", callback?: Callback<number>): void -Unregisters the P2P discovered device state change events. +Unregisters the P2P device discovery state change events. **Required permissions**: ohos.permission.GET_WIFI_INFO **System capability**: SystemCapability.Communication.WiFi.P2P **Parameters** - | **Name**| **Type**| **Mandatory**| **Description**| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is **p2pDiscoveryChange**.| - | callback | Callback<number> | No| Callback used to return the state of the P2P discovered device. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| +| **Name**| **Type**| **Mandatory**| **Description**| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is **p2pDiscoveryChange**.| +| callback | Callback<number> | No| Callback used to return the P2P device discovery state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| diff --git a/en/application-dev/reference/apis/js-apis-xml.md b/en/application-dev/reference/apis/js-apis-xml.md index f22c9988cf123f79225babf014b089bb98e6247a..e89a471130d3fc8d50350fd33bee3bfbcaf8b6ef 100644 --- a/en/application-dev/reference/apis/js-apis-xml.md +++ b/en/application-dev/reference/apis/js-apis-xml.md @@ -146,7 +146,7 @@ thatSer.setNamespace("h", "http://www.w3.org/TR/html4/"); thatSer.startElement("table"); thatSer.setAttributes("importance", "high"); thatSer.setText("Happy"); -endElement(); // => Happy +thatSer.endElement(); // => Happy ``` diff --git a/en/application-dev/reference/arkui-js/js-components-basic-button.md b/en/application-dev/reference/arkui-js/js-components-basic-button.md index 771a5a55404f5bccfab8350837e74dc049bdc298..6e9378efe275d52ea6e28a4e51baa6170f5d6a7c 100644 --- a/en/application-dev/reference/arkui-js/js-components-basic-button.md +++ b/en/application-dev/reference/arkui-js/js-components-basic-button.md @@ -1,340 +1,89 @@ -# button +# button -The **** component includes capsule, circle, text, arc, and download buttons. +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. -## Child Components +The **\ @@ -346,7 +95,7 @@ When the button type is **download**, the following methods are supported. ``` -``` +```css /* xxx.css */ .div-button { flex-direction: column; @@ -389,8 +138,8 @@ When the button type is **download**, the following methods are supported. } ``` -``` -// xxx.js +```js +// xxx.js export default { data: { count: 5, @@ -407,5 +156,4 @@ export default { } ``` -![](figures/1.png) - +![1](figures/1.png) diff --git a/en/application-dev/reference/arkui-js/js-components-basic-input.md b/en/application-dev/reference/arkui-js/js-components-basic-input.md index 283e9aae6e5ad9a4e4cb72abf1e3cc716c1c40d0..1f10982593566d8ad21467a9613d260ab6e6a3ec 100644 --- a/en/application-dev/reference/arkui-js/js-components-basic-input.md +++ b/en/application-dev/reference/arkui-js/js-components-basic-input.md @@ -1,610 +1,239 @@ -# input +# input -The **** component provides an interactive interface to receive user input. It can be a radio button, check box, button, single-line text box, and more. +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. -## Required Permissions +The **\** component provides an interactive interface to receive user input. It can be a radio button, check box, button, single-line text box, and more. + +## Required Permissions None -## Child Component + +## Child Components Not supported -## Attributes - -In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Triggered when

-

type

-

string

-

text

-

No

-

Type of the input component. Available values include text, email, date, time, number, password, button, checkbox, and radio.

-

The text, email, date, time, number, and password types can be dynamically switched and modified.

-

The button, checkbox, and radio types cannot be dynamically modified. Available values include:

-
  • button: a button that can be clicked
  • checkbox: a check box
  • radio: a radio button that allows users to select one from multiple others with the same name
  • text: a single-line text field
  • email: a field used for an email address
  • date: date control, including the year, month, and day, but excluding time
  • time: time control, without the time zone
  • number: field for entering digits
  • password: password field, in which characters will be shielded
    NOTE:

    For wearables, only button, radio, and checkbox types are supported.

    -
    -
-

checked

-

boolean

-

false

-

No

-

Whether the <input> component is selected. This attribute is valid only when type is set to checkbox or radio.

-

name

-

string

-

-

-

No

-

Name of the input component.

-

value

-

string

-

-

-

No

-

Value of the input component. When type is radio, this attribute is mandatory and the value must be unique for radio buttons with the same name.

-

placeholder

-

string

-

-

-

No

-

Content of the hint text. This attribute is available only when the component type is set to text, email, date, time, number, or password.

-

maxlength

-

number

-

-

-

No

-

Maximum number of characters that can be entered in the input box. If no value is specified, the number of characters is not limited.

-

enterkeytype

-

string

-

default

-

No

-

Dynamic modification is not supported.

-

Available values include:

-
  • default
  • next
  • go
  • done
  • send
  • Search
-
NOTE:

The soft keyboard is automatically collapsed after you click the Enter button, except when next is displayed for the button.

-
-

headericon

-

string

-

-

-

No

-

Icon resource path before text input. This icon does not support click events and is unavailable for button, checkbox, and radio types. The supported icon image formats are JPG, PNG, and SVG.

-

showcounter5+

-

boolean

-

false

-

No

-

Whether to display the character counter for an input box. This attribute takes effect only when maxlength is set.

-

menuoptions5+

-

Array<MenuOption>

-

-

-

No

-

Menu options displayed after users touch the More button.

-

autofocus6+

-

boolean

-

false

-

No

-

Whether to automatically obtain the focus.

-
NOTE:

This attribute setting does not take effect on the application home page. You can enable a text box on the home page to automatically obtain focus, by delaying the focus method call (for about 100–500 ms) in onActive.

-
-

selectedstart6+

-

number

-

-1

-

No

-

Start position for text selection.

-

selectedend6+

-

number

-

-1

-

No

-

End position for text selection.

-

softkeyboardenabled6+

-

boolean

-

true

-

No

-

Whether to display the soft keyboard during editing.

-

showpasswordicon6+

-

boolean

-

true

-

No

-

Whether to display the icon at the end of the password text box. The setting is valid only when type is set to password.

-
- -**Table 1** MenuOption5+ - - - - - - - - - - - - - - - - -

Name

-

Type

-

Triggered when

-

icon

-

string

-

Path of the icon for a menu option.

-

content

-

string

-

Text content of a menu option.

-
- -## Styles - -In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Triggered when

-

color

-

<color>

-

#e6000000

-

No

-

Font color of the single-line text box or button.

-

font-size

-

<length>

-

16px

-

No

-

Font size of the single-line text box or button.

-

allow-scale

-

boolean

-

true

-

No

-

Whether the font size changes with the system's font size settings.

-
NOTE:

If the config-changes tag of fontSize is configured for abilities in the config.json file, the setting takes effect without application restart.

-
-

placeholder-color

-

<color>

-

#99000000

-

No

-

Color of the hint text in the single-line text box. This attribute is available when the component type is set to text, email, date, time, number, or password.

-

font-weight

-

number | string

-

normal

-

No

-

Font weight of the single-line text box or button. For details, see font-weight of the text component.

-

caret-color6+

-

<color>

-

-

-

No

-

Color of the input cursor.

-
- -## Events - -In addition to the events in [Universal Events](js-components-common-events.md), the following events are supported. - -- When the input component type is set to **text**, **email**, **date**, **time**, **number**, or **password**, the following events are supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Parameter

-

Triggered when

-

change

-

{ value:inputValue }

-

Triggered when the content entered in the text box changes. The most recent text entered by the user is returned.

-
NOTE:

If you change the value attribute directly, this event will not be triggered.

-
-

enterkeyclick

-

{ value:enterKey }

-

Triggered when the Enter key on a soft keyboard is pressed. The type of the Enter key is returned, which is of the number type. Available values are as follows:

-
  • 2: returned if enterkeytype is go.
  • 3: returned if enterkeytype is search.
  • 4: returned if enterkeytype is send.
  • 5: returned if enterkeytype is next.
  • 6: returned if enterkeytype is default, done, or is not set.
-

translate5+

-

{ value: selectedText }

-

Triggered when users click the translate button in the pop menu displayed after they select a text segment. The selected text content is returned.

-

share5+

-

{ value: selectedText }

-

Triggered when users click the share button in the pop menu displayed after they select a text segment. The selected text content is returned.

-

search5+

-

{ value: selectedText }

-

Triggered when users click the search button in the pop menu displayed after they select a text segment. The selected text content is returned.

-

optionselect5+

-

{ index:optionIndex, value: selectedText }

-

Triggered when users click a menu option in the pop menu displayed after they select a text segment. This event is valid only when the menuoptions attribute is set. The option index and selected text content are returned.

-

selectchange6+

-

{ start: number, end: number }

-

Triggered when the text selection changes.

-
- -- When the input component type is set to **checkbox** or **radio**, the following events are supported. - - - - - - - - - - - - -

Name

-

Parameter

-

Triggered when

-

change

-

{ checked:true | false }

-

Triggered when the checked status of the checkbox or radio button changes.

-
- - -## Methods - -In addition to the methods in [Universal Methods](js-components-common-methods.md), the following events are supported. - - - - - - - - - - - - - - - - - - - - -

Name

-

Parameter

-

Triggered when

-

focus

-

{focus:true|false}: If focus is not passed, the default value true is used.

-

Obtains or loses the focus of a component. When the component type is set to text, email, date, time, number, or password, the input method can be displayed or collapsed.

-

showError

-

{ error: string }

-

Displays the error message. This attribute is available when the component type is set to text, email, date, time, number, or password.

-

delete6+

-

-

-

Deletes the text content based on the current cursor position when the input component type is set to text, email, date, time, number, or password. If the current input component does not have a cursor, the last character is deleted and the cursor is displayed by default.

-
- -## Example Code - -1. Single-line text box - - ``` - -
- - - -
- ``` - - ``` - /* xxx.css */ - .content { - width: 60%; - flex-direction: column; - align-items: center; - } - .input { - placeholder-color: gray; - } - .button { - background-color: gray; - margin-top: 20px; - } - ``` - - ``` - // xxx.js - import prompt from '@system.prompt' - export default { - change(e){ - prompt.showToast({ - message: "value: " + e.value, - duration: 3000, - }); - }, - enterkeyClick(e){ - prompt.showToast({ - message: "enterkey clicked", - duration: 3000, - }); - }, - buttonClick(e){ - this.$element("input").showError({ - error: 'error text' - }); - }, - } - ``` - - ![](figures/1-2.png) - -2. Common button - - ``` - -
- -
- ``` - - ``` - /* xxx.css */ - .div-button { - flex-direction: column; - align-items: center; - - - } - .button { - margin-top: 30px; - width: 280px; - } - ``` - - ![](figures/en-us_image_0000001198898293.png) - -3. Check box - - ``` - -
- - -
- ``` - - ``` - /* xxx.css */ - .content{ - width: 100%; - height: 200px; - - - align-items: center; - justify-content: center; - } - ``` - - ``` - // xxx.js - import prompt from '@system.prompt' - export default { - checkboxOnChange(e) { - prompt.showToast({ - message:'checked: ' + e.checked, - duration: 3000, - }); - } - } - ``` - - ![](figures/en-us_image_0000001173324749.png) - -4. Radio button - - ``` - -
- - - -
- ``` - - ``` - /* xxx.css */ - .content{ - width: 100%; - height: 200px; - justify-content: center; - align-items: center; - } - ``` - - ``` - // xxx.js - import prompt from '@system.prompt' - export default { - onRadioChange(inputValue, e) { - if (inputValue === e.value) { - prompt.showToast({ - message: 'The chosen radio is ' + e.value, - duration: 3000, - }); - } - } - } - ``` - - ![](figures/1-3.png) +## Attributes + +In addition to the [universal attributes](../arkui-js/js-components-common-attributes.md), the following attributes are supported. + +| Name | Type | Default Value | Mandatory| Description | +| -------------------------------- | ----------------------- | --------- | ---- | ------------------------------------------------------------ | +| type | string | text
| No | Type of the input component. Available values include **text**, **email**, **date**, **time**, **number**, **password**, **button**, **checkbox**, and **radio**.
The **text**, **email**, **date**, **time**, **number**, and **password** types can be dynamically switched and modified.
The **button**, **checkbox**, and **radio** types cannot be dynamically modified.
- **button**: a button that can be clicked.
- **checkbox**: a check box.
- **radio**: a radio button that allows users to select one from multiple others with the same name.
- **text**: a single-line text field.
- **email**: a field used for an email address.
- **date**: date component, including the year, month, and day, but excluding time.
- **time**: time component, without the time zone.
- **number**: field for entering digits.
- **password**: password field, in which characters will be shielded.| +| checked | boolean | false | No | Whether the **\** component is selected. This attribute is valid only when **type** is set to **checkbox** or **radio**. | +| name | string | - | No | Name of the **\** component.
This attribute is mandatory when **type** is set to **radio**. | +| value | string | - | No | Value of the **\** component. When **type** is **radio**, this attribute is mandatory and the value must be unique for radio buttons with the same name.| +| placeholder | string | - | No | Content of the hint text. This attribute is available only when the component type is set to **text**, **email**, **date**, **time**, **number**, or **password**.| +| maxlength | number | - | No | Maximum number of characters that can be entered in the input box. The empty value indicates no limit.| +| enterkeytype | string | default | No | Type of the **Enter** key on the soft keyboard. The value cannot be dynamically updated.
Available values include:
- default
- next
- go
- done
- send
- search
Except for the **next** type, clicking the Enter key hides the soft keyboard.| +| headericon | string | - | No | Icon resource path before text input. This icon does not support click events and is unavailable for **button**, **checkbox**, and **radio** types. The supported icon image formats are JPG, PNG, and SVG.| +| showcounter5+ | boolean | false | No | Whether to display the character counter for an input box. This attribute takes effect only when **maxlength** is set. | +| menuoptions5+ | Array<MeunOption> | - | No | Menu options displayed after users click the **More** button. | +| autofocus6+ | boolean | false | No | Whether to automatically obtain focus.
This attribute setting does not take effect on the application home page. You can enable a text box on the home page to automatically obtain focus, by delaying the **focus** method call (for about 100–500 ms) in **onActive**.| +| selectedstart6+ | number | -1 | No | Start position for text selection. | +| selectedend6+ | number | -1 | No | End position for text selection. | +| softkeyboardenabled6+ | boolean | true | No | Whether to display the soft keyboard during editing. | +| showpasswordicon6+ | boolean | true | No | Whether to display the icon at the end of the password text box. This attribute is available only when **type** is set to **password**. | + +**Table 1** MenuOption5+ + +| Name | Type | Description | +| ------- | ------ | ----------- | +| icon | string | Path of the icon for a menu option.| +| content | string | Text content of a menu option.| + + +## Styles + +In addition to the [universal styles](../arkui-js/js-components-common-styles.md), the following styles are supported. + +| Name | Type | Default Value | Mandatory| Description | +| ------------------------ | -------------------------- | ---------- | ---- | ------------------------------------------------------------ | +| color | <color> | \#e6000000 | No | Font color of the single-line text box or button. | +| font-size | <length> | 16px | No | Font size of the single-line text box or button. | +| allow-scale | boolean | true | No | Whether the font size changes with the system's font size settings.
If the **config-changes** tag of **fontSize** is configured for abilities in the **config.json** file, the setting takes effect without application restart.| +| placeholder-color | <color> | \#99000000 | No | Color of the hint text in the single-line text box. This attribute is available when **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**.| +| font-weight | number \| string | normal | No | Font weight of the single-line text box or button. For details, see **font-weight** of the [**\** component](../arkui-js/js-components-basic-text.md).| +| caret-color6+ | <color> | - | No | Color of the input cursor. | + + +## Events + +In addition to the [universal events](../arkui-js/js-components-common-events.md), the following events are supported. + +- When **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**, the following events are supported. + | Name | Parameter | Description | + | ------------------------- | ---------------------------------------- | ---------------------------------------- | + | change | {
 value: inputValue
 } | Triggered when the content entered in the input box changes. The most recent content entered by the user is returned.
If you change the **value** attribute directly, this event will not be triggered.| + | enterkeyclick | {
 value: enterKey
 } | Triggered when the **Enter** key on the soft keyboard is clicked. The type of the **Enter** key is returned, which is of the number type. Available values are as follows:
- **2**: returned if **enterkeytype** is **go**.
- **3**: returned if **enterkeytype** is **search**.
- **4**: returned if **enterkeytype** is **send**.
- **5**: returned if **enterkeytype** is **next**.
- **6**: returned if **enterkeytype** is **default**, **done**, or is not set.| + | translate5+ | {
 value: selectedText
 } | Triggered when users click the translate button in the menu displayed after they select a text segment. The selected text content is returned.| + | share5+ | {
 value: selectedText
 } | Triggered when users click the share button in the menu displayed after they select a text segment. The selected text content is returned.| + | search5+ | {
 value: selectedText
 } | Triggered when users click the search button in the menu displayed after they select a text segment. The selected text content is returned.| + | optionselect5+ | {
 index: optionIndex,
 value: selectedText
 } | Triggered when users click a menu option in the menu displayed after they select a text segment. This event is valid only when the **menuoptions** attribute is set. The option index and selected text content are returned.| + | selectchange6+ | {
start: number,
end: number
 } | Triggered when the text selection changes. | + +- When **type** is set to **checkbox** or **radio**, the following events are supported. + | Name | Parameter | Description | + | ------ | ---------------------------------------- | ---------------------------------------- | + | change | {
 checked:true \| false 
} | Triggered when the checked status of the **checkbox** or **radio** button changes.| + +## Methods + +In addition to the [universal methods](../arkui-js/js-components-common-methods.md), the following methods are supported. + +| Name | Parameter | Description | +| ------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| focus | {
 focus: true\|false
 }:
If **focus** is not passed, the default value **true** is used.| Obtains or loses focus. When **type** is set to **text**, **email**, **date**, **time**, **number**, or password, the input method can be displayed or hidden.| +| showError | {
 error: string 
} | Displays the error message. This attribute is available when **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**.| +| delete6+ | - | Deletes the text content based on the current cursor position when **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**; deletes the last character and displays the cursor if the current input component does not have a cursor.| + +## Example + +1. Single-line text box + ```html + +
+ + + +
+ ``` + + ```css + /* xxx.css */ + .content { + width: 60%; + flex-direction: column; + align-items: center; + } + .input { + placeholder-color: gray; + } + .button { + background-color: gray; + margin-top: 20px; + } + ``` + + ```js + // xxx.js + import prompt from '@system.prompt' + export default { + change(e){ + prompt.showToast({ + message: "value: " + e.value, + duration: 3000, + }); + }, + enterkeyClick(e){ + prompt.showToast({ + message: "enterkey clicked", + duration: 3000, + }); + }, + buttonClick(e){ + this.$element("input").showError({ + error: 'error text' + }); + }, + } + ``` + + ![1-2](figures/1-2.png) + +2. Common button + ```html + +
+ +
+ ``` + + ```css + /* xxx.css */ + .div-button { + flex-direction: column; + align-items: center; + } + .button { + margin-top: 30px; + width: 280px; + } + ``` + + ![en-us_image_0000001198898293](figures/en-us_image_0000001198898293.png) + +3. Check box + ```html + +
+ +
+ ``` + + ```css + /* xxx.css */ + .content{ + width: 100%; + height: 200px; + align-items: center; + justify-content: center; + } + ``` + + ```js + // xxx.js + import prompt from '@system.prompt' + export default { + checkboxOnChange(e) { + prompt.showToast({ + message:'checked: ' + e.checked, + duration: 3000, + }); + } + } + ``` + + ![en-us_image_0000001173324749](figures/en-us_image_0000001173324749.png) + +4. Radio button + ```html + +
+ + + +
+ ``` + + ```css + /* xxx.css */ + .content{ + width: 100%; + height: 200px; + justify-content: center; + align-items: center; + } + ``` + + ```js + // xxx.js + import prompt from '@system.prompt' + export default { + onRadioChange(inputValue, e) { + if (inputValue === e.value) { + prompt.showToast({ + message: 'The chosen radio is ' + e.value, + duration: 3000, + }); + } + } + } + ``` + + ![1-3](figures/1-3.png) diff --git a/en/application-dev/reference/arkui-js/js-components-basic-marquee.md b/en/application-dev/reference/arkui-js/js-components-basic-marquee.md index 6f8ba597ae293c90835bc5d867ebcb91eaa733ab..9f13895436ce5f1104994f9d6956deba5e04a928 100644 --- a/en/application-dev/reference/arkui-js/js-components-basic-marquee.md +++ b/en/application-dev/reference/arkui-js/js-components-basic-marquee.md @@ -1,215 +1,69 @@ -# marquee +# marquee -The **** component displays single-line scrolling text. +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. +> Since API version 6, the text scrolls only when its width exceeds the width of the **\** component. -## Required Permissions +The **\** component is used to display a scrolling piece of text. + +## Required Permissions None -## Child Component + +## Child Components Not supported -## Attributes -In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported. +## Attributes - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

scrollamount

-

number

-

6

-

No

-

Maximum length of each scroll.

-

loop

-

number

-

-1

-

No

-

Number of rolling times. If this parameter is not set, the default value -1 is used. When the value is less than or equal to 0, the marquee scrolls continuously.

-

direction

-

string

-

left

-

No

-

Direction in which the marquee scrolls, which can be left or right.

-
+In addition to the [universal attributes](../arkui-js/js-components-common-attributes.md), the following attributes are supported. -## Styles +| Name | Type | Default Value | Mandatory | Description | +| ------------ | ------ | ---- | ---- | ---------------------------------------- | +| scrollamount | number | 6 | No | Maximum length of each scroll. | +| loop | number | -1 | No | Number of rolling times. If this parameter is not set, the default value **-1** is used. When the value is less than or equal to **0**, the marquee scrolls continuously.| +| direction | string | left | No | Direction in which the marquee scrolls, which can be **left** or **right**. | -In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

color

-

<color>

-

#e5000000

-

No

-

Font color of the scrolling text.

-

font-size

-

<length>

-

37.5

-

No

-

Font size of the scrolling text.

-

allow-scale

-

boolean

-

true

-

No

-

Whether the font size changes with the system's font size settings.

-
NOTE:

If the config-changes tag of fontSize is configured for abilities in the config.json file, the setting takes effect without application restart.

-
-

font-weight

-

number | string

-

normal

-

No

-

Font weight of the scrolling text. For details, see font-weight of the text component.

-

font-family

-

string

-

sans-serif

-

No

-

Font family, in which fonts are separated by commas (,). Each font is set using a font name or font family name. The first font that exists in the system or the font specified by Custom Font Styles in the family is selected as the font for the text.

-
+## Styles -## Events +In addition to the [universal styles](../arkui-js/js-components-common-styles.md), the following styles are supported. -In addition to the events in [Universal Events](js-components-common-events.md), the following events are supported. +| Name | Type | Default Value | Mandatory | Description | +| ----------- | -------------------------- | ---------- | ---- | ---------------------------------------- | +| color | <color> | \#e5000000 | No | Font color of the scrolling text. | +| font-size | <length> | 37.5 | No | Font size of the scrolling text. | +| allow-scale | boolean | true | No | Whether the font size changes with the system's font size settings.
If the **config-changes** tag of **fontSize** is configured for abilities in the **config.json** file, the setting takes effect without application restart.| +| font-weight | number \| string | normal | No | Font weight of the scrolling text. For details, see **font-weight** of the **[\ component](../arkui-js/js-components-basic-text.md#styles)**.| +| font-family | string | sans-serif | No | Font family, in which fonts are separated by commas (,). Each font is set using a font name or font family name. The first font in the family or the specified [custom font](../arkui-js/js-components-common-customizing-font.md) is used for the text.| - - - - - - - - - - - - - - - - - - - -

Name

-

Parameter

-

Description

-

bounce(Rich)

-

-

-

Triggered when the marquee scrolls to the end.

-

finish(Rich)

-

-

-

Triggered when the marquee finishes the specified number of scrollings (value of the loop attribute). It can be triggered only when the loop attribute is set to a number greater than 0.

-

start(Rich)

-

-

-

Triggered when the marquee starts to scroll.

-
-## Methods +## Events -In addition to the methods in [Universal Methods](js-components-common-methods.md), the following events are supported. +In addition to the [universal events](../arkui-js/js-components-common-events.md), the following events are supported. - - - - - - - - - - - - - - - -

Name

-

Parameter

-

Description

-

start

-

-

-

Starts scrolling.

-

stop

-

-

-

Stops scrolling.

-
+| Name | Parameter | Description | +| ------------ | ---- | ---------------------------------------- | +| bounce(Rich) | - | Triggered when the marquee scrolls to the end. | +| finish(Rich) | - | Triggered when the marquee finishes the specified number of scrollings (value of the **loop** attribute). It can be triggered only when the **loop** attribute is set to a number greater than 0.| +| start(Rich) | - | Triggered when the marquee starts to scroll. | -## Example Code +## Methods -``` +In addition to the [universal methods](../arkui-js/js-components-common-methods.md), the following methods are supported. + +| Name | Parameter | Description | +| ----- | ---- | ----- | +| start | - | Starts scrolling.| +| stop | - | Stops scrolling.| + + +## Example + +```html
``` -``` +```css /* xxx.css */ .container { flex-direction: column; @@ -252,7 +106,7 @@ In addition to the methods in [Universal Methods](js-components-common-methods. } ``` -``` +```js // xxx.js export default { data: { @@ -279,5 +133,4 @@ export default { } ``` -![](figures/lite_bar.gif) - +![lite_bar](figures/lite_bar.gif) diff --git a/en/application-dev/reference/arkui-js/js-components-basic-picker-view.md b/en/application-dev/reference/arkui-js/js-components-basic-picker-view.md index 7c925bad746aad5bbade92971de79b1a8063d071..426e227f9009c06b9e6c82f3344719c9d988e948 100644 --- a/en/application-dev/reference/arkui-js/js-components-basic-picker-view.md +++ b/en/application-dev/reference/arkui-js/js-components-basic-picker-view.md @@ -1,577 +1,128 @@ -# picker-view +# picker-view -The **** component provides the view that shows an embedded scrollable selector on the screen. +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. -## Child Components +The **\** component provides the view that shows an embedded scrollable selector on the screen. + + +## Child Components Not supported -## Attributes - -In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported. - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

type

-

string

-

text

-

No

-

Type of the scrollable selector, which cannot be changed dynamically. Available values are as follows:

-
  • text: text selector
  • time: time selector
  • date: date selector
  • datetime: date and time selector
  • multi-text: multi-column text selector
-
- -Text selector \(**type** is **text**\) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

range

-

Array

-

-

-

No

-

Value range of the text selector.

-
NOTE:

Use the data binding mode, for example, range = {{data}}. Declare the corresponding variable data: ["15", "20", "25"] in JavaScript.

-
-

selected

-

string

-

0

-

No

-

Default value of the text selector. The value is the index of range.

-

indicatorprefix

-

string

-

-

-

No

-

Prefix field added when a value is specified for the text selector.

-

indicatorsuffix

-

string

-

-

-

No

-

Suffix field added when a value is specified for the text selector.

-
- -Time selector \(**type** is **time**\) - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

containsecond

-

boolean

-

false

-

No

-

Whether seconds are contained.

-

selected

-

string

-

Current time

-

No

-

Default value of the time selector, in the format of HH:mm.

-

If seconds are contained, the format is HH:mm:ss.

-

hours

-

number

-

241-4

-

-5+

-

No

-

Time format used by the time selector. Available values include:

-
  • 12: displayed in 12-hour format and distinguished by a.m. and p.m.
  • 24: displayed in 24-hour format
    NOTE:

    The default value is the most commonly-used hour format in the current locale. 5+

    -
    -
-
- -Date selector \(**type** is **date**\) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

start

-

<time>

-

1970-1-1

-

No

-

Start date of the date selector, in the format of YYYY-MM-DD.

-

end

-

<time>

-

2100-12-31

-

No

-

End date of the date selector, in the format of YYYY-MM-DD.

-

selected

-

string

-

Current date

-

No

-

Default value of the date selector, in the format of YYYY-MM-DD.

-

lunar5+

-

boolean

-

false

-

No

-

Whether the pop-up window displays the lunar calendar.

-

lunarswitch

-

boolean

-

false

-

No

-

Whether to display the lunar calendar switch in the date selector. When this switch is displayed, you can switch between the lunar calendar and Gregorian calendar. Turn on the switch to display the lunar calendar, and turn off the switch to hide the lunar calendar.

-
NOTE:

-
-
- -Date and time selector \(**type** is **datetime**\) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

selected

-

string

-

Current date and time

-

No

-

Default value of the date and time selector. The value can be in the format of MM-DD-HH-mm or YYYY-MM-DD-HH-mm. If the year is not set, the current year is used by default. The value you set is the date selected by default in the pop-up window.

-

hours

-

number

-

241-4

-

-5+

-

No

-

Time format used by the date and time selector. Available values include:

-
  • 12: displayed in 12-hour format and distinguished by a.m. and p.m.
  • 24: displayed in 24-hour format
    NOTE:

    The default value is the most commonly-used hour format in the current locale. 5+

    -
    -
-

lunar5+

-

boolean

-

false

-

No

-

Whether the pop-up window displays the lunar calendar.

-

lunarswitch

-

boolean

-

false

-

No

-

Whether to display the lunar calendar switch in the date and time selector. When this switch is displayed, you can switch between the lunar calendar and Gregorian calendar. Turn on the switch to display the lunar calendar, and turn off the switch to hide the lunar calendar.

-
NOTE:

-

-
- -Multi-column text selector \(**type** is **multi-text**\) - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

columns

-

number

-

-

-

Yes

-

Number of columns in the multi-column text selector.

-

range

-

Two-dimensional array

-

-

-

No

-

Items of the multi-column text selector. range is a two-dimensional array that indicates the number of columns. Each item in the array indicates the data of each column, for example, [["a","b"], ["c","d"]].

-
NOTE:

Use the data binding mode, for example, range = {{data}}. Declare the corresponding variable data: [["a","b"], ["c","d"]] in the JavaScript.

-
-

selected

-

Array

-

0,0,0,...

-

No

-

Default value of the multi-column text selector, which is an array consisting of the indexes of the selected items in each column.

-
- -## Styles - -In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

color

-

<color>

-

#ffffff

-

No

-

Font color of a candidate item.

-

font-size

-

<length>

-

16px

-

No

-

Font size of a candidate item. The value is of the length type, in pixels.

-

selected-color

-

<color>

-

#ff0a69f7

-

No

-

Font color of the selected item.

-

selected-font-size

-

<length>

-

20px

-

No

-

Font size of the selected item. The value is of the length type, in pixels.

-

disappear-color5+

-

<color>

-

#ffffff

-

No

-

Font color of the items that gradually disappear. Disappearing items are the top option and bottom option of a column containing five options in total.

-
NOTE:

-
-

disappear-font-size5+

-

<length>

-

14px

-

No

-

Font size of the items that gradually disappear. Disappearing items are the top option and bottom option of a column containing five options in total.

-
NOTE:

-
-

font-family

-

string

-

sans-serif

-

No

-

Font type of an item. Font family, in which fonts are separated by commas (,). Each font is set using a font name or font family name. The first font in the family or the font specified by Custom Font Styles is used for the text

-
- -## Events + +## Attributes + +In addition to the [universal attributes](../arkui-js/js-components-common-attributes.md), the following attributes are supported. + +| Name | Type | Default Value | Mandatory | Description | +| ---- | ------ | ---- | ---- | ---------------------------------------- | +| type | string | text | No | Type of the scrollable selector, which cannot be changed dynamically. Available values are as follows:
- **text**: text selector.
- **time**: time selector.
- **date**: date selector.
- **datetime**: date and time selector.
- **multi-text**: multi-column text selector.| + +Text selector (**type** is **text**) + +| Name | Type | Default Value | Mandatory | Description | +| --------------- | ------ | ---- | ---- | ---------------------------------------- | +| range | Array | - | No | Value range of the text selector.
Use the data binding mode, for example, `range = {{data}}`. Declare the corresponding variable `data: ["15", "20", "25"]` in JavaScript.| +| selected | string | 0 | No | Default value of the text selector. The value is the index of **range**. | +| indicatorprefix | string | - | No | Prefix field added when a value is specified for the text selector. | +| indicatorsuffix | string | - | No | Suffix field added when a value is specified for the text selector. | + +Time selector (**type** is **time**) + +| Name | Type | Default Value | Mandatory | Description | +| ------------- | ------- | ----------------------------------- | ---- | ---------------------------------------- | +| containsecond | boolean | false | No | Whether seconds are contained. | +| selected | string | Current time | No | Default value of the time selector, in the format of HH:mm.
If seconds are contained, the format is HH:mm:ss.| +| hours | number | 241-4 | No | Time format used by the time selector. Available values are as follows:
- **12**: displayed in 12-hour format and distinguished by a.m. and p.m.
- **24**: displayed in 24-hour format.
Since API version 5, the default value is the most commonly-used hour format in the current locale.| + +Date selector (**type** is **date**) + +| Name | Type | Default Value | Mandatory | Description | +| ------------------ | ------------ | ---------- | ---- | ---------------------------------------- | +| start | <time> | 1970-1-1 | No | Start date of the date selector, in the format of YYYY-MM-DD. | +| end | <time> | 2100-12-31 | No | End date of the date selector, in the format of YYYY-MM-DD. | +| selected | string | Current date | No | Default value of the date selector, in the format of YYYY-MM-DD. | +| lunar5+ | boolean | false | No | Whether the pop-up window displays the lunar calendar. | +| lunarswitch | boolean | false | No | Whether to display the lunar calendar switch in the date selector. When this switch is displayed, the user can switch between the lunar calendar and Gregorian calendar. Turn on the switch to display the lunar calendar, and turn off the switch to hide the lunar calendar.| + +Date and time selector (**type** is **datetime**) + +| Name | Type | Default Value | Mandatory | Description | +| ------------------ | ------- | ----------------------------------- | ---- | ---------------------------------------- | +| selected | string | Current date and time | No | Default value of the date and time selector. The value can be in the format of MM-DD-HH-mm or YYYY-MM-DD-HH-mm. If the year is not set, the current year is used by default. The value you set is the date selected by default in the pop-up window.| +| hours | number | 241-4 | No | Time format used by the date and time selector. Available values are as follows:
- **12**: displayed in 12-hour format and distinguished by a.m. and p.m.
- **24**: displayed in 24-hour format.
Since API version 5, the default value is the most commonly-used hour format in the current locale.| +| lunar5+ | boolean | false | No | Whether the pop-up window displays the lunar calendar. | +| lunarswitch | boolean | false | No | Whether to display the lunar calendar switch in the date and time selector. When this switch is displayed, the user can switch between the lunar calendar and Gregorian calendar. Turn on the switch to display the lunar calendar, and turn off the switch to hide the lunar calendar.| + +Multi-column text selector (**type** is **multi-text**) + +| Name | Type | Default Value | Mandatory | Description | +| -------- | ------- | --------- | ---- | ---------------------------------------- | +| columns | number | - | Yes | Number of columns in the multi-column text selector. | +| range | Two-dimensional array| - | No | Items of the multi-column text selector. The value is a two-dimensional array that indicates the number of columns. Each item in the array indicates the data of each column, for example, **[["a", "b"], ["c", "d"]]**.
Use the data binding mode, for example, `range = {{data}}`. Declare the corresponding variable `data: ["15", "20", "25"]` in JavaScript.| +| selected | Array | [0,0,0,…]| No | Default value of the multi-column text selector, which is an array consisting of the indexes of the selected items in each column.| + + +## Styles + +In addition to the [universal styles](../arkui-js/js-components-common-styles.md), the following styles are supported. + +| Name | Type | Default Value | Mandatory | Description | +| -------------------------------- | -------------- | ---------- | ---- | ---------------------------------------- | +| color | <color> | \#ffffff | No | Font color of a candidate item. | +| font-size | <length> | 16px | No | Font size of a candidate item. The value is of the length type, in pixels. | +| selected-color | <color> | #ff0a69f7 | No | Font color of the selected item. | +| selected-font-size | <length> | 20px | No | Font size of the selected item. The value is of the length type, in pixels. | +| disappear-color5+ | <color> | \#ffffff | No | Font color of the items that gradually disappear. Disappearing items are the top option and bottom option of a column containing five options in total. | +| disappear-font-size5+ | <length> | 14px | No | Font size of the items that gradually disappear. Disappearing items are the top option and bottom option of a column containing five options in total. | +| font-family | string | sans-serif | No | Font family of the selector, in which fonts are separated by commas (,). Each font is set using a font name or font family name. The first font in the family or the specified [custom font](../arkui-js/js-components-common-customizing-font.md) is used for the text.| + + +## Events The following events are supported. -Text selector \(**type** is **text**\) - - - - - - - - - - - - -

Name

-

Parameter

-

Description

-

change

-

{ newValue: newValue, newSelected: newSelected }

-

Triggered when a value is specified for the text selector.

-
- -Time selector \(**type** is **time**\) - - - - - - - - - - - - -

Name

-

Parameter

-

Description

-

change

-

{ hour: hour, minute: minute, [second:second] }

-

Triggered when a value is specified for the time selector.

-

If seconds are contained, the value contains hour, minute, and second.

-
- -Date selector \(**type** is **date**\) - - - - - - - - - - - - -

Name

-

Parameter

-

Description

-

change

-

{ year:year, month:month, day:day }

-

Triggered when a value is specified for the date selector.

-
- -Date and time selector \(**type** is **datetime**\) - - - - - - - - - - - - -

Name

-

Parameter

-

Description

-

change

-

{ year:year, month:month, day:day, hour:hour, minute:minute }

-

Triggered when a value is specified for the date and time selector.

-
- -Multi-text selector \(**type** is **multi-text**\) - - - - - - - - - - - - -

Name

-

Parameter

-

Description

-

columnchange

-

{ column:column, newValue:newValue, newSelected:newSelected }

-

Triggered when the value of a column in the multi-column selector changes. column indicates the column whose value has changed, newValue indicates the selected value, and newSelected indicates the index of the selected value.

-
- -## Methods +Text selector (**type** is **text**) + +| Name | Parameter | Description | +| ------ | ---------------------------------------- | --------------- | +| change | { newValue: newValue, newSelected: newSelected } | Triggered when a value is specified for the text selector.| + +Time selector (**type** is **time**) + +| Name | Parameter | Description | +| ------ | ---------------------------------------- | ------------------------------- | +| change | { hour: hour, minute: minute, [second:second]} | Triggered when a value is specified for the time selector.
If seconds are contained, the value contains hour, minute, and second.| + +Date selector (**type** is **date**) + +| Name | Parameter | Description | +| ------ | ---------------------------------------- | --------------- | +| change | { year:year, month:month, day:day } | Triggered when a value is specified for the date selector.| + +Date and time selector (**type** is **datetime**) + +| Name | Parameter | Description | +| ------ | ---------------------------------------- | ----------------- | +| change | { year:year, month:month, day:day,  hour:hour, minute:minute } | Triggered when a value is specified for the date and time selector.| + +Multi-text selector (**type** is **multi-text**) + +| Name | Parameter | Description | +| ------------ | ---------------------------------------- | ---------------------------------------- | +| columnchange | { column:column, newValue:newValue, newSelected:newSelected } | Triggered when the value of a column in the multi-column selector changes.
**column**: column whose value has changed.
**newValue**: selected value.
**newSelected**: index of the selected value.| + + +## Methods Not supported -## Example Code -``` +## Example + +```html
@@ -581,7 +132,7 @@ Not supported
``` -``` +```css /* xxx.css */ .container { flex-direction: column; @@ -603,7 +154,7 @@ Not supported } ``` -``` +```js /* xxx.js */ export default { data: { @@ -633,5 +184,4 @@ export default { } ``` -![](figures/lite_bar-4.png) - +![lite_bar-4](figures/lite_bar-4.png) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-image.md b/en/application-dev/reference/arkui-ts/ts-basic-components-image.md index 88231686024e14774633850d6707b8c5c3e77080..d506add310a3c52839d8f688d9493cace324c7c5 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-image.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-image.md @@ -1,83 +1,101 @@ # Image +The **\** component is used to render and display local and online images. -> **NOTE**
+> **NOTE** +> > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. -The **<Image>** component is used to render and display images. - - ## Required Permissions -ohos.permission.INTERNET (using Internet images) +To use online images, you need to add the **ohos.permission.INTERNET** permission to the corresponding abilities in the **config.json** (for the FA model) or **module.json5** file (for the stage model). + +``` +"abilities": [ + { + ... + "permissions": ["ohos.permission.INTERNET"], + ... + } +] +``` ## Child Components -None +Not supported ## APIs -Image(value: {uri: string | PixelMap}) +Image(src: string | PixelMap | Resource) -- Parameters - | Name | Type | Mandatory | Default Value | Description | - | -------- | -------- | -------- | -------- | -------- | - | uri | string | Yes | - | Image URI. Both local and Internal URIs are supported. | +Obtains an image from the specified source for subsequent rendering and display. +**Parameters** + +| Name| Type | Mandatory| Default Value| Description | +| ------ | ------------------------------------------------------------ | ---- | ------ | ------------------------------------------------------------ | +| src | string \| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](../../ui/ts-types.md) | Yes | - | Image source. Both local and online images are supported.
When using resources referenced using a relative path, for example, `Image("common/test.jpg")`, the **\** component cannot be called across bundles or modules. Therefore, you are advised to use `$r` to reference image resources that need to be used globally.
\- The following image formats are supported: PNG, JPG, BMP, SVG, GIF.
\- Base64 strings are supported. The value format is `data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, where `[base64 data]` is a Base64 string.
\- The value can also be a path starting with `dataability://`, which is used to access the image path provided by a Data ability. | ## Attributes -| Name | Type | Default Value | Description | -| -------- | -------- | -------- | -------- | -| alt | string | - | Placeholder image displayed during loading. Both local and Internal URIs are supported. | -| objectFit | ImageFit | ImageFit.Cover | Image scale type. | -| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat enums) | ImageRepeat.NoRepeat | Whether the image is repeated.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> - This attribute is not applicable to SVG images. | -| interpolation | ImageInterpolation | ImageInterpolation.None | Interpolation effect of the image. This attribute is valid only when the image is zoomed in.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> - This attribute is not applicable to SVG images.
>
> - This attribute is not applicable to a **PixelMap** object. | -| renderMode | ImageRenderMode | ImageRenderMode.Original | Rendering mode of the image.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> - This attribute is not applicable to SVG images. | -| sourceSize | {
width: number,
height: number
} | - | Decoding size of the image. The original image is decoded into an image of the specified size. If the value is of the number type, the unit px is used.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> This attribute is not applicable to a **PixelMap** object. | -| syncLoad8+ | boolean | false | Whether to load images synchronously. By default, images are loaded asynchronously. During synchronous loading, the UI thread is blocked and the placeholder diagram is not displayed. | - -- ImageFit enums - | Name | Description | - | -------- | -------- | - | Cover | The image is scaled with its aspect ratio retained for both sides to be greater than or equal to the display boundaries. | - | Contain | The image is scaled with its aspect ratio retained for the content to be completely displayed within the display boundaries. | - | Fill | The video content is resized to fill the display area while retaining its aspect ratio. | - | None | The original size is retained. Generally, this enum is used together with the **objectRepeat** attribute. | - | ScaleDown | The image content is displayed with its aspect ratio retained. The size is smaller than or equal to the original size. | - -- ImageInterpolation enums - | Name | Description | - | -------- | -------- | - | None | Interpolation image data is not used. | - | High | The interpolation image data is used at the high level. The use of the interpolation image data may affect the image rendering speed. | - | Medium | The interpolation image data is used at the medium level. | - | Low | The interpolation image data is used at the low level. | - -- ImageRenderMode enums - | Name | Description | - | -------- | -------- | - | Original | The image is rendered based on the original image, including the color. | - | Template | The image is rendered as a template image, and its color is ignored. | +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. + +| Name | Type | Default Value | Description | +| --------------------- | ---------------------------------------- | ------------------------ | ---------------------------------------- | +| alt | string \| [Resource](../../ui/ts-types.md) | - | Placeholder image displayed during loading. Both local and Internet URIs are supported. | +| objectFit | [ImageFit](#imagefit-enums) | ImageFit.Cover | Image scale type. | +| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | NoRepeat | Whether the image is repeated.
**NOTE**
This attribute is not applicable to SVG images. | +| interpolation | [ImageInterpolation](#imageinterpolation) | ImageInterpolation.None | Interpolation effect of the image. This attribute is valid only when the image is zoomed in.
**NOTE**
This attribute is not applicable to SVG images or **PixelMap** objects. | +| renderMode | [ImageRenderMode](#imagerendermode) | ImageRenderMode.Original | Rendering mode of the image.
**NOTE**
This attribute is not applicable to SVG images. | +| sourceSize | {
width: number,
height: number
} | - | Decoding size of the image. The original image is decoded into an image of the specified size, in px.
**NOTE**
This attribute is not applicable to **PixelMap** objects. | +| syncLoad8+ | boolean | false | Whether to load images synchronously. By default, images are loaded asynchronously. During synchronous loading, the UI thread is blocked and the placeholder diagram is not displayed. | + +### ImageFit + +| Name | Description | +| --------- | -------------------------------- | +| Cover | The image is scaled with its aspect ratio retained for both sides to be greater than or equal to the display boundaries. | +| Contain | The image is scaled with its aspect ratio retained for the content to be completely displayed within the display boundaries. | +| Fill | The image is scaled to fill the display area, and its aspect ratio is not retained. | +| None | The image is displayed in its original size. Generally, this enum is used together with the **objectRepeat** attribute.| +| ScaleDown | The image is displayed with its aspect ratio retained, in a size smaller than or equal to the original size. | + +### ImageInterpolation +| Name | Description | +| ------ | ------------------------- | +| None | Interpolation image data is not used. | +| High | The interpolation image data is used at the high level, which may affect the image rendering speed.| +| Medium | The interpolation image data is used at the medium level. | +| Low | The interpolation image data is used at the low level. | + +### ImageRenderMode + +| Name | Description | +| -------- | --------------------- | +| Original | The image is rendered based on the original image, including the color. | +| Template | The image is rendered as a template image, and its color is ignored.| ## Events -| Name | Description | -| -------- | -------- | -| onComplete(callback: (event?: { width: number, height: number, componentWidth: number, componentHeight: number, loadingStatus: number }) => void) | Triggered when an image is successfully loaded. The loaded image is returned. | -| onError(callback: (event?: { componentWidth: number, componentHeight: number }) => void) | An exception occurs during image loading. | -| onFinish(callback: () => void) | If the source file to be loaded is an SVG image, this callback is invoked when the SVG animation playback is complete. If the animation is an infinite loop, this callback is not triggered. | +In addition to the universal events (ts-universal-events-click.md), the following events are supported. +| Name | Description | +| ---------------------------------------- | ---------------------------------------- | +| onComplete(callback: (event?: { width: number, height: number, componentWidth: number,
componentHeight: number, loadingStatus: number }) => void) | Triggered when an image is successfully loaded. The size of the loaded image is returned.
- **width**: width of the image, in pixels.
- **height**: height of the image, in pixels.
- **componentWidth**: width of the container component, in pixels.
- **componentHeight**: height of the container component, in pixels.
- **loadingStatus**: image loading status.
| +| onError(callback: (event?: { componentWidth: number, componentHeight: number }) => void) | Triggered when an exception occurs during image loading.
- **componentWidth**: width of the container component, in pixels.
- **componentHeight**: height of the container component, in pixels.
| +| onFinish(callback: () => void) | Triggered when the animation playback in the loaded SVG image is complete. If the animation is an infinite loop, this callback is not triggered.| ## Example +### Loading Images -``` -// Image1 +Load and display different types of images and set the scale type of the images. + +```ts @Entry @Component struct ImageExample1 { @@ -143,9 +161,9 @@ struct ImageExample1 { ![en-us_image_0000001211898484](figures/en-us_image_0000001211898484.gif) +### Setting Attributes -``` -// Image2 +```ts @Entry @Component struct ImageExample2 { @@ -163,12 +181,12 @@ struct ImageExample2 { .border({ width: 1 }).borderStyle(BorderStyle.Dashed) .overlay('Template', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) } - + Text('alt').fontSize(12).fontColor(0xcccccc).width('96%').height(30) Image('') .alt($r('app.media.Image_none')) .width(100).height(100).border({ width: 1 }).borderStyle(BorderStyle.Dashed) - + Text('sourceSize').fontSize(12).fontColor(0xcccccc).width('96%') Row({ space: 50 }) { Image($r('app.media.img_example')) @@ -188,7 +206,7 @@ struct ImageExample2 { .border({ width: 1 }).borderStyle(BorderStyle.Dashed) .overlay('w:200 h:200', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) } - + Text('objectRepeat').fontSize(12).fontColor(0xcccccc).width('96%').height(30) Row({ space: 5 }) { Image($r('app.media.ic_health_heart')) @@ -211,18 +229,18 @@ struct ImageExample2 { ![en-us_image_0000001212058474](figures/en-us_image_0000001212058474.png) +### Invoking Events -``` -// Image3 +```ts @Entry @Component struct ImageExample3 { @State width: number = 0 @State height: number = 0 - private on: Resource = $r('app.media.wifi_on') - private off: Resource = $r('app.media.wifi_off') - private on2off: Resource = $r('app.media.wifi_on2off') - private off2on: Resource = $r('app.media.wifi_off2on') + private on: Resource = $r('app.media.image_on') + private off: Resource = $r('app.media.image_off') + private on2off: Resource = $r('app.media.image_on2off') + private off2on: Resource = $r('app.media.image_off2on') @State src: Resource = this.on build() { @@ -237,6 +255,7 @@ struct ImageExample3 { }) .objectFit(ImageFit.Cover) .height(180).width(180) + // Obtain the size of an image after the image loading is complete. .onComplete((msg: { width: number,height: number }) => { this.width = msg.width this.height = msg.height @@ -249,7 +268,7 @@ struct ImageExample3 { offset: { x: 0, y: 20 } }) } - + // Add a click event so that a specific image is loaded upon clicking. Image(this.src) .width(120).height(120) .onClick(() => { diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-marquee.md b/en/application-dev/reference/arkui-ts/ts-basic-components-marquee.md index 757050181d0b2828e0dc806b3f06d170c554ef74..dc89934a2760b1c67f84ca216530d0c3a58752e9 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-marquee.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-marquee.md @@ -1,11 +1,12 @@ # Marquee -> **NOTE**
-> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. +> **NOTE** +> +> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. -The **\** component is used to display a scrolling piece of text. +The **\** component is used to display a scrolling piece of text. The text is scrolled only when its width exceeds the width of the **\** component. ## Required Permissions @@ -15,7 +16,7 @@ None ## Child Components -None +Not supported ## APIs @@ -23,28 +24,29 @@ None Marquee(value: { start: boolean, step?: number, loop?: number, fromStart?: boolean, src: string }) - Parameters - | Name | Type | Mandatory | Default Value | Description | + | Name| Type| Mandatory| Default Value| Description| | -------- | -------- | -------- | -------- | -------- | - | start | boolean | Yes | - | Whether to start scrolling. | - | step | number | No | 6 | Scrolling step. | - | loop | number | No | -1 | Number of times the marquee will scroll. If the value is less than or equal to **0**, the marquee will scroll continuously. | - | fromStart | boolean | No | true | Whether the text scrolls from the start. | - | src | string | Yes | - | Text to scroll. | + | start | boolean | Yes| - | Whether to start scrolling.| + | step | number | No| 6 | Scrolling step.| + | loop | number | No| -1 | Number of times the marquee will scroll. If the value is less than or equal to **0**, the marquee will scroll continuously.| + | fromStart | boolean | No| true | Whether the text scrolls from the start.| + | src | string | Yes| - | Text to scroll.| ## Events -| Name | Description | +| Name| Description| | -------- | -------- | -| onStart(callback: () => void) | Triggered when the marquee starts scrolling. | -| onBounce(callback: () => void) | Triggered when the marquee has reached the end. | -| onFinish(callback: () => void) | Triggered when the marquee has finished scrolling. | +| onStart(callback: () => void) | Triggered when the marquee starts scrolling.| +| onBounce(callback: () => void) | Triggered when the marquee has reached the end.| +| onFinish(callback: () => void) | Triggered when the marquee has finished scrolling.| ## Example -``` +```ts +// xxx.ets @Entry @Component struct MarqueeExample { @@ -63,6 +65,7 @@ struct MarqueeExample { fromStart: this.fromStart, src: this.src }) + .width(400) .fontColor(Color.White) .fontSize(50) .allowScale(false) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-search.md b/en/application-dev/reference/arkui-ts/ts-basic-components-search.md index 7ea05b944a8783a03ce702eac0c904cb5d35760c..386f5aa23c7467f88e77d0c34647f2467af903b3 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-search.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-search.md @@ -1,10 +1,10 @@ # Search -The **\** component provides an input area for users to search. > **NOTE** > > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. +The **\** component provides an input area for users to search. ## Required Permissions @@ -24,7 +24,7 @@ Search(options?: { value?: string; placeholder?: string; icon?: string; controll | -------- | -------- | -------- | -------- | -------- | | value | string | No| - | Text input in the search text box. | | placeholder | string | No | - | Text displayed when there is no input. | - | icon | string | No| - | Path to the search icon. By default, the system search icon is used. The supported icon formats are svg, jpg, and png. | + | icon | string | No| - | Path to the search icon. By default, the system search icon is used. The supported icon formats are .svg, .jpg, and .png. | | controller | SearchController | No| - | Controller. | @@ -36,7 +36,6 @@ Search(options?: { value?: string; placeholder?: string; icon?: string; controll | placeholderColor | [ResourceColor](../../ui/ts-types.md) | - | Placeholder text color. | | placeholderFont | [Font](../../ui/ts-types.md) | - | Placeholder text style. | | textFont | [Font](../../ui/ts-types.md) | - | Text font for the search text box. | -| copyOption9+ | boolean\|[CopyOption](ts-basic-components-text.md) | true | Whether copy and paste is allowed. | ## Events diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textpicker.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textpicker.md index d995c8213360200087233f9d636d7bdb6d1a2410..0a0365a9d3ff3672f346425bab7317a8a83e2694 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-textpicker.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textpicker.md @@ -1,11 +1,12 @@ # TextPicker -> **NOTE**
-> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. +The **\** component allows users to select text from a list of options. -The **<TextPicker>** component allows users to select text from a list of options. +> **NOTE** +> +> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. ## Required Permissions @@ -15,27 +16,28 @@ None ## Child Components -None +Not supported ## APIs -TextPicker(value: {range: string[], selected?: number}) +TextPicker(value: {range: string[] | Resource, value?: string, selected?: number}) Creates a text picker based on the selection range specified by **range**. -- Parameter +- Parameters | Name | Type | Mandatory | Default Value | Description | | -------- | -------- | -------- | -------- | -------- | - | range | string[] | Yes | - | Data selection range of the picker. | - | selected | number | No | - | Index value of the selected item in the array. By default, the first element is selected. | + | range | string[]\| [Resource](../../ui/ts-types.md) | Yes | - | Data selection range of the picker. | + | value | string | No | - | Search text. | + | selected | number | No | Index of the first item | Index of the selected item in the array. | ## Attributes | Name | Type | Default Value | Description | | -------- | -------- | -------- | -------- | -| defaultPickerItemHeight | Length | - | Default height of a Picker content item element. | +| defaultPickerItemHeight | Length | - | Default height of an item in the picker. | ## Events @@ -48,7 +50,8 @@ Creates a text picker based on the selection range specified by **range**. ## Example -``` +```ts +// xxx.ets @Entry @Component struct TextPickerExample { diff --git a/en/application-dev/reference/arkui-ts/ts-basic-gestures-swipegesture.md b/en/application-dev/reference/arkui-ts/ts-basic-gestures-swipegesture.md index f399b16210ca59f3409217b6136443515a3be6d1..6ccd555886c1bf5b46164cd313608998454fadd3 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-gestures-swipegesture.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-gestures-swipegesture.md @@ -1,7 +1,9 @@ # SwipeGesture +**\** is used to implement a swipe gesture, which can be recognized when the swipe speed is 100 vp/s or higher. -> **NOTE**
+> **NOTE** +> > This gesture is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. @@ -33,13 +35,13 @@ SwipeGesture(value?: { fingers?: number; direction?: SwipeDirection; speed?: num | Name | Description | | -------- | -------- | -| onAction(callback:(event?: GestureEvent) => void) | Callback invoked when a swipe gesture is recognized. | +| onAction(callback:(event?: GestureEvent) => void) | Invoked when a swipe gesture is recognized. | - GestureEvent attributes related to the swipe gesture | Name | Type | Description | | -------- | -------- | -------- | - | angle | number | Angle of the swipe gesture.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> Angle calculation method: After the swipe gesture is identified, a line connecting the two fingers is identified as the initial line. As the fingers swipe, the line between the fingers rotates. Based on the coordinates of the initial line's and current line's end points, an arc tangent function is used to calculate the respective included angle of the points relative to the horizontal direction. Rotation angle = arctan2(cy2-cy1,cx2-cx1) - arctan2(y2-y1,x2-x1). The initial line is used as the coordinate system. The clockwise rotation is 0 to 180 degrees, and the counter-clockwise rotation is –180 to 0 degrees. | + | angle | number | Angle of the swipe gesture.
**NOTE**
Angle calculation method: After a swipe gesture is recognized, a line connecting the two fingers is identified as the initial line. As the fingers swipe, the line between the fingers rotates. Based on the coordinates of the initial line's and current line's end points, an arc tangent function is used to calculate the respective included angle of the points relative to the horizontal direction. Rotation angle = arctan2(cy2-cy1,cx2-cx1) - arctan2(y2-y1,x2-x1). The initial line is used as the coordinate system. The clockwise rotation is 0 to 180 degrees, and the counter-clockwise rotation is –180 to 0 degrees. | | speed | number | Speed of the swipe gesture. | ![en-us_image_0000001231374559](figures/en-us_image_0000001231374661.png) diff --git a/en/application-dev/reference/arkui-ts/ts-container-list.md b/en/application-dev/reference/arkui-ts/ts-container-list.md index 5d11634e3bae94e58ac0589451c9076c7c356ecc..adfcea2c3e0b11eb554a0077bb9e794ea1ca6973 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-list.md +++ b/en/application-dev/reference/arkui-ts/ts-container-list.md @@ -21,13 +21,14 @@ This component contains the child component [\](ts-container-listitem. ## APIs -List(value:{space?: number, initialIndex?: number}) +List(value:{space?: number | string, initialIndex?: number, scroller?: Scroller}) - Parameters | Name | Type | Mandatory | Default Value | Description | | -------- | -------- | -------- | -------- | -------- | - | space | number | No | 0 | Spacing between list items. | - | initialIndex | number | No | 0 | Item displayed at the beginning of the component when the current list is loaded for the first time, that is, the first item to be displayed. If the configured sequence number is greater than the sequence number of the last item, the setting does not take effect. | + | space | number \| string | No | 0 | Spacing between list items. | + | initialIndex | number | No | 0 | Item displayed at the beginning of the viewport when the current list is loaded for the first time, that is, the first item to be displayed. If the value set is greater than the sequence number of the last item, the setting does not take effect. | + | scroller | [Scroller](ts-container-scroll.md#scroller) | No | - | Controller bound to the list to control the scrolling. | ## Attributes @@ -36,8 +37,8 @@ List(value:{space?: number, initialIndex?: number}) | -------- | -------- | -------- | -------- | | listDirection | [Axis](ts-appendix-enums.md#axis-enums) | Vertical | Direction in which the list items are arranged. For details, see **Axis** enums. | | divider | {
strokeWidth: Length,
color?:Color,
startMargin?: Length,
endMargin?: Length
} | - | Style of the divider for the list items. By default, there is no divider.
**strokeWidth**: stroke width of the divider.
**color**: color of the divider.
**startMargin**: distance between the divider and the start of the list.
**endMargin**: distance between the divider and the end of the list. | -| editMode | boolean | false | Whether the **<List>** component is in editable mode. | -| edgeEffect | EdgeEffect | EdgeEffect.Spring | Sliding effect. For details, see EdgeEffect enums. | +| editMode | boolean | false | Whether the **\** component is in editable mode. | +| edgeEffect | EdgeEffect | EdgeEffect.Spring | Sliding effect. For details, see **EdgeEffect enums**. | | chainAnimation | boolean | false | Whether to display chained animations on this list when it slides or its top and bottom are dragged. The list items are separated with even space, and one item animation starts after the previous animation during basic sliding interactions. The chained animation effect is similar with spring physics.
- **false**: No chained animations are displayed.
- **true**: Chained animations are displayed. | | multiSelectable8+ | boolean | false | Whether to enable mouse frame selection.
- **false**: The mouse frame selection is disabled.
- **true**: The mouse frame selection is enabled. | | restoreId8+ | number | - | Migration ID of the component. During application migration, the status of the component is migrated to the component with the same migration ID on the peer end.
For a **<\List>** component, the status includes the item serial number displayed at the start position. | @@ -48,7 +49,7 @@ List(value:{space?: number, initialIndex?: number}) | Name | Description | | -------- | -------- | | Spring | Similar to the physical dynamic effect of a spring. After scrolling to the edge, the user can continue to scroll for a distance based on the initial speed or by touching the knob of the scrollbar. After the user releases their hand, the knob is rebounded. | - | None | No effect after the scrollbar is moved to the edge. | + | None | No effect when the list is scrolled to the edge. | - ListItemAlign enums @@ -64,7 +65,8 @@ List(value:{space?: number, initialIndex?: number}) | Name | Description | | -------- | -------- | | onItemDelete(index: number) => boolean | Triggered when a list item is deleted. | -| onScrollIndex(firstIndex: number, lastIndex: number) => void | Triggered when the start position and end position of the current list are changed. | +| onScrollBegin9+(dx: number, dy: number) => { dxRemain: number, dyRemain: number } | Triggered when scrolling starts.
Parameters:
- **dx**: amount by which the list will scroll in the horizontal direction.
- **dy**: amount by which the list will scroll in the vertical direction.
Return value:
- **dxRemain**: remaining amount by which the list can scroll in the horizontal direction.
- **dyRemain**: remaining amount by which the list can scroll in the vertical direction. | +| onScrollIndex(firstIndex: number, lastIndex: number) => void | Triggered when the start position and end position of the current list are changed. | > **NOTE** > @@ -106,9 +108,9 @@ struct ListExample { }.editable(true) }, item => item) } - .listDirection(Axis.Vertical) // Arrangement direction - .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) // Divider line - .edgeEffect(EdgeEffect.None) // No effect when sliding to the edge + .listDirection(Axis.Vertical) // Direction in which the list items are arranged. + .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) // Style of the divider for the list items. + .edgeEffect(EdgeEffect.None) // No effect when the list is scrolled to the edge. .chainAnimation(false) // Chained animations are disabled. .onScrollIndex((firstIndex: number, lastIndex: number) => { console.info('first' + firstIndex) @@ -166,7 +168,7 @@ struct ListLanesExample { .lanes({ minLength: 40, maxLength: 60 }) .alignListItem(this.alignListItem) - Button("Change alignListItem: "+ this.alignListItem).onClick(() => { + Button("Change alignListItem:" + this.alignListItem).onClick(() => { if (this.alignListItem == ListItemAlign.Start) { this.alignListItem = ListItemAlign.Center } else if (this.alignListItem == ListItemAlign.Center) { @@ -179,3 +181,4 @@ struct ListLanesExample { } } ``` + diff --git a/en/application-dev/reference/arkui-ts/ts-methods-action-sheet.md b/en/application-dev/reference/arkui-ts/ts-methods-action-sheet.md index d980bdefeade3492743ebb874675a85ebc34bb75..71c1839a5615a1970668fab8c60f69e2051c8f98 100644 --- a/en/application-dev/reference/arkui-ts/ts-methods-action-sheet.md +++ b/en/application-dev/reference/arkui-ts/ts-methods-action-sheet.md @@ -1,7 +1,8 @@ # Action Sheet -> **NOTE**
+> **NOTE** +> > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. @@ -17,25 +18,25 @@ None show(options: { paramObject1}) -Defines and shows the action sheet. +Defines and shows an action sheet. - paramObject1 parameters | Name | Type | Mandatory | Default Value | Description | | -------- | -------- | -------- | -------- | -------- | - | title | string \|[Resource](../../ui/ts-types.md#resource) | No | None | Title of the dialog box. | - | message | string \|[Resource](../../ui/ts-types.md#resource) | | | Content of the dialog box. | + | title | string \|[Resource](../../ui/ts-types.md) | No | None | Title of the dialog box. | + | message | string \|[Resource](../../ui/ts-types.md) | | | Content of the dialog box. | | autoCancel | boolean | No | true | Whether to close the dialog box when the overlay is clicked. | - | confirm | {
value: string \|[Resource](../../ui/ts-types.md#resource),
action: () => void
} | number | string | Text content of the confirm button and callback upon button clicking.
**value**: button text.
**action**: callback upon button clicking. | + | confirm | {
value: string \| [Resource](../../ui/ts-types.md),
action: () => void
} | No | - | Text content of the confirm button and callback upon button clicking.
**value**: button text.
**action**: callback upon button clicking. | | cancel | () => void | No | - | Callback invoked when the dialog box is closed after the overlay is clicked. | - | alignment | DialogAlignment | No | DialogAlignment.Default | Alignment mode of the dialog box in the vertical direction. | - | offset | {
dx: Length\|[Resource](../../ui/ts-types.md#resource)
dy: Length\|[Resource](../../ui/ts-types.md#resource)
} | No | - | Offset of the dialog box relative to the alignment position. | - | sheets | Array<SheetInfo> | Yes | - | Options in the dialog box. Each option supports the image, text, and callback. | + | alignment | [DialogAlignment](ts-methods-custom-dialog-box.md) | No | DialogAlignment.Default | Alignment mode of the dialog box in the vertical direction. | + | offset | {
dx: Length,
dy: Length
} | No | {
dx: 0,
dy: 0
} | Offset of the dialog box relative to the alignment position. | + | sheets | Array **NOTE**
-> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +> **NOTE** +> +> This method is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. The **** component is used to display an alert dialog box. You can set the text content and response callback for an alert dialog box as needed. @@ -10,40 +11,41 @@ The **** component is used to display an alert dialog box. You can ## Attributes -| Name | Type | Default Value | Description | +| Name | Type | Default Value | Description | | -------- | -------- | -------- | -------- | -| show | options: { paramObject1\| paramObject2} | - | Defines and displays the **** component. | +| show | options: { paramObject1 \| paramObject2} | - | Defines and displays the **** component. | - paramObject1 parameters | Name | Type | Mandatory | Default Value | Description | | -------- | -------- | -------- | -------- | -------- | - | title | string \|[Resource](../../ui/ts-types.md#resource) | | | Title of a dialog box. | - | message | string \|[Resource](../../ui/ts-types.md#resource) | | | Content of the dialog box. | + | title | string \| [Resource](../../ui/ts-types.md) | No | - | Title of a dialog box. | + | message | string \| [Resource](../../ui/ts-types.md) | Yes | - | Content of the dialog box. | | autoCancel | boolean | No | true | Whether to close the dialog box when the overlay is clicked. | - | confirm | {
value: string \|[Resource](../../ui/ts-types.md#resource),
fontColor?: Color\|number \|string \|[Resource](../../ui/ts-types.md#resource),
backgroundColor?:Color \|number\|string\|[Resource](../../ui/ts-types.md#resource),
action: () => void
}
| | | Text content, text color, background color, and click callback of the confirm button. | + | confirm | {
value: string \| [Resource](../../ui/ts-types.md),
fontColor?: Color\| number \| string \| [Resource](../../ui/ts-types.md),
backgroundColor?:Color \| number \| string \| [Resource](../../ui/ts-types.md),
action: () => void
}
| No | - | Text content, text color, background color, and click callback of the confirm button. | | cancel | () => void | No | - | Callback invoked when the dialog box is closed after the overlay is clicked. | - | alignment | DialogAlignment | No | DialogAlignment.Default | Alignment mode of the dialog box in the vertical direction. | - | offset | {
dx: Length \|[Resource](../../ui/ts-types.md#resource),
dy: Length \|[Resource](../../ui/ts-types.md#resource)
} | | | Offset of the dialog box relative to the alignment position. | + | alignment | [DialogAlignment](ts-methods-custom-dialog-box.md) | No | DialogAlignment.Default | Alignment mode of the dialog box in the vertical direction. | + | offset | {
dx: Length \| [Resource](../../ui/ts-types.md),
dy: Length \| [Resource](../../ui/ts-types.md)
} | No | - | Offset of the dialog box relative to the alignment position. | | gridCount | number | No | - | Number of grid columns occupied by the width of the dialog box. | - paramObject2 parameters | Name | Type | Mandatory | Default Value | Description | | -------- | -------- | -------- | -------- | -------- | - | title | string \|[Resource](../../ui/ts-types.md#resource) | No | - | Title of a dialog box. | - | message | string \|[Resource](../../ui/ts-types.md#resource) | Yes | - | Content of the dialog box. | + | title | string \| [Resource](../../ui/ts-types.md) | No | - | Title of a dialog box. | + | message | string \| [Resource](../../ui/ts-types.md) | Yes | - | Content of the dialog box. | | autoCancel | boolean | No | true | Whether to close the dialog box when the overlay is clicked. | - | primaryButton | {
value: string \|[Resource](../../ui/ts-types.md#resource),
fontColor?: Color\|number \|string \|[Resource](../../ui/ts-types.md#resource),
backgroundColor?:Color \|number\|string\|[Resource](../../ui/ts-types.md#resource),
action: () => void
}
| | | Text content, text color, background color, and click callback of the primary button. | - | secondaryButton | {
value: string \|[Resource](../../ui/ts-types.md#resource),
fontColor?: Color\|number \|string \|[Resource](../../ui/ts-types.md#resource),
backgroundColor?:Color \|number\|string\|[Resource](../../ui/ts-types.md#resource),
action: () => void
}
| | | Text content, text color, background color, and click callback of the secondary button. | + | primaryButton | {
value: string \| [Resource](../../ui/ts-types.md),
fontColor?: Color \| number \| string \| [Resource](../../ui/ts-types.md),
backgroundColor?:Color \| number\| string\| [Resource](../../ui/ts-types.md),
action: () => void
}
| No | - | Text content, text color, background color, and click callback of the primary button. | + | secondaryButton | {
value: string \|[Resource](../../ui/ts-types.md),
fontColor?: Color \| number \| string \| [Resource](../../ui/ts-types.md),
backgroundColor?:Color \| number\| string\| [Resource](../../ui/ts-types.md),
action: () => void
}
| No | - | Text content, text color, background color, and click callback of the secondary button. | | cancel | () => void | No | - | Callback invoked when the dialog box is closed after the overlay is clicked. | - | alignment | DialogAlignment | No | DialogAlignment.Default | Alignment mode of the dialog box in the vertical direction. | - | offset | {
dx: Length \|[Resource](../../ui/ts-types.md#resource),
dy: Length \|[Resource](../../ui/ts-types.md#resource)
} | | | Offset of the dialog box relative to the alignment position. | + | alignment | [DialogAlignment](ts-methods-custom-dialog-box.md) | No | DialogAlignment.Default | Alignment mode of the dialog box in the vertical direction. | + | offset | {
dx: Length \| [Resource](../../ui/ts-types.md),
dy: Length \| [Resource](../../ui/ts-types.md)
} | No | - | Offset of the dialog box relative to the alignment position. | | gridCount | number | No | - | Number of grid columns occupied by the width of the dialog box. | ## Example -``` +```ts +// xxx.ets @Entry @Component struct AlertDialogExample { diff --git a/en/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md b/en/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md index 4c39157590da1869b95471dea321cd72fbd212fe..0ebc3483be4382bf5d48644fe1e4cedd397a406b 100644 --- a/en/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md +++ b/en/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md @@ -1,21 +1,20 @@ # Transition of Shared Elements +Shared element transition can be used for transition between pages, for example, transition from an image on the current page to the next page. > **NOTE** +> > This animationis supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. -Transition of shared elements can be used for transition between pages, for example, transition from an image on the current page to the next page. - - -## Type +## Attributes | Name | Type | Default Value | Description | | -------- | -------- | -------- | -------- | | sharedTransition | id: string,
options?: Object | - | If the same ID is configured for a component on the two pages, this shared component is transited. If this parameter is set to an empty string, no shared elements are transited. | - options parameters - | Name | Type | Default Value | Mandatory | Description | + | Name | Type | Default Value | Mandatory | Description | | -------- | -------- | -------- | -------- | -------- | | duration | number | 1000 | No | Animation duration, in ms. The default duration is 1000 ms. | | curve | Curve \| Curves | Linear | No | The default curve is linear. For details about the valid values, see **Curve enums**. | diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-border.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-border.md index f530a14d3a73a1fbd35503c2b6198bb48b77543f..f37f499e123b4b282ed24136951cece34446b314 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-border.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-border.md @@ -1,16 +1,20 @@ # Border -You can set border styles for components. > **NOTE** > > The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > > The border of a component is displayed above the content of its child components since API version 9. + +You can set border styles for components. + + ## Required Permissions None + ## Attributes @@ -27,11 +31,25 @@ None | -------- | -------- | -------- | -------- | -------- | | width | [Length](../../ui/ts-types.md) | 0 | No| Border width.| | color | [ResourceColor](../../ui/ts-types.md) | 'Black' | No| Border color.| - | radius | [Length](../../ui/ts-types.md) | 0 | No| Border radius.| + | radius | [Length](../../ui/ts-types.md)\| EdgeRadiuses9+ | 0 | No| Border radius.| | style | BorderStyle | BorderStyle.Solid | No| Border style.| +- EdgeRadiuses9+ + + To reference this object, at least one parameter must be passed. + + | Name | Type| Mandatory| Default Value| Description | + | ----------- | -------- | ---- | ------ | ---------------- | + | topLeft | length | No | 0 | Radius of the upper-left rounded corner.| + | topRight | length | No | 0 | Radius of the upper-right rounded corner.| + | bottomLeft | length | No | 0 | Radius of the lower-left rounded corner.| + | bottomRight | length | No | 0 | Radius of the lower-right rounded corner.| + + + - BorderStyle enums + | Name| Description| | -------- | -------- | | Dotted | Dotted border. The radius of a dot is half of **borderWidth**.| @@ -52,6 +70,10 @@ struct BorderExample { Text('dashed') .borderStyle(BorderStyle.Dashed).borderWidth(5).borderColor(0xAFEEEE).borderRadius(10) .width(120).height(120).textAlign(TextAlign.Center).fontSize(16) + Text('dashed') + .borderStyle(BorderStyle.Dashed).borderWidth(5).borderColor(0xAFEEEE) + .borderRadius({ topLeft: 10, topRight: 20, bottomLeft: 30, bottomRight: 60 }) + .width(120).height(120).textAlign(TextAlign.Center).fontSize(16) // Dotted border Text('dotted') .border({ width: 5, color: 0x317AF7, radius: 10, style: BorderStyle.Dotted }) diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md index e60aec3ac212bb2d1b83ec9fa3a8e07267ee9346..9cb8daac5a118c29ec740fa43044b5fbafe5073d 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md @@ -1,7 +1,8 @@ # Layout Constraints -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. @@ -13,16 +14,17 @@ None ## Attributes - | Name | Type | Default Value | Description | +| Name | Type | Default Value | Description | | -------- | -------- | -------- | -------- | -| aspectRatio | number | - | Specifies an aspect ratio for the current component. | -| displayPriority | number | - | Sets a display priority for the current component in the layout container. When the space of the parent container is insufficient, the component with a lower priority is hidden.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> This parameter is valid only for the Row/Column/Flex (single-row) container component. | +| aspectRatio | number | - | Aspect ratio of the current component. | +| displayPriority | number | - | Display priority of the current component in the container. When the space of the parent container is insufficient, the component with a lower priority is hidden.
**NOTE**
This attribute is valid only for the **\**, **\**, and **\** (single-row) container components. | ## Example -``` +```ts +// xxx.ets @Entry @Component struct AspectRatioExample { @@ -76,8 +78,7 @@ struct AspectRatioExample { **Figure2** Landscape display ![en-us_image_0000001212218476](figures/en-us_image_0000001212218476.gif) - -``` +```ts class ContainerInfo { label : string = '' size : string = '' @@ -94,13 +95,15 @@ struct DisplayPriorityExample { private container : ContainerInfo[] = [ {label: 'Big container', size: '90%'}, {label: 'Middle container', size: '50%'}, - {label: 'Small container', size: '30%'}] + {label: 'Small container', size: '30%'} + ] private children : ChildInfo[] = [ {text: '1\n(priority:2)', priority: 2}, {text: '2\n(priority:1)', priority: 1}, {text: '3\n(priority:3)', priority: 3}, {text: '4\n(priority:1)', priority: 1}, - {text: '5\n(priority:2)', priority: 2}] + {text: '5\n(priority:2)', priority: 2} + ] @State currentIndex : number = 0 build() { @@ -128,4 +131,4 @@ struct DisplayPriorityExample { ``` -![en-us_image_0000001212058504](figures/en-us_image_0000001212058504.gif) + ![en-us_image_0000001212058504](figures/en-us_image_0000001212058504.gif) diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md index d37d1d1f1421a570c749484e59fd3f9ef9883952..d322c63560b3fc012d6dd089b6bf7227e7ee8fea 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md @@ -1,7 +1,10 @@ # Menu Control -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +This module provides APIs for binding a menu – a vertical list of items – to a component. This menu is displayed by long-pressing, clicking, or right-clicking the component. + +> **NOTE** +> +> The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. ## Required Permissions @@ -12,29 +15,30 @@ None ## Attributes -| Name | Type | Default Value | Description | -| ---------------------------- | ---------------------------------------- | ------------- | ---------------------------------------- | -| bindMenu | Array8+ | - | Menu bound to the component, which is displayed when you click the component. Textual and custom menu items are supported. | -| bindContextMenu8+ | content: [CustomBuilder](../../ui/ts-types.md)
responseType: ResponseType | - | Context menu bound to the component, which is displayed when you long-press or right-click the component. Only custom menu items are supported. | +| Name | Type | Default Value | Description | +| ---------------------------- | ---------------------------------------- | ---- | ---------------------------------- | +| bindMenu | Array8+ | - | Menu bound to the component, which is displayed when you click the component. Textual and custom menu items are supported.| +| bindContextMenu8+ | content: [CustomBuilder](../../ui/ts-types.md),
responseType: ResponseType | - | Context menu bound to the component, which is displayed when you long-press or right-click the component. Only custom menu items are supported. | - MenuItem - | Name | Type | Description | - | ------ | ------------- | ---------------------------------------- | - | value | string | Menu item text. | - | action | () => void | Action triggered when a menu item is clicked. | + | Name | Type | Description | + | ------ | ----------------------- | ----------- | + | value | string | Menu item text. | + | action | () => void | Action triggered when a menu item is clicked.| - ResponseType8+ - | Value | Description | - | ---------- | ---------------------------------------- | - | LongPress | The menu is displayed when the component is long-pressed. | - | RightClick | The menu is displayed when the component is right-clicked. | + | Value | Description | + | ---------- | ------------- | + | LongPress | The menu is displayed when the component is long-pressed. | + | RightClick | The menu is displayed when the component is right-clicked.| ## Example #### Menu with Textual Menu Items -``` +```ts +// xxx.ets @Entry @Component struct MenuExample { @@ -66,7 +70,8 @@ struct MenuExample { #### Menu with Custom Menu Items -``` +```ts +// xxx.ets import router from '@system.router'; @Entry @@ -116,7 +121,8 @@ struct MenuExample { #### Context Menu (Displayed Upon Right-Clicking) -``` +```ts +// xxx.ets @Entry @Component struct ContextMenuExample { diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md index e0468dfe5e7d39816efc9e8a6c10a08a3412321c..8fe71bfe50f7c85128ee538c02ff8e63d2a6fda9 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md @@ -1,7 +1,8 @@ # Shape Clipping -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. @@ -13,16 +14,17 @@ None ## Attributes - | Name | Type | Default Value | Description | +| Name | Type | Default Value | Description | | -------- | -------- | -------- | -------- | -| clip | Shape \| boolean | false | Specifies a clip mode. The value **Shape** indicates that the current component is cropped based on the specified shape. The value **boolean** specifies whether to clip the component based on the edge outline. | -| mask | Shape | - | Adds a mask of the specified shape to the current component. | +| clip | Shape \| boolean | false | Clip mode. The value **Shape** indicates that the current component is cropped based on the specified shape. The value **boolean** specifies whether to clip the component based on the edge outline. | +| mask | Shape | - | Mask of the specified shape for the current component. | ## Example - -``` + +```ts +// xxx.ets @Entry @Component struct ClipAndMaskExample { @@ -30,24 +32,24 @@ struct ClipAndMaskExample { Column({ space: 5 }) { Text('clip').fontSize(9).width('90%').fontColor(0xCCCCCC) // Clip the image by using a circle with a diameter of 280px. - Image('/comment/bg.jpg') + Image($r('app.media.example')) .clip(new Circle({ width: 80, height: 80 })) .width('500px').height('280px') Row() { - Image('/comment/bg.jpg').width('500px').height('280px') + Image($r('app.media.example')).width('500px').height('280px') } .clip(true) .borderRadius(20) Text('mask').fontSize(9).width('90%').fontColor(0xCCCCCC) // Add a 500 px x 280 px mask to the image. - Image('/comment/bg.jpg') + Image($r('app.media.example')) .mask(new Rect({ width: '500px', height: '280px' }).fill(Color.Gray)) .width('500px').height('280px') // Add a 280 px x 280 px circle mask to the image. - Image('/comment/bg.jpg') + Image($r('app.media.example')) .mask(new Circle({ width: '280px', height: '280px' }).fill(Color.Gray)) .width('500px').height('281px') } diff --git a/en/application-dev/reference/arkui-ts/ts-universal-events-click.md b/en/application-dev/reference/arkui-ts/ts-universal-events-click.md index 086a32f23befd0ce05d6f925ce99c9216b7c738b..cc1d167f4d0ab24526632050ac5f8c63f0cd4e00 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-events-click.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-events-click.md @@ -1,10 +1,11 @@ # Click Event +A click event is triggered when a component is clicked. -> **NOTE**
+> **NOTE** +> > This event is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. - ## Required Permissions None @@ -12,12 +13,12 @@ None ## Events -| Name | Bubble Supported | Description | +| Name | Bubbling Supported | Description | | -------- | -------- | -------- | | onClick(callback: (event?: ClickEvent) => void) | No | Called when a click event occurs. For details about the event parameters, see [ClickEvent](#clickevent). | -### ClickEvent +## ClickEvent | Name | Type | Description | | -------- | -------- | -------- | @@ -25,30 +26,30 @@ None | screenY | number | Y coordinate of the click relative to the upper edge of the screen. | | x | number | X coordinate of the click relative to the left edge of the component being clicked. | | y | number | Y coordinate of the click relative to the upper edge of the component being clicked. | -| target8+ | EventTarget | Target element that is clicked. | +| target8+ | [EventTarget](#eventtarget8) | Target element that is clicked. | | timestamp | number | Timestamp of the event. | -- EventTarget8+ attributes +## EventTarget8+ - | Name | Type | Description | - | -------- | -------- | -------- | - | area | Area | Area information of the target element.| +| Name | Type | Description | +| -------- | -------- | -------- | +| area | [Area](#area8) | Area information of the target element.| -- Area8+ attributes +## Area8+ - | Name | Type | Description | - | -------- | -------- | -------- | - | width | number | Width of the target element, in vp. | - | height | number | Height of the target element, in vp. | - | position | Position | Position of the upper left corner of the target element relative to that of the parent element. | - | globalPosition | Position | Position of the upper left corner of the target element relative to that of the page. | +| Name | Type | Description | +| -------- | -------- | -------- | +| width | number | Width of the target element, in vp. | +| height | number | Height of the target element, in vp. | +| position | [Position](#position8) | Position of the upper left corner of the target element relative to that of the parent element. | +| globalPosition | [Position](#position8) | Position of the upper left corner of the target element relative to that of the page. | -- Position8+ attributes +## Position8+ - | Name | Type | Description | - | -------- | -------- | -------- | - | x | number | X-coordinate, in vp. | - | y | number | Y-coordinate, in vp. | +| Name | Type | Description | +| -------- | -------- | -------- | +| x | number | X-coordinate, in vp. | +| y | number | Y-coordinate, in vp. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md b/en/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md index a08f165f89dd50aeb15d582710a0cbfa58d1baca..be73b9cfd5f7484201fe44544d5d440e35786693 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md @@ -1,30 +1,31 @@ -# Drag/Drop Event +# Drag Event +A drag event is triggered when a component is dragged. > **NOTE** > > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. -## Events -| Name | Bubble Supported | Description | +| Name | Bubbling Supported | Description | | -------- | -------- | -------- | -| onDragStart(callback: (event: DragEvent, extraParams?: string) =>\|[Custom Builder](../../ui/ts-types.md)) | No | Triggered when the component bound to the event is dragged for the first time.
-**event**: information about the drag event, including the coordinates of the item that is being dragged.
-**extraParams**: additional information about the drag event. For details, see extraParam.
Return value: object being dragged, which is used for prompts displayed when the object is dragged.
**NOTE**
> - A drag event can be triggered by a 150 ms long press.
> - If the duration of a long-press gesture is set to less than or equal to 150 ms, the callback for the long-press gesture takes precedence. Otherwise, the callback for the drag event takes precedence. | -| onDragEnter(callback: (event: DragEvent, extraParams?: string) => void) | No | Triggered when the dragged item enters a valid drop target.
-**event**: information about the drag event, including the coordinates of the item that is being dragged.
-**extraParams**: additional information about the drag event. For details, see extraParam.
**NOTE**
This event is valid only when the **onDrop** event is listened to. | -| onDragMove(callback: (event: DragEvent, extraParams?: string) => void) | No | Triggered when the dragged item moves in a valid drop target.
-**event**: information about the drag event, including the coordinates of the item that is being dragged.
-**extraParams**: additional information about the drag event. For details, see extraParam.
**NOTE**
This event is valid only when the **onDrop** event is listened to. | -| onDragLeave(callback: (event: DragEvent, extraParams?: string) => void) | No | Triggered when the dragged item leaves a valid drop target.
-**event**: information about the drag event, including the coordinates of the item that is being dragged.
-**extraParams**: additional information about the drag event. For details, see extraParam.
**NOTE**
This event is valid only when the **onDrop** event is listened to. | -| onDrop(callback: (event:DragEvent, extraParams?: string) => void) | No | Triggered when the dragged item is dropped on a valid drop target.
-**event**: information about the drag event, including the coordinates of the item that is being dragged.
-**extraParams**: additional information about the drag event. For details, see extraParam. | +| onDragStart(callback: (event: DragEvent, extraParams?: string) =>\|[Custom Builder](../../ui/ts-types.md)) | No | Triggered when the component bound to the event is dragged for the first time.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **extraParam**.
Return value: object being dragged, which is used for prompts displayed when the object is dragged.
A drag event can be triggered by a 150 ms long press.
If the duration of a long-press gesture is set to less than or equal to 150 ms, the callback for the long-press gesture takes precedence. Otherwise, the callback for the drag event takes precedence. | +| onDragEnter(callback: (event: DragEvent, extraParams?: string) => void) | No | Triggered when the dragged item enters a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **extraParam**.
This event is valid only when the **onDrop** event is listened to. | +| onDragMove(callback: (event: DragEvent, extraParams?: string) => void) | No | Triggered when the dragged item moves in a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **extraParam**.
This event is valid only when the **onDrop** event is listened to. | +| onDragLeave(callback: (event: DragEvent, extraParams?: string) => void) | No | Triggered when the dragged item leaves a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **extraParam**.
This event is valid only when the **onDrop** event is listened to. | +| onDrop(callback: (event:DragEvent, extraParams?: string) => void) | No | Triggered when the dragged item is dropped on a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **extraParam**. | - extraParam + Returns additional information required for dragging an item. - + **extraParam** is a string converted from a JSON object. You can obtain the following attributes using the JSON object converted from **Json.parse**. | Name | Type | Description | | -------- | -------- | -------- | - | selectedIndex | number | Index of the dragged item in the parent container. The value of **selectedindex** starts from **0**.
**NOTE**
This attribute is valid only in the **ListItem** component. | - | insertIndex | number | Index of the element into which the dragged item is dropped in the **List** component. The value of **insertIndex** starts from **0**.
**NOTE**
This attribute is valid only in the drag event of the **List** component. | + | selectedIndex | number | Index of the dragged item in the parent container. The value of **selectedIndex** starts from **0**.
This attribute is valid only in the **\** component. | + | insertIndex | number | Index of the element into which the dragged item is dropped in the **List** component. The value of **insertIndex** starts from **0**.
This attribute is valid only in the drag event of the **\** component. | ### DragEvent diff --git a/en/application-dev/reference/arkui-ts/ts-universal-events-key.md b/en/application-dev/reference/arkui-ts/ts-universal-events-key.md index ca5694f8efd070b2ed5eab223f44474b03a54bb5..77f563ad5781a1acbd502023a4be8d2e965247a8 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-events-key.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-events-key.md @@ -1,8 +1,10 @@ # Key Event +A key event is triggered when a component interacts with a keyboard, remote control, or any other input device with keys. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> This method is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +> **NOTE** +> +> This event is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. ## Required Permissions @@ -12,58 +14,61 @@ None ## Events -| Name | Bubble Supported | Description | +| Name | Bubbling Supported | Description | | -------- | -------- | -------- | -| onKeyEvent(event: (event?: KeyEvent) => void) | Yes | Called when a key event occurs. For details about the event parameters, see [KeyEvent Object](#KeyEvent Object). | +| onKeyEvent(event: (event?: KeyEvent) => void) | Yes | Called when a key event occurs. For details about **event**, see [KeyEvent](#keyevent). | -### KeyEvent Object +## KeyEvent - Attributes - | Name | Type | Description | + | Name | Type | Description | | -------- | -------- | -------- | - | type | KeyType | Type of a key. | - | keyCode | number | Key code. | - | keyText | string | Key value. | - | keySource | KeySource | Type of the input device that triggers the key event. | - | deviceId | number | ID of the input device that triggers the key event. | - | metaKey | number | State of the metakey when the key is pressed. The value **1** means the pressed state, and **0** means the unpressed state. | - | timestamp | number | Timestamp when the key is pressed. | + | type | [KeyType](#keytype-enums) | Type of a key. | + | keyCode | number | Key code. | + | keyText | string | Key value. | + | keySource | [KeySource](#keysource-enums) | Type of the input device that triggers the key event. | + | deviceId | number | ID of the input device that triggers the key event. | + | metaKey | number | State of the metakey when the key is pressed. The value **1** means the pressed state, and **0** means the unpressed state. | + | timestamp | number | Timestamp when the key is pressed. | - APIs - | Name | Description | + | Name | Description | | -------- | -------- | - | stopPropagation(): void | Stops the event from bubbling upwards or downwards. | + | stopPropagation(): void | Stops the event from bubbling upwards or downwards. | -- KeyType enums - | Name | Description | - | -------- | -------- | - | Down | The key is pressed. | - | Up | The key is released. | +## KeyType Enums +| Name | Description | +| -------- | -------- | +| Down | The key is pressed. | +| Up | The key is released. | -- KeySource enums - | Name | Description | - | -------- | -------- | - | Unknown | Unknown input device. | - | Keyboard | The input device is a keyboard. | -- Common KeyCode description - | Value | Behavior | Physical Button | - | -------- | -------- | -------- | - | 19 | Upward | Up button. | - | 20 | Downward | Down button. | - | 21 | Leftward | Left button. | - | 22 | Rightward | Right button. | - | 23 | OK | **OK** key on a remote control. | - | 66 | OK | **Enter** key on a keyboard. | - | 160 | OK | **Enter** button on the numeric keypad. | +## KeySource Enums +| Name | Description | +| -------- | -------- | +| Unknown | Unknown input device. | +| [KeyCode](#common-keycode-enums) | The input device is a keyboard. | + +## Common KeyCode Enums + +| Value | Behavior | Physical Button | +| -------- | -------- | -------- | +| 19 | Upward | Up button. | +| 20 | Downward | Down button. | +| 21 | Leftward | Left button. | +| 22 | Rightward | Right button. | +| 23 | OK | **OK** key on a remote control. | +| 66 | OK | **Enter** key on a keyboard. | +| 160 | OK | **Enter** button on the numeric keypad. | ## Example -``` +```ts +// xxx.ets @Entry @Component struct KeyEventExample { diff --git a/en/application-dev/reference/arkui-ts/ts-universal-events-touch.md b/en/application-dev/reference/arkui-ts/ts-universal-events-touch.md index ea64017630aeb9e7b8ffaa5960a2d18ab9839fa2..58833a25b0ee0a8aa36c37c81c9a31d0954d0bf3 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-events-touch.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-events-touch.md @@ -1,7 +1,9 @@ # Touch Event +A touch event is triggered when a finger is pressed, slides, or is lifted from a component. -> **NOTE**
+> **NOTE** +> > This event is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. @@ -12,51 +14,51 @@ None ## Events -| Name | Pop-up | Description | -| -------- | -------- | -------- | -| onTouch(callback: (event?: TouchEvent) => void) | Yes | Invoked when a touch action is triggered. For details about the event parameters, see [TouchEvent](#touchevent). | +| Name | Bubbling Supported| Description | +| ---------------------------------------- | ---- | ---------------------------------------- | +| onTouch(callback: (event?: TouchEvent) => void) | Yes | Invoked when a touch action is triggered. For details about **event**, see [TouchEvent](#touchevent).| -### TouchEvent +## TouchEvent - Attributes - | Name | Type | Description | - | -------- | -------- | -------- | - | type | TouchType | Type of a touch event. | - | touches | Array<TouchObject> | All finger information. | - | changedTouches | Array<TouchObject> | Finger information changed. | - | timestamp | number | Timestamp of the event. | - | target8+ | [EventTarget](ts-universal-events-click.md) | Target of the event. | + | Name | Type | Description | + | ------------------- | ---------------------------------------- | ------------ | + | type | TouchType | Type of the touch event. | + | touches | Array<[TouchObject](#touchobject)> | All finger information. | + | changedTouches | Array<[TouchObject](#touchobject)> | Finger information changed.| + | timestamp | number | Timestamp of the event. | + | target8+ | [EventTarget](ts-universal-events-click.md#eventtarget8) | Target of the event. | + - APIs - | Name | Description | - | -------- | -------- | - | stopPropagation(): void | Pop-up of the stop event. | + | Name | Description | + | ---------------------- | ------- | + | stopPropagation(): void| Stops the event from bubbling upwards or downwards.| -- TouchObject - | Name | Type | Description | - | -------- | -------- | -------- | - | type | TouchType | Type of a touch event. | - | id | number | Unique identifier of a finger. | - | screenX | number | X coordinate of the touch point relative to the left edge of the screen. | - | screenY | number | Y coordinate of the touch point relative to the upper edge of the device screen. | - | x | number | X coordinate of the touch point relative to the left edge of the element to touch. | - | y | number | Y coordinate of the touch point relative to the upper edge of the element to touch. | +## TouchObject +| Name | Type | Description | +| ------- | --------------------------- | ------------------- | +| type | [TouchType](#touchtype-enums) | Type of the touch event. | +| id | number | Unique identifier of a finger. | +| screenX | number | X-coordinate of the touch point relative to the left edge of the screen. | +| screenY | number | Y-coordinate of the touch point relative to the upper edge of the device screen. | +| x | number | X-coordinate of the touch point relative to the left edge of the element being touched. | +| y | number | Y-coordinate of the touch point relative to the upper edge of the element being touched. | -- TouchType - | Name | Description | - | -------- | -------- | - | Down | Trigger a touch event when a finger is pressed. | - | Up | Trigger a touch event when a finger is lifted. | - | Move | Trigger a touch event when a finger moves on the screen in pressed state. | - | Cancel | Trigger an event when a touch event is canceled. | +## TouchType Enums +| Name | Description | +| ------ | --------------- | +| Down | A finger is pressed. | +| Up | A finger is lifted. | +| Move | A finger moves on the screen in pressed state.| +| Cancel | A touch event is canceled. | ## Example - ```ts // xxx.ets @Entry diff --git a/en/application-dev/reference/arkui-ts/ts-universal-mouse-key.md b/en/application-dev/reference/arkui-ts/ts-universal-mouse-key.md index c7a488006883bf0c32f4693025f41ce7d659b2df..4174d6b266df6c9988aba4224ddabaed16dc7faf 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-mouse-key.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-mouse-key.md @@ -1,7 +1,9 @@ # Mouse Event +If an action triggers multiple events, the order of these events is fixed. By default, mouse events are transmitted transparently. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. @@ -12,48 +14,47 @@ None ## Events - | Name | Bubble Supported | Description | +| Name | Bubbling Supported | Description | | -------- | -------- | -------- | -| onHover(callback: (isHover: boolean) => void) | No | Triggered when the mouse cursor enters or leaves the component.
**isHover**: whether the mouse cursor hovers over the component. The value **true** means that the mouse cursor enters the component, and the value **false** means that the mouse cursor leaves the component. | -| onMouse(callback: (event?: MouseEvent) => void) | Yes | Triggered when the component is clicked by a mouse button or the mouse cursor moves on the component. The **event** parameter indicates the timestamp, mouse button, action, coordinates of the clicked point on the entire screen, and coordinates of the clicked point relative to the component when the event is triggered. | - - -### MouseEvent - -- Attributes - | Name | Type | Description | - | -------- | -------- | -------- | - | timestamp | number | Timestamp when the event is triggered. | - | screenX | number | X-coordinate of the clicked point relative to the upper left corner of the screen. | - | screenY | number | Y-coordinate of the clicked point relative to the upper left corner of the screen. | - | x | number | X-coordinate of the clicked point relative to the upper left corner of the component. | - | y | number | Y-coordinate of the clicked point relative to the upper left corner of the component. | - | button | MouseButton | Mouse button. | - | action | MouseAction | Event action. | - - -- MouseButton attributes - | Name | Type | Description | - | -------- | -------- | -------- | - | Left | number | Left mouse button. | - | Right | number | Right mouse button. | - | Middle | number | Middle mouse button. | - | Back | number | Back button on the left of the mouse. | - | Forward | number | Forward button on the left of the mouse. | - | None | number | No button. | - -- MouseAction attributes - | Name | Type | Description | - | -------- | -------- | -------- | - | Press | number | The mouse button is pressed. | - | Release | number | The mouse button is released. | - | Move | number | The mouse cursor moves. | +| onHover(callback: (isHover: boolean) => void) | No | Triggered when the mouse cursor enters or leaves the component.
**isHover**: whether the mouse cursor hovers over the component. The value **true** means that the mouse cursor enters the component, and the value **false** means that the mouse cursor leaves the component. | +| onMouse(callback: (event?: MouseEvent) => void) | Yes | Triggered when the component is clicked by a mouse button or the mouse cursor moves on the component. The **event** parameter indicates the timestamp, mouse button, action, coordinates of the clicked point on the entire screen, and coordinates of the clicked point relative to the component when the event is triggered. | + + +## MouseEvent + +| Name | Type | Description | +| -------- | -------- | -------- | +| timestamp | number | Timestamp when the event is triggered. | +| screenX | number | X-coordinate of the clicked point relative to the upper left corner of the screen. | +| screenY | number | Y-coordinate of the clicked point relative to the upper left corner of the screen. | +| x | number | X-coordinate of the clicked point relative to the upper left corner of the component. | +| y | number | Y-coordinate of the clicked point relative to the upper left corner of the component. | +| button | [MouseButton](#mousebutton) | Mouse button. | +| action | [MouseAction](#mouseaction) | Event action. | + +## MouseButton +| Name | Type | Description | +| -------- | -------- | -------- | +| Left | number | Left mouse button. | +| Right | number | Right mouse button. | +| Middle | number | Middle mouse button. | +| Back | number | Back button on the left of the mouse. | +| Forward | number | Forward button on the left of the mouse. | +| None | number | No button. | + +## MouseAction +| Name | Type | Description | +| -------- | -------- | -------- | +| Press | number | The mouse button is pressed. | +| Release | number | The mouse button is released. | +| Move | number | The mouse cursor moves. | ## Example - -``` + +```ts +// xxx.ets @Entry @Component struct MouseEventExample { diff --git a/en/application-dev/security/accesstoken-guidelines.md b/en/application-dev/security/accesstoken-guidelines.md index 0eefcc9175b85437a425d73dd9c7759adf649674..2e706b7617e79deb17393ebd3ac1a86e42374e80 100644 --- a/en/application-dev/security/accesstoken-guidelines.md +++ b/en/application-dev/security/accesstoken-guidelines.md @@ -24,9 +24,13 @@ The table below lists only the API used in this guide. For more information, see ## Declaring Permissions -### config.json +Declare the permissions required by the app one by one in the project configuration file. The app cannot obtain the permissions that are not declared in the configuration file. The ability framework provides two models: Feature Ability (FA) model and Stage model. For more information, see [Ability Framework Overview](../ability/ability-brief.md). -Declare the permissions required by the app one by one in the **config.json** file. The app can obtain permissions that have been declared in the **config.json** file. +Note that the app bundle structure and configuration file vary with the ability framework model. + +### FA Model + +For the apps based on the FA model, declare the permissions in the **config.json** file. **Description of config.json** @@ -40,6 +44,41 @@ Declare the permissions required by the app one by one in the **config.json** fi **Example** +```json +{ + "module" : { + "reqPermissions":[ + { + "name" : "ohos.permission.PERMISSION1", + "reason": "$string:reason", + "usedScene": { + "abilities": [ + "FormAbility" + ], + "when":"inuse" + } + }, + { + "name" : "ohos.permission.PERMISSION2", + "reason": "$string:reason", + "usedScene": { + "abilities": [ + "FormAbility" + ], + "when":"always" + } + } + ], + } +} +``` + +### Stage Model + +For the apps based on the stage model, declare the permissions in the **module.json5** file. + +**Example** + ```json { "module" : { @@ -68,11 +107,12 @@ Declare the permissions required by the app one by one in the **config.json** fi } } ``` + ## Declaring the ACL The permission level of **ohos.permission.PERMISSION2** is **system_basic**, which is higher than the app's APL. In this case, use the ACL. -In addition to declaring all the permissions in the **config.json** file, you must declare the permissions whose levels are higher than the app's APL in the app's [profile](../quick-start/app-provision-structure.md). In this example, declare the permission under the **acls** field: +In addition to declaring all the permissions in the configuration file, you must declare the permissions whose levels are higher than the app's APL in the app's [profile](../quick-start/app-provision-structure.md). In this example, declare the permission under the **acls** field: ```json { "version-name": "1.0.0", diff --git a/en/application-dev/security/accesstoken-overview.md b/en/application-dev/security/accesstoken-overview.md index d417572ce565da88f8b2bc9e8415b44ea108e3ec..4537e67fa429ba019ae00074e2dc55c283b690e8 100644 --- a/en/application-dev/security/accesstoken-overview.md +++ b/en/application-dev/security/accesstoken-overview.md @@ -1,6 +1,5 @@ # Access Control Overview -## Introduction AccessTokenManager (ATM) implements unified app permission management based on access tokens on OpenHarmony. By default, apps can access limited system resources. However, in some cases, an app needs to access excess data (including personal data) and functions of the system or another app to implement extended functions. The system or apps must also share their data or functions through interfaces in an explicit manner. OpenHarmony uses app permissions to perform access control and prevent improper or malicious use of these data or functions. @@ -12,9 +11,9 @@ App permissions are used to protect the following objects: Without the required permissions, an app cannot access or perform operations on the target object. Permissions must be clearly defined for apps. With well-defined app permissions, the system can standardize the behavior of apps and protect user privacy. Before an app accesses the target object, the target object verifies the app's permissions and denies the access if the app does not have required permissions. -Currently, ATM performs app permission verification based on the token identity (Token ID). A token ID identifies an app. The ATM manages app permissions based on the app's token ID. +Currently, ATM verifies app permissions based on the token identity (Token ID). A token ID identifies an app. The ATM manages app permissions based on the app's token ID. -## How to Develop +## Permission Workflow Determine the permissions required for an app to access data or perform an operation. Declare the required permissions in the app installation package. @@ -22,12 +21,34 @@ Determine whether the required permissions need to be authorized by users. If ye After the user grants permissions to the app, the app can access the data or perform the operation. -The figure below shows the process. +The figure below shows the permission workflow. -![](figures/figure1.png) +![](figures/permission-workflow.png) + +1. Refer to the figure below for the process of applying for app permissions. + +![](figures/permission-application-process.png) + +1. For details about the mapping between the application Ability Privilege Level (APL) and permission level, see [Permission Levels](#permission-levels). + +2. The permission authorization modes include user_grant (permission granted by the user) and system_grant (permission granted by the system). For details, see [Permission Authorization Modes](#permission-authorization-mode). + +3. A low-level app can have a high-level permission by using the Access Control List (ACL). For details, see [ACL](#acl). ## When to Use +### Basic Principles + +Observe the following principles for permission management: + +- Provide clear description about the app functions and scenarios for each permission required by the app so that users can clearly know why and when these permissions are required. Do not induce or mislead users' authorization. The permissions on an app must comply with the description provided in the app. +- Use the principle of least authority for user permissions. Allow only necessary permissions for service functions. +- When an app is started for the first time, avoid frequently displaying dialog boxes to request permissions. Allow the app to apply for permissions only when it needs to use the corresponding service functions. +- If a user rejects to authorize a permission, the user can still use functions irrelevant to this permission and can register and access the app. +- Provide no more message if a user rejects the authorization required by a function. Provide onscreen instructions to direct the user to grant the permission in **Settings** if the user triggers this function again or needs to use this function. + +- All the permissions granted to apps must come from the [Permission List](permission-list.md). Custom permissions are not allowed for apps currently. + ### Scenarios The following describes two common scenarios. @@ -46,25 +67,13 @@ The following describes two common scenarios. ohos.permission.CAMERA (allowing the apps to use the camera to take photos and record videos) -### Basic Principles - -Observe the following principles for permission management: - -- Provide clear description about the app functions and scenarios for each permission required by the app so that users can clearly know why and when these permissions are required. Do not induce or mislead users' authorization. The permissions on an app must comply with the description provided in the app. -- Use the principle of least authority for user permissions. Allow only necessary permissions for service functions. -- When an app is started for the first time, avoid frequently displaying dialog boxes to request permissions. Allow the app to apply for permissions only when it needs to use the corresponding service functions. -- If a user rejects to authorize a permission, the user can still use functions irrelevant to this permission and can register and access the app. -- Provide no more message if a user rejects the authorization required by a function. Provide onscreen instructions to direct the user to grant the permission in **Settings** if the user triggers this function again or needs to use this function. - -- All the permissions granted to apps must come from the Permission List. Custom permissions are not allowed for apps currently. - ## Permission Levels To protect user privacy, ATM defines different permission levels based on the sensitivity of the data involved or the security threat of the ability. -### App APL +### App APLs -The ability privilege level (APL) defines the priority of the app permission requested. Apps of different APLs can apply for permissions of different levels. +The APL defines the priority of the app permission requested. Apps of different APLs can apply for permissions of different levels. The table below describes the APLs. @@ -78,7 +87,7 @@ By default, apps are of the normal APL. For the app of the system_basic or system_core APL, declare the app APL level in the **apl** field in the app's profile, and use the profile signing tool to generate a certificate when developing the app installation package. For details about the signing process, see [Hapsigner Guide](hapsigntool-guidelines.md). -### Permission Levels +### Levels of Permissions The permissions open to apps vary with the permission level. The permission levels include the following in ascending order of seniority. @@ -100,33 +109,6 @@ The permissions open to apps vary with the permission level. The permission leve The permissions of this type are not open to any app currently. -### ACL - -As described above, permission levels and app APLs are in one-to-one correspondence. In principle, **an app with a lower APL cannot apply for higher permissions by default**. - -The Access Control List (ACL) makes low-level apps have high-level permissions. - -**Example** - -The APL of app A is normal. App A needs to have permission B (system_basic level) and permission C (normal level). - -In this case, you can use the ACL to grant permission B to app A. - -For details, see [Using the ACL](#using-the-acl). -For details about whether the ACL is enabled for a permission, see [Permission List](permission-list.md). - -### Using the ACL - -If the permission required by an app has higher level than the app's APL, you can use the ACL to grant the permissions required. - -In addition to the preceding [authorization processes](#authorization-processes), you must declare the ACL. - -In other words, in addition to declaring the required permissions in the **config.json** file, you must declare the high-level permissions in the app's [profile](accesstoken-guidelines.md#declaring-the-acl). The subsequent steps of authorization are the same. - -**NOTE** - -Declare the target ACL in the **acl** field of the app's profile in the app installation package, and generate a certificate using the profile signing tool. For details about the signing process, see [Hapsigner Guide](hapsigntool-guidelines.md). - ## Permission Authorization Modes Permissions can be classified into the following types based on the authorization mode: @@ -151,15 +133,15 @@ Permissions can be classified into the following types based on the authorizatio The process for an app obtaining the required permissions varies depending on the permission authorization mode. -- For a system_grant permission, you need to [declare the permission](accesstoken-guidelines.md) in the **config.json** file. The permission will be pre-granted when the app is installed. +- For a system_grant permission, you need to [declare the permission](accesstoken-guidelines.md#declaring-permissions) in the configuration file. The permission will be pre-granted when the app is installed. -- For a user_grant permission, you need to [declare the permission](accesstoken-guidelines.md) in the **config.json** file, and a dialog box needs to be displayed to request user authorization during the running of the app. +- For a user_grant permission, you need to [declare the permission](accesstoken-guidelines.md#declaring-permissions) in the configuration file and trigger user authorization through a dialog box during the running of the app. ### Permission Authorization Process (user_grant) The procedure is as follows: -1. In the **config.json** file, declare the permissions required by the app. For details, see [Access Control Development](accesstoken-guidelines.md). +1. In the configuration file, declare the permissions required by the app. For details, see [Access Control Development](accesstoken-guidelines.md). 2. Associate the object that requires the permissions in the app with the target permissions. In this way, the user knows the operations to be granted with the specified permissions. @@ -170,7 +152,33 @@ The procedure is as follows: **Precautions** - Check the app's permission each time before the operation requiring the permission is performed. - - To check whether a user has granted specific permissions to your app, use the [verifyAccessToken](../reference/apis/js-apis-abilityAccessCtrl.md) method. This method returns [PERMISSION_GRANTED](../reference/apis/js-apis-abilityAccessCtrl.md) or [PERMISSION_DENIED](../reference/apis/js-apis-abilityAccessCtrl.md). For details about the sample code, see [Access Control Development](accesstoken-guidelines.md). - Users must be able to understand and control the authorization of user_grant permissions. During the running process, the app requiring user authorization must proactively call the API to dynamically request the authorization. Then, the system displays a dialog box asking the user to grant the requested permission. The user will determine whether to grant the permission based on the running context of the app. - The permission authorized is not permanent, because the user may revoke the authorization at any time. Therefore, even if the user has granted the requested permission to the app, the app must check for the permission before calling the API controlled by this permission. + +## ACL + +As described above, permission levels and app APLs are in one-to-one correspondence. In principle, **an app with a lower APL cannot apply for higher permissions by default**. + +The ACL makes low-level apps have high-level permissions. + +**Example** + +The APL of app A is normal. App A needs to have permission B (system_basic level) and permission C (normal level). + +In this case, you can use the ACL to grant permission B to app A. + +For details, see [Using the ACL](#using-the-acl). +For details about whether a permission can be enabled through the ACL, see the [Permission List](permission-list.md). + +### Using the ACL + +If the permission required by an app has higher level than the app's APL, you can use the ACL to grant the permissions required. + +In addition to the preceding [authorization processes](#authorization-processes), you must declare the ACL. + +In other words, in addition to declaring the required permissions in the **config.json** file, you must declare the high-level permissions in the app's [profile](accesstoken-guidelines.md#declaring-the-acl). The subsequent steps of authorization are the same. + +**NOTE** + +Declare the target ACL in the **acl** field of the app's profile in the app installation package, and generate a certificate using the profile signing tool. For details about the signing process, see [Hapsigner Guide](hapsigntool-guidelines.md). diff --git a/en/application-dev/security/figures/figure1.png b/en/application-dev/security/figures/figure1.png deleted file mode 100644 index f3eebbbb8bd2776828383a0ba00e2411b0d11f61..0000000000000000000000000000000000000000 Binary files a/en/application-dev/security/figures/figure1.png and /dev/null differ diff --git a/en/application-dev/security/figures/permission-workflow.png b/en/application-dev/security/figures/permission-workflow.png new file mode 100644 index 0000000000000000000000000000000000000000..db44f9d26d422c2eff640ca123a4d2ede0b91b72 Binary files /dev/null and b/en/application-dev/security/figures/permission-workflow.png differ diff --git a/en/application-dev/security/huks-overview.md b/en/application-dev/security/huks-overview.md index c43981270787a134a8f129165c6e601f39aee887..dfae447a482a171190ff306525e1dc23d47711fa 100644 --- a/en/application-dev/security/huks-overview.md +++ b/en/application-dev/security/huks-overview.md @@ -1,16 +1,16 @@ # HUKS Overview -### Introduction +## Introduction OpenHarmony Universal KeyStore (HUKS) provides KeyStore (KS) capabilities for applications, including key management and key cryptography operations. HUKS also provides APIs for applications to import or generate keys. -### Basic Concepts +## Basic Concepts - HUKS provides key management functions, including encryption and decryption, signing and signature verification, key agreement and derivation, and Hash-based Message Authentication Code (HMAC) calculation. - HUKS supports the following algorithms: AES and RSA in encryption and decryption, RSA, ECC, DSA, and ED25519 in signing and signature verification, PBKDF2 in key derivation, and DH, ECDH, and X25519 in key agreement. - HUKS uses the OpenSSL and Mbed TLS algorithm libraries. -### Working Principles +## Working Principles HUKS manages keys through the following operations: @@ -20,8 +20,9 @@ HUKS manages keys through the following operations: - **Finish**: processes all data transferred to HUKS and then releases resources. - >**NOTICE**
The **Abort** operation is invoked to terminate the use of the key when an error occurs in the **Init**, **Update**, or **Finish** operation. +> **NOTICE**
+> The **Abort** operation must be invoked to terminate the use of the key when an error occurs in the **Init**, **Update**, or **Finish** operation. -### Constraints +## Constraints N/A diff --git a/en/application-dev/security/permission-list.md b/en/application-dev/security/permission-list.md index 0d9fc7021fe8972192d01483183e8237f0174b35..179073eec8928e709c45fc558344a1fef6898085 100644 --- a/en/application-dev/security/permission-list.md +++ b/en/application-dev/security/permission-list.md @@ -1,14 +1,8 @@ # Permission List -On the basis of the [principles for app permission management](accesstoken-overview.md#basic-principles), apply for permissions for an app by following the procedure illustrated in the figure below. +Before applying for required permissions, read and understand the [permission workflow](accesstoken-overview.md#permission-workflow). Then, determine whether the app can apply for the target permissions based on the table below. -![](figures/permission-application-process.png) - -1. For details about the mapping between the app's ability privilege level (APL) and permission level, see [Permission Levels](accesstoken-overview.md#permission-levels). -2. Permissions can be authorized by the user (user_grant) or the system (system_grant). For details, see [Permission Authorization Modes](accesstoken-overview.md#permission-authorization-modes). -3. In principle, an app with a lower APL cannot apply for higher permissions by default. The Access Control List (ACL) makes low-level apps have high-level permissions. For details, see [ACL](accesstoken-overview.md#acl). - -The following lists the permissions defined by the system. For details about permission usage examples, see [Access Control Development](accesstoken-guidelines.md). +For details about permission usage examples, see [Access Control Development](accesstoken-guidelines.md). | Permission | APL | Authorization Mode | Enable ACL| Description | | -------------------------------------------------------- | ------------ | ------------ | ------- | ------------------------------------------------------------ | @@ -26,10 +20,7 @@ The following lists the permissions defined by the system. For details about per | ohos.permission.REMOVE_CACHE_FILES | system_basic | system_grant | TRUE | Allows the cache of the specified app to be cleared. | | ohos.permission.REBOOT | system_basic | system_grant | TRUE | Allows an app to restart the device. | | ohos.permission.RUNNING_LOCK | normal | system_grant | TRUE | Allows an app to obtain a running lock. | -| ohos.permission.ENROLL_BIOMETRIC | system_core | system_grant | FALSE | Allows an app to add or remove biometric data. | | ohos.permission.ACCESS_BIOMETRIC | normal | system_grant | FALSE | Allows an app to use biometric recognition for identity authentication. | -| ohos.permission.ACCESS_BIOMETRIC_INTERNAL | system_core | system_grant | FALSE | Allows an app to apply for or release biometric recognition resources. | -| ohos.permission.RESET_BIOMETRIC_LOCKOUT | system_core | system_grant | FALSE | Allows an app to reset the maximum number of failures allowed before biometric authentication is locked. | | ohos.permission.SET_TIME | system_basic | system_grant | TRUE | Allows an app to set the system time. | | ohos.permission.SET_TIME_ZONE | system_basic | system_grant | TRUE | Allows an app to set the system time zone. | | ohos.permission.DOWNLOAD_SESSION_MANAGER | system_core | system_grant | TRUE | Allows an app to manage the download sessions. | @@ -136,3 +127,5 @@ The following lists the permissions defined by the system. For details about per | ohos.permission.SET_DEFAULT_APPLICATION | system_core | system_grant | TRUE | Allows an app to set and reset default apps. | | ohos.permission.MANAGE_DISPOSED_APP_STATUS | system_core | system_grant | TRUE | Allows an app to set and query the app handling state. | | ohos.permission.ACCESS_IDS | system_core | system_grant | TRUE | Allows an app to query the unique identifier of a device. | +| ohos.permission.DUMP | system_core | system_grant | TRUE | Allows the basic system information and SA service information to be exported. | +| ohos.permission.DISTRIBUTED_SOFTBUS_CENTER | system_basic | system_grant | FALSE | Allows networking between different devices. | diff --git a/en/application-dev/task-management/background-task-dev-guide.md b/en/application-dev/task-management/background-task-dev-guide.md index f91d0445a535091103051fb6153df1e74f18f03c..e8d85cc571320bd7994e9e80a9b72e89acff367b 100644 --- a/en/application-dev/task-management/background-task-dev-guide.md +++ b/en/application-dev/task-management/background-task-dev-guide.md @@ -284,9 +284,3 @@ export default { } }; ``` - -## Samples - -The following sample is provided to help you better understand how to develop background task management: - -- [`BackgroundTaskManager`: Background Task Management (eTS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/ResourcesSchedule/BackgroundTaskManager) diff --git a/en/application-dev/ui/ts-application-states-appstorage.md b/en/application-dev/ui/ts-application-states-appstorage.md index 66f9e82115b072ad38370fce857bf3009ed81146..ac77b40dd5c85a7494e094b8dc698715786413f8 100644 --- a/en/application-dev/ui/ts-application-states-appstorage.md +++ b/en/application-dev/ui/ts-application-states-appstorage.md @@ -62,7 +62,7 @@ struct ComponentA { @StorageProp('languageCode') lang: string = 'en' private label: string = 'count' - private aboutToAppear() { + aboutToAppear() { this.label = (this.lang === 'en') ? 'Number' : 'Count' } diff --git a/en/application-dev/ui/ui-js-animate-transform.md b/en/application-dev/ui/ui-js-animate-transform.md index 3b6fe35a82a50468f5321d3d97eb98a55a3c87ff..a9b74278cc196e9150bdcd6d15983efe5bbcac12 100644 --- a/en/application-dev/ui/ui-js-animate-transform.md +++ b/en/application-dev/ui/ui-js-animate-transform.md @@ -586,16 +586,4 @@ You can set multiple transform attributes at the same time to apply different tr > > - When using the shorthand notion, note that the animation effect varies according to the sequence of the style values. > -> - The style values in the transform attribute used when the animation starts and ends must be in one-to-one mapping. Only the styles that have value mappings are played. -## Samples - -The following samples are provided to help you better understand how to develop animations with the **transform** attribute: - -- [`JsAnimation`: Animation App (JavaScript, API 8)](https://gitee.com/openharmony/app_samples/tree/master/UI/JsAnimation) -- [`JsAnimationStyle`: JS Animation and Custom Font Styles (API 8)](https://gitee.com/openharmony/app_samples/tree/master/UI/JsAnimationStyle) - -- [`Clock`: Clock (JavaScript, API 8)](https://gitee.com/openharmony/app_samples/tree/master/common/Clock) - -- [Animation Styles (JavaScaript)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/AnimationDemo) - -- [Common Image Operations](https://gitee.com/openharmony/codelabs/tree/master/Media/ImageJsDemo) \ No newline at end of file +> - The style values in the transform attribute used when the animation starts and ends must be in one-to-one mapping. Only the styles that have value mappings are played. \ No newline at end of file diff --git a/en/application-dev/ui/ui-js-component-tabs.md b/en/application-dev/ui/ui-js-component-tabs.md index 9583e28c33e486ed92bef6289ed7c43ccad364d1..fe3f9f0cf1463d5b42a7e0840c6112c957d2b53b 100644 --- a/en/application-dev/ui/ui-js-component-tabs.md +++ b/en/application-dev/ui/ui-js-component-tabs.md @@ -319,11 +319,4 @@ export default { } ``` -![en-us_image_tab.gif](figures/en-us_image_tab.gif) - - -## Samples - -The following sample is provided to help you better understand how to develop the **<tabs>** component: - -[`Tabs`: Tabs (JavaScript, API 8)](https://gitee.com/openharmony/app_samples/tree/master/UI/Tabs) \ No newline at end of file +![en-us_image_tab.gif](figures/en-us_image_tab.gif) \ No newline at end of file diff --git a/en/application-dev/ui/ui-js-components-canvas.md b/en/application-dev/ui/ui-js-components-canvas.md index f1d935f866c29f06ee98109bbea1adf659003995..3c6f3c174c10ac4596cd86e9fe9045991922b34a 100644 --- a/en/application-dev/ui/ui-js-components-canvas.md +++ b/en/application-dev/ui/ui-js-components-canvas.md @@ -139,10 +139,3 @@ export default { > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The **<canvas>** component cannot be created in **onInit** or **onReady**. - -## Samples - -The following sample is provided to help you better understand how to develop the **\** component: - -[`JsCanvas`: \ (JavaScript, API 8)](https://gitee.com/openharmony/app_samples/tree/master/UI/JsCanvas) - diff --git a/en/application-dev/ui/ui-js-components-chart.md b/en/application-dev/ui/ui-js-components-chart.md index 9db89430bdc5ce1f214a38aaef75a058b193adcf..3d23a4f275d8701bcd398094ff2cd191526aa47f 100644 --- a/en/application-dev/ui/ui-js-components-chart.md +++ b/en/application-dev/ui/ui-js-components-chart.md @@ -615,9 +615,4 @@ export default { ``` -![en-us_image_0000001232162328](figures/en-us_image_0000001232162328.gif) -## Samples - -The following sample is provided to help you better understand how to develop the **<chart>** component: - -[`Chart`: chart (JavaScript, API 8)](https://gitee.com/openharmony/app_samples/tree/master/UI/chart) \ No newline at end of file +![en-us_image_0000001232162328](figures/en-us_image_0000001232162328.gif) \ No newline at end of file diff --git a/en/application-dev/ui/ui-js-components-dialog.md b/en/application-dev/ui/ui-js-components-dialog.md index c13d5ce75c14622fee913049508c71d67e6902d1..024dcf2ecdc7b175bc42a0d95dd034a964d9e324 100644 --- a/en/application-dev/ui/ui-js-components-dialog.md +++ b/en/application-dev/ui/ui-js-components-dialog.md @@ -328,9 +328,4 @@ export default { ``` -![en-us_image_0000001223127756](figures/en-us_image_0000001223127756.gif) -## Samples - -The following sample is provided to help you better understand how to develop the **<dialog>** component: - -[`JsDialog`: JS Dialog Box (API 8)](https://gitee.com/openharmony/app_samples/tree/master/UI/JsDialog) \ No newline at end of file +![en-us_image_0000001223127756](figures/en-us_image_0000001223127756.gif) \ No newline at end of file diff --git a/en/application-dev/ui/ui-js-components-list.md b/en/application-dev/ui/ui-js-components-list.md index 8981d4f7c0f1f61bd65e50c1f10a5513837a7dd0..ee26a8b65886736e619c65defbd038e121682e12 100644 --- a/en/application-dev/ui/ui-js-components-list.md +++ b/en/application-dev/ui/ui-js-components-list.md @@ -318,9 +318,4 @@ export default { ``` -![en-us_image_0000001267767861](figures/en-us_image_0000001267767861.gif) -## Samples - -The following sample is provided to help you better understand how to develop the **<list>** component: - -[`JsList`: JSList Offerings (API 7)](https://gitee.com/openharmony/app_samples/tree/master/UI/JsList) \ No newline at end of file +![en-us_image_0000001267767861](figures/en-us_image_0000001267767861.gif) \ No newline at end of file diff --git a/en/application-dev/ui/ui-js-components-stepper.md b/en/application-dev/ui/ui-js-components-stepper.md index caccc7f25503e11f2ac4a4da450524d7b89f052d..4ab5951f921892c6576bce38a8c9f64525967631 100644 --- a/en/application-dev/ui/ui-js-components-stepper.md +++ b/en/application-dev/ui/ui-js-components-stepper.md @@ -411,9 +411,4 @@ export default { } ``` -![en-us_image_0000001267887817](figures/en-us_image_0000001267887817.gif) -## Samples - -The following sample is provided to help you better understand how to develop the **<stepper>** component: - -[`StepNavigator`: StepNavigator (JavaScript, API 7)](https://gitee.com/openharmony/app_samples/tree/master/UI/StepNavigator) \ No newline at end of file +![en-us_image_0000001267887817](figures/en-us_image_0000001267887817.gif) \ No newline at end of file diff --git a/en/application-dev/ui/ui-js-components-swiper.md b/en/application-dev/ui/ui-js-components-swiper.md index d240e96baa6d8d1765d9af5a506855838f483547..7a5514ed2c330c0be3882718247fc92ddf1a6c24 100644 --- a/en/application-dev/ui/ui-js-components-swiper.md +++ b/en/application-dev/ui/ui-js-components-swiper.md @@ -368,9 +368,4 @@ export default { } ``` -![en-us_image_0000001231843132](figures/en-us_image_0000001231843132.gif) -## Samples - -The following sample is provided to help you better understand how to develop the **<swiper>** component: - -- [`Swiper`: Swiper (JavaScript, API 7)](https://gitee.com/openharmony/app_samples/tree/master/UI/Swiper) +![en-us_image_0000001231843132](figures/en-us_image_0000001231843132.gif) \ No newline at end of file diff --git a/en/application-dev/ui/ui-js-components-text.md b/en/application-dev/ui/ui-js-components-text.md index f058773e25d50b45a0adb6a3fc1860ea1d3e480b..76a777c7ddb20c58120f25bcc6d8a4277c557142 100644 --- a/en/application-dev/ui/ui-js-components-text.md +++ b/en/application-dev/ui/ui-js-components-text.md @@ -286,9 +286,4 @@ export default { } ``` -![en-us_image_0000001267887849](figures/en-us_image_0000001267887849.gif) -## Samples - -The following sample is provided to help you better understand how to develop the **<text>** component: - -- [`JsTextComponents`: JavaScript Basic Components (API 8)](https://gitee.com/openharmony/app_samples/tree/master/UI/JsBasicComponents) +![en-us_image_0000001267887849](figures/en-us_image_0000001267887849.gif) \ No newline at end of file diff --git a/en/application-dev/webgl/webgl-guidelines.md b/en/application-dev/webgl/webgl-guidelines.md index f541b6328a122a8fd331e790977916ca681b13ab..d4528ff7ce4abc2e61e885974039bc2aae788724 100644 --- a/en/application-dev/webgl/webgl-guidelines.md +++ b/en/application-dev/webgl/webgl-guidelines.md @@ -29,7 +29,8 @@ WebGL helps you process graphics at the frontend, for example, drawing color gra The following describes how to draw a 2D image without using shaders and how to draw a color triangle using shaders. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > When using WebGL for development, use a real device to ensure the GUI display effect. diff --git a/en/device-dev/driver/driver-platform-adc-des.md b/en/device-dev/driver/driver-platform-adc-des.md index f7075aa1d07a13320c429b23de01b41e5e18f25a..76c73fb3e947e45190831c6f060ae1c1ac1d97db 100644 --- a/en/device-dev/driver/driver-platform-adc-des.md +++ b/en/device-dev/driver/driver-platform-adc-des.md @@ -1,64 +1,79 @@ -# ADC +# ADC -## Overview +## Overview + +### Function An analog-to-digital converter (ADC) is a device that converts analog signals into digital signals. The ADC APIs provide a set of common functions for ADC data transfer, including: -- Opening or closing an ADC device +- Opening or closing an ADC device +- Obtaining the analog-to-digital (AD) conversion result + +### Basic Concepts + +The ADC converts analog parameters into digital parameters for easy storage and computing. The technical specifications of the ADC include the following: + +- Resolution + + The number of binary bits that can be converted by an ADC. A greater number of bits indicates a higher resolution. +- Conversion error + + Difference between the actual and theoretical digital values output by an ADC. It is expressed by a multiple of the least significant bit. Generally, the maximum output error is used. +- Transition time + + Time required by an ADC to perform a complete conversion. + +### Working Principles + +In the Hardware Driver Foundation (HDF), the ADC module uses the unified service mode for API adaptation. In this mode, a service is used as the ADC manager to handle external access requests in a unified manner. The unified service mode applies when the system has multiple device objects of the same type. If the independent service mode is used in this case, more device nodes need to be configured and more memory resources will be consumed. + +The ADC module is divided into the following layers: + +- Interface layer: provides APIs for opening or closing a device and writing data. +- Core layer: provides the capabilities of binding, initializing, and releasing devices. +- Adaptation layer: implements driver-specific functions. + +In addition to the power and ground cables, the ADC requires only one cable to connect to the target device. The figure below shows the physical connection. -- Obtaining the analog-to-digital (AD) conversion result +**Figure 1** ADC physical connection - **Figure 1** ADC physical connection - - ![](figures/ADC_physical_connection.png "ADC_physical_connection") -## Available APIs +![](figures/ADC_physical_connection.png "ADC_physical_connection") + +### Constraints + +Currently, the ADC module supports only the kernels (LiteOS) of mini and small systems. + +## Usage Guidelines + +### When to Use + +An ADC is usually used to convert an analog voltage into a digital parameter, for example, it is used with a microphone to collect sound, used with an NTC resistor to measure temperature, or converts the output of analog sensors into digital parameters. + +### Available APIs + +The table below describes the APIs of the ADC module. For more details, see API Reference. **Table 1** APIs of the ADC driver - - - - - - - - - - - - - - - - - - -

Category

-

API

-

Description

-

Managing ADC devices

-

AdcOpen

-
Opens an ADC device.

-

AdcClose

-

Closes an ADC device.

-

Obtaining the conversion result

-

AdcRead

-

Reads the AD conversion result.

-
- -## Usage Guidelines - -### How to Use - -The figure below illustrates how to use the APIs. - - **Figure 2** Using ADC driver APIs - -![](figures/using-ADC-process.png "using-ADC-process.png") - -### Opening an ADC Device + +| API | Description | +| -------- | ---------------- | +| AdcOpen | Opens an ADC device. | +| AdcClose | Closes an ADC device. | +| AdcRead | Obtains the AD conversion result.| + +### How to Develop + +The figure below shows the general development process. + + **Figure 2** Process of using ADC APIs + +![](figures/using-ADC-process.png) + + +#### Opening an ADC Device. Call **AdcOpen** to open an ADC device. @@ -68,43 +83,20 @@ DevHandle AdcOpen(int16_t number); **Table 2** Description of AdcOpen - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

number

-

ADC device number.

-

Return Value

-

Description

-

NULL

-

Failed to open the ADC device.

-

Device handle

-

Handle of the ADC device opened.

-
- -For example, open device 1 of the two ADCs (numbered 0 and 1) in the system. + +| Parameter | Description | +| ---------- | ----------------- | +| number | ADC device number. | +| **Return Value**| **Description** | +| NULL | The operation failed. | +| Device handle | The operation is successful. The handle of the ADC device opened is returned.| + +Example: Open device 1 of the two ADCs (numbered 0 and 1) in the system. ```c DevHandle adcHandle = NULL; /* ADC device handle / -/* Open the ADC device. */ +/* Open ADC device 1. */ adcHandle = AdcOpen(1); if (adcHandle == NULL) { HDF_LOGE("AdcOpen: failed\n"); @@ -112,7 +104,7 @@ if (adcHandle == NULL) { } ``` -### Obtaining the AD Conversion Result +#### Obtaining the AD Conversion Result ```c int32_t AdcRead(DevHandle handle, uint32_t channel, uint32_t *val); @@ -120,48 +112,30 @@ int32_t AdcRead(DevHandle handle, uint32_t channel, uint32_t *val); **Table 3** Description of AdcRead - - - - - - - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

ADC device handle.

-

channel

-

ADC device channel number.

-

val

-

AD conversion result.

-

Return Value

-

Description

-

0

-

The operation is successful.

-

Negative number

-

Failed to obtain the AC conversion result.

-
- -### Closing an ADC Device + +| Parameter | Description | +| ---------- | -------------- | +| handle | ADC device handle. | +| channel | ADC device channel number. | +| val | Pointer to the AD conversion result. | +| **Return Value**| **Description**| +| 0 | The operation is successful. | +| Negative value | The operation failed. | + +Example: Obtain the AD conversion result of channel 1. + +```c +uint32_t value; +int32_t ret; + +ret = AdcRead(adcHandle, 1, &value); +if (ret != 0) { + HDF_LOGE("ADC read fail!\n"); + return; +} +``` + +#### Closing an ADC Device Call **AdcClose** to close the ADC device after the ADC communication is complete. ```c @@ -169,31 +143,12 @@ void AdcClose(DevHandle handle); ``` **Table 4** Description of AdcClose - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

ADC device handle.

-

Return Value

-

Description

-

None

-

No value is returned if the ADC device is closed.

-
+ +| Parameter | Description | +| ------ | ----------- | +| handle | ADC device handle.| +| **Return Value**| **Description** | +| N/A | N/A | Example: @@ -201,9 +156,9 @@ Example: AdcClose(adcHandle); /* Close the ADC device. */ ``` -## Example +### Example -This following example shows how to use ADC APIs to manage an ADC device on a Hi3516D V300 development board. +This following example shows how to use ADC APIs to manage an ADC device on a Hi3516D V300 board. The basic hardware information is as follows: @@ -242,7 +197,7 @@ static int32_t TestCaseAdc(void) for (i = 0; i < 30; i++) { ret = AdcRead(adcHandle, ADC_CHANNEL_NUM, &readBuf[i]); if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: tp ADC write reg fail!:%d", __func__, ret); + HDF_LOGE("%s: Failed to read ADC!:%d", __func__, ret); AdcClose(adcHandle); return -1; } diff --git a/en/device-dev/driver/driver-platform-dac-des.md b/en/device-dev/driver/driver-platform-dac-des.md index 45cd858317a5affefb3bb285322f73c92b0b380c..4cffd91b8618ab4f466ce32f1ff0ca3e959f1e6b 100644 --- a/en/device-dev/driver/driver-platform-dac-des.md +++ b/en/device-dev/driver/driver-platform-dac-des.md @@ -1,6 +1,5 @@ # DAC - ## Overview ### DAC @@ -8,11 +7,9 @@ A digit-to-analog converter (DAC) is a device that converts a digital signal into an analog signal in electronics. The DAC APIs provide a set of methods for DAC data transfer, including: - - Opening or closing a DAC device - Setting the target digital-to-analog (DA) value - ### Basic Concepts The DAC module provides the output channel for the process control computer system. It connects to the executor to implement automatic control of the production process. It is also an important module in the analog-to-digital converter using feedback technologies. @@ -35,29 +32,31 @@ The DAC module provides the output channel for the process control computer syst ### Working Principles -In the Hardware Driver Foundation (HDF), the DAC module uses the unified service mode for API adaptation. In this mode, a device service is used as the DAC manager to handle access requests from the devices of the same type in a unified manner. The unified service mode applies to the scenario where there are many device objects of the same type. If the independent service mode is used, more device nodes need to be configured and memory resources will be consumed by services. The figure below shows the unified service mode. +In the Hardware Driver Foundation (HDF), the DAC module uses the unified service mode for API adaptation. In this mode, a service is used as the DAC manager to handle external access requests in a unified manner. The unified service mode applies when the system has multiple device objects of the same type. If the independent service mode is used in this case, more device nodes need to be configured and more memory resources will be consumed. The figure below shows the unified service mode. The DAC module is divided into the following layers: -- The interface layer provides APIs for opening or closing a device and writing data. -- The core layer provides the capabilities of binding, initializing, and releasing devices. -- The adaptation layer implements other functions. ->![](../public_sys-resources/icon-note.gif) **NOTE**
->The core layer can call the functions of the interface layer and uses the hook to call functions of the adaptation layer. In this way, the adaptation layer can indirectly call the functions of the interface layer, but the interface layer cannot call the functions of the adaptation layer. +- Interface layer: provides APIs for opening or closing a device and writing data. +- Core layer: provides the capabilities of binding, initializing, and releasing devices. +- Adaptation layer: implements driver-specific functions. + +>![](../public_sys-resources/icon-note.gif) **NOTE** +> +> The core layer can call the functions of the interface layer and uses a hook to call functions of the adaptation layer. In this way, the adaptation layer can indirectly call the functions of the interface layer, but the interface layer cannot call the functions of the adaptation layer. **Figure 1** Unified service mode -![](figures/unified-service-mode.png "DAC-unified-service-mode") +![](figures/unified-service-mode.png "DAC unified service mode") ### Constraints - Currently, the DAC module supports only the kernels (LiteOS) of mini and small systems. +Currently, the DAC module supports only the kernels (LiteOS) of mini and small systems. -## Development Guidelines +## Usage Guidelines ### When to Use - The DAC module converts digital signals into analog signals in the form of current, voltage, or charge. It is mainly used in audio devices. Audio players and headsets use the DAC module as the digital-to-analog conversion channels. +The DAC module converts digital signals into analog signals in the form of current, voltage, or charge. It is mainly used in audio devices. Audio players and headsets use the DAC module as the digital-to-analog conversion channels. ### Available APIs @@ -65,45 +64,44 @@ The table below describes the APIs of the DAC module. For more details, see API **Table 1** DAC driver APIs -| API | Description | -| :------------------------------------------------------------| :------------ | -| DevHandle DacOpen(uint32_t number) | Opens a DAC device. | -| void DacClose(DevHandle handle) | Closes a DAC device. | -| int32_t DacWrite(DevHandle handle, uint32_t channel, uint32_t val) | Sets a target DA value. | +| API | Description | +| ------------------------------------------------------------------ | ------------ | +| DevHandle DacOpen(uint32_t number) | Opens a DAC device. | +| void DacClose(DevHandle handle) | Closes a DAC device. | +| int32_t DacWrite(DevHandle handle, uint32_t channel, uint32_t val) | Sets a target DA value.| ### How to Develop -The figure below illustrates how to use the APIs. +The figure below shows the general development process. + +**Figure 2** Process of using DAC APIs -**Figure 2** Using DAC driver APIs -![](figures/using-DAC-process.png "using-DAC-process.png") +![](figures/using-DAC-process.png) #### Opening a DAC Device Call **DacOpen()** to open a DAC device before performing the DA conversion. -``` +```c++ DevHandle DacOpen(uint32_t number); ``` **Table 2** Description of DacOpen -| **Parameter** | Description | -| ---------- | ----------------- | -| number | DAC device number. | -| **Return Value**| **Description** | -| NULL | Failed to open the DAC device. | -| Device handle | Handle of the DAC device opened.| - - +| Parameter | Description | +| --------- | ---------------- | +| number | DAC device number. | +| **Return Value**| **Description** | +| NULL | The operation failed. | +| Device handle | The operation is successful. The handle of the DAC device opened is returned.| -Open device 1 of the two ADC devices (numbered 0 and 1) in the system. +Example: Open device 1 of the two DAC devices (numbered 0 and 1) in the system. -``` +```c++ DevHandle dacHandle = NULL; /* DAC device handle / -/* Open the DAC device. */ +/* Open DAC device 1. */ dacHandle = DacOpen(1); if (dacHandle == NULL) { HDF_LOGE("DacOpen: failed\n"); @@ -113,23 +111,22 @@ if (dacHandle == NULL) { #### Setting a Target DA Value -``` +```c++ int32_t DacWrite(DevHandle handle, uint32_t channel, uint32_t val); ``` **Table 3** Description of DacWrite - -| **Parameter** | Description | -| ---------- | -------------- | -| handle | DAC device handle. | -| channel | DAC channel number. | -| val | DA value to set. | +| Parameter | Description | +| --------- | ------------ | +| handle | DAC device handle. | +| channel | DAC channel number.| +| val | DA value to set. | | **Return Value**| **Description**| -| 0 | The operation is successful. | -| Negative value | The operation failed. | +| 0 | The operation is successful. | +| Negative value | The operation failed. | -``` +```c++ /* Write the target DA value through the DAC_CHANNEL_NUM channel. */ ret = DacWrite(dacHandle, DAC_CHANNEL_NUM, val); if (ret != HDF_SUCCESS) { @@ -142,28 +139,25 @@ int32_t DacWrite(DevHandle handle, uint32_t channel, uint32_t val); #### Closing a DAC Device After the DAC communication is complete, call **DacClose()** to close the DAC device. -``` +```c++ void DacClose(DevHandle handle); ``` **Table 4** Description of DacClose - -| **Parameter** | Description | -| ---------- | -------------- | -| handle | DAC device handle. | +| Parameter | Description | +| --------- | ------------ | +| handle | DAC device handle. | | **Return Value**| **Description**| -| void | - | - - +| void | - | Example: -``` +```c++ DacClose(dacHandle); /* Close the DAC device. */ ``` -## Development Example +## Example The procedure is as follows: @@ -173,8 +167,8 @@ The procedure is as follows: You can obtain the operation result by printing the log information based on the **val**. -``` -#include "hdmi_if.h" /* Header file for DAC APIs */ +```c++ +#include "dac_if.h" /* Header file for DAC APIs */ #include "hdf_log.h" /* Header file for log APIs */ /* Define device 0, channel 1. */ @@ -209,4 +203,4 @@ static int32_t TestCaseDac(void) return 0; } -``` \ No newline at end of file +``` diff --git a/en/device-dev/driver/figures/ADC_physical_connection.png b/en/device-dev/driver/figures/ADC_physical_connection.png index da94f3b486edb6b269ef341b12b1816f23036c32..d3cddfb92b63afc8ae1b3f8d02e4ac9c7aeb9edd 100644 Binary files a/en/device-dev/driver/figures/ADC_physical_connection.png and b/en/device-dev/driver/figures/ADC_physical_connection.png differ diff --git a/en/device-dev/driver/figures/using-ADC-process.png b/en/device-dev/driver/figures/using-ADC-process.png index 6aebca249fa9d7948eca5f0047cea6ac4074c731..691adc1e3454170d4c0f16f60739560ef2e3ea9f 100644 Binary files a/en/device-dev/driver/figures/using-ADC-process.png and b/en/device-dev/driver/figures/using-ADC-process.png differ diff --git a/en/device-dev/get-code/gettools-acquire.md b/en/device-dev/get-code/gettools-acquire.md index de4acc2188103623732bcd5bf241344352f18425..444283316c4eafd12cc98e5b0af20b999482c243 100644 --- a/en/device-dev/get-code/gettools-acquire.md +++ b/en/device-dev/get-code/gettools-acquire.md @@ -138,7 +138,7 @@ hb set 1. Obtain the Docker image. ``` - docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:1.0.0 + docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0 ``` 2. Go to the root directory of OpenHarmony code and run the following command to access the Docker build environment: diff --git a/en/device-dev/kernel/kernel-small-start-user.md b/en/device-dev/kernel/kernel-small-start-user.md index f2526dda1e39f972865de8ae98f29fbffb24fd22..fb34ba4194831b84c2683fd4ab11e2ee2cc2098c 100644 --- a/en/device-dev/kernel/kernel-small-start-user.md +++ b/en/device-dev/kernel/kernel-small-start-user.md @@ -48,14 +48,14 @@ Common compilation modes of user-mode programs include: Example: ``` - clang --target=arm-liteos --sysroot=prebuilts/lite/sysroot -o helloworld helloworld.c + clang --target=arm-liteos --sysroot=sysroot -o helloworld helloworld.c ``` Before running the **clang** command, install the LLVM compiler. For details, see [Installing LLVM](../quick-start/quickstart-lite-steps-hi3861-setting.md). **--target=arm-liteos**: specifies the compilation platform, which is arm-liteos. - **--sysroot=$\{YOUR\_ROOT\_PATH\}/prebuilts/lite/sysroot**: specifies the directory in which you can search for the header file and the dependent standard libraries. + **--sysroot=$\{YOUR\_ROOT\_OUT\_PATH\}/sysroot**: specifies the directory in which you can search for the header file and the dependent standard libraries. A user-mode program can be started in either of the following ways: diff --git a/en/device-dev/kernel/kernel-standard-patch.md b/en/device-dev/kernel/kernel-standard-patch.md index 9845278874991b0c820ae147e7532ac9a41ef1cf..55448b5f893fc22fa938b8ea111fc42ce92d6068 100644 --- a/en/device-dev/kernel/kernel-standard-patch.md +++ b/en/device-dev/kernel/kernel-standard-patch.md @@ -5,7 +5,7 @@ Apply the HDF patches based on the kernel version in the **kernel/linux/build** repository. For details, see the method for applying the HDF patch in **kernel.mk**. ``` - $(OHOS_BUILD_HOME)/drivers/adapter/khdf/linux/patch_hdf.sh $(OHOS_BUILD_HOME) $(KERNEL_SRC_TMP_PATH) $(HDF_PATCH_FILE) + $(OHOS_BUILD_HOME)/drivers/hdf_core/adapter/khdf/linux/patch_hdf.sh $(OHOS_BUILD_HOME) $(KERNEL_SRC_TMP_PATH) $(KERNEL_PATCH_PATH) $(DEVICE_NAME) ``` 2. Apply the chip driver patches. diff --git a/en/device-dev/porting/porting-linux-kernel.md b/en/device-dev/porting/porting-linux-kernel.md index b05cc605918f7e83b6e244f5f4b97fe61a9c889d..cbe6bef55a6b9ad6ad69f33da16c6d51843a7256 100644 --- a/en/device-dev/porting/porting-linux-kernel.md +++ b/en/device-dev/porting/porting-linux-kernel.md @@ -1,12 +1,12 @@ -# A Method for Rapidly Porting the OpenHarmony Linux Kernel +# A Method for Rapidly Porting the OpenHarmony Linux Kernel -## Overview +## Overview This document describes how to quickly port OpenHarmony to a third-party chip platform by using the existing capabilities of the Linux kernel of the third-party chip platform. -## Overall Porting Approach +## Overall Porting Approach -### Kernel Mode Layer and User Mode Layer +### Kernel Mode Layer and User Mode Layer For easy description, we divide the OpenHarmony architecture into two parts: @@ -20,7 +20,7 @@ The user mode layer includes other parts except the OpenHarmony kernel layer. It The user mode layer of OpenHarmony is loosely coupled with the third-party chip platform and is easy to port. The kernel and HDF at the kernel mode layer are closely coupled with the third-party chip platform and are difficult to port. This document focus on the porting of the kernel mode layer. In addition, it describes only the quick porting of the Linux kernel. It does not include the porting of LiteOS. -### Composition of the Kernel Mode Layer +### Composition of the Kernel Mode Layer The OpenHarmony kernel mode layer can be further divided as follows: @@ -51,7 +51,7 @@ The standard LTS Linux kernel and third-party SoC chip platform code constitute In the following, we elaborate how to port OpenHarmony that uses with the third-party Linux kernel. -### Overall Porting Process +### Overall Porting Process The porting process is as follows: @@ -59,11 +59,11 @@ The porting process is as follows: 2. Port the OpenHarmony basic kernel-mode code. 3. Port OpenHarmony mandatory kernel-mode features \(such as HDF\). -## Procedure +## Procedure The following uses Raspberry Pi 3b \(BCM2837\) as an example to describe how to port OpenHarmony to Raspberry Pi. -### Setting Up the Environment +### Setting Up the Environment 1. Copy the third-party kernel code to the OpenHarmony build environment. @@ -84,8 +84,8 @@ The following uses Raspberry Pi 3b \(BCM2837\) as an example to describe how to # Configure the build environment, and use clang provided by the project to build the Raspberry Pi kernel source code. export PATH=$PROJ_ROOT/prebuilts/clang/ohos/linux-x86_64/llvm/bin:$PROJ_ROOT/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/bin/:$PATH export MAKE_OPTIONS="ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- CC=clang HOSTCC=clang" - export PRODUCT_PATH=vendor/hisilicon/hispark_taurus_standard - ``` + export PRODUCT_PATH=vendor/hisilicon/hispark_taurus_linux + ``` 3. Comment out the flags that cannot be recognized by **clang**. @@ -96,7 +96,7 @@ The following uses Raspberry Pi 3b \(BCM2837\) as an example to describe how to ``` -### Porting Basic Kernel-Mode Code +### Porting Basic Kernel-Mode Code Currently, the basic kernel-mode code of OpenHarmony is related to the log service. The lightweight kernel log service code includes the following: @@ -125,20 +125,20 @@ Enable the CONFIG macros **CONFIG\_HILOG** and **CONFIG\_HIEVENT** in the kernel For details about how to use the logs, see [Hilog\_lite](https://gitee.com/openharmony/hiviewdfx_hilog_lite/blob/master/README.md). -### Porting the HDF Feature +### Porting the HDF Feature 1. Install HDF patches. Run the shell script to apply HDF patches. - 1. Set the three variables in the **patch\_hdf.sh** script. + 1. Set the four variables in the **patch\_hdf.sh** script. 2. Obtain the **patch\_hdf.sh** script. - 3. Run the **patch\_hdf.sh** script to pass the three variables in sequence. + 3. Run the **patch\_hdf.sh** script to pass the four variables in sequence. Run the following command: ``` - ./patch_hdf.sh [Project root directory path] [Kernel directory path] [HDF patch file] + ./patch_hdf.sh [Project root directory path] [Kernel directory path] [Kernel patch path] [Device name] ``` The following uses Raspberry Pi 3b as an example: @@ -148,7 +148,8 @@ For details about how to use the logs, see [Hilog\_lite](https://gitee.com/openh PROJ_ROOT/drivers/adapter/khdf/linux/patch_hdf.sh \ PROJ_ROOT # Specify the path of the project root directory.\ PROJ_ROOT/out/KERNEL_OBJ/kernel/src_tmp/linux-rpi3b # Specify the kernel directory for applying the patch.\ - PROJ_ROOT/kernel/linux/patches/linux-4.19/hi3516dv300_patch/hdf.patch # HDF patch file. + PROJ_ROOT/kernel/linux/patches/linux-4.19 # Kernel patch patch.\ + hi3516dv300 # Device name. ``` 2. Configure the **config** file. @@ -185,14 +186,14 @@ For details about how to use the logs, see [Hilog\_lite](https://gitee.com/openh ![](figures/menuconfig.png) -### Building the Image +### Building the Image ``` # Run the following command: make ${MAKE_OPTIONS} -j33 zImage ``` -### \(Optional\) Building and Running HDF Test Cases +### \(Optional\) Building and Running HDF Test Cases **Overview** diff --git a/en/device-dev/porting/porting-thirdparty-cmake.md b/en/device-dev/porting/porting-thirdparty-cmake.md index 7956e702ae20df460ab4026420557d8a625276da..3ae6e23ff8382ef93fd1583487c433e468233695 100755 --- a/en/device-dev/porting/porting-thirdparty-cmake.md +++ b/en/device-dev/porting/porting-thirdparty-cmake.md @@ -348,7 +348,7 @@ The following steps show how to configure and modify the toolchains for cross-co #toolchain: follow up-layer, depend on $ohos_build_compiler if (ohos_build_compiler == "clang") { - CMAKE_TOOLCHAIN_FLAG = "-DOHOS_SYSROOT_PATH=${ohos_root_path}prebuilts/lite/sysroot/" + CMAKE_TOOLCHAIN_FLAG = "-DOHOS_SYSROOT_PATH=${root_out_dir}sysroot/" } else { CMAKE_TOOLCHAIN_FLAG = "" } diff --git a/en/device-dev/porting/porting-thirdparty-makefile.md b/en/device-dev/porting/porting-thirdparty-makefile.md index 68136beef3a57f2068e8340974d4ada331ccc6c7..6c64a5ce974c525069df4e710753a0f2c54df594 100644 --- a/en/device-dev/porting/porting-thirdparty-makefile.md +++ b/en/device-dev/porting/porting-thirdparty-makefile.md @@ -262,9 +262,9 @@ if (ohos_build_thirdparty_migrated_from_fuchisa == true) { TEST_ENABLE = "YES" if (TEST_ENABLE == "YES") { - MAKE_COMMAND = "make test OHOS_SYSROOT_PATH=${ohos_root_path}prebuilts/lite/sysroot/" + MAKE_COMMAND = "make test OHOS_SYSROOT_PATH=${root_out_dir}sysroot/" } else { - MAKE_COMMAND = "make OHOS_SYSROOT_PATH=${ohos_root_path}prebuilts/lite/sysroot/" + MAKE_COMMAND = "make OHOS_SYSROOT_PATH=${root_out_dir}sysroot/" } ``` diff --git a/en/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-helloworld.md b/en/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-helloworld.md index 798e092f3b6f5d0476c0adb12147d2f215f16e1c..1733121204ab84855e33b90409ecb4aa5f5c8f95 100644 --- a/en/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-helloworld.md +++ b/en/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-helloworld.md @@ -58,7 +58,7 @@ Perform the steps below in the source code directory: 3. Add a component. - Modify the **build/lite/components/applications.json** file and add the configuration of **hello_world_app**. The following code snippet is a snippet of the **applications.json** file: The configuration between \#\#start\#\# and \#\#end\#\# is new. (\#\#start\#\# and \#\#end\#\# are only used to identify the location. After the configuration is complete, delete these lines.) + Modify the **build/lite/components/communication.json** file and add the configuration of **hello_world_app**. The following code snippet is a snippet of the **communication.json** file: The configuration between \#\#start\#\# and \#\#end\#\# is new. (\#\#start\#\# and \#\#end\#\# are only used to identify the location. After the configuration is complete, delete these lines.) ``` diff --git a/en/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-helloworld.md b/en/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-helloworld.md index f3de1522e47257bf0b3f0a644b945c5cc629d87f..9c180451924b4fbccb3492f877bf5ed2946b301f 100644 --- a/en/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-helloworld.md +++ b/en/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-helloworld.md @@ -62,7 +62,7 @@ The following exemplifies how to create a program by modifying the source code. 4. Add a component. - Modify the **build/lite/components/applications.json** file and add the configuration of **hello_world_app**. The following code snippet is a snippet of the **applications.json** file: The configuration between \#\#start\#\# and \#\#end\#\# is new. (\#\#start\#\# and \#\#end\#\# are only used to identify the location. After the configuration is complete, delete these lines.) + Modify the **build/lite/components/communication.json** file and add the configuration of **hello_world_app**. The following code snippet is a snippet of the **communication.json** file: The configuration between \#\#start\#\# and \#\#end\#\# is new. (\#\#start\#\# and \#\#end\#\# are only used to identify the location. After the configuration is complete, delete these lines.) ``` diff --git a/en/device-dev/quick-start/quickstart-lite-steps-hi3516-helloworld.md b/en/device-dev/quick-start/quickstart-lite-steps-hi3516-helloworld.md index 798e092f3b6f5d0476c0adb12147d2f215f16e1c..1733121204ab84855e33b90409ecb4aa5f5c8f95 100644 --- a/en/device-dev/quick-start/quickstart-lite-steps-hi3516-helloworld.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-hi3516-helloworld.md @@ -58,7 +58,7 @@ Perform the steps below in the source code directory: 3. Add a component. - Modify the **build/lite/components/applications.json** file and add the configuration of **hello_world_app**. The following code snippet is a snippet of the **applications.json** file: The configuration between \#\#start\#\# and \#\#end\#\# is new. (\#\#start\#\# and \#\#end\#\# are only used to identify the location. After the configuration is complete, delete these lines.) + Modify the **build/lite/components/communication.json** file and add the configuration of **hello_world_app**. The following code snippet is a snippet of the **communication.json** file: The configuration between \#\#start\#\# and \#\#end\#\# is new. (\#\#start\#\# and \#\#end\#\# are only used to identify the location. After the configuration is complete, delete these lines.) ``` diff --git a/en/device-dev/quick-start/quickstart-lite-steps-hi3861-helloworld.md b/en/device-dev/quick-start/quickstart-lite-steps-hi3861-helloworld.md index f3de1522e47257bf0b3f0a644b945c5cc629d87f..9c180451924b4fbccb3492f877bf5ed2946b301f 100644 --- a/en/device-dev/quick-start/quickstart-lite-steps-hi3861-helloworld.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-hi3861-helloworld.md @@ -62,7 +62,7 @@ The following exemplifies how to create a program by modifying the source code. 4. Add a component. - Modify the **build/lite/components/applications.json** file and add the configuration of **hello_world_app**. The following code snippet is a snippet of the **applications.json** file: The configuration between \#\#start\#\# and \#\#end\#\# is new. (\#\#start\#\# and \#\#end\#\# are only used to identify the location. After the configuration is complete, delete these lines.) + Modify the **build/lite/components/communication.json** file and add the configuration of **hello_world_app**. The following code snippet is a snippet of the **communication.json** file: The configuration between \#\#start\#\# and \#\#end\#\# is new. (\#\#start\#\# and \#\#end\#\# are only used to identify the location. After the configuration is complete, delete these lines.) ``` diff --git a/en/device-dev/subsystems/subsys-data-relational-database-guide.md b/en/device-dev/subsystems/subsys-data-relational-database-guide.md index eeaa439df91494d306ebacd79fd40398d75ffea3..ae7ce7bb1d92c9868e5f7ad1003ff4dbec2c0bf5 100644 --- a/en/device-dev/subsystems/subsys-data-relational-database-guide.md +++ b/en/device-dev/subsystems/subsys-data-relational-database-guide.md @@ -2,85 +2,85 @@ ## When to Use -On the basis of the SQLite database, the RDB allows you to operate data with or without native SQL statements. In OpenHarmony, an RDB is also called RDB store. +A relational database (RDB) store allows you to operate local data with or without native SQL statements based on SQLite. ## Available APIs ### Creating and Deleting an RDB Store -The following table describes APIs available for creating and deleting an RDB store. +The table below describes the APIs for creating and deleting an RDB store. **Table 1** APIs for creating and deleting an RDB store | Class| API| Description| | ---- | ---- | ---- | -| RdbStoreConfig | RdbStoreConfig(const std::string &path,
StorageMode storageMode = StorageMode::MODE_DISK,
bool readOnly = false,
const std::vector &encryptKey = std::vector(),
const std::string &journalMode = "",
const std::string &syncMode = "",
const std::string &databaseFileType = "",
const std::string &databaseFileSecurityLevel = "") | Configures an RDB store, including setting the name, storage mode, log mode, synchronization mode, and read-only mode, and encrypting the RDB store.
- **path**: path of the database.
- **readOnly**: whether the database is read-only.
-  **storageMode**: storage mode.
- **encryptKey**: key used for database encryption.
- **journalMode**: database logging mode.
- **syncMode**: data synchronization mode.
- **databaseFileType**: database type.
- **databaseFileSecurityLevel**: security level. | -| RdbOpenCallback | int OnCreate(RdbStore &rdbStore) | Called when an RDB store is created. You can add the method for initializing the table structure and add initialization data used by your application in the callback.| +| RdbStoreConfig | RdbStoreConfig(const std::string &path,
StorageMode storageMode = StorageMode::MODE_DISK,
bool readOnly = false,
const std::vector &encryptKey = std::vector(),
const std::string &journalMode = "",
const std::string &syncMode = "",
const std::string &databaseFileType = "",
const std::string &databaseFileSecurityLevel = "") | Configures an RDB store, including setting the RDB store name, storage mode, log mode, synchronization mode, and read-only mode, and whether to encrypt the RDB store.
- **path**: path of the RDB store.
- **readOnly**: whether the RDB store is read-only.
- **storageMode**: storage mode.
- **encryptKey**: key used to encrypt the RDB store.
- **journalMode**: logging mode.
- **syncMode**: data synchronization mode.
- **databaseFileType**: RDB store type.
- **databaseFileSecurityLevel**: security level of the RDB store.| +| RdbOpenCallback | int OnCreate(RdbStore &rdbStore) | Called when an RDB store is created. You can add the method for initializing the table structure and initialization data used by your application in this callback.| | RdbOpenCallback | int OnUpgrade(RdbStore &rdbStore, int currentVersion, int targetVersion) | Called when the RDB store is upgraded.| | RdbOpenCallback | int OnDowngrade(RdbStore &rdbStore, int currentVersion, int targetVersion) | Called when the RDB store is downgraded.| | RdbHelper | std::shared_ptr\ GetRdbStore(const RdbStoreConfig &config, int version, RdbOpenCallback &openCallback, int &errCode) | Creates or obtains an RDB store.| -| RdbHelper | int DeleteRdbStore(const std::string &path) | Deletes the specified RDB store.| +| RdbHelper | int DeleteRdbStore(const std::string &path) | Deletes an RDB store.| ### Encrypting an RDB Store -The RDB provides the database encryption capability. When creating an RDB store, you can add a key for security purposes. After that, the RDB store can be accessed only with the correct key. +When creating an RDB store, you can add a key for security purposes. After that, the RDB store can be accessed only with the correct key. **Table 2** API for changing the key | Class| API| Description| | ---- | ---- | ---- | -| RdbStore | int ChangeEncryptKey(const std::vector &newKey) | Changes the encryption key for an RDB store.
Note: The encryption key can be changed only for an encrypted RDB store.| +| RdbStore | int ChangeEncryptKey(const std::vector &newKey) | Changes the encryption key for an RDB store.
Note that the encryption key can be changed only for an encrypted RDB store.| ### Using Predicates -The RDB provides **AbsRdbPredicates** for you to set database operation conditions. The **AbsRdbPredicates** has the following child classes: +The RDB store provides **AbsRdbPredicates** for you to set database operation conditions. The **AbsRdbPredicates** class has the following child classes: -- **RdbPredicates**: With this class, you do not need to write complex SQL statements. Instead, you can combine SQL statements simply by calling methods in this class, such as **equalTo**, **notEqualTo**, **groupBy**, **orderByAsc**, and **beginsWith**. -- **RawRdbPredicates**: With this class, you can set **whereClause** and **whereArgs**, but cannot call methods such as **equalTo**. +- **RdbPredicates**: allows you to combine SQL statements by simply calling methods in this class, such as **equalTo**, **notEqualTo**, **groupBy**, **orderByAsc**, and **beginsWith**. With this class, you do not need to write complex SQL statements. +- **RawRdbPredicates**: allows you to write complex SQL statements, such as setting **whereClause** and **whereArgs**. However, this class does not support APIs such as **equalTo**. - **Table 3** APIs for RDB store predicates + **Table 3** APIs for setting RDB predicates | Class| API| Description| | ---- | ---- | ---- | - | RdbPredicates | AbsPredicates *EqualTo(std::string field, std::string value) | Sets the **AbsPredicates** to match the field that is equal to the specified value.| - | RdbPredicates | AbsPredicates *NotEqualTo(std::string field, std::string value) | Sets the **AbsPredicates** to match the field that is not equal to the specified value.| - | RdbPredicates | AbsPredicates *BeginsWith(std::string field, std::string value) | Sets the **AbsPredicates** to match the field that starts with the specified value.| - | RdbPredicates | AbsPredicates *Between(std::string field, std::string low, std::string high) | Sets the **AbsPredicates** to match the field that is within the range specified by **low** and **high**.| - | RdbPredicates | AbsPredicates *OrderByAsc(std::string field) | Sets the **AbsPredicates** to match the column with values sorted in ascending order.| + | RdbPredicates | AbsPredicates *EqualTo(std::string field, std::string value) | Sets an **AbsPredicates** to match the field that is equal to the specified value.| + | RdbPredicates | AbsPredicates *NotEqualTo(std::string field, std::string value) | Sets an **AbsPredicates** to match the field that is not equal to the specified value.| + | RdbPredicates | AbsPredicates *BeginsWith(std::string field, std::string value) | Sets an **AbsPredicates** to match the field that starts with the specified value.| + | RdbPredicates | AbsPredicates *Between(std::string field, std::string low, std::string high) | Sets an **AbsPredicates** to match the field that is within the range specified by **low** and **high**.| + | RdbPredicates | AbsPredicates *OrderByAsc(std::string field) | Sets an **AbsPredicates** that sorts values in ascending order.| | RdbPredicates | void SetWhereClause(std::string whereClause) | Sets **whereClause**.| | RdbPredicates | void SetWhereArgs(std::vector\ whereArgs) | Sets **whereArgs**, which indicates the value of the placeholder in **whereClause**.| - | RdbPredicates | AbsRdbPredicates *InDevices(std::vector& devices) | Sets the **AbsPredicates** to specify the remote devices on the network with databases to be synchronized.| - | RdbPredicates | AbsRdbPredicates *InAllDevices() | Sets the **AbsPredicates** to connect to all remote devices on the network when synchronizing distributed databases.| + | RdbPredicates | AbsRdbPredicates *InDevices(std::vector& devices) | Sets an **AbsPredicates** to specify the remote devices on the network with databases to be synchronized.| + | RdbPredicates | AbsRdbPredicates *InAllDevices() | Sets an **AbsPredicates** to connect to all remote devices on the network when synchronizing distributed databases.| ### Managing Data in an RDB Store -The RDB provides APIs for inserting, deleting, updating, and querying data in the local RDB store. +You can use the APIs provided by the RDB to insert, delete, update, and query local data. - Inserting data - The RDB provides an API for inserting data through **ValuesBucket** in a data table. If the data is added, the row number of the data inserted is returned; otherwise, **-1** is returned. + Call **int Insert()** to insert data through **ValuesBucket**. If data is inserted, the row number of the data inserted is returned; otherwise, **-1** is returned. - **Table 4** APIs for inserting data tables + **Table 4** API for inserting data | Class| API| Description| | ---- | ---- | ---- | - | RdbStore | int Insert(int64_t &outRowId, const std::string &table, const ValuesBucket &initialValues) | Inserts data based on the passed table name and data in **ValuesBucket**.
- **table**: specifies the name of the target table.
- **initialValues**: specifies the data, stored in **ValuesBucket**, to insert. A series of **put()** methods, such as **PutString(const std::string &columnName, const std::string &value)** and **PutDouble(const std::string &columnName, double value)**, are provided to add data to **ValuesBucket**. | + | RdbStore | int Insert(int64_t &outRowId, const std::string &table, const ValuesBucket &initialValues) | Inserts data based on the passed table name and data in **ValuesBucket**.
- **table**: name of the target table.
- **initialValues**: data to insert. The data is stored in **ValuesBucket**. A series of **put()** methods, such as **PutString(const std::string &columnName, const std::string &value)** and **PutDouble(const std::string &columnName, double value)**, are provided to add data to **ValuesBucket**. | - Deleting data - Call the **delete()** method to delete data meeting the conditions specified by **AbsRdbPredicates**. If the data is deleted, the row number of the deleted data is returned; otherwise, **0** is returned. + Call **delete()** to delete the data that meets the conditions specified by **AbsRdbPredicates**. If data is deleted, the row number of the deleted data is returned; otherwise, **0** is returned. **Table 5** API for deleting data | Class| API| Description| | ---- | ---- | ---- | - | RdbStore | int Delete(int &deletedRows, const AbsRdbPredicates &predicates) | Deletes data.
- **deletedRows**: specifies the number of rows to delete.
- **predicates**: specifies the table name and conditions for deleting the data.
**AbsRdbPredicates** has the following classes:
- **RdbPredicates**: specifies update conditions by calling its methods, such as **equalTo**.
- **RawRdbPredicates**: specifies the table name, **whereClause** and **whereArgs** only. | + | RdbStore | int Delete(int &deletedRows, const AbsRdbPredicates &predicates) | Deletes data.
- **deletedRows**: number of rows to delete.
- **predicates**: table name and conditions for deleting the data. **AbsRdbPredicates** has the following classes:
- **RdbPredicates**: specifies conditions by calling its methods, such as **equalTo**.
- **RawRdbPredicates**: specifies the table name, **whereClause**, and **whereArgs** only. | - Updating data - Call the **update()** method to modify data based on the passed data and the conditions specified by **AbsRdbPredicates**. If the data is updated, the row number of the updated data is returned; otherwise, **0** is returned. + Call **update()** to update data based on the passed data and the conditions specified by **AbsRdbPredicates**. If data is updated, the row number of the updated data is returned; otherwise, **0** is returned. **Table 6** API for updating data | Class| API| Description| | ---- | ---- | ---- | - | RdbStore | int Update(int &changedRows, const ValuesBucket &values, const AbsRdbPredicates &predicates) | Updates the data that meets the conditions specified by predicates.
- **changedRows**: specifies the number of rows to update.
- **values**: specifies the new data stored in **ValuesBucket**.
- **predicates**: specifies the table name and conditions for the update operation. **AbsRdbPredicates** has the following classes:
- **RdbPredicates**: specifies update conditions by calling its methods, such as **equalTo**.
- **RawRdbPredicates**: specifies the table name, **whereClause** and **whereArgs** only. | + | RdbStore | int Update(int &changedRows, const ValuesBucket &values, const AbsRdbPredicates &predicates) | Updates the data that meets the conditions specified by predicates.
- **changedRows**: number of rows to update.
- **values**: new data stored in **ValuesBucket**.
- **predicates**: table name and conditions for the update operation. **AbsRdbPredicates** has the following classes:
- **RdbPredicates**: specifies update conditions by calling its methods, such as **equalTo**.
- **RawRdbPredicates**: specifies the table name, **whereClause**, and **whereArgs** only. | - Querying data @@ -92,72 +92,92 @@ The RDB provides APIs for inserting, deleting, updating, and querying data in th **Table 7** APIs for querying data | Class| API| Description| | ---- | ---- | ---- | - | RdbStore | std::unique_ptr Query(const AbsRdbPredicates &predicates, const std::vector\ columns) | Queries data.
- **predicates**: specifies the query conditions. **AbsRdbPredicates** has the following classes:
- **RdbPredicates**: specifies update conditions by calling its methods, such as **equalTo**.
- **RawRdbPredicates**: specifies the table name, **whereClause**, and **whereArgs** only.
- **columns**: specifies the number of columns returned. | - | RdbStore | std::unique_ptr QuerySql(const std::string &sql, const std::vector\ &selectionArgs = std::vector\()) | Executes the native SQL statements to query data.
- **sql**: specifies the native SQL statement.
- **selectionArgs**: specifies the parameter values corresponding to the placeholders in the SQL statements. Set it to **null** if the **select** statement has no placeholder. | + | RdbStore | std::unique_ptr Query(const AbsRdbPredicates &predicates, const std::vector\ columns) | Queries data.
- **predicates**: query conditions. **AbsRdbPredicates** has the following classes:
- **RdbPredicates**: specifies query conditions by calling its methods, such as **equalTo**.
- **RawRdbPredicates**: specifies the table name, **whereClause**, and **whereArgs** only.
- **columns**: number of columns returned. | + | RdbStore | std::unique_ptr QuerySql(const std::string &sql, const std::vector\ &selectionArgs = std::vector\()) | Executes the native SQL statements to query data.
- **sql**: native SQL statement.
- **selectionArgs**: parameter values corresponding to the placeholders in the SQL statements. Set it to **null** if the **select** statement has no placeholder. | -### Using the Result Set +### Obtaining the Query Result -A result set can be regarded as rows of data in the queried results. It allows you to traverse and access the data you have queried. The following table describes the external APIs of **ResultSet**. +You can use the APIs provided by **ResultSet** to traverse and access the data you have queried. A result set can be regarded as a row of data in the queried result. The table below describes the APIs of **ResultSet**. -**Table 8** APIs for using the result set +**Table 8** APIs of **ResultSet** | Class| API| Description| | ---- | ---- | ---- | -| ResultSet | int GoTo(int offset) | Moves the result set forwards or backwards by the specified offset relative to its current position.| -| ResultSet | int GoToRow(int position) | Moves the result set to the specified row.| -| ResultSet | int GoToNextRow() | Moves the result set to the next row.| -| ResultSet | int GoToPreviousRow() | Moves the result set to the previous row.| +| ResultSet | int GoTo(int offset) | Moves forwards or backwards by the specified offset relative to its current position.| +| ResultSet | int GoToRow(int position) | Moves to the specified row.| +| ResultSet | int GoToNextRow() | Moves to the next row.| +| ResultSet | int GoToPreviousRow() | Moves to the previous row.| | ResultSet | int IsStarted(bool &result) | Checks whether the result set has been moved.| | ResultSet | int IsEnded(bool &result) | Checks whether the result set is moved after the last line.| | ResultSet | int IsAtFirstRow(bool &result) | Checks whether the result set is located in the first row.| | ResultSet | int IsAtLastRow(bool &result) | Checks whether the result set is located in the last row.| -| ResultSet | int GetRowCount(int &count) | Obtains the number of rows in the result set.| -| ResultSet | int GetColumnCount(int &count) | Obtains the number of columns in the result set.| -| ResultSet | int GetString(int columnIndex, std::string &value) | Obtains the values in the specified column of the current row, in strings.| -| ResultSet | int GetBlob(int columnIndex, std::vector\ &blob) | Obtains the values in the specified column of the current row, in a byte array.| -| ResultSet | int GetDouble(int columnIndex, double &value) | Obtains the values in the specified column of the current row, in double.| +| ResultSet | int GetRowCount(int &count) | Obtains the number of rows of this result set.| +| ResultSet | int GetColumnCount(int &count) | Obtains the number of columns of this result set.| +| ResultSet | int GetString(int columnIndex, std::string &value) | Obtains the value in the specified column of the current row, in strings.| +| ResultSet | int GetBlob(int columnIndex, std::vector\ &blob) | Obtains the value in the specified column of the current row, in a byte array.| +| ResultSet | int GetDouble(int columnIndex, double &value) | Obtains the value in the specified column of the current row, in double.| -### Setting a List of Distributed Tables +### Setting Distributed Tables -You can set a list of distributed tables for data operations across devices. +Call **bool SetDistributedTables()** to set distributed tables for data operations across devices. -**Table 9** API for setting a distributed table list +**Table 9** API for setting distributed tables | Class| API| Description| | ---- | ---- | ---- | -| RdbStore | bool SetDistributedTables(const std::vector& tables) | Sets a list of distributed tables.
- **tables**: specifies the names of the distributed tables to set. | +| RdbStore | bool SetDistributedTables(const std::vector& tables) | Sets distributed tables.
- **tables**: names of the distributed tables to set. ### Obtaining the Distributed Table Name for a Remote Device -When querying the RDB store of a remote device, you need to use the distributed table name. You can obtain the distributed table name of a remote device based on the local table name. +You can obtain the distributed table name for a remote device based on the local table name. The distributed table name can be used to query the RDB store of the remote device.
**Table 10** API for obtaining the distributed table name of a remote device - | Class| API| Description| | ---- | ---- | ---- | -| RdbStore | std::string ObtainDistributedTableName(const std::string& device, const std::string& table) | Obtains the distributed table name of a remote device based on the local table name. The distributed table name can be used to query the RDB store of the remote device.
- **device**: specifies the ID of the remote device.
- **table**: specifies the name of the local table. | +| RdbStore | std::string ObtainDistributedTableName(const std::string& device, const std::string& table) | Obtains the distributed table name of a remote device based on the local table name. The distributed table name can be used to query the RDB store of the remote device.
- **device**: ID of the remote device.
- **table**: name of the local table. ### Synchronizing Data Between Devices -**Table 11** API for cross-device data synchronization - +**Table 11** API for synchronizing data between devices | Class| API| Description| | ---- | ---- | ---- | -| RdbStore | bool Sync(const SyncOption& option, const AbsRdbPredicates& predicate, const SyncCallback& callback) | Synchronizes data between devices.
- **option**: specifies synchronization options, which include the following:
**mode**: specifies how data is synchronized. The value **push** means to push data from the local device to the remote device; the value **pull** means to pull data from the remote device to the local device.
**isBlock**: specifies whether the invocation of this function is blocked.
- **callback**: specifies the callback used to return the result. | +| RdbStore | bool Sync(const SyncOption& option, const AbsRdbPredicates& predicate, const SyncCallback& callback) | Synchronizes data between devices.
- **option**: synchronization options, which include **mode** and **isBlock**. **mode** specifies how data is synchronized. The value **push** means to push data from the local device to the remote device; the value **pull** means to pull data from the remote device to the local device. **isBlock** specifies whether the invocation of this function is blocked.
- **callback**: callback used to return the result. ### Registering an RDB Store Observer **Table 12** API for registering an observer - | Class| API| Description| | ---- | ---- | ---- | -| RdbStore | bool Subscribe(const SubscribeOption& option, RdbStoreObserver *observer) | Registers an observer for this RDB store to subscribe to distributed data changes. When data in the RDB store changes, a callback will be invoked to return the data changes.
- **option**: specifies the subscription type.
- **observer**: specifies the observer of data changes in the RDB store. | +| RdbStore | bool Subscribe(const SubscribeOption& option, RdbStoreObserver *observer) | Registers an observer for this RDB store to listen for distributed data changes. When data in the RDB store changes, a callback will be invoked to return the data changes.
- **option**: subscription type.
- **observer**: observer that listens for data changes in the RDB store. ### Unregistering an RDB Store Observer **Table 13** API for unregistering an observer - | Class| API| Description| | ---- | ---- | ---- | -| RdbStore | bool UnSubscribe(const SubscribeOption& option, RdbStoreObserver *observer) | Unregisters the observer of the specified type to unsubscribe from distributed data changes.
- **option**: specifies the subscription type to unregister.
- **observer**: specifies the observer to unregister. | +| RdbStore | bool UnSubscribe(const SubscribeOption& option, RdbStoreObserver *observer) | Unregisters the observer of the specified type.
- **option**: subscription type to unregister.
- **observer**: observer to unregister. + +### Backing Up and Restoring an RDB Store + +You can use the APIs provided by **rdbStore** to back up and restore local database files. + +- Backing up an RDB store + + Call **int Backup()** to back up the current database file. **databasePath** specifies the name or path of the backup file to be generated. If the backup is successful, **0** is returned; otherwise, an error code is returned. + + Table 14 API for backing up an RDB store + + | Class| API| Description| + | ---- | ---- | ---- | + | RdbStore | int Backup(const std::string databasePath, const std::vector<uint8_t> destEncryptKey) | Backs up the current database file.
- **databasePath**: name or path of the backup file to generate.
- **destEncryptKey**: key used to encrypt the RDB store. Currently, only non-encrypted RDB stores can be backed up. | + +- Restoring an RDB store + + Call **int Restore()** to restore an RDB from the backup file. **backupPath** specifies the name or path of the backup file. If the restore is successful, **0** is returned; otherwise, an error code is returned. + + Table 15 API for restoring an RDB store + + | Class| API| Description| + | ---- | ---- | ---- | + | RdbStore | int Restore(const std::string backupPath, const std::vector<uint8_t> &newKey) | Restore an RDB store.
- **backupPath**: name or path of the backup file.
- **newKey**: key used to encrypt the RDB store. Currently, only non-encrypted RDB stores can be restored. | ## Constraints @@ -237,7 +257,7 @@ None. 4. Set the distributed tables to be synchronized. - Call the **SetDistributedTables()** method to set the distributed tables to be synchronized. + a. Call the **SetDistributedTables()** method to set the distributed tables to be synchronized. The sample code is as follows: @@ -307,3 +327,17 @@ None. std::string tableName = store->ObtainDistributedTableName("123456789abcd", "test"); auto resultSet = store->QuerySql("SELECT * from ?;", tableName); ``` + +8. Back up and restore an RDB store. + + a. Back up the current RDB store. + + b. Restore the RDB store from the specified backup file. + + The sample code is as follows: + ``` + std::string backupName = "backup.db"; // Name of the database backup file to generate. + std::vector key; // Key used to encrypt the RDB store. + int errno = store->Backup(backupName, key); + errno = store->Restore(backupName, key); + ``` diff --git a/en/device-dev/subsystems/subsys-data-storage-guide.md b/en/device-dev/subsystems/subsys-data-storage-guide.md index b04c82592a0266a05103a60be2752fa4c4530930..2d577a2ffff46d6ba6b4b40da81fb6f4ae606d58 100644 --- a/en/device-dev/subsystems/subsys-data-storage-guide.md +++ b/en/device-dev/subsystems/subsys-data-storage-guide.md @@ -16,7 +16,7 @@ Create a **Preferences** instance for data operations. A **Preferences** instanc | Class| Method| Description| | --- | ----- | ----| -| PreferencesHelper | static std::shared_ptr GetPreferences(const std::string &path, int &errCode); | Creates a **Preferences** instance.
**path**: storage path of the application data.
**errCode**: error code.
Return value: **Preferences** instance created.| +| PreferencesHelper | static std::shared_ptr GetPreferences(const std::string &path, int &errCode); | Creates a **Preferences** instance.
**path**: storage path of the application data.
**errCode**: error code.
Return value: **Preferences** instance created.| **Writing Data** @@ -26,13 +26,13 @@ Call the **put()** method to add or modify data in a **Preferences** instance. | Class| Method| Description| | --- | ----- | ----| -| Preferences | int PutInt(const std::string &key, int value); | **key**: key of the data to write. It cannot be empty.
**value**: value of the data to write.
Return value: error code.| -| Preferences | int PutString(const std::string &key, const std::string &value); | **key**: key of the data to write. It cannot be empty.
**value**: value of the data to write.
Return value: error code.| -| Preferences | int PutBool(const std::string &key, bool value); | **key**: key of the data to write. It cannot be empty.
**value**: value of the data to write.
Return value: error code.| -| Preferences | int PutLong(const std::string &key, int64_t value); | **key**: key of the data to write. It cannot be empty.
**value**: value of the data to write.
Return value: error code.| -| Preferences | int PutFloat(const std::string &key, float value); | **key**: key of the data to write. It cannot be empty.
**value**: value of the data to write.
Return value: error code.| -| Preferences | int PutDouble(const std::string &key, double value); | **key**: key of the data to write. It cannot be empty.
**value**: value of the data to write.
Return value: error code.| -| Preferences | int PutStringSet(const std::string &key, const std::set\ &value); | **key**: key of the data to write. It cannot be empty.
**value**: value of the data to write.
Return value: error code.| +| Preferences | int PutInt(const std::string &key, int value); | **key**: key of the data to write. It cannot be empty.
**value**: value of the data to write.
Return value: Returns **0** if the operation is successful; returns the error code otherwise.| +| Preferences | int PutString(const std::string &key, const std::string &value); | **key**: key of the data to write. It cannot be empty.
**value**: value of the data to write.
Return value: Returns **0** if the operation is successful; returns the error code otherwise.| +| Preferences | int PutBool(const std::string &key, bool value); | **key**: key of the data to write. It cannot be empty.
**value**: value of the data to write.
Return value: Returns **0** if the operation is successful; returns the error code otherwise.| +| Preferences | int PutLong(const std::string &key, int64_t value); | **key**: key of the data to write. It cannot be empty.
**value**: value of the data to write.
Return value: Returns **0** if the operation is successful; returns the error code otherwise.| +| Preferences | int PutFloat(const std::string &key, float value); | **key**: key of the data to write. It cannot be empty.
**value**: value of the data to write.
Return value: Returns **0** if the operation is successful; returns the error code otherwise.| +| Preferences | int PutDouble(const std::string &key, double value); | **key**: key of the data to write. It cannot be empty.
**value**: value of the data to write.
Return value: Returns **0** if the operation is successful; returns the error code otherwise.| +| Preferences | int PutStringSet(const std::string &key, const std::set\ &value); | **key**: key of the data to write. It cannot be empty.
**value**: value of the data to write.
Return value: Returns **0** if the operation is successful; returns the error code otherwise.| **Reading Data** @@ -42,17 +42,17 @@ Call the **get()** method to read data from a **Preferences** instance. | Class| Method| Description| | --- | ----- | ----| -| Preferences | bool GetBool(const std::string &key, bool defValue); | **key**: key of the data to read. It cannot be empty.
**defValue**: default value to return if the operation fails or the value does not exist.
Return value: Returns the value read if the operation is successful; returns **defValue** otherwise.| -| Preferences | std::string GetString(const std::string &key, const std::string &defValue); | **key**: key of the data to read. It cannot be empty.
**defValue**: default value to return if the operation fails or the value does not exist.
Return value: Returns the value read if the operation is successful; returns **defValue** otherwise.| -| Preferences | bool GetBool(const std::string &key, bool defValue); | **key**: key of the data to read. It cannot be empty.
**defValue**: default value to return if the operation fails or the value does not exist.
Return value: Returns the value read if the operation is successful; returns **defValue** otherwise.| -| Preferences | float GetFloat(const std::string &key, float defValue); | **key**: key of the data to read. It cannot be empty.
**defValue**: default value to return if the operation fails or the value does not exist.
Return value: Returns the value read if the operation is successful; returns **defValue** otherwise.| -| Preferences | double GetDouble(const std::string &key, double defValue); | **key**: key of the data to read. It cannot be empty.
**defValue**: default value to return if the operation fails or the value does not exist.
Return value: Returns the value read if the operation is successful; returns **defValue** otherwise.| -| Preferences | int64_t GetLong(const std::string &key, int64_t defValue); | **key**: key of the data to read. It cannot be empty.
**defValue**: default value to return if the operation fails or the value does not exist.
Return value: Returns the value read if the operation is successful; returns **defValue** otherwise.| -| Preferences | std::set\ GetStringSet(const std::string &key, std::set\ &defValue); | **key**: key of the data to read. It cannot be empty.
**defValue**: default value to return if the operation fails or the value does not exist.
Return value: Returns the value read if the operation is successful; returns **defValue** otherwise.| +| Preferences | int GetInt(const std::string &key, const int defValue = 0); | **key**: key of the data to read. It cannot be empty.
**defValue**: default value to return if the operation fails or the value does not exist.
Return value: value obtained.| +| Preferences | std::string GetString(const std::string &key, const std::string &defValue = {}); | **key**: key of the data to read. It cannot be empty.
**defValue**: default value to return if the operation fails or the value does not exist.
Return value: value obtained.| +| Preferences | bool GetBool(const std::string &key, const bool defValue = false); | **key**: key of the data to read. It cannot be empty.
**defValue**: default value to return if the operation fails or the value does not exist.
Return value: value obtained.| +| Preferences | float GetFloat(const std::string &key, const float defValue = 0); | **key**: key of the data to read. It cannot be empty.
**defValue**: default value to return if the operation fails or the value does not exist.
Return value: value obtained.| +| Preferences | double GetDouble(const std::string &key, const double defValue = 0); | **key**: key of the data to read. It cannot be empty.
**defValue**: default value to return if the operation fails or the value does not exist.
Return value: value obtained.| +| Preferences | int64_t GetLong(const std::string &key, const int64_t defValue = 0); | **key**: key of the data to read. It cannot be empty.
**defValue**: default value to return if the operation fails or the value does not exist.
Return value: value obtained.| +| Preferences | std::set\ GetStringSet(const std::string &key, const std::set\ &defValue = {}); | **key**: key of the data to read. It cannot be empty.
**defValue**: default value to return if the operation fails or the value does not exist.
Return value: value obtained.| **Storing Data Persistently** -Call the **flush()** or **flushSync** method to write the cached data back to its text file for persistent storage. +Call the **Flush()** or **FlushSync()** method to write the cached data back to its text file for persistent storage. **Table 4** APIs for data persistence @@ -65,12 +65,12 @@ Call the **flush()** or **flushSync** method to write the cached data back to it Specify **PreferencesObserver** as the callback to subscribe to data changes. When the value of the subscribed key is changed and the **flush()** method is executed, **PreferencesObserver** will be invoked. -**Table 5** APIs for subscribing to data changes +**Table 5** APIs for observing data changes | Class| Method| Description| | --- | ----- | ----| -| Preferences | void RegisterObserver(std::shared_ptr preferencesObserver); | Subscribes to data changes.
**preferencesObserver**: callback invoked to return the data changes.| -| Preferences | void UnRegisterObserver(std::shared_ptr preferencesObserver); | Unsubscribes from data changes.
**preferencesObserver**: callback used to report data changes.| +| Preferences | void RegisterObserver(std::shared_ptr preferencesObserver); | Subscribes to data changes.
**preferencesObserver**: callback invoked to return the data changes.| +| Preferences | void UnRegisterObserver(std::shared_ptr preferencesObserver); | Unsubscribes from data changes.
**preferencesObserver**: callback used to report data changes.| **Deleting Data** @@ -80,8 +80,8 @@ Use the following APIs to delete a **Preferences** instance or data file. | Class| Method| Description| | --- | ----- | ----| -| PreferencesHelper | int DeletePreferences(const std::string &path); | Deletes a **Preferences** instance from the memory and deletes its file from the device.
**path**: storage path of the application data.
Return value: error code.| -| PreferencesHelper | int RemovePreferencesFromCache(const std::string &path); | Deletes a **Preferences** instance from the memory.
**path**: storage path of the application data.
Return value: error code.| +| PreferencesHelper | int DeletePreferences(const std::string &path); | Deletes a **Preferences** instance from the memory and deletes its file from the device.
**path**: storage path of the application data.
Return value: Returns **0** if the operation is successful; returns the error code otherwise.| +| PreferencesHelper | int RemovePreferencesFromCache(const std::string &path); | Deletes a **Preferences** instance from the memory.
**path**: storage path of the application data.
Return value: Returns **0** if the operation is successful; returns the error code otherwise.| ## How to Develop @@ -122,14 +122,13 @@ Use the following APIs to delete a **Preferences** instance or data file. 5. Store data persistently. - Use the **flush()** or **flushSync()** method to flush data in the **Preferences** instance to its file. + Use the **Flush()** or **FlushSync()** method to flush data in the **Preferences** instance to its file. ```C++ int err = pref->FlushSync(); EXPECT_EQ(ret, E_OK); ``` - 6. Subscribe to data changes. Specify **PreferencesObserver** as the callback to subscribe to data changes for an application. When the value of the subscribed key is changed and the **flush()** or **flushSync()** method is executed, **PreferencesObserver** will be invoked. Unregister the **PreferencesObserver** when it is no longer required. @@ -144,7 +143,7 @@ Use the following APIs to delete a **Preferences** instance or data file. std::atomic_int notifyTimes; static const std::vector NOTIFY_KEYS_VECTOR; }; - + PreferencesObserverCounter::~PreferencesObserverCounter() {} void PreferencesObserverCounter::OnChange(Preferences &preferences, const std::string &key) @@ -156,7 +155,7 @@ Use the following APIs to delete a **Preferences** instance or data file. } } } - + const std::vector PreferencesObserverCounter::NOTIFY_KEYS_VECTOR = { PreferencesTest::KEY_TEST_INT_ELEMENT, PreferencesTest::KEY_TEST_LONG_ELEMENT, PreferencesTest::KEY_TEST_FLOAT_ELEMENT, PreferencesTest::KEY_TEST_BOOL_ELEMENT, PreferencesTest::KEY_TEST_STRING_ELEMENT }; @@ -167,17 +166,17 @@ Use the following APIs to delete a **Preferences** instance or data file. std::shared_ptr counter = std::make_shared(); pref->RegisterObserver(counter); // Register a callback to return data changes. - + pref->PutString(PreferencesTest::KEY_TEST_STRING_ELEMENT, "test"); pref->Flush(); // Trigger the onChanged callback of the counter. EXPECT_EQ(static_cast(counter.get())->notifyTimes, 1); - + /* same value */ pref->PutInt(PreferencesTest::KEY_TEST_INT_ELEMENT, 2); pref->PutString(PreferencesTest::KEY_TEST_STRING_ELEMENT, "test"); pref->Flush(); EXPECT_EQ(static_cast(counter.get())->notifyTimes, 2); - + pref->UnRegisterObserver(counter); // Unregister the callback for data changes. ``` diff --git a/en/device-dev/subsystems/subsys-tel-guide.md b/en/device-dev/subsystems/subsys-tel-guide.md index 889f2b8c452ef67da653750c2806c71f4ecfc2dd..62142ff914cb16d6ab9a9728727838d6b2b0ccf9 100644 --- a/en/device-dev/subsystems/subsys-tel-guide.md +++ b/en/device-dev/subsystems/subsys-tel-guide.md @@ -107,7 +107,7 @@ The following table describes the API for initializing a modem vendor library. ### Debugging and Verification -1. Use the [hdc\_std](https://gitee.com/openharmony/docs/blob/master/en/device-dev/subsystems/subsys-toolchain-hdc-guide.md#preparations) tool to connect to a debugging device. Then, run the following command to send the generated **libril\_vendor.z.so** library file to the **/system/lib/** directory of the device. For details about how to integrate a library file, see [Integrating Modem Vendor Libraries](#section590mcpsimp). +1. Use the [hdc\_std](../subsystems/subsys-toolchain-hdc-guide.md#preparations) tool to connect to a debugging device. Then, run the following command to send the generated **libril\_vendor.z.so** library file to the **/system/lib/** directory of the device. For details about how to integrate a library file, see [Integrating Modem Vendor Libraries](#section590mcpsimp). ``` hdc_std file send libril_vendor.z.so /system/lib/ @@ -202,7 +202,7 @@ The following table describes the APIs for responding to modem service requests, ### Debugging and Verification -1. Use the [hdc\_std](https://gitee.com/openharmony/docs/blob/master/en/device-dev/subsystems/subsys-toolchain-hdc-guide.md#preparations) tool to connect to a debugging device. Then, run the following command to send the generated **libril\_vendor.z.so** library file to the **/system/lib/** directory of the device. +1. Use the [hdc\_std](../subsystems/subsys-toolchain-hdc-guide.md#preparations) tool to connect to a debugging device. Then, run the following command to send the generated **libril\_vendor.z.so** library file to the **/system/lib/** directory of the device. ``` hdc_std file send libril_vendor.z.so /system/lib/ @@ -326,7 +326,7 @@ The following table describes the API for reporting modem events. ### Debugging and Verification -1. Use the [hdc\_std](https://gitee.com/openharmony/docs/blob/master/en/device-dev/subsystems/subsys-toolchain-hdc-guide.md#preparations) tool to connect to a debugging device. Then, run the following command to send the generated **libril\_vendor.z.so** library file to the **/system/lib/** directory of the device. +1. Use the [hdc\_std](../subsystems/subsys-toolchain-hdc-guide.md#preparations) tool to connect to a debugging device. Then, run the following command to send the generated **libril\_vendor.z.so** library file to the **/system/lib/** directory of the device. ``` hdc_std file send libril_vendor.z.so /system/lib/ diff --git a/en/readme/figures/User-IAM-subsystem-architecture.png b/en/readme/figures/User-IAM-subsystem-architecture.png index 13a861f97107524e38ed06f1e3d153cdc7d55fe2..64eaba85160ef22e68b0ebb53ab7e7862d881cec 100644 Binary files a/en/readme/figures/User-IAM-subsystem-architecture.png and b/en/readme/figures/User-IAM-subsystem-architecture.png differ diff --git a/en/readme/kernel.md b/en/readme/kernel.md index 03395200e5d1873463fb231e8f65b2a0bf5c0f7c..470d4cf0be35257de3fc0c17184b509fdc783898 100644 --- a/en/readme/kernel.md +++ b/en/readme/kernel.md @@ -64,18 +64,23 @@ kernel/ │ ├── linux-4.19 # OpenHarmony linux-4.19 common kernel │ ├── linux-5.10 # OpenHarmony linux-5.10 common kernel │ ├── build -│ │ ├── BUILD.gn # GN file of the build framework +│ │ ├── BUILD.gn # GN file of the build framework │ │ ├── kernel.mk # Kernel build file │ │ └── ohos.build # Kernel build component file │ ├── patches │ │ ├── linux-4.19 # linux-4.19 patches +│ │ │   ├── common_patch +│ │ │   │ └── hdf.patch # linux-4.19 HDF patches │ │ │   └── hi3516dv300_patch -│ │ │   ├── hi3516dv300.patch # linux-4.19 Hi3516D V300 SOC patches -│ │ │   └── hdf.patch # linux-4.19 Hi3516D V300 HDF patches +│ │ │   └── hi3516dv300.patch # linux-4.19 Hi3516D V300 SOC patches │ │ └── linux-5.10 +│ │    ├── common_patch +│ │    │ └── hdf.patch # linux-5.10 HDF patches │ │    └── hi3516dv300_patch -│ │    ├── hi3516dv300.patch # linux-5.10 Hi3516D V300 SOC patches -│ │    └── hdf.patch # linux-5.10 Hi3516D V300 HDF patches +│ │    │ └── hi3516dv300.patch # linux-5.10 Hi3516D V300 SOC patches +│ │    └── rkrk3568_patch +│ │    ├── kernel.patch # linux-5.10 rk3568 SOC patches +│ │    └── hdf.patch # linux-5.10 rk3568 customized HDF patches │ └── config │ ├── linux-4.19 │ │   └── arch @@ -151,7 +156,7 @@ For details, see "Usage" in LiteOS-A Kernel [README](https://gitee.com/openharmo Apply the HDF kernel patches matching your kernel version. For details, see the method in **kernel.mk** in the **kernel/linux/build** repository. ``` - $(OHOS_BUILD_HOME)/drivers/adapter/khdf/linux/patch_hdf.sh $(OHOS_BUILD_HOME) $(KERNEL_SRC_TMP_PATH) $(HDF_PATCH_FILE) + $(OHOS_BUILD_HOME)/drivers/hdf_core/adapter/khdf/linux/patch_hdf.sh $(OHOS_BUILD_HOME) $(KERNEL_SRC_TMP_PATH) $(KERNEL_PATCH_PATH) $(DEVICE_NAME) ``` 2. Apply the chip driver patches. diff --git a/en/readme/test.md b/en/readme/test.md index 8fdcf98946d204e687b56526ba7cab409e80f4db..25cdba18c6642ffe1789ce8b6f03efc0ffdd780b 100644 --- a/en/readme/test.md +++ b/en/readme/test.md @@ -1,4 +1,4 @@ -# Test +# Test OpenHarmony provides a comprehensive auto-test framework for designing test cases. Detecting defects in the development process can improve code quality. This document describes how to use the OpenHarmony test framework. @@ -46,19 +46,19 @@ subsystem # Subsystem │ │ ├── moduletest # Module test │ │ ... │ │ -│ ├── moduleB # Module B +│ ├── moduleB # Module B │ ├── test │ │ └── resource # Dependency resources │ │ ├── moduleA # Module A │ │ │ ├── ohos_test.xml # Resource configuration file -│ │ ... └── 1.txt # Resources +│ │ ... └── 1.txt # Resource file │ │ -│ ├── ohos_build # Build entry configuration +│ ├── ohos_build # Build entry configuration │ ... │ ... ``` -> **NOTE:** Test cases are classified into common test cases and device-specific test cases. You are advised to place common test cases in the **common** directory and device-specific test cases in the directories of the related devices. +> **NOTE**
Test cases are classified into common test cases and device-specific test cases. You are advised to place common test cases in the **common** directory and device-specific test cases in the directories of the related devices. ### Writing Test Cases This test framework supports test cases written in multiple programming languages and provides different templates for different languages. @@ -119,7 +119,7 @@ Example: { // Step 1 Call the function to obtain the result. int actual = Sub(4, 0); - + // Step 2 Use an assertion to compare the obtained result with the expected result. EXPECT_EQ(4, actual); } @@ -132,7 +132,7 @@ Example: 2. Add the test framework header file and namespace. ``` #include - + using namespace testing::ext; ``` 3. Add the header file of the test class. @@ -148,28 +148,28 @@ Example: void SetUp(); void TearDown(); }; - + void CalculatorSubTest::SetUpTestCase(void) { // Set a setup function, which will be called before all test cases. } - + void CalculatorSubTest::TearDownTestCase(void) { // Set a teardown function, which will be called after all test cases. } - + void CalculatorSubTest::SetUp(void) { // Set a setup function, which will be called before each test case. } - + void CalculatorSubTest::TearDown(void) { // Set a teardown function, which will be called after each test case. } ``` - > **NOTE**: When defining a test suite, ensure that the test suite name is the same as the target to build and uses the upper camel case style. + > **NOTE**
When defining a test suite, ensure that the test suite name is the same as the target to build and uses the upper camel case style. 5. Add implementation of the test cases, including test case comments and logic. ``` @@ -183,7 +183,7 @@ Example: { // Step 1 Call the function to obtain the test result. int actual = Sub(4, 0); - + // Step 2 Use an assertion to compare the obtained result with the expected result. EXPECT_EQ(4, actual); } @@ -201,7 +201,7 @@ Example: - *B* indicates the test case name, which is in the *Function*\_*No.* format. The *No.* is a three-digit number starting from **001**. - *C* indicates the test case level. There are five test case levels: guard-control level 0 and non-guard-control level 1 to level 4. Of levels 1 to 4, a smaller value indicates a more important function verified by the test case. - **NOTE**: + **NOTE**
- The expected result of each test case must have an assertion. - The test case level must be specified. - It is recommended that the test be implemented step by step according to the template. @@ -262,7 +262,7 @@ Example: it("appInfoTest001", 0, function () { // Step 1 Call the function to obtain the test result. var info = app.getInfo() - + // Step 2 Use an assertion to compare the obtained result with the expected result. expect(info != null).assertEqual(true) }) @@ -276,7 +276,7 @@ Example: 2. Import the APIs and JSUnit test library to test. ``` import app from '@system.app' - + import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' ``` 3. Define the test suite (test class). @@ -313,7 +313,7 @@ Example: it("appInfoTest001", 0, function () { // Step 1 Call the function to obtain the test result. var info = app.getInfo() - + // Step 2 Use an assertion to compare the obtained result with the expected result. expect(info != null).assertEqual(true) }) @@ -372,7 +372,7 @@ The following provides templates for different languages for your reference. ``` module_output_path = "subsystem_examples/calculator" ``` - > **NOTE**: The output path is ***Part name*/*Module name***. + > **NOTE**
The output path is ***Part name*/*Module name***. 4. Configure the directories for dependencies. @@ -383,7 +383,7 @@ The following provides templates for different languages for your reference. include_dirs = [ "../../../include" ] } ``` - > **NOTE**: Generally, the dependency directories are configured here and directly referenced in the build script of the test case. + > **NOTE**
Generally, the dependency directories are configured here and directly referenced in the build script of the test case. 5. Set the output build file for the test cases. @@ -406,15 +406,16 @@ The following provides templates for different languages for your reference. } ``` - > **NOTE:** Set the test type based on actual requirements. The following test types are available: - > - **ohos_unittest**: unit test - > - **ohos_moduletest**: module test - > - **ohos_systemtest**: system test - > - **ohos_performancetest**: performance test - > - **ohos_securitytest**: security test - > - **ohos_reliabilitytest**: reliability test - > - **ohos_distributedtest**: distributed test - + > **NOTE**
Set the test type based on actual requirements. The following test types are available: + > + > - **ohos_unittest**: unit test + > - **ohos_moduletest**: module test + > - **ohos_systemtest**: system test + > - **ohos_performancetest**: performance test + > - **ohos_securitytest**: security test + > - **ohos_reliabilitytest**: reliability test + > - **ohos_distributedtest**: distributed test + 7. Group the test case files by test type. ``` @@ -423,7 +424,7 @@ The following provides templates for different languages for your reference. deps = [":CalculatorSubTest"] } ``` - > **NOTE**: Grouping test cases by test type allows you to execute a specific type of test cases when required. + > **NOTE**
Grouping test cases by test type allows you to execute a specific type of test cases when required. - **Test case build file example (JavaScript)** @@ -462,7 +463,7 @@ The following provides templates for different languages for your reference. ``` module_output_path = "subsystem_examples/app_info" ``` - > **NOTE**: The output path is ***Part name*/*Module name***. + > **NOTE**
The output path is ***Part name*/*Module name***. 4. Set the output build file for the test cases. @@ -470,7 +471,7 @@ The following provides templates for different languages for your reference. ohos_js_unittest("GetAppInfoJsTest") { } ``` - > **NOTE**
+ > **NOTE**
>- Use the **ohos\_js\_unittest** template to define the JavaScript test suite. Pay attention to the difference between JavaScript and C++. >- The file generated for the JavaScript test suite must be in .hap format and named after the test suite name defined here. The test suite name must end with **JsTest**. @@ -496,8 +497,8 @@ The following provides templates for different languages for your reference. "name": "1.0" }, "apiVersion": { - "compatible": 4, - "target": 5 // Set it based on the tested SDK version. In this example, SDK5 is used. + "compatible": 4, + "target": 5 // Set it based on the tested SDK version. In this example, SDK5 is used. } }, "deviceConfig": {}, @@ -554,7 +555,7 @@ The following provides templates for different languages for your reference. deps = [ ":GetAppInfoJsTest" ] } ``` - > **NOTE**: Grouping test cases by test type allows you to execute a specific type of test cases when required. + > **NOTE**
Grouping test cases by test type allows you to execute a specific type of test cases when required. #### Configuring ohos.build @@ -575,7 +576,7 @@ Configure the part build file to associate with specific test cases. ] } ``` -> **NOTE**: **test_list** contains the test cases of the corresponding module. +> **NOTE**
**test_list** contains the test cases of the corresponding module. ### Configuring Test Case Resources Test case resources include external file resources, such as image files, video files, and third-party libraries, required for test case execution. @@ -656,7 +657,7 @@ Before executing test cases, you need to modify the configuration based on the d ``` ->**NOTE**: If HDC is connected to the device before the test cases are executed, you only need to configure the device IP address and port number, and retain the default settings for other parameters. +>**NOTE**
If HDC is connected to the device before the test cases are executed, you only need to configure the device IP address and port number, and retain the default settings for other parameters. ### Executing Test Cases on Windows #### Building Test Cases @@ -667,7 +668,7 @@ Test cases cannot be built on Windows. You need to run the following command to ``` When the build is complete, the test cases are automatically saved in **out/hispark_taurus/packages/phone/images/tests**. ->**NOTE:** In the command, **hispark_taurus_standard** is the product supported by the current version, and **make_test** indicates all test cases. You can set the build options based on requirements: +>**NOTE**
In the command, **hispark_taurus_standard** indicates the product supported by the current version, and **make_test** indicates all test cases. You can set the build options based on requirements:
> - --**product-name**: specifies the name of the product to build. It is mandatory. > - --**build-target**: specifies the target to build. It is optional. @@ -676,7 +677,7 @@ When the build is complete, the test cases are automatically saved in **out/hisp 2. Copy **developertest** and **xdevice** from the Linux environment to the **Test** directory on Windows, and copy the test cases to the **testcase** directory. ->**NOTE**: Port the test framework and test cases from the Linux environment to the Windows environment for subsequent execution. +>**NOTE**
Port the test framework and test cases from the Linux environment to the Windows environment for subsequent execution. 3. Modify the **user_config.xml** file. ``` @@ -689,7 +690,7 @@ When the build is complete, the test cases are automatically saved in **out/hisp D:\Test\testcase\tests ``` - >**NOTE**: `` indicates whether to build test cases. `` indicates the path for searching for test cases. + >**NOTE**
`` indicates whether to build test cases. `` indicates the path for searching for test cases. #### Executing Test Cases 1. Start the test framework. @@ -698,7 +699,7 @@ When the build is complete, the test cases are automatically saved in **out/hisp ``` 2. Select the product. - After the test framework starts, you are asked to select a product. Select the development board to test, for example, **hispark_taurus_standard**. + After the test framework starts, you are asked to select a product. Select the development board to test, for example, **Hi3516DV300**. 3. Execute test cases. @@ -723,13 +724,13 @@ To enable test cases to be executed on a remote Linux server or a Linux VM, map hdc_std kill hdc_std -m -s 0.0.0.0:8710 ``` - >**NOTE**: The IP address and port number are default values. + >**NOTE**
The IP address and port number are default values. 2. On the HDC client, run the following command: ``` hdc_std -s xx.xx.xx.xx:8710 list targets ``` - >**NOTE**: Enter the IP address of the device to test. + >**NOTE**
Enter the IP address of the device to test. #### Executing Test Cases 1. Start the test framework. @@ -738,7 +739,7 @@ To enable test cases to be executed on a remote Linux server or a Linux VM, map ``` 2. Select the product. - After the test framework starts, you are asked to select a product. Select the development board to test, for example, **hispark_taurus_standard**. + After the test framework starts, you are asked to select a product. Select the development board to test, for example, **Hi3516DV300**. 3. Execute test cases. @@ -764,7 +765,7 @@ You can obtain the test result in the following directory: ``` test/developertest/reports/xxxx_xx_xx_xx_xx_xx ``` ->**NOTE**: The folder for test reports is automatically generated. +>**NOTE**
The folder for test reports is automatically generated. The folder contains the following files: | Type| Description| diff --git a/en/readme/user-iam.md b/en/readme/user-iam.md index 52aba67d9048692ead51f3141090abaeb878ab43..0bd5165ee68e3351cedc0753cdb9523550295193 100644 --- a/en/readme/user-iam.md +++ b/en/readme/user-iam.md @@ -16,14 +16,16 @@ The user IAM subsystem consists of the unified user authentication framework and Based on the unified user authentication framework, the system can be extended to support multiple authentication capabilities. Currently, the authentication executors supported by OpenHarmony are password and facial authentication. To implement a new authentication executor, you only need to implement authentication capabilities in a new part and connect the new part to the unified user authentication framework based on the interfaces defined by the authentication executor management part. -*Note: In the user IAM subsystem, an authentication executor is the minimum execution unit of a user identity authentication operation. For example, a password authentication module is responsible for password collection, password processing and comparison, and secure storage, and therefore it can be abstracted as a password authentication executor.* +> **NOTE** +> +>In the user IAM subsystem, an authentication executor is the minimum execution unit of a user identity authentication operation. For example, a password authentication module is responsible for password collection, password processing and comparison, and secure storage, and therefore it can be abstracted as a password authentication executor. ## Directory Structure ```undefined //base/user_iam -├── user_auth_framework # User authentication framework, including user authentication, credential management and executor management +├── 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 ├── pin_auth # Password authentication module, which connects to the authentication executor management part and supports password recording, deletion, and verification @@ -31,15 +33,15 @@ Based on the unified user authentication framework, the system can be extended t ## Constraints -1. User credential management is a key operation in the system, and interfaces used for user credential management can be invoked only by basic system applications. -2. The authentication executors process user authentication credentials and their capabilities can only be implemented by system services for interconnection with the authentication executor management part. +- User credential management is a key operation in the system, and the interfaces used for user credential management can be invoked only by basic system applications. +- The authentication executors process user authentication credentials, and their capabilities can only be implemented by system services for interconnection with the authentication executor management part. ## Usage ### How to Use 1. The unified user authentication framework must work with an authentication executor. -2. The first default authentication executor in the system must be password authentication. +2. The first default authentication executor in the system must be a password authentication executor. ## Repositories Involved diff --git a/zh-cn/OpenHarmony-Overview_zh.md b/zh-cn/OpenHarmony-Overview_zh.md index e5b9c5e2bcd896e5ca464fc00139cc94f9474228..28ab0281465880dedc261b8c6a976162d2348f91 100644 --- a/zh-cn/OpenHarmony-Overview_zh.md +++ b/zh-cn/OpenHarmony-Overview_zh.md @@ -349,16 +349,13 @@ OpenHarmony支持如下几种系统类型: ## 支持的开发板 -当前OpenHarmony社区支持以下6款开发板,具体介绍如下: +当前OpenHarmony社区支持17款开发板,下表介绍3款(此处选择三种系统类型首款进入OpenHarmony主干的开发板),更多开发板信息,请参考[社区支持的开发板清单](device-dev/dev-board-on-the-master.md)。 -| 系统类型 | 开发板型号 | 芯片型号 | 主要能力 | 典型应用场景 | 开发板代码仓及社区每日构建版本获取地址 | +| 系统类型 | 开发板型号 | 芯片型号 | 主要能力及适配案例 | 典型应用场景 | 开发板代码仓及社区每日构建版本获取地址 | | -------- | -------- | -------- | -------- | -------- | -------- | -| 标准系统 | Hi3516DV300 | Hi3516DV300 | Hi3516DV300是新一代Smart HD IP摄像机SOC,集成新一代ISP(Image Signal Processor)、H.265视频压缩编码器、高性能NNIE引擎,在低码率、高画质、智能处理和分析、低功耗等方面有较好的性能。 | 可用在带屏设备上,比如带屏冰箱、车机等。 | 代码仓:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_hisilicon](https://gitee.com/openharmony/device_board_hisilicon)
[vendor_hisilicon](https://gitee.com/openharmony/vendor_hisilicon)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | -| 标准系统 | 润和DAYU200 | RK3568 | 润和HH-SCDAYU200是基于Rockchip RK3568,集成双核心架构GPU以及高效能NPU;板载四核64位Cortex-A55 处理器采用22nm先进工艺,主频高达2.0GHz;支持蓝牙、Wi-Fi、音频、视频和摄像头等功能,拥有丰富的扩展接口,支持多种视频输入输出接口;配置双千兆自适应RJ45以太网口,可满足NVR、工业网关等多网口产品需求。 | 影音娱乐、智慧出行、智能家居,如烟机、烤箱、跑步机等。 | 代码仓:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_hihope](https://gitee.com/openharmony/device_board_hihope)
[vendor_hihope](https://gitee.com/openharmony/vendor_hihope)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | -| 轻量 | 汇顶GR5515-STARTER-KIT | GR5515 | 支持Bluetooth 5.1的单模低功耗蓝牙SoC,多功能按键和LED指示灯。 | 智能硬件,如手表、手环、价格类标签。 | 代码仓:
[device_soc_goodix](https://gitee.com/openharmony/device_soc_goodix)
[device_board_goodix](https://gitee.com/openharmony/device_board_goodix)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | -| 轻量 | 朗国LANGO200 | ASR582X | LANGO200 IOT开发板,集成了高性能的WIFI-BLE双模芯片ASR5822、外部存储芯片、语音播放芯片以及模数转换等,同时支持SPI等IOT设备常用外设接口,可外扩OLED显示屏、红外遥控等。 | 智能家居连接类模组。 | 代码仓:
[device_soc_asrmicro](https://gitee.com/openharmony/device_soc_asrmicro)
[device_board_lango](https://gitee.com/openharmony/device_board_lango)
[vendor_asrmicro](https://gitee.com/openharmony/vendor_asrmicro)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | -| 轻量 | 欧智通V200ZR | BES2600 | Multi-modal V200Z-R开发板是基于恒玄科技BES2600WM芯片的一款高性能、多功能、高性价比AIoT SoC开发板Multi-modal V200Z-R开发板,单模组集成四核ARM处理器(最高主频1GHz),集成双频WiFi + 双模蓝牙,支持标准的802.11 a/b/g/n/协议,支持BT/BLE 5.2协议,内建多种容量的RAM(最大42MB)和Flash(最大32MB),支持MIPI DSI及CSI,适用于各种AIoT多模态VUI + GUI交互硬件场景。 | 智能硬件带屏类模组产品,如音箱、手表等。 | 代码仓:
[device_soc_bestechnic](https://gitee.com/openharmony/device_soc_bestechnic)
[device_board_fnlink](https://gitee.com/openharmony/device_board_fnlink)
[vendor_bestechnic](https://gitee.com/openharmony/vendor_bestechnic)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | -| 轻量 | 小熊派BearPi-HM Nano | Hi3861 | BearPi-HM_Nano开发板是一块专门为OpenHarmony设计的开发板,板载高度集成的2.4GHz WiFi SoC芯片Hi3861,并板载NFC电路及标准的E53接口,标准的E53接口可扩展智能加湿器、智能台灯、智能安防、智能烟感等案例。 | 智慧路灯、智慧物流、人体红外等连接类设备。 | 代码仓:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_bearpi](https://gitee.com/openharmony/device_board_bearpi)
[vendor_bearpi](https://gitee.com/openharmony/vendor_bearpi)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +| 标准系统 | 润和DAYU200 | RK3568 | 主要能力:
润和HH-SCDAYU200基于Rockchip RK3568,集成双核心架构GPU以及高效能NPU;板载四核64位Cortex-A55 处理器采用22nm先进工艺,主频高达2.0GHz;支持蓝牙、Wi-Fi、音频、视频和摄像头等功能,拥有丰富的扩展接口,支持多种视频输入输出接口;配置双千兆自适应RJ45以太网口,可满足NVR、工业网关等多网口产品需求。
适配案例:
[DAYU200适配案例](device-dev/porting/porting-dayu200-on_standard-demo.md) | 影音娱乐、智慧出行、智能家居,如烟机、烤箱、跑步机等。 | 代码仓:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_hihope](https://gitee.com/openharmony/device_board_hihope)
[vendor_hihope](https://gitee.com/openharmony/vendor_hihope)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +| 小型系统 | Hispark_Taurus | Hi3516DV300 | 主要能力:
Hi3516DV300是新一代Smart HD IP摄像机SOC,集成新一代ISP(Image Signal Processor)、H.265视频压缩编码器、高性能NNIE引擎,在低码率、高画质、智能处理和分析、低功耗等方面有较好的性能。 | 带屏智能硬件,比如带屏冰箱、车机等。 | 代码仓:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_hisilicon](https://gitee.com/openharmony/device_board_hisilicon)
[vendor_hisilicon](https://gitee.com/openharmony/vendor_hisilicon)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +| 轻量系统 | Multi-modal V200Z-R | BES2600 | 主要能力:
Multi-modal V200Z-R开发板是基于恒玄科技BES2600WM芯片的一款高性能、多功能、高性价比AIoT SoC开发板Multi-modal V200Z-R开发板,单模组集成四核ARM处理器(最高主频1GHz),集成双频WiFi + 双模蓝牙,支持标准的802.11 a/b/g/n/协议,支持BT/BLE 5.2协议,内建多种容量的RAM(最大42MB)和Flash(最大32MB),支持MIPI DSI及CSI,适用于各种AIoT多模态VUI + GUI交互硬件场景。
适配案例:
[Multi-modal V200Z-R适配案例](device-dev/porting/porting-bes2600w-on-minisystem-display-demo.md) | 智能硬件、带屏类模组产品,如音箱、手表等。 | 代码仓:
[device_soc_bestechnic](https://gitee.com/openharmony/device_soc_bestechnic)
[device_board_fnlink](https://gitee.com/openharmony/device_board_fnlink)
[vendor_bestechnic](https://gitee.com/openharmony/vendor_bestechnic)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | ## 快速入门 diff --git a/zh-cn/application-dev/Readme-CN.md b/zh-cn/application-dev/Readme-CN.md index f6edc6cc861e360a1f8a8ea92aadbccd255131a8..b509593dfe386972188d7477274081703ca253c3 100644 --- a/zh-cn/application-dev/Readme-CN.md +++ b/zh-cn/application-dev/Readme-CN.md @@ -34,6 +34,7 @@ - [设备使用信息统计](device-usage-statistics/Readme-CN.md) - [DFX](dfx/Readme-CN.md) - [国际化](internationalization/Readme-CN.md) + - [一次开发,多端部署](key-features/multi-device-app-dev/Readme-CN.md) - [IDL工具规格及使用说明书](IDL/idl-guidelines.md) - [Native API的相关指导](napi/Readme-CN.md) - 工具 diff --git a/zh-cn/application-dev/ability/ability-brief.md b/zh-cn/application-dev/ability/ability-brief.md index 548b3222b67a29d45dccaf472de44069d7b69fb8..3f8f7bce599193d6cce9d4a594d3188a380e4aed 100644 --- a/zh-cn/application-dev/ability/ability-brief.md +++ b/zh-cn/application-dev/ability/ability-brief.md @@ -31,4 +31,4 @@ Stage模型的设计,主要是为了开发者更加方便地开发出分布式 ## 相关实例 针对Ability开发,有以下相关实例可供参考: -- [Page内和Page间导航跳转](https://gitee.com/openharmony/codelabs/tree/master/Ability/PageAbility) \ No newline at end of file +- [Page内和Page间导航跳转(eTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/Ability/PageAbility) \ No newline at end of file diff --git a/zh-cn/application-dev/ability/fa-brief.md b/zh-cn/application-dev/ability/fa-brief.md index abf0fbccff62d597f714d5ae03c6b11674e665b5..6d658d0655c9c33b58d9f096aebc8e038b97cf28 100644 --- a/zh-cn/application-dev/ability/fa-brief.md +++ b/zh-cn/application-dev/ability/fa-brief.md @@ -32,11 +32,11 @@ Ability框架在API 8及更早版本使用FA模型。FA模型中Ability分为Pag - [`DistributeCalc`:分布式计算器(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/Preset/DistributeCalc) - [`DistributeGraffiti`:分布式涂鸦(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/ability/DistributedGraffiti) -- [分布式调度启动远程FA](https://gitee.com/openharmony/codelabs/tree/master/Distributed/RemoteStartFA) -- [分布式新闻客户端](https://gitee.com/openharmony/codelabs/tree/master/Distributed/NewsDemo) -- [分布式手写板(eTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/DistributeDatabaseDrawEts) -- [分布式鉴权(JS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/GameAuthOpenH) -- [分布式游戏手柄(eTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/HandleGameApplication) -- [分布式邮件(eTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/OHMailETS) -- [分布式亲子早教系统(eTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/OpenHarmonyPictureGame) -- [分布式遥控器(eTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/RemoteControllerETS) \ No newline at end of file +- [分布式调度启动远程FA(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/RemoteStartFA) +- [分布式新闻客户端(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/NewsDemo) +- [分布式手写板(eTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/DistributeDatabaseDrawEts) +- [分布式鉴权(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/GameAuthOpenH) +- [分布式游戏手柄(eTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/HandleGameApplication) +- [分布式邮件(eTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/OHMailETS) +- [分布式亲子早教系统(eTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/OpenHarmonyPictureGame) +- [分布式遥控器(eTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/RemoteControllerETS) \ No newline at end of file diff --git a/zh-cn/application-dev/ability/fa-dataability.md b/zh-cn/application-dev/ability/fa-dataability.md index 67dcdd8c71aeaff992259ea64c844249540bcb19..5ec1135c9c9eb5c7578b8441facb2b9831a7c022 100644 --- a/zh-cn/application-dev/ability/fa-dataability.md +++ b/zh-cn/application-dev/ability/fa-dataability.md @@ -1,12 +1,14 @@ # DataAbility开发指导 + ## 场景介绍 + 基于Data模板的Ability(以下简称“Data”),有助于应用管理其自身和其他应用存储数据的访问,并提供与其他应用共享数据的方法。Data既可用于同设备不同应用的数据共享,也支持跨设备不同应用的数据共享。 Data提供方可以自定义数据的增、删、改、查,以及文件打开等功能,并对外提供这些接口。 ## URI介绍 -Data的提供方和使用方都通过URI(Uniform Resource Identifier)来标识一个具体的数据,例如数据库中的某个表或磁盘上的某个文件。HarmonyOS的URI仍基于URI通用标准,格式如下: +Data的提供方和使用方都通过URI(Uniform Resource Identifier)来标识一个具体的数据,例如数据库中的某个表或磁盘上的某个文件。OpenHarmony的URI仍基于URI通用标准,格式如下: ![fa-dataability-uri](figures/fa-dataability-uri.png) @@ -21,10 +23,9 @@ URI示例: - 跨设备场景:dataability://*device_id*/*com.domainname.dataability.persondata*/*person*/*10* - 本地设备:dataability:///*com.domainname.dataability.persondata*/*person*/*10* -``` -说明 -本地设备的“device_id”字段为空,因此在“dataability:”后面有三个“/”。 -``` +> 说明 +> +> 本地设备的“device_id”字段为空,因此在“dataability:”后面有三个“/”。 ## 接口说明 diff --git a/zh-cn/application-dev/ability/stage-brief.md b/zh-cn/application-dev/ability/stage-brief.md index c1c6407128123a5ad0d06615919de171e5ddc42b..9099e1e557bbd9abd7f3a8fae0eee7de15764a49 100644 --- a/zh-cn/application-dev/ability/stage-brief.md +++ b/zh-cn/application-dev/ability/stage-brief.md @@ -95,3 +95,6 @@ 下图展示了应用的进程模型。 ![stageprocessmodel](figures/stageprocessmodel.png) +## 相关实例 +针对Stage模型下的Ability开发,有以下相关实例可供参考: +- [`MissionManager`:系统任务管理(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/ability/MissionManager) diff --git a/zh-cn/application-dev/ability/stage-call.md b/zh-cn/application-dev/ability/stage-call.md index 1cec47b60933e75be2f0a141e862a92a4d7f7ebf..e8126fa0d7b92f82c9a35d2b92fe3d5017f9ca4d 100644 --- a/zh-cn/application-dev/ability/stage-call.md +++ b/zh-cn/application-dev/ability/stage-call.md @@ -19,7 +19,7 @@ Caller及Callee功能如下:具体的API详见[接口文档](../reference/apis |接口名|描述| |:------|:------| |startAbilityByCall(want: Want): Promise\|获取指定通用组件的Caller通信接口,拉起指定通用组件并将其切换到后台。| -|on(method: string, callback: CaleeCallBack): void|通用组件Callee注册method对应的callback方法。| +|on(method: string, callback: CalleeCallBack): void|通用组件Callee注册method对应的callback方法。| |off(method: string): void|通用组件Callee去注册method的callback方法。| |call(method: string, data: rpc.Sequenceable): Promise\|向通用组件Callee发送约定序列化数据。| |callWithResult(method: string, data: rpc.Sequenceable): Promise\|向通用组件Callee发送约定序列化数据, 并将返回的约定序列化数据带回。| diff --git a/zh-cn/application-dev/connectivity/http-request.md b/zh-cn/application-dev/connectivity/http-request.md index 90b3bb9829236ee4d07acccc23fff6f714034092..d71280393c8c3afc28b8d81bd26f11f7e84af841 100644 --- a/zh-cn/application-dev/connectivity/http-request.md +++ b/zh-cn/application-dev/connectivity/http-request.md @@ -74,4 +74,5 @@ httpRequest.request( ## 相关实例 针对HTTP数据请求,有以下相关实例可供参考: -- [`Http`:数据请求(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/Network/Http) \ No newline at end of file +- [`Http`:数据请求(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/Network/Http) +- [使用HTTP实现与服务端通信(eTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/SmartChatEtsOH) \ No newline at end of file diff --git a/zh-cn/application-dev/connectivity/ipc-rpc-overview.md b/zh-cn/application-dev/connectivity/ipc-rpc-overview.md index 37bd81e6f950e28c1047be1141eea33bb35225d1..ff1261dc0a27b968ba19d86f7bddc5fb401131a7 100755 --- a/zh-cn/application-dev/connectivity/ipc-rpc-overview.md +++ b/zh-cn/application-dev/connectivity/ipc-rpc-overview.md @@ -14,4 +14,4 @@ IPC(Inter-Process Communication)与RPC(Remote Procedure Call)机制用 ## 相关模块 -[分布式任务调度子系统](https://gitee.com/openharmony/distributedschedule_dms_fwk) +[分布式任务调度子系统](https://gitee.com/openharmony/ability_dmsfwk) diff --git a/zh-cn/application-dev/connectivity/socket-connection.md b/zh-cn/application-dev/connectivity/socket-connection.md index 1e39e74d1086ea44eca60bb766eecaa995236ce1..14d67dd82f1dcd79f481b5563dc96a098fb2a560 100644 --- a/zh-cn/application-dev/connectivity/socket-connection.md +++ b/zh-cn/application-dev/connectivity/socket-connection.md @@ -126,3 +126,5 @@ UDP与TCP流程大体类似,下面以TCP为例: ## 相关实例 针对Socket连接开发,有以下相关实例可供参考: - [`Socket`:Socket 连接(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/Network/Socket) +- [使用UDP实现与服务端通信(eTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/UdpDemoOH) +- [使用TCP实现与服务端通信(eTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/TcpSocketDemo) \ No newline at end of file diff --git a/zh-cn/application-dev/connectivity/websocket-connection.md b/zh-cn/application-dev/connectivity/websocket-connection.md index 8cd007bf75842aac584aa76cf97c1f986473962e..53598fc5031da880ebf59edba43fb29bcc8b626b 100644 --- a/zh-cn/application-dev/connectivity/websocket-connection.md +++ b/zh-cn/application-dev/connectivity/websocket-connection.md @@ -83,3 +83,8 @@ WebSocket连接功能主要由webSocket模块提供。使用该功能需要申 } }); ``` + +## 相关实例 + +针对WebSocket连接的开发,有以下相关实例可供参考: +- [`WebSocket`:WebSocket(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/Network/WebSocket) \ No newline at end of file diff --git a/zh-cn/application-dev/database/Readme-CN.md b/zh-cn/application-dev/database/Readme-CN.md index f52d1f24dd42ae50568007e904d13f788574995e..9dedd234837cd5f5fa13d4f34525c4849fcb67fe 100644 --- a/zh-cn/application-dev/database/Readme-CN.md +++ b/zh-cn/application-dev/database/Readme-CN.md @@ -12,3 +12,6 @@ - 分布式数据对象 - [分布式数据对象概述](database-distributedobject-overview.md) - [分布式数据对象开发指导](database-distributedobject-guidelines.md) +- 数据共享 + - [数据共享概述](database-datashare-overview.md) + - [数据共享开发指导](database-datashare-guidelines.md) diff --git a/zh-cn/application-dev/database/database-datashare-guidelines.md b/zh-cn/application-dev/database/database-datashare-guidelines.md index 79a62d26f23f7d3dfa71f5ea97a9561bd3646c06..8bdbd59a824ec23f7a59f7bd810e0cf218e2f7b0 100644 --- a/zh-cn/application-dev/database/database-datashare-guidelines.md +++ b/zh-cn/application-dev/database/database-datashare-guidelines.md @@ -1,4 +1,4 @@ -# DataShare开发指导 +# 数据共享开发指导 DataShare即数据共享模块,提供了向其他应用共享以及管理其数据的方法。目前仅支持同个设备上应用之间的数据共享。 ## 接口说明 diff --git a/zh-cn/application-dev/database/database-datashare-overview.md b/zh-cn/application-dev/database/database-datashare-overview.md index 1adbf97d0a9742351baff9c515cb6eb6302076cf..4131d8bb13c5bb3ee5e6a07bc6ed5828b8459411 100644 --- a/zh-cn/application-dev/database/database-datashare-overview.md +++ b/zh-cn/application-dev/database/database-datashare-overview.md @@ -1,4 +1,4 @@ -# 数据共享开发概述 +# 数据共享概述 ## 数据共享简介 diff --git a/zh-cn/application-dev/database/database-distributedobject-guidelines.md b/zh-cn/application-dev/database/database-distributedobject-guidelines.md index 093eea5fb3b843c12779d67ce68c3812aa0885a8..dac9fb45126a7f3b3dce8f9ee0cc194ec625ff93 100644 --- a/zh-cn/application-dev/database/database-distributedobject-guidelines.md +++ b/zh-cn/application-dev/database/database-distributedobject-guidelines.md @@ -254,12 +254,13 @@ ```js local_object.setSessionId(""); ``` -## 开发实例 +## 相关实例 针对分布式数据对象,有以下开发实例可供参考: +- [`DistributedNote`:分布式备忘录(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/data/DistributedNote) - [备忘录应用](https://gitee.com/openharmony/distributeddatamgr_objectstore/tree/master/samples/distributedNotepad) - -在备忘录应用中,当某一个设备上的备忘录事件发生变更时,通过分布式数据对象将事件变更同步在可信组网内的其他设备上,比如新增备忘录事件、编辑事件标题和内容、清空事件列表等。 + 在备忘录应用中,当某一个设备上的备忘录事件发生变更时,通过分布式数据对象将事件变更同步在可信组网内的其他设备上,比如新增备忘录事件、编辑事件标题和内容、清空事件列表 + 等。 diff --git a/zh-cn/application-dev/database/database-mdds-guidelines.md b/zh-cn/application-dev/database/database-mdds-guidelines.md index 7e6bc5dd5f6323c485a6018ce8bb7fceac476f4f..057a6035fe9061458e1b9ebccb70fe73524fbe94 100644 --- a/zh-cn/application-dev/database/database-mdds-guidelines.md +++ b/zh-cn/application-dev/database/database-mdds-guidelines.md @@ -178,5 +178,7 @@ OpenHarmony系统中的分布式数据服务模块为开发者提供下面几种 ``` ## 相关实例 针对分布式数据开发,有以下相关实例可供参考: +- [`DistributedDataGobang`:分布式五子棋(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/data/DistributedDataGobang) +- [`DDMQuery`:结果集与谓词(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/data/DDMQuery) - [`KvStore`:分布式数据库(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/data/Kvstore) -- [分布式数据库](https://gitee.com/openharmony/codelabs/tree/master/Data/JsDistributedData) +- [分布式数据库(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/Data/JsDistributedData) diff --git a/zh-cn/application-dev/database/database-preference-guidelines.md b/zh-cn/application-dev/database/database-preference-guidelines.md index 14e25f9916b5b76deed13334993231ea7f586f20..76f3ff7808a49ab03bc09f5ad26297be6fa67385 100644 --- a/zh-cn/application-dev/database/database-preference-guidelines.md +++ b/zh-cn/application-dev/database/database-preference-guidelines.md @@ -167,3 +167,6 @@ console.info("Deleted failed with err: " + err) }) ``` +## 相关实例 +针对首选项开发,有以下相关实例可供参考: +- [`Preferences`:首选项(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/data/Preferences) diff --git a/zh-cn/application-dev/database/database-relational-guidelines.md b/zh-cn/application-dev/database/database-relational-guidelines.md index add3bf98baa31c184f521122342586e752a8b84b..785a513f5bc434892d88b3f75b5f5c2491f07b6b 100644 --- a/zh-cn/application-dev/database/database-relational-guidelines.md +++ b/zh-cn/application-dev/database/database-relational-guidelines.md @@ -131,8 +131,8 @@ | ResultSet | goToPreviousRow(): boolean | 将结果集向前移动一行。 | | ResultSet | getColumnIndex(columnName: string): number | 根据指定的列名获取列索引。 | | ResultSet | getColumnName(columnIndex: number): string | 根据指定的列索引获取列名。 | -| ResultSet | goToFirstRow(): boolean | 判断结果集当前位置是否在第一行。 | -| ResultSet | goToLastRow(): boolean | 判断结果集当前位置是否在最后一行。 | +| ResultSet | goToFirstRow(): boolean | 将结果集移动到第一行。 | +| ResultSet | goToLastRow(): boolean | 将结果集移动到最后一行。 | | ResultSet | getString(columnIndex: number): string | 获取当前行指定列的值,以String类型返回。 | | ResultSet | getBlob(columnIndex: number): Uint8Array | 获取当前行指定列的值,以字节数组形式返回。 | | ResultSet | getDouble(columnIndex: number): number | 获取当前行指定列的值,以double型返回。 | @@ -210,6 +210,16 @@ | RdbStore |restore(srcName:string, callback: AsyncCallback<void>):void| 从指定的数据库备份文件恢复数据库,结果以callback形式返回。
- srcName:指定数据库的备份文件名。
- callback:指定callback回调函数。 | | RdbStore |restore(srcName:string): Promise<void>| 从指定的数据库备份文件恢复数据库,结果以promise形式返回。
- srcName:指定数据库的备份文件名。 | +**事务** + +**表15** 事务 + +| 类名 | 接口名 | 描述 | +| -------- | -------- | -------- | +| RdbStore |beginTransaction():void| 在开始执行SQL语句之前,开始事务。 | +| RdbStore |commit():void| 提交已执行的SQL语句。 | +| RdbStore |rollBack():void| 回滚已经执行的SQL语句。 | + ## 开发步骤 1. 创建数据库。 @@ -391,4 +401,4 @@ 针对关系型数据库开发,有以下相关实例可供参考: - [`Rdb`:关系型数据库(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/data/Rdb) - [`DistributedRdb`:分布式关系型数据库(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/data/DistributedRdb) -- [关系型数据库](https://gitee.com/openharmony/codelabs/tree/master/Data/JSRelationshipData) +- [关系型数据库(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/Data/JSRelationshipData) diff --git a/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md b/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md index 9a43e1571aff77f8223461b3c472fefef2c1d7e8..bb10ceb9914da5f59bcf07d919c55b89932160c2 100644 --- a/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md +++ b/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md @@ -436,4 +436,7 @@ import stats from '@ohos.bundleState'; } }); ``` +## 相关实例 +针对设备使用信息统计,有以下相关实例可供参考: +- [`DeviceUsageStatistics`:设备使用信息统计(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/device/DeviceUsageStatistics) diff --git a/zh-cn/application-dev/device/device-location-geocoding.md b/zh-cn/application-dev/device/device-location-geocoding.md index d15b8df3418540ef13cedde828173a1948d9e8fc..8e87eab224a108cd6b620b3bda272c39abda82e8 100644 --- a/zh-cn/application-dev/device/device-location-geocoding.md +++ b/zh-cn/application-dev/device/device-location-geocoding.md @@ -39,13 +39,30 @@ import geolocation from '@ohos.geolocation'; ``` -2. 获取转化结果。 +2. 查询geoCoder服务是否可用。 + - 调用isGeoServiceAvailable查询geoCoder服务是否可用,如果服务可用再继续进行步骤3。 + + ``` + geolocation.isGeoServiceAvailable((err, data) => { + if (err) { + console.log('isGeoServiceAvailable err: ' + JSON.stringify(err)); + } else { + console.log('isGeoServiceAvailable data: ' + JSON.stringify(data)); + } + }); + ``` + +3. 获取转化结果。 - 调用getAddressesFromLocation,坐标转化地理位置信息。 ``` var reverseGeocodeRequest = {"latitude": 31.12, "longitude": 121.11, "maxItems": 1}; - geolocation.getAddressesFromLocation(reverseGeocodeRequest, (data) => { - console.log('getAddressesFromLocation: ' + JSON.stringify(data)); + geolocation.getAddressesFromLocation(reverseGeocodeRequest, (err, data) => { + if (err) { + console.log('getAddressesFromLocation err: ' + JSON.stringify(err)); + } else { + console.log('getAddressesFromLocation data: ' + JSON.stringify(data)); + } }); ``` @@ -54,8 +71,12 @@ ``` var geocodeRequest = {"description": "上海市浦东新区xx路xx号", "maxItems": 1}; - geolocation.getAddressesFromLocationName(geocodeRequest, (data) => { - console.log('getAddressesFromLocationName: ' + JSON.stringify(data)); + geolocation.getAddressesFromLocationName(geocodeRequest, (err, data) => { + if (err) { + console.log('getAddressesFromLocationName err: ' + JSON.stringify(err)); + } else { + console.log('getAddressesFromLocationName data: ' + JSON.stringify(data)); + } }); ``` diff --git a/zh-cn/application-dev/device/device-location-info.md b/zh-cn/application-dev/device/device-location-info.md index f5953d7740e91b796b940456e4e3ad0557727110..9aa69b81798ff67508e57c70ca22374e6da16907 100644 --- a/zh-cn/application-dev/device/device-location-info.md +++ b/zh-cn/application-dev/device/device-location-info.md @@ -84,7 +84,7 @@ } ``` - 配置字段详细说明见。 + 配置字段详细说明见[应用包结构配置文件的说明](../quick-start/stage-structure.md)。 2. 导入geolocation模块,所有与基础定位能力相关的功能API,都是通过该模块提供的。 @@ -123,7 +123,7 @@ 以导航场景为例,实例化方式如下: ``` - var requestInfo = {'scenario': 0x301, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0}; + var requestInfo = {'scenario': geolocation.LocationRequestScenario.NAVIGATION, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0}; ``` **方式二:** @@ -152,7 +152,7 @@ 以定位精度优先策略为例,实例化方式如下: ``` - var requestInfo = {'priority': 0x201, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0}; + var requestInfo = {'priority': geolocation.LocationRequestPriority.ACCURACY, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0}; ``` 4. 实例化Callback对象,用于向系统提供位置上报的途径。 @@ -179,8 +179,12 @@ 如果应用使用场景不需要实时的设备位置,可以获取系统缓存的最近一次历史定位结果。 ``` - geolocation.getLastLocation((data) => { - console.log('getLastLocation: data: ' + JSON.stringify(data)); + geolocation.getLastLocation((err, data) => { + if (err) { + console.log('getLastLocation: err: ' + JSON.stringify(err)); + } else { + console.log('getLastLocation: data: ' + JSON.stringify(data)); + } }); ``` diff --git a/zh-cn/application-dev/device/device-location-overview.md b/zh-cn/application-dev/device/device-location-overview.md index 31bab927335cab41b6d135f890840f2f3e576502..d6a7606f38bc5ad49b72d9c8818ba2c0ec905d63 100644 --- a/zh-cn/application-dev/device/device-location-overview.md +++ b/zh-cn/application-dev/device/device-location-overview.md @@ -37,3 +37,9 @@ 使用设备的位置能力,需要用户进行确认并主动开启位置开关。如果位置开关没有开启,系统不会向任何应用提供位置服务。 设备位置信息属于用户敏感数据,所以即使用户已经开启位置开关,应用在获取设备位置前仍需向用户申请位置访问权限。在用户确认允许后,系统才会向应用提供位置服务。 + +## 相关实例 + +针对位置服务,有以下相关实例可供参考: + +-[`Location`:位置服务(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/device/Location) diff --git a/zh-cn/application-dev/device/usb-guidelines.md b/zh-cn/application-dev/device/usb-guidelines.md index a4b96c2735fcca119917c6c1fcd24e892ac4a3a0..938786fd4b316a19c78b20867a4ee57e560f4e6e 100644 --- a/zh-cn/application-dev/device/usb-guidelines.md +++ b/zh-cn/application-dev/device/usb-guidelines.md @@ -153,3 +153,6 @@ USB设备可作为Host设备连接Device设备进行数据传输。开发示例 usb.releaseInterface(pipe, interface1); usb.closePipe(pipe); ``` +## 相关实例 +针对USB管理开发,有以下相关实例可供参考: +- [`USBManager`:USB管理(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/device/USBManager) diff --git a/zh-cn/application-dev/internationalization/intl-guidelines.md b/zh-cn/application-dev/internationalization/intl-guidelines.md index ceb2f492b42a98e0aa6e1df30db8d801d3cf314c..0f3584a39921fe3065bc46b3ae296c297267442f 100644 --- a/zh-cn/application-dev/internationalization/intl-guidelines.md +++ b/zh-cn/application-dev/internationalization/intl-guidelines.md @@ -328,4 +328,6 @@ 针对Intl开发,有以下相关实例可供参考: --[`International`:国际化(JS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/UI/International) \ No newline at end of file +-[`International`:国际化(JS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/UI/International) + +-[`International`:国际化(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/common/International) \ No newline at end of file diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/layout-intro.md b/zh-cn/application-dev/key-features/multi-device-app-dev/layout-intro.md index 481ccd596210d4541bf68da4b55d5a02049a21bb..474da8065f0ad6a0d8bd97afcca584ee260fbfc0 100644 --- a/zh-cn/application-dev/key-features/multi-device-app-dev/layout-intro.md +++ b/zh-cn/application-dev/key-features/multi-device-app-dev/layout-intro.md @@ -13,3 +13,8 @@ 下面将详细介绍这些布局能力。 +## 相关实例 +针对一次开发,多端部署,有以下相关实例可供参考: +- [`AdaptiveCapabilities`:多设备自适应能力(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/MultiDeviceAppDev/AdaptiveCapabilities) +- [`JsAdaptiveCapabilities`:多设备自适应能力(JS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/MultiDeviceAppDev/JsAdaptiveCapabilities) +- [一次开发多端部署(eTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/MultiDeploymentEts) diff --git a/zh-cn/application-dev/media/audio-playback.md b/zh-cn/application-dev/media/audio-playback.md index f58d0a7c980c3fc5313cf8e92f42dfb961fb4ad3..d5fb8cf6df69f69998a10337f57437f0d2f33947 100644 --- a/zh-cn/application-dev/media/audio-playback.md +++ b/zh-cn/application-dev/media/audio-playback.md @@ -258,5 +258,5 @@ export class AudioDemo { - [`JsDistributedMusicPlayer`:分布式音乐播放(JS)(API7)](https://gitee.com/openharmony/app_samples/tree/master/ability/JsDistributedMusicPlayer) - [`JsAudioPlayer`:音频播放和管理(JS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/media/JsAudioPlayer) -- [`eTsAudioPlayer`: 音频播放器(eTS)](https://gitee.com/openharmony/app_samples/blob/master/media/Recorder/entry/src/main/ets/MainAbility/pages/Play.ets) -- [音频播放器](https://gitee.com/openharmony/codelabs/tree/master/Media/Audio_OH_ETS) \ No newline at end of file +- [`eTsAudioPlayer`: 音频播放器(eTS)(API8)](https://gitee.com/openharmony/app_samples/blob/master/media/Recorder/entry/src/main/ets/MainAbility/pages/Play.ets) +- [音频播放器(eTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Media/Audio_OH_ETS) \ No newline at end of file diff --git a/zh-cn/application-dev/media/audio-recorder.md b/zh-cn/application-dev/media/audio-recorder.md index 91cb1835192acfebfcaa207d73e471c3c0895c8b..4fad7945ff6db32a2746751839a35427f5825674 100644 --- a/zh-cn/application-dev/media/audio-recorder.md +++ b/zh-cn/application-dev/media/audio-recorder.md @@ -192,5 +192,5 @@ export class AudioRecorderDemo { - [`Recorder`:录音机(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/media/Recorder) - [`JsRecorder`:录音机(JS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/media/JSRecorder) -- [`eTsAudioPlayer`: 音频播放器(eTS)](https://gitee.com/openharmony/app_samples/blob/master/media/Recorder/entry/src/main/ets/MainAbility/pages/Play.ets) -- [音频播放器](https://gitee.com/openharmony/codelabs/tree/master/Media/Audio_OH_ETS) +- [`eTsAudioPlayer`: 音频播放器(eTS)(API8)](https://gitee.com/openharmony/app_samples/blob/master/media/Recorder/entry/src/main/ets/MainAbility/pages/Play.ets) +- [音频播放器(eTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Media/Audio_OH_ETS) diff --git a/zh-cn/application-dev/media/image.md b/zh-cn/application-dev/media/image.md index 551617ff75dbe68caf8eef4e678000760daafc49..deda457636e444120cee5a4577ebe1fed567b5fa 100644 --- a/zh-cn/application-dev/media/image.md +++ b/zh-cn/application-dev/media/image.md @@ -296,4 +296,11 @@ public async init(surfaceId: any) { // 调用Camera方法将surfaceId传递给Camera。camera会通过surfaceId获取surface,并生产出surface buffer。 } -``` \ No newline at end of file +``` + +## 相关实例 + +针对图片开发,有以下相关实例可供参考: + +- [`Image`:图片处理(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/media/Image) +- [`GamePuzzle`:拼图(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/media/GamePuzzle) \ No newline at end of file diff --git a/zh-cn/application-dev/media/video-playback.md b/zh-cn/application-dev/media/video-playback.md index d68991c0a1fff0d436b57b04fc9cdfd2090dd54e..bb8a935684e397beef11c5ce4476b81a0a04fa1d 100644 --- a/zh-cn/application-dev/media/video-playback.md +++ b/zh-cn/application-dev/media/video-playback.md @@ -445,4 +445,5 @@ export class VideoPlayerDemo { ## 相关实例 针对视频播放开发,有以下相关实例可供参考: -- [`VideoPlayer`:视频播放(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/media/VideoPlayer) \ No newline at end of file +- [`VideoPlayer`:视频播放(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/media/VideoPlayer) +- [视频播放器(eTS)(API 9)](https://gitee.com/openharmony/codelabs/tree/master/Media/VideoPlayerStage) \ No newline at end of file diff --git a/zh-cn/application-dev/napi/napi-guidelines.md b/zh-cn/application-dev/napi/napi-guidelines.md index f5702ff4654bf4f2e16ddee68d9bd9c705de75bc..95c03925de5ba06ea0eb08e22ab390dc51a946e2 100644 --- a/zh-cn/application-dev/napi/napi-guidelines.md +++ b/zh-cn/application-dev/napi/napi-guidelines.md @@ -10,23 +10,28 @@ js侧通过`import`引入native侧包含处理js逻辑的so,如:`import hell ## 开发建议 -### 1. 注册建议 +### 注册建议 * nm_register_func对应的函数需要加上static,防止与其他so里的符号冲突。 * 模块注册的入口,即使用\_\_attribute\_\_((constructor))修饰的函数的函数名需要确保不与其他模块重复。 -### 2. so命名规则 + +### so命名规则 * 每个模块对应一个so * 如模块名为`hello`,则so的名字为`libhello.so`,`napi_module`中`nm_modname`字段应为`hello`,大小写与模块名保持一致,应用使用时写作:`import hello from 'libhello.so'` -### 3. js对象线程限制 +### js对象线程限制 ark引擎会对js对象线程使用进行保护,不正确使用会引起应用crash。 * napi接口只能在js线程使用。 * env与线程绑定,不能跨线程使用。native侧js对象只能在创建时的线程使用,即与线程所持有的env绑定。 -### 4. napi_create_async_work接口说明 +### 头文件引入限制 + +在使用napi的对象和方法时需要引用"napi/native_api.h"。否则在只引入三方库头文件时,会出现未支持**接口无法找到的编译报错**。 + +### napi_create_async_work接口说明 napi_create_async_work里有两个回调: @@ -635,4 +640,9 @@ export default { }) } } -``` \ No newline at end of file +``` +## 相关实例 +针对Native API的开发,有以下相关实例可供参考: +- [`NativeAPI`:NativeAPI(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/Native/NativeAPI) +- [第一个Native C++应用(eTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/NativeAPI/NativeTemplateDemo) +- [Native Component(eTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/NativeAPI/XComponent) \ No newline at end of file diff --git a/zh-cn/application-dev/notification/background-agent-scheduled-reminder-guide.md b/zh-cn/application-dev/notification/background-agent-scheduled-reminder-guide.md index 6b718b96f3c7e4c517856c28e20b998870027eff..309b35884a463fa5048b1ea03ae70a27a472ecdf 100644 --- a/zh-cn/application-dev/notification/background-agent-scheduled-reminder-guide.md +++ b/zh-cn/application-dev/notification/background-agent-scheduled-reminder-guide.md @@ -283,3 +283,6 @@ let alarm : reminderAgent.ReminderRequestAlarm = { - [`AlarmClock`:后台代理提醒(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/Notification/AlarmClock) +- [`FlipClock`:翻页时钟(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/CompleteApps/FlipClock) + +- [闹钟应用(eTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/CommonEventAndNotification/AlarmClock) \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/Readme-CN.md b/zh-cn/application-dev/quick-start/Readme-CN.md index 3d62e542dff3976fd41ff705a616067c563f8be3..48cea0090a5959e26ecbc3f316c56ec641a41adb 100755 --- a/zh-cn/application-dev/quick-start/Readme-CN.md +++ b/zh-cn/application-dev/quick-start/Readme-CN.md @@ -9,7 +9,6 @@ - 开发基础知识 - [应用包结构说明(FA模型)](package-structure.md) - [应用包结构说明(Stage模型)](stage-structure.md) - - [资源文件的分类](basic-resource-file-categories.md) - [SysCap说明](syscap.md) - [HarmonyAppProvision配置文件](app-provision-structure.md) diff --git a/zh-cn/application-dev/quick-start/package-structure.md b/zh-cn/application-dev/quick-start/package-structure.md index f5398419071b884b9b48da24168e8ac1791ab636..6345a071e3ec1d01af0169dcc9ab1de1567f3cf3 100644 --- a/zh-cn/application-dev/quick-start/package-structure.md +++ b/zh-cn/application-dev/quick-start/package-structure.md @@ -356,7 +356,7 @@ metaData示例: | uri | 表示Ability的统一资源标识符。该标签最大长度为255。 | 字符串 | 可缺省,对于data类型的Ability不可缺省。 | | launchType | 表示Ability的启动模式,支持“standard”和“singleton”两种模式:
standard:表示该Ability可以有多实例。该模式适用于大多数应用场景。
singleton:表示该Ability在所有任务栈中仅可以有一个实例。例如,具有全局唯一性的呼叫来电界面即采用“singleton”模式。该标签仅适用于默认设备、平板、智慧屏、车机、智能穿戴。 | 字符串 | 可缺省,缺省值为“singleton”。 | | visible | 表示Ability是否可以被其他应用调用。
true:可以被其他应用调用。
false:不能被其他应用调用。 | 布尔类型 | 可缺省,缺省值为“false”。 | -| permissions | 表示其他应用的Ability调用此Ability时需要申请的权限。通常采用反向域名格式,取值可以是系统预定义的权限,也可以是开发者自定义的权限。 | 字符串数组 | 可缺省,缺省值为空。 | +| permissions | 表示其他应用的Ability调用此Ability时需要申请的权限集合,一个数组元素为一个权限名称。通常采用反向域名格式(最大255字节),取值为系统预定义的权限。 | 字符串数组 | 可缺省,缺省值为空。 | | skills | 表示Ability能够接收的want的特征。 | 对象数组 | 可缺省,缺省值为空。 | | deviceCapability | 表示Ability运行时要求设备具有的能力,采用字符串数组的格式表示。 | 字符串数组 | 可缺省,缺省值为空。 | | metaData | 元数据,参考表13。 | 对象 | 可缺省,缺省值为空。 | @@ -591,7 +591,7 @@ shortcuts示例: | isDefault | 表示该卡片是否为默认卡片,每个Ability有且只有一个默认卡片。
true:默认卡片。
false:非默认卡片。 | 布尔值 | 不可缺省 | | type | 表示卡片的类型。取值范围如下:
JS:JS卡片。 | 字符串 | 不可缺省 | | colorMode | 表示卡片的主题样式,取值范围如下:
auto:自适应。
dark:深色主题。
light:浅色主题。 | 字符串 | 可缺省,缺省值为“auto”。 | -| supportDimensions | 表示卡片支持的外观规格,取值范围:
1 * 2:表示1行2列的二宫格。
2 * 2:表示2行2列的四宫格。
2 * 4:表示2行4列的八宫格。
4 * 4:表示4行4列的十六宫格。 | 字符串数组 | 不可缺省 | +| supportDimensions | 表示卡片支持的外观规格,取值范围:
1 * 2:表示1行2列的二宫格。
2 * 1:表示2行1列的二宫格。
2 * 2:表示2行2列的四宫格。
2 * 4:表示2行4列的八宫格。
4 * 4:表示4行4列的十六宫格。 | 字符串数组 | 不可缺省 | | defaultDimension | 表示卡片的默认外观规格,取值必须在该卡片supportDimensions配置的列表中。 | 字符串 | 不可缺省 | | updateEnabled | 表示卡片是否支持周期性刷新,取值范围:
true:表示支持周期性刷新,可以在定时刷新(updateDuration)和定点刷新(scheduledUpdateTime)两种方式任选其一,优先选择定时刷新。
false:表示不支持周期性刷新。 | 布尔类型 | 不可缺省 | | scheduledUpdateTime | 表示卡片的定点刷新的时刻,采用24小时制,精确到分钟。 | 字符串 | 可缺省,缺省值为“0:0”。 | diff --git a/zh-cn/application-dev/quick-start/stage-structure.md b/zh-cn/application-dev/quick-start/stage-structure.md index b42469ad7cb47bc6f35a06bb1a8c7110d330867c..fa20a6d5d3cf8cbef28290a52b06576796e7fa9c 100644 --- a/zh-cn/application-dev/quick-start/stage-structure.md +++ b/zh-cn/application-dev/quick-start/stage-structure.md @@ -163,25 +163,25 @@ hap包的配置信息,该标签下的配置只对当前hap包生效。 表3 module对象内部结构 -| 属性名称 | 含义 | 数据类型 | 是否可缺省 | -| ------------------- | ------------------------------------------------------------ | ---------- | ------------------------------------- | -| name | 该标签标识当前module的名字,module打包成hap后,表示hap的名称,标签值采用字符串表示(最大长度31个字节),该名称在整个应用要唯一。 | 字符串 | 该标签不可缺省。 | -| type | 该标签表示当前hap的类型。类型有三种,分别是entry、feature和har。 | 字符串 | 该标签不可缺省。 | -| srcEntrance | 该标签表示hap所对应的入口js代码路径,标签值为字符串(最长为127字节)。 | 字符串 | 该标签可缺省。 | -| description | 该标签标识hap包的描述信息,标签值是是字符串类型或对描述内容的资源索引,以支持多语言。 | 字符串 | 该标签可缺省,缺省值为空。 | -| process | 该标签标识hap的进程名,标签值为字符串类型(最长为31个字节)。如果在hap标签下配置了process,该应用的所有ability都运行在该进程中。 | 字符串 | 可缺省,缺省为hap的名称。 | -| mainElement | 该标签标识hap的入口ability名称或者extension名称。只有配置为mainElement的ability或者extension才允许在服务中心露出。创建OpenHarmony原子化服务时,该标签不可缺省。 | 字符串 | OpenHarmony应用下,该标签可缺省。 | -| deviceTypes | 该标签标识hap可以运行在哪类设备上,标签值采用字符串数组的表示,系统预定义的设备类型见表4。
与syscap不同的是,deviceTypes是以设备类型为粒度,而syscap是以设备能力(例如蓝牙、wifi)为粒度。 | 字符串数组 | 该标签不可缺省,可以为空值。 | -| deliveryWithInstall | 该标签标识当前hap是否在用户主动安装的时候安装,true表示主动安装时安装,false表示主动安装时不安装。 | 布尔值 | 该标签不可缺省。 | -| installationFree | 表示当前HAP是否支持免安装特性。所有Hap包都需要配置不可缺省。
true :表示支持免安装特性,且符合免安装约束。
false :表示不支持免安装特性。

当entry.hap该字段配置为true时,与该entry.hap相关的所有feature.hap该字段也需要配置为true。
当entry.hap该字段配置为false时,与该entry.hap相关的各feature.hap该字段可按业务需求配置true或false。 | 布尔值 | 该标签不可缺省。 | -| virtualMachine | 该标签用于标识当前hap运行的目标虚拟机类型,供云端分发使用,如应用市场和分发中心。
该标签值为字符串。如果目标虚拟机类型为方舟虚拟机,则其值为”ark”; 如果目标虚拟机类型不是方舟虚拟机,则其值为”default”。该标签由IDE构建hap的时候自动插入。解包工具解析时,如果hap包没有该标签,设置该标签值为”default”。 | 字符串 | 该标签可缺省,缺省值为“default”。 | -| uiSyntax | syntax定义该JS Component的语法类型。
hml标识该JS Component使用hml/css/js进行开发;
ets标识该JS Component使用ets声明式语法进行开发。 | 字符串 | 该标签可缺省,默认值为hml | -| pages | 该标签是一个profile资源,用于列举JS Component中每个页面信息。pages使用参考pages示例。 | 对象 | 在有ability的场景下,该标签不可缺省。 | -| metadata | 该标签标识Hap的自定义元信息,标签值为数组类型,该标签下的配置只对当前module、或者ability、或者extensionAbility生效。metadata参考[metadata对象内部结构](#metadata对象内部结构)。 | 数组 | 该标签可缺省,缺省值为空。 | -| abilities | 描述元能力的配置信息,标签值为数组类型,该标签下的配置只对当前ability生效。abilities参考[abilities对象内部结构](#abilities对象内部结构)。 | 对象 | 该标签可缺省,缺省值为空。 | -| extensionAbilities | 描述extensionAbilities的配置信息,标签值为数组类型,该标签下的配置只对当前extensionAbility生效。extensionAbilities参考[extensionAbility对象的内部结构说明](#extensionAbility对象的内部结构说明)。 | 对象 | 该标签可缺省,缺省值为空。 | -| requestPermissions | 该标签标识应用运行时需向系统申请的权限集合,标签值为数组类型。requestPermissions参考[requestPermissions对象内部结构](#requestPermissions对象内部结构)。 | 对象 | 该标签可缺省,缺省值为空。 | -| testRunner | 此标签用于支持对测试框架的配置,参考[testRunner对象内部结构说明](#testRunner对象内部结构)说明。 | 对象 | 可缺省,缺省值为空 | +| 属性名称 | 含义 | 数据类型 | 是否可缺省 | +| -------------------- | ------------------------------------------------------------ | ---------- | ------------------------------------------------- | +| name | 该标签标识当前module的名字,module打包成hap后,表示hap的名称,标签值采用字符串表示(最大长度31个字节),该名称在整个应用要唯一。 | 字符串 | 该标签不可缺省。 | +| type | 该标签表示当前hap的类型。类型有三种,分别是entry、feature和har。 | 字符串 | 该标签不可缺省。 | +| srcEntrance | 该标签表示hap所对应的入口js代码路径,标签值为字符串(最长为127字节)。 | 字符串 | 该标签可缺省。 | +| description | 该标签标识hap包的描述信息,标签值是是字符串类型或对描述内容的资源索引,以支持多语言。 | 字符串 | 该标签可缺省,缺省值为空。 | +| process | 该标签标识hap的进程名,标签值为字符串类型(最长为31个字节)。如果在hap标签下配置了process,该应用的所有ability都运行在该进程中。 | 字符串 | 可缺省,缺省为hap的名称。 | +| mainElement | 该标签标识hap的入口ability名称或者extension名称。只有配置为mainElement的ability或者extension才允许在服务中心露出。创建OpenHarmony原子化服务时,该标签不可缺省。 | 字符串 | OpenHarmony应用下,该标签可缺省。 | +| deviceTypes | 该标签标识hap可以运行在哪类设备上,标签值采用字符串数组的表示,系统预定义的设备类型见表4。
与syscap不同的是,deviceTypes是以设备类型为粒度,而syscap是以设备能力(例如蓝牙、wifi)为粒度。 | 字符串数组 | 该标签不可缺省,可以为空值。 | +| deliveryWithInstall | 该标签标识当前hap是否在用户主动安装的时候安装,true表示主动安装时安装,false表示主动安装时不安装。 | 布尔值 | 该标签不可缺省。 | +| installationFree | 表示当前HAP是否支持免安装特性。所有Hap包都需要配置不可缺省。
true :表示支持免安装特性,且符合免安装约束。
false :表示不支持免安装特性。

当entry.hap该字段配置为true时,与该entry.hap相关的所有feature.hap该字段也需要配置为true。
当entry.hap该字段配置为false时,与该entry.hap相关的各feature.hap该字段可按业务需求配置true或false。 | 布尔值 | 该标签不可缺省。 | +| virtualMachine | 该标签用于标识当前hap运行的目标虚拟机类型,供云端分发使用,如应用市场和分发中心。
该标签值为字符串。如果目标虚拟机类型为方舟虚拟机,则其值为”ark”; 如果目标虚拟机类型不是方舟虚拟机,则其值为”default”。该标签由IDE构建hap的时候自动插入。解包工具解析时,如果hap包没有该标签,设置该标签值为”default”。 | 字符串 | 该标签可缺省,缺省值为“default”。 | +| uiSyntax(deprecated) | syntax定义该JS Component的语法类型。
hml标识该JS Component使用hml/css/js进行开发;
ets标识该JS Component使用ets声明式语法进行开发。 | 字符串 | 该标签可缺省,默认值为hml,该字段从API9开始废弃。 | +| pages | 该标签是一个profile资源,用于列举JS Component中每个页面信息。pages使用参考pages示例。 | 对象 | 在有ability的场景下,该标签不可缺省。 | +| metadata | 该标签标识Hap的自定义元信息,标签值为数组类型,该标签下的配置只对当前module、或者ability、或者extensionAbility生效。metadata参考[metadata对象内部结构](#metadata对象内部结构)。 | 数组 | 该标签可缺省,缺省值为空。 | +| abilities | 描述元能力的配置信息,标签值为数组类型,该标签下的配置只对当前ability生效。abilities参考[abilities对象内部结构](#abilities对象内部结构)。 | 对象 | 该标签可缺省,缺省值为空。 | +| extensionAbilities | 描述extensionAbilities的配置信息,标签值为数组类型,该标签下的配置只对当前extensionAbility生效。extensionAbilities参考[extensionAbility对象的内部结构说明](#extensionAbility对象的内部结构说明)。 | 对象 | 该标签可缺省,缺省值为空。 | +| requestPermissions | 该标签标识应用运行时需向系统申请的权限集合,标签值为数组类型。requestPermissions参考[requestPermissions对象内部结构](#requestPermissions对象内部结构)。 | 对象 | 该标签可缺省,缺省值为空。 | +| testRunner | 此标签用于支持对测试框架的配置,参考[testRunner对象内部结构说明](#testRunner对象内部结构)说明。 | 对象 | 可缺省,缺省值为空 | 表4 deviceTypes对象的系统预定义设备 @@ -283,7 +283,7 @@ abilities描述ability的配置信息,标签值为数组类型。 | launchType | 该标签标示ability的启动模式,标签值可选“standard”、“singleton”、“specified”。该标签缺省为"singleton"。standard表示普通多实例,specified表示指定实例,运行时由ability内部业务决定是否创建多实例,singleton表示单实例。 | 字符串 | 可缺省,该标签缺省为"singleton" | | description | 该标签标识ability的描述,标签值是是字符串类型或对描述内容的资源索引,要求采用用资源索引方式,以支持多语言。 | 字符串 | 该标签可缺省,缺省值为空。 | | icon | 该标签标识ability图标,标签值为资源文件的索引。该标签可缺省,缺省值为空。
如果ability被配置为MainElement,该标签必须配置。 | 字符串 | 该标签可缺省,缺省值为空。
如果ability被配置为MainElement,该标签必须配置。 | -| permissions | 该标签标识被其它应用的ability调用时需要申请的权限的集合,字符串数组类型,每个数组元素为一个权限名称,通常采用反向域名方式表示(最大255字节),可以是系统预定义的权限,也可以是该应用自定义的权限。如果是后者,需要与系统应用定义的权限中的某个权限name标签值保持一致。该标签可缺省,缺省值为空。 | 字符串数组 | 该标签可缺省,缺省值为空。 | +| permissions | 该标签标识被其它应用的ability调用时需要申请的权限的集合,一个数组元素为一个权限名称。通常采用反向域名格式(最大255字节),取值为系统预定义的权限。 | 字符串数组 | 该标签可缺省,缺省值为空。 | | metadata | 该标签表示ability的元信息。metadata参考[metadata对象内部结构](#metadata对象内部结构)。 | 数组 | 该标签可缺省,缺省值为空。 | | visible | 该标签标识ability是否可以被其它应用调用,为布尔类型,true表示可以被其它应用调用, false表示不可以被其它应用调用。 | 布尔值 | 该标签可缺省,缺省值为false。 | | continuable | 该标签标识ability是否可以迁移,为布尔类型,true表示可以被迁移, false表示不可以被迁移。 | 布尔值 | 该标签可缺省,缺省值为false。 | @@ -439,7 +439,7 @@ skills示例 | description | 该标签标识extensionAbility的描述,标签值是是字符串类型或对描述内容的资源索引,以支持多语言。 | 字符串 | 该标签可缺省,缺省值为空。 | | icon | 该标签标识extensionAbility图标,标签值为资源文件的索引。如果extensionAbility被配置为MainElement,该标签必须配置。 | 字符串 | 该标签可缺省,缺省值为空。 | | label | 该标签标识extensionAbility对用户显示的名称,标签值配置为该名称的资源索引以支持多语言。
如果extensionAbility被配置为MainElement,该标签必须配置,且应用内唯一。 | 字符串 | 该标签不可缺省。 | -| type | 该标签标识extensionAbility的类型,取值为form、workScheduler、inputMethod、service、accessibility、dataShare、fileShare、staticSubscriber、wallpaper、backup、window其中之一。 | 字符串 | 该标签不可缺省。 | +| type | 该标签标识extensionAbility的类型,取值为form、workScheduler、inputMethod、service、accessibility、dataShare、fileShare、staticSubscriber、wallpaper、backup、window、enterpriseAdmin、thumbnail、preview其中之一。 | 字符串 | 该标签不可缺省。 | | permissions | 该标签标识被其它应用的ability调用时需要申请的权限的集合,字符串数组类型,每个数组元素为一个权限名称,通常采用反向域名方式表示(最大255字节),可以是系统预定义的权限,也可以是该应用自定义的权限。如果是后者,需与defPermissions标签中定义的某个权限的name标签值一致。 | 字符串数组 | 该标签可缺省,缺省值为空。 | | uri | 该标签标识ability提供的数据uri,为字符数组类型(最大长度255),用反向域名的格式表示。该标签在type为dataShare类型的extensionAbility时,不可缺省。 | 字符串 | 该标签可缺省,缺省值为空。 | | skills | 该标签标识ability能够接收的意图的特征集,为数组格式。
配置规则 : entry包可以配置多个具有入口能力的skills标签(配置了action.system.home和entity.system.home)的ability,其中第一个配置了skills标签的ability中的label和icon作为OpenHarmony服务或应用的label和icon。
OpenHarmony服务的Feature包不能配置具有入口能力的skills标签。
OpenHarmony应用的Feature包可以配置具有入口能力的skills标签。
skills内部结构参考[skills对象内部结构](#skills对象内部结构)。 | 数组 | 该标签可缺省,缺省值为空。 | @@ -528,7 +528,7 @@ forms标签表示卡片的配置,form卡片是可以嵌入桌面上并接收 | window | 该标签标识JS卡片的自适应能力。window结构参考表12。 | 对象 | 可缺省,缺省为空。 | | isDefault | 表示该卡片是否为默认卡片,每个Ability有且只有一个默认卡片。 true :默认卡片。 false :非默认卡片。 | 布尔值 | 否 | | colorMode | 表示卡片的主题样式,取值范围如下 : auto :自适应。 dark :深色主题。 light :浅色主题。 | 字符串 | 可缺省,缺省值为“auto”。 | -| supportDimensions | 表示卡片支持的外观规格,取值范围 : 1 * 2 :表示1行2列的二宫格。 2 * 2 :表示2行2列的四宫格。 2 * 4 :表示2行4列的八宫格。 4 * 4 :表示4行4列的十六宫格。 | 字符串数组 | 否 | +| supportDimensions | 表示卡片支持的外观规格,取值范围 : 1 * 2 :表示1行2列的二宫格。 2 * 1 :表示2行1列的二宫格。 2 * 2 :表示2行2列的四宫格。 2 * 4 :表示2行4列的八宫格。 4 * 4 :表示4行4列的十六宫格。 | 字符串数组 | 否 | | defaultDimension | 表示卡片的默认外观规格,取值必须在该卡片supportDimensions配置的列表中。 | 字符串 | 否 | | updateDuration | 该标签标识卡片定时刷新的更新频率,单位为30分钟,取值为30的倍数值。卡片的最高频率为每30分钟刷新一次,和定点刷新二选一,二者都配置的情况下,定时优先。 | 数值 | 可缺省,缺省为空。 | | metadata | 该标签表示卡片的自定义信息。metadata内部结构参考表5。 | 对象 | 可缺省,缺省为空。 | diff --git a/zh-cn/application-dev/reference/apis/Readme-CN.md b/zh-cn/application-dev/reference/apis/Readme-CN.md index 9048aec6ed20ef8faef94dd42c35c8b766aefbfa..6da3840f815117b6613ddff5614b75bcba5fa6e8 100755 --- a/zh-cn/application-dev/reference/apis/Readme-CN.md +++ b/zh-cn/application-dev/reference/apis/Readme-CN.md @@ -4,53 +4,54 @@ - Ability框架 - - [@ohos.ability.dataUriUtils (DataUriUtils模块)](js-apis-DataUriUtils.md) - - [@ohos.ability.errorCode (ErrorCode)](js-apis-ability-errorCode.md) - - [@ohos.ability.wantConstant (wantConstant)](js-apis-ability-wantConstant.md) - - [@ohos.application.Ability (Ability)](js-apis-application-ability.md) - - [@ohos.application.AbilityConstant (AbilityConstant)](js-apis-application-abilityConstant.md) - - [@ohos.application.abilityDelegatorRegistry (AbilityDelegatorRegistry)](js-apis-abilityDelegatorRegistry.md) - - [@ohos.application.AbilityStage (AbilityStage)](js-apis-application-abilitystage.md) - - [@ohos.application.abilityLifecycleCallback (AbilityLifecycleCallback)](js-apis-application-abilityLifecycleCallback.md) - - [@ohos.application.appManager (appManager)](js-apis-appmanager.md) - - [@ohos.application.Configuration (Configuration)](js-apis-configuration.md) - - [@ohos.application.ConfigurationConstant (ConfigurationConstant)](js-apis-configurationconstant.md) - - [@ohos.application.DataShareExtensionAbility (数据共享扩展能力)](js-apis-application-DataShareExtensionAbility.md) - - [@ohos.ability.featureAbility (FeatureAbility模块)](js-apis-featureAbility.md) - - [@ohos.application.formBindingData (卡片数据绑定类)](js-apis-formbindingdata.md) - - [@ohos.application.FormExtension (FormExtension)](js-apis-formextension.md) - - [@ohos.application.formError (FormError)](js-apis-formerror.md) - - [@ohos.application.formHost (FormHost)](js-apis-formhost.md) - - [@ohos.application.formInfo (FormInfo)](js-apis-formInfo.md) - - [@ohos.application.missionManager (missionManager)](js-apis-missionManager.md) - - [@ohos.application.formProvider (FormProvider)](js-apis-formprovider.md) - - [@ohos.ability.particleAbility (particleAbility模块)](js-apis-particleAbility.md) - - [@ohos.application.ServiceExtensionAbility (ServiceExtensionAbility)](js-apis-service-extension-ability.md) - - [@ohos.application.StartOptions (StartOptions)](js-apis-application-StartOptions.md) - - [@ohos.application.StaticSubscriberExtensionAbility (StaticSubscriberExtensionAbility)](js-apis-application-staticSubscriberExtensionAbility.md) - - [@ohos.application.uriPermissionManager (uriPermissionManager)](js-apis-uripermissionmanager.md) - - [@ohos.application.Want (Want)](js-apis-application-Want.md) - - [@ohos.application.WindowExtensionAbility (窗口扩展能力)](js-apis-application-WindowExtensionAbility.md) - - [@ohos.wantAgent (WantAgent模块)](js-apis-wantAgent.md) - - ability/[dataAbilityHelper (DataAbilityHelper模块)](js-apis-dataAbilityHelper.md) - - app/[context (Context模块)](js-apis-Context.md) - - application/[AbilityContext (AbilityContext)](js-apis-ability-context.md) - - application/[ApplicationContext (ApplicationContext)](js-apis-application-applicationContext.md) - - application/[abilityDelegator (AbilityDelegator)](js-apis-application-abilityDelegator.md) - - application/[abilityDelegatorArgs (AbilityDelegatorArgs)](js-apis-application-abilityDelegatorArgs.md) - - application/[abilityMonitor (AbilityMonitor)](js-apis-application-abilityMonitor.md) - - application/[AbilityRunningInfo (AbilityRunningInfo)](js-apis-abilityrunninginfo.md) - - application/[AbilityStageContext (AbilityStageContext)](js-apis-abilitystagecontext.md) - - application/[Context (Context)](js-apis-application-context.md) - - application/[ExtensionContext (ExtensionContext)](js-apis-extension-context.md) - - application/[ExtensionRunningInfo (ExtensionRunningInfo)](js-apis-extensionrunninginfo.md) - - application/[FormExtensionContext (FormExtensionContext)](js-apis-formextensioncontext.md) - - application/[MissionSnapshot (MissionSnapshot)](js-apis-application-MissionSnapshot.md) - - application/[PermissionRequestResult (PermissionRequestResult)](js-apis-permissionrequestresult.md) - - application/[ProcessRunningInfo (ProcessRunningInfo)](js-apis-processrunninginfo.md) - - application/[ServiceExtensionContext (ServiceExtensionContext)](js-apis-service-extension-context.md) - - application/[shellCmdResult (ShellCmdResult)](js-apis-application-shellCmdResult.md) - - application/[MissionInfo (MissionInfo)](js-apis-application-missionInfo.md) + - FA模型 + - [@ohos.ability.featureAbility (FeatureAbility模块)](js-apis-featureAbility.md) + - [@ohos.ability.particleAbility (particleAbility模块)](js-apis-particleAbility.md) + - ability/[dataAbilityHelper (DataAbilityHelper模块)](js-apis-dataAbilityHelper.md) + - app/[context (Context模块)](js-apis-Context.md) + - Stage模型 + - [@ohos.application.Ability (Ability)](js-apis-application-ability.md) + - [@ohos.application.AbilityConstant (AbilityConstant)](js-apis-application-abilityConstant.md) + - [@ohos.application.AbilityStage (AbilityStage)](js-apis-application-abilitystage.md) + - [@ohos.application.abilityLifecycleCallback (AbilityLifecycleCallback)](js-apis-application-abilityLifecycleCallback.md) + - [@ohos.application.DataShareExtensionAbility (数据共享扩展能力)](js-apis-application-DataShareExtensionAbility.md) + - [@ohos.application.FormExtension (FormExtension)](js-apis-formextension.md) + - [@ohos.application.ServiceExtensionAbility (ServiceExtensionAbility)](js-apis-service-extension-ability.md) + - [@ohos.application.StartOptions (StartOptions)](js-apis-application-StartOptions.md) + - [@ohos.application.StaticSubscriberExtensionAbility (StaticSubscriberExtensionAbility)](js-apis-application-staticSubscriberExtensionAbility.md) + - [@ohos.application.WindowExtensionAbility (窗口扩展能力)](js-apis-application-WindowExtensionAbility.md) + - application/[AbilityContext (AbilityContext)](js-apis-ability-context.md) + - application/[ApplicationContext (ApplicationContext)](js-apis-application-applicationContext.md) + - application/[AbilityStageContext (AbilityStageContext)](js-apis-abilitystagecontext.md) + - application/[Context (Context)](js-apis-application-context.md) + - application/[ExtensionContext (ExtensionContext)](js-apis-extension-context.md) + - application/[FormExtensionContext (FormExtensionContext)](js-apis-formextensioncontext.md) + - application/[PermissionRequestResult (PermissionRequestResult)](js-apis-permissionrequestresult.md) + - application/[ServiceExtensionContext (ServiceExtensionContext)](js-apis-service-extension-context.md) + - 通用 + - [@ohos.ability.dataUriUtils (DataUriUtils模块)](js-apis-DataUriUtils.md) + - [@ohos.ability.errorCode (ErrorCode)](js-apis-ability-errorCode.md) + - [@ohos.ability.wantConstant (wantConstant)](js-apis-ability-wantConstant.md) + - [@ohos.application.abilityDelegatorRegistry (AbilityDelegatorRegistry)](js-apis-abilityDelegatorRegistry.md) + - [@ohos.application.appManager (appManager)](js-apis-appmanager.md) + - [@ohos.application.Configuration (Configuration)](js-apis-configuration.md) + - [@ohos.application.ConfigurationConstant (ConfigurationConstant)](js-apis-configurationconstant.md) + - [@ohos.application.formBindingData (卡片数据绑定类)](js-apis-formbindingdata.md) + - [@ohos.application.formError (FormError)](js-apis-formerror.md) + - [@ohos.application.formHost (FormHost)](js-apis-formhost.md) + - [@ohos.application.formInfo (FormInfo)](js-apis-formInfo.md) + - [@ohos.application.missionManager (missionManager)](js-apis-missionManager.md) + - [@ohos.application.formProvider (FormProvider)](js-apis-formprovider.md) + - [@ohos.application.Want (Want)](js-apis-application-Want.md) + - [@ohos.wantAgent (WantAgent模块)](js-apis-wantAgent.md) + - application/[abilityDelegator (AbilityDelegator)](js-apis-application-abilityDelegator.md) + - application/[abilityDelegatorArgs (AbilityDelegatorArgs)](js-apis-application-abilityDelegatorArgs.md) + - application/[abilityMonitor (AbilityMonitor)](js-apis-application-abilityMonitor.md) + - application/[AbilityRunningInfo (AbilityRunningInfo)](js-apis-abilityrunninginfo.md) + - application/[ExtensionRunningInfo (ExtensionRunningInfo)](js-apis-extensionrunninginfo.md) + - application/[MissionSnapshot (MissionSnapshot)](js-apis-application-MissionSnapshot.md) + - application/[ProcessRunningInfo (ProcessRunningInfo)](js-apis-processrunninginfo.md) + - application/[shellCmdResult (ShellCmdResult)](js-apis-application-shellCmdResult.md) - 公共事件与通知 - [@ohos.commonEvent (公共事件模块)](js-apis-commonEvent.md) @@ -81,6 +82,7 @@ - [@ohos.uiAppearance(用户界面外观)](js-apis-uiappearance.md) - 图形图像 + - [@ohos.animation.windowAnimationManager (窗口动画管理)](js-apis-windowAnimationManager.md) - [@ohos.display (屏幕属性)](js-apis-display.md) - [@ohos.effectKit (图像效果)](js-apis-effectKit.md) - [@ohos.screen (屏幕)](js-apis-screen.md) diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md new file mode 100644 index 0000000000000000000000000000000000000000..dd960f8294fa7b03b3183bedb0431e73dfc29809 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md @@ -0,0 +1,307 @@ +# innerBundleManager模块(JS端SDK接口) + +本模块提供内部包的管理 + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +## 导入模块 + +``` +import innerBundleManager from '@ohos.bundle.innerBundleManager'; +``` + +## 系统能力 + +SystemCapability.BundleManager.BundleFramework + +## 权限列表 + +| 权限 | 权限等级 | 描述 | +| ------------------------------------------ | ------------ | ---------------------------- | +| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | 可查询所有应用信息 | +| ohos.permission.LISTEN_BUNDLE_CHANGE | system_grant | 允许该应用获取应用变化消息。 | + +权限等级参考[权限等级说明](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/accesstoken-overview.md#%E6%9D%83%E9%99%90%E7%AD%89%E7%BA%A7%E8%AF%B4%E6%98%8E) + +## innerBundleManager.getLauncherAbilityInfos + +getLauncherAbilityInfos(bundleName: string, userId: number, callback: AsyncCallback<Array<LauncherAbilityInfo>>) : void; + +以异步方法根据给定的包名获取LauncherAbilityInfos,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- | +| bundleName | string | 是 | 要查询的应用程序包名称。 | +| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | +| callback | AsyncCallback> | 是 | 程序启动作为入参的回调函数,返回程序信息。 | + + + +## innerBundleManager.getLauncherAbilityInfos + +getLauncherAbilityInfos(bundleName: string, userId: number) : Promise<Array<LauncherAbilityInfo>> + +以异步方法根据给定的包名获取LauncherAbilityInfos,使用Promise形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------ | ---- | ----------------------------------------------------- | +| bundleName | string | 是 | 要查询的应用程序包名称。 | +| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | ------------------------- | +| Promise\<[LauncherAbilityInfo](js-apis-bundle-LauncherAbilityInfo.md)> | Promise形式返回程序信息。 | + +## innerBundleManager.on + +on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback, callback: AsyncCallback<string>) : void; + +注册Callback。 + +**需要权限:** + +ohos.permission.LISTEN_BUNDLE_CHANGE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------------------- | --------------------- | ---- | ---------------------------------------------------- | +| type | "BundleStatusChange" | 是 | 指示应执行命令。 | +| bundleStatusCallback | BundleStatusCallback | 是 | 指示要注册的回调。 | +| callback | AsyncCallback | 是 | 程序启动作为入参的回调函数,返回正确结果或错误信息。 | + +## innerBundleManager.on + +on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback): Promise<string> + +注册Callback。 + +**需要权限:** + +ohos.permission.LISTEN_BUNDLE_CHANGE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------------------- | -------------------- | ---- | ------------------ | +| type | "BundleStatusChange" | 是 | 指示应执行命令。 | +| bundleStatusCallback | BundleStatusCallback | 是 | 指示要注册的回调。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------------------- | +| Promise | Promise形式返回正确结果或错误信息。 | + +## innerBundleManager.off + +off(type:"BundleStatusChange", callback: AsyncCallback<string>) : void; + +取消注册Callback。 + +**需要权限:** + +ohos.permission.LISTEN_BUNDLE_CHANGE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | --------------------- | ---- | ---------------------------------------------------- | +| type | "BundleStatusChange" | 是 | 指示应执行命令。 | +| callback | AsyncCallback | 是 | 程序启动作为入参的回调函数,返回正确结果或错误信息。 | + +## innerBundleManager.off + +off(type:"BundleStatusChange"): Promise<string> + +取消注册Callback。 + +**需要权限:** + +ohos.permission.LISTEN_BUNDLE_CHANGE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---- | -------------------- | ---- | ---------------- | +| type | "BundleStatusChange" | 是 | 指示应执行命令。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------------------- | +| Promise | Promise形式返回正确结果或错误信息。 | + +## innerBundleManager.getAllLauncherAbilityInfos + +getAllLauncherAbilityInfos(userId: number, callback: AsyncCallback<Array<LauncherAbilityInfo>>) : void; + +以异步方法根据给定的包名获取所有的LauncherAbilityInfos,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- | +| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | +| callback | AsyncCallback> | 是 | 程序启动作为入参的回调函数,返回程序信息。 | + +## innerBundleManager.getAllLauncherAbilityInfos + +getAllLauncherAbilityInfos(userId: number) : Promise<Array<LauncherAbilityInfo>> + +以异步方法根据给定的包名获取LauncherAbilityInfos,使用Promise形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ------ | ------ | ---- | ----------------------------------------------------- | +| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | ------------------------- | +| Promise\<[LauncherAbilityInfo](js-apis-bundle-LauncherAbilityInfo.md)> | Promise形式返回程序信息。 | + +## innerBundleManager.getShortcutInfos + +getShortcutInfos(bundleName :string, callback: AsyncCallback<Array<ShortcutInfo>>) : void; + +以异步方法根据给定的包名获取快捷方式信息,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------------------------------------------------------------ | ---- | ---------------------------------------------- | +| bundleName | string | 是 | 要查询的应用程序包名称。 | +| callback | AsyncCallback> | 是 | 程序启动作为入参的回调函数,返回快捷方式信息。 | + +## innerBundleManager.getShortcutInfos + +getShortcutInfos(bundleName : string) : Promise<Array<ShortcutInfo>> + +以异步方法根据给定的包名获取快捷方式信息,使用Promise形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------ | ---- | ------------------------ | +| bundleName | string | 是 | 要查询的应用程序包名称。 | + +**返回值:** + +| 类型 | 说明 | +| -------------------------------------------------------- | ----------------------------- | +| Promise\<[ShortcutInfo](js-apis-bundle-ShortcutInfo.md)> | Promise形式返回快捷方式信息。 | + diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md new file mode 100644 index 0000000000000000000000000000000000000000..c61db4e1cee986c12acceae451cc18995068b2da --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md @@ -0,0 +1,138 @@ +# distributedBundle模块(JS端SDK接口) + +本模块提供内部包的管理 + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +## 导入模块 + +``` +import distributedBundle from '@ohos.distributedBundle'; +``` + +## 系统能力 + +SystemCapability.BundleManager.DistributedBundleFramework + +## 权限列表 + +| 权限 | 权限等级 | 描述 | +| ------------------------------------------ | ------------ | ------------------ | +| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | 可查询所有应用信息 | + +权限等级参考[权限等级说明](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/accesstoken-overview.md#%E6%9D%83%E9%99%90%E7%AD%89%E7%BA%A7%E8%AF%B4%E6%98%8E) + +## distributedBundle.getRemoteAbilityInfo + +getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback<RemoteAbilityInfo>): void; + +以异步方法根据给定的包名获取有关远程设备AbilityInfo信息,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.DistributedBundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ----------- | ------------------------------------------------------------ | ---- | -------------------------------------------------- | +| elementName | [ElementName](js-apis-bundle-ElementName.md) | 是 | 获得的ElementName信息。 | +| callback | AsyncCallback<[RemoteAbilityInfo](js-apis-bundle-remoteAbilityInfo.md)> | 是 | 程序启动作为入参的回调函数,返回远程基本能力信息。 | + + + +## distributedBundle.getRemoteAbilityInfo + +getRemoteAbilityInfo(elementName: ElementName): Promise<RemoteAbilityInfo> + +以异步方法根据给定的包名获取有关远程设备AbilityInfo信息,使用Promise形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.DistributedBundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ----------- | -------------------------------------------- | ---- | ----------------------- | +| elementName | [ElementName](js-apis-bundle-ElementName.md) | 是 | 获得的ElementName信息。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | --------------------------------- | +| Promise\<[RemoteAbilityInfo]((js-apis-bundle-remoteAbilityInfo.md))> | Promise形式返回远程基本能力信息。 | + +## distributedBundle.getRemoteAbilityInfos + +getRemoteAbilityInfos(elementNames: Array<ElementName>, callback: AsyncCallback<Array<RemoteAbilityInfo>>): void; + +以异步方法根据给定的包名获取有关远程设备AbilityInfos信息,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.DistributedBundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ------------ | ------------------------------------------------------------ | ---- | -------------------------------------------------- | +| elementNames | Array<[ElementName](js-apis-bundle-ElementName.md)> | 是 | ElementName信息,最大数组长度为10 | +| callback | AsyncCallback< Array<[RemoteAbilityInfo](js-apis-bundle-remoteAbilityInfo.md)>> | 是 | 程序启动作为入参的回调函数,返回远程基本能力信息。 | + + + +## distributedBundle.getRemoteAbilityInfos + +getRemoteAbilityInfos(elementNames: Array<ElementName>): Promise<Array<RemoteAbilityInfo>> + +以异步方法根据给定的包名获取有关远程设备AbilityInfo信息,使用Promise形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.DistributedBundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ------------ | --------------------------------------------------- | ---- | ----------------------- | +| elementNames | Array<[ElementName](js-apis-bundle-ElementName.md)> | 是 | 获得的ElementName信息。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | --------------------------------- | +| Promise\> | Promise形式返回远程基本能力信息。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md index 45f2c957bafe33532b81c6b87f3a7c92d6a628d2..6e0963c0ff560b0737b6c1343524a9a56c5821b3 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md @@ -374,6 +374,466 @@ bundle.getBundleInfo(bundleName, bundleFlags, options, (err, data) => { }) ``` +## bundle.getBundleInstaller + +getBundleInstaller(): Promise<BundleInstaller>; + +获取用于安装包的接口 + +**需要权限:** + +ohos.permission.INSTALL_BUNDLE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | -------------------------------------------- | +| Promise<[BundleInstaller](js-apis-bundle-BundleInstaller.md)> | 返回值为Promise对象,Promise中包含安装信息。 | + +## bundle.getBundleInstaller + +getBundleInstaller(callback: AsyncCallback<BundleInstaller>): void; + +获取用于安装包的接口 + +**需要权限:** + +ohos.permission.INSTALL_BUNDLE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ------------------------------------------------------------ | ---- | ---------------- | +| callback | AsyncCallback<[BundleInstaller](js-apis-bundle-BundleInstaller.md)> | 是 | 安装应用程序包。 | + +## bundle.cleanBundleCacheFiles8+ + +cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback<void>): void; + +清除指定应用程序的缓存数据 + +**需要权限:** + +ohos.permission.REMOVE_CACHE_FILES + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------------------- | ---- | ------------------------------------- | +| bundleName | string | 是 | 指示要清除其缓存数据的应用程序包名称. | +| callback | AsyncCallback | 是 | 为返回操作结果而调用的回调。 | + +## bundle.cleanBundleCacheFiles8+ + +cleanBundleCacheFiles(bundleName: string): Promise<void> + +清除指定应用程序的缓存数据 + +**需要权限:** + +ohos.permission.REMOVE_CACHE_FILES + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------ | ---- | ------------------------------------- | +| bundleName | string | 是 | 指示要清除其缓存数据的应用程序包名称. | + +**返回值:** + +| 类型 | 说明 | +| ------------- | ------------------------------------ | +| Promise | 返回值为Promise对象,Promise中为空。 | + +## bundle.setApplicationEnabled8+ + +setApplicationEnabled(bundleName: string, isEnable: boolean, callback: AsyncCallback<void>): void; + +设置是否启用指定的应用程序 + +**需要权限:** + +ohos.permission.CHANGE_ABILITY_ENABLED_STATE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------------------- | ---- | ----------------------------------------------- | +| bundleName | string | 是 | 应用程序包名称。 | +| isEnable | boolean | 是 | 指定是否启用应用程序。true表示启用,false禁用。 | +| callback | AsyncCallback | 是 | 为返回操作结果而调用的回调。 | + +## bundle.setApplicationEnabled8+ + +setApplicationEnabled(bundleName: string, isEnable: boolean): Promise<void> + +设置是否启用指定的应用程序 + +**需要权限:** + +ohos.permission.CHANGE_ABILITY_ENABLED_STATE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------- | ---- | ----------------------------------------------- | +| bundleName | string | 是 | 应用程序包名称。 | +| isEnable | boolean | 是 | 指定是否启用应用程序。true表示启用,false禁用。 | + +**返回值:** + +| 类型 | 说明 | +| ------------- | ------------------------------------ | +| Promise | 返回值为Promise对象,Promise中为空。 | + +## bundle.setAbilityEnabled8+ + +setApplicationEnabled(bundleName: string, isEnable: boolean, callback: AsyncCallback<void>): void; + +设置是否启用指定的功能 + +**需要权限:** + +ohos.permission.CHANGE_ABILITY_ENABLED_STATE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | -------------------------------------------- | ---- | ----------------------------------------------- | +| info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | 是 | Ability信息。 | +| isEnable | boolean | 是 | 指定是否启用应用程序。true表示启用,false禁用。 | +| callback | AsyncCallback | 是 | 为返回操作结果而调用的回调。 | + +## bundle.setAbilityEnabled8+ + +setAbilityEnabled(info: AbilityInfo, isEnable: boolean): Promise<void> + +设置是否启用指定的功能 + +**需要权限:** + +ohos.permission.CHANGE_ABILITY_ENABLED_STATE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | -------------------------------------------- | ---- | ----------------------------------------------- | +| info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | 是 | Ability信息。 | +| isEnable | boolean | 是 | 指定是否启用应用程序。true表示启用,false禁用。 | + +**返回值:** + +| 类型 | 说明 | +| ------------- | ------------------------------------ | +| Promise | 返回值为Promise对象,Promise中为空。 | + +## bundle.getPermissionDef8+ + +getPermissionDef(permissionName: string, callback: AsyncCallback<PermissionDef>): void; + +按权限名称获取权限的详细信息 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------ | +| permissionName | string | 是 | 指定权限的名称。 | +| callback | AsyncCallback<[PermissionDef](js-apis-bundle-PermissionDef)> | 是 | 程序启动作为入参的回调函数,返回定义的权限信息。 | + +## bundle.getPermissionDef8+ + +getPermissionDef(permissionName: string): Promise<PermissionDef> + +按权限名称获取权限的详细信息 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------------- | ------ | ---- | ---------------- | +| permissionName | string | 是 | 指定权限的名称。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------ | ------------------------------------------------------ | +| Promise<[PermissionDef](js-apis-bundle-PermissionDef)> | 返回值为Promise对象,Promise中包含定义的权限信息对象。 | + +## bundle.setModuleUpgradeFlag9+ + +setModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag, callback: AsyncCallback<void>):void; + +设置模块是否需要升级 + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ----------- | --------------------------- | ---- | ---------------------------- | +| bundleName | string | 是 | 应用程序包名称。 | +| moduleName | string | 是 | 应用程序模块名称。 | +| upgradeFlag | [UpgradeFlag](#upgradeflag) | 是 | 仅供内部系统使用标志位 | +| callback | AsyncCallback | 是 | 为返回操作结果而调用的回调。 | + +## bundle.setModuleUpgradeFlag9+ + +setModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag): Promise<void> + +设置模块是否需要升级 + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ----------- | --------------------------- | ---- | ---------------------- | +| bundleName | string | 是 | 应用程序包名称。 | +| moduleName | string | 是 | 应用程序模块名称。 | +| upgradeFlag | [UpgradeFlag](#upgradeflag) | 是 | 仅供内部系统使用标志位 | + +**返回值:** + +| 类型 | 说明 | +| ------------- | ------------------------------------ | +| Promise | 返回值为Promise对象,Promise中为空。 | + +## bundle.isModuleRemovable9+ + +isModuleRemovable(bundleName: string, moduleName: string, callback: AsyncCallback<boolean>): void; + +检查指定模块是否被移除 + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ---------------------- | ---- | --------------------------------------------- | +| bundleName | string | 是 | 应用程序包名称。 | +| moduleName | string | 是 | 应用程序模块名称。 | +| callback | AsyncCallback | 是 | 程序启动作为入参的回调函数,返回boolean信息。 | + +## bundle.isModuleRemovable9+ + +isModuleRemovable(bundleName: string, moduleName: string): Promise<boolean> + +检查指定模块是否被移除 + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------ | ---- | ------------------ | +| bundleName | string | 是 | 应用程序包名称。 | +| moduleName | string | 是 | 应用程序模块名称。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ---------------------------- | +| Promise | Promise形式返回boolean信息。 | + +## bundle.getBundlePackInfo9+ + +getBundlePackInfo(bundleName: string, bundlePackFlag : pack.BundlePackFlag, callback: AsyncCallback<pack.BundlePackInfo>): void; + +基于bundleName和bundleFlags获取bundlePackInfo + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------------- | ---------------------------------- | ---- | ---------------------------------------------------- | +| bundleName | string | 是 | 应用程序包名称。 | +| bundlePackFlag | pack.BundlePackFlag | 是 | 指示要查询的应用包标志 | +| callback | AsyncCallback | 是 | 程序启动作为入参的回调函数,返回BundlePackInfo信息。 | + +## bundle.getBundlePackInfo9+ + +getBundlePackInfo(bundleName: string, bundlePackFlag : pack.BundlePackFlag): Promise<pack.BundlePackInfo>; + +基于bundleName和bundleFlags获取bundlePackInfo + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------------- | ------------------- | ---- | ---------------------- | +| bundleName | string | 是 | 应用程序包名称。 | +| bundlePackFlag | pack.BundlePackFlag | 是 | 指示要查询的应用包标志 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------- | ----------------------------------- | +| Promise | Promise形式返回BundlePackInfo信息。 | + +## bundle.getDispatcherVersion9+ + +getDispatcherVersion(callback: AsyncCallback<DispatchInfo>): void; + +获取有关dispatcher版本的信息 + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| callback | AsyncCallback<[DispatchInfo](js-apis-dispatchInfo.md)> | 是 | 程序启动作为入参的回调函数,返回[DispatchInfo](js-apis-dispatchInfo.md)信息。 | + +## bundle.getDispatcherVersion9+ + +getDispatcherVersion(): Promise<DispatchInfo>; + +获取有关dispatcher版本的信息 + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------ | ------------------------------------------------------------ | +| Promise<[DispatchInfo](js-apis-dispatchInfo.md)> | Promise形式返回[DispatchInfo](js-apis-dispatchInfo.md)信息。 | ## bundle.getAllApplicationInfo @@ -1693,6 +2153,8 @@ setDisposedStatus(bundleName: string, status: number, callback: AsyncCallback\; **系统能力:** SystemCapability.BundleManager.BundleFramework +**系统API:** 此接口为系统接口,三方应用不支持调用 + **参数:** | 名称 | 类型 | 必填 | 描述 | @@ -1753,12 +2217,12 @@ bundle.setDisposedStatus(bundleName, status).then(data=>{ getDisposedStatus(bundleName: string, callback: AsyncCallback\): void; -此接口为系统接口,以异步方法根据给定的bundleName来获取对应应用的处置状态,使用callback形式返回结果。 - **需要权限:** ohos.permission.MANAGE_DISPOSED_APP_STATUS **系统能力:** SystemCapability.BundleManager.BundleFramework +**系统API:** 此接口为系统接口,三方应用不支持调用 + **参数:** | 名称 | 类型 | 必填 | 描述 | @@ -1787,6 +2251,8 @@ getDisposedStatus(bundleName: string): Promise\; **系统能力:** SystemCapability.BundleManager.BundleFramework +**系统API:** 此接口为系统接口,三方应用不支持调用 + **参数:** | 名称 | 类型 | 必填 | 描述 | @@ -1897,15 +2363,15 @@ Ability类型 | LANDSCAPE | 无 | 屏幕方向--横屏 | | PORTRAIT | 无 | 屏幕方向--竖屏 | | FOLLOW_RECENT | 无 | 屏幕方向--紧跟上一个组件 | -| LANDSCAPE_INVERTED |无 | 屏幕方向--反向横屏 | -| PORTRAIT_INVERTED |无 | 屏幕方向--反向竖屏 | -| AUTO_ROTATION |无 | 屏幕方向--随传感器旋转 | -| AUTO_ROTATION_LANDSCAPE |无 | 屏幕方向--传感器横屏旋转,包括了横屏和反向横屏 | -| AUTO_ROTATION_PORTRAIT |无 | 屏幕方向--传感器竖屏旋转,包括了竖屏和反向竖屏 | -| AUTO_ROTATION_RESTRICTED |无 | 屏幕方向--传感器开关打开,方向可随传感器旋转 | -| AUTO_ROTATION_LANDSCAPE_RESTRICTED |无 | 屏幕方向--传感器开关打开,方向可随传感器旋转为横屏, 包括了横屏和反向横屏 | -| AUTO_ROTATION_PORTRAIT_RESTRICTED |无 | 屏幕方向--传感器开关打开,方向随可传感器旋转为竖屏, 包括了横屏和反向横屏 | -| LOCKED |无 | 屏幕方向--传感器开关关闭,方向锁定 | +| LANDSCAPE_INVERTED9+ |无 | 屏幕方向--反向横屏 | +| PORTRAIT_INVERTED9+ |无 | 屏幕方向--反向竖屏 | +| AUTO_ROTATION9+ |无 | 屏幕方向--随传感器旋转 | +| AUTO_ROTATION_LANDSCAPE9+ |无 | 屏幕方向--传感器横屏旋转,包括了横屏和反向横屏 | +| AUTO_ROTATION_PORTRAIT9+ |无 | 屏幕方向--传感器竖屏旋转,包括了竖屏和反向竖屏 | +| AUTO_ROTATION_RESTRICTED9+ |无 | 屏幕方向--传感器开关打开,方向可随传感器旋转 | +| AUTO_ROTATION_LANDSCAPE_RESTRICTED9+ |无 | 屏幕方向--传感器开关打开,方向可随传感器旋转为横屏, 包括了横屏和反向横屏 | +| AUTO_ROTATION_PORTRAIT_RESTRICTED9+ |无 | 屏幕方向--传感器开关打开,方向随可传感器旋转为竖屏, 包括了横屏和反向横屏 | +| LOCKED9+ |无 | 屏幕方向--传感器开关关闭,方向锁定 | ## LaunchMode 启动模式 @@ -1945,9 +2411,12 @@ ExtensionAbility的类型 | FILE_SHARE9+ | 6 | ExtensionAbility的类型包括文件共享 | | STATIC_SUBSCRIBER9+ | 7 | ExtensionAbility的类型包括订阅者 | | WALLPAPER9+ | 8 | ExtensionAbility的类型包括墙纸 | -| BACKUP9+ | 9 | ExtensionAbility的类型包括数据备份恢复 | +| BACKUP9+ | 9 | ExtensionAbility的类型包括数据备份恢复 | +| WINDOW9+ | 10 | ExtensionAbility的类型包括窗口类型扩展信息 | | ENTERPRISE_ADMIN9+ | 11 | ExtensionAbility的类型包括企业管理员 | -| UNSPECIFIED9+ | 20 | ExtensionAbility未指定类型 | +| THUMBNAIL9+ | 13 | ExtensionAbility的类型包括缩略图 | +| PREVIEW9+ | 14 | ExtensionAbility的类型包括预览 | +| UNSPECIFIED9+ | 255 | ExtensionAbility未指定类型 | ## ExtensionFlag9+ @@ -1994,6 +2463,20 @@ ExtensionAbility的类型 | 名称 | 类型 | 说明 | | ------------------ | ---- | ---- | -| FULLSCREEN | 无 | 全屏模式 | -| SPLIT | 无 | 分屏模式 | -| FLOATING | 无 | 悬浮模式 | +| FULL_SCREEN9+ | 0 | 全屏模式 | +| SPLIT9+ | 1 | 分屏模式 | +| FLOATING9+ | 2 | 悬浮模式 | + +## UpgradeFlag + +此项仅供内部系统使用 + +**系统API:**此接口为系统接口,三方应用不支持调用 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 值 | 说明 | +| ----------------------------- | ---- | ---------------- | +| NOT_UPGRADE9+ | 0 | 模块无需升级 | +| SINGLE_UPGRADE9+ | 1 | 单个模块需要升级 | +| RELATION_UPGRADE9+ | 2 | 关系模块需要升级 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-Context.md b/zh-cn/application-dev/reference/apis/js-apis-Context.md index f85c67797499cb5968532c13f0a50412a06f5b3c..3219356538209311c6f06e53b43842045f15a51c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-Context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Context.md @@ -296,6 +296,225 @@ context.getBundleName().then((data) => { }); ``` +## Context.getDisplayOrientation7+ + +getDisplayOrientation(callback: AsyncCallback\): void + +获取此能力的当前显示方向(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ---------------------- | ---- | ----------------------------- | +| callback | AsyncCallback\<[bundle.DisplayOrientation](js-apis-bundle.md#displayorientation)> | 是 | 表示屏幕显示方向。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.getDisplayOrientation() +``` + +## Context.getDisplayOrientation7+ + +getDisplayOrientation(): Promise\; + +获取此能力的当前显示方向(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------- | +| Promise\<[bundle.DisplayOrientation](js-apis-bundle.md#displayorientation)> | 表示屏幕显示方向。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.getDisplayOrientation().then((data) => { + console.info("=======================>getDisplayOrientationCallback====================>"); + console.info("====>data====>" + JSON.stringify(data)); +}); +``` + +## Context.setDisplayOrientation7+ + +setDisplayOrientation(orientation: bundle.DisplayOrientation, callback: AsyncCallback\): void + +设置当前能力的显示方向(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ---------------------- | ---- | ----------------------------- | +| orientation | [bundle.DisplayOrientation](js-apis-bundle.md#displayorientation) | 是 | 指示当前能力的新方向。。 | +| callback | AsyncCallback\<[bundle.DisplayOrientation](js-apis-bundle.md#displayorientation)> | 是 | 表示屏幕显示方向。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +import bundle from '@ohos.bundle' +var context = featureAbility.getContext(); +var orientation=bundle.DisplayOrientation.UNSPECIFIED +context.setDisplayOrientation(orientation, (err) => { + console.log('---------- setDisplayOrientation fail, err: -----------', err); +}); +``` + +## Context.setDisplayOrientation7+ + +setDisplayOrientation(orientation: bundle.DisplayOrientation): Promise\; + +设置当前能力的显示方向(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------- | +| orientation | [bundle.DisplayOrientation](js-apis-bundle.md#displayorientation) | 是 | 指示当前能力的新方向。。 | +| Promise\<[bundle.DisplayOrientation](js-apis-bundle.md#displayorientation)> | 表示屏幕显示方向。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +import bundle from '@ohos.bundle' +var context = featureAbility.getContext(); +var orientation=bundle.DisplayOrientation.UNSPECIFIED +context.setDisplayOrientation(orientation).then((data) => { + console.info("=======================>setDisplayOrientationCallback====================>"); + console.info("====>data====>" + JSON.stringify(data)); +}); +``` + +## Context.setShowOnLockScreen7+ + +setShowOnLockScreen(show: boolean, callback: AsyncCallback\): void + +设置每当显示锁屏时是否在锁屏顶部显示此功能,使该功能保持激活状态(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ---------------------- | ---- | ----------------------------- | +| show | boolean | 是 | 指定是否在锁屏顶部显示此功能。值true表示在锁屏上显示,值false表示不显示。 | +| callback | AsyncCallback\ | 是 | 返回回调结果。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +var show=true +context.setShowOnLockScreen(show, (err) => { + console.log('---------- setShowOnLockScreen fail, err: -----------', err); +}); +``` + +## Context.setShowOnLockScreen7+ + +setShowOnLockScreen(show: boolean): Promise\; + +设置每当显示锁屏时是否在锁屏顶部显示此功能,使该功能保持激活状态(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ---------------------- | ---- | ----------------------------- | +| show | boolean | 是 | 指定是否在锁屏顶部显示此功能。值true表示在锁屏上显示,值false表示不显示。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------- | +| Promise\| 使用Promise形式返回结果 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +var show=true +context.setShowOnLockScreen(show).then((data) => { + console.info("=======================>setShowOnLockScreenCallback====================>"); + console.info("====>data====>" + JSON.stringify(data)); +}); +``` + +## Context.setWakeUpScreen7+ + +setWakeUpScreen(wakeUp: boolean, callback: AsyncCallback\): void + +设置恢复此功能时是否唤醒屏幕。(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ---------------------- | ---- | ----------------------------- | +| wakeUp | boolean | 是 | 指定是否唤醒屏幕。值true表示唤醒它,值false表示不唤醒它。 | +| callback | AsyncCallback\ | 是 | 返回回调结果。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +var wakeUp=true +context.setWakeUpScreen(wakeUp, (err) => { + console.log('---------- setWakeUpScreen fail, err: -----------', err); +}); +``` + +## Context.setWakeUpScreen7+ + +setWakeUpScreen(wakeUp: boolean): Promise\; + +设置恢复此功能时是否唤醒屏幕。(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ---------------------- | ---- | ----------------------------- | +| wakeUp | boolean | 是 | 指定是否唤醒屏幕。值true表示唤醒它,值false表示不唤醒它。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------- | +| Promise\| 使用Promise形式返回结果 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +var wakeUp=true +context.setWakeUpScreen(wakeUp).then((data) => { + console.info("=======================>setWakeUpScreenCallback====================>"); + console.info("====>data====>" + JSON.stringify(data)); +}); +``` + + ## Context.getProcessInfo7+ @@ -728,7 +947,7 @@ getHapModuleInfo(callback: AsyncCallback\): void | 名称 | 类型 | 必填 | 描述 | | -------- | ---------------------- | ---- | ------------------------- | -| callback | AsyncCallback\<[HapModuleInfo](#hapmoduleinfo)> | 是 | 回调函数,可以在回调函数中处理接口返回值,返回应用的ModuleInfo对象。| +| callback | AsyncCallback\<[HapModuleInfo](js-apis-bundle-HapModuleInfo.md)> | 是 | 回调函数,可以在回调函数中处理接口返回值,返回应用的ModuleInfo对象。| **示例:** @@ -756,7 +975,7 @@ getHapModuleInfo(): Promise\ | 类型 | 说明 | | --------------- | ------------------------- | -| Promise\<[HapModuleInfo](#hapmoduleinfo)> | 返回应用的ModuleInfo对象。 | +| Promise\<[HapModuleInfo](js-apis-bundle-HapModuleInfo.md)> | 返回应用的ModuleInfo对象。 | **示例:** @@ -770,7 +989,7 @@ context.getHapModuleInfo().then((data) => { ## Context.getAppVersionInfo7+ -getAppVersionInfo(callback: AsyncCallback\): void +getAppVersionInfo(callback: AsyncCallback\): void 获取应用的版本信息(callback形式)。 @@ -893,10 +1112,115 @@ import featureAbility from '@ohos.ability.featureAbility' var context = featureAbility.getContext().getApplicationContext(); ``` -## PermissionOptions7+ +## Context.isUpdatingConfigurations7+ + +isUpdatingConfigurations(callback: AsyncCallback\): void; + +检查此能力的配置是否正在更改(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ---------------------- | ---- | ------------------------- | +| callback | AsyncCallback\ | 是 | 如果该能力的配置正在更改,则为true,否则为false。| + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.isUpdatingConfigurations((err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful. Data:' + JSON.stringify(data)); +}); +``` + +## Context.isUpdatingConfigurations7+ + +isUpdatingConfigurations(): Promise\; + +检查此能力的配置是否正在更改(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**返回值:** + +| 类型 | 说明 | +| --------------- | ------------------------- | +|Promise\ | 如果该能力的配置正在更改,则为true,否则为false。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.isUpdatingConfigurations().then((data) => { + console.info("====>data====>" + JSON.stringify(data)); +}); +``` + +## Context.printDrawnCompleted7+ + +printDrawnCompleted(callback: AsyncCallback\): void; + +通知系统绘制此页面功能所需的时间(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ---------------------- | ---- | ------------------------- | +| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。| + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.printDrawnCompleted((err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful. Data:' + JSON.stringify(data)); +}); +``` + +## Context.printDrawnCompleted7+ + +printDrawnCompleted(): Promise\; + +通知系统绘制此页面功能所需的时间(Promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core +**返回值:** + +| 类型 | 说明 | +| --------------- | ------------------------- | +|Promise\ | 以Promise形式返回结果。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.printDrawnCompleted().then((data) => { + console.info("====>data====>" + JSON.stringify(data)); +}); +``` + + +## PermissionOptions7+ + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core + | 名称 | 读写属性 | 类型 | 必填 | 描述 | | ---- | -------- | ------ | ---- | ------ | | pid | 只读 | number | 否 | 进程id。 | @@ -904,7 +1228,7 @@ var context = featureAbility.getContext().getApplicationContext(); ## PermissionRequestResult7+ -**系统能力**:SystemCapability.Ability.AbilityRuntime.Core +**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core | 名称 | 读写属性 | 类型 | 必填 | 描述 | | ----------- | -------- | -------------- | ---- | ------------------ | @@ -912,31 +1236,10 @@ var context = featureAbility.getContext().getApplicationContext(); | permissions | 只读 | Array\ | 是 | 用户传入的权限。 | | authResults | 只读 | Array\ | 是 | 请求权限的结果。 | -## HapModuleInfo7+ - -Hap模块信息 - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ------ | ------ | ------ | ------ | ------ | -| name | string | 是 | 否 | 模块名称。 | -| description | string | 是 | 否 | 模块描述信息。 | -| descriptionId | number | 是 | 否 | 描述信息ID。 | -| icon | string | 是 | 否 | 模块图标。 | -| label | string | 是 | 否 | 模块标签。 | -| labelId | number | 是 | 否 | 模块标签ID。 | -| iconId | number | 是 | 否 | 模块图标ID。 | -| backgroundImg | string | 是 | 否 | 模块背景图片。 | -| supportedModes | number | 是 | 否 | 模块支持的模式。 | -| reqCapabilities | Array\ | 是 | 否 | 模块运行需要的能力。 | -| deviceTypes | Array\ | 是 | 否 | 支持运行的设备类型。 | -| abilityInfo | Array\ | 是 | 否 | Ability信息。 | -| moduleName | string | 是 | 否 | 模块名。 | -| mainAbilityName | string | 是 | 否 | 入口Ability名称。 | -| installationFree | boolean | 是 | 否 | 是否支持免安装。 | -| mainElementName | string | 是 | 否 | 入口ability信息。 | - ## AppVersionInfo7+ +**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core + | 名称 | 类型 | 可读 | 可写 | 说明 | | ------ | ------ | ------| ------ | ------ | | appName | string | 是 | 否 | 模块名称。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-ability-context.md b/zh-cn/application-dev/reference/apis/js-apis-ability-context.md index 8b00de96a429eff67462bc5d2cdaf7bb5d447ecc..db88c9d3067846b7135fa205633522c4c7277470 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-ability-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-ability-context.md @@ -36,7 +36,7 @@ class MainAbility extends Ability { startAbility(want: Want, callback: AsyncCallback<void>): void -启动Ability。 +启动Ability(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -65,7 +65,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void -启动Ability。 +启动Ability(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -98,7 +98,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& startAbility(want: Want, options?: StartOptions): Promise<void>; -启动Ability。通过Promise返回结果。 +启动Ability(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -139,7 +139,7 @@ startAbility(want: Want, options?: StartOptions): Promise<void>; startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void; -启动Ability并在结束的时候返回执行结果。 +启动Ability并在结束的时候返回执行结果(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -167,7 +167,7 @@ startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void; -启动Ability并在结束的时候返回执行结果。 +启动Ability并在结束的时候返回执行结果(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -200,7 +200,7 @@ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>; -启动Ability并在结束的时候返回执行结果。 +启动Ability并在结束的时候返回执行结果(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -306,11 +306,11 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOp ``` - ## AbilityContext.startAbilityForResultWithAccount +## AbilityContext.startAbilityForResultWithAccount startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\; -启动一个Ability并在该Ability帐号销毁时返回执行结果(callback形式)。 +启动一个Ability并在该Ability帐号销毁时返回执行结果(promise形式)。 **需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS @@ -352,13 +352,277 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartO console.log('---------- startAbilityForResultWithAccount fail, err: -----------', err); }) ``` +## AbilityContext.startServiceExtensionAbility + +startServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; + +启动一个新的ServiceExtensionAbility(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + this.context.startServiceExtensionAbility(want, (err) => { + console.log('---------- startServiceExtensionAbility fail, err: -----------', err); + }); + ``` + +## AbilityContext.startServiceExtensionAbility + +startServiceExtensionAbility(want: Want): Promise\; + +启动一个新的ServiceExtensionAbility(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + this.context.startServiceExtensionAbility(want) + .then((data) => { + console.log('---------- startServiceExtensionAbility success, data: -----------', data); + }) + .catch((err) => { + console.log('---------- startServiceExtensionAbility fail, err: -----------', err); + }) + ``` +## AbilityContext.startServiceExtensionAbilityWithAccount + +startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void; + +启动一个新的ServiceExtensionAbility(callback形式)。 + +**需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| accountId | number | 是 | 需要启动的accountId。 | +| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + var accountId = 100; + this.context.startServiceExtensionAbilityWithAccount(want,accountId, (err) => { + console.log('---------- startServiceExtensionAbilityWithAccount fail, err: -----------', err); + }); + ``` + +## AbilityContext.startServiceExtensionAbilityWithAccount + +startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\; + +启动一个新的ServiceExtensionAbility(Promise形式)。 + +**需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| accountId | number | 是 | 需要启动的accountId。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + var accountId = 100; + this.context.startServiceExtensionAbilityWithAccount(want,accountId) + .then((data) => { + console.log('---------- startServiceExtensionAbilityWithAccount success, data: -----------', data); + }) + .catch((err) => { + console.log('---------- startServiceExtensionAbilityWithAccount fail, err: -----------', err); + }) + ``` +## AbilityContext.stopServiceExtensionAbility + +stopServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; + +停止同一应用程序内的服务(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + this.context.stopServiceExtensionAbility(want, (err) => { + console.log('---------- stopServiceExtensionAbility fail, err: -----------', err); + }); + ``` + +## AbilityContext.stopServiceExtensionAbility + +stopServiceExtensionAbility(want: Want): Promise\; + +停止同一应用程序内的服务(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + this.context.stopServiceExtensionAbility(want) + .then((data) => { + console.log('---------- stopServiceExtensionAbility success, data: -----------', data); + }) + .catch((err) => { + console.log('---------- stopServiceExtensionAbility fail, err: -----------', err); + }) + ``` + +## AbilityContext.stopServiceExtensionAbilityWithAccount +stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void; + +使用帐户停止同一应用程序内的服务(callback形式)。 + +**需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| accountId | number | 是 | 需要启动的accountId。 | +| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + var accountId = 100; + this.context.stopServiceExtensionAbilityWithAccount(want,accountId, (err) => { + console.log('---------- stopServiceExtensionAbilityWithAccount fail, err: -----------', err); + }); + ``` + +## AbilityContext.stopServiceExtensionAbilityWithAccount + +stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\; + +使用帐户停止同一应用程序内的服务(Promise形式)。 + +**需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| accountId | number | 是 | 需要启动的accountId。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + var accountId = 100; + this.context.stopServiceExtensionAbilityWithAccount(want,accountId) + .then((data) => { + console.log('---------- stopServiceExtensionAbilityWithAccount success, data: -----------', data); + }) + .catch((err) => { + console.log('---------- stopServiceExtensionAbilityWithAccount fail, err: -----------', err); + }) + ``` ## AbilityContext.terminateSelf terminateSelf(callback: AsyncCallback<void>): void; -停止Ability自身。 +停止Ability自身(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -381,7 +645,7 @@ terminateSelf(callback: AsyncCallback<void>): void; terminateSelf(): Promise<void>; -停止Ability自身。通过Promise返回结果。 +停止Ability自身(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -406,7 +670,7 @@ terminateSelf(): Promise<void>; terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void; -停止Ability,并返回给调用startAbilityForResult 接口调用方的相关信息。 +停止Ability,并返回给调用startAbilityForResult 接口调用方的相关信息(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -435,7 +699,7 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<voi terminateSelfWithResult(parameter: AbilityResult): Promise<void>; -停止Ability,并返回给调用startAbilityForResult 接口相关信息。 +停止Ability,并返回给调用startAbilityForResult 接口调用方的相关信息(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -468,7 +732,7 @@ terminateSelfWithResult(parameter: AbilityResult): Promise<void>; connectAbility(want: Want, options: ConnectOptions): number; -使用AbilityInfo.AbilityType.SERVICE模板将当前能力连接到一个能力。 +使用AbilityInfo.AbilityType.SERVICE模板将当前Ability连接到一个Ability。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -509,7 +773,7 @@ connectAbility(want: Want, options: ConnectOptions): number; connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; -使用AbilityInfo.AbilityType.SERVICE模板和account将当前能力连接到一个能力。 +使用AbilityInfo.AbilityType.SERVICE模板和account将当前Ability连接到一个Ability。 **需要权限:** ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS @@ -553,7 +817,7 @@ connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions disconnectAbility(connection: number): Promise\; -已成功连接接口。 +断开连接(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -563,7 +827,7 @@ disconnectAbility(connection: number): Promise\; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| connection | number | 是 | 连接的能力的数字代码。 | +| connection | number | 是 | 连接的Ability的数字代码。 | **返回值:** @@ -586,7 +850,7 @@ disconnectAbility(connection: number): Promise\; disconnectAbility(connection: number, callback:AsyncCallback\): void; -已成功连接接口。 +断开连接(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -596,7 +860,7 @@ disconnectAbility(connection: number, callback:AsyncCallback\): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| connection | number | 是 | 连接的能力的数字代码。 | +| connection | number | 是 | 连接的Ability的数字代码。 | | callback | AsyncCallback\ | 是 | 表示指定的回调方法。 | **示例:** @@ -768,7 +1032,7 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): requestPermissionsFromUser(permissions: Array<string>, requestCallback: AsyncCallback<PermissionRequestResult>) : void; -拉起弹窗请求用户授权。 +拉起弹窗请求用户授权(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -794,7 +1058,7 @@ requestPermissionsFromUser(permissions: Array<string>, requestCallback: As requestPermissionsFromUser(permissions: Array<string>) : Promise<PermissionRequestResult>; -拉起弹窗请求用户授权。通过Promise返回结果。 +拉起弹窗请求用户授权(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -827,7 +1091,7 @@ requestPermissionsFromUser(permissions: Array<string>) : Promise<Permis setMissionLabel(label: string, callback:AsyncCallback<void>): void; -设置ability在任务中显示的名称。 +设置ability在任务中显示的名称(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -851,7 +1115,7 @@ setMissionLabel(label: string, callback:AsyncCallback<void>): void; setMissionLabel(label: string): Promise<void> -设置ability在任务中显示的名称。 +设置ability在任务中显示的名称(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -880,7 +1144,7 @@ setMissionLabel(label: string): Promise<void> setMissionIcon(icon: image.PixelMap, callback:AsyncCallback\): void; -设置当前ability的任务标签。 +设置当前ability在任务中显示的图标(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -890,7 +1154,7 @@ setMissionIcon(icon: image.PixelMap, callback:AsyncCallback\): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| icon | image.PixelMap | 是 | 在最近的任务中显示的能力图标。 | +| icon | image.PixelMap | 是 | 在最近的任务中显示的ability图标。 | | callback | AsyncCallback\ | 是 | 指定的回调函数的结果。 | **示例:** @@ -922,7 +1186,7 @@ setMissionIcon(icon: image.PixelMap, callback:AsyncCallback\): void; setMissionIcon(icon: image.PixelMap): Promise\; -设置当前ability的任务标签。 +设置当前ability在任务中显示的图标(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -932,7 +1196,7 @@ setMissionIcon(icon: image.PixelMap): Promise\; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| icon | image.PixelMap | 是 | 在最近的任务中显示的能力图标。 | +| icon | image.PixelMap | 是 | 在最近的任务中显示的ability图标。 | **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-ability-wantConstant.md b/zh-cn/application-dev/reference/apis/js-apis-ability-wantConstant.md index 12d235ff4d1f2fce3a3ebc99ddc8ea270a57867b..f337e932bc72270abe300a5ce03e0eb1ab072354 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-ability-wantConstant.md +++ b/zh-cn/application-dev/reference/apis/js-apis-ability-wantConstant.md @@ -46,6 +46,8 @@ want操作的常数。 | ACTION_FILE_SELECT7+ | ohos.action.fileSelect | 指示选择文件的操作。 | | PARAMS_STREAM7+ | ability.params.stream | 指示与连接发送数据一起使用时,包含与意图相关联的数据流的URI。 | | ACTION_APP_ACCOUNT_OAUTH 8+ | ohos.account.appAccount.action.oauth | 指示提供oauth服务的操作。 | +| ACTION_MARKER_DOWNLOAD 9+ | ohos.want.action.marketDownload | 表示从应用程序市场下载应用程序的的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | + ## wantConstant.Entity diff --git a/zh-cn/application-dev/reference/apis/js-apis-accessibility-extension-context.md b/zh-cn/application-dev/reference/apis/js-apis-accessibility-extension-context.md new file mode 100644 index 0000000000000000000000000000000000000000..a9c61d030a405cc3c6d4dd1eb574f733a4936303 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-accessibility-extension-context.md @@ -0,0 +1,238 @@ +# AccessibilityExtensionContext + +AccessibilityExtensionContext是AccessibilityExtensionAbility上下文环境,继承自ExtensionContext。 + +AccessibilityExtensionContext模块提供扩展的上下文的能力,包括允许配置辅助应用关注信息类型、查询节点信息、手势注入等。 + +> **说明:** +> +> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块接口仅可在Stage模型下使用。 + +## 导入模块 + +```js +import AccessibilityExtensionAbility from './@ohos.application.AccessibilityExtensionAbility' +``` + +## FocusDirection + +表示查询下一焦点元素的方向。 + +**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core + +| 名称 | 描述 | +| -------- | -------- | +| up | 表示向上查询。 | +| down | 表示向上查询。 | +| left | 表示向左查询。 | +| right | 表示向右查询。 | +| forward | 表示向前查询。 | +| backward | 表示向后查询。 | + +## FocusType + +表示查询焦点元素的类型。 + +**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core + +| 名称 | 描述 | +| -------- | -------- | +| accessibility | 表示无障碍的焦点类型。 | +| normal | 表示普通的焦点类型。 | + +## Rect + +表示矩形区域。 + +**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core + +### 参数 + +| 名称 | 参数类型 | 可读 | 可写 | 说明 | +| ------ | -------- | ---- | ---- | ------------------ | +| left | number | 是 | 否 | 矩形区域的左边界。 | +| top | number | 是 | 否 | 矩形区域的上边界。 | +| width | number | 是 | 否 | 矩形区域的宽度。 | +| height | number | 是 | 否 | 矩形区域的高度。 | + +## WindowType + +表示窗口的类型。 + +**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core + +| 名称 | 描述 | +| -------- | -------- | +| application | 表示应用窗口类型。 | +| system | 表示系统窗口类型。 | + +## AccessibilityExtensionContext.setEventTypeFilter + +setEventTypeFilter(type: Array): Promise\; + +设置关注的事件类型。 + +**系统能力:** SystemCapability.BarrierFree.Accessibility.Core + +**参数:** + +| 参数名 | 参数类型 | 必填 | 说明 | +| ----- | ------ | ------ | ------ | +| type | Array<[EventType](js-apis-accessibility.md#EventType)> | 是 | 关注的事件类型。 | + +**返回值:** + +| 类型 | 说明 | +| -------------------------------- | --------------------------------------- | +| Promise<boolean> | Promise对象。返回当前设置是否成功。 | + +**示例:** + +```ts +this.context.setEventTypeFilter(['click', 'longClick']); +``` + +## AccessibilityExtensionContext.setTargetBundleName + +setTargetBundleName(targetNames: Array\): Promise\; + +设置关注的事件类型。 + +**系统能力:** SystemCapability.BarrierFree.Accessibility.Core + +**参数:** + +| 参数名 | 参数类型 | 必填 | 说明 | +| ----- | ------ | ------ | ------ | +| targetNames | Array<string> | 是 | 关注的目标包名。 | + +**返回值:** + +| 类型 | 说明 | +| -------------------------------- | --------------------------------------- | +| Promise<boolean> | Promise对象。返回当前设置是否成功。 | + +**示例:** + +```ts +this.context.setTargetBundleName(['com.ohos.mms']); +``` + +## AccessibilityExtensionContext.getFocusElement + +getFocusElement(isAccessibilityFocus?: boolean): Promise\; + +获取焦点元素。 + +**系统能力:** SystemCapability.BarrierFree.Accessibility.Core + +**参数:** + +| 参数名 | 参数类型 | 必填 | 说明 | +| ----- | ------ | ------ | ------ | +| isAccessibilityFocus | boolean | 否 | 获取的是否是无障碍焦点元素,默认为否。 | + +**返回值:** + +| 类型 | 说明 | +| -------------------------------- | --------------------------------------- | +| Promise<AccessibilityElement> | Promise对象。返回当前对应的焦点元素。 | + +**示例:** + +```ts +this.context.getFocusElement().then(focusElement => { + console.log("AxExtensionAbility getFocusElement success"); +}) +``` + +## AccessibilityExtensionContext.getWindowRootElement + +getWindowRootElement(windowId?: number): Promise\; + +获取窗口的根节点元素。 + +**系统能力:** SystemCapability.BarrierFree.Accessibility.Core + +**参数:** + +| 参数名 | 参数类型 | 必填 | 说明 | +| ----- | ------ | ------ | ------ | +| windowId | number | 否 | 指定获取根节点元素的窗口,未指定则从当前活跃窗口获取。 | + +**返回值:** + +| 类型 | 说明 | +| -------------------------------- | --------------------------------------- | +| Promise<AccessibilityElement> | Promise对象。返回当前对应的根节点元素。 | + +**示例:** + +```ts +this.context.getWindowRootElement().then(rootElement => { + console.log("AxExtensionAbility getWindowRootElement success"); +}) +``` + +## AccessibilityExtensionContext.getWindows + +getWindows(displayId?: number): Promise>; + +获取用户可见的窗口列表。 + +**系统能力:** SystemCapability.BarrierFree.Accessibility.Core + +**参数:** + +| 参数名 | 参数类型 | 必填 | 说明 | +| ----- | ------ | ------ | ------ | +| displayId | number | 否 | 指定获取窗口信息的屏幕,未指定则从默认主屏幕获取。 | + +**返回值:** + +| 类型 | 说明 | +| -------------------------------- | --------------------------------------- | +| Promise<Array<AccessibilityElement>> | Promise对象。返回当前对应的窗口列表信息。 | + +**示例:** + +```ts +this.context.getWindows().then(windows => { + console.log("AxExtensionAbility getWindows success"); +}) +``` + +## AccessibilityExtensionContext.gestureInject + +gestureInject(gesturePath: GesturePath, listener: Callback\): Promise\ { + console.info('gestureInject result: ' + result); +}) +``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-accessibility.md b/zh-cn/application-dev/reference/apis/js-apis-accessibility.md index b10175b813f6d459b0033aab306c00ba31138c3e..51cc75843d30c60cdbc333fbdcf17c08ee12b4dd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-accessibility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-accessibility.md @@ -1,5 +1,7 @@ # 辅助功能 +本模块提供辅助功能查询能力,包括获取辅助应用列表、辅助应用启用状态、无障碍字幕配置等。 + > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 本模块首批接口从 API version 7 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 @@ -13,7 +15,7 @@ import accessibility from '@ohos.accessibility'; 辅助应用状态类型。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core | 名称 | 描述 | | -------- | -------- | @@ -25,7 +27,7 @@ import accessibility from '@ohos.accessibility'; 无障碍辅助应用类型。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core | 名称 | 描述 | | -------- | -------- | @@ -34,12 +36,13 @@ import accessibility from '@ohos.accessibility'; | haptic | 表示具有触觉反馈。 | | spoken | 表示具有语音反馈。 | | visual | 表示具有视觉反馈。 | +| all9+ | 表示以上所有类别。 | ## AccessibilityAbilityInfo 辅助应用信息。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core ### 属性 @@ -48,6 +51,7 @@ import accessibility from '@ohos.accessibility'; | id | number | 是 | 否 | ability id。 | | name | string | 是 | 否 | ability 名。 | | bundleName | string | 是 | 否 | 包名。 | +| targetBundleNames9+ | Array<string> | 是 | 否 | 关注的目标包名。 | | abilityTypes | Array<[AbilityType](#abilitytype)> | 是 | 否 | 辅助应用类型。 | | capabilities | Array<[Capability](#capability)> | 是 | 否 | 辅助应用能力列表。 | | description | string | 是 | 否 | 辅助应用描述。 | @@ -57,7 +61,7 @@ import accessibility from '@ohos.accessibility'; 应用所支持的目标动作。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core | 名称 | 描述 | | -------- | -------- | @@ -82,7 +86,7 @@ import accessibility from '@ohos.accessibility'; 辅助应用能力类型。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core | 名称 | 描述 | | -------- | -------- | @@ -96,7 +100,7 @@ import accessibility from '@ohos.accessibility'; 字幕字体边缘类型。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Hearing +**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Hearing | 名称 | 描述 | | -------- | -------- | @@ -110,7 +114,7 @@ import accessibility from '@ohos.accessibility'; 字幕字体。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Hearing +**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Hearing | 名称 | 描述 | | -------- | -------- | @@ -127,7 +131,7 @@ import accessibility from '@ohos.accessibility'; 字幕风格。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Hearing +**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Hearing | 名称 | 参数类型 | 可读 | 可写 | 说明 | | -------- | -------- | -------- | -------- | -------- | @@ -159,7 +163,7 @@ on(type: 'enableChange', callback: Callback<boolean>): void; 注册字幕配置启用的监听函数。 -**系统能力**:SystemCapability.Barrierfree.Accessibility.Hearing +**系统能力**:SystemCapability.BarrierFree.Accessibility.Hearing - 参数: @@ -182,7 +186,7 @@ on(type: 'styleChange', callback: Callback<CaptionsStyle>): void; 注册字幕风格变化的监听函数。 -**系统能力**:SystemCapability.Barrierfree.Accessibility.Hearing +**系统能力**:SystemCapability.BarrierFree.Accessibility.Hearing - 参数: @@ -205,7 +209,7 @@ off(type: 'enableChange', callback?: Callback<boolean>): void; 移除字幕配置启用的监听函数。 -**系统能力**:SystemCapability.Barrierfree.Accessibility.Hearing +**系统能力**:SystemCapability.BarrierFree.Accessibility.Hearing - 参数: @@ -226,7 +230,7 @@ off(type: 'styleChange', callback?: Callback<CaptionsStyle>): void; 移除字幕风格变化的监听函数。 -**系统能力**:SystemCapability.Barrierfree.Accessibility.Hearing +**系统能力**:SystemCapability.BarrierFree.Accessibility.Hearing - 参数: @@ -245,7 +249,7 @@ off(type: 'styleChange', callback?: Callback<CaptionsStyle>): void; 界面变更事件。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core ### 属性 @@ -290,7 +294,7 @@ constructor(jsonObject) 无障碍事件类型。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core | 名称 | 描述 | | -------- | -------- | @@ -310,7 +314,7 @@ constructor(jsonObject) 文本无障碍导航移动粒度。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core | 名称 | 描述 | | -------- | -------- | @@ -324,7 +328,7 @@ constructor(jsonObject) 窗口变化类型。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core | 名称 | 描述 | | -------- | -------- | @@ -340,7 +344,7 @@ getAbilityLists(abilityType: AbilityType, stateType: AbilityState): Promise<A 查询辅助应用列表。 -**系统能力**:SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:SystemCapability.BarrierFree.Accessibility.Core - 参数: @@ -383,7 +387,7 @@ getAbilityLists(abilityType: AbilityType, stateType: AbilityState,callback: Asyn 查询辅助应用列表。 -**系统能力**:SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:SystemCapability.BarrierFree.Accessibility.Core - 参数: @@ -422,7 +426,7 @@ getCaptionsManager(): CaptionsManager 获取无障碍字幕配置。 -**系统能力**:SystemCapability.Barrierfree.Accessibility.Hearing +**系统能力**:SystemCapability.BarrierFree.Accessibility.Hearing - 返回值: @@ -448,7 +452,7 @@ on(type: 'accessibilityStateChange' | 'touchGuideStateChange', callback: Callbac | 参数名 | 参数类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | type | string | 是 | 监听的事件类型。
- type 为'accessibilityStateChange'时表示监听类型为辅助功能启用状态变化监听;
**系统能力**:SystemCapability.Barrierfree.Accessibility.Core
- type 为'touchGuideStateChange'时表示监听类型为触摸浏览启用状态变化监听。
**系统能力**:SystemCapability.Barrierfree.Accessibility.Vision | + | type | string | 是 | 监听的事件类型。
- type 为'accessibilityStateChange'时表示监听类型为辅助功能启用状态变化监听;
**系统能力**:SystemCapability.BarrierFree.Accessibility.Core
- type 为'touchGuideStateChange'时表示监听类型为触摸浏览启用状态变化监听。
**系统能力**:SystemCapability.BarrierFree.Accessibility.Vision | | callback | Callback<boolean> | 是 | 回调函数,在启用状态变化时将状态通过此函数进行通知。 | - 示例 @@ -471,7 +475,7 @@ off(type: ‘accessibilityStateChange ’ | ‘touchGuideStateChange’, callbac | 参数名 | 参数类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | type | string | 否 | 监听的事件类型。
- type 为'accessibilityStateChange'时表示监听类型为辅助功能启用状态变化监听;
**系统能力**:SystemCapability.Barrierfree.Accessibility.Core
- type 为'touchGuideStateChange'时表示监听类型为触摸浏览启用状态变化监听。
**系统能力**:SystemCapability.Barrierfree.Accessibility.Vision | + | type | string | 否 | 监听的事件类型。
- type 为'accessibilityStateChange'时表示监听类型为辅助功能启用状态变化监听;
**系统能力**:SystemCapability.BarrierFree.Accessibility.Core
- type 为'touchGuideStateChange'时表示监听类型为触摸浏览启用状态变化监听。
**系统能力**:SystemCapability.BarrierFree.Accessibility.Vision | | callback | Callback<boolean> | 否 | 要取消的监听回调函数。 | - 示例 @@ -488,7 +492,7 @@ isOpenAccessibility(): Promise<boolean> 判断是否启用了辅助功能。 -**系统能力**:SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:SystemCapability.BarrierFree.Accessibility.Core - 返回值: @@ -513,7 +517,7 @@ isOpenAccessibility(callback: AsyncCallback<boolean>): void 判断是否启用了辅助功能。 -**系统能力**:SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:SystemCapability.BarrierFree.Accessibility.Core - 参数 @@ -539,7 +543,7 @@ isOpenTouchGuide(): Promise<boolean> 判断触摸浏览模式是否开启。 -**系统能力**:SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:SystemCapability.BarrierFree.Accessibility.Core - 返回值: @@ -564,7 +568,7 @@ isOpenTouchGuide(callback: AsyncCallback<boolean>): void 判断触摸浏览模式是否开启。 -**系统能力**:SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:SystemCapability.BarrierFree.Accessibility.Core - 参数 @@ -590,7 +594,7 @@ sendEvent(event: EventInfo): Promise<void> 发送无障碍事件。 -**系统能力**:SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:SystemCapability.BarrierFree.Accessibility.Core - 参数: @@ -621,7 +625,7 @@ sendEvent(event: EventInfo, callback: AsyncCallback<void>): void 发送无障碍事件。 -**系统能力**:SystemCapability.Barrierfree.Accessibility.Core +**系统能力**:SystemCapability.BarrierFree.Accessibility.Core - 参数: diff --git a/zh-cn/application-dev/reference/apis/js-apis-appAccount.md b/zh-cn/application-dev/reference/apis/js-apis-appAccount.md index 6104eeb9f27dcf9c9da172d6eb6ead4d3f0ac77f..da43ecfd8c1f9e62325002ce505da8d7ad4ce35b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-appAccount.md +++ b/zh-cn/application-dev/reference/apis/js-apis-appAccount.md @@ -89,7 +89,7 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback<void>) ### addAccount -addAccount(name: string, extraInfo: string): Promise<void> +addAccount(name: string, extraInfo?: string): Promise<void> 将此应用的帐号名或额外信息(能转换成string类型的其它信息)添加到帐号管理服务中,使用Promise方式异步返回结果。 @@ -100,7 +100,7 @@ addAccount(name: string, extraInfo: string): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | ---------------------------------------- | | name | string | 是 | 要添加的应用帐号名称。 | -| extraInfo | string | 是 | 要添加的应用帐号的额外信息(能转换成string类型的其它信息),额外信息不能是应用帐号的敏感信息(如应用账号密码)。 | +| extraInfo | string | 否 | 要添加的应用帐号的额外信息(能转换成string类型的其它信息),额外信息不能是应用帐号的敏感信息(如应用账号密码)。 | **返回值:** @@ -1696,7 +1696,7 @@ checkAccountLabels(name: string, owner: string, labels: Array<string>, cal | name | string | 是 | 应用帐户的名称。 | | owner | string | 是 | 应用帐户的所有者。| | labels | Array<string> | 是 | 标签数组。 | -| callback | AsyncCallback<void> | 是 | 检查结果的回调。 | +| callback | AsyncCallback<boolean> | 是 | 检查结果的回调。 | **示例:** @@ -1710,7 +1710,7 @@ checkAccountLabels(name: string, owner: string, labels: Array<string>, cal ### checkAccountLabels9+ -checkAccountLabels(name: string, owner: string, labels: Array<string>): Promise<void> +checkAccountLabels(name: string, owner: string, labels: Array<string>): Promise<boolean> 检查指定帐户是否具有特定的标签集合,使用Promise方式异步返回结果。 @@ -1771,7 +1771,7 @@ selectAccountsByOptions(options: SelectAccountsOptions, callback: AsyncCallback& ### selectAccountsByOptions9+ -selectAccountsByOptions(options: SelectAccountsOptions): Promise<void> +selectAccountsByOptions(options: SelectAccountsOptions): Promise<Array<AppAccountInfo>> 根据选项选择请求方可访问的帐户列表,使用Promise方式异步返回结果。 @@ -1836,7 +1836,7 @@ verifyCredential(name: string, owner: string, callback: AuthenticatorCallback): ### verifyCredential9+ -verifyCredential(name: string, owner: string, options, callback: AuthenticatorCallback): void; +verifyCredential(name: string, owner: string, options: VerifyCredentialOptions, callback: AuthenticatorCallback): void; 验证用户凭据,使用callback回调异步返回结果。 @@ -1952,10 +1952,11 @@ setAuthenticatorProperties(owner: string, options: SetPropertiesOptions, callbac **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。 -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------ | ---- | -------- | -| authType | string | 是 | 令牌的鉴权类型。 | -| token | string | 是 | 令牌的取值。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------- | ---- | ----------------- | +| authType | string | 是 | 令牌的鉴权类型。 | +| token | string | 是 | 令牌的取值。 | +| account | AppAccountInfo | 否 | 令牌所属的帐号信息。| ## AuthenticatorInfo8+ @@ -2011,21 +2012,21 @@ setAuthenticatorProperties(owner: string, options: SetPropertiesOptions, callbac **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。 -| 名称 | 默认值 | 说明 | -| ----------------------------- | ---------------------- | ------------- | -| ACTION_ADD_ACCOUNT_IMPLICITLY | "addAccountImplicitly" | 表示操作,隐式添加帐号。 | -| ACTION_AUTHENTICATE | "authenticate" | 表示操作,鉴权。 | -| KEY_NAME | "name" | 表示键名,应用帐号名称。 | -| KEY_OWNER | "owner" | 表示键名,应用帐号所有者。 | -| KEY_TOKEN | "token" | 表示键名,令牌。 | -| KEY_ACTION | "action" | 表示键名,操作。 | -| KEY_AUTH_TYPE | "authType" | 表示键名,鉴权类型。 | -| KEY_SESSION_ID | "sessionId" | 表示键名,会话标识。 | -| KEY_CALLER_PID | "callerPid" | 表示键名,调用方PID。 | -| KEY_CALLER_UID | "callerUid" | 表示键名,调用方UID。 | -| KEY_CALLER_BUNDLE_NAME | "callerBundleName" | 表示键名,调用方包名。 | -| KEY_REQUIRED_LABELS | "requiredLabels" | 表示键名,必需的标签。 | -| KEY_BOOLEAN_RESULT | "booleanResult" | 表示键名,布尔返回值。 | +| 名称 | 默认值 | 说明 | +| -------------------------------- | ---------------------- | ----------------------- | +| ACTION_ADD_ACCOUNT_IMPLICITLY | "addAccountImplicitly" | 表示操作,隐式添加帐号。 | +| ACTION_AUTHENTICATE | "authenticate" | 表示操作,鉴权。 | +| KEY_NAME | "name" | 表示键名,应用帐号名称。 | +| KEY_OWNER | "owner" | 表示键名,应用帐号所有者。| +| KEY_TOKEN | "token" | 表示键名,令牌。 | +| KEY_ACTION | "action" | 表示键名,操作。 | +| KEY_AUTH_TYPE | "authType" | 表示键名,鉴权类型。 | +| KEY_SESSION_ID | "sessionId" | 表示键名,会话标识。 | +| KEY_CALLER_PID | "callerPid" | 表示键名,调用方PID。 | +| KEY_CALLER_UID | "callerUid" | 表示键名,调用方UID。 | +| KEY_CALLER_BUNDLE_NAME | "callerBundleName" | 表示键名,调用方包名。 | +| KEY_REQUIRED_LABELS9+ | "requiredLabels" | 表示键名,必需的标签。 | +| KEY_BOOLEAN_RESULT9+ | "booleanResult" | 表示键名,布尔返回值。 | ## ResultCode8+ @@ -2124,7 +2125,7 @@ onRequestRedirected: (request: Want) => void ### onRequestContinued9+ -onRequestContinued: () => void +onRequestContinued?: () => void 通知请求被继续处理。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-AccessibilityExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-application-AccessibilityExtensionAbility.md new file mode 100644 index 0000000000000000000000000000000000000000..586b0c7e0b71b32a282cb8053593672cf3c98fd6 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-application-AccessibilityExtensionAbility.md @@ -0,0 +1,235 @@ +# 辅助功能扩展能力 + +**AccessibilityExtensionAbility**基于ExtensionAbility框架,提供辅助功能业务的能力。 + +>**说明:** +> +>本模块首批接口从API version 9开始支持,后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> +>本模块接口仅可在Stage模型下使用。 + +## 导入模块 + +```ts +import AccessibilityExtensionAbility from './@ohos.application.AccessibilityExtensionAbility' +``` + +## AccessibilityEvent + +辅助事件信息。 + +**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core + +### 属性 + +| 名称 | 参数类型 | 可读 | 可写 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| eventType | [EventType](js-apis-accessibility.md#EventType) \| [WindowUpdateType](js-apis-accessibility.md#WindowUpdateType) \| [TouchGuideType](touchguidetype) \| [GestureType](gesturetype) \| [PageUpdateType](pageupdatetype) | 是 | 否 | 具体事件类型。 | +| target | AccessibilityElement | 是 | 否 | 发生事件的目标组件。 | +| timeStamp | number | 是 | 否 | 事件时间戳。 | + +## GesturePath + +表示手势路径信息。 + +**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core + +### 属性 + +| 名称 | 参数类型 | 可读 | 可写 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| points | Array<[GesturePoint](gesturepoint)> | 是 | 是 | 手势。 | +| durationTime | number | 是 | 是 | 手势总耗时。 | + +### 方法 + +#### constructor + +constructor(durationTime: number) + +构造函数。 + +- 参数: + + | 参数名 | 参数类型 | 必填 | 说明 | + | -------- | -------- | -------- | -------- | + | durationTime | number | 是 | 手势总耗时。 | + +- 示例 + + ```typescript + let gesturePath = new GesturePath(100); + ``` + +## GesturePoint + +表示手势触摸点。 + +**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core + +### 属性 + +| 名称 | 参数类型 | 可读 | 可写 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| positionX | number | 是 | 是 | 触摸点X坐标。 | +| positionY | number | 是 | 是 | 触摸点Y坐标。 | + +### 方法 + +#### constructor + +constructor(positionX: number, positionY: number) + +构造函数。 + +- 参数: + + | 参数名 | 参数类型 | 必填 | 说明 | + | -------- | -------- | -------- | -------- | + | positionX | number | 是 | 触摸点X坐标。 | + | positionY | number | 是 | 触摸点Y坐标。 | + +- 示例 + + ```typescript + let gesturePoint = new GesturePoint(100, 200); + ``` + +## GestureType + +手势事件类型。 + +**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core + +| 名称 | 描述 | +| -------- | -------- | +| left | 表示向左的手势。 | +| leftThenRight | 表示先向左再向右的手势。 | +| leftThenUp | 表示先向左再向上的手势。 | +| leftThenDown | 表示先向左再向下的手势。 | +| right | 表示向右的手势。 | +| rightThenLeft | 表示先向右再向左的手势。 | +| rightThenUp | 表示先向右再向上的手势。 | +| rightThenDown | 表示先向右再向下的手势。 | +| up | 表示向上的手势。 | +| upThenLeft | 表示先向上再向左的手势。 | +| upThenRight | 表示先向上再向右的手势。 | +| upThenDown | 表示先向上再向下的手势。 | +| down | 表示向下的手势。 | +| downThenLeft | 表示先向下再向左的手势。 | +| downThenRight | 表示先向下再向右的手势。 | +| downThenUp | 表示先向下再向上的手势。 | + +## PageUpdateType + +页面刷新类型。 + +**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core + +| 名称 | 描述 | +| -------- | -------- | +| pageContentUpdate | 表示页面内容刷新。 | +| pageStateUpdate | 表示页面状态刷新。 | + +## TouchGuideType + +触摸浏览事件类型。 + +**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core + +| 名称 | 描述 | +| -------- | -------- | +| touchBegin | 表示触摸浏览时开始触摸。 | +| touchEnd | 表示触摸浏览时结束触摸。 | + +## AccessibilityExtensionAbility.onConnect + +onConnect(): void; + +用户启用AccessibilityExtensionAbility时,系统服务完成连接后,回调此接口,可以该方法中执行初始化业务逻辑操作。该方法可以选择性重写。 + +**系统能力:** SystemCapability.BarrierFree.Accessibility.Core + +**参数:** + +无 + +**示例:** + +```ts +onConnect(): void { + console.log("AxExtensionAbility onConnect"); +} +``` + +## AccessibilityExtensionAbility.onDisconnect + +onDisconnect(): void; + +用户停用AccessibilityExtensionAbility时,系统服务完成断开连接后,回调此接口,可以该方法中执行资源回收退出业务逻辑操作。该方法可以选择性重写。 + +**系统能力:** SystemCapability.BarrierFree.Accessibility.Core + +**参数:** + +无 + +**示例:** + +```ts +onDisconnect(): void { + console.log("AxExtensionAbility onDisconnect"); +} +``` + +## AccessibilityExtensionAbility.onAccessibilityEvent + +onAccessibilityEvent(event: AccessibilityEvent): void; + +在关注的应用及事件类型对应的事件发生时回调此接口,可以在该方法中根据事件信息进行业务逻辑处理。一般情况下需要重写该方法完成业务。 + +**系统能力:** SystemCapability.BarrierFree.Accessibility.Core + +**参数:** + +| 参数名 | 参数类型 | 必填 | 说明 | +| ----- | ------ | ------ | ------ | +| event | [AccessibilityEvent](accessibilityevent) | 是 | 无障碍事件回调函数。无返回值。 | + +**示例:** + +```ts +onAccessibilityEvent(event: AccessibilityEvent): void { + console.log("AxExtensionAbility onAccessibilityEvent"); + if (event.eventType == 'click') { + console.log("AxExtensionAbility onAccessibilityEvent: click"); + } +} +``` + +## AccessibilityExtensionAbility.onKeyEvent + +onKeyEvent(keyEvent: inputEventClient.KeyEvent): boolean; + +在物理按键按下时回调此方法,可以在该方法中根据业务判断是否对事件进行拦截。 + +**系统能力:** SystemCapability.BarrierFree.Accessibility.Core + +**参数:** + +| 参数名 | 参数类型 | 必填 | 说明 | +| ----- | ------ | ------ | ------ | +| keyEvent | [KeyEvent](js-apis-inputeventclient.md#KeyEvent) | 是 | 按键事件回调函数。返回true表示拦截此按键。 | + +**示例:** + +```ts +onKeyEvent(keyEvent: inputEventClient.KeyEvent): boolean { + console.log("AxExtensionAbility onKeyEvent"); + if (keyEvent.keyCode == 22) { + console.log("AxExtensionAbility onKeyEvent: intercept 22"); + return true; + } + return false; +} +``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md index 6411b3a2f1b6d0aa55f66d38b346f2b33e8a6a77..99309ea668135c9a5d08bfc61b53fc99b764f50c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md @@ -17,6 +17,14 @@ import DataShareExtensionAbility from '@ohos.application.DataShareExtensionAbility' ``` +## 属性 + +**系统能力**:SystemCapability.DistributedDataManager.DataShare.Provider + +| 名称 | 参数类型 | 可读 | 可写 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| context | [ExtensionContext](js-apis-extension-context.md) | 是 | 否 |表示数据共享扩展能力上下文。 | + ## onCreate onCreate?(want: Want, callback: AsyncCallback<void>): void @@ -44,20 +52,22 @@ let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS " + " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)"; let rdbStore; -onCreate(want: Want, callback: AsyncCallback) { - rdb.getRdbStore(this.context, { - name: DB_NAME - }, 1, function (err, data) { - console.log('getRdbStore done, data : ' + data); - rdbStore = data; - rdbStore.executeSql(DDL_TBL_CREATE, [], function (err) { - console.log('executeSql done, error message : ' + err); +export default class DataShareExtAbility extends DataShareExtensionAbility { + onCreate(want, callback) { + rdb.getRdbStore(this.context, { + name: DB_NAME + }, 1, function (err, data) { + console.log('getRdbStore done, data : ' + data); + rdbStore = data; + rdbStore.executeSql(DDL_TBL_CREATE, [], function (err) { + console.log('executeSql done, error message : ' + err); + }); + if (callback) { + callback(); + } }); - if (callback) { - callback(); - } - }); -} + } +}; ``` ## getFileTypes @@ -79,11 +89,13 @@ getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback<Ar **示例:** ```ts -getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback>) { - let err = {"code":0}; - let ret = new Array("type01", "type02", "type03"); - callback(err, ret); -} +export default class DataShareExtAbility extends DataShareExtensionAbility { + getFileTypes(uri, mimeTypeFilter, callback) { + let err = {"code":0}; + let ret = new Array("type01", "type02", "type03"); + callback(err, ret); + } +}; ``` ## openFile @@ -105,11 +117,13 @@ openFile?(uri: string, mode: string, callback: AsyncCallback<number>): voi **示例:** ```ts -openFile(uri: string, mode: string, callback: AsyncCallback) { - let err = {"code":0}; - let fd = 0; - callback(err,fd); -} +export default class DataShareExtAbility extends DataShareExtensionAbility { + openFile(uri, mode, callback) { + let err = {"code":0}; + let fd = 0; + callback(err,fd); + } +}; ``` ## insert @@ -131,18 +145,29 @@ insert?(uri: string, valueBucket: ValuesBucket, callback: AsyncCallback<numbe **示例:** ```ts -insert(uri: string, valueBucket: ValuesBucket, callback: AsyncCallback) { - if (value == null) { - console.info('invalid valueBuckets'); - return; - } - rdbStore.insert(TBL_NAME, value, function (err, ret) { - console.info('callback ret:' + ret); - if (callback != undefined) { - callback(err, ret); +import rdb from '@ohos.data.rdb'; + +let DB_NAME = "DB00.db"; +let TBL_NAME = "TBL00"; +let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS " ++ TBL_NAME ++ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)"; +let rdbStore; + +export default class DataShareExtAbility extends DataShareExtensionAbility { + insert(uri, valueBucket, callback) { + if (valueBucket == null) { + console.info('invalid valueBuckets'); + return; } - }); -} + rdbStore.insert(TBL_NAME, valueBucket, function (err, ret) { + console.info('callback ret:' + ret); + if (callback != undefined) { + callback(err, ret); + } + }); + } +}; ``` ## update @@ -165,16 +190,27 @@ update?(uri: string, predicates: dataSharePredicates.DataSharePredicates, valueB **示例:** ```ts -update(uri: string, predicates: dataSharePredicates.DataSharePredicates, valueBucket: ValuesBucket, callback: AsyncCallback) { - if (predicates == null || predicates == undefined) { - return; - } - rdbStore.update(TBL_NAME, value, predicates, function (err, ret) { - if (callback != undefined) { - callback(err, ret); +import rdb from '@ohos.data.rdb'; + +let DB_NAME = "DB00.db"; +let TBL_NAME = "TBL00"; +let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS " ++ TBL_NAME ++ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)"; +let rdbStore; + +export default class DataShareExtAbility extends DataShareExtensionAbility { + update(uri, predicates, valueBucket, callback) { + if (predicates == null || predicates == undefined) { + return; } - }); -} + rdbStore.update(TBL_NAME, valueBucket, predicates, function (err, ret) { + if (callback != undefined) { + callback(err, ret); + } + }); + } +}; ``` ## delete @@ -196,16 +232,27 @@ delete?(uri: string, predicates: dataSharePredicates.DataSharePredicates, callba **示例:** ```ts -delete(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback) { - if (predicates == null || predicates == undefined) { - return; - } - rdbStore.delete(TBL_NAME, predicates, function (err, ret) { - if (callback != undefined) { - callback(err, ret); +import rdb from '@ohos.data.rdb'; + +let DB_NAME = "DB00.db"; +let TBL_NAME = "TBL00"; +let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS " ++ TBL_NAME ++ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)"; +let rdbStore; + +export default class DataShareExtAbility extends DataShareExtensionAbility { + delete(uri, predicates, callback) { + if (predicates == null || predicates == undefined) { + return; } - }); -} + rdbStore.delete(TBL_NAME, predicates, function (err, ret) { + if (callback != undefined) { + callback(err, ret); + } + }); + } +}; ``` ## query @@ -228,19 +275,30 @@ query?(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns **示例:** ```ts -query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array, callback: AsyncCallback) { - if (predicates == null || predicates == undefined) { - return; - } - rdbStore.query(TBL_NAME, predicates, columns, function (err, resultSet) { - if (resultSet != undefined) { - console.info('resultSet.rowCount: ' + resultSet.rowCount); - } - if (callback != undefined) { - callback(err, resultSet); +import rdb from '@ohos.data.rdb'; + +let DB_NAME = "DB00.db"; +let TBL_NAME = "TBL00"; +let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS " ++ TBL_NAME ++ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)"; +let rdbStore; + +export default class DataShareExtAbility extends DataShareExtensionAbility { + query(uri, predicates, columns, callback) { + if (predicates == null || predicates == undefined) { + return; } - }); -} + rdbStore.query(TBL_NAME, predicates, columns, function (err, resultSet) { + if (resultSet != undefined) { + console.info('resultSet.rowCount: ' + resultSet.rowCount); + } + if (callback != undefined) { + callback(err, resultSet); + } + }); + } +}; ``` ## getType @@ -261,16 +319,18 @@ getType?(uri: string, callback: AsyncCallback<string>): void **示例:** ```ts -getType(uri: string, callback: AsyncCallback) { - let err = {"code":0}; - let ret = "image"; - callback(err, ret); -} +export default class DataShareExtAbility extends DataShareExtensionAbility { + getType(uri, callback) { + let err = {"code":0}; + let ret = "image"; + callback(err, ret); + } +}; ``` -## BatchInsert +## batchInsert -BatchInsert?(uri: string, valueBuckets: Array<ValuesBucket>, callback: AsyncCallback<number>): void +batchInsert?(uri: string, valueBuckets: Array<ValuesBucket>, callback: AsyncCallback<number>): void 在数据库批量插入时服务端回调此接口,该方法可以选择性重写。 @@ -287,20 +347,31 @@ BatchInsert?(uri: string, valueBuckets: Array<ValuesBucket>, callback: Asy **示例:** ```ts -batchInsert(uri: string, valueBuckets: Array, callback: AsyncCallback) { - if (valueBuckets == null || valueBuckets.length == undefined) { - console.info('invalid valueBuckets'); - return; - } - let resultNum = valueBuckets.length - valueBuckets.forEach(vb => { - rdbStore.insert(TBL_NAME, vb, function (err, ret) { - if (callback != undefined) { - callback(err, resultNum); - } +import rdb from '@ohos.data.rdb'; + +let DB_NAME = "DB00.db"; +let TBL_NAME = "TBL00"; +let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS " ++ TBL_NAME ++ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)"; +let rdbStore; + +export default class DataShareExtAbility extends DataShareExtensionAbility { + batchInsert(uri, valueBuckets, callback) { + if (valueBuckets == null || valueBuckets.length == undefined) { + console.info('invalid valueBuckets'); + return; + } + let resultNum = valueBuckets.length + valueBuckets.forEach(vb => { + rdbStore.insert(TBL_NAME, vb, function (err, ret) { + if (callback != undefined) { + callback(err, resultNum); + } + }); }); - }); -} + } +}; ``` ## normalizeUri @@ -321,11 +392,13 @@ normalizeUri?(uri: string, callback: AsyncCallback<string>): void **示例:** ```ts -normalizeUri(uri: string, callback: AsyncCallback) { - let err = {"code":0}; - let ret = "normalize+" + uri; - callback(err, ret); -} +export default class DataShareExtAbility extends DataShareExtensionAbility { + normalizeUri(uri, callback) { + let err = {"code":0}; + let ret = "normalize+" + uri; + callback(err, ret); + } +}; ``` ## denormalizeUri @@ -346,9 +419,11 @@ denormalizeUri?(uri: string, callback: AsyncCallback<string>): void **示例:** ```ts -denormalizeUri(uri: string, callback: AsyncCallback) { - let err = {"code":0}; - let ret = "denormalize+" + uri; - callback(err, ret); -} +export default class DataShareExtAbility extends DataShareExtensionAbility { + denormalizeUri(uri, callback) { + let err = {"code":0}; + let ret = "denormalize+" + uri; + callback(err, ret); + } +}; ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md index e8fa4ee743ba15459324de3ece7a6829d96d7192..1f7f75be6ffaa26d40de89879149f88bd7f81d4c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md @@ -1,5 +1,5 @@ # 窗口扩展能力 -WindowExtensionAbility基于ExtensionAbility,WindowExtensionAbility中展示的内容作为一个控件(AbilityComponent)内容展示在其他应用窗口中,实现在一个窗口中展示多个应用程序内容的功能。 +WindowExtensionAbility基于ExtensionAbility。WindowExtensionAbility中展示的内容可作为一个控件(AbilityComponent)内容展示在其他应用窗口中。 > **说明:** > @@ -7,7 +7,7 @@ WindowExtensionAbility基于ExtensionAbility,WindowExtensionAbility中展示 > > 本模块接口为系统接口。 > ->本模块接口仅可在Stage模型下使用。 +> 本模块接口仅可在Stage模型下使用。 ## 导入模块 @@ -17,7 +17,7 @@ import WindowExtensionAbility from '@ohos.application.WindowExtensionAbility'; ## 属性 -**系统能力:** SystemCapability.Ability.AbilityRuntime.Core +**系统能力:** SystemCapability.WindowManager.WindowManager.Core | 名称 | 参数类型 | 可读 | 可写 | 说明 | | --------- | -------- | ---- | ---- | ------------------------- | @@ -29,7 +29,7 @@ onConnect(want: Want): rpc.RemoteObject 当窗口扩展组件第一次连接ability时回调。 -**系统能力:** SystemCapability.Ability.AbilityRuntime.Core +**系统能力:** SystemCapability.WindowManager.WindowManager.Core | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | @@ -86,7 +86,7 @@ onDisconnect(want: Want): void 当所有连接到窗口扩展组件的ability断开连接时回调。 -**系统能力:** SystemCapability.Ability.AbilityRuntime.Core +**系统能力:** SystemCapability.WindowManager.WindowManager.Core | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | @@ -112,7 +112,7 @@ onWindowReady(window: Window): void 当窗口被创建时回调。 -**系统能力:** SystemCapability.Ability.AbilityRuntime.Core +**系统能力:** SystemCapability.WindowManager.WindowManager.Core | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegator.md b/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegator.md index fada27b850de9f6e3b4dcf1951a2f24bb755a728..b9f2671b47aadb433d38996a93195c64d378da44 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegator.md @@ -628,7 +628,7 @@ abilityDelegator.getCurrentTopAbility((err : any, data : any) => { -### printSync +### printSync9+ printSync(msg: string): void diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md b/zh-cn/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md index f220273cbfb22a312c7253d21c6df0b3044cbabc..40c41150c22f760f78e81ba284058bbb85900e43 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md @@ -11,7 +11,7 @@ AbilityLifecycleCallback模块提供应用上下文ApplicationContext的生命 ## 导入模块 ```js -import AbilityLifecycleCallback from "@ohos.application.abilityLifecycleCallback"; +import AbilityLifecycleCallback from "@ohos.application.AbilityLifecycleCallback"; ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-abilityManager.md b/zh-cn/application-dev/reference/apis/js-apis-application-abilityManager.md index 5e86a3af6fe71b6da688d16a5067d65afe994a1d..e49bb16733a7c5028e172f7d5f393bdf00bd778f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-abilityManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-abilityManager.md @@ -7,7 +7,7 @@ AbilityManager模块提供对Ability相关信息和状态信息进行获取、 > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口均为系统接口,三方应用不支持调用。 -# 导入模块 +## 导入模块 ```js import AbilityManager from '@ohos.application.abilityManager' diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-context.md b/zh-cn/application-dev/reference/apis/js-apis-application-context.md index 14d20ed469c29dfc7746238e8c11f22b2bfa3412..bcb6005cd25490b112d3f50de4382e498851a08b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-context.md @@ -27,7 +27,7 @@ import AbilityContext from '@ohos.application.Ability' **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core - | 名称 | 参数类型 | 可读 | 可写 | 说明 | +| 名称 | 参数类型 | 可读 | 可写 | 说明 | | -------- | -------- | -------- | -------- | -------- | | resourceManager | resmgr.ResourceManager; | 是 | 否 | ResourceManager对象。 | | applicationInfo | ApplicationInfo | 是 | 否 | 当前应用信息。 | @@ -47,8 +47,12 @@ createBundleContext(bundleName: string): Context; 创建指定应用上下文。 +**需要权限**:ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + **系统能力**:SystemCapability.Ability.AbilityRuntime.Core +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -117,6 +121,8 @@ createModuleContext(bundleName: string, moduleName: string): Context; **系统能力**:SystemCapability.Ability.AbilityRuntime.Core +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-appmanager.md b/zh-cn/application-dev/reference/apis/js-apis-appmanager.md index 84c6d3ed3a651a88a562c9d6a1b8278bf979e27b..c23fba3ad41639ac832219c4001dc34c8f699395 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-appmanager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-appmanager.md @@ -348,7 +348,7 @@ getForegroundApplications(callback: AsyncCallback\>): void; ## appManager.getForegroundApplications8+ -getProcessRunningInfos(): Promise\>; +getForegroundApplications(): Promise\>; 获取前台进程的应用程序。 @@ -588,6 +588,144 @@ clearUpApplicationData(bundleName: string): Promise\; ``` +## ApplicationStateObserver.onForegroundApplicationChanged8+ + +onForegroundApplicationChanged(appStateData: AppStateData): void; + +将在前台或后台应用程序更改时调用。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**:该接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| appStateData | [AppStateData](#appstatedata) | 否 | 状态更改的应用程序信息。 | + +**示例:** + +```js +import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver' +const foregroundApplicationInfo = ApplicationStateObserver.onForegroundApplicationChanged(); +console.log('-------- foregroundApplicationInfo: ---------', foregroundApplicationInfo); +``` + +## ApplicationStateObserver.onAbilityStateChanged8+ + +onAbilityStateChanged(abilityStateData: AbilityStateData): void; + +将在能力状态更改时调用。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**:该接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| abilityStateData | [AbilityStateData](#abilitystatedata) | 否 | 状态更改的能力信息。 | + +**示例:** + +```js +import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver' +const abilityStateChangedInfo = ApplicationStateObserver.onAbilityStateChanged(); +console.log('-------- abilityStateChangedInfo: ---------', abilityStateChangedInfo); +``` + +## ApplicationStateObserver.onProcessCreated8+ + +onProcessCreated(processData: ProcessData): void; + +将在创建进程时调用。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**:该接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| processData | [ProcessData](#processdata) | 否 | 进程信息。 | + +**示例:** + +```js +import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver' +const processCreatedInfo = ApplicationStateObserver.onProcessCreated(); +console.log('-------- processCreatedInfo: ---------', processCreatedInfo); +``` + +## ApplicationStateObserver.onProcessDied8+ + +onProcessDied(processData: ProcessData): void; + +将在进程终止时调用。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**:该接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| processData | ProcessData | 否 | 进程信息。 | + +**示例:** + +```js +import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver' +const processDiedInfo = ApplicationStateObserver.onProcessDied(); +console.log('-------- processDiedInfo: ---------', processDiedInfo); +``` + +## AppStateData + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core + +**系统API**:该接口为系统接口,三方应用不支持调用。 + +| 名称 | 读写属性 | 类型 | 必填 | 描述 | +| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | +| bundleName8+ | 只读 | string | 否 | 包名。 | +| uid8+ | 只读 | number | 否 | 用户ID。 | +| state8+ | 只读 | number | 否 | 进程信息。 | + +## AbilityStateData + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core + +**系统API**:该接口为系统接口,三方应用不支持调用。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------------------- | ---------| ---- | ---- | ------------------------- | +| pid8+ | number | 是 | 否 | 进程ID。 | +| bundleName8+ | string | 是 | 否 | 应用包名。 | +| abilityName8+ | string | 是 | 否 | Ability名称。 | +| uid8+ | number | 是 | 否 | 用户ID。 | +| state8+ | number | 是 | 否 | 应用程序信息。 | +| moduleName9+ | string | 是 | 否 | Ability所属的HAP包的名称。 | +| abilityType8+ | string | 是 | 否 | 能力类型、页面或服务等。 | + +## ProcessData + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Mission + +**系统API**:该接口为系统接口,三方应用不支持调用。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------------------- | ---------| ---- | ---- | ------------------------- | +| pid8+ | number | 是 | 否 | 进程ID。 | +| bundleName8+ | string | 是 | 否 | 应用包名。 | +| uid8+ | number | 是 | 否 | 用户ID。 | + + + ## ProcessRunningInfo **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core diff --git a/zh-cn/application-dev/reference/apis/js-apis-audio.md b/zh-cn/application-dev/reference/apis/js-apis-audio.md index 447df9f4cb228e42e98ba27916768b987d9b67d1..ae33129b7001defc3092ba04be06e3727e4b244c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-audio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-audio.md @@ -2276,7 +2276,43 @@ write(buffer: ArrayBuffer, callback: AsyncCallback\): void ``` import audio from '@ohos.multimedia.audio'; import fileio from '@ohos.fileio'; +import featureAbility from '@ohos.ability.featureAbility' +var audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW +} + +var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION + rendererFlags: 1 +} + +var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo +} +var audioRenderer; +audio.createAudioRenderer(audioRendererOptions).then((data)=> { + audioRenderer = data; + console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message); + }); +var bufferSize; +audioRenderer.getBufferSize().then((data)=> { + console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data); + bufferSize = data; + }).catch((err) => { + console.info.('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message); + }); +console.info('Buffer size:'+bufferSize); +var context = featureAbility.getContext(); +var path = await context.getCacheDir(); +var filePath = path+"/StarWars10s-2C-48000-4SW.wav" let ss = fileio.createStreamSync(filePath, 'r'); let buf = new ArrayBuffer(bufferSize); ss.readSync(buf); @@ -2308,7 +2344,42 @@ write(buffer: ArrayBuffer): Promise\ ``` import audio from '@ohos.multimedia.audio'; import fileio from '@ohos.fileio'; +import featureAbility from '@ohos.ability.featureAbility' + +var audioStreamInfo = { + samplingRate:audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels:audio.AudioChannel.CHANNEL_2, + sampleFormat.audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType.audio.AudioEncodingType.ENCODING_TYPE_RAW +} + +var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 +} +var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo +} +var audioRenderer; +audio.createAudioRenderer(audioRendererOptions).then((data) => { + audioRenderer = data; + console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message); + }); +var bufferSize; +audioRenderer.getBufferSize().then((data) => { + console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message); + }); +console.info('BufferSize: ' + bufferSize); +var context = featureAbility.getContext(); +var path = await context.getCacheDir(); var filePath = 'data/StarWars10s-2C-48000-4SW.wav'; let ss = fileio.createStreamSync(filePath, 'r'); let buf = new ArrayBuffer(bufferSize); @@ -2411,12 +2482,39 @@ getBufferSize(): Promise\ **示例:** ``` +import audio from '@ohos.multimedia.audio'; +import fileio from '@ohos.fileio'; + +var audioStreamInfo = { + samplingRate:audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels:audio.AudioChannel.CHANNEL_2, + sampleFormat.audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType.audio.AudioEncodingType.ENCODING_TYPE_RAW +} + +var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 +} + +var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo +} +var audioRenderer; +audio.createAudioRenderer(audioRendererOptions).then((data) => { + audioRenderer = data; + console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message); + }); var bufferSize; -await audioRenderer.getBufferSize().then(async function (data) => { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); +audioRenderer.getBufferSize().then((data) => { + console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data); bufferSize=data; }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); + console.info('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message); }); ``` @@ -2545,7 +2643,8 @@ setInterruptMode(interruptMode: InterruptMode): Promise<void> **示例:** ``` -audioManager.setInterruptMode(audio.InterruptType.SHARE_MODE).then(() => { +const audioManager = audio.getAudioManager(); +audioManager.setInterruptMode(audio.InterruptMode.SHARE_MODE).then(() => { console.log('Promise returned to indicate a successful volume setting.'); }); ``` @@ -2567,7 +2666,8 @@ setInterruptMode(interruptMode: InterruptMode, callback: Callback\): void **示例:** ``` -audioManager.setInterruptMode(audio.InterruptType.SHARE_MODE,()=>{ +const audioManager = audio.getAudioManager(); +audioManager.setInterruptMode(audio.InterruptMode.SHARE_MODE,()=>{ console.log('Callback returned to indicate a successful volume setting.'); }); ``` @@ -2657,7 +2757,7 @@ on(type: 'markReach', frame: number, callback: (position: number) => {}): void ``` audioRenderer.on('markReach', 1000, (position) => { - if (position == "1000") { + if (position == 1000) { console.log('ON Triggered successfully'); } }); @@ -2704,7 +2804,7 @@ on(type: "periodReach", frame: number, callback: (position: number) => {}): void ``` audioRenderer.on('periodReach', 1000, (position) => { - if (position == "1000") { + if (position == 1000) { console.log('ON Triggered successfully'); } }); @@ -2938,13 +3038,35 @@ start(): Promise **示例:** ``` +import audio from '@ohos.multimedia.audio'; +import fileio from '@ohos.fileio'; + +var audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW +} + +var audioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags = 1 +} + +var audioCapturer; +audio.createAudioCapturer(audioCapturerOptions).then((data) => { + audioCapturer = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created: ERROR: '+err.message); + }); audioCapturer.start().then(() => { console.info('AudioFrameworkRecLog: ---------START---------'); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info('AudioFrameworkRecLog: Capturer started: SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer: STATE: '+audioCapturer.state); + console.info('AudioFrameworkRecLog: Capturer started: SUCCESS '); if ((audioCapturer.state == audio.AudioState.STATE_RUNNING)) { - stateFlag = true; + console.info('AudioFrameworkRecLog: AudioCapturer is in Running State'); } }).catch((err) => { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); @@ -2997,15 +3119,13 @@ stop(): Promise ``` audioCapturer.stop().then(() => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); + console.info('AudioFrameworkRecLog: Capturer stopped: SUCCESS'); if ((audioCapturer.state == audio.AudioState.STATE_STOPPED)){ - stateFlag=true; - console.info('AudioFrameworkRecLog: resultFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: State is Stopped': '); } }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message); }); ``` @@ -3057,11 +3177,9 @@ audioCapturer.release().then(() => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state); - stateFlag=true; console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false + console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message); }); ``` @@ -3085,6 +3203,13 @@ read(size: number, isBlockingRead: boolean, callback: AsyncCallback { + console.info('AudioFrameworkRecLog: getBufferSize: SUCCESS '+data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRecLog: getBufferSize: EROOR: '+err.message); + }); audioCapturer.read(bufferSize, true, async(err, buffer) => { if (!err) { console.log("Success in reading the buffer data"); @@ -3117,6 +3242,14 @@ read(size: number, isBlockingRead: boolean): Promise **示例:** ``` +var bufferSize; +audioCapturer.getBufferSize().then((data) => { + console.info('AudioFrameworkRecLog: getBufferSize: SUCCESS '+data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRecLog: getBufferSize: ERROR '+err.message); + }); +console.info('Buffer size: ' + bufferSize); audioCapturer.read(bufferSize, true).then((buffer) => { console.info('buffer read successfully'); }).catch((err) => { @@ -3220,12 +3353,12 @@ getBufferSize(): Promise **示例:** ``` -await audioCapturer.getBufferSize().then(async function (bufferSize) { - console.info('AudioFrameworkRecordLog: getBufferSize :SUCCESS '+ bufferSize); - var buffer = await audioCapturer.read(bufferSize, true); - console.info('Buffer read is ' + buffer ); - }).catch((err) => { - console.info('AudioFrameworkRecordLog: getBufferSize :ERROR : '+err.message); +var bufferSize; +audioCapturer.getBufferSize().then((data) => { + console.info('AudioFrameworkRecLog: getBufferSize :SUCCESS '+ data); + bufferSize = data; +}).catch((err) => { + console.info('AudioFrameworkRecLog: getBufferSize :ERROR : '+ err.message); }); ``` @@ -3250,7 +3383,7 @@ on(type: 'markReach', frame: number, callback: (position: number) => {}): void ``` audioCapturer.on('markReach', 1000, (position) => { - if (position == "1000") { + if (position == 1000) { console.log('ON Triggered successfully'); } }); @@ -3296,7 +3429,7 @@ on(type: "periodReach", frame: number, callback: (position: number) => {}): void ``` audioCapturer.on('periodReach', 1000, (position) => { - if (position == "1000") { + if (position == 1000) { console.log('ON Triggered successfully'); } }); diff --git a/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md b/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md index 72df09a27aeea1ded115ce80ff357e4eb0be6258..41dd8c9708125432f2de8c2260bfb1fc908d6fa0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md @@ -145,7 +145,7 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want **参数**: | 参数名 | 类型 | 必填 | 说明 | | --------- | ---------------------------------- | ---- | ------------------------ | -| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 | +| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-Context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | | bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。 | | wantAgent | [WantAgent](js-apis-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击后跳转的界面。 | | callback | AsyncCallback<void> | 是 | callback形式返回启动长时任务的结果。 | @@ -197,7 +197,7 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want | 参数名 | 类型 | 必填 | 说明 | | --------- | ---------------------------------- | ---- | ----------------------- | -| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 | +| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-Context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | | bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。 | | wantAgent | [WantAgent](js-apis-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击跳转的界面。 | @@ -246,7 +246,7 @@ stopBackgroundRunning(context: Context, callback: AsyncCallback<void>): vo **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------- | ---- | ---------------------- | -| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 | +| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-Context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | | callback | AsyncCallback<void> | 是 | callback形式返回启动长时任务的结果。 | **示例**: @@ -277,7 +277,7 @@ stopBackgroundRunning(context: Context): Promise<void> **参数**: | 参数名 | 类型 | 必填 | 说明 | | ------- | ----------------------------- | ---- | --------- | -| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 | +| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-Context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | **返回值** | 类型 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md b/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md index ce7214ccc18f0fccef021cff0f346bd490fad497..b1899240d3f452cacd38fe2a4165d026933253ba 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md @@ -1837,7 +1837,7 @@ panProfile.off('connectionStateChange', onReceiveEvent); ### setTethering9+ -setTethering(value: boolean): boolean +setTethering(enable: boolean): void 设置网络共享状态。 @@ -1875,8 +1875,6 @@ isTetheringOn(): boolean 此接口为系统接口。 -**需要权限**:ohos.permission.DISCOVER_BLUETOOTH - **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **返回值:** @@ -2709,7 +2707,9 @@ client端获取蓝牙低功耗设备的所有服务,即服务发现。 ```js // Promise 模式 -gattClientDevice.getServices().then(result => { +let device = bluetooth.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); +device.connect(); +device.getServices().then(result => { console.info("getServices successfully:" + JSON.stringify(result)); }); ``` @@ -3536,7 +3536,7 @@ let rssi = gattClient.getRssiValue().then((data) => { | serviceSolicitationUuidMask9+ | string | 是 | 是 | 表示过滤包含该UUID服务请求掩码的设备,例如:FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF。 | | serviceData9+ | ArrayBuffer | 是 | 是 | 表示过滤包含该服务相关数据的设备,例如:[0x90,0x00,0xF1,0xF2]。 | | serviceDataMask9+ | ArrayBuffer | 是 | 是 | 表示过滤包含该服务相关数据掩码的设备,例如:[0xFF,0xFF,0xFF,0xFF]。 | -| manufacturerId9+ | number | 是 | 是 | 表示过滤包含该制造商ID的设备,例如:0x0006。 | +| manufactureId9+ | number | 是 | 是 | 表示过滤包含该制造商ID的设备,例如:0x0006。 | | manufactureData9+ | ArrayBuffer | 是 | 是 | 表示过滤包含该制造商相关数据的设备,例如:[0x1F,0x2F,0x3F]。 | | manufactureDataMask9+ | ArrayBuffer | 是 | 是 | 表示过滤包含该制造商相关数据掩码的设备,例如:[0xFF,0xFF,0xFF]。 | @@ -3828,7 +3828,7 @@ let rssi = gattClient.getRssiValue().then((data) => { ## ProfileId8+ -蓝牙profile枚举,API9新增PROFILE_HID_HOST。 +蓝牙profile枚举,API9新增PROFILE_HID_HOST,PROFILE_PAN_NETWORK。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3836,4 +3836,5 @@ let rssi = gattClient.getRssiValue().then((data) => { | -------------------------------- | ------ | --------------- | | PROFILE_A2DP_SOURCE | 0x0001 | 表示A2DP profile。 | | PROFILE_HANDS_FREE_AUDIO_GATEWAY | 0x0004 | 表示HFP profile。 | -| PROFILE_HID_HOST9+ | 0x0006 | 表示HID profile。 | \ No newline at end of file +| PROFILE_HID_HOST9+ | 0x0006 | 表示HID profile。 | +| PROFILE_PAN_NETWORK9+ | 0x0007 | 表示PAN profile。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-AbilityInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-AbilityInfo.md index 44e8685a7a3a9d2f5090d88dbd29bb767203f4db..40bd323beecbdee318c0ab77fd8de00969fa31dd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-AbilityInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-AbilityInfo.md @@ -7,9 +7,9 @@ -Ability信息 - +Ability信息,未做特殊说明的属性,均通过GET_BUNDLE_DEFAULT获取 +## AbilityInfo **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework @@ -31,17 +31,17 @@ Ability信息 | type | AbilityType | 是 | 否 | Ability类型 | | orientation | DisplayOrientation | 是 | 否 | Ability的显示模式 | | launchMode | LaunchMode | 是 | 否 | Ability的启动模式 | -| permissions | Array\ | 是 | 否 | 被其他应用Ability调用时需要申请的权限集合 | +| permissions | Array\ | 是 | 否 | 被其他应用Ability调用时需要申请的权限集合
通过传入GET_ABILITY_INFO_WITH_PERMISSION获取 | | deviceTypes | Array\ | 是 | 否 | Ability支持的设备类型 | | deviceCapabilities | Array\ | 是 | 否 | Ability需要的设备能力 | | readPermission | string | 是 | 否 | 读取Ability数据所需的权限 | | writePermission | string | 是 | 否 | 向Ability写数据所需的权限 | -| applicationInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | 是 | 否 | 应用程序的配置信息 | +| applicationInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | 是 | 否 | 应用程序的配置信息
通过传入GET_ABILITY_INFO_WITH_APPLICATION获取 | | uri | string | 是 | 否 | 获取Ability的统一资源标识符(URI) | | labelId | number | 是 | 否 | Ability的标签id | | subType | AbilitySubType | 是 | 否 | Ability中枚举使用的模板的子类型 | -| metaData8+ | Array\<[CustomizeData](js-apis-bundle-CustomizeData.md)> | 是 | 否 | ability的自定义信息 | -| metadata9+ | Array\<[Metadata](js-apis-bundle-Metadata.md)> | 是 | 否 | ability的元信息 | +| metaData8+ | Array\<[CustomizeData](js-apis-bundle-CustomizeData.md)> | 是 | 否 | ability的自定义信息
通过传入GET_ABILITY_INFO_WITH_METADATA获取 | +| metadata9+ | Array\<[Metadata](js-apis-bundle-Metadata.md)> | 是 | 否 | ability的元信息
通过传入GET_ABILITY_INFO_WITH_METADATA获取 | | enabled8+ | boolean | 是 | 否 | ability是否可用 | | supportWindowMode9+ | Array\<[SupportWindowMode](js-apis-Bundle.md)> | 是 | 否 | ability支持的窗口模式 | | maxWindowRatio9+ | number | 是 | 否 | ability支持的最大的窗口比例 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md index d2a181f5e3014483f941d2f1c3f5f20eaa3369e0..14e35a748a226853453725b3e638a90cabc30b8f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md @@ -3,7 +3,7 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 本模块首批接口从API version 7 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 -应用程序信息 +应用程序信息,未做特殊说明的属性,均通过GET_BUNDLE_DEFAULT获取 ## ApplicationInfo @@ -25,17 +25,17 @@ | process | string | 是 | 否 | 应用程序的进程,如果不设置,默认为包的名称。 | | supportedModes | number | 是 | 否 | 应用程序支持的运行模式。 | | moduleSourceDirs | Array\ | 是 | 否 | 应用程序的资源存放的相对路径。 | -| permissions | Array\ | 是 | 否 | 访问应用程序所需的权限。 | +| permissions | Array\ | 是 | 否 | 访问应用程序所需的权限。
通过传入GET_APPLICATION_INFO_WITH_PERMISSION获取 | | moduleInfos | Array\<[ModuleInfo](js-apis-bundle-ModuleInfo.md)> | 是 | 否 | 应用程序的模块信息。 | | entryDir | string | 是 | 否 | 应用程序的文件保存路径。 | | codePath8+ | string | 是 | 否 | 应用程序的安装目录。 | -| metaData8+ | Map\> | 是 | 否 | 应用程序的自定义元信息。 | -| metadata9+ | Map\> | 是 | 否 | 应用程序的元信息。 | +| metaData8+ | Map\> | 是 | 否 | 应用程序的自定义元信息。
通过传入GET_APPLICATION_INFO_WITH_METADATA获取 | +| metadata9+ | Map\> | 是 | 否 | 应用程序的元信息。
通过传入GET_APPLICATION_INFO_WITH_METADATA获取 | | removable8+ | boolean | 是 | 否 | 应用程序是否可以被移除。 | | accessTokenId8+ | number | 是 | 否 | 应用程序的accessTokenId。 | | uid8+ | number | 是 | 否 | 应用程序的uid。 | | entityType8+ | string | 是 | 否 | 应用程序的实体类型。 | -| fingerprint9+ | string | 是 | 否 | 应用程序的签名证书指纹信息,即开发者申请的签名证书的sha256值。 | +| fingerprint9+ | string | 是 | 否 | 应用程序的签名证书指纹信息,即开发者申请的签名证书的sha256值。
通过传入GET_APPLICATION_INFO_WITH_CERTIFICATE_FINGERPRINT获取 | | iconResource9+ | [Resource](js-apis-resource-manager.md#resource9) | 是 | 否 | 应用程序的图标资源信息。 | | labelResource9+ | [Resource](js-apis-resource-manager.md#resource9) | 是 | 否 | 应用程序的标签资源信息。 | | descriptionResource9+ | [Resource](js-apis-resource-manager.md#resource9) | 是 | 否 | 应用程序的描述资源信息。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInfo.md index 80ace94cbd2a31c487b360e029480feb54394d27..ee49cd6790b2f25bf684f335c9bcdb203000eb48 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInfo.md @@ -7,38 +7,38 @@ -应用包的信息 +应用包的信息,未做特殊说明的属性,均通过GET_BUNDLE_DEFAULT获取 ## BundleInfo **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework -| 名称 | 类型 | 可读 | 可写 | 说明 | -| --------------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------ | -| name | string | 是 | 否 | 应用包的名称 | -| type | string | 是 | 否 | 应用包类型 | -| appId | string | 是 | 否 | 应用包里应用程序的id | -| uid | number | 是 | 否 | 应用包里应用程序的uid | -| installTime | number | 是 | 否 | HAP包安装时间 | -| updateTime | number | 是 | 否 | HAP包更新时间 | -| appInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | 是 | 否 | 应用程序的配置信息 | -| abilityInfos | Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | 是 | 否 | Ability的配置信息 | -| reqPermissions | Array\ | 是 | 否 | 应用运行时需向系统申请的权限集合 | -| reqPermissionDetails | Array\<[ReqPermissionDetail](#ReqPermissionDetail)> | 是 | 否 | 应用运行时需向系统申请的权限集合的详细信息 | -| vendor | string | 是 | 否 | 应用包的供应商 | -| versionCode | number | 是 | 否 | 应用包的版本号 | -| versionName | string | 是 | 否 | 应用包的版本文本描述信息 | -| compatibleVersion | number | 是 | 否 | 运行应用包所需要最低的SDK版本号 | -| targetVersion | number | 是 | 否 | 运行应用包所需要最高SDK版本号 | -| isCompressNativeLibs | boolean | 是 | 否 | 是否压缩应用包的本地库,默认为true | -| hapModuleInfos | Array\<[HapModuleInfo](js-apis-bundle-HapModuleInfo.md)> | 是 | 否 | 模块的配置信息 | -| entryModuleName | string | 是 | 否 | Entry的模块名称 | -| cpuAbi | string | 是 | 否 | 应用包的cpuAbi信息 | -| isSilentInstallation | string | 是 | 否 | 是否通过静默安装 | -| minCompatibleVersionCode | number | 是 | 否 | 分布式场景下的应用包兼容的最低版本 | -| entryInstallationFree | boolean | 是 | 否 | Entry是否支持免安装 | -| reqPermissionStates8+ | Array\ | 是 | 否 | 申请权限的授予状态 | -| extensionAbilityInfo9+ | Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)> | 是 | 否 | ability的可扩展信息 | +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ | +| name | string | 是 | 否 | 应用包的名称 | +| type | string | 是 | 否 | 应用包类型 | +| appId | string | 是 | 否 | 应用包里应用程序的id | +| uid | number | 是 | 否 | 应用包里应用程序的uid | +| installTime | number | 是 | 否 | HAP包安装时间 | +| updateTime | number | 是 | 否 | HAP包更新时间 | +| appInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | 是 | 否 | 应用程序的配置信息 | +| abilityInfos | Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | 是 | 否 | Ability的配置信息
通过传入GET_BUNDLE_WITH_ABILITIES获取 | +| reqPermissions | Array\ | 是 | 否 | 应用运行时需向系统申请的权限集合
通过传入GET_BUNDLE_WITH_REQUESTED_PERMISSION获取 | +| reqPermissionDetails | Array\<[ReqPermissionDetail](#ReqPermissionDetail)> | 是 | 否 | 应用运行时需向系统申请的权限集合的详细信息
通过传入GET_BUNDLE_WITH_REQUESTED_PERMISSION获取 | +| vendor | string | 是 | 否 | 应用包的供应商 | +| versionCode | number | 是 | 否 | 应用包的版本号 | +| versionName | string | 是 | 否 | 应用包的版本文本描述信息 | +| compatibleVersion | number | 是 | 否 | 运行应用包所需要最低的SDK版本号 | +| targetVersion | number | 是 | 否 | 运行应用包所需要最高SDK版本号 | +| isCompressNativeLibs | boolean | 是 | 否 | 是否压缩应用包的本地库,默认为true | +| hapModuleInfos | Array\<[HapModuleInfo](js-apis-bundle-HapModuleInfo.md)> | 是 | 否 | 模块的配置信息 | +| entryModuleName | string | 是 | 否 | Entry的模块名称 | +| cpuAbi | string | 是 | 否 | 应用包的cpuAbi信息 | +| isSilentInstallation | string | 是 | 否 | 是否通过静默安装 | +| minCompatibleVersionCode | number | 是 | 否 | 分布式场景下的应用包兼容的最低版本 | +| entryInstallationFree | boolean | 是 | 否 | Entry是否支持免安装 | +| reqPermissionStates8+ | Array\ | 是 | 否 | 申请权限的授予状态 | +| extensionAbilityInfo9+ | Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)> | 是 | 否 | ability的可扩展信息
通过传入GET_BUNDLE_WITH_EXTENSION_ABILITY获取 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md new file mode 100644 index 0000000000000000000000000000000000000000..003becc599ab3271b038237b783994d0751a8681 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md @@ -0,0 +1,105 @@ +# BundleInstaller + + + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 本模块首批接口从API version 7 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + + +在设备上安装、升级和删除捆绑包 + + + +## 系统能力 + +SystemCapability.BundleManager.BundleFramework + +## BundleInstaller.install + +install(bundleFilePaths: Array<string>, param: InstallParam, callback: AsyncCallback<InstallStatus>): void; + +以异步方法在HAP中安装应用程序,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.INSTALL_BUNDLE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | +| bundleFilePaths | Array<string> | 是 | 指示存储应用程序包的路径。路径应该是当前应用程序的数据目录的相对路径。 | +| param | [InstallParam](#installparam) | 是 | 指定安装所需的其他参数。 | +| callback | AsyncCallback<[InstallStatus](#installstatus)> | 是 | 程序启动作为入参的回调函数,返回安装状态信息。 | + +## BundleInstaller.uninstall + +uninstall(bundleName: string, param: InstallParam, callback: AsyncCallback<InstallStatus>): void; + +以异步方法卸载应用程序,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.INSTALL_BUNDLE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | +| bundleName | string | 是 | 包名 | +| param | [InstallParam](#installparam) | 是 | 指定安装所需的其他参数。 | +| callback | AsyncCallback<[InstallStatus](#installstatus)> | 是 | 程序启动作为入参的回调函数,返回安装状态信息。 | + +## BundleInstaller.recover + +recover(bundleName: string, param: InstallParam, callback: AsyncCallback<InstallStatus>): void; + +以异步方法恢复一个应用程序,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.INSTALL_BUNDLE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | +| bundleName | string | 是 | 包名 | +| param | [InstallParam](#installparam) | 是 | 指定安装所需的其他参数。 | +| callback | AsyncCallback<[InstallStatus](#installstatus)> | 是 | 程序启动作为入参的回调函数,返回安装状态信息。 | + +## InstallParam + +应用程序安装卸载信息 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 类型 | 说明 | +| ----------- | ------- | ------------------ | +| userId | number | 指示用户id | +| installFlag | number | 指示安装标志 | +| isKeepData | boolean | 指示参数是否有数据 | + +## InstallStatus + +应用程序安装状态 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------ | +| status | bundle.[InstallErrorCode](js-apis-Bundle.md#installerrorcode) | 是 | 否 | 表示安装或卸载错误状态码 | +| statusMessage | string | 是 | 否 | 表示安装或卸载的字符串结果信息 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-ElementName.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-ElementName.md index 33b58e0721464c04d2f6d966a9322f02c0b8322b..c7fc3de209c93551ef06d170a8b941c91fa5821d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-ElementName.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-ElementName.md @@ -2,17 +2,17 @@ -**说明:** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 本模块首批接口从API version 7 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 - - ElementName信息 ## ElementName **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + + | 名称 | 类型 | 可读 | 可写 | 说明 | | ----------------------- | ---------| ---- | ---- | ------------------------- | | deviceId | string | 是 | 是 | 设备id | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-ExtensionAbilityInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-ExtensionAbilityInfo.md index 879d9f4b48468c5a564f9e9685dcc262e60fe762..6ca778bf7ca5bb9f2fec9af3680d485fb27ac12e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-ExtensionAbilityInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-ExtensionAbilityInfo.md @@ -7,7 +7,7 @@ -ExtensionAbility信息 +ExtensionAbility信息,未做特殊说明的属性,均通过GET_BUNDLE_DEFAULT获取 ## ExtensionAbilityInfo diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-HapModuleInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-HapModuleInfo.md index f21241cda3ae6467ea1198b4496961725a4f9c90..8cb5642e31bd0805ae7b5f0424406506c1df763d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-HapModuleInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-HapModuleInfo.md @@ -7,7 +7,7 @@ -Hap模块信息 +Hap模块信息,未做特殊说明的属性,均通过GET_BUNDLE_DEFAULT获取 ## HapModuleInfo @@ -35,4 +35,5 @@ Hap模块信息 | mainElementName9+ | string | 是 | 否 | 入口ability信息 | | extensionAbilityInfo9+ | Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)> | 是 | 否 | extensionAbility信息 | | metadata9+ | Array\<[Metadata](js-apis-bundle-Metadata.md)> | 是 | 否 | Ability的元信息 | -| hashValue9+ | string | 是 | 否 | Module的Hash值 | \ No newline at end of file +| hashValue9+ | string | 是 | 否 | Module的Hash值
通过传入GET_BUNDLE_WITH_HASH_VALUE获取 | + diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..c2ca416a6b9ee5a46f61672259d39951481abce6 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md @@ -0,0 +1,23 @@ +# LauncherAbilityInfo + + + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + + +LauncherAbilityInfo信息 + +## LauncherAbilityInfo + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------------- | ---------------------------------------------------- | ---- | ---- | ------------------------------------ | +| applicationInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | 是 | 否 | launcher ability的应用程序的配置信息 | +| elementName | [ElementName](js-apis-bundle-ElementName.md) | 是 | 否 | launcher ability的ElementName信息 | +| labelId | number | 是 | 否 | launcher ability的标签ID | +| iconId | number | 是 | 否 | launcher ability的图标ID | +| userId | number | 是 | 否 | launcher ability的用户ID | +| installTime | number | 是 | 否 | launcher ability的安装时间 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-PermissionDef.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-PermissionDef.md new file mode 100644 index 0000000000000000000000000000000000000000..62cc922bfff3498be6dbba4c3ecc935bbc6c7221 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-PermissionDef.md @@ -0,0 +1,21 @@ +# PermissionDef + + + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + + +配置文件中定义的权限详细信息 + +## **PermissionDef** + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------------- | ------ | ---- | ---- | -------------- | +| permissionName | string | 是 | 否 | 用户权限名称 | +| grantMode | number | 是 | 否 | 权限的授予模式 | +| labelId | number | 是 | 否 | 权限的标签ID | +| descriptionId | number | 是 | 否 | 描述权限的ID | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-ShortcutInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-ShortcutInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..71a3d1077b9c3a64ebcb40095eeb518baf508994 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-ShortcutInfo.md @@ -0,0 +1,46 @@ +# ShortcutInfo + + + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 本模块首批接口从API version 7 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + + +配置文件中定义的权限详细信息 + + + +## ShortcutWant + +获取有关快捷方式将启动的功能和目标的信息 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------------------- | ------ | ---- | ---- | -------------------- | +| targetBundle | string | 是 | 否 | 快捷方式的目标捆绑包 | +| targetModule9+ | string | 是 | 否 | 快捷方式的目标模块 | +| targetClass | string | 是 | 否 | 快捷方式所需的目标类 | + +## ShortcutInfo + +获取有关快捷方式将启动的功能和目标的信息 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------------------- | ------------------------------------------ | ---- | ---- | ---------------------------- | +| id | string | 是 | 否 | 快捷方式所属应用程序的Id | +| bundleName | string | 是 | 否 | 包含快捷方式的包名称 | +| hostAbility | string | 是 | 否 | 快捷方式的本地Ability信息 | +| icon | string | 是 | 否 | 快捷方式的图标 | +| iconId8+ | number | 是 | 否 | 快捷方式的图标Id | +| label | string | 是 | 否 | 快捷方式的标签 | +| labelId8+ | number | 是 | 否 | 快捷方式的标签Id | +| disableMessage | string | 是 | 否 | 快捷方式的禁用消息 | +| wants | Array<[ShortcutWant](#shortcutwant)> | 是 | 否 | 快捷方式所需要的信息 | +| isStatic | boolean | 是 | 否 | 快捷方式是否为静态 | +| isHomeShortcut | boolean | 是 | 否 | 快捷方式是否为主页面快捷方式 | +| isEnabled | boolean | 是 | 否 | 是否启用快捷方式 | +| moduleName9+ | string | 是 | 否 | 快捷方式的模块名 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-defaultAppManager.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-defaultAppManager.md index 502a72801becf2d912d4da660d1e78c13dd98c93..7e2f8e3deede69d1204b7b91589a4f5d7a73167d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-defaultAppManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-defaultAppManager.md @@ -96,7 +96,7 @@ getDefaultApplication(type: string, userId?: number): Promise\ **系统能力:** SystemCapability.BundleManager.BundleFramework -**System API:** 此接口为系统接口 +**系统API:** 此接口为系统接口,三方应用不支持调用 **参数:** @@ -141,7 +141,7 @@ getDefaultApplication(type: string, userId: number, callback: AsyncCallback\) : void **系统能力:** SystemCapability.BundleManager.BundleFramework -**System API:** 此接口为系统接口 +**系统API:** 此接口为系统接口,三方应用不支持调用 **参数:** @@ -220,7 +220,7 @@ setDefaultApplication(type: string, elementName: ElementName, userId?: number): **系统能力:** SystemCapability.BundleManager.BundleFramework -**System API:** 此接口为系统接口 +**系统API:** 此接口为系统接口,三方应用不支持调用 **参数:** @@ -268,7 +268,7 @@ setDefaultApplication(type: string, elementName: ElementName, userId: number, ca **系统能力:** SystemCapability.BundleManager.BundleFramework -**System API:** 此接口为系统接口 +**系统API:** 此接口为系统接口,三方应用不支持调用 **参数:** @@ -317,7 +317,7 @@ setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCal **系统能力:** SystemCapability.BundleManager.BundleFramework -**System API:** 此接口为系统接口 +**系统API:** 此接口为系统接口,三方应用不支持调用 **参数:** @@ -365,7 +365,7 @@ resetDefaultApplication(type: string, userId?: number): Promise\ **系统能力:** SystemCapability.BundleManager.BundleFramework -**System API:** 此接口为系统接口 +**系统API:** 此接口为系统接口,三方应用不支持调用 **参数:** @@ -404,7 +404,7 @@ resetDefaultApplication(type: string, userId: number, callback: AsyncCallback\) : void; **系统能力:** SystemCapability.BundleManager.BundleFramework -**System API:** 此接口为系统接口 +**系统API:** 此接口为系统接口,三方应用不支持调用 **参数:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..37601a3c83847c49bdab956e6782934c4f5c5499 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md @@ -0,0 +1,20 @@ +# RemoteAbilityInfo + + + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + + +包含基本远程能力信息 + +## RemoteAbilityInfo + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------- | -------------------------------------------- | ---- | ---- | ----------------------- | +| elementName | [ElementName](js-apis-bundle-ElementName.md) | 是 | 否 | 指明的ability信息 | +| label | string | 是 | 否 | 指明ability的标签信息 | +| icon | string | 是 | 否 | 指明的ability的图标信息 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bytrace.md b/zh-cn/application-dev/reference/apis/js-apis-bytrace.md index add046e1ff964c4f3d54cf4e5657f74a456b0c62..b35171946c40d103048917acf969d8173553a8fe 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bytrace.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bytrace.md @@ -18,7 +18,10 @@ startTrace(name: string, taskId: number, expectedTime?: number): void 标记一个时间片跟踪任务的开始。 -**系统能力:** SystemCapability.Developtools.Bytrace +> **说明:** +> 如果有多个相同name的任务需要追踪或者对同一个任务要追踪多次,并且这些跟踪任务会同时被执行,则每次调用startTrace的taskId必须不一致。如果具有相同name的跟踪任务是串行执行的,则taskId可以相同。在下面bytrace.finishTrace的示例中会举例说明。 + +**系统能力:** SystemCapability.HiviewDFX.HiTrace **参数:** @@ -28,8 +31,6 @@ startTrace(name: string, taskId: number, expectedTime?: number): void | taskId | number | 是 | 时间片跟踪任务id | | expectedTime | number | 否 | 期望的耗时时间(单位:ms) | -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 如果有多个相同name的任务需要追踪或者对同一个任务要追踪多次,并且这些跟踪任务会同时被执行,则每次调用startTrace的taskId必须不一致。如果具有相同name的跟踪任务是串行执行的,则taskId可以相同。在下面bytrace.finishTrace的示例中会举例说明。 **示例:** @@ -44,7 +45,10 @@ finishTrace(name: string, taskId: number): void 标记一个时间片跟踪事件的结束。 -**系统能力:** SystemCapability.Developtools.Bytrace +> **说明:**
+> finishTrace的name和taskId必须与流程开始的startTrace对应参数值一致。 + +**系统能力:** SystemCapability.HiviewDFX.HiTrace **参数:** @@ -53,8 +57,6 @@ finishTrace(name: string, taskId: number): void | name | string | 是 | 时间片跟踪任务名称 | | taskId | number | 是 | 时间片跟踪任务id | -> **说明:**
-> finishTrace的name和taskId必须与流程开始的startTrace对应参数值一致。 **示例:** @@ -90,7 +92,7 @@ traceByValue(name: string, count: number): void 标记预追踪耗时任务的数值变量,该变量的数值会不断变化。 -**系统能力:** SystemCapability.Developtools.Bytrace +**系统能力:** SystemCapability.HiviewDFX.HiTrace **参数:** | 参数名 | 类型 | 必填 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-call.md b/zh-cn/application-dev/reference/apis/js-apis-call.md index 4b67f61a0c4270e6764eb411710754b43c1c9702..a2a58a10f00924651426da21848c682e9f8f1fa2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-call.md +++ b/zh-cn/application-dev/reference/apis/js-apis-call.md @@ -514,15 +514,2241 @@ promise.then(data => { }); ``` +## call.muteRinger8+ + +muteRinger\(callback: AsyncCallback\): void + +如果来电铃声响起,设备将停止铃声。否则,此方法不起作用。使用callback异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------------------------- | ---- | ---------- | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.muteRinger((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.muteRinger8+ + +muteRinger\(\): Promise + +如果来电铃声响起,设备将停止铃声。否则,此方法不起作用。使用Promise异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CallManager + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.muteRinger(); +promise.then(data => { + console.log(`muteRinger success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`muteRinger fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.answer7+ + +answer\(callback: AsyncCallback\): void + +接听来电。使用callback异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.ANSWER_CALL + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.answer((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.answer7+ + +answer\(callId: number, callback: AsyncCallback\): void + +接听来电。使用callback异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.ANSWER_CALL + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ----------------------------------------------- | +| callId | number | 是 | 呼叫Id。可以通过订阅callDetailsChange事件获得。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.answer(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.answer7+ + +answer(callId?: number\): Promise + +接听来电。使用Promise异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.ANSWER_CALL + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| callId | number | 否 | 呼叫Id。可以通过订阅callDetailsChange事件获得。从API Version 9开始为可选参数。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.answer(1); +promise.then(data => { + console.log(`answer success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`answer fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.hangup7+ + +hangup\(callback: AsyncCallback\): void + +挂断电话。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.hangup((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.hangup7+ + +hangup\(callId: number, callback: AsyncCallback\): void + +挂断电话。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ----------------------------------------------- | +| callId | number | 是 | 呼叫id。可以通过订阅callDetailsChange事件获得。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.hangup(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.hangup7+ + +hangup\(callId?: number\): Promise + +挂断电话。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| callId | number | 否 | 呼叫id。可以通过订阅callDetailsChange事件获得。从API Version 9开始为可选参数。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.hangup(1); +promise.then(data => { + console.log(`hangup success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`hangup fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.reject7+ + +reject\(callback: AsyncCallback\): void + +拒绝来电。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.reject((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.reject7+ + +reject\(options: RejectMessageOptions, callback: AsyncCallback\): void + +拒绝来电。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------------- | ---- | -------------- | +| options | [RejectMessageOptions](#rejectmessageoptions7) | 是 | 拒绝消息选项。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let rejectMessageOptions={ + messageContent: "拦截陌生号码" +} +call.reject(rejectMessageOptions, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.reject7+ + +reject(callId: number, callback: AsyncCallback): + +拒绝来电。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ----------------------------------------------- | +| callId | number | 是 | 呼叫Id。可以通过订阅callDetailsChange事件获得。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.reject(1); +promise.then(data => { + console.log(`reject success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`reject fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.reject7+ + +reject\(callId: number, options: RejectMessageOption, callback: AsyncCallback\): void + +拒绝来电。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------------- | ---- | ----------------------------------------------- | +| callId | number | 是 | 呼叫Id。可以通过订阅callDetailsChange事件获得。 | +| options | [RejectMessageOptions](#rejectmessageoptions7) | 是 | 拒绝消息选项。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let rejectMessageOptions={ + messageContent: "拦截陌生号码" +} +call.reject(1, rejectMessageOptions, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.reject7+ + +reject(callId?: number, options?: RejectMessageOptions\): Promise + +拒绝来电。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ | +| callId | number | 否 | 呼叫Id。可以通过订阅callDetailsChange事件获得。从API Version 9开始为可选参数。 | +| options | [RejectMessageOptions](#rejectmessageoptions7) | 否 | 拒绝消息选项。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let rejectMessageOptions={ + messageContent: "拦截陌生号码" +} +let promise = call.reject(1, rejectMessageOptions); +promise.then(data => { + console.log(`reject success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`reject fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.holdCall7+ + +holdCall\(callId: number, callback: AsyncCallback\): void + +保持通话。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.holdCall(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.holdCall7+ + +holdCall\(callId: number\): Promise + +保持通话。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.holdCall(1); +promise.then(data => { + console.log(`holdCall success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`holdCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.unHoldCall7+ + +unHoldCall\(callId: number, callback: AsyncCallback\): void + +取消保持通话。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.unHoldCall(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.unHoldCall7+ + +unHoldCall\(callId: number\): Promise + +取消保持通话。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.unHoldCall(1); +promise.then(data => { + console.log(`unHoldCall success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`unHoldCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.switchCall7+ + +switchCall\(callId: number, callback: AsyncCallback\): void + +切换呼叫。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.switchCall(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.switchCall7+ + +switchCall\(callId: number\): Promise + +切换呼叫。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.switchCall(1); +promise.then(data => { + console.log(`switchCall success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`switchCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.combineConference7+ + +combineConference\(callId: number, callback: AsyncCallback\): void + +合并通话,将两通电话合并成会议电话。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.combineConference(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.combineConference7+ + +combineConference\(callId: number\): Promise + +合并通话,将两通电话合并成会议电话。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.combineConference(1); +promise.then(data => { + console.log(`combineConference success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`combineConference fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.getMainCallId7+ + +getMainCallId\(callId: number, callback: AsyncCallback\): void + +获取主呼叫Id。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------- | ---- | ------------------------ | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback<number> | 是 | 回调函数。返回主呼叫Id。 | + +**示例:** + +```js +call.getMainCallId(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.getMainCallId7+ + +getMainCallId\(callId: number\): Promise + +获取主呼叫Id。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ------------------------------- | +| Promise<void> | 以Promise形式异步返回主呼叫Id。 | + +**示例:** + +```js +let promise = call.getMainCallId(1); +promise.then(data => { + console.log(`getMainCallId success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getMainCallId fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.getSubCallIdList7+ + +getSubCallIdList\(callId: number, callback: AsyncCallback\>\): void + +获取子呼叫Id列表。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------ | ---- | ---------------------------- | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback\> | 是 | 回调函数。返回子呼叫Id列表。 | + +**示例:** + +```js +call.getSubCallIdList(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.getSubCallIdList7+ + +getSubCallIdList\(callId: number\): Promise\> + +获取子呼叫Id列表。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------- | ----------------------------------- | +| Promise<Array> | 以Promise形式异步返回子呼叫Id列表。 | + +**示例:** + +```js +let promise = call.getSubCallIdList(1); +promise.then(data => { + console.log(`getSubCallIdList success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getSubCallIdList fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.getCallIdListForConference7+ + +getCallIdListForConference\(callId: number, callback: AsyncCallback>\): void + +获取会议的呼叫Id列表。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------- | ---- | -------------------------------- | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback<Array> | 是 | 回调函数。返回会议的呼叫Id列表。 | + +**示例:** + +```js +call.getCallIdListForConference(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.getCallIdListForConference7+ + +getCallIdListForConference\(callId: number\): Promise\> + +获取会议的呼叫Id列表。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------- | --------------------------------------- | +| Promise<Array> | 以Promise形式异步返回会议的呼叫Id列表。 | + +**示例:** + +```js +let promise = call.getCallIdListForConference(1); +promise.then(data => { + console.log(`getCallIdListForConference success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getCallIdListForConference fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.getCallWaitingStatus7+ + +getCallWaitingStatus\(slotId: number, callback: AsyncCallback\): void + +获取呼叫等待状态。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback<[CallWaitingStatus](#callwaitingstatus7)\> | 是 | 回调函数。
返回呼叫等待状态。
- 0:禁用呼叫等待
- 1:启用呼叫等待 | + +**示例:** + +```js +call.getCallWaitingStatus(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.getCallWaitingStatus7+ + +getCallWaitingStatus\(slotId: number\): Promise + +获取呼叫等待状态。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------- | ------------------------------------------------------------ | +| Promise<[CallWaitingStatus](#callwaitingstatus7)> | 以Promise形式异步返回呼叫等待状态。
- 0:禁用呼叫等待
- 1:启用呼叫等待 | + +**示例:** + +```js +let promise = call.getCallWaitingStatus(0); +promise.then(data => { + console.log(`getCallWaitingStatus success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getCallWaitingStatus fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.setCallWaiting7+ + +setCallWaiting\(slotId: number, activate: boolean, callback: AsyncCallback\): void + +设置呼叫等待。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | ------------------------------------------------------------ | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| activate | boolean | 是 | 呼叫等待是否处于启用状态。
- false:禁用呼叫等待
- true:启用呼叫等待 | +| callback | AsyncCallback | 是 | 回调函数。 | + +**示例:** + +```js +call.setCallWaiting(0, true, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.setCallWaiting7+ + +setCallWaiting\(slotId: number, activate: boolean\): Promise + +设置呼叫等待。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------- | ---- | ------------------------------------------------------------ | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| activate | boolean | 是 | 呼叫等待是否处于启用状态。
- false:禁用呼叫等待
- true:启用呼叫等待 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.setCallWaiting(0, true); +promise.then(data => { + console.log(`setCallWaiting success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`setCallWaiting fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.startDTMF7+ + +startDTMF\(callId: number, character: string, callback: AsyncCallback\): void + +启动双音多频。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | -------------------- | ---- | ---------- | +| callId | number | 是 | 呼叫Id。 | +| character | string | 是 | DTMF码。 | +| callback | AsyncCallback | 是 | 回调函数。 | + +**示例:** + +```js +call.startDTMF(1, "0", (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.startDTMF7+ + +startDTMF\(callId: number, character: string\): Promise + +启动双音多频。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | +| character | string | 是 | DTMF码。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ----------------------- | +| Promise<void> | 以Promise形式异步返回。 | + +**示例:** + +```js +let promise = call.startDTMF(1, "0"); +promise.then(data => { + console.log(`startDTMF success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`startDTMF fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.stopDTMF7+ + +stopDTMF\(callId: number, callback: AsyncCallback\): void + +停止双音多频。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.stopDTMF(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.stopDTMF7+ + +stopDTMF\(callId: number\): Promise + +停止双音多频。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.stopDTMF(1); +promise.then(data => { + console.log(`stopDTMF success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`stopDTMF fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.isInEmergencyCall7+ + +isInEmergencyCall\(callback: AsyncCallback\): void + +判断是否正在处于紧急呼叫。使用callback异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | ---------- | +| callback | AsyncCallback<boolean> | 是 | 回调函数。 | + +**示例:** + +```js +call.isInEmergencyCall((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.isInEmergencyCall7+ + +isInEmergencyCall\(\): Promise + +判断是否正在处于紧急呼叫。使用Promise异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CallManager + +**返回值:** + +| 类型 | 说明 | +| ---------------------- | --------------------------- | +| Promise<boolean> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.isInEmergencyCall(); +promise.then(data => { + console.log(`isInEmergencyCall success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`isInEmergencyCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.on('callDetailsChange')7+ + +on\(type: 'callDetailsChange', callback: Callback\): void + +订阅callDetailsChange事件。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------- | ---- | -------------------------- | +| type | string | 是 | 通话时监听通话详情的变化。 | +| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | 是 | 回调函数。 | + +**示例:** + +```js +call.on('callDetailsChange', (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.on('callEventChange')8+ + +on\(type: 'callEventChange', callback: Callback\): void + +订阅callEventChange事件。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------ | ---- | -------------------------- | +| type | string | 是 | 通话时监听通话事件的变化。 | +| callback | Callback<[CallEventOptions](#calleventoptions8)> | 是 | 回调函数。 | + +**示例:** + +```js +call.on('callEventChange', (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.on('callDisconnectedCause')8+ + +on\(type: 'callDisconnectedCause', callback: Callback): void + +订阅callDisconnectedCause事件。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------ | ---- | -------------------------- | +| type | string | 是 | 通话时监听断开连接的原因。 | +| callback | Callback<[DisconnectedDetails](#disconnecteddetails8)> | 是 | 回调函数。 | + +**示例:** + +```js +call.on('callDisconnectedCause', (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.on('mmiCodeResult')9+ + +on\(type: 'mmiCodeResult', callback: Callback\): void + +订阅mmiCodeResult事件。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------------------------------- | ---- | --------------------- | +| type | string | 是 | 通话时监听MMI码结果。 | +| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | 是 | 回调函数。 | + +**示例:** + +```js +isNewCallAllowedcall.on('mmiCodeResult', (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.off('callDetailsChange')7+ + +off\(type: 'callDetailsChange', callback?: Callback\): void + +取消订阅callDetailsChange事件。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------------------------------------------- | ---- | ---------------------------------- | +| type | string | 是 | 通话结束时取消监听通话详情的变化。 | +| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | 否 | 回调函数。 | + +**示例:** + +```js +call.off('callDetailsChange', (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.off('callEventChange')8+ + +off\(type: 'callEventChange', callback?: Callback\): void + +取消订阅callEventChange事件。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------ | ---- | ---------------------------------- | +| type | string | 是 | 通话结束时取消监听通话事件的变化。 | +| callback | Callback<[CallEventOptions](#calleventoptions8)> | 否 | 回调函数。 | + +**示例:** + +```js +call.off('callEventChange', (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.off('callDisconnectedCause')8+ + +off\(type: 'callDisconnectedCause', callback?: Callback\): void + +取消订阅callDisconnectedCause事件。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------------------------- | ---- | -------------------- | +| type | 'callDisconnectedCause' | 是 | 调用断开连接的原因。 | +| callback | Callback**<**[DisconnectedDetails](#disconnecteddetails8)> | 否 | 回调函数。 | + +**示例:** + +```js +call.off('callDisconnectedCause', (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.off('mmiCodeResult')9+ + +off\(type: 'mmiCodeResult', callback?: Callback\): void + +取消订阅mmiCodeResult事件。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------ | ---- | ----------- | +| type | 'mmiCodeResult' | 是 | MMI码结果。 | +| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | 否 | 回调函数。 | + +**示例:** + +```js +call.off('mmiCodeResult', (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.isNewCallAllowed8+ + +isNewCallAllowed\(callback: AsyncCallback\): void + +判断是否允许再拨打一通新电话。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | ---------- | +| callback | AsyncCallback<boolean> | 是 | 回调函数。 | + +**示例:** + +```js +call.isNewCallAllowed((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.isNewCallAllowed8+ + +isNewCallAllowed\(\): Promise + +判断是否允许再拨打一通新电话。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**返回值:** + +| 类型 | 说明 | +| ---------------------- | --------------------------- | +| Promise<boolean> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.isNewCallAllowed(); +promise.then(data => { + console.log(`isNewCallAllowed success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`isNewCallAllowed fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.separateConference8+ + +separateConference\(callId: number, callback: AsyncCallback\): void + +断开会议电话。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.separateConference(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.separateConference8+ + +separateConference\(callId: number\): Promise + +断开会议电话。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.separateConference(1); +promise.then(data => { + console.log(`separateConference success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`separateConference fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.getCallRestrictionStatus8+ + +getCallRestrictionStatus\(slotId: number, type: CallRestrictionType, callback: AsyncCallback\): void + +获取呼叫限制状态。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [CallRestrictionType](#callrestrictiontype8) | 是 | 呼叫限制类型。 | +| callback | AsyncCallback<[RestrictionStatus](#restrictionstatus8)> | 是 | 回调函数。返回限制状态。 | + +**示例:** + +```js +call.getCallRestrictionStatus(0, 1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.getCallRestrictionStatus8+ + +getCallRestrictionStatus\(slotId: number, type: CallRestrictionType\): Promise + +获取呼叫限制状态。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | -------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [CallRestrictionType](#callrestrictiontype8) | 是 | 呼叫限制类型。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------- | --------------------------- | +| Promise<[RestrictionStatus](#restrictionstatus8)> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.getCallRestrictionStatus(0, 1); +promise.then(data => { + console.log(`getCallRestrictionStatus success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getCallRestrictionStatus fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.setCallRestriction8+ + +setCallRestriction\(slotId: number, info: CallRestrictionInfo, callback: AsyncCallback\): void + +设置呼叫限制状态。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| info | [CallRestrictionInfo](#callrestrictioninfo8) | 是 | 呼叫限制信息。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let callRestrictionInfo={ + type: 1, + password: "123456", + mode: 1 +} +call.setCallRestriction(0, callRestrictionInfo, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.setCallRestriction8+ + +setCallRestriction\(slotId: number, info: CallRestrictionInfo\): Promise + +设置呼叫限制状态。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | -------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| info | [CallRestrictionInfo](#callrestrictioninfo8) | 是 | 呼叫限制信息。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let callRestrictionInfo={ + type: 1, + password: "123456", + mode: 1 +} +let promise = call.setCallRestriction(0, callRestrictionInfo); +promise.then(data => { + console.log(`setCallRestriction success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`setCallRestriction fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.getCallTransferInfo8+ + +getCallTransferInfo\(slotId: number, type: CallTransferType, callback: AsyncCallback\): void + +获取呼叫转移信息。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [CallTransferType](#calltransfertype8) | 是 | 呼叫转移类型。 | +| callback | AsyncCallback<[CallTransferResult](#calltransferresult8)> | 是 | 回调函数。返回呼叫转移信息。 | + +**示例:** + +```js +let callTransferTyp={ + CallTransferType: 1 +} +call.getCallTransferInfo(0, callTransferTyp, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.getCallTransferInfo8+ + +getCallTransferInfo\(slotId: number, type: CallTransferType): Promise + +获取呼叫转移信息。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | -------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [CallTransferType](#calltransfertype8) | 是 | 呼叫转移类型。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------------------------------- | --------------------------- | +| Promise<[CallTransferResult](#calltransferresult8)> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let callTransferTyp={ + CallTransferType: 1 +} +let promise = call.getCallTransferInfo(0, callTransferTyp); +promise.then(data => { + console.log(`getCallTransferInfo success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getCallTransferInfo fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.setCallTransfer8+ + +setCallTransfer\(slotId: number, info: CallTransferInfo, callback: AsyncCallback\): void + +设置呼叫转移信息。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| info | [CallTransferInfo](#calltransferinfo8) | 是 | 呼叫转移信息。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let callTransferInfo={ + transferNum: "111", + type: 1, + settingType: 1 +} +call.setCallTransfer(0, callTransferInfo, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.setCallTransfer8+ + +setCallTransfer\(slotId: number, info: CallTransferInfo): Promise + +设置呼叫转移信息。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| info | [CallTransferInfo](#calltransferinfo8) | 是 | 呼叫转移信息。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let callTransferInfo={ + transferNum: "111", + type: 1, + settingType: 1 +} +let promise = call.setCallTransfer(0, callTransferInfo); +promise.then(data => { + console.log(`setCallTransfer success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`setCallTransfer fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.isRinging8+ + +isRinging\(callback: AsyncCallback\): void + +判断是否正在响铃。使用callback异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | ---------- | +| callback | AsyncCallback<boolean> | 是 | 回调函数。 | + +**示例:** + +```js +call.isRinging((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.isRinging8+ + +isRinging\(\): Promise + +判断是否正在响铃。使用Promise异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CallManager + +**返回值:** + +| 类型 | 说明 | +| ---------------------- | --------------------------- | +| Promise<boolean> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.isRinging(); +promise.then(data => { + console.log(`isRinging success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`isRinging fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.setMuted8+ + +setMuted\(callback: AsyncCallback\): void + +设置通话中的静音。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.setMuted((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.setMuted8+ + +setMuted\(\): Promise + +设置通话中的静音。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.setMuted(); +promise.then(data => { + console.log(`setMuted success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`setMuted fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.cancelMuted8+ + +cancelMuted(callback: AsyncCallback): void + +取消通话中的静音。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.cancelMuted((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.cancelMuted8+ + +cancelMuted(): Promise + +取消通话中的静音。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.cancelMuted(); +promise.then(data => { + console.log(`cancelMuted success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`cancelMuted fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.setAudioDevice8+ + +setAudioDevice\(device: AudioDevice, callback: AsyncCallback\): void + +设置通话音频设备。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | ---------- | +| device | [AudioDevice](#audiodevice8) | 是 | 音频设备。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.setAudioDevice(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.setAudioDevice8+ + +setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback\): void + +设置通话音频设备。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------ | ---- | -------------- | +| device | [AudioDevice](#audiodevice8) | 是 | 音频设备。 | +| options | [AudioDeviceOptions](#audiodeviceoptions9) | 是 | 音频设备参数。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let audioDeviceOptions={ + bluetoothAddress: "IEEE 802-2014" +} +call.setAudioDevice(1, bluetoothAddress, (err, value) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.setAudioDevice8+ + +setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise + +设置通话音频设备。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------ | ---- | ------------------ | +| device | [AudioDevice](#audiodevice8) | 是 | 音频设备。 | +| options | [AudioDeviceOptions](#audiodeviceoptions9) | 否 | 音频设备参数参数。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ------------------------------- | +| Promise<void> | 以Promise形式异步返回设置结果。 | + +**示例:** + +```js +let audioDeviceOptions={ + bluetoothAddress: "IEEE 802-2014" +} +let promise = call.setAudioDevice(1, audioDeviceOptions); +promise.then(data => { + console.log(`setAudioDevice success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`setAudioDevice fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.joinConference8+ + +joinConference(mainCallId: number, callNumberList: Array, callback: AsyncCallback): void + +加入会议。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | ------------------------- | ---- | --------------- | +| mainCallId | number | 是 | 主通话Id。 | +| callNumberList | Array | 是 | 呼叫号码列表。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.joinConference(1, "138XXXXXXXX", (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.joinConference8+ + +joinConference(mainCallId: number, callNumberList: Array): Promise + +加入会议。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | -------------- | ---- | --------------- | +| mainCallId | number | 是 | 主通话Id。 | +| callNumberList | Array | 是 | 呼叫号码列表。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.joinConference(1, "138XXXXXXXX"); +promise.then(data => { + console.log(`joinConference success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`joinConference fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.updateImsCallMode8+ + +updateImsCallMode(callId: number, mode: ImsCallMode, callback: AsyncCallback): void + +更新Ims呼叫模式。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | -------------- | +| callId | number | 是 | 呼叫Id。 | +| mode | [ImsCallMode](#imscallmode8) | 是 | Ims呼叫模式。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.updateImsCallMode(1, 1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.updateImsCallMode8+ + +updateImsCallMode(callId: number, mode: ImsCallMode): Promise + +更新Ims呼叫模式。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------------------------- | ---- | -------------- | +| callId | number | 是 | 呼叫Id。 | +| mode | [ImsCallMode](#imscallmode8) | 是 | Ims呼叫模式。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.updateImsCallMode(1, 1); +promise.then(data => { + console.log(`updateImsCallMode success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`updateImsCallMode fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.enableImsSwitch8+ + +enableImsSwitch(slotId: number, callback: AsyncCallback): void + +启用Ims开关。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.enableImsSwitch(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.enableImsSwitch8+ + +enableImsSwitch(slotId: number): Promise + +启用Ims开关。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.enableImsSwitch(0); +promise.then(data => { + console.log(`enableImsSwitch success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`enableImsSwitch fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.disableImsSwitch8+ + +disableImsSwitch(slotId: number, callback: AsyncCallback): void + +禁用Ims开关。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.disableImsSwitch(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.disableImsSwitch8+ + +disableImsSwitch(slotId: number): Promise + +禁用Ims开关。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.disableImsSwitch(0); +promise.then(data => { + console.log(`disableImsSwitch success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`disableImsSwitch fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.isImsSwitchEnabled8+ + +isImsSwitchEnabled(slotId: number, callback: AsyncCallback): void + +判断Ims开关是否启用。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback<boolean> | 是 | 回调函数。 | + +**示例:** + +```js +call.isImsSwitchEnabled(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.isImsSwitchEnabled8+ + +isImsSwitchEnabled(slotId: number): Promise + +判断Ims开关是否启用。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.isImsSwitchEnabled(0); +promise.then(data => { + console.log(`isImsSwitchEnabled success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`isImsSwitchEnabled fail, promise: err->${JSON.stringify(err)}`); +}); +``` + ## DialOptions 拨打电话的可选参数。 **系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------- | ---- | ------------------------------------------------------------ | -| extras | boolean | 否 | 根据extras的值判断是否为视频通话,默认为语音通话。
- true:视频通话。
- false:语音通话。 | +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ---------------------------------- | ---- | ------------------------------------------------------------ | +| extras | boolean | 否 | 根据extras的值判断是否为视频通话,默认为语音通话。
- true:视频通话。
- false:语音通话。 | +| accountId | number | 否 | 帐户Id。从API version 8开始支持。此接口为系统接口。 | +| videoState | [VideoStateType](#videostatetype7) | 否 | 视频状态类型。从API version 8开始支持。此接口为系统接口。 | +| dialScene | [DialScene](#dialscene8) | 否 | 拨号场景。从API version 8开始支持。此接口为系统接口。 | +| dialType | [DialType](#dialtype8) | 否 | 拨号类型。从API version 8开始支持。此接口为系统接口。 | ## CallState @@ -555,4 +2781,396 @@ promise.then(data => { | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ---------------------------------------------------------- | -| countryCode | string | 否 | 国家码,支持所有国家的国家码,如:CN(中国)。默认为:CN。 | \ No newline at end of file +| countryCode | string | 否 | 国家码,支持所有国家的国家码,如:CN(中国)。默认为:CN。 | + +## ImsCallMode8+ + +IP多媒体系统调用模式。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ---------------------- | ---- | ------------------ | +| CALL_MODE_AUDIO_ONLY | 0 | 仅限音频呼叫 | +| CALL_MODE_SEND_ONLY | 1 | 仅发送呼叫 | +| CALL_MODE_RECEIVE_ONLY | 2 | 仅接收呼叫 | +| CALL_MODE_SEND_RECEIVE | 3 | 允许发送和接收呼叫 | +| CALL_MODE_VIDEO_PAUSED | 4 | 暂停视频呼叫 | + +## AudioDevice8+ + +音频设备。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| -------------------- | ---- | ------------ | +| DEVICE_EARPIECE | 0 | 耳机设备 | +| DEVICE_SPEAKER | 1 | 扬声器设备 | +| DEVICE_WIRED_HEADSET | 2 | 有线耳机设备 | +| DEVICE_BLUETOOTH_SCO | 3 | 蓝牙SCO设备 | + +## CallRestrictionType8+ + +呼叫限制类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| --------------------------------------------- | ---- | -------------------------- | +| RESTRICTION_TYPE_ALL_INCOMING | 0 | 限制所有呼入 | +| RESTRICTION_TYPE_ALL_OUTGOING | 1 | 限制所有呼出 | +| RESTRICTION_TYPE_INTERNATIONAL | 2 | 限制国际通话 | +| RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME | 3 | 限制除归属国以外的国际通话 | +| RESTRICTION_TYPE_ROAMING_INCOMING | 4 | 限制漫游呼入 | +| RESTRICTION_TYPE_ALL_CALLS | 5 | 限制所有通话 | +| RESTRICTION_TYPE_OUTGOING_SERVICES | 6 | 限制传出业务 | +| RESTRICTION_TYPE_INCOMING_SERVICES | 7 | 限制呼入业务 | + +## CallTransferInfo8+ + +呼叫转移信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ---------------------------------------------------- | ---- | ---------------- | +| transferNum | string | 是 | 转移编号 | +| type | [CallTransferType](#calltransfertype8) | 是 | 呼叫转移类型 | +| settingType | [CallTransferSettingType](#calltransfersettingtype8) | 是 | 设置呼叫转移类型 | + +## CallTransferType8+ + +呼叫转移类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| --------------------------- | ---- | ------------ | +| TRANSFER_TYPE_UNCONDITIONAL | 0 | 无条件转移 | +| TRANSFER_TYPE_BUSY | 1 | 忙线转移 | +| TRANSFER_TYPE_NO_REPLY | 2 | 无回复转移 | +| TRANSFER_TYPE_NOT_REACHABLE | 3 | 无法访问转移 | + +## CallTransferSettingType8+ + +设置呼叫转移类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| -------------------------- | ---- | ------------ | +| CALL_TRANSFER_DISABLE | 0 | 禁用呼叫转移 | +| CALL_TRANSFER_ENABLE | 1 | 启用呼叫转移 | +| CALL_TRANSFER_REGISTRATION | 3 | 登记呼叫转移 | +| CALL_TRANSFER_ERASURE | 4 | 消除呼叫转移 | + +## CallAttributeOptions7+ + +调用属性选项。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | ---------------------------------------- | ---- | -------------- | +| accountNumber | string | 是 | 帐号号码 | +| speakerphoneOn | boolean | 是 | 扬声器接通电话 | +| accountId | number | 是 | 帐户Id | +| videoState | [VideoStateType](#videostatetype7) | 是 | 视频状态类型 | +| startTime | number | 是 | 开始时间 | +| isEcc | boolean | 是 | 是否是Ecc | +| callType | [CallType](#calltype7) | 是 | 通话类型 | +| callId | number | 是 | 呼叫Id | +| callState | [DetailedCallState](#detailedcallstate7) | 是 | 详细呼叫状态 | +| conferenceState | [ConferenceState](#conferencestate7) | 是 | 会议状态 | + +## ConferenceState7+ + +会议状态。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ---------------------------- | ---- | -------------- | +| TEL_CONFERENCE_IDLE | 0 | 电话会议空闲 | +| TEL_CONFERENCE_ACTIVE | 1 | 电话会议激活 | +| TEL_CONFERENCE_DISCONNECTING | 2 | 电话会议断开 | +| TEL_CONFERENCE_DISCONNECTED | 3 | 电话会议已断开 | + +## CallType7+ + +通话类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ------------- | ---- | ------------ | +| TYPE_CS | 0 | CS通话 | +| TYPE_IMS | 1 | IMS通话 | +| TYPE_OTT | 2 | OTT通话 | +| TYPE_ERR_CALL | 3 | 其他类型通话 | + +## VideoStateType7+ + +视频状态类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ---------- | ---- | -------- | +| TYPE_VOICE | 0 | 语音状态 | +| TYPE_VIDEO | 1 | 视频状态 | + +## DetailedCallState7+ + +详细的呼叫状态。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ------------------------- | ---- | -------------- | +| CALL_STATUS_ACTIVE | 0 | 激活呼叫状态 | +| CALL_STATUS_HOLDING | 1 | 保持呼叫状态 | +| CALL_STATUS_DIALING | 2 | 呼叫状态拨号 | +| CALL_STATUS_ALERTING | 3 | 电话报警状态 | +| CALL_STATUS_INCOMING | 4 | 呼叫传入状态 | +| CALL_STATUS_WAITING | 5 | 呼叫等待状态 | +| CALL_STATUS_DISCONNECTED | 6 | 呼叫状态已断开 | +| CALL_STATUS_DISCONNECTING | 7 | 呼叫状态断开 | +| CALL_STATUS_IDLE | 8 | 呼叫状态空闲 | + +## CallRestrictionInfo8+ + +呼叫限制信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------------------------------- | ---- | ------------ | +| type | [CallRestrictionType](#callrestrictiontype8) | 是 | 呼叫限制类型 | +| password | string | 是 | 密码 | +| mode | [CallRestrictionMode](#callrestrictionmode8) | 是 | 呼叫限制模式 | + +## CallRestrictionMode8+ + +呼叫限制模式。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ----------------------------- | ---- | ------------ | +| RESTRICTION_MODE_DEACTIVATION | 0 | 限制模式停用 | +| RESTRICTION_MODE_ACTIVATION | 1 | 限制模式激活 | + +## CallEventOptions8+ + +呼叫事件的可选参数。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------ | ---- | -------------- | +| eventId | [CallAbilityEventId](#callabilityeventid8) | 是 | 呼叫能力事件Id | + +## CallAbilityEventId8+ + +呼叫能力事件Id。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ------------------------ | ---- | --------------- | +| EVENT_DIAL_NO_CARRIER | 1 | 拨号无载波事件 | +| EVENT_INVALID_FDN_NUMBER | 2 | 无效的FDN号事件 | + +## DialScene8+ + +拨号场景。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| --------------- | ---- | ------------ | +| CALL_NORMAL | 0 | 呼叫正常 | +| CALL_PRIVILEGED | 1 | 呼叫特权 | +| CALL_EMERGENCY | 2 | 拨打紧急电话 | + +## DialType8+ + +拨号类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| -------------------- | ---- | ---------------- | +| DIAL_CARRIER_TYPE | 0 | 载波拨号类型 | +| DIAL_VOICE_MAIL_TYPE | 1 | 语音邮件拨号类型 | +| DIAL_OTT_TYPE | 2 | OTT拨号类型 | + +## RejectMessageOptions7+ + +拒绝消息可选参数。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | ------ | ---- | -------- | +| messageContent | string | 是 | 消息内容 | + +## CallTransferResult8+ + +呼叫转移结果。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------------------------------- | ---- | -------- | +| status | [TransferStatus](#transferstatus8) | 是 | 转移状态 | +| number | string | 是 | 号码 | + +## CallWaitingStatus7+ + +呼叫等待状态。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| -------------------- | ---- | ------------ | +| CALL_WAITING_DISABLE | 0 | 禁用呼叫等待 | +| CALL_WAITING_ENABLE | 1 | 启用呼叫等待 | + +## RestrictionStatus8+ + +限制状态。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ------------------- | ---- | -------- | +| RESTRICTION_DISABLE | 0 | 禁用限制 | +| RESTRICTION_ENABLE | 1 | 启用限制 | + +## TransferStatus8+ + +转移状态。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ---------------- | ---- | -------- | +| TRANSFER_DISABLE | 0 | 禁用转移 | +| TRANSFER_ENABLE | 1 | 启用转移 | + +## DisconnectedDetails8+ + +断开连接的详细信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| --------------------------- | ---- | ---------------------- | +| UNASSIGNED_NUMBER | 1 | 未分配的号码(空号) | +| NO_ROUTE_TO_DESTINATION | 3 | 无至目的地的路由 | +| CHANNEL_UNACCEPTABLE | 6 | 不可接受的通路 | +| OPERATOR_DETERMINED_BARRING | 8 | 运营商闭锁 | +| NORMAL_CALL_CLEARING | 16 | 清除正常呼叫 | +| USER_BUSY | 17 | 用户忙 | +| NO_USER_RESPONDING | 18 | 无用户响应 | +| USER_ALERTING_NO_ANSWER | 19 | 已有用户提醒,但无应答 | +| CALL_REJECTED | 21 | 呼叫拒绝 | +| NUMBER_CHANGED | 22 | 号码改变 | +| DESTINATION_OUT_OF_ORDER | 27 | 终点故障 | +| INVALID_NUMBER_FORMAT | 28 | 无效号码格式 | +| NETWORK_OUT_OF_ORDER | 38 | 网络故障 | +| TEMPORARY_FAILURE | 41 | 临时故障 | +| INVALID_PARAMETER | 1025 | 无效参数 | +| SIM_NOT_EXIT | 1026 | SIM卡未退出 | +| SIM_PIN_NEED | 1027 | 需要SIM卡PIN码 | +| CALL_NOT_ALLOW | 1029 | 不允许呼叫 | +| SIM_INVALID | 1045 | SIM卡无效 | +| UNKNOWN | 1279 | 未知原因 | + +## MmiCodeResults9+ + +MMI码结果。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 类型 | 必填 | 说明 | +| ------- | -------------------------------- | ---- | --------------- | +| result | [MmiCodeResult](#mmicoderesult9) | 是 | MMI码结果 | +| message | string | 是 | MMI码消息 | + +## MmiCodeResult9+ + +MMI码结果。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ---------------- | ---- | ------------- | +| MMI_CODE_SUCCESS | 0 | 表示MMI码成功 | +| MMI_CODE_FAILED | 1 | 表示MMI码失败 | + +## AudioDeviceOptions9+ + +音频设备选项。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 类型 | 必填 | 说明 | +| ---------------- | ------ | ---- | -------- | +| bluetoothAddress | string | 否 | 蓝牙地址 | + diff --git a/zh-cn/application-dev/reference/apis/js-apis-camera.md b/zh-cn/application-dev/reference/apis/js-apis-camera.md index e3124823564897b99dcfe5ff043c215f26b74338..3a2b408ffd04e192004645ca344a28c973edd663 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-camera.md +++ b/zh-cn/application-dev/reference/apis/js-apis-camera.md @@ -347,7 +347,7 @@ cameraManager.on('cameraStatus', (err, cameraStatusInfo) => { ```js async function getCameraInfo("cameraId") { - var cameraManager = await camera.getCameraManager(); + var cameraManager = await camera.getCameraManager(context); var cameras = await cameraManager.getCameras(); var cameraObj = cameras[0]; var cameraId = cameraObj.cameraId; @@ -2231,6 +2231,10 @@ capture(setting: PhotoCaptureSetting, callback: AsyncCallback): void **示例:** ```js +let settings:PhotoCaptureSetting = { + quality = 1, + rotation = 0 +} photoOutput.capture(settings, (err) => { if (err) { console.error('Failed to capture the photo ${err.message}'); @@ -2359,7 +2363,7 @@ on(type: 'frameShutter', callback: AsyncCallback): void **示例:** ```js -photoOutput.on('frameShutter', (frameShutterInfo) => { +photoOutput.on('frameShutter', (err, frameShutterInfo) => { console.log('photo capture end, captureId : ' + frameShutterInfo.captureId); console.log('Timestamp for frame : ' + frameShutterInfo.timestamp); }) @@ -2383,7 +2387,7 @@ on(type: 'captureEnd', callback: AsyncCallback): void **示例:** ```js -photoOutput.on('captureEnd', (captureEndInfo) => { +photoOutput.on('captureEnd', (err, captureEndInfo) => { console.log('photo capture end, captureId : ' + captureEndInfo.captureId); console.log('frameCount : ' + captureEndInfo.frameCount); }) @@ -2407,7 +2411,7 @@ on(type: 'error', callback: ErrorCallback): void **示例:** ```js -photoOutput.on('error', (photoOutputError) => { +photoOutput.on('error', (err, photoOutputError) => { console.log('Photo output error code: ' + photoOutputError.code); }) ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md b/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md index 496ec17ba4000b70553b68fd0beac21b3b02957e..df66790171ff88b2d42ee9dd784cf8eddd857ccf 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md @@ -46,6 +46,7 @@ CommonEvent模块支持的事件类型。名称指的是系统公共事件宏; | COMMON_EVENT_PACKAGE_CHANGED | usual.event.PACKAGE_CHANGED | 无 | 指示应用包已更改的公共事件的动作(例如,包中的组件已启用或禁用)。 | | COMMON_EVENT_PACKAGE_RESTARTED | usual.event.PACKAGE_RESTARTED | 无 | 表示用户重启应用包并杀死其所有进程的普通事件的动作。 | | COMMON_EVENT_PACKAGE_DATA_CLEARED | usual.event.PACKAGE_DATA_CLEARED | 无 | 用户清除应用包数据的公共事件的动作。 | +| COMMON_EVENT_PACKAGE_CACHE_CLEARED9+ | usual.event.PACKAGE_CACHE_CLEARED | 无 | 用户清除应用包缓存数据的公共事件的动作。 | | COMMON_EVENT_PACKAGES_SUSPENDED | usual.event.PACKAGES_SUSPENDED | 无 | 表示应用包已挂起的公共事件的动作。 | | COMMON_EVENT_PACKAGES_UNSUSPENDED | usual.event.PACKAGES_UNSUSPENDED | 无 | 表示应用包未挂起的公共事件的动作。 | | COMMON_EVENT_MY_PACKAGE_SUSPENDED | usual.event.MY_PACKAGE_SUSPENDED | 无 | 应用包被挂起的公共事件的动作。 | @@ -169,6 +170,8 @@ CommonEvent模块支持的事件类型。名称指的是系统公共事件宏; | COMMON_EVENT_FOUNDATION_READY | usual.event.data.FOUNDATION_READY | ohos.permission.RECEIVER_STARTUP_COMPLETED | 表示foundation已准备好的公共事件的动作。 | | COMMON_EVENT_AIRPLANE_MODE_CHANGED | usual.event.AIRPLANE_MODE | 无 | 表示设备飞行模式已更改的公共事件的动作。 | | COMMON_EVENT_SPLIT_SCREEN8+ | usual.event.SPLIT_SCREEN | ohos.permission.RECEIVER_SPLIT_SCREEN | 表示分屏的公共事件的动作。 | +| COMMON_EVENT_SLOT_CHANGE9+ | usual.event.SLOT_CHANGE | ohos.permission.NOTIFICATION_CONTROLLER | 表示通知通道更新的动作。 | +| COMMON_EVENT_SPN_INFO_CHANGED 9+ | usual.event.SPN_INFO_CHANGED | 无 | 表示spn显示信息已更新的公共事件的动作。 | ## CommonEvent.publish diff --git a/zh-cn/application-dev/reference/apis/js-apis-configuration.md b/zh-cn/application-dev/reference/apis/js-apis-configuration.md index 1889e753e1a868c5730c9f29e500b812fb11f64a..0f82948b512e9bd6b497befe3953562bcdb69c63 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-configuration.md +++ b/zh-cn/application-dev/reference/apis/js-apis-configuration.md @@ -23,3 +23,5 @@ import Configuration from '@ohos.application.Configuration'; | direction9+ | Direction | 是 | 否 | 表示屏幕方向,取值范围:水平方向(DIRECTION_HORIZONTAL),垂直方向(DIRECTION_VERTICAL)。 | | screenDensity9+ | ScreenDensity | 是 | 否 | 表示屏幕分辨率,取值范围:SCREEN_DENSITY_SDPI(120)、SCREEN_DENSITY_MDPI(160)、SCREEN_DENSITY_LDPI(240)、SCREEN_DENSITY_XLDPI(320)、SCREEN_DENSITY_XXLDPI(480)、SCREEN_DENSITY_XXXLDPI(640)。 | | displayId9+ | number | 是 | 否 | 表示应用所在的displayId。 | +| hasPointerDevice9+ | boolean | 是 | 否 | 指示指针类型设备是否已连接。 | + diff --git a/zh-cn/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md b/zh-cn/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md index 8270193601115937abe402bb26eb67e11f907411..cbdaec93ae9d5aafc915071a696c5cf9a0ec1d80 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md +++ b/zh-cn/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md @@ -5,12 +5,6 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 -## 导入模块 - -```js -import continuationManager from "@ohos.continuation.continuationManager" -``` - ## ContinuationExtraParams 表示流转管理入口中互联面板所需的过滤参数。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-continuation-continuationManager.md b/zh-cn/application-dev/reference/apis/js-apis-continuation-continuationManager.md index 5153a98a31ae33a6ee20d9e321de71bf181518c4..45c58a00994e6faeac13fa6d95b670751839c6dc 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-continuation-continuationManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-continuation-continuationManager.md @@ -1,10 +1,12 @@ # continuationManager +continuationManager模块提供了流转/协同入口管理服务能力,包括连接/取消流转管理服务,注册/解注册设备连接变化监听,拉起设备选择模块,更新连接状态。 -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +本模块接口用于拉起系统中的设备选择模块,由于该模块功能暂不完备,因此**流转能力整体暂不支持用于应用开发**。 -continuationManager模块提供了流转/协同入口管理服务能力,包括连接/取消流转管理服务,注册/解注册设备连接变化监听,拉起互联面板,更新连接状态。 +> **说明:** +> +> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块 @@ -86,6 +88,12 @@ register(options?: ContinuationExtraParams): Promise\; | -------- | -------- | -------- | -------- | | options | [ContinuationExtraParams](js-apis-continuation-continuationExtraParams.md) | 否 | 过滤可选择设备列表的额外参数,该参数可缺省| +**返回值:** + +| 类型 | 说明 | +| ------------------------- | ------------------ | +| Promise\ | Promise形式返回流转管理服务连接后生成的token。 | + **示例:** ```js @@ -144,7 +152,7 @@ on(type: "deviceConnect", token: number, callback: Callback\> | 是 | 当用户从互联面板中选择设备时调用,返回设备ID、设备类型和设备名称供开发者使用。 | + | callback | Callback\> | 是 | 当用户从设备选择模块中选择设备时调用,返回设备ID、设备类型和设备名称供开发者使用。 | **示例:** @@ -173,7 +181,7 @@ on(type: "deviceDisconnect", token: number, callback: Callback\>) | -------- | -------- | -------- | -------- | | type | string | 是 | 监听的事件类型,固定值"deviceDisconnect"。 | | token | number | 是 | 注册后的token。 | - | callback | Callback\> | 是 | 当用户从互联面板中断开设备时调用,返回设备ID供开发者使用。 | + | callback | Callback\> | 是 | 当用户从设备选择模块中断开设备时调用,返回设备ID供开发者使用。 | **示例:** @@ -233,7 +241,7 @@ off(type: "deviceDisconnect", token: number): void; startDeviceManager(token: number, callback: AsyncCallback\): void; -拉起互联面板,可显示组网内可选择设备列表信息,无过滤条件,使用AsyncCallback方式作为异步方法。 +拉起设备选择模块,可显示组网内可选择设备列表信息,无过滤条件,使用AsyncCallback方式作为异步方法。 **系统能力**:SystemCapability.Ability.DistributedAbilityManager @@ -260,7 +268,7 @@ startDeviceManager(token: number, callback: AsyncCallback\): void; startDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback\): void; -拉起互联面板,可显示组网内可选择设备列表信息,使用AsyncCallback方式作为异步方法。 +拉起设备选择模块,可显示组网内可选择设备列表信息,使用AsyncCallback方式作为异步方法。 **系统能力**:SystemCapability.Ability.DistributedAbilityManager @@ -291,7 +299,7 @@ startDeviceManager(token: number, options: ContinuationExtraParams, callback: As startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\; -拉起互联面板,可显示组网内可选择设备列表信息,使用Promise方式作为异步方法。 +拉起设备选择模块,可显示组网内可选择设备列表信息,使用Promise方式作为异步方法。 **系统能力**:SystemCapability.Ability.DistributedAbilityManager @@ -302,6 +310,12 @@ startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\ | Promise形式返回接口调用结果。 | + **示例:** ```js @@ -321,7 +335,7 @@ startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\): void; -通知互联面板,更新当前的连接状态,使用AsyncCallback方式作为异步方法。 +通知设备选择模块,更新当前的连接状态,使用AsyncCallback方式作为异步方法。 **系统能力**:SystemCapability.Ability.DistributedAbilityManager @@ -351,7 +365,7 @@ updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState, updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState): Promise\; -通知互联面板,更新当前的连接状态,使用Promise方式作为异步方法。 +通知设备选择模块,更新当前的连接状态,使用Promise方式作为异步方法。 **系统能力**:SystemCapability.Ability.DistributedAbilityManager @@ -363,6 +377,12 @@ updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState) | deviceId | string | 是 | 设备ID。 | | status | [DeviceConnectState](#deviceconnectstate) | 是 | 设备连接状态。 | +**返回值:** + +| 类型 | 说明 | +| ------------------------- | ------------------ | +| Promise\ | Promise形式返回接口调用结果。 | + **示例:** ```js @@ -417,6 +437,12 @@ unregister(token: number): Promise\; | -------- | -------- | -------- | -------- | | token | number | 是 | 注册后的token。 | +**返回值:** + +| 类型 | 说明 | +| ------------------------- | ------------------ | +| Promise\ | Promise形式返回接口调用结果。 | + **示例:** ```js @@ -446,7 +472,7 @@ unregister(token: number): Promise\; ## ContinuationMode -互联面板连接模式。 +设备选择模块连接模式。 **系统能力**:SystemCapability.Ability.DistributedAbilityManager @@ -454,5 +480,5 @@ unregister(token: number): Promise\; | 参数名 | 类型 | 值 | 说明 | | -------- | -------- | -------- | -------- | - | COLLABORATION_SINGLE | number | 0 | 互联面板单选模式。 | - | COLLABORATION_MULTIPLE | number | 1 | 互联面板多选模式。 | \ No newline at end of file + | COLLABORATION_SINGLE | number | 0 | 设备选择模块单选模式。 | + | COLLABORATION_MULTIPLE | number | 1 | 设备选择模块多选模式。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-convertxml.md b/zh-cn/application-dev/reference/apis/js-apis-convertxml.md index b5bad4a12fb5be6631b00662311387e9f217dd18..cbb605b604614e67100be55225ba64230b8f4206 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-convertxml.md +++ b/zh-cn/application-dev/reference/apis/js-apis-convertxml.md @@ -49,10 +49,10 @@ let xml = ''; let conv = new convertxml.ConvertXML(); let options = {trim : false, declarationKey:"_declaration", - instructionKey : "_instruction", attributesKey : "_attributes", - textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype", - commentKey : "_comment", parentKey : "_parent", typeKey : "_type", - nameKey : "_name", elementsKey : "_elements"} + instructionKey : "_instruction", attributesKey : "_attributes", + textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype", + commentKey : "_comment", parentKey : "_parent", typeKey : "_type", + nameKey : "_name", elementsKey : "_elements"} let result = JSON.stringify(conv.convert(xml, options)); console.log(result) ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-DataShareResultSet.md b/zh-cn/application-dev/reference/apis/js-apis-data-DataShareResultSet.md index 8f6a8e74a15d7acd70863f92abd8c1adc122b956..c48c588a1110c8085feee3a9f88ec5167a7b1f32 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-DataShareResultSet.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-DataShareResultSet.md @@ -44,7 +44,10 @@ dataShareHelper.query(uri, da, columns).then((data) => { }); ``` -## 属性 +## DataShareResultSet +提供通过查询数据库生成的结果集的相关访问方法。 + +### 属性 **系统能力:** SystemCapability.DistributedDataManager.DataShare.Core @@ -55,7 +58,7 @@ dataShareHelper.query(uri, da, columns).then((data) => { | rowCount | number | 是 | 结果集中的行数。 | | isClosed | boolean | 是 | 标识当前结果集是否关闭。 | -## goToFirstRow +### goToFirstRow goToFirstRow(): boolean @@ -76,7 +79,7 @@ let isGoTOFirstRow = resultSet.goToFirstRow(); console.info('resultSet.goToFirstRow: ' + isGoTOFirstRow); ``` -## goToLastRow +### goToLastRow goToLastRow(): boolean @@ -97,7 +100,7 @@ let isGoToLastRow = resultSet.goToLastRow(); console.info('resultSet.goToLastRow: ' + isGoToLastRow); ``` -## goToNextRow +### goToNextRow goToNextRow(): boolean @@ -118,7 +121,7 @@ let isGoToNextRow = resultSet.goToNextRow(); console.info('resultSet.goToNextRow: ' + isGoToNextRow); ``` -## goToPreviousRow +### goToPreviousRow goToPreviousRow(): boolean @@ -139,7 +142,7 @@ let isGoToPreviousRow = resultSet.goToPreviousRow(); console.info('resultSet.goToPreviousRow: ' + isGoToPreviousRow); ``` -## goTo +### goTo goTo(offset:number): boolean @@ -167,7 +170,7 @@ let isGoTo = resultSet.goTo(goToNum); console.info('resultSet.goTo: ' + isGoTo); ``` -## goToRow +### goToRow goToRow(position: number): boolean @@ -195,7 +198,7 @@ let isGoToRow = resultSet.goToRow(goToRowNum); console.info('resultSet.goToRow: ' + isGoToRow); ``` -## getBlob +### getBlob getBlob(columnIndex: number): Uint8Array @@ -224,7 +227,7 @@ let getBlob = resultSet.getBlob(columnIndex); console.info('resultSet.getBlob: ' + getBlob); ``` -## getString +### getString getString(columnIndex: number): *string* @@ -253,7 +256,7 @@ let getString = resultSet.getString(columnIndex); console.info('resultSet.getString: ' + getString); ``` -## getLong +### getLong getLong(columnIndex: number): number @@ -282,7 +285,7 @@ let getLong = resultSet.getLong(columnIndex); console.info('resultSet.getLong: ' + getLong); ``` -## getDouble +### getDouble getDouble(columnIndex: number): number @@ -311,7 +314,7 @@ let getDouble = resultSet.getDouble(columnIndex); console.info('resultSet.getDouble: ' + getDouble); ``` -## close +### close close(): void @@ -325,7 +328,7 @@ close(): void resultSet.close(); ``` -## getColumnIndex +### getColumnIndex getColumnIndex(columnName: string): number @@ -353,7 +356,7 @@ let getColumnIndex = resultSet.getColumnIndex(ColumnName) console.info('resultSet.getColumnIndex: ' + getColumnIndex); ``` -## getColumnName +### getColumnName getColumnName(columnIndex: number): *string* @@ -381,7 +384,7 @@ let getColumnName = resultSet.getColumnName(columnIndex) console.info('resultSet.getColumnName: ' + getColumnName); ``` -## getDataType +### getDataType getDataType(columnIndex: number): DataType diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md b/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md index 8d3c580b8623b2bd7a5079acf84218e5dcf31c63..19acb3eb1bbd89a0e710fd941e8de936615d211f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md @@ -10,7 +10,6 @@ ## 导入模块 ```ts -import Ability from '@ohos.application.Ability' import dataShare from '@ohos.data.dataShare' ``` @@ -34,7 +33,7 @@ createDataShareHelper(context: Context, uri: string, callback: AsyncCallback< **示例:** ```ts -import dataShare from '@ohos.data.dataShare' +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); let dataShareHelper; @@ -72,7 +71,7 @@ createDataShareHelper(context: Context, uri: string): Promise<DataShareHelper **示例:** ```ts -import dataShare from '@ohos.data.dataShare' +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); let dataShareHelper; @@ -109,11 +108,12 @@ openFile(uri: string, mode: string, callback: AsyncCallback<number>): void **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.openFile(uri, "rwt", (err, data) => { if (err != undefined) { console.info("openFile failed, error message : " + err); - }erse { + }else { console.info("openFile succeed, data : " + data); let fd = data; } @@ -146,6 +146,7 @@ openFile(uri: string, mode: string): Promise<number> **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.openFile(uri, "rwt").then((data) => { console.info("openFile succeed, data : " + data); @@ -176,6 +177,7 @@ on(type: 'dataChange', uri: string, callback: AsyncCallback<void>): void **示例:** ```ts +import Ability from '@ohos.application.Ability' function onCallback() { console.info("**** Observer on callback ****"); } @@ -204,6 +206,7 @@ off(type: 'dataChange', uri: string, callback?: AsyncCallback<void>): void **示例:** ```ts +import Ability from '@ohos.application.Ability' function offCallback() { console.info("**** Observer off callback ****"); } @@ -232,6 +235,7 @@ insert(uri: string, value: ValuesBucket, callback: AsyncCallback<number>): **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); const valueBucket = { "name": "rose", @@ -273,6 +277,7 @@ insert(uri: string, value: ValuesBucket): Promise<number> **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); const valueBucket = { "name": "rose1", @@ -307,6 +312,7 @@ delete(uri: string, predicates: dataSharePredicates.DataSharePredicates, callbac **示例:** ```ts +import Ability from '@ohos.application.Ability' import dataSharePredicates from '@ohos.data.dataSharePredicates' let uri = ("datashare:///com.samples.datasharetest.DataShare"); @@ -347,6 +353,7 @@ delete(uri: string, predicates: dataSharePredicates.DataSharePredicates): Promis **示例:** ```ts +import Ability from '@ohos.application.Ability' import dataSharePredicates from '@ohos.data.dataSharePredicates' let uri = ("datashare:///com.samples.datasharetest.DataShare"); @@ -381,6 +388,7 @@ query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: **示例:** ```ts +import Ability from '@ohos.application.Ability' import dataSharePredicates from '@ohos.data.dataSharePredicates' let uri = ("datashare:///com.samples.datasharetest.DataShare"); @@ -423,6 +431,7 @@ query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: **示例:** ```ts +import Ability from '@ohos.application.Ability' import dataSharePredicates from '@ohos.data.dataSharePredicates' let uri = ("datashare:///com.samples.datasharetest.DataShare"); @@ -458,6 +467,7 @@ update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: **示例:** ```ts +import Ability from '@ohos.application.Ability' import dataSharePredicates from '@ohos.data.dataSharePredicates' let uri = ("datashare:///com.samples.datasharetest.DataShare"); @@ -505,6 +515,7 @@ update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: **示例:** ```ts +import Ability from '@ohos.application.Ability' import dataSharePredicates from '@ohos.data.dataSharePredicates' let uri = ("datashare:///com.samples.datasharetest.DataShare"); @@ -544,6 +555,7 @@ batchInsert(uri: string, values: Array<ValuesBucket>, callback: AsyncCallb **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); let vbs = new Array({"name": "roe11", "age": 21, "salary": 20.5,}, {"name": "roe12", "age": 21, "salary": 20.5,}, @@ -583,6 +595,7 @@ batchInsert(uri: string, values: Array<ValuesBucket>): Promise<number&g **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); let vbs = new Array({"name": "roe11", "age": 21, "salary": 20.5,}, {"name": "roe12", "age": 21, "salary": 20.5,}, @@ -614,6 +627,7 @@ getType(uri: string, callback: AsyncCallback<string>): void **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.getType(uri, (err, data)=>{ if (err != undefined) { @@ -650,6 +664,7 @@ getType(uri: string): Promise<string> **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.getType(uri).then((data) => { console.log("getType succeed, data : " + data); @@ -679,6 +694,7 @@ getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback<Arr **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); let mimeTypeFilter = "image/*"; dataShareHelper.getFileTypes(uri, mimeTypeFilter, (err,data) => { @@ -716,6 +732,7 @@ getFileTypes(uri: string, mimeTypeFilter: string): Promise<Array<string> **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); let mimeTypeFilter = "image/*"; dataShareHelper.getFileTypes(uri, mimeTypeFilter).then((data) => { @@ -745,6 +762,7 @@ normalizeUri(uri: string, callback: AsyncCallback<string>): void **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.normalizeUri(uri, (err, data) => { if (err != undefined) { @@ -780,6 +798,7 @@ normalizeUri(uri: string): Promise<string> **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.normalizeUri(uri).then((data) => { console.log("normalizeUri = " + data); @@ -808,6 +827,7 @@ denormalizeUri(uri: string, callback: AsyncCallback<string>): void **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.denormalizeUri(uri, (err, data) => { if (err != undefined) { @@ -843,6 +863,7 @@ denormalizeUri(uri: string): Promise<string> **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.denormalizeUri(uri).then((data) => { console.log("denormalizeUri = " + data); @@ -871,6 +892,7 @@ notifyChange(uri: string, callback: AsyncCallback<void>): void **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.notifyChange(uri, () => { console.log("***** notifyChange *****"); @@ -902,6 +924,7 @@ notifyChange(uri: string): Promise<void> **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.notifyChange(uri); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-dataSharePredicates.md b/zh-cn/application-dev/reference/apis/js-apis-data-dataSharePredicates.md index ec3f8ec052238bc21e7153365bbf026f259f4ccd..91fcd5fa3bcd519cef639c39bdadfeac7b5b11b8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-dataSharePredicates.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-dataSharePredicates.md @@ -13,7 +13,10 @@ import dataSharePredicates from '@ohos.data.dataSharePredicates'; ``` -## equalTo +## DataSharePredicates +提供用于不同实现不同查询方法的数据共享谓词。 + +### equalTo equalTo(field: string, value: ValueType): DataSharePredicates @@ -43,7 +46,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.equalTo("NAME", "Rose") ``` -## notEqualTo +### notEqualTo notEqualTo(field: string, value: ValueType): DataSharePredicates @@ -73,7 +76,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.notEqualTo("NAME", "Rose") ``` -## beginWrap +### beginWrap beginWrap(): DataSharePredicates @@ -99,7 +102,7 @@ predicates.equalTo("NAME", "lisi") .endWrap() ``` -## endWrap +### endWrap endWrap(): DataSharePredicates @@ -125,7 +128,7 @@ predicates.equalTo("NAME", "lisi") .endWrap() ``` -## or +### or or(): DataSharePredicates @@ -150,7 +153,7 @@ predicates.equalTo("NAME", "lisi") .equalTo("NAME", "Rose") ``` -## and +### and and(): DataSharePredicates @@ -175,7 +178,7 @@ predicates.equalTo("NAME", "lisi") .equalTo("SALARY", 200.5) ``` -## contains +### contains contains(field: string, value: string): DataSharePredicates @@ -203,7 +206,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.contains("NAME", "os") ``` -## beginsWith +### beginsWith beginsWith(field: string, value: string): DataSharePredicates @@ -231,7 +234,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.beginsWith("NAME", "os") ``` -## endsWith +### endsWith endsWith(field: string, value: string): DataSharePredicates @@ -259,7 +262,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.endsWith("NAME", "os") ``` -## isNull +### isNull isNull(field: string): DataSharePredicates @@ -288,7 +291,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.isNull("NAME") ``` -## isNotNull +### isNotNull isNotNull(field: string): DataSharePredicates @@ -317,7 +320,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.isNotNull("NAME") ``` -## like +### like like(field: string, value: string): DataSharePredicates @@ -347,7 +350,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.like("NAME", "%os%") ``` -## unlike +### unlike unlike(field: string, value: string): DataSharePredicates @@ -377,7 +380,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.unlike("NAME", "%os%") ``` -## glob +### glob glob(field: string, value: string): DataSharePredicates @@ -405,7 +408,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.glob("NAME", "?h*g") ``` -## between +### between between(field: string, low: ValueType, high: ValueType): DataSharePredicates @@ -434,7 +437,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.between("AGE", 10, 50) ``` -## notBetween +### notBetween notBetween(field: string, low: ValueType, high: ValueType): DataSharePredicates @@ -463,7 +466,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.notBetween("AGE", 10, 50) ``` -## greaterThan +### greaterThan greaterThan(field: string, value: ValueType): DataSharePredicates @@ -493,7 +496,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.greaterThan("AGE", 10) ``` -## lessThan +### lessThan lessThan(field: string, value: ValueType): DataSharePredicates @@ -523,7 +526,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.lessThan("AGE", 50) ``` -## greaterThanOrEqualTo +### greaterThanOrEqualTo greaterThanOrEqualTo(field: string, value: ValueType): DataSharePredicates @@ -553,7 +556,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.greaterThanOrEqualTo("AGE", 10) ``` -## lessThanOrEqualTo +### lessThanOrEqualTo lessThanOrEqualTo(field: string, value: ValueType): DataSharePredicates @@ -583,7 +586,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.lessThanOrEqualTo("AGE", 50) ``` -## orderByAsc +### orderByAsc orderByAsc(field: string): DataSharePredicates @@ -612,7 +615,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.orderByAsc("AGE") ``` -## orderByDesc +### orderByDesc orderByDesc(field: string): DataSharePredicates @@ -641,7 +644,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.orderByDesc("AGE") ``` -## distinct +### distinct distinct(): DataSharePredicates @@ -659,10 +662,10 @@ distinct(): DataSharePredicates ```ts let predicates = new dataSharePredicates.DataSharePredicates() -predicates.equalTo("NAME", "Rose").distinct("NAME") +predicates.equalTo("NAME", "Rose").distinct() ``` -## limit +### limit limit(total: number, offset: number): DataSharePredicates @@ -692,7 +695,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.equalTo("NAME", "Rose").limit(10, 3) ``` -## groupBy +### groupBy groupBy(fields: Array<string>): DataSharePredicates @@ -719,7 +722,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.groupBy(["AGE", "NAME"]) ``` -## indexedBy +### indexedBy indexedBy(field: string): DataSharePredicates @@ -746,7 +749,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.indexedBy("SALARY_INDEX") ``` -## in +### in in(field: string, value: Array<ValueType>): DataSharePredicates @@ -776,7 +779,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.in("AGE", [18, 20]) ``` -## notIn +### notIn notIn(field: string, value: Array<ValueType>): DataSharePredicates @@ -806,7 +809,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.notIn("NAME", ["Lisa", "Rose"]) ``` -## prefixKey +### prefixKey prefixKey(prefix: string): DataSharePredicates @@ -833,7 +836,7 @@ let predicates = new dataSharePredicates.DataSharePredicates() predicates.prefixKey("NAME") ``` -## inKeys +### inKeys inKeys(keys: Array<string>): DataSharePredicates diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md b/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md index 80f4ebc314fd1df08601f0843f88663cd6f05c5e..c58b2ad12209b1fabfd32d7c7e83fa38eec097a3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md @@ -253,11 +253,12 @@ save(deviceId: string, callback: AsyncCallback<SaveSuccessResponse>): void import distributedObject from '@ohos.data.distributedDataObject'; var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); g_object.setSessionId("123456"); -g_object.save("local", (result)=>{ +g_object.save("local", (status, result)=>{ + console.log("save status = " + status); console.log("save callback"); - console.info("save sessionId " + result.sessionId); - console.info("save version " + result.version); - console.info("save deviceId " + result.deviceId); + console.info("save sessionId: " + result.sessionId); + console.info("save version: " + result.version); + console.info("save deviceId: " + result.deviceId); }); ``` @@ -306,7 +307,7 @@ g_object.save("local").then((result)=>{ ### revokeSave9+ -revokeSave(callback: AsyncCallback<SaveSuccessResponse>): void +revokeSave(callback: AsyncCallback<RevokeSaveSuccessResponse>): void 撤回保存的分布式数据对象。使用callback方式作为异步方法。 @@ -333,7 +334,7 @@ g_object.revokeSave((result, data) =>{ ### revokeSave9+ -revokeSave(): Promise<SaveSuccessResponse> +revokeSave(): Promise<RevokeSaveSuccessResponse> 撤回保存的分布式数据对象。使用Promise方式作为异步方法。 @@ -354,7 +355,7 @@ revokeSave(): Promise<SaveSuccessResponse> import distributedObject from '@ohos.data.distributedDataObject'; var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); g_object.setSessionId("123456"); -g_object.revokeSave("local").then((result)=>{ +g_object.revokeSave().then((result)=>{ console.log("revokeSave callback"); console.log("sessionId" + result.sessionId); }, ()=>{ diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-rdb.md b/zh-cn/application-dev/reference/apis/js-apis-data-rdb.md index 594c29417b3cd9c48d1983b85312eab6a702bd28..ed678b96b9696d4527174fc498abdca488c04286 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-rdb.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-rdb.md @@ -781,13 +781,6 @@ distinct(): RdbPredicates ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.equalTo("NAME", "Rose").distinct("NAME") -let promise = rdbStore.query(predicates, ["NAME"]) -promise.then((resultSet) => { - console.log("ResultSet column names: " + resultSet.columnNames) - console.log("ResultSet column count: " + resultSet.columnCount) -}).catch((err) => { - console.log("Query err.") -}) ``` @@ -1133,7 +1126,7 @@ rdbStore.update("EMPLOYEE", valueBucket, predicates, function (err, ret) { ``` ### update9+ -update(table: string, values: ValuesBucket, predicates: DataSharePredicates):Promise<number> +update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates):Promise<number> 根据DataSharePredicates的指定实例对象更新数据库中的数据,结果以Promise形式返回。 @@ -1231,7 +1224,7 @@ promise.then((rows) => { ### delete9+ -delete(table: string, predicates: DataSharePredicates, callback: AsyncCallback<number>):void +delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>):void 根据DataSharePredicates的指定实例对象从数据库中删除数据,结果以callback形式返回。 @@ -1354,7 +1347,7 @@ query(predicates: RdbPredicates, columns?: Array<string>):Promise<Resul ### query9+ -query(predicates: DataSharePredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>):void +query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>):void 根据指定条件查询数据库中的数据,结果以callback形式返回。 @@ -1363,6 +1356,7 @@ query(predicates: DataSharePredicates, columns: Array<string>, callback: A **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | +| table | string | 是 | 指定的目标表名。 | | predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | 是 | DataSharePredicates的实例对象指定的查询条件。 | | columns | Array<string> | 是 | 表示要查询的列。如果值为空,则查询应用于所有列。 | | callback | AsyncCallback<[ResultSet](js-apis-data-resultset.md)> | 是 | 指定callback回调函数。如果操作成功,则返回ResultSet对象。 | @@ -1384,7 +1378,7 @@ rdbStore.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], ### query9+ -query(predicates: DataSharePredicates, columns?: Array<string>):Promise<ResultSet> +query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns?: Array<string>):Promise<ResultSet> 根据指定条件查询数据库中的数据,结果以Promise形式返回。 @@ -1393,6 +1387,7 @@ query(predicates: DataSharePredicates, columns?: Array<string>):Promise< **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | +| table | string | 是 | 指定的目标表名。 | | predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | 是 | DataSharePredicates的实例对象指定的查询条件。 | | columns | Array<string> | 否 | 表示要查询的列。如果值为空,则查询应用于所有列。 | @@ -1591,7 +1586,7 @@ rdbStore.commit() ### rollBack8+ -rollBack():void; +rollBack():void 回滚已经执行的SQL语句。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md b/zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md index 3810f7281a58ec11c0dbf0b7e6e376be05fd66fe..be98b82dab1e822070f37cf16c69135b7f2ffba7 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md +++ b/zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md @@ -662,7 +662,7 @@ DAHelper.delete( ## DataAbilityHelper.delete -delete(uri: string, predicates: dataAbility.DataAbilityPredicates): Promise\ +delete(uri: string, predicates?: dataAbility.DataAbilityPredicates): Promise\; 从数据库中删除一个或多个数据记录(Promise形式)。 @@ -685,7 +685,7 @@ delete(uri: string, predicates: dataAbility.DataAbilityPredicates): Promise\ +update(uri: string, valuesBucket: rdb.ValuesBucket, predicates?: dataAbility.DataAbilityPredicates): Promise\; 更新数据库中的数据记录(Promise形式)。 @@ -825,7 +825,7 @@ DAHelper.query( ## DataAbilityHelper.query -query(uri: string, columns: Array\, predicates: dataAbility.DataAbilityPredicates): Promise\ +query(uri: string, columns?: Array\, predicates?: dataAbility.DataAbilityPredicates): Promise\; 查询数据库中的数据(Promise形式)。 @@ -932,8 +932,107 @@ dataAbilityHelper.call("dataability:///com.example.jsapidemo.UserDataAbility", " console.info('Operation succeeded: ' + data); }); ``` + +## DataAbilityHelper.executeBatch + +executeBatch(uri: string, operations: Array\, callback: AsyncCallback\>): void; + +查询数据库中的数据。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | --------------------------------- | ---- | ------------------------------------------------ | +| uri | string | 是 | 指定待处理的DataAbility。例:"dataability:///com.example.xxx.xxxx"。| +| operations | Array\<[DataAbilityOperation](#dataabilityoperation)> | 是 | 指示数据操作列表,其中可以包含对数据库的多个操作。 | +| callback | AsyncCallback\> | 是 |在数组 DataAbilityResult中返回每个操作的结果。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility'; + +// 根据DataAbilityOperation列表选择要对数据库做的操作 +let op=new Array(); +let dataAbilityHelper = featureAbility.acquireDataAbilityHelper("dataability:///com.example.jsapidemo.UserDataAbility"); +dataAbilityHelper.executeBatch("dataability:///com.example.jsapidemo.UserDataAbility", op, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + err); + return; + } + console.info('Operation succeeded: ' + data); +}); +``` + +## DataAbilityHelper.executeBatch + +executeBatch(uri: string, operations: Array\): Promise\>; + +查询数据库中的数据。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | -------------------------------| ---- | ------------------------------------------------ | +| uri | string | 是 | 指定待处理的DataAbility。例:"dataability:///com.example.xxx.xxxx"。| +| operations | Array\<[DataAbilityOperation](#dataabilityoperation)> | 是 | 指示数据操作列表,其中可以包含对数据库的多个操作。 | + +**返回值:** + +| 类型 | 说明 | +|------ | ------- | +|Promise\> | 在数组 DataAbilityResult中返回每个操作的结果。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility'; + +// 根据DataAbilityOperation列表选择要对数据库做的操作 +let op=new Array(); +let dataAbilityHelper = featureAbility.acquireDataAbilityHelper("dataability:///com.example.jsapidemo.UserDataAbility"); +dataAbilityHelper.executeBatch("dataability:///com.example.jsapidemo.UserDataAbility",op ).then((data) => { + console.info('Operation succeeded: ' + data); +}).catch((error) => { + console.error('Operation failed. Cause: ' + error); +}); + +``` + ## PacMap +[key: string]: number | string | boolean | Array\ | null; + +**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel + | 名称 | 参数类型 | 必填 | 说明 | | ------ | ------ | ------ | ------ | -| [key: string] | number \| string \| boolean \| Array\ \| null | 是 | 数据存储在键值对中。 | \ No newline at end of file +| [key: string] | number \| string \| boolean \| Array\ \| null | Yes| 数据存储在键值对中。| + +## DataAbilityOperation + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.FAModel + +| 名称 | 参数类型 | 可读 | 可写 | 必填| 说明 | +| -------- | -------- | -------- | -------- | --------| -------- | +| uri | string | 是 | 否 | 是 | 指定待处理的DataAbility。例:"dataability:///com.example.xxx.xxxx"。 | +| type | featureAbility.DataAbilityOperationType | 是 | 否 | 是 | 指示操作类型。 | +| valuesBucket? | rdb.ValuesBucket | 是 | 否 | 否 | 指示要设置的数据值。 | +| valueBackReferences? | rdb.ValuesBucket | 是 | 否 | 否 | 指示包含一组键值对的valuesBucket对象。 | +| predicates? | dataAbility.DataAbilityPredicates | 是 | 否 | 否 | 指示要设置的筛选条件。如果此参数为空,则所有数据记录。 | +| predicatesBackReferences? | Map\ | 是 | 否 | 否 | 指示用作谓词中筛选条件的反向引用。 | +| interrupted? | boolean | 是 | 否 | 否 | 指定是否可以中断批处理操作。 | +| expectedCount? | number | 是 | 否 | 否 | 指示要更新或删除的预期行数。 | + +## DataAbilityResult + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.FAModel + +| 名称 | 参数类型 | 可读 | 可写 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | -------- | -------- | +| uri? | string | 是 | 否 | 否 | 指定待处理的DataAbility。例:"dataability:///com.example.xxx.xxxx"。 | +| count? | number | 是 | 否 | 否 | 指示受操作影响的行数。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md b/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md index be9e8afb3b9c6ae8fb5d186f2be1f00e7cc77db5..7e81e8c7804a5376b4221740f261adca4b7a2ba0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md +++ b/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md @@ -125,15 +125,6 @@ queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void **示例**: ```javascript -//有bundleName的callback -bundleState.queryAppUsagePriorityGroup(this.bundleName, (err, res) => { - if(err) { - console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code); - } else { - console.log('BUNDLE_ACTIVE QueryPackageGroup callback succeeded. result: ' + JSON.stringify(res)); - } -}); -//无bundleName的callback bundleState.queryAppUsagePriorityGroup((err, res) => { if(err) { console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code); @@ -566,7 +557,8 @@ queryAppUsagePriorityGroup(bundleName? : string): Promise<number> ```javascript //有bundleName的promise -bundleState.queryAppUsagePriorityGroup(this.bundleName).then( res => { +let bundleName = "com.ohos.camera"; +bundleState.queryAppUsagePriorityGroup(bundleName).then( res => { console.log('BUNDLE_ACTIVE QueryPackageGroup promise succeeded. result: ' + JSON.stringify(res)); }).catch( err => { console.log('BUNDLE_ACTIVE QueryPackageGroup promise failed. because: ' + err.code); @@ -602,7 +594,8 @@ queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback<numb ```javascript //有bundleName的callback -bundleState.queryAppUsagePriorityGroup(this.bundleName, (err, res) => { +let bundleName = "com.ohos.camera"; +bundleState.queryAppUsagePriorityGroup(bundleName, (err, res) => { if(err) { console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code); } else { diff --git a/zh-cn/application-dev/reference/apis/js-apis-dispatchInfo.md b/zh-cn/application-dev/reference/apis/js-apis-dispatchInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..2ea328f8452288a0bf4461c6704217f5323cb971 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-dispatchInfo.md @@ -0,0 +1,20 @@ +# DispatchInfo + + + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + + +调度信息类 + +## DispatchInfo + +**系统能力**: 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------- | ------ | ---- | ---- | ------------------------ | +| verison | string | 是 | 否 | 包含dispatchInfo版本信息 | +| dispatchAPI | string | 是 | 否 | 包含免安装接口版本号 | + diff --git a/zh-cn/application-dev/reference/apis/js-apis-distributed-account.md b/zh-cn/application-dev/reference/apis/js-apis-distributed-account.md index f6e715f41a98d066a88c4dc58c2064ee63dba262..b732f93c73422cd4bfeafc01ca25962202fef2a1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-distributed-account.md +++ b/zh-cn/application-dev/reference/apis/js-apis-distributed-account.md @@ -43,7 +43,7 @@ queryOsAccountDistributedInfo(callback: AsyncCallback<DistributedInfo>): v **系统能力:** SystemCapability.Account.OsAccount -**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS 或 ohos.permission.DISTRIBUTED_DATASYNC,该权限仅供系统应用使用。 +**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS 或 ohos.permission.DISTRIBUTED_DATASYNC。 - 参数: | 参数名 | 类型 | 必填 | 说明 | @@ -68,7 +68,7 @@ queryOsAccountDistributedInfo(): Promise<DistributedInfo> **系统能力:** SystemCapability.Account.OsAccount -**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS 或 ohos.permission.DISTRIBUTED_DATASYNC,该权限仅供系统应用使用。 +**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS 或 ohos.permission.DISTRIBUTED_DATASYNC。 - 返回值: | 类型 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md b/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md index bce2591a506eed842549ea74ba9d2bd505084335..348934141adb189b9db1a8ce7a53aca355118ae0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md +++ b/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md @@ -39,6 +39,7 @@ createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager> | callback | AsyncCallback<[KVManager](#kvmanager)> | 是 | 回调函数。返回创建的KVManager对象实例。 | **示例:** + Stage模型下的示例: ```ts import AbilityStage from '@ohos.application.Ability' @@ -116,6 +117,7 @@ createKVManager(config: KVManagerConfig): Promise<KVManager> | Promise<[KVManager](#kvmanager)> | Promise对象。返回创建的KVManager对象实例。 | **示例:** + Stage模型下的示例: ```ts import AbilityStage from '@ohos.application.Ability' @@ -180,7 +182,7 @@ export default class MyAbilityStage extends AbilityStage { | 参数名 | 参数类型 | 必填 | 说明 | | ----- | ------ | ------ | ------ | -| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-Context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。| +| context9+ | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-Context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。| | userInfo | [UserInfo](#userinfo) | 是 | 调用方的用户信息。 | | bundleName | string | 是 | 调用方的包名。 | @@ -556,7 +558,7 @@ getAllKVStoreId(appId: string): Promise<string[]> let kvManager; try { console.log('GetAllKVStoreId'); - kvManager.getAllKVStoreId('apppId').then((data) => { + kvManager.getAllKVStoreId('appId').then((data) => { console.log('getAllKVStoreId success'); console.log('size = ' + data.length); }).catch((err) => { @@ -636,17 +638,16 @@ try { 用于提供创建数据库的配置信息。 -**系统能力:** SystemCapability.DistributedDataManager.KVStore.Core | 参数名 | 参数类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------- | -| createIfMissing | boolean | 否 | 当数据库文件不存在时是否创建数据库,默认创建。 | -| encrypt | boolean | 否 |设置数据库文件是否加密,默认不加密。 | -| backup | boolean | 否 |设置数据库文件是否备份,默认备份。 | -| autoSync | boolean | 否 |设置数据库文件是否自动同步,默认不自动同步。
**需要权限**: ohos.permission.DISTRIBUTED_DATASYNC | -| kvStoreType | [KVStoreType](#kvstoretype) | 否 |设置要创建的数据库类型,默认为多设备协同数据库。 | -| securityLevel | [SecurityLevel](#securitylevel) | 否 |设置数据库安全级别,默认不设置安全级别。 | -| schema8+ | [Schema](#schema8) | 否 | 设置定义存储在数据库中的值。 | +| createIfMissing | boolean | 否 | 当数据库文件不存在时是否创建数据库,默认创建。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.Core | +| encrypt | boolean | 否 |设置数据库文件是否加密,默认不加密。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.Core | +| backup | boolean | 否 |设置数据库文件是否备份,默认备份。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.Core | +| autoSync | boolean | 否 |设置数据库文件是否自动同步,默认不自动同步。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.Core
**需要权限**: ohos.permission.DISTRIBUTED_DATASYNC | +| kvStoreType | [KVStoreType](#kvstoretype) | 否 |设置要创建的数据库类型,默认为多设备协同数据库。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.Core | +| securityLevel | [SecurityLevel](#securitylevel) | 否 |设置数据库安全级别,默认不设置安全级别。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.Core | +| schema8+ | [Schema](#schema8) | 否 | 设置定义存储在数据库中的值。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore | ## KVStoreType @@ -813,7 +814,7 @@ try { console.log('getResultSet succeed.'); resultSet = result; }).catch((err) => { - console.log('getResultSet failed:ed: ' + err); + console.log('getResultSet failed: ' + err); }); const count = resultSet.getCount(); console.log("getCount succeed:" + count); @@ -843,10 +844,10 @@ let kvStore; try { let resultSet; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('getResultSet succeeed.'); + console.log('getResultSet succeeded.'); resultSet = result; }).catch((err) => { - console.log('getResultSet failed:ed: ' + err); + console.log('getResultSet failed: ' + err); }); const position = resultSet.getPosition(); console.log("getPosition succeed:" + position); @@ -1896,10 +1897,12 @@ limit(total: number, offset: number): Query **示例:** ```js +let total = 10; +let offset = 1; try { let query = new distributedData.Query(); query.notEqualTo("field", "value"); - query.limit("total", "offset"); + query.limit(total, offset); console.log("query is " + query.getSqlLike()); query = null; } catch (e) { @@ -2298,7 +2301,7 @@ try { ### delete9+ -delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<void>): void +delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<void>) 从数据库中删除符合predicates条件的键值对,并通过callback方式返回,此方法为异步方法。 @@ -2314,7 +2317,7 @@ delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallb **示例:** ```js -import dataSharePredicates from './@ohos.data.dataSharePredicates'; +import dataSharePredicates from '@ohos.data.dataSharePredicates'; let kvStore; try { let predicates = new dataSharePredicates.DataSharePredicates(); @@ -2354,7 +2357,7 @@ delete(predicates: dataSharePredicates.DataSharePredicates): Promise<void> **示例:** ```js -import dataSharePredicates from './@ohos.data.dataSharePredicates'; +import dataSharePredicates from '@ohos.data.dataSharePredicates'; let kvStore; try { let predicates = new dataSharePredicates.DataSharePredicates(); @@ -2378,7 +2381,7 @@ try { ### on('dataChange') -on(event: 'dataChange', type: SubscribeType, observer: Callback<ChangeNotification>): void +on(event: 'dataChange', type: SubscribeType, listener: Callback<ChangeNotification>): void 订阅指定类型的数据变更通知。 @@ -2390,7 +2393,7 @@ on(event: 'dataChange', type: SubscribeType, observer: Callback<ChangeNotific | ----- | ------ | ---- | ----------------------- | | event |string | 是 |订阅的事件名,固定为'dataChange',表示数据变更事件。 | | type |[SubscribeType](#subscribetype) | 是 |表示订阅的类型。 | -| observer |Callback<[ChangeNotification](#changenotification)> | 是 |回调函数。 | +| listener |Callback<[ChangeNotification](#changenotification)> | 是 |回调函数。 | **示例:** @@ -2428,7 +2431,7 @@ kvStore.on('syncComplete', function (data) { ### off('dataChange')8+ -off(event:'dataChange', observer?: Callback<ChangeNotification>): void +off(event:'dataChange', listener?: Callback<ChangeNotification>): void 取消订阅数据变更通知。 @@ -2439,7 +2442,7 @@ off(event:'dataChange', observer?: Callback<ChangeNotification>): void | 参数名 | 参数类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------- | | event |string | 是 |取消订阅的事件名,固定为'dataChange',表示数据变更事件。 | -| observer |Callback<[ChangeNotification](#changenotification)> |否 |回调函数。 | +| listener |Callback<[ChangeNotification](#changenotification)> |否 |回调函数。 | **示例:** @@ -2519,10 +2522,10 @@ try { console.log('entries: ' + JSON.stringify(entries)); kvStore.putBatch(entries, async function (err,data) { console.log('putBatch success'); - kvStore.getEntries('batch_test_string_key', function (err,entrys) { + kvStore.getEntries('batch_test_string_key', function (err,entries) { console.log('getEntries success'); - console.log('entrys.length: ' + entrys.length); - console.log('entrys[0]: ' + JSON.stringify(entrys[0])); + console.log('entries.length: ' + entries.length); + console.log('entries[0]: ' + JSON.stringify(entries[0])); }); }); }catch(e) { @@ -2571,7 +2574,7 @@ try { console.log('entries: ' + JSON.stringify(entries)); kvStore.putBatch(entries).then(async (err) => { console.log('putBatch success'); - kvStore.getEntries('batch_test_string_key').then((entrys) => { + kvStore.getEntries('batch_test_string_key').then((entries) => { console.log('getEntries success'); console.log('PutBatch ' + JSON.stringify(entries)); }).catch((err) => { @@ -2588,7 +2591,7 @@ try { ### putBatch9+ putBatch(value: Array<ValuesBucket>, callback: AsyncCallback<void>): void - + 将值写入KvStore数据库,并通过callback方式返回,此方法为异步方法。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.Core @@ -3310,10 +3313,10 @@ try { } kvStore.putBatch(entries, async function (err,data) { console.log('putBatch success'); - kvStore.getEntries('batch_test_number_key', function (err,entrys) { + kvStore.getEntries('batch_test_number_key', function (err,entries) { console.log('getEntries success'); - console.log('entrys.length: ' + entrys.length); - console.log('entrys[0]: ' + JSON.stringify(entrys[0])); + console.log('entries.length: ' + entries.length); + console.log('entries[0]: ' + JSON.stringify(entries[0])); }); }); }catch(e) { @@ -3362,12 +3365,12 @@ try { console.log('entries: ' + entries); kvStore.putBatch(entries).then(async (err) => { console.log('putBatch success'); - kvStore.getEntries('batch_test_string_key').then((entrys) => { + kvStore.getEntries('batch_test_string_key').then((entries) => { console.log('getEntries success'); - console.log('entrys.length: ' + entrys.length); - console.log('entrys[0]: ' + JSON.stringify(entrys[0])); - console.log('entrys[0].value: ' + JSON.stringify(entrys[0].value)); - console.log('entrys[0].value.value: ' + entrys[0].value.value); + console.log('entries.length: ' + entries.length); + console.log('entries[0]: ' + JSON.stringify(entries[0])); + console.log('entries[0].value: ' + JSON.stringify(entries[0].value)); + console.log('entries[0].value.value: ' + entries[0].value.value); }).catch((err) => { console.log('getEntries fail ' + JSON.stringify(err)); }); @@ -3418,10 +3421,10 @@ try { console.log('putBatch success'); const query = new distributedData.Query(); query.prefixKey("batch_test"); - kvStore.getEntries(query, function (err,entrys) { + kvStore.getEntries(query, function (err,entries) { console.log('getEntries success'); - console.log('entrys.length: ' + entrys.length); - console.log('entrys[0]: ' + JSON.stringify(entrys[0])); + console.log('entries.length: ' + entries.length); + console.log('entries[0]: ' + JSON.stringify(entries[0])); }); }); console.log('GetEntries success'); @@ -3474,7 +3477,7 @@ try { console.log('putBatch success'); const query = new distributedData.Query(); query.prefixKey("batch_test"); - kvStore.getEntries(query).then((entrys) => { + kvStore.getEntries(query).then((entries) => { console.log('getEntries success'); }).catch((err) => { console.log('getEntries fail ' + JSON.stringify(err)); @@ -3715,12 +3718,12 @@ getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: Asyn | 参数名 | 参数类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------- | | predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | 是 |指示筛选条件,当此参数为null时,应定义处理逻辑。 | -| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultsetsup8sup)> | 是 |回调函数,获取与指定Predicates对象匹配的KvStoreResultSet对象。 | +| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | 是 |回调函数,获取与指定Predicates对象匹配的KvStoreResultSet对象。 | **示例:** ```js -import dataSharePredicates from './@ohos.data.dataSharePredicates'; +import dataSharePredicates from '@ohos.data.dataSharePredicates'; let kvStore; try { let resultSet; @@ -3760,7 +3763,7 @@ getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise<Kv **示例:** ```js -import dataSharePredicates from './@ohos.data.dataSharePredicates'; +import dataSharePredicates from '@ohos.data.dataSharePredicates'; let kvStore; try { let resultSet; @@ -3769,7 +3772,7 @@ try { kvStore.getResultSet(predicates) .then((result) => { console.log(' GetResultSet success'); resultSet = result; - kvStore.closeResultSet(resultSet, fun ction (err, data) { + kvStore.closeResultSet(resultSet, function (err, data) { console.log(' closeResultSet success'); }) }); @@ -4161,7 +4164,7 @@ kvStore.off('dataChange', function (data) { ### sync7+ -sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void +sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void 在手动同步方式下,触发数据库同步。关于分布式数据服务的同步方式说明,请见[分布式数据服务概述](../../database/database-mdds-overview.md)。 @@ -4173,9 +4176,9 @@ sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void | 参数名 | 参数类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------- | -| deviceIdList |string[] | 是 |同一组网环境下,需要同步的设备的deviceId列表。 | +| deviceIds |string[] | 是 |同一组网环境下,需要同步的设备的deviceId列表。 | | mode |[SyncMode](#syncmode) | 是 |同步模式。 | -| allowedDelayMs |number | 否 |可选参数,允许延时时间,单位:ms(毫秒)。 | +| delayMs |number | 否 |可选参数,允许延时时间,单位:ms(毫秒)。 | **示例:** @@ -4199,13 +4202,13 @@ sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void | ----- | ------ | ---- | ----------------------- | | deviceIds |string[] | 是 |同一组网环境下,需要同步的设备的deviceId列表。 | | mode |[SyncMode](#syncmode) | 是 |同步模式。 | -| query |[Query](#querysup8sup) | 是 |表示数据库的查询谓词条件 | +| query |[Query](#query8) | 是 |表示数据库的查询谓词条件 | | delayMs |number | 否 |可选参数,允许延时时间,单位:ms(毫秒)。 | **示例:** ```js -let kvstore; +let kvStore; const KEY_TEST_SYNC_ELEMENT = 'key_test_sync'; const VALUE_TEST_SYNC_ELEMENT = 'value-string-001'; try { @@ -4317,7 +4320,7 @@ try { console.log('getSecurityLevel success'); }); }catch(e) { - console.log('GetSecurityLeve e ' + e); + console.log('GetSecurityLevel e ' + e); } ``` @@ -4347,7 +4350,7 @@ try { console.log('getSecurityLevel fail ' + JSON.stringify(err)); }); }catch(e) { - console.log('GetSecurityLeve e ' + e); + console.log('GetSecurityLevel e ' + e); } ``` @@ -4477,10 +4480,10 @@ try { console.log('entries: ' + entries); kvStore.putBatch(entries, async function (err,data) { console.log('putBatch success'); - kvStore.getEntries('localDeviceId', 'batch_test_string_key', function (err,entrys) { + kvStore.getEntries('localDeviceId', 'batch_test_string_key', function (err,entries) { console.log('getEntries success'); - console.log('entrys.length: ' + entrys.length); - console.log('entrys[0]: ' + JSON.stringify(entrys[0])); + console.log('entries.length: ' + entries.length); + console.log('entries[0]: ' + JSON.stringify(entries[0])); }); }); }catch(e) { @@ -4530,12 +4533,12 @@ try { console.log('entries: ' + entries); kvStore.putBatch(entries).then(async (err) => { console.log('putBatch success'); - kvStore.getEntries('localDeviceId', 'batch_test_string_key').then((entrys) => { + kvStore.getEntries('localDeviceId', 'batch_test_string_key').then((entries) => { console.log('getEntries success'); - console.log('entrys.length: ' + entrys.length); - console.log('entrys[0]: ' + JSON.stringify(entrys[0])); - console.log('entrys[0].value: ' + JSON.stringify(entrys[0].value)); - console.log('entrys[0].value.value: ' + entrys[0].value.value); + console.log('entries.length: ' + entries.length); + console.log('entries[0]: ' + JSON.stringify(entries[0])); + console.log('entries[0].value: ' + JSON.stringify(entries[0].value)); + console.log('entries[0].value.value: ' + entries[0].value.value); }).catch((err) => { console.log('getEntries fail ' + JSON.stringify(err)); }); @@ -4587,10 +4590,10 @@ try { const query = new distributedData.Query(); query.prefixKey("batch_test"); query.deviceId('localDeviceId'); - kvStore.getEntries(query, function (err,entrys) { + kvStore.getEntries(query, function (err,entries) { console.log('getEntries success'); - console.log('entrys.length: ' + entrys.length); - console.log('entrys[0]: ' + JSON.stringify(entrys[0])); + console.log('entries.length: ' + entries.length); + console.log('entries[0]: ' + JSON.stringify(entries[0])); }); }); console.log('GetEntries success'); @@ -4643,7 +4646,7 @@ try { console.log('putBatch success'); const query = new distributedData.Query(); query.prefixKey("batch_test"); - kvStore.getEntries(query).then((entrys) => { + kvStore.getEntries(query).then((entries) => { console.log('getEntries success'); }).catch((err) => { console.log('getEntries fail ' + JSON.stringify(err)); @@ -4698,10 +4701,10 @@ try { var query = new distributedData.Query(); query.deviceId('localDeviceId'); query.prefixKey("batch_test"); - kvStore.getEntries('localDeviceId', query, function (err,entrys) { + kvStore.getEntries('localDeviceId', query, function (err,entries) { console.log('getEntries success'); - console.log('entrys.length: ' + entrys.length); - console.log('entrys[0]: ' + JSON.stringify(entrys[0])); + console.log('entries.length: ' + entries.length); + console.log('entries[0]: ' + JSON.stringify(entries[0])); }) }); console.log('GetEntries success'); @@ -4756,7 +4759,7 @@ try { var query = new distributedData.Query(); query.deviceId('localDeviceId'); query.prefixKey("batch_test"); - kvStore.getEntries('localDeviceId', query).then((entrys) => { + kvStore.getEntries('localDeviceId', query).then((entries) => { console.log('getEntries success'); }).catch((err) => { console.log('getEntries fail ' + JSON.stringify(err)); @@ -5456,7 +5459,7 @@ try { ### sync8+ ### -sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void +sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void 在手动同步方式下,触发数据库同步。关于分布式数据服务的同步方式说明,请见[分布式数据服务概述](../../database/database-mdds-overview.md)。 @@ -5468,9 +5471,9 @@ sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void | 参数名 | 参数类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------- | -| deviceIdList |string[] | 是 |需要同步DeviceKvStore数据库的设备ID列表。 | +| deviceIds |string[] | 是 |需要同步DeviceKvStore数据库的设备ID列表。 | | mode |[SyncMode](#syncmode) | 是 |同步模式。 | -| allowedDelayMs |number | 否 |可选参数,允许延时时间,单位:ms(毫秒)。 | +| delayMs |number | 否 |可选参数,允许延时时间,单位:ms(毫秒)。 | **示例:** @@ -5514,7 +5517,7 @@ sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void **示例:** ```js -let kvstore; +let kvStore; const KEY_TEST_SYNC_ELEMENT = 'key_test_sync'; const VALUE_TEST_SYNC_ELEMENT = 'value-string-001'; try { diff --git a/zh-cn/application-dev/reference/apis/js-apis-effectKit.md b/zh-cn/application-dev/reference/apis/js-apis-effectKit.md index b9524a5c74feb553d0cee49a6c549973388b0d65..cfa707255ee96189c9e872c52167da6691c7048d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-effectKit.md +++ b/zh-cn/application-dev/reference/apis/js-apis-effectKit.md @@ -42,10 +42,10 @@ createEffect(source: image.PixelMap): Filter ```js import image from "@ohos.multimedia.image" const color = new ArrayBuffer(96); -let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } +let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }; image.createPixelMap(color, opts) - .then((pixelmap) => { - let headFilter = effectKit.createEffect(pixelmap) + .then((pixelMap) => { + let headFilter = effectKit.createEffect(pixelMap) }) ``` @@ -74,13 +74,12 @@ createColorPicker(source: image.PixelMap): Promise\ ```js import image from "@ohos.multimedia.image" const color = new ArrayBuffer(96); -let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } -image.createPixelMap(color, opts, (pixelmap) => { +let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }; +image.createPixelMap(color, opts, (pixelMap) => { effectKit.createColorPicker(pixelMap).then(colorPicker => { console.info("color picker=" + colorPicker); - }) - .catch(ex => console.error(".error=" + ex.toString())) }) + .catch(ex => console.error(".error=" + ex.toString())) }) ``` @@ -104,15 +103,15 @@ createColorPicker(source: image.PixelMap, callback: AsyncCallback\) ```js import image from "@ohos.multimedia.image" const color = new ArrayBuffer(96); -let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } -image.createPixelMap(color, opts, (pixelmap) => { - effectKit.createColorPicker(pixelMap, (error, colorPicker) ) { +let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }; +image.createPixelMap(color, opts, (pixelMap) => { + effectKit.createColorPicker(pixelMap, (error, colorPicker) => { if(error) { console.log('Failed to create color picker.'); } else { console.log('Succeeded in creating color picker.'); } - }) + }) }) ``` @@ -152,7 +151,7 @@ getMainColor(): Promise\ ```js colorPicker.getMainColor().then(color => { 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 => { console.log('Failed to get main color.'); }) @@ -175,8 +174,8 @@ getMainColorSync(): Color **示例:** ```js -let color = colorPicker.getMainColorSync() -console.log('get main color =' + color) +let color = colorPicker.getMainColorSync(); +console.log('get main color =' + color); ``` ## Filter @@ -208,11 +207,11 @@ blur(radius: number): Filter ```js import image from "@ohos.multimedia.image" const color = new ArrayBuffer(96); -let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } +let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }; image.createPixelMap(color, opts) - .then((pixelmap) => { + .then((pixelMap) => { let radius = 5; - let headFilter = effectKit.createEffect(pixelmap) + let headFilter = effectKit.createEffect(pixelMap) if (headFilter != null) { headFilter.blur(radius) } @@ -244,11 +243,11 @@ brightness(bright: number): Filter ```js import image from "@ohos.multimedia.image" const color = new ArrayBuffer(96); -let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } +let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }; image.createPixelMap(color, opts) - .then((pixelmap) => { + .then((pixelMap) => { let bright = 0.5; - let headFilter = effectKit.createEffect(pixelmap) + let headFilter = effectKit.createEffect(pixelMap) if (headFilter != null) { headFilter.brightness(bright) } @@ -274,10 +273,10 @@ grayscale(): Filter ```js import image from "@ohos.multimedia.image" const color = new ArrayBuffer(96); -let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } +let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }; image.createPixelMap(color, opts) - .then((pixelmap) => { - let headFilter = effectKit.createEffect(pixelmap) + .then((pixelMap) => { + let headFilter = effectKit.createEffect(pixelMap) if (headFilter != null) { headFilter.grayscale() } @@ -303,9 +302,9 @@ getPixelMap(): image.PixelMap ```js import image from "@ohos.multimedia.image" const color = new ArrayBuffer(96); -let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } +let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }; image.createPixelMap(color, opts) - .then((pixelmap) => { - let pixel = effectKit.createEffect(pixelmap).grayscale().getPixelMap() + .then((pixelMap) => { + let pixel = effectKit.createEffect(pixelMap).grayscale().getPixelMap() }) ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-enterprise-device-manager.md b/zh-cn/application-dev/reference/apis/js-apis-enterprise-device-manager.md index b7ed9ce4c281078c60be84474c62aecabf80cae3..79b2a94b142f5b17f1b1e622c9484607500c034d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-enterprise-device-manager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-enterprise-device-manager.md @@ -14,7 +14,7 @@ import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager'; ## enterpriseDeviceManager.enableAdmin -enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId?: number, callback: AsyncCallback\): void +enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callback: AsyncCallback\): void 以异步方法根据给定的包名和类名激活设备管理员应用,使用Callback形式返回是否激活成功。 @@ -22,7 +22,50 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId ohos.permission.MANAGE_ADMIN **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager + +**参数**: + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | ----------------------------------- | --- | ------------------ | +| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 | +| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | 是 | 设备管理员应用的企业信息 | +| type | [AdminType](#AdminType) | 是 | 激活的设备管理员类型 | +| callback | AsyncCallback\ | 是 | callback方式返回是否激活成功 | + +**示例**: + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "com.example.myapplication.MainAbility", +}; +let enterpriseInfo = { + name: "enterprise name", + description: "enterprise description" +} +enterpriseDeviceManager.enableAdmin(wantTemp, enterpriseInfo, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, (error, result) => { + if (error != null) { + console.log("error occurs" + error); + return; + } + console.log("result is " + result); +}); +``` + +## enterpriseDeviceManager.enableAdmin + +enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId: number, callback: AsyncCallback\): void + +以异步方法根据给定的包名和类名激活设备管理员应用,使用Callback形式返回是否激活成功。 + +**需要权限:** + +ohos.permission.MANAGE_ADMIN + +**系统能力:** + + SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -31,7 +74,7 @@ SystemCapability.Customation.EnterpriseDeviceManager | admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 | | enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | 是 | 设备管理员应用的企业信息 | | type | [AdminType](#AdminType) | 是 | 激活的设备管理员类型 | -| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | +| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | | callback | AsyncCallback\ | 是 | callback方式返回是否激活成功 | **示例**: @@ -48,7 +91,7 @@ let enterpriseInfo = { enterpriseDeviceManager.enableAdmin(wantTemp, enterpriseInfo, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, 100, (error, result) => { if (error != null) { console.log("error occurs" + error); - return; + return; } console.log("result is " + result); }); @@ -64,7 +107,7 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId ohos.permission.MANAGE_ADMIN **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -102,22 +145,59 @@ enterpriseDeviceManager.enableAdmin(wantTemp, enterpriseInfo, enterpriseDeviceMa ## enterpriseDeviceManager.disableAdmin -disableAdmin(admin: Want, userId?: number, callback: AsyncCallback\): void +disableAdmin(admin: Want, callback: AsyncCallback\): void + +以异步方法根据给定的包名和类名将设备普通管理员应用去激活,使用Callback形式返回是否去激活成功。 + +**需要权限:** +ohos.permission.MANAGE_ADMIN + +**系统能力:** +SystemCapability.Customization.EnterpriseDeviceManager + +**参数**: + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------- | --- | ------------------- | +| admin | [Want](js-apis-application-Want.md) | 是 | 普通设备管理员应用 | +| callback | AsyncCallback\ | 是 | callback方式返回是否去激活成功 | + +**示例**: + +```js +let wantTemp = { + bundleName: "bundleName", + abilityName: "abilityName", +}; +enterpriseDeviceManager.disableAdmin(wantTemp, (error, result) => { + if (error != null) { + console.log("error occurs" + error); + return; + } + console.log("result is " + result); +}); +``` + +## enterpriseDeviceManager.disableAdmin + +disableAdmin(admin: Want, userId: number, callback: AsyncCallback\): void 以异步方法根据给定的包名和类名将设备普通管理员应用去激活,使用Callback形式返回是否去激活成功。 **需要权限:** + ohos.permission.MANAGE_ADMIN **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager + +SystemCapability.Customization.EnterpriseDeviceManager **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------- | --- | ---------------------------- | | admin | [Want](js-apis-application-Want.md) | 是 | 普通设备管理员应用 | -| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | +| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | | callback | AsyncCallback\ | 是 | callback方式返回是否去激活成功 | **示例**: @@ -130,7 +210,7 @@ let wantTemp = { enterpriseDeviceManager.disableAdmin(wantTemp, 100, (error, result) => { if (error != null) { console.log("error occurs" + error); - return; + return; } console.log("result is " + result); }); @@ -146,7 +226,7 @@ disableAdmin(admin: Want, userId?: number): Promise\ ohos.permission.MANAGE_ADMIN **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -182,7 +262,7 @@ disableSuperAdmin(bundleName: String, callback: AsyncCallback\): void 以异步方法根据给定的包名将设备超级管理员应用去激活,使用Callback形式返回是否去激活成功。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -198,7 +278,7 @@ let bundleName = "com.example.myapplication"; enterpriseDeviceManager.disableSuperAdmin(bundleName, (error, result) => { if (error != null) { console.log("error occurs" + error); - return; + return; } console.log("result is " + result); }); @@ -211,7 +291,7 @@ disableSuperAdmin(bundleName: String): Promise\ 以异步方法根据给定的包名将设备超级管理员应用去激活,使用Promise形式返回是否去激活成功。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -238,19 +318,52 @@ enterpriseDeviceManager.disableSuperAdmin(bundleName).then((result) => { ## enterpriseDeviceManager.isAdminEnabled -isAdminEnabled(admin: Want, userId?: number, callback: AsyncCallback\): void +isAdminEnabled(admin: Want, callback: AsyncCallback\): void 以异步方法根据给定的包名和类名判断设备管理员应用是否被激活,使用Callback形式返回是否处于激活状态。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager + +**参数**: + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------- | --- | -------------------- | +| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 | +| callback | AsyncCallback\ | 是 | callback方式返回是否处于激活状态 | + +**示例**: + +```js +let wantTemp = { + bundleName: "bundleName", + abilityName: "abilityName", +}; +enterpriseDeviceManager.isAdminEnabled(wantTemp, (error, result) => { + if (error != null) { + console.log("error occurs" + error); + return; + } + console.log("result is " + result); +}); +``` + +## enterpriseDeviceManager.isAdminEnabled + +isAdminEnabled(admin: Want, userId: number, callback: AsyncCallback\): void + +以异步方法根据给定的包名和类名判断设备管理员应用是否被激活,使用Callback形式返回是否处于激活状态。 + +**系统能力:** + +SystemCapability.Customization.EnterpriseDeviceManager **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------- | --- | ---------------------------- | | admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 | -| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | +| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | | callback | AsyncCallback\ | 是 | callback方式返回是否处于激活状态 | **示例**: @@ -263,7 +376,7 @@ let wantTemp = { enterpriseDeviceManager.isAdminEnabled(wantTemp, 100, (error, result) => { if (error != null) { console.log("error occurs" + error); - return; + return; } console.log("result is " + result); }); @@ -276,7 +389,7 @@ isAdminEnabled(admin: Want, userId?: number): Promise\ 以异步方法根据给定的包名和类名判断设备管理员应用是否被激活,使用Promise形式返回是否处于激活状态。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -312,7 +425,7 @@ isSuperAdmin(bundleName: String, callback: AsyncCallback\): void 以异步方法根据给定的包名判断设备超级管理员应用是否被激活,使用Callback形式返回是否处于激活状态。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -328,7 +441,7 @@ let bundleName = "com.example.myapplication"; enterpriseDeviceManager.isSuperAdmin(bundleName, (error, result) => { if (error != null) { console.log("error occurs" + error); - return; + return; } console.log("result is " + result); }); @@ -341,7 +454,7 @@ isSuperAdmin(bundleName: String): Promise\ 以异步方法根据给定的包名判断设备超级管理员应用是否被激活,使用Promise形式返回是否处于激活状态。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -373,7 +486,7 @@ getDeviceSettingsManager(callback: AsyncCallback<DeviceSettingsManager>): 获取DeviceSettingsManager对象,使用callback形式返回DeviceSettingsManager对象。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数:** @@ -391,7 +504,7 @@ let wantTemp = { enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => { if (error != null) { console.log("error occurs" + error); - return; + return; } mgr.setDateTime(wantTemp, 1526003846000, (error, value) => { if (error != null) { @@ -410,7 +523,7 @@ getDeviceSettingsManager(): Promise<DeviceSettingsManager> 获取DeviceSettingsManager对象,使用Promise形式返回DeviceSettingsManager对象。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **返回值:** @@ -425,7 +538,7 @@ let wantTemp = { bundleName: "bundleName", abilityName: "abilityName", }; -mgr.getDeviceSettingsManager().then((mgr) => { +enterpriseDeviceManager.getDeviceSettingsManager().then((mgr) => { mgr.setDateTime(wantTemp, 1526003846000).then((value) => { console.log(value); }).catch((error) => { @@ -443,7 +556,7 @@ setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCa 设置设备管理员应用的企业信息,使用callback形式返回是否设置成功。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数:** @@ -479,7 +592,7 @@ setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise<boole 设置设备管理员应用的企业信息,使用Promise形式返回是否设置成功。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数:** @@ -490,9 +603,9 @@ SystemCapability.Customation.EnterpriseDeviceManager **返回值:** -| 类型 | 说明 | -| ------------------ | --------------------- | -| Promise\; | Promise方式返回是否设置企业信息成功 | +| 类型 | 说明 | +| ----------------- | --------------------- | +| Promise\ | Promise方式返回是否设置企业信息成功 | **示例:** @@ -520,7 +633,7 @@ getEnterpriseInfo(admin: Want, callback: AsyncCallback<EnterpriseInfo>): v 获取设备管理员应用的企业信息,使用callback形式返回设备管理员应用的企业信息。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数:** @@ -539,7 +652,7 @@ let wantTemp = { enterpriseDeviceManager.getEnterpriseInfo(wantTemp, (error, result) => { if (error != null) { console.log("error occurs" + error); - return; + return; } console.log(result.name); console.log(result.description); @@ -553,7 +666,7 @@ getEnterpriseInfo(admin: Want): Promise<EnterpriseInfo> 获取设备管理员应用的企业信息,使用Promise形式返回设备管理员应用的企业信息。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数:** @@ -587,18 +700,20 @@ enterpriseDeviceManager.getEnterpriseInfo(wantTemp).then((result) => { 设备管理员应用的企业信息 **系统能力:** -以下各项对应系统能力均为SystemCapability.Customation.EnterpriseDeviceManager -| 名称 | 读写属性 | 类型 | 必填 | 描述 | -| ----------- | ---- | ------ | ---- | ----------------- | -| name | 只读 | string | 是 | 表示设备管理员应用所属企业的名称。 | -| description | 只读 | string | 是 | 表示设备管理员应用所属企业的描述。 | +以下各项对应系统能力均为SystemCapability.Customization.EnterpriseDeviceManager + +| 名称 | 读写属性 | 类型 | 必填 | 描述 | +| ----------- | ---- | ------ | --- | ----------------- | +| name | 只读 | string | 是 | 表示设备管理员应用所属企业的名称。 | +| description | 只读 | string | 是 | 表示设备管理员应用所属企业的描述。 | ## AdminType 设备管理员应用的管理员类型。 **系统能力:** -以下各项对应系统能力均为SystemCapability.Customation.EnterpriseDeviceManager +以下各项对应系统能力均为SystemCapability.Customization.EnterpriseDeviceManager + | 名称 | 默认值 | 说明 | | ----------------- | ---- | ----- | | ADMIN_TYPE_NORMAL | 0x00 | 普通管理员 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-errorManager.md b/zh-cn/application-dev/reference/apis/js-apis-errorManager.md new file mode 100644 index 0000000000000000000000000000000000000000..e7c10cedb7a2d9d8c35e03be4b11b4ea9c2383dd --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-errorManager.md @@ -0,0 +1,127 @@ +# ErrorManager + +ErrorManager模块提供对错误观察器的注册和注销的能力。 + +> **说明:** +> +> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +## 导入模块 +``` +import errorManager from '@ohos.application.errorManager' +``` + +## ErrorManager.registerErrorObserver + +registerErrorObserver(observer: ErrorObserver): number; + +注册错误观测器。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| observer | [ErrorObserver](#errorobserver) | 否 | 返回观察者的数字代码。 | + +**示例:** + +```js +var observer = "12345"; +errorManager.registerErrorObserver(observer) +.then((data) => { + console.log('----------- registerErrorObserver success ----------', data); +}) +.catch((err) => { + console.log('----------- registerErrorObserver fail ----------', err); +}) + +``` + +## ErrorManager.unregisterErrorObserver + +unregisterErrorObserver(observerId: number, callback: AsyncCallback\): void; + +注销错误观测器。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| observerId | number | 否 | 返回观察者的数字代码。 | +| callback | AsyncCallback\ | 否 | 表示指定的回调方法。 | + +**示例:** + +```js +var observerId = 100; + +function unregisterErrorObserver(err) { + if (err) { + console.log('------------ unregisterErrorObserverCallback ------------', err); + } +} +errorManager.unregisterErrorObserver(observerId, unregisterErrorObserverCallback); + +``` + +## ErrorManager.unregisterErrorObserver + +unregisterErrorObserver(observerId: number): Promise\; + +注销错误观测器。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| observerId | number | 否 | 返回观察者的数字代码。 | + +**返回值:** + +| 类型 | 说明 | +| -------- | -------- | +| Promise\ | 返回执行结果。 | + +**示例:** + +```js +var observerId = 100; +errorManager.unregisterErrorObserver(observerId) +.then((data) => { + console.log('----------- unregisterErrorObserver success ----------', data); +}) +.catch((err) => { + console.log('----------- unregisterErrorObserver fail ----------', err); +}) + +``` + +## ErrorObserver + +onUnhandledException(errMsg: string): void; + +将在js运行时引发用户未捕获的异常时调用。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| errMsg | string | 否 | 有关异常的消息和错误堆栈跟踪。 | + +**示例:** + +```js +var errMsg = "12345"; +errorManager.onUnhandledException(errMsg, (error) => { + console.log("error.code = " + error.code) +}) + +``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-extension-context.md b/zh-cn/application-dev/reference/apis/js-apis-extension-context.md index 9add67e43afa65b78f549df61a81eb3548f4883f..4be9d179fcea470a893c93043075a138a8760193 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-extension-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-extension-context.md @@ -17,3 +17,6 @@ ExtensionContext模块提供扩展的上下文的能力,包括允许访问特 | -------- | -------- | -------- | -------- | -------- | | currentHapModuleInfo | HapModuleInfo | 是 | 否 | 当前Hap包的信息。 | | config | Configuration | 是 | 否 | 模块的配置信息。 | +| extensionAbilityInfo | [ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md) | 是 | 否 | 服务扩展信息。 | + + diff --git a/zh-cn/application-dev/reference/apis/js-apis-featureAbility.md b/zh-cn/application-dev/reference/apis/js-apis-featureAbility.md index a20771dcdaae6d4071658b2a2f683582280349a5..5d131e1dfcab25145571f4b9b41e615965c969d2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-featureAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-featureAbility.md @@ -327,8 +327,6 @@ featureAbility.terminateSelfWithResult( }); ``` - - ## featureAbility.hasWindowFocus7+ hasWindowFocus(callback: AsyncCallback\): void @@ -350,8 +348,6 @@ import featureAbility from '@ohos.ability.featureAbility'; featureAbility.hasWindowFocus() ``` - - ## featureAbility.hasWindowFocus7+ hasWindowFocus(): Promise\ @@ -375,8 +371,6 @@ featureAbility.hasWindowFocus().then((data) => { }); ``` - - ## featureAbility.getWant getWant(callback: AsyncCallback\): void @@ -398,8 +392,6 @@ import featureAbility from '@ohos.ability.featureAbility'; featureAbility.getWant() ``` - - ## featureAbility.getWant getWant(): Promise\ @@ -445,8 +437,6 @@ var context = featureAbility.getContext() context.getBundleName() ``` - - ## featureAbility.terminateSelf7+ terminateSelf(callback: AsyncCallback\): void @@ -468,8 +458,6 @@ import featureAbility from '@ohos.ability.featureAbility'; featureAbility.terminateSelf() ``` - - ## featureAbility.terminateSelf7+ terminateSelf(): Promise\ @@ -508,18 +496,6 @@ connectAbility(request: Want, options:ConnectOptions): number | request | [Want](js-apis-application-Want.md) | 是 | 表示被连接的ServiceAbility。 | | options | [ConnectOptions](#connectoptions) | 是 | 被指定的回调方法。 | -## Want - -want类型说明 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityBase - -| 名称 | 读写属性 | 类型 | 必填 | 描述 | -| ----------- | ---- | ------ | ---- | ---------------------------------------- | -| deviceId | 只读 | string | 否 | 表示被连接的ServiceAbility的设备id,缺省表示连接本地的ServiceAbility。 | -| bundleName | 只读 | string | 是 | 表示被连接的ServiceAbility的包名。 | -| abilityName | 只读 | string | 是 | 表示被连接的ServiceAbility的类名。 | - ## ConnectOptions ConnectOptions类型说明 diff --git a/zh-cn/application-dev/reference/apis/js-apis-fileio.md b/zh-cn/application-dev/reference/apis/js-apis-fileio.md index 63b359debfcf06fe70a681d363487f5af6892d95..20eace55dca51bc902ab76ab3f44c2bd91ae184a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-fileio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-fileio.md @@ -16,15 +16,32 @@ import fileio from '@ohos.fileio'; ## 使用说明 使用该功能模块对文件/目录进行操作前,需要先获取其应用沙箱路径,获取方式及其接口用法请参考: + +**Stage模型** + + ```js +import Ability from '@ohos.application.Ability'; +class MainAbility extends Ability { + onWindowStageCreate(windowStage) { + let context = this.context; + let path = context.filesDir; + } +} + ``` + + Stage模型context的具体获取方法参见[Stage模型](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-ability-context.md#abilitycontext)。 + +**FA模型** + ```js import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); - let path = ''; context.getFilesDir().then((data) => { - path = data; + let path = data; }) ``` - + + FA模型context的具体获取方法参见[FA模型](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-Context.md#context%E6%A8%A1%E5%9D%97)。 ## fileio.stat @@ -353,58 +370,11 @@ closeSync(fd: number): void **示例:** ```js + let fd = fileio.openSync(path); fileio.closeSync(fd); ``` -## fileio.close7+ - -close(): Promise<void> - -关闭文件流,使用Promise异步回调。 - -**系统能力**:SystemCapability.FileManagement.File.FileIO - -**返回值:** - - | 类型 | 说明 | - | ------------------- | ---------------------------- | - | Promise<void> | Promise对象。无返回值。 | - -**示例:** - - ```js - fileio.close().then(function(){ - console.info("close file stream succeed"); - }).catch(function(err){ - console.info("close file stream failed with error:"+ err); - }); - ``` - - -## fileio.close7+ - -close(callback: AsyncCallback<void>): void - -关闭文件流,使用callback异步回调。 - -**系统能力**:SystemCapability.FileManagement.File.FileIO - -**参数:** - - | 参数名 | 类型 | 必填 | 说明 | - | -------- | ------------------------- | ---- | ------------- | - | callback | AsyncCallback<void> | 是 | 异步关闭文件流之后的回调。 | - -**示例:** - - ```js - fileio.close(function(err){ - // do something - }); - ``` - - ## fileio.copyFile copyFile(src:string | number, dest:string | number, mode?:number):Promise<void> @@ -430,6 +400,8 @@ copyFile(src:string | number, dest:string | number, mode?:number):Promise<voi **示例:** ```js + let src = path; + let dest = src + 'tgt'; fileio.copyFile(src, dest).then(function(){ console.info("copyFile succeed"); }).catch(function(err){ @@ -458,6 +430,8 @@ copyFile(src: string | number, dest: string | number, mode: number, callback: As **示例:** ```js + let src = path; + let dest = src + 'tgt'; fileio.copyFile(src, dest, function (err) { // do something }); @@ -483,6 +457,8 @@ copyFileSync(src: string | number, dest: string | number, mode?: number): void **示例:** ```js + let src = path; + let dest = src + 'tgt'; fileio.copyFileSync(src, dest); ``` @@ -1059,7 +1035,7 @@ hash(path: string, algorithm: string): Promise<string> ```js fileio.hash(path, "sha256").then(function(str){ console.info("calculate file hash succeed:"+ str); - }).catch(function(error){ + }).catch(function(err){ console.info("calculate file hash failed with error:"+ err); }); ``` @@ -1116,7 +1092,7 @@ chmod(path: string, mode: number):Promise<void> **示例:** ```js - fileio.chmod(path, mode).then(function() { + fileio.chmod(path, 0o700).then(function() { console.info("chmod succeed"); }).catch(function(err){ console.info("chmod failed with error:"+ err); @@ -1143,7 +1119,7 @@ chmod(path: string, mode: number, callback: AsyncCallback<void>): void **示例:** ```js - fileio.chmod(path, mode, function (err) { + fileio.chmod(path, 0o700, function (err) { // do something }); ``` @@ -1167,7 +1143,7 @@ chmodSync(path: string, mode: number): void **示例:** ```js - fileio.chmodSync(path, mode); + fileio.chmodSync(path, 0o700); ``` @@ -1194,6 +1170,7 @@ fstat(fd: number): Promise<Stat> **示例:** ```js + let fd = fileio.openSync(path); fileio.fstat(fd).then(function(stat){ console.info("fstat succeed:"+ JSON.stringify(stat)); }).catch(function(err){ @@ -1307,7 +1284,9 @@ ftruncate(fd: number, len: number, callback:AsyncCallback<void>): void **示例:** ```js - fileio.ftruncate(fd, len, function(err){ + let fd = fileio.openSync(path); + let len = 5; + fileio.ftruncate(fd, 5, function(err){ // do something }); ``` @@ -1331,6 +1310,8 @@ ftruncateSync(fd: number, len?: number): void **示例:** ```js + let fd = fileio.openSync(path); + let len = 5; fileio.ftruncateSync(fd, len); ``` @@ -1359,6 +1340,7 @@ truncate(path: string, len?: number): Promise<void> **示例:** ```js + let len = 5; fileio.truncate(path, len).then(function(){ console.info("truncate file succeed"); }).catch(function(err){ @@ -1386,6 +1368,7 @@ truncate(path: string, len: number, callback:AsyncCallback<void>): void **示例:** ```js + let len = 5; fileio.truncate(path, len, function(err){ // do something }); @@ -1410,6 +1393,7 @@ truncateSync(path: string, len?: number): void **示例:** ```js + let len = 5; fileio.truncateSync(path, len); ``` @@ -1467,13 +1451,13 @@ readText(filePath: string, options: { | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | ------------------------------------------------------------ | | filePath | string | 是 | 待读取文件的应用沙箱路径。 | -| options | Object | 否 | 支持如下选项:
- position,number类型,表示期望读取文件的位置。可选,默认从当前位置开始读取。
- length,number类型,表示期望读取数据的长度。可选,默认缓冲区长度减去偏移长度。
- encoding,string类型,表示数据的编码方式,默认 'utf-8',仅支持 'utf-8'。 | +| options | Object | 是 | 支持如下选项:
- position,number类型,表示期望读取文件的位置。可选,默认从当前位置开始读取。
- length,number类型,表示期望读取数据的长度。可选,默认缓冲区长度减去偏移长度。
- encoding,string类型,表示数据的编码方式,默认 'utf-8',仅支持 'utf-8'。 | | callback | AsyncCallback<string> | 是 | 回调函数,返回读取文件的内容。 | **示例:** ```js - fileio.readText(path, function(err, str){ + fileio.readText(path, { position: 1, encoding: 'UTF-8' }, function(err, str){ // do something }); ``` @@ -1593,76 +1577,6 @@ lstatSync(path:string): Stat ``` -## fileio.read7+ - -read(buffer: ArrayBuffer, options?: { - position?: number; - offset?: number; - length?: number; -}): Promise<ReadOut> - -从文件读取数据,使用Promise异步回调。 - -**系统能力**:SystemCapability.FileManagement.File.FileIO - -**参数:** - - | 参数名 | 类型 | 必填 | 说明 | - | ------- | ----------- | ---- | ------------------------------------------------------------ | - | buffer | ArrayBuffer | 是 | 用于保存读取到的文件数据的缓冲区。 | - | options | Object | 否 | 支持如下选项:
- offset,number类型,表示将数据读取到缓冲区的位置,即相对于缓冲区首地址的偏移。可选,默认为0。
- length,number类型,表示期望读取数据的长度。可选,默认缓冲区长度减去偏移长度。
约束:offset+length<=buffer.size。 | - -**返回值:** - - | 类型 | 说明 | - | ---------------------------------- | ------ | - | Promise<[ReadOut](#readout)> | Promise对象。返回读取的结果。 | - -**示例:** - - ```js - fileio.read(new ArrayBuffer(4096)).then(function(readout){ - console.info("read file data succeed"); - console.log(String.fromCharCode.apply(null, new Uint8Array(readOut.buffer))); - }).catch(function(err){ - console.info("read file data failed with error:"+ err); - }); - ``` - - -## fileio.read7+ - -read(buffer: ArrayBuffer, options: { - position?: number; - offset?: number; - length?: number; -}, callback: AsyncCallback<ReadOut>): void - -从文件读取数据,使用callback异步回调。 - -**系统能力**:SystemCapability.FileManagement.File.FileIO - -**参数:** - - | 参数名 | 类型 | 必填 | 说明 | - | -------- | ---------------------------------------- | ---- | ---------------------------------------- | - | buffer | ArrayBuffer | 是 | 用于保存读取到的文件数据的缓冲区。 | - | options | Object | 否 | 支持如下选项:
- offset,number类型,表示将数据读取到缓冲区的位置,即相对于缓冲区首地址的偏移。可选,默认为0。
- length,number类型,表示期望读取数据的长度。可选,默认缓冲区长度减去偏移长度。
约束:offset+length<=buffer.size。 | - | callback | AsyncCallback<[ReadOut](#readout)> | 是 | 异步从文件读取数据之后的回调。 | - -**示例:** - - ```js - let buf = new ArrayBuffer(4096); - fileio.read(buf, function (err, readOut) { - if (readOut) { - console.info("read file data succeed"); - console.log(String.fromCharCode.apply(null, new Uint8Array(readOut.buffer))); - } - }); - ``` - - ## fileio.rename7+ rename(oldPath: string, newPath: string): Promise<void> @@ -1687,6 +1601,8 @@ rename(oldPath: string, newPath: string): Promise<void> **示例:** ```js + let oldPath = path; + let newPath = oldPath + '123'; fileio.rename(oldPath, newPath).then(function() { console.info("rename succeed"); }).catch(function(err){ @@ -1714,6 +1630,8 @@ rename(oldPath: string, newPath: string, callback: AsyncCallback<void>): v **示例:** ```js + let oldPath = path; + let newPath = oldPath + '123'; fileio.rename(oldPath, newPath, function(err){ }); ``` @@ -1737,6 +1655,8 @@ renameSync(oldPath: string, newPath: string): void **示例:** ```js + let oldPath = path; + let newPath = oldPath + '123'; fileio.renameSync(oldPath, newPath); ``` @@ -1764,6 +1684,7 @@ fsync(fd: number): Promise<void> **示例:** ```js + let fd = fileio.openSync(path); fileio.fsync(fd).then(function(){ console.info("sync data succeed"); }).catch(function(err){ @@ -1790,6 +1711,7 @@ fsync(fd: number, callback: AsyncCallback<void>): void **示例:** ```js + let fd = fileio.openSync(path); fileio.fsync(fd, function(err){ // do something }); @@ -1813,6 +1735,7 @@ fsyncSync(fd: number): void **示例:** ```js + let fd = fileio.openSync(path); fileio.fsyncSync(fd); ``` @@ -1840,6 +1763,7 @@ fdatasync(fd: number): Promise<void> **示例:** ```js + let fd = fileio.openSync(path); fileio.fdatasync(fd).then(function(err) { console.info("sync data succeed"); }).catch(function(err){ @@ -1866,6 +1790,7 @@ fdatasync(fd: number, callback:AsyncCallback<void>): void **示例:** ```js + let fd = fileio.openSync(path); fileio.fdatasync (fd, function (err) { // do something }); @@ -1889,6 +1814,7 @@ fdatasyncSync(fd: number): void **示例:** ```js + let fd = fileio.openSync(path); let stat = fileio.fdatasyncSync(fd); ``` @@ -1917,6 +1843,8 @@ symlink(target: string, srcPath: string): Promise<void> **示例:** ```js + let target = path; + let srcPath = target + 'aaa'; fileio.symlink(target, srcPath).then(function() { console.info("symlink succeed"); }).catch(function(err){ @@ -1944,6 +1872,8 @@ symlink(target: string, srcPath: string, callback: AsyncCallback<void>): v **示例:** ```js + let target = path; + let srcPath = target + 'aaa'; fileio.symlink(target, srcPath, function (err) { // do something }); @@ -1968,6 +1898,8 @@ symlinkSync(target: string, srcPath: string): void **示例:** ```js + let target = path; + let srcPath = target + 'aaa'; fileio.symlinkSync(target, srcPath); ``` @@ -2163,6 +2095,8 @@ fchmod(fd: number, mode: number): Promise<void> **示例:** ```js + let fd = fileio.openSync(path); + let mode = 0o700; fileio.fchmod(fd, mode).then(function() { console.info("chmod succeed"); }).catch(function(err){ @@ -2190,6 +2124,8 @@ fchmod(fd: number, mode: number, callback: AsyncCallback<void>): void **示例:** ```js + let fd = fileio.openSync(path); + let mode = 0o700; fileio.fchmod(fd, mode, function (err) { // do something }); @@ -2214,6 +2150,8 @@ fchmodSync(fd: number, mode: number): void **示例:** ```js + let fd = fileio.openSync(path); + let mode = 0o700; fileio.fchmodSync(fd, mode); ``` @@ -2416,6 +2354,7 @@ fchown(fd: number, uid: number, gid: number): Promise<void> **示例:** ```js + let fd = fileio.openSync(path); let stat = fileio.statSync(path); fileio.fchown(fd, stat.uid, stat.gid).then(function() { console.info("chown succeed"); @@ -2445,6 +2384,7 @@ fchown(fd: number, uid: number, gid: number, callback: AsyncCallback<void> **示例:** ```js + let fd = fileio.openSync(path); let stat = fileio.statSync(path); fileio.fchown(fd, stat.uid, stat.gid, function (err){ // do something @@ -2471,6 +2411,7 @@ fchownSync(fd: number, uid: number, gid: number): void **示例:** ```js + let fd = fileio.openSync(path); let stat = fileio.statSync(path); fileio.fchownSync(fd, stat.uid, stat.gid); ``` @@ -2795,7 +2736,7 @@ stop(): Promise<void> ```js let filename = path +"/test.txt"; - let watcher = await fileio.createWatcher(filename, 1, function(number){ + let watcher = fileio.createWatcher(filename, 1, function(number){ console.info("Monitoring times: "+number); }); watcher.stop().then(function(){ @@ -2822,7 +2763,7 @@ stop(callback: AsyncCallback<void>): void ```js let filename = path +"/test.txt"; - let watcher = await fileio.createWatcher(filename, 1, function(number){ + let watcher = fileio.createWatcher(filename, 1, function(number){ console.info("Monitoring times: "+number); }); watcher.stop(function(){ @@ -3103,7 +3044,7 @@ read(buffer: ArrayBuffer, options?: { ```js let ss = fileio.createStreamSync(path, "r+"); - ss.read(new ArrayBuffer(4096), {offset: 1, length: 5, position: 5}).then(function (readout){ + ss.read(new ArrayBuffer(4096), {offset: 1, length: 5, position: 5}).then(function (readOut){ console.info("read data succeed"); console.log(String.fromCharCode.apply(null, new Uint8Array(readOut.buffer))); }).catch(function(err){ @@ -3180,7 +3121,7 @@ readSync(buffer: ArrayBuffer, options?: { ## Dir -管理目录,在调用Dir的方法前,需要先通过[opendir()](#fileioopendir)方法(同步或异步)来构建一个Dir实例。 +管理目录,在调用Dir的方法前,需要先通过opendir方法(同步或异步)来构建一个Dir实例。 ### read @@ -3200,7 +3141,6 @@ read(): Promise<Dirent> **示例:** ```js - let dir = fileio.opendirSync(path); dir.read().then(function (dirent){ console.log("read succeed:"+JSON.stringify(dirent)); }).catch(function(err){ @@ -3226,7 +3166,6 @@ read(callback: AsyncCallback<Dirent>): void **示例:** ```js - let dir = fileio.opendirSync(path); dir.read(function (err, dirent) { if (dirent) { // do something @@ -3253,7 +3192,6 @@ readSync(): Dirent **示例:** ```js - let dir = fileio.opendirSync(path); let dirent = dir.readSync(); ``` @@ -3269,7 +3207,6 @@ close(): Promise<void> **示例:** ```js - let dir = fileio.opendirSync(path); dir.close().then(function(err){ console.info("close dir successfully"); }); @@ -3287,7 +3224,6 @@ close(callback: AsyncCallback<void>): void **示例:** ```js - let dir = fileio.opendirSync(path); dir.close(function(err){ console.info("close dir successfully"); }); @@ -3305,7 +3241,6 @@ closeSync(): void **示例:** ```js - let dir = fileio.opendirSync(path); dir.closeSync(); ``` @@ -3450,7 +3385,7 @@ isSocket(): boolean **示例:** ```js - let dir = fileio.opendirSync(dpath); + let dir = fileio.opendirSync(path); let isSocket = dir.readSync().isSocket(); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-formInfo.md b/zh-cn/application-dev/reference/apis/js-apis-formInfo.md index e8d857b2e2df72995164f0b47593c03e5c2c9700..119d7675b9a78fd454bfb52db57fd91e5bb9f353 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-formInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-formInfo.md @@ -22,8 +22,6 @@ import formInfo from '@ohos.application.formInfo'; **系统能力**:SystemCapability.Ability.Form -SystemCapability.Ability.Form - | 名称 | 读写属性 | 类型 | 描述 | | ----------- | -------- | -------------------- | ------------------------------------------------------------ | | bundleName | 只读 | string | 表示卡片所属包的包名。 | @@ -51,8 +49,6 @@ SystemCapability.Ability.Form **系统能力**:SystemCapability.Ability.Form -SystemCapability.Ability.Form - | 名称 | 值 | 说明 | | ----------- | ---- | ------------ | | JS | 1 | 卡片类型为JS。 | @@ -63,8 +59,6 @@ SystemCapability.Ability.Form **系统能力**:SystemCapability.Ability.Form -SystemCapability.Ability.Form - | 名称 | 值 | 说明 | | ----------- | ---- | ------------ | | MODE_AUTO | -1 | 自动模式。 | @@ -77,8 +71,6 @@ SystemCapability.Ability.Form **系统能力**:SystemCapability.Ability.Form -SystemCapability.Ability.Form - | 名称 | 读写属性 | 类型 | 描述 | | ----------- | -------- | -------------------- | ------------------------------------------------------------ | | formState | 只读 | [FormState](#formstate) | 表示卡片状态。 | @@ -90,8 +82,6 @@ SystemCapability.Ability.Form **系统能力**:SystemCapability.Ability.Form -SystemCapability.Ability.Form - | 名称 | 值 | 说明 | | ----------- | ---- | ------------ | | UNKNOWN | -1 | 未知状态。 | @@ -104,8 +94,6 @@ SystemCapability.Ability.Form **系统能力**:SystemCapability.Ability.Form -SystemCapability.Ability.Form - | 名称 | 值 | 说明 | | ----------- | ---- | ------------ | | IDENTITY_KEY | "ohos.extra.param.key.form_identity" | 卡片标识。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-formextension.md b/zh-cn/application-dev/reference/apis/js-apis-formextension.md index f014698cb88b80a3b5976a7da03f762ae708d89e..4c0c8a855454c9861d1d2ec95fc639445870bcb0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-formextension.md +++ b/zh-cn/application-dev/reference/apis/js-apis-formextension.md @@ -225,7 +225,7 @@ onConfigurationUpdated(config: Configuration): void; } ``` - ## FormExtension.onAcquireFormState +## FormExtension.onAcquireFormState onAcquireFormState?(want: Want): formInfo.FormState; diff --git a/zh-cn/application-dev/reference/apis/js-apis-formextensioncontext.md b/zh-cn/application-dev/reference/apis/js-apis-formextensioncontext.md index 841b484a23b78ad1ebb5152311d2963edf4b35a4..ac582577cd09cd7d601233b0dc14a7310227add3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-formextensioncontext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-formextensioncontext.md @@ -13,80 +13,6 @@ FormExtensionContext模块提供FormExtension具有的接口和能力。 FormExtensionContext模块是FormExtension的上下文环境,继承自ExtensionContext。 -## FormExtensionContext.updateForm - -updateForm(formId: string, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback\): void - -主动更新卡片。 - -**系统能力**:SystemCapability.Ability.Form - -**参数:** - - | 参数名 | 类型 | 必填 | 说明 | - | --------------- | ------------------------------------------------------------ | ---- | -------------------------------------- | - | formId | string | 是 | 请求更新的卡片ID。 | - | formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | 是 | 卡片新的数据。 | - | callback | AsyncCallback\ | 是 | 回调函数,返回接口调用是否成功的结果。 | - -**示例:** - - ```js - import formBindingData from '@ohos.application.formBindingData' - import FormExtension from '@ohos.application.FormExtension' - export default class MyFormExtension extends FormExtension { - onUpdate(formId) { - console.log('FormExtension onUpdate, formId:' + formId); - let obj2 = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"}); - this.context.updateForm(formId, obj2, (data)=>{ - console.log('FormExtension context updateForm, data:' + data); - }); - } - } - - - ``` - -## FormExtensionContext.updateForm - -updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise\ - -更新卡片。 - -**系统能力**:SystemCapability.Ability.Form - -**参数:** - - | 参数名 | 类型 | 必填 | 说明 | - | --------------- | ------------------------------------------------------------ | ---- | ------------------ | - | formId | string | 是 | 请求更新的卡片ID。 | - | formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | 是 | 卡片新的数据。 | - -**返回值:** - - | 类型 | 说明 | - | -------------- | --------------------------------- | - | Promise\ | 返回一个Promise,包含接口的结果。 | - -**示例:** - - ```js - import formBindingData from '@ohos.application.formBindingData' - import FormExtension from '@ohos.application.FormExtension' - export default class MyFormExtension extends FormExtension { - onUpdate(formId) { - console.log('FormExtension onUpdate, formId:' + formId); - let obj2 = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"}); - this.context.updateForm(formId, obj2) - .then((data)=>{ - console.log('FormExtension context updateForm, data:' + data); - }).catch((error) => { - console.error('Operation updateForm failed. Cause: ' + error);}); - } - } - - ``` - ## FormExtensionContext.startAbility startAbility(want: Want, callback: AsyncCallback<void>): void @@ -95,6 +21,8 @@ startAbility(want: Want, callback: AsyncCallback<void>): void **系统能力**:SystemCapability.Ability.Form +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -126,6 +54,8 @@ startAbility(want: Want): Promise<void> **系统能力**:SystemCapability.Ability.Form +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-formprovider.md b/zh-cn/application-dev/reference/apis/js-apis-formprovider.md index 9e7e8e0c5a2ae8b8cc3fd611d7e0230b3febc9d7..3d81a064465c818b2612eaf17563f65bcf738ffa 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-formprovider.md +++ b/zh-cn/application-dev/reference/apis/js-apis-formprovider.md @@ -238,13 +238,13 @@ formProvider.getFormsInfo(filter).then((data) => { ## requestPublishForm9+ -requestPublishForm(want: Want, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback<string>): <void>; +requestPublishForm(want: Want, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback\): void; 请求发布一张卡片到使用方。 -**系统能力:** +**系统能力:** SystemCapability.Ability.Form -SystemCapability.Ability.Form +**系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** @@ -278,13 +278,13 @@ SystemCapability.Ability.Form ## requestPublishForm9+ -requestPublishForm(want: Want, callback: AsyncCallback<string>): <void>; +requestPublishForm(want: Want, callback: AsyncCallback<string>): void; 请求发布一张卡片到使用方。 -**系统能力:** +**系统能力:** SystemCapability.Ability.Form -SystemCapability.Ability.Form +**系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** @@ -319,9 +319,9 @@ requestPublishForm(want: Want, formBindingData?: formBindingData.FormBindingData 请求发布一张卡片到使用方。 -**系统能力:** +**系统能力:** SystemCapability.Ability.Form -SystemCapability.Ability.Form +**系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** @@ -362,6 +362,8 @@ isRequestPublishFormSupported(callback: AsyncCallback<boolean>): void; **系统能力:** SystemCapability.Ability.Form +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -404,6 +406,8 @@ isRequestPublishFormSupported(): Promise<boolean>; **系统能力:** SystemCapability.Ability.Form +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **返回值:** | 类型 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-hidebug.md b/zh-cn/application-dev/reference/apis/js-apis-hidebug.md index 58da6c591b600ee7063a9fe2e00d642f50139888..26a7adcbafda064eedff82290d791b3e9016f40f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hidebug.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hidebug.md @@ -26,7 +26,7 @@ getNativeHeapSize(): bigint | 类型 | 说明 | | ------ | --------------------------- | -| bigint | 返回native heap内存总大小。 | +| bigint | 返回native heap内存总大小,单位为kB。 | **示例:** @@ -49,7 +49,7 @@ getNativeHeapAllocatedSize(): bigint **返回值:** | 类型 | 说明 | | ------ | --------------------------------- | -| bigint | 返回native heap内存的已分配内存。 | +| bigint | 返回native heap内存的已分配内存,单位为kB。 | **示例:** @@ -72,7 +72,7 @@ getNativeHeapFreeSize(): bigint **返回值:** | 类型 | 说明 | | ------ | ------------------------------- | -| bigint | 返回native heap内存的空闲内存。 | +| bigint | 返回native heap内存的空闲内存,单位为kB。 | **示例:** @@ -93,7 +93,7 @@ getPss(): bigint **返回值:** | 类型 | 说明 | | ------ | ------------------------- | -| bigint | 返回应用进程PSS内存大小。 | +| bigint | 返回应用进程PSS内存大小,单位为kB。 | **示例:** @@ -114,7 +114,7 @@ getSharedDirty(): bigint **返回值:** | 类型 | 说明 | | ------ | -------------------------- | -| bigint | 返回进程的共享脏内存大小。 | +| bigint | 返回进程的共享脏内存大小,单位为kB。 | **示例:** @@ -134,7 +134,7 @@ getPrivateDirty(): bigint **返回值:** | 类型 | 说明 | | ------ | -------------------------- | -| bigint | 返回进程的私有脏内存大小。 | +| bigint | 返回进程的私有脏内存大小,单位为kB。 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-hisysevent.md b/zh-cn/application-dev/reference/apis/js-apis-hisysevent.md index 6cc5ea38e9bc6c15dfa73a02957d999c3406c5a0..c811da3849cdd8b77c0be23b5dd84ca15c123acb 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hisysevent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hisysevent.md @@ -4,7 +4,7 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > - 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 -> - 本模块的接口为系统接口,三方应用不支持调用。 +> - 本模块的接口为系统接口。 ## 导入模块 diff --git a/zh-cn/application-dev/reference/apis/js-apis-i18n.md b/zh-cn/application-dev/reference/apis/js-apis-i18n.md index 8d824eed79e430d8704481ca37a8243011ba834c..0323d11e4e7ffbd2966e4f14453df1b67266b396 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-i18n.md +++ b/zh-cn/application-dev/reference/apis/js-apis-i18n.md @@ -118,7 +118,8 @@ getSystemLanguage(): string setSystemLanguage(language: string): boolean -设置系统语言。
+设置系统语言。当前调用该接口不支持系统界面语言的实时刷新。 + 该接口为系统接口。 **需要权限**:ohos.permission.UPDATE_CONFIGURATION @@ -211,7 +212,8 @@ getSystemRegion(): string setSystemRegion(region: string): boolean -设置系统区域。
+设置系统区域。 + 该接口为系统接口。 **需要权限**:ohos.permission.UPDATE_CONFIGURATION @@ -257,7 +259,8 @@ getSystemLocale(): string setSystemLocale(locale: string): boolean -设置系统Locale。
+设置系统Locale。 + 该接口为系统接口。 **需要权限**:ohos.permission.UPDATE_CONFIGURATION @@ -674,7 +677,7 @@ format(number: string): string ``` -### getLocationName8+ +### getLocationName9+ static getLocationName(number: string, locale: string): string @@ -753,6 +756,30 @@ static unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: ``` +### getDateOrder9+ + +static getDateOrder(locale: string): string + +获取某一区域的日期的年、月、日排列顺序。 + +**系统能力**:SystemCapability.Global.I18n + +**参数:** +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | ---------------------------------------- | +| locale | string | 是 | 格式化时使用的区域参数,如:zh-Hans-CN。 | + +**返回值:** +| 类型 | 说明 | +| ------ | ----------------------- | +| string | 返回某一区域的日期的年、月、日排列顺序 | + +**示例:** + ``` + i18n.Util.getDateOrder("zh-CN"); + ``` + + ## getInstance8+ getInstance(locale?:string): IndexUtil @@ -1486,10 +1513,10 @@ getTimeZone(zoneID?: string): TimeZone ``` -## TimeZone8+ +## TimeZone -### getID8+ +### getID getID(): string @@ -1509,7 +1536,7 @@ getID(): string ``` -### getDisplayName8+ +### getDisplayName getDisplayName(locale?: string, isDST?: boolean): string @@ -1535,7 +1562,7 @@ getDisplayName(locale?: string, isDST?: boolean): string ``` -### getRawOffset8+ +### getRawOffset getRawOffset(): number @@ -1555,7 +1582,7 @@ getRawOffset(): number ``` -### getOffset8+ +### getOffset getOffset(date?: number): number @@ -1666,7 +1693,8 @@ static getTimezoneFromCity(cityID: string): TimeZone setUsingLocalDigit(flag: boolean): boolean -设置是否打开本地数字开关。
+设置是否打开本地数字开关。 + 该接口为系统接口。 **需要权限**:ohos.permission.UPDATE_CONFIGURATION @@ -1705,4 +1733,75 @@ getUsingLocalDigit(): boolean **示例:** ``` var status = i18n.getUsingLocalDigit(); + ``` + + +## Transliterator9+ + + +### getAvailableIDs9+ + +static getAvailableIDs(): string[] + +获取音译支持的ID列表。 + +**系统能力**:SystemCapability.Global.I18n + +**返回值:** +| 类型 | 说明 | +| ------ | ------------ | +| string[] | 音译支持的ID列表。 | + +**示例:** + ``` + i18n.Transliterator.getAvailableIDs(); + ``` + + +### getInstance9+ + +static getInstance(id: string): Transliterator + +创建音译对象。 + +**系统能力**:SystemCapability.Global.I18n + +**参数:** +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | -------------------- | +| id | string | 是 | 音译支持的ID。 | + +**返回值:** +| 类型 | 说明 | +| ------ | ------------- | +| [Transliterator](#transliterator9) | 音译对象。 | + +**示例:** + ``` + var transliterator = i18n.Transliterator.getInstance("Any-Latn"); + ``` + + +### transform9+ + +transform(text: string): string + +将输入字符串从源格式转换为目标格式。 + +**系统能力**:SystemCapability.Global.I18n + +**参数:** +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | -------------------- | +| text | string | 是 | 输入字符串。 | + +**返回值:** +| 类型 | 说明 | +| ------ | ------------- | +| string | 转换后的字符串。 | + +**示例:** + ``` + var transliterator = i18n.Transliterator.getInstance("Any-Latn"); + transliterator.transform("中国"); ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-image.md b/zh-cn/application-dev/reference/apis/js-apis-image.md index be2d2a809c6834ef99cfb179784551b7a7cdedfd..9aa409b0d22d05bde2f7e88897437aedd44bdeba 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-image.md +++ b/zh-cn/application-dev/reference/apis/js-apis-image.md @@ -65,8 +65,13 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: As const color = new ArrayBuffer(96); let bufferArr = new Uint8Array(color); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } -image.createPixelMap(color, opts, (pixelmap) => { - }) +image.createPixelMap(color, opts, (error, pixelmap) => { + if(error) { + console.log('Failed to create pixelmap.'); + } else { + console.log('Succeeded in creating pixelmap.'); + } +}) ``` ## PixelMap7+ @@ -77,9 +82,9 @@ image.createPixelMap(color, opts, (pixelmap) => { **系统能力:** SystemCapability.Multimedia.Image.Core -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ----------------------- | ------- | ---- | ---- | -------------------------- | -| isEditable7+ | boolean | 是 | 否 | 设定是否图像像素可被编辑。 | +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---------- | ------- | ---- | ---- | -------------------------- | +| isEditable | boolean | 是 | 否 | 设定是否图像像素可被编辑。 | ### readPixelsToBuffer7+ @@ -91,20 +96,20 @@ readPixelsToBuffer(dst: ArrayBuffer): Promise\ **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ----------- | ---- | ------------------------------------------------------------ | -| dst | ArrayBuffer | 是 | 缓冲区,函数执行结束后获取的图像像素数据写入到该内存区域内。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ----------- | ---- | ----------------------------------------------------------------------------------------------------- | +| dst | ArrayBuffer | 是 | 缓冲区,函数执行结束后获取的图像像素数据写入到该内存区域内。缓冲区大小由getPixelBytesNumber接口获取。 | **返回值:** | 类型 | 说明 | -| :------------- | :---------------------------------------------- | +| -------------- | ----------------------------------------------- | | Promise\ | Promise实例,用于获取结果,失败时返回错误信息。 | **示例:** ```js -const readBuffer = new ArrayBuffer(400); +const readBuffer = new ArrayBuffer(96); pixelmap.readPixelsToBuffer(readBuffer).then(() => { console.log('Succeeded in reading image pixel data.'); //符合条件则进入 }).catch(error => { @@ -122,15 +127,15 @@ readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | ------------------------------------------------------------ | -| dst | ArrayBuffer | 是 | 缓冲区,函数执行结束后获取的图像像素数据写入到该内存区域内。 | -| callback | AsyncCallback\ | 是 | 获取回调,失败时返回错误信息。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | ----------------------------------------------------------------------------------------------------- | +| dst | ArrayBuffer | 是 | 缓冲区,函数执行结束后获取的图像像素数据写入到该内存区域内。缓冲区大小由getPixelBytesNumber接口获取。 | +| callback | AsyncCallback\ | 是 | 获取回调,失败时返回错误信息。 | **示例:** ```js -const readBuffer = new ArrayBuffer(400); +const readBuffer = new ArrayBuffer(96); pixelmap.readPixelsToBuffer(readBuffer, (err, res) => { if(err) { console.log('Failed to read image pixel data.'); //不符合条件则进入 @@ -274,7 +279,7 @@ writePixels(area: PositionArea, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | --------- | ------------------------------ | ---- | ------------------------------ | | area | [PositionArea](#positionarea7) | 是 | 区域,根据区域写入。 | -| callback: | AsyncCallback\ | 是 | 获取回调,失败时返回错误信息。 | +| callback | AsyncCallback\ | 是 | 获取回调,失败时返回错误信息。 | **示例:** @@ -920,6 +925,33 @@ let path = this.context.getApplicationContext().fileDirs + "test.jpg"; const imageSourceApi = image.createImageSource(path); ``` +## image.createImageSource9+ + +createImageSource(uri: string, options: SourceOptions): ImageSource + +通过传入的uri创建图片源实例。 + +**系统能力:** SystemCapability.Multimedia.Image.ImageSource + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------- | ---- | ----------------------------------- | +| uri | string | 是 | 图片路径,当前仅支持应用沙箱路径。 | +| options | [SourceOptions](#SourceOptions) | 是 | 图片属性,包括图片序号与默认属性值。| + +**返回值:** + +| 类型 | 说明 | +| --------------------------- | -------------------------------------------- | +| [ImageSource](#imagesource) | 返回ImageSource类实例,失败时返回undefined。 | + +**示例:** + +```js +const imageSourceApi = image.createImageSource('/sdcard/test.jpg'); +``` + ## image.createImageSource7+ createImageSource(fd: number): ImageSource @@ -943,7 +975,34 @@ createImageSource(fd: number): ImageSource **示例:** ```js -const imageSourceApi = image.createImageSource(0) +const imageSourceApi = image.createImageSource(0); +``` + +## image.createImageSource9+ + +createImageSource(fd: number, options: SourceOptions): ImageSource + +通过传入文件描述符来创建图片源实例。 + +**系统能力:** SystemCapability.Multimedia.Image.ImageSource + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------- | ---- | ----------------------------------- | +| fd | number | 是 | 文件描述符fd。 | +| options | [SourceOptions](#SourceOptions) | 是 | 图片属性,包括图片序号与默认属性值。| + +**返回值:** + +| 类型 | 说明 | +| --------------------------- | -------------------------------------------- | +| [ImageSource](#imagesource) | 返回ImageSource类实例,失败时返回undefined。 | + +**示例:** + +```js +const imageSourceApi = image.createImageSource(fd); ``` ## image.createImageSource9+ @@ -967,9 +1026,64 @@ const buf = new ArrayBuffer(96); const imageSourceApi = image.createImageSource(buf); ``` +## image.createImageSource9+ + +createImageSource(buf: ArrayBuffer, options: SourceOptions): ImageSource + +通过缓冲区创建图片源实例。 + +**系统能力:** SystemCapability.Multimedia.Image.ImageSource + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | -------------------------------- | ---- | ------------------------------------ | +| buf | ArrayBuffer | 是 | 图像缓冲区数组。 | +| options | [SourceOptions](#SourceOptions) | 是 | 图片属性,包括图片序号与默认属性值。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------- | -------------------------------------------- | +| [ImageSource](#imagesource) | 返回ImageSource类实例,失败时返回undefined。 | + +**示例:** + +```js +const data = new ArrayBuffer(112); +const imageSourceApi = image.createImageSource(data); +``` + +## image.CreateIncrementalSource9+ + +CreateIncrementalSource(buf: ArrayBuffer): ImageSource + +通过缓冲区以增量的方式创建图片源实例。 + +**系统能力:** SystemCapability.Multimedia.Image.ImageSource + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------| ---- | ----------| +| buf | ArrayBuffer | 是 | 增量数据。| + +**返回值:** + +| 类型 | 说明 | +| --------------------------- | --------------------------------- | +| [ImageSource](#imagesource) | 返回图片源,失败时返回undefined。 | + +**示例:** + +```js +const buf = new ArrayBuffer(96); +const imageSourceApi = image.CreateIncrementalSource(buf); +``` + ## image.CreateIncrementalSource9+ -function CreateIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource +CreateIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource 通过缓冲区以增量的方式创建图片源实例。 @@ -1104,8 +1218,8 @@ getImageProperty(key:string, options?: GetImagePropertyOptions): Promise\ | Promise实例,用于异步获取图片属性值,如获取失败则返回属性默认值。 | **示例:** @@ -1154,11 +1268,11 @@ getImageProperty(key:string, options: GetImagePropertyOptions, callback: AsyncCa **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | -| key | string | 是 | 图片属性名。 | -| options | [GetImagePropertyOptions](#getimagepropertyoptions7) | 是 | 图片属性,包括图片序号与默认属性值。 | -| callback | AsyncCallback\ | 是 | 获取图片属性回调,返回图片属性值,如获取失败则返回属性默认值。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------- | +| key | string | 是 | 图片属性名。 | +| options | [GetImagePropertyOptions](#getimagepropertyoptions7) | 是 | 图片属性,包括图片序号与默认属性值。 | +| callback | AsyncCallback\ | 是 | 获取图片属性回调,返回图片属性值,如获取失败则返回属性默认值。| **示例:** @@ -1197,7 +1311,7 @@ modifyImageProperty(key: string, value: string): Promise\ **示例:** ```js -imageSourceApi.modifyImageProperty("ImageWidth", "abc") +imageSourceApi.modifyImageProperty("ImageWidth", "120") .then(() => { const w = imageSourceApi.getImageProperty("ImageWidth") console.info('w', w); @@ -1206,7 +1320,7 @@ imageSourceApi.modifyImageProperty("ImageWidth", "abc") ### modifyImageProperty9+ -modifyImageProperty(key: string, value: string, callback: AsyncCallback): void +modifyImageProperty(key: string, value: string, callback: AsyncCallback\): void 通过指定的键修改图片属性的值,callback形式返回结果。 @@ -1223,7 +1337,7 @@ modifyImageProperty(key: string, value: string, callback: AsyncCallback): **示例:** ```js -imageSourceApi.modifyImageProperty("ImageWidth", "abc",() => {}) +imageSourceApi.modifyImageProperty("ImageWidth", "120",() => {}) ``` ### updateData9+ @@ -1261,7 +1375,7 @@ imageSourceIncrementalSApi.updateData(array, false, 0, 10).then(data => { ### updateData9+ -updateData(buf: ArrayBuffer, isFinished: boolean, value: number, length: number, callback: AsyncCallback): void +updateData(buf: ArrayBuffer, isFinished: boolean, value: number, length: number, callback: AsyncCallback\): void 更新增量数据,callback形式返回结果。 @@ -1335,11 +1449,9 @@ createPixelMap(callback: AsyncCallback\): void **示例:** ```js -imageSourceApi.createPixelMap(pixelmap => { - console.log('Succeeded in creating pixelmap object.'); -}).catch(error => { - console.log('Failed to create pixelmap object.'); -}) +imageSourceApi.createPixelMap((err, pixelmap) => { + console.info('Succeeded in creating pixelmap object.'); + }) ``` ### createPixelMap7+ @@ -1418,7 +1530,7 @@ createImagePacker(): ImagePacker 创建ImagePacker实例。 -**系统能力:** SystemCapability.Multimedia.Image.ImageReceiver +**系统能力:** SystemCapability.Multimedia.Image.ImagePacker **返回值:** @@ -1486,8 +1598,8 @@ packing(source: ImageSource, option: PackingOption): Promise\ **返回值:** | 类型 | 说明 | -| :--------------------------- | :-------------------------------------------- | -| Promise\ | Promise实例,用于异步获取压缩或打包后的数据。 | +| ---------------------------- | --------------------------------------------- | +| Promise\ | Promise实例,用于异步获取压缩或打包后的数据。 | **示例:** @@ -1547,9 +1659,9 @@ packing(source: PixelMap, option: PackingOption): Promise\ **返回值:** -| 类型 | 说明 | -| :--------------------------- | :-------------------------------------------- | -| Promise\ | Promise实例,用于异步获取压缩或打包后的数据。 | +| 类型 | 说明 | +| --------------------- | -------------------------------------------- | +| Promise\ | Promise实例,用于异步获取压缩或打包后的数据。| **示例:** @@ -1596,9 +1708,9 @@ release(): Promise\ **返回值:** -| 类型 | 说明 | -| :------------- | :------------------------------------------------------ | -| Promise\ | Promise实例,用于异步获取释放结果,失败时返回错误信息。 | +| 类型 | 说明 | +| -------------- | ------------------------------------------------------ | +| Promise\ | Promise实例,用于异步获取释放结果,失败时返回错误信息。| **示例:** @@ -1649,11 +1761,11 @@ var receiver = image.createImageReceiver(8192, 8, 4, 8); **系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image.ImageReceiver -| 名称 | 类型 | 可读 | 可写 | 说明 | -| --------------------- | ---------------------------- | ---- | ---- | ------------------ | -| size9+ | [Size](#size) | 是 | 否 | 图片大小。 | -| capacity9+ | number | 是 | 否 | 同时访问的图像数。 | -| format9+ | [ImageFormat](#imageformat9) | 是 | 否 | 图像格式。 | +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | ---------------------------- | ---- | ---- | ------------------ | +| size | [Size](#size) | 是 | 否 | 图片大小。 | +| capacity | number | 是 | 否 | 同时访问的图像数。 | +| format | [ImageFormat](#imageformat9) | 是 | 否 | 图像格式。 | ### getReceivingSurfaceId9+ @@ -1878,11 +1990,11 @@ receiver.release().then(() => { **系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image.Core -| 名称 | 类型 | 可读 | 可写 | 说明 | -| --------------------- | ------------------ | ---- | ---- | -------------------------------------------------- | -| clipRect9+ | [Region](#region7) | 是 | 是 | 要裁剪的图像区域。 | -| size9+ | [Size](#size) | 是 | 否 | 图像大小。 | -| format9+ | number | 是 | 否 | 图像格式,参考[PixelMapFormat](#pixelmapformat7)。 | +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | ------------------ | ---- | ---- | -------------------------------------------------- | +| clipRect | [Region](#region7) | 是 | 是 | 要裁剪的图像区域。 | +| size | [Size](#size) | 是 | 否 | 图像大小。 | +| format | number | 是 | 否 | 图像格式,参考[PixelMapFormat](#pixelmapformat7)。 | ### getComponent9+ @@ -2032,8 +2144,8 @@ img.release().then(() =>{ | 名称 | 默认值 | 描述 | | --------- | ------ | ----------------- | | UNKNOWN | 0 | 未知格式。 | -| RGBA_8888 | 3 | 格式为RGBA_8888。 | | RGB_565 | 2 | 格式为RGB_565。 | +| RGBA_8888 | 3 | 格式为RGBA_8888。 | ## AlphaType9+ @@ -2059,19 +2171,32 @@ img.release().then(() =>{ | CENTER_CROP | 1 | 缩放图像以填充目标图像区域并居中裁剪区域外的效果。 | | FIT_TARGET_SIZE | 2 | 图像适合目标尺寸的效果。 | +## SourceOptions9+ + +ImageSource的初始化选项。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image.Core + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------------- | ---------------------------------- | ---- | ---- | ------------------ | +| sourceDensity | number | 是 | 是 | ImageSource的密度。| +| sourcePixelFormat | [PixelMapFormat](#pixelmapformat7) | 是 | 是 | 图片像素格式。 | +| sourceSize | [Size](#size) | 是 | 是 | 图像像素大小。 | + + ## InitializationOptions8+ PixelMap的初始化选项。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image.Code +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image.Core -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ---------------------- | ---------------------------------- | ---- | ---- | -------------- | -| alphaType9+ | [AlphaType](#alphatype9) | 是 | 是 | 透明度。 | -| editable | boolean | 是 | 是 | 是否可编辑。 | -| pixelFormat | [PixelMapFormat](#pixelmapformat7) | 是 | 是 | 像素格式。 | -| scaleMode9+ | [ScaleMode](#scalemode9) | 是 | 是 | 缩略值。 | -| size | [Size](#size) | 是 | 是 | 创建图片大小。 | +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------------------ | ---------------------------------- | ---- | ---- | -------------- | +| alphaType9+ | [AlphaType](#alphatype9) | 是 | 是 | 透明度。 | +| editable | boolean | 是 | 是 | 是否可编辑。 | +| pixelFormat | [PixelMapFormat](#pixelmapformat7) | 是 | 是 | 像素格式。 | +| scaleMode9+ | [ScaleMode](#scalemode9) | 是 | 是 | 缩略值。 | +| size | [Size](#size) | 是 | 是 | 创建图片大小。 | ## DecodingOptions7+ @@ -2107,9 +2232,9 @@ PixelMap的初始化选项。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image.ImagePacker -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ------- | ------ | ---- | ---- | -------------- | -| format | string | 是 | 是 | 目标格式。 | +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------- | ------ | ---- | ---- | --------------------------------------------------- | +| format | string | 是 | 是 | 目标格式。 | | quality | number | 是 | 是 | JPEG编码中设定输出图片质量的参数,取值范围为1-100。 | ## GetImagePropertyOptions7+ @@ -2129,16 +2254,16 @@ PixelMap的初始化选项。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image.Core -| 名称 | 默认值 | 说明 | -| ----------------- | ----------------- | ------------------- | -| BITS_PER_SAMPLE | "BitsPerSample" | 每个像素比特数。 | -| ORIENTATION | "Orientation" | 图片方向。 | -| IMAGE_LENGTH | "ImageLength" | 图片长度。 | -| IMAGE_WIDTH | "ImageWidth" | 图片宽度。 | -| GPS_LATITUDE | "GPSLatitude" | 图片纬度。 | -| GPS_LONGITUDE | "GPSLongitude" | 图片经度。 | -| GPS_LATITUDE_REF | "GPSLatitudeRef" | 纬度引用,例如N或S。| -| GPS_LONGITUDE_REF | "GPSLongitudeRef" | 经度引用,例如W或E。| +| 名称 | 默认值 | 说明 | +| ----------------- | ----------------------- | ------------------------ | +| BITS_PER_SAMPLE | "BitsPerSample" | 每个像素比特数。 | +| ORIENTATION | "Orientation" | 图片方向。 | +| IMAGE_LENGTH | "ImageLength" | 图片长度。 | +| IMAGE_WIDTH | "ImageWidth" | 图片宽度。 | +| GPS_LATITUDE | "GPSLatitude" | 图片纬度。 | +| GPS_LONGITUDE | "GPSLongitude" | 图片经度。 | +| GPS_LATITUDE_REF | "GPSLatitudeRef" | 纬度引用,例如N或S。 | +| GPS_LONGITUDE_REF | "GPSLongitudeRef" | 经度引用,例如W或E。 | ## ImageFormat9+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputconsumer.md b/zh-cn/application-dev/reference/apis/js-apis-inputconsumer.md index 0a34cefa86bb57dfcac8a65484982ca413899405..6ec2d416630d8a97bacbe2c15fa541813312ac91 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-inputconsumer.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputconsumer.md @@ -25,6 +25,8 @@ on(type: "key", keyOptions: KeyOptions, callback: Callback<KeyOptions>): v 此接口为系统接口。 +**系统能力:** SystemCapability.MultimodalInput.Input.InputConsumer + **参数:** | 参数 | 类型 | 必填 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md index 218c94a6f1881dceddfee7536e81b34a981c6430..09f90747863be35c6e4f32e971fbce67f03f6c09 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md @@ -74,7 +74,53 @@ getInputMethodSetting(): InputMethodSetting ```js var InputMethodSetting = inputMethod.getInputMethodSetting(); ``` +## inputMethod.switchInputMethod9+ +switchInputMethod(target: InputmethodProperty, callback: AsyncCallback<boolean>): void; + + +**系统能力**:SystemCapability.Miscservices.InputMethodFramework + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | -------- | -------- | -------- | -------- | + |target | [InputmethodProperty](#inputmethodproperty8) | 是 | 传入要切换的目标输入法。 | + | callback | AsyncCallback<boolean> | 是 | 返回输入法切换是否成功。 | + + +**示例:** + +```js + inputMethod.switchInputMethod({packageName:"com.ohos.inputApp", methodId:"InputDemoService"}).then(res => { + prompt.showToast({message:"切换输入法成功" + this.imeList[this.flag].packageName, duration: 200}); + }); +``` +## inputMethod.switchInputMethod9+ +switchInputMethod(target: InputmethodProperty): Promise<boolean> + + +**系统能力**: SystemCapability.Miscservices.InputMethodFramework + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | -------- | -------- | -------- | -------- | + |target | [InputmethodProperty](#inputmethodproperty8)| 是 | 传入要切换的目标输入法。 | + +**返回值:** + | 类型 | 说明 | + | ----------------------------------------- | ---------------------------- | + | [Promise](#Promise) | 回调返回切换后的输入法。 | + +**示例:** + + +```js + inputMethod.switchInputMethod({packageName:"com.ohos.inputApp", methodId:"InputDemoService"}).then(res => { + prompt.showToast({message:"切换输入法成功" + this.imeList[this.flag].packageName, duration: 200}); + }); +``` ## InputMethodController 下列API示例中都需使用[getInputMethodController](#getInputMethodController)回调获取到InputMethodController实例,再通过此实例调用对应方法。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmonitor.md b/zh-cn/application-dev/reference/apis/js-apis-inputmonitor.md index be52e915593fe57342e8e74ca2d5ac4a2a73f0de..9ce35da2f1c54b09c3ff6a5220d60883c41131c7 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-inputmonitor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputmonitor.md @@ -29,9 +29,9 @@ on(type: "touch", receiver: TouchEventReceiver): void 此接口为系统接口。 -**需要权限:**ohos.permission.INPUT_MONITORING +**需要权限:** ohos.permission.INPUT_MONITORING -**系统能力:**SystemCapability.MultimodalInput.Input.InputMonitor +**系统能力:** SystemCapability.MultimodalInput.Input.InputMonitor **参数:** | 参数 | 类型 | 必填 | 说明 | @@ -84,9 +84,9 @@ off(type: "touch", receiver?: TouchEventReceiver): void 此接口为系统接口。 -**需要权限:**ohos.permission.INPUT_MONITORING +**需要权限:** ohos.permission.INPUT_MONITORING -**系统能力:**SystemCapability.MultimodalInput.Input.InputMonitor +**系统能力:** SystemCapability.MultimodalInput.Input.InputMonitor **参数:** | 参数 | 类型 | 必填 | 说明 | @@ -106,9 +106,9 @@ off(type: "mouse", receiver?: Callback<MouseEvent>): void 此接口为系统接口。 -**需要权限:**ohos.permission.INPUT_MONITORING +**需要权限:** ohos.permission.INPUT_MONITORING -**系统能力:**SystemCapability.MultimodalInput.Input.InputMonitor +**系统能力:** SystemCapability.MultimodalInput.Input.InputMonitor **参数:** @@ -131,7 +131,7 @@ inputMonitor.off("mouse"); 此接口为系统接口。 -**系统能力:**SystemCapability.MultimodalInput.Input.InputMonitor +**系统能力:** SystemCapability.MultimodalInput.Input.InputMonitor **参数:** | 参数 | 类型 | 必填 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-keycode.md b/zh-cn/application-dev/reference/apis/js-apis-keycode.md index 2559bcf9dc665a91d8f79a60006e9a04cc1fcf10..917509192e42e0b86f7b1ee84d550835e8634d3b 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-keycode.md +++ b/zh-cn/application-dev/reference/apis/js-apis-keycode.md @@ -302,7 +302,7 @@ import {KeyCode} from '@ohos.multimodalInput.keyCode' | KEYCODE_SCREENLOCK | number | 是 | 否 | 屏幕锁定键 | | KEYCODE_DIRECTION_ROTATE_DISPLAY | number | 是 | 否 | 方向旋转显示键 | | KEYCODE_CYCLEWINDOWS | number | 是 | 否 | Windows循环键 | -| KEYCODE_COMPUTER | number | 是 | 否 | 计算机按键 | +| KEYCODE_COMPUTER | number | 是 | 否 | 按键 | | KEYCODE_EJECTCLOSECD | number | 是 | 否 | 弹出CD键 | | KEYCODE_ISO | number | 是 | 否 | ISO键 | | KEYCODE_MOVE | number | 是 | 否 | 移动键 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-media.md b/zh-cn/application-dev/reference/apis/js-apis-media.md index 50438f8ed64fa045d2b4710ea1dcb5ff2df9e31d..9c2dd5f84022610b87c6868135d19be0c4b2ed6a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-media.md +++ b/zh-cn/application-dev/reference/apis/js-apis-media.md @@ -105,6 +105,7 @@ media.createVideoPlayer().then((video) => { createAudioRecorder(): AudioRecorder 创建音频录制的实例来控制音频的录制。 +一台设备只允许创建一个录制实例。 **系统能力:** SystemCapability.Multimedia.Media.AudioRecorder @@ -125,6 +126,7 @@ let audioRecorder = media.createAudioRecorder(); createVideoRecorder(callback: AsyncCallback\<[VideoRecorder](#videorecorder9)>): void 异步方式创建视频录制实例。通过注册回调函数获取返回值。 +一台设备只允许创建一个录制实例。 **系统能力:** SystemCapability.Multimedia.Media.VideoRecorder @@ -154,6 +156,7 @@ media.createVideoRecorder((error, video) => { createVideoRecorder(): Promise<[VideoRecorder](#videorecorder9)> 异步方式创建视频录制实例。通过Promise获取返回值。 +一台设备只允许创建一个录制实例。 **系统能力:** SystemCapability.Multimedia.Media.VideoRecorder @@ -273,10 +276,11 @@ Codec MIME类型枚举。 | 名称 | 类型 | 可读 | 可写 | 说明 | | ----------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ | -| src | string | 是 | 是 | 音频媒体URI,支持当前主流的音频格式(mp4、aac、mp3、ogg、wav)。
**支持路径示例**:
1、fd类型播放:fd://xx
![](figures/zh-cn_image_url.png)
2、http网络播放: http://xx
3、https网络播放: https://xx
**注意事项**:
使用媒体素材需要获取读权限,否则无法正常播放。 | -| loop | boolean | 是 | 是 | 音频循环播放属性,设置为'true'表示循环播放。 | -| currentTime | number | 是 | 否 | 音频的当前播放位置。 | -| duration | number | 是 | 否 | 音频时长。 | +| src | string | 是 | 是 | 音频媒体URI,支持当前主流的视频格式(mp4、mpeg-ts、webm、mkv)。
**支持路径示例**:
1. fd类型播放:fd://xx
![](figures/zh-cn_image_url.png)
2. http网络播放: http://xx
3. https网络播放: https://xx
4. hls网络播放路径:http://xx或者https://xx
**注意事项**:
使用媒体素材需要获取读权限,否则无法正常播放。 | +| loop | boolean | 是 | 是 | 音频循环播放属性,设置为'true'表示循环播放。 +| audioInterruptMode9+ | [InterruptMode](#interruptmode9) | 是 | 是 | 音频焦点模型。 | +| currentTime | number | 是 | 否 | 音频的当前播放位置,单位为毫秒(ms)。 | +| duration | number | 是 | 否 | 音频时长,单位为毫秒(ms)。 | | state | [AudioState](#audiostate) | 是 | 否 | 音频播放的状态。 | ### play @@ -617,7 +621,7 @@ audioPlayer.seek(30000); //seek到30000ms的位置 on(type: 'error', callback: ErrorCallback): void -开始订阅音频播放错误事件。 +开始订阅音频播放错误事件,当上报error错误事件后,用户需处理error事件,退出播放操作。 **系统能力:** SystemCapability.Multimedia.Media.AudioPlayer @@ -653,6 +657,17 @@ audioPlayer.setVolume(3); //设置volume为无效值,触发'error'事件 | stopped | string | 音频播放停止。 | | error8+ | string | 错误状态。 | +## InterruptMode9+ + +枚举,焦点模型。 + +**系统能力:** SystemCapability.Multimedia.Audio.InterruptMode + +| 名称 | 默认值 | 描述 | +| ---------------------------- | ------ | ---------- | +| SHARE_MODE | 0 | 共享焦点模式。 | +| INDEPENDENT_MODE| 1 | 独立焦点模式。 | + ## VideoPlayer8+ 视频播放管理类,用于管理和播放视频媒体。在调用VideoPlayer的方法前,需要先通过[createVideoPlayer()](#mediacreatevideoplayer8)构建一个[VideoPlayer](#videoplayer8)实例。 @@ -665,13 +680,15 @@ audioPlayer.setVolume(3); //设置volume为无效值,触发'error'事件 | 名称 | 类型 | 可读 | 可写 | 说明 | | ------------------------ | ---------------------------------- | ---- | ---- | ------------------------------------------------------------ | -| url8+ | string | 是 | 是 | 视频媒体URL,支持当前主流的视频格式(mp4、mpeg-ts、webm、mkv)。
**支持路径示例**:
1. fd类型播放:fd://xx
![](figures/zh-cn_image_url.png)
2、http网络播放: http://xx
3、https网络播放: https://xx
3、hls网络播放路径:http://xx或者https://xx
**注意事项**:
使用媒体素材需要获取读权限,否则无法正常播放。 | +| url8+ | string | 是 | 是 | 视频媒体URL,支持当前主流的视频格式(mp4、mpeg-ts、webm、mkv)。
**支持路径示例**:
1. fd类型播放:fd://xx
![](figures/zh-cn_image_url.png)
2. http网络播放: http://xx
3. https网络播放: https://xx
4. hls网络播放路径:http://xx或者https://xx
**注意事项**:
使用媒体素材需要获取读权限,否则无法正常播放。 | | loop8+ | boolean | 是 | 是 | 视频循环播放属性,设置为'true'表示循环播放。 | -| currentTime8+ | number | 是 | 否 | 视频的当前播放位置。 | -| duration8+ | number | 是 | 否 | 视频时长,返回-1表示直播模式。 | +| videoScaleType9+ | [VideoScaleType](#videoscaletype9) | 是 | 是 | 视频缩放模式。 | +| audioInterruptMode9+ | [InterruptMode](#interruptmode9) | 是 | 是 | 音频焦点模型。 | +| currentTime8+ | number | 是 | 否 | 视频的当前播放位置,单位为毫秒(ms)。 | +| duration8+ | number | 是 | 否 | 视频时长,单位为毫秒(ms),返回-1表示直播模式。 | | state8+ | [VideoPlayState](#videoplaystate8) | 是 | 否 | 视频播放的状态。 | -| width8+ | number | 是 | 否 | 视频宽。 | -| height8+ | number | 是 | 否 | 视频高。 | +| width8+ | number | 是 | 否 | 视频宽,单位为像素(px)。 | +| height8+ | number | 是 | 否 | 视频高,单位为像素(px)。 | ### setDisplaySurface8+ @@ -1486,7 +1503,7 @@ videoPlayer.on('videoSizeChanged', (width, height) => { on(type: 'error', callback: ErrorCallback): void -开始监听视频播放错误事件。 +开始监听视频播放错误事件,当上报error错误事件后,用户需处理error事件,退出播放操作。 **系统能力:** SystemCapability.Multimedia.Media.VideoPlayer @@ -1573,6 +1590,17 @@ videoPlayer.on('availableBitrateCollected', (bitrates) => { | SPEED_FORWARD_1_75_X | 3 | 表示视频播放正常播速的1.75倍。 | | SPEED_FORWARD_2_00_X | 4 | 表示视频播放正常播速的2.00倍。 | +## VideoScaleType9+ + +枚举,视频缩放模式。 + +**系统能力:** 以下各项对应的系统能力均为 SystemCapability.Multimedia.Media.VideoPlayer。 + +| 名称 | 默认值 | 描述 | +| ---------------------------- | ------ | ---------- | +| VIDEO_SCALE_TYPE_FIT | 0 | 视频拉伸至与窗口等大。 | +| VIDEO_SCALE_TYPE_FIT_CROP| 1 | 保持视频宽高比拉伸至填满窗口,内容可能会有裁剪。 | + ## MediaDescription8+ ### [key : string] : Object @@ -1814,7 +1842,7 @@ audioRecorder.prepare(audioRecorderConfig) on(type: 'error', callback: ErrorCallback): void -开始订阅音频录制错误事件。 +开始订阅音频录制错误事件,当上报error错误事件后,用户需处理error事件,退出录制操作。 **系统能力:** SystemCapability.Multimedia.Media.AudioRecorder @@ -2434,7 +2462,7 @@ videoRecorder.reset().then(() => { on(type: 'error', callback: ErrorCallback): void -开始订阅视频录制错误事件。 +开始订阅视频录制错误事件,当上报error错误事件后,用户需处理error事件,退出录制操作。 **系统能力:** SystemCapability.Multimedia.Media.VideoRecorder diff --git a/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md b/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md index 904b19f54a1ce81502088ccc2f68ad5b5555a06d..3f065be17f0f1bb0efc27420731fff12d6c5660c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md +++ b/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md @@ -136,7 +136,7 @@ let imagesfetchOp = { selectionArgs: [imageType.toString()], }; media.getFileAssets(imagesfetchOp).then(function(fetchFileResult){ - console.info("getFileAssets successfully:"+ JSON.stringify(dir)); + console.info("getFileAssets successfully: image number is "+ fetchFileResult.getCount()); }).catch(function(err){ console.info("getFileAssets failed with error:"+ err); }); @@ -744,7 +744,7 @@ mediaLibrary.getMediaLibrary().startMediaSelect(option).then((value) => { | width | number | 是 | 否 | 图片宽度(单位:像素) | | height | number | 是 | 否 | 图片高度(单位:像素) | | orientation | number | 是 | 是 | 图片显示方向(顺时针旋转角度,如0,90,180 单位:度) | -| duration8+ | number | 是 | 否 | 持续时间(单位:秒) | +| duration8+ | number | 是 | 否 | 持续时间(单位:毫秒) | | albumId | number | 是 | 否 | 文件所归属的相册编号 | | albumUri8+ | string | 是 | 否 | 文件所归属相册uri | | albumName | string | 是 | 否 | 文件所归属相册名称 | @@ -900,7 +900,7 @@ open(mode: string, callback: AsyncCallback<number>): void **注意**:当前写操作是互斥的操作,写操作完成后需要调用close进行释放 -**需要权限**:ohos.permission.READ_MEDIA('r'模式打开),ohos.permission.WRITE_MEDIA('w'模式打开) +**需要权限**:ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -937,7 +937,7 @@ open(mode: string): Promise<number> **注意**:当前写操作是互斥的操作,写操作完成后需要调用close进行释放 -**需要权限**:ohos.permission.READ_MEDIA('r'模式打开),ohos.permission.WRITE_MEDIA('w'模式打开) +**需要权限**:ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -977,7 +977,7 @@ close(fd: number, callback: AsyncCallback<void>): void 关闭当前文件,使用callback方式返回异步结果。 -**需要权限**:ohos.permission.READ_MEDIA('r'模式打开),ohos.permission.WRITE_MEDIA('w'模式打开) +**需要权限**:ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -1018,7 +1018,7 @@ close(fd: number): Promise<void> 关闭当前文件,使用promise方式返回异步结果。 -**需要权限**:ohos.permission.READ_MEDIA('r'模式打开),ohos.permission.WRITE_MEDIA('w'模式打开) +**需要权限**:ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -1671,8 +1671,6 @@ async function example() { 获取文件检索结果中的下一个文件资产。此方法使用callback形式返回结果。 -**需要权限**:ohos.permission.READ_MEDIA - **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core **参数**: @@ -1709,8 +1707,6 @@ async function example() { 获取文件检索结果中的下一个文件资产。此方法使用promise方式来异步返回FileAsset。 -**需要权限**:ohos.permission.READ_MEDIA - **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core **返回值**: @@ -1846,8 +1842,6 @@ getPositionObject(index: number): Promise<FileAsset> 获取文件检索结果中具有指定索引的文件资产。此方法使用Promise形式返回文件Asset。 -**需要权限**:ohos.permission.READ_MEDIA - **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core **参数**: @@ -1890,8 +1884,6 @@ getAllObject(callback: AsyncCallback<Array<FileAsset>>): void 获取文件检索结果中的所有文件资产。此方法使用Callback回调来返回FileAsset结果集。 -**需要权限**:ohos.permission.READ_MEDIA - **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core **参数**: @@ -2119,8 +2111,9 @@ async function example() { ## PeerInfo8+ 注册设备的信息。 +此接口为系统接口。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.Core +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.DistributedCore | 名称 | 类型 | 可读 | 可写 | 说明 | | ---------- | -------------------------- | ---- | ---- | ---------------- | @@ -2165,7 +2158,7 @@ async function example() { | TITLE | title | 文件标题 | | ARTIST | artist | 作者 | | AUDIOALBUM | audio_album | 专辑 | -| DURATION | duration | 持续时间(单位:秒) | +| DURATION | duration | 持续时间(单位:毫秒) | | WIDTH | width | 图片宽度(单位:像素) | | HEIGHT | height | 图片高度(单位:像素) | | ORIENTATION | orientation | 图片显示方向,即顺时针旋转角度,如0,90,180。(单位:度) | @@ -2190,8 +2183,9 @@ async function example() { ## DeviceType8+ 枚举,设备类型。 +此接口为系统接口。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.Core +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.DistributedCore | 名称 | 说明 | | ------------ | ---------- | @@ -2221,6 +2215,7 @@ async function example() { ## Size8+ 图片尺寸。 +系统能力: 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.Core | 名称 | 类型 | 可读 | 可写 | 说明 | | ------ | ------ | ---- | ---- | -------- | @@ -2253,4 +2248,4 @@ async function example() { | 名称 | 类型 | 必填 | 描述 | | ----- | ------ | ---- | -------------------- | | type | string | 是 | 媒体类型,包括:image, video, media,当前仅支持media类型 | -| count | number | 是 | 媒体选择,count = 1表示单选,count大于1表示多选。 | \ No newline at end of file +| count | number | 是 | 媒体选择,count = 1表示单选,count大于1表示多选。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-missionManager.md b/zh-cn/application-dev/reference/apis/js-apis-missionManager.md index af0eb8d91ab0f4e8e42a3021a95edac2f3c8d34d..bb2deac5e536bae5841fd28fd6fe1c112df1b801 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-missionManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-missionManager.md @@ -362,6 +362,88 @@ getMissionSnapShot(deviceId: string, missionId: number): Promise<MissionSnaps }); ``` +## missionManager.getLowResolutionMissionSnapShot9+ + +getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback\): void; + +使用给定的任务ID获取任务低分辨率快照。 + +**需要权限**:ohos.permission.MANAGE_MISSIONS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | -------- | -------- | -------- | -------- | + | deviceId | string | 是 | 设备ID,本机默认为空字符串。 | + | missionId | number | 是 | 任务ID。 | + | callback | AsyncCallback<[MissionSnapshot](js-apis-application-MissionSnapshot.md)> | 是 | 执行结果回调函数,返回任务快照信息。 | + +**示例:** + + ```js + import missionManager from '@ohos.application.missionManager' + + missionManager.getMissionInfos("", 10, (error, missions) => { + console.log("getMissionInfos is called, error.code = " + error.code); + console.log("size = " + missions.length); + console.log("missions = " + JSON.stringify(missions)); + var id = missions[0].missionId; + + missionManager.getLowResolutionMissionSnapShot("", id, (error, snapshot) => { + console.log("getLowResolutionMissionSnapShot is called, error.code = " + error.code); + console.log("bundleName = " + snapshot.ability.bundleName); + }) + }) + ``` + + +## missionManager.getLowResolutionMissionSnapShot9+ + +getLowResolutionMissionSnapShot(deviceId: string, missionId: number): Promise\; + +使用给定的任务ID获取任务低分辨率快照。 + +**需要权限**:ohos.permission.MANAGE_MISSIONS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | -------- | -------- | -------- | -------- | + | deviceId | string | 是 | 设备ID,本机默认为空字符串。 | + | missionId | number | 是 | 任务ID。 | + +**返回值:** + + | 类型 | 说明 | + | -------- | -------- | + | Promise<[MissionSnapshot](js-apis-application-MissionSnapshot.md)> | 任务快照信息。 | + +**示例:** + + ```js + import missionManager from '@ohos.application.missionManager' + + var allMissions; + missionManager.getMissionInfos("",10).then(function(res){ + allMissions=res; + }).catch(function(err){console.log(err);}); + console.log("size = " + allMissions.length); + console.log("missions = " + JSON.stringify(allMissions)); + var id = allMissions[0].missionId; + + var snapshot = missionManager.getLowResolutionMissionSnapShot("", id).catch(function (err){ + console.log(err); + }); + ``` + ## missionManager.lockMission diff --git a/zh-cn/application-dev/reference/apis/js-apis-notification.md b/zh-cn/application-dev/reference/apis/js-apis-notification.md index 3684393fab272c6769669dd027498494fcd601cf..c400b1af6748561785bbff9120b9c9b627154ad1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-notification.md +++ b/zh-cn/application-dev/reference/apis/js-apis-notification.md @@ -2571,7 +2571,7 @@ Notification.enableDistributedByBundle(bundle, enable, enableDistributedByBundle ## Notification.enableDistributedByBundle8+ -bundleenableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise\ +enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise\ 根据应用的包设置应用程序是否支持分布式通知(Promise形式)。 @@ -2905,6 +2905,8 @@ enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean, ca **系统API**:此接口为系统接口,三方应用不支持调用。 +**需要权限**:ohos.permission.NOTIFICATION_CONTROLLER + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2924,14 +2926,14 @@ function enableSlotCallback(err) { Notification.enableNotificationSlot( { bundle: "ohos.samples.notification", }, - notify.SlotType.SOCIAL_COMMUNICATION, + Notification.SlotType.SOCIAL_COMMUNICATION, true, enableSlotCallback); ``` ## Notification.enableNotificationSlot 9+ -enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean): Promise +enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean): Promise\ 设定指定类型的渠道使能状态(Promise形式)。 @@ -2939,6 +2941,8 @@ enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean): P **系统API**:此接口为系统接口,三方应用不支持调用。 +**需要权限**:ohos.permission.NOTIFICATION_CONTROLLER + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2953,7 +2957,7 @@ enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean): P //enableNotificationSlot Notification.enableNotificationSlot( { bundle: "ohos.samples.notification", }, - notify.SlotType.SOCIAL_COMMUNICATION, + Notification.SlotType.SOCIAL_COMMUNICATION, true).then(() => { console.log('====================>enableNotificationSlot====================>'); }); @@ -2961,7 +2965,7 @@ Notification.enableNotificationSlot( ## Notification.isNotificationSlotEnabled 9+ -isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncCallback): void +isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncCallback\): void 获取指定类型的渠道使能状态(Callback形式)。 @@ -2969,13 +2973,15 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncC **系统API**:此接口为系统接口,三方应用不支持调用。 +**需要权限**:ohos.permission.NOTIFICATION_CONTROLLER + **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------- | ---- | ---------------------- | | bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | type | [SlotType](#slottype) | 是 | 指定渠道类型。 | -| callback | AsyncCallback\ | 是 | 设定渠道使能回调函数。 | +| callback | AsyncCallback\ | 是 | 设定渠道使能回调函数。 | **示例:** @@ -2987,13 +2993,13 @@ function getEnableSlotCallback(err, data) { Notification.isNotificationSlotEnabled( { bundle: "ohos.samples.notification", }, - notify.SlotType.SOCIAL_COMMUNICATION, + Notification.SlotType.SOCIAL_COMMUNICATION, getEnableSlotCallback); ``` ## Notification.isNotificationSlotEnabled 9+ -isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise +isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\ 获取指定类型的渠道使能状态(Promise形式)。 @@ -3001,6 +3007,8 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise | 以Promise形式返回指定类型的渠道使能状态。 | + **示例:** ```js //isNotificationSlotEnabled Notification.isNotificationSlotEnabled( { bundle: "ohos.samples.notification", }, - notify.SlotType.SOCIAL_COMMUNICATION, - true).then((data) => { + Notification.SlotType.SOCIAL_COMMUNICATION + ).then((data) => { console.log('====================>isNotificationSlotEnabled====================>'); }); ``` + +## Notification.setSyncNotificationEnabledForUninstallApp9+ + +setSyncNotificationEnabledForUninstallApp(userId: number, enable: boolean, callback: AsyncCallback\): void + +设置是否将通知同步到未安装应用程序的设备(callback形式)。 + +**系统能力**:SystemCapability.Notification.Notification + +**系统API**:此接口为系统接口,三方应用不支持调用。 + +**需要权限**:ohos.permission.NOTIFICATION_CONTROLLER + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ----------------------------- | ---- | -------------- | +| userId | number | 是 | 用户Id。 | +| enable | boolean | 是 | 是否将通知同步到未安装应用程序的设备。true:是。false:否。 | +| callback | AsyncCallback\ | 是 | 设置是否将通知同步到未安装应用程序的设备的回调函数。 | + +**示例:** + +```js +let userId = 100; +let enable = true; + +function setSyncNotificationEnabledForUninstallAppCallback(err) { + console.log('setSyncNotificationEnabledForUninstallAppCallback'); +} + +Notification.setSyncNotificationEnabledForUninstallApp(userId, enable, setSyncNotificationEnabledForUninstallAppCallback); +``` + + +## Notification.setSyncNotificationEnabledForUninstallApp9+ + +setSyncNotificationEnabledForUninstallApp(userId: number, enable: boolean): Promise\ + +设置是否将通知同步到未安装应用程序的设备(Promise形式)。 + +**系统能力**:SystemCapability.Notification.Notification + +**系统API**:此接口为系统接口,三方应用不支持调用。 + +**需要权限**:ohos.permission.NOTIFICATION_CONTROLLER + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ----------------------------- | ---- | -------------- | +| userId | number | 是 | 用户Id。 | +| enable | boolean | 是 | 是否将通知同步到未安装应用程序的设备。true:是。false:否。 | + +**示例:** + +```js +let userId = 100; +let enable = true; + +Notification.setSyncNotificationEnabledForUninstallApp(userId, enable) + .then((data) => { + console.log('setSyncNotificationEnabledForUninstallApp, data:', data); + }) + .catch((err) => { + console.log('setSyncNotificationEnabledForUninstallApp, err:', err); + }); +``` + + +## Notification.getSyncNotificationEnabledForUninstallApp9+ + +getSyncNotificationEnabledForUninstallApp(userId: number, callback: AsyncCallback\): void + +获取是否同步通知到未安装应用程序的设备的结果(callback形式)。 + +**系统能力**:SystemCapability.Notification.Notification + +**系统API**:此接口为系统接口,三方应用不支持调用。 + +**需要权限**:ohos.permission.NOTIFICATION_CONTROLLER + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ----------------------------- | ---- | -------------- | +| userId | number | 是 | 用户Id。 | +| callback | AsyncCallback\ | 是 | 获取是否同步通知到未安装应用程序的设备的结果的回调函数。true:是。false:否。 | + +**示例:** + +```js +let userId = 100; + +function getSyncNotificationEnabledForUninstallAppCallback(err, data) { + console.log('getSyncNotificationEnabledForUninstallAppCallback, data: ', data); +} + +Notification.getSyncNotificationEnabledForUninstallApp(userId, getSyncNotificationEnabledForUninstallAppCallback); +``` + + +## Notification.getSyncNotificationEnabledForUninstallApp9+ + +getSyncNotificationEnabledForUninstallApp(userId: number): Promise\ + +获取是否同步通知到未安装应用程序的设备的结果(Promise形式)。 + +**系统能力**:SystemCapability.Notification.Notification + +**系统API**:此接口为系统接口,三方应用不支持调用。 + +**需要权限**:ohos.permission.NOTIFICATION_CONTROLLER + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ----------------------------- | ---- | -------------- | +| userId | number | 是 | 用户Id。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------------------------------------- | ------------------------------------------------------------ | +| Promise\ | 以Promise形式返回获取是否同步通知到未安装应用程序的设备的结果。true:是。false:否。 | + +**示例:** + +```js +let userId = 100; + +Notification.getSyncNotificationEnabledForUninstallApp(userId) + .then((data) => { + console.log('getSyncNotificationEnabledForUninstallApp, data: ', data); + }) + .catch((err) => { + console.log('getSyncNotificationEnabledForUninstallApp, err: ', err); + }); +``` + + + ## NotificationSubscriber **系统API**:此接口为系统接口,三方应用不支持调用。 @@ -3582,6 +3738,8 @@ Notification.subscribe(subscriber, subscribeCallback); | distributedOption8+ | 是 | 是 | [DistributedOptions](#distributedoptions8) | 否 | 分布式通知的选项。 | | deviceId8+ | 是 | 否 | string | 否 | 通知源的deviceId。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | | notificationFlags8+ | 是 | 否 | [NotificationFlags](#notificationflags8) | 否 | 获取NotificationFlags。 | +| removalWantAgent9+ | 是 | 是 | WantAgent | 否 | 当移除通知时,通知将被重定向到的WantAgent实例。 | +| badgeNumber9+ | 是 | 是 | number | 否 | 应用程序图标上显示的通知数。 | ## DistributedOptions8+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-osAccount.md b/zh-cn/application-dev/reference/apis/js-apis-osAccount.md index 9582d405e98c3e59c78cc3da3feb1dcdcdd54751..fded000bb04ddead66a536442fc34f30d176eb12 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-osAccount.md +++ b/zh-cn/application-dev/reference/apis/js-apis-osAccount.md @@ -801,7 +801,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCall | 参数名 | 类型 | 必填 | 说明 | | ---------- | --------------------------------------- | ---- | -------------------------------------------- | -| domainInfo | [DomainAccountInfo](#domainaccountinfo) | 是 | 域帐号信息。 | +| domainInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 域帐号信息。 | | callback | AsyncCallback<number> | 是 | 回调结果,返回的是和域帐号关联的系统帐号ID。 | **示例:** @@ -829,7 +829,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise<number& | 参数名 | 类型 | 必填 | 说明 | | ---------- | --------------------------------------- | ---- | ------------ | -| domainInfo | [DomainAccountInfo](#domainaccountinfo) | 是 | 域帐号信息。 | +| domainInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 域帐号信息。 | **返回值:** @@ -1156,7 +1156,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, cal | 参数名 | 类型 | 必填 | 说明 | | :--------- | ---------------------------------------------------- | ---- | ------------------------------------------ | | type | [OsAccountType](#osaccounttype) | 是 | 创建的系统帐号的类型。 | -| domainInfo | [DomainAccountInfo](#domainaccountinfo) | 是 | 域帐号信息。 | +| domainInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 域帐号信息。 | | callback | AsyncCallback<[OsAccountInfo](#osaccountinfo)> | 是 | 回调结果,返回的是新创建的系统帐号的信息。 | **示例:** @@ -1187,7 +1187,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Pr | 参数名 | 类型 | 必填 | 说明 | | ---------- | --------------------------------------- | ---- | ---------------------- | | type | [OsAccountType](#osaccounttype) | 是 | 创建的系统帐号的类型。 | -| domainInfo | [DomainAccountInfo](#domainaccountinfo) | 是 | 域帐号信息。 | +| domainInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 域帐号信息。 | **返回值:** @@ -1932,7 +1932,7 @@ queryOsAccountConstraintSourceTypes(localId: number, constraint: string): Promis | isActived8+ | boolean | 是 | 系统帐号激活状态 | | isCreateCompleted8+ | boolean | 是 | 系统帐号创建是否完整 | | distributedInfo | [distributedAccount.DistributedInfo](js-apis-distributed-account.md) | 否 | 分布式帐号信息 | -| domainInfo8+ | [DomainAccountInfo](#domainaccountinfo) | 否 | 域帐号信息 | +| domainInfo8+ | [DomainAccountInfo](#domainaccountinfo8) | 否 | 域帐号信息 | ## DomainAccountInfo8+ @@ -2017,6 +2017,8 @@ queryOsAccountConstraintSourceTypes(localId: number, constraint: string): Promis 约束来源类型信息。 +此接口为系统接口。 + **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount。 | 参数名 | 类型 | 必填 | 说明 | @@ -2028,6 +2030,8 @@ queryOsAccountConstraintSourceTypes(localId: number, constraint: string): Promis 枚举,约束来源类型。 +此接口为系统接口。 + **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount。 | 参数 | 默认值 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-process.md b/zh-cn/application-dev/reference/apis/js-apis-process.md index b3de31b42ffc7139e93b540020b620b7d51a1614..7484c7b566df6b9ba6b2b0118c348ddc65546865 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-process.md +++ b/zh-cn/application-dev/reference/apis/js-apis-process.md @@ -92,7 +92,7 @@ getOutput(): Promise<Uint8Array> ```js var child = process.runCmd('ls'); var result = child.wait(); -child.getOutput.then(val=>{ +child.getOutput().then(val=>{ console.log("child.getOutput = " + val); }) ``` @@ -119,7 +119,7 @@ getErrorOutput(): Promise<Uint8Array> ```js var child = process.runCmd('madir test.text'); var result = child.wait(); -child.getErrorOutput.then(val=>{ +child.getErrorOutput().then(val=>{ console.log("child.getErrorOutput= " + val); }) ``` @@ -232,7 +232,7 @@ is64Bit(): boolean **示例:** ```js -var ressult = process.is64Bit(); +var result = process.is64Bit(); ``` @@ -286,7 +286,7 @@ getThreadPriority(v: number): number **示例:** ```js -var tid = process.getTid(); +var tid = process.tid; var pres = process.getThreadPriority(tid); ``` @@ -409,7 +409,7 @@ runCmd(command: string, options?: { timeout : number, killSignal : number | stri | 名称 | 参数类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | timeout | number | 否 | 子进程运行的ms数,当子进程运行时间超出此时间,则父进程发送killSignal信号给子进程。timeout默认为0。 | -| killSignal | number  \| string | 否 | 子进程运行时间超出timeout时,父进程发送killSignal 信号给子进程。killSignal 默认为'SIGTERM'。 | +| killSignal | number \| string | 否 | 子进程运行时间超出timeout时,父进程发送killSignal 信号给子进程。killSignal 默认为'SIGTERM'。 | | maxBuffer | number | 否 | 子进程标准输入输出的最大缓冲区大小,当超出此大小时则终止子进程。maxBuffer默认1024\*1024。 | **返回值:** @@ -617,5 +617,5 @@ kill(signal: number, pid: number): boolean ```js var pres = process.pid -var result = that.kill(28, pres) +var result = process.kill(28, pres) ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-processrunninginfo.md b/zh-cn/application-dev/reference/apis/js-apis-processrunninginfo.md index 0d5ceb5c8c30bb70fb506922a60613cf48e16475..ba97f38ccc7bc002fa643490d0652d1b4fab8e0a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-processrunninginfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-processrunninginfo.md @@ -4,7 +4,7 @@ ProcessRunningInfo模块提供对进程运行信息进行设置和查询的能 > **说明:** > -> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 使用说明 diff --git a/zh-cn/application-dev/reference/apis/js-apis-prompt.md b/zh-cn/application-dev/reference/apis/js-apis-prompt.md index 774278b087ee2bf412e00548a84842bcb6df9c53..59611dd5f444f49759fc6769725c584698a020b9 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-prompt.md +++ b/zh-cn/application-dev/reference/apis/js-apis-prompt.md @@ -44,7 +44,7 @@ showToast(options: ShowToastOptions): void | 名称 | 类型 | 必填 | 说明 | | -------- | -------------- | ---- | ---------------------------------------- | -| message | string | 是 | 显示的文本信息。 | +| message | string\| [Resource](../../ui/ts-types.md#resource类型)9+ | 是 | 显示的文本信息。 | | duration | number | 否 | 默认值1500ms,建议区间:1500ms-10000ms,若小于1500ms则取默认值。 | | bottom | string | number | 否 | 设置弹窗边框距离屏幕底部的位置。 | @@ -148,8 +148,8 @@ showDialog(options: ShowDialogOptions, callback: AsyncCallback<ShowDialogSucc | 名称 | 类型 | 必填 | 说明 | | ------- | ------ | ---- | ---------------------------------------- | -| title | string | 否 | 标题文本。 | -| message | string | 否 | 内容文本。 | +| title | string\| [Resource](../../ui/ts-types.md#resource类型)9+ | 否 | 标题文本。 | +| message | string\| [Resource](../../ui/ts-types.md#resource类型)9+ | 否 | 内容文本。 | | buttons | Array | 否 | 对话框中按钮的数组,结构为:{text:'button', color: '\#666666'},支持1-3个按钮。其中第一个为positiveButton;第二个为negativeButton;第三个为neutralButton。 | ## ShowDialogSuccessResponse @@ -258,7 +258,7 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse | 名称 | 类型 | 必填 | 说明 | | ------- | ------ | ---- | ---------------------------------------- | -| title | string | 否 | 标题文本。 | +| title | string\| [Resource](../../ui/ts-types.md#resource类型)9+ | 否 | 标题文本。 | | buttons | Array<[Button](#button)> | 是 | 菜单中菜单项按钮的数组,结构为:{text:'button', color: '\#666666'},支持1-6个按钮。大于6个按钮时弹窗不显示。 | ## ActionMenuSuccessResponse @@ -279,6 +279,6 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse | 名称 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ------------------------ | -| text | string | 是 | 按钮文本内容。 | -| color | string | 是 | 按钮文本颜色。 | +| text | string\| [Resource](../../ui/ts-types.md#resource类型)9+ | 是 | 按钮文本内容。 | +| color | string\| [Resource](../../ui/ts-types.md#resource类型)9+ | 是 | 按钮文本颜色。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-radio.md b/zh-cn/application-dev/reference/apis/js-apis-radio.md index 5b6297b3f53f72eac45e6843652eddbea2af7676..b8665dec70d0478eb375734d4525fa26e5f67939 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-radio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-radio.md @@ -701,7 +701,7 @@ getIMEI(slotId?: number): Promise | 类型 | 说明 | | ----------------- | ------------------------------------------ | -| Promise\ | 返回IMEI;如果IMEI不存在,则返回空字符串。 | +| Promise\ | 以Promise形式异步返回IMEI;如果IMEI不存在,则返回空字符串。 | **示例:** @@ -899,6 +899,693 @@ promise.then(data => { }); ``` +## radio.sendUpdateCellLocationRequest8+ + +sendUpdateCellLocationRequest\(callback: AsyncCallback\): void + +发送更新小区位置请求,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ---------- | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +radio.sendUpdateCellLocationRequest((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## radio.sendUpdateCellLocationRequest8+ + +sendUpdateCellLocationRequest\(\): Promise + +发送更新小区位置请求,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------- | +| Promise\ | 以Promise形式返回结果。 | + +**示例:** + +```js +let promise = radio.sendUpdateCellLocationRequest(); +promise.then(data => { + console.log(`sendUpdateCellLocationRequest success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`sendUpdateCellLocationRequest fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## radio.getCellInformation8+ + +getCellInformation(callback: AsyncCallback>): void + +获取小区信息,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.LOCATION + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | ------------------------ | +| callback | AsyncCallback\\> | 是 | 回调函数,返回小区信息。 | + +**示例:** + +```js +radio.getCellInformation((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.getCellInformation8+ + +getCellInformation(slotId: number, callback: AsyncCallback\>): void + +获取小区信息,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.LOCATION + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\\> | 是 | 回调函数,返回小区信息。 | + +**示例:** + +```js +let slotId = 0; +radio.getCellInformation(slotId, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.getCellInformation8+ + +getCellInformation(slotId?: number): Promise\> + +获取小区信息,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.LOCATION + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 否 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------- | ----------------------- | +| Promise\\> | 以Promise形式返回结果。 | + +**示例:** + +```js +let slotId = 0; +let promise = radio.getCellInformation(slotId); +promise.then(data => { + console.log(`getCellInformation success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getCellInformation fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## radio.setNetworkSelectionMode + +setNetworkSelectionMode\(options: NetworkSelectionModeOptions, callback: AsyncCallback\): void + +设置网络选择模式,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------------------- | ---- | ------------------ | +| options | [NetworkSelectionModeOptions](#networkselectionmodeoptions) | 是 | 网络选择模式选项。 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +let networkInformation={ + operatorName: "中国移动", + operatorNumeric: "898600", + state: 1, + radioTech: "CS" +} +let networkSelectionModeOptions={ + slotid: 0, + selectMode: 1, + networkInformation: networkInformation, + resumeSelection: true +} +radio.setNetworkSelectionMode(networkSelectionModeOptions, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## radio.setNetworkSelectionMode + +setNetworkSelectionMode\(options: NetworkSelectionModeOptions\): Promise + +设置网络选择模式,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------------------------------------------------------- | ---- | ------------------ | +| options | [NetworkSelectionModeOptions](#networkselectionmodeoptions) | 是 | 网络选择模式选项。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------- | +| Promise\ | 以Promise形式返回结果。 | + +**示例:** + +```js +let networkInformation={ + operatorName: "中国移动", + operatorNumeric: "898600", + state: 1, + radioTech: "CS" +} +let networkSelectionModeOptions={ + slotid: 0, + selectMode: 1, + networkInformation: networkInformation, + resumeSelection: true +} +let promise = radio.setNetworkSelectionMode(networkSelectionModeOptions); +promise.then(data => { + console.log(`setNetworkSelectionMode success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`setNetworkSelectionMode fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## radio.getNetworkSearchInformation + +getNetworkSearchInformation\(slotId: number, callback: AsyncCallback\): void + +获取网络搜索信息,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\<[NetworkSearchResult](#networksearchresult)\> | 是 | 回调函数。返回网络搜索信息。 | + +**示例:** + +```js +radio.getNetworkSearchInformation(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## radio.getNetworkSearchInformation + +getNetworkSearchInformation\(slotId: number\): Promise + +获取网络搜索信息,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------ | ----------------------- | +| Promise\<[NetworkSearchResult](#networksearchresult)\> | 以Promise形式返回结果。 | + +**示例:** + +```js +let promise = radio.getNetworkSearchInformation(0); +promise.then(data => { + console.log(`getNetworkSearchInformation success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getNetworkSearchInformation fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## radio.getNrOptionMode8+ + +getNrOptionMode(callback: AsyncCallback): void + +获取Nr选项模式 ,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------- | ---- | ---------- | +| callback | AsyncCallback\<[NrOptionMode](#nroptionmode8)\> | 是 | 回调函数。 | + +**示例:** + +```js +radio.getNrOptionMode((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.getNrOptionMode8+ + +getNrOptionMode(slotId: number, callback: AsyncCallback): void + +获取Nr选项模式 ,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\<[NrOptionMode](#nroptionmode8)\> | 是 | 回调函数。 | + +**示例:** + +```js +let slotId = 0; +radio.getNrOptionMode(slotId, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.getNrOptionMode8+ + +getNrOptionMode(slotId?: number): Promise + +获取Nr选项模式 ,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 否 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------------------- | ----------------------- | +| Promise\<[NrOptionMode](#nroptionmode8)\> | 以Promise形式返回结果。 | + +**示例:** + +```js +let slotId = 0; +let promise = radio.getNrOptionMode(slotId); +promise.then(data => { + console.log(`getNrOptionMode success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getNrOptionMode fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## radio.turnOnRadio7+ + +turnOnRadio(callback: AsyncCallback): void + +打开Radio,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ---------- | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +radio.turnOnRadio((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.turnOnRadio7+ + +turnOnRadio(slotId: number, callback: AsyncCallback): void + +打开Radio,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +let slotId = 0; +radio.turnOnRadio(slotId, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.turnOnRadio7+ + +turnOnRadio(slotId?: number): Promise + +打开Radio,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 否 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------- | +| Promise\ | 以Promise形式返回结果。 | + +**示例:** + +```js +let slotId = 0; +let promise = radio.turnOnRadio(slotId); +promise.then(data => { + console.log(`turnOnRadio success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`turnOnRadio fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## radio.turnOffRadio7+ + +turnOffRadio(callback: AsyncCallback): void + +关闭Radio,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ---------- | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +radio.turnOffRadio((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.turnOffRadio7+ + +turnOffRadio(slotId: number, callback: AsyncCallback): void + +关闭Radio,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +let slotId = 0; +radio.turnOffRadio(slotId, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.turnOffRadio7+ + +turnOffRadio(slotId?: number): Promise + +关闭Radio,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 否 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------- | +| Promise\ | 以Promise形式返回结果。 | + +**示例:** + +```js +let slotId = 0; +let promise = radio.turnOffRadio(slotId); +promise.then(data => { + console.log(`turnOffRadio success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`turnOffRadio fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## radio.setPreferredNetwork8+ + +setPreferredNetwork\(slotId: number, networkMode: PreferredNetworkMode, callback: AsyncCallback\): void + +设置首选网络,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ---------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| networkMode | [PreferredNetworkMode](#preferrednetworkmode8) | 是 | 设置首选网络模式 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +radio.setPreferredNetwork(0, 1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## radio.setPreferredNetwork8+ + +setPreferredNetwork(slotId: number, networkMode: PreferredNetworkMode): Promise + +设置首选网络,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ---------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| networkMode | [PreferredNetworkMode](#preferrednetworkmode8) | 是 | 设置首选网络模式 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------- | +| Promise\ | 以Promise形式返回结果。 | + +**示例:** + +```js +let promise = radio.setPreferredNetwork(0, 1); +promise.then(data => { + console.log(`setPreferredNetwork success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`setPreferredNetwork fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## radio.getPreferredNetwork8+ + +getPreferredNetwork\(slotId: number, callback: AsyncCallback\): void + +获取首选网络,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\<[PreferredNetworkMode](#preferrednetworkmode8)\> | 是 | 回调函数。 | + +**示例:** + +```js +radio.getPreferredNetwork(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## radio.getPreferredNetwork8+ + +getPreferredNetwork(slotId: number): Promise + +设置首选网络,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------- | +| Promise\ | 以Promise形式返回结果。 | + +**示例:** + +```js +let promise = radio.getPreferredNetwork(0); +promise.then(data => { + console.log(`getPreferredNetwork success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getPreferredNetwork fail, promise: err->${JSON.stringify(err)}`); +}); +``` + ## RadioTechnology 无线接入技术。 @@ -1011,3 +1698,238 @@ promise.then(data => { | NETWORK_SELECTION_AUTOMATIC | 1 | 自动选网模式。 | | NETWORK_SELECTION_MANUAL | 2 | 手动选网模式。 | +## PreferredNetworkMode8+ + +首选网络模式。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| --------------------------------------------------------- | ---- | --------------------------------------------- | +| PREFERRED_NETWORK_MODE_GSM | 1 | 首选GSM网络模式。 | +| PREFERRED_NETWORK_MODE_WCDMA | 2 | 首选WCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_LTE | 3 | 首选LTE网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_WCDMA | 4 | 首选LTE WCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_WCDMA_GSM | 5 | 首选LTE WCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_WCDMA_GSM | 6 | 首选WCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_CDMA | 7 | 首选CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_EVDO | 8 | 首选EVDO网络模式。 | +| PREFERRED_NETWORK_MODE_EVDO_CDMA | 9 | 首选EVDO CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_WCDMA_GSM_EVDO_CDMA | 10 | 首选WCDMA GSM EVDO CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_EVDO_CDMA | 11 | 首选LTE EVDO CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_WCDMA_GSM_EVDO_CDMA | 12 | 首选LTE WCDMA GSM EVDO CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_TDSCDMA | 13 | 首选TDSCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_TDSCDMA_GSM | 14 | 首选TDSCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA | 15 | 首选TDSCDMA_WCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM | 16 | 首选TDSCDMA_WCDMA_GSM网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_TDSCDMA | 17 | 首选LTE TDSCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_TDSCDMA_GSM | 18 | 首选LTE TDSCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA | 19 | 首选LTE TDSCDMA WCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM | 20 | 首选LTE TDSCDMA WCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM_EVDO_CDMA | 21 | 首选TDSCDMA WCDMA GSM EVDO CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA | 22 | 首选LTE TDSCDMA WCDMA GSM EVDO CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_NR | 31 | 首选NR网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE | 32 | 首选NR LTE网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_WCDMA | 33 | 首选NR LTE WCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_WCDMA_GSM | 34 | 首选NR LTE WCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_EVDO_CDMA | 35 | 首选NR LTE EVDO CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_WCDMA_GSM_EVDO_CDMA | 36 | 首选NR LTE WCDMA GSM EVDO CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA | 37 | 首选NR LTE TDSCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_GSM | 38 | 首选NR LTE TDSCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA | 39 | 首选NR LTE TDSCDMA WCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM | 40 | 首选NR LTE TDSCDMA WCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA | 41 | 首选NR LTE TDSCDMA WCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_MAX_VALUE | 99 | 首选网络模式最大值。 | + +## CellInformation8+ + +小区信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ----------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| networkType | [NetworkType](#networkType) | 获取服务单元的网络类型。 | +| isCamped | boolean | 获取服务单元的状态。 | +| timeStamp | number | 获取单元格信息时获取时间戳。 | +| signalInformation | [SignalInformation](#signalinformation) | 信号信息。 | +| data | [CdmaCellInformation](#cdmacellinformation) \| [GsmCellInformation](#gsmcellinformation) \| [LteCellInformation](#ltecellinformation) \| [NrCellInformation](#nrcellinformation) \| [TdscdmaCellInformation](#tdscdmacellinformation) | Cdma小区信息 \|Gsm小区信息\|Lte小区信息\|Nr小区信息\|Tdscdma小区信息 | + +## CdmaCellInformation8+ + +Cdma小区信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| --------- | ------ | ------------ | +| baseId | number | 基站Id。 | +| latitude | number | 经度。 | +| longitude | number | 纬度。 | +| nid | number | 网络识别码。 | +| sid | number | 系统识别码。 | + +## GsmCellInformation8+ + +Gsm小区信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ------ | ------ | -------------------- | +| lac | number | 位置区编号。 | +| cellId | number | 小区号。 | +| arfcn | number | 绝对无线频率信道号。 | +| bsic | number | 基站识别号。 | +| mcc | string | 移动国家码。 | +| mnc | string | 移动网号。 | + +## LteCellInformation8+ + +Lte小区信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ------------- | ------- | ----------------------- | +| cgi | number | 小区全球标识。 | +| pci | number | 物理小区识别。 | +| tac | number | 跟踪区域代码。 | +| earfcn | number | 绝对无线频率信道号。 | +| bandwidth | number | 带宽。 | +| mcc | string | 移动国家码。 | +| mnc | string | 移动网号。 | +| isSupportEndc | boolean | 是否支持新无线电_双连接 | + +## NrCellInformation8+ + +Nr小区信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ------- | ------ | ---------------- | +| nrArfcn | number | 5G频点号。 | +| pci | number | 物理小区识别。 | +| tac | number | 跟踪区域代码。 | +| nci | number | 5G网络小区标识。 | +| mcc | string | 移动国家码。 | +| mnc | string | 移动网号。 | + +## TdscdmaCellInformation8+ + +Tdscdma小区信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ------ | ------ | ------------ | +| lac | number | 位置区编号。 | +| cellId | number | 小区号。 | +| cpid | number | 小区参数Id。 | +| uarfcn | number | 绝对射频号。 | +| mcc | string | 移动国家码。 | +| mnc | string | 移动网号。 | + +## WcdmaCellInformation8+ + +Wcdma小区信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ------ | ------ | ------------ | +| lac | number | 位置区编号。 | +| cellId | number | 小区号。 | +| psc | number | 主扰码。 | +| uarfcn | number | 绝对射频号。 | +| mcc | string | 移动国家码。 | +| mnc | string | 移动网号。 | + +## NrOptionMode8+ + +Nr的选择模式。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| -------------------- | ---- | ---------------------------------- | +| NR_OPTION_UNKNOWN | 0 | 未知的Nr选择模式。 | +| NR_OPTION_NSA_ONLY | 1 | 仅非独立组网的Nr选择模式。 | +| NR_OPTION_SA_ONLY | 2 | 仅独立组网的Nr选择模式。 | +| NR_OPTION_NSA_AND_SA | 3 | 非独立组网和独立组网的Nr选择模式。 | + +## NetworkSearchResult + +网络搜索结果。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ---------------------- | ------------------------------------------------- | -------------- | +| isNetworkSearchSuccess | boolean | 网络搜索成功。 | +| networkSearchResult | Array<[NetworkInformation](#networkInformation)\> | 网络搜索结果。 | + +## NetworkInformation + +网络信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| --------------- | ----------------------------------------- | -------------- | +| operatorName | string | 运营商的名称。 | +| operatorNumeric | string | 运营商数字。 | +| state | [NetworkInformation](#networkInformation) | 网络信息状态。 | +| radioTech | string | 无线电技术。 | + +## NetworkInformationState + +网络信息状态。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| ----------------- | ---- | ---------------- | +| NETWORK_UNKNOWN | 0 | 网络状态未知。 | +| NETWORK_AVAILABLE | 1 | 网络可用于注册。 | +| NETWORK_CURRENT | 2 | 已在网络中注册。 | +| NETWORK_FORBIDDEN | 3 | 网络无法注册。 | + +## NetworkSelectionModeOptions + +网络选择模式选项。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ------------------ | --------------------------------------------- | -------------------------------------- | +| slotId | number | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| selectMode | [NetworkSelectionMode](#networkselectionmode) | 网络选择模式。 | +| networkInformation | [NetworkInformation](#networkinformation) | 网络信息。 | +| resumeSelection | boolean | 继续选择。 | + diff --git a/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md b/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md index 60b2decb872483e945c3cbde36964548a9c6c487..14d19f464809e47dbd75d91af9eaf83143ec29c2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md @@ -15,7 +15,7 @@ import resourceManager from '@ohos.resourceManager'; ## 使用说明 -从API Version9开始,Stage模型支持了通过context获取resourceManager对象的方式,再调用其接口,无需再导入包,此方式FA模型不适用。 +从API Version9开始,Stage模型支持了通过context获取resourceManager对象的方式,再调用其内部获取资源的接口,无需再导入包,此方式FA模型不适用。 ``` this.context.resourceManager; @@ -1173,7 +1173,7 @@ getStringByName(resName: string, callback: AsyncCallback<string>): void **示例:** ``` - resourceManager.getStringByName("test", (error, value) => { + this.context.resourceManager.getStringByName("test", (error, value) => { if (error != null) { console.log("error is " + error); } else { @@ -1202,7 +1202,7 @@ getStringByName(resName: string): Promise<string> **示例:** ``` - resourceManager.getStringByName("test").then(value => { + this.context.resourceManager.getStringByName("test").then(value => { let string = value; }).catch(error => { console.log("getStringByName promise error is " + error); @@ -1225,7 +1225,7 @@ getStringArrayByName(resName: string, callback: AsyncCallback<Array<string **示例:** ``` - resourceManager.getStringArrayByName("test", (error, value) => { + this.context.resourceManager.getStringArrayByName("test", (error, value) => { if (error != null) { console.log("error is " + error); } else { @@ -1254,7 +1254,7 @@ getStringArrayByName(resName: string): Promise<Array<string>> **示例:** ``` - resourceManager.getStringArrayByName("test").then(value => { + this.context.resourceManager.getStringArrayByName("test").then(value => { let strArray = value; }).catch(error => { console.log("getStringArrayByName promise error is " + error); @@ -1277,7 +1277,7 @@ getMediaByName(resName: string, callback: AsyncCallback<Uint8Array>): void **示例:** ``` - resourceManager.getMediaByName("test", (error, value) => { + this.context.resourceManager.getMediaByName("test", (error, value) => { if (error != null) { console.log("error is " + error); } else { @@ -1306,7 +1306,7 @@ getMediaByName(resName: string): Promise<Uint8Array> **示例:** ``` - resourceManager.getMediaByName("test").then(value => { + this.context.resourceManager.getMediaByName("test").then(value => { let media = value; }).catch(error => { console.log("getMediaByName promise error is " + error); @@ -1329,7 +1329,7 @@ getMediaBase64ByName(resName: string, callback: AsyncCallback<string>): vo **示例:** ``` - resourceManager.getMediaBase64ByName("test", (error, value) => { + this.context.resourceManager.getMediaBase64ByName("test", (error, value) => { if (error != null) { console.log("error is " + error); } else { @@ -1358,7 +1358,7 @@ getMediaBase64ByName(resName: string): Promise<string> **示例:** ``` - resourceManager.getMediaByName("test").then(value => { + this.context.resourceManager.getMediaBase64ByName("test").then(value => { let media = value; }).catch(error => { console.log("getMediaBase64ByName promise error is " + error); @@ -1382,7 +1382,7 @@ getPluralStringByName(resName: string, num: number, callback: AsyncCallback<s **示例:** ``` - resourceManager.getPluralStringByName("test", 1, (error, value) => { + this.context.resourceManager.getPluralStringByName("test", 1, (error, value) => { if (error != null) { console.log("error is " + error); } else { @@ -1412,7 +1412,7 @@ getPluralStringByName(resName: string, num: number): Promise<string> **示例:** ``` - resourceManager.getPluralStringByName("test", 1).then(value => { + this.context.resourceManager.getPluralStringByName("test", 1).then(value => { let str = value; }).catch(error => { console.log("getPluralStringByName promise error is " + error); @@ -1439,7 +1439,7 @@ getStringSync(resId: number): string **示例:** ``` - resourceManager.getStringSync($r('app.string.test').id); + this.context.resourceManager.getStringSync($r('app.string.test').id); ``` ### getStringSync9+ @@ -1490,7 +1490,7 @@ getStringByNameSync(resName: string): string **示例:** ``` - resourceManager.getStringByNameSync("test"); + this.context.resourceManager.getStringByNameSync("test"); ``` ### getBoolean9+ @@ -1513,7 +1513,7 @@ getBoolean(resId: number): boolean **示例:** ``` - resourceManager.getBoolean($r('app.boolean.boolean_test').id); + this.context.resourceManager.getBoolean($r('app.boolean.boolean_test').id); ``` ### getBoolean9+ @@ -1563,7 +1563,7 @@ getBooleanByName(resName: string): boolean **示例:** ``` - resourceManager.getBooleanByName("boolean_test"); + this.context.resourceManager.getBooleanByName("boolean_test"); ``` ### getNumber9+ @@ -1586,8 +1586,8 @@ getNumber(resId: number): number **示例:** ``` - resourceManager.getNumber($r('app.integer.integer_test').id); - resourceManager.getNumber($r('app.float.float_test').id); + this.context.resourceManager.getNumber($r('app.integer.integer_test').id); + this.context.resourceManager.getNumber($r('app.float.float_test').id); ``` ### getNumber9+ @@ -1638,6 +1638,6 @@ getNumberByName(resName: string): number **示例:** ``` - resourceManager.getNumberByName("integer_test"); - resourceManager.getNumberByName("float_test"); + this.context.resourceManager.getNumberByName("integer_test"); + this.context.resourceManager.getNumberByName("float_test"); ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-router.md b/zh-cn/application-dev/reference/apis/js-apis-router.md index 51f8738c2fdf55c470c2d5e4d4159e459974912b..1dc12db497acbd47e933bfcdec3848ce5fff94d1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-router.md +++ b/zh-cn/application-dev/reference/apis/js-apis-router.md @@ -2,9 +2,10 @@ 本模块提供通过不同的url访问不同的页面,包括跳转到应用内的指定页面、用应用内的某个页面替换当前页面、返回上一页面或指定的页面等。 -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明** +> **说明** > > - 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> > - 页面路由需要在页面渲染完成之后才能调用,在onInit和onReady生命周期中页面还处于渲染阶段,禁止调用页面路由方法。 ## 导入模块 @@ -13,59 +14,60 @@ import router from '@ohos.router' ``` -## 权限列表 - -无 - ## router.push -push(options: RouterOptions, mode?: RouterMode): void +push(options: RouterOptions): void 跳转到应用内的指定页面。 **系统能力:** SystemCapability.ArkUI.ArkUI.Full **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| options | [RouterOptions](#routeroptions) | 是 | 跳转页面描述信息。 | -| mode9+ | [RouterMode](#routermode9) | 否 | 跳转页面使用的模式。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------- | ---- | ------------------ | +| options | [RouterOptions](#routeroptions) | 是 | 跳转页面描述信息。 | **示例:** ```js - // 在当前页面中 - export default { - pushPage() { - router.push({ - url: 'pages/routerpage2/routerpage2', - params: { - data1: 'message', - data2: { - data3: [123, 456, 789] - }, - }, - }); - } - } +router.push({ + url: 'pages/routerpage2', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + }, + }, +}); ``` +## router.push9+ + +push(options: RouterOptions, mode: RouterMode): void + +跳转到应用内的指定页面。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**参数:** +| 参数名 | 类型 | 必填 | 说明 | +| ----------------- | ------------------------------- | ---- | -------------------- | +| options | [RouterOptions](#routeroptions) | 是 | 跳转页面描述信息。 | +| mode9+ | [RouterMode](#routermode9) | 是 | 跳转页面使用的模式。 | + + +**示例:** ```js - // 在routerpage2页面中 - export default { - data: { - data1: 'default', - data2: { - data3: [1, 2, 3] - } +router.push({ + url: 'pages/routerpage2/routerpage2', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] }, - onInit() { - console.info('showData1:' + this.data1); - console.info('showData3:' + this.data2.data3); - } - } + }, +},router.RouterMode.Standard); ``` - ## router.replace replace(options: RouterOptions, mode?: RouterMode): void @@ -75,37 +77,44 @@ replace(options: RouterOptions, mode?: RouterMode): void **系统能力:** SystemCapability.ArkUI.ArkUI.Full **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| options | [RouterOptions](#routeroptions) | 是 | 替换页面描述信息。 | -| mode9+ | [RouterMode](#routermode9) | 否 | 跳转页面使用的模式。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------- | ---- | ------------------ | +| options | [RouterOptions](#routeroptions) | 是 | 替换页面描述信息。 | **示例:** ```js - // 在当前页面中 - export default { - replacePage() { - router.replace({ - url: 'pages/detail/detail', - params: { - data1: 'message', - }, - }, router.RouterMode.Standard); - } - } +router.replace({ + url: 'pages/detail', + params: { + data1: 'message', + }, +}); ``` + ## router.replace9+ + +replace(options: RouterOptions, mode: RouterMode): void + +用应用内的某个页面替换当前页面,并销毁被替换的页面。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**参数:** +| 参数名 | 类型 | 必填 | 说明 | +| ----------------- | ------------------------------- | ---- | -------------------- | +| options | [RouterOptions](#routeroptions) | 是 | 替换页面描述信息。 | +| mode9+ | [RouterMode](#routermode9) | 是 | 跳转页面使用的模式。 | + +**示例:** + ```js - // 在detail页面中 - export default { - data: { - data1: 'default' - }, - onInit() { - console.info('showData1:' + this.data1) - } - } +router.replace({ + url: 'pages/detail/detail', + params: { + data1: 'message', + }, +}, router.RouterMode.Standard); ``` ## router.back @@ -117,58 +126,14 @@ back(options?: RouterOptions ): void **系统能力:** SystemCapability.ArkUI.ArkUI.Full **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| options | [RouterOptions](#routeroptions) | 是 | 返回页面描述信息,其中参数url指路由跳转时会返回到指定url的界面,如果页面栈上没有url页面,则不响应该情况。如果url未设置,则返回上一页。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------- | ---- | ------------------------------------------------------------ | +| options | [RouterOptions](#routeroptions) | 否 | 返回页面描述信息,其中参数url指路由跳转时会返回到指定url的界面,如果页面栈上没有url页面,则不响应该情况。如果url未设置,则返回上一页。 | **示例:** - ```js - // index页面 - export default { - indexPushPage() { - router.push({ - url: 'pages/detail/detail', - }); - } - } - ``` - - ```js - // detail页面 - export default { - detailPushPage() { - router.push({ - url: 'pages/mall/mall', - }); - } - } - ``` ```js - // mall页面通过back,将返回detail页面 - export default { - mallBackPage() { - router.back(); - } - } - ``` - - ```js - // detail页面通过back,将返回index页面 - export default { - defaultBack() { - router.back(); - } - } - ``` - - ```js - // 通过back,返回到detail页面 - export default { - backToDetail() { - router.back({uri:'pages/detail/detail'}); - } - } +router.back({uri:'pages/detail'}); ``` ## router.clear @@ -180,12 +145,9 @@ clear(): void **系统能力:** SystemCapability.ArkUI.ArkUI.Full **示例:** + ```js - export default { - clearPage() { - router.clear(); - } - }js +router.clear(); ``` ## router.getLength @@ -197,18 +159,14 @@ getLength(): string **系统能力:** SystemCapability.ArkUI.ArkUI.Full **返回值:** -| 类型 | 说明 | -| -------- | -------- | +| 类型 | 说明 | +| ------ | ---------------------------------- | | string | 页面数量,页面栈支持最大数值是32。 | **示例:** ```js - export default { - getLength() { - var size = router.getLength(); - console.log('pages stack size = ' + size); - } - } +var size = router.getLength(); +console.log('pages stack size = ' + size); ``` ## router.getState @@ -224,28 +182,26 @@ getState(): RouterState | 类型 | 说明 | | --------------------------- | -------------- | | [RouterState](#routerstate) | 页面状态信息。 | +**示例:** + +```js +var page = router.getState(); +console.log('current index = ' + page.index); +console.log('current name = ' + page.name); +console.log('current path = ' + page.path); +``` + ## RouterState -页面状态信息。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。 +页面状态信息。 -| 名称 | 类型 | 说明 | -| -------- | -------- | -------- | -| index | number | 表示当前页面在页面栈中的索引。
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 从栈底到栈顶,index从1开始递增。 | -| name | string | 表示当前页面的名称,即对应文件名。 | -| path | string | 表示当前页面的路径。 | +**系统能力:** SystemCapability.ArkUI.ArkUI.Full。 -**示例:** - ```js - export default { - getState() { - var page = router.getState(); - console.log('current index = ' + page.index); - console.log('current name = ' + page.name); - console.log('current path = ' + page.path); - } - } - ``` +| 名称 | 类型 | 说明 | +| ----- | ------ | ------------------------------------------------------------ | +| index | number | 表示当前页面在页面栈中的索引。从栈底到栈顶,index从1开始递增。 | +| name | string | 表示当前页面的名称,即对应文件名。 | +| path | string | 表示当前页面的路径。 | ## router.enableAlertBeforeBackPage @@ -256,26 +212,16 @@ enableAlertBeforeBackPage(options: EnableAlertOptions): void **系统能力:** SystemCapability.ArkUI.ArkUI.Full **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| options | [EnableAlertOptions](#enablealertoptions) | 是 | 文本弹窗信息描述。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------------------------------------- | ---- | ------------------ | +| options | [EnableAlertOptions](#enablealertoptions) | 是 | 文本弹窗信息描述。 | **示例:** - ```js - export default { - enableAlertBeforeBackPage() { - router.enableAlertBeforeBackPage({ - message: 'Message Info', - success: function() { - console.log('success'); - }, - fail: function() { - console.log('fail'); - }, - }); - } - } + ```js + router.enableAlertBeforeBackPage({ + message: 'Message Info' + }); ``` ## EnableAlertOptions @@ -283,9 +229,9 @@ enableAlertBeforeBackPage(options: EnableAlertOptions): void **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。 -| 名称 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| message | string | 是 | 询问对话框内容。 | +| 名称 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ---------------- | +| message | string | 是 | 询问对话框内容。 | ## router.disableAlertBeforeBackPage @@ -297,11 +243,7 @@ disableAlertBeforeBackPage(): void **示例:** ```js - export default { - disableAlertBeforeBackPage() { - router.disableAlertBeforeBackPage(); - } - } +router.disableAlertBeforeBackPage(); ``` ## router.getParams @@ -320,133 +262,140 @@ getParams(): Object **示例:** -- 类Web范示例 - ```js - // 在当前页面中 - export default { - pushPage() { - router.push({ - url: 'pages/detail/detail', - params: { - data1: 'message', - }, - }); - } - } - ``` - ```js - // 在detail页面中 - export default { - onInit() { - console.info('showData1:' + router.getParams().data1); - } - } - ``` - -- 声明式示例 - - ```ts - //通过router.push跳转至目标页携带params参数 - import router from '@ohos.router' - - @Entry - @Component - struct Index { - async routePage() { - let options = { - url: 'pages/second', - params: { - text: '这是第一页的值', - data: { - array: [12, 45, 78] - }, - } - } - try { - await router.push(options) - } catch (err) { - console.info(` fail callback, code: ${err.code}, msg: ${err.msg}`) - } - } - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('这是第一页') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ top: 20 }) - .backgroundColor('#ccc') - .onClick(() => { - this.routePage() - }) - } - .width('100%') - .height('100%') - } - } - ``` - - ```ts - //在second页面中接收传递过来的参数 - import router from '@ohos.router' - - @Entry - @Component - struct Second { - private content: string = "这是第二页" - @State text: string = router.getParams()['text'] - @State data: any = router.getParams()['data'] - @State secondData : string = '' - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text(`${this.content}`) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Text(this.text) - .fontSize(30) - .onClick(()=>{ - this.secondData = (this.data.array[1]).toString() - }) - .margin({top:20}) - Text('第一页传来的数值' + ' ' + this.secondData) - .fontSize(20) - .margin({top:20}) - .backgroundColor('red') - } - .width('100%') - .height('100%') - } - } - ``` +``` +router.getParams(); +``` ## RouterOptions 路由跳转选项。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Lite。 +**系统能力:** SystemCapability.ArkUI.ArkUI.FULL。 -| 名称 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| url | string | 是 | 表示目标页面的uri,可以用以下两种格式:
- 页面绝对路径,由配置文件中pages列表提供,例如:
  - pages/index/index
  - pages/detail/detail
- 特殊值,如果uri的值是"/",则跳转到首页。 | -| params | Object | 否 | 跳转时要同时传递到目标页面的数据,跳转到目标页面后,参数可以在页面中直接使用,如this.data1(data1为跳转时params参数中的key值)。如果目标页面中已有该字段,则其值会被传入的字段值覆盖。 | +| 名称 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| url | string | 是 | 表示目标页面的uri,可以用以下两种格式:
- 页面绝对路径,由配置文件中pages列表提供,例如:
  - pages/index/index
  - pages/detail/detail
- 特殊值,如果uri的值是"/",则跳转到首页。 | +| params | Object | 否 | 跳转时要同时传递到目标页面的数据,跳转到目标页面后,参数可以在页面中直接使用,如this.data1(data1为跳转时params参数中的key值)。如果目标页面中已有该字段,则其值会被传入的字段值覆盖。 | - > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** + > **说明:** > 页面路由栈支持的最大Page数量为32。 ## RouterMode9+ 路由跳转模式。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Lite。 +**系统能力:** SystemCapability.ArkUI.ArkUI.FULL。 + +| 名称 | 描述 | +| -------- | ------------------------------------------------------------ | +| Standard | 标准模式。 | +| Single | 单实例模式。
如果目标页面的url在页面栈中已经存在同url页面,离栈顶最近的页面会被移动到栈顶,移动后的页面为新建页。
如目标页面的url在页面栈中不存在同url页面,按标准模式跳转。 | + +## 完整示例 + +### 基于JS扩展的类Web开发范式 + +```js +// 在当前页面中 +export default { + pushPage() { + router.push({ + url: 'pages/detail/detail', + params: { + data1: 'message', + }, + }); + } +} +``` +```js +// 在detail页面中 +export default { + onInit() { + console.info('showData1:' + router.getParams().data1); + } +} +``` + +### 基于TS扩展的声明式开发范式 -| 名称 | 描述 | -| -------- | -------- | -| Standard | 标准模式。 | -| Single | 单实例模式。
如果目标页面的url在页面栈中已经存在同url页面,离栈顶最近的页面会被移动到栈顶,移动后的页面为新建页。
如目标页面的url在页面栈中不存在同url页面,按标准模式跳转。 | +```ts +//通过router.push跳转至目标页携带params参数 +import router from '@ohos.router' + +@Entry +@Component +struct Index { + async routePage() { + let options = { + url: 'pages/second', + params: { + text: '这是第一页的值', + data: { + array: [12, 45, 78] + }, + } + } + try { + await router.push(options) + } catch (err) { + console.info(` fail callback, code: ${err.code}, msg: ${err.msg}`) + } + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('这是第一页') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ top: 20 }) + .backgroundColor('#ccc') + .onClick(() => { + this.routePage() + }) + } + .width('100%') + .height('100%') + } +} +``` + +```ts +//在second页面中接收传递过来的参数 +import router from '@ohos.router' + +@Entry +@Component +struct Second { + private content: string = "这是第二页" + @State text: string = router.getParams()['text'] + @State data: any = router.getParams()['data'] + @State secondData : string = '' + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text(this.text) + .fontSize(30) + .onClick(()=>{ + this.secondData = (this.data.array[1]).toString() + }) + .margin({top:20}) + Text('第一页传来的数值' + ' ' + this.secondData) + .fontSize(20) + .margin({top:20}) + .backgroundColor('red') + } + .width('100%') + .height('100%') + } +} +``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md b/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md index 065c993b491e5d045e14fa1cd022c27dbc4bd2df..7581861012f98b643114b083430ce37cf1ae0734 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md +++ b/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md @@ -302,7 +302,7 @@ sendScreenLockEvent(event: String, parameter: number): Promise **示例**: ```js - screenlock.sendScreenLockEvent('unlockScreenResult', 0).then((err, result) => { + screenlock.sendScreenLockEvent('unlockScreenResult', 0).then((result) => { console.log('sending result:' + result); }); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-screen.md b/zh-cn/application-dev/reference/apis/js-apis-screen.md index 7e0c971a5619009392bda8f63a7f32f36ee3d1cc..714cfacfe0b4214c68d8d7f739f2fecb3d6f23bd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-screen.md +++ b/zh-cn/application-dev/reference/apis/js-apis-screen.md @@ -32,7 +32,7 @@ getAllScreens(callback: AsyncCallback<Array<Screen>>): void var screenClass = null; screen.getAllScreens((err, data) => { if (err.code) { - console.error('Failed to get all screens . Cuase: ' + JSON.stringify(err)); + console.error('Failed to get all screens . Cause: ' + JSON.stringify(err)); return; } console.info('Succeeded in getting all screens . Data:' + JSON.stringify(data)); @@ -55,7 +55,7 @@ getAllScreens(): Promise<Array<Screen>> **示例:** ```js var screenClass = null; -let promise = screen.getAllScreen(); +let promise = screen.getAllScreens(); promise.then((data) => { screenClass = data[0]; console.log('Succeeded in getting all screens . Data:'+ JSON.stringify(data)); @@ -531,7 +531,7 @@ screen.setScreenRotationLocked(isLocked, (err, data) => { | parent | number | 是 | 否 | 屏幕所属群组的id。 | | supportedModeInfo | Array<[ScreenModeInfo](#screenmodeinfo)> | 是 | 否 | 屏幕支持的模式集合。 | | activeModeIndex | number | 是 | 否 | 当前屏幕所处模式索引。 | -| orientation | [Orientation](#rientation) | 是 | 否 | 屏幕方向。 | +| orientation | [Orientation](#orientation) | 是 | 否 | 屏幕方向。 | ### setOrientation setOrientation(orientation: Orientation, callback: AsyncCallback<void>): void diff --git a/zh-cn/application-dev/reference/apis/js-apis-securityLabel.md b/zh-cn/application-dev/reference/apis/js-apis-securityLabel.md index 34a85c6f3ca0098102c08121a098058e1fb15010..5dedb55f06c6e564743cda51a39057625791a518 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-securityLabel.md +++ b/zh-cn/application-dev/reference/apis/js-apis-securityLabel.md @@ -18,7 +18,10 @@ import securityLabel from '@ohos.securityLabel'; ```js import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -let path = context.getFilesDir(); +let path = ''; +context.getFilesDir().then((data) => { + path = data; +}) ``` ## securityLabel.setSecurityLabel diff --git a/zh-cn/application-dev/reference/apis/js-apis-sensor.md b/zh-cn/application-dev/reference/apis/js-apis-sensor.md index afc41fd808d0de8bbca05c6ceb56cce3fbc05a00..d22706b127d02eca6495ee5b5a8b792be6c3700b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-sensor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-sensor.md @@ -2172,7 +2172,7 @@ createRotationMatrix(gravity: Array<number>, geomagnetic: Array<number& err.message); return; } - for (var i=0; i < data.length; i++) { + for (var i=0; i < data.rotation.length; i++) { console.info("data[" + i + "]: " + data[i]) } }) @@ -2206,7 +2206,7 @@ createRotationMatrix(gravity: Array<number>, geomagnetic: Array<number& const promise = sensor.createRotationMatrix([-0.27775216, 0.5351276, 9.788099], [210.87253, -78.6096, -111.44444]); promise.then((data) => { console.info('createRotationMatrix_promise successed'); - for (var i=0; i < data.length; i++) { + for (var i=0; i < data.rotation.length; i++) { console.info("data[" + i + "]: " + data[i]); } }).catch((err) => { @@ -2432,11 +2432,11 @@ createRotationMatrix(gravity: Array<number>, geomagnetic: Array<number& **系统能力**:以下各项对应的系统能力均为SystemCapability.Sensors.Sensor -| 名称 | 参数类型 | 可读 | 可写 | 说明 | -| ---- | ------ | ---- | ---- | ------------------ | -| x | number | 是 | 是 | x轴环境磁场强度,单位 : μT。 | -| y | number | 是 | 是 | y轴环境磁场强度,单位 : μT。 | -| z | number | 是 | 是 | z轴环境磁场强度,单位 : μT。。 | +| 名称 | 参数类型 | 可读 | 可写 | 说明 | +| ---- | -------- | ---- | ---- | ---------------------------- | +| x | number | 是 | 是 | x轴环境磁场强度,单位 : μT。 | +| y | number | 是 | 是 | y轴环境磁场强度,单位 : μT。 | +| z | number | 是 | 是 | z轴环境磁场强度,单位 : μT。 | ## MagneticFieldUncalibratedResponse diff --git a/zh-cn/application-dev/reference/apis/js-apis-service-extension-ability.md b/zh-cn/application-dev/reference/apis/js-apis-service-extension-ability.md index 1a99c38a34b9863c991e63ba097c5c0e70c07cad..f3a72caed5eddbb876cadf1308be11c30cc481d9 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-service-extension-ability.md +++ b/zh-cn/application-dev/reference/apis/js-apis-service-extension-ability.md @@ -230,7 +230,7 @@ dump(params: Array\): Array\; 转储客户端信息时调用。 -**系统能力**:SystemCapability.Ability.AbilityRuntime.Core +**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore **系统API**: 此接口为系统接口,三方应用不支持调用。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-service-extension-context.md b/zh-cn/application-dev/reference/apis/js-apis-service-extension-context.md index b92fbe05c23d531c26aa788ea1685e0884862763..a7df410fcbcd25868c4b0fbb216e7d8916ff7790 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-service-extension-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-service-extension-context.md @@ -1,8 +1,8 @@ # ServiceExtensionContext -ServiceExtensionContext模块是ServiceExtension的上下文环境,继承自ExtensionContext。 +ServiceExtensionContext模块是ServiceExtensionAbility的上下文环境,继承自ExtensionContext。 -ServiceExtensionContext模块提供ServiceExtension具有的能力和接口,包括启动、停止、绑定、解绑Ability。 +ServiceExtensionContext模块提供ServiceExtensionAbility具有的能力和接口,包括启动、停止、绑定、解绑Ability。 > **说明:** > @@ -11,15 +11,16 @@ ServiceExtensionContext模块提供ServiceExtension具有的能力和接口, ## 使用说明 -ServiceExtensionContext模块是ServiceExtension的上下文环境,继承自ExtensionContext。 +在使用ServiceExtensionContext的功能前,需要通过ServiceExtensionAbility子类实例获取。 -## 属性 - -**系统能力**:SystemCapability.Ability.AbilityRuntime.Core - -| 名称 | 参数类型 | 可读 | 可写 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -| extensionAbilityInfo | [ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md) | 是 | 否 | 服务扩展信息。 | +```js + import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility'; + class MainAbility extends ServiceExtensionAbility { + onCreate() { + let context = this.context; + } + } +``` ## startAbility @@ -41,18 +42,12 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; **示例:** ```js - import ExtensionContext from '@ohos.application.ServiceExtensionAbility'; - class MainAbility extends ExtensionContext { - onWindowStageCreate(windowStage) { - let want = { - "bundleName": "com.example.myapp", - "abilityName": "MyAbility"}; - this.context.startAbility(want, (err) => { - console.log('startAbility result:' + JSON.stringify(err)); - }); - } - } - + let want = { + "bundleName": "com.example.myapp", + "abilityName": "MyAbility"}; + this.context.startAbility(want, (err) => { + console.log('startAbility result:' + JSON.stringify(err)); + }); ``` ## startAbility @@ -81,20 +76,16 @@ startAbility(want: Want, options?: StartOptions): Promise\; **示例:** ```js - import ExtensionContext from '@ohos.application.ServiceExtensionAbility'; - class MainAbility extends ExtensionContext { - onWindowStageCreate(windowStage) { - let want = { - "bundleName": "com.example.myapp", - "abilityName": "MyAbility" - }; - this.context.startAbility(want).then((data) => { - console.log('success:' + JSON.stringify(data)); - }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); - }); - } - } + let want = { + "bundleName": "com.example.myapp", + "abilityName": "MyAbility" + }; + this.context.startAbility(want).then((data) => { + console.log('success:' + JSON.stringify(data)); + }).catch((error) => { + console.log('failed:' + JSON.stringify(error)); + }); + ``` ## startAbility @@ -127,13 +118,13 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& windowMode: 0, }; this.context.startAbility(want, options, (error) => { - console.log("error.code = " + error.code) + console.log("error.code = " + error.code) }) ``` ## ServiceExtensionContext.startAbilityWithAccount -startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void; +startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void; 根据account启动Ability(callback形式)。 @@ -203,7 +194,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca ## ServiceExtensionContext.startAbilityWithAccount -startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\; +startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\; 根据account启动Ability(Promise形式)。 @@ -240,6 +231,273 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): }) ``` +## ServiceExtensionContext.startServiceExtensionAbility + +startServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; + +启动一个新的ServiceExtensionAbility(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + this.context.startServiceExtensionAbility(want, (err) => { + console.log('---------- startServiceExtensionAbility fail, err: -----------', err); + }); + ``` + +## ServiceExtensionContext.startServiceExtensionAbility + +startServiceExtensionAbility(want: Want): Promise\; + +启动一个新的ServiceExtensionAbility(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + this.context.startServiceExtensionAbility(want) + .then((data) => { + console.log('---------- startServiceExtensionAbility success, data: -----------', data); + }) + .catch((err) => { + console.log('---------- startServiceExtensionAbility fail, err: -----------', err); + }) + ``` + +## ServiceExtensionContext.startServiceExtensionAbilityWithAccount + +startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void; + +启动一个新的ServiceExtensionAbility(callback形式)。 + +**需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| accountId | number | 是 | 需要启动的accountId。 | +| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + var accountId = 100; + this.context.startServiceExtensionAbilityWithAccount(want,accountId, (err) => { + console.log('---------- startServiceExtensionAbilityWithAccount fail, err: -----------', err); + }); + ``` + +## ServiceExtensionContext.startServiceExtensionAbilityWithAccount + +startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\; + +启动一个新的ServiceExtensionAbility(Promise形式)。 + +**需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| accountId | number | 是 | 需要启动的accountId。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + var accountId = 100; + this.context.startServiceExtensionAbilityWithAccount(want,accountId) + .then((data) => { + console.log('---------- startServiceExtensionAbilityWithAccount success, data: -----------', data); + }) + .catch((err) => { + console.log('---------- startServiceExtensionAbilityWithAccount fail, err: -----------', err); + }) + ``` + +## ServiceExtensionContext.stopServiceExtensionAbility + +stopServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; + +停止同一应用程序内的服务(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + this.context.stopServiceExtensionAbility(want, (err) => { + console.log('---------- stopServiceExtensionAbility fail, err: -----------', err); + }); + ``` + +## ServiceExtensionContext.stopServiceExtensionAbility + +stopServiceExtensionAbility(want: Want): Promise\; + +停止同一应用程序内的服务(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + this.context.stopServiceExtensionAbility(want) + .then((data) => { + console.log('---------- stopServiceExtensionAbility success, data: -----------', data); + }) + .catch((err) => { + console.log('---------- stopServiceExtensionAbility fail, err: -----------', err); + }) + ``` + +## ServiceExtensionContext.stopServiceExtensionAbilityWithAccount + +stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void; + +使用帐户停止同一应用程序内的服务(callback形式)。 + +**需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| accountId | number | 是 | 需要启动的accountId。 | +| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + var accountId = 100; + this.context.stopServiceExtensionAbilityWithAccount(want,accountId, (err) => { + console.log('---------- stopServiceExtensionAbilityWithAccount fail, err: -----------', err); + }); + ``` + +## ServiceExtensionContext.stopServiceExtensionAbilityWithAccount + +stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\; + +使用帐户停止同一应用程序内的服务(Promise形式)。 + +**需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| accountId | number | 是 | 需要启动的accountId。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + var accountId = 100; + this.context.stopServiceExtensionAbilityWithAccount(want,accountId) + .then((data) => { + console.log('---------- stopServiceExtensionAbilityWithAccount success, data: -----------', data); + }) + .catch((err) => { + console.log('---------- stopServiceExtensionAbilityWithAccount fail, err: -----------', err); + }) + ``` ## ServiceExtensionContext.terminateSelf @@ -260,19 +518,11 @@ terminateSelf(callback: AsyncCallback<void>): void; **示例:** ```js - import ExtensionContext from '@ohos.application.ServiceExtensionAbility'; - class MainAbility extends ExtensionContext { - onWindowStageCreate(windowStage) { - this.context.terminateSelf((err) => { - console.log('terminateSelf result:' + JSON.stringify(err)); - }); - } - } - - + this.context.terminateSelf((err) => { + console.log('terminateSelf result:' + JSON.stringify(err)); + }); ``` - ## ServiceExtensionContext.terminateSelf terminateSelf(): Promise<void>; @@ -292,17 +542,11 @@ terminateSelf(): Promise<void>; **示例:** ```js - import ExtensionContext from '@ohos.application.ServiceExtensionAbility'; - class MainAbility extends ExtensionContext { - onWindowStageCreate(windowStage) { - this.context.terminateSelf().then((data) => { - console.log('success:' + JSON.stringify(data)); - }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); - }); - } -} - + this.context.terminateSelf().then((data) => { + console.log('success:' + JSON.stringify(data)); + }).catch((error) => { + console.log('failed:' + JSON.stringify(error)); + }); ``` ## ServiceExtensionContext.connectAbility @@ -332,13 +576,13 @@ connectAbility(want: Want, options: ConnectOptions): number; ```js let want = { - "bundleName": "com.example.myapp", - "abilityName": "MyAbility" + "bundleName": "com.example.myapp", + "abilityName": "MyAbility" }; let options = { - onConnect: function(elementName, proxy) {}, - onDisConnect: function(elementName) {}, - onFailed: function(code) {} + onConnect(elementName, remote) { console.log('----------- onConnect -----------') }, + onDisconnect(elementName) { console.log('----------- onDisconnect -----------') }, + onFailed(code) { console.log('----------- onFailed -----------') } } let connection = this.context.connectAbility(want,options); ``` @@ -405,17 +649,11 @@ disconnectAbility(connection: number, callback:AsyncCallback<void>): void; **示例:** ```js - import ExtensionContext from '@ohos.application.ServiceExtensionAbility'; - class MainAbility extends ExtensionContext { - onWindowStageCreate(windowStage) { - let connection=1 - this.context.disconnectAbility(connection, (err) => { + let connection=1 + this.context.disconnectAbility(connection, (err) => { // connection为connectAbility中的返回值 console.log('terminateSelf result:' + JSON.stringify(err)); - }); - } - } - + }); ``` ## ServiceExtensionContext.disconnectAbility @@ -443,16 +681,11 @@ disconnectAbility(connection: number): Promise<void>; **示例:** ```js - import ExtensionContext from '@ohos.application.ServiceExtensionAbility'; - class MainAbility extends ExtensionContext { - onWindowStageCreate(windowStage) { - let connection=1 - this.context.disconnectAbility(connection).then((data) => { // connection为connectAbility中的返回值 + let connection=1 + this.context.disconnectAbility(connection).then((data) => { + // connection为connectAbility中的返回值 console.log('success:' + JSON.stringify(data)); - }).catch((error) => { + }).catch((error) => { console.log('failed:' + JSON.stringify(error)); - }); - } - } - + }); ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-settings.md b/zh-cn/application-dev/reference/apis/js-apis-settings.md index e4b3595f061e8a549450f81fde6fd36ed5578809..4dd0a06978d65c4600204f26ef648f08c6fca4ad 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-settings.md +++ b/zh-cn/application-dev/reference/apis/js-apis-settings.md @@ -1,15 +1,15 @@ # 设置数据项名称 +本模块提供设置数据项的访问功能相关接口的说明及示例。 + > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 本模块首批接口从API version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 -本模块提供设置数据项的访问功能相关接口的说明及示例。 - ## 导入模块 -```typescript +```ts import settings from '@ohos.settings'; ``` @@ -23,18 +23,19 @@ getUriSync(name: string): string **系统能力**:SystemCapability.Applictaions.settings.Core。 -- 参数: +**参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | name | string | 是 | 数据项的名称。数据项名称分为以下两种:
  • 数据库中已存在的数据项,包括:
    • 亮度:settings.display.SCREEN_BRIGHTNESS_STATUS
    • 时间格式:settings.date.TIME_FORMAT
  • 开发者自行添加的数据项。
| + | settings.display.SCREEN_BRIGHTNESS_STATUS | string | 是 | 亮度数据项的名称。| + | settings.date.TIME_FORMAT | string | 是 | 时间格式数据项的名称。| -- 返回值: +**返回值**: | 类型 | 说明 | | -------- | -------- | | string | 数据项的URI。 | -- 示例: - ```typescript +**示例**: + ```ts // 获取数据项的URI let urivar = settings.getUriSync(settings.display.SCREEN_BRIGHTNESS_STATUS); ``` @@ -48,20 +49,20 @@ getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: strin **系统能力**:SystemCapability.Applictaions.settings.Core。 -- 参数: +**参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | 是 | 数据管理辅助类。 | | name | string | 是 | 数据项的名称。数据项名称分为以下两种:
  • 数据库中已存在的数据项,包括:
    • 亮度:settings.display.SCREEN_BRIGHTNESS_STATUS
    • 时间格式:settings.date.TIME_FORMAT
  • 开发者自行添加的数据项。
| | defValue | string | 是 | 默认值。由开发者设置,当未从数据库中查询到该数据时,则返回该默认值。 | -- 返回值: +**返回值**: | 类型 | 说明 | | -------- | -------- | | string | 返回数据项的值。 | -- 示例: - ```typescript +**示例**: + ```ts import featureAbility from '@ohos.ability.featureAbility'; //获取数据项亮度的值(该数据项在数据库中已存在) @@ -82,20 +83,20 @@ setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): **系统能力**:SystemCapability.Applictaions.settings.Core。 -- 参数: +**参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | 是 | 数据管理辅助类。 | | name | string | 是 | 数据项的名称。数据项名称分为以下两种:
  • 数据库中已存在的数据项,包括:
    • 亮度:settings.display.SCREEN_BRIGHTNESS_STATUS
    • 时间格式:settings.date.TIME_FORMAT
  • 开发者自行添加的数据项。
| - | value | string | 是 | 数据项的具体数值。 | + | value | string | 是 | 数据项的具体数值,取值范围随业务变动。 | -- 返回值: +**返回值**: | 类型 | 说明 | | -------- | -------- | | boolean | 返回设置数据项的值是否成功的结果。true表示设置成功,false则表示设置失败。 | -- 示例: - ```typescript +**示例**: + ```ts import featureAbility from '@ohos.ability.featureAbility'; //更新数据项亮度的值(该数据项在数据库中已存在,故setValueSync方法将更新该数据项的值) diff --git a/zh-cn/application-dev/reference/apis/js-apis-sim.md b/zh-cn/application-dev/reference/apis/js-apis-sim.md index 1bc5bd4ae94bfdb0d1136ebf50a394d17cb2fc39..49a02e0b4d5aa3528b2ad47b3865a458331358c4 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-sim.md +++ b/zh-cn/application-dev/reference/apis/js-apis-sim.md @@ -467,7 +467,7 @@ hasSimCard\(slotId: number, callback: AsyncCallback\): void **示例:** -```jsjs +```js sim.hasSimCard(0, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); @@ -522,7 +522,7 @@ getSimAccountInfo(slotId: number, callback: AsyncCallback): voi | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------------------------- | ---- | -------------------------------------- | | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | -| callback | AsyncCallback\<[IccAccountInfo](#IccAccountInfo7)\> | 是 | 回调函数。 | +| callback | AsyncCallback\<[IccAccountInfo](#iccaccountinfo7)\> | 是 | 回调函数。 | **示例:** @@ -555,7 +555,7 @@ getSimAccountInfo(slotId: number): Promise | 类型 | 说明 | | -------------------------------------------- | ------------------------------------------ | -| Promise<[IccAccountInfo](#IccAccountInfo7)\> | 以Promise形式返回指定卡槽SIM卡的账户信息。 | +| Promise<[IccAccountInfo](#iccaccountinfo7)\> | 以Promise形式返回指定卡槽SIM卡的账户信息。 | **示例:** @@ -584,7 +584,7 @@ getActiveSimAccountInfoList(callback: AsyncCallback>): vo | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------------------------- | ---- | ---------- | -| callback | AsyncCallback\\> | 是 | 回调函数。 | +| callback | AsyncCallback\\> | 是 | 回调函数。 | **示例:** @@ -611,7 +611,7 @@ getActiveSimAccountInfoList(): Promise>; | 类型 | 说明 | | ---------------------------------------------------- | ---------------------------------------------- | -| Promise\> | 以Promise形式返回活跃卡槽SIM卡的账户信息列表。 | +| Promise\> | 以Promise形式返回活跃卡槽SIM卡的账户信息列表。 | **示例:** @@ -646,7 +646,7 @@ setDefaultVoiceSlotId(slotId: number, callback: AsyncCallback): void **示例:** ```js -sim.setDefaultVoiceSlotId(0,(err, data) => { +sim.setDefaultVoiceSlotId(0, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -710,8 +710,8 @@ setShowName\(slotId: number, name: string,callback: AsyncCallback\): void **示例:** ```js -const name='中国移动'; -sim.setShowName(0, name,(err, data) => { +const name = '中国移动'; +sim.setShowName(0, name, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -744,8 +744,8 @@ setShowName\(slotId: number, name: string\): Promise\ **示例:** ```js -const name='中国移动'; -let promise = sim.setShowName(0,name); +const name = '中国移动'; +let promise = sim.setShowName(0, name); promise.then(data => { console.log(`setShowName success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -839,8 +839,8 @@ setShowNumber\(slotId: number, number: string,callback: AsyncCallback\): **示例:** ```js -let number='+861xxxxxxxxxx'; -sim.setShowNumber(0, number,(err, data) => { +let number = '+861xxxxxxxxxx'; +sim.setShowNumber(0, number, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -874,8 +874,8 @@ setShowNumber\(slotId: number,number: string\): Promise\ **示例:** ```js -let number='+861xxxxxxxxxx'; -let promise = sim.setShowNumber(0,number); +let number = '+861xxxxxxxxxx'; +let promise = sim.setShowNumber(0, number); promise.then(data => { console.log(`setShowNumber success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -1089,16 +1089,18 @@ setLockState(slotId: number, options: LockInfo, callback: AsyncCallback- 0:卡槽1
- 1:卡槽2 | -| callback | AsyncCallback\<[LockStatusResponse](#LockStatusResponse7)\> | 是 | 回调函数。 | -| options | [LockInfo](#LockInfo8) | 是 | 锁信息。
lockType: [LockType](#LockType8)
password: string
state: [LockState](#LockState8) | +| callback | AsyncCallback\<[LockStatusResponse](#lockstatusresponse7)\> | 是 | 回调函数。 | +| options | [LockInfo](#lockinfo8) | 是 | 锁信息。
lockType: [LockType](#locktype8)
password: string
state: [LockState](#lockstate8) | **示例:** ```js -LockInfo.lockType = 1; -LockInfo.password = "1234"; -LockInfo.state = 0; -sim.setLockState(0, LockInfo, (err, data) => { +let lockInfo = { + lockType = 1, + password = "1234", + state = 0 +}; +sim.setLockState(0, lockInfo, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -1121,21 +1123,23 @@ setLockState(slotId: number, options: LockInfo): Promise | 参数名 | 类型 | 必填 | 说明 | | ------- | ---------------------- | ---- | ------------------------------------------------------------ | | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | -| options | [LockInfo](#LockInfo8) | 是 | 锁信息。
lockType: [LockType](#LockType8)
password: string
state: [LockState](#LockState8) | +| options | [LockInfo](#lockinfo8) | 是 | 锁信息。
lockType: [LockType](#locktype8)
password: string
state: [LockState](#lockstate8) | **返回值:** | 类型 | 说明 | | ---------------------------------------------------- | -------------------------------------------- | -| Promise<[LockStatusResponse](#LockStatusResponse7)\> | 以Promise形式返回获取指定卡槽SIM卡的锁状态。 | +| Promise<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回获取指定卡槽SIM卡的锁状态。 | **示例:** ```js -LockInfo.lockType = 1; -LockInfo.password = "1234"; -LockInfo.state = 0; -let promise = sim.setLockState(0, LockInfo); +let lockInfo = { + lockType = 1, + password = "1234", + state = 0 +}; +let promise = sim.setLockState(0, lockInfo); promise.then(data => { console.log(`setLockState success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -1158,8 +1162,8 @@ getLockState(slotId: number, lockType: LockType, callback: AsyncCallback- 0:卡槽1
- 1:卡槽2 | -| callback | AsyncCallback\<[LockState](#LockState8)\> | 是 | 回调函数。 | -| options | [LockType](#LockType8) | 是 | 锁类型。
- 1: PIN锁
- 2: PIN2锁 | +| callback | AsyncCallback\<[LockState](#lockstate8)\> | 是 | 回调函数。 | +| options | [LockType](#locktype8) | 是 | 锁类型。
- 1: PIN锁
- 2: PIN2锁 | **示例:** @@ -1185,13 +1189,13 @@ getLockState(slotId: number, lockType: LockType): Promise | 参数名 | 类型 | 必填 | 说明 | | ------- | ---------------------- | ---- | --------------------------------------- | | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | -| options | [LockType](#LockType8) | 是 | 锁类型。
- 1: PIN锁
- 2: PIN2锁 | +| options | [LockType](#locktype8) | 是 | 锁类型。
- 1: PIN锁
- 2: PIN2锁 | **返回值:** | 类型 | 说明 | | ---------------------------------- | -------------------------------------------- | -| Promise<[LockState](#LockState8)\> | 以Promise形式返回获取指定卡槽SIM卡的锁状态。 | +| Promise<[LockState](#lockstate8)\> | 以Promise形式返回获取指定卡槽SIM卡的锁状态。 | **示例:** @@ -1221,14 +1225,14 @@ alterPin(slotId: number, newPin: string, oldPin: string, callback: AsyncCallback | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------------------------- | ---- | -------------------------------------- | | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | -| callback | AsyncCallback\<[LockStatusResponse](#LockStatusResponse7)\> | 是 | 回调函数。 | +| callback | AsyncCallback\<[LockStatusResponse](#lockstatusresponse7)\> | 是 | 回调函数。 | | newPin | string | 是 | 新密码。 | | oldPin | string | 是 | 旧密码。 | **示例:** ```js -sim.alterPin(0, "1234", "0000"(err, data) => { +sim.alterPin(0, "1234", "0000", (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -1258,7 +1262,7 @@ alterPin(slotId: number, newPin: string, oldPin: string): Promise | 以Promise形式返回指定卡槽SIM卡的Pin是否成功。 | +| Promise<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回指定卡槽SIM卡的Pin是否成功。 | **示例:** @@ -1288,7 +1292,7 @@ alterPin2(slotId: number, newPin2: string, oldPin2: string, callback: AsyncCallb | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------------------------- | ---- | -------------------------------------- | | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | -| callback | AsyncCallback\<[LockStatusResponse](#LockStatusResponse7)\> | 是 | 回调函数。 | +| callback | AsyncCallback\<[LockStatusResponse](#lockstatusresponse7)\> | 是 | 回调函数。 | | newPin2 | string | 是 | 新密码。 | | oldPin2 | string | 是 | 旧密码。 | @@ -1325,12 +1329,12 @@ alterPin2(slotId: number, newPin2: string, oldPin2: string): Promise | 以Promise形式返回指定卡槽SIM卡的Pin是否成功。 | +| Promise<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回指定卡槽SIM卡的Pin是否成功。 | **示例:** ```js -let promise = sim.alterPin2(0, "1234","0000"); +let promise = sim.alterPin2(0, "1234", "0000"); promise.then(data => { console.log(`alterPin2 success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -1356,13 +1360,13 @@ unlockPin(slotId: number,pin: string ,callback: AsyncCallback- 0:卡槽1
- 1:卡槽2 | | pin | string | 是 | SIM卡的密码 | -| callback | AsyncCallback<[LockStatusResponse](#LockStatusResponse7)> | 是 | 回调函数。 | +| callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | 是 | 回调函数。 | **示例:** ```js -let pin='1234'; -sim.unlockPin(0, pin,(err, data) => { +let pin = '1234'; +sim.unlockPin(0, pin, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -1391,13 +1395,13 @@ unlockPin(slotId: number,pin: string): Promise<LockStatusResponse\> | 类型 | 说明 | | ---------------------------------------------------- | -------------------------------------------------- | -| Promise\<[LockStatusResponse](#LockStatusResponse)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | +| Promise\<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | **示例:** ```js -let pin='1234'; -let promise = sim.unlockPin(0,pin); +let pin = '1234'; +let promise = sim.unlockPin(0, pin); promise.then(data => { console.log(`unlockPin success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -1424,14 +1428,14 @@ unlockPuk(slotId: number,newPin: string,puk: string ,callback: AsyncCallback- 0:卡槽1
- 1:卡槽2 | | newPin | string | 是 | 重置SIM卡的密码 | | puk | string | 是 | SIM卡密码的解锁密码 | -| callback | AsyncCallback<[LockStatusResponse](#LockStatusResponse7)> | 是 | 回调函数。 | +| callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | 是 | 回调函数。 | **示例:** ```js -let puk='1xxxxxxx'; -let newPin='1235'; -sim.unlockPuk(0, newPin,puk,(err, data) => { +let puk = '1xxxxxxx'; +let newPin = '1235'; +sim.unlockPuk(0, newPin, puk, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -1461,14 +1465,14 @@ unlockPuk(slotId: number,newPin: string,puk: string): Promise<LockStatusRespo | 类型 | 说明 | | ---------------------------------------------------- | -------------------------------------------------- | -| Promise\<[LockStatusResponse](#LockStatusResponse)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | +| Promise\<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | **示例:** ```js -let puk='1xxxxxxx'; -let newPin='1235'; -let promise = sim.unlockPuk(0,newPin,puk); +let puk = '1xxxxxxx'; +let newPin = '1235'; +let promise = sim.unlockPuk(0, newPin, puk); promise.then(data => { console.log(`unlockPuk success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -1494,13 +1498,13 @@ promise.then(data => { | -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | | pin2 | string | 是 | SIM卡的密码 | -| callback | AsyncCallback<[LockStatusResponse](#LockStatusResponse7)> | 是 | 回调函数。 | +| callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | 是 | 回调函数。 | **示例:** ```js -let pin2='1234'; -sim.unlockPin2(0, pin2,(err, data) => { +let pin2 = '1234'; +sim.unlockPin2(0, pin2, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -1529,7 +1533,7 @@ unlockPin2(slotId: number,pin2: string): Promise<LockStatusResponse\> | 类型 | 说明 | | ----------------------------------------------------- | -------------------------------------------------- | -| Promise\<[LockStatusResponse](#LockStatusResponse7)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | +| Promise\<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | **示例:** @@ -1562,14 +1566,14 @@ unlockPuk2(slotId: number,newPin2: string,puk2: string ,callback: AsyncCallback< | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | | newPin2 | string | 是 | 重置SIM卡的密码 | | puk2 | string | 是 | SIM卡密码的解锁密码 | -| callback | AsyncCallback<[LockStatusResponse](#LockStatusResponse7)> | 是 | 回调函数。 | +| callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | 是 | 回调函数。 | **示例:** ```js -let puk2='1xxxxxxx'; -let newPin2='1235'; -sim.unlockPuk2(0, newPin2,puk2,(err, data) => { +let puk2 = '1xxxxxxx'; +let newPin2 = '1235'; +sim.unlockPuk2(0, newPin2, puk2, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -1599,14 +1603,14 @@ unlockPuk2slotId: number,newPin2: string,puk2: string): Promise<LockStatusRes | 类型 | 说明 | | ---------------------------------------------------- | -------------------------------------------------- | -| Promise\<[LockStatusResponse](#LockStatusResponse)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | +| Promise\<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | **示例:** ```js -let puk2='1xxxxxxx'; -let newPin2='1235'; -let promise = sim.unlockPuk2(0,newPin2,puk2); +let puk2 = '1xxxxxxx'; +let newPin2 = '1235'; +let promise = sim.unlockPuk2(0, newPin2, puk2); promise.then(data => { console.log(`unlockPuk2 success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -1634,143 +1638,1313 @@ getMaxSimCount\(\): number console.log("Result: "+ sim.getMaxSimCount()) ``` +## sim.getSimIccId7+ -## SimState +getSimIccId(slotId: number, callback: AsyncCallback): void -SIM卡状态。 +获取指定卡槽SIM卡的ICCID,使用callback方式作为异步方法。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +此接口为系统接口。 -| 名称 | 值 | 说明 | -| --------------------- | ---- | ---------------------------------------------------------- | -| SIM_STATE_UNKNOWN | 0 | SIM卡状态未知,即无法获取准确的状态。 | -| SIM_STATE_NOT_PRESENT | 1 | 表示SIM卡处于not present状态,即卡槽中没有插入SIM卡。 | -| SIM_STATE_LOCKED | 2 | 表示SIM卡处于locked状态,即SIM卡被PIN、PUK或网络锁锁定。 | -| SIM_STATE_NOT_READY | 3 | 表示SIM卡处于not ready状态,即SIM卡在位但无法正常工作。 | -| SIM_STATE_READY | 4 | 表示SIM卡处于ready状态,即SIM卡在位且工作正常。 | -| SIM_STATE_LOADED | 5 | 表示SIM卡处于loaded状态,即SIM卡在位且所有卡文件加载完毕。 | +**需要权限**:ohos.permission.GET_TELEPHONY_STATE -## CardType7+ +**系统能力**:SystemCapability.Telephony.CoreService -卡类型。 +**参数:** -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback | 是 | 回调函数。 | -| 名称 | 值 | 说明 | -| ----- | ----- | ----- | -|UNKNOWN_CARD | -1 | 未知类型 | -|SINGLE_MODE_SIM_CARD | 10 | 单SIM卡 | -|SINGLE_MODE_USIM_CARD | 20 | 单USIM卡 | -|SINGLE_MODE_RUIM_CARD | 30 | 单RUIM卡 | -|DUAL_MODE_CG_CARD | 40 | 双卡模式C+G | -|CT_NATIONAL_ROAMING_CARD | 41 | 中国电信内部漫游卡 | -|CU_DUAL_MODE_CARD | 42 | 中国联通双模卡 | -|DUAL_MODE_TELECOM_LTE_CARD | 43 | 双模式电信LTE卡 | -|DUAL_MODE_UG_CARD | 50 | 双模式UG卡 | -|SINGLE_MODE_ISIM_CARD8+ | 60 | 单一ISIM卡类型 | +**示例:** -## LockType8+ +```js +sim.getSimIccId(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` -锁类型。 + +## sim.getSimIccId7+ + +getSimIccId(slotId: number): Promise + +获取指定卡槽SIM卡的ICCID,使用Promise方式作为异步方法。 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**需要权限**:ohos.permission.GET_TELEPHONY_STATE -| 名称 | 值 | 说明 | -| -------- | ---- | ----------- | -| PIN_LOCK | 1 | SIM卡密码锁 | -| FDN_LOCK | 2 | 固定拨号锁 | +**系统能力**:SystemCapability.Telephony.CoreService -## LockState8+ +**参数:** -锁状态。 +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------------------------- | +| Promise | 以Promise形式返回获取指定卡槽SIM卡的ICCID。 | + +**示例:** + +```js +let promise = sim.getSimIccId(0); +promise.then(data => { + console.log(`getSimIccId success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getSimIccId fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getVoiceMailIdentifier8+ + +getVoiceMailIdentifier(slotId: number, callback: AsyncCallback): void + +获取指定卡槽中SIM卡语音信箱的alpha标识符,使用callback方式作为异步方法。 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**需要权限**:ohos.permission.GET_TELEPHONY_STATE -| 名称 | 值 | 说明 | -| -------- | ---- | ---------- | -| LOCK_OFF | 0 | 锁关闭状态 | -| LOCK_ON | 1 | 锁开启状态 | +**系统能力**:SystemCapability.Telephony.CoreService -## **PersoLockType**8+ +**参数:** -定制锁类型。 +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback | 是 | 回调函数。 | + +**示例:** + +```js +sim.getVoiceMailIdentifier(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getVoiceMailIdentifier8+ + +getVoiceMailIdentifier(slotId: number): Promise + +获取指定卡槽中SIM卡语音信箱的alpha标识符,使用Promise方式作为异步方法。 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**需要权限**:ohos.permission.GET_TELEPHONY_STATE -| 名称 | 值 | 说明 | -| ------------ | ---- | ----------------------------------------------- | -| PN_PIN_LOCK | 0 | 定制网络PIN锁*(参照 3GPP TS 22.022 [33])* | -| PN_PUK_LOCK | 1 | 定制网络PUk锁 | -| PU_PIN_LOCK | 2 | 定制网络子集PIN锁*(参照 3GPP TS 22.022 [33])* | -| PU_PUK_LOCK | 3 | 定制网络子集PUK锁 | -| PP_PIN_LOCK | 4 | 定制服务提供者PIN锁*(参照 3GPP TS 22.022 [33])* | -| PP_PUK_LOCK | 5 | 定制服务提供者PUK锁 | -| PC_PIN_LOCK | 6 | 定制企业PIN锁*(参照 3GPP TS 22.022 [33])* | -| PC_PUK_LOCK | 7 | 定制企业Puk锁 | -| SIM_PIN_LOCK | 8 | 定制SIM的PIN锁*(参照 3GPP TS 22.022 [33])* | -| SIM_PUK_LOCK | 9 | 定制SIM的PUK锁 | +**系统能力**:SystemCapability.Telephony.CoreService -## **LockStatusResponse**7+ +**参数:** -锁状态响应。 +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------------------------------- | +| Promise | 以Promise形式返回获取指定卡槽SIM卡的alpha标识符。 | + +**示例:** + +```js +let promise = sim.getVoiceMailIdentifier(0); +promise.then(data => { + console.log(`getVoiceMailIdentifier success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getVoiceMailIdentifier fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getVoiceMailNumber8+ + +getVoiceMailNumber(slotId: number, callback: AsyncCallback): void + +获取指定卡槽中SIM卡的语音信箱号,使用callback方式作为异步方法。 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**需要权限**:ohos.permission.GET_TELEPHONY_STATE -| 名称 | 类型 | 说明 | -| --------------- | ------ | ------------------ | -| result | number | 当前操作的结果 | -| remain?: number | number | 剩余次数(可以为空) | +**系统能力**:SystemCapability.Telephony.CoreService -## **LockInfo**8+ +**参数:** -锁状态响应。 +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback | 是 | 回调函数。 | + +**示例:** + +```js +sim.getVoiceMailNumber(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getVoiceMailNumber8+ + +getVoiceMailNumber(slotId: number): Promise + +获取指定卡槽中SIM卡的语音信箱号,使用Promise方式作为异步方法。 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**需要权限**:ohos.permission.GET_TELEPHONY_STATE -| 名称 | 类型 | 说明 | -| -------- | --------- | ------ | -| lockType | LockType | 锁类型 | -| password | string | 密码 | -| state | LockState | 锁状态 | +**系统能力**:SystemCapability.Telephony.CoreService -## **PersoLockInfo**8+ +**参数:** -锁状态响应。 +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------------------------------ | +| Promise | 以Promise形式返回获取指定卡槽SIM卡的语音信箱号。 | + +**示例:** + +```js +let promise = sim.getVoiceMailNumber(0); +promise.then(data => { + console.log(`getVoiceMailNumber success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getVoiceMailNumber fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.setVoiceMailInfo8+ + +setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string, callback: AsyncCallback): void + +设置语音邮件信息,使用callback方式作为异步方法。 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService -| 名称 | 类型 | 说明 | -| -------- | ------------- | ------------ | -| lockType | PersoLockType | 定制锁的类型 | -| password | string | 密码 | +**参数:** -## **IccAccountInfo**7+ +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | -------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| mailName | string | 是 | 邮件名字 | +| mailNumber | string | 是 | 邮件号码 | +| callback | AsyncCallback | 是 | 回调函数。 | -Icc账户信息。 +**示例:** + +```js +sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com" , (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.setVoiceMailInfo8+ + +setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string): Promise + +设置语音邮件信息,使用Promise方式作为异步方法。 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**需要权限**:ohos.permission.SET_TELEPHONY_STATE -| 名称 | 类型 | 说明 | -| ---------- | ------- | ---------------- | -| simId | number | SIM卡ID | -| slotIndex | number | 卡槽ID | -| isEsim | boolean | 标记卡是否是eSim | -| isActive | boolean | 卡是否被激活 | -| iccId | string | ICCID号码 | -| showName | string | SIM卡显示名称 | -| showNumber | string | SIM卡显示号码 | +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| mailName | string | 是 | 邮件名字 | +| mailNumber | string | 是 | 邮件号码 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | ----------------------- | +| Promise | 以Promise形式返回结果。 | + +**示例:** + +```js +let promise = sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com"); +promise.then(data => { + console.log(`setVoiceMailInfo success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`setVoiceMailInfo fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getSimTelephoneNumber8+ + +getSimTelephoneNumber(slotId: number, callback: AsyncCallback): void + +获取指定卡槽中SIM卡的MSISDN,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback | 是 | 回调函数。 | + +**示例:** + +```js +sim.getSimTelephoneNumber(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getSimTelephoneNumber8+ + +getSimTelephoneNumber(slotId: number): Promise + +获取指定卡槽中SIM卡的MSISDN,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------------------------------- | +| Promise | 以Promise形式返回获取指定卡槽SIM卡的MSISDN。 | + +**示例:** + +```js +let promise = sim.getSimTelephoneNumber(0); +promise.then(data => { + console.log(`getSimTelephoneNumber success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getSimTelephoneNumber fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getSimGid17+ + +getSimGid1(slotId: number, callback: AsyncCallback): void + +获取指定卡槽中SIM卡的组标识符级别1(GID1),使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +sim.getSimGid1(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getSimGid17+ + +getSimGid1(slotId: number): Promise + +获取指定卡槽中SIM卡的组标识符级别1(GID1),使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------------------------------- | +| Promise | 以Promise形式返回获取指定卡槽SIM卡的标识符级别1。 | + +**示例:** + +```js +let promise = sim.getSimGid1(0); +promise.then(data => { + console.log(`getSimGid1 success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getSimGid1 fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getIMSI + +getIMSI(slotId: number, callback: AsyncCallback): void + +获取国际移动用户识别码,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +sim.getIMSI(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getIMSI + +getIMSI(slotId: number): Promise + +获取国际移动用户识别码,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------------------------- | +| Promise | 以Promise形式返回获取的国际移动用户识别码。 | + +**示例:** + +```js +let promise = sim.getIMSI(0); +promise.then(data => { + console.log(`getIMSI success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getIMSI fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getOperatorConfigs8+ + +getOperatorConfigs(slotId: number, callback: AsyncCallback>): void + +获取运营商配置,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback> | 是 | 回调函数。 | + +**示例:** + +```js +sim.getOperatorConfigs(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getOperatorConfigs8+ + +getOperatorConfigs(slotId: number): Promise> + +获取运营商配置,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------------------------- | ----------------------------- | +| Promise> | 以Promise形式返回运营商配置。 | + +**示例:** + +```js +let promise = sim.getOperatorConfigs(0); +promise.then(data => { + console.log(`getOperatorConfigs success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getOperatorConfigs fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.queryIccDiallingNumbers8+ + +queryIccDiallingNumbers(slotId: number, type: ContactType, callback: AsyncCallback>): void + +查询SIM卡联系人号码,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.READ_CONTACTS + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | ---------------------------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | ContactType | 是 | 联系人类型。
1 : GENERAL_CONTACT
2 : FIXED_DIALING | +| callback | AsyncCallback> | 是 | 回调函数。 | + +**示例:** + +```js +sim.queryIccDiallingNumbers(0, 1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.queryIccDiallingNumbers8+ + +queryIccDiallingNumbers(slotId: number, type: ContactType): Promise> + +查询SIM卡联系人号码,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.READ_CONTACTS + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ----------- | ---- | ---------------------------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | ContactType | 是 | 联系人类型。
1 : GENERAL_CONTACT
2 : FIXED_DIALING | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | ------------------------------ | +| Promise> | 以Promise形式返回Icc拨号号码。 | + +**示例:** + +```js +let promise = sim.queryIccDiallingNumbers(0, 1); +promise.then(data => { + console.log(`queryIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`queryIccDiallingNumbers fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.addIccDiallingNumbers8+ + +addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback): void + +添加SIM卡联系人号码,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.WRITE_CONTACTS + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [ContactType](#contacttype8) | 是 | 联系人类型。
1 : GENERAL_CONTACT
2 : FIXED_DIALING | +| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 | +| callback | AsyncCallback | 是 | 回调函数 | + +**示例:** + +```js +let diallingNumbersInof = { + alphaTag = "alpha", + number = "138xxxxxxxx", + recordNumber = 123, + pin2 = "1234" +}; +sim.addIccDiallingNumbers(0, 1, diallingNumbersInof, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.addIccDiallingNumbers8+ + +addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise + +添加SIM卡联系人号码,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.WRITE_CONTACTS + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [ContactType](#contacttype8) | 是 | 联系人类型。
1 : GENERAL_CONTACT
2 : FIXED_DIALING | +| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | --------------------------- | +| Promise | 以Promise形式返回添加结果。 | + +**示例:** + +```js +let diallingNumbersInof = { + alphaTag = "alpha", + number = "138xxxxxxxx", + recordNumber = 123, + pin2 = "1234" +}; +let promise = sim.addIccDiallingNumbers(0, 1, diallingNumbersInof); +promise.then(data => { + console.log(`addIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`addIccDiallingNumbers fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.delIccDiallingNumbers8+ + +delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback): void + +删除SIM卡联系人号码,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.WRITE_CONTACTS + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [ContactType](#contacttype8) | 是 | 联系人类型。
1 : GENERAL_CONTACT
2 : FIXED_DIALING | +| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 | +| callback | AsyncCallback | 是 | 回调函数 | + +**示例:** + +```js +let diallingNumbersInof = { + alphaTag = "alpha", + number = "138xxxxxxxx", + recordNumber = 123, + pin2 = "1234" +}; +sim.delIccDiallingNumbers(0, 1, diallingNumbersInof, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.delIccDiallingNumbers8+ + +delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise + +删除SIM卡联系人号码,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.WRITE_CONTACTS + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [ContactType](#contacttype8) | 是 | 联系人类型。
1 : GENERAL_CONTACT
2 : FIXED_DIALING | +| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | --------------------------- | +| Promise | 以Promise形式返回删除结果。 | + +**示例:** + +```js +let diallingNumbersInof = { + alphaTag = "alpha", + number = "138xxxxxxxx", + recordNumber = 123, + pin2 = "1234" +}; +let promise = sim.delIccDiallingNumbers(0, 1, diallingNumbersInof); +promise.then(data => { + console.log(`delIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`delIccDiallingNumbers fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.updateIccDiallingNumbers8+ + +updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback): void + +更新SIM卡联系人号码,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.WRITE_CONTACTS + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [ContactType](#contacttype8) | 是 | 联系人类型。
1 : GENERAL_CONTACT
2 : FIXED_DIALING | +| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 | +| callback | AsyncCallback | 是 | 回调函数 | + +**示例:** + +```js +let diallingNumbersInof = { + alphaTag = "alpha", + number = "138xxxxxxxx", + recordNumber = 123, + pin2 = "1234" +}; +sim.updateIccDiallingNumbers(0, 1, diallingNumbersInof, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.updateIccDiallingNumbers8+ + +updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise + +更新SIM卡联系人号码,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.WRITE_CONTACTS + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [ContactType](#contacttype8) | 是 | 联系人类型。
1 : GENERAL_CONTACT
2 : FIXED_DIALING | +| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | ----------------------------- | +| Promise | 以Promise形式返回更新的结果。 | + +**示例:** + +```js +let diallingNumbersInof = { + alphaTag = "alpha", + number = "138xxxxxxxx", + recordNumber = 123, + pin2 = "1234" +}; +let promise = sim.updateIccDiallingNumbers(0, 1, diallingNumbersInof); +promise.then(data => { + console.log(`updateIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`updateIccDiallingNumbers fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.sendEnvelopeCmd8+ + +sendEnvelopeCmd(slotId: number, cmd: string, callback: AsyncCallback): void + +发送信封命令,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| cmd | string | 是 | 命令 | +| callback | AsyncCallback | 是 | 是 | + +**示例:** + +```js +sim.sendEnvelopeCmd(0, "ls", (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.sendEnvelopeCmd8+ + +sendEnvelopeCmd(slotId: number, cmd: string): Promise + +发送信封命令,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| cmd | string | 是 | 命令 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | --------------------------- | +| Promise | 以Promise形式返回发送结果。 | + +**示例:** + +```js +let promise = sim.sendEnvelopeCmd(0, "ls"); +promise.then(data => { + console.log(`sendEnvelopeCmd success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`sendEnvelopeCmd fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.sendTerminalResponseCmd8+ + +sendTerminalResponseCmd(slotId: number, cmd: string, callback: AsyncCallback): void + +发送终端响应命令,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| cmd | string | 是 | 命令 | +| callback | AsyncCallback | 是 | 回调函数。 | + +**示例:** + +```js +sim.sendTerminalResponseCmd(0, "ls", (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.sendTerminalResponseCmd8+ + +sendTerminalResponseCmd(slotId: number, cmd: string): Promise + +发送终端响应命令,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| cmd | string | 是 | 命令 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | --------------------------- | +| Promise | 以Promise形式返回发送结果。 | + +**示例:** + +```js +let promise = sim.sendTerminalResponseCmd(0, "ls"); +promise.then(data => { + console.log(`sendTerminalResponseCmd success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`sendTerminalResponseCmd fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.unlockSimLock8+ + +unlockSimLock(slotId: number, lockInfo: PersoLockInfo, callback: AsyncCallback): void + +解锁SIM卡锁,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| lockInfo | [PersoLockInfo](#persolockinfo8) | 是 | 定制锁类型信息 | +| callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)\> | 是 | 回调函数 | + +**示例:** + +```js +let persoLockInfo = { + lockType = 0, + password = "1234" +}; +sim.unlockSimLock(0, persoLockInfo, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.unlockSimLock8+ + +unlockSimLock(slotId: number, lockInfo: PersoLockInfo): Promise + +解锁SIM卡锁,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| lockInfo | [PersoLockInfo](#persolockinfo8) | 是 | 定制锁类型信息 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------------------- | ------------------------- | +| Promise<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回锁状态。 | + +**示例:** + +```js +let persoLockInfo = { + lockType = 0, + password = "1234" +}; +let promise = sim.unlockSimLock(0, persoLockInfo); +promise.then(data => { + console.log(`unlockSimLock success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`unlockSimLock fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getOpKey9+ + +getOpKey(slotId: number, callback: AsyncCallback): void + +获取指定卡槽中SIM卡的opkey,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback | 是 | 回调函数 | + +**示例:** + +```js +sim.getOpKey(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getOpKey9+ + +getOpKey(slotId: number): Promise + +获取指定卡槽中SIM卡的opkey,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ----------------------------------------- | +| Promise | 以Promise形式返回指定卡槽中SIM卡的opkey。 | + +**示例:** + +```js +let promise = sim.getOpKey(0); +promise.then(data => { + console.log(`getOpKey success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getOpKey fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getOpName9+ + +getOpName(slotId: number, callback: AsyncCallback): void + +获取指定卡槽中SIM卡的OpName,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback | 是 | 回调函数 | + +**示例:** + +```js +sim.getOpName(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getOpName9+ + +getOpName(slotId: number): Promise + +获取指定卡槽中SIM卡的OpName,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------------------------ | +| Promise | 以Promise形式返回指定卡槽中SIM卡的OpName。 | + +**示例:** + +```js +let promise = sim.getOpName(0); +promise.then(data => { + console.log(`getOpName success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getOpName fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## SimState + +SIM卡状态。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| --------------------- | ---- | ---------------------------------------------------------- | +| SIM_STATE_UNKNOWN | 0 | SIM卡状态未知,即无法获取准确的状态。 | +| SIM_STATE_NOT_PRESENT | 1 | 表示SIM卡处于not present状态,即卡槽中没有插入SIM卡。 | +| SIM_STATE_LOCKED | 2 | 表示SIM卡处于locked状态,即SIM卡被PIN、PUK或网络锁锁定。 | +| SIM_STATE_NOT_READY | 3 | 表示SIM卡处于not ready状态,即SIM卡在位但无法正常工作。 | +| SIM_STATE_READY | 4 | 表示SIM卡处于ready状态,即SIM卡在位且工作正常。 | +| SIM_STATE_LOADED | 5 | 表示SIM卡处于loaded状态,即SIM卡在位且所有卡文件加载完毕。 | + +## CardType7+ + +卡类型。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| ----- | ----- | ----- | +|UNKNOWN_CARD | -1 | 未知类型 | +|SINGLE_MODE_SIM_CARD | 10 | 单SIM卡 | +|SINGLE_MODE_USIM_CARD | 20 | 单USIM卡 | +|SINGLE_MODE_RUIM_CARD | 30 | 单RUIM卡 | +|DUAL_MODE_CG_CARD | 40 | 双卡模式C+G | +|CT_NATIONAL_ROAMING_CARD | 41 | 中国电信内部漫游卡 | +|CU_DUAL_MODE_CARD | 42 | 中国联通双模卡 | +|DUAL_MODE_TELECOM_LTE_CARD | 43 | 双模式电信LTE卡 | +|DUAL_MODE_UG_CARD | 50 | 双模式UG卡 | +|SINGLE_MODE_ISIM_CARD8+ | 60 | 单一ISIM卡类型 | + +## LockType8+ + +锁类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| -------- | ---- | ----------- | +| PIN_LOCK | 1 | SIM卡密码锁 | +| FDN_LOCK | 2 | 固定拨号锁 | + +## LockState8+ + +锁状态。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| -------- | ---- | ---------- | +| LOCK_OFF | 0 | 锁关闭状态 | +| LOCK_ON | 1 | 锁开启状态 | + +## **PersoLockType**8+ + +定制锁类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| ------------ | ---- | ----------------------------------------------- | +| PN_PIN_LOCK | 0 | 定制网络PIN锁*(参照 3GPP TS 22.022 [33])* | +| PN_PUK_LOCK | 1 | 定制网络PUk锁 | +| PU_PIN_LOCK | 2 | 定制网络子集PIN锁*(参照 3GPP TS 22.022 [33])* | +| PU_PUK_LOCK | 3 | 定制网络子集PUK锁 | +| PP_PIN_LOCK | 4 | 定制服务提供者PIN锁*(参照 3GPP TS 22.022 [33])* | +| PP_PUK_LOCK | 5 | 定制服务提供者PUK锁 | +| PC_PIN_LOCK | 6 | 定制企业PIN锁*(参照 3GPP TS 22.022 [33])* | +| PC_PUK_LOCK | 7 | 定制企业Puk锁 | +| SIM_PIN_LOCK | 8 | 定制SIM的PIN锁*(参照 3GPP TS 22.022 [33])* | +| SIM_PUK_LOCK | 9 | 定制SIM的PUK锁 | + +## **LockStatusResponse**7+ + +锁状态响应。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| --------------- | ------ | ------------------ | +| result | number | 当前操作的结果 | +| remain?: number | number | 剩余次数(可以为空) | + +## **LockInfo**8+ + +锁状态响应。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| -------- | ------------------------ | ------ | +| lockType | [LockType](#locktype8) | 锁类型 | +| password | string | 密码 | +| state | [LockState](#lockstate8) | 锁状态 | + +## **PersoLockInfo**8+ + +锁状态响应。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| -------- | -------------------------------- | ------------ | +| lockType | [PersoLockType](#persolocktype8) | 定制锁的类型 | +| password | string | 密码 | + +## **IccAccountInfo**7+ + +Icc账户信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ---------- | ------- | ---------------- | +| simId | number | SIM卡ID | +| slotIndex | number | 卡槽ID | +| isEsim | boolean | 标记卡是否是eSim | +| isActive | boolean | 卡是否被激活 | +| iccId | string | ICCID号码 | +| showName | string | SIM卡显示名称 | +| showNumber | string | SIM卡显示号码 | + +## **OperatorConfig**8+ + +运营商配置。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ----- | ------ | ---- | +| field | string | 字段 | +| value | string | 值 | + +## **DiallingNumbersInfo**8+ + +拨号号码信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ------------ | ------ | -------- | +| alphaTag | string | 标签 | +| number | string | 号码 | +| recordNumber | number | 记录编号 | +| pin2 | string | pin2密码 | + +## **ContactType**8+ + +联系人类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +| 名称 | 值 | 说明 | +| :-------------- | ---- | ---------- | +| GENERAL_CONTACT | 1 | 通用联系人 | +| FIXED_DIALING | 2 | 固定拨号 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-sms.md b/zh-cn/application-dev/reference/apis/js-apis-sms.md index ed5918167b1bc9108b845951f7ba8ef5eef4d23d..4fd42d04b18e03ac03e1d70d9f4a252fb44f1bf5 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-sms.md +++ b/zh-cn/application-dev/reference/apis/js-apis-sms.md @@ -375,6 +375,739 @@ let result = sms.hasSmsCapability(); console.log(`hasSmsCapability: ${JSON.stringify(result)}`); ``` +## sms.splitMessage8+ + +splitMessage(content: string, callback: AsyncCallback>): void + +将长短信拆分为多个片段,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SEND_MESSAGES + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------- | ---- | ----------------------------- | +| content | string | 是 | 指示短消息内容,不能为null。 | +| callback | AsyncCallback> | 是 | 回调函数。 | + +**示例:** + +```js +string content= "long message"; +sms.splitMessage(content, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.splitMessage8+ + +splitMessage(content: string): Promise> + +将长短信拆分为多个片段,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SEND_MESSAGES + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ---------------------------- | +| content | string | 是 | 指示短消息内容,不能为null。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------- | ----------------------------------- | +| Promise> | 以Promise形式返回多个片段的的结果。 | + +**示例:** + +```js +string content = "long message"; +let promise = sms.splitMessage(content); +promise.then(data => { + console.log(`splitMessage success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`splitMessage fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.addSimMessage7+ + +addSimMessage(options: SimMessageOptions, callback: AsyncCallback): void + +添加SIM卡消息,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | --------------- | +| options | [SimMessageOptions](#simmessageoptions7) | 是 | SIM卡消息选项。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let simMessageOptions = { + slotId = 0, + smsc = "test", + pdu = "xxxxxx", + status = 0 +}; +sms.addSimMessage(simMessageOptions, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.addSimMessage7+ + +addSimMessage(options: SimMessageOptions): Promise + +添加SIM卡消息,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ---------------------------------------- | ---- | --------------- | +| options | [SimMessageOptions](#simmessageoptions7) | 是 | SIM卡消息选项。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ----------------------------- | +| Promise<void> | 以Promise形式返回添加的结果。 | + +**示例:** + +```js +let simMessageOptions = { + slotId = 0, + smsc = "test", + pdu = "xxxxxx", + status = 0 +}; +let promise = sms.addSimMessage(simMessageOptions); +promise.then(data => { + console.log(`addSimMessage success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`addSimMessage fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.delSimMessage7+ + +delSimMessage(slotId: number, msgIndex: number, callback: AsyncCallback): void + +删除SIM卡消息,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ----------------------------------------- | +| slotId | number | 是 | SIM卡槽ID:
- 0:卡槽1
- 1:卡槽2 | +| msgIndex | number | 是 | 消息索引 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let slotId = 0; +let msgIndex = 1; +sms.delSimMessage(slotId, msgIndex, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.delSimMessage7+ + +delSimMessage(slotId: number, msgIndex: number): Promise + +删除SIM卡信息,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ----------------------------------------- | +| slotId | number | 是 | SIM卡槽ID:
- 0:卡槽1
- 1:卡槽2 | +| msgIndex | number | 是 | 消息索引 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ----------------------------- | +| Promise<void> | 以Promise形式返回删除的结果。 | + +**示例:** + +```js +let slotId = 0; +let msgIndex = 1; +let promise = sms.delSimMessage(slotId, msgIndex); +promise.then(data => { + console.log(`delSimMessage success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`delSimMessage fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.updateSimMessage7+ + +updateSimMessage(options: UpdateSimMessageOptions, callback: AsyncCallback): void + +更新SIM卡消息,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------------------- | ---- | ------------------- | +| options | [UpdateSimMessageOptions](#updatesimmessageoptions7) | 是 | 更新SIM卡消息选项。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let updateSimMessageOptions = { + slotId = 0, + msgIndex = 1, + newStatus = 0, + pdu = "xxxxxxx", + smsc = "test" +}; +sms.updateSimMessage(updateSimMessageOptions, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.updateSimMessage7+ + +updateSimMessage(options: UpdateSimMessageOptions): Promise + +更新SIM卡消息,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ---------------------------------------------------- | ---- | ------------------- | +| options | [UpdateSimMessageOptions](#updatesimmessageoptions7) | 是 | 更新SIM卡消息选项。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ----------------------------- | +| Promise<void> | 以Promise形式返回更新的结果。 | + +**示例:** + +```js +let updateSimMessageOptions = { + slotId = 0, + msgIndex = 1, + newStatus = 0, + pdu = "xxxxxxx", + smsc = "test" +}; +let promise = sms.updateSimMessage(updateSimMessageOptions); +promise.then(data => { + console.log(`updateSimMessage success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`updateSimMessage fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.getAllSimMessages7+ + +getAllSimMessages(slotId: number, callback: AsyncCallback>): void + +获取所有SIM卡消息,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------------------- | ---- | ----------------------------------------- | +| slotId | number | 是 | SIM卡槽ID:
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback> | 是 | 回调函数。 | + +**示例:** + +```js +let slotId = 0; +sms.getAllSimMessages(slotId, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.getAllSimMessages7+ + +getAllSimMessages(slotId: number): Promise> + +获取所有SIM卡消息,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ----------------------------------------- | +| slotId | number | 是 | SIM卡槽ID:
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------- | ---------------------------------- | +| PromiseArray<[SimShortMessage](#simshortmessage8)\>> | 以Promise形式返回获取的SIM短消息。 | + +**示例:** + +```js +let slotId = 0; +let promise = sms.getAllSimMessages(slotId); +promise.then(data => { + console.log(`getAllSimMessages success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getAllSimMessages fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.setCBConfig7+ + +setCBConfig(options: CBConfigOptions, callback: AsyncCallback): void + +设置小区广播配置,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------ | ---- | ------------ | +| options | [CBConfigOptions](#cbconfigoptions8) | 是 | 小区广播配置选项。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let cbConfigOptions = { + slotId = 0, + smsc = "test", + pdu = "xxxxxxxx", + status = 0 +}; +sms.setCBConfig(cbConfigOptions, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.setCBConfig7+ + +setCBConfig(options: CBConfigOptions): Promise + +设置小区广播配置,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------ | ---- | ------------ | +| options | [CBConfigOptions](#cbconfigoptions8) | 是 | 小区广播配置选项。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ----------------------------- | +| Promise<void> | 以Promise形式返回设置的结果。 | + +**示例:** + +```js +let cbConfigOptions = { + slotId = 0, + smsc = "test", + pdu = "xxxxxxxx", + status = 0 +}; +let promise = sms.setCBConfig(cbConfigOptions); +promise.then(data => + console.log(`setCBConfig success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`setCBConfig fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.getSmsSegmentsInfo8+ + +getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean, callback: AsyncCallback): void + +获取短信段信息,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------------------------------------------ | ---- | ----------------------------------------- | +| slotId | number | 是 | SIM卡槽ID:
- 0:卡槽1
- 1:卡槽2 | +| message | string | 是 | 消息 | +| force7bit | boolean | 是 | 是否使用7bit编码 | +| callback | AsyncCallback<[SmsSegmentsInfo](#<smssegmentsinfo8)> | 是 | 回调函数 | + +**示例:** + +```js +let slotId = 0; +sms.getSmsSegmentsInfo(slotId, "message", false, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.getSmsSegmentsInfo8+ + +getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean): Promise + +获取短信段信息,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------- | ---- | ----------------------------------------- | +| slotId | number | 是 | SIM卡槽ID:
- 0:卡槽1
- 1:卡槽2 | +| message | string | 是 | 消息 | +| force7bit | boolean | 是 | 是否使用7bit编码 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------- | ----------------------------- | +| Promise<[SmsSegmentsInfo](#<smssegmentsinfo8)> | 以Promise形式返回短信段信息。 | + +**示例:** + +```js +let slotId = 0; +let promise = sms.getSmsSegmentsInfo(slotId, "message", false); +promise.then(data => + console.log(`getSmsSegmentsInfo success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getSmsSegmentsInfo fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.isImsSmsSupported8+ + +isImsSmsSupported(callback: AsyncCallback): void + +如果IMS已注册并且在IMS上支持SMS,则支持通过IMS发送SMS,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | ---------- | +| callback | AsyncCallback<boolean> | 是 | 回调函数。 | + +**示例:** + +```js +sms.isImsSmsSupported((err, data) => { + console.log(`callback: err->${JSON.(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.isImsSmsSupported8+ + +isImsSmsSupported(): Promise + +如果IMS已注册并且在IMS上支持SMS,则支持通过IMS发送SMS,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**返回值:** + +| 类型 | 说明 | +| ---------------------- | ----------------------- | +| Promise<boolean> | 以Promise形式返回结果。 | + +**示例:** + +```js +let promise = sms.isImsSmsSupported(); +promise.then(data => { + console.log(`isImsSmsSupported success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`isImsSmsSupported fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.getImsShortMessageFormat8+ + +getImsShortMessageFormat(callback: AsyncCallback): void + +获取IMS上支持的SMS格式,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------- | ---- | ---------- | +| callback | AsyncCallback<string> | 是 | 回调函数。 | + +**示例:** + +```js +sms.getImsShortMessageFormat((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.getImsShortMessageFormat8+ + +getImsShortMessageFormat(): Promise + +获取IMS上支持的SMS格式,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**返回值:** + +| 类型 | 说明 | +| --------------------- | -------------------------- | +| Promise<string> | 以Promise形式返回SMS格式。 | + +**示例:** + +```js +let promise = sms.getImsShortMessageFormat(); +promise.then(data => { + console.log(`getImsShortMessageFormat success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getImsShortMessageFormat fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.decodeMms8+ + +decodeMms(mmsFilePathName: string | Array, callback: AsyncCallback): void + +彩信解码,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | ------------------------------------------------------- | ---- | -------------- | +| mmsFilePathName | string \|Array | 是 | 彩信文件路径名 | +| callback | AsyncCallback<[MmsInformation](#mmsinformation8)> | 是 | 回调函数。 | + +**示例:** + +```js +let mmsFilePathName = "filename"; +sms.decodeMms(mmsFilePathName, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.decodeMms8+ + +decodeMms(mmsFilePathName: string | Array): Promise + +彩信解码,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | ----------------------- | ---- | -------------- | +| mmsFilePathName | string \|Array | 是 | 彩信文件路径名 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------------------------------- | --------------------------- | +| Promise<<[MmsInformation](#mmsinformation8)>> | 以Promise形式返回彩信信息。 | + +**示例:** + +```js +let mmsFilePathName = "filename"; +let promise = sms.getSmscAddr(mmsFilePathName); +promise.then(data => { + console.log(`decodeMms success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`decodeMms fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.encodeMms8+ + +encodeMms(mms: MmsInformation, callback: AsyncCallback>): void + +彩信编码,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------- | ---- | ---------- | +| mms | [MmsInformation](#mmsinformation8) | 是 | 彩信信息。 | +| callback | AsyncCallback<Array> | 是 | 回调函数。 | + +**示例:** + +```js +let mmsAcknowledgeInd = { + transactionId = "100", + version = 0x10, + reportAllowed = 128 +}; +let mmsInformation = { + messageType = 133, + mmsType = mmsAcknowledgeInd +}; +sms.encodeMms(mmsInformation, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.encodeMms8+ + +encodeMms(mms: MmsInformation): Promise> + +彩信编码,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------------------------------- | ---- | ---------- | +| mms | [MmsInformation](#mmsinformation8) | 是 | 彩信信息。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------- | ----------------------------------- | +| Promise<Array> | 以Promise形式返回彩信编码后的结果。 | + +**示例:** + +```js +let mmsAcknowledgeInd = { + transactionId = "100", + version = 0x10, + reportAllowed = 128 +}; +let mmsInformation = { + messageType = 133, + mmsType = mmsAcknowledgeInd +}; +let promise = sms.encodeMms(mmsInformation); +promise.then(data => { + console.log(`encodeMms success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`encodeMms fail, promise: err->${JSON.stringify(err)}`); +}); +``` + ## ShortMessage 短信实例。 @@ -463,4 +1196,422 @@ console.log(`hasSmsCapability: ${JSON.stringify(result)}`); | SEND_SMS_SUCCESS | 0 | 发送短信成功。 | | SEND_SMS_FAILURE_UNKNOWN | 1 | 发送短信失败,原因未知。 | | SEND_SMS_FAILURE_RADIO_OFF | 2 | 发送短信失败,原因为调制解调器关机。 | -| SEND_SMS_FAILURE_SERVICE_UNAVAILABLE | 3 | 发送短信失败,原因为网络不可用、不支持发送或接收短信。 | \ No newline at end of file +| SEND_SMS_FAILURE_SERVICE_UNAVAILABLE | 3 | 发送短信失败,原因为网络不可用、不支持发送或接收短信。 | + +## MmsInformation8+ + +彩信信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------------------------------------------------------------ | ---- | --------- | +| messageType | [MessageType](#messagetype8) | 是 | 消息类型 | +| mmsType | [MmsSendReq](#mmssendreq8) \|[MmsSendConf](#mmssendconf8) \|[MmsNotificationInd](#mmsnotificationind8) \|[MmsRespInd](#mmsrespind8) \|[MmsRetrieveConf](#mmsretrieveconf8)\|[MmsAcknowledgeInd](#mmsacknowledgeind8)\|[MmsDeliveryInd](#mmsdeliveryind8)\|[MmsReadOrigInd](#mmsreadorigInd8)\|[MmsReadRecInd](#mmsreadorigind8) | 是 | pdu头类型 | +| attachment | Array<[MmsAttachment](#mmsattachment8)\> | 否 | 附件 | + +## MmsSendReq8+ + +彩信发送请求。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ---------------- | ------------------------------------ | ---- | ------------ | +| from | [MmsAddress](#mmsaddress8) | 是 | 彩信来源 | +| transactionId | string | 是 | 事务ID | +| contentType | string | 是 | 内容类型 | +| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 | +| to | Array<[MmsAddress](#mmsaddress8)\> | 否 | 发送至 | +| date | number | 否 | 日期 | +| cc | Array<[MmsAddress](#mmsaddress8)\> | 否 | 抄送 | +| bcc | Array<[MmsAddress](#mmsaddress8)\> | 否 | 暗抄送 | +| subject | string | 否 | 主题 | +| messageClass | number | 否 | 消息类 | +| expiry | number | 否 | 到期 | +| priority | [MmsPriorityType](#mmsprioritytype8) | 否 | 优先 | +| senderVisibility | number | 否 | 发件人可见性 | +| deliveryReport | number | 否 | 交付报告 | +| readReport | number | 否 | 阅读报告 | + +## MmsSendConf8+ + +彩信发送配置。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ------------- | ---------------------------------- | ---- | -------- | +| responseState | number | 是 | 响应状态 | +| transactionId | string | 是 | 事务ID | +| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 | +| messageId | string | 否 | 消息ID | + +## MmsNotificationInd8+ + +彩信通知索引。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | ---------------------------------- | ---- | -------- | +| transactionId | string | 是 | 事务ID | +| messageClass | number | 是 | 消息类 | +| messageSize | number | 是 | 消息大小 | +| expiry | number | 是 | 到期 | +| contentLocation | string | 是 | 内容位置 | +| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 | +| from | [MmsAddress](#mmsaddress8) | 否 | 来源 | +| subject | string | 否 | 主题 | +| deliveryReport | number | 否 | 状态报告 | +| contentClass | number | 否 | 内容类 | + +## MmsAcknowledgeInd8+ + +彩信确认索引。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ------------- | ---------------------------------- | ---- | -------- | +| transactionId | string | 是 | 事务ID | +| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 | +| reportAllowed | [ReportType](#reporttype8) | 否 | 允许报告 | + +## MmsRetrieveConf8+ + +彩信检索配置。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | ------------------------------------ | ---- | -------- | +| transactionId | string | 是 | 事务ID | +| messageId | string | 是 | 消息ID | +| date | number | 是 | 日期 | +| contentType | string | 是 | 内容类型 | +| to | Array<[MmsAddress](#mmsaddress8)\> | 是 | 发送至 | +| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 | +| from | [MmsAddress](#mmsaddress8) | 否 | 来源 | +| cc | Array<[MmsAddress](#mmsaddress8)\> | 否 | 抄送 | +| subject | string | 否 | 主题 | +| priority | [MmsPriorityType](#mmsPrioritytype8) | 否 | 优先级 | +| deliveryReport | number | 否 | 状态报告 | +| readReport | number | 否 | 阅读报告 | +| retrieveStatus | number | 否 | 检索状态 | +| retrieveText | string | 否 | 检索文本 | + +## MmsReadOrigInd8+ + +彩信读取原始索引。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ---------------------------------- | ---- | -------- | +| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 | +| messageId | string | 是 | 消息ID | +| to | Array<[MmsAddress](#mmsaddress8)\> | 是 | 发送至 | +| from | [MmsAddress](#mmsaddress8) | 是 | 来源 | +| date | number | 是 | 日期 | +| readStatus | number | 是 | 阅读状态 | + +## MmsAttachment8+ + +彩信附件。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ----------------------- | ------------------------------------ | ---- | ------------------ | +| contentId | string | 是 | 内容ID | +| contentLocation | string | 是 | 内容位置 | +| contentDisposition | [DispositionType](#dispositiontype8) | 是 | 内容处理 | +| contentTransferEncoding | string | 是 | 内容传输编码 | +| contentType | string | 是 | 内容类型 | +| isSmil | boolean | 是 | 同步多媒体集成语言 | +| path | string | 否 | 路径 | +| inBuff | Array | 否 | 缓冲区中 | +| fileName | string | 否 | 文件名 | +| charset | [MmsCharSets](#mmscharsets8) | 否 | 字符集 | + +## MmsAddress8+ + +彩信地址。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ---------------------------- | ---- | ------ | +| address | string | 是 | 地址 | +| charset | [MmsCharSets](#mmscharsets8) | 是 | 字符集 | + +## MessageType8+ + +消息类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| ------------------------- | ---- | -------------------- | +| TYPE_MMS_SEND_REQ | 128 | 彩信发送请求类型 | +| TYPE_MMS_SEND_CONF | 129 | 彩信发送配置类型 | +| TYPE_MMS_NOTIFICATION_IND | 130 | 彩信通知索引类型 | +| TYPE_MMS_RESP_IND | 131 | 彩信回复索引类型 | +| TYPE_MMS_RETRIEVE_CONF | 132 | 彩信检索配置类型 | +| TYPE_MMS_ACKNOWLEDGE_IND | 133 | 彩信确认索引类型 | +| TYPE_MMS_DELIVERY_IND | 134 | 彩信传送索引类型 | +| TYPE_MMS_READ_REC_IND | 135 | 彩信读取接收索引类型 | +| TYPE_MMS_READ_ORIG_IND | 136 | 彩信读取原始索引类型 | + +## MmsPriorityType8+ + +彩信优先级类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| ---------- | ---- | -------------- | +| MMS_LOW | 128 | 彩信优先级低 | +| MMS_NORMAL | 129 | 彩信优先级正常 | +| MMS_HIGH | 130 | 彩信优先级高 | + +## MmsVersionType8+ + +彩信版本类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| --------------- | ---- | ----------- | +| MMS_VERSION_1_0 | 0x10 | 彩信版本1_0 | +| MMS_VERSION_1_1 | 0x11 | 彩信版本1_1 | +| MMS_VERSION_1_2 | 0x12 | 彩信版本1_2 | +| MMS_VERSION_1_3 | 0x13 | 彩信版本1_3 | + +## MmsCharSets8+ + +彩信字符集。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| --------------- | ------ | ------------------- | +| BIG5 | 0X07EA | BIG5格式 | +| ISO_10646_UCS_2 | 0X03E8 | ISO_10646_UCS_2格式 | +| ISO_8859_1 | 0X04 | ISO_8859_1格式 | +| ISO_8859_2 | 0X05 | ISO_8859_2格式 | +| ISO_8859_3 | 0X06 | ISO_8859_3格式 | +| ISO_8859_4 | 0X07 | ISO_8859_4格式 | +| ISO_8859_5 | 0X08 | ISO_8859_5格式 | +| ISO_8859_6 | 0X09 | ISO_8859_6格式 | +| ISO_8859_7 | 0X0A | ISO_8859_7格式 | +| ISO_8859_8 | 0X0B | ISO_8859_8格式 | +| ISO_8859_9 | 0X0C | ISO_8859_9格式 | +| SHIFT_JIS | 0X11 | SHIFT_JIS格式 | +| US_ASCII | 0X03 | US_ASCII格式 | +| UTF_8 | 0X6A | UTF_8格式 | + +## DispositionType8+ + +处理类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| ---------- | ---- | -------- | +| FROM_DATA | 0 | 数据来源 | +| ATTACHMENT | 1 | 附件 | +| INLINE | 2 | 内联 | + +## ReportType8+ + +报告类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| ------- | ---- | ---- | +| MMS_YES | 128 | YES | +| MMS_NO | 129 | NO | + +## CBConfigOptions8+ + +小区广播配置选项。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | -------------------- | ---- | ------------ | +| slotId | number | 是 | 卡槽ID | +| enable | boolean | 是 | 可行 | +| startMessageId | number | 是 | 消息起始ID | +| endMessageId | number | 是 | 消息结束ID | +| ranType | [RanType](#rantype7) | 是 | 设备网络制式 | + +## SimMessageStatus7+ + +SIM卡消息状态。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| ------------------------- | ---- | --------------------------- | +| SIM_MESSAGE_STATUS_FREE | 0 | SIM卡上的状态可用空间 | +| SIM_MESSAGE_STATUS_READ | 1 | 消息已读状态 | +| SIM_MESSAGE_STATUS_UNREAD | 3 | 消息未读状态 | +| SIM_MESSAGE_STATUS_SENT | 5 | 存储发送消息(仅适用于SMS) | +| SIM_MESSAGE_STATUS_UNSENT | 7 | 储未发送消息(仅适用于SMS) | + +## RanType7+ + +设备网络制式。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| --------- | ---- | ---- | +| TYPE_GSM | 1 | GSM | +| TYPE_CDMA | 2 | CMDA | + +## SmsEncodingScheme8+ + +短信编码方案。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| -------------------- | ---- | ------------ | +| SMS_ENCODING_UNKNOWN | 0 | 未知短信编码 | +| SMS_ENCODING_7BIT | 1 | 7位短信编码 | +| SMS_ENCODING_8BIT | 2 | 8位短信编码 | +| SMS_ENCODING_16BIT | 3 | 16位短信编码 | + +## SimMessageOptions7+ + +SIM卡消息选项。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | -------------------------------------- | ---- | -------------- | +| slotId | number | 是 | 卡槽ID | +| smsc | string | 是 | 短消息业务中心 | +| pdu | string | 是 | 协议数据单元 | +| status | [SimMessageStatus](#simmessagestatus7) | 是 | 状态 | + +## UpdateSimMessageOptions7+ + +更新SIM卡消息选项。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | -------------------------------------- | ---- | -------------- | +| slotId | number | 是 | 卡槽ID | +| msgIndex | number | 是 | 消息索引 | +| newStatus | [SimMessageStatus](#simmessagestatus7) | 是 | 新状态 | +| pdu | string | 是 | 协议数据单元 | +| smsc | string | 是 | 短消息业务中心 | + +## SimShortMessage8+ + +SIM卡短消息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ---------------- | -------------------------------------- | ---- | ------------- | +| shortMessage | [ShortMessage](#shortmessage) | 是 | 短消息 | +| simMessageStatus | [SimMessageStatus](#simmessagestatus7) | 是 | SIM卡消息状态 | +| indexOnSim | number | 是 | SIM卡索引 | + +## MmsDeliveryInd8+ + +彩信发送标识。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ---------------------------------- | ---- | ------ | +| messageId | string | 是 | 消息ID | +| date | number | 是 | 日期 | +| to | Array<[MmsAddress](#mmsaddress8)\> | 是 | 发送至 | +| status | number | 是 | 状态 | +| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 | + +## MmsRespInd8+ + +彩信回复标志。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ------------- | ---------------------------------- | ---- | -------- | +| transactionId | string | 是 | 事件ID | +| status | number | 是 | 状态 | +| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 | +| reportAllowed | [ReportType](#reporttype8) | 否 | 允许报告 | + +## SmsSegmentsInfo8+ + +短信段信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| -------------------- | ---------------------------------------- | ---- | ------------ | +| splitCount | number | 是 | 拆分计数 | +| encodeCount | number | 是 | 编码计数 | +| encodeCountRemaining | number | 是 | 剩余编码计数 | +| scheme | [SmsEncodingScheme](#smsencodingscheme8) | 是 | 短信编码方案 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-storage-statistics.md b/zh-cn/application-dev/reference/apis/js-apis-storage-statistics.md index be091dacdebc8dd1b1d944c01af095c0b57f5625..11c4b540ab18a6092fbfa12a795c70589426c23c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-storage-statistics.md +++ b/zh-cn/application-dev/reference/apis/js-apis-storage-statistics.md @@ -264,14 +264,13 @@ getCurrentBundleStats(callback: AsyncCallback<BundleStats>): void ## BundleStats9+ +### 属性 + **系统能力**:以下各项对应的系统能力均为SystemCapability.FileManagement.StorageService.SpatialStatistics 该接口为系统接口,三方应用不支持调用 - -### 属性 - | 名称 | 类型 | 说明 | | --------- | ------ | -------------- | | appSize | number | app数据大小 | @@ -470,7 +469,7 @@ getUserStorageStats(userId? : number): Promise<StorageStats> | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------ | ---- | ---- | - | userId | string | 否 | 用户id
确认当前用户:
- 有值:表示指定用户。
- 无值:表示当前用户。| + | userId | number | 否 | 用户id
确认当前用户:
- 有值:表示指定用户。
- 无值:表示当前用户。| **返回值:** @@ -481,7 +480,7 @@ getUserStorageStats(userId? : number): Promise<StorageStats> **示例:** ```js - let userId = ""; + let userId = 1; storageStatistics.getUserStorageStats(userId).then(function(StorageStats){ console.info("getUserStorageStats successfully:"+ JSON.stringify(StorageStats)); }).catch(function(err){ @@ -507,13 +506,13 @@ getUserStorageStats(userId: number, callback:AsyncCallback<StorageStats>): | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------------------------------------ | ---- | -------------------------- | - | userId | string | 否 | 用户id
确认当前用户:
- 有值:表示指定用户。
- 无值:表示当前用户。 | + | userId | number | 否 | 用户id
确认当前用户:
- 有值:表示指定用户。
- 无值:表示当前用户。 | | callback | callback:AsyncCallback<[StorageStats](#StorageStats)> | 是 | 返回各类别数据大小之后的回调 | **示例:** ```js - let userId = ""; + let userId = 1; storageStatistics.getUserStorageStats(userId, function(error, StorageStats){ // do something console.info("getUserStorageStats successfully:"+ JSON.stringify(StorageStats)); @@ -523,14 +522,13 @@ getUserStorageStats(userId: number, callback:AsyncCallback<StorageStats>): ## StorageStats9+ +### 属性 + **系统能力**:以下各项对应的系统能力均为SystemCapability.FileManagement.StorageService.SpatialStatistics 该接口为系统接口,三方应用不支持调用 - -### 属性 - | 名称 | 类型 | 说明 | | --------- | ------ | -------------- | | total | number | 内卡总空间大小 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-telephony-data.md b/zh-cn/application-dev/reference/apis/js-apis-telephony-data.md index 0f1a07079c2d53227453da012f062e686683c2ae..c6b5f4294595552bea4d4ba1a3ec08e90abe4e55 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-telephony-data.md +++ b/zh-cn/application-dev/reference/apis/js-apis-telephony-data.md @@ -328,6 +328,240 @@ promise.then((data) => { }); ``` +## data.enableCellularData + +enableCellularData(callback: AsyncCallback): void + +启用蜂窝数据服务,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ---------- | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +data.enableCellularData((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## data.enableCellularData + +enableCellularData(): Promise + +启用蜂窝数据服务,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------- | +| Promise\ | 以Promise形式返回结果。 | + +**示例:** + +```js +let promise = data.enableCellularData(); +promise.then((data) => { + console.log(`enableCellularData success, promise: data->${JSON.stringify(data)}`); +}).catch((err) => { + console.error(`enableCellularData fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## data.disableCellularData + +disableCellularData(callback: AsyncCallback): void + +禁用蜂窝数据服务,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ---------- | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +data.disableCellularData((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## data.disableCellularData + +disableCellularData(): Promise + +禁用蜂窝数据服务,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**返回值:** + +| 类型 | 说明 | +| --------------- | --------------------------- | +| Promise\ | 以Promise形式返回禁用结果。 | + +**示例:** + +```js +let promise = data.disableCellularData(); +promise.then((data) => { + console.log(`disableCellularData success, promise: data->${JSON.stringify(data)}`); +}).catch((err) => { + console.error(`disableCellularData fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## data.enableCellularDataRoaming + +enableCellularDataRoaming(slotId: number, callback: AsyncCallback): void + +启用蜂窝数据漫游,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ---------------------------------------- | +| slotId | number | 是 | 卡槽ID。
0:卡槽1。
1:卡槽2。 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +data.enableCellularDataRoaming(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## data.enableCellularDataRoaming + +enableCellularDataRoaming(slotId: number): Promise + +启用蜂窝数据漫游,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ---------------------------------------- | +| slotId | number | 是 | 卡槽ID。
0:卡槽1。
1:卡槽2。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ------------------------- | +| Promise\ | 以Promise形式返回启用结果 | + +**示例:** + +```js +let promise = data.enableCellularDataRoaming(0); +promise.then((data) => { + console.log(`enableCellularDataRoaming success, promise: data->${JSON.stringify(data)}`); +}).catch((err) => { + console.error(`enableCellularDataRoaming fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## data.disableCellularDataRoaming + +disableCellularDataRoaming(slotId: number, callback: AsyncCallback): void + +禁用蜂窝数据漫游,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ---------------------------------------- | +| slotId | number | 是 | 卡槽ID。
0:卡槽1。
1:卡槽2。 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +data.disableCellularDataRoaming(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## data.disableCellularDataRoaming + +disableCellularDataRoaming(slotId: number): Promise + +禁用蜂窝数据漫游,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ---------------------------------------- | +| slotId | number | 是 | 卡槽ID。
0:卡槽1。
1:卡槽2。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ------------------------- | +| Promise\ | 以Promise形式返回禁用结果 | + +**示例:** + +```js +let promise = data.disableCellularDataRoaming(0); +promise.then((data) => { + console.log(`disableCellularDataRoaming success, promise: data->${JSON.stringify(data)}`); +}).catch((err) => { + console.error(`disableCellularDataRoaming fail, promise: err->${JSON.stringify(err)}`); +}); +``` + ## DataFlowType 描述蜂窝数据流类型。 @@ -354,4 +588,4 @@ promise.then((data) => { | DATA_STATE_DISCONNECTED | 0 | 表示蜂窝数据链路断开。 | | DATA_STATE_CONNECTING | 1 | 表示正在连接蜂窝数据链路。 | | DATA_STATE_CONNECTED | 2 | 表示蜂窝数据链路已连接。 | -| DATA_STATE_SUSPENDED | 3 | 表示蜂窝数据链路被挂起。 | \ No newline at end of file +| DATA_STATE_SUSPENDED | 3 | 表示蜂窝数据链路被挂起。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-timer.md b/zh-cn/application-dev/reference/apis/js-apis-timer.md index 9d26cf336b486374ad7e186807e19ee3bc82c065..1f11fe61e752a418a745e7950b0f450d55919d41 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-timer.md +++ b/zh-cn/application-dev/reference/apis/js-apis-timer.md @@ -3,13 +3,6 @@ ## setTimeout -## 导入模块 - - -``` -import Time from '@ohos.Time'; -``` - setTimeout(handler[,delay[,…args]]): number 设置一个定时器,该定时器在定时器到期后执行一个函数。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-uiappearance.md b/zh-cn/application-dev/reference/apis/js-apis-uiappearance.md index f4e5de83987e675bc8c5d262ee40326aea132b29..28402007b002e0f214060f8dc9a629d2d042a311 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-uiappearance.md +++ b/zh-cn/application-dev/reference/apis/js-apis-uiappearance.md @@ -3,7 +3,9 @@ 用户界面外观提供管理系统外观的一些基础能力,目前仅包括深浅色模式配置。 > **说明:** +> > 从API Version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> > 本模块接口为系统接口。 @@ -19,6 +21,8 @@ import uiAppearance from '@ohos.uiAppearance' 深色模式枚举。 +**系统能力:** SystemCapability.ArkUI.UiAppearance + | 名称 | 值 | 说明 | | -- | -- | -- | | ALWAYS_DARK | 0 | 系统始终为深色。 | @@ -31,9 +35,9 @@ setDarkMode(mode: DarkMode, callback: AsyncCallback\): void 设置系统深色模式。 -**需要权限:** ohos.permission.UPDATE_CONFIGRATION +**需要权限:** ohos.permission.UPDATE_CONFIGURATION -**系统能力:** SystemCapability.ArkUI.ArkUI.Full +**系统能力:** SystemCapability.ArkUI.UiAppearance **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -55,15 +59,21 @@ setDarkMode(mode: DarkMode): Promise\; 设置系统深色模式。 -**需要权限:** ohos.permission.UPDATE_CONFIGRATION +**需要权限:** ohos.permission.UPDATE_CONFIGURATION -**系统能力:** SystemCapability.ArkUI.ArkUI.Full +**系统能力:** SystemCapability.ArkUI.UiAppearance **参数:** | 参数名 | 类型 | 必填 | 说明 | | -- | -- | -- | -- | | mode | [DarkMode](#darkmode) | 是 | 指定系统深色模式配置 | +**返回值:** + +| 类型 | 说明 | +| ------ | ------------------------------ | +| Promise\ | Promise对象。无返回结果的Promise对象。| + **示例:** ```ts uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { @@ -80,9 +90,9 @@ getDarkMode(): DarkMode; 获取当前的深色模式配置。 -**需要权限:** ohos.permission.UPDATE_CONFIGRATION +**需要权限:** ohos.permission.UPDATE_CONFIGURATION -**系统能力:** SystemCapability.ArkUI.ArkUI.Full +**系统能力:** SystemCapability.ArkUI.UiAppearance **返回值:** | 类型 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-uitest.md b/zh-cn/application-dev/reference/apis/js-apis-uitest.md index d94ecac6cf12011a7186b22fdd07a6b0c561d406..1d2473acf732f7cf587cd434dcf3661d435bd274 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-uitest.md +++ b/zh-cn/application-dev/reference/apis/js-apis-uitest.md @@ -408,6 +408,8 @@ UiTest中,UiComponent类代表了UI界面上的一个控件,提供控件属 坐标点信息。 +**系统能力**:SystemCapability.Test.UiTest + | 名称 | 参数类型 | 可读 | 可写 | 描述 | | ---- | -------- | ---- | ---- | ---------------- | | X | number | 是 | 否 | 坐标点的横坐标。 | @@ -417,6 +419,8 @@ UiTest中,UiComponent类代表了UI界面上的一个控件,提供控件属 控件的边框信息。 +**系统能力**:SystemCapability.Test.UiTest + | 名称 | 参数类型 | 可读 | 可写 | 描述 | | ------- | -------- | ---- | ---- | ------------------------- | | leftX | number | 是 | 否 | 控件边框的左上角的X坐标。 | @@ -1281,7 +1285,7 @@ async function demo() { ### triggerCombineKeys9+ -triggerCombineKeys(key0: number, key1: number, key2: number): Promise\ +triggerCombineKeys(key0: number, key1: number, key2?: number): Promise\ UiDriver对象通过给定的key值,找到对应组合键并点击。例如,Key值为(2072, 2019)时,UiDriver对象找到组合键并点击ctrl+c。 @@ -1469,7 +1473,7 @@ UiTest中,UiWindow类代表了UI界面上的一个窗口,提供窗口属性 窗口的标志属性信息。 -**系统能力**:SystemCapability.Test.UiTest +**系统能力**:SystemCapability.Test.UiTest | 名称 | 参数类型 | 必填 | 可读 | 可写 | 描述 | | ---------- | -------- | ---- | ---- | ---- | -------------------------- | @@ -1833,7 +1837,7 @@ async function demo() { 控件属性支持的匹配模式。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Test.UiTest +**系统能力**:SystemCapability.Test.UiTest | 名称 | 值 | 说明 | | ----------- | ---- | -------------- | @@ -1846,6 +1850,8 @@ async function demo() { 窗口调整大小的方向。 +**系统能力**:SystemCapability.Test.UiTest + | 名称 | 说明 | | ---------- | -------- | | LEFT | 左方。 | @@ -1859,6 +1865,8 @@ async function demo() { ## WindowMode9+ +**系统能力**:SystemCapability.Test.UiTest + 窗口的窗口模式。 | 名称 | 说明 | @@ -1866,4 +1874,4 @@ async function demo() { | FULLSCREEN | 全屏模式。 | | PRIMARY | 主窗口。 | | SECONDARY | 第二窗口。 | -| FLOAT | 浮动窗口。 | +| FLOATING | 浮动窗口。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-update.md b/zh-cn/application-dev/reference/apis/js-apis-update.md index 15a198a2c780b9419d8fee05e4dc997c8443afa1..58e88f5c8dadcda4f1a5f41bbff9ef786381ab51 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-update.md +++ b/zh-cn/application-dev/reference/apis/js-apis-update.md @@ -1,9 +1,5 @@ # 升级 -> **说明:** -> -> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 - 升级范围:升级整个系统,包括内置的资源、预置应用;第三方的应用不在升级的范围。 升级依赖:升级分为SD卡升级和在线升级两种。 @@ -11,6 +7,12 @@ - SD卡升级依赖升级包和SD卡安装。 - 在线升级依赖设备厂商部署的用于管理升级包的服务器。服务器由设备厂商部署,IP由调用者传入,请求的request接口是固定的,由设备厂商开发。 +> **说明:** +> +> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> +> 本模块接口为系统接口。 + ## 导入模块 ```js @@ -209,6 +211,88 @@ updater.getNewVersionInfo().then(info => { }); ``` +### getNewVersionDescription + +getNewVersionDescription(versionDigestInfo: VersionDigestInfo, descriptionOptions: DescriptionOptions, callback: AsyncCallback\>): void + +获取新版本描述文件。使用callback异步回调。 + +**系统能力**:SystemCapability.Update.UpdateService + +**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | --------- | +| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | 是 | 版本摘要信息 | +| descriptionOptions | [DescriptionOptions](#descriptionoptions) | 是 | 描述文件选项 | +| callback | AsyncCallback\>) | 是 | 回调函数,返回新版本描述文件 | + +**示例:** + +``` +// 版本摘要信息 +var versionDigestInfo = { + versionDigest: "versionDigest" // 检测结果中的版本摘要信息 +} + +// 描述文件选项 +var descriptionOptions = { + format: DescriptionFormat.STANDARD, // 标准格式 + language: "zh-cn" // 中文 +} + +updater.getNewVersionDescription(versionDigestInfo, descriptionOptions, (err, info) => { + console.log(`getNewVersionDescription info ${JSON.stringify(info)}`); + console.log(`getNewVersionDescription err ${JSON.stringify(err)}`); +}); +``` + +### getNewVersionDescription + +getNewVersionDescription(versionDigestInfo: VersionDigestInfo, descriptionOptions: DescriptionOptions): Promise\>; + +获取新版本描述文件。使用Promise异步回调。 + +**系统能力**:SystemCapability.Update.UpdateService + +**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | --------- | +| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | 是 | 版本摘要信息 | +| descriptionOptions | [DescriptionOptions](#descriptionoptions) | 是 | 描述文件选项 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------- | ---------------- | +| Promise\> | Promise对象,返回新版本描述文件 | + +**示例:** + +``` +// 版本摘要信息 +var versionDigestInfo = { + versionDigest: "versionDigest" // 检测结果中的版本摘要信息 +} + +// 描述文件选项 +var descriptionOptions = { + format: DescriptionFormat.STANDARD, // 标准格式 + language: "zh-cn" // 中文 +} + +updater.getNewVersionDescription(versionDigestInfo, descriptionOptions).then(info => { + console.log(`getNewVersionDescription promise info ${JSON.stringify(info)}`); +}).catch(err => { + console.log(`getNewVersionDescription promise error ${JSON.stringify(err)}`); +}); +``` + ### getCurrentVersionInfo getCurrentVersionInfo(callback: AsyncCallback\): void @@ -263,6 +347,76 @@ updater.getCurrentVersionInfo().then(info => { }); ``` +### getCurrentVersionDescription + +getCurrentVersionDescription(descriptionOptions: DescriptionOptions, callback: AsyncCallback\>): void + +获取当前版本描述文件。使用callback异步回调。 + +**系统能力**:SystemCapability.Update.UpdateService + +**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | --------- | +| descriptionOptions | [DescriptionOptions](#descriptionoptions) | 是 | 描述文件选项 | +| callback | AsyncCallback\>) | 是 | 回调函数,返回当前版本描述文件 | + +**示例:** + +``` +// 描述文件选项 +var descriptionOptions = { + format: DescriptionFormat.STANDARD, // 标准格式 + language: "zh-cn" // 中文 +} + +updater.getCurrentVersionDescription(descriptionOptions, (err, info) => { + console.log(`getCurrentVersionDescription info ${JSON.stringify(info)}`); + console.log(`getCurrentVersionDescription err ${JSON.stringify(err)}`); +}); +``` + +### getCurrentVersionDescription + +getCurrentVersionDescription(descriptionOptions: DescriptionOptions): Promise\> + +获取当前版本描述文件。使用Promise异步回调。 + +**系统能力**:SystemCapability.Update.UpdateService + +**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | --------- | +| descriptionOptions | [DescriptionOptions](#descriptionoptions) | 是 | 描述文件选项 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------- | ---------------- | +| Promise\> | Promise对象,返回当前版本描述文件 | + +**示例:** + +``` +// 描述文件选项 +var descriptionOptions = { + format: DescriptionFormat.STANDARD, // 标准格式 + language: "zh-cn" // 中文 +} + +updater.getCurrentVersionDescription(descriptionOptions).then(info => { + console.log(`getCurrentVersionDescription promise info ${JSON.stringify(info)}`); +}).catch(err => { + console.log(`getCurrentVersionDescription promise error ${JSON.stringify(err)}`); +}); +``` + ### getTaskInfo getTaskInfo(callback: AsyncCallback\): void @@ -295,6 +449,8 @@ getTaskInfo(): Promise\ **系统能力**:SystemCapability.Update.UpdateService +**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限 + **返回值:** | 类型 | 说明 | @@ -339,7 +495,7 @@ var versionDigestInfo = { // 下载选项 var downloadOptions = { - allowNetwork: update.NetType.CELLULAR_AND_WIFI, // 允许所有网络下载 + allowNetwork: update.NetType.CELLULAR, // 允许数据网络下载 order: update.Order.DOWNLOAD // 下载 } updater.download(versionDigestInfo, downloadOptions, (err) => { @@ -380,7 +536,7 @@ var versionDigestInfo = { // 下载选项 var downloadOptions = { - allowNetwork: update.NetType.CELLULAR_AND_WIFI, // 允许所有网络下载 + allowNetwork: update.NetType.CELLULAR, // 允许数据网络下载 order: update.Order.DOWNLOAD // 下载 } updater.download(versionDigestInfo, downloadOptions).then(() => { @@ -418,7 +574,7 @@ var versionDigestInfo = { // 恢复下载选项 var resumeDownloadOptions = { - allowNetwork: update.NetType.CELLULAR_AND_WIFI, // 允许所有网络下载 + allowNetwork: update.NetType.CELLULAR, // 允许数据网络下载 } updater.resumeDownload(versionDigestInfo, resumeDownloadOptions, (err) => { console.log(`resumeDownload error ${JSON.stringify(err)}`); @@ -458,7 +614,7 @@ var versionDigestInfo = { // 恢复下载选项 var resumeDownloadOptions = { - allowNetwork: update.NetType.CELLULAR_AND_WIFI, // 允许所有网络下载 + allowNetwork: update.NetType.CELLULAR, // 允许数据网络下载 } updater.resumeDownload(versionDigestInfo, resumeDownloadOptions).then(value => { console.log(`resumeDownload start`); @@ -752,7 +908,7 @@ updater.getUpgradePolicy().then(policy => { ### setUpgradePolicy -setUpgradePolicy(policy: UpgradePolicy, callback: AsyncCallback\): void +setUpgradePolicy(policy: UpgradePolicy, callback: AsyncCallback\): void 设置升级策略。使用callback异步回调。 @@ -765,7 +921,7 @@ setUpgradePolicy(policy: UpgradePolicy, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ---------- | | policy | [UpgradePolicy](#upgradepolicy) | 是 | 升级策略 | -| callback | AsyncCallback\ | 是 | 回调函数,返回设置结果对象 | +| callback | AsyncCallback\ | 是 | 回调函数,返回设置结果对象 | **示例:** @@ -773,16 +929,16 @@ setUpgradePolicy(policy: UpgradePolicy, callback: AsyncCallback\): void let policy = { downloadStrategy: false, autoUpgradeStrategy: false, - autoUpgradeInterval: [ 120, 240 ], // 自动升级时间段,用分钟表示 + autoUpgradePeriods: [ { start: 120, end: 240 } ] // 自动升级时间段,用分钟表示 } -updater.setUpgradePolicy(policy, (err, value) => { - console.log(`setUpgradePolicy result: ${value?}`); +updater.setUpgradePolicy(policy, (err) => { + console.log(`setUpgradePolicy result: ${err}`); }); ``` ### setUpgradePolicy -setUpgradePolicy(policy: UpgradePolicy): Promise\ +setUpgradePolicy(policy: UpgradePolicy): Promise\ 设置升级策略。使用Promise异步回调。 @@ -800,7 +956,7 @@ setUpgradePolicy(policy: UpgradePolicy): Promise\ | 类型 | 说明 | | ---------------- | --------------- | -| Promise\ | Promise对象,返回设置结果对象。 | +| Promise\ | Promise对象,返回设置结果对象。 | **示例:** @@ -808,11 +964,11 @@ setUpgradePolicy(policy: UpgradePolicy): Promise\ let policy = { downloadStrategy: false, autoUpgradeStrategy: false, - autoUpgradeInterval: [ 120, 240 ], // 自动升级时间段,用分钟表示 + autoUpgradePeriods: [ { start: 120, end: 240 } ] // 自动升级时间段,用分钟表示 } -updater.setUpgradePolicy(policy).then(result => - console.log(`setUpgradePolicy &{result}`); -).catch(err => { +updater.setUpgradePolicy(policy).then(() => { + console.log(`setUpgradePolicy success`); +}).catch(err => { console.log(`setUpgradePolicy promise error ${JSON.stringify(err)}`); }); ``` @@ -849,6 +1005,8 @@ terminateUpgrade(): Promise\ **系统能力**:SystemCapability.Update.UpdateService +**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限 + **返回值:** | 类型 | 说明 | @@ -888,11 +1046,9 @@ var eventClassifyInfo = { extraInfo: "" } -function onTaskUpdate(eventInfo): void { - console.log(`on eventInfo id `, eventInfo.eventId); -} - -updater.on(eventClassifyInfo, onTaskUpdate); +updater.on(eventClassifyInfo, (eventInfo) => { + console.log("updater on " + JSON.stringify(eventInfo)); +}); ``` ### off @@ -917,11 +1073,9 @@ var eventClassifyInfo = { extraInfo: "" } -function onTaskUpdate(eventInfo): void { - console.log(`on eventInfo id `, eventInfo.eventId); -} - -updater.off(eventClassifyInfo, onTaskUpdate); +updater.off(eventClassifyInfo, (eventInfo) => { + console.log("updater off " + JSON.stringify(eventInfo)); +}); ``` ## Restorer @@ -980,7 +1134,7 @@ restorer.factoryReset().then(() => { ### verifyUpgradePackage -verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string, callback: AsyncCallback\): void +verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string, callback: AsyncCallback\): void 校验升级包。使用callback异步回调。 @@ -994,7 +1148,7 @@ verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string, callback: Asyn | -------- | ---------------------------------------- | ---- | --------- | | upgradeFile | [UpgradeFile](#upgradefile) | 是 | 升级文件 | | certsFile | string | 是 | 证书文件路径 | -| callback | AsyncCallback\ | 是 | 回调函数,返回升级包校验结果对象 | +| callback | AsyncCallback\ | 是 | 回调函数,返回升级包校验结果对象 | **示例:** @@ -1004,14 +1158,14 @@ var upgradeFile = { filePath: "path" // 本地升级包路径 } -localUpdater.verifyUpgradePackage(upgradeFile, "cerstFilePath", (err, result) => { +localUpdater.verifyUpgradePackage(upgradeFile, "cerstFilePath", (err) => { console.log(`factoryReset error ${JSON.stringify(err)}`); }); ``` ### verifyUpgradePackage -verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string): Promise\ +verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string): Promise\ 校验升级包。使用Promise异步回调。 @@ -1030,7 +1184,7 @@ verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string): Promise\ | Promise对象,返回升级包校验结果对象。 | +| Promise\ | Promise对象,返回升级包校验结果对象。 | **示例:** @@ -1039,8 +1193,8 @@ var upgradeFile = { fileType: update.ComponentType.OTA, // OTA包 filePath: "path" // 本地升级包路径 } -localUpdater.verifyUpgradePackage(upgradeFile, "cerstFilePath").then(result => { - console.log(`verifyUpgradePackage result: ${result}`); +localUpdater.verifyUpgradePackage(upgradeFile, "cerstFilePath").then(() => { + console.log(`verifyUpgradePackage success`); }).catch(err => { console.log(`verifyUpgradePackage error ${JSON.stringify(err)}`); }); @@ -1095,7 +1249,7 @@ applyNewVersion(upgradeFiles: Array<[UpgradeFile](#upgradefile)>): Promise\ { @@ -1225,6 +1379,7 @@ localUpdater.off(eventClassifyInfo, onTaskUpdate); | 名称 | 参数类型 | 必填 | 说明 | | ------------------- | --------------------------- | ---- | ------- | +| componentId | number | 是 | 组件标识 | | componentType | [ComponentType](#componentyype) | 是 | 组件类型 | | upgradeAction | [UpgradeAction](#upgradeaction) | 是 | 升级方式 | | displayVersion | string | 是 | 显示版本号 | @@ -1233,6 +1388,28 @@ localUpdater.off(eventClassifyInfo, onTaskUpdate); | effectiveMode | [EffectiveMode](#effectivemode) | 是 | 生效模式 | | descriptionInfo | [DescriptionInfo](#descriptioninfo) | 是 | 版本描述文件信息 | +## DescriptionOptions + +描述文件选项。 + +**系统能力**:SystemCapability.Update.UpdateService + +| 名称 | 参数类型 | 必填 | 说明 | +| ------------------- | --------------------------- | ---- | ------- | +| format | [DescriptionFormat](#descriptionformat) | 是 | 描述文件格式 | +| language | string | 是 | 描述文件语言 | + +## ComponentDescription + +组件描述文件。 + +**系统能力**:SystemCapability.Update.UpdateService + +| 名称 | 参数类型 | 必填 | 说明 | +| ------------------- | --------------------------- | ---- | ------- | +| componentId | string | 是 | 组件标识 | +| descriptionInfo | [DescriptionInfo](#descriptioninfo) | 是 | 描述文件信息 | + ## DescriptionInfo 版本描述文件信息。 @@ -1366,7 +1543,7 @@ localUpdater.off(eventClassifyInfo, onTaskUpdate); | progress | number | 是 | 进度 | | installMode | number | 是 | 安装模式 | | errorMessages | Array\<[ErrorMessage](#errormessage)> | 否 | 错误信息 | -| versionComponets | Array\<[VersionComponet](#versioncomponet)> | 是 | 版本组件 | +| versionComponents | Array\<[VersionComponent](#versioncomponent)> | 是 | 版本组件 | ## ErrorMessage @@ -1403,8 +1580,7 @@ localUpdater.off(eventClassifyInfo, onTaskUpdate); ## UpgradeTaskCallback -### onTaskUpdate -onTaskUpdate(eventInfo: [EventInfo](#eventinfo)): void +### (eventInfo: [EventInfo](#eventinfo)): void 事件回调。 @@ -1432,11 +1608,11 @@ onTaskUpdate(eventInfo: [EventInfo](#eventinfo)): void | 参数名 | 默认值 | 说明 | | ------------------- | ---- | -------- | -| FIRWARE | 1 | 固件 | +| FIRMWARE | 1 | 固件 | ## ComponentType -升级包类型。 +组件类型。 **系统能力**:SystemCapability.Update.UpdateService @@ -1478,6 +1654,17 @@ onTaskUpdate(eventInfo: [EventInfo](#eventinfo)): void | CONTENT | 0 | 内容 | | URI | 1 | 链接 | +## DescriptionFormat + +描述文件格式。 + +**系统能力**:SystemCapability.Update.UpdateService + +| 参数名 | 默认值 | 说明 | +| ------------------- | ---- | -------- | +| STANDARD | 0 | 标准格式 | +| SIMPLIFIED | 1 | 简易格式 | + ## NetType 网络类型。 @@ -1502,8 +1689,8 @@ onTaskUpdate(eventInfo: [EventInfo](#eventinfo)): void | ------------------- | ---- | -------- | | DOWNLOAD | 1 | 下载 | | INSTALL | 2 | 安装 | -| APPLY | 4 | 生效 | | DOWNLOAD_AND_INSTALL | 3 | 下载并安装 | +| APPLY | 4 | 生效 | | INSTALL_AND_APPLY | 6 | 安装并生效 | ## UpgradeStatus @@ -1516,11 +1703,11 @@ onTaskUpdate(eventInfo: [EventInfo](#eventinfo)): void | ------------------- | ---- | -------- | | WAITING_DOWNLOAD | 20 | 待下载 | | DOWNLOADING | 21 | 下载中 | -| DOWNLOAD_PAUSE | 22 | 下载暂停 | +| DOWNLOAD_PAUSED | 22 | 下载暂停 | | DOWNLOAD_FAIL | 23 | 下载失败 | | WAITING_INSTALL | 30 | 待安装 | | UPDATING | 31 | 更新中 | -| WATING_APPLY | 40 | 待生效 | +| WAITING_APPLY | 40 | 待生效 | | APPLYING | 21 | 生效中 | | UPGRADE_SUCCESS | 50 | 升级成功 | | UPGRADE_FAIL | 51 | 升级失败 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-uri.md b/zh-cn/application-dev/reference/apis/js-apis-uri.md index ac6946ca66f150ecfe0b2d08198ba0f050e4e332..b5a432841036c20a98e6cc6f160320847a7165fc 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-uri.md +++ b/zh-cn/application-dev/reference/apis/js-apis-uri.md @@ -71,8 +71,8 @@ toString(): string **示例:** ```js -const uri = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); -uri.toString() +const result = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); +result.toString() ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-url.md b/zh-cn/application-dev/reference/apis/js-apis-url.md index d85642ef859b8cae2765234923257bd7b640268c..f7a30ab9b74c73fc034b9d8f37d69ff1337a21f2 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-url.md +++ b/zh-cn/application-dev/reference/apis/js-apis-url.md @@ -31,7 +31,7 @@ URLSearchParams的构造函数。 ```js var objectParams = new Url.URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]); -var objectParams1 = new Url.URLSearchParams({"fod" : 1 , "bard" : 2}); +var objectParams1 = new Url.URLSearchParams({"fod" : '1' , "bard" : '2'}); var objectParams2 = new Url.URLSearchParams('?fod=1&bard=2'); var urlObject = new Url.URL('https://developer.mozilla.org/?fod=1&bard=2'); var params = new Url.URLSearchParams(urlObject.search); @@ -58,7 +58,7 @@ append(name: string, value: string): void ```js let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); -paramsObject.append('fod', 3); +paramsObject.append('fod', '3'); ``` @@ -108,10 +108,10 @@ getAll(name: string): string[] **示例:** ```js -let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); -let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); -paramsObject.append('fod', 3); // Add a second value for the fod parameter. -console.log(params.getAll('fod')) // Output ["1","3"]. +let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let params = new Url.URLSearchParams(urlObject.search.slice(1)); +params.append('fod', '3'); // Add a second value for the fod parameter. +console.log(params.getAll('fod').toString()) // Output ["1","3"]. ``` @@ -196,10 +196,9 @@ get(name: string): string | null **示例:** ```js -var paramsOject = new Url.URLSearchParams(document.location.search.substring(1)); +var paramsOject = new Url.URLSearchParams('name=Jonathan&age=18'); var name = paramsOject.get("name"); // is the string "Jonathan" var age = parseInt(paramsOject.get("age"), 10); // is the number 18 -var address = paramsOject.get("address"); // null ``` @@ -252,7 +251,7 @@ set(name: string, value: string): void ```js let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); -paramsObject.set('baz', 3); // Add a third parameter. +paramsObject.set('baz', '3'); // Add a third parameter. ``` @@ -364,7 +363,7 @@ toString(): string ```js let url = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); let params = new Url.URLSearchParams(url.search.slice(1)); -params.append('fod', 3); +params.append('fod', '3'); console.log(params.toString()); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-usb.md b/zh-cn/application-dev/reference/apis/js-apis-usb.md index 6f3b930ad6295efe57cb60f7543cec2a2c528990..12943e5dc43837fc335678354036d03fbf3a4e7d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-usb.md +++ b/zh-cn/application-dev/reference/apis/js-apis-usb.md @@ -3,7 +3,7 @@ 本模块主要提供管理USB设备的相关功能,包括查询USB设备列表、批量数据传输、控制命令传输、权限控制等。 > **说明:** -> +> > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块 @@ -22,66 +22,66 @@ getDevices(): Array<Readonly<USBDevice>> **返回值:** - | 类型 | 说明 | - | -------- | -------- | - | Array<Readonly<[USBDevice](#usbdevice)>> | 设备信息列表。 | +| 类型 | 说明 | +| ---------------------------------------------------- | ------- | +| Array<Readonly<[USBDevice](#usbdevice)>> | 设备信息列表。 | **示例:** - ```js - let devicesList = usb.getDevices(); - console.log(`devicesList = ${JSON.stringify(devicesList)}`); - //devicesList 返回的数据结构 - //此处提供一个简单的示例,如下 - [ - { - name: "1-1", - serial: "", - manufacturerName: "", - productName: "", - version: "", - vendorId: 7531, - productId: 2, - clazz: 9, - subclass: 0, - protocol: 1, - devAddress: 1, - busNum: 1, - configs: [ - { - id: 1, - attributes: 224, - isRemoteWakeup: true, - isSelfPowered: true, - maxPower: 0, - name: "1-1", - interfaces: [ - { - id: 0, - protocol: 0, - clazz: 9, - subclass: 0, - alternateSetting: 0, - name: "1-1", - endpoints: [ - { - address: 129, - attributes: 3, - interval: 12, - maxPacketSize: 4, - direction: 128, - number: 1, - type: 3, - interfaceId: 0, - }, - ], - }, - ], - }, - ], - }, - ] - ``` +```js +let devicesList = usb.getDevices(); +console.log(`devicesList = ${JSON.stringify(devicesList)}`); +//devicesList 返回的数据结构 +//此处提供一个简单的示例,如下 +[ + { + name: "1-1", + serial: "", + manufacturerName: "", + productName: "", + version: "", + vendorId: 7531, + productId: 2, + clazz: 9, + subclass: 0, + protocol: 1, + devAddress: 1, + busNum: 1, + configs: [ + { + id: 1, + attributes: 224, + isRemoteWakeup: true, + isSelfPowered: true, + maxPower: 0, + name: "1-1", + interfaces: [ + { + id: 0, + protocol: 0, + clazz: 9, + subclass: 0, + alternateSetting: 0, + name: "1-1", + endpoints: [ + { + address: 129, + attributes: 3, + interval: 12, + maxPacketSize: 4, + direction: 128, + number: 1, + type: 3, + interfaceId: 0, + }, + ], + }, + ], + }, + ], + }, +] +``` ## usb.connectDevice @@ -104,11 +104,11 @@ connectDevice(device: USBDevice): Readonly<USBDevicePipe> | Readonly<[USBDevicePipe](#usbdevicepipe)> | 指定的传输通道对象。 | **示例:** - ```js - let devicepipe= usb.connectDevice(device); - console.log(`devicepipe = ${JSON.stringify(devicepipe)}`); - ``` +```js +let devicepipe= usb.connectDevice(device); +console.log(`devicepipe = ${JSON.stringify(devicepipe)}`); +``` ## usb.hasRight @@ -129,12 +129,12 @@ hasRight(deviceName: string): boolean | boolean | true表示有访问设备的权限,false表示没有访问设备的权限。 | **示例:** - ```js - let divicesName="1-1"; - let bool = usb.hasRight(divicesName); - console.log(bool); - ``` +```js +let devicesName="1-1"; +let bool = usb.hasRight(devicesName); +console.log(bool); +``` ## usb.requestRight @@ -155,12 +155,13 @@ requestRight(deviceName: string): Promise<boolean> | Promise<boolean> | 获取到true则表示软件包的临时权限已访问成功, 获取到false则表示软件包的临时权限已访问失败。 | **示例:** - ```js - let divicesName="1-1"; - usb.requestRight(divicesName).then((ret) => { - console.log(`requestRight = ${JSON.stringify(ret)}`); - }); - ``` + +```js +let devicesName="1-1"; +usb.requestRight(devicesName).then((ret) => { + console.log(`requestRight = ${JSON.stringify(ret)}`); +}); +``` ## usb.claimInterface @@ -185,11 +186,11 @@ claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): numbe | number | 注册通信接口成功返回0;注册通信接口失败返回其他错误码。 | **示例:** - ```js - let ret = usb.claimInterface(devicepipe, interfaces); - console.log(`claimInterface = ${ret}`); - ``` +```js +let ret = usb.claimInterface(devicepipe, interfaces); +console.log(`claimInterface = ${ret}`); +``` ## usb.releaseInterface @@ -213,11 +214,11 @@ releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number | number | 释放接口成功返回0;释放接口失败返回其他错误码。 | **示例:** - ```js - let ret = usb.releaseInterface(devicepipe, interfaces); - console.log(`releaseInterface = ${ret}`); - ``` +```js +let ret = usb.releaseInterface(devicepipe, interfaces); +console.log(`releaseInterface = ${ret}`); +``` ## usb.setConfiguration @@ -241,10 +242,11 @@ setConfiguration(pipe: USBDevicePipe, config: USBConfig): number | number | 设置设备配置成功返回0;设置设备配置失败返回其他错误码。 | **示例:** - ```js - let ret = usb.setConfiguration(devicepipe, config); - console.log(`setConfiguration = ${ret}`); - ``` + +```js +let ret = usb.setConfiguration(devicepipe, config); +console.log(`setConfiguration = ${ret}`); +``` ## usb.setInterface @@ -258,10 +260,10 @@ setInterface(pipe: USBDevicePipe, iface: USBInterface): number **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定总线号和设备地址。 | - | iface | [USBInterface](#usbinterface) | 是 | 用于确定需要设置的接口。 | +| 参数名 | 类型 | 必填 | 说明 | +| ----- | ------------------------------- | --- | ------------- | +| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定总线号和设备地址。 | +| iface | [USBInterface](#usbinterface) | 是 | 用于确定需要设置的接口。 | **返回值:** | 类型 | 说明 | @@ -269,10 +271,11 @@ setInterface(pipe: USBDevicePipe, iface: USBInterface): number | number | 设置设备接口成功返回0;设置设备接口失败返回其他错误码。 | **示例:** - ```js - let ret = usb.setInterface(devicepipe, interfaces); - console.log(`setInterface = ${ret}`); - ``` + +```js +let ret = usb.setInterface(devicepipe, interfaces); +console.log(`setInterface = ${ret}`); +``` ## usb.getRawDescriptor @@ -285,6 +288,7 @@ getRawDescriptor(pipe: USBDevicePipe): Uint8Array **系统能力:** SystemCapability.USB.USBManager **参数:** + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定总线号和设备地址。 | @@ -295,10 +299,10 @@ getRawDescriptor(pipe: USBDevicePipe): Uint8Array | Uint8Array | 返回获取的原始数据;失败返回undefined。 | **示例:** - ```js - let ret = usb.getRawDescriptor(devicepipe); - ``` +```js +let ret = usb.getRawDescriptor(devicepipe); +``` ## usb.getFileDescriptor @@ -317,15 +321,15 @@ getFileDescriptor(pipe: USBDevicePipe): number **返回值:** -| 类型 | 说明 | -| -------- | -------- | +| 类型 | 说明 | +| ------ | -------------------- | | number | 返回设备对应的文件描述符;失败返回-1。 | **示例:** - ```js - let ret = usb.getFileDescriptor(devicepipe); - ``` +```js +let ret = usb.getFileDescriptor(devicepipe); +``` ## usb.controlTransfer @@ -350,12 +354,12 @@ controlTransfer(pipe: USBDevicePipe, contrlparam: USBControlParams, timeout?: nu | Promise<number> | 获取传输或接收到的数据块大小, 获取到-1则表示异常。 | **示例:** - ```js - usb.controlTransfer(devicepipe, USBControlParams).then((ret) => { - console.log(`controlTransfer = ${JSON.stringify(ret)}`); - }) - ``` +```js +usb.controlTransfer(devicepipe, USBControlParams).then((ret) => { + console.log(`controlTransfer = ${JSON.stringify(ret)}`); +}) +``` ## usb.bulkTransfer @@ -381,15 +385,15 @@ bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, tim | Promise<number> | 获取传输或接收到的数据块大小, 获取到-1则表示异常。 | **示例:** - ```js - //usb.getDevices 接口返回数据集合,取其中一个设备对象,并获取权限 。 - //把获取到的设备对象作为参数传入usb.connectDevice;当usb.connectDevice接口成功返回之后; - //才可以调用第三个接口usb.claimInterface.当usb.claimInterface 调用成功以后,再调用该接口。 - usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => { - console.log(`bulkTransfer = ${JSON.stringify(ret)}`); - }); - ``` +```js +//usb.getDevices 接口返回数据集合,取其中一个设备对象,并获取权限 。 +//把获取到的设备对象作为参数传入usb.connectDevice;当usb.connectDevice接口成功返回之后; +//才可以调用第三个接口usb.claimInterface.当usb.claimInterface 调用成功以后,再调用该接口。 +usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => { + console.log(`bulkTransfer = ${JSON.stringify(ret)}`); +}); +``` ## usb.closePipe @@ -412,149 +416,424 @@ closePipe(pipe: USBDevicePipe): number | number | 关闭设备消息控制通道成功返回0;关闭设备消息控制通道失败返回其他错误码。 | **示例:** - ```js - let ret = usb.closePipe(devicepipe); - console.log(`closePipe = ${ret}`); - ``` +```js +let ret = usb.closePipe(devicepipe); +console.log(`closePipe = ${ret}`); +``` + +## usb.usbFunctionsFromString9+ + +usbFunctionsFromString(funcs: string): number + +在设备模式下,将字符串形式的usb功能列表转化为数字掩码。 + +此接口为系统接口。 + +**系统能力:** SystemCapability.USB.USBManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ---------------------- | +| funcs | string | 是 | 字符串形式的功能列表。 | + +**返回值:** + +| 类型 | 说明 | +| ------ | ------------------ | +| number | 转化后的数字掩码。 | + +**示例:** + +```js +let funcs = "acm"; +let ret = usb.usbFunctionsFromString(funcs); +``` + +## usb.usbFunctionsToString9+ + +usbFunctionsToString(funcs: FunctionType): string + +在设备模式下,将数字掩码形式的usb功能列表转化为字符串。 + +此接口为系统接口。 + +**系统能力:** SystemCapability.USB.USBManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------------------------------ | ---- | ----------------- | +| funcs | [FunctionType](#functiontype9) | 是 | usb功能数字掩码。 | + +**返回值:** + +| 类型 | 说明 | +| ------ | ------------------------------ | +| string | 转化后的字符串形式的功能列表。 | + +**示例:** + +```js +let funcs = ACM | ECM; +let ret = usb.usbFunctionsToString(funcs); +``` + +## usb.setCurrentFunctions9+ + +setCurrentFunctions(funcs: FunctionType): Promise\ + +在设备模式下,设置当前的USB功能列表。 + +此接口为系统接口。 + +**系统能力:** SystemCapability.USB.USBManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------------------------------ | ---- | ----------------- | +| funcs | [FunctionType](#functiontype9) | 是 | USB功能数字掩码。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------ | ------------------------------------------------------ | +| Promise\ | 设置USB功能列表是否成功,true表示成功,false表示失败。 | + +**示例:** + +```js +let funcs = HDC; +let ret = usb.setCurrentFunctions(funcs); +``` + +## usb.getCurrentFunctions9+ + +getCurrentFunctions(): FunctionType + +在设备模式下,获取当前的USB功能列表的数字组合掩码。 + +此接口为系统接口。 + +**系统能力:** SystemCapability.USB.USBManager + +**返回值:** + +| 类型 | 说明 | +| ------------------------------ | --------------------------------- | +| [FunctionType](#functiontype9) | 当前的USB功能列表的数字组合掩码。 | + +**示例:** + +```js +let ret = usb.getCurrentFunctions(); +``` + +## usb.getPorts9+ + +getPorts(): Array\ + +获取所有物理USB端口描述信息。 + +此接口为系统接口。 + +**系统能力:** SystemCapability.USB.USBManager + +**返回值:** + +| 类型 | 说明 | +| ----------------------------- | --------------------- | +| [Array\](#usbport9) | USB端口描述信息列表。 | + +**示例:** + +```js +let ret = usb.getPorts(); +``` + +## usb.getSupportedModes9+ + +getSupportedModes(portId: number): PortModeType + +获取指定的端口支持的模式列表的组合掩码。 + +此接口为系统接口。 + +**系统能力:** SystemCapability.USB.USBManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| portId | number | 是 | 端口号。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------ | -------------------------- | +| [PortModeType](#portmodetype9) | 支持的模式列表的组合掩码。 | + +**示例:** + +```js +let ret = usb.getSupportedModes(0); +``` + +## usb.setPortRoles9+ + +setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise\ + +设置指定的端口支持的角色模式,包含充电角色、数据传输角色。 + +此接口为系统接口。 + +**系统能力:** SystemCapability.USB.USBManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | -------------------------------- | ---- | ---------------- | +| portId | number | 是 | 端口号。 | +| powerRole | [PowerRoleType](#powerroletype9) | 是 | 充电的角色。 | +| dataRole | [DataRoleType](#dataroletype9) | 是 | 数据传输的角色。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------ | -------------- | +| Promise\ | 设置是否成功。 | + +**示例:** + +```js +let ret = usb.getSupportedModes(0); +``` ## USBEndpoint 通过USB发送和接收数据的端口。通过[USBInterface](#usbinterface)获取。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.USB.USBManager。 - -| 名称 | 参数类型 | 说明 | -| -------- | -------- | -------- | -| address | number | 端点地址。| -| attributes | number | 端点属性。| -| interval | number | 端点间隔。| -| maxPacketSize | number | 端点最大数据包大小。| -| direction | [USBRequestDirection](#usbrequestdirection) | 端点的方向。| -| number | number | 端点号。| -| type | number | 端点类型。| -| interfaceId | number | 端点所属的接口的唯一标识。| +**系统能力**:SystemCapability.USB.USBManager +| 名称 | 参数类型 | 说明 | +| ------------- | ------------------------------------------- | ------------- | +| address | number | 端点地址。 | +| attributes | number | 端点属性。 | +| interval | number | 端点间隔。 | +| maxPacketSize | number | 端点最大数据包大小。 | +| direction | [USBRequestDirection](#usbrequestdirection) | 端点的方向。 | +| number | number | 端点号。 | +| type | number | 端点类型。 | +| interfaceId | number | 端点所属的接口的唯一标识。 | ## USBInterface 一个[USBConfig](#usbconfig)中可以含有多个USBInterface,每个USBInterface提供一个功能。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.USB.USBManager。 - -| 名称 | 参数类型 | 说明 | -| -------- | -------- | -------- | -| id | number | 接口的唯一标识。| -| protocol | number | 接口的协议。| -| clazz | number | 设备类型。| -| subClass | number | 设备子类。| -| alternateSetting | number | 在同一个接口中的多个描述符中进行切换设置。| -| name | string | 接口名称。| -| endpoints | Array<[USBEndpoint](#usbendpoint)> | 当前接口所包含的端点。| +**系统能力**:SystemCapability.USB.USBManager +| 名称 | 参数类型 | 说明 | +| ---------------- | ---------------------------------------- | --------------------- | +| id | number | 接口的唯一标识。 | +| protocol | number | 接口的协议。 | +| clazz | number | 设备类型。 | +| subClass | number | 设备子类。 | +| alternateSetting | number | 在同一个接口中的多个描述符中进行切换设置。 | +| name | string | 接口名称。 | +| endpoints | Array<[USBEndpoint](#usbendpoint)> | 当前接口所包含的端点。 | ## USBConfig USB配置,一个[USBDevice](#usbdevice)中可以含有多个配置。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.USB.USBManager。 - -| 名称 | 参数类型 | 说明 | -| -------- | -------- | -------- | -| id | number | 配置的唯一标识。| -| attributes | number | 配置的属性。| -| maxPower | number | 最大功耗,以毫安为单位。| -| name | string | 配置的名称,可以为空。| -| isRemoteWakeup | boolean | 检查当前配置是否支持远程唤醒。| -| isSelfPowered | boolean | 检查当前配置是否支持独立电源。| -| interfaces | Array <[USBInterface](#usbinterface)> | 配置支持的接口属性。| +**系统能力**:SystemCapability.USB.USBManager +| 名称 | 参数类型 | 说明 | +| -------------- | ------------------------------------------------ | --------------- | +| id | number | 配置的唯一标识。 | +| attributes | number | 配置的属性。 | +| maxPower | number | 最大功耗,以毫安为单位。 | +| name | string | 配置的名称,可以为空。 | +| isRemoteWakeup | boolean | 检查当前配置是否支持远程唤醒。 | +| isSelfPowered | boolean | 检查当前配置是否支持独立电源。 | +| interfaces | Array <[USBInterface](#usbinterface)> | 配置支持的接口属性。 | ## USBDevice USB设备信息。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.USB.USBManager。 - -| 名称 | 参数类型 | 说明 | -| -------- | -------- | -------- | -| busNum | number | 总线地址。| -| devAddress | number | 设备地址。| -| serial | string | 序列号。| -| name | string | 设备名字。| -| manufacturerName | string | 产商信息。| -| productName | string | 产品信息。| -| version | string | 版本。| -| vendorId | number | 厂商ID。| -| productId | number | 产品ID。| -| clazz | number | 设备类。| -| subClass | number | 设备子类。| -| protocol | number | 设备协议码。| -| configs | Array<[USBConfig](#usbconfig)> | 设备配置描述符信息。| - +**系统能力**:SystemCapability.USB.USBManager + +| 名称 | 参数类型 | 说明 | +| ---------------- | ------------------------------------ | ---------- | +| busNum | number | 总线地址。 | +| devAddress | number | 设备地址。 | +| serial | string | 序列号。 | +| name | string | 设备名字。 | +| manufacturerName | string | 产商信息。 | +| productName | string | 产品信息。 | +| version | string | 版本。 | +| vendorId | number | 厂商ID。 | +| productId | number | 产品ID。 | +| clazz | number | 设备类。 | +| subClass | number | 设备子类。 | +| protocol | number | 设备协议码。 | +| configs | Array<[USBConfig](#usbconfig)> | 设备配置描述符信息。 | ## USBDevicePipe USB设备消息传输通道,用于确定设备。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.USB.USBManager。 - -| 名称 | 参数类型 | 说明 | -| -------- | -------- | -------- | -| busNum | number | 总线地址。| -| devAddress | number | 设备地址。| +**系统能力**:SystemCapability.USB.USBManager +| 名称 | 参数类型 | 说明 | +| ---------- | ------ | ----- | +| busNum | number | 总线地址。 | +| devAddress | number | 设备地址。 | ## USBControlParams 控制传输参数。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.USB.USBManager。 +**系统能力**:SystemCapability.USB.USBManager + +| 名称 | 参数类型 | 说明 | +| ------- | ----------------------------------------------- | ---------------- | +| request | number | 请求类型。 | +| target | [USBRequestTargetType](#usbrequesttargettype) | 请求目标类型。 | +| reqType | [USBControlRequestType](#usbcontrolrequesttype) | 请求控制类型。 | +| value | number | 请求参数。 | +| index | number | 请求参数value对应的索引值。 | +| data | Uint8Array | 用于写入或读取的缓冲区。 | + +## USBPort9+ + +USB设备端口。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.USB.USBManager + +| 名称 | 参数类型 | 说明 | +| -------------- | -------------------------------- | ----------------------------------- | +| id | number | USB端口唯一标识。 | +| supportedModes | [PortModeType](#portmodetype9) | USB端口所支持的模式的数字组合掩码。 | +| status | [USBPortStatus](#usbportstatus9) | USB端口角色。 | + +## USBPortStatus9+ + +USB设备端口角色信息。 + +此接口为系统接口。 -| 名称 | 参数类型 | 说明 | -| -------- | -------- | -------- | -| request | number | 请求类型。 | -| target | [USBRequestTargetType](#usbrequesttargettype) | 请求目标类型。| -| reqType | [USBControlRequestType](#usbcontrolrequesttype) | 请求控制类型。| -| value | number | 请求参数。| -| index | number | 请求参数value对应的索引值。| -| data | Uint8Array | 用于写入或读取的缓冲区。| +**系统能力**:SystemCapability.USB.USBManager +| 名称 | 参数类型 | 说明 | +| ---------------- | -------- | ---------------------- | +| currentMode | number | 当前的USB模式。 | +| currentPowerRole | number | 当前设备充电模式。 | +| currentDataRole | number | 当前设备数据传输模式。 | ## USBRequestTargetType 请求目标类型。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.USB.USBManager。 - -| 名称 | 默认值 | 说明 | -| -------- | -------- | -------- | -| USB_REQUEST_TARGET_DEVICE | 0 | 设备。| -| USB_REQUEST_TARGET_INTERFACE | 1 | 接口。| -| USB_REQUEST_TARGET_ENDPOINT | 2 | 端点。| -| USB_REQUEST_TARGET_OTHER | 3 | 其他。| +**系统能力**:SystemCapability.USB.USBManager +| 名称 | 值 | 说明 | +| ---------------------------- | ---- | ------ | +| USB_REQUEST_TARGET_DEVICE | 0 | 设备。 | +| USB_REQUEST_TARGET_INTERFACE | 1 | 接口。 | +| USB_REQUEST_TARGET_ENDPOINT | 2 | 端点。 | +| USB_REQUEST_TARGET_OTHER | 3 | 其他。 | ## USBControlRequestType 控制请求类型。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.USB.USBManager。 - -| 名称 | 默认值 | 说明 | -| -------- | -------- | -------- | -| USB_REQUEST_TYPE_STANDARD | 0 | 标准。| -| USB_REQUEST_TYPE_CLASS | 1 | 类。| -| USB_REQUEST_TYPE_VENDOR | 2 | 厂商。| +**系统能力**:SystemCapability.USB.USBManager +| 名称 | 值 | 说明 | +| ------------------------- | ---- | ------ | +| USB_REQUEST_TYPE_STANDARD | 0 | 标准。 | +| USB_REQUEST_TYPE_CLASS | 1 | 类。 | +| USB_REQUEST_TYPE_VENDOR | 2 | 厂商。 | ## USBRequestDirection 请求方向。 -**系统能力**:以下各项对应的系统能力均为 SystemCapability.USB.USBManager。 +**系统能力**:SystemCapability.USB.USBManager + +| 名称 | 值 | 说明 | +| --------------------------- | ---- | ------------------------ | +| USB_REQUEST_DIR_TO_DEVICE | 0 | 写数据,主设备往从设备。 | +| USB_REQUEST_DIR_FROM_DEVICE | 0x80 | 读数据,从设备往主设备。 | + +## FunctionType9+ + +USB设备侧功能。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.USB.USBManager + +| 名称 | 值 | 说明 | +| ------------ | ---- | ---------- | +| NONE | 0 | 没有功能。 | +| ACM | 1 | acm功能。 | +| ECM | 2 | ecm功能。 | +| HDC | 4 | hdc功能。 | +| MTP | 8 | 暂不支持。 | +| PTP | 16 | 暂不支持。 | +| RNDIS | 32 | 暂不支持。 | +| MIDI | 64 | 暂不支持。 | +| AUDIO_SOURCE | 128 | 暂不支持。 | +| NCM | 256 | 暂不支持。 | + +## PortModeType9+ + +USB端口模式类型。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.USB.USBManager + +| 名称 | 值 | 说明 | +| --------- | ---- | ---------------------------------------------------- | +| NONE | 0 | 无。 | +| UFP | 1 | 数据上行,需要外部供电。 | +| DFP | 2 | 数据下行,对外提供电源。 | +| DRP | 3 | 既可以做DFP(Host),也可以做UFP(Device),当前不支持。 | +| NUM_MODES | 4 | 当前不支持。 | + +## PowerRoleType9+ + +电源角色类型。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.USB.USBManager + +| 名称 | 值 | 说明 | +| ------ | ---- | ---------- | +| NONE | 0 | 无。 | +| SOURCE | 1 | 外部供电。 | +| SINK | 2 | 内部供电。 | + +## DataRoleType9+ + +数据角色类型。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.USB.USBManager + +| 名称 | 值 | 说明 | +| ------ | ---- | ------------ | +| NONE | 0 | 无。 | +| HOST | 1 | 主设备角色。 | +| DEVICE | 2 | 从设备角色。 | -| 名称 | 默认值 | 说明 | -| -------- | -------- | -------- | -| USB_REQUEST_DIR_TO_DEVICE | 0 | 写数据,主设备往从设备。| -| USB_REQUEST_DIR_FROM_DEVICE | 0x80 | 读数据,从设备往主设备。| diff --git a/zh-cn/application-dev/reference/apis/js-apis-util.md b/zh-cn/application-dev/reference/apis/js-apis-util.md index 193b6fb237deaafa28a0c5620b435f9d428d5c84..742e63da1256359ad60510c0283ae75ac9577d52 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-util.md +++ b/zh-cn/application-dev/reference/apis/js-apis-util.md @@ -60,7 +60,7 @@ getErrorString(errno: number): string **示例:** ```js - var errnum = 10; // 10:a system error number + var errnum = 10; // 10 : a system error number var result = util.getErrorString(errnum); console.log("result = " + result); ``` @@ -90,11 +90,12 @@ callbackWrapper(original: Function): (err: Object, value: Object )=>void async function promiseFn() { return Promise.reject('value'); } + var err = "type err"; var cb = util.callbackWrapper(promiseFn); cb((err, ret) => { console.log(err); console.log(ret); - }) + }, err) ``` @@ -103,7 +104,7 @@ callbackWrapper(original: Function): (err: Object, value: Object )=>void promiseWrapper(original: (err: Object, value: Object) => void): Object > **说明:**
-> 从API Version 9开始废弃,建议使用[util.promiseWrapper9+](#utilpromisewrapper9)替代。 +> 从API Version 9开始废弃,建议使用[util.promisify9+](#utilpromisify9)替代。 对异步函数处理并返回一个promise的版本。 @@ -121,22 +122,18 @@ promiseWrapper(original: (err: Object, value: Object) => void): Object **示例:** ```js - function aysnFun(str1, str2, callback) { - if (typeof str1 === 'string' && typeof str2 === 'string') { - callback(null, str1 + str2); - } else { - callback('type err'); - } + function aysnFun() { + return 0; } - let newPromiseObj = util.promiseWrapper(aysnFun)("Hello", 'World'); - newPromiseObj.then(res => { - console.log(res); + let newPromiseObj = util.promiseWrapper(aysnFun); + newPromiseObj().then(res => { + console.log(res); }) ``` -## util.promiseWrapper9+ +## util.promisify9+ -promiseWrapper(original: (err: Object, value: Object) => void): Function +promisify(original: (err: Object, value: Object) => void): Function 对异步函数处理并返回一个promise的函数。 @@ -154,16 +151,16 @@ promiseWrapper(original: (err: Object, value: Object) => void): Function **示例:** ```js - function aysnFun(str1, str2, callback) { - if (typeof str1 === 'string' && typeof str2 === 'string') { - callback(null, str1 + str2); - } else { - callback('type err'); - } + function aysnFun(str1, str2) { + if (typeof str1 === 'object' && typeof str2 === 'object') { + return str2 + } else { + return str1 + } } - let newPromiseObj = util.promiseWrapper(aysnFun); - newPromiseObj("Hello", 'World').then(res => { - console.log(res); + let newPromiseObj = util.promisify(aysnFun); + newPromiseObj({ err: "type error" }, {value:'HelloWorld'}).then(res => { + console.log(res); }) ``` @@ -218,7 +215,7 @@ decode(input: Uint8Array, options?: { stream?: false }): string **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| input | Unit8Array | 是 | 符合格式需要解码的数组。 | +| input | Uint8Array | 是 | 符合格式需要解码的数组。 | | options | Object | 否 | 解码相关选项参数。 | **表2** options @@ -321,10 +318,11 @@ encodeInto(input: string, dest: Uint8Array, ): { read: number; written: number } **示例:** ```js - var that = new util.TextEncoder(); - var buffer = new ArrayBuffer(4); - this.dest = new Uint8Array(buffer); - var result = that.encodeInto("abcd", this.dest); + var that = new util.TextEncoder() + var buffer = new ArrayBuffer(4) + var dest = new Uint8Array(buffer) + var result = new Object() + result = that.encodeInto('abcd', dest) ``` ## RationalNumber8+ @@ -371,7 +369,7 @@ static createRationalFromString​(rationalString: string): RationalNumber​ **示例:** ```js var rationalNumber = new util.RationalNumber(1,2); - var rational = rationalNumer.creatRationalFromString("3/4"); + var rational = util.RationalNumber.createRationalFromString("3/4"); ``` @@ -396,7 +394,7 @@ compareTo​(another: RationalNumber): number​ **示例:** ```js var rationalNumber = new util.RationalNumber(1,2); - var rational = rationalNumer.creatRationalFromString("3/4"); + var rational = util.RationalNumber.createRationalFromString("3/4"); var result = rationalNumber.compareTo(rational); ``` @@ -442,7 +440,7 @@ equals​(obj: Object): boolean **示例:** ```js var rationalNumber = new util.RationalNumber(1,2); - var rational = rationalNumer.creatRationalFromString("3/4"); + var rational = util.RationalNumber.createRationalFromString("3/4"); var result = rationalNumber.equals(rational); ``` @@ -469,7 +467,7 @@ static getCommonDivisor​(number1: number,number2: number): number **示例:** ```js var rationalNumber = new util.RationalNumber(1,2); - var result = rationalNumber.getCommonDivisor(4,6); + var result = util.RationalNumber.getCommonDivisor(4,6); ``` @@ -706,7 +704,7 @@ clear(): void ```js var pro = new util.LruBuffer(); pro.put(2,10); - var result = pro.size(); + var result = pro.length; pro.clear(); ``` @@ -988,14 +986,6 @@ afterRemoval(isEvict: boolean,key: K,value: V,newValue: V): void { super(); } - static getInstance() - { - if(this.instance == null) - { - this.instance = new ChildLruBuffer(); - } - return this.instance; - } afterRemoval(isEvict, key, value, newValue) { if (isEvict === false) @@ -1004,7 +994,8 @@ afterRemoval(isEvict: boolean,key: K,value: V,newValue: V): void } } } - ChildLruBuffer.getInstance().afterRemoval(false,10,30,null); + var lru = new ChildLruBuffer(); + lru.afterRemoval(false,10,30,null); ``` @@ -1097,7 +1088,7 @@ entries(): IterableIterator<[K,V]> ```js var pro = new util.LruBuffer(); pro.put(2,10); - var result = pro[symbol.iterator](); + var result = pro[Symbol.iterator](); ``` @@ -1585,7 +1576,7 @@ encode(src: Uint8Array): Promise<Uint8Array> var rarray = new Uint8Array([99,122,69,122]); that.encode(array).then(val=>{ for (var i = 0; i < rarray.length; i++) { - console.log(val[i]) + console.log(val[i].toString()) } }) ``` @@ -1644,7 +1635,7 @@ decode(src: Uint8Array | string): Promise<Uint8Array> var rarray = new Uint8Array([115,49,51]); that.decode(array).then(val=>{ for (var i = 0; i < rarray.length; i++) { - console.log(val[i]) + console.log(val[i].toString()) } }) ``` @@ -1688,7 +1679,7 @@ isAnyArrayBuffer(value: Object): boolean **示例:** ```js var that = new util.types(); - var result = that.isAnyArrayBuffer(new ArrayBuffer([])); + var result = that.isAnyArrayBuffer(new ArrayBuffer(0)); ``` @@ -1768,7 +1759,7 @@ isArrayBuffer(value: Object): boolean **示例:** ```js var that = new util.types(); - var result = that.isArrayBuffer(new ArrayBuffer([])); + var result = that.isArrayBuffer(new ArrayBuffer(0)); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-volumemanager.md b/zh-cn/application-dev/reference/apis/js-apis-volumemanager.md index 7cc98e4b15693698873fed6ca834c4eb9248f51c..535c50272bda24adad3d53bf78f20179de52cb0e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-volumemanager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-volumemanager.md @@ -204,7 +204,11 @@ getVolumeByUuid(uuid: string): Promise<Volume> ```js let uuid = ""; - let volume = await volumemanager.getVolumeByUuid(uuid); + volumemanager.getVolumeByUuid(uuid).then(function(volume) { + console.info("getVolumeByUuid successfully:" + JSON.stringify(volume)); + }).catch(function(error){ + console.info("getVolumeByUuid failed with error:"+ error); + }); ``` ## volumemanager.getVolumeByUuid @@ -259,7 +263,11 @@ getVolumeById(id: string): Promise<Volume> ```js let id = ""; - let volume = await volumemanager.getVolumeById(id); + volumemanager.getVolumeById(id).then(function(volume) { + console.info("getVolumeById successfully:" + JSON.stringify(volume)); + }).catch(function(error){ + console.info("getVolumeById failed with error:"+ error); + }); ``` ## volumemanager.getVolumeById @@ -316,7 +324,11 @@ setVolumeDescription(uuid: string, description: string): Promise<void> ```js let uuid = ""; let description = ""; - let bool = await volumemanager.setVolumeDescription(uuid, description); + volumemanager.setVolumeDescription(uuid, description).then(function() { + console.info("setVolumeDescription successfully"); + }).catch(function(error){ + console.info("setVolumeDescription failed with error:"+ error); + }); ``` ## volumemanager.setVolumeDescription @@ -373,7 +385,11 @@ format(volId: string): Promise<void> ```js let volId = ""; - let bool = await volumemanager.format(volId); + volumemanager.format(volId).then(function() { + console.info("format successfully"); + }).catch(function(error){ + console.info("format failed with error:"+ error); + }); ``` ## volumemanager.format @@ -430,7 +446,11 @@ partition(volId: string, fstype: string): Promise<void> ```js let volId = ""; let fstype = ""; - let bool = await volumemanager.partition(volId, fstype); + volumemanager.partition(volId, fstype).then(function() { + console.info("partition successfully"); + }).catch(function(error){ + console.info("partition failed with error:"+ error); + }); ``` ## volumemanager.partition @@ -456,7 +476,7 @@ partition(volId: string, fstype : string, callback: AsyncCallback<void>): ```js let volId = ""; let fstype = ""; - volumemanager.format(volId, fstype, (error, bool) => { + volumemanager.partition(volId, fstype, (error, bool) => { // do something }); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md b/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md index 6cd749107fbf9f9a43eb28156bc57f58e7f0b6fb..4a8a90137257be89ec32a2651130e15a6d94df77 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md +++ b/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md @@ -638,7 +638,7 @@ getPixelMap(wallpaperType: WallpaperType): Promise<image.PixelMap> **示例:** ```js - wallpaper.getPixelMap(WALLPAPER_SYSTEM).then((data) => { + wallpaper.getPixelMap(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => { console.info('wallpaperXTS ===> testGetPixelMapPromiseSystem data : ' + data); console.info('wallpaperXTS ===> testGetPixelMapPromiseSystem data : ' + JSON.stringify(data)); }).catch((err) => { diff --git a/zh-cn/application-dev/reference/apis/js-apis-webgl.md b/zh-cn/application-dev/reference/apis/js-apis-webgl.md index 01b09c70a8f9c917344b8f49d4595a067fdda1cd..59e7001d787df56f44fe2ff37855d3866f06aa83 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-webgl.md +++ b/zh-cn/application-dev/reference/apis/js-apis-webgl.md @@ -428,7 +428,7 @@ WebGLRenderingContextBase | CONTEXT_LOST_WEBGL | GLenum | 是 | | UNPACK_COLORSPACE_CONVERSION_WEBGL | GLenum | 是 | | BROWSER_DEFAULT_WEBGL | GLenum | 是 | -| canvas | HTMLCanvasElement \| OffscreenCanvas | 是 | +| canvas | HTMLCanvasElement \| OffscreenCanvas | 是 | | drawingBufferWidth | GLsizei | 是 | | drawingBufferHeight | GLsizei | 是 | @@ -437,124 +437,124 @@ WebGLRenderingContextBase | 方法 | 返回值类型 | | -------- | -------- | -| getContextAttributes() | WebGLContextAttributes \| null | +| getContextAttributes() | WebGLContextAttributes \| null | | isContextLost() | boolean | -| getSupportedExtensions() | string[] \| null | -| getExtension(name: string) | any | -| activeTexture(texture: GLenum) | void | -| attachShader(program: WebGLProgram, shader: WebGLShader) | void | -| bindAttribLocation(program: WebGLProgram, index: GLuint, name: string) | void | -| bindBuffer(target: GLenum, buffer: WebGLBuffer \| null) | void | -| bindFramebuffer(target: GLenum, framebuffer: WebGLFramebuffer \| null) | void | -| bindRenderbuffer(target: GLenum, renderbuffer: WebGLRenderbuffer \| null) | void | -| bindTexture(target: GLenum, texture: WebGLTexture \| null) | void | -| blendColor(red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf) | void | -| blendEquation(mode: GLenum) | void | -| blendEquationSeparate(modeRGB: GLenum, modeAlpha: GLenum) | void | -| blendFunc(sfactor: GLenum, dfactor: GLenum) | void | -| blendFuncSeparate(srcRGB: GLenum, dstRGB: GLenum, srcAlpha: GLenum, dstAlpha: GLenum) | void | -| checkFramebufferStatus(target: GLenum) | GLenum | -| clear(mask: GLbitfield) | void | -| clearColor(red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf) | void | -| clearDepth(depth: GLclampf) | void | -| clearStencil(s: GLint) | void | -| colorMask(red: GLboolean, green: GLboolean, blue: GLboolean, alpha: GLboolean) | void | -| compileShader(shader: WebGLShader) | void | -| copyTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, x: GLint, y: GLint, width: GLsizei, height: GLsizei, border: GLint) | void | -| copyTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | -| createBuffer() | WebGLBuffer \| null | -| createFramebuffer() | WebGLFramebuffer \| null | -| createProgram() | WebGLProgram \| null | -| createRenderbuffer() | WebGLRenderbuffer \| null | -| createShader(type: GLenum) | WebGLShader \| null | -| createTexture() | WebGLTexture \| null | -| cullFace(mode: GLenum) | void | -| deleteBuffer(buffer: WebGLBuffer \| null) | void | -| deleteFramebuffer(framebuffer: WebGLFramebuffer \| null) | void | -| deleteProgram(program: WebGLProgram \| null) | void | -| deleteRenderbuffer(renderbuffer: WebGLRenderbuffer \| null) | void | -| deleteShader(shader: WebGLShader \| null) | void | -| deleteTexture(texture: WebGLTexture \| null) | void | -| depthFunc(func: GLenum) | void | -| depthMask(flag: GLboolean) | void | -| depthRange(zNear: GLclampf, zFar: GLclampf) | void | -| detachShader(program: WebGLProgram, shader: WebGLShader) | void | -| disable(cap: GLenum) | void | -| disableVertexAttribArray(index: GLuint) | void | -| drawArrays(mode: GLenum, first: GLint, count: GLsizei) | void | -| drawElements(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr) | void | -| enable(cap: GLenum) | void | -| enableVertexAttribArray(index: GLuint) | void | +| getSupportedExtensions() | string[] \| null | +| getExtension(name: string) | any | +| activeTexture(texture: GLenum) | void | +| attachShader(program: WebGLProgram, shader: WebGLShader) | void | +| bindAttribLocation(program: WebGLProgram, index: GLuint, name: string) | void | +| bindBuffer(target: GLenum, buffer: WebGLBuffer \| null) | void | +| bindFramebuffer(target: GLenum, framebuffer: WebGLFramebuffer \| null) | void | +| bindRenderbuffer(target: GLenum, renderbuffer: WebGLRenderbuffer \| null) | void | +| bindTexture(target: GLenum, texture: WebGLTexture \| null) | void | +| blendColor(red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf) | void | +| blendEquation(mode: GLenum) | void | +| blendEquationSeparate(modeRGB: GLenum, modeAlpha: GLenum) | void | +| blendFunc(sfactor: GLenum, dfactor: GLenum) | void | +| blendFuncSeparate(srcRGB: GLenum, dstRGB: GLenum, srcAlpha: GLenum, dstAlpha: GLenum) | void | +| checkFramebufferStatus(target: GLenum) | GLenum | +| clear(mask: GLbitfield) | void | +| clearColor(red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf) | void | +| clearDepth(depth: GLclampf) | void | +| clearStencil(s: GLint) | void | +| colorMask(red: GLboolean, green: GLboolean, blue: GLboolean, alpha: GLboolean) | void | +| compileShader(shader: WebGLShader) | void | +| copyTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, x: GLint, y: GLint, width: GLsizei, height: GLsizei, border: GLint) | void | +| copyTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | +| createBuffer() | WebGLBuffer \| null | +| createFramebuffer() | WebGLFramebuffer \| null | +| createProgram() | WebGLProgram \| null | +| createRenderbuffer() | WebGLRenderbuffer \| null | +| createShader(type: GLenum) | WebGLShader \| null | +| createTexture() | WebGLTexture \| null | +| cullFace(mode: GLenum) | void | +| deleteBuffer(buffer: WebGLBuffer \| null) | void | +| deleteFramebuffer(framebuffer: WebGLFramebuffer \| null) | void | +| deleteProgram(program: WebGLProgram \| null) | void | +| deleteRenderbuffer(renderbuffer: WebGLRenderbuffer \| null) | void | +| deleteShader(shader: WebGLShader \| null) | void | +| deleteTexture(texture: WebGLTexture \| null) | void | +| depthFunc(func: GLenum) | void | +| depthMask(flag: GLboolean) | void | +| depthRange(zNear: GLclampf, zFar: GLclampf) | void | +| detachShader(program: WebGLProgram, shader: WebGLShader) | void | +| disable(cap: GLenum) | void | +| disableVertexAttribArray(index: GLuint) | void | +| drawArrays(mode: GLenum, first: GLint, count: GLsizei) | void | +| drawElements(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr) | void | +| enable(cap: GLenum) | void | +| enableVertexAttribArray(index: GLuint) | void | | finish() | void | | flush() | void | -| framebufferRenderbuffer(target: GLenum, attachment: GLenum, renderbuffertarget: GLenum, renderbuffer: WebGLRenderbuffer \| null) | void | -| framebufferTexture2D(target: GLenum, attachment: GLenum, textarget: GLenum, texture: WebGLTexture \| null, level: GLint) | void | -| frontFace(mode: GLenum) | void | -| generateMipmap(target: GLenum) | void | -| getActiveAttrib(program: WebGLProgram, index: GLuint) | WebGLActiveInfo \| null | -| getActiveUniform(program: WebGLProgram, index: GLuint) | WebGLActiveInfo \| null | -| getAttachedShaders(program: WebGLProgram) | WebGLShader[] \| null | -| getAttribLocation(program: WebGLProgram, name: string) | GLint | -| getBufferParameter(target: GLenum, pname: GLenum) | any | -| getParameter(pname: GLenum) | any | +| framebufferRenderbuffer(target: GLenum, attachment: GLenum, renderbuffertarget: GLenum, renderbuffer: WebGLRenderbuffer \| null) | void | +| framebufferTexture2D(target: GLenum, attachment: GLenum, textarget: GLenum, texture: WebGLTexture \| null, level: GLint) | void | +| frontFace(mode: GLenum) | void | +| generateMipmap(target: GLenum) | void | +| getActiveAttrib(program: WebGLProgram, index: GLuint) | WebGLActiveInfo \| null | +| getActiveUniform(program: WebGLProgram, index: GLuint) | WebGLActiveInfo \| null | +| getAttachedShaders(program: WebGLProgram) | WebGLShader[] \| null | +| getAttribLocation(program: WebGLProgram, name: string) | GLint | +| getBufferParameter(target: GLenum, pname: GLenum) | any | +| getParameter(pname: GLenum) | any | | getError() | GLenum | -| getFramebufferAttachmentParameter(target: GLenum, attachment: GLenum, pname: GLenum) | any | -| getProgramParameter(program: WebGLProgram, pname: GLenum) | any | -| getProgramInfoLog(program: WebGLProgram) | string \| null | -| getRenderbufferParameter(target: GLenum, pname: GLenum) | any | -| getShaderParameter(shader: WebGLShader, pname: GLenum) | any | -| getShaderPrecisionFormat(shadertype: GLenum, precisiontype: GLenum) | WebGLShaderPrecisionFormat \| null | -| getShaderInfoLog(shader: WebGLShader) | string \| null | -| getShaderSource(shader: WebGLShader) | string \| null | -| getTexParameter(target: GLenum, pname: GLenum) | any | -| getUniform(program: WebGLProgram, location: WebGLUniformLocation) | any | -| getUniformLocation(program: WebGLProgram, name: string) | WebGLUniformLocation \| null | -| getVertexAttrib(index: GLuint, pname: GLenum) | any | -| getVertexAttribOffset(index: GLuint, pname: GLenum) | GLintptr | -| hint(target: GLenum, mode: GLenum) | void | -| isBuffer(buffer: WebGLBuffer \| null) | GLboolean | -| isEnabled(cap: GLenum) | GLboolean | -| isFramebuffer(framebuffer: WebGLFramebuffer \| null) | GLboolean | -| isProgram(program: WebGLProgram \| null) | GLboolean | -| isRenderbuffer(renderbuffer: WebGLRenderbuffer \| null) | GLboolean | -| isShader(shader: WebGLShader \| null) | GLboolean | -| isTexture(texture: WebGLTexture \| null) | GLboolean | -| lineWidth(width: GLfloat) | void | -| linkProgram(program: WebGLProgram) | void | -| pixelStorei(pname: GLenum, param: GLint \| GLboolean) | void | -| polygonOffset(factor: GLfloat, units: GLfloat) | void | -| renderbufferStorage(target: GLenum, internalformat: GLenum, width: GLsizei, height: GLsizei) | void | -| sampleCoverage(value: GLclampf, invert: GLboolean) | void | -| scissor(x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | -| shaderSource(shader: WebGLShader, source: string) | void | -| stencilFunc(func: GLenum, ref: GLint, mask: GLuint) | void | -| stencilFuncSeparate(face: GLenum, func: GLenum, ref: GLint, mask: GLuint) | void | -| stencilMask(mask: GLuint) | void | -| stencilMaskSeparate(face: GLenum, mask: GLuint) | void | -| stencilOp(fail: GLenum, zfail: GLenum, zpass: GLenum) | void | -| stencilOpSeparate(face: GLenum, fail: GLenum, zfail: GLenum, zpass: GLenum) | void | -| texParameterf(target: GLenum, pname: GLenum, param: GLfloat) | void | -| texParameteri(target: GLenum, pname: GLenum, param: GLint) | void | -| uniform1f(location: WebGLUniformLocation \| null, x: GLfloat) | void | -| uniform2f(location: WebGLUniformLocation \| null, x: GLfloat, y: GLfloat) | void | -| uniform3f(location: WebGLUniformLocation \| null, x: GLfloat, y: GLfloat, z: GLfloat) | void | -| uniform4f(location: WebGLUniformLocation \| null, x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat) | void | -| uniform1i(location: WebGLUniformLocation \| null, x: GLint) | void | -| uniform2i(location: WebGLUniformLocation \| null, x: GLint, y: GLint) | void | -| uniform3i(location: WebGLUniformLocation \| null, x: GLint, y: GLint, z: GLint) | void | -| uniform4i(location: WebGLUniformLocation \| null, x: GLint, y: GLint, z: GLint, w: GLint) | void | -| useProgram(program: WebGLProgram \| null) | void | -| validateProgram(program: WebGLProgram) | void | -| vertexAttrib1f(index: GLuint, x: GLfloat) | void | -| vertexAttrib2f(index: GLuint, x: GLfloat, y: GLfloat) | void | -| vertexAttrib3f(index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat) | void | -| vertexAttrib4f(index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat) | void | -| vertexAttrib1fv(index: GLuint, values: Float32List) | void | -| vertexAttrib2fv(index: GLuint, values: Float32List) | void | -| vertexAttrib3fv(index: GLuint, values: Float32List) | void | -| vertexAttrib4fv(index: GLuint, values: Float32List) | void | -| vertexAttribPointer(index: GLuint, size: GLint, type: GLenum, normalized: GLboolean, stride: GLsizei, offset: GLintptr) | void | -| viewport(x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | +| getFramebufferAttachmentParameter(target: GLenum, attachment: GLenum, pname: GLenum) | any | +| getProgramParameter(program: WebGLProgram, pname: GLenum) | any | +| getProgramInfoLog(program: WebGLProgram) | string \| null | +| getRenderbufferParameter(target: GLenum, pname: GLenum) | any | +| getShaderParameter(shader: WebGLShader, pname: GLenum) | any | +| getShaderPrecisionFormat(shadertype: GLenum, precisiontype: GLenum) | WebGLShaderPrecisionFormat \| null | +| getShaderInfoLog(shader: WebGLShader) | string \| null | +| getShaderSource(shader: WebGLShader) | string \| null | +| getTexParameter(target: GLenum, pname: GLenum) | any | +| getUniform(program: WebGLProgram, location: WebGLUniformLocation) | any | +| getUniformLocation(program: WebGLProgram, name: string) | WebGLUniformLocation \| null | +| getVertexAttrib(index: GLuint, pname: GLenum) | any | +| getVertexAttribOffset(index: GLuint, pname: GLenum) | GLintptr | +| hint(target: GLenum, mode: GLenum) | void | +| isBuffer(buffer: WebGLBuffer \| null) | GLboolean | +| isEnabled(cap: GLenum) | GLboolean | +| isFramebuffer(framebuffer: WebGLFramebuffer \| null) | GLboolean | +| isProgram(program: WebGLProgram \| null) | GLboolean | +| isRenderbuffer(renderbuffer: WebGLRenderbuffer \| null) | GLboolean | +| isShader(shader: WebGLShader \| null) | GLboolean | +| isTexture(texture: WebGLTexture \| null) | GLboolean | +| lineWidth(width: GLfloat) | void | +| linkProgram(program: WebGLProgram) | void | +| pixelStorei(pname: GLenum, param: GLint \| GLboolean) | void | +| polygonOffset(factor: GLfloat, units: GLfloat) | void | +| renderbufferStorage(target: GLenum, internalformat: GLenum, width: GLsizei, height: GLsizei) | void | +| sampleCoverage(value: GLclampf, invert: GLboolean) | void | +| scissor(x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | +| shaderSource(shader: WebGLShader, source: string) | void | +| stencilFunc(func: GLenum, ref: GLint, mask: GLuint) | void | +| stencilFuncSeparate(face: GLenum, func: GLenum, ref: GLint, mask: GLuint) | void | +| stencilMask(mask: GLuint) | void | +| stencilMaskSeparate(face: GLenum, mask: GLuint) | void | +| stencilOp(fail: GLenum, zfail: GLenum, zpass: GLenum) | void | +| stencilOpSeparate(face: GLenum, fail: GLenum, zfail: GLenum, zpass: GLenum) | void | +| texParameterf(target: GLenum, pname: GLenum, param: GLfloat) | void | +| texParameteri(target: GLenum, pname: GLenum, param: GLint) | void | +| uniform1f(location: WebGLUniformLocation \| null, x: GLfloat) | void | +| uniform2f(location: WebGLUniformLocation \| null, x: GLfloat, y: GLfloat) | void | +| uniform3f(location: WebGLUniformLocation \| null, x: GLfloat, y: GLfloat, z: GLfloat) | void | +| uniform4f(location: WebGLUniformLocation \| null, x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat) | void | +| uniform1i(location: WebGLUniformLocation \| null, x: GLint) | void | +| uniform2i(location: WebGLUniformLocation \| null, x: GLint, y: GLint) | void | +| uniform3i(location: WebGLUniformLocation \| null, x: GLint, y: GLint, z: GLint) | void | +| uniform4i(location: WebGLUniformLocation \| null, x: GLint, y: GLint, z: GLint, w: GLint) | void | +| useProgram(program: WebGLProgram \| null) | void | +| validateProgram(program: WebGLProgram) | void | +| vertexAttrib1f(index: GLuint, x: GLfloat) | void | +| vertexAttrib2f(index: GLuint, x: GLfloat, y: GLfloat) | void | +| vertexAttrib3f(index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat) | void | +| vertexAttrib4f(index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat) | void | +| vertexAttrib1fv(index: GLuint, values: Float32List) | void | +| vertexAttrib2fv(index: GLuint, values: Float32List) | void | +| vertexAttrib3fv(index: GLuint, values: Float32List) | void | +| vertexAttrib4fv(index: GLuint, values: Float32List) | void | +| vertexAttribPointer(index: GLuint, size: GLint, type: GLenum, normalized: GLboolean, stride: GLsizei, offset: GLintptr) | void | +| viewport(x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | ## WebGLRenderingContextOverloads @@ -563,24 +563,24 @@ WebGLRenderingContextOverloads | 方法 | 返回值类型 | | -------- | -------- | -| bufferData(target: GLenum, size: GLsizeiptr, usage: GLenum) | void | -| bufferData(target: GLenum, data: BufferSource \| null, usage: GLenum) | void | -| bufferSubData(target: GLenum, offset: GLintptr, data: BufferSource) | void | -| compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, data: ArrayBufferView) | void | -| compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, data: ArrayBufferView) | void | -| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void; | -| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | -| texImage2D(target: GLenum, level: GLint, internalformat: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | -| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | -| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | -| uniform1fv(location: WebGLUniformLocation \| null, v: Float32List) | void | -| uniform2fv(location: WebGLUniformLocation \| null, v: Float32List) | void | -| uniform3fv(location: WebGLUniformLocation \| null, v: Float32List) | void | -| uniform4fv(location: WebGLUniformLocation \| null, v: Float32List) | void | -| uniform1iv(location: WebGLUniformLocation \| null, v: Int32List) | void | -| uniform2iv(location: WebGLUniformLocation \| null, v: Int32List) | void | -| uniform3iv(location: WebGLUniformLocation \| null, v: Int32List) | void | -| uniform4iv(location: WebGLUniformLocation \| null, v: Int32List) | void | -| uniformMatrix2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, value: Float32List) | void | -| uniformMatrix3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, value: Float32List) | void | -| uniformMatrix4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, value: Float32List) | void | +| bufferData(target: GLenum, size: GLsizeiptr, usage: GLenum) | void | +| bufferData(target: GLenum, data: BufferSource \| null, usage: GLenum) | void | +| bufferSubData(target: GLenum, offset: GLintptr, data: BufferSource) | void | +| compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, data: ArrayBufferView) | void | +| compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, data: ArrayBufferView) | void | +| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | +| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | +| texImage2D(target: GLenum, level: GLint, internalformat: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | +| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | +| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | +| uniform1fv(location: WebGLUniformLocation \| null, v: Float32List) | void | +| uniform2fv(location: WebGLUniformLocation \| null, v: Float32List) | void | +| uniform3fv(location: WebGLUniformLocation \| null, v: Float32List) | void | +| uniform4fv(location: WebGLUniformLocation \| null, v: Float32List) | void | +| uniform1iv(location: WebGLUniformLocation \| null, v: Int32List) | void | +| uniform2iv(location: WebGLUniformLocation \| null, v: Int32List) | void | +| uniform3iv(location: WebGLUniformLocation \| null, v: Int32List) | void | +| uniform4iv(location: WebGLUniformLocation \| null, v: Int32List) | void | +| uniformMatrix2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, value: Float32List) | void | +| uniformMatrix3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, value: Float32List) | void | +| uniformMatrix4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, value: Float32List) | void | diff --git a/zh-cn/application-dev/reference/apis/js-apis-webgl2.md b/zh-cn/application-dev/reference/apis/js-apis-webgl2.md index 03ebd9544fb947bd0c96a7e26c9505c60fab9c78..bd55508b7845035d678fc8a8dfd978092e5338b5 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-webgl2.md +++ b/zh-cn/application-dev/reference/apis/js-apis-webgl2.md @@ -343,101 +343,101 @@ WebGL2RenderingContextBase | 方法 | 返回值类型 | | -------- | -------- | -| copyBufferSubData(readTarget: GLenum, writeTarget: GLenum, readOffset: GLintptr, writeOffset: GLintptr, size: GLsizeiptr) | void | -| getBufferSubData(target: GLenum, srcByteOffset: GLintptr, dstBuffer: ArrayBufferView, dstOffset?: GLuint, length?: GLuint) | void | -| blitFramebuffer(srcX0: GLint, srcY0: GLint, srcX1: GLint, srcY1: GLint, dstX0: GLint, dstY0: GLint, dstX1: GLint, dstY1: GLint, mask: GLbitfield, filter: GLenum) | void | -| framebufferTextureLayer(target: GLenum, attachment: GLenum, texture: WebGLTexture \| null, level: GLint, layer: GLint) | void | -| invalidateFramebuffer(target: GLenum, attachments: GLenum[]) | void | -| invalidateSubFramebuffer(target: GLenum, attachments: GLenum[], x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | -| readBuffer(src: GLenum) | void | -| getInternalformatParameter(target: GLenum, internalformat: GLenum, pname: GLenum) | any | -| renderbufferStorageMultisample(target: GLenum, samples: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei) | void | -| texStorage2D(target: GLenum, levels: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei) | void | -| texStorage3D(target: GLenum, levels: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei) | void | -| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | -| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | -| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView \| null) | void | -| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) | void | -| texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | -| texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, source: TexImageSource) | void | -| texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, srcData: ArrayBufferView \| null, srcOffset?: GLuint) | void | -| copyTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | -| compressedTexImage3D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, imageSize: GLsizei, offset: GLintptr) | void | -| compressedTexImage3D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | -| compressedTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, imageSize: GLsizei, offset: GLintptr) | void | -| compressedTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | -| getFragDataLocation(program: WebGLProgram, name: string) | GLint | -| uniform1ui(location: WebGLUniformLocation \| null, v0: GLuint) | void | -| uniform2ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint) | void | -| uniform3ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint, v2: GLuint) | void | -| uniform4ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint, v2: GLuint, v3: GLuint) | void | -| uniform1uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform2uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform3uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform4uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix3x2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix4x2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix2x3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix4x3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix2x4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix3x4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| vertexAttribI4i(index: GLuint, x: GLint, y: GLint, z: GLint, w: GLint) | void | -| vertexAttribI4iv(index: GLuint, values: Int32List) | void | -| vertexAttribI4ui(index: GLuint, x: GLuint, y: GLuint, z: GLuint, w: GLuint) | void | -| vertexAttribI4uiv(index: GLuint, values: Uint32List) | void | -| vertexAttribIPointer(index: GLuint, size: GLint, type: GLenum, stride: GLsizei, offset: GLintptr) | void | -| vertexAttribDivisor(index: GLuint, divisor: GLuint) | void | -| drawArraysInstanced(mode: GLenum, first: GLint, count: GLsizei, instanceCount: GLsizei) | void | -| drawElementsInstanced(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, instanceCount: GLsizei) | void | -| drawRangeElements(mode: GLenum, start: GLuint, end: GLuint, count: GLsizei, type: GLenum, offset: GLintptr) | void | -| drawBuffers(buffers: GLenum[]) | void | -| clearBufferfv(buffer: GLenum, drawbuffer: GLint, values: Float32List, srcOffset?: GLuint) | void | -| clearBufferiv(buffer: GLenum, drawbuffer: GLint, values: Int32List, srcOffset?: GLuint) | void | -| clearBufferuiv(buffer: GLenum, drawbuffer: GLint, values: Uint32List, srcOffset?: GLuint) | void | -| clearBufferfi(buffer: GLenum, drawbuffer: GLint, depth: GLfloat, stencil: GLint) | void | -| createQuery() | WebGLQuery \| null | -| deleteQuery(query: WebGLQuery \| null) | void | -| isQuery(query: WebGLQuery \| null) | GLboolean | -| beginQuery(target: GLenum, query: WebGLQuery) | void | -| endQuery(target: GLenum) | void | -| getQuery(target: GLenum, pname: GLenum) | WebGLQuery \| null | -| getQueryParameter(query: WebGLQuery, pname: GLenum) | any | -| createSampler() | WebGLSampler \| null | -| deleteSampler(sampler: WebGLSampler \| null) | void | -| isSampler(sampler: WebGLSampler \| null) | GLboolean | -| bindSampler(unit: GLuint, sampler: WebGLSampler \| null) | void | -| samplerParameteri(sampler: WebGLSampler, pname: GLenum, param: GLint) | void | -| samplerParameterf(sampler: WebGLSampler, pname: GLenum, param: GLfloat) | void; | -| getSamplerParameter(sampler: WebGLSampler, pname: GLenum) | any | -| fenceSync(condition: GLenum, flags: GLbitfield) | WebGLSync \| null | -| isSync(sync: WebGLSync \| null) | GLboolean | -| deleteSync(sync: WebGLSync \| null) | void | -| clientWaitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLuint64) | GLenum | -| waitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLint64) | void | -| getSyncParameter(sync: WebGLSync, pname: GLenum) | any | -| createTransformFeedback() | WebGLTransformFeedback \| null | -| deleteTransformFeedback(tf: WebGLTransformFeedback \| null) | void | -| isTransformFeedback(tf: WebGLTransformFeedback \| null) | GLboolean | -| bindTransformFeedback(target: GLenum, tf: WebGLTransformFeedback \| null) | void | -| beginTransformFeedback(primitiveMode: GLenum) | void | +| copyBufferSubData(readTarget: GLenum, writeTarget: GLenum, readOffset: GLintptr, writeOffset: GLintptr, size: GLsizeiptr) | void | +| getBufferSubData(target: GLenum, srcByteOffset: GLintptr, dstBuffer: ArrayBufferView, dstOffset?: GLuint, length?: GLuint) | void | +| blitFramebuffer(srcX0: GLint, srcY0: GLint, srcX1: GLint, srcY1: GLint, dstX0: GLint, dstY0: GLint, dstX1: GLint, dstY1: GLint, mask: GLbitfield, filter: GLenum) | void | +| framebufferTextureLayer(target: GLenum, attachment: GLenum, texture: WebGLTexture \| null, level: GLint, layer: GLint) | void | +| invalidateFramebuffer(target: GLenum, attachments: GLenum[]) | void | +| invalidateSubFramebuffer(target: GLenum, attachments: GLenum[], x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | +| readBuffer(src: GLenum) | void | +| getInternalformatParameter(target: GLenum, internalformat: GLenum, pname: GLenum) | any | +| renderbufferStorageMultisample(target: GLenum, samples: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei) | void | +| texStorage2D(target: GLenum, levels: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei) | void | +| texStorage3D(target: GLenum, levels: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei) | void | +| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | +| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | +| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView \| null) | void | +| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) | void | +| texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | +| texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, source: TexImageSource) | void | +| texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, srcData: ArrayBufferView \| null, srcOffset?: GLuint) | void | +| copyTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | +| compressedTexImage3D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, imageSize: GLsizei, offset: GLintptr) | void | +| compressedTexImage3D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | +| compressedTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, imageSize: GLsizei, offset: GLintptr) | void | +| compressedTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | +| getFragDataLocation(program: WebGLProgram, name: string) | GLint | +| uniform1ui(location: WebGLUniformLocation \| null, v0: GLuint) | void | +| uniform2ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint) | void | +| uniform3ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint, v2: GLuint) | void | +| uniform4ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint, v2: GLuint, v3: GLuint) | void | +| uniform1uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform2uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform3uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform4uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix3x2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix4x2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix2x3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix4x3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix2x4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix3x4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| vertexAttribI4i(index: GLuint, x: GLint, y: GLint, z: GLint, w: GLint) | void | +| vertexAttribI4iv(index: GLuint, values: Int32List) | void | +| vertexAttribI4ui(index: GLuint, x: GLuint, y: GLuint, z: GLuint, w: GLuint) | void | +| vertexAttribI4uiv(index: GLuint, values: Uint32List) | void | +| vertexAttribIPointer(index: GLuint, size: GLint, type: GLenum, stride: GLsizei, offset: GLintptr) | void | +| vertexAttribDivisor(index: GLuint, divisor: GLuint) | void | +| drawArraysInstanced(mode: GLenum, first: GLint, count: GLsizei, instanceCount: GLsizei) | void | +| drawElementsInstanced(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, instanceCount: GLsizei) | void | +| drawRangeElements(mode: GLenum, start: GLuint, end: GLuint, count: GLsizei, type: GLenum, offset: GLintptr) | void | +| drawBuffers(buffers: GLenum[]) | void | +| clearBufferfv(buffer: GLenum, drawbuffer: GLint, values: Float32List, srcOffset?: GLuint) | void | +| clearBufferiv(buffer: GLenum, drawbuffer: GLint, values: Int32List, srcOffset?: GLuint) | void | +| clearBufferuiv(buffer: GLenum, drawbuffer: GLint, values: Uint32List, srcOffset?: GLuint) | void | +| clearBufferfi(buffer: GLenum, drawbuffer: GLint, depth: GLfloat, stencil: GLint) | void | +| createQuery() | WebGLQuery \| null | +| deleteQuery(query: WebGLQuery \| null) | void | +| isQuery(query: WebGLQuery \| null) | GLboolean | +| beginQuery(target: GLenum, query: WebGLQuery) | void | +| endQuery(target: GLenum) | void | +| getQuery(target: GLenum, pname: GLenum) | WebGLQuery \| null | +| getQueryParameter(query: WebGLQuery, pname: GLenum) | any | +| createSampler() | WebGLSampler \| null | +| deleteSampler(sampler: WebGLSampler \| null) | void | +| isSampler(sampler: WebGLSampler \| null) | GLboolean | +| bindSampler(unit: GLuint, sampler: WebGLSampler \| null) | void | +| samplerParameteri(sampler: WebGLSampler, pname: GLenum, param: GLint) | void | +| samplerParameterf(sampler: WebGLSampler, pname: GLenum, param: GLfloat) | void; | +| getSamplerParameter(sampler: WebGLSampler, pname: GLenum) | any | +| fenceSync(condition: GLenum, flags: GLbitfield) | WebGLSync \| null | +| isSync(sync: WebGLSync \| null) | GLboolean | +| deleteSync(sync: WebGLSync \| null) | void | +| clientWaitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLuint64) | GLenum | +| waitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLint64) | void | +| getSyncParameter(sync: WebGLSync, pname: GLenum) | any | +| createTransformFeedback() | WebGLTransformFeedback \| null | +| deleteTransformFeedback(tf: WebGLTransformFeedback \| null) | void | +| isTransformFeedback(tf: WebGLTransformFeedback \| null) | GLboolean | +| bindTransformFeedback(target: GLenum, tf: WebGLTransformFeedback \| null) | void | +| beginTransformFeedback(primitiveMode: GLenum) | void | | endTransformFeedback() | void | -| transformFeedbackVaryings(program: WebGLProgram, varyings: string[], bufferMode: GLenum) | void | -| getTransformFeedbackVarying(program: WebGLProgram, index: GLuint) | WebGLActiveInfo \| null | +| transformFeedbackVaryings(program: WebGLProgram, varyings: string[], bufferMode: GLenum) | void | +| getTransformFeedbackVarying(program: WebGLProgram, index: GLuint) | WebGLActiveInfo \| null | | pauseTransformFeedback() | void | | resumeTransformFeedback() | void | -| bindBufferBase(target: GLenum, index: GLuint, buffer: WebGLBuffer \| null) | void | -| bindBufferRange(target: GLenum, index: GLuint, buffer: WebGLBuffer \| null, offset: GLintptr, size: GLsizeiptr) | void | -| getIndexedParameter(target: GLenum, index: GLuint) | any | -| getUniformIndices(program: WebGLProgram, uniformNames: string[]) | GLuint[] \| null | -| getActiveUniforms(program: WebGLProgram, uniformIndices: GLuint[], pname: GLenum) | any | -| getUniformBlockIndex(program: WebGLProgram, uniformBlockName: string) | GLuint | -| getActiveUniformBlockParameter(program: WebGLProgram, uniformBlockIndex: GLuint, pname: GLenum) | any | -| getActiveUniformBlockName(program: WebGLProgram, uniformBlockIndex: GLuint) | string \| null | -| uniformBlockBinding(program: WebGLProgram, uniformBlockIndex: GLuint, uniformBlockBinding: GLuint) | void | -| createVertexArray() | WebGLVertexArrayObject \| null | -| deleteVertexArray(vertexArray: WebGLVertexArrayObject \| null) | void | -| isVertexArray(vertexArray: WebGLVertexArrayObject \| null) | GLboolean | -| bindVertexArray(array: WebGLVertexArrayObject \| null) | void | +| bindBufferBase(target: GLenum, index: GLuint, buffer: WebGLBuffer \| null) | void | +| bindBufferRange(target: GLenum, index: GLuint, buffer: WebGLBuffer \| null, offset: GLintptr, size: GLsizeiptr) | void | +| getIndexedParameter(target: GLenum, index: GLuint) | any | +| getUniformIndices(program: WebGLProgram, uniformNames: string[]) | GLuint[] \| null | +| getActiveUniforms(program: WebGLProgram, uniformIndices: GLuint[], pname: GLenum) | any | +| getUniformBlockIndex(program: WebGLProgram, uniformBlockName: string) | GLuint | +| getActiveUniformBlockParameter(program: WebGLProgram, uniformBlockIndex: GLuint, pname: GLenum) | any | +| getActiveUniformBlockName(program: WebGLProgram, uniformBlockIndex: GLuint) | string \| null | +| uniformBlockBinding(program: WebGLProgram, uniformBlockIndex: GLuint, uniformBlockBinding: GLuint) | void | +| createVertexArray() | WebGLVertexArrayObject \| null | +| deleteVertexArray(vertexArray: WebGLVertexArrayObject \| null) | void | +| isVertexArray(vertexArray: WebGLVertexArrayObject \| null) | GLboolean | +| bindVertexArray(array: WebGLVertexArrayObject \| null) | void | ## WebGL2RenderingContextOverloads @@ -446,36 +446,36 @@ WebGL2RenderingContextOverloads | 方法 | 返回值类型 | | -------- | -------- | -| bufferData(target: GLenum, size: GLsizeiptr, usage: GLenum) | void | -| bufferData(target: GLenum, srcData: BufferSource \| null, usage: GLenum) | void | -| bufferSubData(target: GLenum, dstByteOffset: GLintptr, srcData: BufferSource) | void | -| bufferData(target: GLenum, srcData: ArrayBufferView, usage: GLenum, srcOffset: GLuint, length?: GLuint) | void | -| bufferSubData(target: GLenum, dstByteOffset: GLintptr, srcData: ArrayBufferView, srcOffset: GLuint, length?: GLuint) | void | -| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | -| texImage2D(target: GLenum, level: GLint, internalformat: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | -| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | -| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | -| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | -| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | -| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) | void | -| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | -| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, source: TexImageSource) | void | -| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) | void | -| compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, imageSize: GLsizei, offset: GLintptr) | void | -| compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | -| compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, imageSize: GLsizei, offset: GLintptr) | void | -| compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | -| uniform1fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform2fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform3fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform4fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform1iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform2iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform3iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniform4iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| uniformMatrix4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | -| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, dstData: ArrayBufferView \| null) | void | -| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, offset: GLintptr) | void | -| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, dstData: ArrayBufferView, dstOffset: GLuint) | void | +| bufferData(target: GLenum, size: GLsizeiptr, usage: GLenum) | void | +| bufferData(target: GLenum, srcData: BufferSource \| null, usage: GLenum) | void | +| bufferSubData(target: GLenum, dstByteOffset: GLintptr, srcData: BufferSource) | void | +| bufferData(target: GLenum, srcData: ArrayBufferView, usage: GLenum, srcOffset: GLuint, length?: GLuint) | void | +| bufferSubData(target: GLenum, dstByteOffset: GLintptr, srcData: ArrayBufferView, srcOffset: GLuint, length?: GLuint) | void | +| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | +| texImage2D(target: GLenum, level: GLint, internalformat: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | +| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | +| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | +| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | +| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | +| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) | void | +| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | +| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, source: TexImageSource) | void | +| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) | void | +| compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, imageSize: GLsizei, offset: GLintptr) | void | +| compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | +| compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, imageSize: GLsizei, offset: GLintptr) | void | +| compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | +| uniform1fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform2fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform3fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform4fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform1iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform2iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform3iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniform4iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| uniformMatrix4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | +| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, dstData: ArrayBufferView \| null) | void | +| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, offset: GLintptr) | void | +| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, dstData: ArrayBufferView, dstOffset: GLuint) | void | diff --git a/zh-cn/application-dev/reference/apis/js-apis-windowAnimationManager.md b/zh-cn/application-dev/reference/apis/js-apis-windowAnimationManager.md new file mode 100644 index 0000000000000000000000000000000000000000..7a05d608c5f43e65e1a6a62ec647d6e8cff084e8 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-windowAnimationManager.md @@ -0,0 +1,266 @@ +# 窗口动画管理 +窗口动画管理器,可以监听应用启动退出时应用的动画窗口,提供启动退出过程中控件动画和应用窗口联动动画能力。 + +> **说明:** +> 该组件从API Version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> +> 本模块接口为系统接口。 + +## 导入模块 + +```js +import windowAnimationManager from '@ohos.animation.windowAnimationManager' +``` + +## windowAnimationManager.setController + +setController(controller: WindowAnimationController): void + +设置窗口动画控制器。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| controller | [WindowAnimationController](#windowanimationcontroller) | 是 | 窗口动画的控制器。| + +**示例:** + +```js +var controller = { + onStartAppFromLauncher(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { + console.log('onStartAppFromLauncher', startingWindowTarget); + }, + onStartAppFromRecent(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { + console.log('onStartAppFromRecent', startingWindowTarget); + }, + onStartAppFromOther(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { + console.log('onStartAppFromOther', startingWindowTarget); + }, + onAppTransition(fromWindowTarget: WindowAnimationTarget, toWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { + }, + onMinimizeWindow(minimizingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { + }, + onCloseWindow(closingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { + }, + onScreenUnlock(finishCallback: WindowAnimationFinishedCallback): void { + } +} + +windowAnimationManager.setController(controller) +``` + +## WindowAnimationController + +窗口动画控制器。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +### onStartAppFromLauncher + +onStartAppFromLauncher(startingWindowTarget: WindowAnimationTarget,finishCallback: WindowAnimationFinishedCallback): void + +从桌面启动应用时的回调。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +| 参数名 | 类型 | 必填 | 说明 | +| -------------------- | ------------------------------------------------------------ | ---- | ------------------ | +| startingWindowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 动画目标窗口。 | +| finishCallback | [WindowAnimationFinishedCallback](#windowanimationfinishedcallback) | 是 | 动画完成后的回调。 | + +**示例:** + +```js +var controller = { + onStartAppFromLauncher(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { + console.log('onStartAppFromLauncher', startingWindowTarget); + } +} +``` + +### onStartAppFromRecent + +onStartAppFromRecent(startingWindowTarget: WindowAnimationTarget,finishCallback:WindowAnimationFinishedCallback): void + +从最近任务列表启动应用时的回调。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +| 参数名 | 类型 | 必填 | 说明 | +| -------------------- | ------------------------------------------------------------ | ---- | ------------------ | +| startingWindowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 动画目标窗口。 | +| finishCallback | [WindowAnimationFinishedCallback](#windowanimationfinishedcallback) | 是 | 动画完成后的回调。 | + +**示例:** + +```js +var controller = { + onStartAppFromRecent(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { + console.log('onStartAppFromRecent', startingWindowTarget); + } +} +``` + +### onStartAppFromOther + +onStartAppFromOther(startingWindowTarget: WindowAnimationTarget,finishCallback: WindowAnimationFinishedCallback): void + +从除了桌面和最近任务列表以外其他地方启动应用时的回调。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +| 参数名 | 类型 | 必填 | 说明 | +| -------------------- | ------------------------------------------------------------ | ---- | ------------------ | +| startingWindowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 动画目标窗口。 | +| finishCallback | [WindowAnimationFinishedCallback](#windowanimationfinishedcallback) | 是 | 动画完成后的回调。 | + +**示例:** + +```js +var controller = { + onStartAppFromOther(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { + console.log('onStartAppFromOther', startingWindowTarget); + } +} +``` + +### onAppTransition + +onAppTransition(fromWindowTarget: WindowAnimationTarget, toWindowTarget: WindowAnimationTarget,finishCallback: WindowAnimationFinishedCallback): void + +应用转场时的回调。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +| 参数名 | 类型 | 必填 | 说明 | +| -------------------- | ------------------------------- | ---- | ---------------- | +| fromWindowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 转场前的动画窗口。 | +| toWindowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 转场后的动画窗口。 | +| finishCallback | [WindowAnimationFinishedCallback](#windowanimationfinishedcallback) | 是 | 动画完成后的回调。 | + +**示例:** + +```js +var controller = { + onAppTransition(fromWindowTarget: WindowAnimationTarget, toWindowTarget: WindowAnimationTarget, + finishCallback: WindowAnimationFinishedCallback): void { + console.log('onAppTransition', fromWindowTarget); + } +} +``` + +### onMinimizeWindow + +onMinimizeWindow(minimizingWindowTarget: WindowAnimationTarget,finishCallback: WindowAnimationFinishedCallback): void + +最小化窗口时的回调。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +| 参数名 | 类型 | 必填 | 说明 | +| -------------------- | ------------------------------- | ---- | ---------------- | +| minimizingWindowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 动画目标窗口。 | +| finishCallback | [WindowAnimationFinishedCallback](#windowanimationfinishedcallback) | 是 | 动画完成后的回调。 | + +**示例:** + +```js +var controller = { + onMinimizeWindow(minimizingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { + console.log('onMinimizeWindow', minimizingWindowTarget); + } +} +``` + +### onCloseWindow + +onCloseWindow(closingWindowTarget: WindowAnimationTarget,finishCallback: WindowAnimationFinishedCallback): void + +关闭窗口时的回调。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +| 参数名 | 类型 | 必填 | 说明 | +| -------------------- | ------------------------------- | ---- | ---------------- | +| closingWindowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 动画目标窗口。 | +| finishCallback | [WindowAnimationFinishedCallback](#windowanimationfinishedcallback) | 是 | 动画完成后的回调。 | + +**示例:** + +```js +var controller = { + onCloseWindow(closingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { + console.log('onCloseWindow', closingWindowTarget); + } +} +``` + +### onScreenUnlock + +onScreenUnlock(finishCallback: [WindowAnimationFinishedCallback](#windowanimationfinishedcallback)): void + +屏幕解锁时的回调。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | ------------------------------------------------------------ | ---- | ------------------ | +| finishCallback | [WindowAnimationFinishedCallback](#windowanimationfinishedcallback) | 是 | 动画完成后的回调。 | + +**示例:** + +```js +var controller = { + onScreenUnlock(finishCallback: WindowAnimationFinishedCallback): void { + console.log('onScreenUnlock'.); + } +} +``` + +## WindowAnimationFinishedCallback +动画完成后的回调。 + +### onAnimationFinish + +onAnimationFinish():void + +结束本次动画。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**示例:** + +```js +var controller = { + onCloseWindow(closingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void { + finishCallback.onAnimationFinish(); + } +} +``` + +## WindowAnimationTarget +动画目标窗口,用来实现动画。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +| 参数 | 类型 | 描述 | +| ------- | ------ | ----------------------- | +| bundleName | string | 动画目标窗口所对应的包名。 | +| abilityName | string | 动画目标窗口所对应的Ability名称。 | +| windowBounds | [RRect](#rrect) | 动画目标窗口所对应的实际大小。 | + +## RRect +圆角矩形。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +| 参数 | 类型 | 描述 | +| ------- | ------ | ----------------------- | +| left | number | 动画目标窗口左上角相对于屏幕的横坐标。 | +| top | number | 动画目标窗口左上角相对于屏幕的纵坐标。 | +| width | number | 动画目标窗口的宽度大小。 | +| height | number | 动画目标窗口的高度大小。 | +| radius | number | 动画目标窗口的圆角大小。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-xml.md b/zh-cn/application-dev/reference/apis/js-apis-xml.md index d004358e5f12565e4b5e6900a11e1b3d2e0baad0..412412d1c59b21053c292b55c692ae4ad5579c71 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-xml.md +++ b/zh-cn/application-dev/reference/apis/js-apis-xml.md @@ -146,7 +146,7 @@ thatSer.setNamespace("h", "http://www.w3.org/TR/html4/"); thatSer.startElement("table"); thatSer.setAttributes("importance", "high"); thatSer.setText("Happy"); -endElement(); // => Happy +thatSer.endElement(); // => Happy ``` diff --git a/zh-cn/application-dev/reference/arkui-js/Readme-CN.md b/zh-cn/application-dev/reference/arkui-js/Readme-CN.md index 4ef8ba58b6092774b74d096a3ab36cf09996661c..2a1209a974d273ca6187367ca3fa58cc981c5a10 100644 --- a/zh-cn/application-dev/reference/arkui-js/Readme-CN.md +++ b/zh-cn/application-dev/reference/arkui-js/Readme-CN.md @@ -1,98 +1,99 @@ # 基于JS扩展的类Web开发范式 -- 组件 - - 通用 - - [通用属性](js-components-common-attributes.md) - - [通用样式](js-components-common-styles.md) - - [通用事件](js-components-common-events.md) - - [通用方法](js-components-common-methods.md) - - [动画样式](js-components-common-animation.md) - - [渐变样式](js-components-common-gradient.md) - - [转场样式](js-components-common-transition.md) - - [媒体查询](js-components-common-mediaquery.md) - - [自定义字体样式](js-components-common-customizing-font.md) - - [原子布局](js-components-common-atomic-layout.md) - - 容器组件 - - [badge](js-components-container-badge.md) - - [dialog](js-components-container-dialog.md) - - [div](js-components-container-div.md) - - [form](js-components-container-form.md) - - [list](js-components-container-list.md) - - [list-item](js-components-container-list-item.md) - - [list-item-group](js-components-container-list-item-group.md) - - [panel](js-components-container-panel.md) - - [popup](js-components-container-popup.md) - - [refresh](js-components-container-refresh.md) - - [stack](js-components-container-stack.md) - - [stepper](js-components-container-stepper.md) - - [stepper-item](js-components-container-stepper-item.md) - - [swiper](js-components-container-swiper.md) - - [tabs](js-components-container-tabs.md) - - [tab-bar](js-components-container-tab-bar.md) - - [tab-content](js-components-container-tab-content.md) - - 基础组件 - - [button](js-components-basic-button.md) - - [chart](js-components-basic-chart.md) - - [divider](js-components-basic-divider.md) - - [image](js-components-basic-image.md) - - [image-animator](js-components-basic-image-animator.md) - - [input](js-components-basic-input.md) - - [label](js-components-basic-label.md) - - [marquee](js-components-basic-marquee.md) - - [menu](js-components-basic-menu.md) - - [option](js-components-basic-option.md) - - [picker](js-components-basic-picker.md) - - [picker-view](js-components-basic-picker-view.md) - - [piece](js-components-basic-piece.md) - - [progress](js-components-basic-progress.md) - - [qrcode](js-components-basic-qrcode.md) - - [rating](js-components-basic-rating.md) - - [richtext](js-components-basic-richtext.md) - - [search](js-components-basic-search.md) - - [select](js-components-basic-select.md) - - [slider](js-components-basic-slider.md) - - [span](js-components-basic-span.md) - - [switch](js-components-basic-switch.md) - - [text](js-components-basic-text.md) - - [textarea](js-components-basic-textarea.md) - - [toolbar](js-components-basic-toolbar.md) - - [toolbar-item](js-components-basic-toolbar-item.md) - - [toggle](js-components-basic-toggle.md) - - [web](js-components-basic-web.md) - - [xcomponent](js-components-basic-xcomponent.md) - - 媒体组件 - - [video](js-components-media-video.md) - - 画布组件 - - [canvas组件](js-components-canvas-canvas.md) - - [CanvasRenderingContext2D对象](js-components-canvas-canvasrenderingcontext2d.md) - - [Image对象](js-components-canvas-image.md) - - [CanvasGradient对象](js-components-canvas-canvasgradient.md) - - [ImageData对象](js-components-canvas-imagedata.md) - - [Path2D对象](js-components-canvas-path2d.md) - - [ImageBitmap对象](js-components-canvas-imagebitmap.md) - - [OffscreenCanvas对象](js-components-canvas-offscreencanvas.md) - - [OffscreenCanvasRenderingContext2D对象](js-offscreencanvasrenderingcontext2d.md) - - 栅格组件 - - [基本概念](js-components-grid-basic-concepts.md) - - [grid-container](js-components-grid-container.md) - - [grid-row](js-components-grid-row.md) - - [grid-col](js-components-grid-col.md) - - svg组件 - - [通用属性](js-components-svg-common-attributes.md) - - [svg](js-components-svg.md) - - [rect](js-components-svg-rect.md) - - [circle](js-components-svg-circle.md) - - [ellipse](js-components-svg-ellipse.md) - - [path](js-components-svg-path.md) - - [line](js-components-svg-line.md) - - [polyline](js-components-svg-polyline.md) - - [polygon](js-components-svg-polygon.md) - - [text](js-components-svg-text.md) - - [tspan](js-components-svg-tspan.md) - - [textPath](js-components-svg-textpath.md) - - [animate](js-components-svg-animate.md) - - [animateMotion](js-components-svg-animatemotion.md) - - [animateTransform](js-components-svg-animatetransform.md) +- 组件通用信息 + - [通用属性](js-components-common-attributes.md) + - [通用样式](js-components-common-styles.md) + - [通用事件](js-components-common-events.md) + - [通用方法](js-components-common-methods.md) + - [动画样式](js-components-common-animation.md) + - [渐变样式](js-components-common-gradient.md) + - [转场样式](js-components-common-transition.md) + - [媒体查询](js-components-common-mediaquery.md) + - [自定义字体样式](js-components-common-customizing-font.md) + - [原子布局](js-components-common-atomic-layout.md) +- 容器组件 + - [badge](js-components-container-badge.md) + - [dialog](js-components-container-dialog.md) + - [div](js-components-container-div.md) + - [form](js-components-container-form.md) + - [list](js-components-container-list.md) + - [list-item](js-components-container-list-item.md) + - [list-item-group](js-components-container-list-item-group.md) + - [panel](js-components-container-panel.md) + - [popup](js-components-container-popup.md) + - [refresh](js-components-container-refresh.md) + - [stack](js-components-container-stack.md) + - [stepper](js-components-container-stepper.md) + - [stepper-item](js-components-container-stepper-item.md) + - [swiper](js-components-container-swiper.md) + - [tabs](js-components-container-tabs.md) + - [tab-bar](js-components-container-tab-bar.md) + - [tab-content](js-components-container-tab-content.md) +- 基础组件 + - [button](js-components-basic-button.md) + - [chart](js-components-basic-chart.md) + - [divider](js-components-basic-divider.md) + - [image](js-components-basic-image.md) + - [image-animator](js-components-basic-image-animator.md) + - [input](js-components-basic-input.md) + - [label](js-components-basic-label.md) + - [marquee](js-components-basic-marquee.md) + - [menu](js-components-basic-menu.md) + - [option](js-components-basic-option.md) + - [picker](js-components-basic-picker.md) + - [picker-view](js-components-basic-picker-view.md) + - [piece](js-components-basic-piece.md) + - [progress](js-components-basic-progress.md) + - [qrcode](js-components-basic-qrcode.md) + - [rating](js-components-basic-rating.md) + - [richtext](js-components-basic-richtext.md) + - [search](js-components-basic-search.md) + - [select](js-components-basic-select.md) + - [slider](js-components-basic-slider.md) + - [span](js-components-basic-span.md) + - [switch](js-components-basic-switch.md) + - [text](js-components-basic-text.md) + - [textarea](js-components-basic-textarea.md) + - [toolbar](js-components-basic-toolbar.md) + - [toolbar-item](js-components-basic-toolbar-item.md) + - [toggle](js-components-basic-toggle.md) + - [web](js-components-basic-web.md) + - [xcomponent](js-components-basic-xcomponent.md) +- 媒体组件 + - [video](js-components-media-video.md) +- 画布组件 + - [canvas组件](js-components-canvas-canvas.md) + - [CanvasRenderingContext2D对象](js-components-canvas-canvasrenderingcontext2d.md) + - [Image对象](js-components-canvas-image.md) + - [CanvasGradient对象](js-components-canvas-canvasgradient.md) + - [ImageData对象](js-components-canvas-imagedata.md) + - [Path2D对象](js-components-canvas-path2d.md) + - [ImageBitmap对象](js-components-canvas-imagebitmap.md) + - [OffscreenCanvas对象](js-components-canvas-offscreencanvas.md) + - [OffscreenCanvasRenderingContext2D对象](js-offscreencanvasrenderingcontext2d.md) +- 栅格组件 + - [基本概念](js-components-grid-basic-concepts.md) + - [grid-container](js-components-grid-container.md) + - [grid-row](js-components-grid-row.md) + - [grid-col](js-components-grid-col.md) +- svg组件 + - [通用属性](js-components-svg-common-attributes.md) + - [svg](js-components-svg.md) + - [rect](js-components-svg-rect.md) + - [circle](js-components-svg-circle.md) + - [ellipse](js-components-svg-ellipse.md) + - [path](js-components-svg-path.md) + - [line](js-components-svg-line.md) + - [polyline](js-components-svg-polyline.md) + - [polygon](js-components-svg-polygon.md) + - [text](js-components-svg-text.md) + - [tspan](js-components-svg-tspan.md) + - [textPath](js-components-svg-textpath.md) + - [animate](js-components-svg-animate.md) + - [animateMotion](js-components-svg-animatemotion.md) + - [animateTransform](js-components-svg-animatetransform.md) + + - 自定义组件 - [基本用法](js-components-custom-basic-usage.md) - [继承样式](js-components-custom-style.md) @@ -101,5 +102,4 @@ - [事件参数](js-components-custom-event-parameter.md) - [slot插槽](js-components-custom-slot.md) - [生命周期定义](js-components-custom-lifecycle.md) -- 附录 - - [类型说明](js-appendix-types.md) +- [数据类型说明](js-appendix-types.md) diff --git a/zh-cn/application-dev/reference/arkui-js/js-appendix-types.md b/zh-cn/application-dev/reference/arkui-js/js-appendix-types.md index 27c952f8c6c970bfa4cb427dd22baec0e61db6f4..db674a87f14740cceb8380d62bf20433b982632d 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-appendix-types.md +++ b/zh-cn/application-dev/reference/arkui-js/js-appendix-types.md @@ -1,4 +1,4 @@ -# 类型说明 +# 数据类型说明 ## 长度类型 @@ -10,8 +10,8 @@ ## 颜色类型 -| 名称 | 类型定义 | 描述 | -| ----- | --------------------- | ---------------------------------------- | +| 名称 | 类型定义 | 描述 | +| ----- | --------------------------- | ---------------------------------------- | | color | string \| 颜色枚举字符串 | 用于描述颜色信息,JS脚本中不支持颜色枚举格式。
字符串格式如下:
- 'rgb(255, 255, 255)'
- 'rgba(255, 255, 255, 1.0)'
- HEX格式:'\#rrggbb','\#aarrggbb'
- 枚举格式:'black','white'。 | **表1** 当前支持的颜色枚举 diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-basic-input.md b/zh-cn/application-dev/reference/arkui-js/js-components-basic-input.md index 9f840b4beabf0c123c8297ba62ee3f8bc49c2235..4efc9f3778a084b4f6850f1a76d66d7f4737bbbb 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-basic-input.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-basic-input.md @@ -23,7 +23,7 @@ | -------------------------------- | ----------------------- | --------- | ---- | ---------------------------------------- | | type | string | text
| 否 | input组件类型,可选值为text,email,date,time,number,password,button,checkbox,radio。
其中text,email,date,time,number,password这六种类型之间支持动态切换修改。
button,checkbox,radio不支持动态修改。可选值定义如下:
- button:定义可点击的按钮;
- checkbox:定义多选框;
- radio:定义单选按钮,允许在多个拥有相同name值的选项中选中其中一个;
- text:定义一个单行的文本字段;
- email:定义用于e-mail地址的字段;
- date:定义 date 控件(包括年、月、日,不包括时间);
- time:定义用于输入时间的控件(不带时区);
- number:定义用于输入数字的字段;
- password:定义密码字段(字段中的字符会被遮蔽)。 | | checked | boolean | false | 否 | 当前组件是否选中,仅type为checkbox和radio生效。 | -| name | string | - | 否 | input组件的名称。 | +| name | string | - | 否 | input组件的名称。
type为radio时,name为必填。 | | value | string | - | 否 | input组件的value值,当类型为radio时必填且相同name值的选项该值唯一。 | | placeholder | string | - | 否 | 设置提示文本的内容,仅在type为text\|email\|date\|time\|number\|password时生效。 | | maxlength | number | - | 否 | 输入框可输入的最多字符数量,不填表示不限制输入框中字符数量。 | diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-basic-picker.md b/zh-cn/application-dev/reference/arkui-js/js-components-basic-picker.md index 737797a239fb7a7789d0fbb7633aae75dd156e28..7e4751d2b207bc43d252d3a36e6dfdf6eea1d9d4 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-basic-picker.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-basic-picker.md @@ -18,7 +18,7 @@ ## 属性 -除支持[通用属性](../arkui-js/js-components-common-attributes.md)外,还支持如下属性:↵ +除支持[通用属性](../arkui-js/js-components-common-attributes.md)外,还支持如下属性: | 名称 | 类型 | 默认值 | 必填 | 描述 | | ---- | ------ | ---- | ---- | ---------------------------------------- | diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md b/zh-cn/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md index 0c9b90fb19dfb7a42fb73f97f786d72966fe03fa..51aa4618b3bd86def22292491ef4c056c513fb0f 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md @@ -1777,7 +1777,7 @@ getImageData(sx: number, sy: number, sw: number, sh: number): Object ```html
- +
``` @@ -1813,7 +1813,7 @@ putImageData(imageData: Object, dx: number, dy: number, dirtyX: number, dirtyY: ```html
- +
``` diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-common-animation.md b/zh-cn/application-dev/reference/arkui-js/js-components-common-animation.md index f421cec1de41e922c2576f6f306436f38facd00d..52930bd935d7e69a83d3253121154cf869c91f33 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-common-animation.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-common-animation.md @@ -77,6 +77,7 @@ display: flex; justify-content: center; align-items: center; + margin: 150px; } .rect{ width: 200px; @@ -92,7 +93,7 @@ } /* 可以通过百分比指定动画运行的中间状态 */ 50% { - background-color: \#f76160; + background-color: #f76160; transform:translate(100px) rotate(60deg) scale(1.3); } to { diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-common-transition.md b/zh-cn/application-dev/reference/arkui-js/js-components-common-transition.md index ee8b4a65a998809b645117db9d2bf04101b48e38..67e55748dcf4baf58b5df617cc9bd0300baab7a0 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-common-transition.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-common-transition.md @@ -49,6 +49,8 @@ PageA跳转到PageB,跳转的共享元素为image, shareid为“shareImage + + Click on picture to Jump to ths details @@ -61,7 +63,8 @@ import router from '@system.router'; export default { jump() { router.push({ - uri: 'detailpage', + // 路径要与config.json配置里面的相同 + uri: 'pages/detailpage', }); }, } diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-svg-text.md b/zh-cn/application-dev/reference/arkui-js/js-components-svg-text.md index 3e98506602702595eb6a35d279b688fc470a9315..4df75ebf6511acbe66d25da3d0f012541c8bdee9 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-svg-text.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-svg-text.md @@ -94,10 +94,10 @@
+ text attribute x|opacity|rotate - text attribute x|opacity|rotate
diff --git a/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md b/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md index cb447c2fb3dfad40c9c212822e9727e29d2ee66d..1695c7d920128c10e0d842c1dfe1a174bc5aa3bc 100644 --- a/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md +++ b/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md @@ -1,136 +1,139 @@ # 基于TS扩展的声明式开发范式 -- 组件 - - 通用 - - 通用事件 - - [点击事件](ts-universal-events-click.md) - - [触摸事件](ts-universal-events-touch.md) - - [挂载卸载事件](ts-universal-events-show-hide.md) - - [拖拽事件](ts-universal-events-drag-drop.md) - - [按键事件](ts-universal-events-key.md) - - [焦点事件](ts-universal-focus-event.md) - - [鼠标事件](ts-universal-mouse-key.md) - - [组件区域变化事件](ts-universal-component-area-change-event.md) - - 通用属性 - - [尺寸设置](ts-universal-attributes-size.md) - - [位置设置](ts-universal-attributes-location.md) - - [布局约束](ts-universal-attributes-layout-constraints.md) - - [Flex布局](ts-universal-attributes-flex-layout.md) - - [边框设置](ts-universal-attributes-border.md) - - [图片边框设置](ts-universal-attributes-border-image.md) - - [背景设置](ts-universal-attributes-background.md) - - [透明度设置](ts-universal-attributes-opacity.md) - - [显隐控制](ts-universal-attributes-visibility.md) - - [禁用控制](ts-universal-attributes-enable.md) - - [浮层](ts-universal-attributes-overlay.md) - - [Z序控制](ts-universal-attributes-z-order.md) - - [图形变换](ts-universal-attributes-transformation.md) - - [图像效果](ts-universal-attributes-image-effect.md) - - [形状裁剪](ts-universal-attributes-sharp-clipping.md) - - [文本样式设置](ts-universal-attributes-text-style.md) - - [栅格设置](ts-universal-attributes-grid.md) - - [颜色渐变](ts-universal-attributes-gradient-color.md) - - [Popup控制](ts-universal-attributes-popup.md) - - [Menu控制](ts-universal-attributes-menu.md) - - [点击控制](ts-universal-attributes-click.md) - - [焦点控制](ts-universal-attributes-focus.md) - - [悬浮态效果](ts-universal-attributes-hover-effect.md) - - [组件标识](ts-universal-attributes-component-id.md) - - [触摸热区设置](ts-universal-attributes-touch-target.md) - - [多态样式](ts-universal-attributes-polymorphic-style.md) - - 手势处理 - - [绑定手势方法](ts-gesture-settings.md) - - 基础手势 - - [TapGesture](ts-basic-gestures-tapgesture.md) - - [LongPressGesture](ts-basic-gestures-longpressgesture.md) - - [PanGesture](ts-basic-gestures-pangesture.md) - - [PinchGesture](ts-basic-gestures-pinchgesture.md) - - [RotationGesture](ts-basic-gestures-rotationgesture.md) - - [SwipeGesture](ts-basic-gestures-swipegesture.md) - - [组合手势](ts-combined-gestures.md) - - 基础组件 - - [Blank](ts-basic-components-blank.md) - - [Button](ts-basic-components-button.md) - - [Checkbox](ts-basic-components-checkbox.md) - - [CheckboxGroup](ts-basic-components-checkboxgroup.md) - - [DataPanel](ts-basic-components-datapanel.md) - - [DatePicker](ts-basic-components-datepicker.md) - - [Divider](ts-basic-components-divider.md) - - [Gauge](ts-basic-components-gauge.md) - - [Image](ts-basic-components-image.md) - - [ImageAnimator](ts-basic-components-imageanimator.md) - - [LoadingProgress](ts-basic-components-loadingprogress.md) - - [Marquee](ts-basic-components-marquee.md) - - [Navigation](ts-basic-components-navigation.md) - - [PatternLock](ts-basic-components-patternlock.md) - - [PluginComponent](ts-basic-components-plugincomponent.md) - - [Progress](ts-basic-components-progress.md) - - [QRCode](ts-basic-components-qrcode.md) - - [Radio](ts-basic-components-radio.md) - - [Rating](ts-basic-components-rating.md) - - [RichText](ts-basic-components-richtext.md) - - [ScrollBar](ts-basic-components-scrollbar.md) - - [Search](ts-basic-components-search.md) - - [Select](ts-basic-components-select.md) - - [Slider](ts-basic-components-slider.md) - - [Span](ts-basic-components-span.md) - - [Stepper](ts-basic-components-stepper.md) - - [StepperItem](ts-basic-components-stepperitem.md) - - [Text](ts-basic-components-text.md) - - [TextArea](ts-basic-components-textarea.md) - - [TextClock](ts-basic-components-textclock.md) - - [TextInput](ts-basic-components-textinput.md) - - [TextPicker](ts-basic-components-textpicker.md) - - [TextTimer](ts-basic-components-texttimer.md) - - [TimePicker](ts-basic-components-timepicker.md) - - [Toggle](ts-basic-components-toggle.md) - - [Web](ts-basic-components-web.md) - - [XComponent](ts-basic-components-xcomponent.md) - - 容器组件 - - [AbilityComponent](ts-container-ability-component.md) - - [AlphabetIndexer](ts-container-alphabet-indexer.md) - - [Badge](ts-container-badge.md) - - [Column](ts-container-column.md) - - [ColumnSplit](ts-container-columnsplit.md) - - [Counter](ts-container-counter.md) - - [Flex](ts-container-flex.md) - - [GridContainer](ts-container-gridcontainer.md) - - [Grid](ts-container-grid.md) - - [GridItem](ts-container-griditem.md) - - [List](ts-container-list.md) - - [ListItem](ts-container-listitem.md) - - [Navigator](ts-container-navigator.md) - - [Panel](ts-container-panel.md) - - [Refresh](ts-container-refresh.md) - - [RelativeContainer](ts-container-relativecontainer.md) - - [Row](ts-container-row.md) - - [RowSplit](ts-container-rowsplit.md) - - [Scroll](ts-container-scroll.md) - - [SideBarContainer](ts-container-sidebarcontainer.md) - - [Stack](ts-container-stack.md) - - [Swiper](ts-container-swiper.md) - - [Tabs](ts-container-tabs.md) - - [TabContent](ts-container-tabcontent.md) - - 媒体组件 - - [Video](ts-media-components-video.md) - - 绘制组件 - - [Circle](ts-drawing-components-circle.md) - - [Ellipse](ts-drawing-components-ellipse.md) - - [Line](ts-drawing-components-line.md) - - [Polyline](ts-drawing-components-polyline.md) - - [Polygon](ts-drawing-components-polygon.md) - - [Path](ts-drawing-components-path.md) - - [Rect](ts-drawing-components-rect.md) - - [Shape](ts-drawing-components-shape.md) - - 画布组件 - - [Canvas](ts-components-canvas-canvas.md) - - [CanvasRenderingContext2D对象](ts-canvasrenderingcontext2d.md) - - [OffscreenCanvasRenderingConxt2D对象](ts-offscreencanvasrenderingcontext2d.md) - - [Lottie](ts-components-canvas-lottie.md) - - [Path2D对象](ts-components-canvas-path2d.md) - - [CanvasGradient对象](ts-components-canvas-canvasgradient.md) - - [ImageBitmap对象](ts-components-canvas-imagebitmap.md) - - [ImageData对象](ts-components-canvas-imagedata.md) +- 组件通用信息 + - 通用事件 + - [点击事件](ts-universal-events-click.md) + - [触摸事件](ts-universal-events-touch.md) + - [挂载卸载事件](ts-universal-events-show-hide.md) + - [拖拽事件](ts-universal-events-drag-drop.md) + - [按键事件](ts-universal-events-key.md) + - [焦点事件](ts-universal-focus-event.md) + - [鼠标事件](ts-universal-mouse-key.md) + - [组件区域变化事件](ts-universal-component-area-change-event.md) + - [组件可见区域变化事件](ts-universal-component-visible-area-change-event.md) + - 通用属性 + - [尺寸设置](ts-universal-attributes-size.md) + - [位置设置](ts-universal-attributes-location.md) + - [布局约束](ts-universal-attributes-layout-constraints.md) + - [Flex布局](ts-universal-attributes-flex-layout.md) + - [边框设置](ts-universal-attributes-border.md) + - [图片边框设置](ts-universal-attributes-border-image.md) + - [背景设置](ts-universal-attributes-background.md) + - [透明度设置](ts-universal-attributes-opacity.md) + - [显隐控制](ts-universal-attributes-visibility.md) + - [禁用控制](ts-universal-attributes-enable.md) + - [浮层](ts-universal-attributes-overlay.md) + - [Z序控制](ts-universal-attributes-z-order.md) + - [图形变换](ts-universal-attributes-transformation.md) + - [图像效果](ts-universal-attributes-image-effect.md) + - [形状裁剪](ts-universal-attributes-sharp-clipping.md) + - [文本样式设置](ts-universal-attributes-text-style.md) + - [栅格设置](ts-universal-attributes-grid.md) + - [颜色渐变](ts-universal-attributes-gradient-color.md) + - [Popup控制](ts-universal-attributes-popup.md) + - [Menu控制](ts-universal-attributes-menu.md) + - [点击控制](ts-universal-attributes-click.md) + - [焦点控制](ts-universal-attributes-focus.md) + - [悬浮态效果](ts-universal-attributes-hover-effect.md) + - [组件标识](ts-universal-attributes-component-id.md) + - [触摸热区设置](ts-universal-attributes-touch-target.md) + - [多态样式](ts-universal-attributes-polymorphic-style.md) + - 手势处理 + - [绑定手势方法](ts-gesture-settings.md) + - 基础手势 + - [TapGesture](ts-basic-gestures-tapgesture.md) + - [LongPressGesture](ts-basic-gestures-longpressgesture.md) + - [PanGesture](ts-basic-gestures-pangesture.md) + - [PinchGesture](ts-basic-gestures-pinchgesture.md) + - [RotationGesture](ts-basic-gestures-rotationgesture.md) + - [SwipeGesture](ts-basic-gestures-swipegesture.md) + - [组合手势](ts-combined-gestures.md) +- 基础组件 + - [Blank](ts-basic-components-blank.md) + - [Button](ts-basic-components-button.md) + - [Checkbox](ts-basic-components-checkbox.md) + - [CheckboxGroup](ts-basic-components-checkboxgroup.md) + - [DataPanel](ts-basic-components-datapanel.md) + - [DatePicker](ts-basic-components-datepicker.md) + - [Divider](ts-basic-components-divider.md) + - [Gauge](ts-basic-components-gauge.md) + - [Image](ts-basic-components-image.md) + - [ImageAnimator](ts-basic-components-imageanimator.md) + - [LoadingProgress](ts-basic-components-loadingprogress.md) + - [Marquee](ts-basic-components-marquee.md) + - [Navigation](ts-basic-components-navigation.md) + - [PatternLock](ts-basic-components-patternlock.md) + - [PluginComponent](ts-basic-components-plugincomponent.md) + - [Progress](ts-basic-components-progress.md) + - [QRCode](ts-basic-components-qrcode.md) + - [Radio](ts-basic-components-radio.md) + - [Rating](ts-basic-components-rating.md) + - [RemoteWindow](ts-basic-components-remotewindow.md) + - [RichText](ts-basic-components-richtext.md) + - [ScrollBar](ts-basic-components-scrollbar.md) + - [Search](ts-basic-components-search.md) + - [Select](ts-basic-components-select.md) + - [Slider](ts-basic-components-slider.md) + - [Span](ts-basic-components-span.md) + - [Stepper](ts-basic-components-stepper.md) + - [StepperItem](ts-basic-components-stepperitem.md) + - [Text](ts-basic-components-text.md) + - [TextArea](ts-basic-components-textarea.md) + - [TextClock](ts-basic-components-textclock.md) + - [TextInput](ts-basic-components-textinput.md) + - [TextPicker](ts-basic-components-textpicker.md) + - [TextTimer](ts-basic-components-texttimer.md) + - [TimePicker](ts-basic-components-timepicker.md) + - [Toggle](ts-basic-components-toggle.md) + - [Web](ts-basic-components-web.md) + - [XComponent](ts-basic-components-xcomponent.md) +- 容器组件 + - [AbilityComponent](ts-container-ability-component.md) + - [AlphabetIndexer](ts-container-alphabet-indexer.md) + - [Badge](ts-container-badge.md) + - [Column](ts-container-column.md) + - [ColumnSplit](ts-container-columnsplit.md) + - [Counter](ts-container-counter.md) + - [Flex](ts-container-flex.md) + - [GridContainer](ts-container-gridcontainer.md) + - [Grid](ts-container-grid.md) + - [GridItem](ts-container-griditem.md) + - [List](ts-container-list.md) + - [ListItem](ts-container-listitem.md) + - [Navigator](ts-container-navigator.md) + - [Panel](ts-container-panel.md) + - [Refresh](ts-container-refresh.md) + - [RelativeContainer](ts-container-relativecontainer.md) + - [Row](ts-container-row.md) + - [RowSplit](ts-container-rowsplit.md) + - [Scroll](ts-container-scroll.md) + - [SideBarContainer](ts-container-sidebarcontainer.md) + - [Stack](ts-container-stack.md) + - [Swiper](ts-container-swiper.md) + - [Tabs](ts-container-tabs.md) + - [TabContent](ts-container-tabcontent.md) +- 媒体组件 + - [Video](ts-media-components-video.md) +- 绘制组件 + - [Circle](ts-drawing-components-circle.md) + - [Ellipse](ts-drawing-components-ellipse.md) + - [Line](ts-drawing-components-line.md) + - [Polyline](ts-drawing-components-polyline.md) + - [Polygon](ts-drawing-components-polygon.md) + - [Path](ts-drawing-components-path.md) + - [Rect](ts-drawing-components-rect.md) + - [Shape](ts-drawing-components-shape.md) +- 画布组件 + - [Canvas](ts-components-canvas-canvas.md) + - [CanvasRenderingContext2D对象](ts-canvasrenderingcontext2d.md) + - [OffscreenCanvasRenderingConxt2D对象](ts-offscreencanvasrenderingcontext2d.md) + - [Lottie](ts-components-canvas-lottie.md) + - [Path2D对象](ts-components-canvas-path2d.md) + - [CanvasGradient对象](ts-components-canvas-canvasgradient.md) + - [ImageBitmap对象](ts-components-canvas-imagebitmap.md) + - [ImageData对象](ts-components-canvas-imagedata.md) + + - 动画 - [属性动画](ts-animatorproperty.md) - [显式动画](ts-explicit-animation.md) diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/borderImage.png b/zh-cn/application-dev/reference/arkui-ts/figures/borderImage.png index a111a8e4ed06adf129c010801d10880a22018b25..22285e0910e3c447036d2144194a2e4301c2df6f 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/borderImage.png and b/zh-cn/application-dev/reference/arkui-ts/figures/borderImage.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/borderImageGradient.png b/zh-cn/application-dev/reference/arkui-ts/figures/borderImageGradient.png new file mode 100644 index 0000000000000000000000000000000000000000..edf91d4844deeee4f997f65d2d88b45bf7ff7f1d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/borderImageGradient.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/checkboxgroup.gif b/zh-cn/application-dev/reference/arkui-ts/figures/checkboxgroup.gif index 5d4c6e059f96d3f021f100ffb7c9899630f982ee..27b1a29a14e3bfca893f853d1e185c7493afb366 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/checkboxgroup.gif and b/zh-cn/application-dev/reference/arkui-ts/figures/checkboxgroup.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/focus.png b/zh-cn/application-dev/reference/arkui-ts/figures/focus.png new file mode 100644 index 0000000000000000000000000000000000000000..217dcfbca0de33adef4ffa0d90fd167192845c3c Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/focus.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219982705.gif b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219982705.gif index 89da584f60db920d0801f9e40138a56fd4242fd3..794e6fea1ccbe37ea7bac2dc93b57333fa412ead 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219982705.gif and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219982705.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-blank.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-blank.md index efd45c871b0b9a7f4c34f503bc76a67ae763646f..88a5ed06137d53013fc251ef068033a6623feb0a 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-blank.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-blank.md @@ -31,7 +31,7 @@ Blank(min?: Length) | 名称 | 参数类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| color | Color | 0x00000000 | 设置空白填充的填充颜色。 | +| color | [ResourceColor](../../ui/ts-types.md) | 0x00000000 | 设置空白填充的填充颜色。 | > **说明:** > - 不支持通用属性方法。 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md index 27ac9a92677ae717972bb9a7e759189f78d157f0..234c8df1644e2c064dc707e34ff1c901a8301574 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md @@ -28,7 +28,7 @@ | stateEffect | boolean | 否 | true | 按钮按下时是否开启切换效果,当状态置为false时,点击效果关闭。 | -- Button(label?: string, options?: { type?: ButtonType, stateEffect?: boolean }) +- Button(label?: [ResourceStr](../../ui/ts-types.md), options?: { type?: ButtonType, stateEffect?: boolean }) 使用文本内容创建相应的按钮组件,此时Button无法包含子组件。 @@ -36,7 +36,7 @@ | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | -------- | -------- | -------- | -------- | -------- | - | label | string | 否 | - | 按钮文本内容。 | + | label | [ResourceStr](../../ui/ts-types.md) | 否 | - | 按钮文本内容。 | | options | Object | 否 | - | 见options参数说明。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md index 2e4ce7801249b39e17703c36676f4214c1b528bf..ed99d0137cd965b927013eda6897a0ee0040d528 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md @@ -27,19 +27,19 @@ CheckboxGroup( group?: string ) ## 属性 -| 名称 | 参数类型 | 默认值 | 描述 | +| 名称 | 参数类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| selectAll | boolean | false | 设置是否全选。 | -| selectedColor | Color | - | 设置被选中或部分选中状态的颜色。 | +| selectAll | boolean | false | 设置是否全选。 | +| selectedColor | Color | - | 设置被选中或部分选中状态的颜色。 | ## 事件 -| 名称 | 功能描述 | +| 名称 | 功能描述 | | -------- | -------- | -| onChange (callback: (names: Array<string>, status: SelectStatus) => void ) |CheckboxGroup的选中状态或群组内的Checkbox的选中状态发生变化时,触发回调。
- names:群组内所有被选中的多选框名称。
- status:选中状态。| +| onChange (callback: (names: Array<string>, status: SelectStatus) => void ) |CheckboxGroup的选中状态或群组内的Checkbox的选中状态发生变化时,触发回调。
- names:群组内所有被选中的多选框名称。
- status:选中状态。| - SelectStatus枚举说明 - | 名称 | 描述 | + | 名称 | 描述 | | ----- | -------------------- | | All | 群组多选择框全部选择。 | | Part | 群组多选择框部分选择。 | @@ -57,29 +57,41 @@ struct CheckboxExample { build() { Scroll() { Column() { - CheckboxGroup({group : 'checkboxGroup'}) - .selectedColor(0xed6f21) - .onChange((itemName:CheckboxGroupResult) => { - console.info("TextPicker::dialogResult is" + JSON.stringify(itemName)) - }) - Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) - .select(true) - .selectedColor(0x39a2db) - .onChange((value: boolean) => { - console.info('Checkbox1 change is' + value) - }) - Checkbox({ name: 'checkbox2', group: 'checkboxGroup' }) - .select(false) - .selectedColor(0x39a2db) - .onChange((value: boolean) => { - console.info('Checkbox2 change is' + value) - }) - Checkbox({ name: 'checkbox3', group: 'checkboxGroup' }) - .select(true) - .selectedColor(0x39a2db) - .onChange((value: boolean) => { - console.info('Checkbox3 change is' + value) - }) + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }){ + CheckboxGroup({group : 'checkboxGroup'}) + .selectedColor(0xed6f21) + .onChange((itemName:CheckboxGroupResult) => { + console.info("TextPicker::dialogResult is" + JSON.stringify(itemName)) + }) + Text('select all').fontSize(20) + } + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }){ + Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) + .select(true) + .selectedColor(0x39a2db) + .onChange((value: boolean) => { + console.info('Checkbox1 change is' + value) + }) + Text('Checkbox1').fontSize(20) + } + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }){ + Checkbox({ name: 'checkbox2', group: 'checkboxGroup' }) + .select(false) + .selectedColor(0x39a2db) + .onChange((value: boolean) => { + console.info('Checkbox2 change is' + value) + }) + Text('Checkbox2').fontSize(20) + } + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }){ + Checkbox({ name: 'checkbox3', group: 'checkboxGroup' }) + .select(true) + .selectedColor(0x39a2db) + .onChange((value: boolean) => { + console.info('Checkbox3 change is' + value) + }) + Text('Checkbox3').fontSize(20) + } } } } diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-remotewindow.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-remotewindow.md new file mode 100644 index 0000000000000000000000000000000000000000..2b20aca25bc08b65bc31ac38194491f8f07f1bf2 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-remotewindow.md @@ -0,0 +1,73 @@ +# RemoteWindow + +远程控制窗口组件,可以通过此组件控制应用窗口,提供启动退出过程中控件动画和应用窗口联动动画的能力。 + +> **说明:** +> +> 该组件从API Version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> +> 该组件为系统接口。 + +## 子组件 + +不可以包含子组件。 + +## 接口 + +RemoteWindow(target: WindowAnimationTarget) + +通过窗口动画对象创建组件。 + +- 参数 + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | -------- | -------- | -------- | -------- | -------- | + | target | [WindowAnimationTarget](#windowanimationtarget) | 是 | - | 需要控制的动画窗口的描述。 | + +## WindowAnimationTarget +目标窗口,用来远程控制实现动画。 + +| 参数 | 类型 | 描述 | +| ------- | ------ | ----------------------- | +| bundleName | string | 动画窗口所对应的进程。| +| abilityName | string | 动画窗口所对应的Ability。| +| windowBounds | [RRect](#rrect) | 动画窗口实际大小。| + +## RRect +圆角矩形。 + +| 参数 | 类型 | 描述 | +| ------- | ------ | ----------------------- | +| left | number | 动画窗口左上角相对于屏幕横坐标。| +| top | number | 动画窗口左上角相对于屏幕纵坐标。| +| width | number | 动画窗口宽度大小。| +| height | number | 动画窗口高度大小。| +| radius | number | 动画窗口圆角大小。| + +## 属性 + +支持[通用属性](ts-universal-attributes-size.md)。 + +## 事件 + +支持[通用事件](ts-universal-events-click.md)。 + +## 示例 + +```ts +// xxx.ets +@Entry +@Component +struct RemoteWindowExample { + @State target: WindowAnimationTarget = undefined // 通过windowAnimationManager获取 + + build() { + RemoteWindow(this.target) + .translate({x:100, y:200}) + .scale({x:0.5, y:0.5}) + .opacity(0.8) + .position({x:px2vp(this.target?.windowBounds.left), y:px2vp(this.target?.windowBounds.top)}) + .width(px2vp(this.target?.windowBounds.width)) + .height(px2vp(this.target?.windowBounds.height)) + } +} +``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md index 92cd8df915ddee1167ecd688daef50e527743335..b5edeedb5dc259f890202404e5b6c83abb27e133 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md @@ -58,7 +58,7 @@ TimePicker(options?: TimePickerOptions) @Entry @Component struct TimePickerExample { - private selectedTime: Date = new Date('08-00') + private selectedTime: Date = new Date('7/22/2022 8:00:00') build() { Column() { diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md old mode 100755 new mode 100644 index 502d9dff006d9d25481ddf3dd6944d60e4f6906f..223d4b5dc46ee2bac71f2a2b601fd8a13fb514fb --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md @@ -6,7 +6,7 @@ 提供具有网页显示能力的Web组件。 ## 权限列表 -访问在线网页时需添加网络权限:ohos.permission.INTERNET +访问在线网页时需添加网络权限:ohos.permission.INTERNET。 ## 子组件 @@ -14,184 +14,1584 @@ ## 接口 -- Web\(options: { src: string, controller?: WebController }\) +Web(options: { src: string, controller?: WebController }) + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ---------- | ------------------------------- | ---- | ------ | -------------- | + | src | string | 是 | - | 网页资源地址。 | + | controller | [WebController](#webcontroller) | 否 | - | 控制器。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + } + } + } + ``` + +> **说明:** +> +> 不支持转场动画。 + +## 属性 + +web组件的网络属性。 + +### domStorageAccess + +domStorageAccess(domStorageAccess: boolean) + +设置是否开启文档对象模型存储接口(DOM Storage API)权限,默认未开启。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | domStorageAccess | boolean | 是 | - | 设置是否开启文档对象模型存储接口(DOM Storage API)权限。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .domStorageAccess(true) + } + } + } + ``` + +### fileAccess + +fileAccess(fileAccess: boolean) + +设置是否开启通过[$rawfile(filepath/filename)](../../ui/ts-application-resource-access.md#资源引用)访问应用中rawfile路径的文件, 默认启用。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | fileAccess | boolean | 是 | - | 设置是否开启通过[$rawfile(filepath/filename)](../../ui/ts-application-resource-access.md#资源引用)访问应用中rawfile路径的文件。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .fileAccess(true) + } + } + } + ``` + +### fileFromUrlAccess9+ + +fileFromUrlAccess(fileFromUrlAccess: boolean) + +设置是否允许通过网页中的JavaScript脚本访问[$rawfile(filepath/filename)](../../ui/ts-application-resource-access.md#资源引用)的内容,默认未启用。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | fileFromUrlAccess | boolean | 是 | - | 设置是否允许通过网页中的JavaScript脚本访问[$rawfile(filepath/filename)](../../ui/ts-application-resource-access.md#资源引用)的内容。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .fileFromUrlAccess(true) + } + } + } + ``` + +### imageAccess + +imageAccess(imageAccess: boolean) + +设置是否允许自动加载图片资源,默认允许。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | imageAccess | boolean | 是 | - | 设置是否允许自动加载图片资源。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .imageAccess(true) + } + } + } + ``` + +### javaScriptProxy + +javaScriptProxy(javaScriptProxy: { object: object, name: string, methodList: Array\, + controller: WebController }) + +注入JavaScript对象到window对象中,并在window对象中调用该对象的方法。所有参数不支持更新。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | object | object | 是 | - | 参与注册的对象。只能声明方法,不能声明属性。 | + | name | string | 是 | - | 注册对象的名称,与window中调用的对象名一致。 | + | methodList | Array\ | 是 | - | 参与注册的应用侧JavaScript对象的方法。| + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + testObj = { + test: (data1, data2, data3) => { + console.log("data1:" + data1); + console.log("data2:" + data2); + console.log("data3:" + data3); + return "AceString"; + }, + toString: () => { + console.log('toString' + "interface instead."); + } + } + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .javaScriptAccess(true) + .javaScriptProxy({ + object: this.testObj, + name: "objName", + methodList: ["test", "toString"], + controller: this.controller, + }) + } + } + } + ``` + +### javaScriptAccess + +javaScriptAccess(javaScriptAccess: boolean) + +设置是否允许执行JavaScript脚本,默认允许执行。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | javaScriptAccess | boolean | 是 | - | 是否允许执行JavaScript脚本。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .javaScriptAccess(true) + } + } + } + ``` + +### mixedMode + +mixedMode(mixedMode: MixedMode) + +设置是否允许加载超文本传输协议(HTTP)和超文本传输安全协议(HTTPS)混合内容,默认不允许加载HTTP和HTTPS混合内容。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | mixedMode | [MixedMode](#mixedmode枚举说明) | 是 | - | 要设置的混合内容。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + @State mode:MixedMode = MixedMode.All; + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .mixedMode(this.mode) + } + } + } + ``` + +### onlineImageAccess + +onlineImageAccess(onlineImageAccess: boolean) + +设置是否允许从网络加载图片资源(通过HTTP和HTTPS访问的资源),默认允许访问。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | onlineImageAccess | boolean | 是 | - | 设置是否允许从网络加载图片资源。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .onlineImageAccess(true) + } + } + } + ``` + +### zoomAccess + +zoomAccess(zoomAccess: boolean) + +设置是否支持手势进行缩放,默认允许执行缩放。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | zoomAccess | boolean | 是 | - | 设置是否支持手势进行缩放。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .zoomAccess(true) + } + } + } + ``` + +### overviewModeAccess + +overviewModeAccess(overviewModeAccess: boolean) + +设置是否使用概览模式加载网页,默认使用该方式。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | overviewModeAccess | boolean | 是 | - | 设置是否使用概览模式加载网页。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .overviewModeAccess(true) + } + } + } + ``` + +### databaseAccess + +databaseAccess(databaseAccess: boolean) + +设置是否开启数据库存储API权限,默认不开启。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | databaseAccess | boolean | 是 | - | 设置是否开启数据库存储API权限。 | + + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .databaseAccess(true) + } + } + } + ``` + +### cacheMode + +cacheMode(cacheMode: CacheMode) + +设置缓存模式。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | cacheMode | [CacheMode](#cachemode枚举说明) | 是 | - | 要设置的缓存模式。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + @State mode:CacheMode = CacheMode.None; + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .cacheMode(this.mode) + } + } + } + ``` + +### textZoomAtio + +textZoomAtio(textZoomAtio: number) + +设置页面的文本缩放百分比,默认为100%。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | textZoomAtio | number | 是 | - | 要设置的页面的文本缩放百分比。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + @State atio:number = 150; + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .textZoomAtio(this.atio) + } + } + } + ``` + +### userAgent + +userAgent(userAgent: string) + +设置用户代理。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | userAgent | string | 是 | - | 要设置的用户代理。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + @State userAgent:string = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36'; + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .userAgent(this.userAgent) + } + } + } + ``` + +> **说明:** +> +> 通用属性仅支持[width](ts-universal-attributes-size.md#属性)、[height](ts-universal-attributes-size.md#属性)、[padding](ts-universal-attributes-size.md#属性)、[margin](ts-universal-attributes-size.md#属性)、[border](ts-universal-attributes-border.md#属性)。 + +## 事件 + +不支持通用事件。 + +### onAlert + +onAlert(callback: (event?: { url: string; message: string; result: JsResult }) => boolean) + +网页触发alert()告警弹窗时触发回调。 + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | url | string | 当前显示弹窗所在网页的URL。| + | message | string | 弹窗中显示的信息。 | + | result | [JsResult](#jsresult) | 通知Web组件用户操作行为。| + +**返回值:** + | 类型 | 说明 | + |----------|------| + | boolean | 当回调返回false时,触发默认弹窗。当回调返回true时,系统应用可以调用系统弹窗能力(包括确认和取消),并且需要根据用户的确认或取消操作调用JsResult通知Web组件最终是否离开当前页面。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .onAlert((event) => { + AlertDialog.show({ + title: 'title', + message: 'text', + confirm: { + value: 'onAlert', + action: () => { + event.result.handleConfirm() + } + }, + cancel: () => { + event.result.handleCancel() + } + }) + return true; + }) + } + } + } + ``` + +### onBeforeUnload + +onBeforeUnload(callback: (event?: { url: string; message: string; result: JsResult }) => boolean) + +刷新或关闭场景下,在即将离开当前页面时触发此回调。 + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | url | string | 当前显示弹窗所在网页的URL。| + | message | string | 弹窗中显示的信息。 | + | result | [JsResult](#jsresult) | 通知Web组件用户操作行为。| + +**返回值:** + | 类型 | 说明 | + |----------|------| + | boolean | 当回调返回false时,触发默认弹窗。当回调返回true时,系统应用可以调用系统弹窗能力(包括确认和取消),并且需要根据用户的确认或取消操作调用JsResult通知Web组件最终是否离开当前页面。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .onBeforeUnload((event) => { + console.log("event.url:" + event.url); + console.log("event.message:" + event.message); + console.log("event.result:" + event.result); + return false; + }) + } + } + } + ``` + +### onConfirm + +onConfirm(callback: (event?: { url: string; message: string; result: JsResult }) => boolean) + +网页调用confirm()告警时触发此回调。 + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | url | string | 当前显示弹窗所在网页的URL。| + | message | string | 弹窗中显示的信息。 | + | result | [JsResult](#jsresult) | 通知Web组件用户操作行为。| + +**返回值:** + | 类型 | 说明 | + |----------|------| + | boolean | 当回调返回false时,触发默认弹窗。当回调返回true时,系统应用可以调用系统弹窗能力(包括确认和取消),并且需要根据用户的确认或取消操作调用JsResult通知Web组件。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .onConfirm((event) => { + console.log("event.url:" + event.url); + console.log("event.message:" + event.message); + console.log("event.result:" + event.result); + AlertDialog.show({ + title: 'title', + message: 'text', + confirm: { + value: 'onConfirm', + action: () => { + event.result.handleConfirm() + } + }, + cancel: () => { + event.result.handleCancel() + } + }) + return true; + }) + } + } + } + ``` + +### onPrompt9+ + +onPrompt(callback: (event?: { url: string; message: string; value: string; result: JsResult }) => boolean) + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | url | string | 当前显示弹窗所在网页的URL。| + | message | string | 弹窗中显示的信息。 | + | result | [JsResult](#jsresult) | 通知Web组件用户操作行为。| + +**返回值:** + | 类型 | 说明 | + |----------|------| + | boolean | 当回调返回false时,触发默认弹窗。当回调返回true时,系统应用可以调用系统弹窗能力(包括确认和取消),并且需要根据用户的确认或取消操作调用JsResult通知Web组件。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .onPrompt((event) => { + console.log("url:" + event.url); + console.log("message:" + event.message); + console.log("value:" + event.value); + console.log("result:" + event.result); + return true; + }) + } + } + ``` + +### onConsole + +onConsole(callback: (event?: { message: ConsoleMessage }) => boolean) + +通知宿主应用JavaScript console消息。 + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | message | [ConsoleMessage](#consolemessage) | 触发的控制台信息。 | + +**返回值:** + | 类型 | 说明 | + |----------|------| + | boolean | 当返回true时,该条消息将不会再打印至控制台,反之仍会打印至控制台。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .onConsole((event) => { + console.log('getMessage:' + event.message.getMessage()); + console.log('getSourceId:' + event.message.getSourceId()); + console.log('getLineNumber:' + event.message.getLineNumber()); + console.log('getMessageLevel:' + event.message.getMessageLevel()); + return false; + }) + } + } + } + ``` + +### onDownloadStart + +onDownloadStart(callback: (event?: { url: string, userAgent: string, contentDisposition: string, mimetype: string, contentLength: number }) => void) + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | url | string | 文件下载的URL。 | + | contentDisposition | string | 服务器返回的 Content-Disposition响应头,可能为空。 | + | mimetype | string | 服务器返回内容媒体类型(MIME)信息。 | + | contentLength | contentLength | 服务器返回文件的长度。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .onDownloadStart((event) => { + console.log('url:' + event.url); + console.log('userAgent:' + event.userAgent); + console.log('contentDisposition:' + event.contentDisposition); + console.log('contentLength:' + event.contentLength); + console.log('mimetype:' + event.mimetype); + }) + } + } + } + ``` + +### onErrorReceive + +onErrorReceive(callback: (event?: { request: WebResourceRequest, error: WebResourceError }) => void) + +网页加载遇到错误时触发该回调。出于性能考虑,建议此回调中尽量执行简单逻辑。 + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | request | [WebResourceRequest](#webresourcerequest) | 网页请求的封装信息。 | + | error | [WebResourceError](#webresourceerror) | 网页加载资源错误的封装信息 。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .onErrorReceive((event) => { + console.log('getErrorInfo:' + event.error.getErrorInfo()); + console.log('getErrorCode:' + event.error.getErrorCode()); + console.log('url:' + event.request.getRequestUrl()); + console.log('isMainFrame:' + event.request.isMainFrame()); + console.log('isRedirect:' + event.request.isRedirect()); + console.log('isRequestGesture:' + event.request.isRequestGesture()); + console.log('getRequestHeader_headerKey:' + event.request.getRequestHeader().toString()); + let result = event.request.getRequestHeader(); + console.log('The request header result size is ' + result.length); + for (let i of result) { + console.log('The request header key is : ' + i.headerKey + ', value is : ' + i.headerValue); + } + }) + } + } + } + ``` + +### onHttpErrorReceive + +onHttpErrorReceive(callback: (event?: { request: WebResourceRequest, response: WebResourceResponse }) => void) + +网页加载资源遇到的HTTP错误(响应码>=400)时触发该回调。 + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | request | [WebResourceRequest](#webresourcerequest) | 网页请求的封装信息。 | + | error | [WebResourceError](#webresourceerror) | 网页加载资源错误的封装信息 。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .onHttpErrorReceive((event) => { + console.log('url:' + event.request.getRequestUrl()); + console.log('isMainFrame:' + event.request.isMainFrame()); + console.log('isRedirect:' + event.request.isRedirect()); + console.log('isRequestGesture:' + event.request.isRequestGesture()); + console.log('getResponseData:' + event.response.getResponseData()); + console.log('getResponseEncoding:' + event.response.getResponseEncoding()); + console.log('getResponseMimeType:' + event.response.getResponseMimeType()); + console.log('getResponseCode:' + event.response.getResponseCode()); + console.log('getReasonMessage:' + event.response.getReasonMessage()); + let result = event.request.getRequestHeader(); + console.log('The request header result size is ' + result.length); + for (let i of result) { + console.log('The request header key is : ' + i.headerKey + ' , value is : ' + i.headerValue); + } + let resph = event.response.getResponseHeader(); + console.log('The response header result size is ' + resph.length); + for (let i of resph) { + console.log('The response header key is : ' + i.headerKey + ' , value is : ' + i.headerValue); + } + }) + } + } + } + ``` + +### onPageBegin + +onPageBegin(callback: (event?: { url: string }) => void) + + +网页开始加载时触发该回调,且只在主frame触发,iframe或者frameset的内容加载时不会触发此回调。 + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | url | string | 页面的URL地址。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .onPageBegin((event) => { + console.log('url:' + event.url); + }) + } + } + } + ``` + +### onPageEnd + +onPageEnd(callback: (event?: { url: string }) => void) + + +网页加载完成时触发该回调,且只在主frame触发。 + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | url | string | 页面的URL地址。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .onPageEnd((event) => { + console.log('url:' + event.url); + }) + } + } + } + ``` + +### onProgressChange + +onProgressChange(callback: (event?: { newProgress: number }) => void) + +网页加载进度变化时触发该回调。 + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | newProgress | number | 新的加载进度,取值范围为0到100的整数。 | + + **示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .onProgressChange((event) => { + console.log('newProgress:' + event.newProgress) + }) + } + } + } + ``` + +### onTitleReceive + +onTitleReceive(callback: (event?: { title: string }) => void) + +网页document标题更改时触发该回调。 + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | title | string | document标题内容。 | + + **示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .onTitleReceive((event) => { + console.log('title:' + event.title) + }) + } + } + } + ``` + +### onRefreshAccessedHistory + +onRefreshAccessedHistory(callback: (event?: { url: string, isRefreshed: boolean }) => void) + +加载网页页面完成时触发该回调,用于应用更新其访问的历史链接。 + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | url | string | 访问的url。 | + | isRefreshed | boolean | true表示该页面是被重新加载的,false表示该页面是新加载的。 | + + **示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .onRefreshAccessedHistory((event) => { + console.log('url:' + event.url + ' isReload:' + event.refreshed); + }) + } + } + } + ``` + +### onRenderExited + +onRenderExited(callback: (event?: { renderExitReason: RenderExitReason }) => void) + +应用渲染进程异常退出时触发该回调。 + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | renderExitReason | [RenderExitReason](#renderexitreason枚举说明) | 渲染进程进程异常退出的具体原因。 | + + **示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Web({ src: 'chrome://crash/', controller: this.controller }) + .onRenderExited((event) => { + console.log('reason:' + event.renderExitReason); + }) + } + } + } + ``` + +### onShowFileSelector9+ + +onShowFileSelector(callback: (event?: { result: FileSelectorResult, fileSelector: FileSelectorParam }) => void) + +调用此函数以处理具有“文件”输入类型的HTML表单,以响应用户按下的“选择文件”按钮。 + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | result | [FileSelectorResult](#fileselectorresult9) | 用于通知Web组件文件选择的结果。 | + | fileSelector | [FileSelectorParam](#fileselectorparam9) | 文件选择器的相关信息。 | + + **示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .onShowFileSelector((event) => { + AlertDialog.show({ + title: event.fileSelector.getTitle(), + message: 'isCapture:' + event.fileSelector.isCapture() + " mode:" + event.fileSelector.getMode() + 'acceptType:' + event.fileSelector.getAcceptType(), + confirm: { + value: 'upload', + action: () => { + let fileList: Array = [ + '/data/storage/el2/base/test', + ] + event.result.handleFileList(fileList) + } + }, + cancel: () => { + let fileList: Array = [] + event.result.handleFileList(fileList) + } + }) + return true; + }) + } + } + } + ``` + +### onUrlLoadIntercept + +onUrlLoadIntercept(callback: (event?: { data:string | WebResourceRequest }) => boolean) + +当Web组件加载url之前触发该回调,用于是否阻止此次访问。 + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | data | string / [WebResourceRequest](#webresourcerequest) | url的相关信息。 | + +**返回值:** + | 类型 | 说明 | + |----------|------| + | boolean | 返回true表示阻止此次加载,否则允许此次加载。 | + + **示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .onUrlLoadIntercept((event) => { + console.log('onUrlLoadIntercept ' + event.data.toString()) + return true; + }) + } + } + } + ``` + +### onInterceptRequest9+ + +onInterceptRequest9+(callback: (event?: { request: WebResourceRequest}) => WebResourceResponse) + +当Web组件加载url之前触发该回调,用于拦截url并返回响应数据。 + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | request | [WebResourceRequest](#webresourcerequest) | url请求的相关信息。 | + +**返回值:** + | 类型 | 说明 | + |----------|------| + | [WebResourceResponse](#webresourceresponse) | 返回响应数据为空表示按原来方式加载,否则加载响应数据。 | + + **示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + responseweb: WebResourceResponse = new WebResourceResponse(); + heads:Header[] = new Array(); + @State webdata: string = "\n" + + "\n"+ + "\n"+ + "intercept test\n"+ + "\n"+ + "\n"+ + "

intercept test

\n"+ + "\n"+ + "" + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .onInterceptRequest((event) => { + console.log('url:' + event.request.getRequestUrl()); + var head1:Header = { + headerKey:"Connection", + headerValue:"keep-alive" + } + var head2:Header = { + headerKey:"Cache-Control", + headerValue:"no-cache" + } + var length = this.heads.push(head1); + length = this.heads.push(head2); + this.responseweb.setResponseHeader(this.heads); + this.responseweb.setResponseData(this.webdata); + this.responseweb.setResponseEncoding('utf-8'); + this.responseweb.setResponseMimeType('text/html'); + this.responseweb.setResponseCode(200); + this.responseweb.setReasonMessage('OK'); + return this.responseweb; + }) + } + } + } + ``` + +### onHttpAuthRequest9+ + +onHttpAuthRequest(callback: (event?: { handler: HttpAuthHandler, host: string, realm: string}) => boolean) + +通知收到http auth认证请求。 + +**参数:** + | 参数名 | 参数类型 | 参数描述 | + | ------ | -------- | ------------------------- | + | handler | [HttpAuthHandler](#httpauthhandler9) | 通知Web组件用户操作行为。 | + | host | string | HTTP身份验证凭据应用的主机。 | + | realm | string | HTTP身份验证凭据应用的域。 | + +**返回值:** + | 类型 | 说明 | + |----------|------| + | boolean | 返回false表示此次认证失败,否则成功。 | + + **示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + httpAuth:boolean = false; + build() { + Column() { + Web({ src:'www.example.com', controller:this.controller }) + .onHttpAuthRequest((event) => { + AlertDialog.show({ + title: 'title', + message: 'text', + confirm: { + value: 'onConfirm', + action: () => { + this.httpAuth = event.handler.isHttpAuthInfoSaved(); + if (this.httpAuth == false) { + web.WebDataBase.saveHttpAuthCredentials( + event.host, + event.realm, + "2222", + "2222" + ) + event.handler.cancel(); + } + } + }, + cancel: () => { + event.handler.cancel(); + } + }) + return true; + }) + } + } + ``` + +## ConsoleMessage + +Web组件获取控制台信息对象。示例代码参考[onConsole事件](#onconsole)。 + +### getLineNumber + +getLineNumber(): number + +获取ConsoleMessage的行数。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | number | 返回ConsoleMessage的行数。 | + +### getMessage + +getMessage(): string + +获取ConsoleMessage的日志信息。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | string | 返回ConsoleMessage的日志信息。 | + +### getMessageLevel + +getMessageLevel(): MessageLevel + +获取ConsoleMessage的信息级别。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | [MessageLevel](#messagelevel枚举说明) | 返回ConsoleMessage的信息级别。 | + +### getSourceId + +getSourceId(): string + +获取网页源文件路径和名字。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | string | 返回网页源文件路径和名字。 | + +## JsResult + +Web组件返回的弹窗确认或弹窗取消功能对象。示例代码参考[onAlert事件](#onalert)。 + +### handleCancel + +handleCancel(): void + +通知Web组件用户取消弹窗操作。 + +### handleConfirm + +handleConfirm(): void + +通知Web组件用户确认弹窗操作。 + +### handlePromptConfirm9+ + +handlePromptConfirm(result: string): void + +通知Web组件用户确认弹窗操作及对话框内容。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | result | string | 是 | - | 用户输入的对话框内容。 | + +## WebResourceError + +web组件资源管理错误信息对象。示例代码参考[onErrorReceive事件](#onerrorreceive)。 + +### getErrorCode + +getErrorCode(): number + +获取加载资源的错误码。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | number | 返回加载资源的错误码。 | + +### getErrorInfo + +getErrorInfo(): string + +获取加载资源的错误信息。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | string | 返回加载资源的错误信息。 | + +## WebResourceRequest + +web组件获取资源请求对象。示例代码参考[onErrorReceive事件](#onerrorreceive)。 + +### getRequestHeader + +getResponseHeader() : Array\ + +获取资源请求头信息。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | Array\<[Header](#header)\> | 返回资源请求头信息。 | + +### getRequestUrl + +getRequestUrl(): string + +获取资源请求的URL信息。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | string | 返回资源请求的URL信息。 | + +### isMainFrame + +isMainFrame(): boolean + +判断资源请求是否为主frame。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | boolean | 返回资源请求是否为主frame。 | + +### isRedirect + +isRedirect(): boolean + +判断资源请求是否被服务端重定向。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | boolean | 返回资源请求是否被服务端重定向。 | + +### isRequestGesture + +isRequestGesture(): boolean + +获取资源请求是否与手势(如点击)相关联。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | boolean | 返回资源请求是否与手势(如点击)相关联。 | + +## Header + +Web组件返回的请求/响应头对象。 + +| 名称 | 类型 | 描述 | +| ----------- | -------- | -------------------- | +| headerKey | string | 请求/响应头的key。 | +| headerValue | string | 请求/响应头的value。 | + + +## WebResourceResponse + +web组件资源响应对象。示例代码参考[onHttpErrorReceive事件](#onhttperrorreceive)。 + +### getReasonMessage + +getReasonMessage(): string + +获取资源响应的状态码描述。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | string | 返回资源响应的状态码描述。 | + +### getResponseCode + +getResponseCode(): number + +获取资源响应的状态码。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | number | 返回资源响应的状态码。 | + +### getResponseData + +getResponseData(): string + +获取资源响应数据。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | string | 返回资源响应数据。 | + +### getResponseEncoding + +getResponseEncoding(): string + +获取资源响应的编码。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | string | 返回资源响应的编码。 | + +### getResponseHeader + +getResponseHeader() : Array\ + +获取资源响应头。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | Array\<[Header](#header)\> | 返回资源响应头。 | + +### getResponseMimeType + +getResponseMimeType(): string + +获取资源响应的媒体(MIME)类型。 + +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | string | 返回资源响应的媒体(MIME)类型。 | + +### setResponseData9+ + +setResponseData(data: string) + +设置资源响应数据。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | data | string | 是 | - | 要设置的资源响应数据。 | + +### setResponseEncoding9+ + +setResponseEncoding(encoding: string) + +设置资源响应的编码。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | encoding | string | 是 | - | 要设置的资源响应的编码。 | + +### setResponseMimeType9+ + +setResponseMimeType(mimeType: string) + +设置资源响应的媒体(MIME)类型。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | mimeType | string | 是 | - | 要设置的资源响应的媒体(MIME)类型。 | + +### setReasonMessage9+ + +setReasonMessage(reason: string) + +设置资源响应的状态码描述。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | reason | string | 是 | - | 要设置的资源响应的状态码描述。 | + +### setResponseHeader9+ + +setResponseHeader(header: Array\) + +设置资源响应头。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | header | Array\<[Header](#header)\> | 是 | - | 要设置的资源响应头。 | + +### setResponseCode9+ + +setResponseCode(code: number) + +设置资源响应的状态码。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | code | number | 是 | - | 要设置的资源响应的状态码。 | + +## FileSelectorResult9+ + +通知Web组件的文件选择结果。示例代码参考[onShowFileSelector事件](#onshowfileselector9)。 - 表1 options参数说明 +### handleFileList9+ - | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | - | ---------- | ------------------------------- | ---- | ------ | -------------- | - | src | string | 是 | - | 网页资源地址。 | - | controller | [WebController](#webcontroller) | 否 | - | 控制器。 | +handleFileList(fileList: Array\): void +通知Web组件进行文件选择操作。 -> **说明:** -> -> - 不支持转场动画; -> - 不支持多实例; -> - 仅支持本地音视频播放。 +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | ------------------------- | + | fileList | Array\ | 是 | - | 需要进行操作的文件列表。 | -## 属性 -| 名称 | 参数类型 | 默认值 | 描述 | -| ------------------ | ------------------------------------------------------------ | ----------------- | ------------------------------------------------------------ | -| domStorageAccess | boolean | false | 设置是否开启文档对象模型存储接口(DOM Storage API)权限,默认未开启。 | -| fileAccess | boolean | false | 设置是否开启通过[$rawfile(filepath/filename)](../../ui/ts-application-resource-access.md#资源引用)访问应用中rawfile路径的文件, 默认启用。 | -| fileFromUrlAccess | boolean | true | 设置是否允许通过网页中的JavaScript脚本访问[$rawfile(filepath/filename)](../../ui/ts-application-resource-access.md#资源引用)的内容,默认未启用。 | -| imageAccess | boolean | true | 设置是否允许自动加载图片资源,默认允许。 | -| javaScriptProxy | {
object: object,
name: string,
methodList: Array\,
controller: WebController
} | - | 注入JavaScript对象到window对象中,并在window对象中调用该对象的方法。所有参数不支持更新。
- object: 参与注册的对象。只能声明方法,不能声明属性 。其中方法的参数和返回类型只能为string,number,boolean。
- name: 注册对象的名称,与window中调用的对象名一致。注册后window对象可以通过此名字访问应用侧JavaScript对象。
- methodList: 参与注册的应用侧JavaScript对象的方法。
- controller: 控制器。 | -| javaScriptAccess | boolean | true | 设置是否允许执行JavaScript脚本,默认允许执行。 | -| mixedMode | [MixedMode](#mixedmode枚举说明) | MixedMode.None | 设置是否允许加载超文本传输协议(HTTP)和超文本传输安全协议(HTTPS)混合内容,默认不允许加载HTTP和HTTPS混合内容。 | -| onlineImageAccess | boolean | true | 设置是否允许从网络加载图片资源(通过HTTP和HTTPS访问的资源),默认允许访问。 | -| zoomAccess | boolean | true | 设置是否支持手势进行缩放,默认允许执行缩放。 | -| overviewModeAccess | boolean | true | 设置是否使用概览模式加载网页,默认使用该方式。 | -| databaseAccess | boolean | false | 设置是否开启数据库存储API权限,默认不开启。 | -| cacheMode | [CacheMode](#cachemode枚举说明) | CacheMode.Default | 设置缓存模式。 | -| textZoomAtio | number | 100 | 设置页面的文本缩放百分比,默认为100%。 | -| userAgent | string | - | 设置用户代理。 | +## FileSelectorParam9+ -> **说明:** -> -> 通用属性仅支持[width](ts-universal-attributes-size.md#属性)、[height](ts-universal-attributes-size.md#属性)、[padding](ts-universal-attributes-size.md#属性)、[margin](ts-universal-attributes-size.md#属性)、[border](ts-universal-attributes-border.md#属性)。 +web组件获取文件对象。示例代码参考[onShowFileSelector事件](#onshowfileselector9)。 -## 事件 +### getTitle9+ -不支持通用事件。 +getTitle(): string -| 名称 | 功能描述 | -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| onAlert(callback: (event?: { url: string; message: string; result: [JsResult](#jsresult对象说明) }) => boolean) |

网页触发alert()告警弹窗时触发回调。
当回调返回false时,触发默认弹窗。当回调返回true时,系统应用可以调用系统弹窗能力(只有确认场景),并且根据用户的确认操作调用JsResult通知Web组件。
- url:当前显示弹窗所在网页的URL。
- message:弹窗中显示的信息。
- result:通知Web组件用户操作行为。

| -| onBeforeUnload(callback: (event?: { url: string; message: string; result: [JsResult](#jsresult对象说明) }) => boolean) |

刷新或关闭场景下,在即将离开当前页面时触发此回调。
当回调返回false时,触发默认弹窗。当回调返回true时,系统应用可以调用系统弹窗能力(包括确认和取消),并且需要根据用户的确认或取消操作调用JsResult通知Web组件最终是否离开当前页面。
- url:当前显示弹窗所在网页的URL。
- message:弹窗中显示的信息。
- result:通知Web组件用户操作行为。

| -| onConfirm(callback: (event?: { url: string; message: string; result: [JsResult](#jsresult对象说明) }) => boolean) |

网页调用confirm()告警时触发此回调。
当回调返回false时,触发默认弹窗。当回调返回true时,系统应用可以调用系统弹窗能力(包括确认和取消),并且需要根据用户的确认或取消操作调用JsResult通知Web组件。
- url:当前显示弹窗所在网页的URL。
- message:弹窗中显示的信息。
- result:通知Web组件用户操作行为。

| -| onPrompt9+(callback: (event?: { url: string; message: string; value: string; result: [JsResult](#jsresult对象说明) }) => boolean) |

网页调用prompt()告警时触发此回调。
当回调返回false时,触发默认弹窗。当回调返回true时,系统应用可以调用系统弹窗能力(包括确认和取消),并且需要根据用户的确认或取消操作调用JsResult通知Web组件。
- url:当前显示弹窗所在网页的URL。
- message:弹窗中显示的信息。
- value:对话框中的默认值。
- result:通知Web组件用户操作行为,及对话框内容。

| -| onConsole(callback: (event?: { message: [ConsoleMessage](#consolemessage对象说明) }) => boolean) |

通知宿主应用JavaScript console消息。
- message:触发的控制台信息。

| -| onDownloadStart(callback: (event?: { url: string, userAgent: string, contentDisposition: string, mimetype: string, contentLength: number }) => void) |

网页的下载任务开始时触发该回调。
- url:文件下载的URL。
- userAgent:下载的用户代理(UA)名称。
- contentDisposition:服务器返回的 Content-Disposition响应头,可能为空。
- mimetype:服务器返回内容媒体类型(MIME)信息。
- contentLength:服务器返回文件的长度。

| -| onErrorReceive(callback: (event?: { request: [WebResourceRequest](#webresourceerror对象说明), error: [WebResourceError](#webresourceerror对象说明) }) => void) |

网页加载遇到错误时触发该回调。
出于性能考虑,建议此回调中尽量执行简单逻辑。
- request:网页请求的封装信息。
- error:网页加载资源错误的封装信息 。

| -| onHttpErrorReceive(callback: (event?: { request: [WebResourceRequest](#webresourceerror对象说明), response: [WebResourceResponse](#webresourceresponse对象说明) }) => void) |

网页加载资源遇到的HTTP错误(响应码>=400)时触发该回调。
- request:网页请求的封装信息。
- response:网页响应的封装信息

| -| onPageBegin(callback: (event?: { url: string }) => void) |

网页开始加载时触发该回调,且只在主frame触发,iframe或者frameset的内容加载时不会触发此回调。
- url:页面的URL地址。

| -| onPageEnd(callback: (event?: { url: string }) => void) |

网页加载完成时触发该回调,且只在主frame触发。
- url:页面的URL地址。

| -| onProgressChange(callback: (event?: { newProgress: number }) => void) |

网页加载进度变化时触发该回调。
- newProgress:新的加载进度,取值范围为0到100的整数。

| -| onTitleReceive(callback: (event?: { title: string }) => void) |

网页document标题更改时触发该回调。
- title:document标题内容。

| -| onRefreshAccessedHistory(callback: (event?: { url: string, isRefreshed: boolean }) => void) |

加载网页页面完成时触发该回调,用于应用更新其访问的历史链接。
- url:访问的url。
- isRefreshed:true表示该页面是被重新加载的,false表示该页面是新加载的。

| -| onRenderExited(callback: (event?: { renderExitReason: [RenderExitReason](#renderexitreason枚举说明) }) => void) |

应用渲染进程异常退出时触发该回调。
- renderExitReason:渲染进程进程异常退出的具体原因。

| -| onShowFileSelector(callback: (event?: { result: [FileSelectorResult](#fileselectorresult对象说明), fileSelector: [FileSelectorParam](#fileselectorparam对象说明) }) => void) |

调用此函数以处理具有“文件”输入类型的HTML表单,以响应用户按下的“选择文件”按钮
- result:用于通知Web组件文件选择的结果。
- fileSelector:文件选择器的相关信息。

| -| onUrlLoadIntercept(callback: (event?: { data:string \| [WebResourceRequest](#webresourcerequest对象说明) }) => boolean) |

当Web组件加载url之前触发该回调,用于是否阻止此次访问。callback返回true表示阻止此次加载,否则允许此次加载。
- data:url的相关信息。

| - -## ConsoleMessage对象说明 - -| 接口名称 | 功能描述 | -| -------------------------------------------------------- | ------------------------------ | -| getLineNumber(): number | 获取ConsoleMessage的行数。 | -| getMessage(): string | 获取ConsoleMessage的日志信息。 | -| getMessageLevel(): [MessageLevel](#messagelevel枚举说明) | 获取ConsoleMessage的信息级别。 | -| getSourceId(): string | 获取网页源文件路径和名字。 | +获取文件选择器标题。 -## MessageLevel枚举说明 +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | string | 返回文件选择器标题。 | -| 名称 | 描述 | -| ----- | :--------- | -| Debug | 调试级别。 | -| Error | 错误级别。 | -| Info | 消息级别。 | -| Log | 日志级别。 | -| Warn | 警告级别。 | +### getMode9+ -## JsResult对象说明 +getMode(): FileSelectorMode -Web组件返回的弹窗确认或弹窗取消功能对象。 +获取文件选择器的模式。 -| 接口名称 | 功能描述 | -| ------------------------------------------------------ | ------------------------------------------------ | -| handleCancel(): void |

通知Web组件用户取消弹窗操作。

| -| handleConfirm(): void |

通知Web组件用户确认弹窗操作。

| -| handlePromptConfirm9+(result: string): void |

通知Web组件用户确认弹窗操作及对话框内容。

| +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | [FileSelectorMode](#fileselectormode枚举说明) | 返回文件选择器的模式。 | -## WebResourceError对象说明 +### getAcceptType9+ -| 接口名称 | 功能描述 | -| ---------------------- | ------------------------ | -| getErrorCode(): number | 获取加载资源的错误码。 | -| getErrorInfo(): string | 获取加载资源的错误信息。 | +getAcceptType(): Array\ -## WebResourceRequest对象说明 +获取文件过滤类型。 -| 接口名称 | 功能描述 | -| ------------------------------------------------------ | ---------------------------------------- | -| getRequestHeader(): Array\<[Header](#header对象说明)\> | 获取资源请求头信息。 | -| getRequestUrl(): string | 获取资源请求的URL信息。 | -| isMainFrame(): boolean | 判断资源请求是否为主frame。 | -| isRedirect(): boolean | 判断资源请求是否被服务端重定向。 | -| isRequestGesture(): boolean | 获取资源请求是否与手势(如点击)相关联。 | +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | Array\ | 返回文件过滤类型。 | -## Header对象说明 +### isCapture9+ -Web组件返回的请求/响应头对象。 +isCapture(): boolean -| 参数名称 | 参数类型 | 参数描述 | -| ----------- | -------- | -------------------- | -| headerKey | string | 请求/响应头的key。 | -| headerValue | string | 请求/响应头的value。 | +获取是否调用多媒体能力。 +**返回值:** + | 类型 | 说明 | + | -------- | -------------------- | + | boolean | 返回是否调用多媒体能力。 | -## WebResourceResponse对象说明 +## HttpAuthHandler9+ -| 接口名称 | 功能描述 | -| ------------------------------------------------------- | -------------------------------- | -| getReasonMessage(): string | 获取资源响应的状态码描述。 | -| getResponseCode(): number | 获取资源响应的状态码。 | -| getResponseData(): string | 获取资源响应数据。 | -| getResponseEncoding(): string | 获取资源响应的编码。 | -| getResponseHeader(): Array\<[Header](#header对象说明)\> | 获取资源响应头。 | -| getResponseMimeType(): string | 获取资源响应的媒体(MIME)类型。 | +Web组件返回的http auth认证请求确认或取消和使用缓存密码认证功能对象。示例代码参考[onHttpAuthRequest事件](#onhttpauthrequest9)。 -## RenderExitReason枚举说明 +### cancel9+ -onRenderExited接口返回的渲染进程退出的具体原因。 +cancel(): void -| 名称 | 描述 | -| -------------------------- | ---------------------------- | -| ProcessAbnormalTermination | 渲染进程异常退出。 | -| ProcessWasKilled | 收到SIGKILL,或被手动终止。 | -| ProcessCrashed | 渲染进程崩溃退出,如段错误。 | -| ProcessOom | 程序内存不足。 | -| ProcessExitUnknown | 其他原因。 | +通知Web组件用户取消HTTP认证操作。 -## MixedMode枚举说明 +### confirm9+ -| 名称 | 描述 | -| ---------- | ----------------------------------------------------------- | -| All | 允许加载HTTP和HTTPS混合内容。所有不安全的内容都可以被加载。 | -| Compatible | 混合内容兼容性模式,部分不安全的内容可能被加载。 | -| None | 不允许加载HTTP和HTTPS混合内容。 | +confirm(userName: string, pwd: string): boolean -## CacheMode枚举说明 -| 名称 | 描述 | -| ------- | ------------------------------------------------------------ | -| Default | 使用未过期的cache加载资源,如果cache中无该资源则从网络中获取。 | -| None | 加载资源使用cache,如果cache中无该资源则从网络中获取。 | -| Online | 加载资源不使用cache,全部从网络中获取。 | -| Only | 只从cache中加载资源。 | +使用用户名和密码进行HTTP认证操作。 -## FileSelectorResult对象说明 -通知Web组件的文件选择结果。 +**参数:** -| 接口名称 | 功能描述 | -| ---------------------------------------------- | ------------------------------------------------------------ | -| handleFileList(fileList: Array\): void | 通知Web组件进行文件选择操作。fileList: 需要进行操作的文件列表。 | + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | -------- | -------- | ---- | ------ | -------------- | + | userName | string | 是 | - | HTTP认证用户名。| + | pwd | string | 是 | - | HTTP认证密码。 | -## FileSelectorParam对象说明 -| 接口名称 | 功能描述 | -| -------------------------------- | ------------------------ | -| getTitle(): string | 获取文件选择器标题。 | -| getMode(): FileSelectorMode | 获取文件选择器的模式。 | -| getAcceptType(): Array\ | 获取文件过滤类型。 | -| isCapture(): boolean | 获取是否调用多媒体能力。 | +**返回值:** + | 类型 | 说明 | + | -------- | ------------------------------- | + | boolean | 认证成功返回true,失败返回false。 | -## FileSelectorMode枚举说明 -| 名称 | 描述 | -| -------------------- | -------------------- | -| FileOpenMode | 打开上传单个文件。 | -| FileOpenMultipleMode | 打开上传多个文件。 | -| FileOpenFolderMode | 打开上传文件夹模式。 | -| FileSaveMode | 文件保存模式。 | +### isHttpAuthInfoSaved9+ + +isHttpAuthInfoSaved(): boolean + +通知Web组件用户使用服务器缓存的账号密码认证。 + +**返回值:** + | 类型 | 说明 | + | -------- | ------------------------------------- | + | boolean | 存在密码认证成功返回true,其他返回false。| ## WebController @@ -209,53 +1609,215 @@ accessBackward(): boolean 当前页面是否可后退,即当前页面是否有返回历史记录。 +**返回值:** + | 类型 | 说明 | + | -------- | ------------------------------------- | + | boolean | 可以后退返回true,否则返回false。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('accessBackward') + .onClick(() => { + let result = this.controller.accessBackward(); + console.log('result:' + result); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + ### accessForward accessForward(): boolean 当前页面是否可前进,即当前页面是否有前进历史记录。 +**返回值:** + | 类型 | 说明 | + | -------- | ------------------------------------- | + | boolean | 可以前进返回true,否则返回false。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('accessForward') + .onClick(() => { + let result = this.controller.accessForward(); + console.log('result:' + result); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + ### accessStep accessStep(step: number): boolean 当前页面是否可前进或者后退给定的step步。 -- 参数 +**参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | ------ | -------- | ---- | ------ | ------------------------------------------ | | step | number | 是 | - | 要跳转的步数,正数代表前进,负数代表后退。 | -- 返回值 - - | 参数类型 | 说明 | +**返回值:** + | 类型 | 说明 | | -------- | ------------------ | | boolean | 页面是否前进或后退 | +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + @State steps: number = 2; + + build() { + Column() { + Button('accessStep') + .onClick(() => { + let result = this.controller.accessStep(this.steps); + console.log('result:' + result); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + ### backward backward(): void 按照历史栈,后退一个页面。一般结合accessBackward一起使用。 +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('backward') + .onClick(() => { + this.controller.backward(); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +### forward + +forward(): void + +按照历史栈,前进一个页面。一般结合accessForward一起使用。 + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('forward') + .onClick(() => { + this.controller.forward(); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +### backOrForward9+ + +backOrForward(step: number): void + +按照历史栈,前进或者后退指定步长的页面,当历史栈中不存在对应步长的页面时,不会进行页面跳转。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ---- | ------ | ---- | ---- | ---------------------------------------- | + | step | number | 是 |- |需要前进或后退的步长。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller:WebController = new WebController(); + build() { + Column() { + Button('backOrForward') + .onClick(() => { + this.controller.backOrForward(); + }) + Web({ src:'www.example.com', controller:this.controller }) + } + } + ``` + ### deleteJavaScriptRegister -deleteJavaScriptRegister(name: string): void +deleteJavaScriptRegister(name: string) 删除通过registerJavaScriptProxy注册到window上的指定name的应用侧JavaScript对象。 -- 参数 - +**参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | ------ | -------- | ---- | ------ | ------------------------------------------------------------ | | name | string | 是 | - | 注册对象的名称,可在网页侧JavaScript中通过此名称调用应用侧JavaScript对象。 | -### forward - -forward(): void - -按照历史栈,前进一个页面。一般结合accessForward一起使用。 +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + @State name: string = 'Object'; + + build() { + Column() { + Button('deleteJavaScriptRegister') + .onClick(() => { + this.controller.deleteJavaScriptRegister(this.name); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` ### getHitTest @@ -263,21 +1825,191 @@ getHitTest(): HitTestType 获取当前被点击区域的元素类型。 -- HitTestType枚举说明 - - | 名称 | 描述 | - | ------------- | ----------------------------------------- | - | EditText | 可编辑的区域。 | - | Email | 电子邮件地址。 | - | HttpAnchor | 超链接。其src为http。 | - | HttpAnchorImg | 带有超链接的图片,其中超链接的src为http。 | - | Img | HTML::img标签。 | - | Map | 地理地址。 | - | Unknown | 未知内容。 | +**返回值:** + | 类型 | 说明 | + | -------- | ------------------ | + | [HitTestType](#hittesttype枚举说明) | 被点击区域的元素类型。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('getHitTest') + .onClick(() => { + let hitType = this.controller.getHitTest(); + console.log("hitType: " + hitType); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +### getHitTestValue9+ +getHitTestValue(): HitTestValue + +获取当前被点击区域的元素信息。 + +**返回值:** + | 类型 | 说明 | + |----------|------| + | [HitTestValue](#hittestvalue9) | 点击区域的元素信息。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('getHitTestValue') + .onClick(() => { + let hitValue = this.controller.getHitTestValue(); + console.log("hitType: " + hitValue.getType()); + console.log("extra: " + hitValue.getExtra()); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +### getWebId9+ +getWebId(): number + +获取当前Web组件的索引值,用于多个Web组件的管理。 + +**返回值:** + | 类型 | 说明 | + |----------|------| + | number | 当前Web组件的索引值。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('getWebId') + .onClick(() => { + let id = this.controller.getWebId(); + console.log("id: " + id); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +### getTitle9+ +getTitle(): string + +获取当前网页的标题。 + +**返回值:** + | 类型 | 说明 | + |----------|------| + | string | 当前网页的标题。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('getTitle') + .onClick(() => { + let title = this.controller.getTitle(); + console.log("title: " + title); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +### getPageHeight9+ +getPageHeight(): number + +获取当前网页的页面高度。 + +**返回值:** + | 类型 | 说明 | + |----------|------| + | number | 当前网页的页面高度。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('getPageHeight') + .onClick(() => { + let pageHeight = this.controller.getPageHeight(); + console.log("pageHeight: " + pageHeight); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +### getDefaultUserAgent9+ +getDefaultUserAgent(): string + +获取当前默认用户代理。 + +**返回值:** + | 类型 | 说明 | + |----------|------| + | string | 默认用户代理。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('getDefaultUserAgent') + .onClick(() => { + let userAgent = this.controller.getDefaultUserAgent(); + console.log("userAgent: " + userAgent); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` ### loadData -loadData(options: { data: string, mimeType: string, encoding: string, baseUrl?: string, historyUrl?: string }): void +loadData(options: { data: string, mimeType: string, encoding: string, baseUrl?: string, historyUrl?: string }) baseUrl为空时,通过”data“协议加载指定的一段字符串。 @@ -285,8 +2017,7 @@ baseUrl为空时,通过”data“协议加载指定的一段字符串。 当baseUrl为“http/https"协议时,编码后的data字符串将被Web组件以类似loadUrl的方式以非编码字符串处理。 -- options参数说明 - +**参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | ---------- | -------- | ---- | ------ | ------------------------------------------------------------ | | data | string | 是 | - | 按照”Base64“或者”URL"编码后的一段字符串。 | @@ -295,9 +2026,33 @@ baseUrl为空时,通过”data“协议加载指定的一段字符串。 | baseUrl | string | 否 | - | 指定的一个URL路径(“http”/“https”/"data"协议),并由Web组件赋值给window.origin。 | | historyUrl | string | 否 | - | 历史记录URL。非空时,可被历史记录管理,实现前后后退功能。当baseUrl为空时,此属性无效。 | +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('loadData') + .onClick(() => { + this.controller.loadData({ + data: "Source:
source
", + mimeType: "text/html", + encoding: "UTF-8" + }); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + ### loadUrl -loadUrl(options:{ url: string, headers?: Array\ }): void +loadUrl(options: { url: string | Resource, headers?: Array\ }) 使用指定的http头加载指定的URL。 @@ -305,12 +2060,31 @@ loadUrl(options:{ url: string, headers?: Array\ }): void 而通过registerJavaScriptProxy注入的对象,在loadUrl导航到新的页面也会有效。 -- options参数说明 - +**参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | ------- | ---------------------------------- | ---- | ------ | --------------------- | | url | string | 是 | - | 需要加载的 URL。 | - | headers | Array\<[Header](#header对象说明)\> | 否 | [] | URL的附加HTTP请求头。 | + | headers | Array\<[Header](#header)\> | 否 | [] | URL的附加HTTP请求头。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('loadUrl') + .onClick(() => { + this.controller.loadUrl({ url: 'www.example.com' }); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` ### onActive @@ -318,130 +2092,986 @@ onActive(): void 调用此接口通知Web组件进入前台激活状态。 +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('onActive') + .onClick(() => { + this.controller.onActive(); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + ### onInactive onInactive(): void 调用此接口通知Web组件进入未激活状态。 +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('onInactive') + .onClick(() => { + this.controller.onInactive(); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +### zoom +zoom(factor: number): void + +调整当前网页的缩放比例。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 参数描述 | + |--------|----------|------|---------| + | factor | number | 是 | 基于当前网页所需调整的相对缩放比例,正值为放大,负值为缩小。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + @State factor: number = 1; + + build() { + Column() { + Button('zoom') + .onClick(() => { + this.controller.zoom(this.factor); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +### zoomIn9+ +zoomIn(): boolean + +调用此接口将当前网页进行放大,比列20%。 + +**返回值:** + | 类型 | 说明 | + |----------|------| + | boolean | 放大操作是否成功执行。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('zoomIn') + .onClick(() => { + let result = this.controller.zoomIn(); + console.log("result: " + result); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +### zoomOut9+ +zoomOut(): boolean + +调用此接口将当前网页进行缩小,比列20%。 + +**返回值:** + | 类型 | 说明 | + |----------|------| + | boolean | 缩小操作是否成功执行。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('zoomOut') + .onClick(() => { + let result = this.controller.zoomOut(); + console.log("result: " + result); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + ### refresh -refresh(): void +refresh() 调用此接口通知Web组件刷新网页。 +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('refresh') + .onClick(() => { + this.controller.refresh(); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + ### registerJavaScriptProxy -registerJavaScriptProxy(options: { object: object, name: string, methodList: Array\ }): void +registerJavaScriptProxy(options: { object: object, name: string, methodList: Array\ }) 注入JavaScript对象到window对象中,并在window对象中调用该对象的方法。注册后,须调用refresh接口生效。 -- options 参数说明 - +**参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | ---------- | --------------- | ---- | ------ | ------------------------------------------------------------ | | object | object | 是 | - | 参与注册的应用侧JavaScript对象。只能声明方法,不能声明属性 。其中方法的参数和返回类型只能为string,number,boolean | | name | string | 是 | - | 注册对象的名称,与window中调用的对象名一致。注册后window对象可以通过此名字访问应用侧JavaScript对象。 | | methodList | Array\ | 是 | - | 参与注册的应用侧JavaScript对象的方法。 | +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct Index { + controller: WebController = new WebController() + testObj = { + test: (data) => { + return "ArkUI Web Component"; + }, + toString: () => { + console.log('Web Component toString'); + } + } + build() { + Column() { + Row() { + Button('Register JavaScript To Window').onClick(() => { + this.controller.registerJavaScriptProxy({ + object: this.testObj, + name: "objName", + methodList: ["test", "toString"], + }); + }) + } + Web({ src: $rawfile('index.html'), controller: this.controller }) + .javaScriptAccess(true) + } + } + } + ``` + + ```html + + + + + + Hello world! + + + + + ``` + ### runJavaScript -runJavaScript(options: { script: string, callback?: (result: string) => void }): void +runJavaScript(options: { script: string, callback?: (result: string) => void }) 异步执行JavaScript脚本,并通过回调方式返回脚本执行的结果。runJavaScript需要在loadUrl完成后,比如onPageEnd中调用。 -- options参数说明 - +**参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | -------- | ------------------------ | ---- | ------ | ------------------------------------------------------------ | | script | string | 是 | - | JavaScript脚本。 | | callback | (result: string) => void | 否 | - | 回调执行JavaScript脚本结果。JavaScript脚本若执行失败或无返回值时,返回null。 | +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + @State webResult: string = '' + build() { + Column() { + Text(this.webResult).fontSize(20) + Web({ src: $rawfile('index.html'), controller: this.controller }) + .javaScriptAccess(true) + .onPageEnd(e => { + this.controller.runJavaScript({ + script: 'test()', + callback: (result: string)=> { + this.webResult = result + console.info(`The test() return value is: ${result}`) + }}); + console.info('url: ', e.url); + }) + } + } + } + ``` + + ```html + + + + + + Hello world! + + + + + ``` + ### stop -stop(): void +stop() 停止页面加载。 +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('stop') + .onClick(() => { + this.controller.stop(); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + ### clearHistory clearHistory(): void 删除所有前进后退记录。 -### getCookieManager +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('clearHistory') + .onClick(() => { + this.controller.clearHistory(); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +### getCookieManager9+ getCookieManager(): WebCookie 获取web组件cookie管理对象。 -- 返回值 - | 参数类型 | 说明 | + +**返回值:** + | 类型 | 说明 | | --------- | -------------------------------------------------------- | | WebCookie | web组件cookie管理对象,参考[WebCookie](#webcookie)定义。 | + +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('getCookieManager') + .onClick(() => { + let cookieManager = this.controller.getCookieManager(); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +## HitTestValue9+ +提供点击区域的元素信息。示例代码参考[getHitTestValue](#gethittestvalue9)。 + +### getType9+ +getType(): HitTestType + +获取当前被点击区域的元素类型。 + +**返回值:** + | 类型 | 说明 | + |----------|------| + | [HitTestType](#hittesttype枚举说明) | 当前被点击区域的元素类型。 | + +### getExtra9+ +getExtra(): string + +若被点击区域为图片或链接,则附加参数信息为其url地址。 + +**返回值:** + | 类型 | 说明 | + |----------|------| + | string | 点击区域的附加参数信息。 | + ## WebCookie + 通过WebCookie可以控制Web组件中的cookie的各种行为,其中每个应用中的所有web组件共享一个WebCookie。通过controller方法中的getCookieManager方法可以获取WebCookie对象,进行后续的cookie管理操作。 -### setCookie + +### setCookie9+ setCookie(url: string, value: string): boolean 设置cookie,该方法为同步方法。设置成功返回true,否则返回false。 -- 参数说明 - +**参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | ------ | -------- | ---- | ------ | ------------------------- | | url | string | 是 | - | 要设置的cookie所属的url。 | | value | string | 是 | - | cookie的值。 | -- 返回值 - | 参数类型 | 说明 | + +**返回值:** + | 类型 | 说明 | | -------- | -------------------- | | boolean | 设置cookie是否成功。 | -### saveCookieSync +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('setCookie') + .onClick(() => { + let result = this.controller.getCookieManager().setCookie("www.example.com", "a=b"); + console.log("result: " + result); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +### saveCookieSync9+ saveCookieSync(): boolean 将当前存在内存中的cookie同步到磁盘中,该方法为同步方法。 -- 返回值 - | 参数类型 | 说明 | + +**返回值:** + | 类型 | 说明 | | -------- | ---------------------------------- | | boolean | 同步内存cookie到磁盘操作是否成功。 | -## 示例 - -```ts -// webComponent.ets -@Entry -@Component -struct WebComponent { - @State javaScriptAccess: boolean = true; - @State fileAccess: boolean = true; - controller: WebController = new WebController(); - build() { - Column() { - Web({ src: $rawfile('index.html'), controller: this.controller }) - .javaScriptAccess(this.javaScriptAccess) - .fileAccess(this.fileAccess) - .onPageEnd(e => { - // test() 在 index.html 中已定义 - this.controller.runJavaScript({ script: 'test()' }); - console.log("url: ", e.url); - }) - } - } -} -``` -```html - - - - - - Hello world! - - - -``` -![](figures/Web.png) \ No newline at end of file +**示例:** + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('saveCookieSync') + .onClick(() => { + let result = this.controller.getCookieManager().saveCookieSync(); + console.log("result: " + result); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +## WebDataBase9+ +web组件数据库管理对象。 + +### existHttpAuthCredentials9+ + +static existHttpAuthCredentials(): boolean + +判断是否存在任何已保存的HTTP身份验证凭据,该方法为同步方法。存在返回true,不存在返回false。 + +**返回值:** + | 类型 | 说明 | + | -------- | ----------------------------------- | + | boolean | 是否存在任何已保存的HTTP身份验证凭据。存在返回true,不存在返回false | + +**示例:** + ```ts + // xxx.ets + import web from '@ohos.web'; + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('existHttpAuthCredentials') + .onClick(() => { + let result = web.WebDataBase.existHttpAuthCredentials(); + console.log('result: ' + result); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +### deleteHttpAuthCredentials9+ + +static deleteHttpAuthCredentials(): void + +清除所有已保存的HTTP身份验证凭据,该方法为同步方法。 + +**示例:** + ```ts + // xxx.ets + import web from '@ohos.web'; + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + + build() { + Column() { + Button('deleteHttpAuthCredentials') + .onClick(() => { + web.WebDataBase.deleteHttpAuthCredentials(); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +### getHttpAuthCredentials9+ + +static getHttpAuthCredentials(host: string, realm: string): Array\ + +检索给定主机和域的HTTP身份验证凭据,该方法为同步方法。检索成功返回一个包含用户名和密码的组数,检索不成功返回空数组。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | -------------------------- | + | host | string | 是 | - | HTTP身份验证凭据应用的主机。 | + | realm | string | 是 | - | HTTP身份验证凭据应用的域。 | + +**返回值:** + | 类型 | 说明 | + | ---------------- | --------------------------------------------- | + | Array\ | 包含用户名和密码的组数,检索失败返回空数组。 | + +**示例:** + ```ts + // xxx.ets + import web from '@ohos.web'; + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + host: string = "www.spincast.org"; + realm: string = "protected example"; + username_password: string[]; + build() { + Column() { + Button('getHttpAuthCredentials') + .onClick(() => { + this.username_password = web.WebDataBase.getHttpAuthCredentials(this.host, this.realm); + console.log('num: ' + this.username_password.length); + ForEach(this.username_password, (item) => { + console.log('username_password: ' + item); + }, item => item) + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +### saveHttpAuthCredentials9+ + +static saveHttpAuthCredentials(host: string, realm: string, username: string, password: string): void + +保存给定主机和域的HTTP身份验证凭据,该方法为同步方法。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | -------- | -------- | ---- | ------ | -------------------------- | + | host | string | 是 | - | HTTP身份验证凭据应用的主机。 | + | realm | string | 是 | - | HTTP身份验证凭据应用的域。 | + | username | string | 是 | - | 用户名。 | + | password | string | 是 | - | 密码。 | + +**示例:** + ```ts + // xxx.ets + import web from '@ohos.web'; + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + host: string = "www.spincast.org"; + realm: string = "protected example"; + build() { + Column() { + Button('saveHttpAuthCredentials') + .onClick(() => { + web.WebDataBase.saveHttpAuthCredentials(this.host, this.realm, "Stromgol", "Laroche"); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +## WebStorage9+ +通过WebStorage可管理Web SQL数据库接口和HTML5 Web存储接口,每个应用中的所有Web组件共享一个WebStorage。 +### deleteAllData9+ +static deleteAllData(): void + +清除Web SQL数据库当前使用的所有存储。 + +**示例:** + ```ts + // xxx.ets + import web from '@ohos.web'; + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + build() { + Column() { + Button('deleteAllData') + .onClick(() => { + web.WebStorage.deleteAllData(); + }) + Web({ src: 'www.example.com', controller: this.controller }) + .databaseAccess(true) + } + } + } + ``` + +### deleteOrigin9+ +static deleteOrigin(origin : string): void + +清除指定源所使用的存储。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 说明 | + |---------|---------|-----|-----| + | origin | string | 是 | 指定源的字符串索引。 | + +**示例:** + ```ts + // xxx.ets + import web from '@ohos.web'; + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + origin: string = "origin"; + build() { + Column() { + Button('getHttpAuthCredentials') + .onClick(() => { + web.WebStorage.deleteOrigin(this.origin); + }) + Web({ src: 'www.example.com', controller: this.controller }) + .databaseAccess(true) + } + } + } + ``` + +### getOrigins9+ +static getOrigins(callback: AsyncCallback>) : void + +以回调方式异步获取当前使用Web SQL数据库的所有源的信息。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 说明 | + |---------|---------|-----|----| + | callback | AsyncCallback> | 是 | 以数组方式返回源的信息,信息内容参考WebStorageOrigin。| + +**示例:** + ```ts + // xxx.ets + import web from '@ohos.web'; + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + origin: string = "origin"; + build() { + Column() { + Button('getOrigins') + .onClick(() => { + web.WebStorage.getOrigins((error, origins) => { + if (error) { + console.log('error: ' + error); + return; + } + for (let i = 0; i < origins.length; i++) { + console.log('origin: ' + origins[i].origin); + console.log('usage: ' + origins[i].usage); + console.log('quota: ' + origins[i].quota); + } + }) + }) + Web({ src: 'www.example.com', controller: this.controller }) + .databaseAccess(true) + } + } + } + ``` + +### getOrigins9+ +static getOrigins() : Promise> + +以Promise方式异步获取当前使用Web SQL数据库的所有源的信息。 + +**返回值:** + | 类型 | 说明 | + |------|------| + | Promise> | Promise实例,用于获取当前所有源的信息,信息内容参考WebStorageOrigin。 | + +**示例:** + ```ts + // xxx.ets + import web from '@ohos.web'; + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + origin: string = "origin"; + build() { + Column() { + Button('getOrigins') + .onClick(() => { + web.WebStorage.getOrigins() + .then(origins => { + for (let i = 0; i < origins.length; i++) { + console.log('origin: ' + origins[i].origin); + console.log('usage: ' + origins[i].usage); + console.log('quota: ' + origins[i].quota); + } + }) + .catch(error => { + console.log('error: ' + error); + }) + }) + Web({ src: 'www.example.com', controller: this.controller }) + .databaseAccess(true) + } + } + } + ``` + +### getOriginQuota9+ +static getOriginQuota(origin : string, callback : AsyncCallback) : void + +使用callback回调异步获取指定源的Web SQL数据库的存储配额,配额以字节为单位。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 说明 | + |----------|-----------|------|------| + | origin | string | 是 | 指定源的字符串索引 | + | callback | AsyncCallback | 是 | 指定源的存储配额。 | + +**示例:** + ```ts + // xxx.ets + import web from '@ohos.web'; + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + origin: string = "origin"; + build() { + Column() { + Button('getOriginQuota') + .onClick(() => { + web.WebStorage.getOriginQuota(this.origin, (error, quota) => { + if (error) { + console.log('error: ' + error); + return; + } + console.log('quota: ' + quota); + }) + }) + Web({ src: 'www.example.com', controller: this.controller }) + .databaseAccess(true) + } + } + } + ``` + +### getOriginQuota9+ +static getOriginQuota(origin : string) : Promise + +以Promise方式异步获取指定源的Web SQL数据库的存储配额,配额以字节为单位。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 说明 | + |----------|---------|------|-------| + | origin | string | 是 | 指定源的字符串索引。 | + +**返回值:** + | 类型 | 说明 | + |------|------| + | Promise | Promise实例,用于获取指定源的存储配额。 | + +**示例:** + ```ts + // xxx.ets + import web from '@ohos.web'; + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + origin: string = "origin"; + build() { + Column() { + Button('getOriginQuota') + .onClick(() => { + web.WebStorage.getOriginQuota(this.origin) + .then(quota => { + console.log('quota: ' + quota); + }) + .catch(error => { + console.log('error: ' + error); + }) + }) + Web({ src: 'www.example.com', controller: this.controller }) + .databaseAccess(true) + } + } + } + ``` + +### getOriginUsage9+ +static getOriginUsage(origin : string, callback : AsyncCallback) : void + +以回调方式异步获取指定源的Web SQL数据库的存储量,存储量以字节为单位。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 说明 | + |----------|----------|------|------| + | origin | string | 是 | 指定源的字符串索引。 | + | callback | AsyncCallback | 是 | 指定源的存储量。 | + +**示例:** + ```ts + // xxx.ets + import web from '@ohos.web'; + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + origin: string = "origin"; + build() { + Column() { + Button('getOriginUsage') + .onClick(() => { + web.WebStorage.getOriginUsage(this.origin, (error, usage) => { + if (error) { + console.log('error: ' + error); + return; + } + consloe.log('usage: ' + usage); + }) + }) + Web({ src: 'www.example.com', controller: this.controller }) + .databaseAccess(true) + } + } + } + ``` + +### getOriginUsage9+ +static getOriginUsage(origin : string) : Promise + +以Promise方式异步获取指定源的Web SQL数据库的存储量,存储量以字节为单位。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 说明 | + |----------|----------|------|------| + | origin | string | 是 | 指定源的字符串索引。 | + +**返回值:** + | 类型 | 说明 | + |------|------| + | Promise | Promise实例,用于获取指定源的存储量。 | + +**示例:** + ```ts + // xxx.ets + import web from '@ohos.web'; + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + origin: string = "origin"; + build() { + Column() { + Button('getOriginQuota') + .onClick(() => { + web.WebStorage.getOriginUsage(this.origin) + .then(usage => { + console.log('usage: ' + usage); + }) + .catch(error => { + console.log('error: ' + error); + }) + }) + Web({ src: 'www.example.com', controller: this.controller }) + .databaseAccess(true) + } + } + } + ``` + +## WebStorageOrigin9+ + +提供Web SQL数据库的使用信息。 + +**参数:** + | 参数名 | 参数类型 | 必填 | 说明 | + |----------|----------|------|------| + | origin | string | 是 | 指定源的字符串索引。 | + | usage | number | 是 | 指定源的存储量。 | + | quota | number | 是 | 指定源的存储配额。 | + +## MessageLevel枚举说明 + +| 名称 | 描述 | +| ----- | :--------- | +| Debug | 调试级别。 | +| Error | 错误级别。 | +| Info | 消息级别。 | +| Log | 日志级别。 | +| Warn | 警告级别。 | + +## RenderExitReason枚举说明 + +onRenderExited接口返回的渲染进程退出的具体原因。 + +| 名称 | 描述 | +| -------------------------- | ---------------------------- | +| ProcessAbnormalTermination | 渲染进程异常退出。 | +| ProcessWasKilled | 收到SIGKILL,或被手动终止。 | +| ProcessCrashed | 渲染进程崩溃退出,如段错误。 | +| ProcessOom | 程序内存不足。 | +| ProcessExitUnknown | 其他原因。 | + +## MixedMode枚举说明 + +| 名称 | 描述 | +| ---------- | ----------------------------------------------------------- | +| All | 允许加载HTTP和HTTPS混合内容。所有不安全的内容都可以被加载。 | +| Compatible | 混合内容兼容性模式,部分不安全的内容可能被加载。 | +| None | 不允许加载HTTP和HTTPS混合内容。 | + +## CacheMode枚举说明 +| 名称 | 描述 | +| ------- | ------------------------------------------------------------ | +| Default | 使用未过期的cache加载资源,如果cache中无该资源则从网络中获取。 | +| None | 加载资源使用cache,如果cache中无该资源则从网络中获取。 | +| Online | 加载资源不使用cache,全部从网络中获取。 | +| Only | 只从cache中加载资源。 | + +## FileSelectorMode枚举说明 +| 名称 | 描述 | +| -------------------- | -------------------- | +| FileOpenMode | 打开上传单个文件。 | +| FileOpenMultipleMode | 打开上传多个文件。 | +| FileOpenFolderMode | 打开上传文件夹模式。 | +| FileSaveMode | 文件保存模式。 | + + ## HitTestType枚举说明 + + | 名称 | 描述 | + | ------------- | ----------------------------------------- | + | EditText | 可编辑的区域。 | + | Email | 电子邮件地址。 | + | HttpAnchor | 超链接,其src为http。 | + | HttpAnchorImg | 带有超链接的图片,其中超链接的src为http。 | + | Img | HTML::img标签。 | + | Map | 地理地址。 | + | Unknown | 未知内容。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md b/zh-cn/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md index 602a4899e45964f304c58de3f5a725fde384ea2d..73196594f0b8e11749c78d0feaecb8e5abd6e18f 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md @@ -19,14 +19,14 @@ CanvasRenderingContext2D(setting: RenderingContextSetting) ### RenderingContextSettings -RenderingContextSettings(antialias?: bool) +RenderingContextSettings(antialias?: boolean) 用来配置CanvasRenderingContext2D对象的参数,包括是否开启抗锯齿。 - 参数 - | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | - | --------- | ---- | ---- | ----- | ---------------- | - | antialias | bool | 否 | false | 表明canvas是否开启抗锯齿。 | + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | --------- | ------- | ---- | ----- | ---------------- | + | antialias | boolean | 否 | false | 表明canvas是否开启抗锯齿。 | ## 属性 @@ -1746,17 +1746,17 @@ drawImage(image: ImageBitmap | PixelMap, sx: number, sy: number, sWidth: number, 进行图像绘制。 - 参数 - | 参数 | 类型 | 必填 | 默认值 | 描述 | - | ------- | ---------------------------------------- | ---- | ---- | ----------------------------- | - | image | [ImageBitmap](ts-components-canvas-imagebitmap.md)或[PixelMap](../apis/js-apis-image.md#pixelmap7) | 是 | null | 图片资源,请参考ImageBitmap或PixelMap。 | - | sx | number | 否 | 0 | 裁切源图像时距离源图像左上角的x坐标值。 | - | sy | number | 否 | 0 | 裁切源图像时距离源图像左上角的y坐标值。 | - | sWidth | number | 否 | 0 | 裁切源图像时需要裁切的宽度。 | - | sHeight | number | 否 | 0 | 裁切源图像时需要裁切的高度。 | - | dx | number | 是 | 0 | 绘制区域左上角在x轴的位置。 | - | dy | number | 是 | 0 | 绘制区域左上角在y 轴的位置。 | - | dWidth | number | 否 | 0 | 绘制区域的宽度。 | - | dHeight | number | 否 | 0 | 绘制区域的高度。 | + | 参数 | 类型 | 必填 | 默认值 | 描述 | + | ------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- | + | image | [ImageBitmap](ts-components-canvas-imagebitmap.md)或[PixelMap](../apis/js-apis-image.md#pixelmap7) | 是 | null | 图片资源,请参考ImageBitmap或PixelMap。 | + | sx | number | 否 | 0 | 裁切源图像时距离源图像左上角的x坐标值。 | + | sy | number | 否 | 0 | 裁切源图像时距离源图像左上角的y坐标值。 | + | sWidth | number | 否 | 0 | 裁切源图像时需要裁切的宽度。 | + | sHeight | number | 否 | 0 | 裁切源图像时需要裁切的高度。 | + | dx | number | 是 | 0 | 绘制区域左上角在x轴的位置。 | + | dy | number | 是 | 0 | 绘制区域左上角在y 轴的位置。 | + | dWidth | number | 否 | 0 | 绘制区域的宽度。 当绘制区域的宽度和裁剪图像的宽度不一致时,将图像宽度拉伸或压缩为绘制区域的宽度。 | + | dHeight | number | 否 | 0 | 绘制区域的高度。 当绘制区域的高度和裁剪图像的高度不一致时,将图像高度拉伸或压缩为绘制区域的高度。 | - 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md index 90c23a37039a941962026127fbbb90a0ce6fc1db..2c37265fd0b029bed6458350d2642c2a5500ec18 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md @@ -17,7 +17,7 @@ addColorStop(offset: number, color: string): void | 参数 | 类型 | 必填 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -------- | | offset | number | 是 | 0 | 设置渐变点距离起点的位置占总体长度的比例,范围为0到1。 | - | color | string | 是 | 'ffffff' | 设置渐变的颜色。 | + | color | string | 是 | '#ffffff' | 设置渐变的颜色。 | - 示例 ```ts diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-list.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-list.md index b393437cc7d44e39be337cce207ae25bd914dff9..d756e0ac5fcec68c24af72cadab277a4b6bf0c61 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-list.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-list.md @@ -1,6 +1,6 @@ # List -> **说明:** +> **说明:** > 该组件从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 @@ -26,7 +26,7 @@ List(value:{space?: number | string, initialIndex?: number, scroller?: Scroller} | -------- | -------- | -------- | -------- | -------- | | space | number \| string | 否 | 0 | 列表项间距。 | | initialIndex | number | 否 | 0 | 设置当前List初次加载时视口起始位置显示的item,即显示第一个item,如设置的序号超过了最后一个item的序号,则设置不生效。 | - | scroller | [Scroller](ts-container-scroll.md#scroller) | 是 | - | 可滚动组件的控制器。用于与可滚动组件进行绑定。 | + | scroller | [Scroller](ts-container-scroll.md#scroller) | 否 | - | 可滚动组件的控制器。用于与可滚动组件进行绑定。 | ## 属性 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md index 7c612c94cb36f2894a1482b48013b6e5cc3c69b2..3e670928ff4c5b80b28bc52335fda6e8faf1ec24 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md @@ -35,7 +35,7 @@ Swiper(value:{controller?: SwiperController}) | autoPlay | boolean | false | 子组件是否自动播放,自动播放状态下,导航点不可操作。 | | interval | number | 3000 | 使用自动播放时播放的时间间隔,单位为毫秒。 | | indicator | boolean | true | 是否启用导航点指示器。 | -| loop | boolean | true | 是否开启循环。 | +| loop | boolean | true | 是否开启循环。
设置为true时表示开启循环,在LazyForEach懒循环加载模式下,加载的组件数量建议大于5个。 | | duration | number | 400 | 子组件切换的动画时长,单位为毫秒。 | | vertical | boolean | false | 是否为纵向滑动。 | | itemSpace | Length | 0 | 设置子组件与子组件之间间隙。 | @@ -45,7 +45,7 @@ Swiper(value:{controller?: SwiperController}) | indicatorStyle8+ | {
left?: Length,
top?: Length,
right?: Length,
bottom?: Length,
size?: Length,
color?: Color,
selectedColor?: Color
} | - | 设置indicator样式:
- left: 设置导航点距离Swiper组件左边的距离。
- top: 设置导航点距离Swiper组件顶部的距离。
- right: 设置导航点距离Swiper组件右边的距离。
- bottom: 设置导航点距离Swiper组件底部的距离。
- size: 设置导航点的直径。
- color: 设置导航点的颜色。
- selectedColor: 设置选中的导航点的颜色。 | -### SwiperController +## SwiperController Swiper容器组件的控制器,可以将此对象绑定至Swiper组件,然后通过它控制翻页。 @@ -96,7 +96,7 @@ struct SwiperExample { private swiperController: SwiperController = new SwiperController() private data: MyDataSource = new MyDataSource([]) - private aboutToAppear(): void { + aboutToAppear(): void { let list = [] for (var i = 1; i <= 10; i++) { list.push(i.toString()); diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-background.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-background.md index 123824d1a5deba3e49c73e5986e905dde35956db..15d710e5e01f8accbfe481cc31930f7df3128f48 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-background.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-background.md @@ -17,8 +17,8 @@ | 名称 | 参数类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| backgroundColor | Color | - | 设置组件的背景色。 | -| backgroundImage | src: string,
repeat?: [ImageRepeat](ts-appendix-enums.md#imagerepeat枚举说明) | - | src参数:图片地址,支持网络图片资源和本地图片资源地址(不支持svg类型的图片)。
repeat参数:设置背景图片的重复样式,默认不重复。 | +| backgroundColor | [ResourceColor](../../ui/ts-types.md) | - | 设置组件的背景色。 | +| backgroundImage | src: [ResourceStr](../../ui/ts-types.md),
repeat?: [ImageRepeat](ts-appendix-enums.md#imagerepeat枚举说明) | - | src参数:图片地址,支持网络图片资源和本地图片资源地址(不支持svg类型的图片)。
repeat参数:设置背景图片的重复样式,默认不重复。 | | backgroundImageSize | {
width?: Length,
height?: Length
} \| ImageSize | Auto | 设置背景图像的高度和宽度。当输入为{width: Length, height: Length}对象时,如果只设置一个属性,则第二个属性保持图片原始宽高比进行调整。默认保持原图的比例不变。 | | backgroundImagePosition | {
x?: Length,
y?: Length
} \| [Alignment](ts-appendix-enums.md#alignment枚举说明) | {
x: 0,
y: 0
} | 设置背景图在组件中显示位置。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md index 0bedbd2b915ad4facda451efeb8c1d0bfbb63ece..ca42d63a08616226c97fba1f376c95eea8d3ec73 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md @@ -43,13 +43,10 @@ @Entry @Component struct Index { - @State message: string = 'This is\nborderImage.' - @State message2: string = 'This is\ngradient color.' - build() { Row() { Column() { - Text(this.message).textAlign(TextAlign.Center) + Text('This is\nborderImage.').textAlign(TextAlign.Center) .borderImage({ source: "borderOrigin.png", slice: {top:"31%", bottom:"31%", left:"31%", right:"31%"}, @@ -58,8 +55,26 @@ struct Index { repeat: RepeatMode.Repeat, fill: false }); - Text(this.message2).textAlign(TextAlign.Center) - .margin(10) + } + .width('100%') + } + .height('100%') + } +} +``` + +![zh-cn_image_borderImage](figures/borderImage.png) + + +```ts +// xxx.ets +@Entry +@Component +struct Index { + build() { + Row() { + Column() { + Text('This is\ngradient color.').textAlign(TextAlign.Center) .borderImage({ source: {angle:90, direction: GradientDirection.Left, @@ -77,4 +92,4 @@ struct Index { } ``` -![zh-cn_image_borderImage](figures/borderImage.png) +![zh-cn_image_borderImageGradient](figures/borderImageGradient.png) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border.md index bbe7e27f6b39ce2a02795f40bc403c7b2a027eb3..57e660947ef0d81e680f46434190181e91da34ae 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border.md @@ -2,9 +2,9 @@ > **说明:** > -> 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 > -> 从API Version 9开始,父节点的border显示在子节点内容之上。 +> 从API Version 9开始,父节点的border显示在子节点内容之上。 设置组件边框样式。 @@ -18,29 +18,75 @@ ## 属性 -| 名称 | 参数类型 | 默认值 | 描述 | -| -------- | -------- | -------- | -------- | -| border | BorderOptions | - | 统一边框样式设置接口。 | -| borderStyle | BorderStyle |  BorderStyle.Solid | 设置元素的边框样式。 | -| borderWidth | Length | 0 | 设置元素的边框宽度。 | -| borderColor | Color | - | 设置元素的边框颜色。 | -| borderRadius | Length | 0 | 设置元素的边框圆角半径。 | +| 名称 | 参数类型 | 默认值 | 描述 | +| ------------ | ------------- | ----------------------- | ------------------------ | +| border | BorderOptions | - | 统一边框样式设置接口。 | +| borderStyle | BorderStyle |  BorderStyle.Solid | 设置元素的边框样式。 | +| borderWidth | Length | 0 | 设置元素的边框宽度。 | +| borderColor | [ResourceColor](../../ui/ts-types.md) | - | 设置元素的边框颜色。 | +| 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 | 否 | 边框样式。 | + | 参数名称 | 参数类型 | 默认值 | 必填 | 参数描述 | + | -------- | ------------------------------------------------------------ | ----------------- | ---- | ---------- | + | width | [Length](../../ui/ts-types.md#长度类型)\|EdgeWidth9+ | 0 | 否 | 边框宽度。 | + | color | [ResourceColor](../../ui/ts-types.md)\|EdgeColor9+ | 'Black' | 否 | 边框颜色。 | + | radius | [Length](../../ui/ts-types.md#长度类型)\| EdgeRadiuses9+ | 0 | 否 | 边框角度。 | + | style | BorderStyle\|EdgeStyle9+ | BorderStyle.Solid | 否 | 边框样式。 | + + +- EdgeWidth9+对象说明 + + 引入该对象时,至少传入一个参数。 + + | 名称 | 参数类型 | 必填 | 默认值 | 描述 | + | ------ | -------- | ---- | ------ | -------------- | + | left | length | 否 | 0 | 左侧边框宽度。 | + | right | length | 否 | 0 | 右侧边框宽度。 | + | top | length | 否 | 0 | 上侧边框宽度。 | + | bottom | length | 否 | 0 | 下侧边框宽度。 | + +- EdgeColor9+对象说明 + + 引入该对象时,至少传入一个参数。 + + | 名称 | 参数类型 | 必填 | 默认值 | 描述 | + | ------ | ------------------------------------- | ---- | ------- | -------------- | + | left | [ResourceColor](../../ui/ts-types.md) | 否 | 'Black' | 左侧边框颜色。 | + | right | [ResourceColor](../../ui/ts-types.md) | 否 | 'Black' | 右侧边框颜色。 | + | top | [ResourceColor](../../ui/ts-types.md) | 否 | 'Black' | 上侧边框颜色。 | + | bottom | [ResourceColor](../../ui/ts-types.md) | 否 | 'Black' | 下侧边框颜色。 | + +- EdgeRadiuses9+对象说明 + + 引用该对象时,至少传入一个参数。 + + | 名称 | 参数类型 | 必填 | 默认值 | 描述 | + | ----------- | -------- | ---- | ------ | ---------------- | + | topLeft | length | 否 | 0 | 左上角圆角半径。 | + | topRight | length | 否 | 0 | 右上角圆角半径。 | + | bottomLeft | length | 否 | 0 | 左下角圆角半径。 | + | bottomRight | length | 否 | 0 | 右下角圆角半径。 | + +- EdgeStyle9+对象说明 + + 引入该对象时,至少传入一个参数。 + + | 名称 | 参数类型 | 必填 | 默认值 | 描述 | + | ------ | ----------- | ---- | ----------------- | -------------- | + | left | BorderStyle | 否 | BorderStyle.Solid | 左侧边框样式。 | + | right | BorderStyle | 否 | BorderStyle.Solid | 右侧边框样式。 | + | top | BorderStyle | 否 | BorderStyle.Solid | 上侧边框样式。 | + | bottom | BorderStyle | 否 | BorderStyle.Solid | 下侧边框样式。 | - BorderStyle枚举说明 - | 名称 | 描述 | - | -------- | -------- | - | Dotted | 显示为一系列圆点,圆点半径为borderWidth的一半。 | - | Dashed | 显示为一系列短的方形虚线。 | - | Solid | 显示为一条实线。 | + + | 名称 | 描述 | + | ------ | ----------------------------------------------- | + | Dotted | 显示为一系列圆点,圆点半径为borderWidth的一半。 | + | Dashed | 显示为一系列短的方形虚线。 | + | Solid | 显示为一条实线。 | ## 示例 @@ -51,18 +97,35 @@ @Component struct BorderExample { build() { - Flex({ justifyContent: FlexAlign.SpaceAround, alignItems: ItemAlign.Center }) { - // 线段 - Text('dashed') + Column() { + Flex({ justifyContent: FlexAlign.SpaceAround, alignItems: ItemAlign.Center }) { + // 线段 + Text('dashed') .borderStyle(BorderStyle.Dashed).borderWidth(5).borderColor(0xAFEEEE).borderRadius(10) - .width(120).height(120).textAlign(TextAlign.Center).fontSize(16) - // 点线 - Text('dotted') - .border({ width: 5, color: 0x317AF7, radius: 10, style: BorderStyle.Dotted }) - .width(120).height(120).textAlign(TextAlign.Center).fontSize(16) - }.width('100%').height(150) + .width(120).height(120).textAlign(TextAlign.Center).fontSize(16) + // 点线 + Text('dotted') + .border({ width: 5, color: 0x317AF7, radius: 10, style: BorderStyle.Dotted }) + .width(120).height(120).textAlign(TextAlign.Center).fontSize(16) + }.width('100%').height(150) + Text('.border') + .fontSize(50) + .width(300) + .height(300) + .border({ + width: { left: '5lpx', right: '10lpx', top: '20lpx', bottom: '30lpx' }, + color: { left: '#e3bbbb', right: Color.Blue, top: Color.Red, bottom: Color.Green }, + radius: { topLeft: 10, topRight: 20, bottomLeft: 40, bottomRight: 80 }, + style: { + left: BorderStyle.Dotted, + right: BorderStyle.Dotted, + top: BorderStyle.Solid, + bottom: BorderStyle.Dashed + } + }).textAlign(TextAlign.Center) + } } } ``` -![zh-cn_image_0000001219982705](figures/zh-cn_image_0000001219982705.gif) +![zh-cn_image_0000001219982705](figures/zh-cn_image_0000001219982705.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-focus.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-focus.md index 4709e6c5b4807df9551cd60bab96c20354e68bf8..4f51c85fb0db13fa699d016583bcea7ddb5304c8 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-focus.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-focus.md @@ -3,7 +3,7 @@ 自定义组件的走焦效果,可设置组件是否走焦和具体的走焦顺序,tab键或者方向键切换焦点。 > **说明:** -> 从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> 从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 ## 权限列表 @@ -13,17 +13,18 @@ ## 属性 -| **名称** | **参数类型** | **默认值** | **描述** | -| -------- | -------- | -------- | -------- | -| focusable | boolean | false | 设置当前组件是否可以获焦。 | -| tabIndex9+ | number | 0 | 自定义组件tab键走焦能力,走焦顺序为:tabIndex大于0的组件依次递增走焦, tabIndex等于0的组件按组件树先后顺序走焦。
- tabIndex >= 0:表示元素是可聚焦的,并且可以通过tab键走焦来访问到该元素,按照tabIndex的数值递增而先后获焦。如果多个元素拥有相同的tabIndex,按照元素在当前组件树中的先后顺序获焦
- tabIndex < 0(通常是tabIndex = -1):表示元素是可聚焦的,但是不能通过tab键走焦来访问到该元素 | +| **名称** | **参数类型** | **默认值** | **描述** | +| -------------------- | -------- | ------- | ---------------------------------------- | +| focusable | boolean | false | 设置当前组件是否可以获焦。 | +| tabIndex9+ | number | 0 | 自定义组件tab键走焦能力,走焦顺序为:tabIndex大于0的组件依次递增走焦, tabIndex等于0的组件按组件树先后顺序走焦。
- tabIndex >= 0:表示元素是可聚焦的,并且可以通过tab键走焦来访问到该元素,按照tabIndex的数值递增而先后获焦。如果多个元素拥有相同的tabIndex,按照元素在当前组件树中的先后顺序获焦
- tabIndex < 0(通常是tabIndex = -1):表示元素是可聚焦的,但是不能通过tab键走焦来访问到该元素 | > **说明:** -> 支持焦点控制的组件:Button、Text、Image、List、Grid。 - +> 支持焦点控制的组件:Button、Text、Image、List、Grid。 ## 示例 +焦点事件当前仅支持在真机上显示运行效果。 + ```ts // xxx.ets @Entry @@ -68,3 +69,5 @@ struct FocusableExample { } } ``` + +![focus](figures/focus.png) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md index c2ccb7bf9bf00de306bcffeac847361bc76f5885..67a5d725dd39f3f2ed671a5ffe96252c7a5c1449 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md @@ -3,6 +3,7 @@ 设置组件的颜色渐变效果。 > **说明:** +> > 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 @@ -16,7 +17,7 @@ | 名称 | 参数类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| linearGradient | {
angle?: [Angle](../../ui/ts-types.md),
direction?: GradientDirection,
colors: Array<[ColorStop](../../ui/ts-types.md)>
repeating?: boolean
} | - | 线性渐变。
angle: 线性渐变的角度。
direction: 线性渐变的方向。
colors: 为渐变的颜色描述。
repeating: 为渐变的颜色重复着色。 | +| linearGradient | {
angle?: [Angle](../../ui/ts-types.md),
direction?: GradientDirection,
colors: Array<[ColorStop](../../ui/ts-types.md)>
repeating?: boolean
} | - | 线性渐变。
angle: 线性渐变的角度。
direction: 线性渐变的方向,设置angle后不生效。
colors: 为渐变的颜色描述。
repeating: 为渐变的颜色重复着色。 | | sweepGradient | {
center: Point,
start?: angle,
end?: angle,
colors: Array<[ColorStop](../../ui/ts-types.md)>
repeating?: boolean
} | - | 角度渐变。
center:为角度渐变的中心点。
start:角度渐变的起点。
end:角度渐变的终点。
colors: 为渐变的颜色描述。
repeating: 为渐变的颜色重复着色。 | | radialGradient | {
center: Point,
radius: Length,
colors: Array<[ColorStop](../../ui/ts-types.md)>
repeating: boolean
} | - | 径向渐变。
center:径向渐变的中心点。
radius:径向渐变的半径。
colors: 为渐变的颜色描述。
repeating: 为渐变的颜色重复着色。 | @@ -52,7 +53,6 @@ struct ColorGradientExample { .height(50) .linearGradient({ angle: 90, - direction: GradientDirection.Left, colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]] }) Text('sweepGradient').fontSize(12).width('90%').fontColor(0xCCCCCC) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md index e7e0a8eaef78ba7020faefba9c16a8947bfd4dd1..9168b2896a1d0ca20e7389d4c477c4667ca315f1 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md @@ -3,6 +3,7 @@ 例如背景模糊、内容模糊和灰度效果等。 > **说明:** +> > 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 @@ -18,13 +19,13 @@ | -------- | -------- | -------- | -------- | | blur | number | - | 为当前组件添加内容模糊效果,入参为模糊半径,模糊半径越大越模糊,为0时不模糊。 | | backdropBlur | number | - | 为当前组件添加背景模糊效果,入参为模糊半径,模糊半径越大越模糊,为0时不模糊。 | -| shadow | {
radius: number,
color?: Color,
offsetX?: number,
offsetY?: number
} | - | 为当前组件添加阴影效果,入参为模糊半径(必填)、阴影的颜色(可选,默认为灰色)、X轴的偏移量(可选,默认为0),Y轴的偏移量(可选,默认为0),偏移量单位为px。 | +| shadow | {
radius: number,
color?: Color \| string \| [Resource](../../ui/ts-types.md#resource类型),
offsetX?: number,
offsetY?: number
} | - | 为当前组件添加阴影效果,入参为模糊半径(必填)、阴影的颜色(可选,默认为灰色)、X轴的偏移量(可选,默认为0),Y轴的偏移量(可选,默认为0),偏移量单位为px。 | | grayscale | number | 0.0 | 为当前组件添加灰度效果。值定义为灰度转换的比例,入参1.0则完全转为灰度图像,入参则0.0图像无变化,入参在0.0和1.0之间时,效果呈线性变化。(百分比) | | brightness | number | 1.0 | 为当前组件添加高光效果,入参为高光比例,值为1时没有效果,小于1时亮度变暗,0为全黑;大于1时亮度增加,数值越大亮度越大。 | | saturate | number | 1.0 | 为当前组件添加饱和度效果,饱和度为颜色中的含色成分和消色成分(灰)的比例,入参为1时,显示原图像,大于1时含色成分越大,饱和度越大;小于1时消色成分越大,饱和度越小。(百分比) | | contrast | number | 1.0 | 为当前组件添加对比度效果,入参为对比度的值,值为1时,显示原图;大于1时,值越大对比度越高,图像越清晰醒目;小于1时,值越小对比度越低;当对比度为0时,图像变为全灰。(百分比) | | invert | number | 0 | 反转输入的图像。入参为图像反转的比例。值为1时完全反转。值为0则图像无变化。(百分比) | -| colorBlend 8+ | Color | - | 为当前组件添加颜色叠加效果,入参为叠加的颜色。 | +| colorBlend 8+ | Color \| string \| [Resource](../../ui/ts-types.md#resource类型)| | - | 为当前组件添加颜色叠加效果,入参为叠加的颜色。 | | sepia | number | 0 | 将图像转换为深褐色。入参为图像反转的比例。值为1则完全是深褐色的,值为0图像无变化。 (百分比) | | hueRotate | number \| string | '0deg' | 为当前组件添加色相旋转效果,入参为旋转的角度值,0deg时图像无变化。入参没有最大值,超过360deg时相当于又绕一圈,即,370deg和10deg的色相旋转效果相同。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md index 9bda919e8809d0f8ec0fc400daca3814d252d72f..0328140bc146ee0e61fd6226c162fae6cbac7c4a 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md @@ -17,7 +17,7 @@ | 名称 | 参数类型 | 默认值 | 描述 | | ---------------------------- | ---------------------------------------- | ---- | ---------------------------------- | | bindMenu | Array8+
| - | 给组件绑定菜单,点击后弹出菜单。弹出菜单项支持文本和自定义两种功能。 | -| bindContextMenu8+ | content: [CustomBuilder](../../ui/ts-types.md)
responseType: ResponseType | - | 给组件绑定菜单,触发方式为长按或者右键点击,弹出菜单项需要自定义。 | +| bindContextMenu8+ | content: [CustomBuilder](../../ui/ts-types.md),
responseType: ResponseType | - | 给组件绑定菜单,触发方式为长按或者右键点击,弹出菜单项需要自定义。 | - MenuItem diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md index c674cb11ba10f0cee96871bdc533756c662d765b..aa285f3ccb765adc4c27712a8182b1838a6f2d8b 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md @@ -17,7 +17,7 @@ | 名称 | 参数类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| opacity | number | 1 | 元素的不透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 | +| opacity | number \| [Resource](../../ui/ts-types.md#resource类型) | 1 | 元素的不透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-polymorphic-style.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-polymorphic-style.md index 2363e09c47a0faac853927abe2a58bbdf4f3930b..a0ae6d4562cbbe2a6bd508f8315d9ac0fd416338 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-polymorphic-style.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-polymorphic-style.md @@ -23,7 +23,9 @@ | -------- | -------- | -------- | -------- | -------- | | normal | ()=>void | 否 | - | 组件无状态时的样式。 | | pressed | ()=>void | 否 | - | 组件按下状态的样式。 | - | disabled | ()=>void | 否 | - | 组件禁用状态的样式。 | + | disabled | ()=>void | 否 | - | 组件禁用状态的样式。 | + | focused | ()=>void | 否 | - | 组件聚焦状态的样式。 | + | clicked | ()=>void | 否 | - | 组件点击状态的样式。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md index 77436ad352ee1e63bd608c25ad4a13e1a848b593..f0998baca409969c4bdd6706a2c6af86b01af776 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md @@ -33,8 +33,8 @@ | -------- | -------- | -------- | -------- | -------- | | builder | () => any | 是 | - | 提示气泡内容的构造器。 | | placement | Placement | 否 | Placement.Bottom | 气泡组件优先显示的位置,当前位置显示不下时,会自动调整位置。 | - | maskColor | [Color](../../ui/ts-types.md#颜色类型) | 否 | - | 提示气泡遮障层的颜色。 | - | popupColor | [Color](../../ui/ts-types.md#颜色类型) | 否 | - | 提示气泡的颜色。 | + | maskColor | [ResourceColor](../../ui/ts-types.md) | 否 | - | 提示气泡遮障层的颜色。 | + | popupColor | [ResourceColor](../../ui/ts-types.md) | 否 | - | 提示气泡的颜色。 | | enableArrow | boolean | 否 | true | 是否显示箭头。
从API Version 9开始,如果箭头所在方位侧的气泡长度不足以显示下箭头,则会默认不显示箭头。比如:placement设置为Left,但气泡高度小于箭头的宽度(32vp),则实际不会显示箭头。 | | autoCancel | boolean | 否 | true | 页面有操作时,是否自动关闭气泡 | | onStateChange | (isVisible: boolean) => void | 否 | - | 弹窗状态变化事件回调,参数为弹窗当前的显示状态。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md index 4f8390195044e7e3f82476589c978108a948018a..3dfc55ee77613cf4231d0dff984deef68c78c1dd 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md @@ -3,6 +3,7 @@ 用于对组件进行裁剪、遮罩处理。 > **说明:** +> > 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 @@ -31,24 +32,24 @@ struct ClipAndMaskExample { Column({ space: 5 }) { Text('clip').fontSize(9).width('90%').fontColor(0xCCCCCC) // 用一个280px直径的圆对图像进行裁剪 - Image('/comment/bg.jpg') + Image($r('app.media.example')) .clip(new Circle({ width: 80, height: 80 })) .width('500px').height('280px') Row() { - Image('/comment/bg.jpg').width('500px').height('280px') + Image($r('app.media.example')).width('500px').height('280px') } .clip(true) .borderRadius(20) Text('mask').fontSize(9).width('90%').fontColor(0xCCCCCC) // 给图像添加了一个500px*280px的遮罩 - Image('/comment/bg.jpg') + Image($r('app.media.example')) .mask(new Rect({ width: '500px', height: '280px' }).fill(Color.Gray)) .width('500px').height('280px') // 给图像添加了一个280px*280px的圆遮罩 - Image('/comment/bg.jpg') + Image($r('app.media.example')) .mask(new Circle({ width: '280px', height: '280px' }).fill(Color.Gray)) .width('500px').height('281px') } diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md index f78f9b14162965fef2311137216c1bbec7fe3db4..940dcc2f820dd3c9ad35e862dbe1a3004a289bf2 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md @@ -1,6 +1,7 @@ # 文本样式设置 > **说明:** +> > 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 @@ -17,11 +18,11 @@ | 名称 | 参数类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| fontColor | Color | - | 设置文本颜色。 | -| fontSize | Length | - | 设置文本尺寸,Length为number类型时,使用fp单位。 | +| fontColor | [ResourceColor](../../ui/ts-types.md) | - | 设置文本颜色。 | +| fontSize | Length \| [Resource](../../ui/ts-types.md#resource类型) | - | 设置文本尺寸,Length为number类型时,使用fp单位。 | | fontStyle | FontStyle | FontStyle.Normal | 设置文本的字体样式。 | -| fontWeight | number \| FontWeight | FontWeight.FontWeightNormal | 设置文本的字体粗细,number类型取值[100, 900],取值间隔为100,默认为400,取值越大,字体越粗。
提供常用枚举值,参考:FontWeight枚举说明。 | -| fontFamily | string | - | 设置文本的字体列表。使用多个字体,使用','进行分割,优先级按顺序生效。例如:'Arial, sans-serif'。 | +| fontWeight | number \| FontWeight \| string | FontWeight.FontWeightNormal | 设置文本的字体粗细,number类型取值[100, 900],取值间隔为100,默认为400,取值越大,字体越粗。
提供常用枚举值,参考:FontWeight枚举说明。 | +| fontFamily | string \| [Resource](../../ui/ts-types.md#resource类型) | - | 设置文本的字体列表。使用多个字体,使用','进行分割,优先级按顺序生效。例如:'Arial, sans-serif'。 | - FontStyle枚举说明 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-click.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-click.md index ae2bda63aad1304b7cc1211fc3ff723daf3c2616..87355fc2a9340750feb370006bb452d37bf9c9d1 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-click.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-click.md @@ -3,16 +3,9 @@ 点击事件指组件被点击时触发的事件。 > **说明:** +> > 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 -## 支持设备 - -| 手机 | 平板 | 智慧屏 | 智能穿戴 | -| ---- | ---- | ------ | -------- | -| 支持 | 支持 | 不支持 | 不支持 | - - - ## 权限列表 无 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-mouse-key.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-mouse-key.md index e4c803903726c7c261edc32b9abbceea1b0d2630..86299d7b4b1ee353c0b6fce533293a9f3af000b7 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-mouse-key.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-mouse-key.md @@ -1,6 +1,6 @@ # 鼠标事件 -在单个动作触发多个事件时,事件的顺序是固定的,遵循xxx的顺序调用处理程序。 +在单个动作触发多个事件时,事件的顺序是固定的,鼠标事件默认透传。 > **说明:** > 从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 diff --git a/zh-cn/application-dev/reference/native-apis/_drawing.md b/zh-cn/application-dev/reference/native-apis/_drawing.md index 76b6c2c2e5d3cf7de0243980547f62d9bc8a7475..c8a55c1922209caf6049442320650f7335d7d352 100644 --- a/zh-cn/application-dev/reference/native-apis/_drawing.md +++ b/zh-cn/application-dev/reference/native-apis/_drawing.md @@ -43,7 +43,7 @@ Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能 ### Classes - | Classe Name | Description | + | Classes Name | Description | | -------- | -------- | | [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 结构体用于描述位图像素的格式,包括颜色类型和透明度类型 | diff --git a/zh-cn/application-dev/reference/native-apis/drawing__bitmap_8h.md b/zh-cn/application-dev/reference/native-apis/drawing__bitmap_8h.md index e16944b2b8e814b2239ae0fc73a6dd40c9629d07..3b78678ae631f68f037a07a4a194be3cb8bcf8a6 100644 --- a/zh-cn/application-dev/reference/native-apis/drawing__bitmap_8h.md +++ b/zh-cn/application-dev/reference/native-apis/drawing__bitmap_8h.md @@ -21,7 +21,7 @@ ### Classes - | Classe Name | Description | + | Classes Name | Description | | -------- | -------- | | [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 结构体用于描述位图像素的格式,包括颜色类型和透明度类型 | diff --git a/zh-cn/application-dev/security/accesstoken-guidelines.md b/zh-cn/application-dev/security/accesstoken-guidelines.md index 9354ed496a1c07573f7f9000a54fe030c737aa73..f4550869894c3dcaf7f2523ee76066e849ca5658 100644 --- a/zh-cn/application-dev/security/accesstoken-guidelines.md +++ b/zh-cn/application-dev/security/accesstoken-guidelines.md @@ -182,3 +182,10 @@ ``` > **说明:** > 动态授权申请接口的使用详见[API参考](../reference/apis/js-apis-ability-context.md)。 + +## 相关实例 + +针对访问控制,有以下相关实例可供参考: + +- [`AbilityAccessCtrl`:访问权限控制(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/Safety/AbilityAccessCtrl) +- [为应用添加运行时权限(eTS)(API 9)](https://gitee.com/openharmony/codelabs/tree/master/Ability/AccessPermission) \ No newline at end of file diff --git a/zh-cn/application-dev/security/accesstoken-overview.md b/zh-cn/application-dev/security/accesstoken-overview.md index 29283090785f340d671e6b32b0dd2d8f4d6b9389..75c63227541bbe2e75cc28b06eb5fc248d32226d 100644 --- a/zh-cn/application-dev/security/accesstoken-overview.md +++ b/zh-cn/application-dev/security/accesstoken-overview.md @@ -170,7 +170,7 @@ ATM(AccessTokenManager)是OpenHarmony上基于AccessToken构建的统一的 在权限B的ACL使能为TRUE的情况下,此时,开发者可以使用ACL方式来申请权限B。 -ACL方式的工作流程可以参考[ACL方式使用说明](#ACL方式使用说明)。 +ACL方式的工作流程可以参考[ACL方式使用说明](#acl方式使用说明)。 具体某个权限能否通过ACL使能情况可查阅[权限定义列表](permission-list.md)。 ### ACL方式使用说明 diff --git a/zh-cn/application-dev/security/permission-list.md b/zh-cn/application-dev/security/permission-list.md index e235694328a6201dea5afe6bdfb651c71a65921d..e4fcc0ebb44bc8e68896eab2d8ae44409d1dd717 100644 --- a/zh-cn/application-dev/security/permission-list.md +++ b/zh-cn/application-dev/security/permission-list.md @@ -97,7 +97,7 @@ | ohos.permission.EDM_MANAGE_DATETIME | normal | system_grant | FALSE | 允许设备管理员应用设置系统时间。 | | ohos.permission.NFC_TAG | normal | system_grant | FALSE | 允许应用读取Tag卡片。 | | ohos.permission.NFC_CARD_EMULATION | normal | system_grant | FALSE | 允许应用实现卡模拟功能。 | -| ohos.permission.PERMISSION_USED_STATS | system_core | system_grant | TRUE | 允许系统应用访问权限使用记录。 | +| ohos.permission.PERMISSION_USED_STATS | system_basic | system_grant | TRUE | 允许系统应用访问权限使用记录。 | | ohos.permission.NOTIFICATION_AGENT_CONTROLLER | system_core | system_grant | TRUE | 允许应用发送代理通知。 | | ohos.permission.ANSWER_CALL | system_basic | user_grant | TRUE | 允许应用接听来电。 | | ohos.permission.READ_CALENDAR | normal | user_grant | TRUE | 允许应用读取日历信息。 | @@ -128,4 +128,5 @@ | ohos.permission.MANAGE_DISPOSED_APP_STATUS | system_core | system_grant | TRUE | 允许设置和查询应用的处置状态。 | | ohos.permission.ACCESS_IDS | system_core | system_grant | TRUE | 允许应用查询设备的唯一标识符信息。 | | ohos.permission.DUMP | system_core | system_grant | TRUE | 允许导出系统基础信息和SA服务信息。 | -| ohos.permission.DISTRIBUTED_SOFTBUS_CENTER | system_basic | system_grant | FALSE | 允许不同设备之间进行组网处理。 | \ No newline at end of file +| ohos.permission.DISTRIBUTED_SOFTBUS_CENTER | system_basic | system_grant | FALSE | 允许不同设备之间进行组网处理。 | +| ohos.permission.ACCESS_DLP_FILE | system_core | system_grant | TRUE | 允许对DLP文件进行权限配置和管理。 | \ No newline at end of file diff --git a/zh-cn/application-dev/security/userauth-guidelines.md b/zh-cn/application-dev/security/userauth-guidelines.md index d30a71e607a2f8492b134e7ecc843347597ceac8..de8b8987c78ef6e3254b2d26a05113037efba605 100644 --- a/zh-cn/application-dev/security/userauth-guidelines.md +++ b/zh-cn/application-dev/security/userauth-guidelines.md @@ -111,3 +111,9 @@ userIAM_userAuth模块提供了用户认证的相关方法,包括检测认证 console.error("cancel auth fail"); } ``` + +## 相关实例 + +针对用户认证开发,有以下相关实例可供参考: + +- [`UserAuth`:用户认证(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/Safety/UserAuth) diff --git a/zh-cn/application-dev/task-management/background-task-dev-guide.md b/zh-cn/application-dev/task-management/background-task-dev-guide.md index 8652b3012d203b154ea0a669eadaf2a731d24655..12253f396d09c568d17ed8ce6f2ddd7a924c0bd3 100644 --- a/zh-cn/application-dev/task-management/background-task-dev-guide.md +++ b/zh-cn/application-dev/task-management/background-task-dev-guide.md @@ -116,6 +116,8 @@ ohos.permission.KEEP_BACKGROUND_RUNNING ### 开发步骤 +基于FA模型: + 1. 新建Api Version 8的工程后,在工程目录中右键选择“new” -> “Ability” -> “Service Ability” 快速创建Service Ability组件。并在config.json文件中配置长时任务权限、后台模式类型,其中Ability类型为“service”。 ``` @@ -138,7 +140,7 @@ ohos.permission.KEEP_BACKGROUND_RUNNING } ``` -2. 申请长时任务 +2. 申请长时任务。 ```js import backgroundTaskManager from '@ohos.backgroundTaskManager'; @@ -168,7 +170,7 @@ ohos.permission.KEEP_BACKGROUND_RUNNING }); ``` -3. 停止长时任务 +3. 停止长时任务。 ```js import backgroundTaskManager from '@ohos.backgroundTaskManager'; @@ -182,7 +184,75 @@ ohos.permission.KEEP_BACKGROUND_RUNNING ``` +基于Stage模型: + +1. 新建Api Version 9的工程后,在工程目录中右键选择“New” -> “Ability” 快速创建Ability组件。并在module.json5文件中配置长时任务权限、后台模式类型。 + + ``` + "module": { + "abilities": [ + { + "backgroundModes": [ + "dataTransfer", + "location" + ], // 后台模式类型 + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" // 长时任务权限 + } + ] + } + ``` + +2. 申请长时任务。 + + ```ts + import backgroundTaskManager from '@ohos.backgroundTaskManager'; + import wantAgent from '@ohos.wantAgent'; + + let wantAgentInfo = { + wants: [ + { + bundleName: "com.example.myapplication", + abilityName: "com.example.myapplication.MainAbility" + } + ], + operationType: wantAgent.OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + + // 通过wantAgent模块的getWantAgent方法获取WantAgent对象 + wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { + backgroundTaskManager.startBackgroundRunning(this.context, + backgroundTaskManager.BackgroundMode.DATA_TRANSFER, wantAgentObj).then(() => { + console.info("Operation startBackgroundRunning succeeded"); + }).catch((err) => { + console.error("Operation startBackgroundRunning failed Cause: " + err); + }); + }); + ``` + +3. 停止长时任务。 + + ```ts + import backgroundTaskManager from '@ohos.backgroundTaskManager'; + + backgroundTaskManager.stopBackgroundRunning(this.context).then(() => { + console.info("Operation stopBackgroundRunning succeeded"); + }).catch((err) => { + console.error("Operation stopBackgroundRunning failed Cause: " + err); + }); + + ``` + + ### 开发实例 + +基于FA模型: + 基于FA的Service Ability使用,参考[ServiceAbility开发指导](../ability/fa-serviceability.md)。 当不需要与后台执行的长时任务交互时,可以采用startAbility()方法启动Service Ability。并在Service Ability的onStart回调方法中,调用长时任务的申请接口,声明此服务需要在后台长时运行。当任务执行完,再调用长时任务取消接口,及时释放资源。 @@ -285,6 +355,130 @@ export default { }; ``` +基于Stage模型: + +Stage模型的相关信息参考[Stage模型综述](../ability/stage-brief.md)。 +当应用需要在后台执行长时任务时,可以通过Call的方式在后台创建并运行Ability。使用方式参考[Call调用开发指导](../ability/stage-call.md)。 + +```ts +import Ability from '@ohos.application.Ability' +import backgroundTaskManager from '@ohos.backgroundTaskManager'; +import wantAgent from '@ohos.wantAgent'; + +let mContext = null; + +function startContinuousTask() { + let wantAgentInfo = { + // 点击通知后,将要执行的动作列表 + wants: [ + { + bundleName: "com.example.myapplication", + abilityName: "com.example.myapplication.MainAbility" + } + ], + // 点击通知后,动作类型 + operationType: wantAgent.OperationType.START_ABILITY, + // 使用者自定义的一个私有值 + requestCode: 0, + // 点击通知后,动作执行属性 + wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + + // 通过wantAgent模块的getWantAgent方法获取WantAgent对象 + wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { + backgroundTaskManager.startBackgroundRunning(mContext, + backgroundTaskManager.BackgroundMode.DATA_TRANSFER, wantAgentObj).then(() => { + console.info("Operation startBackgroundRunning succeeded"); + }).catch((err) => { + console.error("Operation startBackgroundRunning failed Cause: " + err); + }); + }); +} + +function stopContinuousTask() { + backgroundTaskManager.stopBackgroundRunning(mContext).then(() => { + console.info("Operation stopBackgroundRunning succeeded"); + }).catch((err) => { + console.error("Operation stopBackgroundRunning failed Cause: " + err); + }); +} + +class MySequenceable { + num: number = 0; + str: String = ""; + + constructor(num, string) { + this.num = num; + this.str = string; + } + + marshalling(messageParcel) { + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + return true; + } + + unmarshalling(messageParcel) { + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + return true; + } +} + +function sendMsgCallback(data) { + console.info('BgTaskAbility funcCallBack is called ' + data) + let receivedData = new Mysequenceable(0, "") + data.readSequenceable(receivedData) + console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`) + if (receivedData.str === 'start_bgtask') { + startContinuousTask() + } else if (receivedData.str === 'stop_bgtask') { + stopContinuousTask(); + } + return new Mysequenceable(10, "Callee test"); +} + +export default class BgTaskAbility extends Ability { + onCreate(want, launchParam) { + console.info("[Demo] BgTaskAbility onCreate") + this.callee.on("test", sendMsgCallback); + + try { + this.callee.on(MSG_SEND_METHOD, sendMsgCallback) + } catch (error) { + console.error(`${MSG_SEND_METHOD} register failed with error ${JSON.stringify(error)}`) + } + mContext = this.context; + } + + onDestroy() { + console.info("[Demo] BgTaskAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + console.info("[Demo] BgTaskAbility onWindowStageCreate") + + windowStage.loadContent("pages/second").then((data)=> { + console.info(`load content succeed with data ${JSON.stringify(data)}`) + }).catch((error)=>{ + console.error(`load content failed with error ${JSON.stringify(error)}`) + }) + } + + onWindowStageDestroy() { + console.info("[Demo] BgTaskAbility onWindowStageDestroy") + } + + onForeground() { + console.info("[Demo] BgTaskAbility onForeground") + } + + onBackground() { + console.info("[Demo] BgTaskAbility onBackground") + } +}; +``` + ## 相关实例 基于后台任务管理,有以下相关实例可供参考: diff --git a/zh-cn/application-dev/telephony/cellular-network-signal-info.md b/zh-cn/application-dev/telephony/cellular-network-signal-info.md index 34a244080874d04ad63b638485a2bd6addfc1222..90d9087aae3b0995ccb86a35149449217f2a7854 100644 --- a/zh-cn/application-dev/telephony/cellular-network-signal-info.md +++ b/zh-cn/application-dev/telephony/cellular-network-signal-info.md @@ -49,3 +49,8 @@ radio模块提供了获取当前网络信号信息的方法。observer模块为 console.log("signal info change, data is:" + JSON.stringify(data)); }); ``` + +## 相关实例 + +针对蜂窝网络数据开发,有以下相关实例可供参考: +- [`MobileNetwork`:蜂窝数据(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/Telephony/MobileNetwork) \ No newline at end of file diff --git a/zh-cn/application-dev/ui/Readme-CN.md b/zh-cn/application-dev/ui/Readme-CN.md index c7a2b79e0bccc29a38a355b4d4113e74882dbfbc..5bba79a97977e50b6e6eb8c2a827a664bd426eae 100755 --- a/zh-cn/application-dev/ui/Readme-CN.md +++ b/zh-cn/application-dev/ui/Readme-CN.md @@ -80,10 +80,9 @@ - [目录结构](ts-framework-directory.md) - [应用代码文件访问规则](ts-framework-file-access-rules.md) - [js标签配置](ts-framework-js-tag.md) - - 资源访问 - - [访问应用资源](ts-application-resource-access.md) - - [访问系统资源](ts-system-resource-access.md) - - [媒体资源类型说明](ts-media-resource-type.md) + - 资源管理 + - [资源文件的分类](ui-ts-basic-resource-file-categories.md) + - [资源访问](ts-resource-access.md) - [像素单位](ts-pixel-units.md) - [类型定义](ts-types.md) - 声明式语法 diff --git a/zh-cn/application-dev/ui/figures/create-resource-file-1.png b/zh-cn/application-dev/ui/figures/create-resource-file-1.png new file mode 100644 index 0000000000000000000000000000000000000000..a6d82caac558cd58b78aba3014b6ac60148f6bc8 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/create-resource-file-1.png differ diff --git a/zh-cn/application-dev/ui/figures/create-resource-file-2.png b/zh-cn/application-dev/ui/figures/create-resource-file-2.png new file mode 100644 index 0000000000000000000000000000000000000000..b4d23e8dc15bafbb08ca691575ce2ea9fe989e91 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/create-resource-file-2.png differ diff --git a/zh-cn/application-dev/ui/figures/create-resource-file-3.png b/zh-cn/application-dev/ui/figures/create-resource-file-3.png new file mode 100644 index 0000000000000000000000000000000000000000..566653c5e49753e1f04d0d6b5b5c3e931f4354b5 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/create-resource-file-3.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642001.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642001.gif new file mode 100644 index 0000000000000000000000000000000000000000..03a0350651c4e4e1fa70593befa45455b662acd1 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642001.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642002.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642002.gif new file mode 100644 index 0000000000000000000000000000000000000000..f07cd18d127944605658f4424ad3b41a39b553c3 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642002.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642003.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642003.png new file mode 100644 index 0000000000000000000000000000000000000000..2c514af73d06209da17532eb6e3c9657f7a97060 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642003.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642004.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642004.gif new file mode 100644 index 0000000000000000000000000000000000000000..eaee7ddb8a27352887aa17b30e906408bd236e9e Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642004.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642005.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642005.gif new file mode 100644 index 0000000000000000000000000000000000000000..7d12fd80ac4f5ceec08b463b24eb48935227f621 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642005.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642006.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642006.png new file mode 100644 index 0000000000000000000000000000000000000000..90a3e2af63bcc5c18114bfd8d112ca58f2c69e1b Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642006.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642007.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642007.gif new file mode 100644 index 0000000000000000000000000000000000000000..9325cd75369ef2a2b1d7784ce5aeef97ae1ec71c Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642007.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642008.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642008.png new file mode 100644 index 0000000000000000000000000000000000000000..4e3f22225a2e1a04c19b9c2d948d8b8351c73056 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642008.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642009.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642009.gif new file mode 100644 index 0000000000000000000000000000000000000000..057e146194b5e63ebeb5b07b0556e3495a4ce2ca Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001118642009.gif differ diff --git a/zh-cn/application-dev/ui/js-framework-syntax-css.md b/zh-cn/application-dev/ui/js-framework-syntax-css.md index a9937650333f75338257615a82d5c6cb840b8b47..73d8b70981cf92b74fde766fa071cfdad635cafb 100644 --- a/zh-cn/application-dev/ui/js-framework-syntax-css.md +++ b/zh-cn/application-dev/ui/js-framework-syntax-css.md @@ -1,6 +1,6 @@ # CSS语法参考 -CSS是描述HML页面结构的样式语言。所有组件均存在系统默认样式,也可在页面CSS样式文件中对组件、页面自定义不同的样式。 +CSS是描述HML页面结构的样式语言。所有组件均存在系统默认样式,也可在页面CSS样式文件中对组件、页面自定义不同的样式。请参考[通用样式](../reference/arkui-js/js-components-common-styles.md)了解基于JS扩展的类Web开发范式支持的组件样式。 ## 尺寸单位 diff --git a/zh-cn/application-dev/ui/js-framework-syntax-hml.md b/zh-cn/application-dev/ui/js-framework-syntax-hml.md index 2684911c682c245a0c43b739904dd91bf28f1876..1d79a5fb5bcf0464fe1b8d4f9df107cf943f89d6 100644 --- a/zh-cn/application-dev/ui/js-framework-syntax-hml.md +++ b/zh-cn/application-dev/ui/js-framework-syntax-hml.md @@ -24,7 +24,12 @@ HML(OpenHarmony Markup Language)是一套类HTML的标记语言,通过组 {{content[1]}} ``` - +``` +/*xxx.css*/ +.container{ + margin: 200px; +} +``` ``` // xxx.js export default { @@ -42,6 +47,7 @@ export default { > > - hml文件中的js表达式不支持ES6语法。 +![zh-cn_image_0000001118642003](figures/zh-cn_image_0000001118642003.png) ## 普通事件绑定 @@ -120,6 +126,7 @@ export default { } ``` +![zh-cn_image_0000001118642002](figures/zh-cn_image_0000001118642002.gif) ## 冒泡事件绑定5+ @@ -200,7 +207,7 @@ Touch触摸类事件支持捕获,捕获阶段位于冒泡阶段之前,捕获 ``` -
+
@@ -252,6 +259,7 @@ tid属性主要用来加速for循环的重渲染,旨在列表中的数据有 > > - tid不支持表达式。 +![zh-cn_image_0000001118642001](figures/zh-cn_image_0000001118642001.gif) ## 条件渲染 @@ -297,6 +305,8 @@ export default { } ``` +![zh-cn_image_0000001118642004](figures/zh-cn_image_0000001118642004.gif) + 优化渲染优化:show方法。当show为true时,节点正常渲染;当为false时,仅仅设置display样式为none。 ``` @@ -335,6 +345,8 @@ export default { > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 禁止在同一个元素上同时设置for和if属性。 +![zh-cn_image_0000001118642005](figures/zh-cn_image_0000001118642005.gif) + ## 逻辑控制块 <block>控制块使得循环渲染和条件渲染变得更加灵活;block在构建时不会被当作真实的节点编译。注意block标签只支持for和if属性。 @@ -367,6 +379,8 @@ export default { } ``` +![zh-cn_image_0000001118642006](figures/zh-cn_image_0000001118642006.png) + ## 模板引用 HML可以通过element引用模板文件,详细介绍可参考[自定义组件](../reference/arkui-js/js-components-custom-basic-usage.md)章节。 diff --git a/zh-cn/application-dev/ui/js-framework-syntax-js.md b/zh-cn/application-dev/ui/js-framework-syntax-js.md index ed3b8c30913e680cb7898fb360c76c9a516dfaab..9aac5acd159d34fd1fa19ca2370155b71da2b8f5 100644 --- a/zh-cn/application-dev/ui/js-framework-syntax-js.md +++ b/zh-cn/application-dev/ui/js-framework-syntax-js.md @@ -184,7 +184,7 @@ JS文件用来定义HML页面的业务逻辑,支持ECMA规范的JavaScript语 2. 通过$element获取DOM元素 ``` -
+
``` @@ -213,6 +213,8 @@ JS文件用来定义HML页面的业务逻辑,支持ECMA规范的JavaScript语 }; ``` +![zh-cn_image_0000001118642007](figures/zh-cn_image_0000001118642007.gif) + ## 获取ViewModel 根节点所在页面: @@ -237,6 +239,8 @@ export default { } ``` +![zh-cn_image_0000001118642008](figures/zh-cn_image_0000001118642008.png) + 自定义parent组件: ``` @@ -272,7 +276,7 @@ export default {
child component clicked - hello child component + hello child component
``` @@ -280,11 +284,11 @@ export default { // child.js export default { data: { - show: false, + isShow: false, text: 'I am child component!', }, childClicked () { - this.show = !this.show; + this.isShow = !this.isShow; console.info('child component get parent text'); console.info('${this.$parent().text}'); console.info('child component get root text'); @@ -292,3 +296,5 @@ export default { }, } ``` + +![zh-cn_image_0000001118642009](figures/zh-cn_image_0000001118642009.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/ui/ts-application-states-appstorage.md b/zh-cn/application-dev/ui/ts-application-states-appstorage.md index 7feb3076d39e3e2d5e96fe566371a468cb10b48c..4a2c477f8f873575be97ca9b913ab675c0adf414 100644 --- a/zh-cn/application-dev/ui/ts-application-states-appstorage.md +++ b/zh-cn/application-dev/ui/ts-application-states-appstorage.md @@ -60,7 +60,7 @@ struct ComponentA { @StorageProp('languageCode') lang: string = 'en' private label: string = 'count' - private aboutToAppear() { + aboutToAppear() { this.label = (this.lang === 'zh') ? '数' : 'Count' } diff --git a/zh-cn/application-dev/ui/ts-component-based-component.md b/zh-cn/application-dev/ui/ts-component-based-component.md index aaaeeb40622b2918e9af9da73c7106c0fe317bcc..fcf5a833d2b567ecc4d2d423d784a31b878f269d 100644 --- a/zh-cn/application-dev/ui/ts-component-based-component.md +++ b/zh-cn/application-dev/ui/ts-component-based-component.md @@ -12,10 +12,11 @@ - 数据驱动更新:由状态变量的数据驱动,实现UI自动更新。 -对组件化的深入描述,请参考深入理解组件化。 +对组件化的深入描述,请参考[深入理解组件化](ts-custom-component-initialization.md)。 -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** +> > - 自定义组件必须定义build方法。 > > - 自定义组件禁止自定义构造函数。 @@ -78,11 +79,11 @@ struct ParentComponent { } } - private aboutToAppear() { + aboutToAppear() { console.log('ParentComponent: Just created, about to become rendered first time.') } - private aboutToDisappear() { + aboutToDisappear() { console.log('ParentComponent: About to be removed from the UI.') } } diff --git a/zh-cn/application-dev/ui/ts-component-based-styles.md b/zh-cn/application-dev/ui/ts-component-based-styles.md index c655aaa5e925637bfc945f992e7fa1867d200c3a..03a0ab8c6b61890e9456cd5123b130d156046723 100644 --- a/zh-cn/application-dev/ui/ts-component-based-styles.md +++ b/zh-cn/application-dev/ui/ts-component-based-styles.md @@ -4,7 +4,7 @@ @Styles装饰器将新的属性函数添加到基本组件上,如Text、Column、Button等。当前@Styles仅支持通用属性。通过@Styles装饰器可以快速定义并复用组件的自定义样式。 -@Styles可以定义在组件内或组件外,在组件外定义时需带上function关键字,组件内定义时不需要。 +@Styles可以定义在组件内或组件外,在组件外定义时需在方法前添加function关键字,组件内定义时不需要添加function关键字。 ``` diff --git a/zh-cn/application-dev/ui/ts-custom-component-initialization.md b/zh-cn/application-dev/ui/ts-custom-component-initialization.md index 0e407eb84db9a6b15f82a9bd24214b2c35b4b9c5..965671a1e26d392e4083b1e17b30afce9a0ef02e 100644 --- a/zh-cn/application-dev/ui/ts-custom-component-initialization.md +++ b/zh-cn/application-dev/ui/ts-custom-component-initialization.md @@ -10,7 +10,7 @@ - 在构造组件时通过构造参数初始化,例如: ``` - MyComponent(counter: $myCounter) + MyComponent({counter: $myCounter}) ``` @@ -70,42 +70,55 @@ ## 示例 ``` +class ClassA { + public a:number + constructor(a: number) { + this.a = a + } +} @Entry @Component struct Parent { - @State parentState: ClassA = new ClassA() - build() { - Row() { - CompA({aState: new ClassA, aLink: $parentState}) // valid - CompA({aLink: $parentState}) // valid - CompA() // invalid, @Link aLink remains uninitialized - CompA({aLink: new ClassA}) // invalid, @Link aLink must be a reference ($) to either @State or @Link variable - } + @State parentState: ClassA = new ClassA(1) + + build() { + Column() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + CompA({ astate: new ClassA(2), aLink: $parentState }) + } + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + CompA({ aLink: $parentState }) + } + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + CompA({ astate: new ClassA(3), aLink: $parentState }) + } } + } } @Component struct CompA { - @State aState: boolean = false // must initialize locally - @Link aLink: ClassA // must not initialize locally - - build() { - Row() { - CompB({bLink: $aLink, // valid init a @Link with reference of another @Link, - bProp: this.aState}) // valid init a @Prop with value of a @State - CompB({aLink: $aState, // invalid: type mismatch expected ref to ClassA, provided reference to boolean - bProp: false}) // valid init a @Prop by constants value - } + @State aState: any = false + @Link aLink: ClassA + + build() { + Column() { + CompB({ bLink: $aLink, bProp: this.aState }) + CompB({ bLink: $aState, bProp: false }) } + } } @Component struct CompB { - @Link bLink: ClassA = new ClassA() // invalid, must not initialize locally - @Prop bProp: boolean = false // invalid must not initialize locally - - build() { - ... - } + @Link bLink: ClassA + @Prop bProp: bpplean + + build() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Text(JSON.stringify(this.bLink.a)).fontSize(30) + Text(JSON.stringify(this.bProp)).fontSize(30).fontColor(Color.Red) + }.margin(10) + } } ``` diff --git a/zh-cn/application-dev/ui/ts-media-resource-type.md b/zh-cn/application-dev/ui/ts-media-resource-type.md deleted file mode 100644 index 10be60e4aff925fe9be48b23f3d02a613052fa2b..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ts-media-resource-type.md +++ /dev/null @@ -1,23 +0,0 @@ -# 媒体资源类型说明 - - - -- 图片资源类型说明 - | 格式 | 文件后缀名 | - | -------- | -------- | - | JPEG | .jpg | - | PNG | .png | - | GIF | .gif | - | SVG | .svg | - | WEBP | .webp | - | BMP | .bmp | - -- 音视频资源类型说明 - | 格式 | 支持的文件类型 | - | -------- | -------- | - | H.263 | .3gp
.mp4 | - | H.264 AVC
Baseline Profile (BP) | .3gp
.mp4 | - | MPEG-4 SP | .3gp | - | VP8 | .webm
.mkv | - - diff --git a/zh-cn/application-dev/ui/ts-pixel-units.md b/zh-cn/application-dev/ui/ts-pixel-units.md index 0265bac90e606c4154c19cb85375e0c062ed009e..928baecba03f8f12aefae155be0df96604ebd893 100644 --- a/zh-cn/application-dev/ui/ts-pixel-units.md +++ b/zh-cn/application-dev/ui/ts-pixel-units.md @@ -71,3 +71,10 @@ struct Example { ``` ![zh-cn_image_0000001169582302](figures/zh-cn_image_0000001169582302.gif) + + +## 相关实例 + +基于像素转换,有以下相关实例可供参考: + +- [像素转换(eTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/PixelUnitsDemo) diff --git a/zh-cn/application-dev/ui/ts-resource-access.md b/zh-cn/application-dev/ui/ts-resource-access.md new file mode 100644 index 0000000000000000000000000000000000000000..b71591bbdca383c1302b4e10bb3f216e7abe1851 --- /dev/null +++ b/zh-cn/application-dev/ui/ts-resource-access.md @@ -0,0 +1,151 @@ +# 资源访问 + + +## 访问应用资源 + +在工程中,通过```"$r('app.type.name')"```的形式引用应用资源。app代表是应用内resources目录中定义的资源;type代表资源类型(或资源的存放位置),可以取“color”、“float”、“string”、“plural”、“media”,name代表资源命名,由开发者定义资源时确定。 + +引用rawfile下资源时使用```"$rawfile('filename')"```的形式,当前$rawfile仅支持Image控件引用图片资源,filename需要表示为rawfile目录下的文件相对路径,文件名需要包含后缀,路径开头不可以以"/"开头。 + +> **说明:** +> 资源描述符不能拼接使用,仅支持普通字符串如`'app.type.name'`。 + +在xxx.ets文件中,可以使用在resources目录中定义的资源。 + +```ts +Text($r('app.string.string_hello')) + .fontColor($r('app.color.color_hello')) + .fontSize($r('app.float.font_hello')) +} + +Text($r('app.string.string_world')) + .fontColor($r('app.color.color_world')) + .fontSize($r('app.float.font_world')) +} + +Text($r('app.string.message_arrive', "five of the clock")) // 引用string资源,$r的第二个参数用于替换%s + .fontColor($r('app.color.color_hello')) + .fontSize($r('app.float.font_hello')) +} + +Text($r('app.plural.eat_apple', 5, 5)) // plural$r引用,第一个指定plural资源,第二个参数指定单复数的数量,此处第三个数字为对%d的替换 + .fontColor($r('app.color.color_world')) + .fontSize($r('app.float.font_world')) +} + +Image($r('app.media.my_background_image')) // media资源的$r引用 + +Image($rawfile('test.png')) // rawfile$r引用rawfile目录下图片 + +Image($rawfile('newDir/newTest.png')) // rawfile$r引用rawfile目录下图片 +``` +## 访问系统资源 + +系统资源包含色彩、圆角、字体、间距、字符串及图片等。通过使用系统资源,不同的开发者可以开发出具有相同视觉风格的应用。 + + +开发者可以通过```“$r('sys.type.resource_id')”```的形式引用系统资源。sys代表是系统资源;type代表资源类型,可以取“color”、“float”、“string”、“media”;resource_id代表资源id。 + +```ts +Text('Hello') + .fontColor($r('sys.color.ohos_id_color_emphasize')) + .fontSize($r('sys.float.ohos_id_text_size_headline1')) + .fontFamily($r('sys.string.ohos_id_text_font_family_medium')) + .backgroundColor($r('sys.color.ohos_id_color_palette_aux1')) +Image($r('sys.media.ohos_app_icon')) + .border({color: $r('sys.color.ohos_id_color_palette_aux1'), radius: $r('sys.float.ohos_id_corner_radius_button'), width: 2}) + .margin({top: $r('sys.float.ohos_id_elements_margin_horizontal_m'), bottom: $r('sys.float.ohos_id_elements_margin_horizontal_l')}) + .height(200) + .width(300) +``` +## 资源文件示例 + +color.json文件的内容如下: + + +``` +{ + "color": [ + { + "name": "color_hello", + "value": "#ffff0000" + }, + { + "name": "color_world", + "value": "#ff0000ff" + } + ] +} +``` + +float.json文件的内容如下: + + +``` +{ + "float":[ + { + "name":"font_hello", + "value":"28.0fp" + }, + { + "name":"font_world", + "value":"20.0fp" + } + ] +} +``` + +string.json文件的内容如下: + + +``` +{ + "string":[ + { + "name":"string_hello", + "value":"Hello" + }, + { + "name":"string_world", + "value":"World" + }, + { + "name":"message_arrive", + "value":"We will arrive at %s." + } + ] +} +``` + +plural.json文件的内容如下: + + +``` +{ + "plural":[ + { + "name":"eat_apple", + "value":[ + { + "quantity":"one", + "value":"%d apple" + }, + { + "quantity":"other", + "value":"%d apples" + } + ] + } + ] +} +``` + + + + +## 相关实例 + +针对访问应用资源,有以下相关实例可供参考: + +- [`ResourceManager`:资源管理器(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/common/ResourceManager) diff --git a/zh-cn/application-dev/ui/ts-syntactic-sugar.md b/zh-cn/application-dev/ui/ts-syntactic-sugar.md index bc36b2e26aea9dcc3fd45850a628a80d81940535..92b9df0a8905896b5433cad07d7b2ffa220103b3 100644 --- a/zh-cn/application-dev/ui/ts-syntactic-sugar.md +++ b/zh-cn/application-dev/ui/ts-syntactic-sugar.md @@ -44,7 +44,7 @@ struct MyComponent { | @Component | struct | 结构体在装饰后具有基于组件的能力,需要实现build方法来更新UI。 | | @Entry | struct | 组件被装饰后作为页面的入口,页面加载时将被渲染显示。 | | @Preview | struct | 用@Preview装饰的自定义组件可以在DevEco Studio的预览器上进行预览,加载页面时,将创建并呈现@Preview装饰的自定义组件。 | -| @Builder | 方法 | 在@Builder装饰的方法用通过声明式UI描述,可以在一个自定义组件内快速生成多个布局内容。 | +| @Builder | 方法 | 在@Builder装饰的方法里,通过声明式UI描述,可以在一个自定义组件内快速生成多个布局内容。 | | @Extend | 方法 | @Extend装饰器将新的属性函数添加到内置组件上,通过@Extend装饰器可以快速定义并复用组件的自定义样式。 | | @CustomDialog | struct | @CustomDialog装饰器用于装饰自定义弹窗。 | | @State | 基本数据类型,类,数组 | 修饰的状态数据被修改时会触发组件的build方法进行UI界面更新。 | diff --git a/zh-cn/application-dev/ui/ts-system-resource-access.md b/zh-cn/application-dev/ui/ts-system-resource-access.md deleted file mode 100644 index ac9a956742e2238a338653c0360078a4c0161c66..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ts-system-resource-access.md +++ /dev/null @@ -1,20 +0,0 @@ -# 访问系统资源 - - -系统资源包含色彩、圆角、字体、间距、字符串及图片等。通过使用系统资源,不同的开发者可以开发出具有相同视觉风格的应用。 - - -开发者可以通过```“$r('sys.type.resource_id')”```的形式引用系统资源。sys代表是系统资源;type代表资源类型,可以取“color”、“float”、“string”、“media”;resource_id代表资源id。 - -``` -Text('Hello') - .fontColor($r('sys.color.ohos_id_color_emphasize')) - .fontSize($r('sys.float.ohos_id_text_size_headline1')) - .fontFamily($r('sys.string.ohos_id_text_font_family_medium')) - .backgroundColor($r('sys.color.ohos_id_color_palette_aux1')) -Image($r('sys.media.ohos_app_icon')) - .border({color: $r('sys.color.ohos_id_color_palette_aux1'), radius: $r('sys.float.ohos_id_corner_radius_button'), width: 2}) - .margin({top: $r('sys.float.ohos_id_elements_margin_horizontal_m'), bottom: $r('sys.float.ohos_id_elements_margin_horizontal_l')}) - .height(200) - .width(300) -``` diff --git a/zh-cn/application-dev/ui/ui-js-animate-transform.md b/zh-cn/application-dev/ui/ui-js-animate-transform.md index 4a0dfed33828eefabc90d42c648b875b4122ae0e..e0f2992b2f2a82242cba6b1a96b44036fdeaedb1 100644 --- a/zh-cn/application-dev/ui/ui-js-animate-transform.md +++ b/zh-cn/application-dev/ui/ui-js-animate-transform.md @@ -586,6 +586,8 @@ transform可以设置多个值并且多个值可同时设置,下面案例中 - [`Clock`:时钟(JS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/common/Clock) -- [动画样式(JS)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/AnimationDemo) +- [`JsAnimator`:动画(JS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/UI/JsAnimation) -- [图片常见操作](https://gitee.com/openharmony/codelabs/tree/master/Media/ImageJsDemo) +- [动画样式(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/AnimationDemo) + +- [图片常见操作(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/Media/ImageJsDemo) diff --git a/zh-cn/application-dev/ui/ui-js-building-ui-component.md b/zh-cn/application-dev/ui/ui-js-building-ui-component.md index d57c8c901cca78e1cf07c9b13a11ebff581081d7..e190e0b5bed9f96258d5dfedc969f3c0abfb4732 100755 --- a/zh-cn/application-dev/ui/ui-js-building-ui-component.md +++ b/zh-cn/application-dev/ui/ui-js-building-ui-component.md @@ -41,6 +41,6 @@ - [`JsVideo`:视频播放(JS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/media/JsVideo) -- [rating(JS)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/RatingApplication) +- [rating(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/RatingApplication) -- [简易视频播放器](https://gitee.com/openharmony/codelabs/tree/master/Media/VideoOpenHarmony) +- [简易视频播放器(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/Media/VideoOpenHarmony) diff --git a/zh-cn/application-dev/ui/ui-js-components-chart.md b/zh-cn/application-dev/ui/ui-js-components-chart.md index 7c4d1ee6d9907c5c2c12de9f638d42af1d20a254..586d58b96c6769be8337e78e4c85ab686b5a412b 100644 --- a/zh-cn/application-dev/ui/ui-js-components-chart.md +++ b/zh-cn/application-dev/ui/ui-js-components-chart.md @@ -621,4 +621,4 @@ export default { - [`Chart`:图表组件(JS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/UI/chart) -- [chart(JS)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/SwitchApplication) +- [chart(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/SwitchApplication) diff --git a/zh-cn/application-dev/ui/ui-js-components-dialog.md b/zh-cn/application-dev/ui/ui-js-components-dialog.md index 00e1f1c7cd5504c46acb79e9200024bd240cfe07..943f92da4d9c171b5ae01783ceb7f326f69db9b5 100644 --- a/zh-cn/application-dev/ui/ui-js-components-dialog.md +++ b/zh-cn/application-dev/ui/ui-js-components-dialog.md @@ -327,4 +327,4 @@ export default { - [`JsDialog`:页面弹窗(JS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/UI/JsDialog) -- [dialog(JS)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/DialogDemo) +- [dialog(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/DialogDemo) diff --git a/zh-cn/application-dev/ui/ui-js-components-image-animator.md b/zh-cn/application-dev/ui/ui-js-components-image-animator.md index e9fe87f31f9e5127eee4aea5eca80222b31e06f9..2a8d6eef1124cc93a2e535e7542d7f49d7561a0e 100644 --- a/zh-cn/application-dev/ui/ui-js-components-image-animator.md +++ b/zh-cn/application-dev/ui/ui-js-components-image-animator.md @@ -339,4 +339,4 @@ export default { 针对Image-animator开发,有以下相关实例可供参考: -- [image、image-animator(JS)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/ClickableJsDemo) +- [image、image-animator(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/ClickableJsDemo) diff --git a/zh-cn/application-dev/ui/ui-js-components-images.md b/zh-cn/application-dev/ui/ui-js-components-images.md index b7f9d9fb580e6998ef43c5232d6a2fb1669e9c3d..4eb69617fc893e28f22e5359a8cbb800c0a88836 100644 --- a/zh-cn/application-dev/ui/ui-js-components-images.md +++ b/zh-cn/application-dev/ui/ui-js-components-images.md @@ -208,6 +208,6 @@ export default { 针对Image开发,有以下相关实例可供参考: -- [image、image-animator(JS)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/ClickableJsDemo) +- [image、image-animator(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/ClickableJsDemo) -- [图片编辑模板](https://gitee.com/openharmony/codelabs/tree/master/Media/ImageEditorTemplate) \ No newline at end of file +- [图片编辑模板(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/Media/ImageEditorTemplate) \ No newline at end of file diff --git a/zh-cn/application-dev/ui/ui-js-components-input.md b/zh-cn/application-dev/ui/ui-js-components-input.md index a94be316352c467acc2c81c25e56cc7b05f01681..b1b55f49c1768b875ff41fc5f6ac6a7f8a180fbd 100644 --- a/zh-cn/application-dev/ui/ui-js-components-input.md +++ b/zh-cn/application-dev/ui/ui-js-components-input.md @@ -318,4 +318,4 @@ export default { 针对Input开发,有以下相关实例可供参考: -- [input、label(JS)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/InputApplication) +- [input、label(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/InputApplication) diff --git a/zh-cn/application-dev/ui/ui-js-components-slider.md b/zh-cn/application-dev/ui/ui-js-components-slider.md index 99bd1e3fda6630b6d02157cde16fe74e4f30aefe..24c1bf161971a3cb35c07a40d4263c13d2993773 100644 --- a/zh-cn/application-dev/ui/ui-js-components-slider.md +++ b/zh-cn/application-dev/ui/ui-js-components-slider.md @@ -219,4 +219,4 @@ export default{ - [`Slider`:滑动条(JS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/UI/Slider) -- [slider(JS)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/SliderApplication) \ No newline at end of file +- [slider(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/SliderApplication) \ No newline at end of file diff --git a/zh-cn/application-dev/ui/ui-js-custom-components.md b/zh-cn/application-dev/ui/ui-js-custom-components.md index 3537724b05e0b34b3bdc789bc891dedfc85fb376..829dff91ed9646fd49061091fc7b790cc9aeff58 100755 --- a/zh-cn/application-dev/ui/ui-js-custom-components.md +++ b/zh-cn/application-dev/ui/ui-js-custom-components.md @@ -105,4 +105,4 @@ - [`JSUICustomComponent`:自定义组件(JS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/UI/JSUICustomComponent) -- [自定义组件(JS)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/JSCanvasComponet) +- [自定义组件(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/JSCanvasComponet) diff --git a/zh-cn/application-dev/ui/ui-js-overview.md b/zh-cn/application-dev/ui/ui-js-overview.md index c94a28c66b7c6f45c80a8ed2b30a422de5f0450a..178416ba17362d3246441578cab30fc0bfaa8b4e 100755 --- a/zh-cn/application-dev/ui/ui-js-overview.md +++ b/zh-cn/application-dev/ui/ui-js-overview.md @@ -52,4 +52,4 @@ - [`Badge`:事件标记控件(JS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/UI/Badge) -- [购物应用(JS)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/ShoppingOpenHarmony) +- [购物应用(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/ShoppingOpenHarmony) diff --git a/zh-cn/application-dev/quick-start/basic-resource-file-categories.md b/zh-cn/application-dev/ui/ui-ts-basic-resource-file-categories.md similarity index 68% rename from zh-cn/application-dev/quick-start/basic-resource-file-categories.md rename to zh-cn/application-dev/ui/ui-ts-basic-resource-file-categories.md index e15c49af5f6d2636c212ec794b8063d5439eed98..8f704f9f69a725690f39e855e38a51477c6cfe1e 100644 --- a/zh-cn/application-dev/quick-start/basic-resource-file-categories.md +++ b/zh-cn/application-dev/ui/ui-ts-basic-resource-file-categories.md @@ -71,11 +71,62 @@ base目录与限定词目录下面可以创建资源组目录(包括element、 **表3** 资源组目录说明 -| 资源组目录 | 目录说明 | 资源文件 | -| --------- | ---------------------------------------- | ---------------------------------------- | -| element | 表示元素资源,以下每一类数据都采用相应的JSON文件来表征。
- boolean,布尔型
- color,颜色
- float,浮点型
- intarray,整型数组
- integer,整型
- pattern,样式
- plural,复数形式
- strarray,字符串数组
- string,字符串 | element目录中的文件名称建议与下面的文件名保持一致。每个文件中只能包含同一类型的数据。
- boolean.json
- color.json
- float.json
- intarray.json
- integer.json
- pattern.json
- plural.json
- strarray.json
- string.json | -| media | 表示媒体资源,包括图片、音频、视频等非文本格式的文件。 | 文件名可自定义,例如:icon.png。 | -| animation | 表示动画资源,采用XML文件格式。 | 文件名可自定义,例如:zoom_in.xml。 | -| layout | 表示布局资源,采用XML文件格式。 | 文件名可自定义,例如:home_layout.xml。 | -| graphic | 表示可绘制资源,采用XML文件格式。 | 文件名可自定义,例如:notifications_dark.xml。 | -| profile | 表示其他类型文件,以原始文件形式保存。 | 文件名可自定义。 | +| 资源组目录 | 目录说明 | 资源文件 | +| ------- | ---------------------------------------- | ---------------------------------------- | +| element | 表示元素资源,以下每一类数据都采用相应的JSON文件来表征。
- boolean,布尔型
- color,颜色
- float,浮点型
- intarray,整型数组
- integer,整型
- pattern,样式
- plural,复数形式
- strarray,字符串数组
- string,字符串 | element目录中的文件名称建议与下面的文件名保持一致。每个文件中只能包含同一类型的数据。
- boolean.json
- color.json
- float.json
- intarray.json
- integer.json
- pattern.json
- plural.json
- strarray.json
- string.json | +| media | 表示媒体资源,包括图片、音频、视频等非文本格式的文件。 | 文件名可自定义,例如:icon.png。 | +| profile | 表示其他类型文件,以原始文件形式保存。 | 文件名可自定义。 | + +### 媒体资源类型说明 + +表1 图片资源类型说明 + +| 格式 | 文件后缀名 | +| ---- | ----- | +| JPEG | .jpg | +| PNG | .png | +| GIF | .gif | +| SVG | .svg | +| WEBP | .webp | +| BMP | .bmp | + +表2 音视频资源类型说明 + +| 格式 | 支持的文件类型 | +| ------------------------------------ | --------------- | +| H.263 | .3gp
.mp4 | +| H.264 AVC
Baseline Profile (BP) | .3gp
.mp4 | +| MPEG-4 SP | .3gp | +| VP8 | .webm
.mkv | + +## 创建资源文件 + +在resources目录下,可按照限定词目录和资源组目录的说明创建子目录和目录内的文件。 + +同时,DevEco Studio也提供了创建资源目录和资源文件的界面。 + +- 创建资源目录及资源文件 + + 在resources目录右键菜单选择“New > Resource File”,此时可同时创建目录和文件。 + + 文件默认创建在base目录的对应资源组下。如果选择了限定词,则会按照命名规范自动生成限定词+资源组目录,并将文件创建在目录中。 + + 目录名自动生成,格式固定为“限定词.资源组”,例如创建一个限定词为横竖屏类别下的竖屏,资源组为绘制资源的目录,自动生成的目录名称为“vertical.graphic”。 + + ![create-resource-file-1](figures/create-resource-file-1.png) + +- 创建资源目录 + + 在resources目录右键菜单选择“New > Resource Directory”,此时可创建资源目录。 + + 选择资源组类型,设置限定词,创建后自动生成目录名称。目录名称格式固定为“限定词.资源组”,例如创建一个限定词为横竖屏类别下的竖屏,资源组为绘制资源的目录,自动生成的目录名称为“vertical.graphic”。 + + ![create-resource-file-2](figures/create-resource-file-2.png) + +- 创建资源文件 + + 在资源目录的右键菜单选择“New > XXX Resource File”,即可创建对应资源组目录的资源文件。 + + 例如,在element目录下可新建Element Resource File。 + + ![create-resource-file-3](figures/create-resource-file-3.png) \ No newline at end of file diff --git a/zh-cn/application-dev/ui/ui-ts-components-web.md b/zh-cn/application-dev/ui/ui-ts-components-web.md index 8d223f77587c83475f2720b8b62d11776af7e507..6cd3922dd86e95e8b3fbf30820c579689f06d8b6 100644 --- a/zh-cn/application-dev/ui/ui-ts-components-web.md +++ b/zh-cn/application-dev/ui/ui-ts-components-web.md @@ -198,4 +198,6 @@ struct WebComponent { 针对Web开发,有以下相关实例可供参考: -- [`Web`:Web(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/Web) \ No newline at end of file +- [`Web`:Web(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/Web) + +- [Web组件加载本地H5小程序(eTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/WebComponent) \ No newline at end of file diff --git a/zh-cn/application-dev/ui/ui-ts-creating-simple-page.md b/zh-cn/application-dev/ui/ui-ts-creating-simple-page.md index 2b3463b86220f42a37bcdd1101b9beb2a1f1cb7d..1a6c7469f65fc06056fed280aaebb3a3216e8c23 100644 --- a/zh-cn/application-dev/ui/ui-ts-creating-simple-page.md +++ b/zh-cn/application-dev/ui/ui-ts-creating-simple-page.md @@ -440,9 +440,6 @@ .fontWeight(FontWeight.Bold) .layoutWeight(1) Flex({ alignItems: ItemAlign.Center }) { - Circle({width: 6, height: 6}) - .margin({right: 12}) - .fill(colorValue) Text(name) .fontSize(17.4) .flexGrow(1) diff --git a/zh-cn/application-dev/ui/ui-ts-layout-flex.md b/zh-cn/application-dev/ui/ui-ts-layout-flex.md index 7706637b7cd3f73395b027db4340fdb2f671c77a..fb875bc077a7161b07fe03e925732fc1eb7e0cae 100644 --- a/zh-cn/application-dev/ui/ui-ts-layout-flex.md +++ b/zh-cn/application-dev/ui/ui-ts-layout-flex.md @@ -374,4 +374,6 @@ struct FlexExample { 针对弹性布局开发,有以下相关实例可供参考: -- [弹性布局(eTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/FlowLayoutEts) +- [弹性布局(eTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/FlowLayoutEts) + +- [ArkUI常用布局容器对齐方式(eTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/LayoutAlignmentDemo) diff --git a/zh-cn/application-dev/ui/ui-ts-overview.md b/zh-cn/application-dev/ui/ui-ts-overview.md index c1c2f3bcf2de96e6948d6e62b0e8f70f6d73770d..4bec8a1c14aada55c870218b046f87debb2ae319 100644 --- a/zh-cn/application-dev/ui/ui-ts-overview.md +++ b/zh-cn/application-dev/ui/ui-ts-overview.md @@ -75,22 +75,38 @@ - [`BringApp`:拉起系统应用(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/BringApp) +- [`Chat`:聊天示例应用(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/AppSample/Chat) + +- [`Shopping`:购物示例应用(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/AppSample/Shopping) + +- [`Lottie`:Lottie(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/Lottie) + - [`Clock`:简单时钟(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/Preset/Clock) - [`Flybird`:小鸟避障游戏(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/ResourcesSchedule/Flybird) - [`News`:新闻浏览(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/ResourcesSchedule/News) -- [极简声明式UI范式(eTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/SimpleGalleryEts) +- [`AdaptiveCapabilities`:多设备自适应能力(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/MultiDeviceAppDev/AdaptiveCapabilities) + +- [`Game2048`:2048游戏(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/Game2048) + +- [`TransitionAnimation`:转场动画(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/TransitionAnimation) + +- [`PatternLock`:图案密码锁组件(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/PatternLock) + +- [`Search`:Search组件(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/Search) + +- [`QRCode`:二维码(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/QRCode) -- [购物应用(eTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/ShoppingEts) +- [极简声明式UI范式(eTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/SimpleGalleryEts) -- [转场动画的使用(eTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/TransitionAnimtaionEts) +- [购物应用(eTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/ShoppingEts) -- [基础组件Slider的使用(eTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/SliderApplicationEts) +- [转场动画的使用(eTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/TransitionAnimtaionEts) -- [弹窗(eTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/CustomDialogEts) +- [基础组件Slider的使用(eTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/SliderApplicationEts) -- [一次开发多端部署(eTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/MultiDeploymentEts) +- [弹窗(eTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/CustomDialogEts) - [CustomComponent:组件化(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/CustomComponent) \ No newline at end of file diff --git a/zh-cn/application-dev/website.md b/zh-cn/application-dev/website.md index b01cd2d170cb2ff462f74bb1ad4e91e560f0ae85..2e458bc5ee479c197ca853d7fa15576ff7b43fa9 100644 --- a/zh-cn/application-dev/website.md +++ b/zh-cn/application-dev/website.md @@ -253,6 +253,9 @@ - 分布式数据对象 - [分布式数据对象概述](database/database-distributedobject-overview.md) - [分布式数据对象开发指导](database/database-distributedobject-guidelines.md) + - 数据共享 + - [数据共享概述](database/database-datashare-overview.md) + - [数据共享开发指导](database/database-datashare-guidelines.md) - 任务管理 - 后台任务 - [后台任务概述](task-management/background-task-overview.md) diff --git a/zh-cn/application-dev/windowmanager/display-guidelines.md b/zh-cn/application-dev/windowmanager/display-guidelines.md index 01840842a262aef9b62ebebb216cd6636569768c..ef1ef4abb5c15e2711eb69cab51658809efd037a 100644 --- a/zh-cn/application-dev/windowmanager/display-guidelines.md +++ b/zh-cn/application-dev/windowmanager/display-guidelines.md @@ -22,4 +22,7 @@ display.getDefaultDisplay().then((disp) => { console.log('display.getDefaultDisplay failed, error : ' + JSON.stringify(err)); }) ``` +## 相关实例 +针对屏幕属性开发,有以下相关实例可供参考: +- [`Screen`:屏幕属性(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/device/Screen) diff --git a/zh-cn/application-dev/windowmanager/window-guidelines.md b/zh-cn/application-dev/windowmanager/window-guidelines.md index 721edb94d5680828cc42457979dfd13e2a75d598..7758fec39628b8c33c9b6b17f9ccb86e9fec2d60 100644 --- a/zh-cn/application-dev/windowmanager/window-guidelines.md +++ b/zh-cn/application-dev/windowmanager/window-guidelines.md @@ -101,5 +101,7 @@ try { } ``` -完整[示例工程](https://gitee.com/openharmony/windowmanager/tree/master/AppDemo/window/immersive)。 +## 相关实例 +针对窗口开发,有以下相关实例可供参考: +- [`Window`:窗口(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/Graphics/Window) diff --git a/zh-cn/contribute/template/guide-template.md b/zh-cn/contribute/template/guide-template.md index 9e6581f02f345229e04e5e36a870581171e522b8..fefe1359814200857ff975c45e75bde193658251 100644 --- a/zh-cn/contribute/template/guide-template.md +++ b/zh-cn/contribute/template/guide-template.md @@ -2,18 +2,19 @@ > **注意:** -> _1、本模板提供推荐的开发指南文档框架、典型知识点写作要求及写作指导。实际写作中,应视具体__方案/特性/功能/模块__情况,先完成开发者任务场景分析与开发指南大纲设计,然后参照本模板写作具体内容。_ > -> _2、文档写作时,两级标题之间的位置不允许添加内容。_ +> _1、本模板提供推荐的开发指南文档框架、典型知识点写作要求及写作指导。实际写作中,应视具体**方案/特性/功能/模块**情况,先完成开发者任务场景分析与开发指南大纲设计,然后参照本模板写作具体内容。_ +> +> _2、文档写作时,一级标题与二级标题之间的位置不允许添加内容。_ > > _3、所有斜体为写作指导,正式文档中注意全部删除。_ ## xxx概述 -_必选。根据具体__方案/特性/功能/模块__的场景划分情况,此处的“xxx概述”与具体任务场景下的“任务场景n概述”按需提供一处或共存,具体的:_ +_必选。根据具体**方案/特性/功能/模块**情况的场景划分情况,此处的“xxx概述”与具体任务场景下的“任务场景n概述”按需提供一处或共存,具体的:_ -_1、此处的“xxx概述”":用于承载开发者需要了解的、本特性各任务场景通用的概述内容。如无,则删除。_ +_1、此处的“xxx概述”:用于承载开发者需要了解的、本特性各任务场景通用的概述内容。如无,则删除。_ _2、“任务场景n概述”:用于承载任务场景n直接相关的概述内容,知识点构成及写作要点与“xxx概述”相同,包括任务场景n简介、任务场景n直接相关的基本概念、任务场景n直接相关的实现原理、任务场景n直接相关的约束与限制、任务场景n直接相关的相关实例。如无,则删除。_ @@ -21,11 +22,11 @@ _2、“任务场景n概述”:用于承载任务场景n直接相关的概述 **_1、目标对象:_**_面向内、外部开发者(含产品经理、开发人员)。面向UX设计师的指导文档通常由专门的UX设计规范承载,不在开发指南范畴。本文如需提及,以超链接方式指向对应UX规范即可。_ -_**2、内容定位:**介绍__方案/特性/功能/模块__是什么(What)、能做什么(Why),以及如何进行相关应用程序/设备的设计、开发、发布上架(How)。支撑开发者学习必要知识,最终在实际开发活动中完成既定任务目标。_ +**_2、内容定位:_**_介绍**方案/特性/功能/模块**是什么(What)、能做什么(Why),以及如何进行相关应用程序/设备的设计、开发、发布上架(How)。支撑开发者学习必要知识,最终在实际开发活动中完成既定任务目标。_ -_**3、用户视角:**变身开发者,始终以开发者视角,提供开发者关注的、可感知和使用的内容。_ +**_3、用户视角:_**_变身开发者,始终以开发者视角,提供开发者关注的、可感知和使用的内容。_ -_**4、面向任务:**聚焦开发者实际任务,完整、正确、易用,具备权威指导性。_ +**_4、面向任务:_**_聚焦开发者实际任务,完整、正确、易用,具备权威指导性。_ _5、不要受限:模板只是基础框架,不要僵化。_ @@ -40,7 +41,7 @@ _这个方案/特性/功能/模块是什么(定义-what)?我为什么要 _**【写作要点】**_ -- _提供易理解的场景化描述。__可参考如下SCQA方式介绍方案/特性/功能/模块客户面的功能场景、特点。_ +- _提供易理解的场景化描述。_ _可参考如下SCQA方式介绍方案/特性/功能/模块客户面的功能场景、特点。_ - _S:situation(情景),由大家都熟悉的的情景、事实引入。_ - _C:complication(冲突),但是实际情况往往和我们的要求有冲突。_ - _Q:question(疑问),怎么办?_ @@ -71,7 +72,7 @@ _要使用该方案/特性/功能/模块,有哪些独有概念是我需要了 - _运作机制、约束限制、开发过程等多个章节相关的概念在此介绍,仅某个章节用到的概念在对应章节中介绍。_ -- _业界通用的概念不用在此赘述。__注意使用业界通用术语来表达,不用华为研发内部语言。_ +- _业界通用的概念不用在此赘述。_ _注意使用业界通用术语来表达,不用华为研发内部语言。_ - _概念之间如有逻辑关系,推荐使用图形描述。_ @@ -141,7 +142,7 @@ _可选。此处放置以下各任务场景通用的约束与限制。_ _**【开发者关注点】**_ -_我要__使用该方案/特性/功能/模块,有什么约束条件吗?__该方案/特性/功能/模块__实现的程度如何,能满足我的需求吗?_ +_我要使用该方案/特性/功能/模块,有什么约束条件吗?该方案/特性/功能/模块实现的程度如何,能满足我的需求吗?_ **_【写作要点】_** @@ -174,7 +175,7 @@ _有哪些Sample code、Codelabs、Demo工程可供学习、参考。_ **_【写作要点】_** -_已发布的Sample code、Codelabs、Demo工程包,请在此处提供链接(一般为Gitee链接)。__注意:不允许将工程包等作为附件插入到文档中。_ +_已发布的Sample code、Codelabs、Demo工程包,请在此处提供链接(一般为Gitee链接)。_ _注意:不允许将工程包等作为附件插入到文档中。_ **【写作样例】** @@ -189,7 +190,7 @@ _可选。_ _根据具体的开发场景分析分解情况,本节内容可按需放入“开发指导”下,作为“前提条件”或“开发准备”与具体场景的“开发步骤”就近放置。_ -_明确如何准备开发环境(如软硬件配置要求、工具要求、设备要求等)__。_ +_明确如何准备开发环境(如软硬件配置要求、工具要求、设备要求等)。_ _如果不涉及上述特殊要求,此章节删除。_ @@ -256,7 +257,7 @@ _贴近开发者实际开发场景:_ - _开发者需要通过哪些任务来达成开发目标,这就是任务场景。_ -- _任务场景可以有1个或多个,__可按需添加多个“开发指导”章节。__同时要遵循分层分级逻辑,即大场景(任务场景n)->小场景(子任务场景n-x)->任务逻辑(对应“开发流程”)->操作步骤(一个个step)。_ +- _任务场景可以有1个或多个,可按需添加多个“开发指导”章节。同时要遵循分层分级逻辑,即大场景(任务场景n)->小场景(子任务场景n-x)->任务逻辑(对应“开发流程”)->操作步骤(一个个step)。_ ### 任务场景n概述 @@ -380,9 +381,8 @@ _描述开发过程遇到的各类问题以及解决方案,以提高开发效 - _如果无常见问题,删除此章节。_ -- _如果有常见问题,建议单独章节,后续具备扩展性。_ +- _各任务场景通用的常见问题,建议以单独章节呈现;单个任务场景相关的常见问题,放在对应任务场景的章节下即可。_ -- _如果有常见问题,问题少于1屏且未来扩充可能性不大,可放在“开发指导”。_ ### 1.XX问题(简单问题) diff --git a/zh-cn/design/hdi-design-specifications.md b/zh-cn/design/hdi-design-specifications.md index a6f410f136870ef1b954c67f640789abbdb96c4c..cf0db1e1c0ddd6e8fbc1bf290946cc0ce8e1a9c6 100644 --- a/zh-cn/design/hdi-design-specifications.md +++ b/zh-cn/design/hdi-design-specifications.md @@ -60,7 +60,7 @@ interface IVibrator { 当对原有接口进行不破坏向后兼容的修改时,如在最后追加新增接口、新增枚举定义、修改变量名称等,只需要增加`minor`版本号,新的包名为`ohos.hdi.vibrator.v1_1`。如: ```cpp -package ohos.hdi.vibrator.v1_0; +package ohos.hdi.vibrator.v1_1; interface IVibrator { ... SetModulationParameter([in] unsigned int vibrationPeriod, [in] int intensity, [in] int freq); @@ -71,7 +71,7 @@ interface IVibrator { 如果对原有接口进行更名、修改变量列表等不向后兼容修改时,需要增加`major`版本号,新的包名为`ohos.hdi.vibrator.v2_0`。如: ```cpp -package ohos.hdi.vibrator.v1_0; +package ohos.hdi.vibrator.v2_0; interface IVibrator { ... SetModulationParameter([in] unsigned int vibrationPeriod, [in] int intensity, [in] int frequency, [int] time); diff --git a/zh-cn/device-dev/dev-board-on-the-master.md b/zh-cn/device-dev/dev-board-on-the-master.md new file mode 100644 index 0000000000000000000000000000000000000000..20237f39f24e9563bbe0210a2a23b5b9af766d4a --- /dev/null +++ b/zh-cn/device-dev/dev-board-on-the-master.md @@ -0,0 +1,36 @@ +# OpenHarmony开发板列表 + +当前社区共支持17款开发板,详见下表。 +更详细的开发板信息展示,请参考:http://ci.openharmony.cn/developBoard/list + +## 标准系统开发板 + +| 开发板型号 | 芯片型号 | 主要能力及适配案例 | 典型应用场景 | 开发板代码仓及社区每日构建版本获取地址 | +| ---------- | -------- | -------- | ------------ | -------------------------------------- | +|润和HH-SCDAYU200| RK3568 |主要能力:
基于Rockchip RK3568平台,集成双核架构GPU以及高效能NPU,四核64位Cortex-A55 处理器采用22nm工艺,主频高达2.0GHz;支持蓝牙、Wi-Fi、音频、视频和摄像头等功能,拥有丰富的扩展接口,支持多种视频输入输出接口,配置双千兆自适应RJ45以太网口,可满足NVR、工业网关等多网口产品需求。
适配案例:
[DAYU200适配案例](porting/porting-dayu200-on_standard-demo.md)|影音娱乐、智慧出行、智能家居,如烟机、烤箱、跑步机等。|代码仓:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_hihope](https://gitee.com/openharmony/device_board_hihope)
[vendor_hihope](https://gitee.com/openharmony/vendor_hihope)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +|Hispark_Phoenix|Hi3751V351|主要能力:
全球制式FHD(全高清)智能电视主处理芯片,内置高性能多核 ARM A53 CPU,多核MALI T450 GPU,支持NTSC/PAL/SECAM制式解调,支持DTMB/DVB-C/ATSC/ISDB-T等全球数字Demod,可以扩展DVB-T/T2/S/S2,支持USB播放,支持主流的视频格式包括MPEG2、H.264、H.265、RMVB、AVS+等,支持主流音频解码及音效处理,以及海思自研的SWS音效处理,支持CVBS/YPbPr/VGA/HDMI 1.4/USB接口,内置1GB DDR,支持LVDS和miniLVDS接口,支持主流的Tconless屏。|智能电视、智能家居中控屏、智能显示器、商显广告屏、交互白板、工业控制屏、打印机屏、白电屏、健身器显示屏等。|代码仓:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_hisilicon](https://gitee.com/openharmony/device_board_hisilicon)
[vendor_hisilicon](https://gitee.com/openharmony/vendor_hisilicon)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|Unionpi Tiger|Amlogic A311D|主要能力:
Unionpi Tiger是一款应用于图像处理,音视频处理和深度学习等场景的智能硬件,其主芯片采用Amlogic A311D芯片方案。 A311D支持GPU和神经网络加速子系统,支持4K视频编解码器引擎和一流的HDR图像处理,并集成了所有标准音频/视频输入/输出接口。主系统的CPU采用大小核设计,主频高达2.2GHz,集成了四个Cortex-A73核心和两Cortex-A53核心 ,集成独立的5.0T NPU处理器。|智能家居、AI人脸识别、工业控制、智慧车载、多媒体处理、AI边缘计算等。|代码仓:
[device_soc_amlogic](https://gitee.com/openharmony/device_soc_amlogic)
[device_board_unionman](https://gitee.com/openharmony/device_board_unionman)
[vendor_unionman](https://gitee.com/openharmony/vendor_unionman)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|MILOS_Standard0|NXP i.MX8M Mini|主要能力:
基于 NXP i.MX8M Mini处理器,1.8G Hz主频。接⼝外设丰富:LVDS显⽰、MIPI-DSI信号引出、 MIPI-CSI摄像头接⼝、⽀持⾳频输⼊输出、千兆⽹、多路USB、多串⼝、等多种通信接⼝|⾼性能仪器仪表(⼯业及医疗)、⼯业控制及⼈机互动装置、智能交通、智慧消防、智慧楼宇等。|代码仓:
[device_soc_nxp](https://gitee.com/openharmony/device_soc_nxp)
[device_board_osware](https://gitee.com/openharmony/device_board_osware)
[vendor_osware](https://gitee.com/openharmony/vendor_osware)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|扬帆开发板|RK3399|主要能力:
扬帆开发板基于RK3399芯片平台;RK3399的CPU采用big.LITTLE核心架构,采用双核Cortex-A72大核+四核Cortex-A53小核结构。在整数,浮点数,内存,整体性能,功耗和核心面积方面都进行了重大改进。RK3399的GPU采用四核ARM的新一代高端图像处理器Mali-T860,集成了更多的带宽压缩技术(如智能叠加,ASTC和本地像素存储),并支持更多的图形和计算接口。|互动广告机、互动数字标牌、智能自助终端、智能零售终端、工控主机、机器人设备等。|代码仓:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_isoftstone](https://gitee.com/openharmony/device_board_isoftstone)
[vendor_isoftstone](https://gitee.com/openharmony/vendor_isoftstone)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|致远开发板|T507|主要能力:
致远开发板搭载了全志工业级T507芯片,该芯片集成四核CortexTM – A53 CPU、G31 MP2 GPU、多路视频输出接口(RGB/2*LVDS/HDMI/CVBS OUT)、多路视频输入接口(MIPI CSI/BT656/BT1120),支持4K@60fps H.265解码,4K@25fps H.264解码,DI,3D降噪,自动调色系统和梯形校正模块可以提供提供流畅的用户体验和专业的视觉效果|工业控制、智能驾舱、智慧家居、智慧电力、在线教育等。|代码仓:
[device_soc_allwinner](https://gitee.com/openharmony/device_soc_allwinner)
[device_board_isoftstone](https://gitee.com/openharmony/device_board_isoftstone)
[vendor_isoftstone](https://gitee.com/openharmony/vendor_isoftstone)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| + +## 小型系统开发板 + +| 开发板型号 | 芯片型号 | 主要能力及适配案例 | 典型应用场景 | 开发板代码仓及社区每日构建版本获取地址 | +| ---------- | -------- | -------- | ------------ | -------------------------------------- | +|Hispark_Taurus|Hi3516DV300|主要能力:
Hi3516DV300是新一代Smart HD IP摄像机SOC,集成新一代ISP(Image Signal Processor)、H.265视频压缩编码器、高性能NNIE引擎,在低码率、高画质、智能处理和分析、低功耗等方面有较好的性能。|带屏智能设备,如带屏冰箱、车机等。|代码仓:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_hisilicon](https://gitee.com/openharmony/device_board_hisilicon)
[vendor_hisilicon](https://gitee.com/openharmony/vendor_hisilicon)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|BearPi-HM Micro|STM32MP157A|主要能力:
BearPi-HM Micro开发板基于STM32MP157芯片,搭配4.3寸LCD电容式触摸屏,并板载wifi电路及标准的E53接口,标准的E53接口可扩展智能加湿器、智能台灯、智能安防、智能烟感等案例。
适配案例:
[BearPi-HM Mircro适配案例](porting/porting-stm32mp15xx-on-smallsystem.md)|智慧家居、智能硬件、中控屏等。|代码仓:
[device_soc_st](https://gitee.com/openharmony/device_soc_st)
[device_board_bearpi](https://gitee.com/openharmony/device_board_bearpi)
[vendor_bearpi](https://gitee.com/openharmony/vendor_bearpi)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | + +## 轻量系统开发板 + +| 开发板型号 | 芯片型号 | 主要能力及适配案例 | 典型应用场景 | 开发板代码仓及社区每日构建版本获取地址 | +| ---------- | -------- | -------- | ------------ | -------------------------------------- | +|小熊派BearPi-HM Nano|Hi3861|主要能力:
BearPi-HM_Nano开发板是一块专门为OpenHarmony设计的开发板,板载高度集成的2.4GHz WiFi SoC芯片Hi3861,并板载NFC电路及标准的E53接口,标准的E53接口可扩展智能加湿器、智能台灯、智能安防、智能烟感等案例。|智慧路灯、智慧物流、人体红外等连接类设备。|代码仓:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_bearpi](https://gitee.com/openharmony/device_board_bearpi)
[vendor_bearpi](https://gitee.com/openharmony/vendor_bearpi)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|Multi-modal V200Z-R|BES2600|主要能力:
Multi-modal V200Z-R开发板是基于恒玄科技BES2600WM芯片的一款高性能、多功能、高性价比AIoT SoC开发板;开发板单模组集成四核ARM处理器(最高主频1GHz),集成双频WiFi + 双模蓝牙,支持标准的802.11 a/b/g/n/协议,支持BT/BLE 5.2协议,内建多种容量的RAM(最大42MB)和Flash(最大32MB),支持MIPI DSI及CSI,适用于各种AIoT多模态VUI + GUI交互硬件场景。
适配案例:
[Multi-modal V200Z-R适配案例](porting/porting-bes2600w-on-minisystem-display-demo.md)|智能硬件、带屏类模组产品,如音箱、手表等。|代码仓:
[device_soc_bestechnic](https://gitee.com/openharmony/device_soc_bestechnic)
[device_board_fnlink](https://gitee.com/openharmony/device_board_fnlink)
[vendor_bestechnic](https://gitee.com/openharmony/vendor_bestechnic)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +|朗国LANGO200|ASR582X|主要能力:
LANGO200 IOT开发板,集成了高性能的WIFI-BLE双模芯片ASR5822、外部存储芯片、语音播放芯片以及模数转换等,同时支持SPI等IOT设备常用外设接口,可外扩OLED显示屏、红外遥控等。
适配案例:
[LANGO200适配案例](porting/porting-asr582x-combo-demo.md)|智能家居、连接类模组。|代码仓:
[device_soc_asrmicro](https://gitee.com/openharmony/device_soc_asrmicro)
[device_board_lango](https://gitee.com/openharmony/device_board_lango)
[vendor_asrmicro](https://gitee.com/openharmony/vendor_asrmicro)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +|汇顶GR5515-STARTER-KIT|GR5515|主要能力:
支持Bluetooth 5.1的单模低功耗蓝牙SoC,多功能按键和LED指示灯。|智能硬件,如手表、手环、价格类标签。|代码仓:
[device_soc_goodix](https://gitee.com/openharmony/device_soc_goodix)
[device_board_goodix](https://gitee.com/openharmony/device_board_goodix)
[vendor_goodix](https://gitee.com/openharmony/vendor_goodix)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|Niobe407|STM32F407IGT6|主要能力:
Niobe407开发板基于STM32F407芯片,该芯片集成Arm Cortex-M4 CPU,带 FPU,自适应实时加速器,频率高达 168 MHz。
适配案例:
[Niobe407适配案例](porting/porting-stm32f407-on-minisystem-eth.md)|智慧交通、工业控制等。|代码仓:
[device_soc_st](https://gitee.com/openharmony/device_soc_st)
[device_board_talkweb](https://gitee.com/openharmony/device_board_talkweb)
[vendor_talkweb](https://gitee.com/openharmony/vendor_talkweb)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +|B91 Generic Starter Kit|TLSR9x|主要能力:
泰凌微公司的B91 Generic Starter Kit是一个可用于评估TLSR9系列芯片组的硬件平台,BLE,BLE Mesh,Zigbee 3.0, Thread和2.4GHz私有协议等多种适用于2.4GHz接口标准的应用程序都可以用它来进行开发。|智能家居、连接类模组。|代码仓:
[device_soc_telink](https://gitee.com/openharmony/device_soc_telink)
[device_board_telink](https://gitee.com/openharmony/device_board_telink)
[vendor_telink](https://gitee.com/openharmony/vendor_telink)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|cst85_wblink|cst85f01|主要能力:
cst85_wblink开发板是基于芯海科技cst85f01芯片,由芯海科技出品的一款高性能、多功能、高性价比AIoT SoC开发板。cst85_wblink开发板,集成双频WiFi + 双模蓝牙,支持标准的802.11 a/b/g/n/协议,支持BT/BLE 5.0协议,内建多种容量的RAM(最大992KB)和Flash(最大16MB),支持MIPI DSI及CSI,适用于快速开发物联网(IOT)及智能设备的Wi-Fi、蓝牙的应用。
适配案例:
[cst85_wblink适配案例](porting/porting-cst85f01-combo-demo.md)|物联网、智能家居等。|代码仓:
[device_soc_chipsea](https://gitee.com/openharmony/device_soc_chipsea)
[device_board_chipsea](https://gitee.com/openharmony/device_board_chipsea)
[vendor_chipsea](https://gitee.com/openharmony/vendor_chipsea)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +|Neptune100| W800 |主要能力:
润和 Neptune100开发板基于联盛德W800芯片,是一款Wi-Fi &蓝牙双模SoC开发板,支持标准的802.11 b/g/n协议,内置完整的TCP/IP协议栈,集成蓝牙基带处理器,支持BT/BLE4.2协议;具备丰富的数字接口,内置QFlash、SPI、UART、GPIO、I2C、I2S、7816等;具备强大的安全特性,支持多种硬件加解密算法,内置DSP、浮点运算单元与安全引擎,支持代码安全权限设置,内置2MBFlash存储器,支持固件加密存储、固件签名、安全调试、安全升级等多项安全措施。
适配案例:
[Neptune100适配案例](porting/porting-w800-combo-demo.md)|物联网、智能家居、连接类产品。|代码仓:
[device_soc_winnermicro](https://gitee.com/openharmony/device_soc_winnermicro)
[device_board_hihope](https://gitee.com/openharmony/device_board_hihope)
[vendor_hihope](https://gitee.com/openharmony/vendor_hihope)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +|小凌派-RK2206| RK2206 |主要能力:
小凌派-RK2206开发板主控器为瑞芯微高性能、高性价比的RK2206芯片,搭载OpenHarmony轻量级操作系统,内置WiFi/AP功能、NFC功能、液晶显示接口以及E53接口,E53接口兼容各类传感器模块,便于多样化的IoT物联网应用;目前小凌派-RK2006开发板已经拥有20+个成熟的应用案例,以及完善的教学课程。|智慧城市、智能家居、智慧教学、智慧车载以及智慧医疗等。|代码仓:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_lockzhiner](https://gitee.com/openharmony/device_board_lockzhiner)
[vendor_lockzhiner](https://gitee.com/openharmony/vendor-lockzhiner)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | \ No newline at end of file diff --git a/zh-cn/device-dev/driver/driver-peripherals-audio-des.md b/zh-cn/device-dev/driver/driver-peripherals-audio-des.md index 2a85f7e38f89ce1e277790d70e8062ba0f17a417..8fcfc791311f3a25449a5a053e9d550683109f81 100644 --- a/zh-cn/device-dev/driver/driver-peripherals-audio-des.md +++ b/zh-cn/device-dev/driver/driver-peripherals-audio-des.md @@ -11,7 +11,7 @@ ## Audio驱动框架介绍 -Audio驱动框架基于[HDF驱动框架](https://device.harmonyos.com/cn/docs/documentation/guide/driver-hdf-overview-0000001051715456)实现。Audio驱动架构组成: +Audio驱动框架基于[HDF驱动框架](driver-hdf-overview.md)实现。Audio驱动架构组成: ![](figures/Audio框架图.png) @@ -273,7 +273,7 @@ int32_t CodecDaiHwParams(const struct AudioCard *card, const struct AudioPcmHwPa #### Codec注册绑定到HDF -此处依赖HDF框架的驱动实现方式,具体流程可参考[HDF驱动框架](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/driver/driver-hdf.md)指导。 +此处依赖HDF框架的驱动实现方式,具体流程可参考[HDF驱动框架](driver-hdf-overview.md)指导。 填充g_codecDriverEntry结构体,moduleName与device_info.hcs中的moduleName匹配,实现Bind、Init、Release函数指针。 @@ -331,7 +331,7 @@ static void CodecDriverRelease(struct HdfDeviceObject *device) #### HCS配置流程 -hcs中配置驱动节点、加载顺序、服务名称等。hcs语法可参考HDF框架的[配置管理](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/driver/driver-hdf-manage.md)。 +hcs中配置驱动节点、加载顺序、服务名称等。hcs语法可参考HDF框架的[配置管理](driver-hdf-manage.md)。 标准系统配置文件路径: @@ -779,7 +779,7 @@ int32_t Tfa9879DaiHwParams(const struct AudioCard *card, const struct AudioPcmHw #### Accessory注册绑定到HDF -此处依赖HDF框架的驱动实现方式,具体流程可参考[HDF驱动框架](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/driver/driver-hdf.md)。 +此处依赖HDF框架的驱动实现方式,具体流程可参考[HDF驱动框架](driver-hdf-overview.md)。 填充g_tfa9879DriverEntry结构体,moduleName与device_info.hcs中的moduleName匹配,实现Bind、Init、Release函数指针。 @@ -900,7 +900,7 @@ int32_t Hi3516DmaPointer(struct PlatformData *data, uint32_t *pointer); #### Platform注册绑定到HDF -此处依赖HDF框架的驱动实现方式,具体流程可参考[HDF驱动框架](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/driver/driver-hdf.md)。 +此处依赖HDF框架的驱动实现方式,具体流程可参考[HDF驱动框架](driver-hdf-overview.md)。 - 填充g_platformDriverEntry结构体 - moduleName与device_info.hcs中的moduleName匹配 @@ -1064,7 +1064,7 @@ int32_t DaiStartup(const struct AudioCard *card, const struct DaiDevice *device) #### Dai注册绑定到HDF -此处依赖HDF框架的驱动实现方式,具体流程可参考[HDF驱动框架](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/driver/driver-hdf.md)。 +此处依赖HDF框架的驱动实现方式,具体流程可参考[HDF驱动框架](driver-hdf-overview.md)。 - 填充g_daiDriverEntry结构体 - moduleName与device_info.hcs中的moduleName匹配 diff --git a/zh-cn/device-dev/driver/driver-peripherals-camera-des.md b/zh-cn/device-dev/driver/driver-peripherals-camera-des.md index a531d05d658dfbc00f47cbffad15220746a97222..94704359fc2492e9ddc456669e3827b4ca0f3d19 100755 --- a/zh-cn/device-dev/driver/driver-peripherals-camera-des.md +++ b/zh-cn/device-dev/driver/driver-peripherals-camera-des.md @@ -52,7 +52,7 @@ Camera模块主要用以相机预览、拍照、视频流等场景下对相机 | 功能描述 | 接口名称 | | ---------------------------- | ------------------------------------------------------------ | | 获取流控制器 | CamRetCode GetStreamOperator(
const OHOS::sptr &callback,
OHOS::sptr &streamOperator) | - | 更新设备控制参数 | CamRetCode UpdateSettings(const std::shared_ptr &settingss) | + | 更新设备控制参数 | CamRetCode UpdateSettings(const std::shared_ptr &settings) | | 设置Result回调模式和回调函数 | CamRetCode SetResultMode(const ResultCallbackMode &mode) | | 获取使能的ResultMeta | CamRetCode GetEnabledResults(std::vector &results) | | 使能具体的ResultMeta | CamRetCode EnableResult(const std::vector &results) | @@ -730,7 +730,7 @@ Camera驱动的开发过程主要包含以下步骤: "-o | --offline stream offline test\n" "-c | --capture capture one picture\n" "-w | --set WB Set white balance Cloudy\n" - "-v | --video capture Viedeo of 10s\n" + "-v | --video capture Video of 10s\n" "-a | --Set AE Set Auto exposure\n" "-f | --Set Flashlight Set flashlight ON 5s OFF\n" "-q | --quit stop preview and quit this app\n"); diff --git a/zh-cn/device-dev/driver/driver-peripherals-light-des.md b/zh-cn/device-dev/driver/driver-peripherals-light-des.md index 8ee0758971e1747b30fd57de817edfdf22954515..3fe251ccb9d9c25668aa97a8c58792947803e285 100644 --- a/zh-cn/device-dev/driver/driver-peripherals-light-des.md +++ b/zh-cn/device-dev/driver/driver-peripherals-light-des.md @@ -50,7 +50,7 @@ Light驱动模型支持获取系统中所有灯的信息,动态配置闪烁模 1. 基于HDF驱动框架,按照驱动Driver Entry程序,完成Light抽象驱动开发(主要由Bind、Init、Release、Dispatch函数接口实现),资源配置及HCS配置文件解析。完成Light驱动的设备信息配置。 - 调用HDF_INIT将驱动入口注册到HDF框架中。在加载驱动时HDF框架会先调用Bind函数,再调用Init函数加载该驱动。当Init调用异常时,HDF框架会调用Release释放驱动资源并退出。 - Light驱动模型使用HCS配置文件作为配置描述源码。HCS配置字段详细介绍请参考[配置管理](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/driver/driver-hdf-manage.md)。 + Light驱动模型使用HCS配置文件作为配置描述源码。HCS配置字段详细介绍请参考[配置管理](driver-hdf-manage.md)。 其Driver Entry入口函数定义如下: ```c diff --git a/zh-cn/device-dev/driver/driver-peripherals-usb-des.md b/zh-cn/device-dev/driver/driver-peripherals-usb-des.md index cfe37f34088f73fa7bba2541fc1a478712fff200..5292ee054ba428f785fdb8a9cef3197e407fd121 100644 --- a/zh-cn/device-dev/driver/driver-peripherals-usb-des.md +++ b/zh-cn/device-dev/driver/driver-peripherals-usb-des.md @@ -468,7 +468,7 @@ static int AcmAllocNotifyRequest(struct AcmDevice *acm) return HDF_SUCCESS; error: - AcmFreeNotifyReqeust(acm); + AcmFreeNotifyRequest(acm); return ret; } @@ -592,7 +592,7 @@ static void AcmFreeRequests(struct AcmDevice *acm) g_syncRequest = NULL; } AcmFreeReadRequests(acm); - AcmFreeNotifyReqeust(acm); + AcmFreeNotifyRequest(acm); AcmFreeWriteRequests(acm); AcmWriteBufFree(acm); } @@ -631,7 +631,7 @@ static int32_t AcmAllocRequests(struct AcmDevice *acm) return HDF_SUCCESS; error_alloc_read_req: - AcmFreeNotifyReqeust(acm); + AcmFreeNotifyRequest(acm); error_alloc_int_req: AcmFreeWriteRequests(acm); error_alloc_write_req: @@ -1112,7 +1112,7 @@ err_submit_req: err_start_io: UsbFreeReadRequests(acm); err_alloc_read_reqs: - UsbFreeNotifyReqeust(acm); + UsbFreeNotifyRequest(acm); err_alloc_notify_req: UsbFreeWriteRequests(acm); err_alloc_write_reqs: @@ -1144,7 +1144,7 @@ static void UsbSerialRelease(struct AcmDevice *acm) g_syncRequest = NULL; } UsbFreeReadRequests(acm); - UsbFreeNotifyReqeust(acm); + UsbFreeNotifyRequest(acm); UsbFreeWriteRequests(acm); AcmWriteBufFree(acm); (void)UsbRawCloseDevice(acm->devHandle); diff --git a/zh-cn/device-dev/driver/driver-peripherals-vibrator-des.md b/zh-cn/device-dev/driver/driver-peripherals-vibrator-des.md index a00c2accba4ee0bb683b4f6442f73ba2cfc9dcab..f4b2cd8874a6425b8ae8335de2f48bbfb409f92b 100755 --- a/zh-cn/device-dev/driver/driver-peripherals-vibrator-des.md +++ b/zh-cn/device-dev/driver/driver-peripherals-vibrator-des.md @@ -67,7 +67,7 @@ Vibrator驱动模型为上层马达硬件服务层提供稳定的马达控制能 1. 基于HDF驱动框架,按照驱动Driver Entry程序,完成马达抽象驱动开发,主要由Bind、Init、Release、Dispatch函数接口实现,配置资源和HCS解析。 - - 调用HDF_INIT将驱动入口注册到HDF框架中,在加载驱动时HDF框架会先调用Bind函数,再调用Init函数加载该驱动。当Init调用异常时,HDF框架会调用Release释放驱动资源并退出马达驱动模型,使用HCS作为配置描述源码。HCS配置字段详细介绍参考[配置管理](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/driver/driver-hdf-manage.md)。其中Driver Entry入口函数定义如下: + - 调用HDF_INIT将驱动入口注册到HDF框架中,在加载驱动时HDF框架会先调用Bind函数,再调用Init函数加载该驱动。当Init调用异常时,HDF框架会调用Release释放驱动资源并退出马达驱动模型,使用HCS作为配置描述源码。HCS配置字段详细介绍参考[配置管理](driver-hdf-manage.md)。其中Driver Entry入口函数定义如下: ```c /* 注册马达抽象驱动入口数据结构体对象 */ @@ -200,7 +200,7 @@ Vibrator驱动模型为上层马达硬件服务层提供稳定的马达控制能 } ``` - - 马达效果模型使用HCS作为配置描述源码,hcs配置文件字段详细介绍参考[配置管理](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/driver/driver-hdf-manage.md)。 + - 马达效果模型使用HCS作为配置描述源码,hcs配置文件字段详细介绍参考[配置管理](driver-hdf-manage.md)。 ```hcs /* 马达数据配置模板(vibrator_config.hcs) */ diff --git a/zh-cn/device-dev/driver/driver-platform-hdmi-develop.md b/zh-cn/device-dev/driver/driver-platform-hdmi-develop.md index fd127d7c13956bca29197a015d8438b579ac6b40..5f3d7c47d7287f8ff33e8b5abc550f81141e6f75 100755 --- a/zh-cn/device-dev/driver/driver-platform-hdmi-develop.md +++ b/zh-cn/device-dev/driver/driver-platform-hdmi-develop.md @@ -100,7 +100,7 @@ struct HdmiCntlrOps { | phyOutputSet | **cntlr**:结构体指针,核心层HDMI控制器
**cfg**: 配置信息 | 无 | 无 | 设置物理层配置信息 | | blackDataSet | **cntlr**:结构体指针,核心层HDMI控制器
**enable**: bool,使能/去使能 | 无 | 无 | 设置黑屏 | | videoMuteEnable | **cntlr**:结构体指针,核心层HDMI控制器
**enable**: bool,使能/去使能 | 无 | 无 | 使能/去使能video静音 | -| videoPathSet | **cntlr**:结构体指针,核心层HDMI控制器
**attr**:配置信息| 无 | 无 | 设置viedo通路配置信息 | +| videoPathSet | **cntlr**:结构体指针,核心层HDMI控制器
**attr**:配置信息| 无 | 无 | 设置video通路配置信息 | |audioMuteEnable | **cntlr**:结构体指针,核心层HDMI控制器
**enable**: bool,使能/去使能 | 无 | 无 | 使能/去使能audio静音 | | avmuteSet | **cntlr**:结构体指针,核心层HDMI控制器
**enable**: bool,使能/去使能| 无 | 无 | 使能/去使能声音图像消隐 | | ddcTransfer | **cntlr**:结构体指针,核心层HDMI控制器
**ddcCfg**:DDC配置参数 |**ddcCfg**:DDC配置参数 |HDF_STATUS相关状态 | 读写DDC数据 | @@ -108,9 +108,9 @@ struct HdmiCntlrOps { | scdcSourceScrambleSet | **cntlr**:结构体指针,核心层HDMI控制器
**enable**: bool,使能/去使能 | 无 | HDF_STATUS相关状态 | 使能/去使能source端的加扰 | | frlEnable | **cntlr**:结构体指针,核心层HDMI控制器
**enable**: bool,使能/去使能 | 无 | HDF_STATUS相关状态 | 使能/去使能FRL | | audioNctsSet | **cntlr**:结构体指针,核心层HDMI控制器
**cfg**:N/CTS配置参数 | 无 | HDF_STATUS相关状态 | 设置audio的N/CTS信息 | -| frlTrainingConfigSet | **cntlr**:结构体指针,核心层HDMI控制器
**cfg**:FRL Traning配置参数 | 无 | 无| 设置FRL Traning配置信息 | -| frlTrainingStart | **cntlr**:结构体指针,核心层HDMI控制器 | 无 | 无 | 开始FRL Traning流程 | -| frlGetTriningRslt | **cntlr**:结构体指针,核心层HDMI控制器 | **rslt**:FRL Traning结果 | 无 | 获取FRL Traning结果 | +| frlTrainingConfigSet | **cntlr**:结构体指针,核心层HDMI控制器
**cfg**:FRL Training配置参数 | 无 | 无| 设置FRL Training配置信息 | +| frlTrainingStart | **cntlr**:结构体指针,核心层HDMI控制器 | 无 | 无 | 开始FRL Training流程 | +| frlGetTriningRslt | **cntlr**:结构体指针,核心层HDMI控制器 | **rslt**:FRL Training结果 | 无 | 获取FRL Training结果 | | hdcpRegInit | **cntlr**:结构体指针,核心层HDMI控制器 | 无 | 无 | 初始化HDCP流程相关的寄存器 | |hdcpGenerateAksvAndAn |**cntlr**:结构体指针,核心层HDMI控制器 | 无 | HDF_STATUS相关状态 | HDCP流程中生成aksv和an | | hdcpOptReg | **cntlr**:结构体指针,核心层HDMI控制器
**type**: 操作类型
**data**: 寄存器数据
**len**: 数据长度 | **data**: 寄存器数据 | HDF_STATUS相关状态 | HDCP流程中读写相关寄存器 | @@ -412,4 +412,4 @@ HDMI模块适配的三个环节是配置属性文件,实例化驱动入口以 ``` > ![](../public_sys-resources/icon-note.gif) **说明:**
- > 所有强制转换获取相应对象的操作前提是在Init函数中具备对应赋值的操作。 \ No newline at end of file + > 所有强制转换获取相应对象的操作前提是在Init函数中具备对应赋值的操作。 diff --git a/zh-cn/device-dev/driver/driver-platform-i3c-des.md b/zh-cn/device-dev/driver/driver-platform-i3c-des.md index 5ead2c6ef21e842f8099560166c0b51c8b2e71a1..24d7f0bd02a15e1942680cd80a19556bbdc2d0f3 100755 --- a/zh-cn/device-dev/driver/driver-platform-i3c-des.md +++ b/zh-cn/device-dev/driver/driver-platform-i3c-des.md @@ -268,7 +268,7 @@ int32_t I3cTestRequestIbi(void) } ret = I3cRequestIbi(i3cHandle, 0x3F, TestI3cIbiFunc, 16); if (ret != 0) { - HDF_LOGE("%s: Requset IBI failed!", __func__); + HDF_LOGE("%s: Request IBI failed!", __func__); return -1; } @@ -447,4 +447,4 @@ static int32_t TestCaseI3c(void) return 0; } -``` \ No newline at end of file +``` diff --git a/zh-cn/device-dev/driver/driver-platform-uart-develop.md b/zh-cn/device-dev/driver/driver-platform-uart-develop.md index d33491b40f4da5a80d90548d85f25e3dd63860ce..0a2abe456278938fe723ef09076f43f6045b9e87 100755 --- a/zh-cn/device-dev/driver/driver-platform-uart-develop.md +++ b/zh-cn/device-dev/driver/driver-platform-uart-develop.md @@ -188,7 +188,7 @@ UART模块适配HDF框架的三个环节是配置属性文件,实例化驱动 #define UART_STATE_NOT_OPENED 0 #define UART_STATE_OPENING 1 #define UART_STATE_USEABLE 2 - #define UART_STATE_SUSPENED 3 + #define UART_STATE_SUSPENDED 3 uint32_t flags; // 状态标志 #define UART_FLG_DMA_RX (1 << 0) #define UART_FLG_DMA_TX (1 << 1) diff --git a/zh-cn/device-dev/get-code/sourcecode-acquire.md b/zh-cn/device-dev/get-code/sourcecode-acquire.md index 98afa8370a3220737ee7418287cd2ad146bcff1a..a75e79c97397f982b94c356d3172d74570d245ca 100644 --- a/zh-cn/device-dev/get-code/sourcecode-acquire.md +++ b/zh-cn/device-dev/get-code/sourcecode-acquire.md @@ -12,7 +12,7 @@ OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及 ## 获取源码概述 -本文档将介绍如何获取OpenHarmony源码并说明OpenHarmony的源码目录结构。OpenHarmony的代码以[组件](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/hpm-part/Readme-CN.md)的形式开放,开发者可以通过如下其中一种方式获取: +本文档将介绍如何获取OpenHarmony源码并说明OpenHarmony的源码目录结构。OpenHarmony的代码以[组件](../hpm-part/Readme-CN.md)的形式开放,开发者可以通过如下其中一种方式获取: - **获取方式1**:从码云代码仓库获取。通过repo或git工具从代码仓库中下载,此方式可获取最新代码。 @@ -100,7 +100,7 @@ OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及 - **OpenHarmony发布版本代码获取** - OpenHarmony发布版本获取源码方式请参考[Release Notes](https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/Readme.md)。 + OpenHarmony发布版本获取源码方式请参考[Release Notes](../../release-notes/Readme.md)。 ## 获取方式2:从DevEco Marketplace获取 @@ -181,7 +181,7 @@ OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及 为了获得更好的下载性能,您可以选择从以下站点的镜像库获取源码或者对应的解决方案。 -本部分只提供OpenHarmony LTS最新版本和最新发布版本的源码获取方式, 其他版本获取源码方式以及具体版本信息请参考[Release Notes](https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/Readme.md)。 +本部分只提供OpenHarmony LTS最新版本和最新发布版本的源码获取方式, 其他版本获取源码方式以及具体版本信息请参考[Release Notes](../../release-notes/Readme.md)。 **表1** 获取源码路径 @@ -200,7 +200,7 @@ OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及 | Hi3861解决方案(二进制) | 3.2 Beta1 | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Beta1/hispark_pegasus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Beta1/hispark_pegasus.tar.gz.sha256) | | Hi3516解决方案-LiteOS(二进制) | 3.2 Beta1 | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Beta1/hispark_taurus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Beta1/hispark_taurus.tar.gz.sha256) | | Hi3516解决方案-Linux(二进制) | 3.2 Beta1 | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Beta1/hispark_taurus_linux.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Beta1/hispark_taurus_linux.tar.gz.sha256) | -| RELEASE-NOTES | 3.2 Beta1 | [站点](https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md) | - | +| RELEASE-NOTES | 3.2 Beta1 | [站点](../../release-notes/OpenHarmony-v3.2-beta1.md) | - | | **编译工具链** | **版本信息** | **下载站点** | **SHA256校验码** | | 编译工具链获取清单 | - | [站点](https://repo.huaweicloud.com/openharmony/os/2.0/tool_chain/) | - | diff --git a/zh-cn/device-dev/kernel/kernel-mini-basic-ipc-queue.md b/zh-cn/device-dev/kernel/kernel-mini-basic-ipc-queue.md index 8ee81f8ae61a503796f4710da3d7602c1fd3631f..16178ecadabea0217f49780744c8d272bc39d590 100644 --- a/zh-cn/device-dev/kernel/kernel-mini-basic-ipc-queue.md +++ b/zh-cn/device-dev/kernel/kernel-mini-basic-ipc-queue.md @@ -215,7 +215,7 @@ UINT32 ExampleQueue(VOID) printf("create queue failure, error: %x\n", ret); } - printf("create the queue succes.\n"); + printf("create the queue success.\n"); LOS_TaskUnlock(); return ret; } diff --git a/zh-cn/device-dev/kernel/kernel-mini-extend-dynamic-loading.md b/zh-cn/device-dev/kernel/kernel-mini-extend-dynamic-loading.md index feff1561c57d548749c17239b703240441b24033..22a9c5443e3a6bff91be15c204c33d583e757aba 100644 --- a/zh-cn/device-dev/kernel/kernel-mini-extend-dynamic-loading.md +++ b/zh-cn/device-dev/kernel/kernel-mini-extend-dynamic-loading.md @@ -96,3 +96,11 @@ Program Headers: 4. “-z max-page-size=4”链接选项:二进制文件中可加载段的对齐字节数为4,可节约内存,可用于动态库。 5. “-mcpu=”需要指定对应的cpu架构。 + + +## 约束 + + +- 不支持应用程序加载,只支持共享库加载。 +- 待加载的共享库不能依赖编译器中的libc库及其他共享库,只能依赖内核提供的对外接口(由导出的符号表提供)。 +- 依赖交叉编译器及文件系统。 \ No newline at end of file diff --git a/zh-cn/device-dev/kernel/kernel-small-basic-trans-user-signal.md b/zh-cn/device-dev/kernel/kernel-small-basic-trans-user-signal.md index a2f3244ecbfe50f54b0eb9808f580a1afd716d22..aaa1f061537203ee243ba8ce14556ac89c4d52d0 100644 --- a/zh-cn/device-dev/kernel/kernel-small-basic-trans-user-signal.md +++ b/zh-cn/device-dev/kernel/kernel-small-basic-trans-user-signal.md @@ -44,7 +44,7 @@ > > 发送信号: > -> a. 进程接收信号存在默认行为,单不支持POSIX标准所给出的STOP及COTINUE、COREDUMP功能。 +> a. 进程接收信号存在默认行为,单不支持POSIX标准所给出的STOP及CONTINUE、COREDUMP功能。 > > b. 进程无法屏蔽SIGSTOP、SIGKILL、SIGCONT信号。 > diff --git a/zh-cn/device-dev/kernel/kernel-small-bundles-system.md b/zh-cn/device-dev/kernel/kernel-small-bundles-system.md index 4b75ad05591aac01d8bdcf3957702469a4e70d2c..8037e5e81d9306b3cea7d0c2881be289a387ab9f 100644 --- a/zh-cn/device-dev/kernel/kernel-small-bundles-system.md +++ b/zh-cn/device-dev/kernel/kernel-small-bundles-system.md @@ -52,8 +52,8 @@ Syscall Handler的具体实现在kernel/liteos_a/syscall/los_syscall.c中OsArmA3 #define __NR_pthread_set_detach (__NR_OHOS_BEGIN + 0) #define __NR_pthread_join (__NR_OHOS_BEGIN + 1) #define __NR_pthread_deatch (__NR_OHOS_BEGIN + 2) - #define __NR_creat_user_thread (__NR_OHOS_BEGIN + 3) - #define __NR_processcreat (__NR_OHOS_BEGIN + 4) + #define __NR_create_user_thread (__NR_OHOS_BEGIN + 3) + #define __NR_processcreate (__NR_OHOS_BEGIN + 4) #define __NR_processtart (__NR_OHOS_BEGIN + 5) #define __NR_printf (__NR_OHOS_BEGIN + 6) #define __NR_dumpmemory (__NR_OHOS_BEGIN + 13) @@ -98,8 +98,8 @@ Syscall Handler的具体实现在kernel/liteos_a/syscall/los_syscall.c中OsArmA3 #define __NR_pthread_set_detach (__NR_OHOS_BEGIN + 0) #define __NR_pthread_join (__NR_OHOS_BEGIN + 1) #define __NR_pthread_deatch (__NR_OHOS_BEGIN + 2) - #define __NR_creat_user_thread (__NR_OHOS_BEGIN + 3) - #define __NR_processcreat (__NR_OHOS_BEGIN + 4) + #define __NR_create_user_thread (__NR_OHOS_BEGIN + 3) + #define __NR_processcreate (__NR_OHOS_BEGIN + 4) #define __NR_processtart (__NR_OHOS_BEGIN + 5) #define __NR_printf (__NR_OHOS_BEGIN + 6) #define __NR_dumpmemory (__NR_OHOS_BEGIN + 13) diff --git a/zh-cn/device-dev/kernel/kernel-small-debug-shell-cmd-sem.md b/zh-cn/device-dev/kernel/kernel-small-debug-shell-cmd-sem.md index 78725d748293c1818f84e1dfef14fe06d15983e2..bdcf23dbcf131ab20306089829c72c997cea2d45 100644 --- a/zh-cn/device-dev/kernel/kernel-small-debug-shell-cmd-sem.md +++ b/zh-cn/device-dev/kernel/kernel-small-debug-shell-cmd-sem.md @@ -18,7 +18,7 @@ sem [_ID__ / fulldata_] | 参数 | 参数说明 | 取值范围 | | -------- | -------- | -------- | | ID | 信号量ID。 | [0, 1023]或[0x0, 0x3FF] | -| fulldata | 查询所有在用的信号量信息,打印信息包括如下:SemID, Count, Original Count, Creater TaskEntry, Last Access Time。 | N/A | +| fulldata | 查询所有在用的信号量信息,打印信息包括如下:SemID, Count, Original Count, Creator TaskEntry, Last Access Time。 | N/A | ## 使用指南 @@ -84,7 +84,7 @@ OHOS # sem ``` OHOS # sem fulldata Used Semaphore List: - SemID Count OriginalCount Creater(TaskEntry) LastAccessTime + SemID Count OriginalCount Creator(TaskEntry) LastAccessTime ------ ------ ------------- ------------------ -------------- 0xb 0x0 0x0 0x404978fc 0xa1 0xc 0x0 0x0 0x404978fc 0xa1 @@ -120,5 +120,5 @@ Used Semaphore List: | SemID | 信号量ID。 | | Count | 信号量使用数。 | | OriginalCount | 信号量原始计数。 | -| Creater | 信号量的创建线程的入口函数地址。 | +| Creator | 信号量的创建线程的入口函数地址。 | | LastAccessTime | 上次访问时间。 | diff --git a/zh-cn/device-dev/kernel/kernel-small-debug-trace.md b/zh-cn/device-dev/kernel/kernel-small-debug-trace.md index 167ca70e5fd6787151f06833c00738b2682deaf5..74e963ab7e637de910d6141a8ad45d0f8a40f8d0 100644 --- a/zh-cn/device-dev/kernel/kernel-small-debug-trace.md +++ b/zh-cn/device-dev/kernel/kernel-small-debug-trace.md @@ -137,7 +137,7 @@ LiteOS-A内核的Trace模块提供下面几种功能,接口详细信息可以 分别对应Trace启动(LOS_TraceStart)、停止(LOS_TraceStop)、清除记录(LOS_TraceReset)、dump记录(LOS_TraceRecordDump)、设置事件过滤掩码(LOS_TraceEventMaskSet) -具体的使用方法参见[用户态编程实例](https://gitee.com/openharmony/docs/blob/70744e1e0e34d66e11108a00c8db494eea49dd02/zh-cn/device-dev/kernel/kernel-small-debug-trace.md#section4.2.2)。 +具体的使用方法参见[用户态编程实例](kernel-small-debug-trace.md#用户态)。 ## 开发指导 diff --git a/zh-cn/device-dev/kernel/kernel-small-memory-lms.md b/zh-cn/device-dev/kernel/kernel-small-memory-lms.md index 145f6c59875a01312bbbd1a2a34fd5b029810a8e..f818c3bdf349ca14ddf83ba3bf6fdae3ce314436 100644 --- a/zh-cn/device-dev/kernel/kernel-small-memory-lms.md +++ b/zh-cn/device-dev/kernel/kernel-small-memory-lms.md @@ -366,7 +366,7 @@ int main(int argc, char * const * argv) Heap buffer overflow error detected! Illegal READ address at: [0x1f8b3edf] Shadow memory address: [0x3d34d3ed : 6] Shadow memory value: [2] -Accessable heap addr 0 +Accessible heap addr 0 Heap red zone 2 Heap freed buffer 3 Dump info around address [0x1f8b3edf]: @@ -391,7 +391,7 @@ Backtrace() returned 5 addresses Use after free error detected! Illegal Double free address at: [0x1f8b3ee0] Shadow memory address: [0x3d34d3ee : 0] Shadow memory value: [3] -Accessable heap addr 0 +Accessible heap addr 0 Heap red zone 2 Heap freed buffer 3 Dump info around address [0x1f8b3ee0]: diff --git a/zh-cn/device-dev/kernel/kernel-standard-patch.md b/zh-cn/device-dev/kernel/kernel-standard-patch.md index 8f9e30ec2f37a35873fbe3a9c7314a79d2580d76..71d41ca8257764b8a3cd43801511ffe7e10ff840 100644 --- a/zh-cn/device-dev/kernel/kernel-standard-patch.md +++ b/zh-cn/device-dev/kernel/kernel-standard-patch.md @@ -3,7 +3,7 @@ 1. 合入HDF补丁 在kernel/linux/build仓中,按照kernel.mk中HDF的补丁合入方法,合入不同内核版本对应的HDF内核补丁: ``` - $(OHOS_BUILD_HOME)/drivers/adapter/khdf/linux/patch_hdf.sh $(OHOS_BUILD_HOME) $(KERNEL_SRC_TMP_PATH) $(HDF_PATCH_FILE) + $(OHOS_BUILD_HOME)/drivers/hdf_core/adapter/khdf/linux/patch_hdf.sh $(OHOS_BUILD_HOME) $(KERNEL_SRC_TMP_PATH) $(KERNEL_PATCH_PATH) $(DEVICE_NAME) ``` 2. 合入芯片平台驱动补丁 diff --git a/zh-cn/device-dev/porting/porting-asr582x-combo-demo.md b/zh-cn/device-dev/porting/porting-asr582x-combo-demo.md index f87d9c1786d8e19dbfb93156d93d8be5c1f4a986..1ab5b74bf430dbbda35319a7c374fb8dcbf3a1e0 100755 --- a/zh-cn/device-dev/porting/porting-asr582x-combo-demo.md +++ b/zh-cn/device-dev/porting/porting-asr582x-combo-demo.md @@ -473,7 +473,7 @@ LOSCFG_DRIVERS_HDF_PLATFORM=y lwIP组件的源码在`//third_party/lwip`,OpenHarmony在kernel中做了定制化,`//kernel/liteos_m/components/net/lwip-2.1`,包括一些接口的重定义,结构体的重定义等。 -移植过程可参考:[lwIP组件适配](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/porting/porting-chip-board-lwip.md) +移植过程可参考:[lwIP组件适配](porting-chip-board-lwip.md) 本案例在config.json中设置lwIP的路径如下: diff --git a/zh-cn/device-dev/porting/porting-chip-board-bundle.md b/zh-cn/device-dev/porting/porting-chip-board-bundle.md index 6c40374e471a03939674b66328c2b74c28dfa0ac..1fd6ca469bbdf2529b3bbe4d01ccf7f3648755b9 100644 --- a/zh-cn/device-dev/porting/porting-chip-board-bundle.md +++ b/zh-cn/device-dev/porting/porting-chip-board-bundle.md @@ -10,7 +10,7 @@ 1. 拷贝include/mbedtls/config.h到ports目录下,并修改打开MBEDTLS_ENTROPY_HARDWARE_ALT开关。 2. 在ports目录下创建entropy_poll_alt.c文件include并实现entropy_poll.h中的硬件随机数接口 3. 在BUILD.gn中的mbedtls_sources中增加刚才适配的entropy_poll_alt.c的路径 - 4. 在BIULD.gn中的lite_library("mbedtls_static")中增加一行MBEDTLS_CONFIG_FILE指定新配置文件的位置 + 4. 在BUILD.gn中的lite_library("mbedtls_static")中增加一行MBEDTLS_CONFIG_FILE指定新配置文件的位置 ``` lite_library("mbedtks_static") { diff --git a/zh-cn/device-dev/porting/porting-chip-prepare-process.md b/zh-cn/device-dev/porting/porting-chip-prepare-process.md index 503972d4e72da5945b93d678c71140707d70f6be..eee8899860e35df47baad80ef1697cf9d04b26f3 100644 --- a/zh-cn/device-dev/porting/porting-chip-prepare-process.md +++ b/zh-cn/device-dev/porting/porting-chip-prepare-process.md @@ -44,7 +44,7 @@ # Note: The default toolchain is "ohos-clang". It's not mandatory if you use the default toochain. board_toolchain = "gcc-arm-none-eabi" - # The toolchain path instatlled, it's not mandatory if you have added toolchian path to your ~/.bashrc. + # The toolchain path installed, it's not mandatory if you have added toolchain path to your ~/.bashrc. board_toolchain_path = rebase_path("//prebuilts/gcc/linux-x86/arm/gcc-arm-none-eabi/bin", root_build_dir) diff --git a/zh-cn/device-dev/porting/porting-linux-kernel.md b/zh-cn/device-dev/porting/porting-linux-kernel.md index 591ff5f3e6b15599b44b82578f81cd255d1d1a4e..14dba59433becdc7d7b325e603a1600270428c2c 100644 --- a/zh-cn/device-dev/porting/porting-linux-kernel.md +++ b/zh-cn/device-dev/porting/porting-linux-kernel.md @@ -96,7 +96,7 @@ OH内核态层 = OH Linux内核 + OH内核态特性(可选特性或者必选 # 配置编译环境,使用工程项目自带的clang export PATH=$PROJ_ROOT/prebuilts/clang/ohos/linux-x86_64/llvm/bin:$PROJ_ROOT/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/bin/:$PATH export MAKE_OPTIONS="ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- CC=clang HOSTCC=clang" - export PRODUCT_PATH=vendor/hisilicon/hispark_taurus_standard + export PRODUCT_PATH=vendor/hisilicon/hispark_taurus_linux ``` 3. 注释掉clang不识别的flag。 @@ -144,15 +144,15 @@ obj-$(CONFIG_HIEVENT) += hievent/ 1. 打HDF补丁。 在Linux内核打HDF补丁时,执行补丁shell脚本合入HDF补丁。 - 1. 配置HDF补丁脚本的三个变量参数。 + 1. 配置HDF补丁脚本的四个变量参数。 2. 获取patch_hdf.sh脚本。 - 3. 执行patch_hdf.sh脚本依次传入三个变量参数。 + 3. 执行patch_hdf.sh脚本依次传入四个变量参数。 - patch_hdf.sh脚本三个参数含义为:第一个入参为工程根目录路径,第二入参为内核目录路径,第三个入参为hdf补丁文件。 + patch_hdf.sh脚本四个参数含义为:第一个入参为工程根目录路径,第二入参为内核目录路径,第三个入参为内核版本路径,第四个参数是当前设备名。 ``` - ./patch_hdf.sh [工程根目录路径] [内核目录路径] [hdf补丁文件] + ./patch_hdf.sh [工程根目录路径] [内核目录路径] [内核补丁路径] [设备名] ``` 以树莓派3b为示例介绍: @@ -163,7 +163,8 @@ obj-$(CONFIG_HIEVENT) += hievent/ PROJ_ROOT/drivers/adapter/khdf/linux/patch_hdf.sh \ PROJ_ROOT # 指定工程根目录路径 \ PROJ_ROOT/out/KERNEL_OBJ/kernel/src_tmp/linux-rpi3b # 打补丁的内核目录路径 \ - PROJ_ROOT/kernel/linux/patches/linux-4.19/hi3516dv300_patch/hdf.patch # HDF补丁文件 + PROJ_ROOT/kernel/linux/patches/linux-4.19 # 内核补丁路径.\ + hi3516dv300 # 设备名. ``` 2. 配置config。 @@ -222,7 +223,7 @@ HDF(Hardware Driver Foundation)自测试用例,用于测试HDF框架和外 **用例编译和测试方法** - 通过[hdc_std工具](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-toolchain-hdc-guide.md)把用例执行文件推送到设备中,然后执行用例即可,操作步骤如下: + 通过[hdc_std工具](../subsystems/subsys-toolchain-hdc-guide.md)把用例执行文件推送到设备中,然后执行用例即可,操作步骤如下: 1. 编译hdf测试用例。 2. 用hdc_std工具推送测试文件到设备中。 @@ -243,7 +244,7 @@ HDF(Hardware Driver Foundation)自测试用例,用于测试HDF框架和外 2. 将测试文件移动到目标移植设备上(以树莓派为例)。 - 方法一:使用[hdc_std工具](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-toolchain-hdc-guide.md)。 + 方法一:使用[hdc_std工具](../subsystems/subsys-toolchain-hdc-guide.md)。 1. 先在树莓派里新建data/test目录。 diff --git a/zh-cn/device-dev/porting/porting-smallchip-prepare-building.md b/zh-cn/device-dev/porting/porting-smallchip-prepare-building.md index 9fe8e43aff7baef85f9054fd49f5899d17c0a351..1a5c4104231706bbf1e1d133e18ae82504cac47f 100644 --- a/zh-cn/device-dev/porting/porting-smallchip-prepare-building.md +++ b/zh-cn/device-dev/porting/porting-smallchip-prepare-building.md @@ -86,7 +86,7 @@ sudo apt-get install gcc-arm-linux-gnueabi # Note: The default toolchain is "ohos-clang". It's not mandatory if you use the default toochain. board_toolchain = "mips-linux-gnu-gcc" - # The toolchain path instatlled, it's not mandatory if you have added toolchian path to your ~/.bashrc. + # The toolchain path installed, it's not mandatory if you have added toolchain path to your ~/.bashrc. board_toolchain_path = rebase_path("//prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/bin", root_build_dir) diff --git a/zh-cn/device-dev/porting/porting-stm32f407-on-minisystem-eth.md b/zh-cn/device-dev/porting/porting-stm32f407-on-minisystem-eth.md index 14632f15e7788c259e65f534bf18f905a5009e31..14751be9e570c1358310f745909f635a03532f7e 100644 --- a/zh-cn/device-dev/porting/porting-stm32f407-on-minisystem-eth.md +++ b/zh-cn/device-dev/porting/porting-stm32f407-on-minisystem-eth.md @@ -92,7 +92,7 @@ vendor └── niobe407 --- 产品名字:niobe407 ``` -获取[OpenHarmony源码](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md),根据上述目录规划,创建相应文件夹。 +获取[OpenHarmony源码](../get-code/sourcecode-acquire.md),根据上述目录规划,创建相应文件夹。 ### 预编译适配 @@ -714,7 +714,7 @@ board_ld_flags :链接选项,与Makefile中的LDFLAGS变量对应。 ### 内核基础功能适配 -内核基础功能适配项包括:**[中断管理](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/kernel/kernel-mini-basic-interrupt.md)**、**[任务管理](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/kernel/kernel-mini-basic-task.md)**、**[内存管理](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/kernel/kernel-mini-basic-memory.md)**、**[内核通信机制](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/kernel/kernel-mini-basic-ipc.md)**、**[时间管理](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/kernel/kernel-basic-mini-time.md)**、**[软件定时器](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/kernel/kernel-mini-basic-soft.md)**,可以参考对应链接中的编程实例进行内核基础功能验证。在验证的过程中发现问题,针对相应问题进行具体的适配。 +内核基础功能适配项包括:**[中断管理](../kernel/kernel-mini-basic-interrupt.md)**、**[任务管理](../kernel/kernel-mini-basic-task.md)**、**[内存管理](../kernel/kernel-mini-basic-memory.md)**、**[内核通信机制](../kernel/kernel-mini-basic-ipc.md)**、**[时间管理](../kernel/kernel-basic-mini-time.md)**、**[软件定时器](../kernel/kernel-mini-basic-soft.md)**,可以参考对应链接中的编程实例进行内核基础功能验证。在验证的过程中发现问题,针对相应问题进行具体的适配。 从上一节中打印信息输出时间间隔可以看出,`LOS_TaskDelay`函数的延时时间不准确,我们可以在`target_config.h`中定义如下宏进行内核时钟适配: @@ -1184,7 +1184,7 @@ _hdf_drivers_end = .; #### 添加XTS子系统 -`XTS`测试参考资料见[xts参考资料](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-xts-guide.md),进行`XTS`子系统适配需要添加`xts_acts`与`xts_tools`组件,直接在`config.json`配置即可,配置如下: +`XTS`测试参考资料见[xts参考资料](../subsystems/subsys-xts-guide.md),进行`XTS`子系统适配需要添加`xts_acts`与`xts_tools`组件,直接在`config.json`配置即可,配置如下: { "subsystem": "xts", diff --git a/zh-cn/device-dev/porting/porting-stm32mp15xx-on-smallsystem.md b/zh-cn/device-dev/porting/porting-stm32mp15xx-on-smallsystem.md index 98f4beddd2b09d74ef26d1a2d7f0dab1cb72efae..7d0f7dc4f2a21d18a4180bd438bdb57e69441adb 100644 --- a/zh-cn/device-dev/porting/porting-stm32mp15xx-on-smallsystem.md +++ b/zh-cn/device-dev/porting/porting-stm32mp15xx-on-smallsystem.md @@ -122,7 +122,7 @@ vendor 内核移植需要完成`LiteOS-A Kconfig`适配、`gn`的编译构建和内核启动最小适配。 -详细移植步骤参考:[LiteOS-A内核移植](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/porting/porting-smallchip-kernel-a.md) +详细移植步骤参考:[LiteOS-A内核移植](porting-smallchip-kernel-a.md) ### Kconfig适配 1. 在//device/board/bearpi/bearpi_hm_micro/liteos_a/drivers/Kconfig中添加芯片、产品名称、厂商名称相关配置。 ``` @@ -266,7 +266,7 @@ vendor } ``` ### 内核启动适配 -1. 在//device/board/bearpi/bearpi_hm_micro/liteos_a/board/os_adapt.c中添加以下内核启动相关代码,详细解释参考[LiteOS-A内核移植](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/porting/porting-smallchip-kernel-a.md)。 +1. 在//device/board/bearpi/bearpi_hm_micro/liteos_a/board/os_adapt.c中添加以下内核启动相关代码,详细解释参考[LiteOS-A内核移植](porting-smallchip-kernel-a.md)。 ``` ... void SystemInit(void) diff --git a/zh-cn/device-dev/porting/porting-thirdparty-cmake.md b/zh-cn/device-dev/porting/porting-thirdparty-cmake.md index 043e797410d3c3b92a775af0c410d53ab7826f62..94b137955ecd3608b9d1e3ab31ee257d2a0d4d64 100644 --- a/zh-cn/device-dev/porting/porting-thirdparty-cmake.md +++ b/zh-cn/device-dev/porting/porting-thirdparty-cmake.md @@ -219,7 +219,7 @@ CMake方式可通过指定工具链进行交叉编译,修改并编译该库, #toolchain:follow up-layer,depend on $ohos_build_compiler if (ohos_build_compiler == "clang") { - CMAKE_TOOLCHAIN_FLAG = "-DOHOS_SYSROOT_PATH=${ohos_root_path}prebuilts/lite/sysroot/" + CMAKE_TOOLCHAIN_FLAG = "-DOHOS_SYSROOT_PATH=${root_out_dir}sysroot" } else { CMAKE_TOOLCHAIN_FLAG = "" } diff --git a/zh-cn/device-dev/porting/porting-thirdparty-makefile.md b/zh-cn/device-dev/porting/porting-thirdparty-makefile.md index 5d01193f8c7cf62e190cbbf7e326e4ab776d2f2b..1a068c62af7a74c9db2591b9112577685d236dd7 100644 --- a/zh-cn/device-dev/porting/porting-thirdparty-makefile.md +++ b/zh-cn/device-dev/porting/porting-thirdparty-makefile.md @@ -173,9 +173,9 @@ if (ohos_build_thirdparty_migrated_from_fuchisa == true) { TEST_ENABLE = "YES" if (TEST_ENABLE == "YES") { - MAKE_COMMAND = "make test OHOS_SYSROOT_PATH=${ohos_root_path}prebuilts/lite/sysroot/" + MAKE_COMMAND = "make test OHOS_SYSROOT_PATH=${root_out_dir}sysroot/" } else { - MAKE_COMMAND = "make OHOS_SYSROOT_PATH=${ohos_root_path}prebuilts/lite/sysroot/" + MAKE_COMMAND = "make OHOS_SYSROOT_PATH=${root_out_dir}sysroot/" } ``` diff --git a/zh-cn/device-dev/quick-start/quickstart-build.md b/zh-cn/device-dev/quick-start/quickstart-build.md index 0cc4275aabdaf7e000ffd04c181ab7cbf43aa3db..4e2363163cbd3c5577fd3d245e29279dc042564c 100644 --- a/zh-cn/device-dev/quick-start/quickstart-build.md +++ b/zh-cn/device-dev/quick-start/quickstart-build.md @@ -1,41 +1,40 @@ # 编译形态整体说明 - -**编译构建支持的产品列表** +**编译构建支持的产品列表** (点击链接可知道具体产品配置及其相关差异) | 编译形态 | 开发板 | 主芯片 | 内核 | 系统类型 | | ----------------------------- | --------------- | ----------- | ----------- | ----------- | -| neptune100 | neptune100 | winnermicro | liteos_m | mini | -| rk3568 | rk3568 | rockchip | linux | standard | -| rk3568_mini_system | rk3568 | rockchip | linux | standard | -| bearpi_hm_micro | bearpi_hm_micro | stm32mp1xx | liteos_a | small | -| bearpi_hm_nano | bearpi_hm_nano | hi3861v100 | liteos_m | mini | -| wifiiot_hispark_pegasus | hispark_pegasus | hi3861v100 | liteos_m | mini | -| ipcamera_hispark_aries | hispark_aries | hi3518ev300 | liteos_a | small | -| ipcamera_hispark_taurus | hispark_taurus | hi3516dv300 | liteos_a | small | -| ipcamera_hispark_taurus_linux | hispark_taurus | hi3516dv300 | linux | small | -| hispark_taurus_standard | hispark_taurus | hi3516dv300 | linux | standard | -| watchos | hispark_taurus | hi3516dv300 | linux | standard | -| hispark_phoenix | hispark_phoenix | hi3751v350 | linux | standard | -| hispark_taurus_mini_system | hispark_taurus | hi3516dv300 | liteos_a | mini | -| hispark_pegasus_mini_system | hispark_pegasus | hi3861v100 | liteos_m | mini | -| gr5515_sk_iotlink_demo | gr5515_sk | gr551x | liteos_m | mini | -| gr5515_sk_xts_demo | gr5515_sk | gr551x | liteos_m | mini | -| wifi_demo | dev_wifi_a | asr582x | liteos_m | mini | -| xts_demo | dev_wifi_a | asr582x | liteos_m | mini | -| display_demo | v200zr | bes2600 | liteos_m | mini | -| xts_demo | v200zr | bes2600 | liteos_m | mini | -| iotlink_demo | v200zr | bes2600 | liteos_m | mini | -| mini_distributed_music_player | v200zr | bes2600 | liteos_m | mini | -| niobe407 | niobe407 | stm32f4xx | liteos_m | mini | -| qemu_mini_system_demo | arm_mps2_an386 | qemu | liteos_m | mini | -| qemu_cksy_mini_system_demo | SmartL_E802 | qemu | liteos_m | mini | -| qemu_cm55_mini_system_demo | arm_mps3_an547 | qemu | liteos_m | mini | -| qemu_xtensa_mini_system_demo | esp32 | qemu | liteos_m | mini | -| qemu_riscv_mini_system_demo | ricsv32_virt | qemu | liteos_m | mini | -| qemu_ca7_mini_system_demo | arm_virt | qemu | liteos_a | small | -| qemu_small_system_demo | arm_virt | qemu | liteos_a | small | -| qemu-arm-linux-min | qemu-arm-linux | qemu | linux | standard | -| qemu-arm-linux-headless | qemu-arm-linux | qemu | linux | standard | -| iotlink_demo | cst85_wblink | chipsea | liteos_m | mini | -| dsoftbus_demo | cst85_wblink | chipsea | liteos_m | mini | -| xts_demo | cst85_wblink | chipsea | liteos_m | mini | +| [neptune100](https://gitee.com/openharmony/vendor_hihope/blob/master/neptune_iotlink_demo/config.json) | neptune100 | winnermicro | liteos_m | mini | +| [rk3568](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/config.json) | rk3568 | rockchip | linux | standard | +| [rk3568_mini_system](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568_mini_system/config.json) | rk3568 | rockchip | linux | standard | +| [bearpi_hm_micro](https://gitee.com/openharmony/vendor_bearpi/blob/master/bearpi_hm_micro/config.json) | bearpi_hm_micro | stm32mp1xx | liteos_a | small | +| [bearpi_hm_nano](https://gitee.com/openharmony/vendor_bearpi/blob/master/bearpi_hm_nano/config.json) | bearpi_hm_nano | hi3861v100 | liteos_m | mini | +| [wifiiot_hispark_pegasus](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_pegasus/config.json) | hispark_pegasus | hi3861v100 | liteos_m | mini | +| [ipcamera_hispark_aries](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_aries/config.json) | hispark_aries | hi3518ev300 | liteos_a | small | +| [ipcamera_hispark_taurus](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_taurus/config.json) | hispark_taurus | hi3516dv300 | liteos_a | small | +| [ipcamera_hispark_taurus_linux](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_taurus_linux/config.json) | hispark_taurus | hi3516dv300 | linux | small | +| [hispark_taurus_standard](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_taurus_standard/config.json) | hispark_taurus | hi3516dv300 | linux | standard | +| [watchos](https://gitee.com/openharmony/vendor_hisilicon/blob/master/watchos/config.json) | hispark_taurus | hi3516dv300 | linux | standard | +| [hispark_phoenix](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_phoenix/config.json) | hispark_phoenix | hi3751v350 | linux | standard | +| [hispark_taurus_mini_system](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_taurus_mini_system/config.json) | hispark_taurus | hi3516dv300 | liteos_a | mini | +| [hispark_pegasus_mini_system](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_pegasus_mini_system/config.json) | hispark_pegasus | hi3861v100 | liteos_m | mini | +| [gr5515_sk_iotlink_demo](https://gitee.com/openharmony/vendor_goodix/blob/master/gr5515_sk_iotlink_demo/config.json) | gr5515_sk | gr551x | liteos_m | mini | +| [gr5515_sk_xts_demo](https://gitee.com/openharmony/vendor_goodix/blob/master/gr5515_sk_xts_demo/config.json) | gr5515_sk | gr551x | liteos_m | mini | +| [wifi_demo](https://gitee.com/openharmony/vendor_asrmicro/blob/master/wifi_demo/config.json) | dev_wifi_a | asr582x | liteos_m | mini | +| [xts_demo](https://gitee.com/openharmony/vendor_asrmicro/blob/master/xts_demo/config.json) | dev_wifi_a | asr582x | liteos_m | mini | +| [display_demo](https://gitee.com/openharmony/vendor_bestechnic/blob/master/display_demo/config.json) | v200zr | bes2600 | liteos_m | mini | +| [xts_demo](https://gitee.com/openharmony/vendor_bestechnic/blob/master/xts_demo/config.json) | v200zr | bes2600 | liteos_m | mini | +| [iotlink_demo](https://gitee.com/openharmony/vendor_bestechnic/blob/master/iotlink_demo/config.json) | v200zr | bes2600 | liteos_m | mini | +| [mini_distributed_music_player](https://gitee.com/openharmony/vendor_bestechnic/blob/master/mini_distributed_music_player/config.json) | v200zr | bes2600 | liteos_m | mini | +| [niobe407](https://gitee.com/openharmony/vendor_talkweb/blob/master/niobe407/config.json) | niobe407 | stm32f4xx | liteos_m | mini | +| [qemu_mini_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_mini_system_demo/config.json) | arm_mps2_an386 | qemu | liteos_m | mini | +| [qemu_cksy_mini_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_csky_mini_system_demo/config.json) | SmartL_E802 | qemu | liteos_m | mini | +| [qemu_cm55_mini_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_cm55_mini_system_demo/config.json) | arm_mps3_an547 | qemu | liteos_m | mini | +| [qemu_xtensa_mini_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_xtensa_mini_system_demo/config.json) | esp32 | qemu | liteos_m | mini | +| [qemu_riscv_mini_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_riscv32_mini_system_demo/config.json) | ricsv32_virt | qemu | liteos_m | mini | +| [qemu_ca7_mini_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_ca7_mini_system_demo/config.json) | arm_virt | qemu | liteos_a | small | +| [qemu_small_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_small_system_demo/config.json) | arm_virt | qemu | liteos_a | small | +| [qemu_arm_linux_min](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_arm_linux_min/config.json) | qemu-arm-linux | qemu | linux | standard | +| [qemu_arm_linux_headless](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_arm_linux_headless/config.json) | qemu-arm-linux | qemu | linux | standard | +| [iotlink_demo](https://gitee.com/openharmony/vendor_chipsea/blob/master/iotlink_demo/config.json) | cst85_wblink | chipsea | liteos_m | mini | +| [dsoftbus_demo](https://gitee.com/openharmony/vendor_chipsea/blob/master/dsoftbus_demo/config.json) | cst85_wblink | chipsea | liteos_m | mini | +| [xts_demo](https://gitee.com/openharmony/vendor_chipsea/blob/master/xts_demo/config.json) | cst85_wblink | chipsea | liteos_m | mini | diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-lite-overview.md b/zh-cn/device-dev/quick-start/quickstart-ide-lite-overview.md index 9a3a8583b784529ace28d09502f653897fd1cb6a..253db99a5d4911f27d38845c50346af85ca022e2 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-lite-overview.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-lite-overview.md @@ -10,7 +10,7 @@ OpenHarmony轻量和小型系统适用于内存较小的IOT设备(参考内存 - IDE方式:完全采用IDE(DevEco Device Tool)进行一站式开发,编译依赖工具的安装及编译、烧录、运行都通过IDE进行操作。 - 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。 - OpenHarmony还为开发者提供了[Docker环境](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 + OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 本文采用DevEco Device Tool进行一站式开发介绍,习惯使用命令行的开发者可参考[轻量和小型系统快速入门(安装包方式)](../quick-start/quickstart-lite-overview.md)。 diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-burn.md b/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-burn.md index 365686ad4de7fb2c59cbcb4a4e8d5000a1868de4..d151adb40ebe43af1d1aed8ed86ed8830b9305b2 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-burn.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-burn.md @@ -8,7 +8,7 @@ Hi3516DV300的镜像烧录通过Winodow环境进行烧录,开发者启动烧 Hi3516DV300开发板小型系统的烧录方式包括USB烧录、网口烧录两种方式,本文采用USB方式进行烧录。 -1. 请连接好电脑和待烧录开发板,需要连接USB口和串口,具体可参考[Hi3516DV300开发板介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md)。 +1. 请连接好电脑和待烧录开发板,需要连接USB口和串口,具体可参考[Hi3516DV300开发板介绍](quickstart-lite-introduction-hi3516.md)。 2. 根据[Hi3516DV300开发板串口驱动安装指导](https://gitee.com/link?target=https%3A%2F%2Fdevice.harmonyos.com%2Fcn%2Fdocs%2Fdocumentation%2Fguide%2Fhi3516_hi3518-drivers-0000001050743695)、[Hi3516DV300开发板USB驱动安装指导](https://device.harmonyos.com/cn/docs/documentation/guide/usb_driver-0000001058690393)安装USB驱动及USB转串口的驱动。若您的设备中已安装此驱动,请忽略该步骤。 diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-helloworld.md b/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-helloworld.md index ef824fc8fb8e6f7c8d7bf8cd619d1a7a34d107da..8bdbbb113e4ab52556ce292865b84c90e1620402 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-helloworld.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-helloworld.md @@ -55,7 +55,7 @@ applications/sample/hello ``` 3. 添加新组件。 - 修改文件**build/lite/components/applications.json**,添加组件hello_world_app的配置,如下所示为applications.json文件片段,"\#\#start\#\#"和"\#\#end\#\#"之间为新增配置("\#\#start\#\#"和"\#\#end\#\#"仅用来标识位置,添加完配置后删除这两行): + 修改文件**build/lite/components/communication.json**,添加组件hello_world_app的配置,如下所示为communication.json文件片段,"\#\#start\#\#"和"\#\#end\#\#"之间为新增配置("\#\#start\#\#"和"\#\#end\#\#"仅用来标识位置,添加完配置后删除这两行): ``` diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-burn.md b/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-burn.md index 1215e4ae5e234fe777fdb9eece7362db527168b0..ebdefa00599e7f50ff2ebf3e8a727a83977557d0 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-burn.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-burn.md @@ -8,7 +8,7 @@ Hi3861V100的镜像烧录通过Winodow环境进行烧录,开发者启动烧录 Hi3861V100开发板支持串口烧录方式,在Windows下通过以下步骤进行烧录: -1. 请连接好电脑和待烧录开发板,需要连接USB口,具体可参考[Hi3861V100开发板介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3861.md)。 +1. 请连接好电脑和待烧录开发板,需要连接USB口,具体可参考[Hi3861V100开发板介绍](quickstart-lite-introduction-hi3861.md)。 2. 根据[Hi3861V100开发板串口驱动安装指导](https://gitee.com/link?target=https%3A%2F%2Fdevice.harmonyos.com%2Fcn%2Fdocs%2Fdocumentation%2Fguide%2Fhi3861-drivers-0000001058153433)安装USB转串口的驱动程序。若您的设备中已安装此驱动,请忽略该步骤。 diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-helloworld.md b/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-helloworld.md index 023fca41a0925099ea0a94f119e45545f17cfd27..5d2aec5f49af0895e1b5d985a3331beb4481dc0e 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-helloworld.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-helloworld.md @@ -58,7 +58,7 @@ - include_dirs中指定source所需要依赖的.h文件路径。 4. 添加新组件。 - 修改文件**build/lite/components/applications.json**,添加组件hello_world_app的配置,如下所示为applications.json文件片段,"\#\#start\#\#"和"\#\#end\#\#"之间为新增配置("\#\#start\#\#"和"\#\#end\#\#"仅用来标识位置,添加完配置后删除这两行): + 修改文件**build/lite/components/communication.json**,添加组件hello_world_app的配置,如下所示为communication.json文件片段,"\#\#start\#\#"和"\#\#end\#\#"之间为新增配置("\#\#start\#\#"和"\#\#end\#\#"仅用来标识位置,添加完配置后删除这两行): ``` diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-standard-overview.md b/zh-cn/device-dev/quick-start/quickstart-ide-standard-overview.md index cd40ca543965e0502b4343441e633074491dbb5e..cffc577473ef8d842cc2c13517a113008295d36a 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-standard-overview.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-standard-overview.md @@ -10,7 +10,7 @@ OpenHarmony标准系统适用于参考内存≥128MiB的设备。通过本文, - IDE方式:完全采用IDE(DevEco Device Tool)进行一站式开发,编译依赖工具的安装及编译、烧录、运行都通过IDE进行操作。 - 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。 - OpenHarmony还为开发者提供了[Docker环境](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 + OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 本文采用DevEco Device Tool进行一站式开发介绍,习惯使用命令行的开发者可参考[标准系统快速入门(安装包方式)](quickstart-standard-overview.md)。 diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-standard-running-hi3516-burning.md b/zh-cn/device-dev/quick-start/quickstart-ide-standard-running-hi3516-burning.md index 58fc2954a1b9fa42cd0b82b8388bf0e746e15b42..31cc342d29853acb97c9d7207df8cf18f733cc30 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-standard-running-hi3516-burning.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-standard-running-hi3516-burning.md @@ -10,7 +10,7 @@ Hi3516DV300开发板小型系统的烧录方式包括USB烧录、网口烧录两 > 使用USB烧录方式,在DevEco Device Tool 2.2 Beta2及更高版本中支持。 -1. 请连接好电脑和待烧录开发板,需要连接USB口和串口,具体可参考[Hi3516DV300开发板介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md)。 +1. 请连接好电脑和待烧录开发板,需要连接USB口和串口,具体可参考[Hi3516DV300开发板介绍](quickstart-lite-introduction-hi3516.md)。 2. 根据[Hi3516DV300开发板串口驱动安装指导](https://gitee.com/link?target=https%3A%2F%2Fdevice.harmonyos.com%2Fcn%2Fdocs%2Fdocumentation%2Fguide%2Fhi3516_hi3518-drivers-0000001050743695)、[Hi3516DV300开发板USB驱动安装指导](https://device.harmonyos.com/cn/docs/documentation/guide/usb_driver-0000001058690393)安装USB驱动及USB转串口的驱动。若您的设备中已安装此驱动,请忽略该步骤。 diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-overview.md b/zh-cn/device-dev/quick-start/quickstart-lite-overview.md index f9276588d5b6c1dd5e2638a67f954cd13d79cb80..f6de41cb0e96858a5fb0e75ab17fdab7bf5e9176 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-overview.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-overview.md @@ -9,7 +9,7 @@ OpenHarmony轻量和小型系统适用于内存较小的IOT设备(参考内存 - IDE方式:完全采用IDE(DevEco Device Tool)进行一站式开发,编译依赖工具的安装及编译、烧录、运行都通过IDE进行操作。 -- 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。OpenHarmony还为开发者提供了[Docker环境](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 +- 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 本文采用安装包方式进行介绍,习惯使用DevEco Device Tool的开发者可参考[轻量与小型系统快速入门(IDE方式)](../quick-start/quickstart-ide-lite-overview.md)。 diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-burn.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-burn.md index 7e3b43c82f1fd89907e6157e89f85c01fe8efb75..e5dbb23c0e0a6b73ddcd259482c766c2735a4c2f 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-burn.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-burn.md @@ -32,7 +32,7 @@ Hi3516DV300支持USB烧录、网口烧录和串口烧录三种方式,本文采 完成源码导入后,通过以下步骤进行烧录: -1. 请连接好电脑和待烧录开发板,需要连接USB口和串口,具体可参考[Hi3516DV300开发板介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md)。 +1. 请连接好电脑和待烧录开发板,需要连接USB口和串口,具体可参考[Hi3516DV300开发板介绍](quickstart-lite-introduction-hi3516.md)。 2. 根据[Hi3516DV300开发板串口驱动安装指导](https://gitee.com/link?target=https%3A%2F%2Fdevice.harmonyos.com%2Fcn%2Fdocs%2Fdocumentation%2Fguide%2Fhi3516_hi3518-drivers-0000001050743695)、[Hi3516DV300开发板USB驱动安装指导](https://device.harmonyos.com/cn/docs/documentation/guide/usb_driver-0000001058690393)安装USB驱动及USB转串口的驱动。若您的设备中已安装此驱动,请忽略该步骤。 diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-helloworld.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-helloworld.md index ef824fc8fb8e6f7c8d7bf8cd619d1a7a34d107da..8bdbbb113e4ab52556ce292865b84c90e1620402 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-helloworld.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-helloworld.md @@ -55,7 +55,7 @@ applications/sample/hello ``` 3. 添加新组件。 - 修改文件**build/lite/components/applications.json**,添加组件hello_world_app的配置,如下所示为applications.json文件片段,"\#\#start\#\#"和"\#\#end\#\#"之间为新增配置("\#\#start\#\#"和"\#\#end\#\#"仅用来标识位置,添加完配置后删除这两行): + 修改文件**build/lite/components/communication.json**,添加组件hello_world_app的配置,如下所示为communication.json文件片段,"\#\#start\#\#"和"\#\#end\#\#"之间为新增配置("\#\#start\#\#"和"\#\#end\#\#"仅用来标识位置,添加完配置后删除这两行): ``` diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-burn.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-burn.md index cb2ca5219cc8f8814a85f18147cb9ccef459925f..c281e7aa447c87e77b8f31bc21b6d1279042eb20 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-burn.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-burn.md @@ -33,7 +33,7 @@ Hi3861V100开发板支持串口烧录方式,在Windows下通过以下步骤进 完成源码导入后,通过以下步骤进行烧录: -1. 请连接好电脑和待烧录开发板,需要连接USB口,具体可参考[Hi3861V100开发板介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3861.md)。 +1. 请连接好电脑和待烧录开发板,需要连接USB口,具体可参考[Hi3861V100开发板介绍](quickstart-lite-introduction-hi3861.md)。 2. 根据[Hi3861V100开发板串口驱动安装指导](https://gitee.com/link?target=https%3A%2F%2Fdevice.harmonyos.com%2Fcn%2Fdocs%2Fdocumentation%2Fguide%2Fhi3861-drivers-0000001058153433)安装USB转串口的驱动程序。若您的设备中已安装此驱动,请忽略该步骤。 diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-helloworld.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-helloworld.md index 023fca41a0925099ea0a94f119e45545f17cfd27..5d2aec5f49af0895e1b5d985a3331beb4481dc0e 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-helloworld.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-helloworld.md @@ -58,7 +58,7 @@ - include_dirs中指定source所需要依赖的.h文件路径。 4. 添加新组件。 - 修改文件**build/lite/components/applications.json**,添加组件hello_world_app的配置,如下所示为applications.json文件片段,"\#\#start\#\#"和"\#\#end\#\#"之间为新增配置("\#\#start\#\#"和"\#\#end\#\#"仅用来标识位置,添加完配置后删除这两行): + 修改文件**build/lite/components/communication.json**,添加组件hello_world_app的配置,如下所示为communication.json文件片段,"\#\#start\#\#"和"\#\#end\#\#"之间为新增配置("\#\#start\#\#"和"\#\#end\#\#"仅用来标识位置,添加完配置后删除这两行): ``` diff --git a/zh-cn/device-dev/quick-start/quickstart-standard-overview.md b/zh-cn/device-dev/quick-start/quickstart-standard-overview.md index f191dbb44a7854c6a0a73bfa4cba157dc69f380a..a565f4412d378c2afa376e85d8267cc330418ae5 100644 --- a/zh-cn/device-dev/quick-start/quickstart-standard-overview.md +++ b/zh-cn/device-dev/quick-start/quickstart-standard-overview.md @@ -10,7 +10,7 @@ OpenHarmony标准系统适用于参考内存≥128MiB的设备。通过本文, - IDE方式:完全采用IDE(DevEco Device Tool)进行一站式开发,编译依赖工具的安装及编译、烧录、运行都通过IDE进行操作。 - 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。 - OpenHarmony还为开发者提供了[Docker环境](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 + OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 本文采用安装包方式进行介绍,习惯使用DevEco Device Tool的开发者可参考[标准系统快速入门(IDE方式)](../quick-start/quickstart-ide-standard-overview.md)。 diff --git a/zh-cn/device-dev/quick-start/quickstart-standard-running-hi3516-burning.md b/zh-cn/device-dev/quick-start/quickstart-standard-running-hi3516-burning.md index e541565607486be073d4297aefd792e43ac2e0c3..07260e729ed7d3709762cb918658b040ac99c446 100644 --- a/zh-cn/device-dev/quick-start/quickstart-standard-running-hi3516-burning.md +++ b/zh-cn/device-dev/quick-start/quickstart-standard-running-hi3516-burning.md @@ -33,7 +33,7 @@ Hi3516DV300开发板小型系统的烧录方式包括USB烧录、网口烧录两 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 使用USB烧录方式,在DevEco Device Tool 2.2 Beta2及更高版本中支持。 -1. 请连接好电脑和待烧录开发板,需要连接USB口和串口,具体可参考[Hi3516DV300开发板介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md)。 +1. 请连接好电脑和待烧录开发板,需要连接USB口和串口,具体可参考[Hi3516DV300开发板介绍](quickstart-lite-introduction-hi3516.md)。 2. 根据[Hi3516DV300/Hi3518EV300开发板串口驱动安装指导](https://gitee.com/link?target=https%3A%2F%2Fdevice.harmonyos.com%2Fcn%2Fdocs%2Fdocumentation%2Fguide%2Fhi3516_hi3518-drivers-0000001050743695)、[Hi3516DV300/Hi3518EV300开发板USB驱动安装指导](https://device.harmonyos.com/cn/docs/documentation/guide/usb_driver-0000001058690393)安装USB驱动及USB转串口的驱动。若您的设备中已安装此驱动,请忽略该步骤。 diff --git a/zh-cn/device-dev/reference/hdi-apis/Readme-CN.md b/zh-cn/device-dev/reference/hdi-apis/Readme-CN.md new file mode 100644 index 0000000000000000000000000000000000000000..c3a79510ced529a8dd075d3d89fd7a80495e2f9e --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/Readme-CN.md @@ -0,0 +1,218 @@ +# HDI 接口参考 + +- 模块 + - [Audio](_audio.md) + - [Battery](battery.md) + - [Camera](_camera.md) + - [Codec](_codec.md) + - [Display](_display.md) + - [HdfFaceAuth](_hdf_face_auth.md) + - [Input](_input.md) + - [Light](_light.md) + - [HdfPinAuth](_hdf_pin_auth.md) + - [Power](power.md) + - [Sensor](_sensor.md) + - [Thermal](thermal.md) + - [USB](_u_s_b.md) + - [HdfUserAuth](_hdf_user_auth.md) + - [Vibrator](_vibrator.md) + - [WLAN](_w_l_a_n.md) +- 头文件和结构体 + - 头文件 + - [audio_adapter.h](audio__adapter_8h.md) + - [audio_attribute.h](audio__attribute_8h.md) + - [audio_capture.h](audio__capture_8h.md) + - [audio_control.h](audio__control_8h.md) + - [audio_manager.h](audio__manager_8h.md) + - [audio_render.h](audio__render_8h.md) + - [audio_scene.h](audio__scene_8h.md) + - [audio_types.h](audio__types_8h.md) + - [audio_volume.h](audio__volume_8h.md) + - [codec_callback_if.h](codec__callback__if_8h.md) + - [codec_common_type.h](codec__common__type_8h.md) + - [codec_component_if.h](codec__component__if_8h.md) + - [codec_component_manager.h](codec__component__manager_8h.md) + - [codec_component_type.h](codec__component__type_8h.md) + - [display_device.h](display__device_8h.md) + - [display_gfx.h](display__gfx_8h.md) + - [display_gralloc.h](display__gralloc_8h.md) + - [display_layer.h](display__layer_8h.md) + - [display_type.h](display__type_8h.md) + - [icamera_device_callback.h](icamera__device__callback_8h.md) + - [icamera_device.h](icamera__device_8h.md) + - [icamera_host_callback.h](icamera__host__callback_8h.md) + - [icamera_host.h](icamera__host_8h.md) + - [input_controller.h](input__controller_8h.md) + - [input_manager.h](input__manager_8h.md) + - [input_reporter.h](input__reporter_8h.md) + - [input_type.h](input__type_8h.md) + - [ioffline_stream_operator.h](ioffline__stream__operator_8h.md) + - [istream_operator_callback.h](istream__operator__callback_8h.md) + - [istream_operator.h](istream__operator_8h.md) + - [light_if.h](light__if_8h.md) + - [light_type.h](light_8typeh.md) + - [sensor_if.h](sensor__if_8h.md) + - [sensor_type.h](sensor__type_8h.md) + - [types.h](types_8h.md) + - [usb_info.h](usb__info_8h.md) + - [usbd_client.h](usbd__client_8h.md) + - [usbd_subscriber.h](usbd__subscriber_8h.md) + - [usbd_type.h](usbd__type_8h.md) + - [vibrator_if.h](vibrator__if_8h.md) + - [vibrator_type.h](vibrator__type_8h.md) + - [wifi_hal_ap_feature.h](wifi__hal__ap__feature_8h.md) + - [wifi_hal_base_feature.h](wifi__hal__base__feature_8h.md) + - [wifi_hal_sta_feature.h](wifi__hal__sta__feature_8h.md) + - [wifi_hal.h](wifi__hal_8h.md) + - [IExecutor.idl](face__auth_2_i_executor_8idl.md) + - [IExecutorCallback.idl](face__auth_2_i_executor_callback_8idl.md) + - [FaceAuthTypes.idl](_face_auth_types_8idl.md) + - [PinAuthTypes.idl](_pin_auth_types_8idl.md) + - [IBatteryCallback.idl](_i_battery_callback_8idl.md) + - [IBatteryInterface.idl](_i_battery_interface_8idl.md) + - [IExecutor.idl](pin__auth_2_i_executor_8idl.md) + - [IExecutorCallback.idl](pin__auth_2_i_executor_callback_8idl.md) + - [IFaceAuthInterface.idl](_i_face_auth_interface_8idl.md) + - [IPinAuthInterface.idl](_i_pin_auth_interface_8idl.md) + - [IPowerHdiCallback.idl](_i_power_hdi_callback_8idl.md) + - [IPowerInterface.idl](_i_power_interface_8idl.md) + - [IThermalInterface.idl](_i_thermal_interface_8idl.md) + - [IThermalCallback.idl](_i_thermal_callback_8idl.md) + - [IUserAuthInterface.idl](_i_user_auth_interface_8idl.md) + - [PowerTypes.idl](_power_types_8idl.md) + - [ThermalTypes.idl](_thermal_types_8idl.md) + - [Types.idl](_types_8idl.md) + - [UserAuthTypes.idl](_user_auth_types_8idl.md) + - 结构体 + - [__attribute__](____attribute____.md) + - [Alignment](_alignment.md) + - [AllocInfo](_alloc_info.md) + - [AudioAdapter](_audio_adapter.md) + - [AudioAdapterDescriptor](_audio_adapter_descriptor.md) + - [AudioAttribute](_audio_attribute.md) + - [AudioCapture](_audio_capture.md) + - [AudioControl](_audio_control.md) + - [AudioDevExtInfo](_audio_dev_ext_info.md) + - [AudioDeviceDescriptor](_audio_device_descriptor.md) + - [AudioManager](_audio_manager.md) + - [AudioMixExtInfo](_audio_mix_ext_info.md) + - [AudioMmapBufferDescripter](_audio_mmap_buffer_descripter.md) + - [AudioPort](_audio_port.md) + - [AudioPortCap](_audio_port_cap.md) + - [AudioPortCapability](_audio_port_capability.md) + - [AudioRender](_audio_render.md) + - [AudioRoute](_audio_route.md) + - [AudioRouteNode](_audio_route_node.md) + - [AudioSampleAttributes](_audio_sample_attributes.md) + - [AudioScene](_audio_scene.md) + - [AudioSceneDescriptor](_audio_scene_descriptor.md) + - [AudioSceneDescriptor::SceneDesc](union_audio_scene_descriptor_1_1_scene_desc.md) + - [AudioSessionExtInfo](_audio_session_ext_info.md) + - [AudioSubPortCapability](_audio_sub_port_capability.md) + - [AudioTimeStamp](_audio_time_stamp.md) + - [AudioVolume](_audio_volume.md) + - [AuthResultInfo](_auth_result_info.md) + - [AuthSolution](_auth_solution.md) + - [BatteryInfo](_battery_info.md) + - [BufferData](_buffer_data.md) + - [CodecCallbackType](_codec_callback_type.md) + - [CodecCompCapability](_codec_comp_capability.md) + - [CodecComponentManager](_codec_component_manager.md) + - [CodecComponentType](_codec_component_type.md) + - [CompVerInfo](_comp_ver_info.md) + - [CredentialInfo](_credential_info.md) + - [DeviceFuncs](_device_funcs.md) + - [DeviceInfo](_device_info.md) + - [DisplayCapability](_display_capability.md) + - [DisplayInfo](_display_info.md) + - [DisplayModeInfo](_display_mode_info.md) + - [EnrolledInfo](_enrolled_info.md) + - [EnrollParam](_enroll_param.md) + - [EnrollResultInfo](_enroll_resultinfo.md) + - [EventInfo](_event_info.md) + - [EventPackage](_event_package.md) + - [ExecutorInfo](_executor_info.md) + - [ExecutorInfo](_user_executor_info.md) + - [ExecutorRegisterInfo](_executor_register_info.md) + - [ExecutorSendMsg](_executor_send_msg.md) + - [GetBufferHandleUsageParams](_get_buffer_handle_usage_params.md) + - [GfxFuncs](_gfx_funcs.md) + - [GfxOpt](_gfx_opt.md) + - [GrallocFuncs](_gralloc_funcs.md) + - [HdfThermalCallbackInfo](_hdf_thermal_callback_info.md) + - [HDRCapability](_h_d_r_capability.md) + - [HDRMetaData](_h_d_r_meta_data.md) + - [IBatteryCallback](interface_i_battery_callback.md) + - [IBatteryInterface](interface_i_battery_interface.md) + - [ICircle](_i_circle.md) + - [IdentifyResultInfo](_identify_result_info.md) + - [IExecutor](interface_i_executor.md) + - [IExecutor](interface_pin_i_executor.md) + - [IExecutorCallback](interface_i_executor_callback.md) + - [IExecutorCallback](interface_pin_i_executor_callback.md) + - [IFaceAuthInterface](interface_i_face_auth_interface.md) + - [IInputInterface](_i_input_interface.md) + - [ILine](_i_line.md) + - [InputController](_input_controller.md) + - [InputExtraCmd](_input_extra_cmd.md) + - [InputManager](_input_manager.md) + - [InputReporter](_input_reporter.md) + - [InputReportEventCb](_input_report_event_cb.md) + - [IPinAuthInterface](interface_i_pin_auth_interface.md) + - [IPowerHdiCallback](interface_i_power_hdi_callback.md) + - [IPowerInterface](interface_i_power_interface.md) + - [IRect](_i_rect.md) + - [ISurface](_i_surface.md) + - [IThermalCallback](interface_i_thermal_callback.md) + - [IThermalInterface](interface_i_thermal_interface.md) + - [IUserAuthInterface](interface_i_user_auth_interface.md) + - [IWiFi](_i_wi_fi.md) + - [IWiFiAp](_i_wi_fi_ap.md) + - [IWiFiBaseFeature](_i_wi_fi_base_feature.md) + - [IWiFiSta](_i_wi_fi_sta.md) + - [LayerAlpha](_layer_alpha.md) + - [LayerBuffer](_layer_buffer.md) + - [LayerFuncs](_layer_funcs.md) + - [LayerInfo](_layer_info.md) + - [LightEffect](_light_effect.md) + - [LightFlashEffect](_light_flash_effect.md) + - [LightInfo](_light_info.md) + - [LightInterface](_light_interface.md) + - [OHOS::Camera::CaptureEndedInfo](_o_h_o_s_1_1_camera_1_1_capture_ended_info.md) + - [OHOS::Camera::CaptureErrorInfo](_o_h_o_s_1_1_camera_1_1_capture_error_info.md) + - [OHOS::Camera::CaptureInfo](_o_h_o_s_1_1_camera_1_1_capture_info.md) + - [OHOS::Camera::ICameraDevice](_o_h_o_s_1_1_camera_1_1_i_camera_device.md) + - [OHOS::Camera::ICameraDeviceCallback](_o_h_o_s_1_1_camera_1_1_i_camera_device_callback.md) + - [OHOS::Camera::ICameraHost](_o_h_o_s_1_1_camera_1_1_i_camera_host.md) + - [OHOS::Camera::ICameraHostCallback](_o_h_o_s_1_1_camera_1_1_i_camera_host_callback.md) + - [OHOS::Camera::IOfflineStreamOperator](_o_h_o_s_1_1_camera_1_1_i_offline_stream_operator.md) + - [OHOS::Camera::IStreamOperator](_o_h_o_s_1_1_camera_1_1_i_stream_operator.md) + - [OHOS::Camera::IStreamOperatorCallback](_o_h_o_s_1_1_camera_1_1_i_stream_operator_callback.md) + - [OHOS::Camera::StreamAttribute](_o_h_o_s_1_1_camera_1_1_stream_attribute.md) + - [OHOS::Camera::StreamInfo](_o_h_o_s_1_1_camera_1_1_stream_info.md) + - [OHOS::USB::UsbCtrlTransfer](_o_h_o_s_1_1_u_s_b_1_1_usb_ctrl_transfer.md) + - [OHOS::USB::UsbdClient](_o_h_o_s_1_1_u_s_b_1_1_usbd_client.md) + - [OHOS::USB::UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) + - [OHOS::USB::USBDeviceInfo](_o_h_o_s_1_1_u_s_b_1_1_u_s_b_device_info.md) + - [OHOS::USB::UsbdSubscriber](_o_h_o_s_1_1_u_s_b_1_1_usbd_subscriber.md) + - [OHOS::USB::UsbInfo](_o_h_o_s_1_1_u_s_b_1_1_usb_info.md) + - [OHOS::USB::UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) + - [OmxCodecBuffer](_omx_codec_buffer.md) + - [PortCap](union_port_cap.md) + - [PresentTimestamp](_present_timestamp.md) + - [PropertyObject](_property_object.md) + - [RangeValue](_range_value.md) + - [Rect](_rect.md) + - [Rectangle](_rectangle.md) + - [ScheduleInfo](_schedule_info.md) + - [SensorEvents](_sensor_events.md) + - [SensorInformation](_sensor_information.md) + - [SensorInterface](_sensor_interface.md) + - [StaInfo](_sta_info.md) + - [SupportBufferType](_support_buffer_type.md) + - [TemplateInfo](_template_info.md) + - [ThermalZoneInfo](_thermal_zone_info.md) + - [UseBufferType](_use_buffer_type.md) + - [VerifyAllocInfo](_verify_alloc_info.md) + - [VibratorInterface](_vibrator_interface.md) + - [VideoPortCap](_video_port_cap.md) diff --git a/zh-cn/device-dev/reference/hdi-apis/____attribute____.md b/zh-cn/device-dev/reference/hdi-apis/____attribute____.md new file mode 100644 index 0000000000000000000000000000000000000000..c271b05bee1f5f6ab32382c00e2c125470c6da91 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/____attribute____.md @@ -0,0 +1,34 @@ +# __attribute__ + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [fd](_display.md#fd) | 句柄 fd, -1代表不支持。 | +| [reserveInts](_display.md#reserveints) | reserve数组的个数。 | +| [reserve](_display.md#reserve) [0] | reserve数组。 | +| [baseAddr](_display.md#baseaddr) | 内存的初始地址。 | +| [yOffset](_display.md#yoffset) | Y的偏移量。 | +| [uOffset](_display.md#uoffset) | U的偏移量。 | +| [vOffset](_display.md#voffset) | V的偏移量。 | +| [yStride](_display.md#ystride) | Y的stride信息。 | +| [uvStride](_display.md#uvstride) | UV的stride信息。 | +| [uvStep](_display.md#uvstep) | UV的step信息。 | + + +## **详细描述** + +扩展数据句柄结构体定义。 + +YUV描述信息结构体定义。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_alignment.md b/zh-cn/device-dev/reference/hdi-apis/_alignment.md new file mode 100644 index 0000000000000000000000000000000000000000..fe001f65e7ca31fea14d7d5ae3bf63ba18b28d62 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_alignment.md @@ -0,0 +1,51 @@ +# Alignment + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [widthAlignment](#widthalignment) | 宽的对齐值。 | +| [heightAlignment](#heightalignment) | 高的对齐值。 | + + +## **详细描述** + +对齐结构定义,包含宽高的对齐值。 + + +## **类成员变量说明** + + +### heightAlignment + + +``` +int32_t Alignment::heightAlignment +``` + +**描述:** + +高的对齐值。 + + +### widthAlignment + + +``` +int32_t Alignment::widthAlignment +``` + +**描述:** + +宽的对齐值。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_alloc_info.md b/zh-cn/device-dev/reference/hdi-apis/_alloc_info.md new file mode 100644 index 0000000000000000000000000000000000000000..6873294ab8b4518a09450b67b7ff209e41102503 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_alloc_info.md @@ -0,0 +1,27 @@ +# AllocInfo + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [width](_display.md#width-67) | 申请内存宽度 | +| [height](_display.md#height-67) | 申请内存高度 | +| [usage](_display.md#usage-12) | 申请内存的使用场景 | +| [format](_display.md#format-12) | 申请内存格式 | +| [expectedSize](_display.md#expectedsize) | 申请内存大小 | + + +## **详细描述** + +定义关于要分配的内存的信息。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio.md b/zh-cn/device-dev/reference/hdi-apis/_audio.md new file mode 100644 index 0000000000000000000000000000000000000000..554eb44177de3dd16d2f72091eb23972324c3a5c --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio.md @@ -0,0 +1,1319 @@ +# Audio + + +## **汇总** + + +### 文件 + + | 文件 | 描述 | +| -------- | -------- | +| [audio_adapter.h](audio__adapter_8h.md) | Audio适配器的接口定义文件 | +| [audio_attribute.h](audio__attribute_8h.md) | Audio属性的接口定义文件 | +| [audio_capture.h](audio__capture_8h.md) | Audio录音的接口定义文件 | +| [audio_control.h](audio__control_8h.md) | Audio控制的接口定义文件 | +| [audio_manager.h](audio__manager_8h.md) | Audio适配器管理及加载的接口定义文件 | +| [audio_render.h](audio__render_8h.md) | Audio播放的接口定义文件 | +| [audio_scene.h](audio__scene_8h.md) | Audio场景的接口定义文件 | +| [audio_types.h](audio__types_8h.md) | Audio模块接口定义中使用的自定义数据类型 | +| [audio_volume.h](audio__volume_8h.md) | Audio音量的接口定义文件 | + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [AudioAdapter](_audio_adapter.md) | AudioAdapter音频适配器接口 [更多...](_audio_adapter.md) | +| [AudioAttribute](_audio_attribute.md) | AudioAttribute音频属性接口 [更多...](_audio_attribute.md) | +| [AudioCapture](_audio_capture.md) | AudioCapture音频录音接口 [更多...](_audio_capture.md) | +| [AudioControl](_audio_control.md) | AudioControl音频控制接口 [更多...](_audio_control.md) | +| [AudioManager](_audio_manager.md) | AudioManager音频适配器管理接口 [更多...](_audio_manager.md) | +| [AudioRender](_audio_render.md) | AudioRender音频播放接口 [更多...](_audio_render.md) | +| [AudioScene](_audio_scene.md) | AudioScene音频场景接口 [更多...](_audio_scene.md) | +| [AudioPort](_audio_port.md) | 音频端口 [更多...](_audio_port.md) | +| [AudioAdapterDescriptor](_audio_adapter_descriptor.md) | 音频适配器描述符 [更多...](_audio_adapter_descriptor.md) | +| [AudioDeviceDescriptor](_audio_device_descriptor.md) | 音频设备描述符 [更多...](_audio_device_descriptor.md) | +| [AudioSceneDescriptor](_audio_scene_descriptor.md) | 音频场景描述符 [更多...](_audio_scene_descriptor.md) | +| [AudioSceneDescriptor::SceneDesc](union_audio_scene_descriptor_1_1_scene_desc.md) | 音频场景描述 [更多...](union_audio_scene_descriptor_1_1_scene_desc.md) | +| [AudioSampleAttributes](_audio_sample_attributes.md) | 音频采样属性 [更多...](_audio_sample_attributes.md) | +| [AudioTimeStamp](_audio_time_stamp.md) | 音频时间戳 [更多...](_audio_time_stamp.md) | +| [AudioSubPortCapability](_audio_sub_port_capability.md) | 音频子端口的支持能力 [更多...](_audio_sub_port_capability.md) | +| [AudioPortCapability](_audio_port_capability.md) | 音频端口的支持能力 [更多...](_audio_port_capability.md) | +| [AudioMmapBufferDescripter](_audio_mmap_buffer_descripter.md) | mmap缓冲区描述符 [更多...](_audio_mmap_buffer_descripter.md) | +| [AudioDevExtInfo](_audio_dev_ext_info.md) | 音频设备拓展信息 [更多...](_audio_dev_ext_info.md) | +| [AudioMixExtInfo](_audio_mix_ext_info.md) | 音轨拓展信息 [更多...](_audio_mix_ext_info.md) | +| [AudioSessionExtInfo](_audio_session_ext_info.md) | 会话拓展信息 [更多...](_audio_session_ext_info.md) | +| [AudioRouteNode](_audio_route_node.md) | 音频路由节点 [更多...](_audio_route_node.md) | +| [AudioRoute](_audio_route.md) | 音频路由信息 [更多...](_audio_route.md) | +| [AudioVolume](_audio_volume.md) | AudioVolume音频音量接口 [更多...](_audio_volume.md) | + + +### 类型定义 + + | 类型定义 | 描述 | +| -------- | -------- | +| AudioHandle | 音频句柄 | +| ([RenderCallback](#rendercallback)) (enum [AudioCallbackType](#audiocallbacktype), void \*reserved, void \*cookie) | 回调函数指针 [更多...](#rendercallback) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [AudioPortDirection](#audioportdirection) { PORT_OUT = 0x1u, PORT_IN = 0x2u, PORT_OUT_IN = 0x3u } | 音频端口的类型 [更多...](#audioportdirection) | +| [AudioPortPin](#audioportpin) {   PIN_NONE = 0x0u, PIN_OUT_SPEAKER = 0x1u, PIN_OUT_HEADSET = 0x2u, PIN_OUT_LINEOUT = 0x4u,   PIN_OUT_HDMI = 0x8u, PIN_OUT_USB = 0x10u, PIN_OUT_USB_EXT = 0x20u, PIN_IN_MIC = 0x8000001u,   PIN_IN_HS_MIC = 0x8000002u, PIN_IN_LINEIN = 0x8000004u, PIN_IN_USB_EXT = 0x8000008u } | 音频适配器端口的PIN脚 [更多...](#audioportpin) | +| [AudioCategory](#audiocategory) { AUDIO_IN_MEDIA = 0, AUDIO_IN_COMMUNICATION, AUDIO_IN_RINGTONE, AUDIO_IN_CALL } | 音频类型(category) [更多...](#audiocategory) | +| [AudioFormat](#audioformat) {   AUDIO_FORMAT_PCM_8_BIT = 0x1u, AUDIO_FORMAT_PCM_16_BIT = 0x2u, AUDIO_FORMAT_PCM_24_BIT = 0x3u, AUDIO_FORMAT_PCM_32_BIT = 0x4u,   AUDIO_FORMAT_AAC_MAIN = 0x1000001u, AUDIO_FORMAT_AAC_LC = 0x1000002u, AUDIO_FORMAT_AAC_LD = 0x1000003u, AUDIO_FORMAT_AAC_ELD = 0x1000004u,   AUDIO_FORMAT_AAC_HE_V1 = 0x1000005u, AUDIO_FORMAT_AAC_HE_V2 = 0x1000006u, AUDIO_FORMAT_G711A = 0x2000001u, AUDIO_FORMAT_G711U = 0x2000002u,   AUDIO_FORMAT_G726 = 0x2000003u } | 音频格式 [更多...](#audioformat) | +| [AudioChannelMask](#audiochannelmask) { AUDIO_CHANNEL_FRONT_LEFT = 0x1, AUDIO_CHANNEL_FRONT_RIGHT = 0x2, AUDIO_CHANNEL_MONO = 0x1u, AUDIO_CHANNEL_STEREO = 0x3u } | 音频通道掩码(mask) [更多...](#audiochannelmask) | +| [AudioSampleRatesMask](#audiosampleratesmask) {   AUDIO_SAMPLE_RATE_MASK_8000 = 0x1u, AUDIO_SAMPLE_RATE_MASK_12000 = 0x2u, AUDIO_SAMPLE_RATE_MASK_11025 = 0x4u, AUDIO_SAMPLE_RATE_MASK_16000 = 0x8u,   AUDIO_SAMPLE_RATE_MASK_22050 = 0x10u, AUDIO_SAMPLE_RATE_MASK_24000 = 0x20u, AUDIO_SAMPLE_RATE_MASK_32000 = 0x40u, AUDIO_SAMPLE_RATE_MASK_44100 = 0x80u,   AUDIO_SAMPLE_RATE_MASK_48000 = 0x100u, AUDIO_SAMPLE_RATE_MASK_64000 = 0x200u, AUDIO_SAMPLE_RATE_MASK_96000 = 0x400u, AUDIO_SAMPLE_RATE_MASK_INVALID = 0xFFFFFFFFu } | 音频采样频率MASK [更多...](#audiosampleratesmask) | +| [AudioPortPassthroughMode](#audioportpassthroughmode) { PORT_PASSTHROUGH_LPCM = 0x1, PORT_PASSTHROUGH_RAW = 0x2, PORT_PASSTHROUGH_HBR2LBR = 0x4, PORT_PASSTHROUGH_AUTO = 0x8 } | 音频端口的数据透传模式 [更多...](#audioportpassthroughmode) | +| [AudioSampleFormat](#audiosampleformat) {   AUDIO_SAMPLE_FORMAT_S8, AUDIO_SAMPLE_FORMAT_S8P, AUDIO_SAMPLE_FORMAT_U8, AUDIO_SAMPLE_FORMAT_U8P,   AUDIO_SAMPLE_FORMAT_S16, AUDIO_SAMPLE_FORMAT_S16P, AUDIO_SAMPLE_FORMAT_U16, AUDIO_SAMPLE_FORMAT_U16P,   AUDIO_SAMPLE_FORMAT_S24, AUDIO_SAMPLE_FORMAT_S24P, AUDIO_SAMPLE_FORMAT_U24, AUDIO_SAMPLE_FORMAT_U24P,   AUDIO_SAMPLE_FORMAT_S32, AUDIO_SAMPLE_FORMAT_S32P, AUDIO_SAMPLE_FORMAT_U32, AUDIO_SAMPLE_FORMAT_U32P,   AUDIO_SAMPLE_FORMAT_S64, AUDIO_SAMPLE_FORMAT_S64P, AUDIO_SAMPLE_FORMAT_U64, AUDIO_SAMPLE_FORMAT_U64P,   AUDIO_SAMPLE_FORMAT_F32, AUDIO_SAMPLE_FORMAT_F32P, AUDIO_SAMPLE_FORMAT_F64, AUDIO_SAMPLE_FORMAT_F64P,   AUDIO_SAMPLE_FMT_U8, AUDIO_SAMPLE_FMT_S16, AUDIO_SAMPLE_FMT_S32, AUDIO_SAMPLE_FMT_FLOAT,   AUDIO_SAMPLE_FMT_DOUBLE, AUDIO_SAMPLE_FMT_U8P, AUDIO_SAMPLE_FMT_S16P, AUDIO_SAMPLE_FMT_S32P,   AUDIO_SAMPLE_FMT_FLOATP, AUDIO_SAMPLE_FMT_DOUBLEP, AUDIO_SAMPLE_FMT_INVALID } | 原始音频样本格式 [更多...](#audiosampleformat) | +| [AudioChannelMode](#audiochannelmode) {   AUDIO_CHANNEL_NORMAL = 0, AUDIO_CHANNEL_BOTH_LEFT, AUDIO_CHANNEL_BOTH_RIGHT, AUDIO_CHANNEL_EXCHANGE,   AUDIO_CHANNEL_MIX, AUDIO_CHANNEL_LEFT_MUTE, AUDIO_CHANNEL_RIGHT_MUTE, AUDIO_CHANNEL_BOTH_MUTE } | 音频播放的通道模式 [更多...](#audiochannelmode) | +| [AudioDrainNotifyType](#audiodrainnotifytype) { AUDIO_DRAIN_NORMAL_MODE, AUDIO_DRAIN_EARLY_MODE } | DrainBuffer函数结束类型 [更多...](#audiodrainnotifytype) | +| [AudioCallbackType](#audiocallbacktype) {   AUDIO_NONBLOCK_WRITE_COMPELETED, AUDIO_DRAIN_COMPELETED, AUDIO_FLUSH_COMPLETED, AUDIO_RENDER_FULL,   AUDIO_ERROR_OCCUR } | 回调函数通知事件类型 [更多...](#audiocallbacktype) | +| [AudioPortRole](#audioportrole) { AUDIO_PORT_UNASSIGNED_ROLE = 0, AUDIO_PORT_SOURCE_ROLE = 1, AUDIO_PORT_SINK_ROLE = 2 } | 音频端口角色 [更多...](#audioportrole) | +| [AudioPortType](#audioporttype) { AUDIO_PORT_UNASSIGNED_TYPE = 0, AUDIO_PORT_DEVICE_TYPE = 1, AUDIO_PORT_MIX_TYPE = 2, AUDIO_PORT_SESSION_TYPE = 3 } | 音频端口类型 [更多...](#audioporttype) | +| [AudioSessionType](#audiosessiontype) { AUDIO_OUTPUT_STAGE_SESSION = 0, AUDIO_OUTPUT_MIX_SESSION, AUDIO_ALLOCATE_SESSION, AUDIO_INVALID_SESSION } | 端口会话类型 [更多...](#audiosessiontype) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [GetAudioManagerFuncs](#getaudiomanagerfuncs) (void) | 获取音频适配器管理接口的操作函数列表,详情参考[AudioManager](_audio_manager.md)[更多...](#getaudiomanagerfuncs) | + + +### 变量 + + | 变量 | 描述 | +| -------- | -------- | +| [AudioPort::dir](#dir) | 音频端口的类型。 | +| [AudioPort::portId](#portid-14) | 音频端口的ID。 | +| [AudioPort::portName](#portname) | 音频端口的名称。 | +| [AudioAdapterDescriptor::adapterName](#adaptername) | 音频适配器的名称。 | +| [AudioAdapterDescriptor::portNum](#portnum) | 一个音频适配器支持的端口数目。 | +| [AudioAdapterDescriptor::ports](#ports) | 一个音频适配器支持的端口列表。 | +| [AudioDeviceDescriptor::portId](#portid-24) | 音频端口ID。 | +| [AudioDeviceDescriptor::pins](#pins) | 音频端口上的PIN脚(输出、输入)。 | +| [AudioDeviceDescriptor::desc](#desc-15) | 以字符串命名的音频设备。 | +| [AudioSceneDescriptor::SceneDesc::id](#id) | 音频场景的ID。 | +| [AudioSceneDescriptor::SceneDesc::desc](#desc-35) | 以字符串命名的音频场景。 | +| [AudioSceneDescriptor::scene](#scene) | 音频场景的名称。 | +| [AudioSceneDescriptor::desc](#desc-25) | 音频设备描述符。 | +| [AudioSampleAttributes::type](#type-13) | 音频类型。 | +| [AudioSampleAttributes::interleaved](#interleaved) | 音频数据交织的标记。 | +| [AudioSampleAttributes::format](#format) | 音频数据格式。 | +| [AudioSampleAttributes::sampleRate](#samplerate) | 音频采样频率。 | +| [AudioSampleAttributes::channelCount](#channelcount-12) | 音频通道数目,如单通道(mono)为1、立体声(stereo)为2。 | +| [AudioSampleAttributes::period](#period) | 音频采样周期。 | +| [AudioSampleAttributes::frameSize](#framesize) | 音频数据的帧大小。 | +| [AudioSampleAttributes::isBigEndian](#isbigendian) | 音频数据的大端标志。 | +| [AudioSampleAttributes::isSignedData](#issigneddata) | 音频数据的有符号或无符号标志。 | +| [AudioSampleAttributes::startThreshold](#startthreshold) | 音频渲染开始阈值。 | +| [AudioSampleAttributes::stopThreshold](#stopthreshold) | 音频渲染停止阈值。 | +| [AudioSampleAttributes::silenceThreshold](#silencethreshold) | 音频捕获缓冲区阈值。 | +| [AudioSampleAttributes::streamId](#streamid-12) | 渲染或捕获的音频标识符。 | +| [AudioTimeStamp::tvSec](#tvsec) | tvSec时间,单位:秒。 | +| [AudioTimeStamp::tvNSec](#tvnsec) | tvNSec时间,单位:纳秒。 | +| [AudioSubPortCapability::portId](#portid-34) | 子端口ID。 | +| [AudioSubPortCapability::desc](#desc-45) | 以字符串命名的子端口。 | +| [AudioSubPortCapability::mask](#mask) | 数据透传模式。 | +| [AudioPortCapability::deviceType](#devicetype) | 设备输出、输入类型。 | +| [AudioPortCapability::deviceId](#deviceid) | 绑定(bind)设备ID,唯一的设备识别符。 | +| [AudioPortCapability::hardwareMode](#hardwaremode) | 是否支持设备绑定处理。 | +| [AudioPortCapability::formatNum](#formatnum) | 支持的音频格式数目。 | +| [AudioPortCapability::formats](#formats) | 支持的音频格式。 | +| [AudioPortCapability::sampleRateMasks](#sampleratemasks) | 支持的音频采样频率(8k、16k、32k、48k)。 | +| [AudioPortCapability::channelMasks](#channelmasks) | 设备的声道布局掩码(mask)。 | +| [AudioPortCapability::channelCount](#channelcount-22) | 支持的最大声道总数。 | +| [AudioPortCapability::subPortsNum](#subportsnum) | 支持的子端口数目(仅用于输出设备)。 | +| [AudioPortCapability::subPorts](#subports) | 支持的子端口列表。 | +| [AudioPortCapability::supportSampleFormatNum](#supportsampleformatnum) | 支持的音频样本格式数量。 | +| [AudioPortCapability::supportSampleFormats](#supportsampleformats) | 支持的音频样本格式。 | +| [AudioMmapBufferDescripter::memoryAddress](#memoryaddress) | 指向mmap缓冲区的指针。 | +| [AudioMmapBufferDescripter::memoryFd](#memoryfd) | mmap缓冲区的文件描述符。 | +| [AudioMmapBufferDescripter::totalBufferFrames](#totalbufferframes) | 缓冲区总大小,单位:帧。 | +| [AudioMmapBufferDescripter::transferFrameSize](#transferframesize) | 传输大小,单位:帧。 | +| [AudioMmapBufferDescripter::isShareable](#isshareable) | mmap缓冲区是否可以在进程间共享。 | +| [AudioDevExtInfo::moduleId](#moduleid-12) | 音频流绑定的模块ID。 | +| [AudioDevExtInfo::type](#type-23) | 音频端口上的PIN脚(输出、输入)。 | +| [AudioDevExtInfo::desc](#desc-55) | 地址描述。 | +| [AudioMixExtInfo::moduleId](#moduleid-22) | 流所属模块标识符。 | +| [AudioMixExtInfo::streamId](#streamid-22) | 由调用者传递的Render或Capture标识符。 | +| [AudioSessionExtInfo::sessionType](#sessiontype) | 音频会话类型。 | +| [AudioRouteNode::portId](#portid-44) | 音频端口ID。 | +| [AudioRouteNode::role](#role) | 指定端口角色为sink或source。 | +| [AudioRouteNode::type](#type-33) | 指定端口类型。 | +| [AudioRouteNode::device](#device) | 设备特定信息。 | +| [AudioRouteNode::mix](#mix) | 音轨特定信息。 | +| [AudioRouteNode::session](#session) | 会话特定信息。 | +| [AudioRoute::sourcesNum](#sourcesnum) | 发送端节点数量。 | +| [AudioRoute::sources](#sources) | 发送端列表。 | +| [AudioRoute::sinksNum](#sinksnum) | 接受端节点数量。 | +| [AudioRoute::sinks](#sinks) | 接受端列表。 | + + +## **详细描述** + +Audio模块接口定义。 + +音频接口涉及自定义类型、驱动加载接口、驱动适配器接口、音频播放(render)接口、音频录音(capture)接口等。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **类型定义说明** + + +### RenderCallback + + +``` +typedef int32_t(* RenderCallback) (enum AudioCallbackType, void *reserved, void *cookie) +``` + +**描述:** + +回调函数指针。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| AudioCallbackType | 回调函数响应类型 | +| reserved | 保留字段 | +| cookie | 用于传递数据 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +RegCallback + + +## **枚举类型说明** + + +### AudioCallbackType + + +``` +enum AudioCallbackType +``` + +**描述:** + +回调函数通知事件类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| AUDIO_NONBLOCK_WRITE_COMPELETED | 非阻塞式写完成 | +| AUDIO_DRAIN_COMPELETED | DrainBuffer完成 | +| AUDIO_FLUSH_COMPLETED | Flush完成 | +| AUDIO_RENDER_FULL | Render缓冲区已满 | +| AUDIO_ERROR_OCCUR | 发生了错误 | + + +### AudioCategory + + +``` +enum AudioCategory +``` + +**描述:** + +音频类型(category)。 + + | 枚举值 | 描述 | +| -------- | -------- | +| AUDIO_IN_MEDIA | 媒体 | +| AUDIO_IN_COMMUNICATION | 通信 | +| AUDIO_IN_RINGTONE | 铃声 | +| AUDIO_IN_CALL | 呼叫 | + + +### AudioChannelMask + + +``` +enum AudioChannelMask +``` + +**描述:** + +音频通道掩码(mask)。 + +定义音频声道的位置。 + + | 枚举值 | 描述 | +| -------- | -------- | +| AUDIO_CHANNEL_FRONT_LEFT | 声道布局前左 | +| AUDIO_CHANNEL_FRONT_RIGHT | 声道布局前右 | +| AUDIO_CHANNEL_MONO | 单声道 | +| AUDIO_CHANNEL_STEREO | 立体声,由左右声道组成(FRONT_LEFT \| FRONT_RIGHT) | + + +### AudioChannelMode + + +``` +enum AudioChannelMode +``` + +**描述:** + +音频播放的通道模式。 + +> ![icon-notice.gif](public_sys-resources/icon-notice.gif) **须知:** +> 下面的模式是针对双通道立体声的音频播放而设置,其他不支持。 + + | 枚举值 | 描述 | +| -------- | -------- | +| AUDIO_CHANNEL_NORMAL | 正常模式,不做处理 | +| AUDIO_CHANNEL_BOTH_LEFT | 两个声道全部为左声道声音 | +| AUDIO_CHANNEL_BOTH_RIGHT | 两个声道全部为右声道声音 | +| AUDIO_CHANNEL_EXCHANGE | 左右声道数据互换,左声道为右声道声音,右声道为左声道声音 | +| AUDIO_CHANNEL_MIX | 左右两个声道输出为左右声道相加(混音) | +| AUDIO_CHANNEL_LEFT_MUTE | 左声道静音,右声道播放原右声道声音 | +| AUDIO_CHANNEL_RIGHT_MUTE | 右声道静音,左声道播放原左声道声音 | +| AUDIO_CHANNEL_BOTH_MUTE | 左右声道均静音 | + + +### AudioDrainNotifyType + + +``` +enum AudioDrainNotifyType +``` + +**描述:** + +DrainBuffer函数结束类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| AUDIO_DRAIN_NORMAL_MODE | DrainBuffer在所有数据播放结束后返回 | +| AUDIO_DRAIN_EARLY_MODE | DrainBuffer()在当前曲目的所有数据播放完之前返回,以便留出时间给音频服务做连续性曲目切换 | + + +### AudioFormat + + +``` +enum AudioFormat +``` + +**描述:** + +音频格式。 + + | 枚举值 | 描述 | +| -------- | -------- | +| AUDIO_FORMAT_PCM_8_BIT | 8bit位宽pcm格式 | +| AUDIO_FORMAT_PCM_16_BIT | 16bit位宽pcm格式 | +| AUDIO_FORMAT_PCM_24_BIT | 24bit位宽pcm格式 | +| AUDIO_FORMAT_PCM_32_BIT | 32bit位宽pcm格式 | +| AUDIO_FORMAT_AAC_MAIN | AAC MAIN格式 | +| AUDIO_FORMAT_AAC_LC | AAC LC格式 | +| AUDIO_FORMAT_AAC_LD | AAC LD格式 | +| AUDIO_FORMAT_AAC_ELD | AAC ELD格式 | +| AUDIO_FORMAT_AAC_HE_V1 | AAC HE_V1格式 | +| AUDIO_FORMAT_AAC_HE_V2 | AAC HE_V2格式 | +| AUDIO_FORMAT_G711A | G711A格式 | +| AUDIO_FORMAT_G711U | G711u格式 | +| AUDIO_FORMAT_G726 | G726格式 | + + +### AudioPortDirection + + +``` +enum AudioPortDirection +``` + +**描述:** + +音频端口的类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| PORT_OUT | 音频输出端口。 | +| PORT_IN | 音频输入端口。 | +| PORT_OUT_IN | 音频输出/入端口,同时支持输出和输入能力(OUT \| IN)。 | + + +### AudioPortPassthroughMode + + +``` +enum AudioPortPassthroughMode +``` + +**描述:** + +音频端口的数据透传模式。 + + | 枚举值 | 描述 | +| -------- | -------- | +| PORT_PASSTHROUGH_LPCM | 立体声pcm | +| PORT_PASSTHROUGH_RAW | HDMI透传 | +| PORT_PASSTHROUGH_HBR2LBR | 蓝光次世代音频降规格输出 | +| PORT_PASSTHROUGH_AUTO | 根据HDMI EDID能力自动匹配 | + + +### AudioPortPin + + +``` +enum AudioPortPin +``` + +**描述:** + +音频适配器端口的PIN脚。 + + | 枚举值 | 描述 | +| -------- | -------- | +| PIN_NONE | 无效PIN | +| PIN_OUT_SPEAKER | 喇叭输出 | +| PIN_OUT_HEADSET | 有线耳机输出 | +| PIN_OUT_LINEOUT | Lineout输出 | +| PIN_OUT_HDMI | HDMI输出 | +| PIN_OUT_USB | USB设备输出 | +| PIN_OUT_USB_EXT | 扩展 USB 设备输出 | +| PIN_IN_MIC | Mic输入 | +| PIN_IN_HS_MIC | 有线耳机Mic输入 | +| PIN_IN_LINEIN | Linein输入 | +| PIN_IN_USB_EXT | 扩展 USB 设备输入 | + + +### AudioPortRole + + +``` +enum AudioPortRole +``` + +**描述:** + +音频端口角色。 + + | 枚举值 | 描述 | +| -------- | -------- | +| AUDIO_PORT_UNASSIGNED_ROLE | 未指定端口角色 | +| AUDIO_PORT_SOURCE_ROLE | 指定端口为发送端角色 | +| AUDIO_PORT_SINK_ROLE | 指定端口为接受端角色 | + + +### AudioPortType + + +``` +enum AudioPortType +``` + +**描述:** + +音频端口类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| AUDIO_PORT_UNASSIGNED_TYPE | 未指定端口类型 | +| AUDIO_PORT_DEVICE_TYPE | 指定端口为设备类型 | +| AUDIO_PORT_MIX_TYPE | 指定端口类型为复合类型 | +| AUDIO_PORT_SESSION_TYPE | 指定端口为会话类型 | + + +### AudioSampleFormat + + +``` +enum AudioSampleFormat +``` + +**描述:** + +原始音频样本格式。 + + | 枚举值 | 描述 | +| -------- | -------- | +| AUDIO_SAMPLE_FORMAT_S8 | 8bit位宽有符号交织样本 | +| AUDIO_SAMPLE_FORMAT_S8P | 8bit位宽有符号非交织样本 | +| AUDIO_SAMPLE_FORMAT_U8 | 8bit位宽无符号交织样本 | +| AUDIO_SAMPLE_FORMAT_U8P | 8bit位宽无符号非交织样本 | +| AUDIO_SAMPLE_FORMAT_S16 | 16bit位宽有符号交织样本 | +| AUDIO_SAMPLE_FORMAT_S16P | 16bit位宽有符号非交织样本 | +| AUDIO_SAMPLE_FORMAT_U16 | 16bit位宽无符号交织样本 | +| AUDIO_SAMPLE_FORMAT_U16P | 16bit位宽无符号非交织样本 | +| AUDIO_SAMPLE_FORMAT_S24 | 24bit位宽有符号交织样本 | +| AUDIO_SAMPLE_FORMAT_S24P | 24bit位宽有符号非交织样本 | +| AUDIO_SAMPLE_FORMAT_U24 | 24bit位宽无符号交织样本 | +| AUDIO_SAMPLE_FORMAT_U24P | 24bit位宽无符号非交织样本 | +| AUDIO_SAMPLE_FORMAT_S32 | 32bit位宽有符号交织样本 | +| AUDIO_SAMPLE_FORMAT_S32P | 32bit位宽有符号非交织样本 | +| AUDIO_SAMPLE_FORMAT_U32 | 32bit位宽无符号交织样本 | +| AUDIO_SAMPLE_FORMAT_U32P | 32bit位宽无符号非交织样本 | +| AUDIO_SAMPLE_FORMAT_S64 | 64bit位宽有符号交织样本 | +| AUDIO_SAMPLE_FORMAT_S64P | 64bit位宽有符号非交织样本 | +| AUDIO_SAMPLE_FORMAT_U64 | 64bit位宽无符号交织样本 | +| AUDIO_SAMPLE_FORMAT_U64P | 64bit位宽无符号非交织样本 | +| AUDIO_SAMPLE_FORMAT_F32 | 32bit位宽浮点型交织样本 | +| AUDIO_SAMPLE_FORMAT_F32P | 64bit位宽浮点型非交织样本 | +| AUDIO_SAMPLE_FORMAT_F64 | 64bit位宽双精度浮点型交织样本 | +| AUDIO_SAMPLE_FORMAT_F64P | 64bit位宽双精度浮点型非交织样本 | +| AUDIO_SAMPLE_FMT_U8 | 无符号8位整型,打包格式 | +| AUDIO_SAMPLE_FMT_S16 | 带符号16位整型,打包格式 | +| AUDIO_SAMPLE_FMT_S32 | 带符号32位整型,打包格式 | +| AUDIO_SAMPLE_FMT_FLOAT | 浮点型,打包格式 | +| AUDIO_SAMPLE_FMT_DOUBLE | 双精度浮点型,打包格式 | +| AUDIO_SAMPLE_FMT_U8P | 无符号8位整型,平面格式 | +| AUDIO_SAMPLE_FMT_S16P | 带符号16位整型,平面格式 | +| AUDIO_SAMPLE_FMT_S32P | 带符号32位整型,平面格式 | +| AUDIO_SAMPLE_FMT_FLOATP | 浮点型,平面格式 | +| AUDIO_SAMPLE_FMT_DOUBLEP | 双精度浮点型,平面格式 | +| AUDIO_SAMPLE_FMT_INVALID | 无效采样格式 | + + +### AudioSampleRatesMask + + +``` +enum AudioSampleRatesMask +``` + +**描述:** + +音频采样频率MASK。 + + | 枚举值 | 描述 | +| -------- | -------- | +| AUDIO_SAMPLE_RATE_MASK_8000 | 8K 采样频率 | +| AUDIO_SAMPLE_RATE_MASK_12000 | 12K 采样频率 | +| AUDIO_SAMPLE_RATE_MASK_11025 | 11.025K 采样频率 | +| AUDIO_SAMPLE_RATE_MASK_16000 | 16K 采样频率 | +| AUDIO_SAMPLE_RATE_MASK_22050 | 22.050K 采样频率 | +| AUDIO_SAMPLE_RATE_MASK_24000 | 24K 采样频率 | +| AUDIO_SAMPLE_RATE_MASK_32000 | 32K 采样频率 | +| AUDIO_SAMPLE_RATE_MASK_44100 | 44.1K 采样频率 | +| AUDIO_SAMPLE_RATE_MASK_48000 | 48K 采样频率 | +| AUDIO_SAMPLE_RATE_MASK_64000 | 64K 采样频率 | +| AUDIO_SAMPLE_RATE_MASK_96000 | 96K 采样频率 | +| AUDIO_SAMPLE_RATE_MASK_INVALID | 无效的采样频率 | + + +### AudioSessionType + + +``` +enum AudioSessionType +``` + +**描述:** + +端口会话类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| AUDIO_OUTPUT_STAGE_SESSION | 会话绑定到指定输出流 | +| AUDIO_OUTPUT_MIX_SESSION | 会话绑定到特定音轨 | +| AUDIO_ALLOCATE_SESSION | 会话ID需重新申请 | +| AUDIO_INVALID_SESSION | 无效会话类型 | + + +## **函数说明** + + +### GetAudioManagerFuncs() + + +``` +struct AudioManager* GetAudioManagerFuncs (void ) +``` + +**描述:** + +获取音频适配器管理接口的操作函数列表,详情参考[AudioManager](_audio_manager.md)。 + +**返回:** + +成功返回一个音频适配器管理接口的对象,失败返回NULL。 + + +## **变量说明** + + +### adapterName + + +``` +const char* AudioAdapterDescriptor::adapterName +``` + +**描述:** + +音频适配器的名称。 + + +### channelCount [1/2] + + +``` +uint32_t AudioSampleAttributes::channelCount +``` + +**描述:** + +音频通道数目,如单通道(mono)为1、立体声(stereo)为2。 + + +### channelCount [2/2] + + +``` +unsigned int AudioPortCapability::channelCount +``` + +**描述:** + +支持的最大声道总数。 + + +### channelMasks + + +``` +enum AudioChannelMask AudioPortCapability::channelMasks +``` + +**描述:** + +设备的声道布局掩码(mask),详情参考[AudioChannelMask](#audiochannelmask)。 + + +### desc [1/5] + + +``` +const char* AudioDeviceDescriptor::desc +``` + +**描述:** + +以字符串命名的音频设备。 + + +### desc [2/5] + + +``` +struct AudioDeviceDescriptor AudioSceneDescriptor::desc +``` + +**描述:** + +音频设备描述符。 + + +### desc [3/5] + + +``` +const char* AudioSceneDescriptor::SceneDesc::desc +``` + +**描述:** + +以字符串命名的音频场景。 + + +### desc [4/5] + + +``` +const char* AudioSubPortCapability::desc +``` + +**描述:** + +以字符串命名的子端口。 + + +### desc [5/5] + + +``` +const char* AudioDevExtInfo::desc +``` + +**描述:** + +地址描述。 + + +### deviceId + + +``` +unsigned int AudioPortCapability::deviceId +``` + +**描述:** + +绑定(bind)设备ID,唯一的设备识别符。 + + +### deviceType + + +``` +unsigned int AudioPortCapability::deviceType +``` + +**描述:** + +设备输出、输入类型。 + + +### dir + + +``` +enum AudioPortDirection AudioPort::dir +``` + +**描述:** + +音频端口的类型,详情参考[AudioPortDirection](#audioportdirection)。 + + +### format + + +``` +enum AudioFormat AudioSampleAttributes::format +``` + +**描述:** + +音频数据格式,详情参考[AudioFormat](#audioformat)。 + + +### formatNum + + +``` +unsigned int AudioPortCapability::formatNum +``` + +**描述:** + +支持的音频格式数目。 + + +### formats + + +``` +enum AudioFormat* AudioPortCapability::formats +``` + +**描述:** + +支持的音频格式,详情参考[AudioFormat](#audioformat)。 + + +### frameSize + + +``` +uint32_t AudioSampleAttributes::frameSize +``` + +**描述:** + +音频数据的帧大小。 + + +### hardwareMode + + +``` +bool AudioPortCapability::hardwareMode +``` + +**描述:** + +是否支持设备绑定处理。 + + +### id + + +``` +unsigned int AudioSceneDescriptor::SceneDesc::id +``` + +**描述:** + +音频场景的ID。 + + +### interleaved + + +``` +bool AudioSampleAttributes::interleaved +``` + +**描述:** + +音频数据交织的标记。 + + +### isBigEndian + + +``` +bool AudioSampleAttributes::isBigEndian +``` + +**描述:** + +音频数据的大端标志。 + + +### isShareable + + +``` +int32_t AudioMmapBufferDescripter::isShareable +``` + +**描述:** + +mmap缓冲区是否可以在进程间共享。 + + +### isSignedData + + +``` +bool AudioSampleAttributes::isSignedData +``` + +**描述:** + +音频数据的有符号或无符号标志 + + +### mask + + +``` +enum AudioPortPassthroughMode AudioSubPortCapability::mask +``` + +**描述:** + +数据透传模式,详情参考[AudioPortPassthroughMode](#audioportpassthroughmode)。 + + +### memoryAddress + + +``` +void* AudioMmapBufferDescripter::memoryAddress +``` + +**描述:** + +指向mmap缓冲区的指针。 + + +### memoryFd + + +``` +int32_t AudioMmapBufferDescripter::memoryFd +``` + +**描述:** + +mmap缓冲区的文件描述符。 + + +### moduleId [1/2] + + +``` +int32_t AudioDevExtInfo::moduleId +``` + +**描述:** + +音频流绑定的模块ID。 + + +### moduleId [2/2] + + +``` +int32_t AudioMixExtInfo::moduleId +``` + +**描述:** + +流所属模块标识符。 + + +### period + + +``` +uint32_t AudioSampleAttributes::period +``` + +**描述:** + +音频采样周期。 + + +### pins + + +``` +enum AudioPortPin AudioDeviceDescriptor::pins +``` + +**描述:** + +音频端口上的PIN脚(输出、输入),详情参考[AudioPortPin](#audioportpin)。 + + +### portId [1/4] + + +``` +unsigned int AudioPort::portId +``` + +**描述:** + +音频端口的ID。 + + +### portId [2/4] + + +``` +unsigned int AudioDeviceDescriptor::portId +``` + +**描述:** + +音频端口ID。 + + +### portId [3/4] + + +``` +unsigned int AudioSubPortCapability::portId +``` + +**描述:** + +子端口ID。 + + +### portId [4/4] + + +``` +int32_t AudioRouteNode::portId +``` + +**描述:** + +音频端口ID。 + + +### portName + + +``` +const char* AudioPort::portName +``` + +**描述:** + +音频端口的名称。 + + +### portNum + + +``` +unsigned int AudioAdapterDescriptor::portNum +``` + +**描述:** + +一个音频适配器支持的端口数目。 + + +### ports + + +``` +struct AudioPort* AudioAdapterDescriptor::ports +``` + +**描述:** + +一个音频适配器支持的端口列表。 + + +### role + + +``` +enum AudioPortRole AudioRouteNode::role +``` + +**描述:** + +指定端口角色为sink或source。 + + +### sampleRate + + +``` +unsigned int AudioSampleAttributes::sampleRate +``` + +**描述:** + +音频采样频率。 + + +### sampleRateMasks + + +``` +unsigned int AudioPortCapability::sampleRateMasks +``` + +**描述:** + +支持的音频采样频率(8k、16k、32k、48k)。 + + +### scene + + +``` +union AudioSceneDescriptor::SceneDesc AudioSceneDescriptor::scene +``` + +**描述:** + +音频场景的名称。 + + +### sessionType + + +``` +enum AudioSessionType AudioSessionExtInfo::sessionType +``` + +**描述:** + +音频会话类型。 + + +### silenceThreshold + + +``` +uint32_t AudioSampleAttributes::silenceThreshold +``` + +**描述:** + +音频捕获缓冲区阈值。 + + +### sinks + + +``` +const struct AudioRouteNode* AudioRoute::sinks +``` + +**描述:** + +接受端列表。 + + +### sinksNum + + +``` +uint32_t AudioRoute::sinksNum +``` + +**描述:** + +接受端节点数量。 + + +### sources + + +``` +const struct AudioRouteNode* AudioRoute::sources +``` + +**描述:** + +发送端列表。 + + +### sourcesNum + + +``` +uint32_t AudioRoute::sourcesNum +``` + +**描述:** + +发送端节点数量。 + + +### startThreshold + + +``` +uint32_t AudioSampleAttributes::startThreshold +``` + +**描述:** + +音频渲染开始阈值。 + + +### stopThreshold + + +``` +uint32_t AudioSampleAttributes::stopThreshold +``` + +**描述:** + +音频渲染停止阈值。 + + +### streamId [1/2] + + +``` +int32_t AudioSampleAttributes::streamId +``` + +**描述:** + +渲染或捕获的音频标识符。 + + +### streamId [2/2] + + +``` +int32_t AudioMixExtInfo::streamId +``` + +**描述:** + +由调用者传递的Render或Capture标识符。 + + +### subPorts + + +``` +struct AudioSubPortCapability* AudioPortCapability::subPorts +``` + +**描述:** + +支持的子端口列表。 + + +### subPortsNum + + +``` +unsigned int AudioPortCapability::subPortsNum +``` + +**描述:** + +支持的子端口数目(仅用于输出设备)。 + + +### supportSampleFormatNum + + +``` +uint32_t AudioPortCapability::supportSampleFormatNum +``` + +**描述:** + +支持的音频样本格式数量。 + + +### supportSampleFormats + + +``` +enum AudioSampleFormat* AudioPortCapability::supportSampleFormats +``` + +**描述:** + +支持的音频样本格式,详请参考[AudioSampleFormat](_codec.md#audiosampleformat)。 + + +### totalBufferFrames + + +``` +int32_t AudioMmapBufferDescripter::totalBufferFrames +``` + +**描述:** + +缓冲区总大小,单位:帧。 + + +### transferFrameSize + + +``` +int32_t AudioMmapBufferDescripter::transferFrameSize +``` + +**描述:** + +传输大小,单位:帧。 + + +### tvNSec + + +``` +int64_t AudioTimeStamp::tvNSec +``` + +**描述:** + +tvNSec时间,单位:纳秒。 + + +### tvSec + + +``` +int64_t AudioTimeStamp::tvSec +``` + +**描述:** + +tvSec时间,单位:秒。 + + +### type [1/3] + + +``` +enum AudioCategory AudioSampleAttributes::type +``` + +**描述:** + +音频类型,详情参考[AudioCategory](#audiocategory)。 + + +### type [2/3] + + +``` +enum AudioPortPin AudioDevExtInfo::type +``` + +**描述:** + +音频端口上的PIN脚(输出、输入),详情参考[AudioPortPin](#audioportpin)。 + + +### type [3/3] + + +``` +enum AudioPortType AudioRouteNode::type +``` + +**描述:** + +指定端口类型。 + + +### device + + +``` + struct AudioDevExtInfo AudioRouteNode::device +``` + +**描述:** + +设备特定信息。 + + +### mix + + +``` + struct AudioMixExtInfo AudioRouteNode::mix +``` + +**描述:** + +音轨特定信息。 + + +### session + + +``` + struct AudioSessionExtInfo AudioRouteNode::session +``` + +**描述:** + +会话特定信息。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_adapter.md b/zh-cn/device-dev/reference/hdi-apis/_audio_adapter.md new file mode 100644 index 0000000000000000000000000000000000000000..c4ddc25428e9e04cacde47a42b131bec1d9e60cf --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_adapter.md @@ -0,0 +1,326 @@ +# AudioAdapter + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [InitAllPorts](#initallports) )(struct AudioAdapter \*adapter) | 初始化一个音频适配器所有的端口驱动 [更多...](#initallports) | +| ( [CreateRender](#createrender) )(struct AudioAdapter \*adapter, const struct [AudioDeviceDescriptor](_audio_device_descriptor.md) \*desc, const struct [AudioSampleAttributes](_audio_sample_attributes.md) \*attrs, struct [AudioRender](_audio_render.md) \*\*render) | 创建一个音频播放(render)接口的对象 [更多...](#createrender) | +| ( [DestroyRender](#destroyrender) )(struct AudioAdapter \*adapter, struct [AudioRender](_audio_render.md) \*render) | 销毁一个音频播放(render)接口的对象 [更多...](#destroyrender) | +| ( [CreateCapture](#createcapture) )(struct AudioAdapter \*adapter, const struct [AudioDeviceDescriptor](_audio_device_descriptor.md) \*desc, const struct [AudioSampleAttributes](_audio_sample_attributes.md) \*attrs, struct [AudioCapture](_audio_capture.md) \*\*capture) | 创建一个音频录音(capture)接口的对象 [更多...](#createcapture) | +| ( [DestroyCapture](#destroycapture) )(struct AudioAdapter \*adapter, struct [AudioCapture](_audio_capture.md) \*capture) | 销毁一个音频录音(capture)接口的对象 [更多...](#destroycapture) | +| ( [GetPortCapability](#getportcapability) )(struct AudioAdapter \*adapter, struct [AudioPort](_audio_port.md) \*port, struct [AudioPortCapability](_audio_port_capability.md) \*capability) | 获取一个音频适配器的端口驱动的能力集 [更多...](#getportcapability) | +| ( [SetPassthroughMode](#setpassthroughmode) )(struct AudioAdapter \*adapter, struct [AudioPort](_audio_port.md) \*port, enum [AudioPortPassthroughMode](_audio.md#audioportpassthroughmode) mode) | 设置音频端口驱动的数据透传模式 [更多...](#setpassthroughmode) | +| ( [GetPassthroughMode](#getpassthroughmode) )(struct AudioAdapter \*adapter, struct [AudioPort](_audio_port.md) \*port, enum [AudioPortPassthroughMode](_audio.md#audioportpassthroughmode) \*mode) | 获取音频端口驱动的数据透传模式 [更多...](#getpassthroughmode) | +| ( [UpdateAudioRoute](#updateaudioroute) )(struct AudioAdapter \*adapter, const struct [AudioRoute](_audio_route.md) \*route, int32_t \*routeHandle) | 更新一个或多个发送端和接受端之间的路由 [更多...](#updateaudioroute) | +| ( [ReleaseAudioRoute](#releaseaudioroute) )(struct  \*adapter, int32_t routeHandle) | 释放一个音频路由. [更多...](#releaseaudioroute) | + + +## **详细描述** + +AudioAdapter音频适配器接口 + +提供音频适配器(声卡)对外支持的驱动能力,包括初始化端口、创建render、创建capture、获取端口能力集等 + +**参见:** + +[AudioRender](_audio_render.md) + +[AudioCapture](_audio_capture.md) + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### CreateCapture + + +``` +int32_t(* AudioAdapter::CreateCapture) (struct AudioAdapter *adapter, const struct AudioDeviceDescriptor *desc, const struct AudioSampleAttributes *attrs, struct AudioCapture **capture) +``` + +**描述:** + +创建一个音频录音(capture)接口的对象 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| adapter | 待操作的音频适配器的指针 | +| desc | 指向要启动的音频适配器的描述符的指针 | +| attrs | 指向要打开的音频采样属性的指针 | +| capture | 指向AudioCapture对象的二级指针 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[GetPortCapability](#getportcapability) + +[DestroyCapture](#destroycapture) + + +### CreateRender + + +``` +int32_t(* AudioAdapter::CreateRender) (struct AudioAdapter *adapter, const struct AudioDeviceDescriptor *desc, const struct AudioSampleAttributes *attrs, struct AudioRender **render) +``` + +**描述:** + +创建一个音频播放(render)接口的对象 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| adapter | 待操作的音频适配器对象 | +| desc | 待打开的音频设备描述符 | +| attrs | 待打开的音频采样属性 | +| render | 获取的音频播放接口的对象实例保存到render中 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[GetPortCapability](#getportcapability) + +[DestroyRender](#destroyrender) + + +### DestroyCapture + + +``` +int32_t(* AudioAdapter::DestroyCapture) (struct AudioAdapter *adapter, struct AudioCapture *capture) +``` + +**描述:** + +销毁一个音频录音(capture)接口的对象 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| adapter | 待操作的音频适配器对象 | +| capture | 待操作的音频录音接口对象 | + +**注意:** + +在音频录音过程中,不能销毁该接口对象 + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[CreateCapture](#createcapture) + + +### DestroyRender + + +``` +int32_t(* AudioAdapter::DestroyRender) (struct AudioAdapter *adapter, struct AudioRender *render) +``` + +**描述:** + +销毁一个音频播放(render)接口的对象 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| adapter | 待操作的音频适配器对象 | +| render | 待操作的音频播放接口对象 | + +**注意:** + +在音频播放过程中,不能销毁该接口对象 + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[CreateRender](#createrender) + + +### GetPassthroughMode + + +``` +int(* AudioAdapter::GetPassthroughMode) (struct AudioAdapter *adapter, struct AudioPort *port, enum AudioPortPassthroughMode *mode) +``` + +**描述:** + +获取音频端口驱动的数据透传模式 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| adapter | 待操作的音频适配器对象 | +| port | 待获取的端口 | +| mode | 获取的传输模式保存到mode中 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[SetPassthroughMode](#setpassthroughmode) + + +### GetPortCapability + + +``` +int(* AudioAdapter::GetPortCapability) (struct AudioAdapter *adapter, struct AudioPort *port, struct AudioPortCapability *capability) +``` + +**描述:** + +获取一个音频适配器的端口驱动的能力集 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| adapter | 待操作的音频适配器对象 | +| port | 待获取的端口 | +| capability | 获取的端口能力保存到capability中 | + +**返回:** + +成功返回值0,失败返回负值 + + +### InitAllPorts + + +``` +int(* AudioAdapter::InitAllPorts) (struct AudioAdapter *adapter) +``` + +**描述:** + +初始化一个音频适配器所有的端口驱动 + +在音频服务中,调用其他驱动接口前需要首先调用该接口检查端口是否已经初始化完成,如果端口驱动初始化完成,则函数返回值0, 否则返回负值,如果端口没有初始化完成,则需要等待一段时间(例如100ms)后重新进行检查,直到端口初始化完成后再继续操作 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| adapter | 待操作的音频适配器对象 | + +**返回:** + +成功返回值0,失败返回负值 + + +### ReleaseAudioRoute + + +``` +int32_t(* AudioAdapter::ReleaseAudioRoute) (struct AudioAdapter *adapter, int32_t routeHandle) +``` + +**描述:** + +释放一个音频路由. + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| adapter | 待操作的音频适配器对象 | +| routeHandle | 待释放的路由句柄. | + +**返回:** + +成功返回值0,失败返回负值 + + +### SetPassthroughMode + + +``` +int(* AudioAdapter::SetPassthroughMode) (struct AudioAdapter *adapter, struct AudioPort *port, enum AudioPortPassthroughMode mode) +``` + +**描述:** + +设置音频端口驱动的数据透传模式 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| adapter | 待操作的音频适配器对象 | +| port | 待设置的端口 | +| mode | 待设置的传输模式 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[GetPassthroughMode](#getpassthroughmode) + + +### UpdateAudioRoute + + +``` +int32_t(* AudioAdapter::UpdateAudioRoute) (struct AudioAdapter *adapter, const struct AudioRoute *route, int32_t *routeHandle) +``` + +**描述:** + +更新一个或多个发送端和接受端之间的路由 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| adapter | 待操作的音频适配器对象 | +| route | 路由信息 | +| routeHandle | 生成的路由句柄 | + +**返回:** + +成功返回值0,失败返回负值 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_adapter_descriptor.md b/zh-cn/device-dev/reference/hdi-apis/_audio_adapter_descriptor.md new file mode 100644 index 0000000000000000000000000000000000000000..37968692e35f2e2db9256d19583836daad3789e0 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_adapter_descriptor.md @@ -0,0 +1,25 @@ +# AudioAdapterDescriptor + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [adapterName](_audio.md#adaptername) | 音频适配器的名称。 | +| [portNum](_audio.md#portnum) | 一个音频适配器支持的端口数目。 | +| [ports](_audio.md#ports) | 一个音频适配器支持的端口列表。 | + + +## **详细描述** + +音频适配器描述符。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_attribute.md b/zh-cn/device-dev/reference/hdi-apis/_audio_attribute.md new file mode 100644 index 0000000000000000000000000000000000000000..84a9d471c65afca1d228083706ac4d352a689826 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_attribute.md @@ -0,0 +1,263 @@ +# AudioAttribute + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [GetFrameSize](#getframesize) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, uint64_t \*size) | 获取音频帧(frame)的大小 [更多...](#getframesize) | +| ( [GetFrameCount](#getframecount) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, uint64_t \*count) | 获取音频buffer中的音频帧数 [更多...](#getframecount) | +| ( [SetSampleAttributes](#setsampleattributes) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, const struct [AudioSampleAttributes](_audio_sample_attributes.md) \*attrs) | 设置音频采样的属性参数 [更多...](#setsampleattributes) | +| ( [GetSampleAttributes](#getsampleattributes) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, struct [AudioSampleAttributes](_audio_sample_attributes.md) \*attrs) | 获取音频采样的属性参数 [更多...](#getsampleattributes) | +| ( [GetCurrentChannelId](#getcurrentchannelid) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, uint32_t \*channelId) | 获取音频的数据通道ID [更多...](#getcurrentchannelid) | +| ( [SetExtraParams](#setextraparams) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, const char \*keyValueList) | 设置音频拓展参数 [更多...](#setextraparams) | +| ( [GetExtraParams](#getextraparams) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, char \*keyValueList) | 获取音频拓展参数 [更多...](#getextraparams) | +| ( [ReqMmapBuffer](#reqmmapbuffer) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, int32_t reqSize, struct [AudioMmapBufferDescripter](_audio_mmap_buffer_descripter.md) \*desc) | 请求mmap缓冲区 [更多...](#reqmmapbuffer) | +| ( [GetMmapPosition](#getmmapposition) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, uint64_t \*frames, struct [AudioTimeStamp](_audio_time_stamp.md) \*time) | 获取当前mmap的读/写位置 [更多...](#getmmapposition) | + + +## **详细描述** + +AudioAttribute音频属性接口 + +提供音频播放(render)或录音(capture)需要的公共属性驱动能力,包括获取帧(frame)信息、设置采样属性等。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### GetCurrentChannelId + + +``` +int32_t(* AudioAttribute::GetCurrentChannelId) (AudioHandle handle, uint32_t *channelId) +``` + +**描述:** + +获取音频的数据通道ID + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| channelId | 获取的通道ID保存到channelId中 | + +**返回:** + +成功返回值0,失败返回负值 + + +### GetExtraParams + + +``` +int32_t(* AudioAttribute::GetExtraParams) (AudioHandle handle, char *keyValueList) +``` + +**描述:** + +获取音频拓展参数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| keyValueList | 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割 | + +**返回:** + +成功返回值0,失败返回负值。 + + +### GetFrameCount + + +``` +int32_t(* AudioAttribute::GetFrameCount) (AudioHandle handle, uint64_t *count) +``` + +**描述:** + +获取音频buffer中的音频帧数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| count | 一个音频buffer中包含的音频帧数,获取后保存到count中 | + +**返回:** + +成功返回值0,失败返回负值 + + +### GetFrameSize + + +``` +int32_t(* AudioAttribute::GetFrameSize) (AudioHandle handle, uint64_t *size) +``` + +**描述:** + +获取音频帧(frame)的大小 + +获取一帧音频数据的长度(字节数) + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| size | 获取的音频帧大小(字节数)保存到size中 | + +**返回:** + +成功返回值0,失败返回负值 + + +### GetMmapPosition + + +``` +int32_t(* AudioAttribute::GetMmapPosition) (AudioHandle handle, uint64_t *frames, struct AudioTimeStamp *time) +``` + +**描述:** + +获取当前mmap的读/写位置 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| frames | 获取的音频帧计数保存到frames中 | +| time | 获取的关联时间戳保存到time中 | + +**返回:** + +成功返回值0,失败返回负值 + + +### GetSampleAttributes + + +``` +int32_t(* AudioAttribute::GetSampleAttributes) (AudioHandle handle, struct AudioSampleAttributes *attrs) +``` + +**描述:** + +获取音频采样的属性参数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| attrs | 获取的音频采样属性(例如采样频率、采样精度、通道)保存到attrs中 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[SetSampleAttributes](#setsampleattributes) + + +### ReqMmapBuffer + + +``` +int32_t(* AudioAttribute::ReqMmapBuffer) (AudioHandle handle, int32_t reqSize, struct AudioMmapBufferDescripter *desc) +``` + +**描述:** + +请求mmap缓冲区 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| reqSize | 请求缓冲区的大小 | +| desc | 缓冲区描述符 | + +**返回:** + +成功返回值0,失败返回负值 + + +### SetExtraParams + + +``` +int32_t(* AudioAttribute::SetExtraParams) (AudioHandle handle, const char *keyValueList) +``` + +**描述:** + +设置音频拓展参数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| keyValueList | 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割 | + +**返回:** + +成功返回值0,失败返回负值 + + +### SetSampleAttributes + + +``` +int32_t(* AudioAttribute::SetSampleAttributes) (AudioHandle handle, const struct AudioSampleAttributes *attrs) +``` + +**描述:** + +设置音频采样的属性参数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| attrs | 待设置的音频采样属性,例如采样频率、采样精度、通道 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[GetSampleAttributes](#getsampleattributes) diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_capture.md b/zh-cn/device-dev/reference/hdi-apis/_audio_capture.md new file mode 100644 index 0000000000000000000000000000000000000000..0cc96d36c54f5325f93f26beb4f2e8ec7daffd6f --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_capture.md @@ -0,0 +1,84 @@ +# AudioCapture + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| control | 音频控制能力接口,详情参考[AudioControl](_audio_control.md) | +| attr | 音频属性能力接口,详情参考[AudioAttribute](_audio_attribute.md) | +| scene | 音频场景能力接口,详情参考[AudioScene](_audio_scene.md) | +| volume | 音频音量能力接口,详情参考[AudioVolume](_audio_volume.md) | +| ( [CaptureFrame](#captureframe) )(struct AudioCapture \*capture, void \*frame, uint64_t requestBytes, uint64_t \*replyBytes) | 从音频驱动中录制(capture)一帧输入数据(录音,音频上行数据) [更多...](#captureframe) | +| ( [GetCapturePosition](#getcaptureposition) )(struct AudioCapture \*capture, uint64_t \*frames, struct [AudioTimeStamp](_audio_time_stamp.md) \*time) | 获取音频输入帧数的上一次计数 [更多...](#getcaptureposition) | + + +## **详细描述** + +AudioCapture音频录音接口。 + + +## **类成员变量说明** + + +### CaptureFrame + + +``` +int32_t(* AudioCapture::CaptureFrame) (struct AudioCapture *capture, void *frame, uint64_t requestBytes, uint64_t *replyBytes) +``` + +**描述:** + +从音频驱动中录制(capture)一帧输入数据(录音,音频上行数据) + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| capture | 待操作的音频录音接口对象 | +| frame | 待存放输入数据的音频frame | +| requestBytes | 待存放输入数据的音频frame大小(字节数) | +| replyBytes | 实际读取到的音频数据长度(字节数),获取后保存到replyBytes中 | + +**返回:** + +成功返回值0,失败返回负值 + + +### GetCapturePosition + + +``` +int32_t(* AudioCapture::GetCapturePosition) (struct AudioCapture *capture, uint64_t *frames, struct AudioTimeStamp *time) +``` + +**描述:** + +获取音频输入帧数的上一次计数 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| capture | 待操作的音频录音接口对象 | +| frames | 获取的音频帧计数保存到frames中 | +| time | 获取的关联时间戳保存到time中 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[CaptureFrame](#captureframe) diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_control.md b/zh-cn/device-dev/reference/hdi-apis/_audio_control.md new file mode 100644 index 0000000000000000000000000000000000000000..1d4d71c6d86d3874b823102ae0d71b296daa5794 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_control.md @@ -0,0 +1,214 @@ +# AudioControl + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [Start](#start) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle) | 启动一个音频播放(render)或录音(capture)处理 [更多...](#start) | +| ( [Stop](#stop) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle) | 停止一个音频播放(render)或录音(capture)处理 [更多...](#stop) | +| ( [Pause](#pause) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle) | 暂停一个音频播放(render)或录音(capture)处理 [更多...](#pause) | +| ( [Resume](#resume) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle) | 恢复一个音频播放(render)或录音(capture)处理 [更多...](#resume) | +| ( [Flush](#flush) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle) | 刷新音频缓冲区buffer中的数据 [更多...](#flush) | +| ( [TurnStandbyMode](#turnstandbymode) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle) | 设置或去设置设备的待机模式 [更多...](#turnstandbymode) | +| ( [AudioDevDump](#audiodevdump) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, int32_t range, int32_t fd) | Dump音频设备信息 [更多...](#audiodevdump) | + + +## **详细描述** + +AudioControl音频控制接口。 + +提供音频播放(render)或录音(capture)需要的公共控制驱动能力,包括Start、Stop、Pause、Resume、Flush等。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### AudioDevDump + + +``` +int32_t(* AudioControl::AudioDevDump) (AudioHandle handle, int32_t range, int32_t fd) +``` + +**描述:** + +Dump音频设备信息 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| range | Dump信息范围,分为简要信息、全量信息 | +| fd | 指定Dump目标文件 | + +**返回:** + +成功返回值0,失败返回负值 + + +### Flush + + +``` +int32_t(* AudioControl::Flush) (AudioHandle handle) +``` + +**描述:** + +刷新音频缓冲区buffer中的数据 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | + +**返回:** + +成功返回值0,失败返回负值 + + +### Pause + + +``` +int32_t(* AudioControl::Pause) (AudioHandle handle) +``` + +**描述:** + +暂停一个音频播放(render)或录音(capture)处理 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[Resume](#resume) + + +### Resume + + +``` +int32_t(* AudioControl::Resume) (AudioHandle handle) +``` + +**描述:** + +恢复一个音频播放(render)或录音(capture)处理 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[Pause](#pause) + + +### Start + + +``` +int32_t(* AudioControl::Start) (AudioHandle handle) +``` + +**描述:** + +启动一个音频播放(render)或录音(capture)处理 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[Stop](#stop) + + +### Stop + + +``` +int32_t(* AudioControl::Stop) (AudioHandle handle) +``` + +**描述:** + +停止一个音频播放(render)或录音(capture)处理 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[Start](#start) + + +### TurnStandbyMode + + +``` +int32_t(* AudioControl::TurnStandbyMode) (AudioHandle handle) +``` + +**描述:** + +设置或去设置设备的待机模式 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | + +**返回:** + +设置设备待机模式成功返回值0,再次执行后去设置待机模式成功返回正值,失败返回负值 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_dev_ext_info.md b/zh-cn/device-dev/reference/hdi-apis/_audio_dev_ext_info.md new file mode 100644 index 0000000000000000000000000000000000000000..1a4a421f8463c9ce844d987f98c89b4cce8cffe9 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_dev_ext_info.md @@ -0,0 +1,25 @@ +# AudioDevExtInfo + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [moduleId](_audio.md#moduleid-12) | 音频流绑定的模块ID。 | +| [type](_audio.md#type-23) | 音频端口上的PIN脚(输出、输入),详情参考[AudioPortPin](_audio.md#audioportpin)。 | +| [desc](_audio.md#desc-55) | 地址描述。 | + + +## **详细描述** + +音频设备拓展信息。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_device_descriptor.md b/zh-cn/device-dev/reference/hdi-apis/_audio_device_descriptor.md new file mode 100644 index 0000000000000000000000000000000000000000..5e10acce99f5c951a1daf983a6b01e36fe84b3de --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_device_descriptor.md @@ -0,0 +1,25 @@ +# AudioDeviceDescriptor + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [portId](_audio.md#portid-24) | 频端口ID。 | +| [pins](_audio.md#pins) | 音频端口上的PIN脚(输出、输入),详情参考[AudioPortPin](_audio.md#audioportpin)。 | +| [desc](_audio.md#desc-15) | 以字符串命名的音频设备。 | + + +## **详细描述** + +音频场景描述符。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_manager.md b/zh-cn/device-dev/reference/hdi-apis/_audio_manager.md new file mode 100644 index 0000000000000000000000000000000000000000..045023b3ff1ff9db7e0bf85e19d2546fdf4a6fd9 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_manager.md @@ -0,0 +1,148 @@ +# AudioManager + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [GetAllAdapters](#getalladapters) )(struct AudioAdapterManager \*manager, struct [AudioAdapterDescriptor](_audio_adapter_descriptor.md) \*\*descs, int \*size) | 获取音频驱动中支持的所有适配器的列表 [更多...](#getalladapters) | +| ( [LoadAdapter](#loadadapter) )(struct AudioAdapterManager \*manager, const struct [AudioAdapterDescriptor](_audio_adapter_descriptor.md) \*desc, struct [AudioAdapter](_audio_adapter.md) \*\*adapter) | 加载一个音频适配器(声卡)的驱动 [更多...](#loadadapter) | +| ( [UnloadAdapter](#unloadadapter) )(struct AudioAdapterManager \*manager, struct [AudioAdapter](_audio_adapter.md) \*adapter) | 卸载音频适配器(声卡)的驱动 [更多...](#unloadadapter) | +| ( [ReleaseAudioManagerObject](#releaseaudiomanagerobject) )(struct AudioManager \*object) | 释放音频管理接口对象 [更多...](#releaseaudiomanagerobject) | + + +## **详细描述** + +AudioManager音频适配器管理接口 + +按照音频服务下发的音频适配器(声卡)描述符加载一个具体的音频适配器驱动程序 + +参见: + +[AudioAdapter](_audio_adapter.md) + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### GetAllAdapters + + +``` +int(* AudioManager::GetAllAdapters) (struct AudioAdapterManager *manager, struct AudioAdapterDescriptor **descs, int *size) +``` + +**描述:** + +获取音频驱动中支持的所有适配器的列表 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| manager | 待操作的音频管理接口对象 | +| descs | 获取到的音频适配器列表保存到descs中 | +| size | 获取到的音频适配器列表的长度保存到size中 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[LoadAdapter](#loadadapter) + + +### LoadAdapter + + +``` +int(* AudioManager::LoadAdapter) (struct AudioAdapterManager *manager, const struct AudioAdapterDescriptor *desc, struct AudioAdapter **adapter) +``` + +**描述:** + +加载一个音频适配器(声卡)的驱动 + +加载一个具体的音频驱动,例如usb驱动,在具体实现中可能加载的是一个动态链接库(\*.so) + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| manager | 待操作的音频管理接口对象 | +| desc | 待加载的音频适配器描述符 | +| adapter | 获取的音频适配器接口的对象实例保存到adapter中 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[GetAllAdapters](#getalladapters) + +[UnloadAdapter](#unloadadapter) + + +### ReleaseAudioManagerObject + + +``` +bool(* AudioManager::ReleaseAudioManagerObject) (struct AudioManager *object) +``` + +**描述:** + +释放音频管理接口对象 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| object | 待操作的音频管理接口对象 | + +**返回:** + +成功返回ture,失败返回false + + +### UnloadAdapter + + +``` +void(* AudioManager::UnloadAdapter) (struct AudioAdapterManager *manager, struct AudioAdapter *adapter) +``` + +**描述:** + +卸载音频适配器(声卡)的驱动 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| manager | 待操作的音频管理接口对象 | +| adapter | 待卸载的音频适配器接口的对象 | + +**参见:** + +[LoadAdapter](#loadadapter) diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_mix_ext_info.md b/zh-cn/device-dev/reference/hdi-apis/_audio_mix_ext_info.md new file mode 100644 index 0000000000000000000000000000000000000000..fcf31a50003dfd54672b80acc06b907f1f80295b --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_mix_ext_info.md @@ -0,0 +1,24 @@ +# AudioMixExtInfo + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [moduleId](_audio.md#moduleid-22) | 流所属模块标识符。 | +| [streamId](_audio.md#streamid-22) | 由调用者传递的Render或Capture标识符。 | + + +## **详细描述** + +音轨拓展信息。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_mmap_buffer_descripter.md b/zh-cn/device-dev/reference/hdi-apis/_audio_mmap_buffer_descripter.md new file mode 100644 index 0000000000000000000000000000000000000000..cd301a7d69f96715c46423c1ed984d7b59b17173 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_mmap_buffer_descripter.md @@ -0,0 +1,27 @@ +# AudioMmapBufferDescripter + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [memoryAddress](_audio.md#memoryaddress) | 指向mmap缓冲区的指针。 | +| [memoryFd](_audio.md#memoryfd) | mmap缓冲区的文件描述符。 | +| [totalBufferFrames](_audio.md#totalbufferframes) | 缓冲区总大小,单位:帧。 | +| [transferFrameSize](_audio.md#transferframesize) | 传输大小,单位:帧。 | +| [isShareable](_audio.md#isshareable) | mmap缓冲区是否可以在进程间共享。 | + + +## **详细描述** + +mmap缓冲区描述符。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_port.md b/zh-cn/device-dev/reference/hdi-apis/_audio_port.md new file mode 100644 index 0000000000000000000000000000000000000000..5ad207379d352367e346ca39e607789e4d38207a --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_port.md @@ -0,0 +1,25 @@ +# AudioPort + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [dir](_audio.md#dir) | 音频端口的类型,详情参考[AudioPortDirection](_audio.md#audioportdirection)。 | +| [portId](_audio.md#portid-14) | 音频端口的ID。 | +| [portName](_audio.md#portname) | 音频端口的名称。 | + + +## **详细描述** + +音频端口。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_port_cap.md b/zh-cn/device-dev/reference/hdi-apis/_audio_port_cap.md new file mode 100644 index 0000000000000000000000000000000000000000..6545ac35c4833ef5e247a78a03361ce016574928 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_port_cap.md @@ -0,0 +1,77 @@ +# AudioPortCap + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [sampleFormats](#sampleformats) [[SAMPLE_FMT_NUM](_codec.md#ga9bda75c363e9bcff915cdd521dd7ba84)] | 支持的音频采样格式,详见[AudioSampleFormat](_codec.md#audiosampleformat)。 | +| [sampleRate](#samplerate) [[SAMPLE_RATE_NUM](_codec.md#ga0d905eaa05b4b6fcec76924eb795d7fe)] | 支持的音频采样率,详见[AudioSampleRate](_codec.md#audiosamplerate)。 | +| [channelLayouts](#channellayouts) [[CHANNEL_NUM](_codec.md#ga6511732d5b29a6781cf38783157f21e1)] | 支持的音频通道数channel layouts。 | +| [channelCount](#channelcount) [[CHANNEL_NUM](_codec.md#ga6511732d5b29a6781cf38783157f21e1)] | 支持的音频通道数。 | + + +## **详细描述** + +定义音频编解码能力。 + + +## **类成员变量说明** + + +### channelCount + + +``` +int32_t AudioPortCap::channelCount[CHANNEL_NUM] +``` + +**描述:** + +支持的音频通道数 + + +### channelLayouts + + +``` +int32_t AudioPortCap::channelLayouts[CHANNEL_NUM] +``` + +**描述:** + +支持的音频通道数channel layouts + + +### sampleFormats + + +``` +int32_t AudioPortCap::sampleFormats[SAMPLE_FMT_NUM] +``` + +**描述:** + +支持的音频采样格式,详见[AudioSampleFormat](_codec.md#audiosampleformat) + + +### sampleRate + + +``` +int32_t AudioPortCap::sampleRate[SAMPLE_RATE_NUM] +``` + +**描述:** + +支持的音频采样率,详见[AudioSampleRate](_codec.md#audiosamplerate) diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_port_capability.md b/zh-cn/device-dev/reference/hdi-apis/_audio_port_capability.md new file mode 100644 index 0000000000000000000000000000000000000000..40a05c9e2259f14eb9abf418fe8c2511820f5d51 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_port_capability.md @@ -0,0 +1,34 @@ +# AudioPortCapability + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [deviceType](_audio.md#devicetype) | 设备输出、输入类型。 | +| [deviceId](_audio.md#deviceid) | 绑定(bind)设备ID,唯一的设备识别符。 | +| [hardwareMode](_audio.md#hardwaremode) | 是否支持设备绑定处理。 | +| [formatNum](_audio.md#formatnum) | 支持的音频格式数目。 | +| [formats](_audio.md#formats) | 支持的音频格式,详情参考[AudioFormat](_audio.md#audioformat)。 | +| [sampleRateMasks](_audio.md#sampleratemasks) | 支持的音频采样频率(8k、16k、32k、48k)。 | +| [channelMasks](_audio.md#channelmasks) | 设备的声道布局掩码(mask),详情参考[AudioChannelMask](_audio.md#audiochannelmask)。 | +| [channelCount](_audio.md#channelcount-22) | 支持的最大声道总数。 | +| [subPortsNum](_audio.md#subportsnum) | 支持的子端口数目(仅用于输出设备)。 | +| [subPorts](_audio.md#subports) | 支持的子端口列表。 | +| [supportSampleFormatNum](_audio.md#supportsampleformatnum) | 支持的音频样本格式数量。 | +| [supportSampleFormats](_audio.md#supportsampleformats) | 支持的音频样本格式,详请参考[AudioSampleFormat](_codec.md#audiosampleformat)。 | + + +## **详细描述** + +音频端口的支持能力。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_render.md b/zh-cn/device-dev/reference/hdi-apis/_audio_render.md new file mode 100644 index 0000000000000000000000000000000000000000..8f2fbb7f23b9011a2a2c0949356cafd80e58c7c0 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_render.md @@ -0,0 +1,297 @@ +# AudioRender + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| control | 音频控制能力接口,详情参考[AudioControl](_audio_control.md) | +| attr | 音频属性能力接口,详情参考[AudioAttribute](_audio_attribute.md) | +| scene | 音频场景能力接口,详情参考[AudioScene](_audio_scene.md) | +| volume | 音频音量能力接口,详情参考[AudioVolume](_audio_volume.md) | +| ( [GetLatency](#getlatency) )(struct AudioRender \*render, uint32_t \*ms) | 获取音频硬件驱动估计的延迟时间 [更多...](#getlatency) | +| ( [RenderFrame](#renderframe) )(struct AudioRender \*render, const void \*frame, uint64_t requestBytes, uint64_t \*replyBytes) | 往音频驱动中播放(render)一帧输出数据(放音,音频下行数据) [更多...](#renderframe) | +| ( [GetRenderPosition](#getrenderposition) )(struct AudioRender \*render, uint64_t \*frames, struct [AudioTimeStamp](_audio_time_stamp.md) \*time) | 获取音频输出帧数的上一次计数 [更多...](#getrenderposition) | +| ( [SetRenderSpeed](#setrenderspeed) )(struct AudioRender \*render, float speed) | 设置一个音频的播放速度 [更多...](#setrenderspeed) | +| ( [GetRenderSpeed](#getrenderspeed) )(struct AudioRender \*render, float \*speed) | 获取一个音频当前的播放速度 [更多...](#getrenderspeed) | +| ( [SetChannelMode](#setchannelmode) )(struct AudioRender \*render, enum [AudioChannelMode](_audio.md#audiochannelmode) mode) | 设置音频播放的通道模式 [更多...](#setchannelmode) | +| ( [GetChannelMode](#getchannelmode) )(struct AudioRender \*render, enum [AudioChannelMode](_audio.md#audiochannelmode) \*mode) | 获取音频播放当前的通道模式 [更多...](#getchannelmode) | +| ( [RegCallback](#regcallback) )(struct AudioRender \*render, [RenderCallback](_audio.md#rendercallback) callback, void \*cookie) | 注册音频回调函数,用于放音过程中缓冲区数据写、DrainBuffer完成通知 [更多...](#regcallback) | +| ( [DrainBuffer](#drainbuffer) )(struct AudioRender \*render, enum [AudioDrainNotifyType](_audio.md#audiodrainnotifytype) \*type) | 排空缓冲区中的数据 [更多...](#drainbuffer) | + + +## **详细描述** + +AudioRender音频播放接口 + +提供音频播放支持的驱动能力,包括音频控制、音频属性、音频场景、音频音量、获取硬件延迟时间、播放音频帧数据(render frame)等 + +**参见:** + +[AudioControl](_audio_control.md) + +[AudioAttribute](_audio_attribute.md) + +[AudioScene](_audio_scene.md) + +[AudioVolume](_audio_volume.md) + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### DrainBuffer + + +``` +int32_t(* AudioRender::DrainBuffer) (struct AudioRender *render, enum AudioDrainNotifyType *type) +``` + +**描述:** + +排空缓冲区中的数据 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| render | 待操作的音频播放接口对象 | +| type | DrainBuffer的操作类型,详情请参考[AudioDrainNotifyType](_audio.md#audiodrainnotifytype) | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[RegCallback](#regcallback) + + +### GetChannelMode + + +``` +int32_t(* AudioRender::GetChannelMode) (struct AudioRender *render, enum AudioChannelMode *mode) +``` + +**描述:** + +获取音频播放当前的通道模式 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| render | 待操作的音频播放接口对象 | +| mode | 获取的通道模式保存到mode中 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[SetChannelMode](#setchannelmode) + + +### GetLatency + + +``` +int32_t(* AudioRender::GetLatency) (struct AudioRender *render, uint32_t *ms) +``` + +**描述:** + +获取音频硬件驱动估计的延迟时间 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| render | 待操作的音频播放接口对象 | +| ms | 获取的延迟时间(单位:毫秒)保存到ms中 | + +**返回:** + +成功返回值0,失败返回负值 + + +### GetRenderPosition + + +``` +int32_t(* AudioRender::GetRenderPosition) (struct AudioRender *render, uint64_t *frames, struct AudioTimeStamp *time) +``` + +**描述:** + +获取音频输出帧数的上一次计数 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| render | 待操作的音频播放接口对象 | +| frames | 获取的音频帧计数保存到frames中 | +| time | 获取的关联时间戳保存到time中 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[RenderFrame](#renderframe) + + +### GetRenderSpeed + + +``` +int32_t(* AudioRender::GetRenderSpeed) (struct AudioRender *render, float *speed) +``` + +**描述:** + +获取一个音频当前的播放速度 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| render | 待操作的音频播放接口对象 | +| speed | 获取的播放速度保存到speed中 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[SetRenderSpeed](#setrenderspeed) + + +### RegCallback + + +``` +int32_t(* AudioRender::RegCallback) (struct AudioRender *render, RenderCallback callback, void *cookie) +``` + +**描述:** + +注册音频回调函数,用于放音过程中缓冲区数据写、DrainBuffer完成通知 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| render | 待操作的音频播放接口对象 | +| callback | 注册的回调函数 | +| cookie | 回调函数的入参 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[RegCallback](#regcallback) + + +### RenderFrame + + +``` +int32_t(* AudioRender::RenderFrame) (struct AudioRender *render, const void *frame, uint64_t requestBytes, uint64_t *replyBytes) +``` + +**描述:** + +往音频驱动中播放(render)一帧输出数据(放音,音频下行数据) + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| render | 待操作的音频播放接口对象 | +| frame | 待写入的输出数据的音频frame | +| requestBytes | 待写入的输出数据的音频frame大小(字节数) | +| replyBytes | 实际写入的音频数据长度(字节数),获取后保存到replyBytes中 | + +**返回:** + +成功返回值0,失败返回负值 + + +### SetChannelMode + + +``` +int32_t(* AudioRender::SetChannelMode) (struct AudioRender *render, enum AudioChannelMode mode) +``` + +**描述:** + +设置音频播放的通道模式 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| render | 待操作的音频播放接口对象 | +| speed | 待设置的通道模式 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[GetChannelMode](#getchannelmode) + + +### SetRenderSpeed + + +``` +int32_t(* AudioRender::SetRenderSpeed) (struct AudioRender *render, float speed) +``` + +**描述:** + +设置一个音频的播放速度 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| render | 待操作的音频播放接口对象 | +| speed | 待设置的播放速度 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[GetRenderSpeed](#getrenderspeed) diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_route.md b/zh-cn/device-dev/reference/hdi-apis/_audio_route.md new file mode 100644 index 0000000000000000000000000000000000000000..d4db5ceddec9bf88fbeb75fa15f6c1a61dc57ac5 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_route.md @@ -0,0 +1,26 @@ +# AudioRoute + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [sourcesNum](_audio.md#sourcesnum) | 发送端节点数量。 | +| [sources](_audio.md#sources) | 发送端列表。 | +| [sinksNum](_audio.md#sinksnum) | 接受端节点数量。 | +| [sinks](_audio.md#sinks) | 接受端列表。 | + + +## **详细描述** + +音频路由信息。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_route_node.md b/zh-cn/device-dev/reference/hdi-apis/_audio_route_node.md new file mode 100644 index 0000000000000000000000000000000000000000..2686ecf9b5d43ab44660185531ecc550aca6cc71 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_route_node.md @@ -0,0 +1,28 @@ +# AudioRouteNode + + +## **述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [portId](_audio.md#portid-44) | 音频端口ID。 | +| [role](_audio.md#role) | 指定端口角色为sink或source。 | +| [type](_audio.md#type-33) | 指定端口类型。 | +| [device](_audio.md#device) | 设备特定信息。 | +| [mix](_audio.md#mix) | 音轨特定信息。 | +| [session](_audio.md#session) | 会话特定信息。 | + + +## **详细描述** + +音频路由节点。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_sample_attributes.md b/zh-cn/device-dev/reference/hdi-apis/_audio_sample_attributes.md new file mode 100644 index 0000000000000000000000000000000000000000..8b2c871f1cf272d6f90fbc43ce08b37e108da7f3 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_sample_attributes.md @@ -0,0 +1,35 @@ +# AudioSampleAttributes + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [type](_audio.md#type-13) | 音频类型,详情参考[AudioCategory](_audio.md#audiocategory)。 | +| [interleaved](_audio.md#interleaved) | 音频数据交织的标记。 | +| [format](_audio.md#format) | 音频数据格式,详情参考[AudioFormat](_audio.md#audioformat)。 | +| [sampleRate](_audio.md#samplerate) | 音频采样频率。 | +| [channelCount](_audio.md#channelcount-12) | 音频通道数目,如单通道(mono)为1、立体声(stereo)为2。 | +| [period](_audio.md#period) | 音频采样周期。 | +| [frameSize](_audio.md#framesize) | 音频数据的帧大小。 | +| [isBigEndian](_audio.md#isbigendian) | 音频数据的大端标志。 | +| [isSignedData](_audio.md#issigneddata) | 音频数据的有符号或无符号标志。 | +| [startThreshold](_audio.md#startthreshold) | 音频渲染开始阈值。 | +| [stopThreshold](_audio.md#stopthreshold) | 音频渲染停止阈值。 | +| [silenceThreshold](_audio.md#silencethreshold) | 音频捕获缓冲区阈值。 | +| [streamId](_audio.md#streamid-12) | 渲染或捕获的音频标识符。 | + + +## **详细描述** + +音频采样属性。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_scene.md b/zh-cn/device-dev/reference/hdi-apis/_audio_scene.md new file mode 100644 index 0000000000000000000000000000000000000000..520381a9b410129142f620ecb394f8fa2183ce94 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_scene.md @@ -0,0 +1,100 @@ +# AudioScene + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [CheckSceneCapability](#checkscenecapability) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, const struct [AudioSceneDescriptor](_audio_scene_descriptor.md) \*scene, bool \*supported) | 是否支持某个音频场景的配置 [更多...](#checkscenecapability) | +| ( [SelectScene](#selectscene) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, const struct [AudioSceneDescriptor](_audio_scene_descriptor.md) \*scene) | 选择音频场景 [更多...](#selectscene) | + + +## **详细描述** + +AudioScene音频场景接口。 + +提供音频播放(render)或录音(capture)需要的公共场景驱动能力,包括选择音频场景等。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### CheckSceneCapability + + +``` +int32_t(* AudioScene::CheckSceneCapability) (AudioHandle handle, const struct AudioSceneDescriptor *scene, bool *supported) +``` + +**描述:** + +是否支持某个音频场景的配置 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| scene | 待获取的音频场景描述符 | +| supported | 是否支持的状态保存到supported中,true表示支持,false表示不支持 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[SelectScene](#selectscene) + + +### SelectScene + + +``` +int32_t(* AudioScene::SelectScene) (AudioHandle handle, const struct AudioSceneDescriptor *scene) +``` + +**描述:** + +选择音频场景 + +- 1. 选择一个非常具体的音频场景(应用场景和输出设备的组合),例如同样是使用手机中的喇叭作为输出设备 + - 在媒体播放场景scene为media_speaker + - 在语音通话免提场景scene为voice_speaker + +- 2. 只是选择一个音频场景,例如使用场景为媒体播放(media)、电影播放(movie)、游戏播放(game) + +- 3. 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset) + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| scene | 待设置的音频场景描述符 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[CheckSceneCapability](#checkscenecapability) diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_scene_descriptor.md b/zh-cn/device-dev/reference/hdi-apis/_audio_scene_descriptor.md new file mode 100644 index 0000000000000000000000000000000000000000..c7838b44b90344f42f8bc9b16b63d1f3abdab568 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_scene_descriptor.md @@ -0,0 +1,31 @@ +# AudioSceneDescriptor + + +## **概述** + +**所属模块:** + +[Audio](_audio.md)[更多...](union_audio_scene_descriptor_1_1_scene_desc.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [SceneDesc](union_audio_scene_descriptor_1_1_scene_desc.md) | 音频场景描述 [AudioSceneDescriptor::SceneDesc](union_audio_scene_descriptor_1_1_scene_desc.md) | + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [scene](_audio.md#scene) | 音频场景的名称。 | +| [desc](_audio.md#desc-25) | 音频设备描述符。 | + + +## **详细描述** + +音频场景描述符。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_session_ext_info.md b/zh-cn/device-dev/reference/hdi-apis/_audio_session_ext_info.md new file mode 100644 index 0000000000000000000000000000000000000000..d48ad307922f7be094c3e4492497e7564a9a70e3 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_session_ext_info.md @@ -0,0 +1,23 @@ +# AudioSessionExtInfo + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [sessionType](_audio.md#sessiontype) | 音频会话类型。 | + + +## **详细描述** + +会话拓展信息。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_sub_port_capability.md b/zh-cn/device-dev/reference/hdi-apis/_audio_sub_port_capability.md new file mode 100644 index 0000000000000000000000000000000000000000..1bc223b1d5f70bb6b1725cf4d184216cc1c93e3f --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_sub_port_capability.md @@ -0,0 +1,25 @@ +# AudioSubPortCapability + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [portId](_audio.md#portid-34) | 子端口ID。 | +| [desc](_audio.md#desc-45) | 以字符串命名的子端口。 | +| [mask](_audio.md#mask) | 数据透传模式,详情参考[AudioPortPassthroughMode](_audio.md#audioportpassthroughmode)。 | + + +## **详细描述** + +音频子端口的支持能力。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_time_stamp.md b/zh-cn/device-dev/reference/hdi-apis/_audio_time_stamp.md new file mode 100644 index 0000000000000000000000000000000000000000..ec53fdefc97c8e41d22e4b68f00796577b63b74e --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_time_stamp.md @@ -0,0 +1,26 @@ +# AudioTimeStamp + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [tvSec](_audio.md#tvsec) | tvSec时间,单位:秒。 | +| [tvNSec](_audio.md#tvnsec) | tvNSec时间,单位:纳秒。 | + + +## **详细描述** + +音频时间戳。 + +时间定义,POSIX timespec的替代品。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_volume.md b/zh-cn/device-dev/reference/hdi-apis/_audio_volume.md new file mode 100644 index 0000000000000000000000000000000000000000..2766ba7eb2bb60cb95e4281799707f2ceb81abd1 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_volume.md @@ -0,0 +1,242 @@ +# AudioVolume + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [SetMute](#setmute) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, bool mute) | 设置音频的静音状态 [更多...](#setmute) | +| ( [GetMute](#getmute) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, bool \*mute) | 获取音频的静音状态 [更多...](#getmute) | +| ( [SetVolume](#setvolume) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, float volume) | 设置一个音频流的音量 [更多...](#setvolume) | +| ( [GetVolume](#getvolume) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, float \*volume) | 获取一个音频流的音量 [更多...](#getvolume) | +| ( [GetGainThreshold](#getgainthreshold) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, float \*min, float \*max) | 获取音频流增益的阈值 [更多...](#getgainthreshold) | +| ( [GetGain](#getgain) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, float \*gain) | 获取音频流的增益 [更多...](#getgain) | +| ( [SetGain](#setgain) )([AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) handle, float gain) | 设置音频流的增益 [更多...](#setgain) | + + +## **详细描述** + +AudioVolume音频音量接口。 + +提供音频播放(render)或录音(capture)需要的公共音量驱动能力,包括静音操作、设置音量、设置增益等。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### GetGain + + +``` +int32_t(* AudioVolume::GetGain) (AudioHandle handle, float *gain) +``` + +**描述:** + +获取音频流的增益 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| gain | 保存当前获取到的增益到gain中 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[GetGainThreshold](#getgainthreshold) + +[SetGain](#setgain) + + +### GetGainThreshold + + +``` +int32_t(* AudioVolume::GetGainThreshold) (AudioHandle handle, float *min, float *max) +``` + +**描述:** + +获取音频流增益的阈值 + +在具体的功能实现中,可以根据芯片平台的实际情况来进行处理: + +- 1. 可以使用实际的增益值,例如增益的范围为-50db ~ 6db + +- 2. 也可以将增益范围设定为0.0~1.0,如果增益的范围为-50db ~ 6db, 则增益的映射关系为0.0表示静音,1.0表示最大增益(6db) + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| min | 获取的音频增益的阈值下限保存到min中 | +| max | 获取的音频增益的阈值上限保存到max中 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[GetGain](#getgain) + +[SetGain](#setgain) + + +### GetMute + + +``` +int32_t(* AudioVolume::GetMute) (AudioHandle handle, bool *mute) +``` + +**描述:** + +获取音频的静音状态 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| mute | 获取的静音状态保存到mute中,true表示静音操作、false表示取消静音操作 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[SetMute](#setmute) + + +### GetVolume + + +``` +int32_t(* AudioVolume::GetVolume) (AudioHandle handle, float *volume) +``` + +**描述:** + +获取一个音频流的音量 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| volume | 获取的音量保存到volume中,范围0.0~1.0 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[SetVolume](#setvolume) + + +### SetGain + + +``` +int32_t(* AudioVolume::SetGain) (AudioHandle handle, float gain) +``` + +**描述:** + +设置音频流的增益 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| gain | gain 待设置的增益 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[GetGainThreshold](#getgainthreshold) + +[GetGain](#getgain) + + +### SetMute + + +``` +int32_t(* AudioVolume::SetMute) (AudioHandle handle, bool mute) +``` + +**描述:** + +设置音频的静音状态 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| mute | 待设置的静音状态,true表示静音操作、false表示取消静音操作 | + +**返回:** + +成功返回值0,失败返回负值 + +**参见:** + +[GetMute](#getmute) + + +### SetVolume + + +``` +int32_t(* AudioVolume::SetVolume) (AudioHandle handle, float volume) +``` + +**描述:** + +设置一个音频流的音量。 + +音量的取值范围是0.0~1.0,如果音频服务中的音量等级为15级(0 ~ 15), 则音量的映射关系为0.0表示静音,1.0表示最大音量等级(15) + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 待操作的音频句柄 | +| volume | 待设置的音量,范围0.0~1.0 | + +**返回:** + +成功返回值0,失败返回负值 diff --git a/zh-cn/device-dev/reference/hdi-apis/_auth_result_info.md b/zh-cn/device-dev/reference/hdi-apis/_auth_result_info.md new file mode 100644 index 0000000000000000000000000000000000000000..3f269e41cebe579b6dd22d6ea14b78eb7f3128de --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_auth_result_info.md @@ -0,0 +1,111 @@ +# AuthResultInfo + + +## **概述** + +**所属模块:** + +[HdfUserAuth](_hdf_user_auth.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [result](#result) | 用户身份认证结果。 | +| [freezingTime](#freezingtime) | 认证方式被冻结的时间。 | +| [remainTimes](#remaintimes) | 认证方式距离被冻结的可处理认证请求次数。 | +| [msgs](#msgs) | 执行器发送的消息。 | +| [token](#token) | 用户身份认证令牌。 | +| rootSecret | 保护文件加密密钥的密钥。 | + + +## **详细描述** + +用户身份认证结果信息。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### freezingTime + + +``` +int AuthResultInfo::freezingTime +``` + +**描述:** + +认证方式被冻结的时间。 + + +### msgs + + +``` +struct ExecutorSendMsg [] AuthResultInfo::msgs +``` + +**描述:** + +执行器发送的消息。 + + +### remainTimes + + +``` +int AuthResultInfo::remainTimes +``` + +**描述:** + +认证方式距离被冻结的可处理认证请求次数。 + + +### result + + +``` +unsigned int AuthResultInfo::result +``` + +**描述:** + +用户身份认证结果。 + + +### token + + +``` +unsigned char [] AuthResultInfo::token +``` + +**描述:** + +用户身份认证令牌。 + + +### rootSecret + + +``` +unsigned char [] AuthResultInfo::rootSecret +``` + +**描述:** + +保护文件加密密钥的密钥。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_auth_solution.md b/zh-cn/device-dev/reference/hdi-apis/_auth_solution.md new file mode 100644 index 0000000000000000000000000000000000000000..8a43490939301ffa64c3dc9b11ce588041ee6e69 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_auth_solution.md @@ -0,0 +1,98 @@ +# AuthSolution + + +## **概述** + +**所属模块:** + +[HdfUserAuth](_hdf_user_auth.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [userId](#userid) | 用户ID。 | +| [authTrustLevel](#authtrustlevel) | 认证结果可信等级。 | +| [authType](#authtype) | 用户认证凭据类型AuthType}。 | +| [executorSensorHint](#executorsensorhint) | 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 | +| [challenge](#challenge) | 挑战值,用于签发认证令牌。 | + + +## **详细描述** + +认证方案。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### authTrustLevel + + +``` +unsigned int AuthSolution::authTrustLevel +``` + +**描述:** + +认证结果可信等级。 + + +### authType + + +``` +enum AuthType AuthSolution::authType +``` + +**描述:** + +用户认证凭据类型AuthType}。 + + +### challenge + + +``` +unsigned char [] AuthSolution::challenge +``` + +**描述:** + +挑战值,用于签发认证令牌。 + + +### executorSensorHint + + +``` +unsigned int AuthSolution::executorSensorHint +``` + +**描述:** + +既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 + + +### userId + + +``` +int AuthSolution::userId +``` + +**描述:** + +用户ID。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_battery_info.md b/zh-cn/device-dev/reference/hdi-apis/_battery_info.md new file mode 100644 index 0000000000000000000000000000000000000000..8373d179faf623504f0e9deee42a05dd4be0ca68 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_battery_info.md @@ -0,0 +1,224 @@ +# BatteryInfo + + +## **概述** + +**所属模块:** + +[Battery](battery.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [capacity](#capacity) | 表示电池的电量百分比。 | +| [voltage](#voltage) | 表示电池的电压。 | +| [temperature](#temperature) | 表示电池的温度 | +| [healthState](#healthstate) | 表示电池的健康状态。 | +| [pluggedType](#pluggedtype) | 表示电池的充电设备类型。 | +| [pluggedMaxCurrent](#pluggedmaxcurrent) | 表示电池的最大充电电流。 | +| [pluggedMaxVoltage](#pluggedmaxvoltage) | 表示电池的最大充电电压。 | +| [chargeState](#chargestate) | 表示电池的充电状态。 | +| [chargeCounter](#chargecounter) | 表示电池的充电次数。 | +| [totalEnergy](#totalenergy) | 表示电池的总容量。 | +| [curAverage](#curaverage) | 表示电池的平均电流。 | +| [curNow](#curnow) | 表示电池的实时电流。 | +| [remainEnergy](#remainenergy) | 表示电池的剩余容量。 | +| [present](#present) | 表示是否支持电池或者电池是否在位。 | +| [technology](#technology) | 表示电池的技术型号。 | + + +## **详细描述** + +电池相关信息。 + +**Since:** + +3.1 + + +## **类成员变量说明** + + +### capacity + + +``` +int BatteryInfo::capacity +``` + +**描述:** + +表示电池的电量百分比。 + + +### chargeCounter + + +``` +int BatteryInfo::chargeCounter +``` + +**描述:** + +表示电池的充电次数。 + + +### chargeState + + +``` +int BatteryInfo::chargeState +``` + +**描述:** + +表示电池的充电状态。 + + +### curAverage + + +``` +int BatteryInfo::curAverage +``` + +**描述:** + +表示电池的平均电流。 + + +### curNow + + +``` +int BatteryInfo::curNow +``` + +**描述:** + +表示电池的实时电流。 + + +### healthState + + +``` +int BatteryInfo::healthState +``` + +**描述:** + +表示电池的健康状态。 + + +### pluggedMaxCurrent + + +``` +int BatteryInfo::pluggedMaxCurrent +``` + +**描述:** + +表示电池的最大充电电流。 + + +### pluggedMaxVoltage + + +``` +int BatteryInfo::pluggedMaxVoltage +``` + +**描述:** + +表示电池的最大充电电压。 + + +### pluggedType + + +``` +int BatteryInfo::pluggedType +``` + +**描述:** + +表示电池的充电设备类型。 + + +### present + + +``` +byte BatteryInfo::present +``` + +**描述:** + +表示是否支持电池或者电池是否在位。 + + +### remainEnergy + + +``` +int BatteryInfo::remainEnergy +``` + +**描述:** + +表示电池的剩余容量。 + + +### technology + + +``` +String BatteryInfo::technology +``` + +**描述:** + +表示电池的技术型号。 + + +### temperature + + +``` +int BatteryInfo::temperature +``` + +**描述:** + +表示电池的温度 + + +### totalEnergy + + +``` +int BatteryInfo::totalEnergy +``` + +**描述:** + +表示电池的总容量。 + + +### voltage + + +``` +int BatteryInfo::voltage +``` + +**描述:** + +表示电池的电压。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_buffer_data.md b/zh-cn/device-dev/reference/hdi-apis/_buffer_data.md new file mode 100644 index 0000000000000000000000000000000000000000..667b9b2a71c852b359534877e1f4c7294afa1137 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_buffer_data.md @@ -0,0 +1,24 @@ +# BufferData + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [phyAddr](_display.md#phyaddr-12) | 物理内存地址。 | +| [virAddr](_display.md#viraddr) | 虚拟内存地址。 | + + +## **详细描述** + +定义一层的缓冲区数据,包括虚拟和物理内存地址。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_camera.md b/zh-cn/device-dev/reference/hdi-apis/_camera.md new file mode 100644 index 0000000000000000000000000000000000000000..563a33e3bf917219d255682c64971c040c9b4b86 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_camera.md @@ -0,0 +1,1837 @@ +# Camera + + +## **汇总** + + +### 文件 + + | 文件 | 描述 | +| -------- | -------- | +| [icamera_device.h](icamera__device_8h.md) | Camera设备操作接口。 | +| [icamera_device_callback.h](icamera__device__callback_8h.md) | Camera设备的回调接口,主要包含camera设备发生错误时和上报metadata的回调函数。 | +| [icamera_host.h](icamera__host_8h.md) | Camera服务的管理类,对上层提供HDI接口。 | +| [icamera_host_callback.h](icamera__host__callback_8h.md) | ICameraHost的回调接口,提供Camera设备和闪关灯状态变化的回调函数,回调函数由调用者实现。 | +| [ioffline_stream_operator.h](ioffline__stream__operator_8h.md) | 离线流的操作接口。 | +| [istream_operator.h](istream__operator_8h.md) | 流的操作接口。 | +| [istream_operator_callback.h](istream__operator__callback_8h.md) | [IStreamOperator](istream__operator_8h.md)相关的回调,这些回调均由调用者实现。 | +| [types.h](types_8h.md) | Camera模块HDI接口使用的数据类型。 | + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [OHOS::Camera::ICameraDevice](_o_h_o_s_1_1_camera_1_1_i_camera_device.md) | Camera设备操作。[更多...](_o_h_o_s_1_1_camera_1_1_i_camera_device.md) | +| [OHOS::Camera::ICameraDeviceCallback](_o_h_o_s_1_1_camera_1_1_i_camera_device_callback.md) | Camera设备操作回调。[更多...](_o_h_o_s_1_1_camera_1_1_i_camera_device_callback.md) | +| [OHOS::Camera::ICameraHost](_o_h_o_s_1_1_camera_1_1_i_camera_host.md) | Camera服务的管理类。[更多...](_o_h_o_s_1_1_camera_1_1_i_camera_host.md) | +| [OHOS::Camera::ICameraHostCallback](_o_h_o_s_1_1_camera_1_1_i_camera_host_callback.md) | Camera服务的管理回调。[更多...](_o_h_o_s_1_1_camera_1_1_i_camera_host_callback.md) | +| [OHOS::Camera::IOfflineStreamOperator](_o_h_o_s_1_1_camera_1_1_i_offline_stream_operator.md) | 离线流的操作类。[更多...](_o_h_o_s_1_1_camera_1_1_i_offline_stream_operator.md) | +| [OHOS::Camera::IStreamOperator](_o_h_o_s_1_1_camera_1_1_i_stream_operator.md) | 流的操作类。[更多...](_o_h_o_s_1_1_camera_1_1_i_stream_operator.md) | +| [OHOS::Camera::IStreamOperatorCallback](_o_h_o_s_1_1_camera_1_1_i_stream_operator_callback.md) | 流的操作回调类。[更多...](_o_h_o_s_1_1_camera_1_1_i_stream_operator_callback.md) | +| [OHOS::Camera::StreamInfo](_o_h_o_s_1_1_camera_1_1_stream_info.md) | 流信息,用于创建流时传入相关的配置参数。 [更多...](_o_h_o_s_1_1_camera_1_1_stream_info.md) | +| [OHOS::Camera::StreamAttribute](_o_h_o_s_1_1_camera_1_1_stream_attribute.md) | 流的属性。 [更多...](_o_h_o_s_1_1_camera_1_1_stream_attribute.md) | +| [OHOS::Camera::CaptureInfo](_o_h_o_s_1_1_camera_1_1_capture_info.md) | 捕获请求的相关信息。 [更多...](_o_h_o_s_1_1_camera_1_1_capture_info.md) | +| [OHOS::Camera::CaptureEndedInfo](_o_h_o_s_1_1_camera_1_1_capture_ended_info.md) | 捕获结束相关信息,用于捕获结束回调 **OnCaptureEnded**。 [更多...](_o_h_o_s_1_1_camera_1_1_capture_ended_info.md) | +| [OHOS::Camera::CaptureErrorInfo](_o_h_o_s_1_1_camera_1_1_capture_error_info.md) | 流错误信息,用于回调 **OnCaptureError**。 [更多...](_o_h_o_s_1_1_camera_1_1_capture_error_info.md) | + + +### 类型定义 + + | 类型定义 | 描述 | +| -------- | -------- | +| **OHOS::Camera::CameraAbility** = CameraMetadata | Camera设备能力集合。 | +| **OHOS::Camera::CameraSetting** = CameraMetadata | Camera设置参数,包括sensor帧率,3A相关参数等。 | +| **OHOS::Camera::MetaType** = int32_t | 整型。 | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [OHOS::Camera::CamRetCode](#camretcode) : int32_t {   OHOS::Camera::NO_ERROR = 0, OHOS::Camera::CAMERA_BUSY = -1, OHOS::Camera::INSUFFICIENT_RESOURCES = -2, OHOS::Camera::INVALID_ARGUMENT = -3,   OHOS::Camera::METHOD_NOT_SUPPORTED = -4, OHOS::Camera::CAMERA_CLOSED = -5, OHOS::Camera::DEVICE_ERROR = -6 } | HDI接口的返回值。 [更多...](#camretcode) | +| [OHOS::Camera::ResultCallbackMode](#resultcallbackmode) : int32_t { OHOS::Camera::PER_FRAME, OHOS::Camera::ON_CHANGED } | metadata的上报模式。 [更多...](#resultcallbackmode) | +| [OHOS::Camera::OperationMode](#operationmode) : int32_t { OHOS::Camera::NORMAL = 0 } | 流的使用模式。 [更多...](#operationmode) | +| [OHOS::Camera::StreamIntent](#streamintent) : int32_t {   OHOS::Camera::PREVIEW = 0, OHOS::Camera::VIDEO = 1, OHOS::Camera::STILL_CAPTURE = 2, OHOS::Camera::POST_VIEW = 3,   OHOS::Camera::ANALYZE = 4, OHOS::Camera::CUSTOM = 5 } | 流的类型。 [更多...](#streamintent) | +| [OHOS::Camera::EncodeType](#encodetype) : int32_t { OHOS::Camera::ENCODE_TYPE_NULL = 0, OHOS::Camera::ENCODE_TYPE_H264 = 1, OHOS::Camera::ENCODE_TYPE_H265 = 2, OHOS::Camera::ENCODE_TYPE_JPEG = 3 } | 流数据的编码类型。 [更多...](#encodetype) | +| [OHOS::Camera::StreamSupportType](#streamsupporttype) : int32_t { OHOS::Camera::DYNAMIC_SUPPORTED, OHOS::Camera::RE_CONFIGURED_REQUIRED, OHOS::Camera::NOT_SUPPORTED } | 动态配置流的切换方式,使用场景参考 [IsStreamsSupported](#isstreamssupported) 。 [更多...](#streamsupporttype) | +| [OHOS::Camera::CameraStatus](#camerastatus) { OHOS::Camera::UN_AVAILABLE = 0, OHOS::Camera::AVAILABLE = 1 } | Camera设备状态。 [更多...](#camerastatus) | +| [OHOS::Camera::FlashlightStatus](#flashlightstatus) : uint32_t { OHOS::Camera::FLASHLIGHT_OFF = 0, OHOS::Camera::FLASHLIGHT_ON = 1, OHOS::Camera::FLASHLIGHT_UNAVAILABLE = 2 } | 闪光灯状态。 [更多...](#flashlightstatus) | +| [OHOS::Camera::CameraEvent](#cameraevent): uint32_t { OHOS::Camera::CAMERA_EVENT_DEVICE_ADD = 0, OHOS::Camera::CAMERA_EVENT_DEVICE_RMV = 1 } | Camera事件。 [更多...](#cameraevent) | +| [OHOS::Camera::ErrorType](#errortype) : uint32_t { OHOS::Camera::FATAL_ERROR = 0, OHOS::Camera::REQUEST_TIMEOUT = 1 } | 设备错误类型,用于设备错误回调 [OnError](#onerror)。 [更多...](#errortype) | +| [OHOS::Camera::StreamError](#streamerror) { OHOS::Camera::UNKNOWN_ERROR = 0, OHOS::Camera::BUFFER_LOST = 1 } | 流错误类型,用于流错误类型 [CaptureErrorInfo](_o_h_o_s_1_1_camera_1_1_capture_error_info.md)。 [更多...](#streamerror) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| **OHOS::Camera::ICameraDevice::DECLARE_INTERFACE_DESCRIPTOR** (u"HDI.Camera.V1_0.Device") | IPC通信token校验。 | +| [OHOS::Camera::ICameraDevice::GetStreamOperator](#getstreamoperator) (const OHOS::sptr< [IStreamOperatorCallback](_o_h_o_s_1_1_camera_1_1_i_stream_operator_callback.md) > &callback, OHOS::sptr< [IStreamOperator](_o_h_o_s_1_1_camera_1_1_i_stream_operator.md) > &streamOperator)=0 | 获取流操作句柄。 [更多...](#getstreamoperator) | +| [OHOS::Camera::ICameraDevice::UpdateSettings](#updatesettings) (const std::shared_ptr< CameraSetting > &settings)=0 | 更新设备控制参数。 [更多...](#updatesettings) | +| [OHOS::Camera::ICameraDevice::SetResultMode](#setresultmode) (const [ResultCallbackMode](#resultcallbackmode) &mode)=0 | 设置metadata上报模式,逐帧上报还是设备状态变化时上报。 [更多...](#setresultmode) | +| [OHOS::Camera::ICameraDevice::GetEnabledResults](#getenabledresults) (std::vector< MetaType > &results)=0 | 查询使能的metadata。 [更多...](#getenabledresults) | +| [OHOS::Camera::ICameraDevice::EnableResult](#enableresult) (const std::vector< MetaType > &results)=0 | 打开metadata上报开关。 [更多...](#enableresult) | +| [OHOS::Camera::ICameraDevice::DisableResult](#disableresult) (const std::vector< MetaType > &results)=0 | 关闭metadata上报开关。 [更多...](#disableresult) | +| [OHOS::Camera::ICameraDevice::Close](#close) ()=0 | 关闭Camera设备。 [更多...](#close) | +| **OHOS::Camera::ICameraDeviceCallback::DECLARE_INTERFACE_DESCRIPTOR** (u"HDI.Camera.V1_0.DeviceCallback") | IPC通信token校验。 | +| [OHOS::Camera::ICameraDeviceCallback::OnError](#onerror) ([ErrorType](#errortype) type, int32_t errorCode)=0 | 设备发生错误时调用,由调用者实现,用于返回错误信息给调用者。 [更多...](#onerror) | +| [OHOS::Camera::ICameraDeviceCallback::OnResult](#onresult) (uint64_t timestamp, const std::shared_ptr< CameraMetadata > &result)=0 | 上报camera设备相关的metadata的回调,上报方式查看 [SetResultMode](#setresultmode)。 [更多...](#onresult) | +| **OHOS::Camera::ICameraHost::DECLARE_INTERFACE_DESCRIPTOR** (u"HDI.Camera.V1_0.Host") | IPC通信token校验。 | +| [OHOS::Camera::ICameraHost::Get](#get) (const char \*serviceName) | 获取ICameraHost实例。 [更多...](#get) | +| [OHOS::Camera::ICameraHost::SetCallback](#setcallback) (const OHOS::sptr< [ICameraHostCallback](_o_h_o_s_1_1_camera_1_1_i_camera_host_callback.md) > &callback)=0 | 设置ICameraHost回调接口,回调函数参考 [ICameraHostCallback](_o_h_o_s_1_1_camera_1_1_i_camera_host_callback.md)。 [更多...](#setcallback) | +| [OHOS::Camera::ICameraHost::GetCameraIds](#getcameraids) (std::vector< std::string > &cameraIds)=0 | 获取当前可用的Camera设备ID列表。 [更多...](#getcameraids) | +| [OHOS::Camera::ICameraHost::GetCameraAbility](#getcameraability) (const std::string &cameraId, std::shared_ptr< CameraAbility > &ability)=0 | 获取Camera设备能力集合。 [更多...](#getcameraability) | +| [OHOS::Camera::ICameraHost::OpenCamera](#opencamera) (const std::string &cameraId, const OHOS::sptr< [ICameraDeviceCallback](_o_h_o_s_1_1_camera_1_1_i_camera_device_callback.md) > &callback, OHOS::sptr< [ICameraDevice](_o_h_o_s_1_1_camera_1_1_i_camera_device.md) > &device)=0 | 打开Camera设备。 [更多...](#opencamera) | +| [OHOS::Camera::ICameraHost::SetFlashlight](#setflashlight) (const std::string &cameraId, bool &isEnable)=0 | 打开或关闭闪光灯。 [更多...](#setflashlight) | +| **OHOS::Camera::ICameraHostCallback::DECLARE_INTERFACE_DESCRIPTOR** (u"HDI.Camera.V1_0.HostCallback") | IPC通信token校验。 | +| [OHOS::Camera::ICameraHostCallback::OnCameraStatus](#oncamerastatus) (const std::string &cameraId, [CameraStatus](#camerastatus) status)=0 | 用于Camera设备状态变化时上报状态信息给调用者。 [更多...](#oncamerastatus) | +| [OHOS::Camera::ICameraHostCallback::OnFlashlightStatus](#onflashlightstatus) (const std::string &cameraId, [FlashlightStatus](#flashlightstatus) status)=0 | 用于在闪光灯状态变化时上报状态信息给调用者。 [更多...](#onflashlightstatus) | +| [OHOS::Camera::ICameraHostCallback::OnCameraEvent](#oncameraevent) (const std::string &cameraId, [CameraEvent](#cameraevent) event)=0 | 在相机事件发生时调用。 [更多...](#oncameraevent) | +| **OHOS::Camera::IOfflineStreamOperator::DECLARE_INTERFACE_DESCRIPTOR** (u"HDI.Camera.V1_0.OfflineStreamOperator") | IPC通信token校验。 | +| [OHOS::Camera::IOfflineStreamOperator::CancelCapture](#cancelcapture-12) (int captureId)=0 | 取消捕获请求。 [更多...](#cancelcapture-12) | +| [OHOS::Camera::IOfflineStreamOperator::ReleaseStreams](#releasestreams-12) (const std::vector< int > &streamIds)=0 | 释放离线流。 [更多...](#releasestreams-12) | +| [OHOS::Camera::IOfflineStreamOperator::Release](#release) ()=0 | 释放所有离线流。 [更多...](#release) | +| **OHOS::Camera::IStreamOperator::DECLARE_INTERFACE_DESCRIPTOR** (u"HDI.Camera.V1_0.StreamOperator") | IPC通信token校验。 | +| [OHOS::Camera::IStreamOperator::IsStreamsSupported](#isstreamssupported) ([OperationMode](#operationmode) mode, const std::shared_ptr< CameraMetadata > &modeSetting, const std::vector< std::shared_ptr< [StreamInfo](_o_h_o_s_1_1_camera_1_1_stream_info.md) >> &info, [StreamSupportType](#streamsupporttype) &type)=0 | 查询是否支持添加参数对应的流 [更多...](#isstreamssupported) | +| [OHOS::Camera::IStreamOperator::CreateStreams](#createstreams) (const std::vector< std::shared_ptr< [StreamInfo](_o_h_o_s_1_1_camera_1_1_stream_info.md) >> &streamInfos)=0 | 创建流。 [更多...](#createstreams) | +| [OHOS::Camera::IStreamOperator::ReleaseStreams](#releasestreams-22) (const std::vector< int > &streamIds)=0 | 释放流。 [更多...](#releasestreams-22) | +| [OHOS::Camera::IStreamOperator::CommitStreams](#commitstreams) ([OperationMode](#operationmode) mode, const std::shared_ptr< CameraMetadata > &modeSetting)=0 | 配置流。 [更多...](#commitstreams) | +| [OHOS::Camera::IStreamOperator::GetStreamAttributes](#getstreamattributes) (std::vector< std::shared_ptr< [StreamAttribute](_o_h_o_s_1_1_camera_1_1_stream_attribute.md) >> &attributes)=0 | 获取流的属性。 [更多...](#getstreamattributes) | +| [OHOS::Camera::IStreamOperator::AttachBufferQueue](#attachbufferqueue) (int streamId, const OHOS::sptr< OHOS::IBufferProducer > &producer)=0 | 绑定生产者句柄和指定流。 [更多...](#attachbufferqueue) | +| [OHOS::Camera::IStreamOperator::DetachBufferQueue](#detachbufferqueue) (int streamId)=0 | 解除生产者句柄和指定流的绑定关系。 [更多...](#detachbufferqueue) | +| [OHOS::Camera::IStreamOperator::Capture](#capture) (int captureId, const std::shared_ptr< [CaptureInfo](_o_h_o_s_1_1_camera_1_1_capture_info.md) > &info, bool isStreaming)=0 | 捕获图像。 [更多...](#capture) | +| [OHOS::Camera::IStreamOperator::CancelCapture](#cancelcapture-22) (int captureId)=0 | 取消捕获。 [更多...](#cancelcapture-22) | +| [OHOS::Camera::IStreamOperator::ChangeToOfflineStream](#changetoofflinestream) (const std::vector< int > &streamIds, OHOS::sptr< [IStreamOperatorCallback](_o_h_o_s_1_1_camera_1_1_i_stream_operator_callback.md) > &callback, OHOS::sptr< [IOfflineStreamOperator](_o_h_o_s_1_1_camera_1_1_i_offline_stream_operator.md) > &offlineOperator)=0 | 将指定流转换成离线流。 [更多...](#changetoofflinestream) | +| **OHOS::Camera::IStreamOperatorCallback::DECLARE_INTERFACE_DESCRIPTOR** (u"HDI.Camera.V1_0.StreamOperatorCallback") | IPC通信token校验。 | +| [OHOS::Camera::IStreamOperatorCallback::OnCaptureStarted](#oncapturestarted) (int32_t captureId, const std::vector< int32_t > &streamIds)=0 | 捕获开始回调,在捕获开始时调用。 [更多...](#oncapturestarted) | +| [OHOS::Camera::IStreamOperatorCallback::OnCaptureEnded](#oncaptureended) (int32_t captureId, const std::vector< std::shared_ptr< [CaptureEndedInfo](_o_h_o_s_1_1_camera_1_1_capture_ended_info.md) >> &infos)=0 | 捕获结束回调,在捕获结束时调用。 [更多...](#oncaptureended) | +| [OHOS::Camera::IStreamOperatorCallback::OnCaptureError](#oncaptureerror) (int32_t captureId, const std::vector< std::shared_ptr< [CaptureErrorInfo](_o_h_o_s_1_1_camera_1_1_capture_error_info.md) >> &infos)=0 | 捕获错误回调,在捕获过程中发生错误时调用。 [更多...](#oncaptureerror) | +| [OHOS::Camera::IStreamOperatorCallback::OnFrameShutter](#onframeshutter) (int32_t captureId, const std::vector< int32_t > &streamIds, uint64_t timestamp)=0 | 帧捕获回调。 [更多...](#onframeshutter) | + + +### 变量 + + | 变量 | 描述 | +| -------- | -------- | +| [OHOS::Camera::StreamInfo::streamId_](#streamid-14) | 流的ID,用于在设备内唯一标识一条流。 | +| [OHOS::Camera::StreamInfo::width_](#width-12) | 图像宽度。 | +| [OHOS::Camera::StreamInfo::height_](#height-12) | 图像高度。 | +| [OHOS::Camera::StreamInfo::format_](#format) | 图像格式。 | +| [OHOS::Camera::StreamInfo::dataspace_](#dataspace) | 图像颜色空间。 | +| [OHOS::Camera::StreamInfo::intent_](#intent) | 流类型。 | +| [OHOS::Camera::StreamInfo::tunneledMode_](#tunneledmode) | 隧道模式,值为true时开启,false关闭。 | +| [OHOS::Camera::StreamInfo::bufferQueue_](#bufferqueue) | 图形提供的生产者句柄。 | +| [OHOS::Camera::StreamInfo::minFrameDuration_](#minframeduration) | 最小帧间隔。 | +| [OHOS::Camera::StreamInfo::encodeType_](#encodetype) | 编码类型。 | +| [OHOS::Camera::StreamAttribute::streamId_](#streamid-24) | 流的ID,用于在设备内唯一标识一条流。 | +| [OHOS::Camera::StreamAttribute::width_](#width-22) | 图像宽度。 | +| [OHOS::Camera::StreamAttribute::height_](#height-22) | 图像高度。 | +| [OHOS::Camera::StreamAttribute::overrideFormat_](#overrideformat) | 重写的图像格式。 | +| [OHOS::Camera::StreamAttribute::overrideDataspace_](#overridedataspace) | 重写的图像颜色空间。 | +| [OHOS::Camera::StreamAttribute::producerUsage_](#producerusage) | 重写后的生产者的使用方式。 | +| [OHOS::Camera::StreamAttribute::producerBufferCount_](#producerbuffercount) | 重写后的生产者缓存数量。 | +| [OHOS::Camera::StreamAttribute::maxBatchCaptureCount_](#maxbatchcapturecount) | 连拍支持的最大捕获帧数量。 | +| [OHOS::Camera::StreamAttribute::maxCaptureCount_](#maxcapturecount) | 最大的并发捕获请求个数,默认为1。 | +| [OHOS::Camera::CaptureInfo::streamIds_](#streamids) | 捕获的流ID集合。 | +| [OHOS::Camera::CaptureInfo::captureSetting_](#capturesetting) | 捕获的配置信息。 | +| [OHOS::Camera::CaptureInfo::enableShutterCallback_](#enableshuttercallback) | 使能捕获回调。 | +| [OHOS::Camera::CaptureEndedInfo::streamId_](#streamid-34) | 捕获的流ID。 | +| [OHOS::Camera::CaptureEndedInfo::frameCount_](#framecount) | 捕获结束时已经抓取的帧数。 | +| [OHOS::Camera::CaptureErrorInfo::streamId_](#streamid-44) | 流ID。 | +| [OHOS::Camera::CaptureErrorInfo::error_](#error) | 错误类型。 | + + +## **详细描述** + +Camera模块接口定义。 + +Camera模块涉及相机设备的操作、流的操作、离线流的操作和各种回调等。 + +**Since:** + +1.0 + + +## **枚举类型说明** + + +### CameraEvent + + +``` +enum OHOS::Camera::CameraEvent : uint32_t +``` + +**描述:** + +Camera事件。 + + | 枚举值 | **描述** | +| -------- | -------- | +| CAMERA_EVENT_DEVICE_ADD | Camera设备增加事件。 | +| CAMERA_EVENT_DEVICE_RMV | Camera设备删除事件。 | + + +### CameraStatus + + +``` +enum OHOS::Camera::CameraStatus +``` + +**描述:** + +Camera设备状态。 + + | 枚举值 | **描述** | +| -------- | -------- | +| UN_AVAILABLE | 设备当前不在位或者不可用。 | +| AVAILABLE | 设备当前可用。 | + + +### CamRetCode + + +``` +enum OHOS::Camera::CamRetCode : int32_t +``` + +**描述:** + +HDI接口的返回值。 + + | 枚举值 | **描述** | +| -------- | -------- | +| NO_ERROR | 调用成功。 | +| CAMERA_BUSY | 设备当前忙。 | +| INSUFFICIENT_RESOURCES | 资源不足。 | +| INVALID_ARGUMENT | 参数错误。 | +| METHOD_NOT_SUPPORTED | 不支持当前调用方法。 | +| CAMERA_CLOSED | Camera设备已经关闭。 | +| DEVICE_ERROR | 驱动层发生严重错误。 | + + +### EncodeType + + +``` +enum OHOS::Camera::EncodeType : int32_t +``` + +**描述:** + +流数据的编码类型。 + + | 枚举值 | **描述** | +| -------- | -------- | +| ENCODE_TYPE_NULL | 未设置编码类型。 | +| ENCODE_TYPE_H264 | 编码类型为H264。 | +| ENCODE_TYPE_H265 | 编码类型为H265。 | +| ENCODE_TYPE_JPEG | 编码类型为JPEG。 | + + +### ErrorType + + +``` +enum OHOS::Camera::ErrorType : uint32_t +``` + +**描述:** + +设备错误类型,用于设备错误回调 **OnError**。 + + | 枚举值 | **描述** | +| -------- | -------- | +| FATAL_ERROR | 严重错误,需要关闭camera设备。 | +| REQUEST_TIMEOUT | 请求超时,需要关闭camera设备。 | + + +### FlashlightStatus + + +``` +enum OHOS::Camera::FlashlightStatus : uint32_t +``` + +**描述:** + +闪光灯状态。 + + | 枚举值 | **描述** | +| -------- | -------- | +| FLASHLIGHT_OFF | 闪光灯关闭。 | +| FLASHLIGHT_ON | 闪光灯开启。 | +| FLASHLIGHT_UNAVAILABLE | 闪光灯当前不可用。 | + + +### OperationMode + + +``` +enum OHOS::Camera::OperationMode : int32_t +``` + +**描述:** + +流的使用模式。 + + | 枚举值 | **描述** | +| -------- | -------- | +| NORMAL | 普通模式。 | + + +### ResultCallbackMode + + +``` +enum OHOS::Camera::ResultCallbackMode : int32_t +``` + +**描述:** + +metadata的上报模式。 + + | 枚举值 | **描述** | +| -------- | -------- | +| PER_FRAME | 每帧上报。 | +| ON_CHANGED | 设备状态变化时上报。 | + + +### StreamError + + +``` +enum OHOS::Camera::StreamError +``` + +**描述:** + +流错误类型,用于流错误类型 [CaptureErrorInfo](_o_h_o_s_1_1_camera_1_1_capture_error_info.md)。 + + | 枚举值 | **描述** | +| -------- | -------- | +| UNKNOWN_ERROR | 流未知错误。 | +| BUFFER_LOST | 丢包。 | + + +### StreamIntent + + +``` +enum OHOS::Camera::StreamIntent : int32_t +``` + +**描述:** + +流的类型。 + + | 枚举值 | **描述** | +| -------- | -------- | +| PREVIEW | 流数据用于显示,即预览流。 | +| VIDEO | 流数据用于编码生成录像,即录像流。 | +| STILL_CAPTURE | 流数据用于编码生成照片,即拍照流。 | +| POST_VIEW | 流数据用于保存缩略图。 | +| ANALYZE | 流数据用于图像分析。 | +| CUSTOM | 自定义类型。 | + + +### StreamSupportType + + +``` +enum OHOS::Camera::StreamSupportType : int32_t +``` + +**描述:** + +动态配置流的切换方式,使用场景参考 [IsStreamsSupported](#isstreamssupported) 。 + + | 枚举值 | 描述 | +| -------- | -------- | +| DYNAMIC_SUPPORTED | 支持动态配置流,对应的流参数直接生效。 | +| RE_CONFIGURED_REQUIRED | 不支持动态配置流,对应的参数需要停止流然后重新配置流才能生效。 | +| NOT_SUPPORTED | 不支持对应的流参数配置。 | + + +## **函数说明** + + +### AttachBufferQueue() + + +``` +virtual CamRetCode OHOS::Camera::IStreamOperator::AttachBufferQueue (int streamId, const OHOS::sptr < OHOS::IBufferProducer > & producer ) +``` + +**描述:** + +绑定生产者句柄和指定流。 + +如果在 [CreateStreams](#createstreams) 创建流时已经指定了生产者句柄,则不需要调用该接口。如果需要重新绑定, 需先调用 [DetachBufferQueue](#detachbufferqueue) 进行解绑,然后再绑定。 对于一些IOT设备,可能不需要或者不支持预览流的图像数据缓存流转,那么不需要绑定生产者句柄, 此时在创建流时 [CreateStreams](#createstreams) 的 [StreamInfo](_o_h_o_s_1_1_camera_1_1_stream_info.md) 参数的生产者句柄bufferQueue_为空,而 tunneledMode_需设置为false。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| streamId | [IN] 用于标识要绑定的流。 | +| producer | [IN] 生产者句柄。 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**参见:** + +[DetachBufferQueue](#detachbufferqueue) + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### CancelCapture() [1/2] + + +``` +virtual CamRetCode OHOS::Camera::IOfflineStreamOperator::CancelCapture (int captureId) +``` + +**描述:** + +取消捕获请求。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| captureId | [IN] 用于标识要取消的捕获请求。 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + + +### CancelCapture() [2/2] + + +``` +virtual CamRetCode OHOS::Camera::IStreamOperator::CancelCapture (int captureId) +``` + +**描述:** + +取消捕获。 + +取消连续捕获时会调用 **OnCaptureEnded**。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| captureId | 用于标识要取消的捕获请求 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**参见:** + +[Capture](#capture) + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### Capture() + + +``` +virtual CamRetCode OHOS::Camera::IStreamOperator::Capture (int captureId, const std::shared_ptr< CaptureInfo > & info, bool isStreaming ) +``` + +**描述:** + +捕获图像。 + +本接口必须在调用 [CommitStreams](#commitstreams) 配置流之后调用。 图像捕获有两种模式,分别是连续捕获和单次捕获。 + +- 连续捕获即触发之后模块内部进行连续的捕获, 消费者可以连续收到图像数据,不需要多次调用本接口,若再次调用了本接口, 则停止当前捕获,更新捕获信息,再进行一次新的捕获,多用于预览、录像或者连拍场景。 + +- 单次捕获即触发之后只捕获一帧图像数据,用于单次拍照场景。 捕获启动时,会调用 **OnCaptureStarted** 来通知调用者捕获已经启动。 + +连续捕获需调用 [CancelCapture](#cancelcapture-22) 来停止捕获。 捕获结束时,会调用 **OnCaptureEnded** 来通知调用者捕获的帧计数等信息。 [CaptureInfo](_o_h_o_s_1_1_camera_1_1_capture_info.md) 的 enableShutterCallback_ 使能 **OnFrameShutter**,使能后每次捕获触发 **OnFrameShutter** 对于多个流同时捕获的场景,本模块内部保证同时上报多路流捕获数据。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| captureId | [IN] 捕获请求的唯一标识,由调用者指定,调用者需保证在Camera设备打开期间,捕获请求ID是唯一的。 | +| info | [IN] 捕获请求的参数信息,具体信息查看 [CaptureInfo](_o_h_o_s_1_1_camera_1_1_capture_info.md)。 | +| isStreaming | [IN] 是否连续捕获,true表示连续捕获,否则为单次捕获。 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**参见:** + +OnFrameShutter + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### ChangeToOfflineStream() + + +``` +virtual CamRetCode OHOS::Camera::IStreamOperator::ChangeToOfflineStream (const std::vector< int > & streamIds, OHOS::sptr< IStreamOperatorCallback > & callback, OHOS::sptr< IOfflineStreamOperator > & offlineOperator ) +``` + +**描述:** + +将指定流转换成离线流。 + +离线流只能由拍照流转换而来,其他流不支持。 一些设备处理能力有限,可能导致拍照时算法处理时间较长,从而引起捕获请求堆积在模块内部,而转换为离线 流之后,可关闭底层设备,由离线流接替,进行后续的处理。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| streamIds | [IN] 用于指定要转换成离线流的流集合。 | +| callback | [IN] 用于设置离线流的回调。 | +| offlineOperator | [OUT] 转换后的离线流。 | + +**返回:** + +NO_ERROR 表示执行成功; + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### Close() + + +``` +virtual void OHOS::Camera::ICameraDevice::Close () +``` + +**描述:** + +关闭Camera设备。 + +**参见:** + +[OpenCamera](#opencamera) + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### CommitStreams() + + +``` +virtual CamRetCode OHOS::Camera::IStreamOperator::CommitStreams (OperationMode mode, const std::shared_ptr< CameraMetadata > & modeSetting ) +``` + +**描述:** + +配置流。 + +本接口需在调用 [CreateStreams](#createstreams) 创建流之后调用。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| mode | [IN] 流运行的模式,支持的模式定义在 **OperationMode**。 | +| modeSetting | [IN] 流的配置参数,包括帧率,ZOOM等信息。 | + +**返回:** + +NO_ERROR 表示执行成功; + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### CreateStreams() + + +``` +virtual CamRetCode OHOS::Camera::IStreamOperator::CreateStreams (const std::vector< std::shared_ptr< StreamInfo >> & streamInfos) +``` + +**描述:** + +创建流。 + +此函数接口依据输入的流信息创建流,调用该接口之前需先通过 [IsStreamsSupported](#isstreamssupported) 查询HAL是否支持要创建的流。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| streamInfos | [IN] 流信息列表,流信息定义在 [StreamInfo](_o_h_o_s_1_1_camera_1_1_stream_info.md)。输入的流信息可能会被修改,需通过 [GetStreamAttributes](#getstreamattributes) 获取最新的流属性。 | + +**返回:** + +NO_ERROR 表示执行成功; + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### DetachBufferQueue() + + +``` +virtual CamRetCode OHOS::Camera::IStreamOperator::DetachBufferQueue (int streamId) +``` + +**描述:** + +解除生产者句柄和指定流的绑定关系。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| streamId | [IN] 用于标识要解除绑定的流。 | + +**返回:** + +NO_ERROR 表示执行成功; + +其他值表示执行失败,具体错误码查看[CamRetCode](#camretcode)。 + +**参见:** + +[AttachBufferQueue](#attachbufferqueue) + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### DisableResult() + + +``` +virtual CamRetCode OHOS::Camera::ICameraDevice::DisableResult (const std::vector< MetaType > & results) +``` + +**描述:** + +关闭metadata上报开关。 + +屏蔽之后,相应的**OnResult**不再上报,需 [EnableResult](#enableresult) 使能之后才上报。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| results | [IN] 需要关闭上报开关的metadata。 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**参见:** + +[EnableResult](#enableresult) + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### EnableResult() + + +``` +virtual CamRetCode OHOS::Camera::ICameraDevice::EnableResult (const std::vector< MetaType > & results) +``` + +**描述:** + +打开metadata上报开关。 + +**OnResult** 只上报此接口使能后的metadata。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| results | [IN] 需要打开上报开关的metadata。 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**参见:** + +[DisableResult](#disableresult) + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### Get() + + +``` +static sptr OHOS::Camera::ICameraHost::Get (const char * serviceName) +``` + +**描述:** + +获取ICameraHost实例。 + +此接口为Camera调用入口,需要先通过该接口获取ICameraHost实例,然后通过ICameraHost实例进行其它操作。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| serviceName | [IN] 要获取的ICameraHost实例的名称,当前实现中实例名称固定为camera_service。 | + +**返回:** + +成功返回ICameraHost实例,失败返回nullptr。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### GetCameraAbility() + + +``` +virtual CamRetCode OHOS::Camera::ICameraHost::GetCameraAbility (const std::string & cameraId, std::shared_ptr< CameraAbility > & ability ) +``` + +**描述:** + +获取Camera设备能力集合。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| cameraId | [IN] 用于指定要操作的camera设备,通过 [GetCameraIds](#getcameraids) 获取。 | +| ability | [OUT] 返回cameraId对应Camera设备的能力集合。 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**参见:** + +[GetCameraIds](#getcameraids) + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### GetCameraIds() + + +``` +virtual CamRetCode OHOS::Camera::ICameraHost::GetCameraIds (std::vector< std::string > & cameraIds) +``` + +**描述:** + +获取当前可用的Camera设备ID列表。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| cameraIds | [OUT] 返回当前可用的设备列表 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**参见:** + +[GetCameraAbility](#getcameraability) + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### GetEnabledResults() + + +``` +virtual CamRetCode OHOS::Camera::ICameraDevice::GetEnabledResults (std::vector< MetaType > & results) +``` + +**描述:** + +查询使能的metadata。 + +[EnableResult](#enableresult) 使能需要上报的metadata之后,可通过此接口查询使能的metadata。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| results | [OUT] 所有使能的metadata。 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### GetStreamAttributes() + + +``` +virtual CamRetCode OHOS::Camera::IStreamOperator::GetStreamAttributes (std::vector< std::shared_ptr< StreamAttribute >> & attributes) +``` + +**描述:** + +获取流的属性。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| attributes | [OUT] 用于获取流的属性。在调用[CreateStreams](#createstreams) 时,通过参数streamInfos携带的流信息 可能会被重写,因此通过该接口获取的流属性可能会。 和 [CreateStreams](#createstreams) 输入的流信息存在差异。 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### GetStreamOperator() + + +``` +virtual CamRetCode OHOS::Camera::ICameraDevice::GetStreamOperator (const OHOS::sptr< IStreamOperatorCallback > & callback, OHOS::sptr< IStreamOperator > & streamOperator ) +``` + +**描述:** + +获取流操作句柄。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| callback | [IN] 设置流回调接口,详细可查看 [IStreamOperatorCallback](_o_h_o_s_1_1_camera_1_1_i_stream_operator_callback.md), 用于上报捕获开始 **OnCaptureStarted**,捕获结束 **OnCaptureEnded**, **OnCaptureError** 捕获错误等信息。 | +| streamOperator | [OUT] 返回流操作句柄。 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### IsStreamsSupported() + + +``` +virtual CamRetCode OHOS::Camera::IStreamOperator::IsStreamsSupported (OperationMode mode, const std::shared_ptr< CameraMetadata > & modeSetting, const std::vector< std::shared_ptr< StreamInfo >> & info, StreamSupportType & type ) +``` + +**描述:** + +查询是否支持添加参数对应的流。 + +流是指从底层设备输出,经本模块内部各环节处理,最终传递到上层服务或者应用的一组数据序列 本模块支持的流的类型有预览流,录像流,拍照流等,更多类型可查看 **StreamIntent**。 + +此函数接口根据输入的运行模式和配置信息以及当前模块中正在运行的流,查询是否支持动态添加流。 + +- 如果本模块支持在不停止其他流的情况下添加新流,或者即使停止其他流但上层服务或应用不感知,则通过type参数返回DYNAMIC_SUPPORTED,上层服务或应用可以直接添加新流。 + +- 如果本模块支持添加新流但需要上层服务或应用先停止所有流的捕获,则通过type参数返回RE_CONFIGURED_REQUIRED。 + +- 如果不支持添加输入的新流,则返回NOT_SUPPORTED。 + +此函数需要在调用 [CreateStreams](#createstreams) 创建流之前调用。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| mode | [IN] 流运行的模式,支持的模式参考 **OperationMode**。 | +| modeSetting | [IN] 流的配置,包括帧率,3A等配置信息。 | +| info | [IN] 流的配置信息,具体参考 [StreamInfo](_o_h_o_s_1_1_camera_1_1_stream_info.md)。 | +| type | [OUT] 对动态配置流的支持类型,支持类型定义在 **StreamSupportType**。 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### OnCameraEvent() + + +``` +virtual void OHOS::Camera::ICameraHostCallback::OnCameraEvent (const std::string & cameraId, CameraEvent event ) +``` + +**描述:** + +在相机事件发生时调用。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| cameraId | 表示相机事件绑定的相机ID。 | +| event | 表示相机事件类型。 | + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### OnCameraStatus() + + +``` +virtual void OHOS::Camera::ICameraHostCallback::OnCameraStatus (const std::string & cameraId, CameraStatus status ) +``` + +**描述:** + +用于Camera设备状态变化时上报状态信息给调用者。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| cameraId | [IN] 状态发生变化的Camera设备ID。 | +| status | [IN] 最新的设备状态。 | + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### OnCaptureEnded() + + +``` +virtual void OHOS::Camera::IStreamOperatorCallback::OnCaptureEnded (int32_t captureId, const std::vector< std::shared_ptr< CaptureEndedInfo >> & infos ) +``` + +**描述:** + +捕获结束回调,在捕获结束时调用。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| captureId | [IN] 用于标识回调对应的捕获请求。 | +| infos | [IN] 捕获结束相关信息。 | + +**参见:** + +[OnCaptureStarted](#oncapturestarted) + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### OnCaptureError() + + +``` +virtual void OHOS::Camera::IStreamOperatorCallback::OnCaptureError (int32_t captureId, const std::vector< std::shared_ptr< CaptureErrorInfo >> & infos ) +``` + +**描述:** + +捕获错误回调,在捕获过程中发生错误时调用。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| captureId | [IN] 用于标识回调对应的捕获请求。 | +| infos | [IN] 捕获错误信息列表。 | + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### OnCaptureStarted() + + +``` +virtual void OHOS::Camera::IStreamOperatorCallback::OnCaptureStarted (int32_t captureId, const std::vector< int32_t > & streamIds ) +``` + +**描述:** + +捕获开始回调,在捕获开始时调用。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| captureId | [IN] 用于标识回调对应的捕获请求。 | +| streamIds | [IN] 回调对应的流集合。 | + +**参见:** + +[OnCaptureEnded](#oncaptureended) + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### OnError() + + +``` +virtual void OHOS::Camera::ICameraDeviceCallback::OnError (ErrorType type, int32_t errorCode ) +``` + +**描述:** + +设备发生错误时调用,由调用者实现,用于返回错误信息给调用者。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| type | [IN] 错误类型,具体错误类型可参考 **ErrorType**。 | +| errorCode | [IN] 错误码,当前暂未使用。 | + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### OnFlashlightStatus() + + +``` +virtual void OHOS::Camera::ICameraHostCallback::OnFlashlightStatus (const std::string & cameraId, FlashlightStatus status ) +``` + +**描述:** + +用于在闪光灯状态变化时上报状态信息给调用者。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| cameraId | [IN] 状态发生变化的闪关灯所绑定的Camera设备ID。 | +| status | [IN] 最新的闪光灯状态。 | + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### OnFrameShutter() + + +``` +virtual void OHOS::Camera::IStreamOperatorCallback::OnFrameShutter (int32_t captureId, const std::vector< int32_t > & streamIds, uint64_t timestamp ) +``` + +**描述:** + +帧捕获回调。 + +通过 **Capture** 的输入参数 [CaptureInfo](_o_h_o_s_1_1_camera_1_1_capture_info.md) 的enableShutterCallback_使能该回调, 使能后每次捕获均会触发此回调。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| captureId | [IN] 用于标识回调对应的捕获请求。 | +| streamIds | [IN] 回调对应的流集合。 | +| timestamp | [IN] 该接口被调用时的时间戳。 | + +**参见:** + +Capture + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### OnResult() + + +``` +virtual void OHOS::Camera::ICameraDeviceCallback::OnResult (uint64_t timestamp, const std::shared_ptr< CameraMetadata > & result ) +``` + +**描述:** + +上报camera设备相关的metadata的回调,上报方式查看 [SetResultMode](#setresultmode)。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| timestamp | [IN] metadata上报的时间戳。 | +| result | [IN] 上报的metadata,上报的metadata由 **EnableResult** 指定, 可通过 **GetEnabledResults** 查询,**DisableResult** 关闭上报开关。 | + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### OpenCamera() + + +``` +virtual CamRetCode OHOS::Camera::ICameraHost::OpenCamera (const std::string & cameraId, const OHOS::sptr< ICameraDeviceCallback > & callback, OHOS::sptr< ICameraDevice > & device ) +``` + +**描述:** + +打开Camera设备。 + +打开指定的Camera设备,通过此接口可以获取到ICameraDevice对象,通过ICameraDevice对象可以操作具体的Camera设备。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| cameraId | [IN] 需要打开的Camera设备ID,可通过 [GetCameraIds](#getcameraids) 接口获取当前已有Camera设备列表。 | +| callback | [IN] camera设备相关的回调函数,具体参见 [ICameraDeviceCallback](_o_h_o_s_1_1_camera_1_1_i_camera_device_callback.md)。 | +| device | [OUT] 返回当前要打开的Camera设备ID对应的ICameraDevice对象。 | + +**返回:** + +NO_ERROR 表示执行成功; + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**参见:** + +[GetCameraIds](#getcameraids) + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### Release() + + +``` +virtual CamRetCode OHOS::Camera::IOfflineStreamOperator::Release () +``` + +**描述:** + +释放所有离线流。 + +**返回:** + +NO_ERROR 表示执行成功; + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### ReleaseStreams() [1/2] + + +``` +virtual CamRetCode OHOS::Camera::IOfflineStreamOperator::ReleaseStreams (const std::vector< int > & streamIds) +``` + +**描述:** + +释放离线流。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| streamIds | 用于标识要释放的离线流集合。 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### ReleaseStreams() [2/2] + + +``` +virtual CamRetCode OHOS::Camera::IStreamOperator::ReleaseStreams (const std::vector< int > & streamIds) +``` + +**描述:** + +释放流。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| streamIds | [IN] 要释放的流ID列表。 | + +**返回:** + +NO_ERROR 表示执行成功; + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### SetCallback() + + +``` +virtual CamRetCode OHOS::Camera::ICameraHost::SetCallback (const OHOS::sptr< ICameraHostCallback > & callback) +``` + +**描述:** + +设置ICameraHost回调接口,回调函数参考 [ICameraHostCallback](_o_h_o_s_1_1_camera_1_1_i_camera_host_callback.md)。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| callback | [IN] 要设置的回调函数。 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### SetFlashlight() + + +``` +virtual CamRetCode OHOS::Camera::ICameraHost::SetFlashlight (const std::string & cameraId, bool & isEnable ) +``` + +**描述:** + +打开或关闭闪光灯。 + +该接口只能由打开cameraId指定Camera设备的调用者调用。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| cameraId | [IN] 闪光灯对应的Camera设备ID。 | +| isEnable | [IN] true打开闪光灯,false关闭闪光灯。 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**参见:** + +[GetCameraIds](#getcameraids) + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### SetResultMode() + + +``` +virtual CamRetCode OHOS::Camera::ICameraDevice::SetResultMode (const ResultCallbackMode & mode) +``` + +**描述:** + +设置metadata上报模式,逐帧上报还是设备状态变化时上报。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| mode | [IN] metadata的上报模式,逐帧上报或者设备状态变化时上报,查看 **ResultCallbackMode**。 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### UpdateSettings() + + +``` +virtual CamRetCode OHOS::Camera::ICameraDevice::UpdateSettings (const std::shared_ptr< CameraSetting > & settings) +``` + +**描述:** + +更新设备控制参数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| settings | [IN] Camera设置参数,包括sensor帧率,3A相关参数等。 | + +**返回:** + +NO_ERROR 表示执行成功。 + +其他值表示执行失败,具体错误码查看 [CamRetCode](#camretcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **变量说明** + + +### bufferQueue_ + + +``` +OHOS::sptr OHOS::Camera::StreamInfo::bufferQueue_ +``` + +**描述:** + +图形提供的生产者句柄。 + + +### captureSetting_ + + +``` +std::shared_ptr OHOS::Camera::CaptureInfo::captureSetting_ +``` + +**描述:** + +捕获的配置信息。 + + +### dataspace_ + + +``` +int OHOS::Camera::StreamInfo::dataspace_ +``` + +**描述:** + +图像颜色空间。 + + +### enableShutterCallback_ + + +``` +bool OHOS::Camera::CaptureInfo::enableShutterCallback_ +``` + +**描述:** + +使能捕获回调,每一次捕获后都会触发 **OnFrameShutter**。 + + +### encodeType_ + + +``` +EncodeType OHOS::Camera::StreamInfo::encodeType_ +``` + +**描述:** + +编码类型。 + + +### error_ + + +``` +StreamError OHOS::Camera::CaptureErrorInfo::error_ +``` + +**描述:** + +错误类型。 + + +### format_ + + +``` +int OHOS::Camera::StreamInfo::format_ +``` + +**描述:** + +图像格式。 + + +### frameCount_ + + +``` +int OHOS::Camera::CaptureEndedInfo::frameCount_ +``` + +**描述:** + +捕获结束时已经抓取的帧数。 + + +### height_ [1/2] + + +``` +int OHOS::Camera::StreamInfo::height_ +``` + +**描述:** + +图像高度。 + + +### height_ [2/2] + + +``` +int OHOS::Camera::StreamAttribute::height_ +``` + +**描述:** + +图像高度。 + + +### intent_ + + +``` +StreamIntent OHOS::Camera::StreamInfo::intent_ +``` + +**描述:** + +流类型。 + + +### maxBatchCaptureCount_ + + +``` +int OHOS::Camera::StreamAttribute::maxBatchCaptureCount_ +``` + +**描述:** + +连拍支持的最大捕获帧数量。 + + +### maxCaptureCount_ + + +``` +int OHOS::Camera::StreamAttribute::maxCaptureCount_ +``` + +**描述:** + +最大的并发捕获请求个数,默认为1。 + + +### minFrameDuration_ + + +``` +int OHOS::Camera::StreamInfo::minFrameDuration_ +``` + +**描述:** + +最小帧间隔。 + + +### overrideDataspace_ + + +``` +int OHOS::Camera::StreamAttribute::overrideDataspace_ +``` + +**描述:** + +重写的图像颜色空间。 + + +### overrideFormat_ + + +``` +int OHOS::Camera::StreamAttribute::overrideFormat_ +``` + +**描述:** + +重写的图像格式。 + + +### producerBufferCount_ + + +``` +int OHOS::Camera::StreamAttribute::producerBufferCount_ +``` + +**描述:** + +重写后的生产者缓存数量。 + + +### producerUsage_ + + +``` +int OHOS::Camera::StreamAttribute::producerUsage_ +``` + +**描述:** + +重写后的生产者的使用方式。 + + +### streamId_ [1/4] + + +``` +int OHOS::Camera::StreamInfo::streamId_ +``` + +**描述:** + +流的ID,用于在设备内唯一标识一条流。 + + +### streamId_ [2/4] + + +``` +int OHOS::Camera::StreamAttribute::streamId_ +``` + +**描述:** + +流的ID,用于在设备内唯一标识一条流。 + + +### streamId_ [3/4] + + +``` +int OHOS::Camera::CaptureEndedInfo::streamId_ +``` + +**描述:** + +捕获的流ID。 + + +### streamId_ [4/4] + + +``` +int OHOS::Camera::CaptureErrorInfo::streamId_ +``` + +**描述:** + +流ID。 + + +### streamIds_ + + +``` +std::vector OHOS::Camera::CaptureInfo::streamIds_ +``` + +**描述:** + +捕获的流ID集合。 + + +### tunneledMode_ + + +``` +bool OHOS::Camera::StreamInfo::tunneledMode_ +``` + +**描述:** + +隧道模式,值为true时开启,false关闭。 + +开启隧道模式后,HAL不直接和上层交互,通过图形提供的生产者句柄来传递帧数据, 对于一些IOT设备,可能不需要或者不支持预览流的图像数据缓存流转,此时需要关闭隧道模式。 + + +### width_ [1/2] + + +``` +int OHOS::Camera::StreamInfo::width_ +``` + +**描述:** + +图像宽度。 + + +### width_ [2/2] + + +``` +int OHOS::Camera::StreamAttribute::width_ +``` + +**描述:** + +图像宽度。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_codec.md b/zh-cn/device-dev/reference/hdi-apis/_codec.md new file mode 100644 index 0000000000000000000000000000000000000000..f3eea39775c59854ce737f602b09aed8711e69fd --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_codec.md @@ -0,0 +1,1346 @@ +# Codec + + +## **汇总** + + +### 文件 + + | 文件 | 描述 | +| -------- | -------- | +| [codec_callback_if.h](codec__callback__if_8h.md) | 主要包括回调函数接口定义。 | +| [codec_common_type.h](codec__common__type_8h.md) | Codec模块接口定义中使用的自定义数据类型。 | +| [codec_component_if.h](codec__component__if_8h.md) | 主要包括Codec组件接口定义。 | +| [codec_component_manager.h](codec__component__manager_8h.md) | 主要包括Codec组件管理类接口。 | +| [codec_component_type.h](codec__component__type_8h.md) | Codec模块接口定义中使用的自定义数据类型。 | + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [CodecCallbackType](_codec_callback_type.md) | Codec回调接口定义。 [更多...](_codec_callback_type.md) | +| [Alignment](_alignment.md) | 对齐结构定义,包含宽高的对齐值。 [更多...](_alignment.md) | +| [Rect](_rect.md) | 矩形的定义。 [更多...](_rect.md) | +| [RangeValue](_range_value.md) | 取值范围的定义。 [更多...](_range_value.md) | +| [CodecComponentType](_codec_component_type.md) | Codec组件接口定义。 [更多...](_codec_component_type.md) | +| [CodecComponentManager](_codec_component_manager.md) | Codec组件管理类接口定义。 [更多...](_codec_component_manager.md) | +| [VideoPortCap](_video_port_cap.md) | 定义视频编解码能力。 [更多...](_video_port_cap.md) | +| [AudioPortCap](_audio_port_cap.md) | 定义音频编解码能力。 [更多...](_audio_port_cap.md) | +| [PortCap](union_port_cap.md) | 定义音视频编解码能力。 [更多...](union_port_cap.md) | +| [CodecCompCapability](_codec_comp_capability.md) | 定义Codec编解码能力。 [更多...](_codec_comp_capability.md) | +| [OmxCodecBuffer](_omx_codec_buffer.md) | Codec buffer信息的定义。 [更多...](_omx_codec_buffer.md) | +| [CompVerInfo](_comp_ver_info.md) | 定义组件版本信息。 [更多...](_comp_ver_info.md) | +| [EventInfo](_event_info.md) | 定义事件上报信息。 [更多...](_event_info.md) | +| [SupportBufferType](_support_buffer_type.md) | SupportBuffer类型定义。 [更多...](_support_buffer_type.md) | +| [UseBufferType](_use_buffer_type.md) | UseBuffer类型定义。 [更多...](_use_buffer_type.md) | +| [GetBufferHandleUsageParams](_get_buffer_handle_usage_params.md) | BufferHandleUsage类型定义。 [更多...](_get_buffer_handle_usage_params.md) | + + +### 宏定义 + + | 宏定义 | 描述 | +| -------- | -------- | +| SAMPLE_FMT_NUM    32 | 采样格式最大值。 | +| UUID_LENGTH    128 | 定义UUID长度。 | +| PIX_FORMAT_NUM    16 | 支持的像素格式数组大小。 | +| SAMPLE_FORMAT_NUM    12 | 支持的音频采样格式数组大小。 | +| SAMPLE_RATE_NUM    16 | 支持的音频采样率数组大小。 | +| CHANNEL_NUM    16 | 支持的音频通道数组大小。 | +| NAME_LENGTH    32 | 组件名称大小。 | +| PROFILE_NUM    256 | 支持的profile数组大小。 | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [CodecType](#codectype) { VIDEO_DECODER, VIDEO_ENCODER, AUDIO_DECODER, AUDIO_ENCODER,   INVALID_TYPE } | 枚举编解码的类型。 [更多...](#codectype) | +| [Profile](#profile) { INVALID_PROFILE = 0, AAC_LC_PROFILE = 0x1000, AAC_MAIN_PROFILE, AAC_HE_V1_PROFILE,   AAC_HE_V2_PROFILE, AAC_LD_PROFILE, AAC_ELD_PROFILE, AVC_BASELINE_PROFILE = 0x2000,   AVC_MAIN_PROFILE, AVC_HIGH_PROFILE, HEVC_MAIN_PROFILE = 0x3000, HEVC_MAIN_10_PROFILE } | 枚举Codec规格。 [更多...](#profile) | +| [AudioSampleRate](#audiosamplerate) {   AUD_SAMPLE_RATE_8000 = 8000, AUD_SAMPLE_RATE_12000 = 12000, AUD_SAMPLE_RATE_11025 = 11025, AUD_SAMPLE_RATE_16000 = 16000,   AUD_SAMPLE_RATE_22050 = 22050, AUD_SAMPLE_RATE_24000 = 24000, AUD_SAMPLE_RATE_32000 = 32000, AUD_SAMPLE_RATE_44100 = 44100,   AUD_SAMPLE_RATE_48000 = 48000, AUD_SAMPLE_RATE_64000 = 64000, AUD_SAMPLE_RATE_96000 = 96000, AUD_SAMPLE_RATE_INVALID } | 枚举音频采样率。 [更多...](#audiosamplerate) | +| [CodecCapsMask](#codeccapsmask) { CODEC_CAP_ADAPTIVE_PLAYBACK = 0x1, CODEC_CAP_SECURE_PLAYBACK = 0x2, CODEC_CAP_TUNNEL_PLAYBACK = 0x4, CODEC_CAP_MULTI_PLANE = 0x10000 } | 枚举播放能力。 [更多...](#codeccapsmask) | +| [CodecProcessMode](#codecprocessmode) {   PROCESS_BLOCKING_INPUT_BUFFER = 0X1, PROCESS_BLOCKING_OUTPUT_BUFFER = 0X2, PROCESS_BLOCKING_CONTROL_FLOW = 0X4, PROCESS_NONBLOCKING_INPUT_BUFFER = 0X100,   PROCESS_NONBLOCKING_OUTPUT_BUFFER = 0X200, PROCESS_NONBLOCKING_CONTROL_FLOW = 0X400 } | 枚举编解码处理模式。 [更多...](#codecprocessmode) | +| [AvCodecRole](#avcodecrole) {   MEDIA_ROLETYPE_IMAGE_JPEG = 0, MEDIA_ROLETYPE_VIDEO_AVC, MEDIA_ROLETYPE_VIDEO_HEVC, MEDIA_ROLETYPE_AUDIO_FIRST = 0x10000,   MEDIA_ROLETYPE_AUDIO_AAC = 0x10000, MEDIA_ROLETYPE_AUDIO_G711A, MEDIA_ROLETYPE_AUDIO_G711U, MEDIA_ROLETYPE_AUDIO_G726,   MEDIA_ROLETYPE_AUDIO_PCM, MEDIA_ROLETYPE_AUDIO_MP3, MEDIA_ROLETYPE_INVALID } | 枚举音视频编解码组件类型。 [更多...](#avcodecrole) | +| [AudioSampleFormat](#audiosampleformat) {   AUDIO_SAMPLE_FORMAT_S8, AUDIO_SAMPLE_FORMAT_S8P, AUDIO_SAMPLE_FORMAT_U8, AUDIO_SAMPLE_FORMAT_U8P,   AUDIO_SAMPLE_FORMAT_S16, AUDIO_SAMPLE_FORMAT_S16P, AUDIO_SAMPLE_FORMAT_U16, AUDIO_SAMPLE_FORMAT_U16P,   AUDIO_SAMPLE_FORMAT_S24, AUDIO_SAMPLE_FORMAT_S24P, AUDIO_SAMPLE_FORMAT_U24, AUDIO_SAMPLE_FORMAT_U24P,   AUDIO_SAMPLE_FORMAT_S32, AUDIO_SAMPLE_FORMAT_S32P, AUDIO_SAMPLE_FORMAT_U32, AUDIO_SAMPLE_FORMAT_U32P,   AUDIO_SAMPLE_FORMAT_S64, AUDIO_SAMPLE_FORMAT_S64P, AUDIO_SAMPLE_FORMAT_U64, AUDIO_SAMPLE_FORMAT_U64P,   AUDIO_SAMPLE_FORMAT_F32, AUDIO_SAMPLE_FORMAT_F32P, AUDIO_SAMPLE_FORMAT_F64, AUDIO_SAMPLE_FORMAT_F64P,   AUDIO_SAMPLE_FMT_U8, AUDIO_SAMPLE_FMT_S16, AUDIO_SAMPLE_FMT_S32, AUDIO_SAMPLE_FMT_FLOAT,   AUDIO_SAMPLE_FMT_DOUBLE, AUDIO_SAMPLE_FMT_U8P, AUDIO_SAMPLE_FMT_S16P, AUDIO_SAMPLE_FMT_S32P,   AUDIO_SAMPLE_FMT_FLOATP, AUDIO_SAMPLE_FMT_DOUBLEP, AUDIO_SAMPLE_FMT_INVALID } | 枚举音频采样格式。 [更多...](#audiosampleformat) | +| [CodecBufferType](#codecbuffertype) {   CODEC_BUFFER_TYPE_INVALID = 0, CODEC_BUFFER_TYPE_VIRTUAL_ADDR = 0x1, CODEC_BUFFER_TYPE_AVSHARE_MEM_FD = 0x2, CODEC_BUFFER_TYPE_HANDLE = 0x4,   CODEC_BUFFER_TYPE_DYNAMIC_HANDLE = 0x8 } | 定义buffer类型。 [更多...](#codecbuffertype) | +| [ShareMemTypes](#sharememtypes) { READ_WRITE_TYPE = 0x1, READ_ONLY_TYPE = 0x2 } | 枚举共享内存类型。 [更多...](#sharememtypes) | +| [OmxIndexCodecExType](#omxindexcodecextype) { OMX_IndexExtBufferTypeStartUnused = OMX_IndexKhronosExtensions + 0x00a00000, OMX_IndexParamSupportBufferType, OMX_IndexParamUseBufferType, OMX_IndexParamGetBufferHandleUsage } | 枚举Codec扩展index。 [更多...](#omxindexcodecextype) | +| [OmxVideoExType](#omxvideoextype) { OMX_VIDEO_CodingHEVC = 11 } | 枚举Codec扩展编码类型。 [更多...](#omxvideoextype) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [CodecCallbackTypeGet](#codeccallbacktypeget) (struct HdfRemoteService \*remote) | 实例化CodecCallbackType对象。 [更多...](#codeccallbacktypeget) | +| [CodecCallbackTypeRelease](#codeccallbacktyperelease) (struct [CodecCallbackType](_codec_callback_type.md) \*instance) | 释放CodecCallbackType对象。 [更多...](#codeccallbacktyperelease) | +| [CodecComponentTypeGet](#codeccomponenttypeget) (struct HdfRemoteService \*remote) | 实例化CodecComponentType对象。 [更多...](#codeccomponenttypeget) | +| [CodecComponentTypeRelease](#codeccomponenttyperelease) (struct [CodecComponentType](_codec_component_type.md) \*instance) | 释放CodecComponentType对象。 [更多...](#codeccomponenttyperelease) | +| [GetCodecComponentManager](#getcodeccomponentmanager) (void) | 实例化CodecComponentManager对象。 [更多...](#getcodeccomponentmanager) | +| [CodecComponentManagerRelease](#codeccomponentmanagerrelease) (void) | 释放CodecComponentManager对象。 [更多...](#codeccomponentmanagerrelease) | + + +### 变量 + + | 变量 | 描述 | +| -------- | -------- | +| [CodecCallbackType::remote](#remote) | 指向HdfRemoteService的指针。 [更多...](#remote) | +| ( [CodecCallbackType::EventHandler](#eventhandler) )(struct [CodecCallbackType](_codec_callback_type.md) \*self, enum OMX_EVENTTYPE event, struct [EventInfo](_event_info.md) \*info) | 事件上报。 [更多...](#eventhandler) | +| ( [CodecCallbackType::EmptyBufferDone](#emptybufferdone) )(struct [CodecCallbackType](_codec_callback_type.md) \*self, int8_t \*appData, uint32_t appDataLen, const struct [OmxCodecBuffer](_omx_codec_buffer.md) \*buffer) | 上报输入buffer编码或者解码处理完毕。 [更多...](#emptybufferdone) | +| ( [CodecCallbackType::FillBufferDone](#fillbufferdone) )(struct [CodecCallbackType](_codec_callback_type.md) \*self, int8_t \*appData, uint32_t appDataLen, struct [OmxCodecBuffer](_omx_codec_buffer.md) \*buffer) | 上报输出buffer填充完毕。 [更多...](#fillbufferdone) | +| ( [CodecComponentType::GetComponentVersion](#getcomponentversion) )(struct [CodecComponentType](_codec_component_type.md) \*self, struct [CompVerInfo](_comp_ver_info.md) \*verInfo) | 获取Codec组件版本号。 [更多...](#getcomponentversion) | +| ( [CodecComponentType::SendCommand](#sendcommand) )(struct [CodecComponentType](_codec_component_type.md) \*self, enum OMX_COMMANDTYPE cmd, uint32_t param, int8_t \*cmdData, uint32_t cmdDataLen) | 发送命令给组件。 [更多...](#sendcommand) | +| ( [CodecComponentType::GetParameter](#getparameter) )(struct [CodecComponentType](_codec_component_type.md) \*self, uint32_t paramIndex, int8_t \*paramStruct, uint32_t paramStructLen) | 获取组件参数设置。 [更多...](#getparameter) | +| ( [CodecComponentType::SetParameter](#setparameter) )(struct [CodecComponentType](_codec_component_type.md) \*self, uint32_t index, int8_t \*paramStruct, uint32_t paramStructLen) | 设置组件需要的参数。 [更多...](#setparameter) | +| ( [CodecComponentType::GetConfig](#getconfig) )(struct [CodecComponentType](_codec_component_type.md) \*self, uint32_t index, int8_t \*cfgStruct, uint32_t cfgStructLen) | 获取组件的配置结构。 [更多...](#getconfig) | +| ( [CodecComponentType::SetConfig](#setconfig) )(struct [CodecComponentType](_codec_component_type.md) \*self, uint32_t index, int8_t \*cfgStruct, uint32_t cfgStructLen) | 设置组件的配置。 [更多...](#setconfig) | +| ( [CodecComponentType::GetExtensionIndex](#getextensionindex) )(struct [CodecComponentType](_codec_component_type.md) \*self, const char \*paramName, uint32_t \*indexType) | 根据字符串获取组件的扩展索引。 [更多...](#getextensionindex) | +| ( [CodecComponentType::GetState](#getstate) )(struct [CodecComponentType](_codec_component_type.md) \*self, enum OMX_STATETYPE \*state) | 获取组件的当前状态。 [更多...](#getstate) | +| ( [CodecComponentType::ComponentTunnelRequest](#componenttunnelrequest) )(struct [CodecComponentType](_codec_component_type.md) \*self, uint32_t port, int32_t tunneledComp, uint32_t tunneledPort, struct OMX_TUNNELSETUPTYPE \*tunnelSetup) | 设置组件采用Tunnel方式通信。 [更多...](#componenttunnelrequest) | +| ( [CodecComponentType::UseBuffer](#usebuffer) )(struct [CodecComponentType](_codec_component_type.md) \*self, uint32_t portIndex, struct [OmxCodecBuffer](_omx_codec_buffer.md) \*buffer) | 指定组件端口的buffer。 [更多...](#usebuffer) | +| ( [CodecComponentType::AllocateBuffer](#allocatebuffer) )(struct [CodecComponentType](_codec_component_type.md) \*self, uint32_t portIndex, struct [OmxCodecBuffer](_omx_codec_buffer.md) \*buffer) | 向组件申请端口buffer。 [更多...](#allocatebuffer) | +| ( [CodecComponentType::FreeBuffer](#freebuffer) )(struct [CodecComponentType](_codec_component_type.md) \*self, uint32_t portIndex, const struct [OmxCodecBuffer](_omx_codec_buffer.md) \*buffer) | 释放buffer。 [更多...](#freebuffer) | +| ( [CodecComponentType::EmptyThisBuffer](#emptythisbuffer) )(struct [CodecComponentType](_codec_component_type.md) \*self, const struct [OmxCodecBuffer](_omx_codec_buffer.md) \*buffer) | 编解码输入待处理buffer。 [更多...](#emptythisbuffer) | +| ( [CodecComponentType::FillThisBuffer](#fillthisbuffer) )(struct [CodecComponentType](_codec_component_type.md) \*self, const struct [OmxCodecBuffer](_omx_codec_buffer.md) \*buffer) | 编解码输出填充buffer。 [更多...](#fillthisbuffer) | +| ( [CodecComponentType::SetCallbacks](#setcallbacks) )(struct [CodecComponentType](_codec_component_type.md) \*self, struct [CodecCallbackType](_codec_callback_type.md) \*callback, int8_t \*appData, uint32_t appDataLen) | 设置Codec组件的回调函数。 [更多...](#setcallbacks) | +| ( [CodecComponentType::ComponentDeInit](#componentdeinit) )(struct [CodecComponentType](_codec_component_type.md) \*self) | 组件去初始化。 [更多...](#componentdeinit) | +| ( [CodecComponentType::UseEglImage](#useeglimage) )(struct [CodecComponentType](_codec_component_type.md) \*self, struct [OmxCodecBuffer](_omx_codec_buffer.md) \*buffer, uint32_t portIndex, int8_t \*eglImage, uint32_t eglImageLen) | 使用已在EGL中申请的空间。 [更多...](#useeglimage) | +| ( [CodecComponentType::ComponentRoleEnum](#componentroleenum) )(struct [CodecComponentType](_codec_component_type.md) \*self, uint8_t \*role, uint32_t roleLen, uint32_t index) | 获取组件角色。 [更多...](#componentroleenum) | + + +## **详细描述** + +Codec模块接口定义。 + +Codec模块涉及自定义类型、音视频编解码组件初始化、参数设置、数据的轮转和控制等。 + +**Since:** + +3.1 + +**Version:** + +2.0 + + +## **枚举类型说明** + + +### AudioSampleFormat + + +``` +enum AudioSampleFormat +``` + +**描述:** + +枚举音频采样格式。 + +- 对于planar的采样格式,每个声道的数据是独立存储在data中。 + +- 对于packed的采样格式,只使用第一个data,每个声道的数据是交错存储的。 + +| 枚举值 | 描述 | +| -------- | -------- | +| AUDIO_SAMPLE_FORMAT_S8 | 8bit位宽有符号交织样本。 | +| AUDIO_SAMPLE_FORMAT_S8P | 8bit位宽有符号非交织样本。 | +| AUDIO_SAMPLE_FORMAT_U8 | 8bit位宽无符号交织样本。 | +| AUDIO_SAMPLE_FORMAT_U8P | 8bit位宽无符号非交织样本。 | +| AUDIO_SAMPLE_FORMAT_S16 | 16bit位宽有符号交织样本。 | +| AUDIO_SAMPLE_FORMAT_S16P | 16bit位宽有符号非交织样本。 | +| AUDIO_SAMPLE_FORMAT_U16 | 16bit位宽无符号交织样本。 | +| AUDIO_SAMPLE_FORMAT_U16P | 16bit位宽无符号非交织样本。 | +| AUDIO_SAMPLE_FORMAT_S24 | 24bit位宽有符号交织样本。 | +| AUDIO_SAMPLE_FORMAT_S24P | 24bit位宽有符号非交织样本。 | +| AUDIO_SAMPLE_FORMAT_U24 | 24bit位宽无符号交织样本。 | +| AUDIO_SAMPLE_FORMAT_U24P | 24bit位宽无符号非交织样本。 | +| AUDIO_SAMPLE_FORMAT_S32 | 32bit位宽有符号交织样本。 | +| AUDIO_SAMPLE_FORMAT_S32P | 32bit位宽有符号非交织样本。 | +| AUDIO_SAMPLE_FORMAT_U32 | 32bit位宽无符号交织样本。 | +| AUDIO_SAMPLE_FORMAT_U32P | 32bit位宽无符号非交织样本。 | +| AUDIO_SAMPLE_FORMAT_S64 | 64bit位宽有符号交织样本。 | +| AUDIO_SAMPLE_FORMAT_S64P | 64bit位宽有符号非交织样本。 | +| AUDIO_SAMPLE_FORMAT_U64 | 64bit位宽无符号交织样本。 | +| AUDIO_SAMPLE_FORMAT_U64P | 64bit位宽无符号非交织样本。 | +| AUDIO_SAMPLE_FORMAT_F32 | 32bit位宽浮点型交织样本。 | +| AUDIO_SAMPLE_FORMAT_F32P | 64bit位宽浮点型非交织样本。 | +| AUDIO_SAMPLE_FORMAT_F64 | 64bit位宽双精度浮点型交织样本。 | +| AUDIO_SAMPLE_FORMAT_F64P | 64bit位宽双精度浮点型非交织样本。 | +| AUDIO_SAMPLE_FMT_U8 | 无符号8位整型,打包格式。 | +| AUDIO_SAMPLE_FMT_S16 | 带符号16位整型,打包格式。 | +| AUDIO_SAMPLE_FMT_S32 | 带符号32位整型,打包格式。 | +| AUDIO_SAMPLE_FMT_FLOAT | 浮点型,打包格式。 | +| AUDIO_SAMPLE_FMT_DOUBLE | 双精度浮点型,打包格式。 | +| AUDIO_SAMPLE_FMT_U8P | 无符号8位整型,平面格式。 | +| AUDIO_SAMPLE_FMT_S16P | 带符号16位整型,平面格式。 | +| AUDIO_SAMPLE_FMT_S32P | 带符号32位整型,平面格式。 | +| AUDIO_SAMPLE_FMT_FLOATP | 浮点型,平面格式。 | +| AUDIO_SAMPLE_FMT_DOUBLEP | 双精度浮点型,平面格式。 | +| AUDIO_SAMPLE_FMT_INVALID | 无效采样格式。 | + + +### AudioSampleRate + + +``` +enum AudioSampleRate +``` + +**描述:** + +枚举音频采样率 + + | 枚举值 | 描述 | +| -------- | -------- | +| AUD_SAMPLE_RATE_8000 | 8K采样率 | +| AUD_SAMPLE_RATE_12000 | 12K采样率 | +| AUD_SAMPLE_RATE_11025 | 11.025K采样率 | +| AUD_SAMPLE_RATE_16000 | 16K采样率 | +| AUD_SAMPLE_RATE_22050 | 22.050K采样率 | +| AUD_SAMPLE_RATE_24000 | 24K采样率 | +| AUD_SAMPLE_RATE_32000 | 32K采样率 | +| AUD_SAMPLE_RATE_44100 | 44.1K采样率 | +| AUD_SAMPLE_RATE_48000 | 48K采样率 | +| AUD_SAMPLE_RATE_64000 | 64K采样率 | +| AUD_SAMPLE_RATE_96000 | 96K采样率 | +| AUD_SAMPLE_RATE_INVALID | 无效采样率 | + + +### AvCodecRole + + +``` +enum AvCodecRole +``` + +**描述:** + +枚举音视频编解码组件类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| MEDIA_ROLETYPE_IMAGE_JPEG | 图像JPEG媒体类型 | +| MEDIA_ROLETYPE_VIDEO_AVC | 视频H.264媒体类型 | +| MEDIA_ROLETYPE_VIDEO_HEVC | 视频H.265媒体类型 | +| MEDIA_ROLETYPE_AUDIO_FIRST | 音频编解码器类型 | +| MEDIA_ROLETYPE_AUDIO_AAC | 音频AAC媒体类型 | +| MEDIA_ROLETYPE_AUDIO_G711A | 音频G711A媒体类型 | +| MEDIA_ROLETYPE_AUDIO_G711U | 音频G711U媒体类型 | +| MEDIA_ROLETYPE_AUDIO_G726 | 音频G726媒体类型 | +| MEDIA_ROLETYPE_AUDIO_PCM | 音频PCM媒体类型 | +| MEDIA_ROLETYPE_AUDIO_MP3 | 音频MP3媒体类型 | +| MEDIA_ROLETYPE_INVALID | 无效媒体类型 | + + +### CodecBufferType + + +``` +enum CodecBufferType +``` + +**描述:** + +定义buffer类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| CODEC_BUFFER_TYPE_INVALID | 无效buffer类型 | +| CODEC_BUFFER_TYPE_VIRTUAL_ADDR | 虚拟地址类型 | +| CODEC_BUFFER_TYPE_AVSHARE_MEM_FD | 共享内存类型 | +| CODEC_BUFFER_TYPE_HANDLE | handle类型 | +| CODEC_BUFFER_TYPE_DYNAMIC_HANDLE | 动态handle类型 | + + +### CodecCapsMask + + +``` +enum CodecCapsMask +``` + +**描述:** + +枚举播放能力。 + + | 枚举值 | 描述 | +| -------- | -------- | +| CODEC_CAP_ADAPTIVE_PLAYBACK | 自适应播放能力 | +| CODEC_CAP_SECURE_PLAYBACK | 安全播放能力 | +| CODEC_CAP_TUNNEL_PLAYBACK | 通道播放能力 | +| CODEC_CAP_MULTI_PLANE | 视频图像平面/音频通道平面能力 | + + +### CodecProcessMode + + +``` +enum CodecProcessMode +``` + +**描述:** + +枚举编解码处理模式。 + + | 枚举值 | 描述 | +| -------- | -------- | +| PROCESS_BLOCKING_INPUT_BUFFER | 同步模式输入buffer | +| PROCESS_BLOCKING_OUTPUT_BUFFER | 同步模式输出buffer | +| PROCESS_BLOCKING_CONTROL_FLOW | 同步模式控制流 | +| PROCESS_NONBLOCKING_INPUT_BUFFER | 异步模式输入buffer | +| PROCESS_NONBLOCKING_OUTPUT_BUFFER | 异步模式输出buffer | +| PROCESS_NONBLOCKING_CONTROL_FLOW | 异步模式控制流 | + + +### CodecType + + +``` +enum CodecType +``` + +**描述:** + +枚举编解码的类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| VIDEO_DECODER | 视频解码类型 | +| VIDEO_ENCODER | 视频编码类型 | +| AUDIO_DECODER | 音频解码类型 | +| AUDIO_ENCODER | 音频编码类型 | +| INVALID_TYPE | 无效类型 | + + +### OmxIndexCodecExType + + +``` +enum OmxIndexCodecExType +``` + +**描述:** + +枚举Codec扩展index。 + + | 枚举值 | 描述 | +| -------- | -------- | +| OMX_IndexExtBufferTypeStartUnused | BufferType 扩展index | +| OMX_IndexParamSupportBufferType | SupportBuffer类型 | +| OMX_IndexParamUseBufferType | UseBuffer类型 | +| OMX_IndexParamGetBufferHandleUsage | GetBufferHandleUsage类型 | + + +### OmxVideoExType + + +``` +enum OmxVideoExType +``` + +**描述:** + +枚举Codec扩展编码类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| OMX_VIDEO_CodingHEVC | HEVC编码类型 | + + +### Profile + + +``` +enum Profile +``` + +**描述:** + +枚举Codec规格。 + + | 枚举值 | 描述 | +| -------- | -------- | +| INVALID_PROFILE | 无效的规格。 | +| AAC_LC_PROFILE | AAC低复杂度规格。 | +| AAC_MAIN_PROFILE | AAC主规格。 | +| AAC_HE_V1_PROFILE | AAC高效率和频带重现规格,又称为HEAAC,AAC+,或者AACPlusV1。 | +| AAC_HE_V2_PROFILE | AAC高效率和频带重现以及变量立体声规格,又称为AAC++或者AACPlusV2。 | +| AAC_LD_PROFILE | AAC低延迟规格。 | +| AAC_ELD_PROFILE | AAC增强型低延迟规格。 | +| AVC_BASELINE_PROFILE | H.264低规格。 | +| AVC_MAIN_PROFILE | H.264主规格。 | +| AVC_HIGH_PROFILE | H.264高规格。 | +| HEVC_MAIN_PROFILE | H.265主规格。 | +| HEVC_MAIN_10_PROFILE | H.265 10比特主规格。 | + + +### ShareMemTypes + + +``` +enum ShareMemTypes +``` + +**描述:** + +枚举共享内存类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| READ_WRITE_TYPE | 可读可写的共享内存类型 | +| READ_ONLY_TYPE | 可读的共享内存类型 | + + +## **函数说明** + + +### CodecCallbackTypeGet() + + +``` +struct CodecCallbackType* CodecCallbackTypeGet (struct HdfRemoteService * remote) +``` + +**描述:** + +实例化CodecCallbackType对象。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| remote | 输入参数,指向HdfRemoteService的指针。 | + +**返回:** + +实例化CodecCallbackType对象。 + +**Since:** + +3.1 + + +### CodecCallbackTypeRelease() + + +``` +void CodecCallbackTypeRelease (struct CodecCallbackType * instance) +``` + +**描述:** + +释放CodecCallbackType对象。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| instance | 输入参数,指向CodecCallbackType实例的指针。 | + +**Since:** + +3.1 + + +### CodecComponentManagerRelease() + + +``` +void CodecComponentManagerRelease (void ) +``` + +**描述:** + +释放CodecComponentManager对象。 + +**Since:** + +3.1 + + +### CodecComponentTypeGet() + + +``` +struct CodecComponentType* CodecComponentTypeGet (struct HdfRemoteService * remote) +``` + +**描述:** + +实例化CodecComponentType对象。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| remote | 输入参数,指向RemoteService的指针。 | + +**返回:** + +实例化的CodecComponentType对象。 + +**Since:** + +3.1 + + +### CodecComponentTypeRelease() + + +``` +void CodecComponentTypeRelease (struct CodecComponentType * instance) +``` + +**描述:** + +释放CodecComponentType对象。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| instance | 输入参数,指向CodecComponentType实例的指针。 | + +**Since:** + +3.1 + + +### GetCodecComponentManager() + + +``` +struct CodecComponentManager* GetCodecComponentManager (void ) +``` + +**描述:** + +实例化CodecComponentManager对象。 + +**返回:** + +实例化的CodecComponentManager对象。 + +**Since:** + +3.1 + + +## **变量说明** + + +### AllocateBuffer + + +``` +int32_t(* CodecComponentType::AllocateBuffer) (struct CodecComponentType *self, uint32_t portIndex, struct OmxCodecBuffer *buffer) +``` + +**描述:** + +向组件申请端口buffer。 + +向组件申请分配新的buffer,此接口在以下情况下使用: + +- 当组件处于OMX_StateLoaded状态,并且用户已经向组件发送OMX_StateIdle状态转换请求。 + +- 当组件处于OMX_StateWaitForResources状态,所需的资源可用,并且组件已准备好进入OMX_StateIdle状态。 + +- 在去使能端口上,组件处于OMX_StateExecuting、OMX_StatePause或OMX_StateIdle状态。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| portIndex | 输入参数,指定的组件端口。 | +| buffer | 输入输出参数,指向要申请的buffer结构体[OmxCodecBuffer](_omx_codec_buffer.md)指针。 | + +**返回:** + +HDF_SUCCESS 表示申请buffer成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,申请buffer失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,申请buffer失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,申请buffer失败。 + +**Since:** + +3.1 + + +### ComponentDeInit + + +``` +int32_t(* CodecComponentType::ComponentDeInit) (struct CodecComponentType *self) +``` + +**描述:** + +组件去初始化。 + +调用此接口使组件去初始化,当组件处于OMX_StateLoaded状态时,将直接关闭组件。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | + +**返回:** + +HDF_SUCCESS 表示去初始化成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,去初始化失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,去初始化失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,去初始化失败。 + +**Since:** + +3.1 + + +### ComponentRoleEnum + + +``` +int32_t(* CodecComponentType::ComponentRoleEnum) (struct CodecComponentType *self, uint8_t *role, uint32_t roleLen, uint32_t index) +``` + +**描述:** + +获取组件角色。 + +根据组件角色索引获取对应组件角色。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| role | 输出参数,角色名称。 | +| roleLen | 输入参数,role字节数。 | +| index | 输入参数,角色的索引,一个组件可能支持多种角色。 | + +**返回:** + +HDF_SUCCESS 表示获取角色成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,获取角色失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,获取角色失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,获取角色失败。 + +**Since:** + +3.1 + + +### ComponentTunnelRequest + + +``` +int32_t(* CodecComponentType::ComponentTunnelRequest) (struct CodecComponentType *self, uint32_t port, int32_t tunneledComp, uint32_t tunneledPort, struct OMX_TUNNELSETUPTYPE *tunnelSetup) +``` + +**描述:** + +设置组件采用Tunnel方式通信。 + +当组件处于OMX_StateLoaded 状态时,用户通过调用此接口确定组件是否可以进行Tunnel传输,如果可以则设置组件的Tunnel传输。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| port | 输入参数,组件设置的端口。 | +| tunneledComp | 输入参数,组件的tunnel handle。 | +| tunneledPort | 输入参数,组件用来Tunnel通信的端口。 | +| tunnelSetup | 输入输出参数,指向Tunnel设置的结构体**OMX_TUNNELSETUPTYPE**指针。 | + +**返回:** + +HDF_SUCCESS 表示设置成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,设置失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,设置失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,设置失败。 + +**Since:** + +3.1 + + +### EmptyBufferDone + + +``` +int32_t(* CodecCallbackType::EmptyBufferDone) (struct CodecCallbackType *self, int8_t *appData, uint32_t appDataLen, const struct OmxCodecBuffer *buffer) +``` + +**描述:** + +上报输入buffer编码或者解码处理完毕。 + +组件运行过程中向上报告输入buffer已经使用完毕。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的callback指针。 | +| appData | 输入参数,上层数据,通常是设置回调时给入的上层实例。 | +| appDataLen | 输入参数,appData字节数。 | +| buffer | 输入参数,已经处理完毕的输入buffer信息[OmxCodecBuffer](_omx_codec_buffer.md)。 | + +**返回:** + +HDF_SUCCESS 表示上报成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,上报失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,上报失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,上报失败。 + +**Since:** + +3.1 + + +### EmptyThisBuffer + + +``` +int32_t(* CodecComponentType::EmptyThisBuffer) (struct CodecComponentType *self, const struct OmxCodecBuffer *buffer) +``` + +**描述:** + +编解码输入待处理buffer。 + +此接口在组件处于OMX_StateExecuting或者OMX_StatePause状态时调用。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| buffer | 输入参数,指向[OmxCodecBuffer](_omx_codec_buffer.md)结构体的指针。 | + +**返回:** + +HDF_SUCCESS 表示输入buffer成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,输入buffer失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,输入buffer失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,输入buffer失败。 + +**Since:** + +3.1 + + +### EventHandler + + +``` +int32_t(* CodecCallbackType::EventHandler) (struct CodecCallbackType *self, enum OMX_EVENTTYPE event, struct EventInfo *info) +``` + +**描述:** + +事件上报。 + +组件运行过程中向上报告错误事件、命令完成事件、端口设置更改事件等。 + +- 当eEvent为OMX_EventCmdComplete,eventData为NULL,data1数据为OMX_COMMANDTYPE,此时,当data1为OMX_CommandStateSet,data2表示状态,其它情况下,data2表示端口。 + +- 当event为OMX_EventError时,data1表示错误码,data2和eventData都为0。 + +- 当event为OMX_EventMark时,data1和data2都为0,eventData指向mark指针。 + +- 当event为OMX_EventPortSettingsChanged时,data1表示端口,data2和eventData为0。 + +- 当event为OMX_EventBufferFlag时,data1表示端口,data2表示flag,eventData为0。 + +- 当event为OMX_EventResourcesAcquired或OMX_EventDynamicResourcesAvailable时,data1、data2和eventData都为0。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的callback指针。 | +| event | 输入参数,要通知的事件类型,详见**OMX_EVENTTYPE**。 | +| info | 输入参数,指向事件上报携带的信息指针,详见[EventInfo](_event_info.md)。 | + +**返回:** + +HDF_SUCCESS 表示事件上报成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,事件上报失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,事件上报失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,事件上报失败。 + +**Since:** + +3.1 + + +### FillBufferDone + + +``` +int32_t(* CodecCallbackType::FillBufferDone) (struct CodecCallbackType *self, int8_t *appData, uint32_t appDataLen, struct OmxCodecBuffer *buffer) +``` + +**描述:** + +上报输出buffer填充完毕。 + +组件运行过程中向上报告输出buffer已经填充完毕。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的callback指针。 | +| appData | 输入参数,上层数据,通常是设置回调时给入的上层实例。 | +| appDataLen | 输入参数,appData字节数。 | +| buffer | 输入参数,已经填充完毕的buffer信息[OmxCodecBuffer](_omx_codec_buffer.md)。 | + +**返回:** + +HDF_SUCCESS 表示上报成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,上报失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,上报失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,上报失败。 + +**Since:** + +3.1 + + +### FillThisBuffer + + +``` +int32_t(* CodecComponentType::FillThisBuffer) (struct CodecComponentType *self, const struct OmxCodecBuffer *buffer) +``` + +**描述:** + +编解码输出填充buffer。 + +此接口在组件处于OMX_StateExecuting或者OMX_StatePause状态时调用。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| buffer | 输入参数,指向[OmxCodecBuffer](_omx_codec_buffer.md)结构体的指针。 | + +**返回:** + +HDF_SUCCESS 表示填充buffer成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,填充buffer失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,填充buffer失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,填充buffer失败。 + +**Since:** + +3.1 + + +### FreeBuffer + + +``` +int32_t(* CodecComponentType::FreeBuffer) (struct CodecComponentType *self, uint32_t portIndex, const struct OmxCodecBuffer *buffer) +``` + +**描述:** + +释放buffer。 + +此接口在以下情况下使用: + +- 当组件处于OMX_StateIdle状态,并且已经向组件发送OMX_StateLoaded状态转换请求。 + +- 在去使能端口上,组件处于OMX_StateExecuting、OMX_StatePause或OMX_StateIdle时调用。 + +- 此接口调用可随时进行,但是如果未在上述情况下执行,可能会导致组件上报OMX_ErrorPortUnpopulated事件。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| portIndex | 输入参数,指定的组件端口。 | +| buffer | 输入参数,指向[OmxCodecBuffer](_omx_codec_buffer.md)结构体的指针。 | + +**返回:** + +HDF_SUCCESS 表示释放buffer成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,释放buffer失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,释放buffer失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,释放buffer失败。 + +**Since:** + +3.1 + + +### GetComponentVersion + + +``` +int32_t(* CodecComponentType::GetComponentVersion) (struct CodecComponentType *self, struct CompVerInfo *verInfo) +``` + +**描述:** + +获取Codec组件版本号。 + +通过查询组件,返回组件版本信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| verInfo | 输出参数,指向组件版本信息的指针,详见[CompVerInfo](_comp_ver_info.md)。 | + +**返回:** + +HDF_SUCCESS 表示获取版本号成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,获取版本号失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,获取版本号失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,获取版本号失败。 + +**Since:** + +3.1 + + +### GetConfig + + +``` +int32_t(* CodecComponentType::GetConfig) (struct CodecComponentType *self, uint32_t index, int8_t *cfgStruct, uint32_t cfgStructLen) +``` + +**描述:** + +获取组件的配置结构。 + +加载组件后可以随时调用此接口获取组件的配置。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| index | 输入参数,待填充结构的索引,详见**OMX_INDEXTYPE**。 | +| cfgStruct | 输入输出参数,指向由组件填充的应用程序分配的结构体指针。 | +| cfgStructLen | 输入参数,上层传入的cfgStruct字节数。 | + +**返回:** + +HDF_SUCCESS 表示获取配置成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,获取配置失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,获取配置失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,获取配置失败。 + +**Since:** + +3.1 + + +### GetExtensionIndex + + +``` +int32_t(* CodecComponentType::GetExtensionIndex) (struct CodecComponentType *self, const char *paramName, uint32_t *indexType) +``` + +**描述:** + +根据字符串获取组件的扩展索引。 + +将扩展字符串转换为Openmax IL结构索引。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| paramName | 输入参数,组件用来转换为配置索引的字符串。 | +| indexType | 输出参数,由paramName转换的配置索引,详见**OMX_INDEXTYPE**。 | + +**返回:** + +HDF_SUCCESS 表示获取扩展索引成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,获取扩展索引失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,获取扩展索引失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,获取扩展索引失败。 + +**Since:** + +3.1 + + +### GetParameter + + +``` +int32_t(* CodecComponentType::GetParameter) (struct CodecComponentType *self, uint32_t paramIndex, int8_t *paramStruct, uint32_t paramStructLen) +``` + +**描述:** + +获取组件参数设置。 + +当组件处于除了OMX_StateInvalid(组件状态异常)之外的其他状态,用户可通过此接口获取组件参数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| paramIndex | 输入参数,待填充结构的索引,详见**OMX_INDEXTYPE**。 | +| paramStruct | 输入输出参数,指向由组件填充的应用程序分配的结构体指针。 | +| paramStructLen | 输入参数,paramStruct字节数。 | + +**返回:** + +HDF_SUCCESS 表示获取参数成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,获取参数失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,获取参数失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,获取参数失败。 + +**Since:** + +3.1 + + +### GetState + + +``` +int32_t(* CodecComponentType::GetState) (struct CodecComponentType *self, enum OMX_STATETYPE *state) +``` + +**描述:** + +获取组件的当前状态。 + +用户可调用此接口获取组件的当前状态,组件状态详见**OMX_STATETYPE**。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| state | 输出参数,指向获取到的状态指针,组件状态详见**OMX_STATETYPE**。 | + +**返回:** + +HDF_SUCCESS 表示获取状态成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,获取状态失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,获取状态失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,获取状态失败。 + +**Since:** + +3.1 + + +### remote + + +``` +struct HdfRemoteService* CodecCallbackType::remote +``` + +**描述:** + +指向HdfRemoteService的指针。 + +**Since:** + +3.1 + + +### SendCommand + + +``` +int32_t(* CodecComponentType::SendCommand) (struct CodecComponentType *self, enum OMX_COMMANDTYPE cmd, uint32_t param, int8_t *cmdData, uint32_t cmdDataLen) +``` + +**描述:** + +发送命令给组件。 + +发送命令给组件,当命令为设置状态时,会有事件回调通知结果给上层,其他命令则没有事件上报。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| cmd | 输入参数,组件要执行的命令,详见**OMX_COMMANDTYPE**。 | +| param | 输入参数,组件要执行的命令携带的参数。
- 当cmd为OMX_CommandStateSet时,param的值详见**OMX_STATETYPE**。
- 当cmd为OMX_CommandFlush、OMX_CommandPortDisable、OMX_CommandPortEnable、OMX_CommandMarkBuffer时,param为目标端口。 | +| cmdData | 输入参数,当cmd为OMX_CommandMarkBuffer时,指向OMX_MARKTYPE结构体指针。 | +| cmdDataLen | 输入参数,上层传递的cmdData字节数。 | + +**返回:** + +HDF_SUCCESS 表示发送命令成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,发送命令失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,发送命令失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,发送命令失败。 + +**Since:** + +3.1 + + +### SetCallbacks + + +``` +int32_t(* CodecComponentType::SetCallbacks) (struct CodecComponentType *self, struct CodecCallbackType *callback, int8_t *appData, uint32_t appDataLen) +``` + +**描述:** + +设置Codec组件的回调函数。 + +当组件处于OMX_StateLoaded状态时,使用此回调函数向上通知事件以及上报可用的输入输出信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| callback | 输入参数,指向回调函数[CodecCallbackType](_codec_callback_type.md)对象指针。 | +| appData | 输入参数,指向应用程序定义的值的指针,该值将在回调期间返回。 | +| appDataLen | 输入参数,上层传递的appData字节数。 | + +**返回:** + +HDF_SUCCESS 表示设置回调成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,设置回调失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,设置回调失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,设置回调失败。 + +**Since:** + +3.1 + + +### SetConfig + + +``` +int32_t(* CodecComponentType::SetConfig) (struct CodecComponentType *self, uint32_t index, int8_t *cfgStruct, uint32_t cfgStructLen) +``` + +**描述:** + +设置组件的配置。 + +加载组件后可以随时调用此接口设置组件的配置。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| index | 输入参数,要设置的结构索引,详见**OMX_INDEXTYPE**。 | +| cfgStruct | 输入参数,指向组件用于初始化的应用程序分配结构的指针。 | +| cfgStructLen | 输入参数,cfgStruct字节数。 | + +**返回:** + +HDF_SUCCESS 表示设置配置成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,设置失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,设置失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,设置失败。 + +**Since:** + +3.1 + + +### SetParameter + + +``` +int32_t(* CodecComponentType::SetParameter) (struct CodecComponentType *self, uint32_t index, int8_t *paramStruct, uint32_t paramStructLen) +``` + +**描述:** + +设置组件需要的参数。 + +当组件处于OMX_StateLoaded、OMX_StateWaitForResources状态或者端口是去使能状态,用户可通过此接口设置组件参数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| index | 输入参数,要设置的结构索引,详见**OMX_INDEXTYPE**。 | +| paramStruct | 输入参数,指向组件用于初始化的应用程序分配结构的指针。 | +| paramStructLen | 输入参数,paramStruct字节数。 | + +**返回:** + +HDF_SUCCESS 表示设置参数成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,设置参数失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,设置参数失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,设置参数失败。 + +**Since:** + +3.1 + + +### UseBuffer + + +``` +int32_t(* CodecComponentType::UseBuffer) (struct CodecComponentType *self, uint32_t portIndex, struct OmxCodecBuffer *buffer) +``` + +**描述:** + +指定组件端口的buffer。 + +此接口在以下情况下使用: + +- 当组件处于OMX_StateLoaded状态,并且用户已经向组件发送OMX_StateIdle状态转换请求。 + +- 当组件处于OMX_StateWaitForResources状态,所需的资源可用,并且组件已准备好进入OMX_StateIdle状态。 + +- 在去使能端口上,组件处于OMX_StateExecuting、OMX_StatePause或OMX_StateIdle状态。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| portIndex | 输入参数,指定的组件端口。 | +| buffer | 输入输出参数,指向要使用的buffer结构体[OmxCodecBuffer](_omx_codec_buffer.md)指针。 | + +**返回:** + +HDF_SUCCESS 表示指定成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,指定失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,指定失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,指定失败。 + +**Since:** + +3.1 + + +### UseEglImage + + +``` +int32_t(* CodecComponentType::UseEglImage) (struct CodecComponentType *self, struct OmxCodecBuffer *buffer, uint32_t portIndex, int8_t *eglImage, uint32_t eglImageLen) +``` + +**描述:** + +使用已在EGL中申请的空间。 + +此接口在以下情况下使用: + +- 当组件处于OMX_StateLoaded状态,并且已经向组件发送OMX_StateIdle状态转换请求。 + +- 当组件处于OMX_StateWaitForResources状态,所需的资源可用,并且组件已准备好进入OMX_StateIdle状态。 + +- 在去使能端口上,组件处于OMX_StateExecuting、OMX_StatePause或OMX_StateIdle状态。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| self | 输入参数,指向要操作的Codec组件指针。 | +| buffer | 输入输出参数,指向[OmxCodecBuffer](_omx_codec_buffer.md)结构体的指针。 | +| portIndex | 输入参数,指定的组件端口。 | +| eglImage | 输入参数,EGL申请的图像指针。 | +| eglImageLen | 输入参数,eglImage字节数。 | + +**返回:** + +HDF_SUCCESS 表示使用成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,使用失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,使用失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,使用失败。 + +**Since:** + +3.1 diff --git a/zh-cn/device-dev/reference/hdi-apis/_codec_callback_type.md b/zh-cn/device-dev/reference/hdi-apis/_codec_callback_type.md new file mode 100644 index 0000000000000000000000000000000000000000..1734e7654a81742da24ef94e9b0e9f344a33b181 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_codec_callback_type.md @@ -0,0 +1,38 @@ +# CodecCallbackType + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [remote](_codec.md#remote) | 指向HdfRemoteService的指针。 [更多...](_codec.md#remote) | +| ( [EventHandler](_codec.md#eventhandler) )(struct [ERROR:Invalid link:zh-cn_topic_0000001304382300.xml#xref452479393083931,link:zh-cn_topic_0000001304382300.xml](zh-cn_topic_0000001304382300.xml) \*self, enum OMX_EVENTTYPE event, struct [EventInfo](_event_info.md) \*info) | 事件上报。 [更多...](_codec.md#eventhandler) | +| ( [EmptyBufferDone](_codec.md#emptybufferdone) )(struct [ERROR:Invalid link:zh-cn_topic_0000001304382300.xml#xref1077915705083931,link:zh-cn_topic_0000001304382300.xml](zh-cn_topic_0000001304382300.xml) \*self, int8_t \*appData, uint32_t appDataLen, const struct [OmxCodecBuffer](_omx_codec_buffer.md) \*buffer) | 上报输入buffer编码或者解码处理完毕。 [更多...](_codec.md#emptybufferdone) | +| ( [FillBufferDone](_codec.md#fillbufferdone) )(struct [ERROR:Invalid link:zh-cn_topic_0000001304382300.xml#xref1123615867083931,link:zh-cn_topic_0000001304382300.xml](zh-cn_topic_0000001304382300.xml) \*self, int8_t \*appData, uint32_t appDataLen, struct [OmxCodecBuffer](_omx_codec_buffer.md) \*buffer) | 上报输出buffer填充完毕。 [更多...](_codec.md#fillbufferdone) | + + +## **详细描述** + +Codec回调接口定义。 + +提供了以下3种回调函数: + +- 组件错误事件、命令完成事件、端口设置等事件回调,详见EventHandler。 + +- 输入端口处理完buffer回调,详见EmptyBufferDone。 + +- 输出端口填充完buffer回调,详见FillBufferDone。 通过以下两种方式注册回调: + +- 创建组件时,通过CreateComponent方法。 + +- 当组件处于OMX_StateLoaded状态时,通过SetCallbacks方法注册回调。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_codec_comp_capability.md b/zh-cn/device-dev/reference/hdi-apis/_codec_comp_capability.md new file mode 100644 index 0000000000000000000000000000000000000000..f8900208d56a534c34c0204d6d8124024c4fc9b6 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_codec_comp_capability.md @@ -0,0 +1,155 @@ +# CodecCompCapability + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [role](#role) | 媒体类型。 | +| [type](#type) | 编解码类型。 | +| [compName](#compname) [[NAME_LENGTH](_codec.md#gaf71324c57f05ff9e24bd384925dd6b17)] | 编解码组件名称。 | +| [supportProfiles](#supportprofiles) [[PROFILE_NUM](_codec.md#gaab6353cb3662bdc672ae8ab90df529ce)] | 支持的profiles,详见[Profile](_codec.md#profile)。 | +| [maxInst](#maxinst) | 最大实例。 | +| [isSoftwareCodec](#issoftwarecodec) | 软件编解码还是硬件编解码。 | +| [processModeMask](#processmodemask) | 编解码处理模式掩码,详见[CodecProcessMode](_codec.md#codecprocessmode)。 | +| [capsMask](#capsmask) | 编解码播放能力掩码,详见[CodecCapsMask](_codec.md#codeccapsmask)。 | +| [bitRate](#bitrate) | 支持的码率范围。 | +| [port](#port) | 支持的音视频编解码能力。 | + + +## **详细描述** + +定义Codec编解码能力。 + + +## **类成员变量说明** + + +### bitRate + + +``` +RangeValue CodecCompCapability::bitRate +``` + +**描述:** + +支持的码率范围 + + +### capsMask + + +``` +uint32_t CodecCompCapability::capsMask +``` + +**描述:** + +编解码播放能力掩码,详见[CodecCapsMask](_codec.md#codeccapsmask). + + +### compName + + +``` +char CodecCompCapability::compName[NAME_LENGTH] +``` + +**描述:** + +编解码组件名称 + + +### isSoftwareCodec + + +``` +bool CodecCompCapability::isSoftwareCodec +``` + +**描述:** + +软件编解码还是硬件编解码 + + +### maxInst + + +``` +int32_t CodecCompCapability::maxInst +``` + +**描述:** + +最大实例 + + +### port + + +``` +PortCap CodecCompCapability::port +``` + +**描述:** + +支持的音视频编解码能力 + + +### processModeMask + + +``` +int32_t CodecCompCapability::processModeMask +``` + +**描述:** + +编解码处理模式掩码,详见[CodecProcessMode](_codec.md#codecprocessmode). + + +### role + + +``` +AvCodecRole CodecCompCapability::role +``` + +**描述:** + +媒体类型 + + +### supportProfiles + + +``` +int32_t CodecCompCapability::supportProfiles[PROFILE_NUM] +``` + +**描述:** + +支持的profiles,详见[Profile](_codec.md#profile) + + +### type + + +``` +CodecType CodecCompCapability::type +``` + +**描述:** + +编解码类型 diff --git a/zh-cn/device-dev/reference/hdi-apis/_codec_component_manager.md b/zh-cn/device-dev/reference/hdi-apis/_codec_component_manager.md new file mode 100644 index 0000000000000000000000000000000000000000..22b2d95f61a7a6529fdf473dcec84ed2a8bedd22 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_codec_component_manager.md @@ -0,0 +1,148 @@ +# CodecComponentManager + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ([GetComponentNum](#getcomponentnum) )() | 获取Codec编解码组件数量。 [更多...](#getcomponentnum) | +| ( [GetComponentCapabilityList](#getcomponentcapabilitylist) )([CodecCompCapability](_codec_comp_capability.md) \*capList, int32_t count) | 获取编解码能力集表。 [更多...](#getcomponentcapabilitylist) | +| ( [CreateComponent](#createcomponent) )(struct [CodecComponentType](_codec_component_type.md) \*\*component, char \*compName, void \*appData, int32_t appDataSize, struct [CodecCallbackType](_codec_callback_type.md) \*callbacks) | 创建Codec组件实例。 [更多...](#createcomponent) | +| ( [DestroyComponent](#destroycomponent))(struct [CodecComponentType](_codec_component_type.md) \*component) | 销毁组件实例。 [更多...](#destroycomponent) | + + +## **详细描述** + +Codec组件管理类接口定义。 + +主要提供以下功能: + +- 获取Codec编解码组件数量以及编解码能力集表。 + +- 创建/销毁Codec组件。 + + +## **类成员变量说明** + + +### CreateComponent + + +``` +int32_t(* CodecComponentManager::CreateComponent) (struct CodecComponentType **component, char *compName, void *appData, int32_t appDataSize, struct CodecCallbackType *callbacks) +``` + +**描述:** + +创建Codec组件实例。 + +根据组件名称创建Codec组件实例。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| component | 输出参数,指向Codec组件的指针。 | +| compName | 输入参数,组件名称。 | +| appData | 输入参数,指向应用程序定义的值的指针,该值将在回调期间返回。 | +| appDataSize | 输入参数,appData字节数。 | +| callbacks | 输入参数,回调接口,指向OMX_CALLBACKTYPE结构的指针,详见[CodecCallbackType](_codec_callback_type.md)。 | + +**返回:** + +HDF_SUCCESS 表示创建组件成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,创建组件失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,创建组件失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,创建组件失败。 + + +### DestroyComponent + + +``` +int32_t(* CodecComponentManager::DestroyComponent) (struct CodecComponentType *component) +``` + +**描述:** + +销毁组件实例。 + +销毁指定的Codec组件。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| component | 输入参数,需要销毁的Codec组件。 | + +**返回:** + +HDF_SUCCESS 表示销毁组件成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,销毁组件失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,销毁组件失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,销毁组件失败。 + + +### GetComponentCapabilityList + + +``` +int32_t(* CodecComponentManager::GetComponentCapabilityList) (CodecCompCapability *capList, int32_t count) +``` + +**描述:** + +获取编解码能力集表。 + +用户可通过此接口了解Codec模块提供了哪些编解码能力,对应的能力体现在[CodecCompCapability](_codec_comp_capability.md)结构体。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| capList | 输出参数,返回全部组件的能力集表[CodecCompCapability](_codec_comp_capability.md)。 | +| count | 输入参数,编解码组件数量,由[GetComponentNum](#getcomponentnum)获得。 | + +**返回:** + +HDF_SUCCESS 表示获取能力集表成功。 + +HDF_ERR_INVALID_PARAM 表示参数无效,获取能力集表失败。 + +HDF_ERR_INVALID_OBJECT 表示对象无效,获取能力集表失败。 + +HDF_ERR_MALLOC_FAIL 表示申请内存失败,获取能力集表失败。 + + +### GetComponentNum + + +``` +int32_t(* CodecComponentManager::GetComponentNum) () +``` + +**描述:** + +获取Codec编解码组件数量。 + +通过此接口获取Codec编解码组件数量,用来获取全部编解码能力集。 + +**返回:** + +Codec编解码组件数量。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_codec_component_type.md b/zh-cn/device-dev/reference/hdi-apis/_codec_component_type.md new file mode 100644 index 0000000000000000000000000000000000000000..9487954829cb9363bcc0ff88d38e47bda2f869c5 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_codec_component_type.md @@ -0,0 +1,54 @@ +# CodecComponentType + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [GetComponentVersion](_codec.md#getcomponentversion) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref1521256091083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, struct [CompVerInfo](_comp_ver_info.md) \*verInfo) | 获取Codec组件版本号。 [更多...](_codec.md#getcomponentversion) | +| ( [SendCommand](_codec.md#sendcommand) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref2020788308083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, enum OMX_COMMANDTYPE cmd, uint32_t param, int8_t \*cmdData, uint32_t cmdDataLen) | 发送命令给组件。 [更多...](_codec.md#sendcommand) | +| ( [GetParameter](_codec.md#getparameter) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref2071182762083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, uint32_t paramIndex, int8_t \*paramStruct, uint32_t paramStructLen) | 获取组件参数设置。 [更多...](_codec.md#getparameter) | +| ( [SetParameter](_codec.md#setparameter) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref1874982936083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, uint32_t index, int8_t \*paramStruct, uint32_t paramStructLen) | 设置组件需要的参数。 [更多...](_codec.md#setparameter) | +| ( [GetConfig](_codec.md#getconfig) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref921941812083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, uint32_t index, int8_t \*cfgStruct, uint32_t cfgStructLen) | 获取组件的配置结构。 [更多...](_codec.md#getconfig) | +| ( [SetConfig](_codec.md#setconfig) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref1073566491083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, uint32_t index, int8_t \*cfgStruct, uint32_t cfgStructLen) | 设置组件的配置。 [更多...](_codec.md#setconfig) | +| ( [GetExtensionIndex](_codec.md#getextensionindex) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref68113596083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, const char \*paramName, uint32_t \*indexType) | 根据字符串获取组件的扩展索引。 [更多...](_codec.md#getextensionindex) | +| ( [GetState](_codec.md#getstate) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref1226754841083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, enum OMX_STATETYPE \*state) | 获取组件的当前状态。 [更多...](_codec.md#getstate) | +| ( [ComponentTunnelRequest](_codec.md#componenttunnelrequest) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref1739461855083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, uint32_t port, int32_t tunneledComp, uint32_t tunneledPort, struct OMX_TUNNELSETUPTYPE \*tunnelSetup) | 设置组件采用Tunnel方式通信。 [更多...](_codec.md#componenttunnelrequest) | +| ( [UseBuffer](_codec.md#usebuffer) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref2135329427083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, uint32_t portIndex, struct [OmxCodecBuffer](_omx_codec_buffer.md) \*buffer) | 指定组件端口的buffer。 [更多...](_codec.md#usebuffer) | +| ( [AllocateBuffer](_codec.md#allocatebuffer) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref857621490083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, uint32_t portIndex, struct [OmxCodecBuffer](_omx_codec_buffer.md) \*buffer) | 向组件申请端口buffer。 [更多...](_codec.md#allocatebuffer) | +| ( [FreeBuffer](_codec.md#freebuffer) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref1026220701083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, uint32_t portIndex, const struct [OmxCodecBuffer](_omx_codec_buffer.md) \*buffer) | 释放buffer。 [更多...](_codec.md#freebuffer) | +| ( [EmptyThisBuffer](_codec.md#emptythisbuffer) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref1735359869083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, const struct [OmxCodecBuffer](_omx_codec_buffer.md) \*buffer) | 编解码输入待处理buffer。 [更多...](_codec.md#emptythisbuffer) | +| ( [FillThisBuffer](_codec.md#fillthisbuffer) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref1574208746083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, const struct [OmxCodecBuffer](_omx_codec_buffer.md) \*buffer) | 编解码输出填充buffer。 [更多...](_codec.md#fillthisbuffer) | +| ( [SetCallbacks](_codec.md#setcallbacks) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref1922857471083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, struct [CodecCallbackType](_codec_callback_type.md) \*callback, int8_t \*appData, uint32_t appDataLen) | 设置Codec组件的回调函数。 [更多...](_codec.md#setcallbacks) | +| ( [ComponentDeInit](_codec.md#componentdeinit) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref1721252790083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self) | 组件去初始化。 [更多...](_codec.md#componentdeinit) | +| ( [UseEglImage](_codec.md#useeglimage) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref872648430083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, struct [OmxCodecBuffer](_omx_codec_buffer.md) \*buffer, uint32_t portIndex, int8_t \*eglImage, uint32_t eglImageLen) | 使用已在EGL中申请的空间。 [更多...](_codec.md#useeglimage) | +| ( [ComponentRoleEnum](_codec.md#componentroleenum) )(struct [ERROR:Invalid link:zh-cn_topic_0000001357501829.xml#xref1661834974083931,link:zh-cn_topic_0000001357501829.xml](zh-cn_topic_0000001357501829.xml) \*self, uint8_t \*role, uint32_t roleLen, uint32_t index) | 获取组件角色。 [更多...](_codec.md#componentroleenum) | + + +## **详细描述** + +Codec组件接口定义。 + +主要提供以下功能: + +- 获取组件的版本。 + +- 组件参数配置的获取和设置。 + +- 发送命令至组件及获取组件状态。 + +- 设置回调函数。 + +- 设置/释放组件使用的buffer。 + +- 编解码输入输出buffer处理 具体方法使用详见函数说明。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_comp_ver_info.md b/zh-cn/device-dev/reference/hdi-apis/_comp_ver_info.md new file mode 100644 index 0000000000000000000000000000000000000000..ddf1830d2f8d1634cbe777656fdefd8f61615340 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_comp_ver_info.md @@ -0,0 +1,78 @@ +# CompVerInfo + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [compName](#compname) [[NAME_LENGTH](_codec.md#gaf71324c57f05ff9e24bd384925dd6b17)] | 组件名称 | +| [compUUID](#compuuid) [[UUID_LENGTH](_codec.md#ga9226162b034cc837cd977f0fcf611c2c)] | 组件的UUID标识符 | +| [compVersion](#compversion) | OMX组件版本信息 | +| [specVersion](#specversion) | 构建组件所依据的规范的版本信息 | + + +## **Details** + + +## **详细描述** + + +## **类成员变量说明** + + +### compName + + +``` +char CompVerInfo::compName[NAME_LENGTH] +``` + +**描述:** + +组件名称 + + +### compUUID + + +``` +uint8_t CompVerInfo::compUUID[UUID_LENGTH] +``` + +**描述:** + +组件的UUID标识符 + + +### compVersion + + +``` +union OMX_VERSIONTYPE CompVerInfo::compVersion +``` + +**描述:** + +OMX组件版本信息 + + +### specVersion + + +``` +union OMX_VERSIONTYPE CompVerInfo::specVersion +``` + +**描述:** + +构建组件所依据的规范的版本信息 diff --git a/zh-cn/device-dev/reference/hdi-apis/_credential_info.md b/zh-cn/device-dev/reference/hdi-apis/_credential_info.md new file mode 100644 index 0000000000000000000000000000000000000000..c51b0e7909f75385a521de317311ba46527d5a2c --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_credential_info.md @@ -0,0 +1,111 @@ +# CredentialInfo + + +## **概述** + +**所属模块:** + +[HdfUserAuth](_hdf_user_auth.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [credentialId](#credentialid) | 认证凭据ID。 | +| [index](#index) | 用户认证框架的执行器索引。 | +| [templateId](#templateid) | 认证凭据模版ID。 | +| [authType](#authtype) | 用户认证凭据类型AuthType。 | +| [executorMatcher](#executormatcher) | 执行器匹配器。 | +| [executorSensorHint](#executorsensorhint) | 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 | + + +## **详细描述** + +认证凭据信息。 + +**自动:** + +3.2 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### authType + + +``` +enum AuthType CredentialInfo::authType +``` + +**描述:** + +用户认证凭据类型。 + + +### credentialId + + +``` +unsigned long CredentialInfo::credentialId +``` + +**描述:** + +认证凭据ID。 + + +### executorSensorHint + + +``` +unsigned int CredentialInfo::executorSensorHint +``` + +**描述:** + +既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 + + +### executorMatcher + + +``` +unsigned int CredentialInfo::executorMatcher +``` + +**描述:** + +执行器匹配器。 + + +### index + + +``` +unsigned long CredentialInfo::index +``` + +**描述:** + +用户认证框架的执行器索引。 + + +### templateId + + +``` +unsigned long CredentialInfo::templateId +``` + +**描述:** + +认证凭据模版ID。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_device_funcs.md b/zh-cn/device-dev/reference/hdi-apis/_device_funcs.md new file mode 100644 index 0000000000000000000000000000000000000000..a423b267c59d718dc84d6dd28e3ccc8c884bba7b --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_device_funcs.md @@ -0,0 +1,59 @@ +# DeviceFuncs + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( **RegHotPlugCallback** )(HotPlugCallback callback, void \*data) | 注册热插拔事件回调 | +| ( **RegDisplayVBlankCallback** )(uint32_t devId, VBlankCallback callback, void \*data) | 注册VBlank事件回调。 | +| ( **RegDisplayRefreshCallback** )(uint32_t devId, RefreshCallback callback, void \*data) | 刷新请求回调。 | +| ( **GetDisplayCapability** )(uint32_t devId, [DisplayCapability](_display_capability.md) \*info) | 获取显示设备能力集。 | +| ( **GetDisplaySupportedModes** )(uint32_t devId, uint32_t \*num, [DisplayModeInfo](_display_mode_info.md) \*modes) | 获取显示设备支持的显示模式信息。 | +| ( **GetDisplayMode** )(uint32_t devId, uint32_t \*modeId) | 获取显示设备当前的显示模式。 | +| ( **SetDisplayMode** )(uint32_t devId, uint32_t modeId) | 设置显示设备的显示模式。 | +| ( **GetDisplayPowerStatus** )(uint32_t devId, [DispPowerStatus](_display.md#disppowerstatus) \*status) | 获取显示设备当前的电源状态。 | +| ( **SetDisplayPowerStatus** )(uint32_t devId, [DispPowerStatus](_display.md#disppowerstatus) status) | 设置显示设备当前的电源状态。 | +| ( **GetDisplayBacklight** )(uint32_t devId, uint32_t \*level) | 获取显示设备当前的背光值。 | +| ( **SetDisplayBacklight** )(uint32_t devId, uint32_t level) | 设置显示设备当前的背光值。 | +| ( **GetDisplayProperty** )(uint32_t devId, uint32_t id, uint64_t \*value) | 获取显示设备属性值。 | +| ( **SetDisplayProperty** )(uint32_t devId, uint32_t id, uint64_t value) | 设置显示设备属性值。 | +| ( **PrepareDisplayLayers** )(uint32_t devId, bool \*needFlushFb) | 显示设备合成前准备 | +| ( **GetDisplayCompChange** )(uint32_t devId, uint32_t \*num, uint32_t \*Layers, int32_t \*type) | 获取显示设备合成类型有变化的layer | +| ( **SetDisplayClientCrop** )(uint32_t devId, [IRect](_i_rect.md) \*rect) | 设置显示设备的裁剪区域。 | +| ( **SetDisplayClientDestRect** )(uint32_t devId, [IRect](_i_rect.md) \*rect) | 设置显示设备的显示区域。 | +| ( **SetDisplayClientBuffer** )(uint32_t devId, const BufferHandle \*buffer, int32_t fence) | 设置显示设备的显示缓存。 | +| ( **SetDisplayClientDamage** )(uint32_t devId, uint32_t num, [IRect](_i_rect.md) \*rect) | 设置显示设备的显示脏区 | +| ( **SetDisplayVsyncEnabled** )(uint32_t devId, bool enabled) | 使能垂直同步信号。 | +| ( **GetDisplayReleaseFence** )(uint32_t devId, uint32_t \*num, uint32_t \*layers, int32_t \*fences) | 获取显示图层fence。 | +| ( **GetDisplaySupportedColorGamuts** )(uint32_t devId, uint32_t \*num, [ColorGamut](_display.md#colorgamut) \*gamuts) | 获取显示设备支持的色域信息。 | +| ( **GetDisplayColorGamut** )(uint32_t devId, [ColorGamut](_display.md#colorgamut) \*gamut) | 获取显示设备当前的色域模式。 | +| ( **SetDisplayColorGamut** )(uint32_t devId, [ColorGamut](_display.md#colorgamut) gamut) | 设置显示设备当前的色域模式。 | +| ( **GetDisplayGamutMap** )(uint32_t devId, [GamutMap](_display.md#gamutmap) \*gamutMap) | 获取显示设备当前的色域映射模式。 | +| ( **SetDisplayGamutMap** )(uint32_t devId, [GamutMap](_display.md#gamutmap) gamutMap) | 设置显示设备当前的色域映射模式。 | +| ( **SetDisplayColorTransform** )(uint32_t devId, const float \*matrix) | 设置显示设备当前的4x4的颜色转换矩阵。 | +| ( **GetHDRCapabilityInfos** )(uint32_t devId, [HDRCapability](_h_d_r_capability.md) \*info) | 获取显示设备支持的HDR属性信息。 | +| ( **GetSupportedMetadataKey** )(uint32_t devId, uint32_t \*num, [HDRMetadataKey](_display.md#hdrmetadatakey) \*keys) | 获取显示设备支持的 HDRMetadataKey。 | +| ( **Commit** )(uint32_t devId, int32_t \*fence) | 提交合成送显请求。 | +| ( **InvokeDisplayCmd** )(uint32_t devId,...) | 调用显示设备命令。 | +| ( **CreateVirtualDisplay** )(uint32_t width, uint32_t height, int32_t \*format, uint32_t \*devId) | 创建虚拟显示设备。 | +| ( **DestroyVirtualDisplay** )(uint32_t devId) | 销毁虚拟显示设备。 | +| ( **SetVirtualDisplayBuffer** )(uint32_t devId, BufferHandle \*buffer, int32_t fence) | 设置虚拟屏的输出缓存。 | +| ( **GetWriteBackFrame** )(uint32_t devId, BufferHandle \*buffer, int32_t \*fence) | 获取显示设备的回写帧。 | +| ( **CreateWriteBack** )(uint32_t \*devId, uint32_t width, uint32_t height, int32_t \*format) | 对指定显示设备创建回写点。 | +| ( **DestroyWriteBack** )(uint32_t devId) | 销毁指定显示设备的回写点。 | + + +## **详细描述** + +显示设备控制接口结构体,定义显示设备控制接口函数指针。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_device_info.md b/zh-cn/device-dev/reference/hdi-apis/_device_info.md new file mode 100644 index 0000000000000000000000000000000000000000..592bd0305dcd42301b5a0224d2257e994110e02f --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_device_info.md @@ -0,0 +1,194 @@ +# DeviceInfo + + +## **概述** + +**所属模块:** + +[Input](_input.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [devIndex](#devindex) | 设备索引 | +| [fd](#fd) | 设备对应的文件描述符 | +| [service](#service) | 设备对应的服务 | +| [listener](#listener) | 设备对应的事件监听器 | +| [devType](#devtype) | 设备类型 | +| [powerStatus](#powerstatus) | 电源状态 | +| [chipInfo](#chipinfo) [CHIP_INFO_LEN] | 驱动芯片编码信息 | +| [vendorName](#vendorname) [VENDOR_NAME_LEN] | 模组厂商名 | +| [chipName](#chipname) [CHIP_NAME_LEN] | 驱动芯片型号 | +| [devNodePath](#devnodepath) [MAX_NODE_PATH_LEN] | 设备文件路径 | +| [solutionX](#solutionx) | x方向分辨率 | +| [solutionY](#solutiony) | y方向分辨率 | +| [callback](#callback) | 数据上报回调函数 [InputReportEventCb](_input_report_event_cb.md) | + + +## **详细描述** + +input设备基础设备信息 + + +## **类成员变量说明** + + +### callback + + +``` +InputReportEventCb* DeviceInfo::callback +``` + +**描述:** + +数据上报回调函数 [InputReportEventCb](_input_report_event_cb.md) + + +### chipInfo + + +``` +char DeviceInfo::chipInfo[CHIP_INFO_LEN] +``` + +**描述:** + +驱动芯片编码信息 + + +### chipName + + +``` +char DeviceInfo::chipName[CHIP_NAME_LEN] +``` + +**描述:** + +驱动芯片型号 + + +### devIndex + + +``` +uint32_t DeviceInfo::devIndex +``` + +**描述:** + +设备索引 + + +### devNodePath + + +``` +char DeviceInfo::devNodePath[MAX_NODE_PATH_LEN] +``` + +**描述:** + +设备文件路径 + + +### devType + + +``` +uint32_t DeviceInfo::devType +``` + +**描述:** + +设备类型 + + +### fd + + +``` +int32_t DeviceInfo::fd +``` + +**描述:** + +设备对应的文件描述符 + + +### listener + + +``` +void* DeviceInfo::listener +``` + +**描述:** + +设备对应的事件监听器 + + +### powerStatus + + +``` +uint32_t DeviceInfo::powerStatus +``` + +**描述:** + +电源状态 + + +### service + + +``` +void* DeviceInfo::service +``` + +**描述:** + +设备对应的服务 + + +### solutionX + + +``` +uint32_t DeviceInfo::solutionX +``` + +**描述:** + +x方向分辨率 + + +### solutionY + + +``` +uint32_t DeviceInfo::solutionY +``` + +**描述:** + +y方向分辨率 + + +### vendorName + + +``` +char DeviceInfo::vendorName[VENDOR_NAME_LEN] +``` + +**描述:** + +模组厂商名 diff --git a/zh-cn/device-dev/reference/hdi-apis/_display.md b/zh-cn/device-dev/reference/hdi-apis/_display.md new file mode 100644 index 0000000000000000000000000000000000000000..a062997aa175dfed717deab26edfe212591bbd6c --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_display.md @@ -0,0 +1,3358 @@ +# Display + + +## **汇总** + + +### 文件 + + | 文件 | 描述 | +| -------- | -------- | +| [display_device.h](display__device_8h.md) | 显示设备控制接口声明。 | +| [display_gfx.h](display__gfx_8h.md) | 显示硬件加速驱动接口声明。 | +| [display_gralloc.h](display__gralloc_8h.md) | 显示内存驱动接口声明。 | +| [display_layer.h](display__layer_8h.md) | 显示图层驱动接口声明。 | +| [display_type.h](display__type_8h.md) | 显示类型定义,定义显示驱动接口所使用的数据类型。 | + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [DeviceFuncs](_device_funcs.md) | 显示设备控制接口结构体,定义显示设备控制接口函数指针。 [更多...](_device_funcs.md) | +| [GfxFuncs](_gfx_funcs.md) | 显示硬件加速驱动接口结构体,定义硬件加速驱动接口函数指针。 [更多...](_gfx_funcs.md) | +| [GrallocFuncs](_gralloc_funcs.md) | 显示内存驱动接口结构体,定义显示内存驱动接口函数指针。 [更多...](_gralloc_funcs.md) | +| [LayerFuncs](_layer_funcs.md) | 显示图层驱动接口结构体,定义显示图层驱动接口函数指针。 [更多...](_layer_funcs.md) | +| [DisplayInfo](_display_info.md) | 定义显示信息结构体 [更多...](_display_info.md) | +| [LayerInfo](_layer_info.md) | 定义图层信息结构体 [更多...](_layer_info.md) | +| [LayerAlpha](_layer_alpha.md) | 定义图层Alpha信息的结构体 [更多...](_layer_alpha.md) | +| [BufferData](_buffer_data.md) | 定义一层的缓冲区数据,包括虚拟和物理内存地址。 [更多...](_buffer_data.md) | +| [LayerBuffer](_layer_buffer.md) | 图层Buffer,用于存放图层数据。 [更多...](_layer_buffer.md) | +| [IRect](_i_rect.md) | 定义矩形信息 [更多...](_i_rect.md) | +| [ISurface](_i_surface.md) | 用于存放窗口相关信息的结构体定义,提供给硬件加速使用,例如图像合成,位图搬移等操作。 [更多...](_i_surface.md) | +| [ILine](_i_line.md) | 线条描述结构体定义,用于硬件加速绘制直线。 [更多...](_i_line.md) | +| [ICircle](_i_circle.md) | 圆形描述结构体定义,用于硬件加速绘制圆形。 [更多...](_i_circle.md) | +| [Rectangle](_rectangle.md) | 矩形描述结构体定义,用于硬件加速绘制矩形, [更多...](_rectangle.md) | +| [GfxOpt](_gfx_opt.md) | 图像硬件加速相关的操作选项结构体定义,用于图像硬件加速时的操作选项。 [更多...](_gfx_opt.md) | +| [PropertyObject](_property_object.md) | 定义包含名称、属性ID和值的属性对象。 [更多...](_property_object.md) | +| [DisplayCapability](_display_capability.md) | 定义输出性能。 [更多...](_display_capability.md) | +| [DisplayModeInfo](_display_mode_info.md) | 定义输出模式信息。 [更多...](_display_mode_info.md) | +| [AllocInfo](_alloc_info.md) | 定义关于要分配的内存的信息。 [更多...](_alloc_info.md) | +| [HDRCapability](_h_d_r_capability.md) | HDR属性结构体定义 [更多...](_h_d_r_capability.md) | +| [HDRMetaData](_h_d_r_meta_data.md) | HDR元数据结构体定义 [更多...](_h_d_r_meta_data.md) | +| [VerifyAllocInfo](_verify_alloc_info.md) | 用于验证内存分配信息的结构体定义 [更多...](_verify_alloc_info.md) | +| [PresentTimestamp](_present_timestamp.md) | 上屏时间戳结构体定义 [更多...](_present_timestamp.md) | +| [__attribute__](____attribute____.md) | 扩展数据句柄结构体定义 [更多...](____attribute____.md) | + + +### 宏定义 + + | 宏定义 | 描述 | +| -------- | -------- | +| **PROPERTY_NAME_LEN**   50 | 属性名字长度。 | + + +### 类型定义 + + | 类型定义 | 描述 | +| -------- | -------- | +| ([HotPlugCallback](#hotplugcallback)) (uint32_t devId, bool connected, void \*data) | 热插拔事件回调。[更多...](#hotplugcallback) | +| ([VBlankCallback](#vblankcallback)) (unsigned int sequence, uint64_t ns, void \*data) | VBlank 事件回调。 [更多...](#vblankcallback) | +| ([RefreshCallback](#refreshcallback)) (uint32_t devId, void \*data) | 刷新请求回调。[更多...](#refreshcallback) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [DispErrCode](#disperrcode) { DISPLAY_SUCCESS = 0, DISPLAY_FAILURE = -1, DISPLAY_FD_ERR = -2, DISPLAY_PARAM_ERR = -3,   DISPLAY_NULL_PTR = -4, DISPLAY_NOT_SUPPORT = -5, DISPLAY_NOMEM = -6, DISPLAY_SYS_BUSY = -7,   DISPLAY_NOT_PERM = -8 } | 返回值类型定义。 [更多...](#disperrcode) | +| [LayerType](#layertype) { LAYER_TYPE_GRAPHIC, LAYER_TYPE_OVERLAY, LAYER_TYPE_SDIEBAND, LAYER_TYPE_CURSOR,   LAYER_TYPE_BUTT } | 图层类型定义。 [更多...](#layertype) | +| { HBM_USE_CPU_READ = (1 << 0), HBM_USE_CPU_WRITE = (1 << 1), HBM_USE_MEM_MMZ = (1 << 2), HBM_USE_MEM_DMA = (1 << 3),   HBM_USE_MEM_SHARE = (1 << 4), HBM_USE_MEM_MMZ_CACHE = (1 << 5), HBM_USE_MEM_FB = (1 << 6), HBM_USE_ASSIGN_SIZE = (1 << 7) } | 缓冲区定义。[更多...](#anonymous-enum) | +| [PixelFormat](#pixelformat) { PIXEL_FMT_CLUT8 = 0, PIXEL_FMT_CLUT1, PIXEL_FMT_CLUT4, PIXEL_FMT_RGB_565,   PIXEL_FMT_RGBA_5658, PIXEL_FMT_RGBX_4444, PIXEL_FMT_RGBA_4444, PIXEL_FMT_RGB_444,   PIXEL_FMT_RGBX_5551, PIXEL_FMT_RGBA_5551, PIXEL_FMT_RGB_555, PIXEL_FMT_RGBX_8888,   PIXEL_FMT_RGBA_8888, PIXEL_FMT_RGB_888, PIXEL_FMT_BGR_565, PIXEL_FMT_BGRX_4444,   PIXEL_FMT_BGRA_4444, PIXEL_FMT_BGRX_5551, PIXEL_FMT_BGRA_5551, PIXEL_FMT_BGRX_8888,   PIXEL_FMT_BGRA_8888, PIXEL_FMT_YUV_422_I, PIXEL_FMT_YCBCR_422_SP, PIXEL_FMT_YCRCB_422_SP,   PIXEL_FMT_YCBCR_420_SP, PIXEL_FMT_YCRCB_420_SP, PIXEL_FMT_YCBCR_422_P, PIXEL_FMT_YCRCB_422_P,   PIXEL_FMT_YCBCR_420_P, PIXEL_FMT_YCRCB_420_P, PIXEL_FMT_YUYV_422_PKG, PIXEL_FMT_UYVY_422_PKG,   PIXEL_FMT_YVYU_422_PKG, PIXEL_FMT_VYUY_422_PKG, PIXEL_FMT_VENDER_MASK = 0X7FFF0000, PIXEL_FMT_BUTT = 0X7FFFFFFF } | 像素格式类型定义。 [更多...](#pixelformat) | +| [TransformType](#transformtype) { ROTATE_NONE = 0, ROTATE_90, ROTATE_180, ROTATE_270,   ROTATE_BUTT } | 图层变换类型定义。 [更多...](#transformtype) | +| [BlendType](#blendtype) { BLEND_NONE = 0, BLEND_CLEAR, BLEND_SRC, BLEND_SRCOVER,   BLEND_DSTOVER, BLEND_SRCIN, BLEND_DSTIN, BLEND_SRCOUT,   BLEND_DSTOUT, BLEND_SRCATOP, BLEND_DSTATOP, BLEND_ADD,   BLEND_XOR, BLEND_DST, BLEND_AKS, BLEND_AKD,   BLEND_BUTT } | 显示内存类型定义。 [更多...](#blendtype) | +| [RopType](#roptype) { ROP_BLACK = 0, ROP_NOTMERGEPEN, ROP_MASKNOTPEN, ROP_NOTCOPYPEN,   ROP_MASKPENNOT, ROP_NOT, ROP_XORPEN, ROP_NOTMASKPEN,   ROP_MASKPEN, ROP_NOTXORPEN, ROP_NOP, ROP_MERGENOTPEN,   ROP_COPYPE, ROP_MERGEPENNOT, ROP_MERGEPEN, ROP_WHITE,   ROP_BUTT } | 硬件加速支持的ROP操作类型。 [更多...](#roptype) | +| [ColorKey](#colorkey) { CKEY_NONE = 0, CKEY_SRC, CKEY_DST, CKEY_BUTT } | Color key操作类型定义,即硬件加速支持的Color key操作类型。 [更多...](#colorkey) | +| [MirrorType](#mirrortype) { MIRROR_NONE = 0, MIRROR_LR, MIRROR_TB, MIRROR_BUTT } | 硬件加速支持的镜像操作类型定义 [更多...](#mirrortype) | +| [Connection](#connection) { CON_INVALID = 0, CONNECTED, DISCONNECTED } | 热插拔连接类型定义 [更多...](#connection) | +| [InterfaceType](#interfacetype) { DISP_INTF_HDMI = 0, DISP_INTF_LCD, DISP_INTF_BT1120, DISP_INTF_BT656,   DISP_INTF_YPBPR, DISP_INTF_RGB, DISP_INTF_CVBS, DISP_INTF_SVIDEO,   DISP_INTF_VGA, DISP_INTF_MIPI, DISP_INTF_PANEL, DISP_INTF_BUTT } | 枚举接口类型。 [更多...](#interfacetype) | +| [DispPowerStatus](#disppowerstatus) { POWER_STATUS_ON, POWER_STATUS_STANDBY, POWER_STATUS_SUSPEND, POWER_STATUS_OFF,   POWER_STATUS_BUTT } | 枚举显示状态 [更多...](#disppowerstatus) | +| [CompositionType](#compositiontype) { COMPOSITION_CLIENT, COMPOSITION_DEVICE, COMPOSITION_CURSOR, COMPOSITION_VIDEO,   COMPOSITION_DEVICE_CLEAR, COMPOSITION_CLIENT_CLEAR, COMPOSITION_TUNNEL, COMPOSITION_BUTT } | 枚举特殊层的组合类型。 [更多...](#compositiontype) | +| [ColorGamut](#colorgamut) { COLOR_GAMUT_INVALID = -1, COLOR_GAMUT_NATIVE = 0, COLOR_GAMUT_SATNDARD_BT601 = 1, COLOR_GAMUT_STANDARD_BT709 = 2,   COLOR_GAMUT_DCI_P3 = 3, COLOR_GAMUT_SRGB = 4, COLOR_GAMUT_ADOBE_RGB = 5, COLOR_GAMUT_DISPLAY_P3 = 6,   COLOR_GAMUT_BT2020 = 7, COLOR_GAMUT_BT2100_PQ = 8, COLOR_GAMUT_BT2100_HLG = 9, COLOR_GAMUT_DISPLAY_BT2020 = 10 } | 色域类型枚举值 [更多...](#colorgamut) | +| [GamutMap](#gamutmap) { GAMUT_MAP_CONSTANT = 0, GAMUT_MAP_EXPANSION = 1, GAMUT_MAP_HDR_CONSTANT = 2, GAMUT_MAP_HDR_EXPANSION = 3 } | 枚举色域的映射类型 [更多...](#gamutmap) | +| [ColorDataSpace](#colordataspace) {   COLOR_DATA_SPACE_UNKNOWN = 0, GAMUT_BT601 = 0x00000001, GAMUT_BT709 = 0x00000002, GAMUT_DCI_P3 = 0x00000003,   GAMUT_SRGB = 0x00000004, GAMUT_ADOBE_RGB = 0x00000005, GAMUT_DISPLAY_P3 = 0x00000006, GAMUT_BT2020 = 0x00000007,   GAMUT_BT2100_PQ = 0x00000008, GAMUT_BT2100_HLG = 0x00000009, GAMUT_DISPLAY_BT2020 = 0x0000000a, TRANSFORM_FUNC_UNSPECIFIED = 0x00000100,   TRANSFORM_FUNC_LINEAR = 0x00000200, TRANSFORM_FUNC_SRGB = 0x00000300, TRANSFORM_FUNC_SMPTE_170M = 0x00000400, TRANSFORM_FUNC_GM2_2 = 0x00000500,   TRANSFORM_FUNC_GM2_6 = 0x00000600, TRANSFORM_FUNC_GM2_8 = 0x00000700, TRANSFORM_FUNC_ST2084 = 0x00000800, TRANSFORM_FUNC_HLG = 0x00000900,   PRECISION_UNSPECIFIED = 0x00010000, PRECISION_FULL = 0x00020000, PRESION_LIMITED = 0x00030000, PRESION_EXTENDED = 0x00040000,   BT601_SMPTE170M_FULL = GAMUT_BT601 \| TRANSFORM_FUNC_SMPTE_170M \| PRECISION_FULL, BT601_SMPTE170M_LIMITED = GAMUT_BT601 \| TRANSFORM_FUNC_SMPTE_170M \| PRESION_LIMITED, BT709_LINEAR_FULL = GAMUT_BT709 \| TRANSFORM_FUNC_LINEAR \| PRECISION_FULL, BT709_LINEAR_EXTENDED = GAMUT_BT709 \| TRANSFORM_FUNC_LINEAR \| PRESION_EXTENDED,   BT709_SRGB_FULL = GAMUT_BT709 \| TRANSFORM_FUNC_SRGB \| PRECISION_FULL, BT709_SRGB_EXTENDED = GAMUT_BT709 \| TRANSFORM_FUNC_SRGB \| PRESION_EXTENDED, BT709_SMPTE170M_LIMITED = GAMUT_BT709 \| TRANSFORM_FUNC_SMPTE_170M \| PRESION_LIMITED, DCI_P3_LINEAR_FULL = GAMUT_DCI_P3 \| TRANSFORM_FUNC_LINEAR \| PRECISION_FULL,   DCI_P3_GAMMA26_FULL = GAMUT_DCI_P3 \| TRANSFORM_FUNC_GM2_6 \| PRECISION_FULL, DISPLAY_P3_LINEAR_FULL = GAMUT_DISPLAY_P3 \| TRANSFORM_FUNC_LINEAR \| PRECISION_FULL, DCI_P3_SRGB_FULL = GAMUT_DCI_P3 \| TRANSFORM_FUNC_SRGB \| PRECISION_FULL, ADOBE_RGB_GAMMA22_FULL = GAMUT_ADOBE_RGB \| TRANSFORM_FUNC_GM2_2 \| PRECISION_FULL,   BT2020_LINEAR_FULL = GAMUT_BT2020 \| TRANSFORM_FUNC_LINEAR \| PRECISION_FULL, BT2020_SRGB_FULL = GAMUT_BT2020 \| TRANSFORM_FUNC_SRGB \| PRECISION_FULL, BT2020_SMPTE170M_FULL = GAMUT_BT2020 \| TRANSFORM_FUNC_SMPTE_170M \| PRECISION_FULL, BT2020_ST2084_FULL = GAMUT_BT2020 \| TRANSFORM_FUNC_ST2084 \| PRECISION_FULL,   BT2020_HLG_FULL = GAMUT_BT2020 \| TRANSFORM_FUNC_HLG \| PRECISION_FULL, BT2020_ST2084_LIMITED = GAMUT_BT2020 \| TRANSFORM_FUNC_ST2084 \| PRESION_LIMITED } | 枚举颜色空间的类型 [更多...](#colordataspace) | +| [HDRFormat](#hdrformat) { NOT_SUPPORT_HDR = 0, DOLBY_VISION = 1, HDR10 = 2, HLG = 3,   HDR10_PLUS = 4, HDR_VIVID = 5 } | 枚举HDR格式 [更多...](#hdrformat) | +| [HDRMetadataKey](#hdrmetadatakey) { MATAKEY_RED_PRIMARY_X = 0, MATAKEY_RED_PRIMARY_Y = 1, MATAKEY_GREEN_PRIMARY_X = 2, MATAKEY_GREEN_PRIMARY_Y = 3,   MATAKEY_BLUE_PRIMARY_X = 4, MATAKEY_BLUE_PRIMARY_Y = 5, MATAKEY_WHITE_PRIMARY_X = 6, MATAKEY_WHITE_PRIMARY_Y = 7,   MATAKEY_MAX_LUMINANCE = 8, MATAKEY_MIN_LUMINANCE = 9, MATAKEY_MAX_CONTENT_LIGHT_LEVEL = 10, MATAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11,   MATAKEY_HDR10_PLUS = 12, MATAKEY_HDR_VIVID = 13 } | 枚举HDR元数据关键字 [更多...](#hdrmetadatakey) | +| [PresentTimestampType](#presenttimestamptype) { HARDWARE_DISPLAY_PTS_UNSUPPORTED = 0, HARDWARE_DISPLAY_PTS_DELAY = 1 << 0, HARDWARE_DISPLAY_PTS_TIMESTAMP = 1 << 1 } | 上屏时间戳类型枚举值 [更多...](#presenttimestamptype) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [DeviceInitialize](#deviceinitialize) ([DeviceFuncs](_device_funcs.md) \*\*funcs) | 实现显示设备控制接口的初始化,申请操作显示设备控制接口的资源,并获取对应的操作接口。 [更多...](#deviceinitialize) | +| [DeviceUninitialize](#deviceuninitialize) ([DeviceFuncs](_device_funcs.md) \*funcs) | 取消显示设备控制接口的初始化,释放控制接口使用到的资源。 [更多...](#deviceuninitialize) | +| [GfxInitialize](#gfxinitialize) ([GfxFuncs](_gfx_funcs.md) \*\*funcs) | 获取硬件加速相关的操作接口指针。 [更多...](#gfxinitialize) | +| [GfxUninitialize](#gfxuninitialize) ([GfxFuncs](_gfx_funcs.md) \*funcs) | 释放硬件加速相关的操作接口指针。 [更多...](#gfxuninitialize) | +| [GrallocInitialize](#grallocinitialize) ([GrallocFuncs](_gralloc_funcs.md) \*\*funcs) | 初始化内存模块,并获取内存提供的操作接口。 [更多...](#grallocinitialize) | +| [GrallocUninitialize](#grallocuninitialize) ([GrallocFuncs](_gralloc_funcs.md) \*funcs) | 取消初始化内存模块,并释放内存操作接口指针。 [更多...](#grallocuninitialize) | +| [LayerInitialize](#layerinitialize) ([LayerFuncs](_layer_funcs.md) \*\*funcs) | 实现图层初始化功能,申请图层使用的资源,并获取图层提供的操作接口。 [更多...](#layerinitialize) | +| [LayerUninitialize](#layeruninitialize) ([LayerFuncs](_layer_funcs.md) \*funcs) | 取消图层初始化功能,释放图层使用到的资源,并释放图层操作接口指针。 [更多...](#layeruninitialize) | + + +### 变量 + + | 变量 | 描述 | +| -------- | -------- | +| ( [DeviceFuncs::RegHotPlugCallback](#reghotplugcallback) )([HotPlugCallback](#hotplugcallback) callback, void \*data) | 注册热插拔事件回调。 [更多...](#reghotplugcallback) | +| ( [DeviceFuncs::RegDisplayVBlankCallback](#regdisplayvblankcallback) )(uint32_t devId, [VBlankCallback](#vblankcallback) callback, void \*data) | 注册VBlank事件回调。 [更多...](#regdisplayvblankcallback) | +| ( [DeviceFuncs::RegDisplayRefreshCallback](#regdisplayrefreshcallback) )(uint32_t devId, [RefreshCallback](#refreshcallback) callback, void \*data) | 刷新请求回调。 [更多...](#regdisplayrefreshcallback) | +| ( [DeviceFuncs::GetDisplayCapability](#getdisplaycapability) )(uint32_t devId, [DisplayCapability](_display_capability.md) \*info) | 获取显示设备能力集。 [更多...](#getdisplaycapability) | +| ( [DeviceFuncs::GetDisplaySupportedModes](#getdisplaysupportedmodes) )(uint32_t devId, uint32_t \*num, [DisplayModeInfo](_display_mode_info.md) \*modes) | 获取显示设备支持的显示模式信息。 [更多...](#getdisplaysupportedmodes) | +| ( [DeviceFuncs::GetDisplayMode](#getdisplaymode) )(uint32_t devId, uint32_t \*modeId) | 获取显示设备当前的显示模式。 [更多...](#getdisplaymode) | +| ( [DeviceFuncs::SetDisplayMode](#setdisplaymode) )(uint32_t devId, uint32_t modeId) | 设置显示设备的显示模式。 [更多...](#setdisplaymode) | +| ( [DeviceFuncs::GetDisplayPowerStatus](#getdisplaypowerstatus) )(uint32_t devId, [DispPowerStatus](#disppowerstatus) \*status) | 获取显示设备当前的电源状态。 [更多...](#getdisplaypowerstatus) | +| ([ DeviceFuncs::SetDisplayPowerStatus](#setdisplaypowerstatus) )(uint32_t devId, [DispPowerStatus](#disppowerstatus) status) | 设置显示设备当前的电源状态。 [更多...](#setdisplaypowerstatus) | +| ( [DeviceFuncs::GetDisplayBacklight](#getdisplaybacklight) )(uint32_t devId, uint32_t \*level) | 获取显示设备当前的背光值。 [更多...](#getdisplaybacklight) | +| ( [DeviceFuncs::SetDisplayBacklight](#setdisplaybacklight) )(uint32_t devId, uint32_t level) | 设置显示设备当前的背光值。 [更多...](#setdisplaybacklight) | +| ( [DeviceFuncs::GetDisplayProperty](#getdisplayproperty) )(uint32_t devId, uint32_t id, uint64_t \*value) | 获得显示设备属性值。 [更多...](#getdisplayproperty) | +| ( [DeviceFuncs::SetDisplayProperty](#setdisplayproperty) )(uint32_t devId, uint32_t id, uint64_t value) | 设置显示设备属性值。 [更多...](#setdisplayproperty) | +| ( [DeviceFuncs::PrepareDisplayLayers](#preparedisplaylayers) )(uint32_t devId, bool \*needFlushFb) | 显示设备合成前准备。 [更多...](#preparedisplaylayers) | +| ( [DeviceFuncs::GetDisplayCompChange](#getdisplaycompchange) )(uint32_t devId, uint32_t \*num, uint32_t \*Layers, int32_t \*type) | 获取显示设备合成类型有变化的layer。 [更多...](#getdisplaycompchange) | +| ( [DeviceFuncs::SetDisplayClientCrop](#setdisplayclientcrop) )(uint32_t devId, [IRect](_i_rect.md) \*rect) | 设置显示设备的裁剪区域。 [更多...](#setdisplayclientcrop) | +| ( [DeviceFuncs::SetDisplayClientDestRect](#setdisplayclientdestrect) )(uint32_t devId, [IRect](_i_rect.md) \*rect) | 设置显示设备的显示区域。 [更多...](#setdisplayclientdestrect) | +| ( [DeviceFuncs::SetDisplayClientBuffer](#setdisplayclientbuffer) )(uint32_t devId, const BufferHandle \*buffer, int32_t fence) | 设置显示设备的显示缓存。 [更多...](#setdisplayclientbuffer) | +| ( [DeviceFuncs::SetDisplayClientDamage](#setdisplayclientdamage) )(uint32_t devId, uint32_t num, [IRect](_i_rect.md) \*rect) | 设置显示设备的显示脏区。 [更多...](#setdisplayclientdamage) | +| ( [DeviceFuncs::SetDisplayVsyncEnabled](#setdisplayvsyncenabled) )(uint32_t devId, bool enabled) | 使能垂直同步信号。 [更多...](#setdisplayvsyncenabled) | +| ( [DeviceFuncs::GetDisplayReleaseFence](#getdisplayreleasefence) )(uint32_t devId, uint32_t \*num, uint32_t \*layers, int32_t \*fences) | 获取显示图层fence。 [更多...](#getdisplayreleasefence) | +| ( [DeviceFuncs::GetDisplaySupportedColorGamuts](#getdisplaysupportedcolorgamuts) )(uint32_t devId, uint32_t \*num, [ColorGamut](#colorgamut) \*gamuts) | 获取显示设备支持的色域信息。 [更多...](#getdisplaysupportedcolorgamuts) | +| ( [DeviceFuncs::GetDisplayColorGamut](#getdisplaycolorgamut) )(uint32_t devId, [ColorGamut](#colorgamut) \*gamut) | 获取显示设备当前的色域模式。 [更多...](#getdisplaycolorgamut) | +| ( [DeviceFuncs::SetDisplayColorGamut](#setdisplaycolorgamut) )(uint32_t devId, [ColorGamut](#colorgamut) gamut) | 设置显示设备当前的色域模式。 [更多...](#setdisplaycolorgamut) | +| ( [DeviceFuncs::GetDisplayGamutMap](#getdisplaygamutmap) )(uint32_t devId, [ColorGamut](#colorgamut) \*gamutMap) | 获取显示设备当前的色域映射模式。 [更多...](#getdisplaygamutmap) | +| ( [DeviceFuncs::SetDisplayGamutMap](#setdisplaygamutmap) )(uint32_t devId, [ColorGamut](#colorgamut) gamutMap) | 设置显示设备当前的色域映射模式。 [更多...](#setdisplaygamutmap) | +| ( [DeviceFuncs::SetDisplayColorTransform](#setdisplaycolortransform) )(uint32_t devId, const float \*matrix) | 设置显示设备当前的4x4的颜色转换矩阵。 [更多...](#setdisplaycolortransform) | +| ( [DeviceFuncs::GetHDRCapabilityInfos](#gethdrcapabilityinfos) )(uint32_t devId, [HDRCapability](_h_d_r_capability.md) \*info) | 获取显示设备支持的HDR属性信息。 [更多...](#gethdrcapabilityinfos) | +| ( [DeviceFuncs::GetSupportedMetadataKey](#getsupportedmetadatakey) )(uint32_t devId, uint32_t \*num, [HDRMetadataKey](#hdrmetadatakey) \*keys) | 获取显示设备支持的 HDRMetadataKey。 [更多...](#getsupportedmetadatakey) | +| ( [DeviceFuncs::Commit](#commit) )(uint32_t devId, int32_t \*fence) | 提交合成送显请求。 [更多...](#commit) | +| ( [DeviceFuncs::InvokeDisplayCmd](#invokedisplaycmd) )(uint32_t devId,...) | 调用显示设备命令。 [更多...](#invokedisplaycmd) | +| ([ DeviceFuncs::CreateVirtualDisplay](#createvirtualdisplay) )(uint32_t width, uint32_t height, int32_t \*format, uint32_t \*devId) | 创建虚拟显示设备。 [更多...](#createvirtualdisplay) | +| ( [DeviceFuncs::DestroyVirtualDisplay](#destroyvirtualdisplay) )(uint32_t devId) | 销毁虚拟显示设备。 [更多...](#destroyvirtualdisplay) | +| ( [DeviceFuncs::SetVirtualDisplayBuffer](#setvirtualdisplaybuffer) )(uint32_t devId, BufferHandle \*buffer, int32_t fence) | 设置虚拟屏的输出缓存。 [更多...](#setvirtualdisplaybuffer) | +| ( [DeviceFuncs::GetWriteBackFrame](#getwritebackframe) )(uint32_t devId, BufferHandle \*buffer, int32_t \*fence) | 获取显示设备的回写帧。 [更多...](#getwritebackframe) | +| ( [DeviceFuncs::CreateWriteBack](#createwriteback) )(uint32_t \*devId, uint32_t width, uint32_t height, int32_t \*format) | 对指定显示设备创建回写点。 [更多...](#createwriteback) | +| ( [DeviceFuncs::DestroyWriteBack](#destroywriteback) )(uint32_t devId) | 销毁指定显示设备的回写点。 [更多...](#destroywriteback) | +| [DisplayInfo::width](#width-17) | 显示屏宽度 | +| [DisplayInfo::height](#height-17) | 显示屏高度 | +| [DisplayInfo::rotAngle](#rotangle) | 显示屏旋转角度 | +| [LayerInfo::width](#width-27) | 图层宽度 | +| [LayerInfo::height](#height-27) | 图层高度 | +| [LayerInfo::type](#type-13) | 图层类型,包括图形层、视频层和媒体播放模式 | +| [LayerInfo::bpp](#bpp) | 每像素所占bit数 | +| [LayerInfo::pixFormat](#pixformat-12) | 图层像素格式 | +| [LayerAlpha::enGlobalAlpha](#englobalalpha-12) | 全局alpha使能标志 | +| [LayerAlpha::enPixelAlpha](#enpixelalpha-12) | 像素alpha使能标志 | +| [LayerAlpha::alpha0](#alpha0-12) | alpha0值,取值范围:[0, 255] | +| [LayerAlpha::alpha1](#alpha1-12) | alpha1值,取值范围:[0, 255] | +| [LayerAlpha::gAlpha](#galpha) | 全局alpha值,取值范围:[0, 255] | +| [BufferData::phyAddr](#phyaddr-12) | 物理内存地址 | +| [BufferData::virAddr](#viraddr) | 虚拟内存地址 | +| [LayerBuffer::fenceId](#fenceid) | buffer 的fence号r | +| [LayerBuffer::width](#width-37) | buffer宽度 | +| [LayerBuffer::height](#height-37) | buffer高度 | +| [LayerBuffer::pitch](#pitch) | 一行数据所占字节数 | +| [LayerBuffer::pixFormat](#pixformat-22) | buffer像素格式r | +| [LayerBuffer::data](#data) | 图层buffer数据 | +| [LayerBuffer::hdl](#hdl) | 图层buffer句柄 | +| [IRect::x](#x-12) | 矩形框起始x坐标 | +| [IRect::y](#y-12) | 矩形框起始y坐标 | +| [IRect::w](#w) | 矩形框宽度 | +| [IRect::h](#h) | 矩形框高度 | +| [ISurface::phyAddr](#phyaddr-22) | 图像首地址 | +| [ISurface::height](#height-47) | 图像高度 | +| [ISurface::width](#width-47) | 图像宽度 | +| [ISurface::stride](#stride) | 图像跨度 | +| [ISurface::enColorFmt](#encolorfmt) | 图像格式 | +| [ISurface::bYCbCrClut](#bycbcrclut) | CLUT表是否位于 YCbCr 空间 | +| [ISurface::bAlphaMax255](#balphamax255) | 图像alpha最大值为255还是128 | +| [ISurface::bAlphaExt1555](#balphaext1555) | 是否使能1555的Alpha扩展 | +| [ISurface::alpha0](#alpha0-22) | Alpha0值,取值范围:[0,255] | +| [ISurface::alpha1](#alpha1-22) | Alpha1值,取值范围:[0,255] | +| [ISurface::cbcrPhyAddr](#cbcrphyaddr) | CbCr分量地址 | +| [ISurface::cbcrStride](#cbcrstride) | CbCr分量跨度 | +| [ISurface::clutPhyAddr](#clutphyaddr) | Clut表首地址,用作颜色扩展或颜色校正 | +| [ILine::x0](#x0) | 线条起点的x坐标 | +| [ILine::y0](#y0) | 线条起点的y坐标 | +| [ILine::x1](#x1) | 线条终点的x坐标 | +| [ILine::y1](#y1) | 线条终点的y坐标 | +| [ILine::color](#color-13) | 线条颜色 | +| [ICircle::x](#x-22) | 圆心x坐标 | +| [ICircle::y](#y-22) | 圆心y坐标r | +| [ICircle::r](#r) | 圆的半径 | +| [ICircle::color](#color-23) | 圆的颜色 | +| [Rectangle::rect](#rect) | 矩形区域 | +| [Rectangle::color](#color-33) | 矩形颜色 | +| [GfxOpt::enGlobalAlpha](#englobalalpha-22) | 全局alpha使能位 | +| [GfxOpt::globalAlpha](#globalalpha) | 全局alpha的值 | +| [GfxOpt::enPixelAlpha](#enpixelalpha-22) | 像素alpha使能位 | +| [GfxOpt::blendType](#blendtype) | 混合方式 | +| [GfxOpt::colorKeyFrom](#colorkeyfrom) | 色键模式 | +| [GfxOpt::enableRop](#enablerop) | Rop功能使能位 | +| [GfxOpt::colorRopType](#colorroptype) | 颜色的Rop类型 | +| [GfxOpt::alphaRopType](#alpharoptype) | Alpha的Rop类型 | +| [GfxOpt::enableScale](#enablescale) | 缩放功能使能位 | +| [GfxOpt::rotateType](#rotatetype) | 旋转类型 | +| [GfxOpt::mirrorType](#mirrortype) | 镜像类型 | +| [PropertyObject::name](#name-12) [PROPERTY_NAME_LEN] | 属性名称 | +| [PropertyObject::propId](#propid) | 属性ID | +| [PropertyObject::value](#value-12) | 属性值 | +| [DisplayCapability::name](#name-22) [PROPERTY_NAME_LEN] | 显示设备名称 | +| [DisplayCapability::type](#type-23) | 显示屏接口类型 | +| [DisplayCapability::phyWidth](#phywidth) | 物理宽度 | +| [DisplayCapability::phyHeight](#phyheight) | 物理高度 | +| [DisplayCapability::supportLayers](#supportlayers) | 支持的图层数 | +| [DisplayCapability::virtualDispCount](#virtualdispcount) | 支持的虚拟屏数 | +| [DisplayCapability::supportWriteBack](#supportwriteback) | 是否支持回写 | +| [DisplayCapability::propertyCount](#propertycount) | 属性数组大小 | +| [DisplayCapability::props](#props) | 属性数组 | +| [DisplayModeInfo::width](#width-57) | 像素宽度 | +| [DisplayModeInfo::height](#height-57) | 像素高度 | +| [DisplayModeInfo::freshRate](#freshrate) | 刷新速率 | +| [DisplayModeInfo::id](#id) | 模式ID | +| [AllocInfo::width](#width-67) | 申请内存宽度 | +| [AllocInfo::height](#height-67) | 申请内存高度 | +| [AllocInfo::usage](#usage-12) | 申请内存的使用场景 | +| [AllocInfo::format](#format-12) | 申请内存格式 | +| [AllocInfo::expectedSize](#expectedsize) | 申请内存大小 | +| [HDRCapability::formatCount](#formatcount) | 支持的HDR格式的数量 | +| [HDRCapability::formats](#formats) | 支持的HDR格式的数组首地址 | +| [HDRCapability::maxLum](#maxlum) | 最大的光亮度luminance值 | +| [HDRCapability::maxAverageLum](#maxaveragelum) | 最大的平均光亮度luminance值 | +| [HDRCapability::minLum](#minlum) | 最小的光亮度luminance值 | +| [HDRMetaData::key](#key) | HDR元数据关键字 | +| [HDRMetaData::value](#value-22) | 关键字对应的值 | +| [VerifyAllocInfo::width](#width-77) | 分配内存的宽度 | +| [VerifyAllocInfo::height](#height-77) | 分配内存的高度 | +| [VerifyAllocInfo::usage](#usage-22) | 内存的用处 | +| [VerifyAllocInfo::format](#format-22) | 分配内存的像素格式 | +| [PresentTimestamp::type](#type-33) | 上屏时间戳类型 | +| [PresentTimestamp::time](#time) | 类型对应的值 | +| [__attribute__::fd](#fd) | 句柄 fd,-1代表不支持 | +| [__attribute__::reserveInts](#reserveints) | reserve数组的个数 | +| [__attribute__::reserve](#reserve) [0] | reserve数组 | +| [__attribute__::baseAddr](#baseaddr) | 内存的初始地址 | +| [__attribute__::yOffset](#yoffset) | Y的偏移量 | +| [__attribute__::uOffset](#uoffset) | U的偏移量 | +| [__attribute__::vOffset](#voffset) | V的偏移量 | +| [__attribute__::yStride](#ystride) | Y的stride信息 | +| [__attribute__::uvStride](#uvstride) | UV的stride信息 | +| [__attribute__::uvStep](#uvstep) | UV的step信息 | + + +## **详细描述** + +显示模块驱动接口定义。 + +提供给图形系统使用的驱动接口,包括图层管理、设备控制、图形硬件加速、显示内存管理和回调接口等。 + +**Since:** + +1.0 + +**Version:** + +2.0 + + +## **类型定义说明** + + +### HotPlugCallback + + +``` +typedef void(* HotPlugCallback) (uint32_t devId, bool connected, void *data) +``` + +**描述:** + +热插拔事件回调。 + +当有热插拔事件发生时,会回调该接口,需要通过RegHotPlugCallback注册该回调接口。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,此ID由HDI实现层生成,并通过当前回调接口传递给图形服务使用,用以标记当前连接的显示设备。 | +| connected | 输入参数,指明设备的连接状态,ture代表连接,false代表断开。 | +| data | 输出参数,图形服务携带的私有数据,该参数携带的是RegHotPlugCallback接口注册时传递的私有数据地址,详情参考 RegHotPlugCallback 接口注册时传递的地址。 | + + +### RefreshCallback + + +``` +typedef void(* RefreshCallback) (uint32_t devId, void *data) +``` + +**描述:** + +刷新请求回调。 + +刷新请求回调,当接口实现层需要图形服务刷新数据帧时会回调该接口,需要通过RegDisplayRefreshCallback注册该回调接口。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID。 | +| data | 输出参数,图形服务携带的私有数据,该参数携带的是RegDisplayRefreshCallback接口注册时传递的地址。 | + + +### VBlankCallback + + +``` +typedef void(* VBlankCallback) (unsigned int sequence, uint64_t ns, void *data) +``` + +**描述:** + +VBlank 事件回调。 + +垂直同步事件回调接口,需要通过RegDisplayVBlankCallback注册该回调接口。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| sequence | 输入参数,指明VBlank序列,是一个累加值。 | +| ns | 输入参数,该次VBlank事件的时间戳,以纳秒为单位。 | +| data | 输出参数,图形服务携带的私有数据,该参数携带的是RegDisplayVBlankCallback接口注册时传递的地址。 | + + +## **枚举类型说明** + + +### anonymous enum + + +``` +anonymous enum +``` + +**描述:** + +缓冲区定义。 + + | 枚举值 | 描述 | +| -------- | -------- | +| HBM_USE_CPU_READ | CPU 读缓冲 | +| HBM_USE_CPU_WRITE | CPU 写内存 | +| HBM_USE_MEM_MMZ | MMZ | +| HBM_USE_MEM_DMA | DMA缓冲区 | +| HBM_USE_MEM_SHARE | 共享内存缓冲区 | +| HBM_USE_MEM_MMZ_CACHE | MMZ缓存 | +| HBM_USE_MEM_FB | 帧缓存 | +| HBM_USE_ASSIGN_SIZE | 内存分配 | + + +### BlendType + + +``` +enum BlendType +``` + +**描述:** + +显示内存类型定义。 + +根据图形系统指定的类型进行分配,包括带cache或者不带cache的内存。 + + | 枚举值 | 描述 | +| -------- | -------- | +| BLEND_NONE | No 混合操作 | +| BLEND_CLEAR | CLEAR 混合操作 | +| BLEND_SRC | SRC 混合操作 | +| BLEND_SRCOVER | SRC_OVER 混合操作 | +| BLEND_DSTOVER | DST_OVER 混合操作 | +| BLEND_SRCIN | SRC_IN 混合操作 | +| BLEND_DSTIN | DST_IN 混合操作 | +| BLEND_SRCOUT | SRC_OUT 混合操作 | +| BLEND_DSTOUT | DST_OUT 混合操作 | +| BLEND_SRCATOP | SRC_ATOP 混合操作 | +| BLEND_DSTATOP | DST_ATOP 混合操作 | +| BLEND_ADD | ADD 混合操作 | +| BLEND_XOR | XOR 混合操作 | +| BLEND_DST | DST 混合操作 | +| BLEND_AKS | AKS 混合操作 | +| BLEND_AKD | AKD 混合操作 | +| BLEND_BUTT | 空操作 | + + +### ColorDataSpace + + +``` +enum ColorDataSpace +``` + +**描述:** + +枚举颜色空间的类型 + + | 枚举值 | 描述 | +| -------- | -------- | +| COLOR_DATA_SPACE_UNKNOWN | 未知的 | +| GAMUT_BT601 | BT601色域 | +| GAMUT_BT709 | BT709色域 | +| GAMUT_DCI_P3 | DCI_P3色域 | +| GAMUT_SRGB | SRGB色域 | +| GAMUT_ADOBE_RGB | ADOBE_RGB色域 | +| GAMUT_DISPLAY_P3 | DISPLAY_P3色域 | +| GAMUT_BT2020 | BT2020色域 | +| GAMUT_BT2100_PQ | BT2100_PQ色域 | +| GAMUT_BT2100_HLG | BT2100_HLG色域 | +| GAMUT_DISPLAY_BT2020 | DISPLAY_BT2020色域 | +| TRANSFORM_FUNC_UNSPECIFIED | UNSPECIFIED转换函数 | +| TRANSFORM_FUNC_LINEAR | LINEAR转换函数 | +| TRANSFORM_FUNC_SRGB | SRGB转换函数 | +| TRANSFORM_FUNC_SMPTE_170M | SMPTE_170M转换函数 | +| TRANSFORM_FUNC_GM2_2 | GM2_2转换函数 | +| TRANSFORM_FUNC_GM2_6 | GM2_6转换函数 | +| TRANSFORM_FUNC_GM2_8 | GM2_8转换函数 | +| TRANSFORM_FUNC_ST2084 | ST2084转换函数 | +| TRANSFORM_FUNC_HLG | HLG转换函数 | +| PRECISION_UNSPECIFIED | UNSPECIFIED精度 | +| PRECISION_FULL | FULL精度 | +| PRESION_LIMITED | LIMITED精度 | +| PRESION_EXTENDED | EXTENDED精度 | +| BT601_SMPTE170M_FULL | BT601色域 \| SMPTE_170M转换函数 \| FULL精度 | +| BT601_SMPTE170M_LIMITED | BT601色域 \| SMPTE_170M转换函数 \| LIMITED精度 | +| BT709_LINEAR_FULL | BT709色域 \| LINEAR转换函数 \| FULL精度 | +| BT709_LINEAR_EXTENDED | BT709色域 \| LINEAR转换函数 \| EXTENDED精度 | +| BT709_SRGB_FULL | BT709色域 \| SRGB转换函数 \| FULL精度 | +| BT709_SRGB_EXTENDED | BT709色域 \| SRGB转换函数 \| EXTENDED精度 | +| BT709_SMPTE170M_LIMITED | BT709色域 \| SMPTE_170M转换函数 \| LIMITED精度 | +| DCI_P3_LINEAR_FULL | DCI_P3色域 \| LINEAR转换函数 \| FULL精度 | +| DCI_P3_GAMMA26_FULL | DCI_P3色域 \| GM2_6转换函数 \| FULL精度 | +| DISPLAY_P3_LINEAR_FULL | DISPLAY_P3色域 \| LINEAR转换函数 \| FULL精度 | +| DCI_P3_SRGB_FULL | DCI_P3色域 \| SRGB转换函数 \| FULL精度 | +| ADOBE_RGB_GAMMA22_FULL | ADOBE_RGB色域 \| GM2_2转换函数 \| FULL精度 | +| BT2020_LINEAR_FULL | BT2020色域 \| LINEAR转换函数 \| FULL精度 | +| BT2020_SRGB_FULL | BT2020色域 \| SRGB转换函数 \| FULL精度 | +| BT2020_SMPTE170M_FULL | BT2020色域 \| SMPTE_170M转换函数 \| FULL精度 | +| BT2020_ST2084_FULL | BT2020色域 \| ST2084转换函数 \| FULL精度 | +| BT2020_HLG_FULL | BT2020色域 \| HLG转换函数 \| FULL精度 | +| BT2020_ST2084_LIMITED | BT2020色域 \| ST2084转换函数 \| LIMITED精度 | + + +### ColorGamut + + +``` +enum ColorGamut +``` + +**描述:** + +色域类型枚举值。 + + | 枚举值 | 描述 | +| -------- | -------- | +| COLOR_GAMUT_INVALID | 无效值 | +| COLOR_GAMUT_NATIVE | 默认值 | +| COLOR_GAMUT_SATNDARD_BT601 | Standard BT601类型 | +| COLOR_GAMUT_STANDARD_BT709 | Standard BT709类型 | +| COLOR_GAMUT_DCI_P3 | DCI P3类型 | +| COLOR_GAMUT_SRGB | SRGB类型 | +| COLOR_GAMUT_ADOBE_RGB | Adobe RGB类型 | +| COLOR_GAMUT_DISPLAY_P3 | display P3类型 | +| COLOR_GAMUT_BT2020 | BT2020类型 | +| COLOR_GAMUT_BT2100_PQ | BT2100 PQ类型 | +| COLOR_GAMUT_BT2100_HLG | BT2100 HLG类型 | +| COLOR_GAMUT_DISPLAY_BT2020 | Display BT2020类型 | + + +### ColorKey + + +``` +enum ColorKey +``` + +**描述:** + +Color key操作类型定义,即硬件加速支持的Color key操作类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| CKEY_NONE | 不使用colorkey | +| CKEY_SRC | 使用源colorkey | +| CKEY_DST | 使用目标colorkey | +| CKEY_BUTT | 空操作 | + + +### CompositionType + + +``` +enum CompositionType +``` + +**描述:** + +枚举特殊层的组合类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| COMPOSITION_CLIENT | Client 合成类型,使用CPU或者GPU合成。 | +| COMPOSITION_DEVICE | Device 合成类型,使用Device合成。 | +| COMPOSITION_CURSOR | Cursor合成类型,用于光标合成。 | +| COMPOSITION_VIDEO | Video合成类型,用于视频层合成。 | +| COMPOSITION_DEVICE_CLEAR | Device clear 合成类型,device会清除目标区域。 | +| COMPOSITION_CLIENT_CLEAR | Client clear 合成类型,service会清除目标区域。 | +| COMPOSITION_TUNNEL | Tunnel 合成类型,用于tunnel。 | +| COMPOSITION_BUTT | 合成类型,一个不可用类型,用于默认初始化。 | + + +### Connection + + +``` +enum Connection +``` + +**描述:** + +热插拔连接类型定义 + + | 枚举值 | 描述 | +| -------- | -------- | +| CON_INVALID | 无效类型 | +| CONNECTED | 已连接 | +| DISCONNECTED | 断开连接 | + + +### DispErrCode + + +``` +enum DispErrCode +``` + +**描述:** + +返回值类型定义。 + + | 枚举值 | 描述 | +| -------- | -------- | +| DISPLAY_SUCCESS | 成功 | +| DISPLAY_FAILURE | 失败 | +| DISPLAY_FD_ERR | fd错误 | +| DISPLAY_PARAM_ERR | 参数错误 | +| DISPLAY_NULL_PTR | 空指针 | +| DISPLAY_NOT_SUPPORT | 不支持的特性 | +| DISPLAY_NOMEM | 内存不足 | +| DISPLAY_SYS_BUSY | 系统繁忙 | +| DISPLAY_NOT_PERM | 操作不允许 | + + +### DispPowerStatus + + +``` +enum DispPowerStatus +``` + +**描述:** + +枚举显示状态 + + | 枚举值 | 描述 | +| -------- | -------- | +| POWER_STATUS_ON | 上电模式 | +| POWER_STATUS_STANDBY | 待机模式 | +| POWER_STATUS_SUSPEND | 休眠模式 | +| POWER_STATUS_OFF | 下电模式 | +| POWER_STATUS_BUTT | 默认模式 | + + +### GamutMap + + +``` +enum GamutMap +``` + +**描述:** + +枚举色域的映射类型 + + | 枚举值 | 描述 | +| -------- | -------- | +| GAMUT_MAP_CONSTANT | 不变 | +| GAMUT_MAP_EXPANSION | 映射增强 | +| GAMUT_MAP_HDR_CONSTANT | 不变,用于HDR | +| GAMUT_MAP_HDR_EXPANSION | 映射增强,用于HDR | + + +### HDRFormat + + +``` +enum HDRFormat +``` + +**描述:** + +枚举HDR格式 + + | 枚举值 | 描述 | +| -------- | -------- | +| NOT_SUPPORT_HDR | 不支持HDR | +| DOLBY_VISION | Dolby Vision格式 | +| HDR10 | HDR10格式 | +| HLG | HLG格式 | +| HDR10_PLUS | HDR10 Plus格式 | +| HDR_VIVID | Vivid格式 | + + +### HDRMetadataKey + + +``` +enum HDRMetadataKey +``` + +**描述:** + +枚举HDR元数据关键字 + + | 枚举值 | 描述 | +| -------- | -------- | +| MATAKEY_RED_PRIMARY_X | 红基色X坐标 | +| MATAKEY_RED_PRIMARY_Y | 红基色Y坐标 | +| MATAKEY_GREEN_PRIMARY_X | 绿基色X坐标 | +| MATAKEY_GREEN_PRIMARY_Y | 绿基色Y坐标 | +| MATAKEY_BLUE_PRIMARY_X | 蓝基色X坐标 | +| MATAKEY_BLUE_PRIMARY_Y | 蓝基色Y坐标 | +| MATAKEY_WHITE_PRIMARY_X | 白点X坐标 | +| MATAKEY_WHITE_PRIMARY_Y | 白点Y坐标 | +| MATAKEY_MAX_LUMINANCE | 最大的光亮度 | +| MATAKEY_MIN_LUMINANCE | 最小的光亮度 | +| MATAKEY_MAX_CONTENT_LIGHT_LEVEL | 最大的内容亮度水平 | +| MATAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL | 最大的帧平均亮度水平 | +| MATAKEY_HDR10_PLUS | HDR10 Plus | +| MATAKEY_HDR_VIVID | Vivid | + + +### InterfaceType + + +``` +enum InterfaceType +``` + +**描述:** + +枚举接口类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| DISP_INTF_HDMI | HDMI 接口 | +| DISP_INTF_LCD | LCD 接口 | +| DISP_INTF_BT1120 | BT1120 接口 | +| DISP_INTF_BT656 | BT656 接口 | +| DISP_INTF_YPBPR | YPBPR 接口 | +| DISP_INTF_RGB | RGB 接口 | +| DISP_INTF_CVBS | CVBS 接口 | +| DISP_INTF_SVIDEO | SVIDEO 接口 | +| DISP_INTF_VGA | VGA 接口 | +| DISP_INTF_MIPI | MIPI 接口 | +| DISP_INTF_PANEL | PANEL 接口 | +| DISP_INTF_BUTT | BUTT接口,一个不可用类型,用于默认初始化。 | + + +### LayerType + + +``` +enum LayerType +``` + +**描述:** + +图层类型定义。 + + | 枚举值 | 描述 | +| -------- | -------- | +| LAYER_TYPE_GRAPHIC | 图形层 | +| LAYER_TYPE_OVERLAY | 视频层 | +| LAYER_TYPE_SDIEBAND | 媒体播放 | +| LAYER_TYPE_CURSOR | 光标层 | +| LAYER_TYPE_BUTT | 空图层 | + + +### MirrorType + + +``` +enum MirrorType +``` + +**描述:** + +硬件加速支持的镜像操作类型定义 + + | 枚举值 | 描述 | +| -------- | -------- | +| MIRROR_NONE | 不使用镜像 | +| MIRROR_LR | 左右镜像 | +| MIRROR_TB | 上下镜像 | +| MIRROR_BUTT | 空操作 | + + +### PixelFormat + + +``` +enum PixelFormat +``` + +**描述:** + +像素格式类型定义。 + + | 枚举值 | 描述 | +| -------- | -------- | +| PIXEL_FMT_CLUT8 | CLUT8 格式 | +| PIXEL_FMT_CLUT1 | CLUT1 格式 | +| PIXEL_FMT_CLUT4 | CLUT4 格式 | +| PIXEL_FMT_RGB_565 | RGB565 格式 | +| PIXEL_FMT_RGBA_5658 | RGBA5658 格式 | +| PIXEL_FMT_RGBX_4444 | RGBX4444 格式 | +| PIXEL_FMT_RGBA_4444 | RGBA4444 格式 | +| PIXEL_FMT_RGB_444 | RGB444 格式 | +| PIXEL_FMT_RGBX_5551 | RGBX5551 格式 | +| PIXEL_FMT_RGBA_5551 | RGBA5551 格式 | +| PIXEL_FMT_RGB_555 | RGB555 格式 | +| PIXEL_FMT_RGBX_8888 | RGBX8888 格式 | +| PIXEL_FMT_RGBA_8888 | RGBA8888 格式 | +| PIXEL_FMT_RGB_888 | RGB888 格式 | +| PIXEL_FMT_BGR_565 | BGR565 格式 | +| PIXEL_FMT_BGRX_4444 | BGRX4444 格式 | +| PIXEL_FMT_BGRA_4444 | BGRA4444 格式 | +| PIXEL_FMT_BGRX_5551 | BGRX5551 格式 | +| PIXEL_FMT_BGRA_5551 | BGRA5551 格式 | +| PIXEL_FMT_BGRX_8888 | BGRX8888 格式 | +| PIXEL_FMT_BGRA_8888 | BGRA8888 格式 | +| PIXEL_FMT_YUV_422_I | YUV422 交错格式 | +| PIXEL_FMT_YCBCR_422_SP | YCBCR422 半平面格式 | +| PIXEL_FMT_YCRCB_422_SP | YCRCB422 半平面格式 | +| PIXEL_FMT_YCBCR_420_SP | YCBCR420 半平面格式 | +| PIXEL_FMT_YCRCB_420_SP | YCRCB420 半平面格式 | +| PIXEL_FMT_YCBCR_422_P | YCBCR422 平面格式 | +| PIXEL_FMT_YCRCB_422_P | YCRCB422 平面格式 | +| PIXEL_FMT_YCBCR_420_P | YCBCR420 平面格式 | +| PIXEL_FMT_YCRCB_420_P | YCRCB420 平面格式 | +| PIXEL_FMT_YUYV_422_PKG | YUYV422 打包格式 | +| PIXEL_FMT_UYVY_422_PKG | UYVY422 打包格式t | +| PIXEL_FMT_YVYU_422_PKG | YVYU422 打包格式 | +| PIXEL_FMT_VYUY_422_PKG | VYUY422 打包格式 | +| PIXEL_FMT_VENDER_MASK | vendor mask 格式 | +| PIXEL_FMT_BUTT | Invalid 像素格式 | + + +### PresentTimestampType + + +``` +enum PresentTimestampType +``` + +**描述:** + +上屏时间戳类型枚举值。 + + | 枚举值 | 描述 | +| -------- | -------- | +| HARDWARE_DISPLAY_PTS_UNSUPPORTED | 不支持 | +| HARDWARE_DISPLAY_PTS_DELAY | Delay 时延类型 | +| HARDWARE_DISPLAY_PTS_TIMESTAMP | 时间戳类型 | + + +### RopType + + +``` +enum RopType +``` + +**描述:** + +硬件加速支持的ROP操作类型。 + +硬件加速支持的ROP操作类型,在将前景位图的RGB颜色分量和Alpha分量值与背景位图的RGB颜色 分量值和Alpha分量值进行按位的布尔运算(包括按位与,按位或等),将结果输出。 + + | 枚举值 | 描述 | +| -------- | -------- | +| ROP_BLACK | 黑色 | +| ROP_NOTMERGEPEN | ~(S2+S1) | +| ROP_MASKNOTPEN | ~S2&S1 | +| ROP_NOTCOPYPEN | ~S2 | +| ROP_MASKPENNOT | S2&~S1 | +| ROP_NOT | ~S1 | +| ROP_XORPEN | S2^S1 | +| ROP_NOTMASKPEN | ~(S2&S1) | +| ROP_MASKPEN | S2&S1 | +| ROP_NOTXORPEN | ~(S2^S1) | +| ROP_NOP | S1 | +| ROP_MERGENOTPEN | ~S2+S1 | +| ROP_COPYPE | S2 | +| ROP_MERGEPENNOT | S2+~S1 | +| ROP_MERGEPEN | S2+S1 | +| ROP_WHITE | 白色 | +| ROP_BUTT | 无效值 | + + +### TransformType + + +``` +enum TransformType +``` + +**描述:** + +图层变换类型定义。 + + | 枚举值 | 描述 | +| -------- | -------- | +| ROTATE_NONE | 不旋转 | +| ROTATE_90 | 旋转90度 | +| ROTATE_180 | 旋转180度 | +| ROTATE_270 | 旋转270度 | +| ROTATE_BUTT | 无效操作 | + + +## **函数说明** + + +### DeviceInitialize() + + +``` +int32_t DeviceInitialize (DeviceFuncs **funcs) +``` + +**描述:** + +实现显示设备控制接口的初始化,申请操作显示设备控制接口的资源,并获取对应的操作接口。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| funcs | 输出参数,显示设备控制接口指针,初始化时分配内存,调用者不需要分配内存,调用者获取该指针用于操作显示设备。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### DeviceUninitialize() + + +``` +int32_t DeviceUninitialize (DeviceFuncs * funcs) +``` + +**描述:** + +取消显示设备控制接口的初始化,释放控制接口使用到的资源。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| funcs | 输出参数,显示设备控制接口指针,用于释放初始化函数中分配的操作指针内存。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### GfxInitialize() + + +``` +int32_t GfxInitialize (GfxFuncs **funcs) +``` + +**描述:** + +获取硬件加速相关的操作接口指针。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| funcs | 输出参数,硬件加速模块操作接口指针,调用者不需要分配内存,调用者获取该指针操作硬件加速。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### GfxUninitialize() + + +``` +int32_t GfxUninitialize (GfxFuncs * funcs) +``` + +**描述:** + +释放硬件加速相关的操作接口指针。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| funcs | 输出参数,硬件加速操作接口指针。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### GrallocInitialize() + + +``` +int32_t GrallocInitialize (GrallocFuncs **funcs) +``` + +**描述:** + +初始化内存模块,并获取内存提供的操作接口。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| funcs | 输出参数,内存模块操作接口指针,初始化内存模块时分配内存,调用者不需要分配内存,调用者获取该指针操作内存。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### GrallocUninitialize() + + +``` +int32_t GrallocUninitialize (GrallocFuncs * funcs) +``` + +**描述:** + +取消初始化内存模块,并释放内存操作接口指针。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| funcs | 输出参数,内存操作接口指针,用于释放内存初始化函数中分配的操作指针内存。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### LayerInitialize() + + +``` +int32_t LayerInitialize (LayerFuncs **funcs) +``` + +**描述:** + +实现图层初始化功能,申请图层使用的资源,并获取图层提供的操作接口。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| funcs | 输出参数,图层操作接口指针,初始化图层时分配内存,调用者不需要分配内存,调用者获取该指针操作图层。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + +**参见:** + +[LayerUninitialize](#layeruninitialize) + + +### LayerUninitialize() + + +``` +int32_t LayerUninitialize (LayerFuncs * funcs) +``` + +**描述:** + +取消图层初始化功能,释放图层使用到的资源,并释放图层操作接口指针。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| funcs | 输出参数,图层操作接口指针,用于释放图层初始化函数中分配的操作指针内存。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + +**参见:** + +[LayerInitialize](#layerinitialize) + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **变量说明** + + +### alpha0 [1/2] + + +``` +uint8_t LayerAlpha::alpha0 +``` + +**描述:** + +alpha0值,取值范围:[0, 255] + + +### alpha0 [2/2] + + +``` +uint8_t ISurface::alpha0 +``` + +**描述:** + +Alpha0值,取值范围:[0,255] + + +### alpha1 [1/2] + + +``` +uint8_t LayerAlpha::alpha1 +``` + +**描述:** + +alpha1值,取值范围:[0, 255] + + +### alpha1 [2/2] + + +``` +uint8_t ISurface::alpha1 +``` + +**描述:** + +Alpha1值,取值范围:[0,255] + + +### alphaRopType + + +``` +RopType GfxOpt::alphaRopType +``` + +**描述:** + +Alpha的Rop类型 + + +### bAlphaExt1555 + + +``` +bool ISurface::bAlphaExt1555 +``` + +**描述:** + +是否使能1555的Alpha扩展 + + +### bAlphaMax255 + + +``` +bool ISurface::bAlphaMax255 +``` + +**描述:** + +图像alpha最大值为255还是128 + + +### baseAddr + + +``` +void* __attribute__::baseAddr +``` + +**描述:** + +内存的初始地址 + + +### blendType + + +``` +BlendType GfxOpt::blendType +``` + +**描述:** + +混合方式 + + +### bpp + + +``` +int32_t LayerInfo::bpp +``` + +**描述:** + +每像素所占bit数 + + +### bYCbCrClut + + +``` +bool ISurface::bYCbCrClut +``` + +**描述:** + +CLUT表是否位于 YCbCr 空间 + + +### cbcrPhyAddr + + +``` +uint64_t ISurface::cbcrPhyAddr +``` + +**描述:** + +CbCr分量地址 + + +### cbcrStride + + +``` +int32_t ISurface::cbcrStride +``` + +**描述:** + +CbCr分量跨度 + + +### clutPhyAddr + + +``` +uint64_t ISurface::clutPhyAddr +``` + +**描述:** + +Clut表首地址,用作颜色扩展或颜色校正 + + +### color [1/3] + + +``` +uint32_t ILine::color +``` + +**描述:** + +线条颜色 + + +### color [2/3] + + +``` +uint32_t ICircle::color +``` + +**描述:** + +圆的颜色 + + +### color [3/3] + + +``` +uint32_t Rectangle::color +``` + +**描述:** + +矩形颜色 + + +### colorKeyFrom + + +``` +ColorKey GfxOpt::colorKeyFrom +``` + +**描述:** + +色键模式 + + +### colorRopType + + +``` +RopType GfxOpt::colorRopType +``` + +**描述:** + +颜色的Rop类型 + + +### Commit + + +``` +int32_t(* DeviceFuncs::Commit) (uint32_t devId, int32_t *fence) +``` + +**描述:** + +提交合成送显请求。 + +图形服务通过该接口向接口实现层提交合成送显请求,如果有硬件合成层,接口实现层需要在这时进行合成,并且把最终合成的数据送到硬件进行显示。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| fences | 输出参数,fence首地址,指向fence数组的首地址。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### CreateVirtualDisplay + + +``` +int32_t(* DeviceFuncs::CreateVirtualDisplay) (uint32_t width, uint32_t height, int32_t *format, uint32_t *devId) +``` + +**描述:** + +创建虚拟显示设备。 + +该接口用于创建一个虚拟显示设备。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| width | 输入参数,指定显示设备的像素宽度。 | +| height | 输入参数,指定显示设备的像素高度。 | +| format | 输出参数,指定显示设备的像素格式。 详情参考[ERROR:Invalid link:zh-cn_topic_0000001357381993.xml#xref738382043153217,link:zh-cn_topic_0000001347985105.xml#ga60883d4958a60b91661e97027a85072a](zh-cn_topic_0000001347985105.xml#ga60883d4958a60b91661e97027a85072a),接口实现层可以根据硬件需求,修改format并返回给图形服务。 | +| devId | 输出参数,用于接口层返回创建的设备ID。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### CreateWriteBack + + +``` +int32_t(* DeviceFuncs::CreateWriteBack) (uint32_t *devId, uint32_t width, uint32_t height, int32_t *format) +``` + +**描述:** + +对指定显示设备创建回写点。 + +该接口用来对指定的设备创建一个回写点,如果回写点数量超过了限制,接口实现层将会返回失败。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID,接口实现层在创建完回写点后将回写点设备ID存放在该参数中返回给图形服务。 | +| width | 输入参数,回写像素宽度。 | +| height | 输入参数,回写像素高度。 | +| format | 输入参数,回写点数据格式,详情参考[PixelFormat](#pixelformat),接口实现层可以根据硬件需求,修改format并返回给图形服务。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### data + + +``` +BufferData LayerBuffer::data +``` + +**描述:** + +图层buffer数据 + + +### DestroyVirtualDisplay + + +``` +int32_t(* DeviceFuncs::DestroyVirtualDisplay) (uint32_t devId) +``` + +**描述:** + +销毁虚拟显示设备。 + +该接口用于销毁指定的虚拟显示设备。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### DestroyWriteBack + + +``` +int32_t(* DeviceFuncs::DestroyWriteBack) (uint32_t devId) +``` + +**描述:** + +销毁指定显示设备的回写点。 + +该接口用來销毁指定的回写点。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### enableRop + + +``` +bool GfxOpt::enableRop +``` + +**描述:** + +Rop功能使能位 + + +### enableScale + + +``` +bool GfxOpt::enableScale +``` + +**描述:** + +缩放功能使能位 + + +### enColorFmt + + +``` +PixelFormat ISurface::enColorFmt +``` + +**描述:** + +图像格式 + + +### enGlobalAlpha [1/2] + + +``` +bool LayerAlpha::enGlobalAlpha +``` + +**描述:** + +全局alpha使能标志 + + +### enGlobalAlpha [2/2] + + +``` +bool GfxOpt::enGlobalAlpha +``` + +**描述:** + +全局alpha使能位 + + +### enPixelAlpha [1/2] + + +``` +bool LayerAlpha::enPixelAlpha +``` + +**描述:** + +像素alpha使能标志 + + +### enPixelAlpha [2/2] + + +``` +bool GfxOpt::enPixelAlpha +``` + +**描述:** + +像素alpha使能位 + + +### expectedSize + + +``` +uint32_t AllocInfo::expectedSize +``` + +**描述:** + +申请内存大小 + + +### fd + + +``` +int32_t __attribute__::fd +``` + +**描述:** + +句柄 fd,-1代表不支持。 + + +### fenceId + + +``` +int32_t LayerBuffer::fenceId +``` + +**描述:** + +buffer 的fence号 + + +### format [1/2] + + +``` +PixelFormat AllocInfo::format +``` + +**描述:** + +申请内存格式 + + +### format [2/2] + + +``` +PixelFormat VerifyAllocInfo::format +``` + +**描述:** + +分配内存的像素格式 + + +### formatCount + + +``` +uint32_t HDRCapability::formatCount +``` + +**描述:** + +支持的HDR格式的数量 + + +### formats + + +``` +HDRFormat* HDRCapability::formats +``` + +**描述:** + +支持的HDR格式的数组首地址 + + +### freshRate + + +``` +uint32_t DisplayModeInfo::freshRate +``` + +**描述:** + +刷新速率 + + +### gAlpha + + +``` +uint8_t LayerAlpha::gAlpha +``` + +**描述:** + +全局alpha值,取值范围:[0, 255] + + +### GetDisplayBacklight + + +``` +int32_t(* DeviceFuncs::GetDisplayBacklight) (uint32_t devId, uint32_t *level) +``` + +**描述:** + +获取显示设备当前的背光值。 + +图形服务可以通过该接口获取设置显示设备的背光值。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| level | 输出参数,保存对应设备的背光值,由接口实现层进行写入。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### GetDisplayCapability + + +``` +int32_t(* DeviceFuncs::GetDisplayCapability) (uint32_t devId, DisplayCapability *info) +``` + +**描述:** + +获取显示设备能力集。 + +图形服务可以通过该接口获取显示设备具备哪些显示能力。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| info | 输出参数,设备支持的能力级信息,详情参考 {\@DisplayCapability}。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### GetDisplayColorGamut + + +``` +int32_t(* DeviceFuncs::GetDisplayColorGamut) (uint32_t devId, ColorGamut *gamut) +``` + +**描述:** + +获取显示设备当前的色域模式。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| gamut | 输出参数,保存对应设备的色域模式,由接口实现层进行写入。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### GetDisplayCompChange + + +``` +int32_t(* DeviceFuncs::GetDisplayCompChange) (uint32_t devId, uint32_t *num, uint32_t *Layers, int32_t *type) +``` + +**描述:** + +获取显示设备合成类型有变化的layer。 + +在合成准备阶段,显示设备会根据设备的合成能力修改图层的合成类型,该接口会返回哪些图层合成类型发生了变化。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| num | 输出参数,表示合成类型发生了变化的图层数量。 | +| Layers | 输出参数,指向图层数组首地址。 | +| type | 输出参数,指向合成类型数组首地址。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### GetDisplayGamutMap + + +``` +int32_t(* DeviceFuncs::GetDisplayGamutMap) (uint32_t devId, GamutMap *gamutMap) +``` + +**描述:** + +获取显示设备当前的色域映射模式。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| gamutMap | 输出参数,保存对应设备的色域映射模式,由接口实现层进行写入。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### GetDisplayMode + + +``` +int32_t(* DeviceFuncs::GetDisplayMode) (uint32_t devId, uint32_t *modeId) +``` + +**描述:** + +获取显示设备当前的显示模式。 + +图形服务可以通过该接口获取显示设备当前的显示模式。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| modeId | 输出参数,存放当前设备的显示模式ID, 由接口实现层进行数据的写入。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### GetDisplayPowerStatus + + +``` +int32_t(* DeviceFuncs::GetDisplayPowerStatus) (uint32_t devId, DispPowerStatus *status) +``` + +**描述:** + +获取显示设备当前的电源状态。 + +图形服务可以通过该接口获设置显示设备的电源状态。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| status | 输出参数,保存对应设备的电源状态,由接口实现层进行状态的写入。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### GetDisplayProperty + + +``` +int32_t(* DeviceFuncs::GetDisplayProperty) (uint32_t devId, uint32_t id, uint64_t *value) +``` + +**描述:** + +获得显示设备属性值。 + +图形服务可以通过该接口获取显示设备具体的属性值。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| id | 输入参数,由接口GetDisplayCapability返回属性ID。 | +| level | 输出参数,属性ID对应的属性值,由接口实现层写入。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### GetDisplayReleaseFence + + +``` +int32_t(* DeviceFuncs::GetDisplayReleaseFence) (uint32_t devId, uint32_t *num, uint32_t *layers, int32_t *fences) +``` + +**描述:** + +获取显示图层fence。 + +图形服务在调用接口Commit后,需要通过该接口获取图层的fence信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| num | 输出参数,图层个数。 | +| layers | 输出参数,图层首地址,指向图层数组的首地址。 | +| fences | 输出参数,fence首地址,指向fence数组的首地址。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### GetDisplaySupportedColorGamuts + + +``` +int32_t(* DeviceFuncs::GetDisplaySupportedColorGamuts) (uint32_t devId, uint32_t *num, ColorGamut *gamuts) +``` + +**描述:** + +获取显示设备支持的色域信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| num | 输出参数,设备支持的色域数组个数。 | +| gamuts | 输出参数,色域首地址,指向色域数组首地址。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### GetDisplaySupportedModes + + +``` +int32_t(* DeviceFuncs::GetDisplaySupportedModes) (uint32_t devId, uint32_t *num, DisplayModeInfo *modes) +``` + +**描述:** + +获取显示设备支持的显示模式信息。 + +图形服务可以通过该接口获取到显示设备支持哪些显示模式。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| num | 输出参数,设备支持的模式数量。 | +| modes | 输出参数,设备支持的所有模式信息,包括所有能支持的分辨率和刷新率,每一个模式实现层都有一个Id与之对应,在获取当前模式 和设置当前模式时都会使用到,详情参考 {\@DisplayModeInfo}。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### GetHDRCapabilityInfos + + +``` +int32_t(* DeviceFuncs::GetHDRCapabilityInfos) (uint32_t devId, HDRCapability *info) +``` + +**描述:** + +获取显示设备支持的HDR属性信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| info | 输出参数,保存对应设备的HDR属性信息,由接口实现层进行写入。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### GetSupportedMetadataKey + + +``` +int32_t(* DeviceFuncs::GetSupportedMetadataKey) (uint32_t devId, uint32_t *num, HDRMetadataKey *keys) +``` + +**描述:** + +获取显示设备支持的 HDRMetadataKey。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| num | 输出参数,设备支持的HDRMetadataKey数组个数。 | +| keys | 输出参数,HDRMetadataKey首地址,指向HDRMetadataKey数组首地址。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### GetWriteBackFrame + + +``` +int32_t(* DeviceFuncs::GetWriteBackFrame) (uint32_t devId, BufferHandle *buffer, int32_t *fence) +``` + +**描述:** + +获取显示设备的回写帧。 + +该接口用来获取devId指定的回写点数据,接口实现层将显示设备回写点的数据写入到设置的缓存中。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| buffer | 输出参数,回写点数据缓存。 | +| fence | 输出参数,同步栅栏,图形服务在调用该接口时,需要将Buffer的release fence 传入,标记该缓存是否可以被写入,接口实现层在接口返回前需要将buffer的acquirce fence 写入回传给图形服务,用来标记回写数据是否已经写入缓存。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### globalAlpha + + +``` +uint32_t GfxOpt::globalAlpha +``` + +**描述:** + +全局alpha的值 + + +### h + + +``` +int32_t IRect::h +``` + +**描述:** + +矩形框高度 + + +### hdl + + +``` +BufferHandle* LayerBuffer::hdl +``` + +**描述:** + +图层buffer句柄 + + +### height [1/7] + + +``` +uint32_t DisplayInfo::height +``` + +**描述:** + +显示屏高度 + + +### height [2/7] + + +``` +int32_t LayerInfo::height +``` + +**描述:** + +图层高度 + + +### height [3/7] + + +``` +int32_t LayerBuffer::height +``` + +**描述:** + +buffer高度 + + +### height [4/7] + + +``` +int32_t ISurface::height +``` + +**描述:** + +图像高度 + + +### height [5/7] + + +``` +int32_t DisplayModeInfo::height +``` + +**描述:** + +像素高度 + + +### height [6/7] + + +``` +uint32_t AllocInfo::height +``` + +**描述:** + +申请内存高度 + + +### height [7/7] + + +``` +uint32_t VerifyAllocInfo::height +``` + +**描述:** + +分配内存的高度 + + +### id + + +``` +int32_t DisplayModeInfo::id +``` + +**描述:** + +模式ID + + +### InvokeDisplayCmd + + +``` +int32_t(* DeviceFuncs::InvokeDisplayCmd) (uint32_t devId,...) +``` + +**描述:** + +调用显示设备命令。 + +该接口用于图形服务和接口实现层之间的接口扩展,如果由临时接口新增可以通过该接口进行扩展,不用增加新的接口定义。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### key + + +``` +HDRMetadataKey HDRMetaData::key +``` + +**描述:** + +HDR元数据关键字 + + +### maxAverageLum + + +``` +float HDRCapability::maxAverageLum +``` + +**描述:** + +最大的平均光亮度luminance值 + + +### maxLum + + +``` +float HDRCapability::maxLum +``` + +**描述:** + +最大的光亮度luminance值 + + +### minLum + + +``` +float HDRCapability::minLum +``` + +**描述:** + +最小的光亮度luminance值 + + +### mirrorType + + +``` +MirrorType GfxOpt::mirrorType +``` + +**描述:** + +镜像类型 + + +### name [1/2] + + +``` +char PropertyObject::名称[PROPERTY_NAME_LEN] +``` + +**描述:** + +属性名称 + + +### name [2/2] + + +``` +char DisplayCapability::名称[PROPERTY_NAME_LEN] +``` + +**描述:** + +显示设备名称 + + +### phyAddr [1/2] + + +``` +uint64_t BufferData::phyAddr +``` + +**描述:** + +物理内存地址 + + +### phyAddr [2/2] + + +``` +uint64_t ISurface::phyAddr +``` + +**描述:** + +图像首地址 + + +### phyHeight + + +``` +uint32_t DisplayCapability::phyHeight +``` + +**描述:** + +物理高度 + + +### phyWidth + + +``` +uint32_t DisplayCapability::phyWidth +``` + +**描述:** + +物理宽度 + + +### pitch + + +``` +int32_t LayerBuffer::pitch +``` + +**描述:** + +一行数据所占字节数 + + +### pixFormat [1/2] + + +``` +PixelFormat LayerInfo::pixFormat +``` + +**描述:** + +图层像素格式 + + +### pixFormat [2/2] + + +``` +PixelFormat LayerBuffer::pixFormat +``` + +**描述:** + +buffer像素格式 + + +### PrepareDisplayLayers + + +``` +int32_t(* DeviceFuncs::PrepareDisplayLayers) (uint32_t devId, bool *needFlushFb) +``` + +**描述:** + +显示设备合成前准备。 + +图形服务在合成前需要通过该接口通知显示设备进行合成前的准备工作。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| needFlushFb | 输出参数,接口实现层通过该参数指示图形服务在commit前是否需要通过SetDisplayClientBuffer重新设置显示帧存。 true表示需要设置显示帧存,false表示不需要。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### propertyCount + + +``` +uint32_t DisplayCapability::propertyCount +``` + +**描述:** + +属性数组大小 + + +### propId + + +``` +uint32_t PropertyObject::propId +``` + +**描述:** + +属性ID + + +### props + + +``` +PropertyObject* DisplayCapability::props +``` + +**描述:** + +属性数组 + + +### r + + +``` +int32_t ICircle::r +``` + +**描述:** + +圆的半径 + + +### rect + + +``` +IRect Rectangle::rect +``` + +**描述:** + +矩形区域 + + +### RegDisplayRefreshCallback + + +``` +int32_t(* DeviceFuncs::RegDisplayRefreshCallback) (uint32_t devId, RefreshCallback callback, void *data) +``` + +**描述:** + +刷新请求回调。 + +注册刷新请求事件回调,当实现层有刷新需求时,实现层通过回调注册的接口通知图形服务。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| callback | 输入参数,刷新请求事件回调实例,当有接口实现层有刷新请求时,需要通过该实例通知图形服务。 | +| data | 输出参数,图形服务携带的私有数据,在事件回调接口中需要返回给图形服务。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### RegDisplayVBlankCallback + + +``` +int32_t(* DeviceFuncs::RegDisplayVBlankCallback) (uint32_t devId, VBlankCallback callback, void *data) +``` + +**描述:** + +注册VBlank事件回调。 + +注册VBlank事件回调,当有VBlank事件发生时接口实现层需要回调注册的接口。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| callback | 输入参数,VBlank事件回调实例,当有VBlank事件发生时并且DisplayVsync处于Enable状态,接口实现层需要通过该实例通知图形服务。 | +| data | 输出参数,图形服务携带的私有数据,在事件回调接口中需要返回给图形服务。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### RegHotPlugCallback + + +``` +int32_t(* DeviceFuncs::RegHotPlugCallback) ((HotPlugCallback callback, void *data) +``` + +**描述:** + +注册热插拔事件回调。 + +注册热插拔事件回调,当有热插拔事件发生时接口实现层需要回调注册的接口。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| callback | 输入参数,热插拔事件回调实例,当有热插拔事件发生时,接口实现层需要通过该实例通知图形服务。 | +| data | 输出参数,图形服务携带的私有数据,在事件回调接口中需要返回给图形服务。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### reserve + + +``` +int32_t __attribute__::reserve[0] +``` + +**描述:** + +reserve数组 + + +### reserveInts + + +``` +uint32_t __attribute__::reserveInts +``` + +**描述:** + +reserve数组的个数 + + +### rotAngle + + +``` +int32_t DisplayInfo::rotAngle +``` + +**描述:** + +显示屏旋转角度 + + +### rotateType + + +``` +TransformType GfxOpt::rotateType +``` + +**描述:** + +旋转类型 + + +### SetDisplayBacklight + + +``` +int32_t(* DeviceFuncs::SetDisplayBacklight) (uint32_t devId, uint32_t level) +``` + +**描述:** + +设置显示设备当前的背光值。 + +图形服务可以通过该接口获设置显示设备的背光值。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| level | 输入参数,表示需要设置的背光值。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### SetDisplayClientBuffer + + +``` +int32_t(* DeviceFuncs::SetDisplayClientBuffer) (uint32_t devId, const BufferHandle *buffer, int32_t fence) +``` + +**描述:** + +设置显示设备的显示缓存。 + +图形服务可以通过该接口将显示缓存设置给显示设备,显示设备硬件合成结果将会存放在该显示缓存中。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| buffer | 输入参数,显示缓存。 | +| fence | 输入参数,同步栅栏,标识显示缓存是否可以访问,有图形服务创建和释放,接口实现层需要等待同步栅栏发送信号后才能使用显示缓存。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### SetDisplayClientCrop + + +``` +int32_t(* DeviceFuncs::SetDisplayClientCrop) (uint32_t devId, IRect *rect) +``` + +**描述:** + +设置显示设备的裁剪区域。 + +图形服务可以通过该接口设置显示设备的ClientBuffer的裁剪区域,裁剪区域不能超过ClientBuffer的大小。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| rect | 输入参数,ClientBuffer的裁剪区域。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### SetDisplayClientDamage + + +``` +int32_t(* DeviceFuncs::SetDisplayClientDamage) (uint32_t devId, uint32_t num, IRect *rect) +``` + +**描述:** + +设置显示设备的显示脏区。 + +图形服务可以通过该接口设置显示设备脏区,接口实现层可以根据该区域进行区域刷新,脏区是由多个矩形区域组合起来的。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| num | 输入参数,矩形个数。 | +| rect | 输入参数,区域矩形指针,指向矩形数组的首地址。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### SetDisplayClientDestRect + + +``` +int32_t(* DeviceFuncs::SetDisplayClientDestRect) (uint32_t devId, IRect *rect) +``` + +**描述:** + +设置显示设备的显示区域。 + +图形服务可以通过该接口设置显示设备的显示区域。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| rect | 输入参数,显示区域。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### SetDisplayColorGamut + + +``` +int32_t(* DeviceFuncs::SetDisplayColorGamut) (uint32_t devId, ColorGamut gamut) +``` + +**描述:** + +设置显示设备当前的色域模式。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| gamut | 输入参数,表示需要设置的色域模式。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### SetDisplayColorTransform + + +``` +int32_t(* DeviceFuncs::SetDisplayColorTransform) (uint32_t devId, const float *matrix) +``` + +**描述:** + +设置显示设备当前的4x4的颜色转换矩阵。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| matrix | 输入参数,表示需要设置的颜色转换模式。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### SetDisplayGamutMap + + +``` +int32_t(* DeviceFuncs::SetDisplayGamutMap) (uint32_t devId, GamutMap gamutMap) +``` + +**描述:** + +设置显示设备当前的色域映射模式。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| gamutMap | 输入参数,表示需要设置的色域映射模式。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### SetDisplayMode + + +``` +int32_t(* DeviceFuncs::SetDisplayMode) (uint32_t devId, uint32_t modeId) +``` + +**描述:** + +设置显示设备的显示模式。 + +图形服务可以通过该接口获设置显示设备的显示模式。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| modeId | 输入参数,指明需要设置的模式ID,接口实现层将设备切换到该参数对应的显示模式。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### SetDisplayPowerStatus + + +``` +int32_t(* DeviceFuncs::SetDisplayPowerStatus) (uint32_t devId, DispPowerStatus status) +``` + +**描述:** + +设置显示设备当前的电源状态。 + +图形服务可以通过该接口获设置显示设备的电源状态。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| status | 输入参数,表示需要设置的电源状态。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### SetDisplayProperty + + +``` +int32_t(* DeviceFuncs::SetDisplayProperty) (uint32_t devId, uint32_t id, uint64_t value) +``` + +**描述:** + +设置显示设备属性值。 + +图形服务可以通过该接口设置显示设备具体的属性值。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| id | 输入参数,由接口GetDisplayCapability返回属性ID。 | +| value | 输入参数,需要设置的属性值。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### SetDisplayVsyncEnabled + + +``` +int32_t(* DeviceFuncs::SetDisplayVsyncEnabled) (uint32_t devId, bool enabled) +``` + +**描述:** + +使能垂直同步信号。 + +图形服务可以通过该接口使能或取消垂直同步信号,当有垂直同步信号产生时,接口实现层需要回调图形服务通过RegDisplayVBlankCallback注册的 VBlankCallback 回调。 图形服务在需要刷新显示时需要使能垂直同步信号,在收到VBlankCallback事件回调时再进行合成送显,不需要刷新显示时需要取消垂直同步信号。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| enabled | 输入参数,使能状态,true表示能,false表示不能。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### SetVirtualDisplayBuffer + + +``` +int32_t(* DeviceFuncs::SetVirtualDisplayBuffer) (uint32_t devId, BufferHandle *buffer, int32_t fence) +``` + +**描述:** + +设置虚拟屏的输出缓存。 + +该接口用于设置虚拟屏输出缓存,接口实现层需要将虚拟屏的输出放入到该缓存中,接口实现层需要等待同步栅栏发送信号后才能使用缓存。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| buffer | 输出参数,输出缓存。 | +| fence | 输出参数,同步栅栏。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](#disperrcode)。 + + +### stride + + +``` +int32_t ISurface::stride +``` + +**描述:** + +图像跨度 + + +### supportLayers + + +``` +uint32_t DisplayCapability::supportLayers +``` + +**描述:** + +支持的图层数 + + +### supportWriteBack + + +``` +bool DisplayCapability::supportWriteBack +``` + +**描述:** + +是否支持回写 + + +### time + + +``` +int64_t PresentTimestamp::time +``` + +**描述:** + +类型对应的值 + + +### type [1/3] + + +``` +LayerType LayerInfo::type +``` + +**描述:** + +图层类型,包括图形层、视频层和媒体播放模式 + + +### type [2/3] + + +``` +InterfaceType DisplayCapability::type +``` + +**描述:** + +显示屏接口类型 + + +### type [3/3] + + +``` +PresentTimestampType PresentTimestamp::type +``` + +**描述:** + +上屏时间戳类型 + + +### uOffset + + +``` +size_t __attribute__::uOffset +``` + +**描述:** + +U的偏移量 + + +### usage [1/2] + + +``` +uint64_t AllocInfo::usage +``` + +**描述:** + +申请内存的使用场景 + + +### usage [2/2] + + +``` +uint64_t VerifyAllocInfo::usage +``` + +**描述:** + +内存的用处 + + +### uvStep + + +``` +size_t __attribute__::uvStep +``` + +**描述:** + +UV的step信息 + + +### uvStride + + +``` +size_t __attribute__::uvStride +``` + +**描述:** + +UV的stride信息 + + +### value [1/2] + + +``` +uint64_t PropertyObject::value +``` + +**描述:** + +属性值 + + +### value [2/2] + + +``` +float HDRMetaData::value +``` + +**描述:** + +关键字对应的值 + + +### virAddr + + +``` +void* BufferData::virAddr +``` + +**描述:** + +虚拟内存地址 + + +### virtualDispCount + + +``` +uint32_t DisplayCapability::virtualDispCount +``` + +**描述:** + +支持的虚拟屏数 + + +### vOffset + + +``` +size_t __attribute__::vOffset +``` + +**描述:** + +V的偏移量 + + +### w + + +``` +int32_t IRect::w +``` + +**描述:** + +矩形框宽度 + + +### width [1/7] + + +``` +uint32_t DisplayInfo::width +``` + +**描述:** + +显示屏宽度 + + +### width [2/7] + + +``` +int32_t LayerInfo::width +``` + +**描述:** + +图层宽度 + + +### width [3/7] + + +``` +int32_t LayerBuffer::width +``` + +**描述:** + +buffer宽度 + + +### width [4/7] + + +``` +int32_t ISurface::width +``` + +**描述:** + +图像宽度 + + +### width [5/7] + + +``` +int32_t DisplayModeInfo::width +``` + +**描述:** + +像素宽度 + + +### width [6/7] + + +``` +uint32_t AllocInfo::width +``` + +**描述:** + +申请内存宽度 + + +### width [7/7] + + +``` +uint32_t VerifyAllocInfo::width +``` + +**描述:** + +分配内存的宽度 + + +### x [1/2] + + +``` +int32_t IRect::x +``` + +**描述:** + +矩形框起始x坐标 + + +### x [2/2] + + +``` +int32_t ICircle::x +``` + +**描述:** + +圆心x坐标 + + +### x0 + + +``` +int32_t ILine::x0 +``` + +**描述:** + +线条起点的x坐标 + + +### x1 + + +``` +int32_t ILine::x1 +``` + +**描述:** + +线条终点的x坐标 + + +### y [1/2] + + +``` +int32_t IRect::y +``` + +**描述:** + +矩形框起始y坐标 + + +### y [2/2] + + +``` +int32_t ICircle::y +``` + +**描述:** + +圆心y坐标r + + +### y0 + + +``` +int32_t ILine::y0 +``` + +**描述:** + +线条起点的y坐标 + + +### y1 + + +``` +int32_t ILine::y1 +``` + +**描述:** + +线条终点的y坐标 + + +### yOffset + + +``` +size_t __attribute__::yOffset +``` + +**描述:** + +Y的偏移量 + + +### yStride + + +``` +size_t __attribute__::yStride +``` + +**描述:** + +Y的stride信息 diff --git a/zh-cn/device-dev/reference/hdi-apis/_display_capability.md b/zh-cn/device-dev/reference/hdi-apis/_display_capability.md new file mode 100644 index 0000000000000000000000000000000000000000..a4a43e5cb58d12934ab7589b6e901c97b5a4c3c7 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_display_capability.md @@ -0,0 +1,31 @@ +# DisplayCapability + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [name](_display.md#name-22) [PROPERTY_NAME_LEN] | 显示设备名称 | +| [type](_display.md#type-23) | 显示屏接口类型 | +| [phyWidth](_display.md#phywidth) | 物理宽度 | +| [phyHeight](_display.md#phyheight) | 物理高度 | +| [supportLayers](_display.md#supportlayers) | 支持的图层数 | +| [virtualDispCount](_display.md#virtualdispcount) | 支持的虚拟屏数 | +| [supportWriteBack](_display.md#supportwriteback) | 是否支持回写 | +| [propertyCount](_display.md#propertycount) | 属性数组大小 | +| [props](_display.md#props) | 属性数组 | + + +## **详细描述** + +定义输出性能。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_display_info.md b/zh-cn/device-dev/reference/hdi-apis/_display_info.md new file mode 100644 index 0000000000000000000000000000000000000000..b67997b6de13b855cdea17de0987e37d70b233be --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_display_info.md @@ -0,0 +1,25 @@ +# DisplayInfo + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [width](_display.md#width-17) | 显示屏宽度 | +| [height](_display.md#height-17) | 显示屏高度 | +| [rotAngle](_display.md#rotangle) | 显示屏旋转角度 | + + +## **详细描述** + +定义显示信息结构体。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_display_mode_info.md b/zh-cn/device-dev/reference/hdi-apis/_display_mode_info.md new file mode 100644 index 0000000000000000000000000000000000000000..eafd58d19e35fad8b0a08e5389bd1ca9e34b1209 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_display_mode_info.md @@ -0,0 +1,26 @@ +# DisplayModeInfo + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [width](_display.md#width-57) | 像素宽度 | +| [height](_display.md#height-57) | 像素高度 | +| [freshRate](_display.md#freshrate) | 刷新速率 | +| [id](_display.md#id) | 模式ID | + + +## **详细描述** + +定义输出模式信息。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_enroll_param.md b/zh-cn/device-dev/reference/hdi-apis/_enroll_param.md new file mode 100644 index 0000000000000000000000000000000000000000..cc322e8336343a6499543a67f7ca6565cf3f29b3 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_enroll_param.md @@ -0,0 +1,72 @@ +# EnrollParam + + +## **概述** + +**所属模块:** + +[HdfUserAuth](_hdf_user_auth.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [authType](#authtype) | 用户认证凭据类型。 | +| [executorType](#executortype) | 执行器类型。 | +| [executorId](#executorsensorhint) | 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 | + + +## **详细描述** + +录入结果信息。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### authType + + +``` +enum AuthType EnrollParam::authType +``` + +**描述:** + +用户认证凭据类型。 + + +### executorSensorHint + + +``` +unsigned int EnrollParam::executorSensorHint +``` + +**描述:** + +既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 + + +### executorType + + +``` +unsigned int EnrollParam::executorType +``` + +**描述:** + +执行器类型。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_enroll_resultinfo.md b/zh-cn/device-dev/reference/hdi-apis/_enroll_resultinfo.md new file mode 100644 index 0000000000000000000000000000000000000000..a1213411c37768ce085514a640f8d89adc301a63 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_enroll_resultinfo.md @@ -0,0 +1,72 @@ +# EnrollResultInfo + + +## **概述** + +**所属模块:** + +[HdfUserAuth](_hdf_user_auth.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [credentialId](#credentialid) | 认证凭据ID。 | +| [oldInfo](#oldinfo) | 旧凭据信息。 | +| [rootSecret](#rootsecret) | 保护文件加密密钥的密钥。 | + + +## **详细描述** + +注册认证凭据参数。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### credentialId + + +``` +unsigned long EnrollResultInfo::credentialId +``` + +**描述:** + +认证凭据ID。 + + +### oldInfo + + +``` +struct CredentialInfo EnrollParam::oldInfo +``` + +**描述:** + +旧凭据信息{\@link CredentialInfo}。 + + +### rootSecret + + +``` +unsigned char[] EnrollParam::rootSecret +``` + +**描述:** + +保护文件加密密钥的密钥。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_enrolled_info.md b/zh-cn/device-dev/reference/hdi-apis/_enrolled_info.md new file mode 100644 index 0000000000000000000000000000000000000000..36c6ffd6e1e8e66e645074fd4fb3b81388059e14 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_enrolled_info.md @@ -0,0 +1,59 @@ +# EnrolledInfo + + +## **概述** + +**所属模块:** + +[HdfUserAuth](_hdf_user_auth.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [enrolledId](#enrolledid) | 注册ID,用户注册新的认证凭据时会更新注册ID。 | +| [authType](#authtype) | 用户认证凭据类型。 | + + +## **详细描述** + +注册信息。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### authType + + +``` +enum AuthType EnrolledInfo::authType +``` + +**描述:** + +用户认证凭据类型AuthType}。 + + +### enrolledId + + +``` +unsigned long EnrolledInfo::enrolledId +``` + +**描述:** + +注册ID,用户注册新的认证凭据时会更新注册ID。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_event_info.md b/zh-cn/device-dev/reference/hdi-apis/_event_info.md new file mode 100644 index 0000000000000000000000000000000000000000..02b70dc552b5ced6c3ed1b8f1cc995cce92fab1d --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_event_info.md @@ -0,0 +1,103 @@ +# EventInfo + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [appData](#appdata) | 设置回调时给入的上层实例。 | +| [appDataLen](#appdatalen) | appData字节数。 | +| [data1](#data1) | 事件上报携带的数据1。 | +| [data2](#data2) | 事件上报携带的数据2。 | +| [eventData](#eventdata) | 事件上报携带的数据信息。 | +| [eventDataLen](#eventdatalen) | eventData字节数。 | + + +## **详细描述** + +定义事件上报信息。 + + +## **类成员变量说明** + + +### appData + + +``` +int8_t* EventInfo::appData +``` + +**描述:** + +设置回调时给入的上层实例 + + +### appDataLen + + +``` +uint32_t EventInfo::appDataLen +``` + +**描述:** + +appData字节数 + + +### data1 + + +``` +uint32_t EventInfo::data1 +``` + +**描述:** + +事件上报携带的数据1 + + +### data2 + + +``` +uint32_t EventInfo::data2 +``` + +**描述:** + +事件上报携带的数据2 + + +### eventData + + +``` +int8_t* EventInfo::eventData +``` + +**描述:** + +事件上报携带的数据信息 + + +### eventDataLen + + +``` +uint32_t EventInfo::eventDataLen +``` + +**描述:** + +eventData字节数 diff --git a/zh-cn/device-dev/reference/hdi-apis/_event_package.md b/zh-cn/device-dev/reference/hdi-apis/_event_package.md new file mode 100644 index 0000000000000000000000000000000000000000..6ea01ee6fa3e3428bf43b1733edfcd778a850151 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_event_package.md @@ -0,0 +1,77 @@ +# EventPackage + + +## **概述** + +**所属模块:** + +[Input](_input.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [type](#type) | 输入事件的属性 | +| [code](#code) | 输入事件的特定编码项 | +| [value](#value) | 输入事件编码项对应的值 | +| [timestamp](#timestamp) | 输入事件对应的时间戳 | + + +## **详细描述** + +input事件数据包结构。 + + +## **类成员变量说明** + + +### code + + +``` +uint32_t EventPackage::code +``` + +**描述:** + +输入事件的特定编码项 + + +### timestamp + + +``` +uint64_t EventPackage::timestamp +``` + +**描述:** + +输入事件对应的时间戳 + + +### type + + +``` +uint32_t EventPackage::type +``` + +**描述:** + +输入事件的属性 + + +### value + + +``` +int32_t EventPackage::value +``` + +**描述:** + +输入事件编码项对应的值 diff --git a/zh-cn/device-dev/reference/hdi-apis/_executor_info.md b/zh-cn/device-dev/reference/hdi-apis/_executor_info.md new file mode 100644 index 0000000000000000000000000000000000000000..b769eeab63507075713a6b68f36eec417577bf81 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_executor_info.md @@ -0,0 +1,152 @@ +# ExecutorInfo + + +## **概述** + +**所属模块:** + +[HdfFaceAuth](_hdf_face_auth.md) | [HdfPinAuth](_hdf_pin_auth.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [sensorId](#sensorid) | 传感器ID,不同传感器在人脸/口令认证驱动内的唯一标识。 | +| [executorType](#executortype) | 执行器类型,根据执行器支持的能力/算法类型进行分类。 | +| [index](#index) | 用户认证框架的执行器索引。 | +| [executorRole](#executorrole) | 执行器角色ExecutorRole。 | +| [authType](#authtype) | 用户认证凭据类型。 | +| [esl](#esl) | 执行器安全等级。 | +| [publicKey](#publickey) | 执行器公钥,用于校验该执行器私钥签名的信息。 | +| [extraInfo](#extrainfo) | 其他相关信息,用于支持信息扩展。 | +| [info](#info) | 执行器注册信息ExecutorRegisterInfo。 | + + +## **详细描述** + +执行器信息。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### authType + + +``` +enum AuthType ExecutorInfo::authType +``` + +**描述:** + +用户认证凭据类型。 + + +### esl + + +``` +enum ExecutorSecureLevel ExecutorInfo::esl +``` + +**描述:** + +执行器安全等级ExecutorSecureLevel。 + + +### executorRole + + +``` +enum ExecutorRole ExecutorInfo::executorRole +``` + +**描述:** + +执行器角色ExecutorRole。 + + +### executorType + + +``` +unsigned int ExecutorInfo::executorType +``` + +**描述:** + +执行器类型,根据执行器支持的能力/算法类型进行分类。 + + +### extraInfo + + +``` +unsigned char [] ExecutorInfo::extraInfo +``` + +**描述:** + +其他相关信息,用于支持信息扩展。 + + +### index + + +``` +unsigned long ExecutorInfo::index +``` + +**描述:** + +用户认证框架的执行器索引。 + + +### info + + +``` +struct ExecutorRegisterInfo ExecutorInfo::info +``` + +**描述:** + +执行器注册信息ExecutorRegisterInfo。 + + +### publicKey + + +``` +unsigned char [] ExecutorInfo::publicKey +``` + +**描述:** + +执行器公钥,用于校验该执行器私钥签名的信息。 + + +### sensorId + + +``` +unsigned short ExecutorInfo::sensorId +``` + +**描述:** + +传感器ID,不同传感器在人脸认证驱动内的唯一标识。 + +传感器ID,不同传感器在口令认证驱动内的唯一标识。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_executor_register_info.md b/zh-cn/device-dev/reference/hdi-apis/_executor_register_info.md new file mode 100644 index 0000000000000000000000000000000000000000..85ba5209010fe793e063d5332cdc5c50a51df27c --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_executor_register_info.md @@ -0,0 +1,111 @@ +# ExecutorRegisterInfo + + +## **概述** + +**所属模块:** + +[HdfUserAuth](_hdf_user_auth.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [authType](#authtype) | 用户认证凭据类型。 | +| [executorRole](#executorrole) | 执行器角色ExecutorRole。 | +| [executorSensorHint](#executorsensorhint) | 既定用户认证凭据类型的执行器ID。 | +| [executorMatcher](#executormatcher) | 执行器类型,根据执行器支持的认证能力进行分类。 | +| [esl](#esl) | 执行器安全等级ExecutorSecureLevel。 | +| [publicKey](#publickey) | 执行器公钥,用于校验该执行器私钥签名的信息。 | + + +## **详细描述** + +执行器注册信息。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### authType + + +``` +enum AuthType ExecutorRegisterInfo::authType +``` + +**描述:** + +用户认证凭据类型。 + + +### esl + + +``` +enum ExecutorSecureLevel ExecutorRegisterInfo::esl +``` + +**描述:** + +执行器安全等级ExecutorSecureLevel。 + + +### executorSensorHint + + +``` +unsigned int ExecutorRegisterInfo::executorSensorHint +``` + +**描述:** + +既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 + + +### executorRole + + +``` +enum ExecutorRole ExecutorRegisterInfo::executorRole +``` + +**描述:** + +执行器角色ExecutorRole。 + + +### executorMatcher + + +``` +unsigned int ExecutorRegisterInfo::executorMatcher +``` + +**描述:** + +执行器匹配器,根据执行器支持的认证能力进行分类。 + + +### publicKey + + +``` +unsigned char [] ExecutorRegisterInfo::publicKey +``` + +**描述:** + +执行器公钥,用于校验该执行器私钥签名的信息。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_executor_send_msg.md b/zh-cn/device-dev/reference/hdi-apis/_executor_send_msg.md new file mode 100644 index 0000000000000000000000000000000000000000..90ed9fcc8933fe089cf35c374839e4168bf83f8c --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_executor_send_msg.md @@ -0,0 +1,70 @@ +# ExecutorSendMsg + + +## **概述** + +**所属模块:** + +[HdfUserAuth](_hdf_user_auth.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [executorIndex](#executorindex) | 用户认证框架的执行器索引。 | +| [commandId](#commandid) | 消息命令ID。 | +| [msg](#msg) | 执行器发送的消息。 | + + +## **详细描述** + +执行器发送的消息。 + +**Since:** + +3.2 + +**Version:** + + +## **类成员变量说明** + + +### executorIndex + + +``` +unsigned long ExecutorSendMsg::executorIndex +``` + +**描述:** + +用户认证框架的执行器索引。 + + +### commandId + + +``` +unsigned int ExecutorSendMsg::commandId +``` + +**描述:** + +消息命令ID。 + + +### msg + + +``` +unsigned char [] ExecutorSendMsg::msg +``` + +**描述:** + +执行器发送的消息。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_face_auth_types_8idl.md b/zh-cn/device-dev/reference/hdi-apis/_face_auth_types_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..b9c9e4ad7876f5796cd736e15b1ec3ae429eb4c1 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_face_auth_types_8idl.md @@ -0,0 +1,46 @@ +# FaceAuthTypes.idl + + +## **概述** + +**所属模块:** + +[HdfFaceAuth](_hdf_face_auth.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [ExecutorInfo](_executor_info.md) | 执行器信息。 [更多...](_executor_info.md) | +| [TemplateInfo](_template_info.md) | 凭据模版信息。 [更多...](_template_info.md) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [AuthType](_hdf_face_auth.md#authtype) : int { PIN = 1, FACE = 2, FINGERPRINT = 4 } | 枚举用户认证凭据类型。 [更多...](_hdf_face_auth.md#authtype) | +| [ExecutorRole](_hdf_face_auth.md#executorrole) : int { COLLECTOR = 1, VERIFIER = 2, ALL_IN_ONE = 3 } | 枚举执行器角色。 [更多...](_hdf_face_auth.md#executorrole) | +| [ExecutorSecureLevel](_hdf_face_auth.md#executorsecurelevel) : int { ESL0 = 0, ESL1 = 1, ESL2 = 2, ESL3 = 3 } | 枚举执行器安全等级。 [更多...](_hdf_face_auth.md#executorsecurelevel) | +| [CommandId](_hdf_face_auth.md#commandid) : int { LOCK_TEMPLATE = 1, UNLOCK_TEMPLATE = 2, VENDOR_COMMAND_BEGIN = 10000 } | 枚举人脸认证功能相关操作命令。 [更多...](_hdf_face_auth.md#commandid) | +| [FaceTipsCode](_hdf_face_auth.md#facetipscode) : int { FACE_AUTH_TIP_TOO_BRIGHT = 1, FACE_AUTH_TIP_TOO_DARK = 2, FACE_AUTH_TIP_TOO_CLOSE = 3, FACE_AUTH_TIP_TOO_FAR = 4,   FACE_AUTH_TIP_TOO_HIGH = 5, FACE_AUTH_TIP_TOO_LOW = 6, FACE_AUTH_TIP_TOO_RIGHT = 7, FACE_AUTH_TIP_TOO_LEFT = 8,   FACE_AUTH_TIP_TOO_MUCH_MOTION = 9, FACE_AUTH_TIP_POOR_GAZE = 10, FACE_AUTH_TIP_NOT_DETECTED = 11, VENDOR_FACE_AUTH_TIP_BEGIN = 10000 } | 枚举提示信息编码。 [更多...](_hdf_face_auth.md#facetipscode) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.face_auth.v1_0 | 人脸认证接口的包路径 | + + +## **详细描述** + +定义人脸认证驱动的枚举类和数据结构。 + +**Since:** + +3.2 diff --git a/zh-cn/device-dev/reference/hdi-apis/_get_buffer_handle_usage_params.md b/zh-cn/device-dev/reference/hdi-apis/_get_buffer_handle_usage_params.md new file mode 100644 index 0000000000000000000000000000000000000000..2f5936c9d16e2800eb9fd6718d7f18f552e99685 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_get_buffer_handle_usage_params.md @@ -0,0 +1,77 @@ +# GetBufferHandleUsageParams + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [size](#size) | 结构体大小 | +| [version](#version) | 组件版本信息 | +| [portIndex](#portindex) | 端口索引 | +| [usage](#usage) | 使用率 | + + +## **详细描述** + +BufferHandleUsage类型定义。 + + +## **类成员变量说明** + + +### portIndex + + +``` +uint32_t GetBufferHandleUsageParams::portIndex +``` + +**描述:** + +端口索引 + + +### size + + +``` +uint32_t GetBufferHandleUsageParams::size +``` + +**描述:** + +结构体大小 + + +### usage + + +``` +uint32_t GetBufferHandleUsageParams::usage +``` + +**描述:** + +usage + + +### version + + +``` +union OMX_VERSIONTYPE GetBufferHandleUsageParams::version +``` + +**描述:** + +组件版本信息 diff --git a/zh-cn/device-dev/reference/hdi-apis/_gfx_funcs.md b/zh-cn/device-dev/reference/hdi-apis/_gfx_funcs.md new file mode 100644 index 0000000000000000000000000000000000000000..76ed3097f7da3a13a35b00d4f791bfcf2ffa2ccf --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_gfx_funcs.md @@ -0,0 +1,239 @@ +# GfxFuncs + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [InitGfx](#initgfx) )(void) | 初始化硬件加速。 [更多...](#initgfx) | +| ( [DeinitGfx](#deinitgfx) )(void) | 去初始化硬件加速。 [更多...](#deinitgfx) | +| ( [FillRect](#fillrect) )([ISurface](_i_surface.md) \*surface, [IRect](_i_rect.md) \*rect, uint32_t color, [GfxOpt](_gfx_opt.md) \*opt) | 填充矩形,用一种颜色填充画布上指定矩形区域的矩形框。 [更多...](#fillrect) | +| ( [DrawRectangle](#drawrectangle) )([ISurface](_i_surface.md) \*surface, [Rectangle](_rectangle.md) \*rect, uint32_t color, [GfxOpt](_gfx_opt.md) \*opt) | 绘制矩形框,用一种颜色在画布上绘制指定区域的矩形框。 [更多...](#drawrectangle) | +| ( [DrawLine](#drawline) )([ISurface](_i_surface.md) \*surface, [ILine](_i_line.md) \*line, [GfxOpt](_gfx_opt.md) \*opt) | 绘制直线,使用一种颜色在画布上绘制一条直线。 [更多...](#drawline) | +| ( [DrawCircle](#drawcircle) )([ISurface](_i_surface.md) \*surface, [ICircle](_i_circle.md) \*circle, [GfxOpt](_gfx_opt.md) \*opt) | 绘制圆形,使用一种颜色在画布上绘制指定圆心和半径的圆。 [更多...](#drawcircle) | +| ( [Blit](#blit) )([ISurface](_i_surface.md) \*srcSurface, [IRect](_i_rect.md) \*srcRect, [ISurface](_i_surface.md) \*dstSurface, [IRect](_i_rect.md) \*dstRect, [GfxOpt](_gfx_opt.md) \*opt) | 位图搬移 [更多...](#blit) | +| ( [Sync](#sync) )(int32_t timeOut) | 硬件加速同步。 [更多...](#sync) | + + +## **详细描述** + +显示硬件加速驱动接口结构体,定义硬件加速驱动接口函数指针。 + + +## **类成员变量说明** + + +### Blit + + +``` +int32_t(* GfxFuncs::Blit) (ISurface *srcSurface, IRect *srcRect, ISurface *dstSurface, IRect *dstRect, GfxOpt *opt) +``` + +**描述:** + +位图搬移 + +在位图搬移过程中,可以实现色彩空间转换、缩放、旋转等功能。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| srcSurface | 输入参数,源位图信息。 | +| srcRect | 输入参数,源位图搬移区域。 | +| dstSurface | 输出参数,目标位图信息。 | +| dstRect | 输出参数,目标位图区域。 | +| opt | 输入参数,硬件加速选项。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### DeinitGfx + + +``` +int32_t(* GfxFuncs::DeinitGfx) (void) +``` + +**描述:** + +去初始化硬件加速。 + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[InitGfx](#initgfx) + + +### DrawCircle + + +``` +int32_t(* GfxFuncs::DrawCircle) (ISurface *surface, ICircle *circle, GfxOpt *opt) +``` + +**描述:** + +绘制圆形,使用一种颜色在画布上绘制指定圆心和半径的圆。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| surface | 输入参数,画布。 | +| circle | 输入参数,圆形结构。 | +| opt | 输入参数,硬件加速选项。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### DrawLine + + +``` +int32_t(* GfxFuncs::DrawLine) (ISurface *surface, ILine *line, GfxOpt *opt) +``` + +**描述:** + +绘制直线,使用一种颜色在画布上绘制一条直线。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| surface | 输入参数,画布。 | +| line | 输入参数,直线结构。 | +| opt | 输入参数,硬件加速选项。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### DrawRectangle + + +``` +int32_t(* GfxFuncs::DrawRectangle) (ISurface *surface, Rectangle *rect, uint32_t color, GfxOpt *opt) +``` + +**描述:** + +绘制矩形框,用一种颜色在画布上绘制指定区域的矩形框。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| surface | 输入参数,画布。 | +| rect | 输入参数,矩形框结构。 | +| color | 输入参数,绘制的颜色。 | +| opt | 输入参数,硬件加速选项。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### FillRect + + +``` +int32_t(* GfxFuncs::FillRect) (ISurface *surface, IRect *rect, uint32_t color, GfxOpt *opt) +``` + +**描述:** + +填充矩形,用一种颜色填充画布上指定矩形区域的矩形框。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| surface | 输入参数,画布。 | +| rect | 输入参数,填充的矩形区域。 | +| color | 输入参数,填充的颜色。 | +| opt | 输入参数,硬件加速选项。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### InitGfx + + +``` +int32_t(* GfxFuncs::InitGfx) (void) +``` + +**描述:** + +初始化硬件加速。 + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[DeinitGfx](#deinitgfx) + + +### Sync + + +``` +int32_t(* GfxFuncs::Sync) (int32_t timeOut) +``` + +**描述:** + +硬件加速同步。 + +在使用硬件加速模块进行图像绘制、图像叠加、图像搬移时,通过调用该接口进行硬件同步,该接口会等待硬件加速完成。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| timeOut | 输入参数,硬件加速同步超时设置,设置为0表示无超时,等待直到硬件加速完成。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_gfx_opt.md b/zh-cn/device-dev/reference/hdi-apis/_gfx_opt.md new file mode 100644 index 0000000000000000000000000000000000000000..00fdaa09fd517f09213a136e8ab126a907c73b02 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_gfx_opt.md @@ -0,0 +1,33 @@ +# GfxOpt + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [enGlobalAlpha](_display.md#englobalalpha-22) | 全局alpha使能标志 | +| [globalAlpha](_display.md#globalalpha) | 全局alpha的值 | +| [enPixelAlpha](_display.md#enpixelalpha-22) | 像素alpha使能标志 | +| [blendType](_display.md#blendtype) | 混合方式 | +| [colorKeyFrom](_display.md#colorkeyfrom) | 色键模式 | +| [enableRop](_display.md#enablerop) | Rop功能使能位 | +| [colorRopType](_display.md#colorroptype) | 颜色的Rop类型 | +| [alphaRopType](_display.md#alpharoptype) | Alpha的Rop类型 | +| [enableScale](_display.md#enablescale) | 缩放功能使能位 | +| [rotateType](_display.md#rotatetype) | 旋转类型 | +| [mirrorType](_display.md#mirrortype) | 镜像类型 | + + +## **详细描述** + +图像硬件加速相关的操作选项结构体定义,用于图像硬件加速时的操作选项。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_gralloc_funcs.md b/zh-cn/device-dev/reference/hdi-apis/_gralloc_funcs.md new file mode 100644 index 0000000000000000000000000000000000000000..d67c99a3dd81c1e4afa35a157c5b43538d65f4c1 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_gralloc_funcs.md @@ -0,0 +1,273 @@ +# GrallocFuncs + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [AllocMem](#allocmem) )(const [AllocInfo](_alloc_info.md) \*info, BufferHandle \*\*handle) | 显示内存分配。 [更多...](#allocmem) | +| ( [FreeMem](#freemem) )(BufferHandle \*handle) | 显示内存释放。 [更多...](#freemem) | +| ( [Mmap](#mmap) )(BufferHandle \*handle) | 显示内存映射,将内存映射到对应的进程地址空间中。 [更多...](#mmap) | +| ( [MmapYUV](#mmapyuv) )(BufferHandle \*handle, YUVDescInfo \*info) | YUV 内存映射。 [更多...](#mmapyuv) | +| ( [MmapCache](#mmapcache) )(BufferHandle \*handle) | 显示内存映射,将内存映射为 cache 内存到对应的进程地址空间中。 [更多...](#mmapcache) | +| ( [Unmap](#unmap) )(BufferHandle \*handle) | 内存反映射,将内存进行反映射。 [更多...](#unmap) | +| ( [FlushCache](#flushcache) )(BufferHandle \*handle) | 刷新cache,刷新cache里的内容到内存并且使cache里的内容无效。 [更多...](#flushcache) | +| ( [FlushMCache](#flushmcache) )(BufferHandle \*handle) | 刷新Mmap映射的cache,刷新Mmap映射的cache里的内容到内存并且使cache里的内容无效。 [更多...](#flushmcache) | +| ( [InvalidateCache](#invalidatecache) )(BufferHandle \*handle) | 使cache中的内容无效用以存储更新内存内容。 [更多...](#invalidatecache) | +| ( [IsSupportedAlloc](#issupportedalloc) )(uint32_t num, const [VerifyAllocInfo](_verify_alloc_info.md) \*infos, bool \*supporteds) | 检测给定的VerifyAllocInfo数组信息能否申请内存成功。 [更多...](#issupportedalloc) | + + +## **详细描述** + +显示内存驱动接口结构体,定义显示内存驱动接口函数指针。 + + +## **类成员变量说明** + + +### AllocMem + + +``` +int32_t(* GrallocFuncs::AllocMem) (const AllocInfo *info, BufferHandle **handle) +``` + +**描述:** + +显示内存分配。 + +根据GUI图形系统传递的参数分配内存,分配的内存根据类型可分为共享内存、cache内存和非cache内存等。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| info | 输入参数,指示申请内存AllocInfo信息. | +| handle | 输入参数,指向申请的内存handle指针。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### FlushCache + + +``` +int32_t(* GrallocFuncs::FlushCache) (BufferHandle *handle) +``` + +**描述:** + +刷新cache,刷新cache里的内容到内存并且使cache里的内容无效。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 输出参数,待刷新cache的handle指针。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### FlushMCache + + +``` +int32_t(* GrallocFuncs::FlushMCache) (BufferHandle *handle) +``` + +**描述:** + +刷新Mmap映射的cache,刷新Mmap映射的cache里的内容到内存并且使cache里的内容无效。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 输出参数,待刷新cache的handle指针。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### FreeMem + + +``` +void(* GrallocFuncs::FreeMem) (BufferHandle *handle) +``` + +**描述:** + +显示内存释放。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 输入参数,待释放的内存handle指针。 | + +**返回:** + +成功返回有效地址,失败返回NULL。 + + +### InvalidateCache + + +``` +int32_t(* GrallocFuncs::InvalidateCache) (BufferHandle *handle) +``` + +**描述:** + +使cache中的内容无效用以存储更新内存内容。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 输出参数,待无效cache的handle指针。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### IsSupportedAlloc + + +``` +int32_t(* GrallocFuncs::IsSupportedAlloc) (uint32_t num, const VerifyAllocInfo *infos, bool *supporteds) +``` + +**描述:** + +检测给定的VerifyAllocInfo数组信息能否申请内存成功。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| num | 输入参数,VerifyAllocInfo数组个数。 | +| infos | 输出参数,VerifyAllocInfo数组首地址。 | +| supporteds | 输出参数,supporteds数组首地址, 表示能否申请成功。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### Mmap + + +``` +void*(* GrallocFuncs::Mmap) (BufferHandle *handle) +``` + +**描述:** + +显示内存映射,将内存映射到对应的进程地址空间中。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 输入参数,待映射内存handle指针。 | + +**返回:** + +成功返回有效地址,失败返回NULL。 + + +### MmapCache + + +``` +void*(* GrallocFuncs::MmapCache) (BufferHandle *handle) +``` + +**描述:** + +显示内存映射,将内存映射为 cache 内存到对应的进程地址空间中。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 输出参数,待映射内存 handle 指针。 | + +**返回:** + +成功返回有效地址,失败返回 NULL。 + + +### MmapYUV + + +``` +void*(* GrallocFuncs::MmapYUV) (BufferHandle *handle, YUVDescInfo *info) +``` + +**描述:** + +YUV 内存映射。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 输出参数,指示内存映射的输出缓存。 | +| info | 输出参数,指示内存映射的YUVDescInfo信息。 | + +**返回:** + +成功返回有效地址,失败返回 NULL。 + + +### Unmap + + +``` +int32_t(* GrallocFuncs::Unmap) (BufferHandle *handle) +``` + +**描述:** + +内存反映射,将内存进行反映射。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| handle | 输出参数,待反映射内存handle指针。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_h_d_r_capability.md b/zh-cn/device-dev/reference/hdi-apis/_h_d_r_capability.md new file mode 100644 index 0000000000000000000000000000000000000000..08d19bbbbfe355000de3b0421183a4a8f1eb73da --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_h_d_r_capability.md @@ -0,0 +1,27 @@ +# HDRCapability + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [formatCount](_display.md#formatcount) | 支持的HDR格式的数量 | +| [formats](_display.md#formats) | 支持的HDR格式的数组首地址 | +| [maxLum](_display.md#maxlum) | 最大的光亮度luminance值 | +| [maxAverageLum](_display.md#maxaveragelum) | 最大的平均光亮度luminance值 | +| [minLum](_display.md#minlum) | 最小的光亮度luminance值 | + + +## **详细描述** + +HDR属性结构体定义。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_h_d_r_meta_data.md b/zh-cn/device-dev/reference/hdi-apis/_h_d_r_meta_data.md new file mode 100644 index 0000000000000000000000000000000000000000..d20665318f9555957e07bac0617c2f65e6f5586f --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_h_d_r_meta_data.md @@ -0,0 +1,24 @@ +# HDRMetaData + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [key](_display.md#key) | HDR元数据关键字。 | +| [value](_display.md#value-22) | 关键字对应的值。 | + + +## **详细描述** + +HDR元数据结构体定义。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_hdf_face_auth.md b/zh-cn/device-dev/reference/hdi-apis/_hdf_face_auth.md new file mode 100644 index 0000000000000000000000000000000000000000..742e19ca1cb15f5562d8a22f65651c69e2250123 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_hdf_face_auth.md @@ -0,0 +1,157 @@ +# HdfFaceAuth + + +## **汇总** + + +### 文件 + + | 文件 | 描述 | +| -------- | -------- | +| [FaceAuthTypes.idl](_face_auth_types_8idl.md) | 定义人脸认证驱动的枚举类和数据结构。 | +| [IExecutor.idl](face__auth_2_i_executor_8idl.md) | 定义执行器接口,用于获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 | +| [IExecutorCallback.idl](face__auth_2_i_executor_callback_8idl.md) | 定义异步API接口回调,用于返回异步接口的请求处理结果和信息。 | +| [IFaceAuthInterface.idl](_i_face_auth_interface_8idl.md) | 定义获取人脸认证驱动的执行器列表接口,用于从人脸认证驱动获取执行器对象列表。 | + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [ExecutorInfo](_executor_info.md) | 执行器信息。 [更多...](_executor_info.md) | +| [TemplateInfo](_template_info.md) | 凭据模版信息。 [更多...](_template_info.md) | +| [IExecutor](interface_i_executor.md) | 定义执行器接口,用于获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 [更多...](interface_i_executor.md) | +| [IExecutorCallback](interface_i_executor_callback.md) | 定义异步API接口回调,用于返回异步接口的请求处理结果和信息。使用细节见[IExecutor](interface_i_executor.md)。 [更多...](interface_i_executor_callback.md) | +| [IFaceAuthInterface](interface_i_face_auth_interface.md) | 定义获取人脸认证驱动的执行器列表接口。 [更多...](interface_i_face_auth_interface.md) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [AuthType](#authtype) : int { PIN = 1, FACE = 2, FINGERPRINT = 4 } | 枚举用户认证凭据类型。 [更多...](#authtype) | +| [ExecutorRole](#executorrole) : int { COLLECTOR = 1, VERIFIER = 2, ALL_IN_ONE = 3 } | 枚举执行器角色。 [更多...](#executorrole) | +| [ExecutorSecureLevel](#executorsecurelevel) : int { ESL0 = 0, ESL1 = 1, ESL2 = 2, ESL3 = 3 } | 枚举执行器安全等级。 [更多...](#executorsecurelevel) | +| [CommandId](#commandid) : int { LOCK_TEMPLATE = 1, UNLOCK_TEMPLATE = 2, VENDOR_COMMAND_BEGIN = 10000 } | 枚举人脸认证功能相关操作命令。 [更多...](#commandid) | +| [FaceTipsCode](#facetipscode) : int { FACE_AUTH_TIP_TOO_BRIGHT = 1, FACE_AUTH_TIP_TOO_DARK = 2, FACE_AUTH_TIP_TOO_CLOSE = 3, FACE_AUTH_TIP_TOO_FAR = 4,   FACE_AUTH_TIP_TOO_HIGH = 5, FACE_AUTH_TIP_TOO_LOW = 6, FACE_AUTH_TIP_TOO_RIGHT = 7, FACE_AUTH_TIP_TOO_LEFT = 8,   FACE_AUTH_TIP_TOO_MUCH_MOTION = 9, FACE_AUTH_TIP_POOR_GAZE = 10, FACE_AUTH_TIP_NOT_DETECTED = 11, VENDOR_FACE_AUTH_TIP_BEGIN = 10000 } | 枚举提示信息编码。 [更多...](#facetipscode) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.face_auth.v1_0 | 人脸认证接口的包路径 | + + +## **详细描述** + +提供人脸认证驱动的标准API接口。 + +人脸认证驱动为人脸认证服务提供统一的访问接口。获取人脸认证驱动代理后,人脸认证服务可以调用相关接口获取执行器,获取人脸认证执行器后, 人脸认证服务可以调用相关接口获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 + +**Since:** + +3.2 + + +## **枚举类型说明** + + +### AuthType + + +``` +enum AuthType : int +``` + +**描述:** + +枚举用户认证凭据类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| PIN | 认证凭据类型为口令。 | +| FACE | 认证凭据类型为人脸。 | +| FINGERPRINT | 认证凭据类型为指纹。 | + + +### CommandId + + +``` +enum CommandId : int +``` + +**描述:** + +枚举人脸认证功能相关操作命令。 + + | 枚举值 | 描述 | +| -------- | -------- | +| LOCK_TEMPLATE | 锁定人脸模版。 | +| UNLOCK_TEMPLATE | 解锁人脸模版。 | +| VENDOR_COMMAND_BEGIN | 用于厂商自定义操作指令。 | + + +### ExecutorRole + + +``` +enum ExecutorRole : int +``` + +**描述:** + +枚举执行器角色。 + + | 枚举值 | 描述 | +| -------- | -------- | +| COLLECTOR | 执行器角色为采集器,提供用户认证时的数据采集能力,需要和认证器配合完成用户认证。 | +| VERIFIER | 执行器角色为认证器,提供用户认证时数据处理能力,读取存储凭据模板信息并完成比对。 | +| ALL_IN_ONE | 执行器角色为全功能执行器,可提供用户认证数据采集、处理、储存及比对能力。 | + + +### ExecutorSecureLevel + + +``` +enum ExecutorSecureLevel : int +``` + +**描述:** + +枚举执行器安全等级。 + + | 枚举值 | 描述 | +| -------- | -------- | +| ESL0 | 执行器安全级别为0,关键操作在无访问控制执行环境中完成。 | +| ESL1 | 执行器安全级别为1,关键操作在有访问控制的执行环境中完成。 | +| ESL2 | 执行器安全级别为2,关键操作在可信执行环境中完成。 | +| ESL3 | 执行器安全级别为3,关键操作在高安环境如独立安全芯片中完成。 | + + +### FaceTipsCode + + +``` +enum FaceTipsCode : int +``` + +**描述:** + +枚举提示信息编码。 + + | 枚举值 | 描述 | +| -------- | -------- | +| FACE_AUTH_TIP_TOO_BRIGHT | 获取的人脸图像由于光照度高而过亮。 | +| FACE_AUTH_TIP_TOO_DARK | 获取的人脸图像由于光照度低而过暗。 | +| FACE_AUTH_TIP_TOO_CLOSE | 人脸离设备过近。 | +| FACE_AUTH_TIP_TOO_FAR | 人脸离设备过远。 | +| FACE_AUTH_TIP_TOO_HIGH | 设备过高,只拍到人脸的上半部分。 | +| FACE_AUTH_TIP_TOO_LOW | 设备过低,只拍到人脸的下半部分。 | +| FACE_AUTH_TIP_TOO_RIGHT | 设备偏右,只拍到人脸的右侧部分。 | +| FACE_AUTH_TIP_TOO_LEFT | 设备偏左,只拍到人脸的左侧部分。 | +| FACE_AUTH_TIP_TOO_MUCH_MOTION | 人脸信息采集过程中,人脸移动过多。 | +| FACE_AUTH_TIP_POOR_GAZE | 用户未注视设备。 | +| FACE_AUTH_TIP_NOT_DETECTED | 未检测到人脸。 | +| VENDOR_FACE_AUTH_TIP_BEGIN | 用于厂商自定义提示信息。 | diff --git a/zh-cn/device-dev/reference/hdi-apis/_hdf_pin_auth.md b/zh-cn/device-dev/reference/hdi-apis/_hdf_pin_auth.md new file mode 100644 index 0000000000000000000000000000000000000000..a26f8a42ad9a53c376a467a8572c671d672d628f --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_hdf_pin_auth.md @@ -0,0 +1,127 @@ +# HdfPinAuth + + +## **汇总** + + +### 文件 + + | 文件 | 描述 | +| -------- | -------- | +| [IExecutor.idl](pin__auth_2_i_executor_8idl.md) | 定义执行器标准API接口。接口可用于获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 | +| [IExecutorCallback.idl](pin__auth_2_i_executor_callback_8idl.md) | 定义异步API接口回调,用于返回异步接口的请求处理结果和获取信息。 | +| [IPinAuthInterface.idl](_i_pin_auth_interface_8idl.md) | 定义获取口令认证驱动的执行器列表接口,用于从口令认证驱动获取执行器对象列表。 | +| [PinAuthTypes.idl](_pin_auth_types_8idl.md) | 定义口令认证驱动的枚举类和数据结构。 | + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IExecutor](interface_pin_i_executor.md) | 定义执行器标准API接口。接口可用于获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。[更多...](interface_pin_i_executor.md) | +| [IExecutorCallback](interface_i_executor_callback.md) | 定义异步API接口回调,用于返回异步接口的请求处理结果和信息。使用细节见[IExecutor](interface_i_executor.md)。 [更多...](interface_i_executor_callback.md) | +| [IPinAuthInterface](interface_i_pin_auth_interface.md) | 定义获取口令认证驱动的执行器列表接口。 [更多...](interface_i_pin_auth_interface.md) | +| [ExecutorInfo](_executor_info.md) | 执行器信息。 [更多...](_executor_info.md) | +| [TemplateInfo](_template_info.md) | 凭据模版信息。 [更多...](_template_info.md) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [AuthType](#authtype) : int {   PIN = 1, FACE = 2, FINGERPRINT = 4 } | 枚举用户认证凭据类型。 [更多...](#authtype) | +| [ExecutorRole](#executorrole) : int {   COLLECTOR = 1, VERIFIER = 2, ALL_IN_ONE = 3 } | 枚举执行器角色。 [更多...](#executorrole) | +| [ExecutorSecureLevel](#executorsecurelevel) : int {   ESL0 = 0, ESL1 = 1, ESL2 = 2, ESL3 = 3 } | 枚举执行器安全等级。 [更多...](#executorsecurelevel) | +| [CommandId](#commandid) : int { DEFAULT = 0 } | 枚举口令认证相关功能操作命令。 [更多...](#commandid) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.pin_auth.v1_0 | 口令认证接口的包路径 | + + +## **详细描述** + +提供口令认证驱动的标准API接口。 + +口令认证驱动为口令认证服务提供统一的访问接口。获取口令认证驱动代理后,口令认证服务可以调用相关接口获取执行器,获取口令认证执行器后, 口令认证服务可以调用相关接口获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 + +**Since:** + +3.2 + + +## **枚举类型说明** + + +### AuthType + + +``` +enum AuthType : int +``` + +**描述:** + +枚举用户认证凭据类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| PIN | 认证凭据类型为口令。 | +| FACE | 认证凭据类型为人脸。 | +| FINGERPRINT | 认证凭据类型为指纹。 | + + +### CommandId + + +``` +enum CommandId : int +``` + +**描述:** + +枚举口令认证相关功能操作命令。 + + | 枚举值 | 描述 | +| -------- | -------- | +| DEFAULT | 默认无效操作命令。 | + + +### ExecutorRole + + +``` +enum ExecutorRole : int +``` + +**描述:** + +枚举执行器角色。 + + | 枚举值 | 描述 | +| -------- | -------- | +| COLLECTOR | 执行器角色为采集器,提供用户认证时的数据采集能力,需要和认证器配合完成用户认证。 | +| VERIFIER | 执行器角色为认证器,提供用户认证时数据处理能力,读取存储凭据模板信息并完成比对。 | +| ALL_IN_ONE | 执行器角色为全功能执行器,可提供用户认证数据采集、处理、储存及比对能力。 | + + +### ExecutorSecureLevel + + +``` +enum ExecutorSecureLevel : int +``` + +**描述:** + +枚举执行器安全等级。 + + | 枚举值 | 描述 | +| -------- | -------- | +| ESL0 | 执行器安全级别为0,关键操作在无访问控制执行环境中完成。 | +| ESL1 | 执行器安全级别为1,关键操作在有访问控制的执行环境中完成。 | +| ESL2 | 执行器安全级别为2,关键操作在可信执行环境中完成。 | +| ESL3 | 执行器安全级别为3,关键操作在高安环境如独立安全芯片中完成。 | diff --git a/zh-cn/device-dev/reference/hdi-apis/_hdf_thermal_callback_info.md b/zh-cn/device-dev/reference/hdi-apis/_hdf_thermal_callback_info.md new file mode 100644 index 0000000000000000000000000000000000000000..5652e991ce997a3b1c53d18467dc185f278e806d --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_hdf_thermal_callback_info.md @@ -0,0 +1,38 @@ +# HdfThermalCallbackInfo + + +## **概述** + +**所属模块:** + +[Thermal](thermal.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [info](#info) | 设备发热的信息列表。 | + + +## **详细描述** + +设备发热的信息列表。 + + +## **类成员变量说明** + + +### info + + +``` +List HdfThermalCallbackInfo::info +``` + +**描述:** + +设备发热的信息列表。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_hdf_user_auth.md b/zh-cn/device-dev/reference/hdi-apis/_hdf_user_auth.md new file mode 100644 index 0000000000000000000000000000000000000000..7b93380140382a5522d28ffdda3726ff2af4ffc7 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_hdf_user_auth.md @@ -0,0 +1,115 @@ +# HdfUserAuth + + +## **汇总** + + +### 文件 + + | 文件 | 描述 | +| -------- | -------- | +| [IUserAuthInterface.idl](_i_user_auth_interface_8idl.md) | 声明用户认证驱动的API接口。接口可用于注册执行器,管理用户认证凭据,完成PIN码和生物特征认证。 | +| [UserAuthTypes.idl](_user_auth_types_8idl.md) | 定义用户认证驱动的枚举类和数据结构。 | + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IUserAuthInterface](interface_i_user_auth_interface.md) | 声明用户认证驱动的API接口。 [更多...](interface_i_user_auth_interface.md) | +| [ExecutorRegisterInfo](_executor_register_info.md) | 执行器注册信息。 [更多...](_executor_register_info.md) | +| [ExecutorInfo](_user_executor_info.md) | 执行器信息。 [更多...](_user_executor_info.md) | +| [ScheduleInfo](_schedule_info.md) | 调度信息。 [更多...](_schedule_info.md) | +| [AuthSolution](_auth_solution.md) | 认证方案。 [更多...](_auth_solution.md) | +| [ExecutorSendMsg](_executor_send_msg.md) | 执行器发送的消息。 [更多...](_executor_send_msg.md) | +| [AuthResultInfo](_auth_result_info.md) | 用户身份认证结果信息。 [更多...](_auth_result_info.md) | +| [IdentifyResultInfo](_identify_result_info.md) | 用户身份识别结果信息。 [更多...](_identify_result_info.md) | +| [EnrollParam](_enroll_param.md) | 注册认证凭据参数。 [更多...](_enroll_param.md) | +| [CredentialInfo](_credential_info.md) | 认证凭据信息。 [更多...](_credential_info.md) | +| [EnrolledInfo](_enrolled_info.md) | 注册信息。 [更多...](_enrolled_info.md) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [AuthType](#authtype) : int {   PIN = 1, FACE = 2, FINGERPRINT = 4, ALL = 0 } | 枚举用户认证凭据类型。 [更多...](#authtype) | +| [ExecutorRole](#executorrole) : int {   COLLECTOR = 1, VERIFIER = 2, ALL_IN_ONE = 3 } | 枚举执行器角色。 [更多...](#executorrole) | +| [ExecutorSecureLevel](#executorsecurelevel) : int {   ESL0 = 0, ESL1 = 1, ESL2 = 2, ESL3 = 3 } | 枚举执行器安全等级。 [更多...](#executorsecurelevel) | + + +### 变量 + + | 变量 | 描述 | +| -------- | -------- | +| package ohos.hdi.user_auth.v1_0 | 用户认证接口的包路径 | + + +## **详细描述** + +提供用户认证驱动的标准API接口。 + +用户认证驱动为用户认证服务提供统一的访问接口。获取用户认证驱动代理后,用户认证服务可以调用相关接口注册执行器,管理用户认证凭据, 完成PIN码和生物特征。 + +**Since:** + +3.2 + + +## **枚举类型说明** + + +### AuthType + + +``` +enum AuthType : int +``` + +**描述:** + +枚举用户认证凭据类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| PIN | 认证凭据类型为口令。 | +| FACE | 认证凭据类型为人脸。 | +| FINGERPRINT | 认证凭据类型为指纹。 | +| ALL | 表示包含所有认证凭据类型。 | + + +### ExecutorRole + + +``` +enum ExecutorRole : int +``` + +**描述:** + +枚举执行器角色。 + + | 枚举值 | 描述 | +| -------- | -------- | +| COLLECTOR | 执行器角色为采集器,提供用户认证时的数据采集能力,需要和认证器配合完成用户认证。 | +| VERIFIER | 执行器角色为认证器,提供用户认证时数据处理能力,读取存储凭据模板信息并完成比对。 | +| ALL_IN_ONE | 执行器角色为全功能执行器,可提供用户认证数据采集、处理、储存及比对能力。 | + + +### ExecutorSecureLevel + + +``` +enum ExecutorSecureLevel : int +``` + +**描述:** + +枚举执行器安全等级。 + + | 枚举值 | 描述 | +| -------- | -------- | +| ESL0 | 执行器安全级别为0,关键操作在无访问控制执行环境中完成。 | +| ESL1 | 执行器安全级别为1,关键操作在有访问控制的执行环境中完成。 | +| ESL2 | 执行器安全级别为2,关键操作在可信执行环境中完成。 | +| ESL3 | 执行器安全级别为3,关键操作在高安环境如独立安全芯片中完成。 | diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_battery_callback_8idl.md b/zh-cn/device-dev/reference/hdi-apis/_i_battery_callback_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..96897505990ce8d3b82c7a6d27b6f0f21cfb6cb5 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_battery_callback_8idl.md @@ -0,0 +1,40 @@ +# IBatteryCallback.idl + + +## **概述** + +**所属模块:** + +[Battery](battery.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IBatteryCallback](interface_i_battery_callback.md) | 电池信息的回调。 [更多...](interface_i_battery_callback.md) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.battery.v1_0 | 电池信息接口的包路径 | + + +## **详细描述** + +电池信息的回调。 + +电池模块为电池服务提供的订阅电池信息变化的回调。 + +**Since:** + +3.1 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_battery_interface_8idl.md b/zh-cn/device-dev/reference/hdi-apis/_i_battery_interface_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..7a4a80ad0cd4c4d46a7afd72724c1fc404b56903 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_battery_interface_8idl.md @@ -0,0 +1,36 @@ +# IBatteryInterface.idl + + +## **概述** + +**所属模块:** + +[Battery](battery.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IBatteryInterface](interface_i_battery_interface.md) | 获取、订阅电池信息的接口。 [更多...](interface_i_battery_interface.md) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.battery.v1_0 | 电池信息接口的包路径 | + + +## **详细描述** + +获取、订阅电池信息的接口。 + +服务获取此对象后,可以调用相关的接口获取、订阅电池信息。 + +**Since:** + +3.1 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_circle.md b/zh-cn/device-dev/reference/hdi-apis/_i_circle.md new file mode 100644 index 0000000000000000000000000000000000000000..1bc7edaa14025dad5c55d757af5ac06dbeb04bc4 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_circle.md @@ -0,0 +1,26 @@ +# ICircle + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [x](_display.md#x-22) | 矩形框起始X坐标。 | +| [y](_display.md#y-22) | 矩形框起始Y坐标。 | +| [r](_display.md#r) | 圆的半径。 | +| [color](_display.md#color-23) | 圆的颜色。 | + + +## **详细描述** + +圆形描述结构体定义,用于硬件加速绘制圆形。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_face_auth_interface_8idl.md b/zh-cn/device-dev/reference/hdi-apis/_i_face_auth_interface_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..3776682000f467549f40f0f7bfb4d606a56ccb9c --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_face_auth_interface_8idl.md @@ -0,0 +1,34 @@ +# IFaceAuthInterface.idl + + +## **概述** + +**所属模块:** + +[HdfFaceAuth](_hdf_face_auth.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IFaceAuthInterface](interface_i_face_auth_interface.md) | 定义获取人脸认证驱动的执行器列表接口。 [更多...](interface_i_face_auth_interface.md) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.face_auth.v1_0 | 人脸认证接口的包路径 | + + +## **详细描述** + +定义获取人脸认证驱动的执行器列表接口,用于从人脸认证驱动获取执行器对象列表。 + +**Since:** + +3.2 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_input_interface.md b/zh-cn/device-dev/reference/hdi-apis/_i_input_interface.md new file mode 100644 index 0000000000000000000000000000000000000000..d2308b6bd9da78210c7a2c186fadac3d09bff0e3 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_input_interface.md @@ -0,0 +1,64 @@ +# IInputInterface + + +## **概述** + +**所属模块:** + +[Input](_input.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [iInputManager](#iinputmanager) | input设备的设备管理接口。 | +| [iInputController](#iinputcontroller) | input设备的业务控制接口。 | +| [iInputReporter](#iinputreporter) | input设备的数据上报接口。 | + + +## **详细描述** + +定义用于提供输入设备驱动能力的接口。 + + +## **类成员变量说明** + + +### iInputController + + +``` +InputController* IInputInterface::iInputController +``` + +**描述:** + +input设备的业务控制接口 + + +### iInputManager + + +``` +InputManager* IInputInterface::iInputManager +``` + +**描述:** + +input设备的设备管理接口 + + +### iInputReporter + + +``` +InputReporter* IInputInterface::iInputReporter +``` + +**描述:** + +input设备的数据上报接口 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_line.md b/zh-cn/device-dev/reference/hdi-apis/_i_line.md new file mode 100644 index 0000000000000000000000000000000000000000..ee33cb7f530956d58f511b68858c0770d7530ce6 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_line.md @@ -0,0 +1,27 @@ +# ILine + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [x0](_display.md#x0) | 线条起点的X坐标。 | +| [y0](_display.md#y0) | 线条起点的Y坐标。 | +| [x1](_display.md#x1) | 线条终点的X坐标。 | +| [y1](_display.md#y1) | 线条终点的Y坐标。 | +| [color](_display.md#color-13) | 线条颜色。 | + + +## **详细描述** + +线条描述结构体定义,用于硬件加速绘制直线。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_pin_auth_interface_8idl.md b/zh-cn/device-dev/reference/hdi-apis/_i_pin_auth_interface_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..75007400f13eb9b00a91b8954caf233be2906ad9 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_pin_auth_interface_8idl.md @@ -0,0 +1,34 @@ +# IPinAuthInterface.idl + + +## **概述** + +**所属模块:** + +[HdfPinAuth](_hdf_pin_auth.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IPinAuthInterface](interface_i_pin_auth_interface.md) | 定义获取口令认证驱动的执行器列表接口。 [更多...](interface_i_pin_auth_interface.md) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.pin_auth.v1_0 | 口令认证接口的包路径 | + + +## **详细描述** + +定义获取口令认证驱动的执行器列表接口,用于从口令认证驱动获取执行器对象列表。 + +**Since:** + +3.2 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_power_hdi_callback_8idl.md b/zh-cn/device-dev/reference/hdi-apis/_i_power_hdi_callback_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..58b85115424fd410feff222b777c099e50a88746 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_power_hdi_callback_8idl.md @@ -0,0 +1,40 @@ +# IPowerHdiCallback.idl + + +## **概述** + +**所属模块:** + +[Power](power.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IPowerHdiCallback](interface_i_power_hdi_callback.md) | 休眠/唤醒状态的回调。 [更多...](interface_i_power_hdi_callback.md) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.power.v1_0 | 电源接口的包路径 | + + +## **详细描述** + +休眠/唤醒状态的回调。 + +电源模块为电源服务提供的订阅休眠/唤醒状态的回调。 + +**Since:** + +3.1 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_power_interface_8idl.md b/zh-cn/device-dev/reference/hdi-apis/_i_power_interface_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..b6899c701f1f7919e937b3f9e7e86e7693e13fe2 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_power_interface_8idl.md @@ -0,0 +1,40 @@ +# IPowerInterface.idl + + +## **概述** + +**所属模块:** + +[Power](power.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IPowerInterface](interface_i_power_interface.md) | 休眠/唤醒操作、订阅休眠/唤醒状态、运行锁管理的接口。 [更多...](interface_i_power_interface.md) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.power.v1_0 | 电源接口的包路径 | + + +## **详细描述** + +休眠/唤醒操作、订阅休眠/唤醒状态、运行锁管理的接口。 + +电源模块为电源服务提供休眠/唤醒操作、订阅休眠/唤醒状态和运行锁管理的接口。 + +**Since:** + +3.1 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_rect.md b/zh-cn/device-dev/reference/hdi-apis/_i_rect.md new file mode 100644 index 0000000000000000000000000000000000000000..f2b8f481e4ebb1800008d7ccf84bf9da98e0ef96 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_rect.md @@ -0,0 +1,26 @@ +# IRect + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [x](_display.md#x-12) | 矩形框起始X坐标。 | +| [y](_display.md#y-12) | 矩形框起始Y坐标。 | +| [w](_display.md#w) | 矩形框宽度。 | +| [h](_display.md#h) | 矩形框高度。 | + + +## **详细描述** + +定义矩形信息。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_surface.md b/zh-cn/device-dev/reference/hdi-apis/_i_surface.md new file mode 100644 index 0000000000000000000000000000000000000000..2108ff270981699143688f0452a594b229c2e83b --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_surface.md @@ -0,0 +1,35 @@ +# ISurface + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [phyAddr](_display.md#phyaddr-22) | 图像首地址 | +| [height](_display.md#height-47) | 图像高度 | +| [width](_display.md#width-47) | 图像宽度 | +| [stride](_display.md#stride) | 图像跨度 | +| [enColorFmt](_display.md#encolorfmt) | 图像格式 | +| [bYCbCrClut](_display.md#bycbcrclut) | CLUT表是否位于 YCbCr 空间 | +| [bAlphaMax255](_display.md#balphamax255) | 图像alpha最大值为255还是128 | +| [bAlphaExt1555](_display.md#balphaext1555) | 是否使能1555的Alpha扩展 | +| [alpha0](_display.md#alpha0-22) | Alpha0值,取值范围:[0,255] | +| [alpha1](_display.md#alpha1-22) | Alpha1值,取值范围:[0,255] | +| [cbcrPhyAddr](_display.md#cbcrphyaddr) | CLUT表首地址,用作颜色扩展或颜色校正 | +| [cbcrStride](_display.md#cbcrstride) | CbCr分量跨度 | +| [clutPhyAddr](_display.md#clutphyaddr) | CbCr分量地址 | + + +## **详细描述** + +用于存放窗口相关信息的结构体定义,提供给硬件加速使用,例如图像合成,位图搬移等操作。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_thermal_callback_8idl.md b/zh-cn/device-dev/reference/hdi-apis/_i_thermal_callback_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..5a4758d6b98696af3f30cdea9973526aa0dc68e4 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_thermal_callback_8idl.md @@ -0,0 +1,40 @@ +# IThermalCallback.idl + + +## **概述** + +**所属模块:** + +[Thermal](thermal.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IThermalCallback](interface_i_thermal_callback.md) | 订阅设备发热状态的回调。 [更多...](interface_i_thermal_callback.md) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.thermal.v1_0 | 设备温度管理接口的包路径 | + + +## **详细描述** + +设备发热状态的回调。 + +热模块为热服务提供的设备发热状态的回调。 + +**Since:** + +3.1 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_thermal_interface_8idl.md b/zh-cn/device-dev/reference/hdi-apis/_i_thermal_interface_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..06a92364867540b188c6d3cec54e94ff968d74ca --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_thermal_interface_8idl.md @@ -0,0 +1,40 @@ +# IThermalInterface.idl + + +## **概述** + +**所属模块:** + +[Thermal](thermal.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IThermalInterface](interface_i_thermal_interface.md) | 设备温度管理、控制及订阅接口。 [更多...](interface_i_thermal_interface.md) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.thermal.v1_0 | 设备温度管理接口的包路径 | + + +## **详细描述** + +设备温度管理、控制及订阅接口。 + +热模块为热服务提供的设备温度管理、控制及订阅接口。 + +**Since:** + +3.1 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_user_auth_interface_8idl.md b/zh-cn/device-dev/reference/hdi-apis/_i_user_auth_interface_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..7f3c5bd0151a021922e2030f7c66bd5bd19aa98f --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_user_auth_interface_8idl.md @@ -0,0 +1,34 @@ +# IUserAuthInterface.idl + + +## **概述** + +**所属模块:** + +[HdfUserAuth](_hdf_user_auth.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IUserAuthInterface](interface_i_user_auth_interface.md) | 声明用户认证驱动的API接口。 [更多...](interface_i_user_auth_interface.md) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.user_auth.v1_0 | 用户认证接口的包路径 | + + +## **详细描述** + +声明用户认证驱动的API接口。接口可用于注册执行器,管理用户认证凭据,完成PIN码和生物特征认证。 + +**Since:** + +3.2 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_wi_fi.md b/zh-cn/device-dev/reference/hdi-apis/_i_wi_fi.md new file mode 100644 index 0000000000000000000000000000000000000000..4010893f082cb29cf18a9f8aaeeff6c7ea0bbec6 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_wi_fi.md @@ -0,0 +1,369 @@ +# IWiFi + + +## **概述** + +**所属模块:** + +[WLAN](_w_l_a_n.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [start](#start) )(struct IWiFi \*iwifi) | 创建HAL和驱动之间的通道及获取驱动网卡信息,该函数调用在创建IWiFi实体后进行。 [更多...](#start) | +| ( [stop](#stop) )(struct IWiFi \*iwifi) | 销毁HAL和驱动之间的通道,该函数调用在销毁IWiFi实体前进行。 [更多...](#stop) | +| ( [getSupportFeature](#getsupportfeature) )(uint8_t \*supType, uint32_t size) | 获取该设备支持的WLAN特性(不考虑当前的使用状态)。 [更多...](#getsupportfeature) | +| ( [getSupportCombo](#getsupportcombo) )(uint64_t \*combo, uint32_t size) | 获取多网卡共存情况。 [更多...](#getsupportcombo) | +| ( [createFeature](#createfeature) )(int32_t type, struct [IWiFiBaseFeature](_i_wi_fi_base_feature.md) \*\*ifeature) | 根据输入类型创建对应的特性[IWiFiBaseFeature](_i_wi_fi_base_feature.md)。 [更多...](#createfeature) | +| ( [getFeatureByIfName](#getfeaturebyifname) )(const char \*ifName, struct [IWiFiBaseFeature](_i_wi_fi_base_feature.md) \*\*ifeature) | 通过网络接口名字获取对应的特性。 [更多...](#getfeaturebyifname) | +| ( [registerEventCallback](#registereventcallback) )([CallbackFunc](_w_l_a_n.md#callbackfunc) cbFunc, const char \*ifName) | 注册IWiFi的回调函数,监听异步事件。 [更多...](#registereventcallback) | +| ( [unregisterEventCallback](#unregistereventcallback) )([CallbackFunc](_w_l_a_n.md#callbackfunc) cbFunc, const char \*ifName) | 去注册IWiFi的回调函数。 [更多...](#unregistereventcallback) | +| ( [destroyFeature](#destroyfeature) )(struct [IWiFiBaseFeature](_i_wi_fi_base_feature.md) \*ifeature) | 根据输入类型销毁对应的特性[IWiFiBaseFeature](_i_wi_fi_base_feature.md)。 [更多...](#destroyfeature) | +| ( [resetDriver](#resetdriver) )(const uint8_t chipId, const char \*ifName) | 重置具有指定芯片ID的WLAN驱动程序。 [更多...](#resetdriver) | +| ( [getNetDevInfo](#getnetdevinfo) )(struct NetDeviceInfoResult \*netDeviceInfoResult) | 获取网络设备信息(设备索引、网卡名字、MAC等信息)。 [更多...](#getnetdevinfo) | +| ( [getPowerMode](#getpowermode) )(const char \*ifName, uint8_t \*mode) | 获取正在使用的功率模式。 [更多...](#getpowermode) | +| ( [setPowerMode](#setpowermode) )(const char \*ifName, uint8_t mode) | 设置功率模式 [更多...](#setpowermode) | + + +## **详细描述** + +HAL对WLAN服务提供的基本能力。 + +用于创建HAL与驱动的通道,创建/获取/销毁WLAN特性等。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### createFeature + + +``` +int32_t(* IWiFi::createFeature) (int32_t type, struct IWiFiBaseFeature **ifeature) +``` + +**描述:** + +根据输入类型创建对应的特性[IWiFiBaseFeature](_i_wi_fi_base_feature.md)。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| type | 输入参数,创建的feature类型。 | +| ifeature | 输出参数,获取创建的feature对象。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### destroyFeature + + +``` +int32_t(* IWiFi::destroyFeature) (struct IWiFiBaseFeature *ifeature) +``` + +**描述:** + +根据输入类型销毁对应的特性[IWiFiBaseFeature](_i_wi_fi_base_feature.md)。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| ifeature | 输入参数,销毁的feature对象。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### getFeatureByIfName + + +``` +int32_t(* IWiFi::getFeatureByIfName) (const char *ifName, struct IWiFiBaseFeature **ifeature) +``` + +**描述:** + +通过网络接口名字获取对应的特性。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| ifName | 输入参数,网卡名称。 | +| ifeature | 输出参数,获取该网络接口名字的feature对象。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### getNetDevInfo + + +``` +int32_t(* IWiFi::getNetDevInfo) (struct NetDeviceInfoResult *netDeviceInfoResult) +``` + +**描述:** + +获取网络设备信息(设备索引、网卡名字、MAC等信息)。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| netDeviceInfoResult | 输出参数,得到的网络设备信息。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### getPowerMode + + +``` +int32_t(* IWiFi::getPowerMode) (const char *ifName, uint8_t *mode) +``` + +**描述:** + +获取正在使用的功率模式。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| ifName | 输入参数,网卡名称。 | +| mode | 输出参数,功率模式,包括睡眠模式(待机状态运行)、一般模式(正常额定功率运行)、穿墙模式(最大功率运行,提高信号强度和覆盖面积)。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### getSupportCombo + + +``` +int32_t(* IWiFi::getSupportCombo) (uint64_t *combo, uint32_t size) +``` + +**描述:** + +获取多网卡共存情况。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| combo | 输出参数,基于芯片的能力保存当前所有支持的多网卡共存情况(比如支持AP,STA,P2P等不同组合的共存)。 | +| size | 输入参数,combo数组的长度。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### getSupportFeature + + +``` +int32_t(* IWiFi::getSupportFeature) (uint8_t *supType, uint32_t size) +``` + +**描述:** + +获取该设备支持的WLAN特性(不考虑当前的使用状态)。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| supType | 输出参数,保存当前设备支持的特性。 | +| size | 输入参数,supType数组的长度。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### registerEventCallback + + +``` +int32_t(* IWiFi::registerEventCallback) (CallbackFunc cbFunc, const char *ifName) +``` + +**描述:** + +注册IWiFi的回调函数,监听异步事件。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| cbFunc | 输入参数,注册的回调函数。 | +| ifName | 输入参数,网卡名称。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### resetDriver + + +``` +int32_t(* IWiFi::resetDriver) (const uint8_t chipId, const char *ifName) +``` + +**描述:** + +重置具有指定芯片ID的WLAN驱动程序。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| chipId | 输入参数,需要进行重置驱动的对应芯片ID。 | +| ifName | 输入参数,网卡名称。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### setPowerMode + + +``` +int32_t(* IWiFi::setPowerMode) (const char *ifName, uint8_t mode) +``` + +**描述:** + +设置功率模式 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| ifName | 输入参数,网卡名称。 | +| mode | 输入参数,功率模式,包括睡眠模式(待机状态运行)、一般模式(正常额定功率运行)、穿墙模式(最大功率运行,提高信号强度和覆盖面积)。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### start + + +``` +int32_t(* IWiFi::start) (struct IWiFi *iwifi) +``` + +**描述:** + +创建HAL和驱动之间的通道及获取驱动网卡信息,该函数调用在创建IWiFi实体后进行。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| iwifi | 输入参数,IWiFi对象。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### stop + + +``` +int32_t(* IWiFi::stop) (struct IWiFi *iwifi) +``` + +**描述:** + +销毁HAL和驱动之间的通道,该函数调用在销毁IWiFi实体前进行。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| iwifi | 输入参数,IWiFi对象。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### unregisterEventCallback + + +``` +int32_t(* IWiFi::unregisterEventCallback) (CallbackFunc cbFunc, const char *ifName) +``` + +**描述:** + +去注册IWiFi的回调函数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| cbFunc | 输入参数,去注册的回调函数。 | +| ifName | 输入参数,网卡名称。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_wi_fi_ap.md b/zh-cn/device-dev/reference/hdi-apis/_i_wi_fi_ap.md new file mode 100644 index 0000000000000000000000000000000000000000..2b291fba5e1a5852eee597b9d401ea72884f5b70 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_wi_fi_ap.md @@ -0,0 +1,101 @@ +# IWiFiAp + + +## **概述** + +**所属模块:** + +[WLAN](_w_l_a_n.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [baseFeature](#basefeature) | 基本特性。 | +| ( [getAsscociatedStas](#getasscociatedstas) )(const struct IWiFiAp \*apFeature, struct [StaInfo](_sta_info.md) \*staInfo, uint32_t count, uint32_t \*num) | 获取连接上的所有STA的信息(目前只包含MAC地址)。 [更多...](#getasscociatedstas) | +| ( [setCountryCode](#setcountrycode) )(const struct IWiFiAp \*apFeature, const char \*code, uint32_t len) | 设置国家码(表示AP射频所在的国家,规定了AP射频特性,包括AP的发送功率、支持的信道等。其目的是为了使AP的射频特性符合不同国家或区域的法律法规要求)。 [更多...](#setcountrycode) | + + +## **详细描述** + +继承了IWiFiBaseFeature基本特性,并包含AP模式下获取连接STA的信息和设置国家码的功能。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### baseFeature + + +``` +struct IWiFiBaseFeature IWiFiAp::baseFeature +``` + +**描述:** + +基本特性。 + + +### getAsscociatedStas + + +``` +int32_t(* IWiFiAp::getAsscociatedStas) (const struct IWiFiAp *apFeature, struct StaInfo *staInfo, uint32_t count, uint32_t *num) +``` + +**描述:** + +获取连接上的所有STA的信息(目前只包含MAC地址)。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| apFeature | 输入参数,AP特性。 | +| staInfo | 输出参数,保存与AP连接的STA的基本信息。 | +| count | 输入参数,staInfo结构体数组的元素个数。 | +| num | 输出参数,实际连接的STA的个数。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### setCountryCode + + +``` +int32_t(* IWiFiAp::setCountryCode) (const struct IWiFiAp *apFeature, const char *code, uint32_t len) +``` + +**描述:** + +设置国家码(表示AP射频所在的国家,规定了AP射频特性,包括AP的发送功率、支持的信道等。其目的是为了使AP的射频特性符合不同国家或区域的法律法规要求)。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| apFeature | 输入参数,AP特性。 | +| code | 输入参数,设置的国家码。 | +| len | 输入参数,国家码长度。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_wi_fi_base_feature.md b/zh-cn/device-dev/reference/hdi-apis/_i_wi_fi_base_feature.md new file mode 100644 index 0000000000000000000000000000000000000000..0f440188c6e2ce31ffc78229a6d82c8e53a3702a --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_wi_fi_base_feature.md @@ -0,0 +1,259 @@ +# IWiFiBaseFeature + + +## **概述** + +**所属模块:** + +[WLAN](_w_l_a_n.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [ifName](#ifname) [[IFNAME_MAX_LEN](_w_l_a_n.md#ga63637ece87095ff8d153f650434ecf97)] | 网卡名称。 | +| **type** | 特性的类型,参考[FeatureType](_w_l_a_n.md#featuretype)。 | +| ( [getNetworkIfaceName](#getnetworkifacename) )(const struct IWiFiBaseFeature \*baseFeature) | 根据基本特性获取网卡名称。 [更多...](#getnetworkifacename) | +| ( [getFeatureType](#getfeaturetype) )(const struct IWiFiBaseFeature \*baseFeature) | 获取基本特性的类型[FeatureType](_w_l_a_n.md#featuretype)。 [更多...](#getfeaturetype) | +| ( [setMacAddress](#setmacaddress) )(const struct IWiFiBaseFeature \*baseFeature, unsigned char \*mac, uint8_t len) | 根据传入参数设置对应网卡的MAC地址。 [更多...](#setmacaddress) | +| ( [getDeviceMacAddress](#getdevicemacaddress) )(const struct IWiFiBaseFeature \*baseFeature, unsigned char \*mac, uint8_t len) | 获取设备的MAC地址。 [更多...](#getdevicemacaddress) | +| ( [getValidFreqsWithBand](#getvalidfreqswithband) )(const struct IWiFiBaseFeature \*baseFeature, int32_t band, int32_t \*freqs, uint32_t count, uint32_t \*num) | 获取指定频段(2.4G或者5G)下支持的频率。 [更多...](#getvalidfreqswithband) | +| ( [setTxPower](#settxpower) )(const struct IWiFiBaseFeature \*baseFeature, int32_t power) | 设置发射功率。 [更多...](#settxpower) | +| ( [getChipId](#getchipid) )(const struct IWiFiBaseFeature \*baseFeature, uint8_t \*chipId) | 获得当前驱动的芯片ID。 [更多...](#getchipid) | +| ( [getIfNamesByChipId](#getifnamesbychipid) )(const uint8_t chipId, char \*\*ifNames, uint32_t \*num) | 通过芯片ID获得当前芯片所有的网卡名称。 [更多...](#getifnamesbychipid) | + + +## **详细描述** + +WLAN基本特性操作接口,包括获取网卡名称,设置MAC地址,设置发射功率等公共能力接口。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### getChipId + + +``` +int32_t(* IWiFiBaseFeature::getChipId) (const struct IWiFiBaseFeature *baseFeature, uint8_t *chipId) +``` + +**描述:** + +获得当前驱动的芯片ID。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| baseFeature | 输入参数,基本特性。 | +| chipId | 输出参数,获得的芯片ID。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### getDeviceMacAddress + + +``` +int32_t(* IWiFiBaseFeature::getDeviceMacAddress) (const struct IWiFiBaseFeature *baseFeature, unsigned char *mac, uint8_t len) +``` + +**描述:** + +获取设备的MAC地址。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| baseFeature | 输入参数,基本特性。 | +| mac | 输出参数,获得的MAC地址。 | +| len | 输入参数,获得的MAC地址长度。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### getFeatureType + + +``` +int32_t(*IWiFiBaseFeature::getFeatureType) (const struct IWiFiBaseFeature *baseFeature) +``` + +**描述:** + +获取基本特性的类型[FeatureType](_w_l_a_n.md#featuretype)。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| baseFeature | 输入参数,基本特性。 | + +**返回:** + +如果操作成功,则返回特性类型。 + +如果操作失败,则返回负值。 + + +### getIfNamesByChipId + + +``` +int32_t(* IWiFiBaseFeature::getIfNamesByChipId) (const uint8_t chipId, char **ifNames, uint32_t *num) +``` + +**描述:** + +通过芯片ID获得当前芯片所有的网卡名称。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| chipId | 输入参数,需要获取网卡名称的芯片ID。 | +| ifNames | 输出参数,网卡名称。 | +| num | 输出参数,网卡的数量。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### getNetworkIfaceName + + +``` +const char*(* IWiFiBaseFeature::getNetworkIfaceName) (const struct IWiFiBaseFeature *baseFeature) +``` + +**描述:** + +根据基本特性获取网卡名称。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| baseFeature | 输入参数,基本特性。 | + +**返回:** + +如果操作成功,则返回网卡名称。 + +如果操作失败,则返回NULL。 + + +### getValidFreqsWithBand + + +``` +int32_t(* IWiFiBaseFeature::getValidFreqsWithBand) (const struct IWiFiBaseFeature *baseFeature, int32_t band, int32_t *freqs, uint32_t count, uint32_t *num) +``` + +**描述:** + +获取指定频段(2.4G或者5G)下支持的频率。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| baseFeature | 输入参数,基本特性。 | +| band | 输入参数,指定的一个频段。 | +| freqs | 输出参数,保存支持的频率。 | +| count | 输入参数,频率数组的元素个数。 | +| num | 输出参数,实际支持的频率个数。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### ifName + + +``` +char IWiFiBaseFeature::ifName[IFNAME_MAX_LEN] +``` + +**描述:** + +网卡名称。 + + +### setMacAddress + + +``` +int32_t(* IWiFiBaseFeature::setMacAddress) (const struct IWiFiBaseFeature *baseFeature, unsigned char *mac, uint8_t len) +``` + +**描述:** + +根据传入参数设置对应网卡的MAC地址。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| baseFeature | 输入参数,基本特性。 | +| mac | 输入参数,设置的MAC地址。 | +| len | 输入参数,设置的MAC地址长度。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### setTxPower + + +``` +int32_t(* IWiFiBaseFeature::setTxPower) (const struct IWiFiBaseFeature *baseFeature, int32_t power) +``` + +**描述:** + +设置发射功率。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| baseFeature | 输入参数,基本特性。 | +| power | 输入参数,设置的发射功率。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_i_wi_fi_sta.md b/zh-cn/device-dev/reference/hdi-apis/_i_wi_fi_sta.md new file mode 100644 index 0000000000000000000000000000000000000000..aff3e568d7d0cae1422620565645673dbcb5508e --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_i_wi_fi_sta.md @@ -0,0 +1,99 @@ +# IWiFiSta + + +## **概述** + +**所属模块:** + +[WLAN](_w_l_a_n.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [baseFeature](#basefeature) | 基本特性。 | +| ( [setScanningMacAddress](#setscanningmacaddress) )(const struct IWiFiSta \*staFeature, unsigned char \*scanMac, uint8_t len) | 设置扫描单个MAC地址。 [更多...](#setscanningmacaddress) | +| ( [startScan](#startscan) )(const char \*ifName, WifiScan \*scan) | 启动扫描。 [更多...](#startscan) | + + +## **详细描述** + +继承了[IWiFiBaseFeature](_i_wi_fi_base_feature.md)基本特性,额外包含设置扫描单个MAC地址功能。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### baseFeature + + +``` +struct IWiFiBaseFeature IWiFiSta::baseFeature +``` + +**描述:** + +基本特性。 + + +### setScanningMacAddress + + +``` +int32_t(* IWiFiSta::setScanningMacAddress) (const struct IWiFiSta *staFeature, unsigned char *scanMac, uint8_t len) +``` + +**描述:** + +设置扫描单个MAC地址。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| staFeature | 输入参数,STA特性。 | +| scanMac | 输入参数,设置STA扫描的MAC地址。 | +| len | 输入参数,MAC地址的长度。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### startScan + + +``` +int32_t(* IWiFiSta::startScan) (const char *ifName, WifiScan *scan) +``` + +**描述:** + +启动扫描。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| ifName | 输入参数,网卡名称。 | +| scan | 输入参数,扫描参数。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_identify_result_info.md b/zh-cn/device-dev/reference/hdi-apis/_identify_result_info.md new file mode 100644 index 0000000000000000000000000000000000000000..f990a2d18bffdca9b2404f92e1c56f191bc93676 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_identify_result_info.md @@ -0,0 +1,72 @@ +# IdentifyResultInfo + + +## **概述** + +**所属模块:** + +[HdfUserAuth](_hdf_user_auth.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [result](#result) | 用户身份识别结果。 | +| [userId](#userid) | 用户ID。 | +| [token](#token) | 用户身份识别令牌。 | + + +## **详细描述** + +用户身份识别结果信息。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### result + + +``` +int IdentifyResultInfo::result +``` + +**描述:** + +用户身份识别结果。 + + +### token + + +``` +unsigned char [] IdentifyResultInfo::token +``` + +**描述:** + +用户身份识别令牌。 + + +### userId + + +``` +int IdentifyResultInfo::userId +``` + +**描述:** + +用户ID。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_input.md b/zh-cn/device-dev/reference/hdi-apis/_input.md new file mode 100644 index 0000000000000000000000000000000000000000..4d1ff3164d7e3640000029d9adc9eb3dc81b160b --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_input.md @@ -0,0 +1,194 @@ +# Input + + +## **汇总** + + +### 文件 + + | 文件 | 描述 | +| -------- | -------- | +| [input_controller.h](input__controller_8h.md) | 描述input设备业务控制相关的接口声明。 | +| [input_manager.h](input__manager_8h.md) | 描述input设备管理相关的接口声明。 | +| [input_reporter.h](input__reporter_8h.md) | 描述input设备数据上报相关的接口声明。 | +| [input_type.h](input__type_8h.md) | input设备相关的类型定义,定义了input设备驱动接口所使用的结构体及枚举类型。 | + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [InputController](_input_controller.md) | 提供input设备业务控制相关的接口。 [更多...](_input_controller.md) | +| [InputManager](_input_manager.md) | 提供input设备管理相关的接口。 [更多...](_input_manager.md) | +| [IInputInterface](_i_input_interface.md) | 定义用于提供输入设备驱动能力的接口。[更多...](_i_input_interface.md) | +| [InputReporter](_input_reporter.md) | 提供input设备数据上报相关的接口。 [更多...](_input_reporter.md) | +| [EventPackage](_event_package.md) | input事件数据包结构 [更多...](_event_package.md) | +| [InputReportEventCb](_input_report_event_cb.md) | 此结构体定义了输入事件回调函数并提供给input服务使用 [更多...](_input_report_event_cb.md) | +| [DeviceInfo](_device_info.md) | input设备基础设备信息 [更多...](_device_info.md) | +| [InputExtraCmd](_input_extra_cmd.md) | 扩展指令的数据结构 [更多...](_input_extra_cmd.md) | + + +### 宏定义 + + | 宏定义 | 描述 | +| -------- | -------- | +| **MAX_INPUT_DEV_NUM**   32 | Input设备最大数量。 | +| **MAX_NODE_PATH_LEN**   64 | 节点路径最大长度。 | +| **CHIP_INFO_LEN**   10 | 芯片信息长度。 | +| **CHIP_NAME_LEN**   10 | 芯片名称长度。 | +| **VENDOR_NAME_LEN**   10 | 厂商名称长度。 | +| **SELF_TEST_RESULT_LEN**   20 | 自测结果长度。 | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [RetStatus](#retstatus) { INPUT_SUCCESS = 0, INPUT_FAILURE = -1, INPUT_INVALID_PARAM = -2, INPUT_NOMEM = -3,   INPUT_NULL_PTR = -4, INPUT_TIMEOUT = -5, INPUT_UNSUPPORTED = -6 } | 定义返回值类型 [更多...](#retstatus) | +| [InputDevType](#inputdevtype) { INDEV_TYPE_TOUCH, INDEV_TYPE_KEY, INDEV_TYPE_KEYBOARD, INDEV_TYPE_MOUSE,   INDEV_TYPE_BUTTON, INDEV_TYPE_CROWN, INDEV_TYPE_ENCODER, INDEV_TYPE_UNKNOWN } | 定义input设备类型 [更多...](#inputdevtype) | +| [PowerStatus](#powerstatus) { INPUT_RESUME, INPUT_SUSPEND, INPUT_LOW_POWER, INPUT_POWER_STATUS_UNKNOWN } | 定义电源状态 [更多...](#powerstatus) | +| [CapacitanceTest](#capacitancetest) { BASE_TEST, FULL_TEST, MMI_TEST, RUNNING_TEST,   TEST_TYPE_UNKNOWN } | 定义容值测试类型 [更多...](#capacitancetest) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [GetInputInterface](#getinputinterface) ([IInputInterface](_i_input_interface.md) \*\*interface) | input服务通过调用此接口获取操作input设备的所有接口。 [更多...](#getinputinterface) | + + +## **详细描述** + +Input模块驱动接口声明。 + +本模块为Input服务提供相关驱动接口,包括input设备的打开和关闭、input事件获取、设备信息查询、回调函数注册、特性状态控制等接口。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **枚举类型说明** + + +### CapacitanceTest + + +``` +enum CapacitanceTest +``` + +**描述:** + +定义容值测试类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| BASE_TEST | 基础容值测试 | +| FULL_TEST | 全量容值自检测试 | +| MMI_TEST | MMI容值测试 | +| RUNNING_TEST | 老化容值测试 | +| TEST_TYPE_UNKNOWN | 未知的测试类型 | + + +### InputDevType + + +``` +enum InputDevType +``` + +**描述:** + +定义Input设备类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| INDEV_TYPE_TOUCH | 触摸屏。 | +| INDEV_TYPE_KEY | 物理按键。 | +| INDEV_TYPE_KEYBOARD | 键盘。 | +| INDEV_TYPE_MOUSE | 鼠标。 | +| INDEV_TYPE_BUTTON | 虚拟按键。 | +| INDEV_TYPE_CROWN | 表冠。 | +| INDEV_TYPE_ENCODER | 自定义编码的特定功能或者事件。 | +| INDEV_TYPE_UNKNOWN | 未知输入设备类型。 | + + +### PowerStatus + + +``` +enum PowerStatus +``` + +**描述:** + +定义电源状态。 + + | 枚举值 | 描述 | +| -------- | -------- | +| INPUT_RESUME | 正常唤醒。 | +| INPUT_SUSPEND | 休眠下电模式。 | +| INPUT_LOW_POWER | 休眠低功耗模式。 | +| INPUT_POWER_STATUS_UNKNOWN | 未知电源状态。 | + + +### RetStatus + + +``` +enum RetStatus +``` + +**描述:** + +定义返回值类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| INPUT_SUCCESS | 成功。 | +| INPUT_FAILURE | 失败。 | +| INPUT_INVALID_PARAM | 无效参数。 | +| INPUT_NOMEM | 内存不足。 | +| INPUT_NULL_PTR | 空指针。 | +| INPUT_TIMEOUT | 执行超时。 | +| INPUT_UNSUPPORTED | 特性不支持。 | + + +## **函数说明** + + +### GetInputInterface() + + +``` +int32_t GetInputInterface (IInputInterface **interface) +``` + +**描述:** + +Input服务通过调用此接口获取操作input设备的所有接口。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| interface | 对input设备进行接口操作的指针,通常在input服务启动后,通过调用此函数获取input设备操作接口 | + +**返回:** + +INPUT_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看**RetSatus**。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/_input_controller.md b/zh-cn/device-dev/reference/hdi-apis/_input_controller.md new file mode 100644 index 0000000000000000000000000000000000000000..5cdf213f3862f6331c2e0f33241db20fab120715 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_input_controller.md @@ -0,0 +1,276 @@ +# InputController + + +## **概述** + +**所属模块:** + +[Input](_input.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [SetPowerStatus](#setpowerstatus) )(uint32_t devIndex, uint32_t status) | 设置电源状态 [更多...](#setpowerstatus) | +| ( [GetPowerStatus](#getpowerstatus) )(uint32_t devIndex, uint32_t \*status) | 获取电源状态 [更多...](#getpowerstatus) | +| ( [GetDeviceType](#getdevicetype) )(uint32_t devIndex, uint32_t \*deviceType) | 获取devIndex对应的input设备的类型 [更多...](#getdevicetype) | +| ( [GetChipInfo](#getchipinfo) )(uint32_t devIndex, char \*chipInfo, uint32_t length) | 获取器件对应的编码信息 [更多...](#getchipinfo) | +| ( [GetVendorName](#getvendorname) )(uint32_t devIndex, char \*vendorName, uint32_t length) | 获取devIndex对应的模组厂商名 [更多...](#getvendorname) | +| ( [GetChipName](#getchipname) )(uint32_t devIndex, char \*chipName, uint32_t length) | 获取devIndex对应的驱动芯片名 [更多...](#getchipname) | +| ( [SetGestureMode](#setgesturemode) )(uint32_t devIndex, uint32_t gestureMode) | 设置手势模式 [更多...](#setgesturemode) | +| ( [RunCapacitanceTest](#runcapacitancetest) )(uint32_t devIndex, uint32_t testType, char \*result, uint32_t length) | 执行容值自检测试 [更多...](#runcapacitancetest) | +| ( [RunExtraCommand](#runextracommand) )(uint32_t devIndex, [InputExtraCmd](_input_extra_cmd.md) \*cmd) | 执行拓展指令 [更多...](#runextracommand) | + + +## **详细描述** + +提供input设备业务控制相关的接口。 + +此类接口包含电源状态的设置、特性的使能、器件信息的获取,以及产线相关的测试功能接口。 + + +## **类成员变量说明** + + +### GetChipInfo + + +``` +int32_t(* InputController::GetChipInfo) (uint32_t devIndex, char *chipInfo, uint32_t length) +``` + +**描述:** + +获取器件对应的编码信息 + +一款产品通常会有多家模组和Driver IC,上层应用如果关注具体器件型号,则通过此接口来获取。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devIndex | Input设备索引,用于标志多个input设备,取值从0开始,最多支持32个设备。 | +| chipInfo | 获取的对应设备索引的器件编码信息。 | +| length | 保存器件芯片信息的内存长度。 | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 + + +### GetChipName + + +``` +int32_t(* InputController::GetChipName) (uint32_t devIndex, char *chipName, uint32_t length) +``` + +**描述:** + +获取devIndex对应的驱动芯片名 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devIndex | Input设备索引,用于标志多个input设备,取值从0开始,最多支持32个设备。 | +| chipName | 获取的对应设备索引的驱动芯片名。 | +| length | 保存驱动芯片名的内存长度。 | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 + + +### GetDeviceType + + +``` +int32_t(* InputController::GetDeviceType) (uint32_t devIndex, uint32_t *deviceType) +``` + +**描述:** + +获取devIndex对应的input设备的类型 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devIndex | Input设备索引,用于标志多个input设备,取值从0开始,最多支持32个设备。 | +| deviceType | 获取的对应设备索引的设备类型,具体参考**InputDevType**。 | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 + + +### GetPowerStatus + + +``` +int32_t(* InputController::GetPowerStatus) (uint32_t devIndex, uint32_t *status) +``` + +**描述:** + +获取电源状态 + +在系统休眠或者唤醒时,input服务或电源管理模块获取电源状态,以便驱动IC能正常进入对应的休眠模式。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devIndex | Input设备索引,用于标志多个input设备,取值从0开始,最多支持32个设备。 | +| status | 获取的对应设备索引的电源状态,具体参考**PowerStatus**。 | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus。** + + +### GetVendorName + + +``` +int32_t(* InputController::GetVendorName) (uint32_t devIndex, char *vendorName, uint32_t length) +``` + +**描述:** + +获取devIndex对应的模组厂商名 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devIndex | Input设备索引,用于标志多个input设备,取值从0开始,最多支持32个设备。 | +| vendorName | 获取的对应设备索引的模组厂商名。 | +| length | 保存模组厂商名的内存长度。 | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 + + +### RunCapacitanceTest + + +``` +int32_t(* InputController::RunCapacitanceTest) (uint32_t devIndex, uint32_t testType, char *result, uint32_t length) +``` + +**描述:** + +执行容值自检测试 + +启动不同检测场景下的容值自检测试,并获取测试结果,容值自检项由器件厂商自定义, 一般包括RawData测试、 \* 短路检测、开路检测、干扰检测、行列差检测等测试项。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devIndex | Input设备索引,用于标志多个input设备,取值从0开始,最多支持32个设备。 | +| testType | 容值测试的测试类型,具体参考**CapacitanceTest**。 | +| result | 容值测试的结果,成功则输出“SUCCESS”,失败则返回对应的错误提示 。 | +| length | 保存容值测试结果的内存长度。 | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 + + +### RunExtraCommand + + +``` +int32_t(* InputController::RunExtraCommand) (uint32_t devIndex, InputExtraCmd *cmd) +``` + +**描述:** + +执行拓展指令 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devIndex | Input设备索引,用于标志多个input设备,取值从0开始,最多支持32个设备。 | +| cmd | 拓展指令数据包,包括指令编码及参数,具体参考**InputExtraCmd**。 | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 + + +### SetGestureMode + + +``` +int32_t(* InputController::SetGestureMode) (uint32_t devIndex, uint32_t gestureMode) +``` + +**描述:** + +设置手势模式 + +上层应用开关手势模式,即设置手势模式的对应使能bit + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devIndex | Input设备索引,用于标志多个input设备,取值从0开始,最多支持32个设备。 | +| gestureMode | 手势模式的开关状态 | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 + + +### SetPowerStatus + + +``` +int32_t(* InputController::SetPowerStatus) (uint32_t devIndex, uint32_t status) +``` + +**描述:** + +设置电源状态 + +在系统休眠或者唤醒时,input服务或电源管理模块设置电源状态,以使驱动IC能正常进入对应的休眠模式。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devIndex | Input设备索引,用于标志多个input设备,取值从0开始,最多支持32个设备。 | +| status | 设置的电源状态,input服务控制input设备进入resume或者suspend等状态[PowerStatus](_input.md#powerstatus)。 | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_input_extra_cmd.md b/zh-cn/device-dev/reference/hdi-apis/_input_extra_cmd.md new file mode 100644 index 0000000000000000000000000000000000000000..56083e65b9a4c823d7c5fc42cc29ddbd3b910228 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_input_extra_cmd.md @@ -0,0 +1,51 @@ +# InputExtraCmd + + +## **概述** + +**所属模块:** + +[Input](_input.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [cmdCode](#cmdcode) | 指令对应的编码。 | +| [cmdValue](#cmdvalue) | 指令传输的数据。 | + + +## **详细描述** + +扩展指令的数据结构。 + + +## **类成员变量说明** + + +### cmdCode + + +``` +const char* InputExtraCmd::cmdCode +``` + +**描述:** + +指令对应的编码 + + +### cmdValue + + +``` +const char* InputExtraCmd::cmdValue +``` + +**描述:** + +指令传输的数据 diff --git a/zh-cn/device-dev/reference/hdi-apis/_input_manager.md b/zh-cn/device-dev/reference/hdi-apis/_input_manager.md new file mode 100644 index 0000000000000000000000000000000000000000..e1299baf018fe62bc5532fc4db51be5a7d99db34 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_input_manager.md @@ -0,0 +1,156 @@ +# InputManager + + +## **概述** + +**所属模块:** + +[Input](_input.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [ScanInputDevice](#scaninputdevice) )(DevDesc \*staArr, uint32_t arrLen) | input服务用于扫描所有在线设备。 [更多...](#scaninputdevice) | +| ( [OpenInputDevice](#openinputdevice) )(uint32_t devIndex) | input服务打开对应设备的设备文件 [更多...](#openinputdevice) | +| ( [CloseInputDevice](#closeinputdevice) )(uint32_t devIndex) | input服务关闭对应设备的设备文件 [更多...](#closeinputdevice) | +| ( [GetInputDevice](#getinputdevice) )(uint32_t devIndex, [DeviceInfo](_device_info.md) \*\*devInfo) | input服务获取对应ID的设备信息 [更多...](#getinputdevice) | +| ( [GetInputDeviceList](#getinputdevicelist) )(uint32_t \*devNum, [DeviceInfo](_device_info.md) \*\*devList, uint32_t size) | input服务获取所有input设备列表的设备信息 [更多...](#getinputdevicelist) | + + +## **详细描述** + +提供input设备管理相关的接口。 + +此类接口包含input设备的扫描、打开和关闭、特定设备信息查询,以及所有设备列表信息获取等接口。 + + +## **类成员变量说明** + + +### CloseInputDevice + + +``` +int32_t(* InputManager::CloseInputDevice) (uint32_t devIndex) +``` + +**描述:** + +input服务关闭对应设备的设备文件 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devIndex | Input设备索引,用于标志多个input设备,取值从0开始,最多支持32个设备 | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 + + +### GetInputDevice + + +``` +int32_t(* InputManager::GetInputDevice) (uint32_t devIndex, DeviceInfo **devInfo) +``` + +**描述:** + +input服务获取对应ID的设备信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devIndex | Input设备索引,用于标志多个input设备,取值从0开始,最多支持32个设备。 | +| devInfo | 即devIndex对应设备的设备信息,具体参考**DeviceInfo**。 | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 + + +### GetInputDeviceList + + +``` +int32_t(* InputManager::GetInputDeviceList) (uint32_t *devNum, DeviceInfo **devList, uint32_t size) +``` + +**描述:** + +input服务获取所有input设备列表的设备信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devNum | 当前已经注册过的所有input设备的总数。 | +| devInfo | input设备列表所对应的设备信息,具体参考**DeviceInfo**。 | +| size | 即指定deviceList数组对应的元素个数。 | + +返回: + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 + + +### OpenInputDevice + + +``` +int32_t(* InputManager::OpenInputDevice) (uint32_t devIndex) +``` + +**描述:** + +input服务打开对应设备的设备文件 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devIndex | Input设备索引,用于标志多个input设备,取值从0开始,最多支持32个设备。 | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 + + +### ScanInputDevice + + +``` +int32_t(* InputManager::ScanInputDevice) (DevDesc *staArr, uint32_t arrLen) +``` + +**描述:** + +input服务用于扫描所有在线设备。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| staArr | 存放Input设备扫描信息的数组,信息包含设备索引以及设备类型。 | +| arrLen | staArr数组的长度信息。 | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_input_report_event_cb.md b/zh-cn/device-dev/reference/hdi-apis/_input_report_event_cb.md new file mode 100644 index 0000000000000000000000000000000000000000..ae163394876e83ae7fe85f8925c12dae9b2efb6c --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_input_report_event_cb.md @@ -0,0 +1,65 @@ +# InputReportEventCb + + +## **概述** + +**所属模块:** + +[Input](_input.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [ReportEventPkgCallback](#reporteventpkgcallback) )(const [EventPackage](_event_package.md) \*\*pkgs, uint32_t count, uint32_t devIndex) | 输入事件数据上报的回调函数 [更多...](#reporteventpkgcallback) | +| ( [ReportHotPlugEventCallback](#reporthotplugeventcallback) )(const HotPlugEvent \*event) | 热插拔事件上报的回调函数 [更多...](#reporthotplugeventcallback) | + + +## **详细描述** + +此结构体定义了输入事件回调函数并提供给input服务使用。 + + +## **类成员变量说明** + + +### ReportEventPkgCallback + + +``` +void(* InputReportEventCb::ReportEventPkgCallback) (const EventPackage **pkgs, uint32_t count, uint32_t devIndex) +``` + +**描述:** + +输入事件数据上报的回调函数 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| eventData | 驱动上报的input事件数据。 | +| count | Input事件数据包的个数。 | +| devIndex | Input设备索引,用于标志多个input设备,取值从0开始,最多支持32个设备。 | + + +### ReportHotPlugEventCallback + + +``` +void(* InputReportEventCb::ReportHotPlugEventCallback) (const HotPlugEvent *event) +``` + +**描述:** + +热插拔事件上报的回调函数 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| event | 上报的热插拔事件数据 | diff --git a/zh-cn/device-dev/reference/hdi-apis/_input_reporter.md b/zh-cn/device-dev/reference/hdi-apis/_input_reporter.md new file mode 100644 index 0000000000000000000000000000000000000000..fa80efaff1bddf7031df4d9ff943e911d6a38c5e --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_input_reporter.md @@ -0,0 +1,132 @@ +# InputReporter + + +## **概述** + +**所属模块:** + +[Input](_input.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [RegisterReportCallback](#registerreportcallback) )(uint32_t devIndex, [InputReportEventCb](_input_report_event_cb.md) \*callback) | 注册对应设备的回调函数 [更多...](#registerreportcallback) | +| ( [UnregisterReportCallback](#unregisterreportcallback) )(uint32_t devIndex) | 注销对应设备的回调函数 [更多...](#unregisterreportcallback) | +| ( [RegisterHotPlugCallback](#registerhotplugcallback) )([InputReportEventCb](_input_report_event_cb.md) \*callback) | 注册Input设备的热插拔回调函数 [更多...](#registerhotplugcallback) | +| ( [UnregisterHotPlugCallback](#unregisterhotplugcallback) )(void) | 注销Input设备的热插拔回调函数 [更多...](#unregisterhotplugcallback) | + + +## **详细描述** + +提供input设备数据上报相关的接口。 + +此类接口包含input设备的数据上报回调函数的注册和注销。 + + +## **类成员变量说明** + + +### RegisterHotPlugCallback + + +``` +int32_t(* InputReporter::RegisterHotPlugCallback) (InputReportEventCb *callback) +``` + +**描述:** + +注册Input设备的热插拔回调函数 + +input服务通过此接口注册回调函数到hdi中,所有Input设备由此函数进行热插拔事件上报 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| callback | 回调函数的函数指针 | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 + + +### RegisterReportCallback + + +``` +int32_t(* InputReporter::RegisterReportCallback) (uint32_t devIndex, InputReportEventCb *callback) +``` + +**描述:** + +注册对应设备的回调函数 + +input服务通过此接口注册数据回调函数到hdi中,hdi通过此回调函数上报input事件 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devIndex | Input设备索引,用于标志多个input设备,取值从0开始,最多支持32个设备 | +| callback | 回调函数的函数指针 | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 + + +### UnregisterHotPlugCallback + + +``` +int32_t(* InputReporter::UnregisterHotPlugCallback) (void) +``` + +**描述:** + +注销Input设备的热插拔回调函数 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| 无 | - | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 + + +### UnregisterReportCallback + + +``` +int32_t(* InputReporter::UnregisterReportCallback) (uint32_t devIndex) +``` + +**描述:** + +注销对应设备的回调函数 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devIndex | Input设备索引,用于标志多个input设备,取值从0开始,最多支持32个设备 | + +**返回:** + +Returns INPUT_SUCCESS 表示执行成功。 + +Returns 其他值表示执行失败,具体错误码查看**RetSatus**。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_layer_alpha.md b/zh-cn/device-dev/reference/hdi-apis/_layer_alpha.md new file mode 100644 index 0000000000000000000000000000000000000000..9dc52678aecefe62852b3c53f430b051c1f39bb0 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_layer_alpha.md @@ -0,0 +1,27 @@ +# LayerAlpha + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [enGlobalAlpha](_display.md#englobalalpha-12) | 全局alpha使能标志 | +| [enPixelAlpha](_display.md#enpixelalpha-12) | 像素alpha使能标志 | +| [alpha0](_display.md#alpha0-12) | alpha0值,取值范围:[0, 255] | +| [alpha1](_display.md#alpha1-12) | alpha1值,取值范围:[0, 255] | +| [gAlpha](_display.md#galpha) | 全局alpha值,取值范围:[0, 255] | + + +## **详细描述** + +定义图层Alpha信息的结构体。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_layer_buffer.md b/zh-cn/device-dev/reference/hdi-apis/_layer_buffer.md new file mode 100644 index 0000000000000000000000000000000000000000..179aa36a396027e7cbae879faf591dcbfc977550 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_layer_buffer.md @@ -0,0 +1,29 @@ +# LayerBuffer + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [fenceId](_display.md#fenceid) | buffer的fence号 | +| [width](_display.md#width-37) | buffer宽度 | +| [height](_display.md#height-37) | buffer高度 | +| [pitch](_display.md#pitch) | 一行数据所占字节数 | +| [pixFormat](_display.md#pixformat-22) | 图层像素格式 | +| [data](_display.md#data) | 图层buffer数据 | +| [hdl](_display.md#hdl) | 图层buffer句柄 | + + +## **详细描述** + +图层Buffer,用于存放图层数据。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_layer_funcs.md b/zh-cn/device-dev/reference/hdi-apis/_layer_funcs.md new file mode 100644 index 0000000000000000000000000000000000000000..6868d6a8388fc43ef53e245a960504741a1ebf6c --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_layer_funcs.md @@ -0,0 +1,1267 @@ +# LayerFuncs + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [InitDisplay](#initdisplay) )(uint32_t devId) | 初始化显示设备。 [更多...](#initdisplay) | +| ( [DeinitDisplay](#deinitdisplay) )(uint32_t devId) | 取消初始化显示设备。 [更多...](#deinitdisplay) | +| ( [GetDisplayInfo](#getdisplayinfo) )(uint32_t devId, [DisplayInfo](_display_info.md) \*dispInfo) | 获取显示设备相关信息。 [更多...](#getdisplayinfo) | +| ( [CreateLayer](#createlayer) )(uint32_t devId, const [LayerInfo](_layer_info.md) \*layerInfo, uint32_t \*layerId) | 打开图层。 [更多...](#createlayer) | +| ( [CloseLayer](#closelayer) )(uint32_t devId, uint32_t layerId) | 关闭图层。 [更多...](#closelayer) | +| ( [SetLayerVisible](#setlayervisible) )(uint32_t devId, uint32_t layerId, bool visible) | 设置图层是否可见。 [更多...](#setlayervisible) | +| ( [GetLayerVisibleState](#getlayervisiblestate) )(uint32_t devId, uint32_t layerId, bool \*visible) | 获取图层是否可见状态。 [更多...](#getlayervisiblestate) | +| ( [SetLayerSize](#setlayersize) )(uint32_t devId, uint32_t layerId, [IRect](_i_rect.md) \*rect) | 设置图层大小。 [更多...](#setlayersize) | +| ( [GetLayerSize](#getlayersize) )(uint32_t devId, uint32_t layerId, [IRect](_i_rect.md) \*rect) | 获取图层大小。 [更多...](#getlayersize) | +| ( [SetLayerCrop](#setlayercrop) )(uint32_t devId, uint32_t layerId, [IRect](_i_rect.md) \*rect) | 设置图层裁剪区域。 [更多...](#setlayercrop) | +| ( [SetLayerZorder](#setlayerzorder) )(uint32_t devId, uint32_t layerId, uint32_t zorder) | 设置图层Z轴次序。 [更多...](#setlayerzorder) | +| ( [GetLayerZorder](#getlayerzorder) )(uint32_t devId, uint32_t layerId, uint32_t \*zorder) | 获取图层Z轴次序。 [更多...](#getlayerzorder) | +| ( [SetLayerPreMulti](#setlayerpremulti) )(uint32_t devId, uint32_t layerId, bool preMul) | 设置图层预乘。 [更多...](#setlayerpremulti) | +| ( [GetLayerPreMulti](#getlayerpremulti) )(uint32_t devId, uint32_t layerId, bool \*preMul) | 获取图层预乘标识。 [更多...](#getlayerpremulti) | +| ( [SetLayerAlpha](#setlayeralpha) )(uint32_t devId, uint32_t layerId, [LayerAlpha](_layer_alpha.md) \*alpha) | 设置图层alpha值。 [更多...](#setlayeralpha) | +| ( [GetLayerAlpha](#getlayeralpha) )(uint32_t devId, uint32_t layerId, [LayerAlpha](_layer_alpha.md) \*alpha) | 获取图层alpha值。 [更多...](#getlayeralpha) | +| ( [SetLayerColorKey](#setlayercolorkey) )(uint32_t devId, uint32_t layerId, bool enable, uint32_t key) | 设置图层colorkey属性,在图层叠加时使用。 [更多...](#setlayercolorkey) | +| ( [GetLayerColorKey](#getlayercolorkey) )(uint32_t devId, uint32_t layerId, bool \*enable, uint32_t \*key) | 获取图层colorkey。 [更多...](#getlayercolorkey) | +| ( [SetLayerPalette](#setlayerpalette) )(uint32_t devId, uint32_t layerId, uint32_t \*palette, uint32_t len) | 设置图层调色板。 [更多...](#setlayerpalette) | +| ( [GetLayerPalette](#getlayerpalette) )(uint32_t devId, uint32_t layerId, uint32_t \*palette, uint32_t len) | 获取图层调色板。 [更多...](#getlayerpalette) | +| ( [SetTransformMode](#settransformmode) )(uint32_t devId, uint32_t layerId, [TransformType](_display.md#transformtype) type) | 设置图层变换模式,根据不同的场景设置图层的旋转、缩放、移位等。 [更多...](#settransformmode) | +| ( [SetLayerCompression](#setlayercompression) )(uint32_t devId, uint32_t layerId, int32_t compType) | 设置图层压缩功能 [更多...](#setlayercompression) | +| ( [GetLayerCompression](#getlayercompression) )(uint32_t devId, uint32_t layerId, int32_t \*compType) | 获取图层压缩功能是否打开。 [更多...](#getlayercompression) | +| ( [SetLayerDirtyRegion](#setlayerdirtyregion) )(uint32_t devId, uint32_t layerId, [IRect](_i_rect.md) \*region) | 设置图层刷新区域。 [更多...](#setlayerdirtyregion) | +| ( [GetLayerBuffer](#getlayerbuffer) )(uint32_t devId, uint32_t layerId, [LayerBuffer](_layer_buffer.md) \*buffer) | 获取图层的buffer。 [更多...](#getlayerbuffer) | +| ( [Flush](#flush) )(uint32_t devId, uint32_t layerId, [LayerBuffer](_layer_buffer.md) \*buffer) | 刷新图层。 [更多...](#flush) | +| ( [WaitForVBlank](#waitforvblank) )(uint32_t devId, uint32_t layerId, int32_t timeOut) | 实现等待帧消隐期到来功能。 [更多...](#waitforvblank) | +| ( [SnapShot](#snapshot) )(uint32_t devId, [LayerBuffer](_layer_buffer.md) \*buffer) | 实现抓图功能。 [更多...](#snapshot) | +| ( [SetLayerVisibleRegion](#setlayervisibleregion) )(uint32_t devId, uint32_t layerId, uint32_t num, [IRect](_i_rect.md) \*rect) | 设置一个图层的可见区域 [更多...](#setlayervisibleregion) | +| ( [SetLayerBuffer](#setlayerbuffer) )(uint32_t devId, uint32_t layerId, const BufferHandle \*buffer, int32_t fence) | 设置一个层的缓冲区。 [更多...](#setlayerbuffer) | +| ( [InvokeLayerCmd](#invokelayercmd) )(uint32_t devId, uint32_t layerId, uint32_t cmd,...) | 扩展接口 [更多...](#invokelayercmd) | +| ( [SetLayerCompositionType](#setlayercompositiontype) )(uint32_t devId, uint32_t layerId, [CompositionType](_display.md#compositiontype) type) | 设置客户端期望的组合类型 [更多...](#setlayercompositiontype) | +| ( [SetLayerBlendType](#setlayerblendtype) )(uint32_t devId, uint32_t layerId, [BlendType](_display.md#blendtype) type) | 设置混合类型 [更多...](#setlayerblendtype) | +| ( [SetLayerColorTransform](#setlayercolortransform) )(uint32_t devId, uint32_t layerId, const float \*matrix) | 设置图层当前的颜色转换矩阵。 [更多...](#setlayercolortransform) | +| ( [SetLayerColorDataSpace](#setlayercolordataspace) )(uint32_t devId, uint32_t layerId, [ColorDataSpace](_display.md#colordataspace) colorSpace) | 设置图层的颜色数据空间。 [更多...](#setlayercolordataspace) | +| ( [GetLayerColorDataSpace](#getlayercolordataspace) )(uint32_t devId, uint32_t layerId, [ColorDataSpace](_display.md#colordataspace) \*colorSpace) | 获取图层当前的颜色数据空间。 [更多...](#getlayercolordataspace) | +| ( [SetLayerMetaData](#setlayermetadata) )(uint32_t devId, uint32_t layerId, uint32_t num, const [HDRMetaData](_h_d_r_meta_data.md) \*metaData) | 设置图层的HDRmetaData。 [更多...](#setlayermetadata) | +| ( [SetLayerMetaDataSet](#setlayermetadataset) )(uint32_t devId, uint32_t layerId, [HDRMetadataKey](_display.md#hdrmetadatakey) key, uint32_t num, const uint8_t \*metaData) | 设置图层的metaData set。 [更多...](#setlayermetadataset) | +| ( [GetSupportedPresentTimestamp](#getsupportedpresenttimestamp) )(uint32_t devId, uint32_t layerId, [PresentTimestampType](_display.md#presenttimestamptype) \*type) | 获取图层支持的上屏时间戳类型。 [更多...](#getsupportedpresenttimestamp) | +| ( [GetHwPresentTimestamp](#gethwpresenttimestamp) )(uint32_t devId, uint32_t layerId, [PresentTimestamp](_present_timestamp.md) \*pts) | 获取图层的上屏时间戳信息。 [更多...](#gethwpresenttimestamp) | +| ( [SetLayerTunnelHandle](#setlayertunnelhandle) )(uint32_t devId, uint32_t layerId, ExtDataHandle \*handle) | 设置图层的tunnel句柄。 [更多...](#setlayertunnelhandle) | +| ( [GetLayerReleaseFence](#getlayerreleasefence) )(uint32_t devId, uint32_t layerId, int32_t \*fence) | 获取图层的同步栅栏。 [更多...](#getlayerreleasefence) | + + +## **详细描述** + +显示图层驱动接口结构体,定义显示图层驱动接口函数指针。 + + +## **类成员变量说明** + + +### CloseLayer + + +``` +int32_t(* LayerFuncs::CloseLayer) (uint32_t devId, uint32_t layerId) +``` + +**描述:** + +关闭图层。 + +在完成显示后,如果不在需要使用图层,调用关闭图层接口关闭图层。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +**OpenLayer** + + +### CreateLayer + + +``` +int32_t(* LayerFuncs::CreateLayer) (uint32_t devId, const LayerInfo *layerInfo, uint32_t *layerId) +``` + +**描述:** + +打开图层。 + +GUI在使用图层时,需要先根据图层信息打开图层,打开图层成功可获得图层ID,根据图层ID使用图层各接口。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerInfo | 输入参数,图层信息,上层GUI打开图层时需传递图层信息,包括图层类型,图层大小,像素格式等信息。 | +| layerId | 输入参数,图层ID,打开图层成功后返回给GUI的图层ID,用于标识唯一的图层。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[CloseLayer](#closelayer) + + +### DeinitDisplay + + +``` +int32_t(* LayerFuncs::DeinitDisplay) (uint32_t devId) +``` + +**描述:** + +取消初始化显示设备。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[InitDisplay](#initdisplay) + + +### Flush + + +``` +int32_t(* LayerFuncs::Flush) (uint32_t devId, uint32_t layerId, LayerBuffer *buffer) +``` + +**描述:** + +刷新图层。 + +将buffer显示数据刷新到指定的layerId图层上,实现图像数据显示到屏幕上。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| buffer | 输出参数,待刷新的buffer。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### GetDisplayInfo + + +``` +int32_t(* LayerFuncs::GetDisplayInfo) (uint32_t devId, DisplayInfo *dispInfo) +``` + +**描述:** + +获取显示设备相关信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| dispInfo | 输出参数,显示相关信息。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### GetHwPresentTimestamp + + +``` +int32_t(* LayerFuncs::GetHwPresentTimestamp) (uint32_t devId, uint32_t layerId, PresentTimestamp *pts) +``` + +**描述:** + +获取图层的上屏时间戳信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| layerId | 输入参数,指示需要操作的图层ID。 | +| pts | 输出参数,保存图层的上屏时间戳信息, 由接口实现层进行写入。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### GetLayerAlpha + + +``` +int32_t(* LayerFuncs::GetLayerAlpha) (uint32_t devId, uint32_t layerId, LayerAlpha *alpha) +``` + +**描述:** + +获取图层alpha值。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| alpha | 输出参数,保存获取的图层alpha值。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[SetLayerAlpha](#setlayeralpha) + + +### GetLayerBuffer + + +``` +int32_t(* LayerFuncs::GetLayerBuffer) (uint32_t devId, uint32_t layerId, LayerBuffer *buffer) +``` + +**描述:** + +获取图层的buffer。 + +向buffer中绘图后,调用Flush接口显示到屏幕上。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| buffer | 输出参数,保存获取的图层buffer。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[Flush](#flush) + + +### GetLayerColorDataSpace + + +``` +int32_t(* LayerFuncs::GetLayerColorDataSpace) (uint32_t devId, uint32_t layerId, ColorDataSpace *colorSpace) +``` + +**描述:** + +获取图层当前的颜色数据空间。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| layerId | 输入参数,指示需要操作的图层ID。 | +| colorSpace | 输出参数,保存对应图层的颜色数据空间。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### GetLayerColorKey + + +``` +int32_t(* LayerFuncs::GetLayerColorKey) (uint32_t devId, uint32_t layerId, bool *enable, uint32_t *key) +``` + +**描述:** + +获取图层colorkey。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| enable | 输出参数,保存获取的enable色键使能标识。 | +| key | 输出参数,保存获取的色键值,即颜色值。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[SetLayerColorKey](#setlayercolorkey) + + +### GetLayerCompression + + +``` +int32_t(* LayerFuncs::GetLayerCompression) (uint32_t devId, uint32_t layerId, int32_t *compType) +``` + +**描述:** + +获取图层压缩功能是否打开。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| compType | 输出参数,保存获取的图层压缩功能状态。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[SetLayerCompression](#setlayercompression) + + +### GetLayerPalette + + +``` +int32_t(* LayerFuncs::GetLayerPalette) (uint32_t devId, uint32_t layerId, uint32_t *palette, uint32_t len) +``` + +**描述:** + +获取图层调色板。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| palette | 输出参数,保存获取的图层调色板。 | +| len | 输入参数,调色板长度。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[SetLayerPalette](#setlayerpalette) + + +### GetLayerPreMulti + + +``` +int32_t(* LayerFuncs::GetLayerPreMulti) (uint32_t devId, uint32_t layerId, bool *preMul) +``` + +**描述:** + +获取图层预乘标识。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| preMul | 输出参数,保存获取的图层预乘使能标识。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[SetLayerPreMulti](#setlayerpremulti) + + +### GetLayerReleaseFence + + +``` +int32_t(* LayerFuncs::GetLayerReleaseFence) (uint32_t devId, uint32_t layerId, int32_t *fence) +``` + +**描述:** + +获取图层的同步栅栏。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| layerId | 输入参数,指示需要操作的图层ID。 | +| fence | 输出参数,保存图层的 release fence, 由接口实现层进行写入。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### GetLayerSize + + +``` +int32_t(* LayerFuncs::GetLayerSize) (uint32_t devId, uint32_t layerId, IRect *rect) +``` + +**描述:** + +获取图层大小。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| rect | 输出参数,保存获取的图层大小。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[SetLayerSize](#setlayersize) + + +### GetLayerVisibleState + + +``` +int32_t(* LayerFuncs::GetLayerVisibleState) (uint32_t devId, uint32_t layerId, bool *visible) +``` + +**描述:** + +获取图层是否可见状态。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| visible | 输出参数,保存获取的图层可见状态,true表示图层可见,false表示图层不可见。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[SetLayerVisible](#setlayervisible) + + +### GetLayerZorder + + +``` +int32_t(* LayerFuncs::GetLayerZorder) (uint32_t devId, uint32_t layerId, uint32_t *zorder) +``` + +**描述:** + +获取图层Z轴次序。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| zorder | 输出参数,保存获取的图层Z轴次序,为整数值,取值范围为[0, 255],值越大图层越往上排列。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[SetLayerZorder](#setlayerzorder) + + +### GetSupportedPresentTimestamp + + +``` +int32_t(* LayerFuncs::GetSupportedPresentTimestamp) (uint32_t devId, uint32_t layerId, PresentTimestampType *type) +``` + +**描述:** + +获取图层支持的上屏时间戳类型。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| layerId | 输入参数,指示需要操作的图层ID。 | +| type | 输出参数,保存图层支持的上屏时间戳类型, 由接口实现层进行写入。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### InitDisplay + + +``` +int32_t(* LayerFuncs::InitDisplay) (uint32_t devId) +``` + +**描述:** + +初始化显示设备。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[DeinitDisplay](#deinitdisplay) + + +### InvokeLayerCmd + + +``` +int32_t(* LayerFuncs::InvokeLayerCmd) (uint32_t devId, uint32_t layerId, uint32_t cmd,...) +``` + +**描述:** + +扩展接口 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备的ID。取值范围为0 ~ 4,其中0表示第一个显示设备,4表示最后一个显示设备。 | +| layerId | 输入参数,层ID,唯一标识一个层。可以对该层进行操作。 | +| cmd | 输入参数,表示扩展cmd,用于识别不同的意图。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### SetLayerAlpha + + +``` +int32_t(* LayerFuncs::SetLayerAlpha) (uint32_t devId, uint32_t layerId, LayerAlpha *alpha) +``` + +**描述:** + +设置图层alpha值。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| alpha | 输入参数,待设置的图层 alpha 值。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[GetLayerAlpha](#getlayeralpha) + + +### SetLayerBlendType + + +``` +int32_t(* LayerFuncs::SetLayerBlendType) (uint32_t devId, uint32_t layerId, BlendType type) +``` + +**描述:** + +设置混合类型 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备的ID。取值范围为0 ~ 4,其中0表示第一个显示设备,4表示最后一个显示设备。 | +| layerId | 输入参数,层ID,唯一标识一个层。可以对该层进行操作。 | +| type | 输入参数,指示混合类型。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### SetLayerBuffer + + +``` +int32_t(* LayerFuncs::SetLayerBuffer) (uint32_t devId, uint32_t layerId, const BufferHandle *buffer, int32_t fence) +``` + +**描述:** + +设置一个层的缓冲区。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备的ID。取值范围为0 ~ 4,其中0表示第一个显示设备,4表示最后一个显示设备。 | +| layerId | 输入参数,层ID,唯一标识一个层。可以对该层进行操作。 | +| buffer | 输入参数,指示缓冲区句柄的指针,该指针包含所有用于合成的缓冲区的所有信息。 | +| fence | 输入参数,同步文件的fd。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### SetLayerColorDataSpace + + +``` +int32_t(* LayerFuncs::SetLayerColorDataSpace) (uint32_t devId, uint32_t layerId, ColorDataSpace colorSpace) +``` + +**描述:** + +设置图层的颜色数据空间。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| layerId | 输入参数,指示需要操作的图层ID。 | +| colorSpace | 输入参数,表示需要设置的颜色数据空间。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### SetLayerColorKey + + +``` +int32_t(* LayerFuncs::SetLayerColorKey) (uint32_t devId, uint32_t layerId, bool enable, uint32_t key) +``` + +**描述:** + +设置图层colorkey属性,在图层叠加时使用。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| enable | 输入参数,待设置的色键使能标识。 | +| key | 输入参数,待设置的色键值,即颜色值。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[GetLayerColorKey](#getlayercolorkey) + + +### SetLayerColorTransform + + +``` +int32_t(* LayerFuncs::SetLayerColorTransform) (uint32_t devId, uint32_t layerId, const float *matrix) +``` + +**描述:** + +设置图层当前的颜色转换矩阵。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| layerId | 输入参数,指示需要操作的图层ID。 | +| matrix | 输入参数,表示需要设置的颜色转换模式。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### SetLayerCompositionType + + +``` +int32_t(* LayerFuncs::SetLayerCompositionType) (uint32_t devId, uint32_t layerId, CompositionType type) +``` + +**描述:** + +设置客户端期望的组合类型 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备的ID。取值范围为0 ~ 4,其中0表示第一个显示设备,4表示最后一个显示设备。 | +| layerId | 输入参数,层ID,唯一标识一个层。可以对该层进行操作。 | +| type | 输入参数,指示客户端期望的组合类型。它可能随实现而变化。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### SetLayerCompression + + +``` +int32_t(* LayerFuncs::SetLayerCompression) (uint32_t devId, uint32_t layerId, int32_t compType) +``` + +**描述:** + +设置图层压缩功能 + +在特定场景下,需要对图像数据进行压缩,可设置启动或关闭图层压缩功能。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| compType | 输入参数,图层压缩使能标识。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[GetLayerCompression](#getlayercompression) + + +### SetLayerCrop + + +``` +int32_t(* LayerFuncs::SetLayerCrop) (uint32_t devId, uint32_t layerId, IRect *rect) +``` + +**描述:** + +设置图层裁剪区域。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| rect | 输入参数,待设置的裁剪区域。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### SetLayerDirtyRegion + + +``` +int32_t(* LayerFuncs::SetLayerDirtyRegion) (uint32_t devId, uint32_t layerId, IRect *region) +``` + +**描述:** + +设置图层刷新区域。 + +GUI图形系统绘制好图像数据后,在调用Flush接口刷新屏幕之前需要设置图层刷新区域。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| region | 输入参数,待设置的刷新区域。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### SetLayerMetaData + + +``` +int32_t(* LayerFuncs::SetLayerMetaData) (uint32_t devId, uint32_t layerId, uint32_t num, const HDRMetaData *metaData) +``` + +**描述:** + +设置图层的HDRmetaData。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| layerId | 输入参数,指示需要操作的图层ID。 | +| num | 输入参数,metadata 数组个数。 | +| metaData | 输入参数,表示需要设置的 metadata 数组首地址。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### SetLayerMetaDataSet + + +``` +int32_t(* LayerFuncs::SetLayerMetaDataSet) (uint32_t devId, uint32_t layerId, HDRMetadataKey key, uint32_t num, const uint8_t *metaData) +``` + +**描述:** + +设置图层的metaData set。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| layerId | 输入参数,指示需要操作的图层ID。 | +| key | 输入参数,表示需要设置的 HDRMetadataKey。 | +| num | 输入参数,metadata 数组个数。 | +| metaData | 输入参数,表示需要设置的 metadata 数组首地址, 数据类型为uint8_t。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### SetLayerPalette + + +``` +int32_t(* LayerFuncs::SetLayerPalette) (uint32_t devId, uint32_t layerId, uint32_t *palette, uint32_t len) +``` + +**描述:** + +设置图层调色板。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| palette | 输入参数,待设置的图层调色板。 | +| len | 输入参数,调色板长度。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[GetLayerPalette](#getlayerpalette) + + +### SetLayerPreMulti + + +``` +int32_t(* LayerFuncs::SetLayerPreMulti) (uint32_t devId, uint32_t layerId, bool preMul) +``` + +**描述:** + +设置图层预乘。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| preMul | 输入参数,待设置的图层预乘使能标识,1表示使能图层预乘,0表示不使能图层预乘。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[GetLayerPreMulti](#getlayerpremulti) + + +### SetLayerSize + + +``` +int32_t(* LayerFuncs::SetLayerSize) (uint32_t devId, uint32_t layerId, IRect *rect) +``` + +**描述:** + +设置图层大小。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| rect | 输入参数,待设置的图层大小,单位为像素。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[GetLayerSize](#getlayersize) + + +### SetLayerTunnelHandle + + +``` +int32_t(* LayerFuncs::SetLayerTunnelHandle) (uint32_t devId, uint32_t layerId, ExtDataHandle *handle) +``` + +**描述:** + +设置图层的tunnel句柄。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,指示需要操作的设备ID。 | +| layerId | 输入参数,指示需要操作的图层ID。 | +| handle | 输入参数,表示需要设置的句柄。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### SetLayerVisible + + +``` +int32_t(* LayerFuncs::SetLayerVisible) (uint32_t devId, uint32_t layerId, bool visible) +``` + +**描述:** + +设置图层是否可见。 + +不可见情况下图层不显示在屏幕上,可见情况下图层显示在屏幕上。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| visible | 输入参数,待设置的图层可见标识,设置true表示图层可见,设置false表示图层不可见。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[GetLayerVisibleState](#getlayervisiblestate) + + +### SetLayerVisibleRegion + + +``` +int32_t(* LayerFuncs::SetLayerVisibleRegion) (uint32_t devId, uint32_t layerId, uint32_t num, IRect *rect) +``` + +**描述:** + +设置一个图层的可见区域 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备的ID。取值范围为0 ~ 4,其中0表示第一个显示设备,4表示最后一个显示设备。 | +| layerId | 输入参数,层ID,唯一标识一个层。可以对该层进行操作。 | +| num | 输入参数,指定rect的计数,该区域包含多个 [IRect](_i_rect.md),num表示该区域中有多少个rect区域。 | +| rect | 输出参数,rectes对象的指针。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### SetLayerZorder + + +``` +int32_t(* LayerFuncs::SetLayerZorder) (uint32_t devId, uint32_t layerId, uint32_t zorder) +``` + +**描述:** + +设置图层Z轴次序。 + +图层的Z序值越大,图层越靠上显示。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| zorder | 输入参数,待设置的图层Z序,为整数值,取值范围为[0, 255],值越大图层越往上排列。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + +**参见:** + +[GetLayerZorder](#getlayerzorder) + + +### SetTransformMode + + +``` +int32_t(* LayerFuncs::SetTransformMode) (uint32_t devId, uint32_t layerId, TransformType type) +``` + +**描述:** + +设置图层变换模式,根据不同的场景设置图层的旋转、缩放、移位等。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| type | 输入参数,待设置的图层变换模式。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### SnapShot + + +``` +int32_t(* LayerFuncs::SnapShot) (uint32_t devId, LayerBuffer *buffer) +``` + +**描述:** + +实现抓图功能。 + +本函数将显示设备上的图像数据截图保存到buffer中,用于调试、应用截图等场景。 + +otherwise. + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| buffer | 输出参数,保存截屏的buffer信息。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 + + +### WaitForVBlank + + +``` +int32_t(* LayerFuncs::WaitForVBlank) (uint32_t devId, uint32_t layerId, int32_t timeOut) +``` + +**描述:** + +实现等待帧消隐期到来功能。 + +该函数会让系统等待,直到帧消隐期到来,用于软件和硬件之间的同步。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| devId | 输入参数,显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备。 | +| layerId | 输入参数,图层ID,图层的唯一标识,根据图层ID操作图层。 | +| timeOut | 输入参数,超时时间,在设置的超时时间后,没有等到帧消隐期到来则超时返回。 | + +**返回:** + +DISPLAY_SUCCESS 表示执行成功。 + +其他值表示执行失败,具体错误码查看[DispErrCode](_display.md#disperrcode)。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_layer_info.md b/zh-cn/device-dev/reference/hdi-apis/_layer_info.md new file mode 100644 index 0000000000000000000000000000000000000000..dec0da93d00b2149b713cc2369472137edc4cb8f --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_layer_info.md @@ -0,0 +1,29 @@ +# LayerInfo + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [width](_display.md#width-27) | 图层宽度 | +| [height](_display.md#height-27) | 图层高度 | +| [type](_display.md#type-13) | 图层类型,包括图形层、视频层和媒体播放模式。 | +| [bpp](_display.md#bpp) | 每像素所占bit数 | +| [pixFormat](_display.md#pixformat-12) | 图层像素格式 | + + +## **详细描述** + +定义图层信息结构体。 + +在创建图层时,需要将LayerInfo传递给创建图层接口,创建图层接口根据图层信息创建相应图层。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_light.md b/zh-cn/device-dev/reference/hdi-apis/_light.md new file mode 100644 index 0000000000000000000000000000000000000000..62e49861d2aaad72185e10e690f2b52c59a93309 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_light.md @@ -0,0 +1,159 @@ +# Light + + +## **汇总** + + +### 文件 + + | 文件 | 描述 | +| -------- | -------- | +| [light_if.h](light__if_8h.md) | 声明light模块的通用API,可用于获取灯ID、打开或关闭灯、并设置灯光亮度和闪烁模式。 | +| [light_type.h](light_8typeh.md) | 定义灯的数据结构,包括灯ID、灯的模式、灯的闪烁模式和持续时间、灯的状态、灯的效果。 | + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [LightFlashEffect](_light_flash_effect.md) | 定义闪烁参数。 [更多...](_light_flash_effect.md) | +| [LightEffect](_light_effect.md) | 定义灯的效果参数。 [更多...](_light_effect.md) | +| [LightInfo](_light_info.md) | 定义灯的基本信息。 [更多...](_light_info.md) | +| [LightInterface](_light_interface.md) | 定义可以在灯上执行的基本操作。 [更多...](_light_interface.md) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [LightStatus](#lightstatus) { LIGHT_SUCCESS = 0, LIGHT_NOT_SUPPORT = -1, LIGHT_NOT_FLASH = -2, LIGHT_NOT_BRIGHTNESS = -3 } | 枚举灯模块的状态值。 [更多...](#lightstatus) | +| [LightId](#lightid) { LIGHT_ID_NONE = 0, LIGHT_ID_BATTERY = 1, LIGHT_ID_NOTIFICATIONS = 2, LIGHT_ID_ATTENTION = 3,   LIGHT_ID_BUTT = 4 } | 枚举灯类型 [更多...](#lightid) | +| [LightFlashMode](#lightflashmode) { LIGHT_FLASH_NONE = 0, LIGHT_FLASH_TIMED = 1, LIGHT_FLASH_BUTT = 2 } | 枚举灯的模式 [更多...](#lightflashmode) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [NewLightInterfaceInstance](#newlightinterfaceinstance) (void) | 创建LightInterface实例。 [更多...](#newlightinterfaceinstance) | +| [FreeLightInterfaceInstance](#freelightinterfaceinstance) (void) | 释放LightInterface实例和相关资源。 [更多...](#freelightinterfaceinstance) | + + +## **详细描述** + +灯模块对灯服务提供通用的接口能力。 + +灯模块为灯服务提供通用的接口去访问灯驱动。 服务获取灯驱动对象或代理后,可以调用相关的APIs接口获取灯信息、打开或关闭灯,并根据灯ID设置灯闪烁模式。 + +**Since:** + +3.1 + + +## **枚举类型说明** + + +### LightFlashMode + + +``` +enum LightFlashMode +``` + +**描述:** + +枚举灯的模式 + + | 枚举值 | 描述 | +| -------- | -------- | +| LIGHT_FLASH_NONE | 常亮。 | +| LIGHT_FLASH_TIMED | 闪烁。 | +| LIGHT_FLASH_BUTT | 无效模式。 | + + +### LightId + + +``` +enum LightId +``` + +**描述:** + +枚举灯类型 + + | 枚举值 | 描述 | +| -------- | -------- | +| LIGHT_ID_NONE | 未知ID。 | +| LIGHT_ID_BATTERY | 电源指示灯。 | +| LIGHT_ID_NOTIFICATIONS | 通知灯。 | +| LIGHT_ID_ATTENTION | 报警灯。 | +| LIGHT_ID_BUTT | 无效ID。 | + + +### LightStatus + + +``` +enum LightStatus +``` + +**描述:** + +枚举灯模块的状态值。 + + | 枚举值 | 描述 | +| -------- | -------- | +| LIGHT_SUCCESS | 操作成功。 | +| LIGHT_NOT_SUPPORT | 灯ID不支持。 | +| LIGHT_NOT_FLASH | 设置闪烁不支持。 | +| LIGHT_NOT_BRIGHTNESS | 设置亮度不支持。 | + + +## **函数说明** + + +### FreeLightInterfaceInstance() + + +``` +int32_t FreeLightInterfaceInstance (void ) +``` + +**描述:** + +释放LightInterface实例和相关资源。 + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + +**Since:** + +3.1 + + +### NewLightInterfaceInstance() + + +``` +const struct LightInterface* NewLightInterfaceInstance (void ) +``` + +**描述:** + +创建LightInterface实例。 + +创建的LightInterface实例可用于执行相关的灯控制操作。 + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + +**Since:** + +3.1 diff --git a/zh-cn/device-dev/reference/hdi-apis/_light_effect.md b/zh-cn/device-dev/reference/hdi-apis/_light_effect.md new file mode 100644 index 0000000000000000000000000000000000000000..7dd78f2c3efe8e9ac9f7a51ded19958470f1163b --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_light_effect.md @@ -0,0 +1,57 @@ +# LightEffect + + +## **概述** + +**所属模块:** + +[Light](_light.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [lightBrightness](#lightbrightness) | 亮度值。 | +| [flashEffect](#flasheffect) | 闪烁模式。 | + + +## **详细描述** + +定义灯的效果参数。 + +参数包括亮度和闪烁模式。 + +**Since:** + +3.1 + + +## **类成员变量说明** + + +### flashEffect + + +``` +struct LightFlashEffect LightEffect::flashEffect +``` + +**描述:** + +闪烁模式。详见[LightFlashEffect](_light_flash_effect.md)。 + + +### lightBrightness + + +``` +int32_t LightEffect::lightBrightness +``` + +**描述:** + +亮度值:Bits 24–31为扩展位,Bits 16–23为红色,bits 8–15为绿色,bits 0–7为蓝色。 如果字节段不等于0,指示打开相应颜色的灯。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_light_flash_effect.md b/zh-cn/device-dev/reference/hdi-apis/_light_flash_effect.md new file mode 100644 index 0000000000000000000000000000000000000000..9a8a9123a99ee397b85ff88fc9158af0a16d446e --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_light_flash_effect.md @@ -0,0 +1,70 @@ +# LightFlashEffect + + +## **概述** + +**所属模块:** + +[Light](_light.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [flashMode](#flashmode) | 闪烁模式。 | +| [onTime](#ontime) | 表示灯在闪烁期间点亮时持续的时间(毫秒)。 | +| [offTime](#offtime) | 表示灯在闪烁期间熄灭时持续的时间(毫秒)。 | + + +## **详细描述** + +定义闪烁参数。 + +这些参数包括闪烁模式以及闪烁期间指示灯的打开和关闭时间。 + +**Since:** + +3.1 + + +## **类成员变量说明** + + +### flashMode + + +``` +int32_t LightFlashEffect::flashMode +``` + +**描述:** + +闪烁模式,详见[LightFlashMode](_light.md#lightflashmode)。 + + +### offTime + + +``` +int32_t LightFlashEffect::offTime +``` + +**描述:** + +表示灯在闪烁期间熄灭时持续的时间(毫秒)。 + + +### onTime + + +``` +int32_t LightFlashEffect::onTime +``` + +**描述:** + +表示灯在闪烁期间点亮时持续的时间(毫秒)。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_light_info.md b/zh-cn/device-dev/reference/hdi-apis/_light_info.md new file mode 100644 index 0000000000000000000000000000000000000000..20d8387e71e256aaefa055c21bd9b66d208379d2 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_light_info.md @@ -0,0 +1,57 @@ +# LightInfo + + +## **概述** + +**所属模块:** + +[Light](_light.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [lightId](#lightid) | 灯ID | +| [reserved](#reserved) | 自定义扩展信息 | + + +## **详细描述** + +定义灯的基本信息。 + +基本的灯信息包括灯ID和自定义扩展信息。 + +**Since:** + +3.1 + + +## **类成员变量说明** + + +### lightId + + +``` +uint32_t LightInfo::lightId +``` + +**描述:** + +灯ID,详见[LightId](_light.md#lightid)。 + + +### reserved + + +``` +int32_t LightInfo::reserved +``` + +**描述:** + +自定义扩展信息。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_light_interface.md b/zh-cn/device-dev/reference/hdi-apis/_light_interface.md new file mode 100644 index 0000000000000000000000000000000000000000..2c966f0a5e37d9066bd23601d75fc2725529122c --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_light_interface.md @@ -0,0 +1,108 @@ +# LightInterface + + +## **概述** + +**所属模块:** + +[Light](_light.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [GetLightInfo](#getlightinfo) )([out] struct [LightInfo](_light_info.md) \*\*lightInfo, [out] uint32_t \*count) | 获取当前系统中所有类型的灯信息。 [更多...](#getlightinfo) | +| ( [TurnOnLight](#turnonlight) )([in] uint32_t lightId, [in] struct [LightEffect](_light_effect.md) \*effect) | 根据指定的灯ID打开列表中的可用灯。 [更多...](#turnonlight) | +| ( [TurnOffLight](#turnofflight) )([in] uint32_t lightId) | 根据指定的灯ID关闭列表中的可用灯。 [更多...](#turnofflight) | + + +## **详细描述** + +定义可以在灯上执行的基本操作。 + +操作包括获取灯的信息、打开或关闭灯、设置灯的亮度或闪烁模式。 + + +## **类成员变量说明** + + +### GetLightInfo + + +``` +int32_t(* LightInterface::GetLightInfo) ([out] struct LightInfo **lightInfo,[out] uint32_t *count) +``` + +**描述:** + +获取当前系统中所有类型的灯信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| lightInfo | 表示指向灯信息的二级指针,详见[LightInfo](_light_info.md)。 | +| count | 表示指向灯数量的指针。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### TurnOffLight + + +``` +int32_t(* LightInterface::TurnOffLight) ([in] uint32_t lightId) +``` + +**描述:** + +根据指定的灯ID关闭列表中的可用灯。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| lightId | 表示灯ID,详见[LightId](_light.md#lightid)。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### TurnOnLight + + +``` +int32_t(* LightInterface::TurnOnLight) ([in] uint32_t lightId,[in] struct LightEffect *effect) +``` + +**描述:** + +根据指定的灯ID打开列表中的可用灯。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| lightId | 表示灯ID,详见[LightId](_light.md#lightid)。 | +| effect | 表示指向灯效果的指针,如果lightbrightness字段为0时, 灯的亮度根据HCS配置的默认亮度进行设置,详见[LightEffect](_light_effect.md)。 | + +**返回:** + +如果操作成功,则返回0。 + +如果不支持灯ID,则返回-1。 + +如果不支持闪烁设置,则返回-2。 + +如果不支持亮度设置,则返回3。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_capture_ended_info.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_capture_ended_info.md new file mode 100644 index 0000000000000000000000000000000000000000..955b58092baa386c07225ccf5cd317e2cf6195ed --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_capture_ended_info.md @@ -0,0 +1,24 @@ +# OHOS::Camera::CaptureEndedInfo + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [streamId_](_camera.md#streamid-34) | 捕获的流ID。 | +| [frameCount_](_camera.md#framecount) | 捕获结束时已经抓取的帧数。 | + + +## **详细描述** + +捕获结束相关信息,用于捕获结束回调 **OnCaptureEnded**。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_capture_error_info.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_capture_error_info.md new file mode 100644 index 0000000000000000000000000000000000000000..fed70cf0c2f5339c6d17280d30ba324167a08120 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_capture_error_info.md @@ -0,0 +1,24 @@ +# OHOS::Camera::CaptureErrorInfo + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [streamId_](_camera.md#streamid-44) | 流ID。 | +| [error_](_camera.md#error) | 错误类型。 | + + +## **详细描述** + +流错误信息,用于回调[OnCaptureError](_camera.md#oncaptureerror)。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_capture_info.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_capture_info.md new file mode 100644 index 0000000000000000000000000000000000000000..d37ee91131ecde1979a36b9df4fddcca26378762 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_capture_info.md @@ -0,0 +1,25 @@ +# OHOS::Camera::CaptureInfo + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [streamIds_](_camera.md#streamids) | 捕获的流ID集合。 | +| [captureSetting_](_camera.md#capturesetting) | 捕获的配置信息。 | +| [enableShutterCallback_](_camera.md#enableshuttercallback) | 使能捕获回调,每一次捕获后都会触发 **OnFrameShutter**。 | + + +## **详细描述** + +捕获请求的相关信息。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_camera_device.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_camera_device.md new file mode 100644 index 0000000000000000000000000000000000000000..7000a726a8d5d1456daafc9e9baff100c162208b --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_camera_device.md @@ -0,0 +1,30 @@ +# OHOS::Camera::ICameraDevice + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| **DECLARE_INTERFACE_DESCRIPTOR** (u"HDI.Camera.V1_0.Device") | IPC通信token校验。 | +| [GetStreamOperator](_camera.md#getstreamoperator) (const OHOS::sptr< [IStreamOperatorCallback](_o_h_o_s_1_1_camera_1_1_i_stream_operator_callback.md) > &callback, OHOS::sptr< [IStreamOperator](_o_h_o_s_1_1_camera_1_1_i_stream_operator.md) > &streamOperator)=0 | 获取流操作句柄。 [更多...](_camera.md#getstreamoperator) | +| [UpdateSettings](_camera.md#updatesettings) (const std::shared_ptr< CameraSetting > &settings)=0 | 更新设备控制参数。 [更多...](_camera.md#updatesettings) | +| [SetResultMode](_camera.md#setresultmode) (const [ResultCallbackMode](_camera.md#resultcallbackmode) &mode)=0 | 设置metadata上报模式,逐帧上报还是设备状态变化时上报。 [更多...](_camera.md#setresultmode) | +| [GetEnabledResults](_camera.md#getenabledresults) (std::vector< MetaType > &results)=0 | 查询使能的metadata。 [更多...](_camera.md#getenabledresults) | +| [EnableResult](_camera.md#enableresult) (const std::vector< MetaType > &results)=0 | 打开metadata上报开关。 [更多...](_camera.md#enableresult) | +| [DisableResult](_camera.md#disableresult) (const std::vector< MetaType > &results)=0 | 关闭metadata上报开关。 [更多...](_camera.md#disableresult) | +| [Close](_camera.md#close) ()=0 | 关闭Camera设备。 [更多...](_camera.md#close) | + + +## **详细描述** + +Camera设备操作。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_camera_device_callback.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_camera_device_callback.md new file mode 100644 index 0000000000000000000000000000000000000000..4a7f16ecc6932bca6fc726e496004236aa3f81ad --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_camera_device_callback.md @@ -0,0 +1,25 @@ +# OHOS::Camera::ICameraDeviceCallback + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| **DECLARE_INTERFACE_DESCRIPTOR** (u"HDI.Camera.V1_0.DeviceCallback") | IPC通信token校验。 | +| [OnError](_camera.md#onerror) ([ErrorType](_camera.md#errortype) type, int32_t errorCode)=0 | 设备发生错误时调用,由调用者实现,用于返回错误信息给调用者。 [更多...](_camera.md#onerror) | +| [OnResult](_camera.md#onresult) (uint64_t timestamp, const std::shared_ptr< CameraMetadata > &result)=0 | 上报camera设备相关的metadata的回调,上报方式查看 [SetResultMode](_camera.md#setresultmode)。 [更多...](_camera.md#onresult) | + + +## **详细描述** + +Camera设备操作回调。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_camera_host.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_camera_host.md new file mode 100644 index 0000000000000000000000000000000000000000..a77249e55bb64230e8eb8c1d48e59c9623013a3e --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_camera_host.md @@ -0,0 +1,35 @@ +# OHOS::Camera::ICameraHost + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| **DECLARE_INTERFACE_DESCRIPTOR** (u"HDI.Camera.V1_0.Host") | IPC通信token校验。 | +| [SetCallback](_camera.md#setcallback) (const OHOS::sptr< [ICameraHostCallback](_o_h_o_s_1_1_camera_1_1_i_camera_host_callback.md) > &callback)=0 | 设置ICameraHost回调接口,回调函数参考 [ICameraHostCallback](_o_h_o_s_1_1_camera_1_1_i_camera_host_callback.md)。 [更多...](_camera.md#setcallback) | +| [GetCameraIds](_camera.md#getcameraids) (std::vector< std::string > &cameraIds)=0 | 获取当前可用的Camera设备ID列表。 [更多...](_camera.md#getcameraids) | +| [GetCameraAbility](_camera.md#getcameraability) (const std::string &cameraId, std::shared_ptr< CameraAbility > &ability)=0 | 获取Camera设备能力集合。 [更多...](_camera.md#getcameraability) | +| [OpenCamera](_camera.md#opencamera) (const std::string &cameraId, const OHOS::sptr< [ICameraDeviceCallback](_o_h_o_s_1_1_camera_1_1_i_camera_device_callback.md) > &callback, OHOS::sptr< [ICameraDevice](_o_h_o_s_1_1_camera_1_1_i_camera_device.md) > &device)=0 | 打开Camera设备。 [更多...](_camera.md#opencamera) | +| [SetFlashlight](_camera.md#setflashlight) (const std::string &cameraId, bool &isEnable)=0 | 打开或关闭闪光灯。 [更多...](_camera.md#setflashlight) | + + +### 静态 Public 成员函数 + + | 静态 Public 成员函数 | 描述 | +| -------- | -------- | +| [Get](_camera.md#get) (const char \*serviceName) | 获取ICameraHost实例。 [更多...](_camera.md#get) | + + +## **详细描述** + +Camera服务的管理类。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_camera_host_callback.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_camera_host_callback.md new file mode 100644 index 0000000000000000000000000000000000000000..7a0885b50d8f9647c9fd0dc82e9684dd2acdf255 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_camera_host_callback.md @@ -0,0 +1,26 @@ +# OHOS::Camera::ICameraHostCallback + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| **DECLARE_INTERFACE_DESCRIPTOR** (u"HDI.Camera.V1_0.HostCallback") | IPC通信token校验。 | +| [OnCameraStatus](_camera.md#oncamerastatus) (const std::string &cameraId, [CameraStatus](_camera.md#camerastatus) status)=0 | 用于Camera设备状态变化时上报状态信息给调用者。 [更多...](_camera.md#oncamerastatus) | +| [OnFlashlightStatus](_camera.md#onflashlightstatus) (const std::string &cameraId, [FlashlightStatus](_camera.md#flashlightstatus) status)=0 | 用于在闪光灯状态变化时上报状态信息给调用者。 [更多...](_camera.md#onflashlightstatus) | +| [OnCameraEvent](_camera.md#oncameraevent) (const std::string &cameraId, [CameraEvent](_camera.md#cameraevent) event)=0 | 在相机事件发生时调用。 [更多...](_camera.md#oncameraevent) | + + +## **详细描述** + +Camera服务的管理回调。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_offline_stream_operator.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_offline_stream_operator.md new file mode 100644 index 0000000000000000000000000000000000000000..f8793d89a49086de20c50ba6beb49a85107eaba9 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_offline_stream_operator.md @@ -0,0 +1,26 @@ +# OHOS::Camera::IOfflineStreamOperator + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| **DECLARE_INTERFACE_DESCRIPTOR** (u"HDI.Camera.V1_0.OfflineStreamOperator") | IPC通信token校验。 | +| [CancelCapture](_camera.md#cancelcapture-12) (int captureId)=0 | 取消捕获请求。 [更多...](_camera.md#cancelcapture-12) | +| [ReleaseStreams](_camera.md#releasestreams-12) (const std::vector< int > &streamIds)=0 | 释放离线流。 [更多...](_camera.md#releasestreams-12) | +| [Release](_camera.md#release) ()=0 | 释放所有离线流。 [更多...](_camera.md#release) | + + +## **详细描述** + +离线流的操作类。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_stream_operator.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_stream_operator.md new file mode 100644 index 0000000000000000000000000000000000000000..b38ca7889204518e9f9321b212375022a92b2acd --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_stream_operator.md @@ -0,0 +1,33 @@ +# OHOS::Camera::IStreamOperator + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| **DECLARE_INTERFACE_DESCRIPTOR** (u"HDI.Camera.V1_0.StreamOperator") | IPC通信token校验。 | +| [IsStreamsSupported](_camera.md#isstreamssupported) ([OperationMode](_camera.md#operationmode) mode, const std::shared_ptr< CameraMetadata > &modeSetting, const std::vector< std::shared_ptr< [StreamInfo](_o_h_o_s_1_1_camera_1_1_stream_info.md) >> &info, [StreamSupportType](_camera.md#streamsupporttype) &type)=0 | 查询是否支持添加参数对应的流 [更多...](_camera.md#isstreamssupported) | +| [CreateStreams](_camera.md#createstreams) (const std::vector< std::shared_ptr< [StreamInfo](_o_h_o_s_1_1_camera_1_1_stream_info.md) >> &streamInfos)=0 | 创建流。 [更多...](_camera.md#createstreams) | +| [ReleaseStreams](_camera.md#releasestreams-22) (const std::vector< int > &streamIds)=0 | 释放流。 [更多...](_camera.md#releasestreams-22) | +| [CommitStreams](_camera.md#commitstreams) ([OperationMode](_camera.md#operationmode) mode, const std::shared_ptr< CameraMetadata > &modeSetting)=0 | 配置流。 [更多...](_camera.md#commitstreams) | +| [GetStreamAttributes](_camera.md#getstreamattributes) (std::vector< std::shared_ptr< [StreamAttribute](_o_h_o_s_1_1_camera_1_1_stream_attribute.md) >> &attributes)=0 | 获取流的属性。 [更多...](_camera.md#getstreamattributes) | +| [AttachBufferQueue](_camera.md#attachbufferqueue) (int streamId, const OHOS::sptr< OHOS::IBufferProducer > &producer)=0 | 绑定生产者句柄和指定流。 [更多...](_camera.md#attachbufferqueue) | +| [DetachBufferQueue](_camera.md#detachbufferqueue) (int streamId)=0 | 解除生产者句柄和指定流的绑定关系。 [更多...](_camera.md#detachbufferqueue) | +| [Capture](_camera.md#capture) (int captureId, const std::shared_ptr< [CaptureInfo](_o_h_o_s_1_1_camera_1_1_capture_info.md) > &info, bool isStreaming)=0 | 捕获图像。 [更多...](_camera.md#capture) | +| [CancelCapture](_camera.md#cancelcapture-22) (int captureId)=0 | 取消捕获。 [更多...](_camera.md#cancelcapture-22) | +| [ChangeToOfflineStream](_camera.md#changetoofflinestream) (const std::vector< int > &streamIds, OHOS::sptr< [IStreamOperatorCallback](_o_h_o_s_1_1_camera_1_1_i_stream_operator_callback.md) > &callback, OHOS::sptr< [IOfflineStreamOperator](_o_h_o_s_1_1_camera_1_1_i_offline_stream_operator.md) > &offlineOperator)=0 | 将指定流转换成离线流。 [更多...](_camera.md#changetoofflinestream) | + + +## **详细描述** + +流的操作类。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_stream_operator_callback.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_stream_operator_callback.md new file mode 100644 index 0000000000000000000000000000000000000000..4935fd6e235e1850ee9309db17f28910e75f5996 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_i_stream_operator_callback.md @@ -0,0 +1,27 @@ +# OHOS::Camera::IStreamOperatorCallback + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| **DECLARE_INTERFACE_DESCRIPTOR** (u"HDI.Camera.V1_0.StreamOperatorCallback") | IPC通信token校验。 | +| [OnCaptureStarted](_camera.md#oncapturestarted) (int32_t captureId, const std::vector< int32_t > &streamIds)=0 | 捕获开始回调,在捕获开始时调用。 [更多...](_camera.md#oncapturestarted) | +| [OnCaptureEnded](_camera.md#oncaptureended) (int32_t captureId, const std::vector< std::shared_ptr< [CaptureEndedInfo](_o_h_o_s_1_1_camera_1_1_capture_ended_info.md) >> &infos)=0 | 捕获结束回调,在捕获结束时调用。 [更多...](_camera.md#oncaptureended) | +| [OnCaptureError](_camera.md#oncaptureerror) (int32_t captureId, const std::vector< std::shared_ptr< [CaptureErrorInfo](_o_h_o_s_1_1_camera_1_1_capture_error_info.md) >> &infos)=0 | 捕获错误回调,在捕获过程中发生错误时调用。 [更多...](_camera.md#oncaptureerror) | +| [OnFrameShutter](_camera.md#onframeshutter) (int32_t captureId, const std::vector< int32_t > &streamIds, uint64_t timestamp)=0 | 帧捕获回调。 [更多...](_camera.md#onframeshutter) | + + +## **详细描述** + +流的操作回调类。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_stream_attribute.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_stream_attribute.md new file mode 100644 index 0000000000000000000000000000000000000000..568e09e49daf3d929d6862a117be57fad26048eb --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_stream_attribute.md @@ -0,0 +1,31 @@ +# OHOS::Camera::StreamAttribute + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [streamId_](_camera.md#streamid-24) | 流的ID,用于在设备内唯一标识一条流。 | +| [width_](_camera.md#width-22) | 图像宽度。 | +| [height_](_camera.md#height-22) | 图像高度。 | +| [overrideFormat_](_camera.md#overrideformat) | 重写的图像格式。 | +| [overrideDatasapce_](_camera.md#overridedataspace) | 重写的图像颜色空间 | +| [producerUsage_](_camera.md#producerusage) | 重写后的生产者的使用方式。 | +| [producerBufferCount_](_camera.md#producerbuffercount) | 重写后的生产者缓存数量。 | +| [maxBatchCaptureCount_](_camera.md#maxbatchcapturecount) | 连拍支持的最大捕获帧数量。 | +| [maxCaptureCount_](_camera.md#maxcapturecount) | 最大的并发捕获请求个数,默认为1。 | + + +## **详细描述** + +流的属性。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_stream_info.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_stream_info.md new file mode 100644 index 0000000000000000000000000000000000000000..f258c8e39376ad1284bfaff72cbd2b4a8273b4d5 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_camera_1_1_stream_info.md @@ -0,0 +1,32 @@ +# OHOS::Camera::StreamInfo + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [streamId_](_camera.md#streamid-14) | 流的ID,用于在设备内唯一标识一条流。 | +| [width_](_camera.md#width-12) | 图像宽度。 | +| [height_](_camera.md#height-12) | 图像高度。 | +| [format_](_camera.md#format) | 图像格式。 | +| [datasapce_](_camera.md#dataspace) | 图像颜色空间。 | +| [intent_](_camera.md#intent) | 流类型。 | +| [tunneledMode_](_camera.md#tunneledmode) | 隧道模式,值为true时开启,false关闭。 | +| [bufferQueue_](_camera.md#bufferqueue) | 图形提供的生产者句柄。 | +| [minFrameDuration_](_camera.md#minframeduration) | 最小帧间隔。 | +| [encodeType_](_camera.md#encodetype) | 编码类型。 | + + +## **详细描述** + +流信息,用于创建流时传入相关的配置参数。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_u_s_b_device_info.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_u_s_b_device_info.md new file mode 100644 index 0000000000000000000000000000000000000000..0ae62b90c880862107a3d949d7b659b322ca278e --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_u_s_b_device_info.md @@ -0,0 +1,25 @@ +# OHOS::USB::USBDeviceInfo + + +## **概述** + +**所属模块:** + +[USB](_u_s_b.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [status](_u_s_b.md#status) | USB设备状态 | +| [busNum](_u_s_b.md#busnum-12) | USB总线编号 | +| [devNum](_u_s_b.md#devnum) | USB设备编号 | + + +## **详细描述** + +USB设备信息。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usb_ctrl_transfer.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usb_ctrl_transfer.md new file mode 100644 index 0000000000000000000000000000000000000000..545ea45988ed42a69dd6b855e100795956fb4850 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usb_ctrl_transfer.md @@ -0,0 +1,27 @@ +# OHOS::USB::UsbCtrlTransfer + + +## **概述** + +**所属模块:** + +[USB](_u_s_b.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [requestType](_u_s_b.md#requesttype) | 请求类型 | +| [requestCmd](_u_s_b.md#requestcmd) | 请求命令字 | +| [value](_u_s_b.md#value) | 请求值 | +| [index](_u_s_b.md#index) | 索引 | +| [timeout](_u_s_b.md#timeout) | 超时时间 | + + +## **详细描述** + +USB控制传输。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md new file mode 100644 index 0000000000000000000000000000000000000000..5df0bae75c4fc4c442c14211b38e55b2b928dba5 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md @@ -0,0 +1,24 @@ +# OHOS::USB::UsbDev + + +## **概述** + +**所属模块:** + +[USB](_u_s_b.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [busNum](_u_s_b.md#busnum-22) | USB总线编号 | +| [devAddr](_u_s_b.md#devaddr) | USB设备地址 | + + +## **详细描述** + +USB设备。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usb_info.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usb_info.md new file mode 100644 index 0000000000000000000000000000000000000000..f53374d6fe456acabef870f480b39db0ea1d9785 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usb_info.md @@ -0,0 +1,28 @@ +# OHOS::USB::UsbInfo + + +## **概述** + +**所属模块:** + +[USB](_u_s_b.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| [setDevInfoStatus](_u_s_b.md#setdevinfostatus) (int32_t status) | 设置USB设备状态。 [更多...](_u_s_b.md#setdevinfostatus) | +| [setDevInfoBusNum](_u_s_b.md#setdevinfobusnum) (int32_t busNum) | 设置USB总线编号。 [更多...](_u_s_b.md#setdevinfobusnum) | +| [setDevInfoDevNum](_u_s_b.md#setdevinfodevnum) (int32_t devNum) | 设置USB设备编号。 [更多...](_u_s_b.md#setdevinfodevnum) | +| [getDevInfoStatus](_u_s_b.md#getdevinfostatus) () const | 获取USB设备状态。 [更多...](_u_s_b.md#getdevinfostatus) | +| [getDevInfoBusNum](_u_s_b.md#getdevinfobusnum) () const | 获取USB总线编号。 [更多...](_u_s_b.md#getdevinfobusnum) | +| [getDevInfoDevNum](_u_s_b.md#getdevinfodevnum) () const | 获取USB设备编号。 [更多...](_u_s_b.md#getdevinfodevnum) | + + +## **详细描述** + +USB设备信息类。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md new file mode 100644 index 0000000000000000000000000000000000000000..e58adfe5cdf7a56550c81967622d862343ac384f --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md @@ -0,0 +1,24 @@ +# OHOS::USB::UsbPipe + + +## **概述** + +**所属模块:** + +[USB](_u_s_b.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [interfaceId](_u_s_b.md#interfaceid) | USB设备接口ID | +| [endpointId](_u_s_b.md#endpointid) | USB设备端点ID | + + +## **详细描述** + +管道信息。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usbd_client.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usbd_client.md new file mode 100644 index 0000000000000000000000000000000000000000..d20a86b90e38e55ed78995b3887747295b1e97a0 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usbd_client.md @@ -0,0 +1,57 @@ +# OHOS::USB::UsbdClient + + +## **概述** + +**所属模块:** + +[USB](_u_s_b.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| [OpenDevice](_u_s_b.md#opendevice) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev) | 打开设备,建立连接。 [更多...](_u_s_b.md#opendevice) | +| [CloseDevice](_u_s_b.md#closedevice) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev) | 关闭设备,释放与设备相关的所有系统资源。 [更多...](_u_s_b.md#closedevice) | +| [GetDeviceDescriptor](_u_s_b.md#getdevicedescriptor) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, std::vector< uint8_t > &descriptor) | 获取设备描述符。 [更多...](_u_s_b.md#getdevicedescriptor) | +| [GetStringDescriptor](_u_s_b.md#getstringdescriptor) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, uint8_t descId, std::vector< uint8_t > &descriptor) | 根据String ID获取设备的字符串描述符。 [更多...](_u_s_b.md#getstringdescriptor) | +| [GetConfigDescriptor](_u_s_b.md#getconfigdescriptor) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, uint8_t descId, std::vector< uint8_t > &descriptor) | 根据config ID获取设备的配置描述符config。 [更多...](_u_s_b.md#getconfigdescriptor) | +| [GetRawDescriptor](_u_s_b.md#getrawdescriptor) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, std::vector< uint8_t > &descriptor) | 获取原始描述符。 [更多...](_u_s_b.md#getrawdescriptor) | +| [GetFileDescriptor](_u_s_b.md#getfiledescriptor) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, int32_t &fd) | 获取文件描述符。 [更多...](_u_s_b.md#getfiledescriptor) | +| [SetConfig](_u_s_b.md#setconfig) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, uint8_t configIndex) | 设置当前的config信息。 [更多...](_u_s_b.md#setconfig) | +| [GetConfig](_u_s_b.md#getconfig) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, uint8_t &configIndex) | 获取当前的config信息。 [更多...](_u_s_b.md#getconfig) | +| [ClaimInterface](_u_s_b.md#claiminterface) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, uint8_t interfaceid, uint8_t force) | 打开接口,并声明独占接口,必须在数据传输前执行。 [更多...](_u_s_b.md#claiminterface) | +| [ReleaseInterface](_u_s_b.md#releaseinterface) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, uint8_t interfaceid) | 关闭接口,释放接口的占用,在停止数据传输后执行。 [更多...](_u_s_b.md#releaseinterface) | +| [SetInterface](_u_s_b.md#setinterface) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, uint8_t interfaceid, uint8_t altIndex) | 设置指定接口的备选设置,用于在具有相同ID但不同备用设置的两个接口之间进行选择。 [更多...](_u_s_b.md#setinterface) | +| [BulkTransferRead](_u_s_b.md#bulktransferread) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, int32_t timeout, std::vector< uint8_t > &data) | 在给定端点上执行批量数据读取,返回读取的数据和长度,端点方向必须为数据读取,可以设置超时时间。 [更多...](_u_s_b.md#bulktransferread) | +| [BulkTransferWrite](_u_s_b.md#bulktransferwrite) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, int32_t timeout, const std::vector< uint8_t > &data) | 在给定端点上执行批量数据写入, 返回读取的数据和长度,端点方向必须为数据写入。 [更多...](_u_s_b.md#bulktransferwrite) | +| [ControlTransfer](_u_s_b.md#controltransfer) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbCtrlTransfer](_o_h_o_s_1_1_u_s_b_1_1_usb_ctrl_transfer.md) &ctrl, std::vector< uint8_t > &data) | 对此设备执行端点零的控制事务,传输方向由请求类型决定。 如果requestType& USB_ENDPOINT_DIR_MASK是USB_DIR_OUT ,则传输是写入,如果是USB_DIR_IN ,则传输是读取。 [更多...](_u_s_b.md#controltransfer) | +| [InterruptTransferRead](_u_s_b.md#interrupttransferread) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, int32_t timeout, std::vector< uint8_t > &data) | 在给定端点上执行中断数据读取, 返回读取的数据和长度,端点方向必须为数据读取。 [更多...](_u_s_b.md#interrupttransferread) | +| [InterruptTransferWrite](_u_s_b.md#interrupttransferwrite) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, int32_t timeout, std::vector< uint8_t > &data) | 在给定端点上执行中断数据写入, 返回读取的数据和长度,端点方向必须为数据写入。 [更多...](_u_s_b.md#interrupttransferwrite) | +| [IsoTransferRead](_u_s_b.md#isotransferread) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, int32_t timeout, std::vector< uint8_t > &data) | 在给定端点上执行等时数据读取, 返回读取的数据和长度,端点方向必须为数据读取。 [更多...](_u_s_b.md#isotransferread) | +| [IsoTransferWrite](_u_s_b.md#isotransferwrite) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, int32_t timeout, std::vector< uint8_t > &data) | 在给定端点上执行等时数据写入, 返回读取的数据和长度,端点方向必须为数据写入。 [更多...](_u_s_b.md#isotransferwrite) | +| [RequestQueue](_u_s_b.md#requestqueue) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, const std::vector< uint8_t > &clientData, const std::vector< uint8_t > &buffer) | 将指定的端点进行异步数据发送或者接收请求,数据传输方向由端点方向决定。 [更多...](_u_s_b.md#requestqueue) | +| [RequestWait](_u_s_b.md#requestwait) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, std::vector< uint8_t > &clientData, std::vector< uint8_t > &buffer, int32_t timeout) | 等待RequestQueue异步请求的操作结果。 [更多...](_u_s_b.md#requestwait) | +| [RequestCancel](_u_s_b.md#requestcancel) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe) | 取消待处理的数据请求。 [更多...](_u_s_b.md#requestcancel) | +| [GetCurrentFunctions](_u_s_b.md#getcurrentfunctions) (int32_t &funcs) | 获取从设备支持的功能列表(按位域表示)(从设备)。 [更多...](_u_s_b.md#getcurrentfunctions) | +| [SetCurrentFunctions](_u_s_b.md#setcurrentfunctions) (int32_t funcs) | 设置从设备支持的功能列表(按位域表示)(从设备)。 [更多...](_u_s_b.md#setcurrentfunctions) | +| [SetPortRole](_u_s_b.md#setportrole) (int32_t portId, int32_t powerRole, int32_t dataRole) | 设置port端口的角色。 [更多...](_u_s_b.md#setportrole) | +| [QueryPort](_u_s_b.md#queryport) (int32_t &portId, int32_t &powerRole, int32_t &dataRole, int32_t &mode) | 查询port端口的当前设置。 [更多...](_u_s_b.md#queryport) | +| [BindUsbdSubscriber](_u_s_b.md#bindusbdsubscriber) (const sptr< [UsbdSubscriber](_o_h_o_s_1_1_u_s_b_1_1_usbd_subscriber.md) > &subscriber) | 绑定订阅者。 [更多...](_u_s_b.md#bindusbdsubscriber) | +| [UnbindUsbdSubscriber](_u_s_b.md#unbindusbdsubscriber) (const sptr< [UsbdSubscriber](_o_h_o_s_1_1_u_s_b_1_1_usbd_subscriber.md) > &subscriber) | 解绑订阅者。 [更多...](_u_s_b.md#unbindusbdsubscriber) | +| [RegBulkCallback](_u_s_b.md#regbulkcallback) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, const sptr< IRemoteObject > &cb) | 注册批量传输异步回调函数。 [更多...](_u_s_b.md#regbulkcallback) | +| [UnRegBulkCallback](_u_s_b.md#unregbulkcallback) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe) | 注销批量传输异步回调函数。 [更多...](_u_s_b.md#unregbulkcallback) | +| [BulkRead](_u_s_b.md#bulkread) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, sptr< Ashmem > &ashmem) | 批量传输异步读数据。 [更多...](_u_s_b.md#bulkread) | +| [BulkWrite](_u_s_b.md#bulkwrite) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, sptr< Ashmem > &ashmem) | 批量传输异步写数据。 [更多...](_u_s_b.md#bulkwrite) | +| [BulkCancel](_u_s_b.md#bulkcancel) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe) | 批量传输异步取消接口,用于取消当前接口的异步批量读写操作。 [更多...](_u_s_b.md#bulkcancel) | + + +### 静态 Public 成员函数 + + | 静态 Public 成员函数 | 描述 | +| -------- | -------- | +| **GetInstance** () | 获取实例。 | diff --git a/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usbd_subscriber.md b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usbd_subscriber.md new file mode 100644 index 0000000000000000000000000000000000000000..eb3e0c18fde07c792180193dc475526117db1c53 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_o_h_o_s_1_1_u_s_b_1_1_usbd_subscriber.md @@ -0,0 +1,20 @@ +# OHOS::USB::UsbdSubscriber + + +## **概述** + +**所属模块:** + +[USB](_u_s_b.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| [DeviceEvent](_u_s_b.md#deviceevent) (const [UsbInfo](_o_h_o_s_1_1_u_s_b_1_1_usb_info.md) &info)=0 | 设备事件。 [更多...](_u_s_b.md#deviceevent) | +| [PortChangedEvent](_u_s_b.md#portchangedevent) (int32_t portId, int32_t powerRole, int32_t dataRole, int32_t mode)=0 | 端口改变事件。 [更多...](_u_s_b.md#portchangedevent) | +| [OnRemoteRequest](_u_s_b.md#onremoterequest) (uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override | 远程请求。 [更多...](_u_s_b.md#onremoterequest) | diff --git a/zh-cn/device-dev/reference/hdi-apis/_omx_codec_buffer.md b/zh-cn/device-dev/reference/hdi-apis/_omx_codec_buffer.md new file mode 100644 index 0000000000000000000000000000000000000000..9b59c569ce179b8ea38d724027c1726aeeaf40c1 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_omx_codec_buffer.md @@ -0,0 +1,194 @@ +# OmxCodecBuffer + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [bufferId](#bufferid) | buffer的ID。 | +| [size](#size) | 结构体大小。 | +| [version](#version) | 组件版本信息。 | +| [bufferType](#buffertype) | buffer类型。 | +| [buffer](#buffer) | 编码或者解码使用的buffer。 | +| [bufferLen](#bufferlen) | buffer大小。 | +| [allocLen](#alloclen) | 申请的buffer大小。 | +| [filledLen](#filledlen) | 填充的buffer大小。 | +| [offset](#offset) | 有效数据从缓冲区开始的起始偏移量。 | +| [fenceFd](#fencefd) | 该描述符来自buffer消费者,Codec等待成功后才可以使用输入或者输出buffer。 | +| [type](#type) | 共享内存类型。 | +| [pts](#pts) | 时间戳。 | +| [flag](#flag) | 标志。 | + + +## **详细描述** + +Codec buffer信息的定义。 + + +## **类成员变量说明** + + +### allocLen + + +``` +uint32_t OmxCodecBuffer::allocLen +``` + +**描述:** + +申请的buffer大小 + + +### buffer + + +``` +uint8_t* OmxCodecBuffer::buffer +``` + +**描述:** + +编码或者解码使用的buffer + + +### bufferId + + +``` +uint32_t OmxCodecBuffer::bufferId +``` + +**描述:** + +buffer ID + + +### bufferLen + + +``` +uint32_t OmxCodecBuffer::bufferLen +``` + +**描述:** + +buffer大小 + + +### bufferType + + +``` +enum CodecBufferType OmxCodecBuffer::bufferType +``` + +**描述:** + +buffer类型 + + +### fenceFd + + +``` +int32_t OmxCodecBuffer::fenceFd +``` + +**描述:** + +该描述符来自buffer消费者,Codec等待成功后才可以使用输入或者输出buffer + + +### filledLen + + +``` +uint32_t OmxCodecBuffer::filledLen +``` + +**描述:** + +填充的buffer大小 + + +### flag + + +``` +uint32_t OmxCodecBuffer::flag +``` + +**描述:** + +标志 + + +### offset + + +``` +uint32_t OmxCodecBuffer::offset +``` + +**描述:** + +有效数据从缓冲区开始的起始偏移量 + + +### pts + + +``` +int64_t OmxCodecBuffer::pts +``` + +**描述:** + +时间戳 + + +### size + + +``` +uint32_t OmxCodecBuffer::size +``` + +**描述:** + +结构体大小 + + +### type + + +``` +enum ShareMemTypes OmxCodecBuffer::type +``` + +**描述:** + +共享内存类型 + + +### version + + +``` +union OMX_VERSIONTYPE OmxCodecBuffer::version +``` + +**描述:** + +组件版本信息 diff --git a/zh-cn/device-dev/reference/hdi-apis/_pin_auth_types_8idl.md b/zh-cn/device-dev/reference/hdi-apis/_pin_auth_types_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..9e2a1a49e5be8d62450f959d90cca14151476c7e --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_pin_auth_types_8idl.md @@ -0,0 +1,45 @@ +# PinAuthTypes.idl + + +## **概述** + +**所属模块:** + +[HdfPinAuth](_hdf_pin_auth.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [ExecutorInfo](_executor_info.md) | 执行器信息。 [更多...](_executor_info.md) | +| [TemplateInfo](_template_info.md) | 凭据模版信息。 [更多...](_template_info.md) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [AuthType](_hdf_pin_auth.md#authtype) : int {   PIN = 1, FACE = 2, FINGERPRINT = 4 } | 枚举用户认证凭据类型。 [更多...](_hdf_face_auth.md#authtype) | +| [ExecutorRole](_hdf_pin_auth.md#executorrole) : int {   COLLECTOR = 1, VERIFIER = 2, ALL_IN_ONE = 3 } | 枚举执行器角色。 [更多...](_hdf_face_auth.md#executorrole) | +| [ExecutorSecureLevel](_hdf_pin_auth.md#executorsecurelevel) : int {   ESL0 = 0, ESL1 = 1, ESL2 = 2, ESL3 = 3 } | 枚举执行器安全等级。 [更多...](_hdf_face_auth.md#executorsecurelevel) | +| [CommandId](_hdf_pin_auth.md#commandid) : int { DEFAULT = 0 } | 枚举口令认证功能相关操作命令。 [更多...](_hdf_face_auth.md#commandid) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.pin_auth.v1_0 | 口令认证接口的包路径 | + + +## **详细描述** + +定义口令认证驱动的枚举类和数据结构。 + +**Since:** + +3.2 diff --git a/zh-cn/device-dev/reference/hdi-apis/_power_types_8idl.md b/zh-cn/device-dev/reference/hdi-apis/_power_types_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..179b60a2a0a0261d0e9d3c8afd29316395f440ef --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_power_types_8idl.md @@ -0,0 +1,42 @@ +# PowerTypes.idl + + +## **概述** + +**所属模块:** + +[Power](power.md) + + +## **汇总** + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [PowerHdfCmd](power.md#powerhdfcmd) {   CMD_REGISTER_CALLBCK = 0, CMD_START_SUSPEND, CMD_STOP_SUSPEND, CMD_FORCE_SUSPEND,   CMD_SUSPEND_BLOCK, CMD_SUSPEND_UNBLOCK, CMD_DUMP } | 枚举电源命令的参数。 [更多...](power.md#powerhdfcmd) | +| [PowerHdfCallbackCmd](power.md#powerhdfcallbackcmd) { CMD_ON_SUSPEND = 0, CMD_ON_WAKEUP } | 枚举电源状态回调的参数。 [更多...](power.md#powerhdfcallbackcmd) | +| [PowerHdfState](power.md#powerhdfstate) { AWAKE = 0, INACTIVE, SLEEP } | 枚举电源的状态。 [更多...](power.md#powerhdfstate) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.power.v1_0 | 电源管理接口的包路径 | + + +## **详细描述** + +电源相关的数据类型。 + +电源管理中使用的数据类型,包括命令参数、回调参数和系统状态。 + +**Since:** + +3.1 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/_present_timestamp.md b/zh-cn/device-dev/reference/hdi-apis/_present_timestamp.md new file mode 100644 index 0000000000000000000000000000000000000000..75be9d799ef7eb95d18e7484fcf739a32cf44408 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_present_timestamp.md @@ -0,0 +1,24 @@ +# PresentTimestamp + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [type](_display.md#type-33) | 上屏时间戳类型 | +| [time](_display.md#time) | 类型对应的值 | + + +## **详细描述** + +上屏时间戳结构体定义。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_property_object.md b/zh-cn/device-dev/reference/hdi-apis/_property_object.md new file mode 100644 index 0000000000000000000000000000000000000000..5520d0be40f9064035c5f374f32739ebe89798dc --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_property_object.md @@ -0,0 +1,25 @@ +# PropertyObject + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [name](_display.md#name-12) [PROPERTY_NAME_LEN] | 属性名称 | +| [propId](_display.md#propid) | 属性ID | +| [value](_display.md#value-12) | 属性值 | + + +## **详细描述** + +定义包含名称、属性ID和值的属性对象。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_range_value.md b/zh-cn/device-dev/reference/hdi-apis/_range_value.md new file mode 100644 index 0000000000000000000000000000000000000000..723b312f4a6bb0b12078398487a4ba026204d60d --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_range_value.md @@ -0,0 +1,51 @@ +# RangeValue + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [min](#min) | 最小值 | +| [max](#max) | 最大值 | + + +## **详细描述** + +取值范围的定义。 + + +## **类成员变量说明** + + +### max + + +``` +int32_t RangeValue::max +``` + +**描述:** + +最大值 + + +### min + + +``` +int32_t RangeValue::min +``` + +**描述:** + +最小值 diff --git a/zh-cn/device-dev/reference/hdi-apis/_rect.md b/zh-cn/device-dev/reference/hdi-apis/_rect.md new file mode 100644 index 0000000000000000000000000000000000000000..c241e45e26485c1110984ac3a9bd24cfecb53422 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_rect.md @@ -0,0 +1,51 @@ +# Rect + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [width](#width) | 矩形的宽 | +| [height](#height) | 矩形的高 | + + +## **详细描述** + +矩形的定义。 + + +## **类成员变量说明** + + +### height + + +``` +int32_t Rect::height +``` + +**描述:** + +矩形的高 + + +### width + + +``` +int32_t Rect::width +``` + +**描述:** + +矩形的宽 diff --git a/zh-cn/device-dev/reference/hdi-apis/_rectangle.md b/zh-cn/device-dev/reference/hdi-apis/_rectangle.md new file mode 100644 index 0000000000000000000000000000000000000000..374827e42143f6317681811d5d2c53c30469ced8 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_rectangle.md @@ -0,0 +1,24 @@ +# Rectangle + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [rect](_display.md#rect) | 矩形区域 | +| [color](_display.md#color-33) | 矩形颜色 | + + +## **详细描述** + +矩形描述结构体定义,用于硬件加速绘制矩形。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_schedule_info.md b/zh-cn/device-dev/reference/hdi-apis/_schedule_info.md new file mode 100644 index 0000000000000000000000000000000000000000..4fcebffea49a53a5907520898ee73d4e84f4b09e --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_schedule_info.md @@ -0,0 +1,111 @@ +# ScheduleInfo + + +## **概述** + +**所属模块:** + +[HdfUserAuth](_hdf_user_auth.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [scheduleId](#scheduleid) | 调度ID,用于标识一次操作请求的执行器调度过程。 | +| [templateIds](#templateids) | 模版ID列表。 | +| [authType](#authtype) | 用户认证凭据类型。 | +| [executorMatcher](#executormatcher) | 执行器匹配器。 | +| [scheduleMode](#schedulemode) | 调度模式,支持注册、认证和识别模式。 | +| [executors](#executors) | 执行器信息列表。 | + + +## **详细描述** + +调度信息。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### authType + + +``` +enum AuthType ScheduleInfo::authType +``` + +**描述:** + +用户认证凭据类型。 + + +### executors + + +``` +struct ExecutorInfo [] ScheduleInfo::executors +``` + +**描述:** + +执行器信息列表。 + + +### executorMatcher + + +``` +unsigned int ScheduleInfo::executorMatcher +``` + +**描述:** + +执行器匹配器。 + + +### scheduleId + + +``` +unsigned long ScheduleInfo::scheduleId +``` + +**描述:** + +调度ID,用于标识一次操作请求的执行器调度过程。 + + +### scheduleMode + + +``` +unsigned int ScheduleInfo::scheduleMode +``` + +**描述:** + +调度模式,支持注册、认证和识别模式。 + + +### templateIds + + +``` +unsigned long [] ScheduleInfo::templateIds +``` + +**描述:** + +模版ID列表。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_sensor.md b/zh-cn/device-dev/reference/hdi-apis/_sensor.md new file mode 100644 index 0000000000000000000000000000000000000000..2cdb5edfed5917b6443ae3110efdc54f699160be --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_sensor.md @@ -0,0 +1,326 @@ +# Sensor + + +## **汇总** + + +### 文件 + + | 文件 | 描述 | +| -------- | -------- | +| [sensor_if.h](sensor__if_8h.md) | Sensor模块对外通用的接口声明文件,提供获取传感器设备信息、订阅/去订阅传感器数据、 使能/去使能传感器、设置传感器模式、设置传感器精度,量程等可选配置接口定义。 | +| [sensor_type.h](sensor__type_8h.md) | 定义传感器模块所使用的传感器类型,传感器信息,传感器数据结构等数据类型。 | + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [SensorInterface](_sensor_interface.md) | 提供sensor设备基本控制操作接口。 [更多...](_sensor_interface.md) | +| [SensorInformation](_sensor_information.md) | 定义传感器基本信息。 [更多...](_sensor_information.md) | +| [SensorEvents](_sensor_events.md) | 上报传感器数据结构。 [更多...](_sensor_events.md) | + + +### 宏定义 + + | 宏定义 | 描述 | +| -------- | -------- | +| [SENSOR_NAME_MAX_LEN](#sensornamemaxlen)   32 | Sensor名称的最大长度。 | +| [SENSOR_VERSION_MAX_LEN](#sensorversionmaxlen)   16 | Sensor版本号的最大长度。 | + + +### 类型定义 + + | 类型定义 | 描述 | +| -------- | -------- | +| ([RecordDataCallback](#recorddatacallback)) (const struct [SensorEvents](_sensor_events.md) \*) | 传感器上报数据回调函数的定义,传感器服务用户在订阅传感器时, 需要注册上报数据回调函数,传感器使能后,传感器服务用户可以接受到传感器数据,详见[SensorInterface](_sensor_interface.md)。 [更多...](#recorddatacallback) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [SensorStatus](#sensorstatus) { SENSOR_SUCCESS = 0, SENSOR_FAILURE = -1, SENSOR_NOT_SUPPORT = -2, SENSOR_INVALID_PARAM = -3,   SENSOR_INVALID_SERVICE = -4, SENSOR_NULL_PTR = -5 } | 定义传感器模块返回值类型。 [更多...](#sensorstatus) | +| [SensorTypeTag](#sensortypetag) { SENSOR_TYPE_NONE = 0, SENSOR_TYPE_ACCELEROMETER = 1, SENSOR_TYPE_GYROSCOPE = 2, SENSOR_TYPE_PHOTOPLETHYSMOGRAPH = 3,   SENSOR_TYPE_ELECTROCARDIOGRAPH = 4, SENSOR_TYPE_AMBIENT_LIGHT = 5, SENSOR_TYPE_MAGNETIC_FIELD = 6, SENSOR_TYPE_CAPACITIVE = 7,   SENSOR_TYPE_BAROMETER = 8, SENSOR_TYPE_TEMPERATURE = 9, SENSOR_TYPE_HALL = 10, SENSOR_TYPE_GESTURE = 11,   SENSOR_TYPE_PROXIMITY = 12, SENSOR_TYPE_HUMIDITY = 13, SENSOR_TYPE_MEDICAL_BEGIN = 128, SENSOR_TYPE_MEDICAL_END = 160,   SENSOR_TYPE_PHYSICAL_MAX = 255, SENSOR_TYPE_ORIENTATION = 256, SENSOR_TYPE_GRAVITY = 257, SENSOR_TYPE_LINEAR_ACCELERATION = 258,   SENSOR_TYPE_ROTATION_VECTOR = 259, SENSOR_TYPE_AMBIENT_TEMPERATURE = 260, SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED = 261, SENSOR_TYPE_GAME_ROTATION_VECTOR = 262,   SENSOR_TYPE_GYROSCOPE_UNCALIBRATED = 263, SENSOR_TYPE_SIGNIFICANT_MOTION = 264, SENSOR_TYPE_PEDOMETER_DETECTION = 265, SENSOR_TYPE_PEDOMETER = 266,   SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR = 277, SENSOR_TYPE_HEART_RATE = 278, SENSOR_TYPE_DEVICE_ORIENTATION = 279, SENSOR_TYPE_WEAR_DETECTION = 280,   SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 281, SENSOR_TYPE_MAX } | 定义传感器类型标识。 [更多...](#sensortypetag) | +| [SensorAccuracyType](#sensoraccuracytype) { SENSOR_NO_ACCURACY = 0, SENSOR_LOW_ACCURACY = 1, SENSOR_MEDIUM_ACCURACY = 2, SENSOR_HIGH_ACCURACY = 3,   SENSOR_MAX_ACCURACY } | 传感器的精度类型。 [更多...](#sensoraccuracytype) | +| [SensorRangeType](#sensorrangetype) { SENSOR_RANGE_LEVEL1 = 0, SENSOR_RANGE_LEVEL2 = 1, SENSOR_RANGE_LEVEL3 = 2, SENSOR_RANGE_LEVEL_MAX } | 传感器的量程级别。 [更多...](#sensorrangetype) | +| [SensorModeType](#sensormodetype) { SENSOR_MODE_DEFAULT = 0, SENSOR_MODE_REALTIME = 1, SENSOR_MODE_ON_CHANGE = 2, SENSOR_MODE_ONE_SHOT = 3,   SENSOR_MODE_FIFO_MODE = 4, SENSOR_MODE_MAX } | 传感器的工作模式。 [更多...](#sensormodetype) | +| [SensorGroupType](#sensorgrouptype) { TRADITIONAL_SENSOR_TYPE = 0, MEDICAL_SENSOR_TYPE = 1, SENSOR_GROUP_TYPE_MAX } | 枚举传感器的硬件服务组。 [更多...](#sensorgrouptype) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [NewSensorInterfaceInstance](#newsensorinterfaceinstance) (void) | 创建传感器接口实例。 [更多...](#newsensorinterfaceinstance) | +| [FreeSensorInterfaceInstance](#freesensorinterfaceinstance) (void) | 释放传感器接口实例。 [更多...](#freesensorinterfaceinstance) | + + +## **详细描述** + +传感器设备驱动对传感器服务提供通用的接口能力。 + +模块提供传感器服务对传感器驱动访问统一接口,服务获取驱动对象或者代理后, 通过其提供的各类方法,以传感器id区分访问不同类型传感器设备,实现获取传感器设备信息、订阅/去订阅传感器数据、 使能/去使能传感器、设置传感器模式、设置传感器精度、量程等可选配置等。 + +**Since:** + +2.2 + +**Version:** + +1.0 + + +## **宏定义说明** + + +### SENSOR_NAME_MAX_LEN + + +``` +#define SENSOR_NAME_MAX_LEN 32 +``` + +**描述:** + +Sensor名称的最大长度。 + + +### SENSOR_VERSION_MAX_LEN + + +``` +#define SENSOR_VERSION_MAX_LEN 16 +``` + +**描述:** + +Sensor版本号的最大长度。 + + +## **类型定义说明** + + +### RecordDataCallback + + +``` +typedef int32_t(* RecordDataCallback) (const struct SensorEvents *) +``` + +**描述:** + +传感器上报数据回调函数的定义,传感器服务用户在订阅传感器时, 需要注册上报数据回调函数,传感器使能后,传感器服务用户可以接受到传感器数据,详见[SensorInterface](_sensor_interface.md)。 + + +## **枚举类型说明** + + +### SensorAccuracyType + + +``` +enum SensorAccuracyType +``` + +**描述:** + +传感器的精度类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| SENSOR_NO_ACCURACY | 无精度类型。 | +| SENSOR_LOW_ACCURACY | 低精度类型。 | +| SENSOR_MEDIUM_ACCURACY | 中等精度类型。 | +| SENSOR_HIGH_ACCURACY | 高精度类型。 | +| SENSOR_MAX_ACCURACY | 最大精度类型。 | + + +### SensorGroupType + + +``` +enum SensorGroupType +``` + +**描述:** + +枚举传感器的硬件服务组。 + + | 枚举值 | 描述 | +| -------- | -------- | +| TRADITIONAL_SENSOR_TYPE | 传统传感器类型,传感器ID枚举值范围为128-160。 | +| MEDICAL_SENSOR_TYPE | 医疗传感器类型,传感器ID枚举值范围不在128-160之间。 | +| SENSOR_GROUP_TYPE_MAX | 最大传感器类型。 | + + +### SensorModeType + + +``` +enum SensorModeType +``` + +**描述:** + +传感器的工作模式。 + + | 枚举值 | 描述 | +| -------- | -------- | +| SENSOR_MODE_DEFAULT | 传感器默认工作模式状态。 | +| SENSOR_MODE_REALTIME | 传感器实时工作模式状态,一组数据上报一次。 | +| SENSOR_MODE_ON_CHANGE | 传感器实时工作模式状态,状态变更上报一次。 | +| SENSOR_MODE_ONE_SHOT | 传感器实时工作模式状态,只上报一次。 | +| SENSOR_MODE_FIFO_MODE | 传感器缓存工作模式状态,根据配置的缓存大小上报。 | +| SENSOR_MODE_MAX | 传感器最大类型标识。 | + + +### SensorRangeType + + +``` +enum SensorRangeType +``` + +**描述:** + +传感器的量程级别。 + + | 枚举值 | 描述 | +| -------- | -------- | +| SENSOR_RANGE_LEVEL1 | 量程级别1。 | +| SENSOR_RANGE_LEVEL2 | 量程级别2。 | +| SENSOR_RANGE_LEVEL3 | 量程级别3。 | +| SENSOR_RANGE_LEVEL_MAX | 量程最大级别。 | + + +### SensorStatus + + +``` +enum SensorStatus +``` + +**描述:** + +定义传感器模块返回值类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| SENSOR_SUCCESS | 传感器执行成功。 | +| SENSOR_FAILURE | 传感器执行失败。 | +| SENSOR_NOT_SUPPORT | 传感器不支持。 | +| SENSOR_INVALID_PARAM | 传感器无效参数。 | +| SENSOR_INVALID_SERVICE | 传感器无效服务。 | +| SENSOR_NULL_PTR | 传感器空指针。 | + + +### SensorTypeTag + + +``` +enum SensorTypeTag +``` + +**描述:** + +定义传感器类型标识。 + + | 枚举值 | 描述 | +| -------- | -------- | +| SENSOR_TYPE_NONE | 空传感器类型,用于测试。 | +| SENSOR_TYPE_ACCELEROMETER | 加速度传感器。 | +| SENSOR_TYPE_GYROSCOPE | 陀螺仪传感器。 | +| SENSOR_TYPE_PHOTOPLETHYSMOGRAPH | 心率传感器。 | +| SENSOR_TYPE_ELECTROCARDIOGRAPH | 心电传感器。 | +| SENSOR_TYPE_AMBIENT_LIGHT | 环境光传感器。 | +| SENSOR_TYPE_MAGNETIC_FIELD | 地磁传感器。 | +| SENSOR_TYPE_CAPACITIVE | 电容传感器。 | +| SENSOR_TYPE_BAROMETER | 气压计传感器。 | +| SENSOR_TYPE_TEMPERATURE | 温度传感器。 | +| SENSOR_TYPE_HALL | 霍尔传感器。 | +| SENSOR_TYPE_GESTURE | 手势传感器。 | +| SENSOR_TYPE_PROXIMITY | 接近光传感器。 | +| SENSOR_TYPE_HUMIDITY | 湿度传感器。 | +| SENSOR_TYPE_MEDICAL_BEGIN | 医疗传感器ID枚举值范围的开始。 | +| SENSOR_TYPE_MEDICAL_END | 医疗传感器ID枚举值范围的结束。 | +| SENSOR_TYPE_PHYSICAL_MAX | 物理传感器最大类型。 | +| SENSOR_TYPE_ORIENTATION | 方向传感器。 | +| SENSOR_TYPE_GRAVITY | 重力传感器。 | +| SENSOR_TYPE_LINEAR_ACCELERATION | 线性加速度传感器。 | +| SENSOR_TYPE_ROTATION_VECTOR | 旋转矢量传感器。 | +| SENSOR_TYPE_AMBIENT_TEMPERATURE | 环境温度传感器 | +| SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED | 未校准磁场传感器。 | +| SENSOR_TYPE_GAME_ROTATION_VECTOR | 游戏旋转矢量传感器。 | +| SENSOR_TYPE_GYROSCOPE_UNCALIBRATED | 未校准陀螺仪传感器。 | +| SENSOR_TYPE_SIGNIFICANT_MOTION | 大幅度动作传感器。 | +| SENSOR_TYPE_PEDOMETER_DETECTION | 计步器检测传感器。 | +| SENSOR_TYPE_PEDOMETER | 计步器传感器。 | +| SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR | 地磁旋转矢量传感器。 | +| SENSOR_TYPE_HEART_RATE | 心率传感器。 | +| SENSOR_TYPE_DEVICE_ORIENTATION | 设备方向传感器。 | +| SENSOR_TYPE_WEAR_DETECTION | 佩戴检测传感器。 | +| SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED | 未校准加速度传感器。 | +| SENSOR_TYPE_MAX | 传感器类型最大个数标识。 | + + +## **函数说明** + + +### FreeSensorInterfaceInstance() + + +``` +int32_t FreeSensorInterfaceInstance (void ) +``` + +**描述:** + +释放传感器接口实例。 + +**返回:** + +如果释放实例成功,则返回0。 + +如果释放实例失败,则返回负值。 + +**Since:** + +2.2 + +**Version:** + +1.0 + + +### NewSensorInterfaceInstance() + + +``` +const struct SensorInterface* NewSensorInterfaceInstance (void ) +``` + +**描述:** + +创建传感器接口实例。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| sensorId | 表示传感器ID。有关详细信息,详见[SensorTypeTag](#sensortypetag)。 | +| cb | 表示要注册的回调函数。有关详细信息,详见[RecordDataCallback](#recorddatacallback)。 | + +**返回:** + +如果创建实例成功,则返回非零值。 + +如果创建实例失败,则返回负值。 + +**Since:** + +2.2 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/_sensor_events.md b/zh-cn/device-dev/reference/hdi-apis/_sensor_events.md new file mode 100644 index 0000000000000000000000000000000000000000..51c8079517f1e6cb44ca20b482c9dfc357328a1e --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_sensor_events.md @@ -0,0 +1,122 @@ +# SensorEvents + + +## **概述** + +**所属模块:** + +[Sensor](_sensor.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [sensorId](#sensorid) | 传感器的标识号。 | +| [version](#version) | 传感器算法版本号。 | +| [timestamp](#timestamp) | 传感器数据生成时间。 | +| [option](#option) | 传感器量程精度可选配置。 | +| [mode](#mode) | 传感器工作模式。 | +| [data](#data) | 传感器数据地址。 | +| [dataLen](#section0442151664211) | 传感器数据长度。 | + + +## **详细描述** + +上报传感器数据结构。 + +上报传感器设备数据事件信息包括传感器的标识号、传感器算法版本号、传感器数据生成时间、传感器量程精度可选配置、传感器工作模式、传感器数据地址、传感器数据长度。 + +**Since:** + +2.2 + + +## **类成员变量说明** + + +### data + + +``` +uint8_t* SensorEvents::data +``` + +**描述:** + +传感器数据地址。 + + +### mode + + +``` +int32_t SensorEvents::mode +``` + +**描述:** + +传感器工作模式。 + + +### option + + +``` +uint32_t SensorEvents::option +``` + +**描述:** + +传感器量程精度可选配置。 + + +### sensorId + + +``` +int32_t SensorEvents::sensorId +``` + +**描述:** + +传感器的标识号。 + + +### timestamp + + +``` +int64_t SensorEvents::timestamp +``` + +**描述:** + +传感器数据生成时间。 + + +### version + + +``` +int32_t SensorEvents::version +``` + +**描述:** + +传感器算法版本号。 + + +### h2dataLen + + +``` +int32_t SensorEvents::dataLen +``` + +**描述:** + +传感器算法版本号。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_sensor_information.md b/zh-cn/device-dev/reference/hdi-apis/_sensor_information.md new file mode 100644 index 0000000000000000000000000000000000000000..f3c35206a61c82b4ead25cb834fe2aa67fd741b7 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_sensor_information.md @@ -0,0 +1,148 @@ +# SensorInformation + + +## **概述** + +**所属模块:** + +[Sensor](_sensor.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [sensorName](#sensorname) [[SENSOR_NAME_MAX_LEN](_sensor.md#sensornamemaxlen)] | 传感器名称。 | +| [vendorName](#vendorname) [[SENSOR_NAME_MAX_LEN](_sensor.md#sensornamemaxlen)] | 传感器设备厂商。 | +| [firmwareVersion](#firmwareversion) [[SENSOR_VERSION_MAX_LEN](_sensor.md#sensorversionmaxlen)] | 传感器固件版本号。 | +| [hardwareVersion](#hardwareversion)
[[SENSOR_VERSION_MAX_LEN](_sensor.md#sensorversionmaxlen)] | 传感器硬件版本号。 | +| [sensorTypeId](#sensortypeid) | 传感器类型编号, | +| [sensorId](#sensorid) | 传感器的标识号,有传感器驱动开发者定义。 | +| [maxRange](#maxrange) | 传感器的最大量程。 | +| [accuracy](#accuracy) | 传感器的精度。 | +| [power](#power) | 传感器的功耗。 | + + +## **详细描述** + +定义传感器基本信息。 + +一个传感器设备信息包括传感器名字、设备厂商、固件版本号、硬件版本号、传感器类型编号、传感器标识、最大量程、精度、功耗。 + +**Since:** + +2.2 + + +## **类成员变量说明** + + +### accuracy + + +``` +float SensorInformation::accuracy +``` + +**描述:** + +传感器的精度。 + + +### firmwareVersion + + +``` +char SensorInformation::firmwareVersion[SENSOR_VERSION_MAX_LEN] +``` + +**描述:** + +传感器固件版本号。 + + +### hardwareVersion + + +``` +char SensorInformation::hardwareVersion[SENSOR_VERSION_MAX_LEN] +``` + +**描述:** + +传感器硬件版本号。 + + +### maxRange + + +``` +float SensorInformation::maxRange +``` + +**描述:** + +传感器的最大量程。 + + +### sensorId + + +``` +int32_t SensorInformation::sensorId +``` + +**描述:** + +传感器的标识号,有传感器驱动开发者定义。 + + +### sensorName + + +``` +char SensorInformation::sensorName[SENSOR_NAME_MAX_LEN] +``` + +**描述:** + +传感器名称。 + + +### sensorTypeId + + +``` +int32_t SensorInformation::sensorTypeId +``` + +**描述:** + +传感器类型编号,唯一标识一个传感器设备类型,详见[SensorTypeTag](_sensor.md#sensortypetag)。 + + +### vendorName + + +``` +char SensorInformation::vendorName[SENSOR_NAME_MAX_LEN] +``` + +**描述:** + +传感器设备厂商。 + + +### power + + +``` +char SensorInformation::power +``` + +**描述:** + +传感器的功耗。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_sensor_interface.md b/zh-cn/device-dev/reference/hdi-apis/_sensor_interface.md new file mode 100644 index 0000000000000000000000000000000000000000..cc24e3a087fceec2d31ef546e72b51e1ec4fcc1f --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_sensor_interface.md @@ -0,0 +1,234 @@ +# SensorInterface + + +## **概述** + +**所属模块:** + +[Sensor](_sensor.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [GetAllSensors](#getallsensors) )([out] struct [SensorInformation](_sensor_information.md) \*\*sensorInfo, [out] int32_t \*count) | 获取当前系统中所有类型的传感器信息。 [更多...](#getallsensors) | +| ( [Enable](#enable) )([in] int32_t sensorId) | 根据传感器设备类型标识使能传感器信息列表里存在的设备,只有数据订阅者使能传感器后,才能获取订阅的传感器数据。 [更多...](#enable) | +| ( [Disable](#disable) )([in] int32_t sensorId) | 根据传感器设备类型标识去使能传感器信息列表里存在的设备。 [更多...](#disable) | +| ( [SetBatch](#setbatch) )([in] int32_t sensorId, [in] int64_t samplingInterval, [in] int64_t reportInterval) | 设置指定传感器的数据采样间隔和数据上报间隔。 [更多...](#setbatch) | +| ( [SetMode](#setmode) )([in] int32_t sensorId, [in] int32_t mode) | 设置指定传感器的数据上报模式,不同的工作模式,上报数据的方式不同。 [更多...](#setmode) | +| ( [SetOption](#setoption) )([in] int32_t sensorId, [in] uint32_t option) | 设置指定传感器量程、精度等可选配置。 [更多...](#setoption) | +| ( [Register](#register) )([in] int32_t groupId, [in] [RecordDataCallback](_sensor.md#recorddatacallback) cb) | 订阅者注册传感器数据回调函数,系统会将获取到的传感器数据上报给订阅者。 [更多...](#register) | +| ( [Unregister](#unregister) )([in] int32_t groupId, [in] [RecordDataCallback](_sensor.md#recorddatacallback) cb) | 订阅者去注册传感器数据回调函数。 [更多...](#unregister) | + + +## **详细描述** + +提供sensor设备基本控制操作接口。 + +结构体提供获取传感器设备信息、订阅/去订阅传感器数据、使能/去使能传感器、设置传感器模式、设置传感器精度、量程等可选配置接口定义。 + + +## **类成员变量说明** + + +### Disable + + +``` +int32_t(* SensorInterface::Disable) ([in] int32_t sensorId) +``` + +**描述:** + +根据传感器设备类型标识去使能传感器信息列表里存在的设备。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| sensorId | 唯一标识一个传感器设备类型,详见[SensorTypeTag](_sensor.md#sensortypetag)。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### Enable + + +``` +int32_t(* SensorInterface::Enable) ([in] int32_t sensorId) +``` + +**描述:** + +根据传感器设备类型标识使能传感器信息列表里存在的设备,只有数据订阅者使能传感器后,才能获取订阅的传感器数据。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| sensorId | 唯一标识一个传感器设备类型,详见[SensorTypeTag](_sensor.md#sensortypetag)。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### GetAllSensors + + +``` +int32_t(* SensorInterface::GetAllSensors) ([out] struct SensorInformation **sensorInfo,[out] int32_t *count) +``` + +**描述:** + +获取当前系统中所有类型的传感器信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| sensorInfo | 输出系统中注册的所有传感器信息,一种类型传感器信息包括传感器名字、设备厂商、 固件版本号、硬件版本号、传感器类型编号、传感器标识、最大量程、精度、功耗,详见[SensorInformation](_sensor_information.md)。 | +| count | 输出系统中注册的传感器数量。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### Register + + +``` +int32_t(* SensorInterface::Register) ([in] int32_t groupId,[in] RecordDataCallback cb) +``` + +**描述:** + +订阅者注册传感器数据回调函数,系统会将获取到的传感器数据上报给订阅者。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| groupId | 传感器组ID。 sensorId枚举值范围为128-160,表示已订阅医疗传感器服务,只需成功订阅一次,无需重复订阅。 sensorId枚举值范围不在128-160之间,这意味着传统传感器已订阅,只需成功订阅一次,无需重复订阅。 | +| cb | 要注册的回调函数,详见[RecordDataCallback](_sensor.md#recorddatacallback)。 | + +**返回:** + +如果注册回调函数成功,则返回0。 + +如果注册回调函数失败,则返回负数。 + + +### SetBatch + + +``` +int32_t(* SensorInterface::SetBatch) ([in] int32_t sensorId,[in] int64_t samplingInterval,[in] int64_t reportInterval) +``` + +**描述:** + +设置指定传感器的数据采样间隔和数据上报间隔。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| sensorId | 唯一标识一个传感器设备类型,详见[SensorTypeTag](_sensor.md#sensortypetag)。 | +| samplingInterval | 设置指定传感器的数据采样间隔,单位纳秒。 | +| reportInterval | 表示传感器数据上报间隔,单位纳秒。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + + +### SetMode + + +``` +int32_t(* SensorInterface::SetMode) ([in] int32_t sensorId,[in] int32_t mode) +``` + +**描述:** + +设置指定传感器的数据上报模式,不同的工作模式,上报数据的方式不同。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| sensorId | 唯一标识一个传感器设备类型,详见[SensorTypeTag](_sensor.md#sensortypetag)。 | +| mode | 传感器的数据上报模式,详见[SensorModeType](_sensor.md#sensormodetype)。 | + +**返回:** + +如果设置传感器数据报告模式成功,则返回0。 + +如果设置传感器数据报告模式失败,则返回负数。 + + +### SetOption + + +``` +int32_t(* SensorInterface::SetOption) ([in] int32_t sensorId,[in] uint32_t option) +``` + +**描述:** + +设置指定传感器量程、精度等可选配置。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| sensorId | 唯一标识一个传感器设备类型,详见[SensorTypeTag](_sensor.md#sensortypetag)。 | +| option | 传感器的量程、精度等配置。 | + +**返回:** + +如果设置参数成功,则返回0。 + +如果设置参数失败,则返回负数。 + + +### Unregister + + +``` +int32_t(* SensorInterface::Unregister) ([in] int32_t groupId,[in] RecordDataCallback cb) +``` + +**描述:** + +订阅者去注册传感器数据回调函数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| groupId | 传感器组ID。 sensorId枚举值范围为128-160,表示已订阅医疗传感器服务。只需成功取消订阅一次,无需重复取消订阅。 sensorId枚举值范围不在128-160之间,这意味着传统传感器已订阅。并且成功取消订阅。 | +| cb | 要注册的回调函数,详见[RecordDataCallback](_sensor.md#recorddatacallback)。 | + +**返回:** + +如果取消注册回调函数成功,则返回0。 + +如果取消注册回调函数失败,则返回负数。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_sta_info.md b/zh-cn/device-dev/reference/hdi-apis/_sta_info.md new file mode 100644 index 0000000000000000000000000000000000000000..605e17a4f2e3e629a11939553baf0b28cbf0561e --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_sta_info.md @@ -0,0 +1,46 @@ +# StaInfo + + +## **概述** + +**所属模块:** + +[WLAN](_w_l_a_n.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [mac](#mac) [[WIFI_MAC_ADDR_LENGTH](_w_l_a_n.md#ga27ea7645cf89c113dae48346e19a676f)] | STA的MAC地址 | + + +## **详细描述** + +描述与AP连接的STA的基本信息。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### mac + + +``` +unsigned char StaInfo::mac[WIFI_MAC_ADDR_LENGTH] +``` + +**描述:** + +STA的MAC地址。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_support_buffer_type.md b/zh-cn/device-dev/reference/hdi-apis/_support_buffer_type.md new file mode 100644 index 0000000000000000000000000000000000000000..22e7876400f9ef145757edc027231d5053b53499 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_support_buffer_type.md @@ -0,0 +1,77 @@ +# SupportBufferType + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [size](#size) | 结构体大小 | +| [version](#version) | 组件版本信息 | +| [portIndex](#portindex) | 端口索引 | +| [bufferTypes](#buffertypes) | 支持的所有Buffer类型 | + + +## **详细描述** + +SupportBuffer类型定义。 + + +## **类成员变量说明** + + +### bufferTypes + + +``` +uint32_t SupportBufferType::bufferTypes +``` + +**描述:** + +支持的所有Buffer类型 + + +### portIndex + + +``` +uint32_t SupportBufferType::portIndex +``` + +**描述:** + +端口索引 + + +### size + + +``` +uint32_t SupportBufferType::size +``` + +**描述:** + +结构体大小 + + +### version + + +``` +union OMX_VERSIONTYPE SupportBufferType::version +``` + +**描述:** + +组件版本信息 diff --git a/zh-cn/device-dev/reference/hdi-apis/_template_info.md b/zh-cn/device-dev/reference/hdi-apis/_template_info.md new file mode 100644 index 0000000000000000000000000000000000000000..1d900c103ee8602a976a9364388b7a5ab2a0215f --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_template_info.md @@ -0,0 +1,85 @@ +# TemplateInfo + + +## **概述** + +**所属模块:** + +[HdfFaceAuth](_hdf_face_auth.md) | [HdfPinAuth](_hdf_pin_auth.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [executorType](#executortype) | 执行器类型,根据执行器支持的算法类型进行分类。 | +| [freezingTime](#freezingtime) | 认证方式被冻结的时间。 | +| [remainTimes](#remaintimes) | 认证方式距离被冻结的可处理认证请求次数。 | +| [extraInfo](#extrainfo) | 其他相关信息,用于支持信息扩展。 | + + +## **详细描述** + +凭据模版信息。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### executorType + + +``` +unsigned int TemplateInfo::executorType +``` + +**描述:** + +执行器类型,根据执行器支持的算法类型进行分类。 + + +### extraInfo + + +``` +unsigned char [] TemplateInfo::extraInfo +``` + +**描述:** + +其他相关信息,用于支持信息扩展。 + + +### freezingTime + + +``` +int TemplateInfo::freezingTime +``` + +**描述:** + +认证方式被冻结的时间。 + + +### remainTimes + + +``` +int TemplateInfo::remainTimes +``` + +**描述:** + +认证方式距离被冻结的可处理认证请求次数。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_thermal_types_8idl.md b/zh-cn/device-dev/reference/hdi-apis/_thermal_types_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..38c78e4de0d69fd3c775a820e311780c09d6482f --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_thermal_types_8idl.md @@ -0,0 +1,41 @@ +# ThermalTypes.idl + + +## **概述** + +**所属模块:** + +[Thermal](thermal.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [ThermalZoneInfo](_thermal_zone_info.md) | 设备发热的信息。 [更多...](_thermal_zone_info.md) | +| [HdfThermalCallbackInfo](_hdf_thermal_callback_info.md) | 设备发热的信息列表。 [更多...](_hdf_thermal_callback_info.md) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.thermal.v1_0 | 设备温度管理接口的包路径 | + + +## **详细描述** + +设备发热状态相关的数据类型。 + +热管理中使用的数据类型,包括设备发热的信息和设备发热的信息列表。 + +**Since:** + +3.1 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/_thermal_zone_info.md b/zh-cn/device-dev/reference/hdi-apis/_thermal_zone_info.md new file mode 100644 index 0000000000000000000000000000000000000000..6c60b3463c1d06fa6efc51a5d5c0ba07fc3be39f --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_thermal_zone_info.md @@ -0,0 +1,55 @@ +# ThermalZoneInfo + + +## **概述** + +**所属模块:** + +[Thermal](thermal.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [type](#type) | 发热器件的类型。 | +| [temp](#temp) | 器件的温度值。 | + + +## **详细描述** + +设备发热的信息。 + +**Since:** + +3.1 + + +## **类成员变量说明** + + +### temp + + +``` +int ThermalZoneInfo::temp +``` + +**描述:** + +器件的温度值。 + + +### type + + +``` +String ThermalZoneInfo::type +``` + +**描述:** + +发热器件的类型。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_types_8idl.md b/zh-cn/device-dev/reference/hdi-apis/_types_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..b924caff85bec0cdd0dcac7a8eefa0fca8334854 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_types_8idl.md @@ -0,0 +1,49 @@ +# Types.idl + + +## **概述** + +**所属模块:** + +[Battery](battery.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [BatteryInfo](_battery_info.md) | 电池相关信息。 [更多...](_battery_info.md) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [BatteryHealthState](battery.md#batteryhealthstate) {   BATTERY_HEALTH_UNKNOWN = 0, BATTERY_HEALTH_GOOD, BATTERY_HEALTH_OVERHEAT, BATTERY_HEALTH_OVERVOLTAGE,   BATTERY_HEALTH_COLD, BATTERY_HEALTH_DEAD, BATTERY_HEALTH_RESERVED } | 电池的健康状态。 [更多...](battery.md#batteryhealthstate) | +| [BatteryChargeState](battery.md#batterychargestate) {   CHARGE_STATE_NONE = 0, CHARGE_STATE_ENABLE, CHARGE_STATE_DISABLE, CHARGE_STATE_FULL,   CHARGE_STATE_RESERVED } | 电池的充电状态。 [更多...](battery.md#batterychargestate) | +| [BatteryPluggedType](battery.md#batterypluggedtype) {   PLUGGED_TYPE_NONE = 0, PLUGGED_TYPE_AC, PLUGGED_TYPE_USB, PLUGGED_TYPE_WIRELESS,   PLUGGED_TYPE_BUTT } | 电池的充电设备类型。 [更多...](battery.md#batterypluggedtype) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.battery.v1_0 | 电池信息接口的包路径 | + + +## **详细描述** + +电池信息相关数据类型。 + +电池信息中使用的数据类型,包括健康状态、充电状态、充电设备类型和电池信息结构。 + +**Since:** + +3.1 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/_u_s_b.md b/zh-cn/device-dev/reference/hdi-apis/_u_s_b.md new file mode 100644 index 0000000000000000000000000000000000000000..451ef796db779d80aff06641c02ef9b552d14d96 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_u_s_b.md @@ -0,0 +1,1718 @@ +# USB + + +## **汇总** + + +### 文件 + + | 文件 | 描述 | +| -------- | -------- | +| [usb_info.h](usb__info_8h.md) | USB驱动订阅模块使用的数据类型。 | +| [usbd_client.h](usbd__client_8h.md) | 声明标准USB驱动接口函数。 | +| [usbd_subscriber.h](usbd__subscriber_8h.md) | USB驱动订阅模块。 | +| [usbd_type.h](usbd__type_8h.md) | USB驱动模块接口定义中使用的自定义数据类型。 | + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [OHOS::USB::USBDeviceInfo](_o_h_o_s_1_1_u_s_b_1_1_u_s_b_device_info.md) | USB设备信息。 [更多...](_o_h_o_s_1_1_u_s_b_1_1_u_s_b_device_info.md) | +| [OHOS::USB::UsbInfo](_o_h_o_s_1_1_u_s_b_1_1_usb_info.md) | USB设备信息类。 [更多...](_o_h_o_s_1_1_u_s_b_1_1_usb_info.md) | +| [OHOS::USB::UsbdClient](_o_h_o_s_1_1_u_s_b_1_1_usbd_client.md) | Usb驱动类。[更多...](_o_h_o_s_1_1_u_s_b_1_1_usbd_client.md) | +| [OHOS::USB::UsbdSubscriber](_o_h_o_s_1_1_u_s_b_1_1_usbd_subscriber.md) | 订阅类。[更多...](_o_h_o_s_1_1_u_s_b_1_1_usbd_subscriber.md) | +| [OHOS::USB::UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) | USB设备。 [更多...](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) | +| [OHOS::USB::UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) | 管道信息。 [更多...](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) | +| [OHOS::USB::UsbCtrlTransfer](_o_h_o_s_1_1_u_s_b_1_1_usb_ctrl_transfer.md) | USB控制传输。 [更多...](_o_h_o_s_1_1_u_s_b_1_1_usb_ctrl_transfer.md) | + + +### 宏定义 + + | 宏定义 | 描述 | +| -------- | -------- | +| [USB_MAX_INTERFACES](#usbmaxinterfaces)   32 | USB设备最大接口数量。 | + + +### 类型定义 + + | 类型定义 | 描述 | +| -------- | -------- | +| ([UsbdRequestCallback](#usbdrequestcallback)) (uint8_t \*requestArg) | 请求回调函数。[更多...](#usbdrequestcallback) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [UsbdBulkCbCmd](#usbdbulkcbcmd) { CMD_USBD_BULK_CALLBACK_READ, CMD_USBD_BULK_CALLBACK_WRITE } | 批量回调命令字。 [更多...](#usbdbulkcbcmd) | +| [UsbdDeviceAction](#usbddeviceaction) { ACT_DEVUP = 0, ACT_DEVDOWN, ACT_UPDEVICE, ACT_DOWNDEVICE } | 主机端和设备端插拔事件。 [更多...](#usbddeviceaction) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [OHOS::USB::UsbInfo::setDevInfoStatus](#setdevinfostatus) (int32_t status) | 设置USB设备状态。 [更多...](#setdevinfostatus) | +| [OHOS::USB::UsbInfo::setDevInfoBusNum](#setdevinfobusnum) (int32_t busNum) | 设置USB总线编号。 [更多...](#setdevinfobusnum) | +| [OHOS::USB::UsbInfo::setDevInfoDevNum](#setdevinfodevnum) (int32_t devNum) | 设置USB设备编号。 [更多...](#setdevinfodevnum) | +| [OHOS::USB::UsbInfo::getDevInfoStatus](#getdevinfostatus) () const | 获取USB设备状态。 [更多...](#getdevinfostatus) | +| [OHOS::USB::UsbInfo::getDevInfoBusNum](#getdevinfobusnum) () const | 获取USB总线编号。 [更多...](#getdevinfobusnum) | +| [OHOS::USB::UsbInfo::getDevInfoDevNum](#getdevinfodevnum) () const | 获取USB设备编号。 [更多...](#getdevinfodevnum) | +| **OHOS::USB::UsbdClient::GetInstance** () | 获取实例。 | +| [OHOS::USB::UsbdClient::OpenDevice](#opendevice) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev) | 打开设备,建立连接。 [更多...](#opendevice) | +| [OHOS::USB::UsbdClient::CloseDevice](#closedevice) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev) | 关闭设备,释放与设备相关的所有系统资源。 [更多...](#closedevice) | +| [OHOS::USB::UsbdClient::GetDeviceDescriptor](#getdevicedescriptor) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, std::vector< uint8_t > &descriptor) | 获取设备描述符。 [更多...](#getdevicedescriptor) | +| [OHOS::USB::UsbdClient::GetStringDescriptor](#getstringdescriptor) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, uint8_t descId, std::vector< uint8_t > &descriptor) | 根据String ID获取设备的字符串描述符。 [更多...](#getstringdescriptor) | +| [OHOS::USB::UsbdClient::GetConfigDescriptor](#getconfigdescriptor) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, uint8_t descId, std::vector< uint8_t > &descriptor) | 根据config ID获取设备的配置描述符config。 [更多...](#getconfigdescriptor) | +| [OHOS::USB::UsbdClient::GetRawDescriptor](#getrawdescriptor) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, std::vector< uint8_t > &descriptor) | 获取原始描述符。 [更多...](#getrawdescriptor) | +| [OHOS::USB::UsbdClient::GetFileDescriptor](#getfiledescriptor) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, int32_t &fd) | 获取文件描述符。 [更多...](#getfiledescriptor) | +| [OHOS::USB::UsbdClient::SetConfig](#setconfig) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, uint8_t configIndex) | 设置当前的config信息。 [更多...](#setconfig) | +| [OHOS::USB::UsbdClient::GetConfig](#getconfig) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, uint8_t &configIndex) | 获取当前的config信息。 [更多...](#getconfig) | +| [OHOS::USB::UsbdClient::ClaimInterface](#claiminterface) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, uint8_t interfaceid, uint8_t force) | 打开接口,并声明独占接口,必须在数据传输前执行。 [更多...](#claiminterface) | +| [OHOS::USB::UsbdClient::ReleaseInterface](#releaseinterface) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, uint8_t interfaceid) | 关闭接口,释放接口的占用,在停止数据传输后执行。 [更多...](#releaseinterface) | +| [OHOS::USB::UsbdClient::SetInterface](#setinterface) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, uint8_t interfaceid, uint8_t altIndex) | 设置指定接口的备选设置,用于在具有相同ID但不同备用设置的两个接口之间进行选择。 [更多...](#setinterface) | +| [OHOS::USB::UsbdClient::BulkTransferRead](#bulktransferread) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, int32_t timeout, std::vector< uint8_t > &data) | 在给定端点上执行批量数据读取,返回读取的数据和长度,端点方向必须为数据读取,可以设置超时时间。 [更多...](#bulktransferread) | +| [OHOS::USB::UsbdClient::BulkTransferWrite](#bulktransferwrite) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, int32_t timeout, const std::vector< uint8_t > &data) | 在给定端点上执行批量数据写入, 返回读取的数据和长度,端点方向必须为数据写入。 [更多...](#bulktransferwrite) | +| [OHOS::USB::UsbdClient::ControlTransfer](#controltransfer) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbCtrlTransfer](_o_h_o_s_1_1_u_s_b_1_1_usb_ctrl_transfer.md) &ctrl, std::vector< uint8_t > &data) | 对此设备执行端点零的控制事务,传输方向由请求类型决定。 如果requestType& USB_ENDPOINT_DIR_MASK是USB_DIR_OUT ,则传输是写入,如果是USB_DIR_IN ,则传输是读取。 [更多...](#controltransfer) | +| [OHOS::USB::UsbdClient::InterruptTransferRead](#interrupttransferread) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, int32_t timeout, std::vector< uint8_t > &data) | 在给定端点上执行中断数据读取, 返回读取的数据和长度,端点方向必须为数据读取。 [更多...](#interrupttransferread) | +| [OHOS::USB::UsbdClient::InterruptTransferWrite](#interrupttransferwrite) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, int32_t timeout, std::vector< uint8_t > &data) | 在给定端点上执行中断数据写入, 返回读取的数据和长度,端点方向必须为数据写入。 [更多...](#interrupttransferwrite) | +| [OHOS::USB::UsbdClient::IsoTransferRead](#isotransferread) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, int32_t timeout, std::vector< uint8_t > &data) | 在给定端点上执行等时数据读取, 返回读取的数据和长度,端点方向必须为数据读取。 [更多...](#isotransferread) | +| [OHOS::USB::UsbdClient::IsoTransferWrite](#isotransferwrite) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, int32_t timeout, std::vector< uint8_t > &data) | 在给定端点上执行等时数据写入, 返回读取的数据和长度,端点方向必须为数据写入。 [更多...](#isotransferwrite) | +| [OHOS::USB::UsbdClient::RequestQueue](#requestqueue) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, const std::vector< uint8_t > &clientData, const std::vector< uint8_t > &buffer) | 将指定的端点进行异步数据发送或者接收请求,数据传输方向由端点方向决定。 [更多...](#requestqueue) | +| [OHOS::USB::UsbdClient::RequestWait](#requestwait) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, std::vector< uint8_t > &clientData, std::vector< uint8_t > &buffer, int32_t timeout) | 等待RequestQueue异步请求的操作结果。 [更多...](#requestwait) | +| [OHOS::USB::UsbdClient::RequestCancel](#requestcancel) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe) | 取消待处理的数据请求。 [更多...](#requestcancel) | +| [OHOS::USB::UsbdClient::GetCurrentFunctions](#getcurrentfunctions) (int32_t &funcs) | 获取从设备支持的功能列表(按位域表示)(从设备)。 [更多...](#getcurrentfunctions) | +| [OHOS::USB::UsbdClient::SetCurrentFunctions](#setcurrentfunctions) (int32_t funcs) | 设置从设备支持的功能列表(按位域表示)(从设备)。 [更多...](#setcurrentfunctions) | +| [OHOS::USB::UsbdClient::SetPortRole](#setportrole) (int32_t portId, int32_t powerRole, int32_t dataRole) | 设置port端口的角色。 [更多...](#setportrole) | +| [OHOS::USB::UsbdClient::QueryPort](#queryport) (int32_t &portId, int32_t &powerRole, int32_t &dataRole, int32_t &mode) | 查询port端口的当前设置。 [更多...](#queryport) | +| [OHOS::USB::UsbdClient::BindUsbdSubscriber](#bindusbdsubscriber) (const sptr< [UsbdSubscriber](_o_h_o_s_1_1_u_s_b_1_1_usbd_subscriber.md) > &subscriber) | 绑定订阅者。 [更多...](#bindusbdsubscriber) | +| [OHOS::USB::UsbdClient::UnbindUsbdSubscriber](#unbindusbdsubscriber) (const sptr< [UsbdSubscriber](_o_h_o_s_1_1_u_s_b_1_1_usbd_subscriber.md) > &subscriber) | 解绑订阅者。 [更多...](#unbindusbdsubscriber) | +| [OHOS::USB::UsbdClient::RegBulkCallback](#regbulkcallback) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, const sptr< IRemoteObject > &cb) | 注册批量传输异步回调函数。 [更多...](#regbulkcallback) | +| [OHOS::USB::UsbdClient::UnRegBulkCallback](#unregbulkcallback) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe) | 注销批量传输异步回调函数。 [更多...](#unregbulkcallback) | +| [OHOS::USB::UsbdClient::BulkRead](#bulkread) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, sptr< Ashmem > &ashmem) | 批量传输异步读数据。 [更多...](#bulkread) | +| [OHOS::USB::UsbdClient::BulkWrite](#bulkwrite) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe, sptr< Ashmem > &ashmem) | 批量传输异步写数据。 [更多...](#bulkwrite) | +| [OHOS::USB::UsbdClient::BulkCancel](#bulkcancel) (const [UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) &dev, const [UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) &pipe) | 批量传输异步取消接口,用于取消当前接口的异步批量读写操作。 [更多...](#bulkcancel) | +| [OHOS::USB::UsbdSubscriber::DeviceEvent](#deviceevent) (const [UsbInfo](_o_h_o_s_1_1_u_s_b_1_1_usb_info.md) &info)=0 | 设备事件。 [更多...](#deviceevent) | +| [OHOS::USB::UsbdSubscriber::PortChangedEvent](#portchangedevent) (int32_t portId, int32_t powerRole, int32_t dataRole, int32_t mode)=0 | 端口改变事件。 [更多...](#portchangedevent) | +| [OHOS::USB::UsbdSubscriber::OnRemoteRequest](#onremoterequest) (uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override | 远程请求。 [更多...](#onremoterequest) | + + +### 变量 + + | 变量 | 描述 | +| -------- | -------- | +| [OHOS::USB::USBDeviceInfo::status](#status) | USB设备状态 | +| [OHOS::USB::USBDeviceInfo::busNum](#busnum-12) | USB总线编号 | +| [OHOS::USB::USBDeviceInfo::devNum](#devnum) | USB设备编号 | +| [OHOS::USB::UsbDev::busNum](#busnum-22) | USB总线编号 | +| [OHOS::USB::UsbDev::devAddr](#devaddr) | USB设备地址 | +| [OHOS::USB::UsbPipe::interfaceId](#interfaceid) | USB设备接口ID | +| [OHOS::USB::UsbPipe::endpointId](#endpointid) | USB设备端点ID | +| [OHOS::USB::UsbCtrlTransfer::requestType](#requesttype) | 请求类型 | +| [OHOS::USB::UsbCtrlTransfer::requestCmd](#requestcmd) | 请求命令字 | +| [OHOS::USB::UsbCtrlTransfer::value](#value) | 请求值 | +| [OHOS::USB::UsbCtrlTransfer::index](#index) | 索引 | +| [OHOS::USB::UsbCtrlTransfer::timeout](#timeout) | 超时时间 | + + +## **详细描述** + +定义(USB)功能的标准API接口。 + +该模块用于获取描述符、接口对象、请求对象和提交请求的自定义数据类型和函数。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +## **宏定义说明** + + +### USB_MAX_INTERFACES + + +``` +#define USB_MAX_INTERFACES 32 +``` + +**描述:** + +USB设备最大接口数量 + + +## **类型定义说明** + + +### UsbdRequestCallback + + +``` +typedef void(* UsbdRequestCallback) (uint8_t *requestArg) +``` + +**描述:** + +请求回调函数 + + +## **枚举类型说明** + + +### UsbdBulkCbCmd + + +``` +enum UsbdBulkCbCmd +``` + +**描述:** + +批量回调命令字。 + + | 枚举值 | 描述 | +| -------- | -------- | +| CMD_USBD_BULK_CALLBACK_READ | 批量回调读取 | +| CMD_USBD_BULK_CALLBACK_WRITE | 批量回调写入 | + + +### UsbdDeviceAction + + +``` +enum UsbdDeviceAction +``` + +**描述:** + +主机端和设备端插拔事件。 + + | 枚举值 | 描述 | +| -------- | -------- | +| ACT_DEVUP | 主机端接入设备 | +| ACT_DEVDOWN | 主机端拔出设备 | +| ACT_UPDEVICE | 设备连接 | +| ACT_DOWNDEVICE | 设备断开 | + + +## **函数说明** + + +### BindUsbdSubscriber() + + +``` +int32_t OHOS::USB::UsbdClient::BindUsbdSubscriber (const sptr< UsbdSubscriber > & subscriber) +``` + +**描述:** + +绑定订阅者。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| subscriber | 输入参数,订阅者信息,详见[UsbdSubscriber](_o_h_o_s_1_1_u_s_b_1_1_usbd_subscriber.md)。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### BulkCancel() + + +``` +int32_t OHOS::USB::UsbdClient::BulkCancel (const UsbDev & dev, const UsbPipe & pipe ) +``` + +**描述:** + +批量传输异步取消接口,用于取消当前接口的异步批量读写操作。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| pipe | 输入参数,USB设备pipe信息,详见[UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md)。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### BulkRead() + + +``` +int32_t OHOS::USB::UsbdClient::BulkRead (const UsbDev & dev, const UsbPipe & pipe, sptr< Ashmem > & ashmem ) +``` + +**描述:** + +批量传输异步读数据。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| pipe | 输入参数,USB设备pipe信息,详见[UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md)。 | +| ashmem | 输出参数,为共享内存,用于存放读取的数据,详见**Ashmem**。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### BulkTransferRead() + + +``` +int32_t OHOS::USB::UsbdClient::BulkTransferRead (const UsbDev & dev, const UsbPipe & pipe, int32_t timeout, std::vector< uint8_t > & data ) +``` + +**描述:** + +在给定端点上执行批量数据读取,返回读取的数据和长度,端点方向必须为数据读取,可以设置超时时间。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| pipe | 输入参数,USB设备pipe信息,详见[UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md)。 | +| timeout | 输入参数,超时时间。 | +| data | 输出参数,获取写入的数据。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### BulkTransferWrite() + + +``` +int32_t OHOS::USB::UsbdClient::BulkTransferWrite (const UsbDev & dev, const UsbPipe & pipe, int32_t timeout, const std::vector< uint8_t > & data ) +``` + +**描述:** + +在给定端点上执行批量数据写入, 返回读取的数据和长度,端点方向必须为数据写入。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| pipe | 输入参数,USB设备pipe信息,详见[UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md)。 | +| timeout | 输入参数,超时时间。 | +| data | 输入参数,写入的数据。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### BulkWrite() + + +``` +int32_t OHOS::USB::UsbdClient::BulkWrite (const UsbDev & dev, const UsbPipe & pipe, sptr< Ashmem > & ashmem ) +``` + +**描述:** + +批量传输异步写数据。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| pipe | 输入参数,USB设备pipe信息,详见[UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md)。 | +| ashmem | 输入参数,为共享内存,用于存放需要写入的数据,详见**Ashmem**。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### ClaimInterface() + + +``` +int32_t OHOS::USB::UsbdClient::ClaimInterface (const UsbDev & dev, uint8_t interfaceid, uint8_t force ) +``` + +**描述:** + +打开接口,并声明独占接口,必须在数据传输前执行。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| interfaceid | 输入参数,USB设备interface ID。 | +| force | 输入参数,是否强制: 1强制 0不强制。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### CloseDevice() + + +``` +int32_t OHOS::USB::UsbdClient::CloseDevice (const UsbDev & dev) +``` + +**描述:** + +关闭设备,释放与设备相关的所有系统资源。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### ControlTransfer() + + +``` +int32_t OHOS::USB::UsbdClient::ControlTransfer (const UsbDev & dev, const UsbCtrlTransfer & ctrl, std::vector< uint8_t > & data ) +``` + +**描述:** + +对此设备执行端点零的控制事务,传输方向由请求类型决定。 如果requestType& USB_ENDPOINT_DIR_MASK是USB_DIR_OUT ,则传输是写入,如果是USB_DIR_IN ,则传输是读取。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| ctrl | 输入参数,USB设备控制数据包结构,详见[UsbCtrlTransfer](_o_h_o_s_1_1_u_s_b_1_1_usb_ctrl_transfer.md)。 | +| data | 输入/输出参数,读取/写入的数据。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### DeviceEvent() + + +``` +virtual int32_t OHOS::USB::UsbdSubscriber::DeviceEvent (const UsbInfo & info) +``` + +**描述:** + +设备事件。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| [UsbInfo](_o_h_o_s_1_1_u_s_b_1_1_usb_info.md) | 输入参数,USB设备信息。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### GetConfig() + + +``` +int32_t OHOS::USB::UsbdClient::GetConfig (const UsbDev & dev, uint8_t & configIndex ) +``` + +**描述:** + +获取当前的config信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| configIndex | 输出参数,USB设备config信息。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### GetConfigDescriptor() + + +``` +int32_t OHOS::USB::UsbdClient::GetConfigDescriptor (const UsbDev & dev, uint8_t descId, std::vector< uint8_t > & descriptor ) +``` + +**描述:** + +根据config ID获取设备的配置描述符config。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| descId | 输入参数,USB的config ID。 | +| descriptor | 输出参数,获取USB设备config信息。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### GetCurrentFunctions() + + +``` +int32_t OHOS::USB::UsbdClient::GetCurrentFunctions (int32_t & funcs) +``` + +**描述:** + +获取从设备支持的功能列表(按位域表示)(从设备)。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| funcs | 输出参数,获取当前设备的function的值。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### GetDeviceDescriptor() + + +``` +int32_t OHOS::USB::UsbdClient::GetDeviceDescriptor (const UsbDev & dev, std::vector< uint8_t > & descriptor ) +``` + +**描述:** + +获取设备描述符。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| descriptor | 输出参数,USB设备描述符信息。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### getDevInfoBusNum() + + +``` +int32_t OHOS::USB::UsbInfo::getDevInfoBusNum () const +``` + +**描述:** + +获取USB总线编号。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| status | 输出参数,USB总线编号。 | + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### getDevInfoDevNum() + + +``` +int32_t OHOS::USB::UsbInfo::getDevInfoDevNum () const +``` + +**描述:** + +获取USB设备编号。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| status | 输出参数,USB设备编号。 | + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### getDevInfoStatus() + + +``` +int32_t OHOS::USB::UsbInfo::getDevInfoStatus () const +``` + +**描述:** + +获取USB设备状态。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| status | 输出参数,设备状态。 | + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### GetFileDescriptor() + + +``` +int32_t OHOS::USB::UsbdClient::GetFileDescriptor (const UsbDev & dev, int32_t & fd ) +``` + +**描述:** + +获取文件描述符。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| fd | 输出参数,USB设备文件描述符。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### GetRawDescriptor() + + +``` +int32_t OHOS::USB::UsbdClient::GetRawDescriptor (const UsbDev & dev, std::vector< uint8_t > & descriptor ) +``` + +**描述:** + +获取原始描述符。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| descriptor | 输出参数,USB设备原始描述符。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### GetStringDescriptor() + + +``` +int32_t OHOS::USB::UsbdClient::GetStringDescriptor (const UsbDev & dev, uint8_t descId, std::vector< uint8_t > & descriptor ) +``` + +**描述:** + +根据String ID获取设备的字符串描述符。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| descId | 输入参数,USB的string ID。 | +| descriptor | 输出参数,获取USB设备config信息。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### InterruptTransferRead() + + +``` +int32_t OHOS::USB::UsbdClient::InterruptTransferRead (const UsbDev & dev, const UsbPipe & pipe, int32_t timeout, std::vector< uint8_t > & data ) +``` + +**描述:** + +在给定端点上执行中断数据读取, 返回读取的数据和长度,端点方向必须为数据读取。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| pipe | 输入参数,USB设备pipe信息,详见[UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md)。 | +| timeout | 输入参数,超时时间。 | +| data | 输出参数,读取的数据。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### InterruptTransferWrite() + + +``` +int32_t OHOS::USB::UsbdClient::InterruptTransferWrite (const UsbDev & dev, const UsbPipe & pipe, int32_t timeout, std::vector< uint8_t > & data ) +``` + +**描述:** + +在给定端点上执行中断数据写入, 返回读取的数据和长度,端点方向必须为数据写入。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| pipe | 输入参数,USB设备pipe信息,详见[UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md)。 | +| timeout | 输入参数,超时时间。 | +| data | 输入参数,写入的数据。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### IsoTransferRead() + + +``` +int32_t OHOS::USB::UsbdClient::IsoTransferRead (const UsbDev & dev, const UsbPipe & pipe, int32_t timeout, std::vector< uint8_t > & data ) +``` + +**描述:** + +在给定端点上执行等时数据读取, 返回读取的数据和长度,端点方向必须为数据读取。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| pipe | 输入参数,USB设备pipe信息,详见[UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md)。 | +| timeout | 输入参数,超时时间。 | +| data | 输出参数,读取的数据。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### IsoTransferWrite() + + +``` +int32_t OHOS::USB::UsbdClient::IsoTransferWrite (const UsbDev & dev, const UsbPipe & pipe, int32_t timeout, std::vector< uint8_t > & data ) +``` + +**描述:** + +在给定端点上执行等时数据写入, 返回读取的数据和长度,端点方向必须为数据写入。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| pipe | 输入参数,USB设备pipe信息,详见[UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md)。 | +| timeout | 输入参数,超时时间。 | +| data | 输入参数,读取的数据。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### OnRemoteRequest() + + +``` +int32_t OHOS::USB::UsbdSubscriber::OnRemoteRequest (uint32_t code, MessageParcel & data, MessageParcel & reply, MessageOption & option ) +``` + +**描述:** + +远程请求。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| code | 输入参数,命令字。 | +| data | 输入参数,待解析的数据。 | +| reply | 输出参数,返回的数据。 | +| option | 输入参数,选项数据。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### OpenDevice() + + +``` +int32_t OHOS::USB::UsbdClient::OpenDevice (const UsbDev & dev) +``` + +**描述:** + +打开设备,建立连接。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### PortChangedEvent() + + +``` +virtual int32_t OHOS::USB::UsbdSubscriber::PortChangedEvent (int32_t portId, int32_t powerRole, int32_t dataRole, int32_t mode ) +``` + +**描述:** + +端口改变事件。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| portId | 输入参数,端口ID。 | +| powerRole | 输入参数,电源角色的值。 | +| dataRole | 输入参数,数据角色的值。 | +| mode | 输入参数,端口模式的值。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### QueryPort() + + +``` +int32_t OHOS::USB::UsbdClient::QueryPort (int32_t & portId, int32_t & powerRole, int32_t & dataRole, int32_t & mode ) +``` + +**描述:** + +查询port端口的当前设置。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| portId | 输出参数,port接口ID。 | +| powerRole | 输出参数,电源角色的值。 | +| dataRole | 输出参数,数据角色的值。 | +| mode | 输出参数,模式的值。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### RegBulkCallback() + + +``` +int32_t OHOS::USB::UsbdClient::RegBulkCallback (const UsbDev & dev, const UsbPipe & pipe, const sptr< IRemoteObject > & cb ) +``` + +**描述:** + +注册批量传输异步回调函数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| pipe | 输入参数,USB设备pipe信息,详见[UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md)。 | +| cb | 输入参数,回调函数对象的引用。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### ReleaseInterface() + + +``` +int32_t OHOS::USB::UsbdClient::ReleaseInterface (const UsbDev & dev, uint8_t interfaceid ) +``` + +**描述:** + +关闭接口,释放接口的占用,在停止数据传输后执行。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| interfaceid | 输入参数,USB设备interface ID。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### RequestCancel() + + +``` +int32_t OHOS::USB::UsbdClient::RequestCancel (const UsbDev & dev, const UsbPipe & pipe ) +``` + +**描述:** + +取消待处理的数据请求。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| pipe | 输入参数,USB设备pipe信息,详见[UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md)。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### RequestQueue() + + +``` +int32_t OHOS::USB::UsbdClient::RequestQueue (const UsbDev & dev, const UsbPipe & pipe, const std::vector< uint8_t > & clientData, const std::vector< uint8_t > & buffer ) +``` + +**描述:** + +将指定的端点进行异步数据发送或者接收请求,数据传输方向由端点方向决定。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| pipe | 输入参数,USB设备pipe信息,详见[UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md)。 | +| clientData | 输入参数,用户数据。 | +| buffer | 输入参数,传输的数据。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### RequestWait() + + +``` +int32_t OHOS::USB::UsbdClient::RequestWait (const UsbDev & dev, std::vector< uint8_t > & clientData, std::vector< uint8_t > & buffer, int32_t timeout ) +``` + +**描述:** + +等待RequestQueue异步请求的操作结果。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| clientData | 输入参数,用户数据。 | +| buffer | 输入参数,传输数据。 | +| timeout | 输入参数,超时时间。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### SetConfig() + + +``` +int32_t OHOS::USB::UsbdClient::SetConfig (const UsbDev & dev, uint8_t configIndex ) +``` + +**描述:** + +设置当前的config信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| configIndex | 输入参数,USB设备config信息。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### SetCurrentFunctions() + + +``` +int32_t OHOS::USB::UsbdClient::SetCurrentFunctions (int32_t funcs) +``` + +**描述:** + +设置从设备支持的功能列表(按位域表示)(从设备)。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| funcs | 输入参数,传入设备支持的function的值。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### setDevInfoBusNum() + + +``` +void OHOS::USB::UsbInfo::setDevInfoBusNum (int32_t busNum) +``` + +**描述:** + +设置USB总线编号。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| status | 输入参数,USB总线编号。 | + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### setDevInfoDevNum() + + +``` +void OHOS::USB::UsbInfo::setDevInfoDevNum (int32_t devNum) +``` + +**描述:** + +设置USB设备编号。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| status | 输入参数,USB设备编号。 | + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### setDevInfoStatus() + + +``` +void OHOS::USB::UsbInfo::setDevInfoStatus (int32_t status) +``` + +**描述:** + +设置USB设备状态。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| status | 输入参数,设备状态。 | + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### SetInterface() + + +``` +int32_t OHOS::USB::UsbdClient::SetInterface (const UsbDev & dev, uint8_t interfaceid, uint8_t altIndex ) +``` + +**描述:** + +设置指定接口的备选设置,用于在具有相同ID但不同备用设置的两个接口之间进行选择。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| interfaceid | 输入参数,USB设备interface ID。 | +| altIndex | 输入参数,interface的AlternateSetting信息。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### SetPortRole() + + +``` +int32_t OHOS::USB::UsbdClient::SetPortRole (int32_t portId, int32_t powerRole, int32_t dataRole ) +``` + +**描述:** + +设置port端口的角色。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| portId | 输入参数,port接口ID。 | +| powerRole | 输入参数,电源角色的值。 | +| dataRole | 输入参数,数据角色的值。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### UnbindUsbdSubscriber() + + +``` +int32_t OHOS::USB::UsbdClient::UnbindUsbdSubscriber (const sptr< UsbdSubscriber > & subscriber) +``` + +**描述:** + +解绑订阅者。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| subscriber | 输入参数,订阅者信息,详见[UsbdSubscriber](_o_h_o_s_1_1_u_s_b_1_1_usbd_subscriber.md)。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +### UnRegBulkCallback() + + +``` +int32_t OHOS::USB::UsbdClient::UnRegBulkCallback (const UsbDev & dev, const UsbPipe & pipe ) +``` + +**描述:** + +注销批量传输异步回调函数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| dev | 输入参数,USB设备地址信息,详见[UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)。 | +| pipe | 输入参数,USB设备pipe信息,详见[UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md)。 | + +**返回:** + +0 表示操作成功。 + +非零值 表示操作失败。 + +**Since:** + +3.0 + +**Version:** + +1.0 + + +## **变量说明** + + +### busNum [1/2] + + +``` +int32_t OHOS::USB::USBDeviceInfo::busNum +``` + +**描述:** + +USB总线编号 + + +### busNum [2/2] + + +``` +uint8_t OHOS::USB::UsbDev::busNum +``` + +**描述:** + +USB总线编号 + + +### devAddr + + +``` +uint8_t OHOS::USB::UsbDev::devAddr +``` + +**描述:** + +USB设备地址 + + +### devNum + + +``` +int32_t OHOS::USB::USBDeviceInfo::devNum +``` + +**描述:** + +USB设备编号 + + +### endpointId + + +``` +uint8_t OHOS::USB::UsbPipe::endpointId +``` + +**描述:** + +USB设备端点ID + + +### index + + +``` +int32_t OHOS::USB::UsbCtrlTransfer::index +``` + +**描述:** + +索引 + + +### interfaceId + + +``` +uint8_t OHOS::USB::UsbPipe::interfaceId +``` + +**描述:** + +USB设备接口ID + + +### requestCmd + + +``` +int32_t OHOS::USB::UsbCtrlTransfer::requestCmd +``` + +**描述:** + +请求命令字 + + +### requestType + + +``` +int32_t OHOS::USB::UsbCtrlTransfer::requestType +``` + +**描述:** + +请求类型 + + +### status + + +``` +int32_t OHOS::USB::USBDeviceInfo::status +``` + +**描述:** + +USB设备状态 + + +### timeout + + +``` +int32_t OHOS::USB::UsbCtrlTransfer::timeout +``` + +**描述:** + +超时时间 + + +### value + + +``` +int32_t OHOS::USB::UsbCtrlTransfer::value +``` + +**描述:** + +请求值 diff --git a/zh-cn/device-dev/reference/hdi-apis/_use_buffer_type.md b/zh-cn/device-dev/reference/hdi-apis/_use_buffer_type.md new file mode 100644 index 0000000000000000000000000000000000000000..99e2e88d43d8cea5b32d737fca929bc64e8772cb --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_use_buffer_type.md @@ -0,0 +1,77 @@ +# UseBufferType + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [size](#size) | 结构体大小 | +| [version](#version) | 组件版本信息 | +| [portIndex](#portindex) | 端口索引 | +| [bufferType](#buffertype) | Buffer类型 | + + +## **详细描述** + +UseBuffer类型定义。 + + +## **类成员变量说明** + + +### bufferType + + +``` +uint32_t UseBufferType::bufferType +``` + +**描述:** + +Buffer类型 + + +### portIndex + + +``` +uint32_t UseBufferType::portIndex +``` + +**描述:** + +端口索引 + + +### size + + +``` +uint32_t UseBufferType::size +``` + +**描述:** + +结构体大小 + + +### version + + +``` +union OMX_VERSIONTYPE UseBufferType::version +``` + +**描述:** + +组件版本信息 diff --git a/zh-cn/device-dev/reference/hdi-apis/_user_auth_types_8idl.md b/zh-cn/device-dev/reference/hdi-apis/_user_auth_types_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..a017cbea7ba1bb97308b80a45594ff481dd65fcb --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_user_auth_types_8idl.md @@ -0,0 +1,53 @@ +# UserAuthTypes.idl + + +## **概述** + +**所属模块:** + +[HdfUserAuth](_hdf_user_auth.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [ExecutorRegisterInfo](_executor_register_info.md) | 执行器注册信息。 [更多...](_executor_register_info.md) | +| [ExecutorInfo](_executor_info.md) | 执行器信息。 [更多...](_executor_info.md) | +| [ScheduleInfo](_schedule_info.md) | 调度信息。 [更多...](_schedule_info.md) | +| [AuthSolution](_auth_solution.md) | 认证方案。 [更多...](_auth_solution.md) | +| [ExecutorSendMsg](_executor_send_msg.md) | 执行器发送的消息。 [更多...](_executor_send_msg.md) | +| [AuthResultInfo](_auth_result_info.md) | 用户身份认证结果信息。 [更多...](_auth_result_info.md) | +| [IdentifyResultInfo](_identify_result_info.md) | 用户身份识别结果信息。 [更多...](_identify_result_info.md) | +| [EnrollParam](_enroll_param.md) | 注册认证凭据参数。 [更多...](_enroll_param.md) | +| [CredentialInfo](_credential_info.md) | 认证凭据信息。 [更多...](_credential_info.md) | +| [EnrolledInfo](_enrolled_info.md) | 注册信息。 [更多...](_enrolled_info.md) | +| [EnrollResultInfo](_enroll_resultinfo.md) | 录入结果信息。[更多...](_enroll_resultinfo.md) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [AuthType](_hdf_user_auth.md#authtype) : int {   PIN = 1, FACE = 2, FINGERPRINT = 4, ALL = 0 } | 枚举用户认证凭据类型。 [更多...](_hdf_user_auth.md#authtype) | +| [ExecutorRole](_hdf_user_auth.md#executorrole) : int {   COLLECTOR = 1, VERIFIER = 2, ALL_IN_ONE = 3 } | 枚举执行器角色。 [更多...](_hdf_user_auth.md#executorrole) | +| [ExecutorSecureLevel](_hdf_user_auth.md#executorsecurelevel) : int {   ESL0 = 0, ESL1 = 1, ESL2 = 2, ESL3 = 3 } | 枚举执行器安全等级。 [更多...](_hdf_user_auth.md#executorsecurelevel) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.user_auth.v1_0 | 用户认证接口的包路径 | + + +## **详细描述** + +定义用户认证驱动的枚举类和数据结构。 + +**Since:** + +3.2 diff --git a/zh-cn/device-dev/reference/hdi-apis/_user_executor_info.md b/zh-cn/device-dev/reference/hdi-apis/_user_executor_info.md new file mode 100644 index 0000000000000000000000000000000000000000..126685bf071258a5a15d65dc8804d274f1a55325 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_user_executor_info.md @@ -0,0 +1,59 @@ +# ExecutorInfo + + +## **概述** + +**所属模块:** + +[HdfUserAuth](_hdf_user_auth.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| executorIndex | 用户认证框架的执行器索引。 | +| info | 执行器注册信息。 | + + +## **详细描述** + +执行器信息。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **类成员变量说明** + + +### executorIndex + + +``` +unsigned long ExecutorInfo::executorIndex +``` + +**描述:** + +用户认证框架的执行器索引。 + + +### info + + +``` +struct ExecutorRegisterInfo ExecutorInfo::info +``` + +**描述:** + +执行器注册信息[ExecutorRegisterInfo](_executor_register_info.md)。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_verify_alloc_info.md b/zh-cn/device-dev/reference/hdi-apis/_verify_alloc_info.md new file mode 100644 index 0000000000000000000000000000000000000000..dc697ac80a3a92a5e11de4a8454af11cf5bc5a5b --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_verify_alloc_info.md @@ -0,0 +1,26 @@ +# VerifyAllocInfo + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [width](_display.md#width-77) | 分配内存的宽度 | +| [height](_display.md#height-77) | 分配内存的高度 | +| [usage](_display.md#usage-22) | 内存的用处 | +| [format](_display.md#format-22) | 分配内存的像素格式 | + + +## **详细描述** + +用于验证内存分配信息的结构体定义。 diff --git a/zh-cn/device-dev/reference/hdi-apis/_vibrator.md b/zh-cn/device-dev/reference/hdi-apis/_vibrator.md new file mode 100644 index 0000000000000000000000000000000000000000..b3d4c3a0a251d34fd3722591f477e63b3f86f38e --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_vibrator.md @@ -0,0 +1,171 @@ +# Vibrator + + +## **汇总** + + +### 文件 + + | 文件 | 描述 | +| -------- | -------- | +| [vibrator_if.h](vibrator__if_8h.md) | 定义马达数据结构,包括马达模式和效果振动。 | +| [vibrator_type.h](vibrator__type_8h.md) | 定义马达数据结构,包括马达模式和效果振动。 | + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [VibratorInterface](_vibrator_interface.md) | 提供Vibrator设备基本控制操作接口。[更多...](_vibrator_interface.md) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [VibratorMode](#vibratormode) { VIBRATOR_MODE_ONCE = 0, VIBRATOR_MODE_PRESET = 1, VIBRATOR_MODE_BUTT } | 枚举马达振动模式。 [更多...](#vibratormode) | +| [VibratorStatus](#vibratorstatus) { VIBRATOR_SUCCESS = 0, VIBRATOR_NOT_PERIOD = -1,  VIBRATOR_NOT_INTENSITY  = -2,  VIBRATOR_NOT_FREQUENCY= -3} | 枚举马达振动模式。[更多...](#vibratorstatus) | +| [VibratorInfo](#vibratorinfo) { isSupportIntensity, isSupportFrequency, intensityMaxValue, intensityMinValue, frequencyMaxValue, frequencyMinValue} | 定义马达参数。[更多...](#vibratorinfo) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [NewVibratorInterfaceInstance](#newvibratorinterfaceinstance) (void) | 创建一个VibratorInterface实例。 [更多...](#newvibratorinterfaceinstance) | +| [FreeVibratorInterfaceInstance](#freevibratorinterfaceinstance) (void) | 释放VibratorInterface实例以及相关资源。 [更多...](#freevibratorinterfaceinstance) | + + +## **详细描述** + +马达驱动对马达服务提供通用的接口能力。 + +服务获取驱动对象或者代理后,马达服务启动或停止振动。 通过驱动程序对象或代理提供使用功能。 + +**Since:** + +2.2 + +**版本** + +1.0: + + +## **枚举类型说明** + + +### VibratorMode + + +``` +enum VibratorMode +``` + +**描述:** + +枚举马达振动模式。 + + | 枚举值 | 描述 | +| -------- | -------- | +| VIBRATOR_MODE_ONCE | 表示给定持续时间内的一次性振动。 | +| VIBRATOR_MODE_PRESET | 表示具有预置效果的周期性振动。 | +| VIBRATOR_MODE_BUTT | 表示效果模式无效。 | + + +### VibratorStatus + + +``` +enum VibratorStatus +``` + +**描述:** + +枚举马达振动模式。 + + | 枚举值 | 描述 | +| -------- | -------- | +| VIBRATOR_SUCCESS | 操作成功。 | +| VIBRATOR_NOT_PERIOD | 不支持振动周期设置。 | +| VIBRATOR_NOT_INTENSITY | 不支持振幅设置。 | +| VIBRATOR_NOT_FREQUENCY | 不支持频率设置。 | + + +### VibratorInfo + + +``` +enum VibratorInfo +``` + +**描述:** + +定义马达参数。 + +参数包括设置马达振幅和频率以及振幅和频率的范围。 + + | 枚举值 | 描述 | +| -------- | -------- | +| isSupportIntensity | 设置马达振幅。1表示支持,0表示不支持。 | +| isSupportFrequency | 设置马达频率。1表示支持,0表示不支持。 | +| intensityMaxValue | 最大振幅。 | +| intensityMinValue | 最小振幅。 | +| frequencyMaxValue | 最大频率。 | +| frequencyMinValue | 最小频率。 | + + +## **函数说明** + + +### FreeVibratorInterfaceInstance() + + +``` +int32_t FreeVibratorInterfaceInstance (void ) +``` + +**描述:** + +释放VibratorInterface实例以及相关资源。 + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + +**Since:** + +2.2 + +**Version:** + +1.0 + + +### NewVibratorInterfaceInstance() + + +``` +const struct VibratorInterface* NewVibratorInterfaceInstance (void ) +``` + +**描述:** + +创建一个VibratorInterface实例。 + +获的马达接口实例可用于控制马达按照配置进行振动。 + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + +**Since:** + +2.2 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/_vibrator_interface.md b/zh-cn/device-dev/reference/hdi-apis/_vibrator_interface.md new file mode 100644 index 0000000000000000000000000000000000000000..3812f340bae039c6c2d64f9cb25ffa59bab7b3b8 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_vibrator_interface.md @@ -0,0 +1,208 @@ +# VibratorInterface + + +## **概述** + +**所属模块:** + +[Vibrator](_vibrator.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| ( [StartOnce](#startonce) )([in] uint32_t duration) | 控制马达以执行给定持续时间的一次性振动。 [更多...](#startonce) | +| ( [Start](#start) )([in] const char \*effectType) | 控制马达以预置效果执行周期性振动。 [更多...](#start) | +| ( [Stop](#stop) )([in] enum [VibratorMode](_vibrator.md#vibratormode) mode) | 停止马达振动。 [更多...](#stop) | +| ( [GetVibratorInfo](#getvibratorinfo))([out] struct VibratorInfo \*\*vibratorInfo) | 获取有关系统中支持设置振幅和频率的所有马达信息。[更多...](#getvibratorinfo) | +| ( [EnableVibratorModulation](#enablevibratormodulation))(uint32_t duration, int32_t intensity, int32_t frequency) | 根据传入的振动效果启动马达。 [更多...](#enablevibratormodulation) | + + +## **详细描述** + +提供Vibrator设备基本控制操作接口。 + +操作包括马达模式和效果振动、停止马达振动。 + + +## **类成员变量说明** + + +### Start + + +``` +int32_t(*VibratorInterface::Start) ([in] const char *effectType) +``` + +**描述:** + +控制马达以预置效果执行周期性振动。 + +单次振动与周期振动相互排斥。在执行一次性振动之前,需退出周期性振动。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| effectType | 指向指示预置效果类型的指针。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + +**Since:** + +2.2 + +**Version:** + +1.0 + + +### StartOnce + + +``` +int32_t(*VibratorInterface::StartOnce) ([in] uint32_t duration) +``` + +**描述:** + +控制马达以执行给定持续时间的一次性振动。 + +单次振动与周期振动相互排斥。在执行一次性振动之前,需退出周期性振动。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| duration | 指示一次性振动的持续时间,以毫秒为单位。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + +**Since:** + +2.2 + +**Version:** + +1.0 + + +### Stop + + +``` +int32_t(*VibratorInterface::Stop) ([in] enum VibratorMode mode) +``` + +**描述:** + +停止马达振动。 + +马达启动前,必须在任何模式下停止振动。此功能用在振动过程之后。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| mode | 指示振动模式,可以是一次性或周期性的,详见[VibratorMode](_vibrator.md#vibratormode)。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + +**Since:** + +2.2 + +**Version:** + +1.0 + + +### GetVibratorInfo + + +``` +int32_t (*VibratorInterface::GetVibratorInfo)([out] struct VibratorInfo **vibratorInfo) +``` + +**描述:** + +获取有关系统中支持设置振幅和频率的所有马达信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| vibratorInfo | 表示指向马达信息的指针,详见 [VibratorInfo](_vibrator.md#vibratorinfo)。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + +**Since:** + +3.2 + +**Version:** + +1.1 + + +### EnableVibratorModulation + + +``` +int32_t (*VibratorInterface::EnableVibratorModulation)(uint32_t duration, int32_t intensity, int32_t frequency); +``` + +**描述:** + +根据传入的振动效果启动马达。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| duration | 表示马达振动的持续时间,以毫秒为单位。 | +| intensity | 表示振动周期内的马达振幅。 | +| frequency | 表示振动周期内的马达频率。 | + +**返回:** + +如果操作成功,则返回0。 + +如果不支持振动周期设置,则返回-1。 + +如果不支持振幅设置,则返回-2。 + +如果不支持频率设置,则返回-3。 + + +**Since:** + + +3.2 + + +**Version:** + + +1.1 diff --git a/zh-cn/device-dev/reference/hdi-apis/_video_port_cap.md b/zh-cn/device-dev/reference/hdi-apis/_video_port_cap.md new file mode 100644 index 0000000000000000000000000000000000000000..e99f63e78499847569f19217ddfc009f6b9a99de --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_video_port_cap.md @@ -0,0 +1,116 @@ +# VideoPortCap + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [minSize](#minsize) | 支持的最小分辨率 | +| [maxSize](#maxsize) | 支持的最大分辨率 | +| [whAlignment](#whalignment) | 宽高对齐值 | +| [blockCount](#blockcount) | 支持的块数量范围 | +| [blocksPerSecond](#blockspersecond) | 每秒可处理的块数量范围 | +| [blockSize](#blocksize) | 支持的块大小 | +| [supportPixFmts](#supportpixfmts) [[PIX_FORMAT_NUM](_codec.md#gadb8c6478388b68c09835ebe093a8920a)] | 支持的像素格式 | + + +## **详细描述** + +定义视频编解码能力。 + + +## **类成员变量说明** + + +### blockCount + + +``` +RangeValue VideoPortCap::blockCount +``` + +**描述:** + +支持的块数量范围 + + +### blockSize + + +``` +Rect VideoPortCap::blockSize +``` + +**描述:** + +支持的块大小 + + +### blocksPerSecond + + +``` +RangeValue VideoPortCap::blocksPerSecond +``` + +**描述:** + +每秒可处理的块数量范围 + + +### maxSize + + +``` +Rect VideoPortCap::maxSize +``` + +**描述:** + +支持的最大分辨率 + + +### minSize + + +``` +Rect VideoPortCap::minSize +``` + +**描述:** + +支持的最小分辨率 + + +### supportPixFmts + + +``` +int32_t VideoPortCap::supportPixFmts[PIX_FORMAT_NUM] +``` + +**描述:** + +支持的像素格式,详见**OMX_COLOR_FORMATTYPE** + + +### whAlignment + + +``` +Alignment VideoPortCap::whAlignment +``` + +**描述:** + +宽高对齐值 diff --git a/zh-cn/device-dev/reference/hdi-apis/_w_l_a_n.md b/zh-cn/device-dev/reference/hdi-apis/_w_l_a_n.md new file mode 100644 index 0000000000000000000000000000000000000000..1abeadfea0e954a557e821a716cab04c96aa158c --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/_w_l_a_n.md @@ -0,0 +1,304 @@ +# WLAN + + +## **汇总** + + +### 文件 + + | 文件 | 描述 | +| -------- | -------- | +| [wifi_hal.h](wifi__hal_8h.md) | 提供给WLAN服务的WLAN基本能力接口。 | +| [wifi_hal_ap_feature.h](wifi__hal__ap__feature_8h.md) | 提供WLAN的AP特性能力(获取与AP连接的STA的基本信息、设置国家码)。 | +| [wifi_hal_base_feature.h](wifi__hal__base__feature_8h.md) | 提供WLAN基本特性能力。 | +| [wifi_hal_sta_feature.h](wifi__hal__sta__feature_8h.md) | 提供WLAN的STA特性能力。 | + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IWiFi](_i_wi_fi.md) | HAL对WLAN服务提供的基本能力。 [更多...](_i_wi_fi.md) | +| [StaInfo](_sta_info.md) | 描述与AP连接的STA的基本信息 [更多...](_sta_info.md) | +| [IWiFiAp](_i_wi_fi_ap.md) | 继承了[IWiFiBaseFeature](_i_wi_fi_base_feature.md)基本特性,并包含AP模式下获取连接STA的信息和设置国家码的功能。 [更多...](_i_wi_fi_ap.md) | +| [IWiFiBaseFeature](_i_wi_fi_base_feature.md) | WLAN基本特性操作接口,包括获取网卡名称,设置MAC地址,设置发射功率等公共能力接口。 [更多...](_i_wi_fi_base_feature.md) | +| [IWiFiSta](_i_wi_fi_sta.md) | 继承了[IWiFiBaseFeature](_i_wi_fi_base_feature.md)基本特性,额外包含设置扫描单个MAC地址功能。 [更多...](_i_wi_fi_sta.md) | + + +### 宏定义 + + | 宏定义 | 描述 | +| -------- | -------- | +| IFNAME_MAX_LEN    16 | 网卡名称最大长度。 | +| WIFI_MAC_ADDR_LENGTH    6 | WLAN的MAC地址长度。 | +| ERR_UNAUTH_ACCESS    (-6) | 定义访问失败错误码。 | + + +### 类型定义 + + | 类型定义 | 描述 | +| -------- | -------- | +| ([CallbackFunc](#callbackfunc)) (uint32_t event, void \*data, const char \*ifName) | 定义IWiFi回调函数的原型,监听异步事件。 [更多...](#callbackfunc) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [FeatureType](#featuretype) {   PROTOCOL_80211_IFTYPE_UNSPECIFIED, PROTOCOL_80211_IFTYPE_ADHOC, PROTOCOL_80211_IFTYPE_STATION, PROTOCOL_80211_IFTYPE_AP,   PROTOCOL_80211_IFTYPE_AP_VLAN, PROTOCOL_80211_IFTYPE_WDS, PROTOCOL_80211_IFTYPE_MONITOR, PROTOCOL_80211_IFTYPE_MESH_POINT,   PROTOCOL_80211_IFTYPE_P2P_CLIENT, PROTOCOL_80211_IFTYPE_P2P_GO, PROTOCOL_80211_IFTYPE_P2P_DEVICE, PROTOCOL_80211_IFTYPE_NUM } | 枚举WLAN相关特性的类型[FeatureType](#featuretype)。 [更多...](#featuretype) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [WifiConstruct](#wificonstruct) (struct [IWiFi](_i_wi_fi.md) \*\*wifiInstance) | 创建IWiFi结构体,挂接[IWiFi](_i_wi_fi.md)中能力接口。 [更多...](#wificonstruct) | +| [WifiDestruct](#wifidestruct) (struct [IWiFi](_i_wi_fi.md) \*\*wifiInstance) | 销毁IWiFi结构体并释放相关资源。 [更多...](#wifidestruct) | +| [InitApFeature](#initapfeature) (struct [IWiFiAp](_i_wi_fi_ap.md) \*\*fe) | 初始化AP特性。WLAN服务在创建AP类型的特性[FeatureType](#featuretype)时调用。 [更多...](#initapfeature) | +| [InitBaseFeature](#initbasefeature) (struct [IWiFiBaseFeature](_i_wi_fi_base_feature.md) \*\*fe) | WLAN服务创建任何类型的特性{\@Link FeatureType}时,都需要调用此函数。 [更多...](#initbasefeature) | +| [InitStaFeature](#initstafeature) (struct [IWiFiSta](_i_wi_fi_sta.md) \*\*fe) | 初始化STA特性。WLAN服务在创建STA类型的特性[FeatureType](#featuretype)时调用。 [更多...](#initstafeature) | + + +## **详细描述** + +WLAN模块向上层WLAN服务提供了统一接口。 + +HDI层开发人员可根据WLAN模块提供的向上统一接口获取如下能力:建立/关闭WLAN热点,扫描,关联WLAN热点,WLAN平台芯片管理,网络数据缓冲的申请、释放、移动等操作,网络设备管理,电源管理等。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **类型定义说明** + + +### CallbackFunc + + +``` +typedef int32_t(* CallbackFunc) (uint32_t event, void *data, const char *ifName) +``` + +**描述:** + +定义IWiFi回调函数的原型,监听异步事件。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| event | 输入参数,回调传入的事件类型标识。 | +| data | 输入参数,回调传入的数据。 | +| ifName | 输入参数,网卡名称。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +## **枚举类型说明** + + +### FeatureType + + +``` +enum FeatureType +``` + +**描述:** + +枚举WLAN相关特性的类型[FeatureType](#featuretype)。 + + | 枚举值 | 描述 | +| -------- | -------- | +| PROTOCOL_80211_IFTYPE_UNSPECIFIED | 未定义的类型 | +| PROTOCOL_80211_IFTYPE_ADHOC | 特设型网络 | +| PROTOCOL_80211_IFTYPE_STATION | 工作站 | +| PROTOCOL_80211_IFTYPE_AP | 接入点 | +| PROTOCOL_80211_IFTYPE_AP_VLAN | 虚拟接入点 | +| PROTOCOL_80211_IFTYPE_WDS | 无线分布式系统 | +| PROTOCOL_80211_IFTYPE_MONITOR | 网络监听器 | +| PROTOCOL_80211_IFTYPE_MESH_POINT | 组网 | +| PROTOCOL_80211_IFTYPE_P2P_CLIENT | 对等网络客户端 | +| PROTOCOL_80211_IFTYPE_P2P_GO | 对等网络群组所有者 | +| PROTOCOL_80211_IFTYPE_P2P_DEVICE | 对等网络设备 | +| PROTOCOL_80211_IFTYPE_NUM | 网口的数目 | + + +## **函数说明** + + +### InitApFeature() + + +``` +int32_t InitApFeature (struct IWiFiAp **fe) +``` + +**描述:** + +初始化AP特性。WLAN服务在创建AP类型的特性[FeatureType](#featuretype)时调用。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| fe | 输入参数,AP特性[IWiFiAp](_i_wi_fi_ap.md)。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### InitBaseFeature() + + +``` +int32_t InitBaseFeature (struct IWiFiBaseFeature **fe) +``` + +**描述:** + +WLAN服务创建任何类型的特性{\@Link FeatureType}时,都需要调用此函数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| fe | 输入参数,基本特性[IWiFiBaseFeature](_i_wi_fi_base_feature.md)。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### InitStaFeature() + + +``` +int32_t InitStaFeature (struct IWiFiSta **fe) +``` + +**描述:** + +初始化STA特性。WLAN服务在创建STA类型的特性[FeatureType](#featuretype)时调用。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| fe | 输出参数,STA特性[IWiFiSta](_i_wi_fi_sta.md)。 | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### WifiConstruct() + + +``` +int32_t WifiConstruct (struct IWiFi **wifiInstance) +``` + +**描述:** + +创建IWiFi结构体,挂接[IWiFi](_i_wi_fi.md)中能力接口。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| wifiInstance | HAL服务对象[IWiFi](_i_wi_fi.md) | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + +**Since:** + +1.0 + +**Version:** + +1.0 + + +### WifiDestruct() + + +``` +int32_t WifiDestruct (struct IWiFi **wifiInstance) +``` + +**描述:** + +销毁IWiFi结构体并释放相关资源。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| wifiInstance | HAL服务对象[IWiFi](_i_wi_fi.md) | + +**返回:** + +如果操作成功,则返回0。 + +如果操作失败,则返回负值。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/annotated.md b/zh-cn/device-dev/reference/hdi-apis/annotated.md new file mode 100644 index 0000000000000000000000000000000000000000..86ba79c685e4f78974093e893d95a35995197b62 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/annotated.md @@ -0,0 +1,267 @@ +# 结构体 + + + +- **[__attribute__](____attribute____.md)** + +- **[Alignment](_alignment.md)** + +- **[AllocInfo](_alloc_info.md)** + +- **[AudioAdapter](_audio_adapter.md)** + +- **[AudioAdapterDescriptor](_audio_adapter_descriptor.md)** + +- **[AudioAttribute](_audio_attribute.md)** + +- **[AudioCapture](_audio_capture.md)** + +- **[AudioControl](_audio_control.md)** + +- **[AudioDevExtInfo](_audio_dev_ext_info.md)** + +- **[AudioDeviceDescriptor](_audio_device_descriptor.md)** + +- **[AudioManager](_audio_manager.md)** + +- **[AudioMixExtInfo](_audio_mix_ext_info.md)** + +- **[AudioMmapBufferDescripter](_audio_mmap_buffer_descripter.md)** + +- **[AudioPort](_audio_port.md)** + +- **[AudioPortCap](_audio_port_cap.md)** + +- **[AudioPortCapability](_audio_port_capability.md)** + +- **[AudioRender](_audio_render.md)** + +- **[AudioRoute](_audio_route.md)** + +- **[AudioRouteNode](_audio_route_node.md)** + +- **[AudioSampleAttributes](_audio_sample_attributes.md)** + +- **[AudioScene](_audio_scene.md)** + +- **[AudioSceneDescriptor](_audio_scene_descriptor.md)** + +- **[AudioSceneDescriptor::SceneDesc](union_audio_scene_descriptor_1_1_scene_desc.md)** + +- **[AudioSessionExtInfo](_audio_session_ext_info.md)** + +- **[AudioSubPortCapability](_audio_sub_port_capability.md)** + +- **[AudioTimeStamp](_audio_time_stamp.md)** + +- **[AudioVolume](_audio_volume.md)** + +- **[AuthResultInfo](_auth_result_info.md)** + +- **[AuthSolution](_auth_solution.md)** + +- **[BatteryInfo](_battery_info.md)** + +- **[BufferData](_buffer_data.md)** + +- **[CodecCallbackType](_codec_callback_type.md)** + +- **[CodecCompCapability](_codec_comp_capability.md)** + +- **[CodecComponentManager](_codec_component_manager.md)** + +- **[CodecComponentType](_codec_component_type.md)** + +- **[CompVerInfo](_comp_ver_info.md)** + +- **[CredentialInfo](_credential_info.md)** + +- **[DeviceFuncs](_device_funcs.md)** + +- **[DeviceInfo](_device_info.md)** + +- **[DisplayCapability](_display_capability.md)** + +- **[DisplayInfo](_display_info.md)** + +- **[DisplayModeInfo](_display_mode_info.md)** + +- **[EnrolledInfo](_enrolled_info.md)** + +- **[EnrollParam](_enroll_param.md)** + +- **[EnrollResultInfo](_enroll_resultinfo.md)** + +- **[EventInfo](_event_info.md)** + +- **[EventPackage](_event_package.md)** + +- **[ExecutorInfo](_executor_info.md)** + +- **[ExecutorInfo](_user_executor_info.md)** + +- **[ExecutorRegisterInfo](_executor_register_info.md)** + +- **[ExecutorSendMsg](_executor_send_msg.md)** + +- **[GetBufferHandleUsageParams](_get_buffer_handle_usage_params.md)** + +- **[GfxFuncs](_gfx_funcs.md)** + +- **[GfxOpt](_gfx_opt.md)** + +- **[GrallocFuncs](_gralloc_funcs.md)** + +- **[HdfThermalCallbackInfo](_hdf_thermal_callback_info.md)** + +- **[HDRCapability](_h_d_r_capability.md)** + +- **[HDRMetaData](_h_d_r_meta_data.md)** + +- **[IBatteryCallback](interface_i_battery_callback.md)** + +- **[IBatteryInterface](interface_i_battery_interface.md)** + +- **[ICircle](_i_circle.md)** + +- **[IdentifyResultInfo](_identify_result_info.md)** + +- **[IExecutor](interface_i_executor.md)** + +- **[IExecutor](interface_pin_i_executor.md)** + +- **[IExecutorCallback](interface_i_executor_callback.md)** + +- **[IExecutorCallback](interface_pin_i_executor_callback.md)** + +- **[IFaceAuthInterface](interface_i_face_auth_interface.md)** + +- **[IInputInterface](_i_input_interface.md)** + +- **[ILine](_i_line.md)** + +- **[InputController](_input_controller.md)** + +- **[InputExtraCmd](_input_extra_cmd.md)** + +- **[InputManager](_input_manager.md)** + +- **[InputReporter](_input_reporter.md)** + +- **[InputReportEventCb](_input_report_event_cb.md)** + +- **[IPinAuthInterface](interface_i_pin_auth_interface.md)** + +- **[IPowerHdiCallback](interface_i_power_hdi_callback.md)** + +- **[IPowerInterface](interface_i_power_interface.md)** + +- **[IRect](_i_rect.md)** + +- **[ISurface](_i_surface.md)** + +- **[IThermalCallback](interface_i_thermal_callback.md)** + +- **[IThermalInterface](interface_i_thermal_interface.md)** + +- **[IUserAuthInterface](interface_i_user_auth_interface.md)** + +- **[IWiFi](_i_wi_fi.md)** + +- **[IWiFiAp](_i_wi_fi_ap.md)** + +- **[IWiFiBaseFeature](_i_wi_fi_base_feature.md)** + +- **[IWiFiSta](_i_wi_fi_sta.md)** + +- **[LayerAlpha](_layer_alpha.md)** + +- **[LayerBuffer](_layer_buffer.md)** + +- **[LayerFuncs](_layer_funcs.md)** + +- **[LayerInfo](_layer_info.md)** + +- **[LightEffect](_light_effect.md)** + +- **[LightFlashEffect](_light_flash_effect.md)** + +- **[LightInfo](_light_info.md)** + +- **[LightInterface](_light_interface.md)** + +- **[OHOS::Camera::CaptureEndedInfo](_o_h_o_s_1_1_camera_1_1_capture_ended_info.md)** + +- **[OHOS::Camera::CaptureErrorInfo](_o_h_o_s_1_1_camera_1_1_capture_error_info.md)** + +- **[OHOS::Camera::CaptureInfo](_o_h_o_s_1_1_camera_1_1_capture_info.md)** + +- **[OHOS::Camera::ICameraDevice](_o_h_o_s_1_1_camera_1_1_i_camera_device.md)** + +- **[OHOS::Camera::ICameraDeviceCallback](_o_h_o_s_1_1_camera_1_1_i_camera_device_callback.md)** + +- **[OHOS::Camera::ICameraHost](_o_h_o_s_1_1_camera_1_1_i_camera_host.md)** + +- **[OHOS::Camera::ICameraHostCallback](_o_h_o_s_1_1_camera_1_1_i_camera_host_callback.md)** + +- **[OHOS::Camera::IOfflineStreamOperator](_o_h_o_s_1_1_camera_1_1_i_offline_stream_operator.md)** + +- **[OHOS::Camera::IStreamOperator](_o_h_o_s_1_1_camera_1_1_i_stream_operator.md)** + +- **[OHOS::Camera::IStreamOperatorCallback](_o_h_o_s_1_1_camera_1_1_i_stream_operator_callback.md)** + +- **[OHOS::Camera::StreamAttribute](_o_h_o_s_1_1_camera_1_1_stream_attribute.md)** + +- **[OHOS::Camera::StreamInfo](_o_h_o_s_1_1_camera_1_1_stream_info.md)** + +- **[OHOS::USB::UsbCtrlTransfer](_o_h_o_s_1_1_u_s_b_1_1_usb_ctrl_transfer.md)** + +- **[OHOS::USB::UsbdClient](_o_h_o_s_1_1_u_s_b_1_1_usbd_client.md)** + +- **[OHOS::USB::UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md)** + +- **[OHOS::USB::USBDeviceInfo](_o_h_o_s_1_1_u_s_b_1_1_u_s_b_device_info.md)** + +- **[OHOS::USB::UsbdSubscriber](_o_h_o_s_1_1_u_s_b_1_1_usbd_subscriber.md)** + +- **[OHOS::USB::UsbInfo](_o_h_o_s_1_1_u_s_b_1_1_usb_info.md)** + +- **[OHOS::USB::UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md)** + +- **[OmxCodecBuffer](_omx_codec_buffer.md)** + +- **[PortCap](union_port_cap.md)** + +- **[PresentTimestamp](_present_timestamp.md)** + +- **[PropertyObject](_property_object.md)** + +- **[RangeValue](_range_value.md)** + +- **[Rect](_rect.md)** + +- **[Rectangle](_rectangle.md)** + +- **[ScheduleInfo](_schedule_info.md)** + +- **[SensorEvents](_sensor_events.md)** + +- **[SensorInformation](_sensor_information.md)** + +- **[SensorInterface](_sensor_interface.md)** + +- **[StaInfo](_sta_info.md)** + +- **[SupportBufferType](_support_buffer_type.md)** + +- **[TemplateInfo](_template_info.md)** + +- **[ThermalZoneInfo](_thermal_zone_info.md)** + +- **[UseBufferType](_use_buffer_type.md)** + +- **[VerifyAllocInfo](_verify_alloc_info.md)** + +- **[VibratorInterface](_vibrator_interface.md)** + +- **[VideoPortCap](_video_port_cap.md)** \ No newline at end of file diff --git a/zh-cn/device-dev/reference/hdi-apis/audio__adapter_8h.md b/zh-cn/device-dev/reference/hdi-apis/audio__adapter_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..39a1c6b4c753d39fa2c89bf7aea12435a1a1397d --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/audio__adapter_8h.md @@ -0,0 +1,31 @@ +# audio_adapter.h + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [AudioAdapter](_audio_adapter.md) | AudioAdapter音频适配器接口 [更多...](_audio_adapter.md) | + + +## **详细描述** + +Audio适配器的接口定义文件。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/audio__attribute_8h.md b/zh-cn/device-dev/reference/hdi-apis/audio__attribute_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..095bcf40db692f78de203acd93a8bf9d0058821d --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/audio__attribute_8h.md @@ -0,0 +1,31 @@ +# audio_attribute.h + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [AudioAttribute](_audio_attribute.md) | AudioAttribute音频属性接口 [更多...](_audio_attribute.md) | + + +## **详细描述** + +Audio属性的接口定义文件。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/audio__capture_8h.md b/zh-cn/device-dev/reference/hdi-apis/audio__capture_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..62573f64322601ee09e1172bb3e0036654ad439d --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/audio__capture_8h.md @@ -0,0 +1,31 @@ +# audio_capture.h + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [AudioCapture](_audio_capture.md) | AudioCapture音频录音接口 [更多...](_audio_capture.md) | + + +## **详细描述** + +Audio录音的接口定义文件。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/audio__control_8h.md b/zh-cn/device-dev/reference/hdi-apis/audio__control_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..04254ba25ab995425f023c5dc54a8ee23a340fb1 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/audio__control_8h.md @@ -0,0 +1,31 @@ +# audio_control.h + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [AudioControl](_audio_control.md) | AudioControl音频控制接口 [更多...](_audio_control.md) | + + +## **详细描述** + +Audio控制的接口定义文件。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/audio__manager_8h.md b/zh-cn/device-dev/reference/hdi-apis/audio__manager_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..7ac28b26d6aa3f47e03f6eee4990e6b5da257a86 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/audio__manager_8h.md @@ -0,0 +1,38 @@ +# audio_manager.h + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [AudioManager](_audio_manager.md) | AudioManager音频适配器管理接口 [更多...](_audio_manager.md) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [GetAudioManagerFuncs](_audio.md#getaudiomanagerfuncs) (void) | 获取音频适配器管理接口的操作函数列表,详情参考[AudioManager](_audio_manager.md)[更多...](_audio.md#getaudiomanagerfuncs) | + + +## **详细描述** + +Audio适配器管理及加载的接口定义文件。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/audio__render_8h.md b/zh-cn/device-dev/reference/hdi-apis/audio__render_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..7f1d7eaa28d7a5ecf2edba37ea302a9d8b96463b --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/audio__render_8h.md @@ -0,0 +1,31 @@ +# audio_render.h + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [AudioRender](_audio_render.md) | AudioRender音频播放接口 [更多...](_audio_render.md) | + + +## **详细描述** + +Audio播放的接口定义文件。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/audio__scene_8h.md b/zh-cn/device-dev/reference/hdi-apis/audio__scene_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..09b3026f883670d286ec9bedca1e4a27f8a65d54 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/audio__scene_8h.md @@ -0,0 +1,31 @@ +# audio_scene.h + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [AudioScene](_audio_scene.md) | AudioScene音频场景接口 [更多...](_audio_scene.md) | + + +## **详细描述** + +Audio场景的接口定义文件。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/audio__types_8h.md b/zh-cn/device-dev/reference/hdi-apis/audio__types_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..5d038c1abc9b3780f27c3a1143fd02639cc99119 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/audio__types_8h.md @@ -0,0 +1,75 @@ +# audio_types.h + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [AudioPort](_audio_port.md) | 音频端口 [更多...](_audio_port.md) | +| [AudioAdapterDescriptor](_audio_adapter_descriptor.md) | 音频适配器描述符 [更多...](_audio_adapter_descriptor.md) | +| [AudioDeviceDescriptor](_audio_device_descriptor.md) | 音频设备描述符 [更多...](_audio_device_descriptor.md) | +| [AudioSceneDescriptor](_audio_scene_descriptor.md) | 音频场景描述符 [更多...](_audio_scene_descriptor.md) | +| [AudioSceneDescriptor::SceneDesc](union_audio_scene_descriptor_1_1_scene_desc.md) | 音频场景描述 [更多...](union_audio_scene_descriptor_1_1_scene_desc.md) | +| [AudioSampleAttributes](_audio_sample_attributes.md) | 音频采样属性 [更多...](_audio_sample_attributes.md) | +| [AudioTimeStamp](_audio_time_stamp.md) | 音频时间戳 [更多...](_audio_time_stamp.md) | +| [AudioSubPortCapability](_audio_sub_port_capability.md) | 音频子端口的支持能力 [更多...](_audio_sub_port_capability.md) | +| [AudioPortCapability](_audio_port_capability.md) | 音频端口的支持能力 [更多...](_audio_port_capability.md) | +| [AudioMmapBufferDescripter](_audio_mmap_buffer_descripter.md) | mmap缓冲区描述符 [更多...](_audio_mmap_buffer_descripter.md) | +| [AudioDevExtInfo](_audio_dev_ext_info.md) | 音频设备拓展信息 [更多...](_audio_dev_ext_info.md) | +| [AudioMixExtInfo](_audio_mix_ext_info.md) | 音轨拓展信息 [更多...](_audio_mix_ext_info.md) | +| [AudioSessionExtInfo](_audio_session_ext_info.md) | 会话拓展信息 [更多...](_audio_session_ext_info.md) | +| [AudioRouteNode](_audio_route_node.md) | 音频路由节点 [更多...](_audio_route_node.md) | +| [AudioRoute](_audio_route.md) | 音频路由信息 [更多...](_audio_route.md) | + + +### 类型定义 + + | 类型定义 | 描述 | +| -------- | -------- | +| [AudioHandle](_audio.md#ga18675ddb073465fdeac33a897f675d79) | 音频句柄 | +| ([RenderCallback](_audio.md#rendercallback)) (enum [AudioCallbackType](_audio.md#audiocallbacktype), void \*reserved, void \*cookie) | 回调函数指针 [更多...](_audio.md#rendercallback) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [AudioPortDirection](_audio.md#audioportdirection) { PORT_OUT = 0x1u, PORT_IN = 0x2u, PORT_OUT_IN = 0x3u } | 音频端口的类型 [更多...](_audio.md#audioportdirection) | +| [AudioPortPin](_audio.md#audioportpin) {   PIN_NONE = 0x0u, PIN_OUT_SPEAKER = 0x1u, PIN_OUT_HEADSET = 0x2u, PIN_OUT_LINEOUT = 0x4u,   PIN_OUT_HDMI = 0x8u, PIN_OUT_USB = 0x10u, PIN_OUT_USB_EXT = 0x20u, PIN_IN_MIC = 0x8000001u,   PIN_IN_HS_MIC = 0x8000002u, PIN_IN_LINEIN = 0x8000004u, PIN_IN_USB_EXT = 0x8000008u } | 音频适配器端口的PIN脚 [更多...](_audio.md#audioportpin) | +| [AudioCategory](_audio.md#audiocategory) { AUDIO_IN_MEDIA = 0, AUDIO_IN_COMMUNICATION, AUDIO_IN_RINGTONE, AUDIO_IN_CALL } | 音频类型(category) [更多...](_audio.md#audiocategory) | +| [AudioFormat](_audio.md#audioformat) {   AUDIO_FORMAT_PCM_8_BIT = 0x1u, AUDIO_FORMAT_PCM_16_BIT = 0x2u, AUDIO_FORMAT_PCM_24_BIT = 0x3u, AUDIO_FORMAT_PCM_32_BIT = 0x4u,   AUDIO_FORMAT_AAC_MAIN = 0x1000001u, AUDIO_FORMAT_AAC_LC = 0x1000002u, AUDIO_FORMAT_AAC_LD = 0x1000003u, AUDIO_FORMAT_AAC_ELD = 0x1000004u,   AUDIO_FORMAT_AAC_HE_V1 = 0x1000005u, AUDIO_FORMAT_AAC_HE_V2 = 0x1000006u, AUDIO_FORMAT_G711A = 0x2000001u, AUDIO_FORMAT_G711U = 0x2000002u,   AUDIO_FORMAT_G726 = 0x2000003u } | 音频格式 [更多...](_audio.md#audioformat) | +| [AudioChannelMask](_audio.md#audiochannelmask) { AUDIO_CHANNEL_FRONT_LEFT = 0x1, AUDIO_CHANNEL_FRONT_RIGHT = 0x2, AUDIO_CHANNEL_MONO = 0x1u, AUDIO_CHANNEL_STEREO = 0x3u } | 音频通道掩码(mask) [更多...](_audio.md#audiochannelmask) | +| [AudioSampleRatesMask](_audio.md#audiosampleratesmask) {   AUDIO_SAMPLE_RATE_MASK_8000 = 0x1u, AUDIO_SAMPLE_RATE_MASK_12000 = 0x2u, AUDIO_SAMPLE_RATE_MASK_11025 = 0x4u, AUDIO_SAMPLE_RATE_MASK_16000 = 0x8u,   AUDIO_SAMPLE_RATE_MASK_22050 = 0x10u, AUDIO_SAMPLE_RATE_MASK_24000 = 0x20u, AUDIO_SAMPLE_RATE_MASK_32000 = 0x40u, AUDIO_SAMPLE_RATE_MASK_44100 = 0x80u,   AUDIO_SAMPLE_RATE_MASK_48000 = 0x100u, AUDIO_SAMPLE_RATE_MASK_64000 = 0x200u, AUDIO_SAMPLE_RATE_MASK_96000 = 0x400u, AUDIO_SAMPLE_RATE_MASK_INVALID = 0xFFFFFFFFu } | 音频采样频率MASK [更多...](_audio.md#audiosampleratesmask) | +| [AudioPortPassthroughMode](_audio.md#audioportpassthroughmode) { PORT_PASSTHROUGH_LPCM = 0x1, PORT_PASSTHROUGH_RAW = 0x2, PORT_PASSTHROUGH_HBR2LBR = 0x4, PORT_PASSTHROUGH_AUTO = 0x8 } | 音频端口的数据透传模式 [更多...](_audio.md#audioportpassthroughmode) | +| [AudioSampleFormat](_audio.md#audiosampleformat) {   AUDIO_SAMPLE_FORMAT_S8, AUDIO_SAMPLE_FORMAT_S8P, AUDIO_SAMPLE_FORMAT_U8, AUDIO_SAMPLE_FORMAT_U8P,   AUDIO_SAMPLE_FORMAT_S16, AUDIO_SAMPLE_FORMAT_S16P, AUDIO_SAMPLE_FORMAT_U16, AUDIO_SAMPLE_FORMAT_U16P,   AUDIO_SAMPLE_FORMAT_S24, AUDIO_SAMPLE_FORMAT_S24P, AUDIO_SAMPLE_FORMAT_U24, AUDIO_SAMPLE_FORMAT_U24P,   AUDIO_SAMPLE_FORMAT_S32, AUDIO_SAMPLE_FORMAT_S32P, AUDIO_SAMPLE_FORMAT_U32, AUDIO_SAMPLE_FORMAT_U32P,   AUDIO_SAMPLE_FORMAT_S64, AUDIO_SAMPLE_FORMAT_S64P, AUDIO_SAMPLE_FORMAT_U64, AUDIO_SAMPLE_FORMAT_U64P,   AUDIO_SAMPLE_FORMAT_F32, AUDIO_SAMPLE_FORMAT_F32P, AUDIO_SAMPLE_FORMAT_F64, AUDIO_SAMPLE_FORMAT_F64P,   AUDIO_SAMPLE_FMT_U8, AUDIO_SAMPLE_FMT_S16, AUDIO_SAMPLE_FMT_S32, AUDIO_SAMPLE_FMT_FLOAT,   AUDIO_SAMPLE_FMT_DOUBLE, AUDIO_SAMPLE_FMT_U8P, AUDIO_SAMPLE_FMT_S16P, AUDIO_SAMPLE_FMT_S32P,   AUDIO_SAMPLE_FMT_FLOATP, AUDIO_SAMPLE_FMT_DOUBLEP, AUDIO_SAMPLE_FMT_INVALID } | 原始音频样本格式 [更多...](_audio.md#audiosampleformat) | +| [AudioChannelMode](_audio.md#audiochannelmode) {   AUDIO_CHANNEL_NORMAL = 0, AUDIO_CHANNEL_BOTH_LEFT, AUDIO_CHANNEL_BOTH_RIGHT, AUDIO_CHANNEL_EXCHANGE,   AUDIO_CHANNEL_MIX, AUDIO_CHANNEL_LEFT_MUTE, AUDIO_CHANNEL_RIGHT_MUTE, AUDIO_CHANNEL_BOTH_MUTE } | 音频播放的通道模式 [更多...](_audio.md#audiochannelmode) | +| [AudioDrainNotifyType](_audio.md#audiodrainnotifytype) { AUDIO_DRAIN_NORMAL_MODE, AUDIO_DRAIN_EARLY_MODE } | DrainBuffer函数结束类型 [更多...](_audio.md#audiodrainnotifytype) | +| [AudioCallbackType](_audio.md#audiocallbacktype) {   AUDIO_NONBLOCK_WRITE_COMPELETED, AUDIO_DRAIN_COMPELETED, AUDIO_FLUSH_COMPLETED, AUDIO_RENDER_FULL,   AUDIO_ERROR_OCCUR } | 回调函数通知事件类型 [更多...](_audio.md#audiocallbacktype) | +| [AudioPortRole](_audio.md#audioportrole) { AUDIO_PORT_UNASSIGNED_ROLE = 0, AUDIO_PORT_SOURCE_ROLE = 1, AUDIO_PORT_SINK_ROLE = 2 } | 音频端口角色 [更多...](_audio.md#audioportrole) | +| [AudioPortType](_audio.md#audioporttype) { AUDIO_PORT_UNASSIGNED_TYPE = 0, AUDIO_PORT_DEVICE_TYPE = 1, AUDIO_PORT_MIX_TYPE = 2, AUDIO_PORT_SESSION_TYPE = 3 } | 音频端口类型. [更多...](_audio.md#audioporttype) | +| [AudioSessionType](_audio.md#audiosessiontype) { AUDIO_OUTPUT_STAGE_SESSION = 0, AUDIO_OUTPUT_MIX_SESSION, AUDIO_ALLOCATE_SESSION, AUDIO_INVALID_SESSION } | 端口会话类型 [更多...](_audio.md#audiosessiontype) | + + +## **详细描述** + +Audio模块接口定义中使用的自定义数据类型 + +Audio模块接口定义中使用的自定义数据类型,包括音频端口、适配器描述符、设备描述符、场景描述符、采样属性、时间戳等。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/audio__volume_8h.md b/zh-cn/device-dev/reference/hdi-apis/audio__volume_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..743fa7b97a30dd5cf2fa49bc650e50de06928579 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/audio__volume_8h.md @@ -0,0 +1,31 @@ +# audio_volume.h + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [AudioVolume](_audio_volume.md) | AudioVolume音频音量接口 [更多...](_audio_volume.md) | + + +## **详细描述** + +Audio音量的接口定义文件。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/battery.md b/zh-cn/device-dev/reference/hdi-apis/battery.md new file mode 100644 index 0000000000000000000000000000000000000000..1a16568662ace94731352b6bf85f4da96607314b --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/battery.md @@ -0,0 +1,118 @@ +# Battery + + +## **汇总** + + +### 文件 + + | 文件 | 描述 | +| -------- | -------- | +| [IBatteryCallback.idl](_i_battery_callback_8idl.md) | 电池信息的回调。 | +| [IBatteryInterface.idl](_i_battery_interface_8idl.md) | 获取、订阅电池信息的接口。 | +| [Types.idl](_types_8idl.md) | 电池信息相关数据类型。 | + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IBatteryCallback](interface_i_battery_callback.md) | 电池信息的回调。 [更多...](interface_i_battery_callback.md) | +| [IBatteryInterface](interface_i_battery_interface.md) | 获取、订阅电池信息的接口。 [更多...](interface_i_battery_interface.md) | +| [BatteryInfo](_battery_info.md) | 电池相关信息。 [更多...](_battery_info.md) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [BatteryHealthState](#batteryhealthstate) {   BATTERY_HEALTH_UNKNOWN = 0, BATTERY_HEALTH_GOOD, BATTERY_HEALTH_OVERHEAT, BATTERY_HEALTH_OVERVOLTAGE,   BATTERY_HEALTH_COLD, BATTERY_HEALTH_DEAD, BATTERY_HEALTH_RESERVED } | 电池的健康状态。 [更多...](#batteryhealthstate) | +| [BatteryChargeState](#batterychargestate) {   CHARGE_STATE_NONE = 0, CHARGE_STATE_ENABLE, CHARGE_STATE_DISABLE, CHARGE_STATE_FULL,   CHARGE_STATE_RESERVED } | 电池的充电状态。 [更多...](#batterychargestate) | +| [BatteryPluggedType](#batterypluggedtype) {   PLUGGED_TYPE_NONE = 0, PLUGGED_TYPE_AC, PLUGGED_TYPE_USB, PLUGGED_TYPE_WIRELESS,   PLUGGED_TYPE_BUTT } | 电池的充电设备类型。 [更多...](#batterypluggedtype) | + + +### 变量 + + | 变量 | 描述 | +| -------- | -------- | +| package ohos.hdi.battery.v1_0 | 电池信息接口的包路径 | + + +## **详细描述** + +提供获取、订阅电池信息的接口。 + +电池模块为电池服务提供的获取、订阅电池信息的接口。 服务获取此模块的对象或代理后,可以调用相关的接口获取电池信息、订阅电池信息的变化。 + +**Since:** + +3.1 + +**Version:** + +1.0 + + +## **枚举类型说明** + + +### BatteryChargeState + + +``` +enum BatteryChargeState +``` + +**描述:** + +电池的充电状态。 + + | 枚举值 | 描述 | +| -------- | -------- | +| CHARGE_STATE_NONE | 表示电池充电状态未知。 | +| CHARGE_STATE_ENABLE | 表示电池充电状态为使能状态。 | +| CHARGE_STATE_DISABLE | 表示电池充电状态为停止状态。 | +| CHARGE_STATE_FULL | 表示电池充电状态为已充满状态。 | +| CHARGE_STATE_RESERVED | 预留。 | + + +### BatteryHealthState + + +``` +enum BatteryHealthState +``` + +**描述:** + +电池的健康状态。 + + | 枚举值 | 描述 | +| -------- | -------- | +| BATTERY_HEALTH_UNKNOWN | 表示电池健康状态未知。 | +| BATTERY_HEALTH_GOOD | 表示电池健康状态为正常。 | +| BATTERY_HEALTH_OVERHEAT | 表示电池健康状态为过热。 | +| BATTERY_HEALTH_OVERVOLTAGE | 表示电池健康状态为过压。 | +| BATTERY_HEALTH_COLD | 表示电池健康状态为低温。 | +| BATTERY_HEALTH_DEAD | 表示电池健康状态为耗尽。 | +| BATTERY_HEALTH_RESERVED | 预留。 | + + +### BatteryPluggedType + + +``` +enum BatteryPluggedType +``` + +**描述:** + +电池的充电设备类型。 + + | 枚举值 | 描述 | +| -------- | -------- | +| PLUGGED_TYPE_NONE | 表示连接充电器类型未知。 | +| PLUGGED_TYPE_AC | 表示连接的充电器类型为交流充电器。 | +| PLUGGED_TYPE_USB | 表示连接的充电器类型为USB充电器。 | +| PLUGGED_TYPE_WIRELESS | 表示连接的充电器类型为无线充电器。 | +| PLUGGED_TYPE_BUTT | 预留。 | diff --git a/zh-cn/device-dev/reference/hdi-apis/codec__callback__if_8h.md b/zh-cn/device-dev/reference/hdi-apis/codec__callback__if_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..901abda364d0489a74a9b6c5808360a2886eb36b --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/codec__callback__if_8h.md @@ -0,0 +1,41 @@ +# codec_callback_if.h + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [CodecCallbackType](_codec_callback_type.md) | Codec回调接口定义。 [更多...](_codec_callback_type.md) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [CodecCallbackTypeGet](_codec.md#codeccallbacktypeget) (struct HdfRemoteService \*remote) | 实例化CodecCallbackType对象。 [更多...](_codec.md#codeccallbacktypeget) | +| [CodecCallbackTypeRelease](_codec.md#codeccallbacktyperelease) (struct [CodecCallbackType](_codec_callback_type.md) \*instance) | 释放CodecCallbackType对象。 [更多...](_codec.md#codeccallbacktyperelease) | + + +## **详细描述** + +主要包括回调函数接口定义。 + +Codec模块事件上报、上报输入buffer和输出buffer处理完毕等接口定义。 + +**Since:** + +3.1 + +**Version:** + +2.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/codec__common__type_8h.md b/zh-cn/device-dev/reference/hdi-apis/codec__common__type_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..7f573637c2dbff1f5945f81c5dc0bb57550d2999 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/codec__common__type_8h.md @@ -0,0 +1,46 @@ +# codec_common_type.h + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [Alignment](_alignment.md) | 对齐结构定义,包含宽高的对齐值 [更多...](_alignment.md) | +| [Rect](_rect.md) | 矩形的定义 [更多...](_rect.md) | +| [RangeValue](_range_value.md) | 取值范围的定义 [更多...](_range_value.md) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [CodecType](_codec.md#codectype) { VIDEO_DECODER, VIDEO_ENCODER, AUDIO_DECODER, AUDIO_ENCODER,   INVALID_TYPE } | 枚举编解码的类型 [更多...](_codec.md#codectype) | +| [Profile](_codec.md#profile) { INVALID_PROFILE = 0, AAC_LC_PROFILE = 0x1000, AAC_MAIN_PROFILE, AAC_HE_V1_PROFILE,   AAC_HE_V2_PROFILE, AAC_LD_PROFILE, AAC_ELD_PROFILE, AVC_BASELINE_PROFILE = 0x2000,   AVC_MAIN_PROFILE, AVC_HIGH_PROFILE, HEVC_MAIN_PROFILE = 0x3000, HEVC_MAIN_10_PROFILE } | 枚举Codec规格 [更多...](_codec.md#profile) | +| [AudioSampleRate](_codec.md#audiosamplerate) {   AUD_SAMPLE_RATE_8000 = 8000, AUD_SAMPLE_RATE_12000 = 12000, AUD_SAMPLE_RATE_11025 = 11025, AUD_SAMPLE_RATE_16000 = 16000,   AUD_SAMPLE_RATE_22050 = 22050, AUD_SAMPLE_RATE_24000 = 24000, AUD_SAMPLE_RATE_32000 = 32000, AUD_SAMPLE_RATE_44100 = 44100,   AUD_SAMPLE_RATE_48000 = 48000, AUD_SAMPLE_RATE_64000 = 64000, AUD_SAMPLE_RATE_96000 = 96000, AUD_SAMPLE_RATE_INVALID } | 枚举音频采样率 [更多...](_codec.md#audiosamplerate) | +| [CodecCapsMask](_codec.md#codeccapsmask) { CODEC_CAP_ADAPTIVE_PLAYBACK = 0x1, CODEC_CAP_SECURE_PLAYBACK = 0x2, CODEC_CAP_TUNNEL_PLAYBACK = 0x4, CODEC_CAP_MULTI_PLANE = 0x10000 } | 枚举播放能力 [更多...](_codec.md#codeccapsmask) | +| [CodecProcessMode](_codec.md#codecprocessmode) {   PROCESS_BLOCKING_INPUT_BUFFER = 0X1, PROCESS_BLOCKING_OUTPUT_BUFFER = 0X2, PROCESS_BLOCKING_CONTROL_FLOW = 0X4, PROCESS_NONBLOCKING_INPUT_BUFFER = 0X100,   PROCESS_NONBLOCKING_OUTPUT_BUFFER = 0X200, PROCESS_NONBLOCKING_CONTROL_FLOW = 0X400 } | 枚举编解码处理模式 [更多...](_codec.md#codecprocessmode) | + + +## **详细描述** + +Codec模块接口定义中使用的自定义数据类型。 + +Codec模块接口定义中使用的自定义数据类型,包括编解码类型、音视频参数、buffer定义等。 + +**Since:** + +3.1 + +**Version:** + +2.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/codec__component__if_8h.md b/zh-cn/device-dev/reference/hdi-apis/codec__component__if_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..4e4587ac518b6a11993f76ff6f599d9d05f76bd8 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/codec__component__if_8h.md @@ -0,0 +1,41 @@ +# codec_component_if.h + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [CodecComponentType](_codec_component_type.md) | Codec组件接口定义。 [更多...](_codec_component_type.md) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [CodecComponentTypeGet](_codec.md#codeccomponenttypeget) (struct HdfRemoteService \*remote) | 实例化CodecComponentType对象。 [更多...](_codec.md#codeccomponenttypeget) | +| [CodecComponentTypeRelease](_codec.md#codeccomponenttyperelease) (struct [CodecComponentType](_codec_component_type.md) \*instance) | 释放CodecComponentType对象。 [更多...](_codec.md#codeccomponenttyperelease) | + + +## **详细描述** + +主要包括Codec组件接口定义。 + +Codec模块提供了获取组件信息、给组件发送命令、组件参数设置、buffer轮转和控制等接口定义。创建组件后,可使用下列接口进行编解码处理。 + +**Since:** + +3.1 + +**Version:** + +2.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/codec__component__manager_8h.md b/zh-cn/device-dev/reference/hdi-apis/codec__component__manager_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..77ea946aef35c4d7d6254e37baee11b398c7b68f --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/codec__component__manager_8h.md @@ -0,0 +1,41 @@ +# codec_component_manager.h + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [CodecComponentManager](_codec_component_manager.md) | Codec组件管理类接口定义。 [更多...](_codec_component_manager.md) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [GetCodecComponentManager](_codec.md#getcodeccomponentmanager) (void) | 实例化CodecComponentManager对象。 [更多...](_codec.md#getcodeccomponentmanager) | +| [CodecComponentManagerRelease](_codec.md#codeccomponentmanagerrelease) (void) | 释放CodecComponentManager对象。 [更多...](_codec.md#codeccomponentmanagerrelease) | + + +## **详细描述** + +主要包括Codec组件管理类接口。 + +Codec模块获取组件编解码能力集、创建组件和销毁组件等接口定义。 + +**Since:** + +3.1 + +**Version:** + +2.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/codec__component__type_8h.md b/zh-cn/device-dev/reference/hdi-apis/codec__component__type_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..c83e715ec17f67d91ff5dd89e44ffa81c5dbe3a7 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/codec__component__type_8h.md @@ -0,0 +1,68 @@ +# codec_component_type.h + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [VideoPortCap](_video_port_cap.md) | 定义视频编解码能力 [更多...](_video_port_cap.md) | +| [AudioPortCap](_audio_port_cap.md) | 定义音频编解码能力 [更多...](_audio_port_cap.md) | +| [PortCap](union_port_cap.md) | 定义音视频编解码能力 [更多...](union_port_cap.md) | +| [CodecCompCapability](_codec_comp_capability.md) | 定义Codec编解码能力 [更多...](_codec_comp_capability.md) | +| [OmxCodecBuffer](_omx_codec_buffer.md) | Codec buffer信息的定义 [更多...](_omx_codec_buffer.md) | +| [CompVerInfo](_comp_ver_info.md) | 定义组件版本信息 [更多...](_comp_ver_info.md) | +| [EventInfo](_event_info.md) | 定义事件上报信息 [更多...](_event_info.md) | +| [SupportBufferType](_support_buffer_type.md) | SupportBuffer类型定义. [更多...](_support_buffer_type.md) | +| [UseBufferType](_use_buffer_type.md) | UseBuffer类型定义 [更多...](_use_buffer_type.md) | +| [GetBufferHandleUsageParams](_get_buffer_handle_usage_params.md) | BufferHandleUsage类型定义 [更多...](_get_buffer_handle_usage_params.md) | + + +### 宏定义 + + | 宏定义 | 描述 | +| -------- | -------- | +| [SAMPLE_FMT_NUM](_codec.md#ga9bda75c363e9bcff915cdd521dd7ba84)   32 | 采样格式最大值 | +| [UUID_LENGTH](_codec.md#ga9226162b034cc837cd977f0fcf611c2c)   128 | 定义UUID长度 | +| [PIX_FORMAT_NUM](_codec.md#gadb8c6478388b68c09835ebe093a8920a)   16 | 支持的像素格式数组大小 | +| [SAMPLE_FORMAT_NUM](_codec.md#gaf958b9cc535f6260e2e8b7ce42c89946)   12 | 支持的音频采样格式数组大小 | +| [SAMPLE_RATE_NUM](_codec.md#ga0d905eaa05b4b6fcec76924eb795d7fe)   16 | 支持的音频采样率数组大小 | +| [CHANNEL_NUM](_codec.md#ga6511732d5b29a6781cf38783157f21e1)   16 | 支持的音频通道数组大小 | +| [NAME_LENGTH](_codec.md#gaf71324c57f05ff9e24bd384925dd6b17)   32 | 组件名称大小 | +| [PROFILE_NUM](_codec.md#gaab6353cb3662bdc672ae8ab90df529ce)   256 | 支持的profile数组大小 | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [AvCodecRole](_codec.md#avcodecrole) { MEDIA_ROLETYPE_IMAGE_JPEG = 0, MEDIA_ROLETYPE_VIDEO_AVC, MEDIA_ROLETYPE_VIDEO_HEVC, MEDIA_ROLETYPE_AUDIO_FIRST = 0x10000,   MEDIA_ROLETYPE_AUDIO_AAC = 0x10000, MEDIA_ROLETYPE_AUDIO_G711A, MEDIA_ROLETYPE_AUDIO_G711U, MEDIA_ROLETYPE_AUDIO_G726,   MEDIA_ROLETYPE_AUDIO_PCM, MEDIA_ROLETYPE_AUDIO_MP3, MEDIA_ROLETYPE_INVALID } | 枚举音视频编解码组件类型 [更多...](_codec.md#avcodecrole) | +| [AudioSampleFormat](_codec.md#audiosampleformat) { AUDIO_SAMPLE_FORMAT_S8, AUDIO_SAMPLE_FORMAT_S8P, AUDIO_SAMPLE_FORMAT_U8, AUDIO_SAMPLE_FORMAT_U8P,   AUDIO_SAMPLE_FORMAT_S16, AUDIO_SAMPLE_FORMAT_S16P, AUDIO_SAMPLE_FORMAT_U16, AUDIO_SAMPLE_FORMAT_U16P,   AUDIO_SAMPLE_FORMAT_S24, AUDIO_SAMPLE_FORMAT_S24P, AUDIO_SAMPLE_FORMAT_U24, AUDIO_SAMPLE_FORMAT_U24P,   AUDIO_SAMPLE_FORMAT_S32, AUDIO_SAMPLE_FORMAT_S32P, AUDIO_SAMPLE_FORMAT_U32, AUDIO_SAMPLE_FORMAT_U32P,   AUDIO_SAMPLE_FORMAT_S64, AUDIO_SAMPLE_FORMAT_S64P, AUDIO_SAMPLE_FORMAT_U64, AUDIO_SAMPLE_FORMAT_U64P,   AUDIO_SAMPLE_FORMAT_F32, AUDIO_SAMPLE_FORMAT_F32P, AUDIO_SAMPLE_FORMAT_F64, AUDIO_SAMPLE_FORMAT_F64P,   AUDIO_SAMPLE_FMT_U8, AUDIO_SAMPLE_FMT_S16, AUDIO_SAMPLE_FMT_S32, AUDIO_SAMPLE_FMT_FLOAT,   AUDIO_SAMPLE_FMT_DOUBLE, AUDIO_SAMPLE_FMT_U8P, AUDIO_SAMPLE_FMT_S16P, AUDIO_SAMPLE_FMT_S32P,   AUDIO_SAMPLE_FMT_FLOATP, AUDIO_SAMPLE_FMT_DOUBLEP, AUDIO_SAMPLE_FMT_INVALID } | 枚举音频采样格式 [更多...](_codec.md#audiosampleformat) | +| [CodecBufferType](_codec.md#codecbuffertype) { CODEC_BUFFER_TYPE_INVALID = 0, CODEC_BUFFER_TYPE_VIRTUAL_ADDR = 0x1, CODEC_BUFFER_TYPE_AVSHARE_MEM_FD = 0x2, CODEC_BUFFER_TYPE_HANDLE = 0x4,   CODEC_BUFFER_TYPE_DYNAMIC_HANDLE = 0x8 } | 定义buffer类型 [更多...](_codec.md#codecbuffertype) | +| [ShareMemTypes](_codec.md#sharememtypes) { READ_WRITE_TYPE = 0x1, READ_ONLY_TYPE = 0x2 } | 枚举共享内存类型 [更多...](_codec.md#sharememtypes) | +| [OmxIndexCodecExType](_codec.md#omxindexcodecextype) { OMX_IndexExtBufferTypeStartUnused = OMX_IndexKhronosExtensions + 0x00a00000, OMX_IndexParamSupportBufferType, OMX_IndexParamUseBufferType, OMX_IndexParamGetBufferHandleUsage } | 枚举Codec扩展index [更多...](_codec.md#omxindexcodecextype) | +| [OmxVideoExType](_codec.md#omxvideoextype) { OMX_VIDEO_CodingHEVC = 11 } | 枚举Codec扩展编码类型 [更多...](_codec.md#omxvideoextype) | + + +## **详细描述** + +Codec模块接口定义中使用的自定义数据类型。 + +Codec模块接口定义中使用的自定义数据类型,包括编解码类型、音视频参数、buffer定义等。 + +**Since:** + +3.1 + +**Version:** + +2.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/display__device_8h.md b/zh-cn/device-dev/reference/hdi-apis/display__device_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..7d8bb2f45071341bc1b4ab3536019f659b723353 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/display__device_8h.md @@ -0,0 +1,48 @@ +# display_device.h + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [DeviceFuncs](_device_funcs.md) | 显示设备控制接口结构体,定义显示设备控制接口函数指针。 [更多...](_device_funcs.md) | + + +### 类型定义 + + | 类型定义 | 描述 | +| -------- | -------- | +| ([HotPlugCallback](_display.md#hotplugcallback)) (uint32_t devId, bool connected, void \*data) | 热插拔事件回调。[更多...](_display.md#hotplugcallback) | +| ([VBlankCallback](_display.md#vblankcallback)) (unsigned int sequence, uint64_t ns, void \*data) | VBlank 事件回调。 [更多...](_display.md#vblankcallback) | +| ([RefreshCallback](_display.md#refreshcallback)) (uint32_t devId, void \*data) | 刷新请求回调。[更多...](_display.md#refreshcallback) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [DeviceInitialize](_display.md#deviceinitialize) ([DeviceFuncs](_device_funcs.md) \*\*funcs) | 实现显示设备控制接口的初始化,申请操作显示设备控制接口的资源,并获取对应的操作接口。 [更多...](_display.md#deviceinitialize) | +| [DeviceUninitialize](_display.md#deviceuninitialize) ([DeviceFuncs](_device_funcs.md) \*funcs) | 取消显示设备控制接口的初始化,释放控制接口使用到的资源。 [更多...](_display.md#deviceuninitialize) | + + +## **详细描述** + +显示设备控制接口声明。 + +**Since:** + +1.0 + +**Version:** + +2.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/display__gfx_8h.md b/zh-cn/device-dev/reference/hdi-apis/display__gfx_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..10cc061b8db3075f786370c338472ba45f72102c --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/display__gfx_8h.md @@ -0,0 +1,39 @@ +# display_gfx.h + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [GfxFuncs](_gfx_funcs.md) | 显示硬件加速驱动接口结构体,定义硬件加速驱动接口函数指针。 [更多...](_gfx_funcs.md) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [GfxInitialize](_display.md#gfxinitialize) ([GfxFuncs](_gfx_funcs.md) \*\*funcs) | 获取硬件加速相关的操作接口指针。 [更多...](_display.md#gfxinitialize) | +| [GfxUninitialize](_display.md#gfxuninitialize) ([GfxFuncs](_gfx_funcs.md) \*funcs) | 释放硬件加速相关的操作接口指针。 [更多...](_display.md#gfxuninitialize) | + + +## **详细描述** + +显示硬件加速驱动接口声明。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/display__gralloc_8h.md b/zh-cn/device-dev/reference/hdi-apis/display__gralloc_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..e75c7d78987dd301d0011d5afe4990a67e05db5d --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/display__gralloc_8h.md @@ -0,0 +1,39 @@ +# display_gralloc.h + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [GrallocFuncs](_gralloc_funcs.md) | 显示内存驱动接口结构体,定义显示内存驱动接口函数指针。 [更多...](_gralloc_funcs.md) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [GrallocInitialize](_display.md#grallocinitialize) ([GrallocFuncs](_gralloc_funcs.md) \*\*funcs) | 初始化内存模块,并获取内存提供的操作接口。 [更多...](_display.md#grallocinitialize) | +| [GrallocUninitialize](_display.md#grallocuninitialize) ([GrallocFuncs](_gralloc_funcs.md) \*funcs) | 取消初始化内存模块,并释放内存操作接口指针。 [更多...](_display.md#grallocuninitialize) | + + +## **详细描述** + +显示内存驱动接口声明。 + +**Since:** + +1.0 + +**Version:** + +2.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/display__layer_8h.md b/zh-cn/device-dev/reference/hdi-apis/display__layer_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..6075edc6e52f07cd9762c2b0211ed9730a9df171 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/display__layer_8h.md @@ -0,0 +1,39 @@ +# display_layer.h + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [LayerFuncs](_layer_funcs.md) | 显示图层驱动接口结构体,定义显示图层驱动接口函数指针。 [更多...](_layer_funcs.md) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [LayerInitialize](_display.md#layerinitialize) ([LayerFuncs](_layer_funcs.md) \*\*funcs) | 实现图层初始化功能,申请图层使用的资源,并获取图层提供的操作接口。 [更多...](_display.md#layerinitialize) | +| [LayerUninitialize](_display.md#layeruninitialize) ([LayerFuncs](_layer_funcs.md) \*funcs) | 取消图层初始化功能,释放图层使用到的资源,并释放图层操作接口指针。 [更多...](_display.md#layeruninitialize) | + + +## **详细描述** + +显示图层驱动接口声明。 + +**Since:** + +1.0 + +**Version:** + +2.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/display__type_8h.md b/zh-cn/device-dev/reference/hdi-apis/display__type_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..8329743362d776e90bd97422eff59690223f2024 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/display__type_8h.md @@ -0,0 +1,82 @@ +# display_type.h + + +## **概述** + +**所属模块:** + +[Display](_display.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [DisplayInfo](_display_info.md) | 定义显示信息结构体 [更多...](_display_info.md) | +| [LayerInfo](_layer_info.md) | 定义图层信息结构体 [更多...](_layer_info.md) | +| [LayerAlpha](_layer_alpha.md) | 定义图层Alpha信息的结构体 [更多...](_layer_alpha.md) | +| [BufferData](_buffer_data.md) | 定义一层的缓冲区数据,包括虚拟和物理内存地址。 [更多...](_buffer_data.md) | +| [LayerBuffer](_layer_buffer.md) | 图层Buffer,用于存放图层数据。 [更多...](_layer_buffer.md) | +| [IRect](_i_rect.md) | 定义矩形信息 [更多...](_i_rect.md) | +| [ISurface](_i_surface.md) | 用于存放窗口相关信息的结构体定义,提供给硬件加速使用,例如图像合成,位图搬移等操作。 [更多...](_i_surface.md) | +| [ILine](_i_line.md) | 线条描述结构体定义,用于硬件加速绘制直线。 [更多...](_i_line.md) | +| [ICircle](_i_circle.md) | 圆形描述结构体定义,用于硬件加速绘制圆形。 [更多...](_i_circle.md) | +| [Rectangle](_rectangle.md) | 矩形描述结构体定义,用于硬件加速绘制矩形, [更多...](_rectangle.md) | +| [GfxOpt](_gfx_opt.md) | 图像硬件加速相关的操作选项结构体定义,用于图像硬件加速时的操作选项。 [更多...](_gfx_opt.md) | +| [PropertyObject](_property_object.md) | 定义包含名称、属性ID和值的属性对象。 [更多...](_property_object.md) | +| [DisplayCapability](_display_capability.md) | 定义输出性能。 [更多...](_display_capability.md) | +| [DisplayModeInfo](_display_mode_info.md) | 定义输出模式信息。 [更多...](_display_mode_info.md) | +| [AllocInfo](_alloc_info.md) | 定义关于要分配的内存的信息。 [更多...](_alloc_info.md) | +| [HDRCapability](_h_d_r_capability.md) | HDR属性结构体定义 [更多...](_h_d_r_capability.md) | +| [HDRMetaData](_h_d_r_meta_data.md) | HDR元数据结构体定义 [更多...](_h_d_r_meta_data.md) | +| [VerifyAllocInfo](_verify_alloc_info.md) | 用于验证内存分配信息的结构体定义 [更多...](_verify_alloc_info.md) | +| [PresentTimestamp](_present_timestamp.md) | 上屏时间戳结构体定义 [更多...](_present_timestamp.md) | +| [__attribute__](____attribute____.md) | 扩展数据句柄结构体定义 [更多...](____attribute____.md) | + + +### 宏定义 + + | 宏定义 | 描述 | +| -------- | -------- | +| **PROPERTY_NAME_LEN**   50 | 属性名称长度 | + + +### 枚举 + + | 枚举 | 枚举 | 描述 | +| -------- | -------- | -------- | +| [DispErrCode](_display.md#disperrcode) { DISPLAY_SUCCESS = 0, DISPLAY_FAILURE = -1, DISPLAY_FD_ERR = -2, DISPLAY_PARAM_ERR = -3,   DISPLAY_NULL_PTR = -4, DISPLAY_NOT_SUPPORT = -5, DISPLAY_NOMEM = -6, DISPLAY_SYS_BUSY = -7,   DISPLAY_NOT_PERM = -8 } | [DispErrCode](_display.md#disperrcode) {   [DISPLAY_SUCCESS](_display.md#gga12a925dadef7573cd74d63d06824f9b0a188daac95e787159d50ff9546536035b) = 0, [DISPLAY_FAILURE](_display.md#gga12a925dadef7573cd74d63d06824f9b0afdffc20c71fb142c3e7f01323a31d742) = -1, [DISPLAY_FD_ERR](_display.md#gga12a925dadef7573cd74d63d06824f9b0a5bdb0a826a652f51e6c82685ae08ede8) = -2, [DISPLAY_PARAM_ERR](_display.md#gga12a925dadef7573cd74d63d06824f9b0a330e09be303bc7056f6115830bbd2370) = -3,   [DISPLAY_NULL_PTR](_display.md#gga12a925dadef7573cd74d63d06824f9b0a82fbcdba6c699059bc04b491c92424ac) = -4, [DISPLAY_NOT_SUPPORT](_display.md#gga12a925dadef7573cd74d63d06824f9b0a950a7bc41e893450315da9e73208f8c2) = -5, [DISPLAY_NOMEM](_display.md#gga12a925dadef7573cd74d63d06824f9b0af186ab511133fa3280c54d2c44358882) = -6, [DISPLAY_SYS_BUSY](_display.md#gga12a925dadef7573cd74d63d06824f9b0ac11b678fc04745ff4d91f4398b83c427) = -7,   [DISPLAY_NOT_PERM](_display.md#gga12a925dadef7573cd74d63d06824f9b0ad133674b9f3b857a12791479aaf58cf8) = -8 } | 返回值类型定义。 [更多...](_display.md#disperrcode) | +| [LayerType](_display.md#layertype) { LAYER_TYPE_GRAPHIC, LAYER_TYPE_OVERLAY, LAYER_TYPE_SDIEBAND, LAYER_TYPE_CURSOR,   LAYER_TYPE_BUTT } | [LayerType](_display.md#layertype) {   [LAYER_TYPE_GRAPHIC](_display.md#gga56943a0946e5f15e5e58054b8e7a04a4a6ef157ea82a5d4c1715b3cddcca38d6f), [LAYER_TYPE_OVERLAY](_display.md#gga56943a0946e5f15e5e58054b8e7a04a4ac33e449941bc0e4d039b4b5bed853a78), [LAYER_TYPE_SDIEBAND](_display.md#gga56943a0946e5f15e5e58054b8e7a04a4a0aef2c460a206fa00c742219d65be477), [LAYER_TYPE_CURSOR](_display.md#gga56943a0946e5f15e5e58054b8e7a04a4a44b3a657e6bf4f1f5709c03a94a11019),   [LAYER_TYPE_BUTT](_display.md#gga56943a0946e5f15e5e58054b8e7a04a4acd813c5ad9a2be97c85a97d4bdf1cb57) } | 图层类型定义。 [更多...](_display.md#layertype) | +| { HBM_USE_CPU_READ = (1 << 0), HBM_USE_CPU_WRITE = (1 << 1), HBM_USE_MEM_MMZ = (1 << 2), HBM_USE_MEM_DMA = (1 << 3),   HBM_USE_MEM_SHARE = (1 << 4), HBM_USE_MEM_MMZ_CACHE = (1 << 5), HBM_USE_MEM_FB = (1 << 6), HBM_USE_ASSIGN_SIZE = (1 << 7) } | {[HBM_USE_CPU_READ](_display.md#ggadf764cbdea00d65edcd07bb9953ad2b7a9bb139ab93fcaceac48e52bac1be53dc) = (1 << 0), [HBM_USE_CPU_WRITE](_display.md#ggadf764cbdea00d65edcd07bb9953ad2b7a29217cbafbb6666fe1e8d96f3c368a4d) = (1 << 1), [HBM_USE_MEM_MMZ](_display.md#ggadf764cbdea00d65edcd07bb9953ad2b7a9126b10e53b48304a5d9c351b1ace6d4) = (1 << 2), [HBM_USE_MEM_DMA](_display.md#ggadf764cbdea00d65edcd07bb9953ad2b7af7d33fd75c60375bef211629ff02d8c4) = (1 << 3),   [HBM_USE_MEM_SHARE](_display.md#ggadf764cbdea00d65edcd07bb9953ad2b7a16042b501b66017d663c3f5bcd24a20f) = (1 << 4), [HBM_USE_MEM_MMZ_CACHE](_display.md#ggadf764cbdea00d65edcd07bb9953ad2b7a553664654199ebde6733a830cbe0a369) = (1 << 5), [HBM_USE_MEM_FB](_display.md#ggadf764cbdea00d65edcd07bb9953ad2b7a110b955655861ef11167e907be5f18fc) = (1 << 6), [HBM_USE_ASSIGN_SIZE](_display.md#ggadf764cbdea00d65edcd07bb9953ad2b7a44d0fd6e88dbbe9e78c44cc8e5bddc22) = (1 << 7) } | 缓冲区定义。[更多...](_display.md#anonymous-enum) | +| [PixelFormat](_display.md#pixelformat) { PIXEL_FMT_CLUT8 = 0, PIXEL_FMT_CLUT1, PIXEL_FMT_CLUT4, PIXEL_FMT_RGB_565,   PIXEL_FMT_RGBA_5658, PIXEL_FMT_RGBX_4444, PIXEL_FMT_RGBA_4444, PIXEL_FMT_RGB_444,   PIXEL_FMT_RGBX_5551, PIXEL_FMT_RGBA_5551, PIXEL_FMT_RGB_555, PIXEL_FMT_RGBX_8888,   PIXEL_FMT_RGBA_8888, PIXEL_FMT_RGB_888, PIXEL_FMT_BGR_565, PIXEL_FMT_BGRX_4444,   PIXEL_FMT_BGRA_4444, PIXEL_FMT_BGRX_5551, PIXEL_FMT_BGRA_5551, PIXEL_FMT_BGRX_8888,   PIXEL_FMT_BGRA_8888, PIXEL_FMT_YUV_422_I, PIXEL_FMT_YCBCR_422_SP, PIXEL_FMT_YCRCB_422_SP,   PIXEL_FMT_YCBCR_420_SP, PIXEL_FMT_YCRCB_420_SP, PIXEL_FMT_YCBCR_422_P, PIXEL_FMT_YCRCB_422_P,   PIXEL_FMT_YCBCR_420_P, PIXEL_FMT_YCRCB_420_P, PIXEL_FMT_YUYV_422_PKG, PIXEL_FMT_UYVY_422_PKG,   PIXEL_FMT_YVYU_422_PKG, PIXEL_FMT_VYUY_422_PKG, PIXEL_FMT_VENDER_MASK = 0X7FFF0000, PIXEL_FMT_BUTT = 0X7FFFFFFF } | [PixelFormat](_display.md#pixelformat) {   [PIXEL_FMT_CLUT8](_display.md#gga60883d4958a60b91661e97027a85072aabdea255b6e5f2920977f11d21445b34a) = 0, [PIXEL_FMT_CLUT1](_display.md#gga60883d4958a60b91661e97027a85072aa5740c66a546552c0c5a4bc06850af584), [PIXEL_FMT_CLUT4](_display.md#gga60883d4958a60b91661e97027a85072aabde13e8f357e39981973929309bb0e0e), [PIXEL_FMT_RGB_565](_display.md#gga60883d4958a60b91661e97027a85072aa5fae320872be3ffdda0d371cec048ec6),   [PIXEL_FMT_RGBA_5658](_display.md#gga60883d4958a60b91661e97027a85072aa4c16147153b63d7ba71b257111afdd62), [PIXEL_FMT_RGBX_4444](_display.md#gga60883d4958a60b91661e97027a85072aaa479ac0d983fde9b4f7f0e1a3b3e230f), [PIXEL_FMT_RGBA_4444](_display.md#gga60883d4958a60b91661e97027a85072aacbb91256e8c45a51410a9f6caae2d04c), [PIXEL_FMT_RGB_444](_display.md#gga60883d4958a60b91661e97027a85072aa7d18a83da06902c104208031ed487942),   [PIXEL_FMT_RGBX_5551](_display.md#gga60883d4958a60b91661e97027a85072aa85e5dd1a0e547c0031baffd02abb31a0), [PIXEL_FMT_RGBA_5551](_display.md#gga60883d4958a60b91661e97027a85072aadc1387526a271d8c6db7729de06474b1), [PIXEL_FMT_RGB_555](_display.md#gga60883d4958a60b91661e97027a85072aa720a429fa57133f6e27ef8c8fa1c404a), [PIXEL_FMT_RGBX_8888](_display.md#gga60883d4958a60b91661e97027a85072aa24a7181b7fb4019e7c19739bd9b65ff0),   [PIXEL_FMT_RGBA_8888](_display.md#gga60883d4958a60b91661e97027a85072aa90b462672221691ed66cacb07dd2e05f), [PIXEL_FMT_RGB_888](_display.md#gga60883d4958a60b91661e97027a85072aa7ff77397bf2cf52b4614a46264f8ce01), [PIXEL_FMT_BGR_565](_display.md#gga60883d4958a60b91661e97027a85072aaec581b908c291e2bd0155e25169f9629), [PIXEL_FMT_BGRX_4444](_display.md#gga60883d4958a60b91661e97027a85072aa6b5a7b35e00fc25146de0c9bf88b0230),   [PIXEL_FMT_BGRA_4444](_display.md#gga60883d4958a60b91661e97027a85072aa2f3d4ada099b2e8d84ec4501fbc8bed9), [PIXEL_FMT_BGRX_5551](_display.md#gga60883d4958a60b91661e97027a85072aaaf1a20dc0a597258cfe6aca806a8e0de), [PIXEL_FMT_BGRA_5551](_display.md#gga60883d4958a60b91661e97027a85072aa2319d4a75dae0b56776fa63d525e308b), [PIXEL_FMT_BGRX_8888](_display.md#gga60883d4958a60b91661e97027a85072aa1b19279f89c8cfb60e7d77ce23cd5f43),   [PIXEL_FMT_BGRA_8888](_display.md#gga60883d4958a60b91661e97027a85072aaeb31c670120a1fbc96a0e0887997fe16), [PIXEL_FMT_YUV_422_I](_display.md#gga60883d4958a60b91661e97027a85072aac73c2a84907a53ed95a329007b5c8992), [PIXEL_FMT_YCBCR_422_SP](_display.md#gga60883d4958a60b91661e97027a85072aabdf1224848278508479ce97f637dd711), [PIXEL_FMT_YCRCB_422_SP](_display.md#gga60883d4958a60b91661e97027a85072aa8bf97d66e26b3aad7c83dfa70e2bc451),   [PIXEL_FMT_YCBCR_420_SP](_display.md#gga60883d4958a60b91661e97027a85072aa0d1db50eb492f9073abdd2d662c56396), [PIXEL_FMT_YCRCB_420_SP](_display.md#gga60883d4958a60b91661e97027a85072aa1fa43c8a197d5c974a35b8bf02ab386e), [PIXEL_FMT_YCBCR_422_P](_display.md#gga60883d4958a60b91661e97027a85072aaa2fe085e63428ea76e1d975175001dc6), [PIXEL_FMT_YCRCB_422_P](_display.md#gga60883d4958a60b91661e97027a85072aab04eb6e1d940e42f3b4cc20c0a44c4ee),   [PIXEL_FMT_YCBCR_420_P](_display.md#gga60883d4958a60b91661e97027a85072aa3d80e785bed28e2b3f5c7df563500962), [PIXEL_FMT_YCRCB_420_P](_display.md#gga60883d4958a60b91661e97027a85072aa3dc5a0a5ad2f21218b446c477277210a), [PIXEL_FMT_YUYV_422_PKG](_display.md#gga60883d4958a60b91661e97027a85072aa3980def5b133584bdb2982a71f07798e), [PIXEL_FMT_UYVY_422_PKG](_display.md#gga60883d4958a60b91661e97027a85072aadfd69bd5b421aad5bdd39d5f33317197),   [PIXEL_FMT_YVYU_422_PKG](_display.md#gga60883d4958a60b91661e97027a85072aaf851031c336e8d9f57c940c5f52381f4), [PIXEL_FMT_VYUY_422_PKG](_display.md#gga60883d4958a60b91661e97027a85072aa317a761939335025379d382074a1541c), [PIXEL_FMT_VENDER_MASK](_display.md#gga60883d4958a60b91661e97027a85072aa67668ea067a31a8479aece94094bc547) = 0X7FFF0000, [PIXEL_FMT_BUTT](_display.md#gga60883d4958a60b91661e97027a85072aa07086bb3356c9c88959eee00c0982684) = 0X7FFFFFFF } | 像素格式类型定义。 [更多...](_display.md#pixelformat) | +| [TransformType](_display.md#transformtype) { ROTATE_NONE = 0, ROTATE_90, ROTATE_180, ROTATE_270,   ROTATE_BUTT } | [TransformType](_display.md#transformtype) {   [ROTATE_NONE](_display.md#ggaa65f3b21a9a92ff022e435a7304126d2a68e349e9d45a8eba440e2a7a3ba31ec9) = 0, [ROTATE_90](_display.md#ggaa65f3b21a9a92ff022e435a7304126d2a685062467b0c1a3164556335b467c886), [ROTATE_180](_display.md#ggaa65f3b21a9a92ff022e435a7304126d2a186263164422bb8f0eb5f7b7d195a3d1), [ROTATE_270](_display.md#ggaa65f3b21a9a92ff022e435a7304126d2a554e734d2a23790b248c5ce39816c18f),   [ROTATE_BUTT](_display.md#ggaa65f3b21a9a92ff022e435a7304126d2a9b6ff871536aeef2a8e3ce4a753988ed) } | 图层变换类型定义。 [更多...](_display.md#transformtype) | +| [BlendType](_display.md#blendtype) { BLEND_NONE = 0, BLEND_CLEAR, BLEND_SRC, BLEND_SRCOVER,   BLEND_DSTOVER, BLEND_SRCIN, BLEND_DSTIN, BLEND_SRCOUT,   BLEND_DSTOUT, BLEND_SRCATOP, BLEND_DSTATOP, BLEND_ADD,   BLEND_XOR, BLEND_DST, BLEND_AKS, BLEND_AKD,   BLEND_BUTT } | [BlendType](_display.md#blendtype) {   [BLEND_NONE](_display.md#ggaab1839ed4aab1030dfda801a51e68817ae410edb34509ca21425fe5872bbc7e2f) = 0, [BLEND_CLEAR](_display.md#ggaab1839ed4aab1030dfda801a51e68817a6330cee419fbdafc0b25f0aa068814e5), [BLEND_SRC](_display.md#ggaab1839ed4aab1030dfda801a51e68817af01da0c255cdbf67d0774a67c2d221b5), [BLEND_SRCOVER](_display.md#ggaab1839ed4aab1030dfda801a51e68817ad4c0cd02aa4b5f4849e2b29a26481dde),   [BLEND_DSTOVER](_display.md#ggaab1839ed4aab1030dfda801a51e68817a21f03e8d04a58ed0684b39eb84bdb89f), [BLEND_SRCIN](_display.md#ggaab1839ed4aab1030dfda801a51e68817a74e681f6c9027bb2cf0bda3b72d2dd9e), [BLEND_DSTIN](_display.md#ggaab1839ed4aab1030dfda801a51e68817a19f528828d75c34e18375219f113d9bb), [BLEND_SRCOUT](_display.md#ggaab1839ed4aab1030dfda801a51e68817a404e05a118462520e878c23f89808199),   [BLEND_DSTOUT](_display.md#ggaab1839ed4aab1030dfda801a51e68817ac0dc902b4928413d367376e4c842d909), [BLEND_SRCATOP](_display.md#ggaab1839ed4aab1030dfda801a51e68817ada473c7e3bf2b1102349489416aefefc), [BLEND_DSTATOP](_display.md#ggaab1839ed4aab1030dfda801a51e68817a0129b4506a06b1a6df297bcf685f5f89), [BLEND_ADD](_display.md#ggaab1839ed4aab1030dfda801a51e68817adbdb329830e5b4d9fa2b17d5d6d7894f),   [BLEND_XOR](_display.md#ggaab1839ed4aab1030dfda801a51e68817a167c3b256e051244066d8e53cdd5529d), [BLEND_DST](_display.md#ggaab1839ed4aab1030dfda801a51e68817a4686a5f30c73982d625a05db021e9b15), [BLEND_AKS](_display.md#ggaab1839ed4aab1030dfda801a51e68817ae549aa3794365df8965a2c3853c8da99), [BLEND_AKD](_display.md#ggaab1839ed4aab1030dfda801a51e68817a3cc39f12fa8bceba626a33c2d82a8bf7),   [BLEND_BUTT](_display.md#ggaab1839ed4aab1030dfda801a51e68817ad0650812ac2aa9eee228f48ac514b44a) } | 显示内存类型定义。 [更多...](_display.md#blendtype) | +| [RopType](_display.md#roptype) { ROP_BLACK = 0, ROP_NOTMERGEPEN, ROP_MASKNOTPEN, ROP_NOTCOPYPEN,   ROP_MASKPENNOT, ROP_NOT, ROP_XORPEN, ROP_NOTMASKPEN,   ROP_MASKPEN, ROP_NOTXORPEN, ROP_NOP, ROP_MERGENOTPEN,   ROP_COPYPE, ROP_MERGEPENNOT, ROP_MERGEPEN, ROP_WHITE,   ROP_BUTT } | [RopType](_display.md#roptype) {   [ROP_BLACK](_display.md#gga24265f7618fbdba53d3da4806d3097c4a6358a786ec3b81000a07b343424cee0d) = 0, [ROP_NOTMERGEPEN](_display.md#gga24265f7618fbdba53d3da4806d3097c4a96c89f7b89a9048d355b4dc467224f4c), [ROP_MASKNOTPEN](_display.md#gga24265f7618fbdba53d3da4806d3097c4a54d054ea6920cb88f374f70e8d41f934), [ROP_NOTCOPYPEN](_display.md#gga24265f7618fbdba53d3da4806d3097c4af4a5d5dc0f15249001cff7ef32fadef1),   [ROP_MASKPENNOT](_display.md#gga24265f7618fbdba53d3da4806d3097c4ad777eea18ba9f4e071b00aa060db00e3), [ROP_NOT](_display.md#gga24265f7618fbdba53d3da4806d3097c4afa63c8e2a6a39d50954cb6316576b4e9), [ROP_XORPEN](_display.md#gga24265f7618fbdba53d3da4806d3097c4a79433776e85bb80ad0306ced0b82947c), [ROP_NOTMASKPEN](_display.md#gga24265f7618fbdba53d3da4806d3097c4ad6c4d2458a9caaa079a3e5907d636e8a),   [ROP_MASKPEN](_display.md#gga24265f7618fbdba53d3da4806d3097c4a2a069e2105c5b8d4dac5d174c76eb9d4), [ROP_NOTXORPEN](_display.md#gga24265f7618fbdba53d3da4806d3097c4a33c37c5ce718e876f43141dc5a028375), [ROP_NOP](_display.md#gga24265f7618fbdba53d3da4806d3097c4a2acacab882af44bba09878bd58e18695), [ROP_MERGENOTPEN](_display.md#gga24265f7618fbdba53d3da4806d3097c4afaea3c47612082914332b78ca8c331b3),   [ROP_COPYPE](_display.md#gga24265f7618fbdba53d3da4806d3097c4a91bae697f9dea25ac4d7be011958a45d), [ROP_MERGEPENNOT](_display.md#gga24265f7618fbdba53d3da4806d3097c4a3580b77320e4829da046b8739c61d6b8), [ROP_MERGEPEN](_display.md#gga24265f7618fbdba53d3da4806d3097c4a8195ac0d37e0d69b2cd71dd7362d3fd3), [ROP_WHITE](_display.md#gga24265f7618fbdba53d3da4806d3097c4a533a614b27da8a81b67ada085b018618),   [ROP_BUTT](_display.md#gga24265f7618fbdba53d3da4806d3097c4aa858b07e214a7f62625e24776806c74b) } | 硬件加速支持的ROP操作类型。 [更多...](_display.md#roptype) | +| [ColorKey](_display.md#colorkey) { CKEY_NONE = 0, CKEY_SRC, CKEY_DST, CKEY_BUTT } | [ColorKey](_display.md#colorkey) { [CKEY_NONE](_display.md#gga4fe6fb05c7ba0048b1739d88f4d4878ea629b31de258db2ce01cb757b85bd5273) = 0, [CKEY_SRC](_display.md#gga4fe6fb05c7ba0048b1739d88f4d4878ea5e3271e73dce39d0806ff8e9cba011bc), [CKEY_DST](_display.md#gga4fe6fb05c7ba0048b1739d88f4d4878ea6921c2c202aa69293467baa6c33fae05), [CKEY_BUTT](_display.md#gga4fe6fb05c7ba0048b1739d88f4d4878ea32cedc8986de2c290bf2ec193d88cabf) } | Color key操作类型定义,即硬件加速支持的Color key操作类型。 [更多...](_display.md#colorkey) | +| [MirrorType](_display.md#mirrortype) { MIRROR_NONE = 0, MIRROR_LR, MIRROR_TB, MIRROR_BUTT } | [MirrorType](_display.md#mirrortype) { [MIRROR_NONE](_display.md#gga08d32376574b541d162d8534adb78fd0a5ad82fcc8af04f92571e185b61eeb309) = 0, [MIRROR_LR](_display.md#gga08d32376574b541d162d8534adb78fd0ae35099d9fd28c2974661bcce36a9ea5c), [MIRROR_TB](_display.md#gga08d32376574b541d162d8534adb78fd0afd82e59546a645fd29bc779c50bfa733), [MIRROR_BUTT](_display.md#gga08d32376574b541d162d8534adb78fd0ad9e357a2c2f7dc0e3ca5a351ec457410) } | 硬件加速支持的镜像操作类型定义 [更多...](_display.md#mirrortype) | +| [Connection](_display.md#connection) { CON_INVALID = 0, CONNECTED, DISCONNECTED } | [Connection](_display.md#connection) { [CON_INVALID](_display.md#ggab0845c0c8d309ee865c78b095b00e671ab5c8a92e6af2e63e769dd8f711564760) = 0, [CONNECTED](_display.md#ggab0845c0c8d309ee865c78b095b00e671a7a691a2430ec26878897b5fbc9c22a4c), [DISCONNECTED](_display.md#ggab0845c0c8d309ee865c78b095b00e671acdaad1112073e3e2ea032424c38c34e1) } | 热插拔连接类型定义 [更多...](_display.md#connection) | +| [InterfaceType](_display.md#interfacetype) { DISP_INTF_HDMI = 0, DISP_INTF_LCD, DISP_INTF_BT1120, DISP_INTF_BT656,   DISP_INTF_YPBPR, DISP_INTF_RGB, DISP_INTF_CVBS, DISP_INTF_SVIDEO,   DISP_INTF_VGA, DISP_INTF_MIPI, DISP_INTF_PANEL, DISP_INTF_BUTT } | [InterfaceType](_display.md#interfacetype) {   [DISP_INTF_HDMI](_display.md#ggaf1ef2c97e255bd7f21d3b7614b283d9da717f9ae7960ba280c6c6b8822c6d8b66) = 0, [DISP_INTF_LCD](_display.md#ggaf1ef2c97e255bd7f21d3b7614b283d9da210dbbea7e5c30b693515bba570474d4), [DISP_INTF_BT1120](_display.md#ggaf1ef2c97e255bd7f21d3b7614b283d9da89a4e456ceffa55cb93b2c6f4792c96b), [DISP_INTF_BT656](_display.md#ggaf1ef2c97e255bd7f21d3b7614b283d9daf23a0b7607d3fdc7eac791d62c5f9cd5),   [DISP_INTF_YPBPR](_display.md#ggaf1ef2c97e255bd7f21d3b7614b283d9da54a83297ab61376574854e804a6158e1), [DISP_INTF_RGB](_display.md#ggaf1ef2c97e255bd7f21d3b7614b283d9da83ef625db890ee1ddb4e874d6155405f), [DISP_INTF_CVBS](_display.md#ggaf1ef2c97e255bd7f21d3b7614b283d9dabf3991ede75cb3bb454372174d63ec29), [DISP_INTF_SVIDEO](_display.md#ggaf1ef2c97e255bd7f21d3b7614b283d9daad740e6f901f40965d2824415fcb9041),   [DISP_INTF_VGA](_display.md#ggaf1ef2c97e255bd7f21d3b7614b283d9da5db1f365e675d992f47ce797339beff5), [DISP_INTF_MIPI](_display.md#ggaf1ef2c97e255bd7f21d3b7614b283d9da5b9c7382dfdcc029e467c6339bf90915), [DISP_INTF_PANEL](_display.md#ggaf1ef2c97e255bd7f21d3b7614b283d9da4d64c32b687840c7e08e28a2892ac222), [DISP_INTF_BUTT](_display.md#p106611424171011) } | 枚举接口类型。 [更多...](_display.md#interfacetype) | +| [DispPowerStatus](_display.md#disppowerstatus) { POWER_STATUS_ON, POWER_STATUS_STANDBY, POWER_STATUS_SUSPEND, POWER_STATUS_OFF,   POWER_STATUS_BUTT } | [DispPowerStatus](_display.md#disppowerstatus) {   [POWER_STATUS_ON](_display.md#gga0f3c8af6e9d40730b0d2e0fbbf8e627da89e258c21283c662af2145bd3f9fc9a0), [POWER_STATUS_STANDBY](_display.md#gga0f3c8af6e9d40730b0d2e0fbbf8e627da604748a7de21aa992c1f72c252fc77a7), [POWER_STATUS_SUSPEND](_display.md#gga0f3c8af6e9d40730b0d2e0fbbf8e627da5605db047fd50c64fa0a13d8e558d479), [POWER_STATUS_OFF](_display.md#gga0f3c8af6e9d40730b0d2e0fbbf8e627daddd660122faa920f2adcd81e83d22c85),   [POWER_STATUS_BUTT](_display.md#gga0f3c8af6e9d40730b0d2e0fbbf8e627dad1f590a00c02d7335bfc24edbea92037) } | 枚举显示状态 [更多...](_display.md#disppowerstatus) | +| [CompositionType](_display.md#compositiontype) { COMPOSITION_CLIENT, COMPOSITION_DEVICE, COMPOSITION_CURSOR, COMPOSITION_VIDEO,   COMPOSITION_DEVICE_CLEAR, COMPOSITION_CLIENT_CLEAR, COMPOSITION_TUNNEL, COMPOSITION_BUTT } | [CompositionType](_display.md#compositiontype) {   [COMPOSITION_CLIENT](_display.md#ggae5d7b642670cf3dc6654131dfa115fe5afc7ab4757f19ed87ea6d1603478edbe8), [COMPOSITION_DEVICE](_display.md#ggae5d7b642670cf3dc6654131dfa115fe5aa51390e0da602171f2d042a94c6b75bf), [COMPOSITION_CURSOR](_display.md#ggae5d7b642670cf3dc6654131dfa115fe5a663feec453d4509980f3bb34f641303b), [COMPOSITION_VIDEO](_display.md#ggae5d7b642670cf3dc6654131dfa115fe5a89ea30239d366a6968c7dff429a99aa9),   [COMPOSITION_DEVICE_CLEAR](_display.md#ggae5d7b642670cf3dc6654131dfa115fe5a05f5ab2a5da295c0fdc7e19e9a121f3e), [COMPOSITION_CLIENT_CLEAR](_display.md#ggae5d7b642670cf3dc6654131dfa115fe5a7c1535ef8d388f878fae7c722d69855e), [COMPOSITION_TUNNEL](_display.md#ggae5d7b642670cf3dc6654131dfa115fe5a400576aea4b15e011ddd21748d16f9ca), [COMPOSITION_BUTT](_display.md#p488974221219) } | 枚举特殊层的组合类型。 [更多...](_display.md#compositiontype) | +| [ColorGamut](_display.md#colorgamut) { COLOR_GAMUT_INVALID = -1, COLOR_GAMUT_NATIVE = 0, COLOR_GAMUT_SATNDARD_BT601 = 1, COLOR_GAMUT_STANDARD_BT709 = 2,   COLOR_GAMUT_DCI_P3 = 3, COLOR_GAMUT_SRGB = 4, COLOR_GAMUT_ADOBE_RGB = 5, COLOR_GAMUT_DISPLAY_P3 = 6,   COLOR_GAMUT_BT2020 = 7, COLOR_GAMUT_BT2100_PQ = 8, COLOR_GAMUT_BT2100_HLG = 9, COLOR_GAMUT_DISPLAY_BT2020 = 10 } | [ColorGamut](_display.md#colorgamut) {   [COLOR_GAMUT_INVALID](_display.md#gga7e865f6dbae09a004be2949b473fd7c3a7d7d95bebc0ddb4d10da05b449bab1bf) = -1, [COLOR_GAMUT_NATIVE](_display.md#gga7e865f6dbae09a004be2949b473fd7c3af0e1dba48215d4d19bd9a3536a736cdb) = 0, [COLOR_GAMUT_SATNDARD_BT601](_display.md#gga7e865f6dbae09a004be2949b473fd7c3affa91ab208128bec9b981e7020bcbfa9) = 1, [COLOR_GAMUT_STANDARD_BT709](_display.md#gga7e865f6dbae09a004be2949b473fd7c3a248480b6ae7ad6c5327dd7cb5cfd0a85) = 2,   [COLOR_GAMUT_DCI_P3](_display.md#gga7e865f6dbae09a004be2949b473fd7c3a98eb540d5a93ab3ad4256907eec89c4e) = 3, [COLOR_GAMUT_SRGB](_display.md#gga7e865f6dbae09a004be2949b473fd7c3a8327e3fc0a79c9935dd9279c10c841c5) = 4, [COLOR_GAMUT_ADOBE_RGB](_display.md#gga7e865f6dbae09a004be2949b473fd7c3a3377a7df82b495c65f3f7ab2b1655100) = 5, [COLOR_GAMUT_DISPLAY_P3](_display.md#gga7e865f6dbae09a004be2949b473fd7c3ad79cdc9f86f3b581453c523a03a876d3) = 6,   [COLOR_GAMUT_BT2020](_display.md#gga7e865f6dbae09a004be2949b473fd7c3a79ff774719c5b83287b298d39ee274f3) = 7, [COLOR_GAMUT_BT2100_PQ](_display.md#gga7e865f6dbae09a004be2949b473fd7c3aa8191f5fca2ad767fa56767b41f4dec5) = 8, [COLOR_GAMUT_BT2100_HLG](_display.md#gga7e865f6dbae09a004be2949b473fd7c3ad4f624c7b578dacaa732cd9556724797) = 9, [COLOR_GAMUT_DISPLAY_BT2020](_display.md#gga7e865f6dbae09a004be2949b473fd7c3a5d07e2f0d8e570c5e16ccff05e12cb29) = 10 } | 色域类型枚举值 [更多...](_display.md#colorgamut) | +| [GamutMap](_display.md#gamutmap) { GAMUT_MAP_CONSTANT = 0, GAMUT_MAP_EXPANSION = 1, GAMUT_MAP_HDR_CONSTANT = 2, GAMUT_MAP_HDR_EXPANSION = 3 } | [GamutMap](_display.md#gamutmap) { [GAMUT_MAP_CONSTANT](_display.md#gga5700b58f1bc340e309a0962101ad7fa4acdf75e246ac2f53f37ef9e11b5561535) = 0, [GAMUT_MAP_EXPANSION](_display.md#gga5700b58f1bc340e309a0962101ad7fa4af3824abcccbd8d85d28e34149e9aaa33) = 1, [GAMUT_MAP_HDR_CONSTANT](_display.md#gga5700b58f1bc340e309a0962101ad7fa4afd4e1cb10b8032108ab070925b73e270) = 2, [GAMUT_MAP_HDR_EXPANSION](_display.md#gga5700b58f1bc340e309a0962101ad7fa4ad0f9722a0efd51910ac5f2f63fd86a10) = 3 } | 枚举色域的映射类型 [更多...](_display.md#gamutmap) | +| [ColorDataSpace](_display.md#colordataspace) {   COLOR_DATA_SPACE_UNKNOWN = 0, GAMUT_BT601 = 0x00000001, GAMUT_BT709 = 0x00000002, GAMUT_DCI_P3 = 0x00000003,   GAMUT_SRGB = 0x00000004, GAMUT_ADOBE_RGB = 0x00000005, GAMUT_DISPLAY_P3 = 0x00000006, GAMUT_BT2020 = 0x00000007,   GAMUT_BT2100_PQ = 0x00000008, GAMUT_BT2100_HLG = 0x00000009, GAMUT_DISPLAY_BT2020 = 0x0000000a, TRANSFORM_FUNC_UNSPECIFIED = 0x00000100,   TRANSFORM_FUNC_LINEAR = 0x00000200, TRANSFORM_FUNC_SRGB = 0x00000300, TRANSFORM_FUNC_SMPTE_170M = 0x00000400, TRANSFORM_FUNC_GM2_2 = 0x00000500,   TRANSFORM_FUNC_GM2_6 = 0x00000600, TRANSFORM_FUNC_GM2_8 = 0x00000700, TRANSFORM_FUNC_ST2084 = 0x00000800, TRANSFORM_FUNC_HLG = 0x00000900,   PRECISION_UNSPECIFIED = 0x00010000, PRECISION_FULL = 0x00020000, PRESION_LIMITED = 0x00030000, PRESION_EXTENDED = 0x00040000,   BT601_SMPTE170M_FULL = GAMUT_BT601 \| TRANSFORM_FUNC_SMPTE_170M \| PRECISION_FULL, BT601_SMPTE170M_LIMITED = GAMUT_BT601 \| TRANSFORM_FUNC_SMPTE_170M \| PRESION_LIMITED, BT709_LINEAR_FULL = GAMUT_BT709 \| TRANSFORM_FUNC_LINEAR \| PRECISION_FULL, BT709_LINEAR_EXTENDED = GAMUT_BT709 \| TRANSFORM_FUNC_LINEAR \| PRESION_EXTENDED,   BT709_SRGB_FULL = GAMUT_BT709 \| TRANSFORM_FUNC_SRGB \| PRECISION_FULL, BT709_SRGB_EXTENDED = GAMUT_BT709 \| TRANSFORM_FUNC_SRGB \| PRESION_EXTENDED, BT709_SMPTE170M_LIMITED = GAMUT_BT709 \| TRANSFORM_FUNC_SMPTE_170M \| PRESION_LIMITED, DCI_P3_LINEAR_FULL = GAMUT_DCI_P3 \| TRANSFORM_FUNC_LINEAR \| PRECISION_FULL,   DCI_P3_GAMMA26_FULL = GAMUT_DCI_P3 \| TRANSFORM_FUNC_GM2_6 \| PRECISION_FULL, DISPLAY_P3_LINEAR_FULL = GAMUT_DISPLAY_P3 \| TRANSFORM_FUNC_LINEAR \| PRECISION_FULL, DCI_P3_SRGB_FULL = GAMUT_DCI_P3 \| TRANSFORM_FUNC_SRGB \| PRECISION_FULL, ADOBE_RGB_GAMMA22_FULL = GAMUT_ADOBE_RGB \| TRANSFORM_FUNC_GM2_2 \| PRECISION_FULL,   BT2020_LINEAR_FULL = GAMUT_BT2020 \| TRANSFORM_FUNC_LINEAR \| PRECISION_FULL, BT2020_SRGB_FULL = GAMUT_BT2020 \| TRANSFORM_FUNC_SRGB \| PRECISION_FULL, BT2020_SMPTE170M_FULL = GAMUT_BT2020 \| TRANSFORM_FUNC_SMPTE_170M \| PRECISION_FULL, BT2020_ST2084_FULL = GAMUT_BT2020 \| TRANSFORM_FUNC_ST2084 \| PRECISION_FULL,   BT2020_HLG_FULL = GAMUT_BT2020 \| TRANSFORM_FUNC_HLG \| PRECISION_FULL, BT2020_ST2084_LIMITED = GAMUT_BT2020 \| TRANSFORM_FUNC_ST2084 \| PRESION_LIMITED } | [ColorDataSpace](_display.md#colordataspace) {   [COLOR_DATA_SPACE_UNKNOWN](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca5a0aa62f13715cbdf2b5ec1e26e76225) = 0, [GAMUT_BT601](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccad778a31f4c8e3431f5240f98c70f577d) = 0x00000001, [GAMUT_BT709](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca7d346fa865c56c76f62c7f6ab92511ec) = 0x00000002, [GAMUT_DCI_P3](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccae29ccb674444c3f81f0a46361d7ce63c) = 0x00000003,   [GAMUT_SRGB](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca16c4c57e66f86b20269db0d5d6382ded) = 0x00000004, [GAMUT_ADOBE_RGB](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca0a0a0c633a41a5f30596a5168a3267ca) = 0x00000005, [GAMUT_DISPLAY_P3](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca3d4a0608dd5c682fc020bfc68a425e15) = 0x00000006, [GAMUT_BT2020](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccaa6dc448a5d0d16a7d2610edb29fff407) = 0x00000007,   [GAMUT_BT2100_PQ](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca6b100b6876c7e77106df92b9c8cf7d2b) = 0x00000008, [GAMUT_BT2100_HLG](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca53a60a5ed93129597841bde263e9a798) = 0x00000009, [GAMUT_DISPLAY_BT2020](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccaa66ffaf12ec59488cccbd2170cc3d2c8) = 0x0000000a, [TRANSFORM_FUNC_UNSPECIFIED](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca0fe652843eafbf7a93b645a71342dce0) = 0x00000100,   [TRANSFORM_FUNC_LINEAR](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccaa2e1f70b023dd5ae3a31771217d958cc) = 0x00000200, [TRANSFORM_FUNC_SRGB](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca47dd20703e8d8135aedfb687b75ef66c) = 0x00000300, [TRANSFORM_FUNC_SMPTE_170M](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccab031ec808cc46bee79d2c96460615206) = 0x00000400, [TRANSFORM_FUNC_GM2_2](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca078b8dad4e1eb6720c81c841b3f417d9) = 0x00000500,   [TRANSFORM_FUNC_GM2_6](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccad6abe514be2fa6c57b2aec5a5eb6fc7d) = 0x00000600, [TRANSFORM_FUNC_GM2_8](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca850b419cb0075b5bd44df5708fc9c87f) = 0x00000700, [TRANSFORM_FUNC_ST2084](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca24a6d830fca211b067260df9583a1b2b) = 0x00000800, [TRANSFORM_FUNC_HLG](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca4a6d68c7a2219cada2edf0e9d7bc46f8) = 0x00000900,   [PRECISION_UNSPECIFIED](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca77342396f1154be94079d0d76fc5e829) = 0x00010000, [PRECISION_FULL](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca200541efc2ee0d21e37a7200e7a08a54) = 0x00020000, [PRESION_LIMITED](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccab51307e81936be84b6504a98197fb1ee) = 0x00030000, [PRESION_EXTENDED](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccafd6ac339ebbdbbdd7fee540a6fad5ec2) = 0x00040000,   [BT601_SMPTE170M_FULL](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccab640f36320dafb19066dfcaccc836999) = GAMUT_BT601 \| TRANSFORM_FUNC_SMPTE_170M \| PRECISION_FULL, [BT601_SMPTE170M_LIMITED](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca6cd475c6421764e5d71d71f1de75d638) = GAMUT_BT601 \| TRANSFORM_FUNC_SMPTE_170M \| PRESION_LIMITED, [BT709_LINEAR_FULL](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccad2bc96da52c18ef9bb26320507747176) = GAMUT_BT709 \| TRANSFORM_FUNC_LINEAR \| PRECISION_FULL, [BT709_LINEAR_EXTENDED](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca03631fd75bc6ec7280ce2c68a129e4fd) = GAMUT_BT709 \| TRANSFORM_FUNC_LINEAR \| PRESION_EXTENDED,   [BT709_SRGB_FULL](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccaaffba49d9c1c335387cd8153becad65a) = GAMUT_BT709 \| TRANSFORM_FUNC_SRGB \| PRECISION_FULL, [BT709_SRGB_EXTENDED](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca049878481c3ed46dbd6cfea995e2f0d5) = GAMUT_BT709 \| TRANSFORM_FUNC_SRGB \| PRESION_EXTENDED, [BT709_SMPTE170M_LIMITED](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca14381e6d202b6bda3c90264b05d31838) = GAMUT_BT709 \| TRANSFORM_FUNC_SMPTE_170M \| PRESION_LIMITED, [DCI_P3_LINEAR_FULL](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccad03af85a7ff4c1069a97bfb603f7d694) = GAMUT_DCI_P3 \| TRANSFORM_FUNC_LINEAR \| PRECISION_FULL,   [DCI_P3_GAMMA26_FULL](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca9de9b32e0e7c172c77922af8904ba3a2) = GAMUT_DCI_P3 \| TRANSFORM_FUNC_GM2_6 \| PRECISION_FULL, [DISPLAY_P3_LINEAR_FULL](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca8bcb3a4ed6039d158b9c32ba99fceaff) = GAMUT_DISPLAY_P3 \| TRANSFORM_FUNC_LINEAR \| PRECISION_FULL, [DCI_P3_SRGB_FULL](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca2fac97f61868100034eb40fdba9a9d3f) = GAMUT_DCI_P3 \| TRANSFORM_FUNC_SRGB \| PRECISION_FULL, [ADOBE_RGB_GAMMA22_FULL](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca1f855c7b4bd5f8a9cc29f3e335a9f2f4) = GAMUT_ADOBE_RGB \| TRANSFORM_FUNC_GM2_2 \| PRECISION_FULL,   [BT2020_LINEAR_FULL](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca27315309a3b866eda00f17825ee9532d) = GAMUT_BT2020 \| TRANSFORM_FUNC_LINEAR \| PRECISION_FULL, [BT2020_SRGB_FULL](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccaa63d6a3a8bb1c6c5b383cb7010f61d72) = GAMUT_BT2020 \| TRANSFORM_FUNC_SRGB \| PRECISION_FULL, [BT2020_SMPTE170M_FULL](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33cca6de02e882e01743ce5ca07a17d481930) = GAMUT_BT2020 \| TRANSFORM_FUNC_SMPTE_170M \| PRECISION_FULL, [BT2020_ST2084_FULL](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccac2e37c91fc9bd29641cf95d74aa7862c) = GAMUT_BT2020 \| TRANSFORM_FUNC_ST2084 \| PRECISION_FULL,   [BT2020_HLG_FULL](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccad5b0a069ac80df8d045265e88f9b5e71) = GAMUT_BT2020 \| TRANSFORM_FUNC_HLG \| PRECISION_FULL, [BT2020_ST2084_LIMITED](_display.md#gga00fa6ca1bcfe5949dceaa3a77f8d33ccaeab2d55af8e3568130cf69fa614b3c9d) = GAMUT_BT2020 \| TRANSFORM_FUNC_ST2084 \| PRESION_LIMITED } | 枚举颜色空间的类型 [更多...](_display.md#colordataspace) | +| [HDRFormat](_display.md#hdrformat) { NOT_SUPPORT_HDR = 0, DOLBY_VISION = 1, HDR10 = 2, HLG = 3,   HDR10_PLUS = 4, HDR_VIVID = 5 } | [HDRFormat](_display.md#hdrformat) {   [NOT_SUPPORT_HDR](_display.md#ggabdc446aa6fa47c5dd8d1b7d87bed2566a0799ce04a1873f60ed59c3d30dcda69a) = 0, [DOLBY_VISION](_display.md#ggabdc446aa6fa47c5dd8d1b7d87bed2566ac43f1175d92c85033e0a85c7a14266a7) = 1, [HDR10](_display.md#ggabdc446aa6fa47c5dd8d1b7d87bed2566ada5b15b3c4b4cc64593452113ac1d4dc) = 2, [HLG](_display.md#ggabdc446aa6fa47c5dd8d1b7d87bed2566a2c6e7224778e782cbbd478e4c11282e2) = 3,   [HDR10_PLUS](_display.md#ggabdc446aa6fa47c5dd8d1b7d87bed2566abc6f25afdafdebb03fd137de1917389d) = 4, [HDR_VIVID](_display.md#ggabdc446aa6fa47c5dd8d1b7d87bed2566a84318c5a162e5b9b822e38e675117e42) = 5 } | 枚举HDR格式 [更多...](_display.md#hdrformat) | +| [HDRMetadataKey](_display.md#hdrmetadatakey) { MATAKEY_RED_PRIMARY_X = 0, MATAKEY_RED_PRIMARY_Y = 1, MATAKEY_GREEN_PRIMARY_X = 2, MATAKEY_GREEN_PRIMARY_Y = 3,   MATAKEY_BLUE_PRIMARY_X = 4, MATAKEY_BLUE_PRIMARY_Y = 5, MATAKEY_WHITE_PRIMARY_X = 6, MATAKEY_WHITE_PRIMARY_Y = 7,   MATAKEY_MAX_LUMINANCE = 8, MATAKEY_MIN_LUMINANCE = 9, MATAKEY_MAX_CONTENT_LIGHT_LEVEL = 10, MATAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11,   MATAKEY_HDR10_PLUS = 12, MATAKEY_HDR_VIVID = 13 } | [HDRMetadataKey](_display.md#hdrmetadatakey) {   [MATAKEY_RED_PRIMARY_X](_display.md#gga5d7d90acb5c568e62a02b18446f37789a92c0f5eaba344bee22c657040b606fd3) = 0, [MATAKEY_RED_PRIMARY_Y](_display.md#gga5d7d90acb5c568e62a02b18446f37789a405841a4999556bd36281870d579dc7e) = 1, [MATAKEY_GREEN_PRIMARY_X](_display.md#gga5d7d90acb5c568e62a02b18446f37789a08f31a74e8df3253c6326879818dfe1b) = 2, [MATAKEY_GREEN_PRIMARY_Y](_display.md#gga5d7d90acb5c568e62a02b18446f37789a19db3eede73e96c6a25dc4d31e5846e1) = 3,   [MATAKEY_BLUE_PRIMARY_X](_display.md#gga5d7d90acb5c568e62a02b18446f37789a23e7112a9c4aaf15bc2a529344a61939) = 4, [MATAKEY_BLUE_PRIMARY_Y](_display.md#gga5d7d90acb5c568e62a02b18446f37789a5a34485b5884d8bd86273750b9d47b0b) = 5, [MATAKEY_WHITE_PRIMARY_X](_display.md#gga5d7d90acb5c568e62a02b18446f37789ac12237b3de1eee6176c690e7f14ab339) = 6, [MATAKEY_WHITE_PRIMARY_Y](_display.md#gga5d7d90acb5c568e62a02b18446f37789a331c8b69a7d9484c9eaea70e78a34921) = 7,   [MATAKEY_MAX_LUMINANCE](_display.md#gga5d7d90acb5c568e62a02b18446f37789ac27053151e1fa76e58dc3281d843ad74) = 8, [MATAKEY_MIN_LUMINANCE](_display.md#gga5d7d90acb5c568e62a02b18446f37789a345f5cea142c7357e0b9de5ccfc86bed) = 9, [MATAKEY_MAX_CONTENT_LIGHT_LEVEL](_display.md#gga5d7d90acb5c568e62a02b18446f37789a9897f53fcb179afc9c90f8c7ca0ac254) = 10, [MATAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL](_display.md#gga5d7d90acb5c568e62a02b18446f37789a8d285ea7b6246f62b7e7a65e5a870bfe) = 11,   [MATAKEY_HDR10_PLUS](_display.md#gga5d7d90acb5c568e62a02b18446f37789a89ef9c02321a94080f185c7fea3f6d1d) = 12, [MATAKEY_HDR_VIVID](_display.md#gga5d7d90acb5c568e62a02b18446f37789ac99c4612b3aee2bfede23070fe32ac7e) = 13 } | 枚举HDR元数据关键字 [更多...](_display.md#hdrmetadatakey) | +| [PresentTimestampType](_display.md#presenttimestamptype) { HARDWARE_DISPLAY_PTS_UNSUPPORTED = 0, HARDWARE_DISPLAY_PTS_DELAY = 1 << 0, HARDWARE_DISPLAY_PTS_TIMESTAMP = 1 << 1 } | [PresentTimestampType](_display.md#presenttimestamptype) { [HARDWARE_DISPLAY_PTS_UNSUPPORTED](_display.md#ggabdba71665ea5ba4004ac1a9fbeb505f3ad6e47ab1a80ab94cccb5e465610ff45d) = 0, [HARDWARE_DISPLAY_PTS_DELAY](_display.md#ggabdba71665ea5ba4004ac1a9fbeb505f3a5c06391b9583b69d37c7a0518dd10f09) = 1 << 0, [HARDWARE_DISPLAY_PTS_TIMESTAMP](_display.md#ggabdba71665ea5ba4004ac1a9fbeb505f3afd872c457c9dade672aaaec5de622ff7) = 1 << 1 } | 上屏时间戳类型枚举值 [更多...](_display.md#presenttimestamptype) | + + +## **详细描述** + +显示类型定义,定义显示驱动接口所使用的数据类型。 + +**Since:** + +1.0 + +**Version:** + +2.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/face__auth_2_i_executor_8idl.md b/zh-cn/device-dev/reference/hdi-apis/face__auth_2_i_executor_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..746f21f26106445e5134a3ac3b3878cc4d96098a --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/face__auth_2_i_executor_8idl.md @@ -0,0 +1,34 @@ +# IExecutor.idl + + +## **概述** + +**所属模块:** + +[HdfFaceAuth](_hdf_face_auth.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IExecutor](interface_i_executor.md) | 定义执行器接口,用于获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 [更多...](interface_i_executor.md) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.face_auth.v1_0 | 人脸认证接口的包路径。 | + + +## **详细描述** + +定义执行器接口,用于获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 + +**Since:** + +3.2 diff --git a/zh-cn/device-dev/reference/hdi-apis/face__auth_2_i_executor_callback_8idl.md b/zh-cn/device-dev/reference/hdi-apis/face__auth_2_i_executor_callback_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..ae11adf2057ae5a01e3d4c363b60754ac0754783 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/face__auth_2_i_executor_callback_8idl.md @@ -0,0 +1,34 @@ +# IExecutorCallback.idl + + +## **概述** + +**所属模块:** + +[HdfFaceAuth](_hdf_face_auth.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IExecutorCallback](interface_i_executor_callback.md) | 定义异步API接口回调,用于返回异步接口的请求处理结果和信息。使用细节见[IExecutor](interface_i_executor.md)。 [更多...](interface_i_executor_callback.md) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.face_auth.v1_0 | 人脸认证接口的包路径 | + + +## **详细描述** + +定义异步API接口回调,用于返回异步接口的请求处理结果和信息。 + +**Since:** + +3.2 diff --git a/zh-cn/device-dev/reference/hdi-apis/files.md b/zh-cn/device-dev/reference/hdi-apis/files.md new file mode 100644 index 0000000000000000000000000000000000000000..e44e53e4664fd78e95581381f05b11fed399faac --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/files.md @@ -0,0 +1,131 @@ +# 头文件 + + + +- **[audio_adapter.h](audio__adapter_8h.md)** + +- **[audio_attribute.h](audio__attribute_8h.md)** + +- **[audio_capture.h](audio__capture_8h.md)** + +- **[audio_control.h](audio__control_8h.md)** + +- **[audio_manager.h](audio__manager_8h.md)** + +- **[audio_render.h](audio__render_8h.md)** + +- **[audio_scene.h](audio__scene_8h.md)** + +- **[audio_types.h](audio__types_8h.md)** + +- **[audio_volume.h](audio__volume_8h.md)** + +- **[codec_callback_if.h](codec__callback__if_8h.md)** + +- **[codec_common_type.h](codec__common__type_8h.md)** + +- **[codec_component_if.h](codec__component__if_8h.md)** + +- **[codec_component_manager.h](codec__component__manager_8h.md)** + +- **[codec_component_type.h](codec__component__type_8h.md)** + +- **[display_device.h](display__device_8h.md)** + +- **[display_gfx.h](display__gfx_8h.md)** + +- **[display_gralloc.h](display__gralloc_8h.md)** + +- **[display_layer.h](display__layer_8h.md)** + +- **[display_type.h](display__type_8h.md)** + +- **[icamera_device_callback.h](icamera__device__callback_8h.md)** + +- **[icamera_device.h](icamera__device_8h.md)** + +- **[icamera_host_callback.h](icamera__host__callback_8h.md)** + +- **[icamera_host.h](icamera__host_8h.md)** + +- **[input_controller.h](input__controller_8h.md)** + +- **[input_manager.h](input__manager_8h.md)** + +- **[input_reporter.h](input__reporter_8h.md)** + +- **[input_type.h](input__type_8h.md)** + +- **[ioffline_stream_operator.h](ioffline__stream__operator_8h.md)** + +- **[istream_operator_callback.h](istream__operator__callback_8h.md)** + +- **[istream_operator.h](istream__operator_8h.md)** + +- **[light_if.h](light__if_8h.md)** + +- **[light_type.h](light_8typeh.md)** + +- **[sensor_if.h](sensor__if_8h.md)** + +- **[sensor_type.h](sensor__type_8h.md)** + +- **[types.h](types_8h.md)** + +- **[usb_info.h](usb__info_8h.md)** + +- **[usbd_client.h](usbd__client_8h.md)** + +- **[usbd_subscriber.h](usbd__subscriber_8h.md)** + +- **[usbd_type.h](usbd__type_8h.md)** + +- **[vibrator_if.h](vibrator__if_8h.md)** + +- **[vibrator_type.h](vibrator__type_8h.md)** + +- **[wifi_hal_ap_feature.h](wifi__hal__ap__feature_8h.md)** + +- **[wifi_hal_base_feature.h](wifi__hal__base__feature_8h.md)** + +- **[wifi_hal_sta_feature.h](wifi__hal__sta__feature_8h.md)** + +- **[wifi_hal.h](wifi__hal_8h.md)** + +- **[IExecutor.idl](face__auth_2_i_executor_8idl.md)** + +- **[IExecutorCallback.idl](face__auth_2_i_executor_callback_8idl.md)** + +- **[FaceAuthTypes.idl](_face_auth_types_8idl.md)** + +- **[PinAuthTypes.idl](_pin_auth_types_8idl.md)** + +- **[IBatteryCallback.idl](_i_battery_callback_8idl.md)** + +- **[IBatteryInterface.idl](_i_battery_interface_8idl.md)** + +- **[IExecutor.idl](pin__auth_2_i_executor_8idl.md)** + +- **[IExecutorCallback.idl](pin__auth_2_i_executor_callback_8idl.md)** + +- **[IFaceAuthInterface.idl](_i_face_auth_interface_8idl.md)** + +- **[IPinAuthInterface.idl](_i_pin_auth_interface_8idl.md)** + +- **[IPowerHdiCallback.idl](_i_power_hdi_callback_8idl.md)** + +- **[IPowerInterface.idl](_i_power_interface_8idl.md)** + +- **[IThermalInterface.idl](_i_thermal_interface_8idl.md)** + +- **[IThermalCallback.idl](_i_thermal_callback_8idl.md)** + +- **[IUserAuthInterface.idl](_i_user_auth_interface_8idl.md)** + +- **[PowerTypes.idl](_power_types_8idl.md)** + +- **[ThermalTypes.idl](_thermal_types_8idl.md)** + +- **[Types.idl](_types_8idl.md)** + +- **[UserAuthTypes.idl](_user_auth_types_8idl.md)** \ No newline at end of file diff --git a/zh-cn/device-dev/reference/hdi-apis/icamera__device_8h.md b/zh-cn/device-dev/reference/hdi-apis/icamera__device_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..91b9f1c93460824bf925388ebdfba6f93a5d0c2e --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/icamera__device_8h.md @@ -0,0 +1,31 @@ +# icamera_device.h + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [OHOS::Camera::ICameraDevice](_o_h_o_s_1_1_camera_1_1_i_camera_device.md) | Camera设备操作。 | + + +## **详细描述** + +Camera设备操作接口。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/icamera__device__callback_8h.md b/zh-cn/device-dev/reference/hdi-apis/icamera__device__callback_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..d70ccf005f7eae0f6882672fd0761781959b8276 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/icamera__device__callback_8h.md @@ -0,0 +1,31 @@ +# icamera_device_callback.h + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [OHOS::Camera::ICameraDeviceCallback](_o_h_o_s_1_1_camera_1_1_i_camera_device_callback.md) | Camera设备操作回调。 | + + +## **详细描述** + +Camera设备的回调接口,主要包含camera设备发生错误时和上报metadata的回调函数。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/icamera__host_8h.md b/zh-cn/device-dev/reference/hdi-apis/icamera__host_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..e7991b95aeef1a42960f000d2132442d4542f37c --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/icamera__host_8h.md @@ -0,0 +1,31 @@ +# icamera_host.h + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [OHOS::Camera::ICameraHost](_o_h_o_s_1_1_camera_1_1_i_camera_host.md) | Camera服务的管理类。 | + + +## **详细描述** + +Camera服务的管理类,对上层提供HDI接口。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/icamera__host__callback_8h.md b/zh-cn/device-dev/reference/hdi-apis/icamera__host__callback_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..f63aab515a0770f65885e0107c20df7e016c9149 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/icamera__host__callback_8h.md @@ -0,0 +1,31 @@ +# icamera_host_callback.h + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [OHOS::Camera::ICameraHostCallback](_o_h_o_s_1_1_camera_1_1_i_camera_host_callback.md) | Camera服务的管理回调。 | + + +## **详细描述** + +ICameraHost的回调接口,提供Camera设备和闪关灯状态变化的回调函数,回调函数由调用者实现。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/index.md b/zh-cn/device-dev/reference/hdi-apis/index.md new file mode 100644 index 0000000000000000000000000000000000000000..27d1c39014f7b380f9ba3477290d03c5f0af9f05 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/index.md @@ -0,0 +1,35 @@ +# NativeAPI参考 + + + +- **[Audio](_audio.md)** + +- **[Battery](battery.md)** + +- **[Camera](_camera.md)** + +- **[Codec](_codec.md)** + +- **[Display](_display.md)** + +- **[HdfFaceAuth](_hdf_face_auth.md)** + +- **[Input](_input.md)** + +- **[Light](_light.md)** + +- **[HdfPinAuth](_hdf_pin_auth.md)** + +- **[Power](power.md)** + +- **[Sensor](_sensor.md)** + +- **[Thermal](thermal.md)** + +- **[USB](_u_s_b.md)** + +- **[HdfUserAuth](_hdf_user_auth.md)** + +- **[Vibrator](_vibrator.md)** + +- **[WLAN](_w_l_a_n.md)** \ No newline at end of file diff --git a/zh-cn/device-dev/reference/hdi-apis/input__controller_8h.md b/zh-cn/device-dev/reference/hdi-apis/input__controller_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..db9bca32bef40659abc5f0ca874078c80f7714c7 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/input__controller_8h.md @@ -0,0 +1,31 @@ +# input_controller.h + + +## **概述** + +**所属模块:** + +[Input](_input.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [InputController](_input_controller.md) | 提供input设备业务控制相关的接口。 [更多...](_input_controller.md) | + + +## **详细描述** + +描述input设备业务控制相关的接口声明。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/input__manager_8h.md b/zh-cn/device-dev/reference/hdi-apis/input__manager_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..03a08b6be878d8692f3c69d5a898c95526aaab2b --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/input__manager_8h.md @@ -0,0 +1,39 @@ +# input_manager.h + + +## **概述** + +**所属模块:** + +[Input](_input.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [InputManager](_input_manager.md) | 提供input设备管理相关的接口。 [更多...](_input_manager.md) | +| [IInputInterface](_i_input_interface.md) | 定义用于提供输入设备驱动能力的接口。[更多...](_i_input_interface.md) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [GetInputInterface](_input.md#getinputinterface) ([IInputInterface](_i_input_interface.md) \*\*interface) | input服务通过调用此接口获取操作input设备的所有接口。 [更多...](_input.md#getinputinterface) | + + +## **详细描述** + +描述input设备管理相关的接口声明。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/input__reporter_8h.md b/zh-cn/device-dev/reference/hdi-apis/input__reporter_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..5982a674507c08b4fdfa257a29ed69677b15c603 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/input__reporter_8h.md @@ -0,0 +1,31 @@ +# input_reporter.h + + +## **概述** + +**所属模块:** + +[Input](_input.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [InputReporter](_input_reporter.md) | 提供input设备数据上报相关的接口。 [更多...](_input_reporter.md) | + + +## **详细描述** + +描述input设备数据上报相关的接口声明。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/input__type_8h.md b/zh-cn/device-dev/reference/hdi-apis/input__type_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..97b78edcd59358dc48f4011ef9190b23d5a994c0 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/input__type_8h.md @@ -0,0 +1,56 @@ +# input_type.h + + +## **概述** + +**所属模块:** + +[Input](_input.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [EventPackage](_event_package.md) | input事件数据包结构 [更多...](_event_package.md) | +| [InputReportEventCb](_input_report_event_cb.md) | 此结构体定义了输入事件回调函数并提供给input服务使用 [更多...](_input_report_event_cb.md) | +| [DeviceInfo](_device_info.md) | input设备基础设备信息 [更多...](_device_info.md) | +| [InputExtraCmd](_input_extra_cmd.md) | 扩展指令的数据结构 [更多...](_input_extra_cmd.md) | + + +### 宏定义 + + | 宏定义 | 描述 | +| -------- | -------- | +| **MAX_INPUT_DEV_NUM**   32 | Input设备最大数量。 | +| **MAX_NODE_PATH_LEN**   64 | 节点路径最大长度。 | +| **CHIP_INFO_LEN**   10 | 芯片信息长度。 | +| **CHIP_NAME_LEN**   10 | 芯片名称长度。 | +| **VENDOR_NAME_LEN**   10 | 厂商名称长度。 | +| **SELF_TEST_RESULT_LEN**   20 | 自测结果长度。 | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [RetStatus](_input.md#retstatus) { INPUT_SUCCESS = 0, INPUT_FAILURE = -1, INPUT_INVALID_PARAM = -2, INPUT_NOMEM = -3,   INPUT_NULL_PTR = -4, INPUT_TIMEOUT = -5, INPUT_UNSUPPORTED = -6 } | 定义返回值类型 [更多...](_input.md#retstatus) | +| [InputDevType](_input.md#inputdevtype) { INDEV_TYPE_TOUCH, INDEV_TYPE_KEY, INDEV_TYPE_KEYBOARD, INDEV_TYPE_MOUSE,   INDEV_TYPE_BUTTON, INDEV_TYPE_CROWN, INDEV_TYPE_ENCODER, INDEV_TYPE_UNKNOWN } | 定义input设备类型 [更多...](_input.md#inputdevtype) | +| [PowerStatus](_input.md#powerstatus) { INPUT_RESUME, INPUT_SUSPEND, INPUT_LOW_POWER, INPUT_POWER_STATUS_UNKNOWN } | 定义电源状态 [更多...](_input.md#powerstatus) | +| [CapacitanceTest](_input.md#capacitancetest) { BASE_TEST, FULL_TEST, MMI_TEST, RUNNING_TEST,   TEST_TYPE_UNKNOWN } | 定义容值测试类型 [更多...](_input.md#capacitancetest) | + + +## **详细描述** + +input设备相关的类型定义,定义了input设备驱动接口所使用的结构体及枚举类型。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/interface_i_battery_callback.md b/zh-cn/device-dev/reference/hdi-apis/interface_i_battery_callback.md new file mode 100644 index 0000000000000000000000000000000000000000..cafdf21cd8e3a4d1eccbe3d8fa82ddb1256470a1 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/interface_i_battery_callback.md @@ -0,0 +1,56 @@ +# IBatteryCallback + + +## **概述** + +**所属模块:** + +[Battery](battery.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| [Update](#update) ([in] struct [BatteryInfo](_battery_info.md) event) | 电池信息的回调方法。 [更多...](#update) | + + +## **详细描述** + +电池信息的回调。 + +服务创建此回调对象后,可以调用IBatteryInterface的接口注册回调,从而订阅电池信息的变化。 + +**Since:** + +3.1 + + +## **成员函数说明** + + +### Update() + + +``` +IBatteryCallback::Update ([in] struct BatteryInfo event) +``` + +**描述:** + +电池信息的回调方法。 + +当电池信息发生变化时,将通过此方法的参数返回给服务。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| event | 电池信息,如电量,电压,健康状态等。 | + +**参见:** + +[BatteryInfo](_battery_info.md) diff --git a/zh-cn/device-dev/reference/hdi-apis/interface_i_battery_interface.md b/zh-cn/device-dev/reference/hdi-apis/interface_i_battery_interface.md new file mode 100644 index 0000000000000000000000000000000000000000..d82964f347df262b4764b633f78815fb8257cf52 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/interface_i_battery_interface.md @@ -0,0 +1,409 @@ +# IBatteryInterface + + +## **概述** + +**所属模块:** + +[Battery](battery.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| [Register](#register) ([in] [IBatteryCallback](interface_i_battery_callback.md) event) | 注册电池信息的回调。 [更多...](#register) | +| [UnRegister](#unregister) () | 取消注册电池信息的回调。 [更多...](#unregister) | +| [ChangePath](#changepath) ([in] String path) | 设置电池信息节点的路径。 [更多...](#changepath) | +| [GetCapacity](#getcapacity) ([out] int capacity) | 获取电池的电量百分比。 [更多...](#getcapacity) | +| [GetVoltage](#getvoltage) ([out] int voltage) | 获取电池的电压,单位微伏。 [更多...](#getvoltage) | +| [GetTemperature](#gettemperature) ([out] int temperature) | 获取电池的充电温度,单位0.1摄氏度。 [更多...](#gettemperature) | +| [GetHealthState](#gethealthstate) ([out] enum [BatteryHealthState](battery.md#batteryhealthstate) healthState) | 获取电池的健康状态。 [更多...](#gethealthstate) | +| [GetPluggedType](#getpluggedtype) ([out] enum [BatteryPluggedType](battery.md#batterypluggedtype) pluggedType) | 获取充电设备类型。 [更多...](#getpluggedtype) | +| [GetChargeState](#getchargestate) ([out] enum [BatteryChargeState](battery.md#batterychargestate) chargeState) | 获取充电状态。 [更多...](#getchargestate) | +| [GetPresent](#getpresent) ([out] boolean present) | 获取是否支持电池或者电池是否在位。 [更多...](#getpresent) | +| [GetTechnology](#gettechnology) ([out] String technology) | 获取电池的技术型号。 [更多...](#gettechnology) | +| [GetTotalEnergy](#gettotalenergy) ([out] int totalEnergy) | 获取电池的总容量。 [更多...](#gettotalenergy) | +| [GetCurrentAverage](#getcurrentaverage) ([out] int curAverage) | 获取电池的平均电流。 [更多...](#getcurrentaverage) | +| [GetCurrentNow](#getcurrentnow) ([out] int curNow) | 获取电池的电流。 [更多...](#getcurrentnow) | +| [GetRemainEnergy](#getremainenergy) ([out] int remainEnergy) | 获取电池的剩余容量。 [更多...](#getremainenergy) | +| [GetBatteryInfo](#getbatteryinfo) ([out] struct [BatteryInfo](_battery_info.md) info) | 获取电池的全部信息。 [更多...](#getbatteryinfo) | + + +## **详细描述** + +获取、订阅电池信息的接口。 + +服务获取此对象后,可以调用相关的接口获取、订阅电池信息。 + +**Since:** + +3.1 + + +## **成员函数说明** + + +### ChangePath() + + +``` +IBatteryInterface::ChangePath ([in] String path) +``` + +**描述:** + +设置电池信息节点的路径。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| path | 输入参数,电池信息节点的路径。 | + +**返回:** + +HDF_SUCCESS 表示路径设置成功。 + + +### GetBatteryInfo() + + +``` +IBatteryInterface::GetBatteryInfo ([out] struct BatteryInfo info) +``` + +**描述:** + +获取电池的全部信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| info | 输出参数,电池的全部信息。 | + +**返回:** + +HDF_SUCCESS 表示获取成功。 + +**参见:** + +[BatteryInfo](_battery_info.md) + + +### GetCapacity() + + +``` +IBatteryInterface::GetCapacity ([out] int capacity) +``` + +**描述:** + +获取电池的电量百分比。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| capacity | 输出参数,表示电量的百分比值。 | + +**返回:** + +HDF_SUCCESS 表示获取成功。 + + +### GetChargeState() + + +``` +IBatteryInterface::GetChargeState ([out] enum BatteryChargeState chargeState) +``` + +**描述:** + +获取充电状态。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| chargeState | 输出参数,表示充电状态。 | + +**返回:** + +HDF_SUCCESS 表示获取成功。 + +**参见:** + +[BatteryChargeState](battery.md#batterychargestate) + + +### GetCurrentAverage() + + +``` +IBatteryInterface::GetCurrentAverage ([out] int curAverage) +``` + +**描述:** + +获取电池的平均电流。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| totalEnergy | 输出参数,表示电池的平均电流,单位毫安。 | + +**返回:** + +HDF_SUCCESS 表示获取成功。 + + +### GetCurrentNow() + + +``` +IBatteryInterface::GetCurrentNow ([out] int curNow) +``` + +**描述:** + +获取电池的电流。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| curNow | 输出参数,表示电池的实时电流,单位毫安。 | + +**返回:** + +HDF_SUCCESS 表示获取成功。 + + +### GetHealthState() + + +``` +IBatteryInterface::GetHealthState ([out] enum BatteryHealthState healthState) +``` + +**描述:** + +获取电池的健康状态。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| healthState | 输出参数,表示电池健康状态。 | + +**返回:** + +HDF_SUCCESS 表示获取成功。 + +**参见:** + +[BatteryHealthState](battery.md#batteryhealthstate) + + +### GetPluggedType() + + +``` +IBatteryInterface::GetPluggedType ([out] enum BatteryPluggedType pluggedType) +``` + +**描述:** + +获取充电设备类型。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| pluggedType | 输出参数,表示充电设备类型。 | + +**返回:** + +HDF_SUCCESS 表示获取成功。 + +**参见:** + +[BatteryPluggedType](battery.md#batterypluggedtype) + + +### GetPresent() + + +``` +IBatteryInterface::GetPresent ([out] boolean present) +``` + +**描述:** + +获取是否支持电池或者电池是否在位。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| present | 输出参数,表示是否支持电池或者电池是否在位。true表示支持或在位,false表示不支持或不在位。 | + +**返回:** + +HDF_SUCCESS 表示获取成功。 + + +### GetRemainEnergy() + + +``` +IBatteryInterface::GetRemainEnergy ([out] int remainEnergy) +``` + +**描述:** + +获取电池的剩余容量。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| remainEnergy | 输出参数,表示电池的剩余容量,单位毫安时。 | + +**返回:** + +HDF_SUCCESS 表示获取成功。 + + +### GetTechnology() + + +``` +IBatteryInterface::GetTechnology ([out] String technology) +``` + +**描述:** + +获取电池的技术型号。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| technology | 输出参数,当前电池技术型号。 | + +**返回:** + +HDF_SUCCESS 表示获取成功。 + + +### GetTemperature() + + +``` +IBatteryInterface::GetTemperature ([out] int temperature) +``` + +**描述:** + +获取电池的充电温度,单位0.1摄氏度。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| temperature | 输出参数,表示电池温度。 | + +**返回:** + +HDF_SUCCESS 表示获取成功。 + + +### GetTotalEnergy() + + +``` +IBatteryInterface::GetTotalEnergy ([out] int totalEnergy) +``` + +**描述:** + +获取电池的总容量。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| totalEnergy | 输出参数,表示电池的总容量,单位毫安时。 | + +**返回:** + +HDF_SUCCESS 表示获取成功。 + + +### GetVoltage() + + +``` +IBatteryInterface::GetVoltage ([out] int voltage) +``` + +**描述:** + +获取电池的电压,单位微伏。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| voltage | 输出参数,表示电池的电压。 | + +**返回:** + +HDF_SUCCESS 表示获取成功。 + + +### Register() + + +``` +IBatteryInterface::Register ([in] IBatteryCallback event) +``` + +**描述:** + +注册电池信息的回调。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| event | 输入参数,服务注册的回调。 | + +**返回:** + +HDF_SUCCESS 表示注册成功。 + + +### UnRegister() + + +``` +IBatteryInterface::UnRegister () +``` + +**描述:** + +取消注册电池信息的回调。 + +**返回:** + +HDF_SUCCESS 表示取消注册成功。 diff --git a/zh-cn/device-dev/reference/hdi-apis/interface_i_executor.md b/zh-cn/device-dev/reference/hdi-apis/interface_i_executor.md new file mode 100644 index 0000000000000000000000000000000000000000..32a215289c1ff2bba8aaf381d61f8a6fa930a816 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/interface_i_executor.md @@ -0,0 +1,296 @@ +# IExecutor + + +## **概述** + +**所属模块:** + +[HdfFaceAuth](_hdf_face_auth.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| [GetExecutorInfo](#getexecutorinfo) ([out] struct [ExecutorInfo](_executor_info.md) executorInfo) | 获取执行器信息,人脸认证服务将执行器注册到用户认证框架时需要通过该接口获取对应信息。 [更多...](#getexecutorinfo) | +| [GetTemplateInfo](#gettemplateinfo) ([in] unsigned long templateId, [out] struct [TemplateInfo](_template_info.md) templateInfo) | 获取凭据模版信息。 [更多...](#gettemplateinfo) | +| [OnRegisterFinish](#onregisterfinish-12) ([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo) | 完成执行器注册,对人脸特征模版进行对账,用于删除无效的人脸特征模板及相关信息。 [更多...](#onregisterfinish-12) | +| [Enroll](#enroll) ([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] [IExecutorCallback](interface_i_executor_callback.md) callbackObj) | 注册人脸特征模版。 [更多...](#enroll) | +| [Authenticate](#authenticate) ([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] unsigned char[] extraInfo, [in] [IExecutorCallback](interface_i_executor_callback.md) callbackObj) | 人脸认证。 [更多...](#authenticate) | +| [Identify](#identify) ([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] [IExecutorCallback](interface_i_executor_callback.md) callbackObj) | 人脸识别。 [更多...](#identify) | +| [Delete](#delete) ([in] unsigned long[] templateIdList) | 删除人脸特征模版。 [更多...](#delete) | +| [Cancel](#cancel) ([in] unsigned long scheduleId) | 取消操作请求。 [更多...](#cancel) | +| [SendCommand](#sendcommand) ([in] int commandId, [in] unsigned char[] extraInfo, [in] [IExecutorCallback](interface_i_executor_callback.md) callbackObj) | 发送人脸认证功能相关操作命令。 [更多...](#sendcommand) | + + +## **详细描述** + +定义执行器接口,用于获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **成员函数说明** + + +### Authenticate() + + +``` +IExecutor::Authenticate ([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj ) +``` + +**描述:** + +人脸认证。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| scheduleId | 调度ID,用于标识一次操作请求的调度过程。 | +| templateIdList | 指定要认证的模版ID列表。 | +| extraInfo | 其他相关信息,用于支持信息扩展。 | +| callbackObj | 回调对象[IExecutorCallback](interface_i_executor_callback.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### Cancel() + + +``` +IExecutor::Cancel ([in] unsigned long scheduleId) +``` + +**描述:** + +取消操作请求。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| scheduleId | 调度ID,用于标识一次操作请求的调度过程。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### Delete() + + +``` +IExecutor::Delete ([in] unsigned long[] templateIdList) +``` + +**描述:** + +删除人脸特征模版。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| templateIdList | 指定要删除的模版ID列表。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### Enroll() + + +``` +IExecutor::Enroll ([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj ) +``` + +**描述:** + +注册人脸特征模版。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| scheduleId | 调度ID,用于标识一次操作请求的调度过程。 | +| extraInfo | 其他相关信息,用于支持信息扩展。 | +| callbackObj | 回调对象[IExecutorCallback](interface_i_executor_callback.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### GetExecutorInfo() + + +``` +IExecutor::GetExecutorInfo ([out] struct ExecutorInfo executorInfo) +``` + +**描述:** + +获取执行器信息,人脸认证服务将执行器注册到用户认证框架时需要通过该接口获取对应信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| executorInfo | 执行器信息[ExecutorInfo](_executor_info.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### GetTemplateInfo() + + +``` +IExecutor::GetTemplateInfo ([in] unsigned long templateId, [out] struct TemplateInfo templateInfo ) +``` + +**描述:** + +获取凭据模版信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| templateId | 凭据模版ID。 | +| templateInfo | 凭据模版信息[TemplateInfo](_template_info.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### Identify() + + +``` +IExecutor::Identify ([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj ) +``` + +**描述:** + +人脸识别。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| scheduleId | 调度ID,用于标识一次操作请求的调度过程。 | +| extraInfo | 其他相关信息,用于支持信息扩展。 | +| callbackObj | 回调对象[IExecutorCallback](interface_i_executor_callback.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### OnRegisterFinish() [1/2] + + +``` +IExecutor::OnRegisterFinish ([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo ) +``` + +**描述:** + +完成执行器注册,对人脸特征模版进行对账,用于删除无效的人脸特征模板及相关信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| templateIdList | 用户认证框架内由该执行器注册的人脸特征模版ID列表。 | +| frameworkPublicKey | 用户认证框架的公钥,用于校验用户认证框架私钥签名的信息。 | +| extraInfo | 其他相关信息,用于支持信息扩展。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### OnSetData() + + +``` +IExecutor::OnSetData ([in] unsigned long scheduleId, [in] unsigned long authSubType, [in] unsigned char[] data ) +``` + +**描述:** + +设置口令数据,口令认证驱动处理注册或认证口令请求时,如果口令数据由口令认证服务获取,需要通过该接口将口令数据传给口令认证驱动。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| scheduleId | 调度ID,用于标识一次操作请求的调度过程。 | +| authSubType | 口令子类型,如六位数字PIN码等。 | +| data | 口令数据。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### SendCommand() + + +``` +IExecutor::SendCommand ([in] int commandId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj ) +``` + +**描述:** + +发送人脸认证功能相关操作命令。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| commandId | 操作命令ID[CommandId](_hdf_pin_auth.md#commandid)。 | +| extraInfo | 其他相关信息,用于支持信息扩展。 | +| callbackObj | 回调对象[IExecutorCallback](interface_i_executor_callback.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 diff --git a/zh-cn/device-dev/reference/hdi-apis/interface_i_executor_callback.md b/zh-cn/device-dev/reference/hdi-apis/interface_i_executor_callback.md new file mode 100644 index 0000000000000000000000000000000000000000..70e9ae565dca1ee9fa562596c0966b6a48f31508 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/interface_i_executor_callback.md @@ -0,0 +1,85 @@ +# IExecutorCallback + + +## **概述** + +**所属模块:** + +[HdfFaceAuth](_hdf_face_auth.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| [OnResult](#onresult) ([in] int result, [in] unsigned char[] extraInfo) | 定义操作结果回调函数。 [更多...](#onresult) | +| [OnAcquireInfo](#onacquireinfo) ([in] int acquire, [in] unsigned char[] extraInfo) | 定义操作过程信息反馈回调函数。 [更多...](#onacquireinfo) | + + +## **详细描述** + +定义异步API接口回调,用于返回异步接口的请求处理结果和获取信息。使用细节见[IExecutor](interface_i_executor.md)。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **成员函数说明** + + +### OnAcquireInfo() + + +``` +IExecutorCallback::OnAcquireInfo ([in] int acquire, [in] unsigned char[] extraInfo ) +``` + +**描述:** + +定义操作过程信息反馈回调函数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| acquire | 提示信息编码[FaceTipsCode](_hdf_face_auth.md#facetipscode)。 | +| extraInfo | 其他相关信息,用于支持信息扩展。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### OnResult() + + +``` +IExecutorCallback::OnResult ([in] int result, [in] unsigned char[] extraInfo ) +``` + +**描述:** + +定义操作请求处理结果回调函数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| result | 操作请求处理结果。 | +| extraInfo | 其他相关信息,如用户认证通过时用于返回执行器签发的认证令牌等。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 diff --git a/zh-cn/device-dev/reference/hdi-apis/interface_i_face_auth_interface.md b/zh-cn/device-dev/reference/hdi-apis/interface_i_face_auth_interface.md new file mode 100644 index 0000000000000000000000000000000000000000..32041928f7fe5e3bbd82e4861cb8d86733d4bc7d --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/interface_i_face_auth_interface.md @@ -0,0 +1,58 @@ +# IFaceAuthInterface + + +## **概述** + +**所属模块:** + +[HdfFaceAuth](_hdf_face_auth.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| [GetExecutorList](#getexecutorlist) ([out] [IExecutor](interface_i_executor.md)[] executorList) | 获取执行器列表,人脸认证服务进程启动进行初始化操作时通过该接口获取人脸认证驱动支持的执行器列表。 [更多...](#getexecutorlist) | + + +## **详细描述** + +定义获取人脸认证驱动的执行器列表接口。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **成员函数说明** + + +### GetExecutorList() + + +``` +IFaceAuthInterface::GetExecutorList ([out] IExecutor[] executorList) +``` + +**描述:** + +获取执行器列表,人脸认证服务进程启动进行初始化操作时通过该接口获取人脸认证驱动支持的执行器列表。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| executorList | 执行器对象列表[IExecutor](interface_i_executor.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 diff --git a/zh-cn/device-dev/reference/hdi-apis/interface_i_pin_auth_interface.md b/zh-cn/device-dev/reference/hdi-apis/interface_i_pin_auth_interface.md new file mode 100644 index 0000000000000000000000000000000000000000..bff63979bde1291b904a3530fcb2a8e0df0b1bdd --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/interface_i_pin_auth_interface.md @@ -0,0 +1,58 @@ +# IPinAuthInterface + + +## **概述** + +**所属模块:** + +[HdfPinAuth](_hdf_pin_auth.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| [GetExecutorList](#getexecutorlist) ([out] [IExecutor](interface_i_executor.md)[] executorList) | 获取执行器列表,口令认证服务进程启动进行初始化操作时通过该接口获取口令认证驱动支持的执行器列表。 [更多...](#getexecutorlist) | + + +## **详细描述** + +定义获取口令认证驱动的执行器列表接口。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **成员函数说明** + + +### GetExecutorList() + + +``` +IPinAuthInterface::GetExecutorList ([out] IExecutor[] executorList) +``` + +**描述:** + +获取执行器列表,口令认证服务进程启动进行初始化操作时通过该接口获取口令认证驱动支持的执行器列表。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| executorList | 执行器对象列表[IExecutor](interface_i_executor.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 diff --git a/zh-cn/device-dev/reference/hdi-apis/interface_i_power_hdi_callback.md b/zh-cn/device-dev/reference/hdi-apis/interface_i_power_hdi_callback.md new file mode 100644 index 0000000000000000000000000000000000000000..993bd9ed6101f16f848009998b1088adb9a1f655 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/interface_i_power_hdi_callback.md @@ -0,0 +1,61 @@ +# IPowerHdiCallback + + +## **概述** + +**所属模块:** + +[Power](power.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| [OnSuspend](#onsuspend) () | 休眠状态的回调方法。 [更多...](#onsuspend) | +| [OnWakeup](#onwakeup) () | 唤醒状态的回调方法。 [更多...](#onwakeup) | + + +## **详细描述** + +休眠/唤醒状态的回调。 + +服务创建此回调对象后,可以调用IPowerInterface的接口注册回调,从而订阅休眠/唤醒状态的变化。 + +**Since:** + +3.1 + + +## **成员函数说明** + + +### OnSuspend() + + +``` +IPowerHdiCallback::OnSuspend () +``` + +**描述:** + +休眠状态的回调方法。 + +当设备进入休眠状态时,将通过此方法通知给服务。 + + +### OnWakeup() + + +``` +IPowerHdiCallback::OnWakeup () +``` + +**描述:** + +唤醒状态的回调方法。 + +当设备进入唤醒状态时,将通过此方法通知给服务。 diff --git a/zh-cn/device-dev/reference/hdi-apis/interface_i_power_interface.md b/zh-cn/device-dev/reference/hdi-apis/interface_i_power_interface.md new file mode 100644 index 0000000000000000000000000000000000000000..73d549879069aba5d3d0b90d89cc12631fda7d41 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/interface_i_power_interface.md @@ -0,0 +1,178 @@ +# IPowerInterface + + +## **概述** + +**所属模块:** + +[Power](power.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| [RegisterCallback](#registercallback) ([in] [IPowerHdiCallback](interface_i_power_hdi_callback.md) ipowerHdiCallback) | 注册休眠/唤醒状态的回调。 [更多...](#registercallback) | +| [StartSuspend](#startsuspend) () | 执行设备休眠操作。 [更多...](#startsuspend) | +| [StopSuspend](#stopsuspend) () | 执行设备唤醒操作。 [更多...](#stopsuspend) | +| [ForceSuspend](#forcesuspend) () | 执行设备强制休眠操作。 [更多...](#forcesuspend) | +| [SuspendBlock](#suspendblock) ([in] String name) | 打开运行锁,阻止休眠。 [更多...](#suspendblock) | +| [SuspendUnblock](#suspendunblock) ([in] String name) | 关闭运行锁,取消阻止休眠。 [更多...](#suspendunblock) | +| [PowerDump](#powerdump) ([out] String info) | 获取电源的Dump信息。 [更多...](#powerdump) | + + +## **详细描述** + +休眠/唤醒操作、订阅休眠/唤醒状态、运行锁管理的接口。 + +服务获取此对象后,可以调用相关的接口对设备进行休眠/唤醒、订阅休眠/唤醒状态和管理运行锁。 + +**Since:** + +3.1 + + +## **成员函数说明** + + +### ForceSuspend() + + +``` +IPowerInterface::ForceSuspend () +``` + +**描述:** + +执行设备强制休眠操作。 + +**返回:** + +HDF_SUCCESS 表示操作成功。 + + +### PowerDump() + + +``` +IPowerInterface::PowerDump ([out] String info) +``` + +**描述:** + +获取电源的Dump信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| info | 输出参数,电源的Dump信息。 | + +**返回:** + +HDF_SUCCESS 表示操作成功。 + + +### RegisterCallback() + + +``` +IPowerInterface::RegisterCallback ([in] IPowerHdiCallback ipowerHdiCallback) +``` + +**描述:** + +注册休眠/唤醒状态的回调。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| ipowerHdiCallback | 输入参数,服务注册的回调。 | + +**返回:** + +HDF_SUCCESS 表示注册成功。 + +**参见:** + +[IPowerHdiCallback](interface_i_power_hdi_callback.md) + + +### StartSuspend() + + +``` +IPowerInterface::StartSuspend () +``` + +**描述:** + +执行设备休眠操作。 + +**返回:** + +HDF_SUCCESS 表示操作成功。 + + +### StopSuspend() + + +``` +IPowerInterface::StopSuspend () +``` + +**描述:** + +执行设备唤醒操作。 + +**返回:** + +HDF_SUCCESS 表示操作成功。 + + +### SuspendBlock() + + +``` +IPowerInterface::SuspendBlock ([in] String name) +``` + +**描述:** + +打开运行锁,阻止休眠。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| name | 输入参数,运行锁的名称。 | + +**返回:** + +HDF_SUCCESS 表示操作成功。 + + +### SuspendUnblock() + + +``` +IPowerInterface::SuspendUnblock ([in] String name) +``` + +**描述:** + +关闭运行锁,取消阻止休眠。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| name | 输入参数,运行锁的名称。 | + +**返回:** + +HDF_SUCCESS 表示操作成功。 diff --git a/zh-cn/device-dev/reference/hdi-apis/interface_i_thermal_callback.md b/zh-cn/device-dev/reference/hdi-apis/interface_i_thermal_callback.md new file mode 100644 index 0000000000000000000000000000000000000000..b713dbcc70868b061dd239f2b0527d8c3e1652e6 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/interface_i_thermal_callback.md @@ -0,0 +1,56 @@ +# IThermalCallback + + +## **概述** + +**所属模块:** + +[Thermal](thermal.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| [OnThermalDataEvent](#onthermaldataevent) ([in] struct [HdfThermalCallbackInfo](_hdf_thermal_callback_info.md) event) | 设备发热状态变化的回调方法。 [更多...](#onthermaldataevent) | + + +## **详细描述** + +订阅设备发热状态的回调。 + +服务创建此回调对象后,可以调用IThermalInterface的接口注册回调,从而订阅设备发热状态的变化。 + +**Since:** + +3.1 + + +## **成员函数说明** + + +### OnThermalDataEvent() + + +``` +IThermalCallback::OnThermalDataEvent ([in] struct HdfThermalCallbackInfo event) +``` + +**描述:** + +设备发热状态变化的回调方法。 + +当设备发热状态发生变化时,将通过此方法的参数返回给服务。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| event | 输入参数,设备发热信息,包括器件类型、器件温度。 | + +**参见:** + +[HdfThermalCallbackInfo](_hdf_thermal_callback_info.md) diff --git a/zh-cn/device-dev/reference/hdi-apis/interface_i_thermal_interface.md b/zh-cn/device-dev/reference/hdi-apis/interface_i_thermal_interface.md new file mode 100644 index 0000000000000000000000000000000000000000..cffe822befa71b155d2095b34d79894ae12bbb08 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/interface_i_thermal_interface.md @@ -0,0 +1,171 @@ +# IThermalInterface + + +## **概述** + +**所属模块:** + +[Thermal](thermal.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| [SetCpuFreq](#setcpufreq) ([in] int freq) | 设置CPU频率。 [更多...](#setcpufreq) | +| [SetGpuFreq](#setgpufreq) ([in] int freq) | 设置GPU频率。 [更多...](#setgpufreq) | +| [SetBatteryCurrent](#setbatterycurrent) ([in] int current) | 设置充电电流。 [更多...](#setbatterycurrent) | +| [GetThermalZoneInfo](#getthermalzoneinfo) ([out] struct [HdfThermalCallbackInfo](_hdf_thermal_callback_info.md) event) | 获取设备发热的信息。 [更多...](#getthermalzoneinfo) | +| [Register](#register) ([in] [IThermalCallback](interface_i_thermal_callback.md) callbackObj) | 注册设备发热状态的回调。 [更多...](#register) | +| [Unregister](#unregister) () | 取消注册设备发热状态的回调。 [更多...](#unregister) | + + +## **详细描述** + +设备温度管理、控制及订阅接口。 + +服务获取此对象后,可以调用相关的接口管理、控制和订阅设备温度。 + +**Since:** + +3.1 + + +## **成员函数说明** + + +### GetThermalZoneInfo() + + +``` +IThermalInterface::GetThermalZoneInfo ([out] struct HdfThermalCallbackInfo event) +``` + +**描述:** + +获取设备发热的信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| event | 输出参数,设备发热信息,包括器件类型、器件温度。 | + +**返回:** + +HDF_SUCCESS 表示获取成功。 + +**参见:** + +[HdfThermalCallbackInfo](_hdf_thermal_callback_info.md) + + +### Register() + + +``` +IThermalInterface::Register ([in] IThermalCallback callbackObj) +``` + +**描述:** + +注册设备发热状态的回调。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| callbackObj | 输入参数,服务注册的回调。 | + +**返回:** + +HDF_SUCCESS 表示注册成功。 + +**参见:** + +[IThermalCallback](interface_i_thermal_callback.md) + + +### SetBatteryCurrent() + + +``` +IThermalInterface::SetBatteryCurrent ([in] int current) +``` + +**描述:** + +设置充电电流。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| current | 输入参数,充电电流,单位毫安。 | + +**返回:** + +HDF_SUCCESS 表示设置成功 + + +### SetCpuFreq() + + +``` +IThermalInterface::SetCpuFreq ([in] int freq) +``` + +**描述:** + +设置CPU频率。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| freq | 输入参数,设置CPU频率的值。 | + +**返回:** + +HDF_SUCCESS 表示设置成功。 + + +### SetGpuFreq() + + +``` +IThermalInterface::SetGpuFreq ([in] int freq) +``` + +**描述:** + +设置GPU频率。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| freq | 输入参数,设置GPU频率的值。 | + +**返回:** + +HDF_SUCCESS 表示设置成功。 + + +### Unregister() + + +``` +IThermalInterface::Unregister () +``` + +**描述:** + +取消注册设备发热状态的回调。 + +**返回:** + +HDF_SUCCESS 表示取消注册成功。 diff --git a/zh-cn/device-dev/reference/hdi-apis/interface_i_user_auth_interface.md b/zh-cn/device-dev/reference/hdi-apis/interface_i_user_auth_interface.md new file mode 100644 index 0000000000000000000000000000000000000000..ab757df9914cb17004229e608b7401a149b1105d --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/interface_i_user_auth_interface.md @@ -0,0 +1,587 @@ +# IUserAuthInterface + + +## **概述** + +**所属模块:** + +[HdfUserAuth](_hdf_user_auth.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| [Init](#init) () | 初始化用户认证驱动缓存信息,用于用户认证框架进程启动时初始化信息。 [更多...](#init) | +| [AddExecutor](#addexecutor) ([in] struct [ExecutorRegisterInfo](_executor_register_info.md) info, [out] unsigned long index, [out] unsigned char[] publicKey, [out] unsigned long[] templateIds) | 添加认证执行器来获取认证能力,用于各认证基础服务如口令认证服务等将认证能力对接到用户认证框架。 [更多...](#addexecutor) | +| [DeleteExecutor](#deleteexecutor) ([in] unsigned long index) | 删除执行器,用于清理失效的执行器信息。 [更多...](#deleteexecutor) | +| [OpenSession](#opensession) ([in] int userId, [out] unsigned char[] challenge) | 开启一个认证凭据管理会话,用于在请求管理用户认证凭据前获取有效挑战值。 [更多...](#opensession) | +| [CloseSession](#closesession) ([in] int userId) | 关闭认证凭据管理会话,完成用户认证凭据管理请求处理后,调用该接口使原挑战值失效。 [更多...](#closesession) | +| [BeginEnrollment](#beginenrollment) ([in] int userId, [in] unsigned char[] authToken, [in] struct [EnrollParam](_enroll_param.md) param, [out] struct [ScheduleInfo](_schedule_info.md) info) | 开始注册用户认证凭据。当注册凭据类型为口令且该用户已经注册了口令凭据时,将会更新口令凭据。 [更多...](#beginenrollment) | +| [UpdateEnrollmentResult](#updateenrollmentresult) ([in] int userId, [in] unsigned char[] scheduleResult, [out] unsigned long credentialId, [out] struct [CredentialInfo](_credential_info.md) oldInfo) | 更新用户凭据注册结果,完成凭据注册。 [更多...](#updateenrollmentresult) | +| [CancelEnrollment](#cancelenrollment) ([in] int userId) | 取消注册请求。 [更多...](#cancelenrollment) | +| [DeleteCredential](#deletecredential) ([in] int userId, [in] unsigned long credentialId, [in] unsigned char[] authToken, [out] struct [CredentialInfo](_credential_info.md) info) | 删除用户凭据信息。 [更多...](#deletecredential) | +| [GetCredential](#getcredential) ([in] int userId, [in] enum [AuthType](_hdf_face_auth.md#authtype) authType, [out] struct [CredentialInfo](_credential_info.md)[] infos) | 查询用户凭据信息。 [更多...](#getcredential) | +| [GetUserInfo](#getuserinfo) ([in] int userId, [out] unsigned long secureUid, [out] enum PinSubType pinSubType, [out] struct [EnrolledInfo](_enrolled_info.md)[] infos) | 查询用户认证相关信息。 [更多...](#getuserinfo) | +| [DeleteUser](#deleteuser) ([in] int userId, [in] unsigned char[] authToken, [out] struct [CredentialInfo](_credential_info.md)[] deletedInfos) | 删除用户口令认证凭据,在用户IAM系统内删除该用户,该请求由用户触发。 [更多...](#deleteuser) | +| [EnforceDeleteUser](#enforcedeleteuser) ([in] int userId, [out] struct [CredentialInfo](_credential_info.md)[] deletedInfos) | 强制删除用户,该请求由系统内管理用户的模块触发。 [更多...](#enforcedeleteuser) | +| [BeginAuthentication](#beginauthentication) ([in] unsigned long contextId, [in] struct [AuthSolution](_auth_solution.md) param, [out] struct [ScheduleInfo](_schedule_info.md)[] scheduleInfos) | 开始认证用户,并生成认证方案。 [更多...](#beginauthentication) | +| [UpdateAuthenticationResult](#updateauthenticationresult) ([in] unsigned long contextId, [in] unsigned char[] scheduleResult, [out] struct [AuthResultInfo](_auth_result_info.md) info) | 更新认证结果,评估认证方案的认证结果。 [更多...](#updateauthenticationresult) | +| [CancelAuthentication](#cancelauthentication) ([in] unsigned long contextId) | 取消用户认证请求。 [更多...](#cancelauthentication) | +| [BeginIdentification](#beginidentification) ([in] unsigned long contextId, [in] enum [AuthType](_hdf_face_auth.md#authtype) authType, [in] unsigned char[] challenge, [in] unsigned int executorSensorHint, [out] struct [ScheduleInfo](_schedule_info.md) scheduleInfo) | 开始用户身份识别,并生成识别方案。 [更多...](#beginidentification) | +| [UpdateIdentificationResult](#updateidentificationresult) ([in] unsigned long contextId, [in] unsigned char[] scheduleResult, [out] struct [IdentifyResultInfo](_identify_result_info.md) info) | 更新用户身份识别结果,生成身份识别方案的结果。 [更多...](#updateidentificationresult) | +| [CancelIdentification](#cancelidentification) ([in] unsigned long contextId) | 取消用户身份识别请求。 [更多...](#cancelidentification) | +| [GetAuthTrustLevel](#getauthtrustlevel) ([in] GetUserInfoint userId, [in] enum [AuthType](_hdf_face_auth.md#authtype) authType, [out] unsigned int authTrustLevel) | 获取当前认证类型的认证结果可信等级。 [更多...](#getauthtrustlevel) | +| [GetValidSolution](#getvalidsolution) ([in] int userId, [in] enum [AuthType](_hdf_face_auth.md#authtype)[] authTypes, [in] unsigned int authTrustLevel, [out] enum [AuthType](_hdf_face_auth.md#authtype)[] validTypes) | 获取指定认证结果可信等级下有效的认证方式。 [更多...](#getvalidsolution) | + + +## **详细描述** + +声明用户认证驱动的API接口。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **成员函数说明** + + +### AddExecutor() + + +``` +IUserAuthInterface::AddExecutor ([in] struct ExecutorRegisterInfo info, [out] unsigned long index, [out] unsigned char[] publicKey, [out] unsigned long[] templateIds ) +``` + +**描述:** + +添加认证执行器来获取认证能力,用于各认证基础服务如口令认证服务等将认证能力对接到用户认证框架。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| info | 执行器注册信息[ExecutorRegisterInfo](_executor_register_info.md)。 | +| index | 用户认证框架的执行器索引。 | +| publicKey | 用户认证框架公钥。 | +| templateIds | 该执行器已注册的模版ID列表。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### BeginAuthentication() + + +``` +IUserAuthInterface::BeginAuthentication ([in] unsigned long contextId, [in] struct AuthSolution param, [out] struct ScheduleInfo[] scheduleInfos ) +``` + +**描述:** + +开始认证用户,并生成认证方案。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| contextId | 上下文索引。 | +| param | 认证方案[AuthSolution](_auth_solution.md)。 | +| scheduleInfos | 调度信息[ScheduleInfo](_schedule_info.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### BeginEnrollment() + + +``` +IUserAuthInterface::BeginEnrollment ([in] int userId, [in] unsigned char[] authToken, [in] struct EnrollParam param, [out] struct ScheduleInfo info ) +``` + +**描述:** + +开始注册用户认证凭据。当注册凭据类型为口令且该用户已经注册了口令凭据时,将会更新口令凭据。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| userId | 用户ID。 | +| authToken | 用户口令认证令牌。 | +| param | 注册凭据参数[EnrollParam](_enroll_param.md)。 | +| info | 调度信息[ScheduleInfo](_schedule_info.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### BeginIdentification() + + +``` +IUserAuthInterface::BeginIdentification([in] unsigned long contextId, [in] enum AuthType authType, [in] unsigned char[] challenge, [in] unsigned int executorSensorHint, [out] struct ScheduleInfo scheduleInfo) +``` + +**描述:** + +开始用户身份识别,并生成识别方案。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| contextId | 上下文索引。 | +| authType | 用户身份识别类型AuthType}。 | +| challenge | 随机挑战值,用于生成用户身份识别令牌,防止重放。 | +| executorSensorHint | 执行器传感器提示,用于找到对应认证方式的传感器。 | +| scheduleInfo | 调度信息[ScheduleInfo](_schedule_info.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### CancelAuthentication() + + +``` +IUserAuthInterface::CancelAuthentication ([in] unsigned long contextId) +``` + +**描述:** + +取消用户认证请求。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| contextId | 上下文索引。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### CancelEnrollment() + + +``` +IUserAuthInterface::CancelEnrollment ([in] int userId) +``` + +**描述:** + +取消注册请求。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| userId | 用户ID。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### CancelIdentification() + + +``` +IUserAuthInterface::CancelIdentification ([in] unsigned long contextId) +``` + +**描述:** + +取消用户身份识别请求。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| contextId | 上下文索引。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### CloseSession() + + +``` +IUserAuthInterface::CloseSession ([in] int userId) +``` + +**描述:** + +关闭认证凭据管理会话,完成用户认证凭据管理请求处理后,调用该接口使原挑战值失效。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| userId | 用户ID。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### DeleteCredential() + + +``` +IUserAuthInterface::DeleteCredential ([in] int userId, [in] unsigned long credentialId, [in] unsigned char[] authToken, [out] struct CredentialInfo info ) +``` + +**描述:** + +删除用户凭据信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| userId | 用户ID。 | +| credentialId | 凭据ID。 | +| authToken | 用户口令认证令牌。 | +| info | 删除的凭据信息[CredentialInfo](_credential_info.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### DeleteExecutor() + + +``` +IUserAuthInterface::DeleteExecutor ([in] unsigned long index) +``` + +**描述:** + +删除执行器,用于清理失效的执行器信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| index | 用户认证框架的执行器索引。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### DeleteUser() + + +``` +IUserAuthInterface::DeleteUser ([in] int userId, [in] unsigned char[] authToken, [out] struct CredentialInfo[] deletedInfos ) +``` + +**描述:** + +删除用户口令认证凭据,在用户IAM系统内删除该用户,该请求由用户触发。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| userId | 用户ID。 | +| authToken | 用户口令认证令牌。 | +| deletedInfos | 删除的凭据信息[CredentialInfo](_credential_info.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### EnforceDeleteUser() + + +``` +IUserAuthInterface::EnforceDeleteUser ([in] int userId, [out] struct CredentialInfo[] deletedInfos ) +``` + +**描述:** + +强制删除用户,该请求由系统内管理用户的模块触发。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| userId | 用户ID。 | +| deletedInfos | 删除的凭据信息[CredentialInfo](_credential_info.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### GetAuthTrustLevel() + + +``` +IUserAuthInterface::GetAuthTrustLevel ([in] int userId, [in] enum AuthType authType, [out] unsigned int authTrustLevel ) +``` + +**描述:** + +获取当前认证类型的认证结果可信等级。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| userId | 用户ID。 | +| authType | 认证类型[AuthType](_hdf_user_auth.md#authtype)。 | +| authTrustLevel | 认证结果可信等级。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### GetCredential() + + +``` +IUserAuthInterface::GetCredential ([in] int userId, [in] enum AuthType authType, [out] struct CredentialInfo[] infos ) +``` + +**描述:** + +查询用户凭据信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| userId | 用户ID。 | +| authType | 凭据类型[AuthType](_hdf_user_auth.md#authtype)。 | +| infos | 凭据信息[CredentialInfo](_credential_info.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### GetUserInfo() + + +``` +IUserAuthInterface::GetUserInfo([in] int userId, [out] unsigned long secureUid, [out] enum PinSubType pinSubType, [out] struct EnrolledInfo[] infos) +``` + +**描述:** + +查询用户认证相关信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| userId | 用户ID。 | +| secureUid | 安全用户ID。 | +| pinSubType | 口令认证子类型 {\@link PinSubType}。 | +| infos | 注册信息[EnrolledInfo](_enrolled_info.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### GetValidSolution() + + +``` +IUserAuthInterface::GetValidSolution ([in] int userId, [in] enum AuthType[] authTypes, [in] unsigned int authTrustLevel, [out] enum AuthType[] validTypes ) +``` + +**描述:** + +获取指定认证结果可信等级下有效的认证方式。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| userId | 用户ID。 | +| authTypes | 用于筛选的认证方式列表[AuthType](_hdf_user_auth.md#authtype)。 | +| authTrustLevel | 认证结果可信等级。 | +| validTypes | 有效的认证方式列表[AuthType](_hdf_user_auth.md#authtype)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### Init() + + +``` +IUserAuthInterface::Init () +``` + +**描述:** + +初始化用户认证驱动缓存信息,用于用户认证框架进程启动时初始化信息。 + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### OpenSession() + + +``` +IUserAuthInterface::OpenSession ([in] int userId, [out] unsigned char[] challenge ) +``` + +**描述:** + +开启一个认证凭据管理会话,用于在请求管理用户认证凭据前获取有效挑战值。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| userId | 用户ID。 | +| challenge | 随机挑战值,用于生成用户身份认证令牌。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### UpdateAuthenticationResult() + + +``` +IUserAuthInterface::UpdateAuthenticationResult ([in] unsigned long contextId, [in] unsigned char[] scheduleResult, [out] struct AuthResultInfo info ) +``` + +**描述:** + +更新认证结果,评估认证方案的认证结果。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| contextId | 上下文索引。 | +| scheduleResult | 执行器签发的认证结果。 | +| info | 认证结果信息[AuthResultInfo](_auth_result_info.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### UpdateEnrollmentResult() + + +``` +IUserAuthInterface::UpdateEnrollmentResult([in] int userId, [in] unsigned char[] scheduleResult, [out] struct EnrollResultInfo info) +``` + +**描述:** + +更新用户凭据注册结果,完成凭据注册。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| userId | 用户ID。 | +| scheduleResult | 执行器签发的注册结果。 | +| oldInfo | 录入结果信息[EnrollResultInfo](_enroll_resultinfo.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### UpdateIdentificationResult() + + +``` +IUserAuthInterface::UpdateIdentificationResult ([in] unsigned long contextId, [in] unsigned char[] scheduleResult, [out] struct IdentifyResultInfo info ) +``` + +**描述:** + +更新用户身份识别结果,生成身份识别方案的结果。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| contextId | 上下文索引。 | +| scheduleResult | 执行器签发的用户身份识别结果。 | +| info | 用户身份识别结果[IdentifyResultInfo](_identify_result_info.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 diff --git a/zh-cn/device-dev/reference/hdi-apis/interface_pin_i_executor.md b/zh-cn/device-dev/reference/hdi-apis/interface_pin_i_executor.md new file mode 100644 index 0000000000000000000000000000000000000000..84471c4498b59fbad7a9964b47ef70bc196f52c9 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/interface_pin_i_executor.md @@ -0,0 +1,270 @@ +# IExecutor + + +## **概述** + +**所属模块:** + +[HdfPinAuth](_hdf_pin_auth.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| [GetTemplateInfo](interface_i_executor.md#gettemplateinfo) ([in] unsigned long templateId, [out] struct [TemplateInfo](_template_info.md) templateInfo) | 获取凭据模版信息。 [更多...](interface_i_executor.md#gettemplateinfo) | +| [Cancel](interface_i_executor.md#cancel) ([in] unsigned long scheduleId) | 取消操作请求。 [更多...](interface_i_executor.md#cancel) | +| [h2GetExecutorInfo](#getexecutorinfo) ([out] struct [ExecutorInfo](_executor_info.md) executorInfo) | 获取执行器信息,口令认证服务将执行器注册到用户认证框架时需要通过该接口获取对应信息。 [更多...](#getexecutorinfo) | +| [OnRegisterFinish](#onregisterfinish) ([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo) | 完成执行器注册,对口令模版信息进行对账,用于删除无效的口令模板及相关信息。 [更多...](#onregisterfinish) | +| [OnSetData](interface_i_executor.md#onsetdata) ([in] unsigned long scheduleId, [in] unsigned long authSubType, [in] unsigned char[] data) | 设置口令数据,口令认证驱动处理注册或认证口令请求时,如果口令数据由口令认证服务获取,需要通过该接口将口令数据传给口令认证驱动。 [更多...](interface_i_executor.md#onsetdata) | +| [Enroll](#enroll) ([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] [IExecutorCallback](interface_i_executor_callback.md) callbackObj) | 注册口令。 [更多...](#enroll) | +| [Authenticate](#authenticate) ([in] unsigned long scheduleId, [in] unsigned long templateId, [in] unsigned char[] extraInfo, [in] [IExecutorCallback](interface_i_executor_callback.md) callbackObj) | 认证口令。 [ERROR:Invalid link:zh-cn_topic_0000001304382272.xml#xref15713627408,link:zh-cn_topic_0000001304382272.xml](zh-cn_topic_0000001304382272.xml) | +| [Delete](#delete) ([in] unsigned long templateId) | 删除口令。 [更多...](#delete) | +| [SendCommand](#sendcommand) ([in] int commandId, [in] unsigned char[] extraInfo, [in] [IExecutorCallback](interface_i_executor_callback.md) callbackObj) | 发送口令认证功能相关操作命令。 [更多...](#sendcommand) | + + +## **详细描述** + +定义执行器标准API接口。接口可用于获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **成员函数说明** + + +### Authenticate() + + +``` +IExecutor::Authenticate ([in] unsigned long scheduleId, [in] unsigned long templateId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj ) +``` + +**描述:** + +认证口令。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| scheduleId | 调度ID,用于标识一次操作请求的调度过程。 | +| templateId | 指定要认证的模版ID。 | +| extraInfo | 其他相关信息,用于支持信息扩展。 | +| callbackObj | 回调对象[IExecutorCallback](interface_i_executor_callback.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### Cancel() + + +``` +IExecutor::Cancel ([in] unsigned long scheduleId) +``` + +**描述:** + +取消操作请求。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| scheduleId | 调度ID,用于标识一次操作请求的调度过程。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### Delete() + + +``` +IExecutor::Delete ([in] unsigned long templateId) +``` + +**描述:** + +删除口令。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| templateId | 模版ID。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### Enroll() + + +``` +IExecutor::Enroll ([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj ) +``` + +**描述:** + +注册口令。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| scheduleId | 调度ID,用于标识一次操作请求的调度过程。 | +| extraInfo | 其他相关信息,用于支持信息扩展。 | +| callbackObj | 回调对象[IExecutorCallback](interface_i_executor_callback.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### GetExecutorInfo() + + +``` +IExecutor::GetExecutorInfo ([out] struct ExecutorInfo executorInfo) +``` + +**描述:** + +获取执行器信息,口令认证服务将执行器注册到用户认证框架时需要通过该接口获取对应信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| executorInfo | 执行器信息[ExecutorInfo](_executor_info.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### GetTemplateInfo() + + +``` +IExecutor::GetTemplateInfo ([in] unsigned long templateId, [out] struct TemplateInfo templateInfo ) +``` + +**描述:** + +获取凭据模版信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| templateId | 凭据模版ID。 | +| templateInfo | 凭据模版信息[TemplateInfo](_template_info.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### OnRegisterFinish() + + +``` +IExecutor::OnRegisterFinish ([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo ) +``` + +**描述:** + +完成执行器注册,对口令模版信息进行对账,用于删除无效的口令模板及相关信息。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| templateIdList | 用户认证框架内由该执行器注册的口令凭据模版ID列表。 | +| frameworkPublicKey | 用户认证框架的公钥,用于校验用户认证框架私钥签名的信息。 | +| extraInfo | 其他相关信息,用于支持信息扩展。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### OnSetData() + + +``` +IExecutor::OnSetData ([in] unsigned long scheduleId, [in] unsigned long authSubType, [in] unsigned char[] data ) +``` + +**描述:** + +设置口令数据,口令认证驱动处理注册或认证口令请求时,如果口令数据由口令认证服务获取,需要通过该接口将口令数据传给口令认证驱动。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| scheduleId | 调度ID,用于标识一次操作请求的调度过程。 | +| authSubType | 口令子类型,如六位数字PIN码等。 | +| data | 口令数据。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### SendCommand() + + +``` +IExecutor::SendCommand ([in] int commandId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj ) +``` + +**描述:** + +发送口令认证功能相关操作命令。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| commandId | 操作命令ID[CommandId](_hdf_pin_auth.md#commandid)。 | +| extraInfo | 其他相关信息,用于支持信息扩展。 | +| callbackObj | 回调对象[IExecutorCallback](interface_i_executor_callback.md)。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 diff --git a/zh-cn/device-dev/reference/hdi-apis/interface_pin_i_executor_callback.md b/zh-cn/device-dev/reference/hdi-apis/interface_pin_i_executor_callback.md new file mode 100644 index 0000000000000000000000000000000000000000..afa114d1d6713248b831ebbca7933c13e947da39 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/interface_pin_i_executor_callback.md @@ -0,0 +1,85 @@ +# IExecutorCallback + + +## **概述** + +**所属模块:** + +[HdfPinAuth](_hdf_pin_auth.md) + + +## **汇总** + + +### Public 成员函数 + + | Public 成员函数 | 描述 | +| -------- | -------- | +| [OnResult](interface_i_executor_callback.md#onresult) ([in] int result, [in] unsigned char[] extraInfo) | 定义操作结果回调函数。 [更多...](interface_i_executor_callback.md#onresult) | +| [OnGetData](#ongetdata) ([in] unsigned long scheduleId, [in] unsigned char[] salt, [in] unsigned long authSubType) | 定义请求获取口令数据回调函数。 [更多...](#ongetdata) | + + +## **详细描述** + +定义异步API接口回调,用于返回异步接口的请求处理结果和获取信息。使用细节见[IExecutor](interface_i_executor.md)。 + +**Since:** + +3.2 + +**Version:** + +1.0 + + +## **成员函数说明** + + +### OnGetData() + + +``` +IExecutorCallback::OnGetData ([in] unsigned long scheduleId, [in] unsigned char[] salt, [in] unsigned long authSubType ) +``` + +**描述:** + +定义请求获取口令数据回调函数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| salt | 盐值,用于对口令明文进行单向处理。 | +| authSubType | 口令子类型,如六位数字PIN码等。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 + + +### OnResult() + + +``` +IExecutorCallback::OnResult ([in] int result, [in] unsigned char[] extraInfo ) +``` + +**描述:** + +定义操作请求处理结果回调函数。 + +**参数:** + + | 名称 | 描述 | +| -------- | -------- | +| result | 操作请求处理结果。 | +| extraInfo | 其他相关信息,如用户认证通过时用于返回执行器签发的认证令牌等。 | + +**返回:** + +0 表示操作成功。 + +非0 表示操作失败。 diff --git a/zh-cn/device-dev/reference/hdi-apis/ioffline__stream__operator_8h.md b/zh-cn/device-dev/reference/hdi-apis/ioffline__stream__operator_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..0a593960df15b13fa7993604729fe44d422f52a7 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/ioffline__stream__operator_8h.md @@ -0,0 +1,31 @@ +# ioffline_stream_operator.h + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [OHOS::Camera::IOfflineStreamOperator](_o_h_o_s_1_1_camera_1_1_i_offline_stream_operator.md) | 离线流的操作类。 | + + +## **详细描述** + +离线流的操作接口。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/istream__operator_8h.md b/zh-cn/device-dev/reference/hdi-apis/istream__operator_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..a051ce63222611aef21f4be9f21e1c972b6468ba --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/istream__operator_8h.md @@ -0,0 +1,31 @@ +# istream_operator.h + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [OHOS::Camera::IStreamOperator](_o_h_o_s_1_1_camera_1_1_i_stream_operator.md) | 流的操作类。 | + + +## **详细描述** + +流的操作接口。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/istream__operator__callback_8h.md b/zh-cn/device-dev/reference/hdi-apis/istream__operator__callback_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..79f5e3d8b480e208e732160c760498ea84515517 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/istream__operator__callback_8h.md @@ -0,0 +1,31 @@ +# istream_operator_callback.h + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [OHOS::Camera::IStreamOperatorCallback](_o_h_o_s_1_1_camera_1_1_i_stream_operator_callback.md) | 流的操作回调类。 | + + +## **详细描述** + +[IStreamOperator](istream__operator_8h.md) 相关的回调,这些回调均由调用者实现。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/light_8typeh.md b/zh-cn/device-dev/reference/hdi-apis/light_8typeh.md new file mode 100644 index 0000000000000000000000000000000000000000..768205451b405ea57d0669c318814a7bfc95c78b --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/light_8typeh.md @@ -0,0 +1,29 @@ +# light_type.h + + +## **概述** + +**所属模块:** + +[Light](_light.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| LightFlashEffect | 定义闪烁参数。 [更多...](_light_flash_effect.md) | +| LightEffect | 定义灯的效果参数。 [更多...](_light_effect.md) | +| LightInfo | 定义灯的基本信息。 [更多...](_light_info.md) | + + +## **详细描述** + +声明light模块的通用API,可用于获取灯ID、打开或关闭灯、并设置灯光亮度和闪烁模式。 + +**Since:** + +3.1 diff --git a/zh-cn/device-dev/reference/hdi-apis/light__if_8h.md b/zh-cn/device-dev/reference/hdi-apis/light__if_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..a48fb26211d38edd1dc8bc3485ec5544be732517 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/light__if_8h.md @@ -0,0 +1,35 @@ +# light_if.h + + +## **概述** + +**所属模块:** + +[Light](_light.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [LightInterface](_light_interface.md) | 定义可以在灯上执行的基本操作。 [更多...](_light_interface.md) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [NewLightInterfaceInstance](_light.md#newlightinterfaceinstance) (void) | 创建LightInterface实例。 [更多...](_light.md#newlightinterfaceinstance) | +| [FreeLightInterfaceInstance](_light.md#freelightinterfaceinstance) (void) | 释放LightInterface实例和相关资源。 [更多...](_light.md#freelightinterfaceinstance) | + + +## **详细描述** + +声明light模块的通用API,可用于获取灯ID、打开或关闭灯、并设置灯光亮度和闪烁模式。 + +**Sinc[更多...](_light_flash_effect.md)e更多...[更多...](_light_info.md):** + +3.1 diff --git a/zh-cn/device-dev/reference/hdi-apis/pin__auth_2_i_executor_8idl.md b/zh-cn/device-dev/reference/hdi-apis/pin__auth_2_i_executor_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..66e82d37d3a46c2dc7df4bd8f44638bc0e7bf1b5 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/pin__auth_2_i_executor_8idl.md @@ -0,0 +1,34 @@ +# IExecutor.idl + + +## **概述** + +**所属模块:** + +[HdfPinAuth](_hdf_pin_auth.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IExecutor](interface_i_executor.md) | 定义执行器接口,用于获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 [更多...](interface_i_executor.md) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.pin_auth.v1_0 | 口令认证接口的包路径 | + + +## **详细描述** + +定义执行器标准API接口。接口可用于获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 + +**Since:** + +3.2 diff --git a/zh-cn/device-dev/reference/hdi-apis/pin__auth_2_i_executor_callback_8idl.md b/zh-cn/device-dev/reference/hdi-apis/pin__auth_2_i_executor_callback_8idl.md new file mode 100644 index 0000000000000000000000000000000000000000..39258b4678e9d90ce337c0a3ccef4ad97f7af148 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/pin__auth_2_i_executor_callback_8idl.md @@ -0,0 +1,38 @@ +# IExecutorCallback.idl + + +## **概述** + +**所属模块:** + +[HdfPinAuth](_hdf_pin_auth.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IExecutorCallback](interface_i_executor_callback.md) | 定义异步API接口回调,用于返回异步接口的请求处理结果和信息。使用细节见[IExecutor](interface_i_executor.md)。 [更多...](interface_i_executor_callback.md) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.pin_auth.v1_0 | 口令认证接口的包路径 | + + +## **详细描述** + +定义异步API接口回调,用于返回异步接口的请求处理结果和获取信息。使用细节见[IExecutor](interface_i_executor.md)。 + +**Since:** + +3.2 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/power.md b/zh-cn/device-dev/reference/hdi-apis/power.md new file mode 100644 index 0000000000000000000000000000000000000000..2ce105c12d28d9579ab2b3ad6eefbf186588e312 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/power.md @@ -0,0 +1,112 @@ +# Power + + +## **汇总** + + +### 文件 + + | 文件 | 描述 | +| -------- | -------- | +| [IPowerHdiCallback.idl](_i_power_hdi_callback_8idl.md) | 休眠/唤醒状态的回调。 | +| [IPowerInterface.idl](_i_power_interface_8idl.md) | 休眠/唤醒操作、订阅休眠/唤醒状态、运行锁管理的接口。 | +| [PowerTypes.idl](_power_types_8idl.md) | 电源相关的数据类型。 | + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IPowerHdiCallback](interface_i_power_hdi_callback.md) | 休眠/唤醒状态的回调。 [更多...](interface_i_power_hdi_callback.md) | +| [IPowerInterface](interface_i_power_interface.md) | 休眠/唤醒操作、订阅休眠/唤醒状态、运行锁管理的接口。 [更多...](interface_i_power_interface.md) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [PowerHdfCmd](#powerhdfcmd) {   CMD_REGISTER_CALLBCK = 0, CMD_START_SUSPEND, CMD_STOP_SUSPEND, CMD_FORCE_SUSPEND,   CMD_SUSPEND_BLOCK, CMD_SUSPEND_UNBLOCK, CMD_DUMP } | 枚举电源命令的参数。 [更多...](#powerhdfcmd) | +| [PowerHdfCallbackCmd](#powerhdfcallbackcmd) { CMD_ON_SUSPEND = 0, CMD_ON_WAKEUP } | 枚举电源状态回调的参数。 [更多...](#powerhdfcallbackcmd) | +| [PowerHdfState](#powerhdfstate) { AWAKE = 0, INACTIVE, SLEEP } | 枚举电源的状态。 [更多...](#powerhdfstate) | + + +### 变量 + + | 变量 | 描述 | +| -------- | -------- | +| package ohos.hdi.power.v1_0 | 电源管理接口的包路径。 | + + +## **详细描述** + +提供休眠/唤醒操作、订阅休眠/唤醒状态、运行锁管理的接口。 + +电源模块为电源服务提供的休眠/唤醒操作、订阅休眠/唤醒状态和运行锁管理的接口。 服务获取此模块的对象或代理后,可以调用相关的接口对设备进行休眠/唤醒、订阅休眠/唤醒状态和管理运行锁。 + +**Since:** + +3.1 + +**Version:** + +1.0 + + +## **枚举类型说明** + + +### PowerHdfCallbackCmd + + +``` +enum PowerHdfCallbackCmd +``` + +**描述:** + +枚举电源状态回调的参数。 + + | 枚举值 | 描述 | +| -------- | -------- | +| CMD_ON_SUSPEND | 休眠回调的命令参数。 | +| CMD_ON_WAKEUP | 唤醒回调的命令参数。 | + + +### PowerHdfCmd + + +``` +enum PowerHdfCmd +``` + +**描述:** + +枚举电源命令的参数。 + + | 枚举值 | 描述 | +| -------- | -------- | +| CMD_REGISTER_CALLBCK | 订阅状态的命令参数 | +| CMD_START_SUSPEND | 休眠的命令参数 | +| CMD_STOP_SUSPEND | 唤醒的命令参数 | +| CMD_FORCE_SUSPEND | 强制休眠的命令参数 | +| CMD_SUSPEND_BLOCK | 打开运行锁的命令参数 | +| CMD_SUSPEND_UNBLOCK | 关闭运行锁的命令参数 | +| CMD_DUMP | Dump的命令参数 | + + +### PowerHdfState + + +``` +enum PowerHdfState +``` + +**描述:** + +枚举电源的状态。 + + | 枚举值 | 描述 | +| -------- | -------- | +| AWAKE | 唤醒状态。 | +| INACTIVE | 非活动状态。 | +| SLEEP | 休眠状态。 | diff --git a/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-caution.gif b/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-caution.gif new file mode 100644 index 0000000000000000000000000000000000000000..6e90d7cfc2193e39e10bb58c38d01a23f045d571 Binary files /dev/null and b/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-caution.gif differ diff --git a/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-danger.gif b/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-danger.gif new file mode 100644 index 0000000000000000000000000000000000000000..6e90d7cfc2193e39e10bb58c38d01a23f045d571 Binary files /dev/null and b/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-danger.gif differ diff --git a/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-note.gif b/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-note.gif new file mode 100644 index 0000000000000000000000000000000000000000..6314297e45c1de184204098efd4814d6dc8b1cda Binary files /dev/null and b/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-note.gif differ diff --git a/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-notice.gif b/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-notice.gif new file mode 100644 index 0000000000000000000000000000000000000000..86024f61b691400bea99e5b1f506d9d9aef36e27 Binary files /dev/null and b/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-notice.gif differ diff --git a/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-tip.gif b/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-tip.gif new file mode 100644 index 0000000000000000000000000000000000000000..93aa72053b510e456b149f36a0972703ea9999b7 Binary files /dev/null and b/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-tip.gif differ diff --git a/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-warning.gif b/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-warning.gif new file mode 100644 index 0000000000000000000000000000000000000000..6e90d7cfc2193e39e10bb58c38d01a23f045d571 Binary files /dev/null and b/zh-cn/device-dev/reference/hdi-apis/public_sys-resources/icon-warning.gif differ diff --git a/zh-cn/device-dev/reference/hdi-apis/sensor__if_8h.md b/zh-cn/device-dev/reference/hdi-apis/sensor__if_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..4e575fefc013c7573bb316314180f8447eb112d4 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/sensor__if_8h.md @@ -0,0 +1,39 @@ +# sensor_if.h + + +## **概述** + +**所属模块:** + +[Sensor](_sensor.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [SensorInterface](_sensor_interface.md) | 提供sensor设备基本控制操作接口。 [更多...](_sensor_interface.md) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [NewSensorInterfaceInstance](_sensor.md#newsensorinterfaceinstance) (void) | 创建传感器接口实例。 [更多...](_sensor.md#newsensorinterfaceinstance) | +| [FreeSensorInterfaceInstance](_sensor.md#freesensorinterfaceinstance) (void) | 释放传感器接口实例。 [更多...](_sensor.md#freesensorinterfaceinstance) | + + +## **详细描述** + +Sensor模块对外通用的接口声明文件,提供获取传感器设备信息、订阅/去订阅传感器数据、 使能/去使能传感器、设置传感器模式、设置传感器精度,量程等可选配置接口定义。 + +**Since:** + +2.2 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/sensor__type_8h.md b/zh-cn/device-dev/reference/hdi-apis/sensor__type_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..35adb8935df3946a74ce804b53a713680154aedc --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/sensor__type_8h.md @@ -0,0 +1,59 @@ +# sensor_type.h + + +## **概述** + +**所属模块:** + +[Sensor](_sensor.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [SensorInformation](_sensor_information.md) | 定义传感器基本信息。 [更多...](_sensor_information.md) | +| [SensorEvents](_sensor_events.md) | 上报传感器数据结构。 [更多...](_sensor_events.md) | + + +### 宏定义 + + | 宏定义 | 描述 | +| -------- | -------- | +| [SENSOR_NAME_MAX_LEN](_sensor.md#sensornamemaxlen)   32 | Sensor名称的最大长度 | +| [SENSOR_VERSION_MAX_LEN](_sensor.md#sensorversionmaxlen)   16 | Sensor版本号的最大长度 | + + +### 类型定义 + + | 类型定义 | 描述 | +| -------- | -------- | +| ([RecordDataCallback](_sensor.md#recorddatacallback)) (const struct [SensorEvents](_sensor_events.md) \*) | 传感器上报数据回调函数的定义,传感器服务用户在订阅传感器时, 需要注册上报数据回调函数,传感器使能后,传感器服务用户可以接受到传感器数据,详见[SensorInterface](_sensor_interface.md)。 [更多...](_sensor.md#recorddatacallback) | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [SensorStatus](_sensor.md#sensorstatus) { SENSOR_SUCCESS = 0, SENSOR_FAILURE = -1, SENSOR_NOT_SUPPORT = -2, SENSOR_INVALID_PARAM = -3,   SENSOR_INVALID_SERVICE = -4, SENSOR_NULL_PTR = -5 } | 定义传感器模块返回值类型。 [更多...](_sensor.md#sensorstatus) | +| [SensorTypeTag](_sensor.md#sensortypetag) { SENSOR_TYPE_NONE = 0, SENSOR_TYPE_ACCELEROMETER = 1, SENSOR_TYPE_GYROSCOPE = 2, SENSOR_TYPE_PHOTOPLETHYSMOGRAPH = 3,   SENSOR_TYPE_ELECTROCARDIOGRAPH = 4, SENSOR_TYPE_AMBIENT_LIGHT = 5, SENSOR_TYPE_MAGNETIC_FIELD = 6, SENSOR_TYPE_CAPACITIVE = 7,   SENSOR_TYPE_BAROMETER = 8, SENSOR_TYPE_TEMPERATURE = 9, SENSOR_TYPE_HALL = 10, SENSOR_TYPE_GESTURE = 11,   SENSOR_TYPE_PROXIMITY = 12, SENSOR_TYPE_HUMIDITY = 13, SENSOR_TYPE_MEDICAL_BEGIN = 128, SENSOR_TYPE_MEDICAL_END = 160,   SENSOR_TYPE_PHYSICAL_MAX = 255, SENSOR_TYPE_ORIENTATION = 256, SENSOR_TYPE_GRAVITY = 257, SENSOR_TYPE_LINEAR_ACCELERATION = 258,   SENSOR_TYPE_ROTATION_VECTOR = 259, SENSOR_TYPE_AMBIENT_TEMPERATURE = 260, SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED = 261, SENSOR_TYPE_GAME_ROTATION_VECTOR = 262,   SENSOR_TYPE_GYROSCOPE_UNCALIBRATED = 263, SENSOR_TYPE_SIGNIFICANT_MOTION = 264, SENSOR_TYPE_PEDOMETER_DETECTION = 265, SENSOR_TYPE_PEDOMETER = 266,   SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR = 277, SENSOR_TYPE_HEART_RATE = 278, SENSOR_TYPE_DEVICE_ORIENTATION = 279, SENSOR_TYPE_WEAR_DETECTION = 280,   SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 281, SENSOR_TYPE_MAX } | 定义传感器类型标识。 [更多...](_sensor.md#sensortypetag) | +| [SensorAccuracyType](_sensor.md#sensoraccuracytype) { SENSOR_NO_ACCURACY = 0, SENSOR_LOW_ACCURACY = 1, SENSOR_MEDIUM_ACCURACY = 2, SENSOR_HIGH_ACCURACY = 3,   SENSOR_MAX_ACCURACY } | 传感器的精度类型。 [更多...](_sensor.md#sensoraccuracytype) | +| [SensorRangeType](_sensor.md#sensorrangetype) { SENSOR_RANGE_LEVEL1 = 0, SENSOR_RANGE_LEVEL2 = 1, SENSOR_RANGE_LEVEL3 = 2, SENSOR_RANGE_LEVEL_MAX } | 传感器的量程级别。 [更多...](_sensor.md#sensorrangetype) | +| [SensorModeType](_sensor.md#sensormodetype) { SENSOR_MODE_DEFAULT = 0, SENSOR_MODE_REALTIME = 1, SENSOR_MODE_ON_CHANGE = 2, SENSOR_MODE_ONE_SHOT = 3,   SENSOR_MODE_FIFO_MODE = 4, SENSOR_MODE_MAX } | 传感器的工作模式。 [更多...](_sensor.md#sensormodetype) | +| [SensorGroupType](_sensor.md#sensorgrouptype) { TRADITIONAL_SENSOR_TYPE = 0, MEDICAL_SENSOR_TYPE = 1, SENSOR_GROUP_TYPE_MAX } | 枚举传感器的硬件服务组。 [更多...](_sensor.md#sensorgrouptype) | + + +## **详细描述** + +定义传感器模块所使用的传感器类型,传感器信息,传感器数据结构等数据类型。 + +**Since:** + +2.2 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/thermal.md b/zh-cn/device-dev/reference/hdi-apis/thermal.md new file mode 100644 index 0000000000000000000000000000000000000000..d639a37e380cc8615bd0440eee3909523152865b --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/thermal.md @@ -0,0 +1,45 @@ +# Thermal + + +## **汇总** + + +### 文件 + + | 文件 | 描述 | +| -------- | -------- | +| [IThermalCallback.idl](_i_thermal_callback_8idl.md) | 设备发热状态的回调。 | +| [IThermalInterface.idl](_i_thermal_interface_8idl.md) | 设备温度管理、控制及订阅接口。 | +| [ThermalTypes.idl](_thermal_types_8idl.md) | 设备发热状态相关的数据类型。 | + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IThermalCallback](interface_i_thermal_callback.md) | 订阅设备发热状态的回调。 [更多...](interface_i_thermal_callback.md) | +| [IThermalInterface](interface_i_thermal_interface.md) | 设备温度管理、控制及订阅接口。 [更多...](interface_i_thermal_interface.md) | +| [ThermalZoneInfo](_thermal_zone_info.md) | 设备发热的信息。 [更多...](_thermal_zone_info.md) | +| [HdfThermalCallbackInfo](_hdf_thermal_callback_info.md) | 设备发热的信息列表。 [更多...](_hdf_thermal_callback_info.md) | + + +### 变量 + + | 变量 名称 | 描述 | +| -------- | -------- | +| package ohos.hdi.thermal.v1_0 | 设备温度管理接口的包路径 | + + +## **详细描述** + +提供设备温度管理、控制及订阅接口。 + +热模块为热服务提供的设备温度管理、控制及订阅接口。 服务获取此模块的对象或代理后,可以调用相关的接口管理、控制和订阅设备温度。 + +**Since:** + +3.1 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/total.md b/zh-cn/device-dev/reference/hdi-apis/total.md new file mode 100644 index 0000000000000000000000000000000000000000..bac50766065bf942c00fe3d98e89e1772b2b5087 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/total.md @@ -0,0 +1,7 @@ +# 头文件和结构体 + + + +- **[头文件](files.md)** + +- **[结构体](annotated.md)** \ No newline at end of file diff --git a/zh-cn/device-dev/reference/hdi-apis/types_8h.md b/zh-cn/device-dev/reference/hdi-apis/types_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..d464901d79c2444c7a1e1910b598dbe89cd1b8a0 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/types_8h.md @@ -0,0 +1,61 @@ +# types.h + + +## **概述** + +**所属模块:** + +[Camera](_camera.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [OHOS::Camera::StreamInfo](_o_h_o_s_1_1_camera_1_1_stream_info.md) | 流信息,用于创建流时传入相关的配置参数。 [更多...](_o_h_o_s_1_1_camera_1_1_stream_info.md) | +| [OHOS::Camera::StreamAttribute](_o_h_o_s_1_1_camera_1_1_stream_attribute.md) | 流的属性。 [更多...](_o_h_o_s_1_1_camera_1_1_stream_attribute.md) | +| [OHOS::Camera::CaptureInfo](_o_h_o_s_1_1_camera_1_1_capture_info.md) | 捕获请求的相关信息。 [更多...](_o_h_o_s_1_1_camera_1_1_capture_info.md) | +| [OHOS::Camera::CaptureEndedInfo](_o_h_o_s_1_1_camera_1_1_capture_ended_info.md) | 捕获结束相关信息,用于捕获结束回调 **OnCaptureEnded**。 [更多...](_o_h_o_s_1_1_camera_1_1_capture_ended_info.md) | +| [OHOS::Camera::CaptureErrorInfo](_o_h_o_s_1_1_camera_1_1_capture_error_info.md) | 流错误信息,用于回调 **OnCaptureError**。 [更多...](_o_h_o_s_1_1_camera_1_1_capture_error_info.md) | + + +### 类型定义 + + | 类型定义 | 描述 | +| -------- | -------- | +| **OHOS::Camera::CameraAbility** = CameraMetadata | Camera设备能力集合。 | +| **OHOS::Camera::CameraSetting** = CameraMetadata | Camera设置参数,包括sensor帧率,3A相关参数等。 | +| **OHOS::Camera::MetaType** = int32_t | 整型。 | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [OHOS::Camera::CamRetCode](_camera.md#camretcode) : int32_t {   OHOS::Camera::NO_ERROR = 0, OHOS::Camera::CAMERA_BUSY = -1, OHOS::Camera::INSUFFICIENT_RESOURCES = -2, OHOS::Camera::INVALID_ARGUMENT = -3,   OHOS::Camera::METHOD_NOT_SUPPORTED = -4, OHOS::Camera::CAMERA_CLOSED = -5, OHOS::Camera::DEVICE_ERROR = -6 } | HDI接口的返回值。 [更多...](_camera.md#camretcode) | +| [OHOS::Camera::ResultCallbackMode](_camera.md#resultcallbackmode) : int32_t { OHOS::Camera::PER_FRAME, OHOS::Camera::ON_CHANGED } | metadata的上报模式。 [更多...](_camera.md#resultcallbackmode) | +| [OHOS::Camera::OperationMode](_camera.md#operationmode) : int32_t { OHOS::Camera::NORMAL = 0 } | 流的使用模式。 [更多...](_camera.md#operationmode) | +| [OHOS::Camera::StreamIntent](_camera.md#streamintent) : int32_t {   OHOS::Camera::PREVIEW = 0, OHOS::Camera::VIDEO = 1, OHOS::Camera::STILL_CAPTURE = 2, OHOS::Camera::POST_VIEW = 3,   OHOS::Camera::ANALYZE = 4, OHOS::Camera::CUSTOM = 5 } | 流的类型。 [更多...](_camera.md#streamintent) | +| [OHOS::Camera::EncodeType](_camera.md#encodetype) : int32_t { OHOS::Camera::ENCODE_TYPE_NULL = 0, OHOS::Camera::ENCODE_TYPE_H264 = 1, OHOS::Camera::ENCODE_TYPE_H265 = 2, OHOS::Camera::ENCODE_TYPE_JPEG = 3 } | 流数据的编码类型。 [更多...](_camera.md#encodetype) | +| [OHOS::Camera::StreamSupportType](_camera.md#streamsupporttype) : int32_t { OHOS::Camera::DYNAMIC_SUPPORTED, OHOS::Camera::RE_CONFIGURED_REQUIRED, OHOS::Camera::NOT_SUPPORTED } | 动态配置流的切换方式,使用场景参考 [IsStreamsSupported](_camera.md#isstreamssupported) 。 [更多...](_camera.md#streamsupporttype) | +| [OHOS::Camera::CameraStatus](_camera.md#camerastatus) { OHOS::Camera::UN_AVAILABLE = 0, OHOS::Camera::AVAILABLE = 1 } | Camera设备状态。 [更多...](_camera.md#camerastatus) | +| [OHOS::Camera::FlashlightStatus](_camera.md#flashlightstatus) : uint32_t { OHOS::Camera::FLASHLIGHT_OFF = 0, OHOS::Camera::FLASHLIGHT_ON = 1, OHOS::Camera::FLASHLIGHT_UNAVAILABLE = 2 } | 闪光灯状态。 [更多...](_camera.md#flashlightstatus) | +| [OHOS::Camera::CameraEvent](_camera.md#cameraevent): uint32_t { OHOS::Camera::CAMERA_EVENT_DEVICE_ADD = 0, OHOS::Camera::CAMERA_EVENT_DEVICE_RMV = 1 } | Camera事件。 [更多...](_camera.md#cameraevent) | +| [OHOS::Camera::ErrorType](_camera.md#errortype) : uint32_t { OHOS::Camera::FATAL_ERROR = 0, OHOS::Camera::REQUEST_TIMEOUT = 1 } | 设备错误类型,用于设备错误回调 **OnError**。 [更多...](_camera.md#errortype) | +| [OHOS::Camera::StreamError](_camera.md#streamerror) { OHOS::Camera::UNKNOWN_ERROR = 0, OHOS::Camera::BUFFER_LOST = 1 } | 流错误类型,用于流错误类型 **CaptureErrorInfo**。 [更多...](_camera.md#streamerror) | + + +## **详细描述** + +Camera模块HDI接口使用的数据类型。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/union_audio_scene_descriptor_1_1_scene_desc.md b/zh-cn/device-dev/reference/hdi-apis/union_audio_scene_descriptor_1_1_scene_desc.md new file mode 100644 index 0000000000000000000000000000000000000000..8de76492ce9026d0aea6c5a71bd5ca2ad479d361 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/union_audio_scene_descriptor_1_1_scene_desc.md @@ -0,0 +1,24 @@ +# AudioSceneDescriptor::SceneDesc + + +## **概述** + +**所属模块:** + +[Audio](_audio.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [id](_audio.md#id) | 音频场景的ID。 | +| [desc](_audio.md#desc-35) | 以字符串命名的音频场景。 | + + +## **详细描述** + +音频场景描述。 diff --git a/zh-cn/device-dev/reference/hdi-apis/union_port_cap.md b/zh-cn/device-dev/reference/hdi-apis/union_port_cap.md new file mode 100644 index 0000000000000000000000000000000000000000..3e1b3f060202249675ae58d842207e63f25152dd --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/union_port_cap.md @@ -0,0 +1,51 @@ +# PortCap + + +## **概述** + +**所属模块:** + +[Codec](_codec.md) + + +## **汇总** + + +### Public 属性 + + | Public 属性 | 描述 | +| -------- | -------- | +| [video](#video) | 视频编解码能力 | +| [audio](#audio) | 音频编解码能力 | + + +## **详细描述** + +定义音视频编解码能力。 + + +## **类成员变量说明** + + +### audio + + +``` +AudioPortCap PortCap::audio +``` + +**描述:** + +音频编解码能力 + + +### video + + +``` +VideoPortCap PortCap::video +``` + +**描述:** + +视频编解码能力 diff --git a/zh-cn/device-dev/reference/hdi-apis/usb__info_8h.md b/zh-cn/device-dev/reference/hdi-apis/usb__info_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..4d075be4d50a0065bee81aa13f8f93b56c68876c --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/usb__info_8h.md @@ -0,0 +1,32 @@ +# usb_info.h + + +## **概述** + +**所属模块:** + +[USB](_u_s_b.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [OHOS::USB::USBDeviceInfo](_o_h_o_s_1_1_u_s_b_1_1_u_s_b_device_info.md) | USB设备信息。 [更多...](_o_h_o_s_1_1_u_s_b_1_1_u_s_b_device_info.md) | +| [OHOS::USB::UsbInfo](_o_h_o_s_1_1_u_s_b_1_1_usb_info.md) | USB设备信息类。 [更多...](_o_h_o_s_1_1_u_s_b_1_1_usb_info.md) | + + +## **详细描述** + +USB驱动订阅模块使用的数据类型。 + +**Since:** + +3.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/usbd__client_8h.md b/zh-cn/device-dev/reference/hdi-apis/usbd__client_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..e8ca6691a0b58d02be9447301431287af1273c80 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/usbd__client_8h.md @@ -0,0 +1,31 @@ +# usbd_client.h + + +## **概述** + +**所属模块:** + +[USB](_u_s_b.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [OHOS::USB::UsbdClient](_o_h_o_s_1_1_u_s_b_1_1_usbd_client.md) | USB驱动类。[更多...](_o_h_o_s_1_1_u_s_b_1_1_usbd_client.md) | + + +## **详细描述** + +声明标准USB驱动接口函数。 + +**Since:** + +3.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/usbd__subscriber_8h.md b/zh-cn/device-dev/reference/hdi-apis/usbd__subscriber_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..5bddc2d6b20509f2b5d0cfd6b7be46ee5503f7b7 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/usbd__subscriber_8h.md @@ -0,0 +1,31 @@ +# usbd_subscriber.h + + +## **概述** + +**所属模块:** + +[USB](_u_s_b.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [OHOS::USB::UsbdSubscriber](_o_h_o_s_1_1_u_s_b_1_1_usbd_subscriber.md) | USB订阅类。[更多...](_o_h_o_s_1_1_u_s_b_1_1_usbd_subscriber.md) | + + +## **详细描述** + +USB驱动订阅模块。 + +**Since:** + +3.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/usbd__type_8h.md b/zh-cn/device-dev/reference/hdi-apis/usbd__type_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..f92f98f0c839f272a744b2ef5dfc9c6cc6bacf2c --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/usbd__type_8h.md @@ -0,0 +1,58 @@ +# usbd_type.h + + +## **概述** + +**所属模块:** + +[USB](_u_s_b.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [OHOS::USB::UsbDev](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) | USB设备。 [更多...](_o_h_o_s_1_1_u_s_b_1_1_usb_dev.md) | +| [OHOS::USB::UsbPipe](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) | 管道信息。 [更多...](_o_h_o_s_1_1_u_s_b_1_1_usb_pipe.md) | +| [OHOS::USB::UsbCtrlTransfer](_o_h_o_s_1_1_u_s_b_1_1_usb_ctrl_transfer.md) | USB控制传输。 [更多...](_o_h_o_s_1_1_u_s_b_1_1_usb_ctrl_transfer.md) | +| [OHOS::USB::USBDeviceInfo](_o_h_o_s_1_1_u_s_b_1_1_u_s_b_device_info.md) | USB设备信息。 [更多...](_o_h_o_s_1_1_u_s_b_1_1_u_s_b_device_info.md) | + + +### 宏定义 + + | 宏定义 | 描述 | +| -------- | -------- | +| [USB_MAX_INTERFACES](_u_s_b.md#usbmaxinterfaces)   32 | USB设备最大接口数量。 | + + +### 类型定义 + + | 类型定义 | 描述 | +| -------- | -------- | +| ([UsbdRequestCallback](_u_s_b.md#usbdrequestcallback)) (uint8_t \*requestArg) | 请求回调函数。 | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [UsbdBulkCbCmd](_u_s_b.md#usbdbulkcbcmd) { CMD_USBD_BULK_CALLBACK_READ, CMD_USBD_BULK_CALLBACK_WRITE } | 批量回调命令字。 [更多...](_u_s_b.md#usbdbulkcbcmd) | +| [UsbdDeviceAction](_u_s_b.md#usbddeviceaction) { ACT_DEVUP = 0, ACT_DEVDOWN, ACT_UPDEVICE, ACT_DOWNDEVICE } | 主机端和设备端插拔事件。 [更多...](_u_s_b.md#usbddeviceaction) | + + +## **详细描述** + +USB驱动模块接口定义中使用的自定义数据类型。 + +USB驱动模块接口定义中使用的自定义数据类型, 包括分发的命令字、数据方向等。 + +**Since:** + +3.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/vibrator__if_8h.md b/zh-cn/device-dev/reference/hdi-apis/vibrator__if_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..29b0c3a7c21a41ed4c0ae62ab3d56da43c59c3ea --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/vibrator__if_8h.md @@ -0,0 +1,39 @@ +# vibrator_if.h + + +## **概述** + +**所属模块:** + +[Vibrator](_vibrator.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [VibratorInterface](_vibrator_interface.md) | 提供Vibrator设备基本控制操作接口。 | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [NewVibratorInterfaceInstance](_vibrator.md#newvibratorinterfaceinstance) (void) | 创建一个VibratorInterface实例。 [更多...](_vibrator.md#newvibratorinterfaceinstance) | +| [FreeVibratorInterfaceInstance](_vibrator.md#freevibratorinterfaceinstance) (void) | 释放VibratorInterface实例以及相关资源。 [更多...](_vibrator.md#freevibratorinterfaceinstance) | + + +## **详细描述** + +定义马达数据结构,包括马达模式和效果振动。 + +**Since:** + +2.2 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/vibrator__type_8h.md b/zh-cn/device-dev/reference/hdi-apis/vibrator__type_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..1abb949a8c7e380abacb367d82feffd85471982d --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/vibrator__type_8h.md @@ -0,0 +1,33 @@ +# vibrator_type.h + + +## **概述** + +**所属模块:** + +[Vibrator](_vibrator.md) + + +## **汇总** + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [VibratorMode](_vibrator.md#vibratormode) { VIBRATOR_MODE_ONCE = 0, VIBRATOR_MODE_PRESET = 1, VIBRATOR_MODE_BUTT } | 枚举马达振动模式。 [更多...](_vibrator.md#vibratormode) | +| [VibratorStatus](_vibrator.md#vibratorstatus) { VIBRATOR_SUCCESS = 0, VIBRATOR_NOT_PERIOD = -1,  VIBRATOR_NOT_INTENSITY  = -2,  VIBRATOR_NOT_FREQUENCY= -3} | 枚举马达振动模式。[更多...](_vibrator.md#vibratorstatus) | +| [VibratorInfo](_vibrator.md#vibratorinfo) { isSupportIntensity, isSupportFrequency, intensityMaxValue, intensityMinValue, frequencyMaxValue, frequencyMinValue} | 定义马达参数。[更多...](_vibrator.md#vibratorinfo) | + + +## **详细描述** + +定义马达数据结构,包括马达模式和效果振动。 + +**Since:** + +2.2 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/wifi__hal_8h.md b/zh-cn/device-dev/reference/hdi-apis/wifi__hal_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..ce0a6c3e0386722de46f68519df51ef20ba04ce5 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/wifi__hal_8h.md @@ -0,0 +1,46 @@ +# wifi_hal.h + + +## **概述** + +**所属模块:** + +[WLAN](_w_l_a_n.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IWiFi](_i_wi_fi.md) | HAL对WLAN服务提供的基本能力。 [更多...](_i_wi_fi.md) | + + +### 类型定义 + + | 类型定义 | 描述 | +| -------- | -------- | +| ([CallbackFunc](_w_l_a_n.md#callbackfunc)) (uint32_t event, void \*data, const char \*ifName) | 定义IWiFi回调函数的原型,监听异步事件。 [更多...](_w_l_a_n.md#callbackfunc) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [WifiConstruct](_w_l_a_n.md#wificonstruct) (struct [IWiFi](_i_wi_fi.md) \*\*wifiInstance) | 创建IWiFi结构体,挂接[IWiFi](_i_wi_fi.md)中能力接口。 [更多...](_w_l_a_n.md#wificonstruct) | +| [WifiDestruct](_w_l_a_n.md#wifidestruct) (struct [IWiFi](_i_wi_fi.md) \*\*wifiInstance) | 销毁IWiFi结构体并释放相关资源。 [更多...](_w_l_a_n.md#wifidestruct) | + + +## **详细描述** + +提供给WLAN服务的WLAN基本能力接口。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/wifi__hal__ap__feature_8h.md b/zh-cn/device-dev/reference/hdi-apis/wifi__hal__ap__feature_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..5070b56b1ba8a62600a9a0486c7125d2ed457e9d --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/wifi__hal__ap__feature_8h.md @@ -0,0 +1,39 @@ +# wifi_hal_ap_feature.h + + +## **概述** + +**所属模块:** + +[WLAN](_w_l_a_n.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [StaInfo](_sta_info.md) | 描述与AP连接的STA的基本信息 [更多...](_sta_info.md) | +| [IWiFiAp](_i_wi_fi_ap.md) | 继承了[IWiFiBaseFeature](_i_wi_fi_base_feature.md)基本特性,并包含AP模式下获取连接STA的信息和设置国家码的功能。 [更多...](_i_wi_fi_ap.md) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [InitApFeature](_w_l_a_n.md#initapfeature) (struct [IWiFiAp](_i_wi_fi_ap.md) \*\*fe) | 初始化AP特性。WLAN服务在创建AP类型的特性[FeatureType](_w_l_a_n.md#featuretype)时调用。 [更多...](_w_l_a_n.md#initapfeature) | + + +## **详细描述** + +提供WLAN的AP特性能力(获取与AP连接的STA的基本信息、设置国家码)。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/wifi__hal__base__feature_8h.md b/zh-cn/device-dev/reference/hdi-apis/wifi__hal__base__feature_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..2507aeda6f531039f93e9db3bcb511b06f6622f3 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/wifi__hal__base__feature_8h.md @@ -0,0 +1,54 @@ +# wifi_hal_base_feature.h + + +## **概述** + +**所属模块:** + +[WLAN](_w_l_a_n.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IWiFiBaseFeature](_i_wi_fi_base_feature.md) | WLAN基本特性操作接口,包括获取网卡名称,设置MAC地址,设置发射功率等公共能力接口。 [更多...](_i_wi_fi_base_feature.md) | + + +### 宏定义 + + | 宏定义 | 描述 | +| -------- | -------- | +| [IFNAME_MAX_LEN](_w_l_a_n.md#ga63637ece87095ff8d153f650434ecf97)   16 | 网卡名称最大长度。 | +| [WIFI_MAC_ADDR_LENGTH](_w_l_a_n.md#ga27ea7645cf89c113dae48346e19a676f)   6 | WLAN的MAC地址长度。 | +| [ERR_UNAUTH_ACCESS](_w_l_a_n.md#gadfe9ac5a374d348cd8f77a84cd5ab94e)   (-6) | 定义访问失败错误码。 | + + +### 枚举 + + | 枚举 | 描述 | +| -------- | -------- | +| [FeatureType](_w_l_a_n.md#featuretype) {   PROTOCOL_80211_IFTYPE_UNSPECIFIED, PROTOCOL_80211_IFTYPE_ADHOC, PROTOCOL_80211_IFTYPE_STATION, PROTOCOL_80211_IFTYPE_AP,   PROTOCOL_80211_IFTYPE_AP_VLAN, PROTOCOL_80211_IFTYPE_WDS, PROTOCOL_80211_IFTYPE_MONITOR, PROTOCOL_80211_IFTYPE_MESH_POINT,   PROTOCOL_80211_IFTYPE_P2P_CLIENT, PROTOCOL_80211_IFTYPE_P2P_GO, PROTOCOL_80211_IFTYPE_P2P_DEVICE, PROTOCOL_80211_IFTYPE_NUM } | 枚举WLAN相关特性的类型[FeatureType](_w_l_a_n.md#featuretype)。 [更多...](_w_l_a_n.md#featuretype) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [InitBaseFeature](_w_l_a_n.md#initbasefeature) (struct [IWiFiBaseFeature](_i_wi_fi_base_feature.md) \*\*fe) | WLAN服务创建任何类型的特性{\@Link FeatureType}时,都需要调用此函数。 [更多...](_w_l_a_n.md#initbasefeature) | + + +## **详细描述** + +提供WLAN基本特性能力。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/reference/hdi-apis/wifi__hal__sta__feature_8h.md b/zh-cn/device-dev/reference/hdi-apis/wifi__hal__sta__feature_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..66cf5f1a520a17a27b8806a589916e124d362d23 --- /dev/null +++ b/zh-cn/device-dev/reference/hdi-apis/wifi__hal__sta__feature_8h.md @@ -0,0 +1,38 @@ +# wifi_hal_sta_feature.h + + +## **概述** + +**所属模块:** + +[WLAN](_w_l_a_n.md) + + +## **汇总** + + +### 类 + + | 类 | 描述 | +| -------- | -------- | +| [IWiFiSta](_i_wi_fi_sta.md) | 继承了[IWiFiBaseFeature](_i_wi_fi_base_feature.md)基本特性,额外包含设置扫描单个MAC地址功能。 [更多...](_i_wi_fi_sta.md) | + + +### 函数 + + | 函数 | 描述 | +| -------- | -------- | +| [InitStaFeature](_w_l_a_n.md#initstafeature) (struct [IWiFiSta](_i_wi_fi_sta.md) \*\*fe) | 初始化STA特性。WLAN服务在创建STA类型的特性[FeatureType](_w_l_a_n.md#featuretype)时调用。 [更多...](_w_l_a_n.md#initstafeature) | + + +## **详细描述** + +提供WLAN的STA特性能力。 + +**Since:** + +1.0 + +**Version:** + +1.0 diff --git a/zh-cn/device-dev/subsystems/subsys-boot.md b/zh-cn/device-dev/subsystems/subsys-boot.md index a8cb1eb6a188955976b1f611fdecb0df56ee9701..41b3d9795d01dbfbc074337e06dc6977dbe474af 100644 --- a/zh-cn/device-dev/subsystems/subsys-boot.md +++ b/zh-cn/device-dev/subsystems/subsys-boot.md @@ -4,7 +4,7 @@ - **[启动恢复子系统概述](subsys-boot-overview.md)** - **[init启动引导组件](subsys-boot-init.md)** -- **[appspawn应用孵化组件](subsys-boot-appspawn.md)** +- **[appspawn应用孵化组件](subsys-boot-appspawn.md)** - **[bootstrap服务启动组件](subsys-boot-bootstrap.md)** - **[syspara系统属性组件](subsys-boot-syspara.md)** - **[常见问题](subsys-boot-faqs.md)** diff --git a/zh-cn/device-dev/subsystems/subsys-build-gn-kconfig-visual-config-guide.md b/zh-cn/device-dev/subsystems/subsys-build-gn-kconfig-visual-config-guide.md index 9aeb519340de37f0183c3e15291d0efcaa7e2234..d6175848914f1bb1caee3cd219fdff1930c7aeaa 100644 --- a/zh-cn/device-dev/subsystems/subsys-build-gn-kconfig-visual-config-guide.md +++ b/zh-cn/device-dev/subsystems/subsys-build-gn-kconfig-visual-config-guide.md @@ -26,11 +26,11 @@ 1. 获取源码 - OpenHarmony版本发布的源码获取请参考:[源码获取教程](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md) + OpenHarmony版本发布的源码获取请参考:[源码获取教程](../get-code/sourcecode-acquire.md) 2. 环境准备 - 环境配置所需要的Kconfiglib已内置在OpenHarmony自带的hb工具中,如需安装hb工具,可参考:[hb安装教程](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-env-setup.md#%E5%AE%89%E8%A3%85hb) + 环境配置所需要的Kconfiglib已内置在OpenHarmony自带的hb工具中,如需安装hb工具,可参考:[hb安装教程](../quick-start/quickstart-lite-env-setup.md#安装hb) 3. 开启可视化配置界面 diff --git a/zh-cn/device-dev/subsystems/subsys-build-mini-lite.md b/zh-cn/device-dev/subsystems/subsys-build-mini-lite.md index 0c18f32304ff90fb79a1a78c7cead94308a77a64..a8cda2618b822f6123d84fe19e687310eb82ef9e 100644 --- a/zh-cn/device-dev/subsystems/subsys-build-mini-lite.md +++ b/zh-cn/device-dev/subsystems/subsys-build-mini-lite.md @@ -629,7 +629,7 @@ optional arguments: # Note: The default toolchain is "ohos-clang". It's not mandatory if you use the default toochain. board_toolchain = "gcc-arm-none-eabi" - # The toolchain path instatlled, it's not mandatory if you have added toolchian path to your ~/.bashrc. + # The toolchain path installed, it's not mandatory if you have added toolchain path to your ~/.bashrc. board_toolchain_path = rebase_path("//prebuilts/gcc/linux-x86/arm/gcc-arm-none-eabi/bin", root_build_dir) diff --git a/zh-cn/device-dev/subsystems/subsys-data-relational-database-guide.md b/zh-cn/device-dev/subsystems/subsys-data-relational-database-guide.md index d45e6a2ed07e5eaffa4798504a231df1c3c0acde..18d44eedce007f87bd76e669dd6f88599e92b9ef 100644 --- a/zh-cn/device-dev/subsystems/subsys-data-relational-database-guide.md +++ b/zh-cn/device-dev/subsystems/subsys-data-relational-database-guide.md @@ -71,7 +71,7 @@ 表5 数据表删除API | 类名 | 接口名 | 描述 | | ---- | ---- | ---- | - | RdbStore | int Delete(int &deletedRows, const AbsRdbPredicates &predicates) | 删除数据。
  • deletedRows:删除的记录条数。
  • predicates:Rdb谓词,指定了删除操作的表名和条件。AbsRdbPredicates的实现类有两个:RdbPredicates和RawRdbPredicates。
    • RdbPredicates:支持调用谓词提供的equalTo等接口,设置更新条件。
    • RawRdbPredicates:仅支持设置表名、where条件子句、whereArgs三个参数,不支持equalTo等接口调用。
| + | RdbStore | int Delete(int &deletedRows, const AbsRdbPredicates &predicates) | 删除数据。
  • deletedRows:删除的记录条数。
  • predicates:Rdb谓词,指定了删除操作的表名和条件。AbsRdbPredicates的实现类有两个:RdbPredicates和RawRdbPredicates。
    • RdbPredicates:支持调用谓词提供的equalTo等接口,设置删除条件。
    • RawRdbPredicates:仅支持设置表名、where条件子句、whereArgs三个参数,不支持equalTo等接口调用。
| - 更新 @@ -92,7 +92,7 @@ 表7 数据表查询API | 类名 | 接口名 | 描述 | | ---- | ---- | ---- | - | RdbStore | std::unique_ptr Query(const AbsRdbPredicates &predicates, const std::vector\ columns) | 查询数据。
  • predicates:谓词,可以设置查询条件。AbsRdbPredicates的实现类有两个:RdbPredicates和RawRdbPredicates。
    • RdbPredicates:支持调用谓词提供的equalTo等接口,设置更新条件。
    • RawRdbPredicates:仅支持设置表名、where条件子句、whereArgs三个参数,不支持equalTo等接口调用。
  • columns:规定查询返回的列。
| + | RdbStore | std::unique_ptr Query(const AbsRdbPredicates &predicates, const std::vector\ columns) | 查询数据。
  • predicates:谓词,可以设置查询条件。AbsRdbPredicates的实现类有两个:RdbPredicates和RawRdbPredicates。
    • RdbPredicates:支持调用谓词提供的equalTo等接口,设置查询条件。
    • RawRdbPredicates:仅支持设置表名、where条件子句、whereArgs三个参数,不支持equalTo等接口调用。
  • columns:规定查询返回的列。
| | RdbStore | std::unique_ptr QuerySql(const std::string &sql, const std::vector\ &selectionArgs = std::vector\()) | 执行原生的用于查询操作的SQL语句。
  • sql:原生用于查询的sql语句。
  • selectionArgs:sql语句中占位符参数的值,若select语句中没有使用占位符,该参数可以设置为null。
| ### 查询结果集的使用 @@ -129,28 +129,28 @@ 用户根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名。 -表9 根据本地表名获取指定远程设备的分布式表名 +表10 根据本地表名获取指定远程设备的分布式表名 | 类名 | 接口名 | 描述 | | ---- | ---- | ---- | | RdbStore | std::string ObtainDistributedTableName(const std::string& device, const std::string& table) | 根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名。
  • device:远程设备ID
  • table:本地表名
### 在设备之间同步数据 -表10 在设备之间同步数据 +表11 在设备之间同步数据 | 类名 | 接口名 | 描述 | | ---- | ---- | ---- | | RdbStore | bool Sync(const SyncOption& option, const AbsRdbPredicates& predicate, const SyncCallback& callback) | 在设备之间同步数据。
  • option:同步选项;mode:同步模式(PUSH表示数据从本地设备推送到远程设备/PULL表示数据从远程设备拉至本地设备);isBlock:是否阻塞
  • callback:指定的callback回调函数
### 注册数据库的观察者 -表10 注册数据库的观察者 +表12 注册数据库的观察者 | 类名 | 接口名 | 描述 | | ---- | ---- | ---- | | RdbStore | bool Subscribe(const SubscribeOption& option, RdbStoreObserver *observer) | 注册数据库的观察者。当分布式数据库中的数据发生更改时,将调用回调。
  • option:订阅类型;
  • observer:指分布式数据库中数据更改事件的观察者
### 从数据库中删除指定类型的指定观察者 -表10 从数据库中删除指定类型的指定观察者 +表13 从数据库中删除指定类型的指定观察者 | 类名 | 接口名 | 描述 | | ---- | ---- | ---- | | RdbStore | bool UnSubscribe(const SubscribeOption& option, RdbStoreObserver *observer) | 从数据库中删除指定类型的指定观察者。
  • option:订阅类型;
  • observer:指已注册的数据更改观察者
@@ -163,7 +163,7 @@ 关系型数据库提供了备份数据库文件的接口,通过databasePath指定的备份文件名(支持路径)备份当前数据库文件。通过返回值判断是否备份成功,成功时返回0,失败时则返回相应的错误码。 - 表11 数据库备份API + 表14 数据库备份API | 类名 | 接口名 | 描述 | | ---- | ---- | ---- | @@ -173,12 +173,24 @@ 关系型数据库提供了恢复数据库文件的接口,通过backupPath指定的备份文件名(支持路径)恢复当前数据库文件。通过返回值判断是否恢复成功,成功时返回0,失败时则返回相应的错误码。 - 表12 数据库恢复API + 表15 数据库恢复API | 类名 | 接口名 | 描述 | | ---- | ---- | ---- | | RdbStore | int Restore(const std::string backupPath, const std::vector<uint8_t> &newKey) | 恢复数据库文件。
  • backupPath:指定的备份文件名。
  • newKey:数据库的加密密钥。注意:当前只支持非加密数据库的恢复。
| +### 事务 + + 事务(Transaction)是一个对数据库执行工作单元。通过返回值判断事务是否成功,成功时返回0,失败时则返回相应的错误码。 + + 表16 事务API + + | 类名 | 接口名 | 描述 | + | ---- | ---- | ---- | + | RdbStore | int BeginTransaction() | 开启一个事务。 | + | RdbStore | int Commit() | 保存更改。 | + | RdbStore | int RollBack() | 回滚所做的更改。 | + ## 约束与限制 无。 diff --git a/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-listening.md b/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-listening.md index 8fe100842ba0de74a06f7add5b5764a8975c9fda..f6f6e92d5fec95b30e7c21bfb31d7474babf1348 100644 --- a/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-listening.md +++ b/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-listening.md @@ -11,7 +11,7 @@ HiSysEvent提供了跨进程订阅机制,开发者可以通过注册订阅接 ### 约束与限制 -在订阅HiSysEvent事件之前,需要先完成HiSysEvent打点配置,具体配置方法请参考[《HiSysEvent打点配置指导》](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-logging-config.md)。 +在订阅HiSysEvent事件之前,需要先完成HiSysEvent打点配置,具体配置方法请参考[《HiSysEvent打点配置指导》](../subsystems/subsys-dfx-hisysevent-logging-config.md)。 ## 开发指导 diff --git a/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-logging-config.md b/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-logging-config.md index 4b7b2ecc30a30d697f4d57e001d9850a3d7841e5..ed9ee462bc0c7aa0c55077c2e3b0f5991292147e 100644 --- a/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-logging-config.md +++ b/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-logging-config.md @@ -6,18 +6,18 @@ ### 功能简介 -组件若有HiSysEvent事件的打点需求,则需要先定义yaml文件并在bundle.js文件中[配置yaml文件的路径](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-logging-config.md#section123181432175135)。OpenHarmony编译框架在编译过程中则会通过python编译脚本解析校验bundle.js文件指定的所有yaml文件。在解析校验之后,编译框架会将这些yaml文件中配置的信息汇总转换成名为hisysevent.def的json文件。最后,将此json文件打包到系统指定路径下,用作HiSysEvent事件落盘的判断依据。 +组件若有HiSysEvent事件的打点需求,则需要先定义yaml文件并在bundle.js文件中[配置yaml文件的路径](subsys-dfx-hisysevent-logging-config.md#配置yaml文件路径)。OpenHarmony编译框架在编译过程中则会通过python编译脚本解析校验bundle.js文件指定的所有yaml文件。在解析校验之后,编译框架会将这些yaml文件中配置的信息汇总转换成名为hisysevent.def的json文件。最后,将此json文件打包到系统指定路径下,用作HiSysEvent事件落盘的判断依据。 ### 基本概念 在配置HiSysEvent打点之前,开发者应了解以下基本概念: -- 事件领域 用于标识事件所属的领域,在yaml文件中以domain为键值指定,可参考yaml文件样例中的[domain](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-logging-config.md#section123181432175123)。 +- 事件领域 用于标识事件所属的领域,在yaml文件中以domain为键值指定,可参考yaml文件样例中的[domain](subsys-dfx-hisysevent-logging-config.md#编写样例)。 -- 事件名称 用于指定事件领域包含的所有事件,可参考yaml文件样例中的[EVENT_NAMEA/EVENT_NAMEB](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-logging-config.md#section123181432175123)。 +- 事件名称 用于指定事件领域包含的所有事件,可参考yaml文件样例中的[EVENT_NAMEA/EVENT_NAMEB](subsys-dfx-hisysevent-logging-config.md#编写样例)。 -- 参数 用于定义某个事件名称包含的所有键值,可参考yaml文件样例中的[__BASE/NAME1/NAME2](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-logging-config.md#section123181432175123)。 +- 参数 用于定义某个事件名称包含的所有键值,可参考yaml文件样例中的[__BASE/NAME1/NAME2](subsys-dfx-hisysevent-logging-config.md#编写样例)。 ### 约束与限制 @@ -71,9 +71,9 @@ - yaml文件样例指定的事件领域名称为MODULEA,该事件领域包含两个事件,名称分别是EVENT_NAMEA和EVENT_NAMEB。 -- EVENT_NAMEA被定义成错误类型的严重事件,该事件包含类型为字符串类型的NAME1参数、字符串类型的NAME2参数及无符号短整型类型的NAME3参数,可以通过事件领域MODULEA和事件名称EVENT_NAMEA对其进行[实时订阅](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-listening.md)。 +- EVENT_NAMEA被定义成错误类型的严重事件,该事件包含类型为字符串类型的NAME1参数、字符串类型的NAME2参数及无符号短整型类型的NAME3参数,可以通过事件领域MODULEA和事件名称EVENT_NAMEA对其进行[实时订阅](../subsystems/subsys-dfx-hisysevent-listening.md)。 -- EVENT_NAMEB被定义成统计类型的一般事件,EVENT_NAMEB包含类型为无符号短整型类型的NAME1参数及整型类型的NAME2参数。因为EVENT_NAMEB在__BASE参数中定义了名称为tag1和tag2的两个事件标签,所以不仅可以通过事件领域MODULEA和事件名称EVENT_NAMEB对其进行[实时订阅](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-listening.md),,所以还可以通过事件标签对该事件进行[实时订阅](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-listening.md)。 +- EVENT_NAMEB被定义成统计类型的一般事件,EVENT_NAMEB包含类型为无符号短整型类型的NAME1参数及整型类型的NAME2参数。因为EVENT_NAMEB在__BASE参数中定义了名称为tag1和tag2的两个事件标签,所以不仅可以通过事件领域MODULEA和事件名称EVENT_NAMEB对其进行[实时订阅](../subsystems/subsys-dfx-hisysevent-listening.md),所以还可以通过事件标签对该事件进行实时订阅。 ``` ########################################## @@ -185,6 +185,6 @@ ### 打点及查询定义的事件 -1. 通过[hdc_std工具](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-toolchain-hdc-guide.md)将hisysevent.def文件推送到至设备的//system/etc/hiview/目录下。 +1. 通过[hdc_std工具](../subsystems/subsys-toolchain-hdc-guide.md)将hisysevent.def文件推送到至设备的//system/etc/hiview/目录下。 -2. 触发yaml文件自定义的HiSysEvent事件完成打点,通过[hisysevent -l](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-tool.md)命令查询历史HiSysEvent事件,确认触发的自定义HiSysEvent事件是否打点成功。 +2. 触发yaml文件自定义的HiSysEvent事件完成打点,通过“[hisysevent -l](../subsystems/subsys-dfx-hisysevent-tool.md)”命令查询历史HiSysEvent事件,确认触发的自定义HiSysEvent事件是否打点成功。 diff --git a/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-logging.md b/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-logging.md index db570a79071efe3eaff95bcf249cda3ac2c94f5f..8be5fe23e2c375fc01002165aff65ce1530e665e 100644 --- a/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-logging.md +++ b/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-logging.md @@ -4,11 +4,11 @@ ### 功能简介 -HiSysEvent打点提供了事件埋点功能,开发者可以通过在关键路径埋点来记录系统在运行过程中的重要信息。 +HiSysEvent打点提供了事件埋点功能,开发者可以通过在关键路径埋点来记录系统在运行过程中的重要信息。同时,HiSysEvent打点也提供了以事件领域为单位的HiSysEvent打点屏蔽机制,方便开发者评估及调试HiSysEvent打点操作的影响。 ### 运作机制 -在进行HiSysEvent事件埋点之前,需要先完成HiSysEvent打点配置,具体配置方法请参考[《HiSysEvent打点配置指导》](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-logging-config.md)。 +在进行HiSysEvent事件埋点之前,需要先完成HiSysEvent打点配置,具体配置方法请参考[《HiSysEvent打点配置指导》](subsys-dfx-hisysevent-logging-config.md)。 ## 开发指导 @@ -22,13 +22,21 @@ HiSysEvent打点提供了事件埋点功能,开发者可以通过在关键路 c++事件埋点开发能力如下:HiSysEvent类,具体的API详见接口文档 。 -**表1** c++事件埋点API接口功能介绍 +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 在OpenHarmony-3.2-Beta3版本中,为避免打点风暴事件引发性能问题,对HiSysEvent打点进行了管控,表1中的HiSysEvent::Write打点API接口被表2中的HiSysEventWrite宏接口取代。HiSysEvent::Write接口已废弃,请使用HiSysEventWrite宏完成HiSysEvent事件打点。 + +**表1** c++事件埋点API接口功能介绍(已废弃) | 接口名 | 描述 | | ------------------------------------------------------------ | ---------------------- | | template<typename... Types> 
static int Write(const std::string &domain, const std::string &eventName, EventType type, Types... keyValues) | 将打点事件数据进行落盘 | - **表2** c++事件类型API接口介绍 +**表2** c++事件埋点API接口功能介绍 +| 接口名 | 描述 | +| ------------------------------------------------------------ | ---------------------- | +| HiSysEventWrite(domain, eventName, type, ...) | 将打点事件数据进行落盘| + + **表3** c++事件类型API接口介绍 | 接口名 | 描述 | | --------- | ------------ | @@ -41,7 +49,7 @@ c++事件埋点开发能力如下:HiSysEvent类,具体的API详见接口文 kernel事件埋点开发能力如下: -**表3** kernel事件埋点API接口功能介绍 +**表4** kernel事件埋点API接口功能介绍 | 接口名 | 描述 | | ------------------------------------------------------------ | ------------------------------------ | @@ -51,7 +59,7 @@ kernel事件埋点开发能力如下: | int hisysevent_put_string(struct hiview_hisysevent *event, const char *key, const char *value); | 将字符串类型的事件参数添加到事件对象 | | int hisysevent_write(struct hiview_hisysevent *event); | 将事件对象数据进行落盘 | -**表4** kernel事件类型API接口介绍 +**表5** kernel事件类型API接口介绍 | 接口名 | 描述 | | --------- | ------------ | @@ -67,7 +75,7 @@ kernel事件埋点开发能力如下: 1. 在需要埋点的地方直接调用埋点接口,并传入相应事件参数即可: ```c++ - HiSysEvent::Write(HiSysEvent::Domain::AAFWK, "START_APP", HiSysEvent::EventType::BEHAVIOR, "APP_NAME", "com.ohos.demo"); + HiSysEventWrite(HiSysEvent::Domain::AAFWK, "START_APP", HiSysEvent::EventType::BEHAVIOR, "APP_NAME", "com.ohos.demo"); ``` #### kernel埋点开发步骤 @@ -100,6 +108,36 @@ kernel事件埋点开发能力如下: hisysevent_destroy(&event); ``` +#### 事件领域屏蔽的步骤 + +1. 在相应的文件中定义名称为“DOMAIN_MASKS”,内容形如“DOMAIN_NAME_1|DOMAIN_NAME_2|...|DOMAIN_NAME_n”,共有三种屏蔽场景: + +- 只屏蔽当前源码文件中的相应事件领域的HiSysEvent打点,在该cpp文件引入hisysevent.h头文件之前定义宏DOMAIN_MASKS即可。 + ```c++ + #define DOMAIN_MASKS "DOMAIN_NAME_1|DOMAIN_NAME_2|...|DOMAIN_NAME_n" + #include "hisysevent.h" + ``` + +- 屏蔽整个模块相应事件领域的HiSysEvent打点,在模块的BUILD.gn文件中定义宏DOMAIN_MASKS即可。 + ```gn + config("module_a"){ + cflags_cc += ["-DDOMAIN_MASKS=\"DOMAIN_NAME_1|DOMAIN_NAME_2|...|DOMAIN_NAME_n\""] + } + ``` + +- 全局屏蔽相应事件领域的HiSysEvent打点,则在/build/config/compiler/BUILD.gn中定义宏DIMAIN_MASKS即可。 + ```gn + cflags_cc += ["-DDOMAIN_MASKS=\"DOMAIN_NAME_1|DOMAIN_NAME_2|...|DOMAIN_NAME_n\""] + ``` + +2. 通过HiSysEventWrite宏完成HiSysEvent打点操作: + ```c++ + constexpr char DOMAIN[] = "DOMAIN_NAME_1"; + const std::string eventName = "EVENT_NAME1"; + OHOS:HiviewDFX::HiSysEvent::EventType eventType = OHOS:HiviewDFX::HiSysEvent::EventType::FAULT; + HiSysEventWrite(domain, eventName, eventType); //因为DOMAIN_NAME_1事件领域已经在DOMAIN_MASKS中定义,所以该HiSysEvent打点不会执行。 + ``` + ### 开发实例 #### c++埋点开发实例 @@ -114,14 +152,13 @@ kernel事件埋点开发能力如下: 2. 在业务模块的应用启动函数StartAbility()中,调用埋点接口并传入对应事件参数: - ```c++ #include "hisysevent.h" int StartAbility() { ... // 其他业务逻辑 - int ret = HiSysEvent::Write(HiSysEvent::Domain::AAFWK, "START_APP", HiSysEvent::EventType::BEHAVIOR, "APP_NAME", "com.ohos.demo"); + int ret = HiSysEventWrite(HiSysEvent::Domain::AAFWK, "START_APP", HiSysEvent::EventType::BEHAVIOR, "APP_NAME", "com.ohos.demo"); ... // 其他业务逻辑 } ``` @@ -132,35 +169,64 @@ kernel事件埋点开发能力如下: 1. 在设备启动函数device_boot()中,构建一个启动事件对象,然后将事件进行上报,最后销毁事件对象。 -```c -#include + ```c + #include + + #include + #include + + int device_boot() + { + ... // 其他业务逻辑 + struct hiview_hisysevent *event = NULL; + int ret = 0; + + event = hisysevent_create("KERNEL", "BOOT", BEHAVIOR); + if (!event) { + pr_err("failed to create event"); + return -EINVAL; + } + ret = hisysevent_put_string(event, "MSG", "This is a test message"); + if (ret != 0) { + pr_err("failed to put sting to event, ret=%d", ret); + goto hisysevent_end; + } + ret = hisysevent_write(event); + + hisysevent_end: + hisysevent_destroy(&event); + ... // 其他业务逻辑 + } + ``` -#include -#include +#### 事件领域屏蔽的开发实例 -int device_boot() -{ +- 假设业务模块中,需要在某个cpp文件中屏蔽名称分别为AAFWK和POWER的事件领域的打点,在该cpp文件引入hisysevent.h头文件之前,定义名称为DOMAIN_MASKS的宏: + ```c++ + + #define DOMAIN_MASKS "AAFWK|POWER" + + #include "hisysevent.h" + ... // 其他业务逻辑 + HiSysEventWrite(OHOS:HiviewDFX::HiSysEvent::Domain::AAFWK, "JS_ERROR", OHOS:HiviewDFX::HiSysEvent::EventType::FAULT, "MODULE", "com.ohos.module"); // 该HiSysEvent打点操作不会执行 ... // 其他业务逻辑 - struct hiview_hisysevent *event = NULL; - int ret = 0; + HiSysEventWrite(OHOS:HiviewDFX::HiSysEvent::Domain::POWER, "POWER_RUNNINGLOCK", OHOS:HiviewDFX::HiSysEvent::EventType::FAULT, "NAME", "com.ohos.module"); // 该HiSysEvent打点操作不会执行 - event = hisysevent_create("KERNEL", "BOOT", BEHAVIOR); - if (!event) { - pr_err("failed to create event"); - return -EINVAL; - } - ret = hisysevent_put_string(event, "MSG", "This is a test message"); - if (ret != 0) { - pr_err("failed to put sting to event, ret=%d", ret); - goto hisysevent_end; + ``` + +- 假设需要在整个业务模块中屏蔽名称分别为AAFWK和POWER的事件领域的打点,在模块的BUILG.gn文件中定义名称为DOMAIN_MASKS的宏: + ```gn + config("module_a") { + ... // 其他配置项 + cflags_cc += ["-DDOMAIN_MASKS=\"AAFWK|POWER\""] } - ret = hisysevent_write(event); + ``` -hisysevent_end: - hisysevent_destroy(&event); - ... // 其他业务逻辑 -} -``` +- 假设需要在整个系统中屏蔽名称分别为AAFWK和POWER的事件领域的打点,则直接在/build/config/compiler/BUILD.gn文件中定义名称为DOMAIN_MASKS的宏: + ```gn + ... // 其他配置项 + cflags_cc += ["-DDOMAIN_MASKS=\"AAFWK|POWER\""] + ``` # 参考 diff --git a/zh-cn/device-dev/subsystems/subsys-ota-guide.md b/zh-cn/device-dev/subsystems/subsys-ota-guide.md index 0f373114da8e29832ea543f4f5d527903fe7596d..94cb6dc08681e15e04045f6f2a64fab7992de870 100644 --- a/zh-cn/device-dev/subsystems/subsys-ota-guide.md +++ b/zh-cn/device-dev/subsystems/subsys-ota-guide.md @@ -273,7 +273,7 @@ OTA(Over the Air)提供对设备远程升级的能力,可以让您的设 - API的使用方法,见本文“API应用场景”和API文档的OTA接口章节。 - 如果需要适配开发板,请参考HAL层头文件:base\update\ota_lite\hals\hal_hota_board.h。 -2. 标准系统请参考[JS参考规范](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-update.md)指导中的升级接口参考规范。 +2. 标准系统请参考[JS参考规范](../../application-dev/reference/apis/js-apis-update.md)指导中的升级接口参考规范。 ## API应用场景-默认场景 diff --git a/zh-cn/device-dev/subsystems/subsys-testguide-test.md b/zh-cn/device-dev/subsystems/subsys-testguide-test.md index 7b10a0a98117ba588f416673e36b0f15f71e5f74..a11367525b5348f0dd1028c56b5c8f8f0f0ef981 100644 --- a/zh-cn/device-dev/subsystems/subsys-testguide-test.md +++ b/zh-cn/device-dev/subsystems/subsys-testguide-test.md @@ -758,7 +758,7 @@ subsystem # 子系统 当选择完产品形态,可参考如下指令执行测试用例。 ``` - run -t UT -ts CalculatorSubTest -tc interger_sub_00l + run -t UT -ts CalculatorSubTest -tc integer_sub_00l ``` 执行命令参数说明: ``` @@ -798,7 +798,7 @@ subsystem # 子系统 测试框架在执行用例时会根据指令找到所需用例,自动实现用例编译,执行过程,完成自动化测试。 ``` - run -t UT -ts CalculatorSubTest -tc interger_sub_00l + run -t UT -ts CalculatorSubTest -tc integer_sub_00l ``` 执行命令参数说明: ``` diff --git a/zh-cn/device-dev/website.md b/zh-cn/device-dev/website.md index b61d2426878270c36e0c0efcc9724c7cf87019db..e39707abac668b44550adac242da6c51e39dbf5d 100644 --- a/zh-cn/device-dev/website.md +++ b/zh-cn/device-dev/website.md @@ -97,6 +97,7 @@ - [参考信息](quick-start/quickstart-standard-reference.md) - [使用HiTool烧录代码](quick-start/quickstart-standard-hitool.md) - [编译形态整体说明](quick-start/quickstart-build.md) + - [获取源码](get-code/sourcecode-acquire.md) - 兼容性与安全 diff --git "a/zh-cn/readme/AI\344\270\232\345\212\241\345\255\220\347\263\273\347\273\237.md" "b/zh-cn/readme/AI\344\270\232\345\212\241\345\255\220\347\263\273\347\273\237.md" index 5e892c843c39341685aead1070b36df0d0b32702..50fa8c9cec1fdda474e58ebd020eaf85343af346 100644 --- "a/zh-cn/readme/AI\344\270\232\345\212\241\345\255\220\347\263\273\347\273\237.md" +++ "b/zh-cn/readme/AI\344\270\232\345\212\241\345\255\220\347\263\273\347\273\237.md" @@ -84,7 +84,7 @@ AI业务子系统是OpenHarmony提供原生的分布式AI能力的子系统。 ``` #include "plugin/i_plugin.h - class KWSPlugin : public IPlugin { # Keywords Spotting Plugin(KWSPlugin)继承IPlugin算法插件基类public: + class KWSPlugin : public IPlugin { // Keywords Spotting Plugin(KWSPlugin)继承IPlugin算法插件基类public: KWSPlugin(); ~KWSPlugin(); diff --git "a/zh-cn/readme/\345\206\205\346\240\270\345\255\220\347\263\273\347\273\237.md" "b/zh-cn/readme/\345\206\205\346\240\270\345\255\220\347\263\273\347\273\237.md" old mode 100755 new mode 100644 index 747c945ffd6b5c074942072a1bcff0081fc50e1e..53e16d1b619e6bfa1c38136b3a12598a0b6f9501 --- "a/zh-cn/readme/\345\206\205\346\240\270\345\255\220\347\263\273\347\273\237.md" +++ "b/zh-cn/readme/\345\206\205\346\240\270\345\255\220\347\263\273\347\273\237.md" @@ -75,18 +75,23 @@ kernel/ │ ├── linux-4.19 # OpenHarmony linux-4.19 Common kernel │ ├── linux-5.10 # OpenHarmony linux-5.10 Common kernel │ ├── build -│ │ ├── BUILD.gn # 编译框架GN文件 +│ │ ├── BUILD.gn # 编译框架GN文件 │ │ ├── kernel.mk # 内核编译文件 │ │ └── ohos.build # 内核编译组件文件 │ ├── patches │ │ ├── linux-4.19 # linux-4.19 相关patch +│ │ │   ├── common_patch +│ │ │   │ └── hdf.patch # linux-4.19 HDF patches │ │ │   └── hi3516dv300_patch -│ │ │   ├── hi3516dv300.patch # linux-4.19 hi3516dv300 SOC patch -│ │ │   └── hdf.patch # linux-4.19 hi3516dv300 hdf patch +│ │ │   └── hi3516dv300.patch # linux-4.19 Hi3516D V300 SOC patches │ │ └── linux-5.10 +│ │    ├── common_patch +│ │    │ └── hdf.patch # linux-5.10 HDF patches │ │    └── hi3516dv300_patch -│ │    ├── hi3516dv300.patch # linux-5.10 hi3516dv300 SOC patch -│ │    └── hdf.patch # linux-5.10 hi3516dv300 hdf patch +│ │    │ └── hi3516dv300.patch # linux-5.10 Hi3516D V300 SOC patches +│ │    └── rkrk3568_patch +│ │    ├── kernel.patch # linux-5.10 rk3568 SOC patches +│ │    └── hdf.patch # linux-5.10 rk3568 定制 HDF patches │ └── config │ ├── linux-4.19 │ │   └── arch @@ -162,7 +167,7 @@ Hi3518EV300默认使用jffs2文件系统,Hi3516DV300默认使用FAT文件系 在kernel/linux/build仓中,按照kernel.mk中HDF的补丁合入方法,合入不同内核版本对应的HDF内核补丁: ``` - $(OHOS_BUILD_HOME)/drivers/adapter/khdf/linux/patch_hdf.sh $(OHOS_BUILD_HOME) $(KERNEL_SRC_TMP_PATH) $(HDF_PATCH_FILE) + $(OHOS_BUILD_HOME)/drivers/hdf_core/adapter/khdf/linux/patch_hdf.sh $(OHOS_BUILD_HOME) $(KERNEL_SRC_TMP_PATH) $(KERNEL_PATCH_PATH) $(DEVICE_NAME) ``` 2. 合入芯片平台驱动补丁 diff --git a/zh-cn/release-notes/OpenHarmony-v3.0.5-LTS.md b/zh-cn/release-notes/OpenHarmony-v3.0.5-LTS.md new file mode 100644 index 0000000000000000000000000000000000000000..e5455a0cddd1a108ccc2c3c3a1ded6a627242e63 --- /dev/null +++ b/zh-cn/release-notes/OpenHarmony-v3.0.5-LTS.md @@ -0,0 +1,136 @@ +# OpenHarmony 3.0.5 LTS + + +## 版本概述 + +此版本为OpenHarmony-3.0-LTS分支上的维护版本,基于OpenHarmony-v3.0.3-LTS版本修复一些缺陷及安全问题,并更新支持以下能力: + +**轻量系统能力增强** + +DFX提供native崩溃信息采集能力和整机重启故障检测定位能力。基础通信增加STA基础能力。 + + +## 配套关系 + + **表1** 版本软件和工具配套关系 + +| 软件 | 版本 | 备注 | +| -------- | -------- | -------- | +| OpenHarmony | 3.0.5 LTS | NA | +| HUAWEI DevEco Studio(可选) | 3.0 Beta1 | OpenHarmony应用开发推荐使用。 | +| HUAWEI DevEco Device Tool(可选) | 2.2 Beta2 | OpenHarmony智能设备集成开发环境推荐使用。 | + + +## 源码获取 + + +### 前提条件 + +1. 注册码云gitee账号。 + +2. 注册码云SSH公钥,请参考[码云帮助中心](https://gitee.com/help/articles/4191)。 + +3. 安装[git客户端](https://gitee.com/link?target=https%3A%2F%2Fgit-scm.com%2Fbook%2Fzh%2Fv2%2F%25E8%25B5%25B7%25E6%25AD%25A5-%25E5%25AE%2589%25E8%25A3%2585-Git)和[git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading)并配置用户信息。 + + ``` + git config --global user.name "yourname" + git config --global user.email "your-email-address" + git config --global credential.helper store + ``` + +4. 安装码云repo工具,可以执行如下命令。 + + ``` + curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo #如果没有权限,可下载至其他目录,并将其配置到环境变量中chmod a+x /usr/local/bin/repo + pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests + ``` + + +### 通过repo获取 + +**方式一(推荐)**:通过repo + ssh 下载(需注册公钥,请参考[码云帮助中心](https://gitee.com/help/articles/4191))。 + + +``` +repo init -u git@gitee.com:openharmony/manifest.git -b refs/tags/OpenHarmony-v3.0.5-LTS --no-repo-verify +repo sync -c +repo forall -c 'git lfs pull' +``` + +**方式二**:通过repo + https 下载。 + + +``` +repo init -u https://gitee.com/openharmony/manifest.git -b refs/tags/OpenHarmony-v3.0.5-LTS --no-repo-verify +repo sync -c +repo forall -c 'git lfs pull' +``` + + +### 从镜像站点获取 + + **表2** 获取源码路径 + +| **LTS版本源码** | **版本信息** | **下载站点** | **SHA256校验码** | +| -------- | -------- | -------- | -------- | +| 全量代码(标准、轻量和小型系统) | 3.0.5 | [站点](https://repo.huaweicloud.com/openharmony/os/3.0.5/code-v3.0.5-LTS.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.0.5/code-v3.0.5-LTS.tar.gz.sha256) | +| 标准系统Hi3516解决方案(二进制) | 3.0.5 | [站点](https://repo.huaweicloud.com/openharmony/os/3.0.5/standard.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.0.5/standard.tar.gz.sha256) | +| 轻量系统Hi3861解决方案(二进制) | 3.0.5 | [站点](https://repo.huaweicloud.com/openharmony/os/3.0.5/hispark_pegasus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.0.5/hispark_pegasus.tar.gz.sha256) | +| 小型系统Hi3516解决方案-LiteOS(二进制) | 3.0.5 | [站点](https://repo.huaweicloud.com/openharmony/os/3.0.5/hispark_taurus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.0.5/hispark_taurus.tar.gz.sha256) | +| 小型系统Hi3516解决方案-Linux(二进制) | 3.0.5 | [站点](https://repo.huaweicloud.com/openharmony/os/3.0.5/hispark_taurus_linux.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.0.5/hispark_taurus_linux.tar.gz.sha256) | + + +## 更新说明 + + +### 特性变更 + + **表3** 版本新增特性表 + +| 子系统名称 | 标准系统 | 轻量、小型系统 | +| -------- | -------- | -------- | +| 基础通信子系统 | NA | Linux版小型系统增加STA基础能力。
主要涉及如下需求:
I5AAFQ  支持WIFI开关,扫描、连接、自动重连等STA特性的编译使能。
I5AAFQ  STA连接支持动态获取IPv4地址能力的编译使能。 | +| DFX子系统 | NA | Linux版小型系统提供native崩溃信息采集能力和整机重启故障检测定位能力。
主要涉及如下需求:
I57I8Y/I57TOE  提供native崩溃信息采集能力。
I5C0QR 在linux5.10上提供整机重启故障检测定位能力。 | + + +### API变更 + +此版本不涉及API变更。 + + +### 芯片及开发板适配 + +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 + + +## 修复缺陷列表 + + **表4** 解决的缺陷ISSUE列表 + +| ISSUE单号 | 问题描述 | +| -------- | -------- | +| [I4YBB0](https://gitee.com/openharmony/multimedia_camera_lite/issues/I4YBB0) | 小型系统3516DV300-Linux在系统相机拍照录像后,无图片生成,录制的视频无法播放。 | +| [I4YB87](https://gitee.com/openharmony/multimedia_camera_lite/issues/I4YB87) | 小型系统3516DV300-Linux在系统相机拍照录像后,图库中无显示。 | +| [I4YAGS](https://gitee.com/openharmony/multimedia_camera_lite/issues/I4YAGS?from=project-issue) | 小型系统3516DV300-Linux进入系统相机,画面蓝屏。 | +| [I59FZ7](https://gitee.com/openharmony/telephony_core_service/issues/I59FZ7) | 标准系统电话测试用例无法进行测试验证。 | +| [I4Z2MI](https://gitee.com/openharmony/xts_acts/issues/I4Z2MI) | 标准系统执行acts测试用例异常,actsWifiJSApiTest、ActsHotSpotJSApiTest、ActsP2PJSApiTest模块用例全部失败。 | + + +## 修复安全漏洞列表 + +如下漏洞为本项目组内上报漏洞,漏洞修复补丁及受影响版本详情请参考社区[安全漏洞披露](https://gitee.com/openharmony/security/tree/master/zh/security-disclosure/2022)。 + + **表5** 修复的安全漏洞列表 + +| 漏洞编号 | 漏洞描述 | 漏洞影响 | 受影响的仓库 | +| -------- | -------- | -------- | -------- | +| OpenHarmony-SA-2022-0501 | 软总线子系统存在堆溢出漏洞。 | 攻击者可在本地发起攻击,造成内存访问越界,可获取系统控制权。 | communication_dsoftbus | +| OpenHarmony-SA-2022-0502 | 软总线子系统在接收TCP消息时存在堆溢出漏洞。 | 攻击者可在局域网内发起攻击,进行远程代码执行,获得系统控制权。 | communication_dsoftbus | +| OpenHarmony-SA-2022-0503 | 软总线处理设备同步消息时存在越界访问漏洞。 | 攻击者可在局域网内发起攻击,可造成内存访问越界,造成DoS攻击。 | communication_dsoftbus | +| OpenHarmony-SA-2022-0504 | Lock类包含的一个指针成员存在重复释放问题。 | 攻击者可在本地发起攻击,可获取系统控制权。 | global_resmgr_standard | +| OpenHarmony-SA-2022-0601 | 事件通知子系统反序列化对象时会绕过认证机制。 | 攻击者可在本地发起攻击,造成权限绕过,导致服务端进程崩溃。 | notification_ces_standard | +| OpenHarmony-SA-2022-0602 | 事件通知子系统存在校验绕过漏洞,可发起SA中继攻击。 | 攻击者可在本地发起攻击,造成校验绕过,获得系统控制权。 | notification_ces_standard | +| OpenHarmony-SA-2022-0603 | 升级服务组件存在校验绕过漏洞,可发起SA中继攻击。 | 攻击者可在本地发起攻击,造成校验绕过,获得系统控制权。 | update_updateservice | +| OpenHarmony-SA-2022-0604 | 多媒体子系统存在校验绕过漏洞,可发起SA中继攻击。 | 攻击者可在本地发起攻击,造成校验绕过,获取系统控制权。 | multimedia_media_standard | + + diff --git a/zh-cn/release-notes/Readme.md b/zh-cn/release-notes/Readme.md index 8f7f5277d88eba79c132647dfe9fe3d8e3f73a78..039f8b8a71379a2d4da00a665f71cc8da7e093fc 100644 --- a/zh-cn/release-notes/Readme.md +++ b/zh-cn/release-notes/Readme.md @@ -4,6 +4,7 @@ - [OpenHarmony v3.1.1 Release (2022-05-31)](OpenHarmony-v3.1.1-release.md) - [OpenHarmony v3.1 Release (2022-03-30)](OpenHarmony-v3.1-release.md) - [OpenHarmony v3.1 Beta (2021-12-31)](OpenHarmony-v3.1-beta.md) +- [OpenHarmony v3.0.5 LTS (2022-07-01)](OpenHarmony-v3.0.5-LTS.md) - [OpenHarmony v3.0.3 LTS (2022-04-08)](OpenHarmony-v3.0.3-LTS.md) - [OpenHarmony v3.0.2 LTS (2022-03-18)](OpenHarmony-v3.0.2-LTS.md) - [OpenHarmony v3.0.1 LTS (2022-01-12)](OpenHarmony-v3.0.1-LTS.md)